aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/docs/hook_system.html20
-rw-r--r--phpBB/includes/hooks/index.php14
-rw-r--r--phpBB/includes/template.php6
3 files changed, 20 insertions, 20 deletions
diff --git a/phpBB/docs/hook_system.html b/phpBB/docs/hook_system.html
index 2bcffe3458..2aab028a78 100644
--- a/phpBB/docs/hook_system.html
+++ b/phpBB/docs/hook_system.html
@@ -434,11 +434,11 @@ class my_hookable_object
{
global $phpbb_hook;
- if ($phpbb_hook->call_hook(array(get_class($this), __FUNCTION__), $my_first_parameter, $my_second_parameter))
+ if ($phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $my_first_parameter, $my_second_parameter))
{
- if ($phpbb_hook->hook_return(array(get_class($this), __FUNCTION__)))
+ if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
{
- return $phpbb_hook->hook_return_result(array(get_class($this), __FUNCTION__));
+ return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
}
}
@@ -447,7 +447,7 @@ class my_hookable_object
}
</pre></div>
-<p>The only difference about calling it is the way you define the first parameter. For a function it is only <code>__FUNCTION__</code>, for a method it is <code>array(get_class($this), __FUNCTION__)</code>. Since PHP 5.0.0 the get_class() function no longer requires the object to be given, you simply write: <code>array(get_class(), __FUNCTION__)</code>.</p>
+<p>The only difference about calling it is the way you define the first parameter. For a function it is only <code>__FUNCTION__</code>, for a method it is <code>array(__CLASS__, __FUNCTION__)</code>. In PHP4 __CLASS__ is always returning the class in lowercase.</p>
<p>Now, in phpBB there are some pre-defined hooks available, but how do you make your own hookable function available (and therefore allowing others to hook into it)? For this, there is the add_hook() method:</p>
@@ -579,11 +579,11 @@ class my_hookable_object2 extends my_hookable_object
{
global $phpbb_hook;
- if ($phpbb_hook-&gt;call_hook(array(get_class($this), __FUNCTION__), $my_first_parameter, $my_second_parameter))
+ if ($phpbb_hook-&gt;call_hook(array(__CLASS__, __FUNCTION__), $my_first_parameter, $my_second_parameter))
{
- if ($phpbb_hook-&gt;hook_return(array(get_class($this), __FUNCTION__)))
+ if ($phpbb_hook-&gt;hook_return(array(__CLASS__, __FUNCTION__)))
{
- return $phpbb_hook-&gt;hook_return_result(array(get_class($this), __FUNCTION__));
+ return $phpbb_hook-&gt;hook_return_result(array(__CLASS__, __FUNCTION__));
}
}
}
@@ -636,11 +636,11 @@ class my_hookable_object2 extends my_hookable_object
{
global $phpbb_hook;
- if ($phpbb_hook-&gt;call_hook(array(get_class($this), __FUNCTION__), $my_first_parameter, $my_second_parameter))
+ if ($phpbb_hook-&gt;call_hook(array(__CLASS__, __FUNCTION__), $my_first_parameter, $my_second_parameter))
{
- if ($phpbb_hook-&gt;hook_return(array(get_class($this), __FUNCTION__)))
+ if ($phpbb_hook-&gt;hook_return(array(__CLASS__, __FUNCTION__)))
{
- return $phpbb_hook-&gt;hook_return_result(array(get_class($this), __FUNCTION__));
+ return $phpbb_hook-&gt;hook_return_result(array(__CLASS__, __FUNCTION__));
}
}
}
diff --git a/phpBB/includes/hooks/index.php b/phpBB/includes/hooks/index.php
index bbd258ff40..a8ad64478a 100644
--- a/phpBB/includes/hooks/index.php
+++ b/phpBB/includes/hooks/index.php
@@ -59,7 +59,7 @@ class phpbb_hook
* Register function/method to be called within hook
* This function is normally called by the modification/application to attach/register the functions.
*
- * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(get_class([$object]), __FUNCTION__) (PHP4 requires $object to be given)
+ * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
* @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition
* @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain.
*/
@@ -101,7 +101,7 @@ class phpbb_hook
* Calling all functions/methods attached to a specified hook.
* Called by the function allowing hooks...
*
- * @param mixed $definition Declaring function (with __FUNCTION__) or class definition with array(). Must be call_user_func_array() compatible.
+ * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
* @return bool False if no hook got executed, true otherwise
*/
function call_hook($definition)
@@ -154,7 +154,7 @@ class phpbb_hook
/**
* Get result from previously called functions/methods for the same hook
*
- * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(get_class([$object]), __FUNCTION__) (PHP4 requires $object to be given)
+ * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
* @return mixed False if nothing returned if there is no result, else array('result' => ... )
*/
function previous_hook_result($definition)
@@ -173,7 +173,7 @@ class phpbb_hook
/**
* Check if the called functions/methods returned something.
*
- * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(get_class([$object]), __FUNCTION__) (PHP4 requires $object to be given)
+ * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
* @return bool True if results are there, false if not
*/
function hook_return($definition)
@@ -192,7 +192,7 @@ class phpbb_hook
/**
* Give actual result from called functions/methods back.
*
- * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(get_class([$object]), __FUNCTION__) (PHP4 requires $object to be given)
+ * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
* @return mixed The result
*/
function hook_return_result($definition)
@@ -213,7 +213,7 @@ class phpbb_hook
/**
* Add new function to the allowed hooks.
*
- * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(get_class([$object]), __FUNCTION__) (PHP4 requires $object to be given)
+ * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
*/
function add_hook($definition)
{
@@ -228,7 +228,7 @@ class phpbb_hook
/**
* Remove function from the allowed hooks.
*
- * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(get_class([$object]), __FUNCTION__) (PHP4 requires $object to be given)
+ * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
*/
function remove_hook($definition)
{
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 10411b268e..4c126b8a91 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -149,11 +149,11 @@ class template
{
global $user, $phpbb_hook;
- if ($phpbb_hook->call_hook(array(get_class($this), __FUNCTION__), $handle, $include_once))
+ if ($phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
{
- if ($phpbb_hook->hook_return(array(get_class($this), __FUNCTION__)))
+ if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
{
- return $phpbb_hook->hook_return_result(array(get_class($this), __FUNCTION__));
+ return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
}
}