* (bug 7075) List registered parser function hooks on Special:Version
authorRob Church <robchurch@users.mediawiki.org>
Wed, 30 Aug 2006 07:45:07 +0000 (07:45 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Wed, 30 Aug 2006 07:45:07 +0000 (07:45 +0000)
* Make the exception text in Parser::setFunctionHook() a bit more succinct

RELEASE-NOTES
includes/Parser.php
includes/SpecialVersion.php

index 9a394d7..378c35d 100644 (file)
@@ -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 ==
 
index 5692387..98178de 100644 (file)
@@ -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--> link placeholders with actual links, in the buffer
         * Placeholders created in Skin::makeLinkObj()
index 9c3ea77..8ad14ce 100644 (file)
@@ -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";