Merge "(bug 37755) Set robot meta tags for 'view source' pages"
[lhc/web/wiklou.git] / includes / OutputPage.php
index ea90250..7649b23 100644 (file)
@@ -611,7 +611,7 @@ class OutputPage extends ContextSource {
 
        /**
         * checkLastModified tells the client to use the client-cached page if
-        * possible. If sucessful, the OutputPage is disabled so that
+        * possible. If successful, the OutputPage is disabled so that
         * any future call to OutputPage->output() have no effect.
         *
         * Side effect: sets mLastModified for Last-Modified header
@@ -1469,7 +1469,7 @@ class OutputPage extends ContextSource {
         * @param $interface Boolean: whether it is an interface message
         *                                                              (for example disables conversion)
         */
-       public function addWikiTextTitle( $text, &$title, $linestart, $tidy = false, $interface = false ) {
+       public function addWikiTextTitle( $text, Title $title, $linestart, $tidy = false, $interface = false ) {
                global $wgParser;
 
                wfProfileIn( __METHOD__ );
@@ -1769,14 +1769,12 @@ class OutputPage extends ContextSource {
                                } else {
                                        $aloption[] = 'string-contains=' . $variant;
 
-                                       // IE and some other browsers use another form of language code
-                                       // in their Accept-Language header, like "zh-CN" or "zh-TW".
+                                       // IE and some other browsers use BCP 47 standards in
+                                       // their Accept-Language header, like "zh-CN" or "zh-Hant".
                                        // We should handle these too.
-                                       $ievariant = explode( '-', $variant );
-                                       if ( count( $ievariant ) == 2 ) {
-                                               $ievariant[1] = strtoupper( $ievariant[1] );
-                                               $ievariant = implode( '-', $ievariant );
-                                               $aloption[] = 'string-contains=' . $ievariant;
+                                       $variantBCP47 = wfBCP47( $variant );
+                                       if ( $variantBCP47 !== $variant ) {
+                                               $aloption[] = 'string-contains=' . $variantBCP47;
                                        }
                                }
                        }
@@ -2462,7 +2460,7 @@ $templates
         */
        private function addDefaultModules() {
                global $wgIncludeLegacyJavaScript, $wgPreloadJavaScriptMwUtil, $wgUseAjax,
-                       $wgAjaxWatch;
+                       $wgAjaxWatch, $wgResponsiveImages;
 
                // Add base resources
                $this->addModules( array(
@@ -2503,6 +2501,11 @@ $templates
                if ( $this->isArticle() && $this->getUser()->getOption( 'editondblclick' ) ) {
                        $this->addModules( 'mediawiki.action.view.dblClickEdit' );
                }
+
+               // Support for high-density display images
+               if ( $wgResponsiveImages ) {
+                       $this->addModules( 'mediawiki.hidpi' );
+               }
        }
 
        /**
@@ -2915,7 +2918,7 @@ $templates
         * @return array
         */
        public function getJSVars() {
-               global $wgUseAjax, $wgContLang;
+               global $wgContLang;
 
                $latestRevID = 0;
                $pageID = 0;
@@ -2977,7 +2980,7 @@ $templates
                );
                if ( $wgContLang->hasVariants() ) {
                        $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
-               }
+               }
                foreach ( $title->getRestrictionTypes() as $type ) {
                        $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
                }
@@ -3568,7 +3571,6 @@ $templates
                $msgSpecs = array_values( $msgSpecs );
                $s = $wrap;
                foreach ( $msgSpecs as $n => $spec ) {
-                       $options = array();
                        if ( is_array( $spec ) ) {
                                $args = $spec;
                                $name = array_shift( $args );