From: Rob Church Date: Wed, 30 Aug 2006 07:45:07 +0000 (+0000) Subject: * (bug 7075) List registered parser function hooks on Special:Version X-Git-Tag: 1.31.0-rc.0~55881 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=d5364e2bea2d5331d7f9a8dec2792b98641c261b;p=lhc%2Fweb%2Fwiklou.git * (bug 7075) List registered parser function hooks on Special:Version * Make the exception text in Parser::setFunctionHook() a bit more succinct --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9a394d7e49..378c35db80 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -161,7 +161,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 832) Return to user page after emailing a user * (bug 366) Add local-system-timezone equivalents for date/time variables * (bug 7109) Fix Atom feed version number in header links - +* (bug 7075) List registered parser function hooks on Special:Version == Languages updated == diff --git a/includes/Parser.php b/includes/Parser.php index 5692387841..98178de359 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3852,10 +3852,8 @@ class Parser # Add to function cache $mw = MagicWord::get( $id ); - if ( !$mw ) { - throw new MWException( 'The calling convention to Parser::setFunctionHook() has changed, ' . - 'it is now required to pass a MagicWord ID as the first parameter.' ); - } + if( !$mw ) + throw new MWException( 'Parser::setFunctionHook() expecting a magic word identifier.' ); $synonyms = $mw->getSynonyms(); $sensitive = intval( $mw->isCaseSensitive() ); @@ -3878,6 +3876,15 @@ class Parser return $oldVal; } + /** + * Get all registered function hook identifiers + * + * @return array + */ + function getFunctionHooks() { + return array_keys( $this->mFunctionHooks ); + } + /** * Replace link placeholders with actual links, in the buffer * Placeholders created in Skin::makeLinkObj() diff --git a/includes/SpecialVersion.php b/includes/SpecialVersion.php index 9c3ea775ec..8ad14ce1ba 100644 --- a/includes/SpecialVersion.php +++ b/includes/SpecialVersion.php @@ -129,6 +129,11 @@ class SpecialVersion { $out .= "** Parser extension tags:\n"; $out .= '***' . $this->listToText( $tags ). "\n"; } + + if( $cnt = count( $fhooks = $wgParser->getFunctionHooks() ) ) { + $out .= "** Parser function hooks:\n"; + $out .= '***' . $this->listToText( $fhooks ) . "\n"; + } if ( count( $wgSkinExtensionFunction ) ) { $out .= "** Skin extension functions:\n";