Merge "Split the 'mediawiki.htmlform' module code into multiple files"
[lhc/web/wiklou.git] / includes / content / WikitextContent.php
index 8beae39..a63819d 100644 (file)
@@ -89,7 +89,7 @@ class WikitextContent extends TextContent {
                        # Inserting a new section
                        $subject = $sectionTitle ? wfMessage( 'newsectionheaderdefaultlevel' )
                                        ->rawParams( $sectionTitle )->inContentLanguage()->text() . "\n\n" : '';
-                       if ( Hooks::run( 'PlaceNewSection', array( $this, $oldtext, $subject, &$text ) ) ) {
+                       if ( Hooks::run( 'PlaceNewSection', [ $this, $oldtext, $subject, &$text ] ) ) {
                                $text = strlen( trim( $oldtext ) ) > 0
                                        ? "{$oldtext}\n\n{$subject}{$text}"
                                        : "{$subject}{$text}";
@@ -153,7 +153,7 @@ class WikitextContent extends TextContent {
         *
         * @return Content
         */
-       public function preloadTransform( Title $title, ParserOptions $popts, $params = array() ) {
+       public function preloadTransform( Title $title, ParserOptions $popts, $params = [] ) {
                global $wgParser;
 
                $text = $this->getNativeData();
@@ -180,7 +180,7 @@ class WikitextContent extends TextContent {
 
                if ( $wgMaxRedirects < 1 ) {
                        // redirects are disabled, so quit early
-                       $this->redirectTargetAndText = array( null, $this->getNativeData() );
+                       $this->redirectTargetAndText = [ null, $this->getNativeData() ];
                        return $this->redirectTargetAndText;
                }
 
@@ -190,7 +190,7 @@ class WikitextContent extends TextContent {
                        // Extract the first link and see if it's usable
                        // Ensure that it really does come directly after #REDIRECT
                        // Some older redirects included a colon, so don't freak about that!
-                       $m = array();
+                       $m = [];
                        if ( preg_match( '!^\s*:?\s*\[{2}(.*?)(?:\|.*?)?\]{2}\s*!', $text, $m ) ) {
                                // Strip preceding colon used to "escape" categories, etc.
                                // and URL-decode links
@@ -201,16 +201,16 @@ class WikitextContent extends TextContent {
                                $title = Title::newFromText( $m[1] );
                                // If the title is a redirect to bad special pages or is invalid, return null
                                if ( !$title instanceof Title || !$title->isValidRedirectTarget() ) {
-                                       $this->redirectTargetAndText = array( null, $this->getNativeData() );
+                                       $this->redirectTargetAndText = [ null, $this->getNativeData() ];
                                        return $this->redirectTargetAndText;
                                }
 
-                               $this->redirectTargetAndText = array( $title, substr( $text, strlen( $m[0] ) ) );
+                               $this->redirectTargetAndText = [ $title, substr( $text, strlen( $m[0] ) ) ];
                                return $this->redirectTargetAndText;
                        }
                }
 
-               $this->redirectTargetAndText = array( null, $this->getNativeData() );
+               $this->redirectTargetAndText = [ null, $this->getNativeData() ];
                return $this->redirectTargetAndText;
        }
 
@@ -258,10 +258,10 @@ class WikitextContent extends TextContent {
         * Returns true if this content is not a redirect, and this content's text
         * is countable according to the criteria defined by $wgArticleCountMethod.
         *
-        * @param bool $hasLinks If it is known whether this content contains
+        * @param bool|null $hasLinks If it is known whether this content contains
         *    links, provide this information here, to avoid redundant parsing to
         *    find out (default: null).
-        * @param Title $title Optional title, defaults to the title from the current main request.
+        * @param Title|null $title Optional title, defaults to the title from the current main request.
         *
         * @return bool
         */
@@ -338,7 +338,7 @@ class WikitextContent extends TextContent {
                                $chain = $this->getRedirectChain();
                                $output->setText(
                                        Article::getRedirectHeaderHtml( $title->getPageLanguage(), $chain, false ) .
-                                       $output->getText()
+                                       $output->getRawText()
                                );
                                $output->addModuleStyles( 'mediawiki.action.view.redirectPage' );
                        }