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

Изменена XML-разметка для нескольких языков.

This commit is contained in:
Alexey Kachayev 2010-02-09 15:53:06 +00:00
parent 0e8ca8b89a
commit daa892f905
2 changed files with 22 additions and 25 deletions

View file

@ -90,18 +90,10 @@ class LsPlugin extends Module {
* Обрабатываем данные, считанные из 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));
$this->Xlang($oXml,'name',$sLang);
$this->Xlang($oXml,'author',$sLang);
$this->Xlang($oXml,'description',$sLang);
$oXml->homepage=$this->Text_Parser($oXml->homepage);
$this->aPluginsList[$sPlugin]['property']=$oXml;
@ -111,6 +103,21 @@ class LsPlugin extends Module {
return $this->aPluginsList;
}
/**
* Получает значение параметра из XML на основе языковой разметки
*
* @param SimpleXMLElement $oXml
* @param string $sProperty
* @param string $sLang
*/
protected function Xlang($oXml,$sProperty,$sLang) {
$sProperty=trim($sProperty);
$oXml->$sProperty->data = count($data=$oXml->xpath("{$sProperty}/lang[@name='{$sLang}']"))
? $this->Text_Parser(trim((string)array_shift($data)))
: $this->Text_Parser(trim((string)array_shift($oXml->xpath("{$sProperty}/lang[@name='default']"))));
}
public function Toggle($sPlugin,$sAction) {
$aPlugins=$this->GetList();
if(!isset($aPlugins[$sPlugin])) return null;

View file

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