Fix typo in comment
[lhc/web/wiklou.git] / includes / OutputPage.php
index cb72a9d..beaca5f 100644 (file)
@@ -22,7 +22,7 @@ class OutputPage extends ContextSource {
        /// Should be private. Used with addMeta() which adds <meta>
        var $mMetatags = array();
 
-       /// <meta keyworkds="stuff"> most of the time the first 10 links to an article
+       /// <meta keywords="stuff"> most of the time the first 10 links to an article
        var $mKeywords = array();
 
        var $mLinktags = array();
@@ -231,15 +231,6 @@ class OutputPage extends ContextSource {
         */
        private $mRedirectedFrom = null;
 
-       /**
-        * Name prefixes that can be used in addMeta
-        */
-       public static $metaAttrPrefixes = array(
-               'http' => 'http-equiv',
-               'itemprop' => 'itemprop',
-               'property' => 'property',
-       );
-
        /**
         * Constructor for OutputPage. This should not be called directly.
         * Instead a new RequestContext should be created and it will implicitly create
@@ -287,12 +278,6 @@ class OutputPage extends ContextSource {
        /**
         * Add a new <meta> tag
         * To add an http-equiv meta tag, precede the name with "http:"
-        * To add a Microdata itemprop meta tag, precede the name with "itemprop:"
-        * To add a RDFa property meta tag, precede the name with "property:"
-        *
-        * itemprop: and property: were introduced in 1.20, you can feature
-        * test for them by checking for the key in the new
-        * OutputPage::$metaAttrPrefixes variable.
         *
         * @param $name String tag name
         * @param $val String tag value
@@ -2520,7 +2505,7 @@ $templates
         * @return string html <script> and <style> tags
         */
        protected function makeResourceLoaderLink( $modules, $only, $useESI = false, array $extraQuery = array(), $loadCall = false ) {
-               global $wgResourceLoaderUseESI, $wgResourceLoaderInlinePrivateModules;
+               global $wgResourceLoaderUseESI;
 
                if ( !count( $modules ) ) {
                        return '';
@@ -2599,10 +2584,11 @@ $templates
                                continue;
                        }
 
-                       // Support inlining of private modules if configured as such. Note that these
-                       // modules should be loaded from getHeadScripts() before the first loader call.
-                       // Otherwise other modules can't properly use them as dependencies (bug 30914)
-                       if ( $group === 'private' && $wgResourceLoaderInlinePrivateModules ) {
+                       // Inline private modules. These can't be loaded through load.php for security
+                       // reasons, see bug 34907. Note that these modules should be loaded from
+                       // getHeadScripts() before the first loader call. Otherwise other modules can't
+                       // properly use them as dependencies (bug 30914)
+                       if ( $group === 'private' ) {
                                if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
                                        $links .= Html::inlineStyle(
                                                $resourceLoader->makeModuleResponse( $context, $modules )
@@ -2845,7 +2831,7 @@ $templates
         * @return array
         */
        public function getJSVars() {
-               global $wgUseAjax, $wgEnableMWSuggest;
+               global $wgUseAjax, $wgEnableMWSuggest, $wgContLang;
 
                $latestRevID = 0;
                $pageID = 0;
@@ -2855,6 +2841,10 @@ $templates
                $ns = $title->getNamespace();
                $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
 
+               // Get the relevant title so that AJAX features can use the correct page name
+               // when making API requests from certain special pages (bug 34972).
+               $relevantTitle = $this->getSkin()->getRelevantTitle();
+
                if ( $ns == NS_SPECIAL ) {
                        list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
                } elseif ( $this->canUseWikiPage() ) {
@@ -2896,9 +2886,10 @@ $templates
                        'wgPageContentLanguage' => $lang->getCode(),
                        'wgSeparatorTransformTable' => $compactSeparatorTransTable,
                        'wgDigitTransformTable' => $compactDigitTransTable,
+                       'wgRelevantPageName' => $relevantTitle->getPrefixedDBKey(),
                );
-               if ( $lang->hasVariants() ) {
-                       $vars['wgUserVariant'] = $lang->getPreferredVariant();
+               if ( $wgContLang->hasVariants() ) {
+                       $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
                }
                foreach ( $title->getRestrictionTypes() as $type ) {
                        $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
@@ -3010,16 +3001,11 @@ $templates
                }
 
                foreach ( $this->mMetatags as $tag ) {
-                       $a = 'name'; // default attribute
-                       foreach ( self::$metaAttrPrefixes as $prefix => $attribute ) {
-                               // Check if the name starts with the prefix
-                               if ( strpos( $tag[0], "$prefix:" ) === 0 ) {
-                                       // Set the attribute name we're using
-                                       $a = $attribute;
-                                       // Strip the prefix from the name
-                                       $tag[0] = substr( $tag[0], strlen( $prefix ) + 1 );
-                                       break;
-                               }
+                       if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) {
+                               $a = 'http-equiv';
+                               $tag[0] = substr( $tag[0], 5 );
+                       } else {
+                               $a = 'name';
                        }
                        $tags[] = Html::element( 'meta',
                                array(
@@ -3453,7 +3439,7 @@ $templates
         * @param $args array
         */
        public function addWikiMsgArray( $name, $args ) {
-               $this->addWikiText( $this->msg( $name, $args )->plain() );
+               $this->addHTML( $this->msg( $name, $args )->parseAsBlock() );
        }
 
        /**