mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-01 14:05:07 +03:00
Ticket #213
This commit is contained in:
parent
4fb88243db
commit
23c189b7a6
|
@ -89,6 +89,12 @@ class Engine extends Object {
|
|||
*/
|
||||
const CI_INHERIT = 128;
|
||||
|
||||
/**
|
||||
* Имя блока
|
||||
* @var int
|
||||
*/
|
||||
const CI_BLOCK = 256;
|
||||
|
||||
/**
|
||||
* Префикс плагина
|
||||
* @var int
|
||||
|
@ -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
|
||||
*/
|
||||
const CI_OBJECT = 95;
|
||||
const CI_OBJECT = 351 ;
|
||||
|
||||
static protected $oInstance=null;
|
||||
|
||||
|
@ -763,6 +769,12 @@ class Engine extends Object {
|
|||
? $aMatches[1]
|
||||
: null
|
||||
;
|
||||
}
|
||||
if($iFlag & self::CI_BLOCK){
|
||||
$aResult[self::CI_BLOCK] = preg_match('/^(?:Plugin[^_]+_|)Block([^_]+)$/',$sClassName,$aMatches)
|
||||
? $aMatches[1]
|
||||
: null
|
||||
;
|
||||
}
|
||||
if($iFlag & self::CI_METHOD){
|
||||
$sModuleName = isset($aResult[self::CI_MODULE])
|
||||
|
@ -890,6 +902,18 @@ class Engine extends Object {
|
|||
// Хук ядра
|
||||
$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]){
|
||||
// Плагин
|
||||
$sPath .= 'plugins/'.strtolower($aInfo[self::CI_PLUGIN])
|
||||
|
|
|
@ -50,7 +50,8 @@ class ModulePlugin extends Module {
|
|||
'mapper' => array(),
|
||||
'action' => array(),
|
||||
'entity' => array(),
|
||||
'template' => array()
|
||||
'template' => array(),
|
||||
'block' => array(),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,13 +36,14 @@ function smarty_insert_block($aParams,&$oSmarty) {
|
|||
require_once(Config::Get('path.root.server').'/engine/classes/ActionPlugin.class.php');
|
||||
|
||||
$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);';
|
||||
} else {
|
||||
$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);';
|
||||
}
|
||||
$sBlock=Engine::getInstance()->Plugin_GetDelegate('block','Block'.$sBlock);
|
||||
|
||||
|
||||
if (!isset($aParams['block']) or !$oSmarty->templateExists($sBlockTemplate)) {
|
||||
$oSmarty->trigger_error("Not found template for block: ".$sBlockTemplate);
|
||||
|
@ -58,8 +59,7 @@ function smarty_insert_block($aParams,&$oSmarty) {
|
|||
/**
|
||||
* Подключаем необходимый обработчик
|
||||
*/
|
||||
require_once($sBlockClass);
|
||||
eval($sCmd);
|
||||
$oBlock = new $sBlock($aParams);
|
||||
/**
|
||||
* Запускаем обработчик
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue