mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-02 23:07:39 +02:00
[feature/template-engine] Refactor hook logic into a separate function.
PHPBB3-9726
This commit is contained in:
@@ -195,14 +195,10 @@ class phpbb_template
|
|||||||
*/
|
*/
|
||||||
public function display($handle, $include_once = true)
|
public function display($handle, $include_once = true)
|
||||||
{
|
{
|
||||||
global $phpbb_hook;
|
$result = $this->call_hook($handle, $include_once);
|
||||||
|
if ($result !== false)
|
||||||
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once, $this))
|
|
||||||
{
|
{
|
||||||
if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
|
return $result[0];
|
||||||
{
|
|
||||||
return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -228,6 +224,27 @@ class phpbb_template
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls hook if any is defined.
|
||||||
|
* @param string $handle Template handle being displayed.
|
||||||
|
* @param bool $include_once Allow multiple inclusions
|
||||||
|
*/
|
||||||
|
private function call_hook($handle, $include_once)
|
||||||
|
{
|
||||||
|
global $phpbb_hook;
|
||||||
|
|
||||||
|
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once, $this))
|
||||||
|
{
|
||||||
|
if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
|
||||||
|
{
|
||||||
|
$result = $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
|
||||||
|
return array($result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtains language array.
|
* Obtains language array.
|
||||||
* This is either lang property of global $user object, or if
|
* This is either lang property of global $user object, or if
|
||||||
|
Reference in New Issue
Block a user