Merge "Rename $usableSkins to $allowedSkins"
[lhc/web/wiklou.git] / includes / OutputPage.php
index 3abfff0..b63e658 100644 (file)
@@ -1296,7 +1296,6 @@ class OutputPage extends ContextSource {
         * Return whether user JavaScript is allowed for this page
         * @deprecated since 1.18 Load modules with ResourceLoader, and origin and
         *     trustworthiness is identified and enforced automagically.
-        *     Will be removed in 1.20.
         * @return Boolean
         */
        public function isUserJsAllowed() {
@@ -2050,7 +2049,7 @@ class OutputPage extends ContextSource {
                }
 
                if ( $this->mArticleBodyOnly ) {
-                       $this->out( $this->mBodytext );
+                       echo $this->mBodytext;
                } else {
                        $this->addDefaultModules();
 
@@ -2076,11 +2075,13 @@ class OutputPage extends ContextSource {
        }
 
        /**
-        * Actually output something with print().
+        * Actually output something with print.
         *
         * @param string $ins the string to output
+        * @deprecated since 1.20 Use echo yourself.
         */
        public function out( $ins ) {
+               wfDeprecated( __METHOD__, '1.22' );
                print $ins;
        }
 
@@ -2475,7 +2476,7 @@ $templates
         * @return String: The doctype, opening "<html>", and head element.
         */
        public function headElement( Skin $sk, $includeStyle = true ) {
-               global $wgContLang;
+               global $wgContLang, $wgMimeType;
 
                $userdir = $this->getLanguage()->getDir();
                $sitedir = $wgContLang->getDir();
@@ -2496,10 +2497,22 @@ $templates
                        $ret .= "$openHead\n";
                }
 
+               if ( !Html::isXmlMimeType( $wgMimeType ) ) {
+                       // Add <meta charset="UTF-8">
+                       // This should be before <title> since it defines the charset used by
+                       // text including the text inside <title>.
+                       // The spec recommends defining XHTML5's charset using the XML declaration
+                       // instead of meta.
+                       // Our XML declaration is output by Html::htmlHeader.
+                       // http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#attr-meta-http-equiv-content-type
+                       // http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#charset
+                       $ret .= Html::element( 'meta', array( 'charset' => 'UTF-8' ) );
+               }
+
                $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
 
                $ret .= implode( "\n", array(
-                       $this->getHeadLinks( null, true ),
+                       $this->getHeadLinks(),
                        $this->buildCssLinks(),
                        $this->getHeadScripts(),
                        $this->getHeadItems()
@@ -2968,7 +2981,7 @@ $templates
                // This also enforces $.isReady to be true at </body> which fixes the
                // mw.loader bug in Firefox with using document.write between </body>
                // and the DOMContentReady event (bug 47457).
-               $html = Html::inlineScript( 'jQuery.ready();' );
+               $html = Html::inlineScript( 'window.jQuery && jQuery.ready();' );
 
                if ( !$wgResourceLoaderExperimentalAsyncLoading ) {
                        $html .= $this->getScriptsForBottomQueue( false );
@@ -3062,6 +3075,7 @@ $templates
                        'wgCategories' => $this->getCategories(),
                        'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
                        'wgPageContentLanguage' => $lang->getCode(),
+                       'wgPageContentModel' => $title->getContentModel(),
                        'wgSeparatorTransformTable' => $compactSeparatorTransTable,
                        'wgDigitTransformTable' => $compactDigitTransTable,
                        'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
@@ -3074,6 +3088,10 @@ $templates
                        $vars['wgUserEditCount'] = $user->getEditCount();
                        $userReg = wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
                        $vars['wgUserRegistration'] = $userReg !== null ? ( $userReg * 1000 ) : null;
+                       // Get the revision ID of the oldest new message on the user's talk
+                       // page. This can be used for constructing new message alerts on
+                       // the client side.
+                       $vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
                }
                if ( $wgContLang->hasVariants() ) {
                        $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
@@ -3123,13 +3141,11 @@ $templates
        }
 
        /**
-        * @param bool $addContentType Whether "<meta>" specifying content type should be returned
-        *
         * @return array in format "link name or number => 'link html'".
         */
-       public function getHeadLinksArray( $addContentType = false ) {
+       public function getHeadLinksArray() {
                global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
-                       $wgSitename, $wgVersion, $wgHtml5, $wgMimeType,
+                       $wgSitename, $wgVersion,
                        $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
                        $wgDisableLangConversion, $wgCanonicalLanguageLinks,
                        $wgRightsPage, $wgRightsUrl;
@@ -3138,23 +3154,6 @@ $templates
 
                $canonicalUrl = $this->mCanonicalUrl;
 
-               if ( $addContentType ) {
-                       if ( $wgHtml5 ) {
-                               # More succinct than <meta http-equiv=Content-Type>, has the
-                               # same effect
-                               $tags['meta-charset'] = Html::element( 'meta', array( 'charset' => 'UTF-8' ) );
-                       } else {
-                               $tags['meta-content-type'] = Html::element( 'meta', array(
-                                       'http-equiv' => 'Content-Type',
-                                       'content' => "$wgMimeType; charset=UTF-8"
-                               ) );
-                               $tags['meta-content-style-type'] = Html::element( 'meta', array( // bug 15835
-                                       'http-equiv' => 'Content-Style-Type',
-                                       'content' => 'text/css'
-                               ) );
-                       }
-               }
-
                $tags['meta-generator'] = Html::element( 'meta', array(
                        'name' => 'generator',
                        'content' => "MediaWiki $wgVersion",
@@ -3372,13 +3371,10 @@ $templates
        }
 
        /**
-        * @param $unused
-        * @param bool $addContentType Whether "<meta>" specifying content type should be returned
-        *
         * @return string HTML tag links to be put in the header.
         */
-       public function getHeadLinks( $unused = null, $addContentType = false ) {
-               return implode( "\n", $this->getHeadLinksArray( $addContentType ) );
+       public function getHeadLinks() {
+               return implode( "\n", $this->getHeadLinksArray() );
        }
 
        /**