return true;
}
+ /**
+ * Override the last modified timestamp
+ *
+ * @param $timestamp String: new timestamp, in a format readable by
+ * wfTimestamp()
+ */
+ public function setLastModified( $timestamp ) {
+ $this->mLastModified = wfTimestamp( TS_RFC2822, $timestamp );
+ }
+
/**
* Set the robot policy for the page: <http://www.robotstxt.org/meta.html>
}
/**
- * "HTML title" means the contents of <title>. It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file.
+ * "HTML title" means the contents of <title>.
+ * It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file.
*/
public function setHTMLTitle( $name ) {
$this->mHTMLtitle = $name;
$this->mTemplateIds[$ns] = $dbks;
}
}
- // Page title
- $title = $parserOutput->getTitleText();
- if ( $title != '' ) {
- $this->setPageTitle( $title );
- }
// Hooks registered in the object
global $wgParserOutputHooks;
* For example:
* /w/index.php?title=Main_page should always be served; but
* /w/index.php?title=Main_page&variant=zh-cn should never be served.
- *
- * patched by Liangent and Philip
*/
function addAcceptLanguage() {
global $wgRequest, $wgContLang;
global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType;
global $wgUseAjax, $wgAjaxWatch;
global $wgEnableMWSuggest, $wgUniversalEditButton;
- global $wgArticle;
+ global $wgArticle, $wgJQueryOnEveryPage;
if( $this->mDoNothing ){
return;
wfRunHooks( 'AjaxAddScript', array( &$this ) );
if( $wgAjaxWatch && $wgUser->isLoggedIn() ) {
+ $this->includeJQuery();
$this->addScriptFile( 'ajaxwatch.js' );
}
) );
}
}
+
+ if ( $wgJQueryOnEveryPage ) {
+ $this->includeJQuery();
+ }
# Buffer output; final headers may depend on later processing
ob_start();
// Wiki is read only
$this->setPageTitle( wfMsg( 'readonly' ) );
$reason = wfReadOnlyReason();
- $this->wrapWikiMsg( '<div class="mw-readonly-error">\n$1</div>', array( 'readonlytext', $reason ) );
+ $this->wrapWikiMsg( "<div class='mw-readonly-error'>\n$1</div>", array( 'readonlytext', $reason ) );
}
// Show source, if supplied
* @return String: The doctype, opening <html>, and head element.
*/
public function headElement( Skin $sk, $includeStyle = true ) {
- global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
- global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
- global $wgContLang, $wgUseTrackbacks, $wgStyleVersion, $wgHtml5, $wgWellFormedXml;
+ global $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
+ global $wgContLang, $wgUseTrackbacks, $wgStyleVersion, $wgHtml5;
global $wgUser, $wgRequest, $wgLang;
if ( $sk->commonPrintStylesheet() ) {
}
$sk->setupUserCss( $this );
- $ret = '';
-
- if( $wgMimeType == 'text/xml' || $wgMimeType == 'application/xhtml+xml' || $wgMimeType == 'application/xml' ) {
- $ret .= "<?xml version=\"1.0\" encoding=\"$wgOutputEncoding\" ?" . ">\n";
- }
+ $dir = $wgContLang->getDir();
+ $htmlAttribs = array( 'lang' => $wgContLanguageCode, 'dir' => $dir );
+ $ret = Html::htmlHeader( $htmlAttribs );
if ( $this->getHTMLTitle() == '' ) {
$this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ) );
}
- $dir = $wgContLang->getDir();
-
- $htmlAttribs = array( 'lang' => $wgContLanguageCode, 'dir' => $dir );
if ( $wgHtml5 ) {
- if ( $wgWellFormedXml ) {
- # Unknown elements and attributes are okay in XML, but unknown
- # named entities are well-formedness errors and will break XML
- # parsers. Thus we need a doctype that gives us appropriate
- # entity definitions. The HTML5 spec permits four legacy
- # doctypes as obsolete but conforming, so let's pick one of
- # those, although it makes our pages look like XHTML1 Strict.
- # Isn't compatibility great?
- $ret .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
- } else {
- # Much saner.
- $ret .= "<!doctype html>\n";
- }
- if ( $wgHtml5Version ) {
- $htmlAttribs['version'] = $wgHtml5Version;
- }
+ # More succinct than <meta http-equiv=Content-Type>, has the
+ # same effect
+ $ret .= Html::element( 'meta', array( 'charset' => $wgOutputEncoding ) ) . "\n";
} else {
- $ret .= "<!DOCTYPE html PUBLIC \"$wgDocType\" \"$wgDTD\">\n";
- $htmlAttribs['xmlns'] = $wgXhtmlDefaultNamespace;
- foreach ( $wgXhtmlNamespaces as $tag => $ns ) {
- $htmlAttribs["xmlns:$tag"] = $ns;
- }
$this->addMeta( 'http:Content-Type', "$wgMimeType; charset=$wgOutputEncoding" );
}
- $ret .= Html::element( 'html', $htmlAttribs ) . "\n";
$openHead = Html::openElement( 'head' );
if ( $openHead ) {
# Don't bother with the newline if $head == ''
$ret .= "$openHead\n";
}
- $ret .= "<title>" . htmlspecialchars( $this->getHTMLTitle() ) . "</title>\n";
+ $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
- if ( $wgHtml5 ) {
- # More succinct than <meta http-equiv=Content-Type>, has the
- # same effect
- $ret .= Html::element( 'meta', array( 'charset' => $wgOutputEncoding ) ) . "\n";
- }
$ret .= implode( "\n", array(
$this->getHeadLinks(),
* @since 1.16
*/
public function includeJQuery( $modules = array() ) {
- global $wgStylePath, $wgStyleVersion;
+ global $wgStylePath, $wgStyleVersion, $wgJQueryVersion, $wgJQueryMinified;
$supportedModules = array( /** TODO: add things here */ );
$unsupported = array_diff( $modules, $supportedModules );
- $url = "$wgStylePath/common/jquery.min.js?$wgStyleVersion";
+ $min = $wgJQueryMinified ? '.min' : '';
+ $url = "$wgStylePath/common/jquery-$wgJQueryVersion$min.js?$wgStyleVersion";
if ( !$this->mJQueryDone ) {
$this->mJQueryDone = true;
$this->mScripts = Html::linkedScript( $url ) . "\n" . $this->mScripts;