From 2e2d01a859a1456f8bc5567befcfdcdf68d90aad Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Fri, 25 Nov 2005 12:27:09 +0000 Subject: [PATCH] allow to suppress smarty hook calls via a variable --- include/functions_smarty.inc.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/functions_smarty.inc.php b/include/functions_smarty.inc.php index 33d204a..4644043 100644 --- a/include/functions_smarty.inc.php +++ b/include/functions_smarty.inc.php @@ -134,6 +134,19 @@ function serendipity_smarty_hookPlugin($params, &$smarty) { $smarty->trigger_error(__FUNCTION__ .": illegal hook '". $params['hook'] ."'"); return; } + + // Smarty hooks can be bypassed via an internal variable (temporarily) + if (isset($serendipity['skip_smarty_hooks']) && $serendipity['skip_smarty_hooks']) { + return; + } + + // A specific hook can also be bypassed by creating an associative array like this: + // $serendipity['skip_smarty_hook'] = array('entries_header'); + // That would only skip the entries_header event hook, but allow all others. + // Of course it cannot be used in conjunction with the all-blocking skip_smarty_hooks. + if (isset($serendipity['skip_smarty_hook']) && is_array($serendipity['skip_smarty_hook']) && isset($serendipity['skip_smarty_hook'][$params['hook']])) { + return; + } if (!isset($params['data'])) { $params['data'] = &$serendipity; -- 2.39.5