From efbad45bd5dd69e029bcfdafa3b691c328340819 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 12 Nov 2007 07:32:17 +0000 Subject: [PATCH] Allow the special page function to be a callback, not just a function name. --- includes/SpecialPage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index b5820034ba..effea32dc3 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -643,7 +643,7 @@ class SpecialPage if ( $this->userCanExecute( $wgUser ) ) { $func = $this->mFunction; // only load file if the function does not exist - if(!function_exists($func) and $this->mFile) { + if(!is_callable($func) and $this->mFile) { require_once( $this->mFile ); } # FIXME: these hooks are broken for extensions and anything else that subclasses SpecialPage. @@ -651,7 +651,7 @@ class SpecialPage $this->outputHeader(); if ( ! wfRunHooks( 'SpecialPageExecuteBeforePage', array( &$this, &$par, &$func ) ) ) return; - $func( $par, $this ); + call_user_func( $func, $par, $this ); if ( ! wfRunHooks( 'SpecialPageExecuteAfterPage', array( &$this, &$par, &$func ) ) ) return; } else { -- 2.20.1