From c349f8d9856765ed6cd93b44c0ed897f234d48c0 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Sat, 29 Apr 2006 13:06:11 +0000 Subject: [PATCH] Some more minor performance tuning --- include/plugin_api.inc.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/include/plugin_api.inc.php b/include/plugin_api.inc.php index cdc761d..e0930ee 100644 --- a/include/plugin_api.inc.php +++ b/include/plugin_api.inc.php @@ -974,17 +974,21 @@ class serendipity_plugin_api { return false; } - $plugins = serendipity_plugin_api::get_event_plugins(); + $plugins =& serendipity_plugin_api::get_event_plugins(); if (is_array($plugins)) { // foreach() operates on copies of values, but we want to operate on references, so we use while() @reset($plugins); while(list($plugin, $plugin_data) = each($plugins)) { - $bag = &$plugin_data['b']; - if (array_key_exists($event_name, $bag->get('event_hooks'))) { + $bag = &$plugin_data['b']; + $phooks = &$bag->get('event_hooks'); + if (isset($phooks[$event_name])) { // Check for cachable events. - if (isset($eventData['is_cached']) && $eventData['is_cached'] && array_key_exists($event_name, (array)$bag->get('cachable_events'))) { - continue; + if (isset($eventData['is_cached']) && $eventData['is_cached']) { + $chooks = &$bag->get('cachable_events'); + if (is_array($chooks) && isset($chooks[$event_name])) { + continue; + } } $plugin_data['p']->event_hook($event_name, $bag, $eventData, $addData); -- 2.39.5