]> git.mjollnir.org Git - s9y.git/commitdiff
allow to suppress smarty hook calls via a variable
authorgarvinhicking <garvinhicking>
Fri, 25 Nov 2005 12:27:09 +0000 (12:27 +0000)
committergarvinhicking <garvinhicking>
Fri, 25 Nov 2005 12:27:09 +0000 (12:27 +0000)
include/functions_smarty.inc.php

index 33d204af62281ac9f63340c7a7a606c992de199d..4644043400cf5fd05653dda71220557c8072871c 100644 (file)
@@ -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;