* @todo document
*/
class OutputPage extends ContextSource {
- /// Should be private. Used with addMeta() which adds <meta>
+ /// Should be private. Used with addMeta() which adds "<meta>"
var $mMetatags = array();
- /// <meta keywords="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();
/// Should be private - has getter and setter. Contains the HTML title
var $mPagetitle = '';
- /// Contains all of the <body> content. Should be private we got set/get accessors and the append() method.
+ /// Contains all of the "<body>" content. Should be private we got set/get accessors and the append() method.
var $mBodytext = '';
/**
*/
public $mDebugtext = ''; // TODO: we might want to replace it by wfDebug() wfDebugLog()
- /// Should be private. Stores contents of <title> tag
+ /// Should be private. Stores contents of "<title>" tag
var $mHTMLtitle = '';
/// Should be private. Is the displayed content related to the source of the corresponding wiki article.
/**
* Should be private. Used for JavaScript (pre resource loader)
* We should split js / css.
- * mScripts content is inserted as is in <head> by Skin. This might contains
- * either a link to a stylesheet or inline css.
+ * mScripts content is inserted as is in "<head>" by Skin. This might
+ * contains either a link to a stylesheet or inline css.
*/
var $mScripts = '';
*/
var $mPageLinkTitle = '';
- /// Array of elements in <head>. Parser might add its own headers!
+ /// Array of elements in "<head>". Parser might add its own headers!
var $mHeadItems = array();
// @todo FIXME: Next variables probably comes from the resource loader
/**
* Comes from the parser. This was probably made to load CSS/JS only
- * if we had <gallery>. Used directly in CategoryPage.php
+ * if we had "<gallery>". Used directly in CategoryPage.php
* Looks like resource loader can replace this.
*/
var $mNoGallery = false;
}
/**
- * Add a new <meta> tag
+ * Add a new "<meta>" tag
* To add an http-equiv meta tag, precede the name with "http:"
*
* @param $name String tag name
/**
* Add a self-contained script tag with the given contents
*
- * @param $script String: JavaScript text, no <script> tags
+ * @param $script String: JavaScript text, no "<script>" tags
*/
public function addInlineScript( $script ) {
$this->mScripts .= Html::inlineScript( "\n$script\n" ) . "\n";
$maxModified = max( $modifiedTimes );
$this->mLastModified = wfTimestamp( TS_RFC2822, $maxModified );
- if( empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
+ $clientHeader = $this->getRequest()->getHeader( 'If-Modified-Since' );
+ if ( $clientHeader === false ) {
wfDebug( __METHOD__ . ": client did not send If-Modified-Since header\n", false );
return false;
}
- # Make debug info
- $info = '';
- foreach ( $modifiedTimes as $name => $value ) {
- if ( $info !== '' ) {
- $info .= ', ';
- }
- $info .= "$name=" . wfTimestamp( TS_ISO_8601, $value );
- }
-
# IE sends sizes after the date like this:
# Wed, 20 Aug 2003 06:51:19 GMT; length=5202
# this breaks strtotime().
- $clientHeader = preg_replace( '/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"] );
+ $clientHeader = preg_replace( '/;.*$/', '', $clientHeader );
wfSuppressWarnings(); // E_STRICT system time bitching
$clientHeaderTime = strtotime( $clientHeader );
}
$clientHeaderTime = wfTimestamp( TS_MW, $clientHeaderTime );
+ # Make debug info
+ $info = '';
+ foreach ( $modifiedTimes as $name => $value ) {
+ if ( $info !== '' ) {
+ $info .= ', ';
+ }
+ $info .= "$name=" . wfTimestamp( TS_ISO_8601, $value );
+ }
+
wfDebug( __METHOD__ . ": client sent If-Modified-Since: " .
wfTimestamp( TS_ISO_8601, $clientHeaderTime ) . "\n", false );
wfDebug( __METHOD__ . ": effective Last-Modified: " .
}
/**
- * "HTML title" means the contents of <title>.
+ * "HTML title" means the contents of "<title>".
* It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file.
*
* @param $name string
}
/**
- * Return the "HTML title", i.e. the content of the <title> tag.
+ * Return the "HTML title", i.e. the content of the "<title>" tag.
*
* @return String
*/
/**
* Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
*
- * param @t Title
+ * @param $t Title
*/
public function setRedirectedFrom( $t ) {
$this->mRedirectedFrom = $t;
* Set the timestamp of the revision which will be displayed. This is used
* to avoid a extra DB call in Skin::lastModified().
*
- * @param $revid Mixed: string, or null
+ * @param $timestamp Mixed: string, or null
* @return Mixed: previous value
*/
- public function setRevisionTimestamp( $timestmap ) {
- return wfSetVar( $this->mRevisionTimestamp, $timestmap );
+ public function setRevisionTimestamp( $timestamp) {
+ return wfSetVar( $this->mRevisionTimestamp, $timestamp );
}
/**
/**
* Return a Vary: header on which to vary caches. Based on the keys of $mVaryHeader,
* such as Accept-Encoding or Cookie
- *
+ *
* @return String
*/
public function getVaryHeader() {
}
$this->sendCacheControl();
+
+ wfRunHooks( 'AfterFinalPageOutput', array( &$this ) );
+
ob_end_flush();
+
wfProfileOut( __METHOD__ );
}
/**
* Prepare this object to display an error page; disable caching and
* indexing, clear the current text and redirect, set the page's title
- * and optionally an custom HTML title (content of the <title> tag).
+ * and optionally an custom HTML title (content of the "<title>" tag).
*
* @param $pageTitle String|Message will be passed directly to setPageTitle()
* @param $htmlTitle String|Message will be passed directly to setHTMLTitle();
- * optional, if not passed the <title> attribute will be
+ * optional, if not passed the "<title>" attribute will be
* based on $pageTitle
*/
public function prepareErrorPage( $pageTitle, $htmlTitle = false ) {
*
* showErrorPage( 'titlemsg', 'pagetextmsg', array( 'param1', 'param2' ) );
* showErrorPage( 'titlemsg', $messageObject );
+ * showErrorPage( $titleMessageObj, $messageObject );
*
- * @param $title String: message key for page title
+ * @param $title Mixed: message key (string) for page title, or a Message object
* @param $msg Mixed: message key (string) for page text, or a Message object
* @param $params Array: message parameters; ignored if $msg is a Message object
*/
public function showErrorPage( $title, $msg, $params = array() ) {
- $this->prepareErrorPage( $this->msg( $title ), $this->msg( 'errorpagetitle' ) );
+ if( !$title instanceof Message ) {
+ $title = $this->msg( $title );
+ }
+
+ $this->prepareErrorPage( $title, $this->msg( 'errorpagetitle' ) );
if ( $msg instanceof Message ){
$this->addHTML( $msg->parse() );
* Add a "return to" link pointing to a specified title
*
* @param $title Title to link
- * @param $query String query string
+ * @param $query Array query string parameters
* @param $text String text of the link (input is not escaped)
*/
public function addReturnTo( $title, $query = array(), $text = null ) {
$titleObj = Title::newMainPage();
}
- $this->addReturnTo( $titleObj, $returntoquery );
+ $this->addReturnTo( $titleObj, wfCgiToArray( $returntoquery ) );
}
/**
* @param $sk Skin The given Skin
* @param $includeStyle Boolean: unused
- * @return String: The doctype, opening <html>, and head element.
+ * @return String: The doctype, opening "<html>", and head element.
*/
public function headElement( Skin $sk, $includeStyle = true ) {
global $wgContLang;
* @param $only String ResourceLoaderModule TYPE_ class constant
* @param $useESI boolean
* @param $extraQuery Array with extra query parameters to add to each request. array( param => value )
- * @param $loadCall boolean If true, output an (asynchronous) mw.loader.load() call rather than a <script src="..."> tag
- * @return string html <script> and <style> tags
+ * @param $loadCall boolean If true, output an (asynchronous) mw.loader.load() call rather than a "<script src='...'>" tag
+ * @return string html "<script>" and "<style>" tags
*/
protected function makeResourceLoaderLink( $modules, $only, $useESI = false, array $extraQuery = array(), $loadCall = false ) {
global $wgResourceLoaderUseESI;
}
/**
- * JS stuff to put in the <head>. This is the startup module, config
+ * JS stuff to put in the "<head>". This is the startup module, config
* vars and modules marked with position 'top'
*
* @return String: HTML fragment
}
/**
- * JS stuff to put at the 'bottom', which can either be the bottom of the <body>
- * or the bottom of the <head> depending on $wgResourceLoaderExperimentalAsyncLoading:
+ * JS stuff to put at the 'bottom', which can either be the bottom of the "<body>"
+ * or the bottom of the "<head>" depending on $wgResourceLoaderExperimentalAsyncLoading:
* modules marked with position 'bottom', legacy scripts ($this->mScripts),
* user preferences, site JS and user JS
*
- * @param $inHead boolean If true, this HTML goes into the <head>, if false it goes into the <body>
+ * @param $inHead boolean If true, this HTML goes into the "<head>", if false it goes into the "<body>"
* @return string
*/
function getScriptsForBottomQueue( $inHead ) {
}
/**
- * JS stuff to put at the bottom of the <body>
+ * JS stuff to put at the bottom of the "<body>"
* @return string
*/
function getBottomScripts() {
/**
* Add one or more variables to be set in mw.config in JavaScript.
*
- * @param $key {String|Array} Key or array of key/value pars.
+ * @param $keys {String|Array} Key or array of key/value pairs.
* @param $value {Mixed} [optional] Value of the configuration variable.
*/
public function addJsConfigVars( $keys, $value = null ) {
'wgPageContentLanguage' => $lang->getCode(),
'wgSeparatorTransformTable' => $compactSeparatorTransTable,
'wgDigitTransformTable' => $compactDigitTransTable,
+ 'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
+ 'wgMonthNames' => $lang->getMonthNamesArray(),
+ 'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
'wgRelevantPageName' => $relevantTitle->getPrefixedDBKey(),
);
if ( $wgContLang->hasVariants() ) {
}
/**
- * @param $addContentType bool: Whether <meta> specifying content type should be returned
+ * @param $addContentType bool: Whether "<meta>" specifying content type should be returned
*
* @return array in format "link name or number => 'link html'".
*/
/**
* @param $unused
- * @param $addContentType bool: Whether <meta> specifying content type should be returned
+ * @param $addContentType bool: Whether "<meta>" specifying content type should be returned
*
* @return string HTML tag links to be put in the header.
*/
}
/**
- * Generate a <link rel/> for a feed.
+ * Generate a "<link rel/>" for a feed.
*
* @param $type String: feed type
* @param $url String: URL to the feed
}
/**
- * Build a set of <link>s for the stylesheets specified in the $this->styles array.
+ * Build a set of "<link>" elements for the stylesheets specified in the $this->styles array.
* These will be applied to various media & IE conditionals.
*
* @return string
* Add a wikitext-formatted message to the output.
* This is equivalent to:
*
- * $wgOut->addWikiText( wfMsgNoTrans( ... ) )
+ * $wgOut->addWikiText( wfMessage( ... )->plain() )
*/
public function addWikiMsg( /*...*/ ) {
$args = func_get_args();