r16278 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r16277‎ | r16278 | r16279 >
Date:07:45, 30 August 2006
Author:robchurch
Status:old
Tags:
Comment:
* (bug 7075) List registered parser function hooks on Special:Version
* Make the exception text in Parser::setFunctionHook() a bit more succinct
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/SpecialVersion.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialVersion.php
@@ -129,6 +129,11 @@
130130 $out .= "** Parser extension tags:\n";
131131 $out .= '***' . $this->listToText( $tags ). "\n";
132132 }
 133+
 134+ if( $cnt = count( $fhooks = $wgParser->getFunctionHooks() ) ) {
 135+ $out .= "** Parser function hooks:\n";
 136+ $out .= '***' . $this->listToText( $fhooks ) . "\n";
 137+ }
133138
134139 if ( count( $wgSkinExtensionFunction ) ) {
135140 $out .= "** Skin extension functions:\n";
Index: trunk/phase3/includes/Parser.php
@@ -3852,10 +3852,8 @@
38533853
38543854 # Add to function cache
38553855 $mw = MagicWord::get( $id );
3856 - if ( !$mw ) {
3857 - throw new MWException( 'The calling convention to Parser::setFunctionHook() has changed, ' .
3858 - 'it is now required to pass a MagicWord ID as the first parameter.' );
3859 - }
 3856+ if( !$mw )
 3857+ throw new MWException( 'Parser::setFunctionHook() expecting a magic word identifier.' );
38603858
38613859 $synonyms = $mw->getSynonyms();
38623860 $sensitive = intval( $mw->isCaseSensitive() );
@@ -3879,6 +3877,15 @@
38803878 }
38813879
38823880 /**
 3881+ * Get all registered function hook identifiers
 3882+ *
 3883+ * @return array
 3884+ */
 3885+ function getFunctionHooks() {
 3886+ return array_keys( $this->mFunctionHooks );
 3887+ }
 3888+
 3889+ /**
38833890 * Replace <!--LINK--> link placeholders with actual links, in the buffer
38843891 * Placeholders created in Skin::makeLinkObj()
38853892 * Returns an array of links found, indexed by PDBK:
Index: trunk/phase3/RELEASE-NOTES
@@ -161,8 +161,8 @@
162162 * (bug 832) Return to user page after emailing a user
163163 * (bug 366) Add local-system-timezone equivalents for date/time variables
164164 * (bug 7109) Fix Atom feed version number in header links
 165+* (bug 7075) List registered parser function hooks on Special:Version
165166
166 -
167167 == Languages updated ==
168168
169169 * Albanian (sq)