1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-17 07:10:48 +03:00

Поддержка нескольких языков в файле plugin.xml (секция <lang> соответствующего параметра).

This commit is contained in:
Alexey Kachayev 2010-02-08 18:07:28 +00:00
parent 31ba1c5795
commit 3d978c52be
3 changed files with 40 additions and 7 deletions

View file

@ -85,8 +85,26 @@ class LsPlugin extends Module {
* Считываем данные из XML файла описания
*/
$sPluginXML = $this->sPluginsDir.$sPlugin.'/'.self::PLUGIN_README_FILE;
if($this->aPluginsList[$sPlugin]['property'] = @simplexml_load_file($sPluginXML)) {
$this->aPluginsList[$sPlugin]['property']->homepage=$this->Text_Parser($this->aPluginsList[$sPlugin]['property']->homepage);
if($oXml = @simplexml_load_file($sPluginXML)) {
/**
* Обрабатываем данные, считанные из XML-описания
*/
$sLang=$this->Lang_GetLang();
$oXml->name->data = count($aName=$oXml->xpath("name/lang/{$sLang}"))
? $this->Text_Parser(trim(array_shift($aName)))
: $this->Text_Parser(trim($oXml->name->data));
$oXml->author->data = count($aAuthor=$oXml->xpath("author/lang/{$sLang}"))
? $this->Text_Parser(trim(array_shift($aAuthor)))
: $this->Text_Parser(trim($oXml->author->data));
$oXml->description->data = count($aDescription=$oXml->xpath("description/lang/{$sLang}"))
? $this->Text_Parser(trim(array_shift($aDescription)))
: $this->Text_Parser(trim($oXml->description->data));
$oXml->homepage=$this->Text_Parser($oXml->homepage);
$this->aPluginsList[$sPlugin]['property']=$oXml;
}
}

View file

@ -1,7 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<name>Livestreet Profiler Plugin</name>
<author>LiveStreet Developers Team</author>
<name>
<data>
Livestreet Profiler Plugin
</data>
</name>
<author>
<data>
LiveStreet Developers Team
</data>
</author>
<homepage>http://livestreet.ru/</homepage>
<version>1.0.0</version>
<requires>
@ -11,7 +19,14 @@
</plugins>
</requires>
<description>
Профилирование работы движка LiveStreet-движка.
<data>
Профилирование работы движка LiveStreet-движка.
</data>
<lang>
<english>
Profiling the engine`s working.
</english>
</lang>
</description>
<delegate>
<module></module>

View file

@ -18,9 +18,9 @@
{foreach from=$aPlugins item=aPlugin}
<tr>
<td><input type="checkbox" name="plugin_del[{$aPlugin.code}]" class="form_plugins_checkbox"></td>
<td class="name"><a class="title">{$aPlugin.property->name|escape:'html'}</a><br />{$aPlugin.property->description|escape:'html'}<br />{$aPlugin.property->homepage}</td>
<td class="name"><a class="title">{$aPlugin.property->name->data|escape:'html'}</a><br />{$aPlugin.property->description->data|escape:'html'}<br />{$aPlugin.property->homepage}</td>
<td class="version">{$aPlugin.property->version|escape:'html'}</td>
<td class="author">{$aPlugin.property->author|escape:'html'}</td>
<td class="author">{$aPlugin.property->author->data|escape:'html'}</td>
<td class="{if $aPlugin.is_active}deactivate{else}activate{/if}"><strong>{if $aPlugin.is_active}<a href="{router page='admin'}plugins/?plugin={$aPlugin.code}&action=deactivate">{$aLang.plugins_plugin_deactivate}</a>{else}<a href="{router page='admin'}plugins/?plugin={$aPlugin.code}&action=activate">{$aLang.plugins_plugin_activate}</a>{/if}</strong></td>
</tr>
{/foreach}