From 4f41d77add7ca6f3c458c0fac91b4ae273ced882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=A8rejean?= Date: Mon, 2 Apr 2012 11:53:12 +0200 Subject: [PATCH 1/2] [feature/events] Add `core.page_header_override` Add a ledge that will allow listeners to override the build in `page_header` function. http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=42741&p=237037 PHPBB3-9550 --- phpBB/includes/functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a44ebb04e86..842934e65ee 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4526,6 +4526,16 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 define('HEADER_INC', true); + // A listener can set this variable to `true` when it overrides this function + $page_header_override = false; + + $vars = array('page_title', 'display_online_list', 'item_id', 'item', 'page_header_override'); + extract($phpbb_dispatcher->trigger_event('core.page_header_override', compact($vars))); + if ($page_header_override) + { + return; + } + // gzip_compression if ($config['gzip_compress']) { From 59343a5cd88d16f2bc4e9ece6039e8af69c9eeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=A8rejean?= Date: Mon, 2 Apr 2012 11:57:25 +0200 Subject: [PATCH 2/2] [feature/events] Add `core.page_footer_override` Add a ledge that will allow listeners to override the build in `page_footer` function. http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=42741&p=237037 PHPBB3-9550 --- phpBB/includes/functions.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 842934e65ee..c9ba58a6ab2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4837,6 +4837,17 @@ function page_footer($run_cron = true) { global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx; global $request; + global $phpbb_dispatcher; + + // A listener can set this variable to `true` when it overrides this function + $page_footer_override = false; + + $vars = array('run_cron', 'page_footer_override'); + extract($phpbb_dispatcher->trigger_event('core.page_footer_override', compact($vars))); + if ($page_footer_override) + { + return; + } // Output page creation time if (defined('DEBUG'))