Merge "Implement static public Parser::getExternalLinkRel"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index d9fcdf9..512605d 100644 (file)
@@ -246,6 +246,13 @@ class Parser {
                }
        }
 
+       /**
+        * Allow extensions to clean up when the parser is cloned
+        */
+       function __clone() {
+               wfRunHooks( 'ParserCloned', array( $this ) );
+       }
+
        /**
         * Do various kinds of initialisation on the first call of the parser
         */
@@ -542,7 +549,7 @@ class Parser {
         * Also removes comments.
         * @return mixed|string
         */
-       function preprocess( $text, Title $title, ParserOptions $options, $revid = null ) {
+       function preprocess( $text, Title $title = null, ParserOptions $options, $revid = null ) {
                wfProfileIn( __METHOD__ );
                $this->startParse( $title, $options, self::OT_PREPROCESS, true );
                if ( $revid !== null ) {
@@ -1307,7 +1314,8 @@ class Parser {
                if ( $text === false ) {
                        # Not an image, make a link
                        $text = Linker::makeExternalLink( $url,
-                               $this->getConverterLanguage()->markNoConversion($url), true, 'free',
+                               $this->getConverterLanguage()->markNoConversion( $url, true ),
+                               true, 'free',
                                $this->getExternalLinkAttribs( $url ) );
                        # Register it in the output object...
                        # Replace unnecessary URL escape codes with their equivalent characters
@@ -4688,11 +4696,7 @@ class Parser {
                        global $wgTitle;
                        $title = $wgTitle;
                }
-               if ( !$title ) {
-                       # It's not uncommon having a null $wgTitle in scripts. See r80898
-                       # Create a ghost title in such case
-                       $title = Title::newFromText( 'Dwimmerlaik' );
-               }
+
                $text = $this->preprocess( $text, $title, $options );
 
                $executing = false;