mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-01 05:55:02 +03:00
Ticket #213
This commit is contained in:
parent
4fb88243db
commit
23c189b7a6
|
@ -88,6 +88,12 @@ class Engine extends Object {
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
const CI_INHERIT = 128;
|
const CI_INHERIT = 128;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Имя блока
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
const CI_BLOCK = 256;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Префикс плагина
|
* Префикс плагина
|
||||||
|
@ -122,10 +128,10 @@ class Engine extends Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Объекты
|
* Объекты
|
||||||
* CI_ACTION | CI_MAPPER | CI_HOOK | CI_PLUGIN | CI_ACTION | CI_MODULE | CI_ENTITY
|
* CI_ACTION | CI_MAPPER | CI_HOOK | CI_PLUGIN | CI_ACTION | CI_MODULE | CI_ENTITY | CI_BLOCK
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
const CI_OBJECT = 95;
|
const CI_OBJECT = 351 ;
|
||||||
|
|
||||||
static protected $oInstance=null;
|
static protected $oInstance=null;
|
||||||
|
|
||||||
|
@ -763,6 +769,12 @@ class Engine extends Object {
|
||||||
? $aMatches[1]
|
? $aMatches[1]
|
||||||
: null
|
: null
|
||||||
;
|
;
|
||||||
|
}
|
||||||
|
if($iFlag & self::CI_BLOCK){
|
||||||
|
$aResult[self::CI_BLOCK] = preg_match('/^(?:Plugin[^_]+_|)Block([^_]+)$/',$sClassName,$aMatches)
|
||||||
|
? $aMatches[1]
|
||||||
|
: null
|
||||||
|
;
|
||||||
}
|
}
|
||||||
if($iFlag & self::CI_METHOD){
|
if($iFlag & self::CI_METHOD){
|
||||||
$sModuleName = isset($aResult[self::CI_MODULE])
|
$sModuleName = isset($aResult[self::CI_MODULE])
|
||||||
|
@ -890,6 +902,18 @@ class Engine extends Object {
|
||||||
// Хук ядра
|
// Хук ядра
|
||||||
$sPath .= 'classes/hooks/Hook'.$aInfo[self::CI_HOOK].'.class.php';
|
$sPath .= 'classes/hooks/Hook'.$aInfo[self::CI_HOOK].'.class.php';
|
||||||
}
|
}
|
||||||
|
}elseif($aInfo[self::CI_BLOCK]){
|
||||||
|
// Блок
|
||||||
|
if($aInfo[self::CI_PLUGIN]){
|
||||||
|
// Блок плагина
|
||||||
|
$sPath .= 'plugins/'.strtolower($aInfo[self::CI_PLUGIN])
|
||||||
|
.'/classes/blocks/Block'.$aInfo[self::CI_BLOCK]
|
||||||
|
.'.class.php';
|
||||||
|
;
|
||||||
|
}else{
|
||||||
|
// Блок ядра
|
||||||
|
$sPath .= 'classes/blocks/Block'.$aInfo[self::CI_BLOCK].'.class.php';
|
||||||
|
}
|
||||||
}elseif($aInfo[self::CI_PLUGIN]){
|
}elseif($aInfo[self::CI_PLUGIN]){
|
||||||
// Плагин
|
// Плагин
|
||||||
$sPath .= 'plugins/'.strtolower($aInfo[self::CI_PLUGIN])
|
$sPath .= 'plugins/'.strtolower($aInfo[self::CI_PLUGIN])
|
||||||
|
|
|
@ -50,7 +50,8 @@ class ModulePlugin extends Module {
|
||||||
'mapper' => array(),
|
'mapper' => array(),
|
||||||
'action' => array(),
|
'action' => array(),
|
||||||
'entity' => array(),
|
'entity' => array(),
|
||||||
'template' => array()
|
'template' => array(),
|
||||||
|
'block' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -418,10 +419,10 @@ class ModulePlugin extends Module {
|
||||||
* @param string $sFrom
|
* @param string $sFrom
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function GetDelegate($sType,$sFrom) {
|
public function GetDelegate($sType,$sFrom) {
|
||||||
if (isset($this->aDelegates[$sType][$sFrom]['delegate'])) {
|
if (isset($this->aDelegates[$sType][$sFrom]['delegate'])) {
|
||||||
return $this->aDelegates[$sType][$sFrom]['delegate'];
|
return $this->aDelegates[$sType][$sFrom]['delegate'];
|
||||||
} elseif ($aInherit=$this->GetLastInherit($sFrom)) {
|
} elseif ($aInherit=$this->GetLastInherit($sFrom)) {
|
||||||
return $aInherit['inherit'];
|
return $aInherit['inherit'];
|
||||||
}
|
}
|
||||||
return $sFrom;
|
return $sFrom;
|
||||||
|
|
|
@ -36,14 +36,15 @@ function smarty_insert_block($aParams,&$oSmarty) {
|
||||||
require_once(Config::Get('path.root.server').'/engine/classes/ActionPlugin.class.php');
|
require_once(Config::Get('path.root.server').'/engine/classes/ActionPlugin.class.php');
|
||||||
|
|
||||||
$sBlockTemplate = Plugin::GetTemplatePath($aParams['params']['plugin']).'/block.'.$aParams['block'].'.tpl';
|
$sBlockTemplate = Plugin::GetTemplatePath($aParams['params']['plugin']).'/block.'.$aParams['block'].'.tpl';
|
||||||
$sBlockClass = Config::Get('path.root.server').'/plugins/'.$aParams['params']['plugin'].'/classes/blocks/Block'.$sBlock.'.class.php';
|
$sBlock ='Plugin'.ucfirst($aParams['params']['plugin']).'_'.$sBlock;
|
||||||
$sCmd='$oBlock=new Plugin'.ucfirst($aParams['params']['plugin']).'_Block'.$sBlock.'($aParamsBlock);';
|
$sCmd='$oBlock=new Plugin'.ucfirst($aParams['params']['plugin']).'_Block'.$sBlock.'($aParamsBlock);';
|
||||||
} else {
|
} else {
|
||||||
$sBlockTemplate = Engine::getInstance()->Plugin_GetDelegate('template','block.'.$aParams['block'].'.tpl');
|
$sBlockTemplate = Engine::getInstance()->Plugin_GetDelegate('template','block.'.$aParams['block'].'.tpl');
|
||||||
$sBlockClass = Config::Get('path.root.server').'/classes/blocks/Block'.$sBlock.'.class.php';
|
|
||||||
$sCmd='$oBlock=new Block'.$sBlock.'($aParamsBlock);';
|
$sCmd='$oBlock=new Block'.$sBlock.'($aParamsBlock);';
|
||||||
}
|
}
|
||||||
|
$sBlock=Engine::getInstance()->Plugin_GetDelegate('block','Block'.$sBlock);
|
||||||
|
|
||||||
|
|
||||||
if (!isset($aParams['block']) or !$oSmarty->templateExists($sBlockTemplate)) {
|
if (!isset($aParams['block']) or !$oSmarty->templateExists($sBlockTemplate)) {
|
||||||
$oSmarty->trigger_error("Not found template for block: ".$sBlockTemplate);
|
$oSmarty->trigger_error("Not found template for block: ".$sBlockTemplate);
|
||||||
return ;
|
return ;
|
||||||
|
@ -58,8 +59,7 @@ function smarty_insert_block($aParams,&$oSmarty) {
|
||||||
/**
|
/**
|
||||||
* Подключаем необходимый обработчик
|
* Подключаем необходимый обработчик
|
||||||
*/
|
*/
|
||||||
require_once($sBlockClass);
|
$oBlock = new $sBlock($aParams);
|
||||||
eval($sCmd);
|
|
||||||
/**
|
/**
|
||||||
* Запускаем обработчик
|
* Запускаем обработчик
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue