summaryrefslogtreecommitdiff
path: root/includes/OutputPage.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-01-11 19:06:07 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-01-11 19:06:07 +0000
commita58285fd06c8113c45377c655dd43cef6337e815 (patch)
treedfe31d3d12652352fe44890b4811eda0728faefb /includes/OutputPage.php
parent20194986f6638233732ba1fc3e838f117d3cc9ea (diff)
Aktualisierung auf MediaWiki 1.9.0
Diffstat (limited to 'includes/OutputPage.php')
-rw-r--r--includes/OutputPage.php316
1 files changed, 198 insertions, 118 deletions
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 0d55c2e0..4ca9e88a 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -54,18 +54,34 @@ class OutputPage {
$this->mNewSectionLink = false;
}
- function redirect( $url, $responsecode = '302' ) {
+ public function redirect( $url, $responsecode = '302' ) {
# Strip newlines as a paranoia check for header injection in PHP<5.1.2
$this->mRedirect = str_replace( "\n", '', $url );
$this->mRedirectCode = $responsecode;
}
+ /**
+ * Set the HTTP status code to send with the output.
+ *
+ * @param int $statusCode
+ * @return nothing
+ */
function setStatusCode( $statusCode ) { $this->mStatusCode = $statusCode; }
# To add an http-equiv meta tag, precede the name with "http:"
function addMeta( $name, $val ) { array_push( $this->mMetatags, array( $name, $val ) ); }
function addKeyword( $text ) { array_push( $this->mKeywords, $text ); }
function addScript( $script ) { $this->mScripts .= $script; }
+
+ /**
+ * Add a self-contained script tag with the given contents
+ * @param string $script JavaScript text, no <script> tags
+ */
+ function addInlineScript( $script ) {
+ global $wgJsMimeType;
+ $this->mScripts .= "<script type=\"$wgJsMimeType\"><!--\n$script\n--></script>";
+ }
+
function getScript() { return $this->mScripts; }
function setETag($tag) { $this->mETag = $tag; }
@@ -88,8 +104,9 @@ class OutputPage {
/**
* checkLastModified tells the client to use the client-cached page if
* possible. If sucessful, the OutputPage is disabled so that
- * any future call to OutputPage->output() have no effect. The method
- * returns true iff cache-ok headers was sent.
+ * any future call to OutputPage->output() have no effect.
+ *
+ * @return bool True iff cache-ok headers was sent.
*/
function checkLastModified ( $timestamp ) {
global $wgCachePages, $wgCacheEpoch, $wgUser, $wgRequest;
@@ -127,7 +144,12 @@ class OutputPage {
$this->sendCacheControl();
wfDebug( "$fname: CACHED client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false );
$this->disable();
- @ob_end_clean(); // Don't output compressed blob
+
+ // Don't output a compressed blob when using ob_gzhandler;
+ // it's technically against HTTP spec and seems to confuse
+ // Firefox when the response gets split over two packets.
+ wfClearOutputBuffers();
+
return true;
} else {
wfDebug( "$fname: READY client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false );
@@ -162,9 +184,9 @@ class OutputPage {
}
}
- function setRobotpolicy( $str ) { $this->mRobotpolicy = $str; }
- function setHTMLTitle( $name ) {$this->mHTMLtitle = $name; }
- function setPageTitle( $name ) {
+ public function setRobotpolicy( $str ) { $this->mRobotpolicy = $str; }
+ public function setHTMLTitle( $name ) {$this->mHTMLtitle = $name; }
+ public function setPageTitle( $name ) {
global $action, $wgContLang;
$name = $wgContLang->convert($name, true);
$this->mPagetitle = $name;
@@ -177,50 +199,50 @@ class OutputPage {
$this->setHTMLTitle( wfMsg( 'pagetitle', $name ) );
}
- function getHTMLTitle() { return $this->mHTMLtitle; }
- function getPageTitle() { return $this->mPagetitle; }
- function setSubtitle( $str ) { $this->mSubtitle = /*$this->parse(*/$str/*)*/; } // @bug 2514
- function getSubtitle() { return $this->mSubtitle; }
- function isArticle() { return $this->mIsarticle; }
- function setPrintable() { $this->mPrintable = true; }
- function isPrintable() { return $this->mPrintable; }
- function setSyndicated( $show = true ) { $this->mShowFeedLinks = $show; }
- function isSyndicated() { return $this->mShowFeedLinks; }
- function setOnloadHandler( $js ) { $this->mOnloadHandler = $js; }
- function getOnloadHandler() { return $this->mOnloadHandler; }
- function disable() { $this->mDoNothing = true; }
-
- function setArticleRelated( $v ) {
+ public function getHTMLTitle() { return $this->mHTMLtitle; }
+ public function getPageTitle() { return $this->mPagetitle; }
+ public function setSubtitle( $str ) { $this->mSubtitle = /*$this->parse(*/$str/*)*/; } // @bug 2514
+ public function getSubtitle() { return $this->mSubtitle; }
+ public function isArticle() { return $this->mIsarticle; }
+ public function setPrintable() { $this->mPrintable = true; }
+ public function isPrintable() { return $this->mPrintable; }
+ public function setSyndicated( $show = true ) { $this->mShowFeedLinks = $show; }
+ public function isSyndicated() { return $this->mShowFeedLinks; }
+ public function setOnloadHandler( $js ) { $this->mOnloadHandler = $js; }
+ public function getOnloadHandler() { return $this->mOnloadHandler; }
+ public function disable() { $this->mDoNothing = true; }
+
+ public function setArticleRelated( $v ) {
$this->mIsArticleRelated = $v;
if ( !$v ) {
$this->mIsarticle = false;
}
}
- function setArticleFlag( $v ) {
+ public function setArticleFlag( $v ) {
$this->mIsarticle = $v;
if ( $v ) {
$this->mIsArticleRelated = $v;
}
}
- function isArticleRelated() { return $this->mIsArticleRelated; }
+ public function isArticleRelated() { return $this->mIsArticleRelated; }
- function getLanguageLinks() { return $this->mLanguageLinks; }
- function addLanguageLinks($newLinkArray) {
+ public function getLanguageLinks() { return $this->mLanguageLinks; }
+ public function addLanguageLinks($newLinkArray) {
$this->mLanguageLinks += $newLinkArray;
}
- function setLanguageLinks($newLinkArray) {
+ public function setLanguageLinks($newLinkArray) {
$this->mLanguageLinks = $newLinkArray;
}
- function getCategoryLinks() {
+ public function getCategoryLinks() {
return $this->mCategoryLinks;
}
/**
* Add an array of categories, with names in the keys
*/
- function addCategoryLinks($categories) {
+ public function addCategoryLinks($categories) {
global $wgUser, $wgContLang;
if ( !is_array( $categories ) ) {
@@ -233,32 +255,32 @@ class OutputPage {
$lb->execute();
$sk =& $wgUser->getSkin();
- foreach ( $categories as $category => $arbitrary ) {
+ foreach ( $categories as $category => $unused ) {
$title = Title::makeTitleSafe( NS_CATEGORY, $category );
$text = $wgContLang->convertHtml( $title->getText() );
$this->mCategoryLinks[] = $sk->makeLinkObj( $title, $text );
}
}
- function setCategoryLinks($categories) {
+ public function setCategoryLinks($categories) {
$this->mCategoryLinks = array();
$this->addCategoryLinks($categories);
}
- function suppressQuickbar() { $this->mSuppressQuickbar = true; }
- function isQuickbarSuppressed() { return $this->mSuppressQuickbar; }
+ public function suppressQuickbar() { $this->mSuppressQuickbar = true; }
+ public function isQuickbarSuppressed() { return $this->mSuppressQuickbar; }
- function addHTML( $text ) { $this->mBodytext .= $text; }
- function clearHTML() { $this->mBodytext = ''; }
- function getHTML() { return $this->mBodytext; }
- function debug( $text ) { $this->mDebugtext .= $text; }
+ public function addHTML( $text ) { $this->mBodytext .= $text; }
+ public function clearHTML() { $this->mBodytext = ''; }
+ public function getHTML() { return $this->mBodytext; }
+ public function debug( $text ) { $this->mDebugtext .= $text; }
/* @deprecated */
- function setParserOptions( $options ) {
+ public function setParserOptions( $options ) {
return $this->parserOptions( $options );
}
- function parserOptions( $options = null ) {
+ public function parserOptions( $options = null ) {
if ( !$this->mParserOptions ) {
$this->mParserOptions = new ParserOptions;
}
@@ -271,7 +293,7 @@ class OutputPage {
* @param mixed $revid an integer, or NULL
* @return mixed previous value
*/
- function setRevisionId( $revid ) {
+ public function setRevisionId( $revid ) {
$val = is_null( $revid ) ? null : intval( $revid );
return wfSetVar( $this->mRevisionId, $val );
}
@@ -280,17 +302,20 @@ class OutputPage {
* Convert wikitext to HTML and add it to the buffer
* Default assumes that the current page title will
* be used.
+ *
+ * @param string $text
+ * @param bool $linestart
*/
- function addWikiText( $text, $linestart = true ) {
+ public function addWikiText( $text, $linestart = true ) {
global $wgTitle;
$this->addWikiTextTitle($text, $wgTitle, $linestart);
}
- function addWikiTextWithTitle($text, &$title, $linestart = true) {
+ public function addWikiTextWithTitle($text, &$title, $linestart = true) {
$this->addWikiTextTitle($text, $title, $linestart);
}
- function addWikiTextTitle($text, &$title, $linestart) {
+ private function addWikiTextTitle($text, &$title, $linestart) {
global $wgParser;
$fname = 'OutputPage:addWikiTextTitle';
wfProfileIn($fname);
@@ -301,7 +326,11 @@ class OutputPage {
wfProfileOut($fname);
}
- function addParserOutputNoText( &$parserOutput ) {
+ /**
+ * @todo document
+ * @param ParserOutput object &$parserOutput
+ */
+ public function addParserOutputNoText( &$parserOutput ) {
$this->mLanguageLinks += $parserOutput->getLanguageLinks();
$this->addCategoryLinks( $parserOutput->getCategories() );
$this->mNewSectionLink = $parserOutput->getNewSection();
@@ -319,6 +348,10 @@ class OutputPage {
wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) );
}
+ /**
+ * @todo document
+ * @param ParserOutput &$parserOutput
+ */
function addParserOutput( &$parserOutput ) {
$this->addParserOutputNoText( $parserOutput );
$text = $parserOutput->getText();
@@ -328,9 +361,13 @@ class OutputPage {
/**
* Add wikitext to the buffer, assuming that this is the primary text for a page view
- * Saves the text into the parser cache if possible
+ * Saves the text into the parser cache if possible.
+ *
+ * @param string $text
+ * @param Article $article
+ * @param bool $cache
*/
- function addPrimaryWikiText( $text, $article, $cache = true ) {
+ public function addPrimaryWikiText( $text, $article, $cache = true ) {
global $wgParser, $wgUser;
$popts = $this->parserOptions();
@@ -348,8 +385,11 @@ class OutputPage {
/**
* For anything that isn't primary text or interface message
+ *
+ * @param string $text
+ * @param bool $linestart Is this the start of a line?
*/
- function addSecondaryWikiText( $text, $linestart = true ) {
+ public function addSecondaryWikiText( $text, $linestart = true ) {
global $wgTitle;
$popts = $this->parserOptions();
$popts->setTidy(true);
@@ -360,9 +400,10 @@ class OutputPage {
/**
* Add the output of a QuickTemplate to the output buffer
+ *
* @param QuickTemplate $template
*/
- function addTemplate( &$template ) {
+ public function addTemplate( &$template ) {
ob_start();
$template->execute();
$this->addHTML( ob_get_contents() );
@@ -371,8 +412,12 @@ class OutputPage {
/**
* Parse wikitext and return the HTML.
+ *
+ * @param string $text
+ * @param bool $linestart Is this the start of a line?
+ * @param bool $interface ??
*/
- function parse( $text, $linestart = true, $interface = false ) {
+ public function parse( $text, $linestart = true, $interface = false ) {
global $wgParser, $wgTitle;
$popts = $this->parserOptions();
if ( $interface) { $popts->setInterfaceMessage(true); }
@@ -383,12 +428,12 @@ class OutputPage {
}
/**
- * @param $article
- * @param $user
+ * @param Article $article
+ * @param User $user
*
- * @return bool
+ * @return bool True if successful, else false.
*/
- function tryParserCache( &$article, $user ) {
+ public function tryParserCache( &$article, $user ) {
$parserCache =& ParserCache::singleton();
$parserOutput = $parserCache->get( $article, $user );
if ( $parserOutput !== false ) {
@@ -400,18 +445,17 @@ class OutputPage {
}
/**
- * Set the maximum cache time on the Squid in seconds
- * @param $maxage
+ * @param int $maxage Maximum cache time on the Squid, in seconds.
*/
- function setSquidMaxage( $maxage ) {
+ public function setSquidMaxage( $maxage ) {
$this->mSquidMaxage = $maxage;
}
/**
* Use enableClientCache(false) to force it to send nocache headers
- * @param $state
+ * @param $state ??
*/
- function enableClientCache( $state ) {
+ public function enableClientCache( $state ) {
return wfSetVar( $this->mEnableClientCache, $state );
}
@@ -421,7 +465,7 @@ class OutputPage {
&& $wgRequest->getText('uselang', false) === false;
}
- function sendCacheControl() {
+ public function sendCacheControl() {
global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgRequest;
$fname = 'OutputPage::sendCacheControl';
@@ -477,10 +521,11 @@ class OutputPage {
* Finally, all the text has been munged and accumulated into
* the object, let's actually output it:
*/
- function output() {
+ public function output() {
global $wgUser, $wgOutputEncoding, $wgRequest;
global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType;
- global $wgJsMimeType, $wgStylePath, $wgUseAjax, $wgAjaxSearch, $wgScriptPath, $wgServer;
+ global $wgJsMimeType, $wgStylePath, $wgUseAjax, $wgAjaxSearch, $wgAjaxWatch;
+ global $wgServer, $wgStyleVersion;
if( $this->mDoNothing ){
return;
@@ -490,12 +535,15 @@ class OutputPage {
$sk = $wgUser->getSkin();
if ( $wgUseAjax ) {
- $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajax.js\"></script>\n" );
- }
+ $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajax.js?$wgStyleVersion\"></script>\n" );
+ if( $wgAjaxSearch ) {
+ $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajaxsearch.js\"></script>\n" );
+ $this->addScript( "<script type=\"{$wgJsMimeType}\">hookEvent(\"load\", sajax_onload);</script>\n" );
+ }
- if ( $wgUseAjax && $wgAjaxSearch ) {
- $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajaxsearch.js\"></script>\n" );
- $this->addScript( "<script type=\"{$wgJsMimeType}\">hookEvent(\"load\", sajax_onload);</script>\n" );
+ if( $wgAjaxWatch && $wgUser->isLoggedIn() ) {
+ $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajaxwatch.js\"></script>\n" );
+ }
}
if ( '' != $this->mRedirect ) {
@@ -601,7 +649,11 @@ class OutputPage {
wfProfileOut( $fname );
}
- function out( $ins ) {
+ /**
+ * @todo document
+ * @param string $ins
+ */
+ public function out( $ins ) {
global $wgInputEncoding, $wgOutputEncoding, $wgContLang;
if ( 0 == strcmp( $wgInputEncoding, $wgOutputEncoding ) ) {
$outs = $ins;
@@ -612,7 +664,10 @@ class OutputPage {
print $outs;
}
- function setEncodings() {
+ /**
+ * @todo document
+ */
+ public static function setEncodings() {
global $wgInputEncoding, $wgOutputEncoding;
global $wgUser, $wgContLang;
@@ -626,19 +681,20 @@ class OutputPage {
}
/**
- * Returns a HTML comment with the elapsed time since request.
- * This method has no side effects.
- * Use wfReportTime() instead.
+ * Deprecated, use wfReportTime() instead.
* @return string
* @deprecated
*/
- function reportTime() {
+ public function reportTime() {
$time = wfReportTime();
return $time;
}
/**
- * Produce a "user is blocked" page
+ * Produce a "user is blocked" page.
+ *
+ * @param bool $return Whether to have a "return to $wgTitle" message or not.
+ * @return nothing
*/
function blockedPage( $return = true ) {
global $wgUser, $wgContLang, $wgTitle;
@@ -658,7 +714,9 @@ class OutputPage {
}
$link = '[[' . $wgContLang->getNsText( NS_USER ) . ":{$name}|{$name}]]";
- $this->addWikiText( wfMsg( 'blockedtext', $link, $reason, $ip, $name ) );
+ $blockid = $wgUser->mBlock->mId;
+
+ $this->addWikiText( wfMsg( 'blockedtext', $link, $reason, $ip, $name, $blockid ) );
# Don't auto-return to special pages
if( $return ) {
@@ -668,9 +726,13 @@ class OutputPage {
}
/**
- * Note: these arguments are keys into wfMsg(), not text!
+ * Outputs a pretty page to explain why the request exploded.
+ *
+ * @param string $title Message key for page title.
+ * @param string $msg Message key for page text.
+ * @return nothing
*/
- function showErrorPage( $title, $msg ) {
+ public function showErrorPage( $title, $msg ) {
global $wgTitle;
$this->mDebugtext .= 'Original title: ' .
@@ -688,7 +750,7 @@ class OutputPage {
}
/** @obsolete */
- function errorpage( $title, $msg ) {
+ public function errorpage( $title, $msg ) {
throw new ErrorPageError( $title, $msg );
}
@@ -698,7 +760,7 @@ class OutputPage {
*
* @param mixed $version The version of MediaWiki needed to use the page
*/
- function versionRequired( $version ) {
+ public function versionRequired( $version ) {
$this->setPageTitle( wfMsg( 'versionrequired', $version ) );
$this->setHTMLTitle( wfMsg( 'versionrequired', $version ) );
$this->setRobotpolicy( 'noindex,nofollow' );
@@ -711,9 +773,10 @@ class OutputPage {
/**
* Display an error page noting that a given permission bit is required.
+ *
* @param string $permission key required
*/
- function permissionRequired( $permission ) {
+ public function permissionRequired( $permission ) {
global $wgGroupPermissions, $wgUser;
$this->setPageTitle( wfMsg( 'badaccess' ) );
@@ -751,23 +814,25 @@ class OutputPage {
}
/**
+ * Use permissionRequired.
* @deprecated
*/
- function sysopRequired() {
+ public function sysopRequired() {
throw new MWException( "Call to deprecated OutputPage::sysopRequired() method\n" );
}
/**
+ * Use permissionRequired.
* @deprecated
*/
- function developerRequired() {
+ public function developerRequired() {
throw new MWException( "Call to deprecated OutputPage::developerRequired() method\n" );
}
/**
* Produce the stock "please login to use the wiki" page
*/
- function loginToUse() {
+ public function loginToUse() {
global $wgUser, $wgTitle, $wgContLang;
if( $wgUser->isLoggedIn() ) {
@@ -782,40 +847,45 @@ class OutputPage {
$this->setRobotPolicy( 'noindex,nofollow' );
$this->setArticleFlag( false );
- $loginTitle = Title::makeTitle( NS_SPECIAL, 'Userlogin' );
+ $loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
$loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $wgTitle->getPrefixedUrl() );
$this->addHtml( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) );
$this->addHtml( "\n<!--" . $wgTitle->getPrefixedUrl() . "-->" );
# Don't return to the main page if the user can't read it
# otherwise we'll end up in a pointless loop
- $mainPage = Title::newFromText( wfMsgForContent( 'mainpage' ) );
+ $mainPage = Title::newMainPage();
if( $mainPage->userCanRead() )
$this->returnToMain( true, $mainPage );
}
/** @obsolete */
- function databaseError( $fname, $sql, $error, $errno ) {
+ public function databaseError( $fname, $sql, $error, $errno ) {
throw new MWException( "OutputPage::databaseError is obsolete\n" );
}
- function readOnlyPage( $source = null, $protected = false ) {
+ /**
+ * @todo document
+ * @param bool $protected Is the reason the page can't be reached because it's protected?
+ * @param mixed $source
+ */
+ public function readOnlyPage( $source = null, $protected = false ) {
global $wgUser, $wgReadOnlyFile, $wgReadOnly, $wgTitle;
+ $skin = $wgUser->getSkin();
$this->setRobotpolicy( 'noindex,nofollow' );
$this->setArticleRelated( false );
if( $protected ) {
- $skin = $wgUser->getSkin();
$this->setPageTitle( wfMsg( 'viewsource' ) );
$this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
-
+
# Determine if protection is due to the page being a system message
# and show an appropriate explanation
if( $wgTitle->getNamespace() == NS_MEDIAWIKI && !$wgUser->isAllowed( 'editinterface' ) ) {
$this->addWikiText( wfMsg( 'protectedinterface' ) );
} else {
- $this->addWikiText( wfMsg( 'protectedtext' ) );
+ $this->addWikiText( wfMsg( 'protectedpagetext' ) );
}
} else {
$this->setPageTitle( wfMsg( 'readonly' ) );
@@ -828,7 +898,8 @@ class OutputPage {
}
if( is_string( $source ) ) {
- if( strcmp( $source, '' ) == 0 ) {
+ $this->addWikiText( wfMsg( 'viewsourcetext' ) );
+ if( $source === '' ) {
global $wgTitle;
if ( $wgTitle->getNamespace() == NS_MEDIAWIKI ) {
$source = wfMsgWeirdKey ( $wgTitle->getText() );
@@ -838,46 +909,48 @@ class OutputPage {
}
$rows = $wgUser->getIntOption( 'rows' );
$cols = $wgUser->getIntOption( 'cols' );
-
+
$text = "\n<textarea name='wpTextbox1' id='wpTextbox1' cols='$cols' rows='$rows' readonly='readonly'>" .
htmlspecialchars( $source ) . "\n</textarea>";
$this->addHTML( $text );
}
+ $article = new Article($wgTitle);
+ $this->addHTML( $skin->formatTemplates($article->getUsedTemplates()) );
$this->returnToMain( false );
}
/** @obsolete */
- function fatalError( $message ) {
+ public function fatalError( $message ) {
throw new FatalError( $message );
}
/** @obsolete */
- function unexpectedValueError( $name, $val ) {
+ public function unexpectedValueError( $name, $val ) {
throw new FatalError( wfMsg( 'unexpected', $name, $val ) );
}
/** @obsolete */
- function fileCopyError( $old, $new ) {
+ public function fileCopyError( $old, $new ) {
throw new FatalError( wfMsg( 'filecopyerror', $old, $new ) );
}
/** @obsolete */
- function fileRenameError( $old, $new ) {
+ public function fileRenameError( $old, $new ) {
throw new FatalError( wfMsg( 'filerenameerror', $old, $new ) );
}
/** @obsolete */
- function fileDeleteError( $name ) {
+ public function fileDeleteError( $name ) {
throw new FatalError( wfMsg( 'filedeleteerror', $name ) );
}
/** @obsolete */
- function fileNotFoundError( $name ) {
+ public function fileNotFoundError( $name ) {
throw new FatalError( wfMsg( 'filenotfound', $name ) );
}
- function showFatalError( $message ) {
+ public function showFatalError( $message ) {
$this->setPageTitle( wfMsg( "internalerror" ) );
$this->setRobotpolicy( "noindex,nofollow" );
$this->setArticleRelated( false );
@@ -886,23 +959,23 @@ class OutputPage {
$this->mBodytext = $message;
}
- function showUnexpectedValueError( $name, $val ) {
+ public function showUnexpectedValueError( $name, $val ) {
$this->showFatalError( wfMsg( 'unexpected', $name, $val ) );
}
- function showFileCopyError( $old, $new ) {
+ public function showFileCopyError( $old, $new ) {
$this->showFatalError( wfMsg( 'filecopyerror', $old, $new ) );
}
- function showFileRenameError( $old, $new ) {
+ public function showFileRenameError( $old, $new ) {
$this->showFatalError( wfMsg( 'filerenameerror', $old, $new ) );
}
- function showFileDeleteError( $name ) {
+ public function showFileDeleteError( $name ) {
$this->showFatalError( wfMsg( 'filedeleteerror', $name ) );
}
- function showFileNotFoundError( $name ) {
+ public function showFileNotFoundError( $name ) {
$this->showFatalError( wfMsg( 'filenotfound', $name ) );
}
@@ -911,7 +984,7 @@ class OutputPage {
* @param $auto automatically redirect the user after 10 seconds
* @param $returnto page title to return to. Default is Main Page.
*/
- function returnToMain( $auto = true, $returnto = NULL ) {
+ public function returnToMain( $auto = true, $returnto = NULL ) {
global $wgUser, $wgOut, $wgRequest;
if ( $returnto == NULL ) {
@@ -919,7 +992,7 @@ class OutputPage {
}
if ( '' === $returnto ) {
- $returnto = wfMsgForContent( 'mainpage' );
+ $returnto = Title::newMainPage();
}
if ( is_object( $returnto ) ) {
@@ -944,8 +1017,10 @@ class OutputPage {
/**
* This function takes the title (first item of mGoodLinks), categories, existing and broken links for the page
* and uses the first 10 of them for META keywords
+ *
+ * @param ParserOutput &$parserOutput
*/
- function addKeywords( &$parserOutput ) {
+ private function addKeywords( &$parserOutput ) {
global $wgTitle;
$this->addKeyword( $wgTitle->getPrefixedText() );
$count = 1;
@@ -953,8 +1028,8 @@ class OutputPage {
if ( !is_array( $links2d ) ) {
return;
}
- foreach ( $links2d as $ns => $dbkeys ) {
- foreach( $dbkeys as $dbkey => $id ) {
+ foreach ( $links2d as $dbkeys ) {
+ foreach( $dbkeys as $dbkey => $unused ) {
$this->addKeyword( $dbkey );
if ( ++$count > 10 ) {
break 2;
@@ -964,12 +1039,12 @@ class OutputPage {
}
/**
- * @access private
- * @return string
+ * @return string The doctype, opening <html>, and head element.
*/
- function headElement() {
+ public function headElement() {
global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
- global $wgUser, $wgContLang, $wgUseTrackbacks, $wgTitle;
+ global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
+ global $wgUser, $wgContLang, $wgUseTrackbacks, $wgTitle, $wgStyleVersion;
if( $wgMimeType == 'text/xml' || $wgMimeType == 'application/xhtml+xml' || $wgMimeType == 'application/xml' ) {
$ret = "<?xml version=\"1.0\" encoding=\"$wgOutputEncoding\" ?>\n";
@@ -984,7 +1059,11 @@ class OutputPage {
}
$rtl = $wgContLang->isRTL() ? " dir='RTL'" : '';
- $ret .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"$wgContLanguageCode\" lang=\"$wgContLanguageCode\" $rtl>\n";
+ $ret .= "<html xmlns=\"{$wgXhtmlDefaultNamespace}\" ";
+ foreach($wgXhtmlNamespaces as $tag => $ns) {
+ $ret .= "xmlns:{$tag}=\"{$ns}\" ";
+ }
+ $ret .= "xml:lang=\"$wgContLanguageCode\" lang=\"$wgContLanguageCode\" $rtl>\n";
$ret .= "<head>\n<title>" . htmlspecialchars( $this->getHTMLTitle() ) . "</title>\n";
array_push( $this->mMetatags, array( "http:Content-type", "$wgMimeType; charset={$wgOutputEncoding}" ) );
@@ -995,7 +1074,7 @@ class OutputPage {
} else {
$media = "media='print'";
}
- $printsheet = htmlspecialchars( "$wgStylePath/common/wikiprintable.css" );
+ $printsheet = htmlspecialchars( "$wgStylePath/common/wikiprintable.css?$wgStyleVersion" );
$ret .= "<link rel='stylesheet' type='text/css' $media href='$printsheet' />\n";
$sk = $wgUser->getSkin();
@@ -1010,7 +1089,10 @@ class OutputPage {
return $ret;
}
- function getHeadLinks() {
+ /**
+ * @return string HTML tag links to be put in the header.
+ */
+ public function getHeadLinks() {
global $wgRequest;
$ret = '';
foreach ( $this->mMetatags as $tag ) {
@@ -1060,9 +1142,8 @@ class OutputPage {
* Turn off regular page output and return an error reponse
* for when rate limiting has triggered.
* @todo i18n
- * @access public
*/
- function rateLimited() {
+ public function rateLimited() {
global $wgOut;
$wgOut->disable();
wfHttpError( 500, 'Internal Server Error',
@@ -1075,9 +1156,8 @@ class OutputPage {
*
* @return bool True if the parser output instructs us to add one
*/
- function showNewSectionLink() {
+ public function showNewSectionLink() {
return $this->mNewSectionLink;
}
-
}
?>