mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-17 07:10:48 +03:00
возможность указывать короткую запись при делегировании шаблонов из плагинов
This commit is contained in:
parent
a50e73be74
commit
aa83293766
|
@ -45,7 +45,7 @@ abstract class ActionPlugin extends Action {
|
|||
* @return string
|
||||
*/
|
||||
public function getTemplatePathPlugin() {
|
||||
if(is_null($this->sTemplatePathPlugin)) {
|
||||
if(is_null($this->sTemplatePathPlugin)) {
|
||||
preg_match('/^Plugin([\w]+)_Action([\w]+)$/i',$this->GetActionClass(),$aMatches);
|
||||
/**
|
||||
* Проверяем в списке шаблонов
|
||||
|
|
|
@ -68,7 +68,7 @@ abstract class Plugin extends Object {
|
|||
/**
|
||||
* Считываем данные из XML файла описания
|
||||
*/
|
||||
$sPluginXML = Config::Get('path.root.server').'/plugins/'.$sPluginName.'/'.LsPlugin::PLUGIN_README_FILE;
|
||||
$sPluginXML = Config::Get('path.root.server').'/plugins/'.$sPluginName.'/'.LsPlugin::PLUGIN_XML_FILE;
|
||||
if($oXml = @simplexml_load_file($sPluginXML)) {
|
||||
foreach($aObjects as $sObjectName) {
|
||||
if(is_array($data=$oXml->xpath("delegate/{$sObjectName}/item"))) {
|
||||
|
@ -81,7 +81,15 @@ abstract class Plugin extends Object {
|
|||
* Если не указан делегат TO, считаем, что делегатом является
|
||||
* одноименный объект текущего плагина
|
||||
*/
|
||||
if(!$aDelegate->to) $aDelegate->to = get_class($this).'_'.$aDelegate->from;
|
||||
if ($sObjectName=='template') {
|
||||
if(!$aDelegate->to) {
|
||||
$aDelegate->to = $this->GetTemplatePath(get_class($this)).$aDelegate->from;
|
||||
} else {
|
||||
$aDelegate->to=preg_replace("/^_/",$this->GetTemplatePath(get_class($this)),$aDelegate->to);
|
||||
}
|
||||
} else {
|
||||
if(!$aDelegate->to) $aDelegate->to = get_class($this).'_'.$aDelegate->from;
|
||||
}
|
||||
$this->Plugin_Delegate($sObjectName,$aDelegate->from,$aDelegate->to,get_class($this));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class LsPlugin extends Module {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
const PLUGIN_README_FILE = 'plugin.xml';
|
||||
const PLUGIN_XML_FILE = 'plugin.xml';
|
||||
/**
|
||||
* Путь к директории с плагинами
|
||||
*
|
||||
|
@ -84,7 +84,7 @@ class LsPlugin extends Module {
|
|||
/**
|
||||
* Считываем данные из XML файла описания
|
||||
*/
|
||||
$sPluginXML = $this->sPluginsDir.$sPlugin.'/'.self::PLUGIN_README_FILE;
|
||||
$sPluginXML = $this->sPluginsDir.$sPlugin.'/'.self::PLUGIN_XML_FILE;
|
||||
if($oXml = @simplexml_load_file($sPluginXML)) {
|
||||
/**
|
||||
* Обрабатываем данные, считанные из XML-описания
|
||||
|
|
Loading…
Reference in a new issue