1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-29 21:10:31 +02:00

[ticket/16204] Remove hooks system

PHPBB3-16204
This commit is contained in:
Marc Alexander
2019-11-07 20:21:50 +01:00
parent e1dce434db
commit d66960f4d5
6 changed files with 21 additions and 324 deletions

View File

@@ -1514,7 +1514,7 @@ function tracking_unserialize($string, $max_depth = 3)
*/
function append_sid($url, $params = false, $is_amp = true, $session_id = false, $is_route = false)
{
global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_path_helper;
global $_SID, $_EXTRA_URL, $phpbb_path_helper;
global $phpbb_dispatcher;
if ($params === '' || (is_array($params) && empty($params)))
@@ -1561,18 +1561,6 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false,
return $append_sid_overwrite;
}
// The following hook remains for backwards compatibility, though use of
// the event above is preferred.
// Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropriately.
// They could mimic most of what is within this function
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id))
{
if ($phpbb_hook->hook_return(__FUNCTION__))
{
return $phpbb_hook->hook_return_result(__FUNCTION__);
}
}
$params_is_array = is_array($params);
// Get anchor
@@ -4543,17 +4531,31 @@ function garbage_collection()
* This function supports hooks.
*
* Note: This function is called after the template has been outputted.
*
* @return void
*/
function exit_handler()
{
global $phpbb_hook;
global $phpbb_dispatcher;
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__))
$exit_handler_override = false;
/**
* This event can either supplement or override the exit_handler() function
*
* To override this function, the event must set $exit_handler_override to
* true to force it to exit directly after calling this event.
*
* @event core.exit_handler
* @var bool exit_handler_override Flag to signify exit is handled elsewhere
* @since 4.0.0-a1
*/
$vars = ['exit_handler_override'];
extract($phpbb_dispatcher->trigger_event('core.exit_handler', compact($vars)));
if ($exit_handler_override)
{
if ($phpbb_hook->hook_return(__FUNCTION__))
{
return $phpbb_hook->hook_return_result(__FUNCTION__);
}
return;
}
// As a pre-caution... some setups display a blank page if the flush() is not there.
@@ -4562,25 +4564,6 @@ function exit_handler()
exit;
}
/**
* Handler for init calls in phpBB. This function is called in \phpbb\user::setup();
* This function supports hooks.
*/
function phpbb_user_session_handler()
{
global $phpbb_hook;
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__))
{
if ($phpbb_hook->hook_return(__FUNCTION__))
{
return $phpbb_hook->hook_return_result(__FUNCTION__);
}
}
return;
}
/**
* Casts a numeric string $input to an appropriate numeric type (i.e. integer or float)
*