Merge "Make "/*@noflip*/ /*@embed*/" annotation work"
[lhc/web/wiklou.git] / includes / OutputPage.php
index 8d50e41..a58a79a 100644 (file)
@@ -3336,25 +3336,23 @@ $templates
                }
 
                # Language variants
-               if ( !$config->get( 'DisableLangConversion' ) && $config->get( 'CanonicalLanguageLinks' ) ) {
+               if ( !$config->get( 'DisableLangConversion' ) ) {
                        $lang = $this->getTitle()->getPageLanguage();
                        if ( $lang->hasVariants() ) {
-
-                               $urlvar = $lang->getURLVariant();
-
-                               if ( !$urlvar ) {
-                                       $variants = $lang->getVariants();
-                                       foreach ( $variants as $_v ) {
-                                               $tags["variant-$_v"] = Html::element( 'link', array(
-                                                       'rel' => 'alternate',
-                                                       'hreflang' => wfBCP47( $_v ),
-                                                       'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
-                                               );
-                                       }
-                               } else {
-                                       $canonicalUrl = $this->getTitle()->getLocalURL();
+                               $variants = $lang->getVariants();
+                               foreach ( $variants as $_v ) {
+                                       $tags["variant-$_v"] = Html::element( 'link', array(
+                                               'rel' => 'alternate',
+                                               'hreflang' => wfBCP47( $_v ),
+                                               'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
+                                       );
                                }
                        }
+                       # x-default link per https://support.google.com/webmasters/answer/189077?hl=en
+                       $tags["variant-x-default"] = Html::element( 'link', array(
+                               'rel' => 'alternate',
+                               'hreflang' => 'x-default',
+                               'href' => $this->getTitle()->getLocalURL() ) );
                }
 
                # Copyright
@@ -3504,6 +3502,8 @@ $templates
                if ( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
                        # If wanted, and the interface is right-to-left, flip the CSS
                        $style_css = CSSJanus::transform( $style_css, true, false );
+               } else {
+                       $style_css = CSSJanus::nullTransform( $style_css );
                }
                $this->mInlineStyles .= Html::inlineStyle( $style_css ) . "\n";
        }
@@ -3554,6 +3554,8 @@ $templates
                        $previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
                        if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
                                $previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
+                       } else {
+                               $previewedCSS = CSSJanus::nullTransform( $previewedCSS );
                        }
                        $otherTags .= Html::inlineStyle( $previewedCSS ) . "\n";
                } else {