print is not a function
[lhc/web/wiklou.git] / includes / OutputPage.php
index bf3c084..746cd0e 100644 (file)
@@ -1609,6 +1609,10 @@ class OutputPage extends ContextSource {
                        }
                }
 
+               // Link flags are ignored for now, but may in the future be
+               // used to mark individual language links.
+               $linkFlags = array();
+               wfRunHooks( 'LanguageLinks', array( $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ) );
                wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) );
        }
 
@@ -2072,7 +2076,7 @@ class OutputPage extends ContextSource {
        }
 
        /**
-        * Actually output something with print().
+        * Actually output something with print.
         *
         * @param string $ins the string to output
         */
@@ -2506,20 +2510,29 @@ $templates
                        $ret .= "$closeHead\n";
                }
 
-               $bodyAttrs = array();
+               $bodyClasses = array();
+               $bodyClasses[] = 'mediawiki';
 
                # Classes for LTR/RTL directionality support
-               $bodyAttrs['class'] = "mediawiki $userdir sitedir-$sitedir";
+               $bodyClasses[] = $userdir;
+               $bodyClasses[] = "sitedir-$sitedir";
 
                if ( $this->getLanguage()->capitalizeAllNouns() ) {
                        # A <body> class is probably not the best way to do this . . .
-                       $bodyAttrs['class'] .= ' capitalize-all-nouns';
+                       $bodyClasses[] = 'capitalize-all-nouns';
                }
-               $bodyAttrs['class'] .= ' ' . $sk->getPageClasses( $this->getTitle() );
-               $bodyAttrs['class'] .= ' skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
-               $bodyAttrs['class'] .= ' action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
 
-               $sk->addToBodyAttributes( $this, $bodyAttrs ); // Allow skins to add body attributes they need
+               $bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
+               $bodyClasses[] = 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
+               $bodyClasses[] = 'action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
+
+               $bodyAttrs = array();
+               // While the implode() is not strictly needed, it's used for backwards compatibility
+               // (this used to be built as a string and hooks likely still expect that).
+               $bodyAttrs['class'] = implode( ' ', $bodyClasses );
+
+               // Allow skins and extensions to add body attributes they need
+               $sk->addToBodyAttributes( $this, $bodyAttrs );
                wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) );
 
                $ret .= Html::openElement( 'body', $bodyAttrs ) . "\n";
@@ -2950,11 +2963,18 @@ $templates
         */
        function getBottomScripts() {
                global $wgResourceLoaderExperimentalAsyncLoading;
+
+               // Optimise jQuery ready event cross-browser.
+               // 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();' );
+
                if ( !$wgResourceLoaderExperimentalAsyncLoading ) {
-                       return $this->getScriptsForBottomQueue( false );
-               } else {
-                       return '';
+                       $html .= $this->getScriptsForBottomQueue( false );
                }
+
+               return $html;
        }
 
        /**
@@ -3042,6 +3062,7 @@ $templates
                        'wgCategories' => $this->getCategories(),
                        'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
                        'wgPageContentLanguage' => $lang->getCode(),
+                       'wgPageContentModel' => $title->getContentModel(),
                        'wgSeparatorTransformTable' => $compactSeparatorTransTable,
                        'wgDigitTransformTable' => $compactDigitTransTable,
                        'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
@@ -3054,6 +3075,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();
@@ -3324,7 +3349,7 @@ $templates
                                foreach ( $wgAdvertisedFeedTypes as $format ) {
                                        $tags[] = $this->feedLink(
                                                $format,
-                                               $rctitle->getLocalURL( "feed={$format}" ),
+                                               $rctitle->getLocalURL( array( 'feed' => $format ) ),
                                                $this->msg( "site-{$format}-feed", $wgSitename )->text() # For grep: 'site-rss-feed', 'site-atom-feed'.
                                        );
                                }