Followup r102785: fix typo in index name. Thanks to Platonides and his special page...
[lhc/web/wiklou.git] / includes / parser / Parser_LinkHooks.php
index 7c17ce4..90e4494 100644 (file)
@@ -9,8 +9,7 @@
  * Parser with LinkHooks experiment
  * @ingroup Parser
  */
-class Parser_LinkHooks extends Parser
-{
+class Parser_LinkHooks extends Parser {
        /**
         * Update this version number when the ParserOutput format
         * changes in an incompatible way, so the parser cache
@@ -38,10 +37,8 @@ class Parser_LinkHooks extends Parser
 
        /**
         * Constructor
-        *
-        * @public
         */
-       function __construct( $conf = array() ) {
+       public function __construct( $conf = array() ) {
                parent::__construct( $conf );
                $this->mLinkHooks = array();
        }
@@ -82,8 +79,6 @@ class Parser_LinkHooks extends Parser
         * True) (Treat as link) Parse the link according to normal link rules
         * False) (Bad link) Just output the raw wikitext (You may modify the text first)
         *
-        * @public
-        *
         * @param $ns Integer or String: the Namespace ID or regex pattern if SLH_PATTERN is set
         * @param $callback Mixed: the callback function (and object) to use
         * @param $flags Integer: a combination of the following flags:
@@ -91,7 +86,7 @@ class Parser_LinkHooks extends Parser
         *
         * @return The old callback function for this name, if any
         */
-       function setLinkHook( $ns, $callback, $flags = 0 ) {
+       public function setLinkHook( $ns, $callback, $flags = 0 ) {
                if( $flags & SLH_PATTERN && !is_string($ns) )
                        throw new MWException( __METHOD__.'() expecting a regex string pattern.' );
                elseif( $flags | ~SLH_PATTERN && !is_int($ns) )
@@ -232,7 +227,7 @@ class Parser_LinkHooks extends Parser
                wfProfileOut( __METHOD__."-misc" );
                # Make title object
                wfProfileIn( __METHOD__."-title" );
-               $title = Title::newFromText( $this->mStripState->unstripNoWiki($titleText) );
+               $title = Title::newFromText( $this->mStripState->unstripNoWiki( $titleText ) );
                if( !$title ) {
                        wfProfileOut( __METHOD__."-title" );
                        wfProfileOut( __METHOD__ );
@@ -244,7 +239,7 @@ class Parser_LinkHooks extends Parser
                # Default for Namespaces is a default link
                # ToDo: Default for patterns is plain wikitext
                $return = true;
-               if( isset($this->mLinkHooks[$ns]) ) {
+               if( isset( $this->mLinkHooks[$ns] ) ) {
                        list( $callback, $flags ) = $this->mLinkHooks[$ns];
                        if( $flags & SLH_PATTERN ) {
                                $args = array( $parser, $holders, $markers, $titleText, &$paramText, &$leadingColon );
@@ -253,14 +248,14 @@ class Parser_LinkHooks extends Parser
                        }
                        # Workaround for PHP bug 35229 and similar
                        if ( !is_callable( $callback ) ) {
-                               throw new MWException( "Tag hook for $name is not callable\n" );
+                               throw new MWException( "Tag hook for namespace $ns is not callable\n" );
                        }
                        $return = call_user_func_array( $callback, $args );
                }
                if( $return === true ) {
                        # True (treat as plain link) was returned, call the defaultLinkHook
-                       $args = array( $parser, $holders, $markers, $title, $titleText, &$paramText, &$leadingColon );
-                       $return = call_user_func_array( array( 'CoreLinkFunctions', 'defaultLinkHook' ), $args );
+                       $return = CoreLinkFunctions::defaultLinkHook( $parser, $holders, $markers, $title, 
+                               $titleText, $paramText, $leadingColon );
                }
                if( $return === false ) {
                        # False (no link) was returned, output plain wikitext