mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-01 05:55:02 +03:00
Ticket #96
This commit is contained in:
parent
e80ace1996
commit
05e640ddeb
46
engine/modules/viewer/plugs/block.hookb.php
Normal file
46
engine/modules/viewer/plugs/block.hookb.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/*-------------------------------------------------------
|
||||
*
|
||||
* LiveStreet Engine Social Networking
|
||||
* Copyright © 2008 Mzhelskiy Maxim
|
||||
*
|
||||
*--------------------------------------------------------
|
||||
*
|
||||
* Official site: www.livestreet.ru
|
||||
* Contact e-mail: rus.engine@gmail.com
|
||||
*
|
||||
* GNU General Public License, version 2:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
---------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Плагин для смарти
|
||||
* Запускает блочные хуки из шаблона на выполнение
|
||||
*
|
||||
* @param array $aParams
|
||||
* @param string $sContent
|
||||
* @param Smarty $oSmarty
|
||||
* @param bool $bRepeat
|
||||
* @return string
|
||||
*/
|
||||
function smarty_block_hookb($aParams,$sContent,&$oSmarty,&$bRepeat) {
|
||||
if(empty($aParams['run'])) {
|
||||
$oSmarty->trigger_error("Hook: missing 'run' parametr");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($sContent) {
|
||||
$sHookName='template_block_'.strtolower($aParams['run']);
|
||||
unset($aParams['run']);
|
||||
$aParams['content']=$sContent;
|
||||
$aResultHook=Engine::getInstance()->Hook_Run($sHookName,$aParams);
|
||||
if (array_key_exists('template_result',$aResultHook)) {
|
||||
echo join('',$aResultHook['template_result']);
|
||||
return ;
|
||||
}
|
||||
echo $sContent;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in a new issue