Go to the documentation of this file.
154 # What level of 'untrustworthiness' is allowed in CSS/JS modules loaded on this page?
155 # @see ResourceLoaderModule::$origin
156 # ResourceLoaderModule::ORIGIN_ALL is assumed unless overridden;
238 'Accept-Encoding' =>
array(
'list-contains=gzip' ),
276 # Extensions should use `new RequestContext` instead of `new OutputPage` now.
289 public function redirect( $url, $responsecode =
'302' ) {
290 # Strip newlines as a paranoia check for header injection in PHP<5.1.2
291 $this->mRedirect = str_replace(
"\n",
'', $url );
292 $this->mRedirectCode = $responsecode;
310 $this->mStatusCode = $statusCode;
321 array_push( $this->mMetatags,
array(
$name, $val ) );
332 array_push( $this->mLinktags, $linkarr );
352 $this->mCanonicalUrl = $url;
361 # note: buggy CC software only reads first "meta" link
362 static $haveMeta =
false;
364 return 'alternate meta';
377 $this->mScripts .= $script .
"\n";
389 array_push( $this->mExtStyles, $url );
409 global $wgStylePath, $wgStyleVersion;
411 if ( substr(
$file, 0, 1 ) ==
'/' || preg_match(
'#^[a-z]*://#i',
$file ) ) {
414 $path =
"{$wgStylePath}/common/{$file}";
450 $filteredModules =
array();
451 foreach ( $modules
as $val ) {
455 && ( is_null( $position ) || $module->getPosition() == $position )
456 && ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) )
458 $filteredModules[] = $val;
461 return $filteredModules;
472 public function getModules( $filter =
false, $position =
null, $param =
'mModules' ) {
473 $modules = array_values( array_unique( $this->$param ) );
487 $this->mModules = array_merge( $this->mModules, (
array)$modules );
499 return $this->
getModules( $filter, $position,
'mModuleScripts' );
510 $this->mModuleScripts = array_merge( $this->mModuleScripts, (
array)$modules );
522 return $this->
getModules( $filter, $position,
'mModuleStyles' );
535 $this->mModuleStyles = array_merge( $this->mModuleStyles, (
array)$modules );
547 return $this->
getModules( $filter, $position,
'mModuleMessages' );
558 $this->mModuleMessages = array_merge( $this->mModuleMessages, (
array)$modules );
574 $this->mTarget = $target;
593 foreach ( $this->mHeadItems
as $item ) {
616 return isset( $this->mHeadItems[
$name] );
636 $this->mArticleBodyOnly = $only;
667 if ( isset( $this->mProperties[
$name] ) ) {
668 return $this->mProperties[
$name];
686 global $wgCachePages, $wgCacheEpoch, $wgUseSquid, $wgSquidMaxage;
689 wfDebug( __METHOD__ .
": CACHE DISABLED, NO TIMESTAMP\n" );
692 if ( !$wgCachePages ) {
693 wfDebug( __METHOD__ .
": CACHE DISABLED\n" );
698 $modifiedTimes =
array(
700 'user' => $this->
getUser()->getTouched(),
701 'epoch' => $wgCacheEpoch
709 $maxModified = max( $modifiedTimes );
712 $clientHeader = $this->
getRequest()->getHeader(
'If-Modified-Since' );
713 if ( $clientHeader ===
false ) {
714 wfDebug( __METHOD__ .
": client did not send If-Modified-Since header\n",
'log' );
718 # IE sends sizes after the date like this:
719 # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
720 # this breaks strtotime().
721 $clientHeader = preg_replace(
'/;.*$/',
'', $clientHeader );
724 $clientHeaderTime = strtotime( $clientHeader );
726 if ( !$clientHeaderTime ) {
727 wfDebug( __METHOD__ .
": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
735 if ( $info !==
'' ) {
741 wfDebug( __METHOD__ .
": client sent If-Modified-Since: " .
743 wfDebug( __METHOD__ .
": effective Last-Modified: " .
745 if ( $clientHeaderTime < $maxModified ) {
746 wfDebug( __METHOD__ .
": STALE, $info\n",
'log' );
751 # Give a 304 response code and disable body output
752 wfDebug( __METHOD__ .
": NOT MODIFIED, $info\n",
'log' );
753 ini_set(
'zlib.output_compression', 0 );
754 $this->
getRequest()->response()->header(
"HTTP/1.1 304 Not Modified" );
787 if ( isset( $policy[
'index'] ) ) {
790 if ( isset( $policy[
'follow'] ) ) {
803 $policy = trim( $policy );
804 if ( in_array( $policy,
array(
'index',
'noindex' ) ) ) {
805 $this->mIndexPolicy = $policy;
817 $policy = trim( $policy );
818 if ( in_array( $policy,
array(
'follow',
'nofollow' ) ) ) {
819 $this->mFollowPolicy = $policy;
830 $this->mPageTitleActionText = $text;
839 if ( isset( $this->mPageTitleActionText ) ) {
852 if (
$name instanceof Message ) {
855 $this->mHTMLtitle =
$name;
874 $this->mRedirectedFrom =
$t;
886 if (
$name instanceof Message ) {
890 # change "<script>foo&bar</script>" to "<script>foo&bar</script>"
891 # but leave "<i>foobar</i>" alone
893 $this->mPagetitle = $nameWithTags;
895 # change "<i>foo&bar</i>" to "foo&bar"
898 ->inContentLanguage()
946 if ( $str instanceof Message ) {
947 $this->mSubtitle[] = $str->setContext( $this->
getContext() )->parse();
949 $this->mSubtitle[] = $str;
960 if (
$title->isRedirect() ) {
961 $query[
'redirect'] =
'no';
970 $this->mSubtitle =
array();
979 return implode(
"<br />\n\t\t\t\t", $this->mSubtitle );
987 $this->mPrintable =
true;
1003 $this->mDoNothing =
true;
1045 $this->mFeedLinks =
array();
1059 global $wgAdvertisedFeedTypes;
1061 $this->mFeedLinks =
array();
1063 foreach ( $wgAdvertisedFeedTypes
as $type ) {
1065 if ( is_string( $val ) ) {
1079 global $wgAdvertisedFeedTypes;
1081 if ( in_array( $format, $wgAdvertisedFeedTypes ) ) {
1082 $this->mFeedLinks[$format] = $href;
1091 return count( $this->mFeedLinks ) > 0;
1119 $this->mIsarticle = $v;
1121 $this->mIsArticleRelated = $v;
1142 $this->mIsArticleRelated = $v;
1144 $this->mIsarticle =
false;
1164 $this->mLanguageLinks += $newLinkArray;
1174 $this->mLanguageLinks = $newLinkArray;
1194 if ( !is_array( $categories ) || count( $categories ) == 0 ) {
1198 # Add the links to a LinkBatch
1201 $lb->setArray( $arr );
1203 # Fetch existence plus the hiddencat property
1206 array(
'page_id',
'page_namespace',
'page_title',
'page_len',
'page_is_redirect',
'page_latest',
'pp_value' ),
1207 $lb->constructSet(
'page',
$dbr ),
1210 array(
'page_props' =>
array(
'LEFT JOIN',
array(
'pp_propname' =>
'hiddencat',
'pp_page = page_id' ) ) )
1213 # Add the results to the link cache
1216 # Set all the values to 'normal'. This can be done with array_fill_keys in PHP 5.2.0+
1217 $categories = array_combine(
1218 array_keys( $categories ),
1219 array_fill( 0, count( $categories ),
'normal' )
1222 # Mark hidden categories
1223 foreach (
$res as $row ) {
1224 if ( isset( $row->pp_value ) ) {
1225 $categories[$row->page_title] =
'hidden';
1229 # Add the remaining categories to the skin
1230 if (
wfRunHooks(
'OutputPageMakeCategoryLinks',
array( &$this, $categories, &$this->mCategoryLinks ) ) ) {
1231 foreach ( $categories
as $category =>
$type ) {
1232 $origcategory = $category;
1235 if ( $category != $origcategory ) {
1236 if ( array_key_exists( $category, $categories ) ) {
1241 $this->mCategories[] =
$title->getText();
1253 $this->mCategoryLinks =
array();
1308 return min( array_values( $this->mAllowedModules ) );
1310 return isset( $this->mAllowedModules[
$type] )
1311 ? $this->mAllowedModules[
$type]
1322 $this->mAllowedModules[
$type] = $level;
1348 public function addHTML( $text ) {
1349 $this->mBodytext .= $text;
1369 $this->mBodytext =
'';
1389 if ( !$this->mParserOptions ) {
1391 $this->mParserOptions->setEditSection(
false );
1404 $val = is_null( $revid ) ? null : intval( $revid );
1405 return wfSetVar( $this->mRevisionId, $val );
1447 $val =
array(
'time' =>
$file->getTimestamp(),
'sha1' =>
$file->getSha1() );
1449 return wfSetVar( $this->mFileVersion, $val,
true );
1489 public function addWikiText( $text, $linestart =
true, $interface =
true ) {
1546 $oldTidy = $popts->setTidy( $tidy );
1547 $popts->setInterfaceMessage( (
bool)$interface );
1551 $linestart,
true, $this->mRevisionId
1554 $popts->setTidy( $oldTidy );
1567 $this->mLanguageLinks += $parserOutput->getLanguageLinks();
1569 $this->mNewSectionLink = $parserOutput->getNewSection();
1570 $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
1572 $this->mParseWarnings = $parserOutput->getWarnings();
1573 if ( !$parserOutput->isCacheable() ) {
1576 $this->mNoGallery = $parserOutput->getNoGallery();
1577 $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
1578 $this->
addModules( $parserOutput->getModules() );
1583 $this->mPreventClickjacking = $this->mPreventClickjacking
1584 || $parserOutput->preventClickjacking();
1587 foreach ( (
array)$parserOutput->getTemplateIds()
as $ns => $dbks ) {
1588 if ( isset( $this->mTemplateIds[$ns] ) ) {
1589 $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1591 $this->mTemplateIds[$ns] = $dbks;
1595 foreach ( (
array)$parserOutput->getFileSearchOptions()
as $dbk => $data ) {
1596 $this->mImageTimeKeys[$dbk] = $data;
1600 global $wgParserOutputHooks;
1601 foreach ( $parserOutput->getOutputHooks()
as $hookInfo ) {
1602 list( $hookName, $data ) = $hookInfo;
1603 if ( isset( $wgParserOutputHooks[$hookName] ) ) {
1604 call_user_func( $wgParserOutputHooks[$hookName], $this, $parserOutput, $data );
1610 $linkFlags =
array();
1612 wfRunHooks(
'OutputPageParserOutput',
array( &$this, $parserOutput ) );
1622 $parserOutput->setTOCEnabled( $this->mEnableTOC );
1625 if ( $parserOutput->getEditSectionTokens() ) {
1626 $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks );
1628 $text = $parserOutput->getText();
1639 $this->
addHTML( $template->getHTML() );
1654 public function parse( $text, $linestart =
true, $interface =
false, $language =
null ) {
1657 if ( is_null( $this->
getTitle() ) ) {
1658 throw new MWException(
'Empty $mTitle in ' . __METHOD__ );
1663 $popts->setInterfaceMessage(
true );
1665 if ( $language !==
null ) {
1666 $oldLang = $popts->setTargetLanguage( $language );
1671 $linestart,
true, $this->mRevisionId
1675 $popts->setInterfaceMessage(
false );
1677 if ( $language !==
null ) {
1678 $popts->setTargetLanguage( $oldLang );
1681 return $parserOutput->getText();
1694 public function parseInline( $text, $linestart =
true, $interface =
false ) {
1695 $parsed = $this->
parse( $text, $linestart, $interface );
1698 if ( preg_match(
'/^<p>(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) {
1711 $this->mSquidMaxage = $maxage;
1722 return wfSetVar( $this->mEnableClientCache, $state );
1736 "{$wgCookiePrefix}Token",
1737 "{$wgCookiePrefix}LoggedOut",
1755 $cookieHeader = $this->
getRequest()->getHeader(
'cookie' );
1756 if ( $cookieHeader ===
false ) {
1760 foreach ( $cvCookies
as $cookieName ) {
1761 # Check for a simple string match, like the way squid does it
1762 if ( strpos( $cookieHeader, $cookieName ) !==
false ) {
1763 wfDebug( __METHOD__ .
": found $cookieName\n" );
1767 wfDebug( __METHOD__ .
": no cache-varying cookies found\n" );
1780 if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
1781 $this->mVaryHeader[$header] = (
array)$option;
1782 } elseif ( is_array( $option ) ) {
1783 if ( is_array( $this->mVaryHeader[$header] ) ) {
1784 $this->mVaryHeader[$header] = array_merge( $this->mVaryHeader[$header], $option );
1786 $this->mVaryHeader[$header] = $option;
1789 $this->mVaryHeader[$header] = array_unique( (
array)$this->mVaryHeader[$header] );
1799 return 'Vary: ' . join(
', ', array_keys( $this->mVaryHeader ) );
1807 public function getXVO() {
1810 $cookiesOption =
array();
1811 foreach ( $cvCookies
as $cookieName ) {
1812 $cookiesOption[] =
'string-contains=' . $cookieName;
1817 foreach ( $this->mVaryHeader
as $header => $option ) {
1818 $newheader = $header;
1819 if ( is_array( $option ) && count( $option ) > 0 ) {
1820 $newheader .=
';' . implode(
';', $option );
1822 $headers[] = $newheader;
1824 $xvo =
'X-Vary-Options: ' . implode(
',', $headers );
1838 $lang = $this->
getTitle()->getPageLanguage();
1839 if ( !$this->
getRequest()->getCheck(
'variant' ) && $lang->hasVariants() ) {
1840 $variants = $lang->getVariants();
1841 $aloption =
array();
1842 foreach ( $variants
as $variant ) {
1843 if ( $variant === $lang->getCode() ) {
1846 $aloption[] =
'string-contains=' . $variant;
1851 $variantBCP47 =
wfBCP47( $variant );
1852 if ( $variantBCP47 !== $variant ) {
1853 $aloption[] =
'string-contains=' . $variantBCP47;
1872 $this->mPreventClickjacking = $enable;
1881 $this->mPreventClickjacking =
false;
1902 global $wgBreakFrames, $wgEditPageFrameOptions;
1903 if ( $wgBreakFrames ) {
1905 } elseif ( $this->mPreventClickjacking && $wgEditPageFrameOptions ) {
1906 return $wgEditPageFrameOptions;
1915 global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgUseXVO;
1918 if ( $wgUseETag && $this->mETag ) {
1919 $response->header(
"ETag: $this->mETag" );
1925 # don't serve compressed data to clients who can't handle it
1926 # maintain different caches for logged-in users and non-logged in ones
1930 # Add an X-Vary-Options header for Squid with Wikimedia patches
1934 if ( $this->mEnableClientCache ) {
1936 $wgUseSquid && session_id() ==
'' && !$this->
isPrintable() &&
1940 # We'll purge the proxy cache explicitly, but require end user agents
1941 # to revalidate against the proxy on each visit.
1942 # Surrogate-Control controls our Squid, Cache-Control downstream caches
1943 wfDebug( __METHOD__ .
": proxy caching with ESI; {$this->mLastModified} **\n",
'log' );
1944 # start with a shorter timeout for initial testing
1945 # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
1946 $response->header(
'Surrogate-Control: max-age=' . $wgSquidMaxage .
'+' . $this->mSquidMaxage .
', content="ESI/1.0"' );
1947 $response->header(
'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
1949 # We'll purge the proxy cache for anons explicitly, but require end user agents
1950 # to revalidate against the proxy on each visit.
1951 # IMPORTANT! The Squid needs to replace the Cache-Control header with
1952 # Cache-Control: s-maxage=0, must-revalidate, max-age=0
1953 wfDebug( __METHOD__ .
": local proxy caching; {$this->mLastModified} **\n",
'log' );
1954 # start with a shorter timeout for initial testing
1955 # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
1956 $response->header(
'Cache-Control: s-maxage=' . $this->mSquidMaxage .
', must-revalidate, max-age=0' );
1959 # We do want clients to cache if they can, but they *must* check for updates
1960 # on revisiting the page.
1961 wfDebug( __METHOD__ .
": private caching; {$this->mLastModified} **\n",
'log' );
1962 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
1963 $response->header(
"Cache-Control: private, must-revalidate, max-age=0" );
1965 if ( $this->mLastModified ) {
1966 $response->header(
"Last-Modified: {$this->mLastModified}" );
1969 wfDebug( __METHOD__ .
": no caching **\n",
'log' );
1971 # In general, the absence of a last modified header should be enough to prevent
1972 # the client from using its cache. We send a few other things just to make sure.
1973 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
1974 $response->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
1975 $response->header(
'Pragma: no-cache' );
1996 public function output() {
1997 global $wgLanguageCode, $wgDebugRedirects, $wgMimeType, $wgVaryOnXFP,
1998 $wgUseAjax, $wgResponsiveImages;
2000 if ( $this->mDoNothing ) {
2008 if ( $this->mRedirect !=
'' ) {
2009 # Standards require redirect URLs to be absolute
2015 if (
wfRunHooks(
"BeforePageRedirect",
array( $this, &$redirect, &$code ) ) ) {
2016 if ( $code ==
'301' || $code ==
'303' ) {
2017 if ( !$wgDebugRedirects ) {
2019 $response->header(
"HTTP/1.1 $code $message" );
2023 if ( $wgVaryOnXFP ) {
2028 $response->header(
"Content-Type: text/html; charset=utf-8" );
2029 if ( $wgDebugRedirects ) {
2030 $url = htmlspecialchars( $redirect );
2031 print
"<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2032 print
"<p>Location: <a href=\"$url\">$url</a></p>\n";
2033 print
"</body>\n</html>\n";
2035 $response->header(
'Location: ' . $redirect );
2041 } elseif ( $this->mStatusCode ) {
2044 $response->header(
'HTTP/1.1 ' . $this->mStatusCode .
' ' . $message );
2048 # Buffer output; final headers may depend on later processing
2051 $response->header(
"Content-type: $wgMimeType; charset=UTF-8" );
2052 $response->header(
'Content-language: ' . $wgLanguageCode );
2056 if ( $frameOptions ) {
2057 $response->header(
"X-Frame-Options: $frameOptions" );
2060 if ( $this->mArticleBodyOnly ) {
2066 $modules = $sk->getDefaultModules();
2069 $coreModules =
array(
2071 'mediawiki.page.startup',
2076 if ( $wgResponsiveImages ) {
2077 $coreModules[] =
'mediawiki.hidpi';
2081 foreach ( $modules
as $group ) {
2115 public function out( $ins ) {
2140 if ( $htmlTitle !==
false ) {
2146 $this->mRedirect =
'';
2164 if ( !
$title instanceof Message ) {
2170 if ( $msg instanceof Message ) {
2172 trigger_error(
'Argument ignored: $params. The message parameters argument is discarded when the $msg argument is a Message object instead of a string.', E_USER_NOTICE );
2174 $this->
addHTML( $msg->parseAsBlock() );
2194 if ( in_array( $action,
array(
'read',
'edit',
'createpage',
'createtalk',
'upload' ) )
2195 && $this->
getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2196 && ( $errors[0][0] ==
'badaccess-groups' || $errors[0][0] ==
'badaccess-group0' )
2200 $displayReturnto =
null;
2202 # Due to bug 32276, if a user does not have read permissions,
2203 # $this->getTitle() will just give Special:Badtitle, which is
2204 # not especially useful as a returnto parameter. Use the title
2205 # from the request instead, if there was one.
2208 if ( $action ==
'edit' ) {
2209 $msg =
'whitelistedittext';
2210 $displayReturnto = $returnto;
2211 } elseif ( $action ==
'createpage' || $action ==
'createtalk' ) {
2212 $msg =
'nocreatetext';
2213 } elseif ( $action ==
'upload' ) {
2214 $msg =
'uploadnologintext';
2216 $msg =
'loginreqpagetext';
2223 $query[
'returnto'] = $returnto->getPrefixedText();
2225 if ( !$request->wasPosted() ) {
2226 $returntoquery = $request->getValues();
2227 unset( $returntoquery[
'title'] );
2228 unset( $returntoquery[
'returnto'] );
2229 unset( $returntoquery[
'returntoquery'] );
2235 $this->
msg(
'loginreqlink' )->escaped(),
2241 $this->
addHTML( $this->
msg( $msg )->rawParams( $loginLink )->
parse() );
2243 # Don't return to a page the user can't read otherwise
2244 # we'll end up in a pointless loop
2245 if ( $displayReturnto && $displayReturnto->userCan(
'read', $this->getUser() ) ) {
2294 if ( $action ==
null ) {
2295 $text = $this->
msg(
'permissionserrorstext', count( $errors ) )->plain() .
"\n\n";
2297 $action_desc = $this->
msg(
"action-$action" )->plain();
2299 'permissionserrorstext-withaction',
2302 )->plain() .
"\n\n";
2305 if ( count( $errors ) > 1 ) {
2306 $text .=
'<ul class="permissions-errors">' .
"\n";
2310 $text .= call_user_func_array(
array( $this,
'msg' ),
$error )->plain();
2315 $text .=
"<div class=\"permissions-errors\">\n" .
2316 call_user_func_array(
array( $this,
'msg' ), reset( $errors ) )->plain() .
2350 if ( $protected && empty( $reasons ) ) {
2351 $reasons[] =
array(
'badaccess-group0' );
2354 if ( !empty( $reasons ) ) {
2372 $pageLang = $this->
getTitle()->getPageLanguage();
2374 'id' =>
'wpTextbox1',
2375 'name' =>
'wpTextbox1',
2376 'cols' => $this->
getUser()->getOption(
'cols' ),
2377 'rows' => $this->
getUser()->getOption(
'rows' ),
2378 'readonly' =>
'readonly',
2379 'lang' => $pageLang->getHtmlCode(),
2380 'dir' => $pageLang->getDir(),
2386 $this->
addHTML(
"<div class='templatesUsed'>
2392 # If the title doesn't exist, it's fairly pointless to print a return
2393 # link to it. After all, you just tried editing it and couldn't, so
2394 # what's there to do there?
2395 if ( $this->
getTitle()->exists() ) {
2418 global $wgSlaveLagWarning, $wgSlaveLagCritical;
2419 if ( $lag >= $wgSlaveLagWarning ) {
2420 $message = $lag < $wgSlaveLagCritical
2463 $link = $this->
msg(
'returnto' )->rawParams(
2465 $this->
addHTML(
"<p id=\"mw-returnto\">{$link}</p>\n" );
2476 public function returnToMain( $unused =
null, $returnto =
null, $returntoquery =
null ) {
2477 if ( $returnto ==
null ) {
2478 $returnto = $this->
getRequest()->getText(
'returnto' );
2481 if ( $returntoquery ==
null ) {
2482 $returntoquery = $this->
getRequest()->getText(
'returntoquery' );
2485 if ( $returnto ===
'' ) {
2489 if ( is_object( $returnto ) ) {
2490 $titleObj = $returnto;
2494 if ( !is_object( $titleObj ) ) {
2520 # Don't bother with the newline if $head == ''
2521 $ret .=
"$openHead\n";
2540 $ret .=
Html::element(
'meta',
array(
'http-equiv' =>
'X-UA-Compatible',
'content' =>
'IE=EDGE' ) ) .
"\n";
2554 $ret .=
"$closeHead\n";
2557 $bodyClasses =
array();
2558 $bodyClasses[] =
'mediawiki';
2560 # Classes for LTR/RTL directionality support
2561 $bodyClasses[] = $userdir;
2562 $bodyClasses[] =
"sitedir-$sitedir";
2564 if ( $this->
getLanguage()->capitalizeAllNouns() ) {
2565 # A <body> class is probably not the best way to do this . . .
2566 $bodyClasses[] =
'capitalize-all-nouns';
2573 $bodyAttrs =
array();
2576 $bodyAttrs[
'class'] = implode(
' ', $bodyClasses );
2580 wfRunHooks(
'OutputPageBodyAttributes',
array( $this, $sk, &$bodyAttrs ) );
2593 if ( is_null( $this->mResourceLoader ) ) {
2609 global $wgResourceLoaderUseESI;
2611 $modules = (
array)$modules;
2615 'states' =>
array(),
2618 if ( !count( $modules ) ) {
2623 if ( count( $modules ) > 1 ) {
2625 $modules = array_unique( $modules );
2631 foreach ( $modules
as $name ) {
2633 $links[
'html'] .=
$link[
'html'];
2634 $links[
'states'] +=
$link[
'states'];
2640 if ( !is_null( $this->mTarget ) ) {
2647 foreach ( $modules
as $name ) {
2649 # Check that we're allowed to include this module on this page
2655 || ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) )
2660 $group = $module->getGroup();
2661 if ( !isset( $groups[$group] ) ) {
2662 $groups[$group] =
array();
2664 $groups[$group][
$name] = $module;
2667 foreach ( $groups
as $group => $grpModules ) {
2670 if ( ( $group ===
'user' || $group ===
'private' ) && $this->
getUser()->isLoggedIn() ) {
2679 $this->
getSkin()->getSkinName(),
2691 foreach ( $grpModules
as $key => $module ) {
2694 if ( $module->isKnownEmpty(
$context ) ) {
2695 unset( $grpModules[$key] );
2697 $links[
'states'][$key] =
'ready';
2703 if ( count( $grpModules ) === 0 ) {
2711 if ( $group ===
'private' ) {
2723 $links[
'html'] .=
"\n";
2733 if ( $group ===
'user' ) {
2736 foreach ( $grpModules
as $module ) {
2744 array_keys( $grpModules ),
2746 $this->
getSkin()->getSkinName(),
2755 if ( $useESI && $wgResourceLoaderUseESI ) {
2766 } elseif ( $loadCall ) {
2777 foreach ( $grpModules
as $key => $module ) {
2779 if ( $key !==
'startup' ) {
2780 $links[
'states'][$key] =
'loading';
2786 if ( $group ==
'noscript' ) {
2789 $links[
'html'] .=
$link .
"\n";
2805 if ( !is_array(
$link ) ) {
2809 $states +=
$link[
'states'];
2813 if ( count( $states ) ) {
2831 global $wgResourceLoaderExperimentalAsyncLoading;
2847 $embedScripts =
array(
'user.options',
'user.tokens' );
2866 if ( $wgResourceLoaderExperimentalAsyncLoading ) {
2883 global $wgUseSiteJs, $wgAllowUserJs;
2900 $modules = $this->
getModules(
true,
'bottom' );
2914 false,
array(), $inHead
2919 # XXX: additional security check/prompt?
2923 array(
'excludepage' => $this->
getTitle()->getPrefixedDBkey() ), $inHead
2934 false,
array(), $inHead
2940 false,
array(), $inHead
2951 global $wgResourceLoaderExperimentalAsyncLoading;
2959 if ( !$wgResourceLoaderExperimentalAsyncLoading ) {
2983 if ( is_array(
$keys ) ) {
2985 $this->mJsConfigVars[$key] =
$value;
3010 $canonicalSpecialPageName =
false; # bug 21115
3013 $ns =
$title->getNamespace();
3019 $relevantTitle = $sk->getRelevantTitle();
3020 $relevantUser = $sk->getRelevantUser();
3026 $curRevisionId = $wikiPage->getLatest();
3027 $articleId = $wikiPage->getId();
3030 $lang =
$title->getPageLanguage();
3033 $separatorTransTable = $lang->separatorTransformTable();
3034 $separatorTransTable = $separatorTransTable ? $separatorTransTable :
array();
3035 $compactSeparatorTransTable =
array(
3036 implode(
"\t", array_keys( $separatorTransTable ) ),
3037 implode(
"\t", $separatorTransTable ),
3039 $digitTransTable = $lang->digitTransformTable();
3040 $digitTransTable = $digitTransTable ? $digitTransTable :
array();
3041 $compactDigitTransTable =
array(
3042 implode(
"\t", array_keys( $digitTransTable ) ),
3043 implode(
"\t", $digitTransTable ),
3049 'wgCanonicalNamespace' => $canonicalNamespace,
3050 'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3051 'wgNamespaceNumber' =>
$title->getNamespace(),
3052 'wgPageName' =>
$title->getPrefixedDBkey(),
3053 'wgTitle' =>
$title->getText(),
3054 'wgCurRevisionId' => $curRevisionId,
3056 'wgArticleId' => $articleId,
3058 'wgIsRedirect' => $title->isRedirect(),
3060 'wgUserName' =>
$user->isAnon() ? null :
$user->getName(),
3061 'wgUserGroups' =>
$user->getEffectiveGroups(),
3064 'wgPageContentLanguage' => $lang->getCode(),
3065 'wgPageContentModel' =>
$title->getContentModel(),
3066 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3067 'wgDigitTransformTable' => $compactDigitTransTable,
3068 'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
3069 'wgMonthNames' => $lang->getMonthNamesArray(),
3070 'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
3071 'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3073 if (
$user->isLoggedIn() ) {
3075 $vars[
'wgUserEditCount'] =
$user->getEditCount();
3077 $vars[
'wgUserRegistration'] = $userReg !==
null ? ( $userReg * 1000 ) :
null;
3081 $vars[
'wgUserNewMsgRevisionId'] =
$user->getNewMessageRevisionId();
3091 if (
$title->isMainPage() ) {
3092 $vars[
'wgIsMainPage'] =
true;
3094 if ( $this->mRedirectedFrom ) {
3095 $vars[
'wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3097 if ( $relevantUser ) {
3098 $vars[
'wgRelevantUserName'] = $relevantUser->getName();
3121 if ( $this->
getRequest()->getVal(
'action' ) !=
'submit'
3123 || !$this->
getUser()->matchEditToken(
3124 $this->
getRequest()->getVal(
'wpEditToken' ) )
3128 if ( !$this->
getTitle()->isJsSubpage() && !$this->
getTitle()->isCssSubpage() ) {
3139 global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
3140 $wgSitename, $wgVersion,
3141 $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
3142 $wgDisableLangConversion, $wgCanonicalLanguageLinks,
3143 $wgRightsPage, $wgRightsUrl;
3150 'name' =>
'generator',
3151 'content' =>
"MediaWiki $wgVersion",
3154 $p =
"{$this->mIndexPolicy},{$this->mFollowPolicy}";
3155 if ( $p !==
'index,follow' ) {
3164 foreach ( $this->mMetatags
as $tag ) {
3165 if ( 0 == strcasecmp(
'http:', substr( $tag[0], 0, 5 ) ) ) {
3167 $tag[0] = substr( $tag[0], 5 );
3171 $tagName =
"meta-{$tag[0]}";
3172 if ( isset( $tags[$tagName] ) ) {
3173 $tagName .= $tag[1];
3178 'content' => $tag[1]
3183 foreach ( $this->mLinktags
as $tag ) {
3187 # Universal edit button
3193 $msg = $this->
msg(
'edit' )->text();
3195 'rel' =>
'alternate',
3196 'type' =>
'application/x-wiki',
3198 'href' => $this->
getTitle()->getLocalURL(
'action=edit' )
3204 'href' => $this->
getTitle()->getLocalURL(
'action=edit' )
3209 # Generally the order of the favicon and apple-touch-icon links
3210 # should not matter, but Konqueror (3.5.9 at least) incorrectly
3211 # uses whichever one appears later in the HTML source. Make sure
3212 # apple-touch-icon is specified first to avoid this.
3213 if ( $wgAppleTouchIcon !==
false ) {
3214 $tags[
'apple-touch-icon'] =
Html::element(
'link',
array(
'rel' =>
'apple-touch-icon',
'href' => $wgAppleTouchIcon ) );
3217 if ( $wgFavicon !==
false ) {
3218 $tags[
'favicon'] =
Html::element(
'link',
array(
'rel' =>
'shortcut icon',
'href' => $wgFavicon ) );
3221 # OpenSearch description link
3224 'type' =>
'application/opensearchdescription+xml',
3225 'href' =>
wfScript(
'opensearch_desc' ),
3226 'title' => $this->
msg(
'opensearch-desc' )->inContentLanguage()->
text(),
3229 if ( $wgEnableAPI ) {
3230 # Real Simple Discovery link, provides auto-discovery information
3231 # for the MediaWiki API (and potentially additional custom API
3232 # support such as WordPress or Twitter-compatible APIs for a
3233 # blogging extension, etc)
3236 'type' =>
'application/rsd+xml',
3244 if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
3245 $lang = $this->
getTitle()->getPageLanguage();
3246 if ( $lang->hasVariants() ) {
3248 $urlvar = $lang->getURLVariant();
3251 $variants = $lang->getVariants();
3252 foreach ( $variants
as $_v ) {
3254 'rel' =>
'alternate',
3256 'href' => $this->
getTitle()->getLocalURL(
array(
'variant' => $_v ) ) )
3260 $canonicalUrl = $this->
getTitle()->getLocalURL();
3267 if ( $wgRightsPage ) {
3271 $copyright = $copy->getLocalURL();
3275 if ( !$copyright && $wgRightsUrl ) {
3276 $copyright = $wgRightsUrl;
3281 'rel' =>
'copyright',
3282 'href' => $copyright )
3289 # Use the page name for the title. In principle, this could
3290 # lead to issues with having the same name for different feeds
3291 # corresponding to the same page, but we can't avoid that at
3297 # Used
messages:
'page-rss-feed' and
'page-atom-feed' (
for an easier grep)
3298 $this->
msg(
"page-{$format}-feed", $this->
getTitle()->getPrefixedText() )->
text()
3302 # Recent changes feed should appear on every page (except recentchanges,
3303 # that would be redundant). Put it after the per-page feed to avoid
3304 # changing existing behavior. It's still available, probably via a
3305 # menu in your browser. Some sites might have a different feed they'd
3306 # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3307 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3308 # If so, use it instead.
3309 if ( $wgOverrideSiteFeed ) {
3310 foreach ( $wgOverrideSiteFeed
as $type => $feedUrl ) {
3315 $this->
msg(
"site-{$type}-feed", $wgSitename )->
text()
3318 } elseif ( !$this->
getTitle()->isSpecial(
'Recentchanges' ) ) {
3320 foreach ( $wgAdvertisedFeedTypes
as $format ) {
3323 $rctitle->getLocalURL(
array(
'feed' => $format ) ),
3324 $this->
msg(
"site-{$format}-feed", $wgSitename )->text() # For grep:
'site-rss-feed',
'site-atom-feed'.
3331 global $wgEnableCanonicalServerLink;
3332 if ( $wgEnableCanonicalServerLink ) {
3333 if ( $canonicalUrl !==
false ) {
3336 $reqUrl = $this->
getRequest()->getRequestURL();
3340 if ( $canonicalUrl !==
false ) {
3342 'rel' =>
'canonical',
3343 'href' => $canonicalUrl
3365 private function feedLink( $type, $url, $text ) {
3367 'rel' =>
'alternate',
3368 'type' =>
"application/$type+xml",
3383 public function addStyle( $style, $media =
'', $condition =
'',
$dir =
'' ) {
3391 $options[
'condition'] = $condition;
3405 if ( $flip ===
'flip' && $this->
getLanguage()->isRTL() ) {
3406 # If wanted, and the interface is right-to-left, flip the CSS
3421 $this->
getSkin()->setupSkinUserCss( $this );
3433 $moduleStyles[] =
'site';
3434 $moduleStyles[] =
'noscript';
3435 $moduleStyles[] =
'user.groups';
3442 array(
'excludepage' => $this->
getTitle()->getPrefixedDBkey() )
3444 $otherTags .=
$link[
'html'];
3449 $previewedCSS = $this->
getRequest()->getText(
'wpTextbox1' );
3456 $moduleStyles[] =
'user';
3460 $moduleStyles[] =
'user.cssprefs';
3462 foreach ( $moduleStyles
as $name ) {
3467 $group = $module->getGroup();
3482 $links[] =
Html::element(
'meta',
array(
'name' =>
'ResourceLoaderDynamicStyles',
'content' =>
'' ) ) .
"\n";
3487 foreach (
array(
'site',
'noscript',
'private',
'user' )
as $group ) {
3504 foreach ( $this->mExtStyles
as $url ) {
3507 $this->mExtStyles =
array();
3532 if ( isset(
$options[
'media'] ) ) {
3534 if ( is_null( $media ) ) {
3541 if ( substr( $style, 0, 1 ) ==
'/' ||
3542 substr( $style, 0, 5 ) ==
'http:' ||
3543 substr( $style, 0, 6 ) ==
'https:' ) {
3546 global $wgStylePath, $wgStyleVersion;
3547 $url = $wgStylePath .
'/' . $style .
'?' . $wgStyleVersion;
3552 if ( isset(
$options[
'condition'] ) ) {
3553 $condition = htmlspecialchars(
$options[
'condition'] );
3554 $link =
"<!--[if $condition]>$link<![endif]-->";
3570 $screenMediaQueryRegex =
'/^(?:only\s+)?screen\b/i';
3574 'printable' =>
'print',
3575 'handheld' =>
'handheld',
3577 foreach ( $switches
as $switch => $targetMedia ) {
3578 if ( $wgRequest->getBool( $switch ) ) {
3579 if ( $media == $targetMedia ) {
3581 } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3592 if ( $targetMedia ==
'print' || $media ==
'screen' ) {
3609 $args = func_get_args();
3650 $msgSpecs = func_get_args();
3651 array_shift( $msgSpecs );
3652 $msgSpecs = array_values( $msgSpecs );
3654 foreach ( $msgSpecs
as $n => $spec ) {
3655 if ( is_array( $spec ) ) {
3658 if ( isset(
$args[
'options'] ) ) {
3659 unset(
$args[
'options'] );
3661 'Adding "options" to ' . __METHOD__ .
' is no longer supported',
3669 $s = str_replace(
'$' . (
$n + 1 ), $this->
msg( $name,
$args )->plain(),
$s );
3692 public function enableTOC( $flag =
true ) {
3693 $this->mEnableTOC = $flag;
3710 $this->mEnableSectionEditLinks = $flag;
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
static getActionName(IContextSource $context)
Get the action that will be executed, not necessarily the one passed passed through the "action" requ...
preventClickjacking( $enable=true)
Set a flag which will cause an X-Frame-Options header appropriate for edit pages to be sent.
static makeLoaderConditionalScript( $script)
Returns JS code which runs given JS code if the client-side framework is present.
addCategoryLinks( $categories)
Add an array of categories, with names in the keys.
Set options of the Parser.
getCategoryLinks()
Get the list of category links, in a 2-D array with the following format: $arr[$type][] = $link,...
addMeta( $name, $val)
Add a new "<meta>" tag To add an http-equiv meta tag, precede the name with "http:".
setArticleRelated( $v)
Set whether this page is related an article on the wiki Setting false will cause the change of "artic...
Object passed around to modules which contains information about the state of a specific loader reque...
$mRevisionId
should be private. To include the variable {{REVISIONID}}
$mHeadItems
Array of elements in "<head>". Parser might add its own headers!
getSubtitle()
Get the subtitle.
WebRequest clone which takes values from a provided array.
setAllowedModules( $type, $level)
Set the highest level of CSS/JS untrustworthiness allowed.
enableClientCache( $state)
Use enableClientCache(false) to force it to send nocache headers.
styleLink( $style, $options)
Generate <link> tags for stylesheets.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
addWikiMsg()
Add a wikitext-formatted message to the output.
getContext()
Get the RequestContext object.
getLanguageLinks()
Get the list of language links.
reduceAllowedModules( $type, $level)
As for setAllowedModules(), but don't inadvertently make the page more accessible.
wfBCP47( $code)
Get the normalised IETF language tag See unit test for examples.
addSubtitle( $str)
Add $str to the subtitle.
addAcceptLanguage()
bug 21672: Add Accept-Language to Vary and XVO headers if there's no 'variant' parameter existed in G...
bool $mEnableSectionEditLinks
Whether parser output should contain section edit links.
static formatRobotPolicy( $policy)
Converts a String robot policy into an associative array, to allow merging of several policies using ...
getJSVars()
Get an array containing the variables to be set in mw.config in JavaScript.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static makeConfigSetScript(array $configuration)
Returns JS code which will set the MediaWiki configuration array to the given value.
static htmlHeader( $attribs=array())
Constructs the opening html-tag with necessary doctypes depending on global variables.
Show an error when the user tries to do something whilst blocked.
showFileRenameError( $old, $new)
$mBodytext
Contains all of the "<body>" content. Should be private we got set/get accessors and the append() met...
getScriptsForBottomQueue( $inHead)
JS stuff to put at the 'bottom', which can either be the bottom of the "<body>" or the bottom of the ...
Title $mRedirectedFrom
If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redire...
setTitle(Title $t)
Set the Title object to use.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Class representing a list of titles The execute() method checks them all for existence and adds them ...
hasHeadItem( $name)
Check if the header item $name is already set.
__construct(IContextSource $context=null)
Constructor for OutputPage.
addModuleMessages( $modules)
Add only messages of one or more modules recognized by the resource loader.
getScript()
Get all registered JS and CSS tags for the header.
addModuleStyles( $modules)
Add only CSS of one or more modules recognized by the resource loader.
loginToUse()
Produce the stock "please login to use the wiki" page.
$mLanguageLinks
Should be private. Array of Interwiki Prefixed (non DB key) Titles (e.g. 'fr:Test page')
$mSubtitle
Should be private.
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
isArticleRelated()
Return whether this page is related an article on the wiki.
enableSectionEditLinks( $flag=true)
Enables/disables section edit links, doesn't override NOEDITSECTION
setArticleBodyOnly( $only)
Set whether the output should only contain the body of the article, without any skin,...
getFrameOptions()
Get the X-Frame-Options header value (without the name part), or false if there isn't one.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
blockedPage()
Produce a "user is blocked" page.
getRevisionId()
Get the displayed revision ID.
addParserOutput(&$parserOutput)
Add a ParserOutput object.
addWikiTextTitleTidy( $text, &$title, $linestart=true)
Add wikitext with a custom Title object and tidy enabled.
clearHTML()
Clear the body HTML.
static newMainPage()
Create a new Title for the Main Page.
setCategoryLinks( $categories)
Reset the category links (but not the category list) and add $categories.
addScript( $script)
Add raw HTML to the list of scripts (including <script> tag, etc.)
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
returnToMain( $unused=null, $returnto=null, $returntoquery=null)
Add a "return to" link pointing to a specified title, or the title indicated in the request,...
$mIsArticleRelated
Should be private.
$mHTMLtitle
Should be private. Stores contents of "<title>" tag.
wfProfileIn( $functionname)
Begin profiling of a function.
setPageTitleActionText( $text)
Set the new value of the "action text", this will be added to the "HTML title", separated from it wit...
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
if( $wgRCFilterByAge) if( $wgSkipSkin) if( $wgLocalInterwiki) if( $wgSharedPrefix===false) if(! $wgCookiePrefix) $wgCookiePrefix
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
isUserJsAllowed()
Return whether user JavaScript is allowed for this page.
getBottomScripts()
JS stuff to put at the bottom of the "<body>".
showFileNotFoundError( $name)
static getHtmlFromLoaderLinks(Array $links)
Build html output from an array of links from makeResourceLoaderLink.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled also a ContextSource error or success such as when responding to a resource loader request or generating HTML output & $resourceLoader
getModuleStyles( $filter=false, $position=null)
Get the list of module CSS to include on this page.
addToBodyAttributes( $out, &$bodyAttrs)
This will be called by OutputPage::headElement when it is creating the "<body>" tag,...
versionRequired( $version)
Display an error page indicating that a given version of MediaWiki is required to use it.
parseInline( $text, $linestart=true, $interface=false)
Parse wikitext, strip paragraphs, and return the HTML.
addScriptFile( $file, $version=null)
Add a JavaScript file out of skins/common, or a given relative path.
parserOptions( $options=null)
Get/set the ParserOptions object to use for wikitext parsing.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
static escapeClass( $class)
Given a value, escape it so that it can be used as a CSS class and return it.
getFileVersion()
Get the displayed file version.
getSyndicationLinks()
Return URLs for each supported syndication format for this page.
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
getRequest()
Get the WebRequest object.
Show an error when a user tries to do something they do not have the necessary permissions for.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. Handler functions that modify $result should generally return false to further attempts at conversion. 'ContribsPager you ll need to handle error messages
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
getRedirect()
Get the URL to redirect to, or an empty string if not redirect URL set.
setCanonicalUrl( $url)
Set the URL to be used for the <link rel="canonical">.
$mExtStyles
Additional stylesheets. Looks like this is for extensions. Might be replaced by resource loader.
getUser()
Get the User object.
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
getTitle()
Get the Title object.
getHtmlElementAttributes()
static inlineScript( $contents)
Output a "<script>" tag with the given contents.
permissionRequired( $permission)
Display an error page noting that a given permission bit is required.
static stripAllTags( $text)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed,...
showFileDeleteError( $name)
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
addHTML( $text)
Append $text to the body HTML.
addHeadItem( $name, $value)
Add or replace an header item to the output.
addWikiTextTidy( $text, $linestart=true)
Add wikitext with tidy enabled.
$mArticleBodyOnly
Flag if output should only contain the body of the article.
getModuleScripts( $filter=false, $position=null)
Get the list of module JS to include on this page.
getRevisionTimestamp()
Get the timestamp of displayed revision.
addWikiMsgArray( $name, $args)
Add a wikitext-formatted message to the output.
enableTOC( $flag=true)
Enables/disables TOC, doesn't override NOTOC
static transformCssMedia( $media)
Transform "media" attribute based on request parameters.
setLastModified( $timestamp)
Override the last modified timestamp.
$mNoGallery
Comes from the parser.
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
getLanguage()
Get the Language object.
static makeLoaderQuery( $modules, $lang, $skin, $user=null, $version=null, $debug=false, $only=null, $printable=false, $handheld=false, $extraQuery=array())
Build a query array (array representation of query string) for load.php.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
forceHideNewSectionLink()
Forcibly hide the new section link?
addWikiTextWithTitle( $text, &$title, $linestart=true)
Add wikitext with a custom Title object.
static closeElement( $element)
Returns "</$element>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
static isXmlMimeType( $mimetype)
Determines if the given mime type is xml.
readOnlyPage( $source=null, $protected=false, $reasons=array(), $action=null)
Display a page stating that the Wiki is in read-only mode, and optionally show the source of the page...
showErrorPage( $title, $msg, $params=array())
Output a standard error page.
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
getModuleMessages( $filter=false, $position=null)
Get the list of module messages to include on this page.
if( $wgAPIRequestLog) $lb
Implements some public methods and some protected utility functions which are required by multiple ch...
feedLink( $type, $url, $text)
Generate a "<link rel/>" for a feed.
$mLastModified
mLastModified and mEtag are used for sending cache control.
addStyle( $style, $media='', $condition='', $dir='')
Add a local or specified stylesheet, with the given media options.
sendCacheControl()
Send cache control HTTP headers.
setETag( $tag)
Set the value of the ETag HTTP header, only used if $wgUseETag is true.
out( $ins)
Actually output something with print.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
wfRestoreWarnings()
Restore error level to previous value.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
output()
Finally, all the text has been munged and accumulated into the object, let's actually output it:
bool $mEnableTOC
Whether parser output should contain table of contents.
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
$mInlineStyles
Inline CSS styles.
setFileVersion( $file)
Set the displayed file version.
showUnexpectedValueError( $name, $val)
static makeLoaderStateScript( $name, $state=null)
Returns a JS call to mw.loader.state, which sets the state of a module or modules to a given value.
getResourceLoader()
Get a ResourceLoader object associated with this OutputPage.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
static linkedScript( $url)
Output a "<script>" tag linking to the given URL, e.g., "<script src=foo.js></script>".
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
getWikiPage()
Get the WikiPage object.
setFeedAppendQuery( $val)
Add default feeds to the page header This is mainly kept for backward compatibility,...
isDisabled()
Return whether the output will be completely disabled.
wfTimestampOrNull( $outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.
setRevisionId( $revid)
Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISION...
wfProfileOut( $functionname='missing')
Stop profiling of a function.
setArticleFlag( $v)
Set whether the displayed content is related to the source of the corresponding article on the wiki S...
disallowUserJs()
Do not allow scripts which can be modified by wiki users to load on this page; only allow scripts bun...
getSkin()
Get the Skin object.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
setSubtitle( $str)
Replace the subtitle with $str.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
addVaryHeader( $header, $option=null)
Add an HTTP header that will influence on the cache.
static getStatusMessage( $code)
Get the message associated with the HTTP response code $code.
addWikiText( $text, $linestart=true, $interface=true)
Convert wikitext to HTML and add it to the buffer Default assumes that the current page title will be...
Show an error when the user hits a rate limit.
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
getVaryHeader()
Return a Vary: header on which to vary caches.
addModules( $modules)
Add one or more modules recognized by the resource loader.
showLagWarning( $lag)
Show a warning about slave lag.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
appendSubtitle( $str)
Add $str to the subtitle.
getPageTitleActionText()
Get the value of the "action text".
getCacheVaryCookies()
Get the list of cookies that will influence on the cache.
getHeadItems()
Get all header items in a string.
when a variable name is used in a it is silently declared as a new masking the global
addLanguageLinks( $newLinkArray)
Add new language links.
formatPermissionsErrorMessage( $errors, $action=null)
Format a list of error messages.
static makeLoaderURL( $modules, $lang, $skin, $user=null, $version=null, $debug=false, $only=null, $printable=false, $handheld=false, $extraQuery=array())
Build a load.php URL.
return false to override stock group removal can be modified modifiable will be added to $_SESSION & $cookies
getOrigin()
Get this module's origin.
addBacklinkSubtitle(Title $title)
Add a subtitle containing a backlink to a page.
setContext(IContextSource $context)
Set the IContextSource object.
addParserOutputNoText(&$parserOutput)
Add a ParserOutput object, but without Html.
isArticle()
Return whether the content displayed page is related to the source of the corresponding article on th...
This class should be covered by a general architecture document which does not exist as of January 20...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
ParserOptions $mParserOptions
lazy initialised, use parserOptions()
addLink( $linkarr)
Add a new <link> tag to the page header.
addInlineScript( $script)
Add a self-contained script tag with the given contents.
getArticleBodyOnly()
Return whether the output will contain only the body of the article.
getPreventClickjacking()
Get the prevent-clickjacking flag.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
getExtStyle()
Get all styles added by extensions.
setStatusCode( $statusCode)
Set the HTTP status code to send with the output.
includeJQuery( $modules=array())
Include jQuery core.
makeResourceLoaderLink( $modules, $only, $useESI=false, array $extraQuery=array(), $loadCall=false)
TODO: Document.
haveCacheVaryCookies()
Check if the request has a cache-varying cookie header If it does, it's very important that we don't ...
getPageTitle()
Return the "page title", i.e.
disable()
Disable output completely, i.e.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
sectionEditLinksEnabled()
setIndexPolicy( $policy)
Set the index policy for the page, but leave the follow policy un- touched.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
presenting them properly to the user as errors is done by the caller $title
getPageClasses( $title)
TODO: document.
showPermissionsErrorPage( $errors, $action=null)
Output a standard permission error page.
setRevisionTimestamp( $timestamp)
Set the timestamp of the revision which will be displayed.
Allows to change the fields on the form that will be generated $name
getHeadItemsArray()
Get an array of head items.
wfClearOutputBuffers()
More legible than passing a 'false' parameter to wfResetOutputBuffers():
rateLimited()
Turn off regular page output and return an error response for when rate limiting has triggered.
const ORIGIN_USER_INDIVIDUAL
const TS_ISO_8601_BASIC
ISO 8601 basic format with no timezone: 19860209T200000Z.
getProperty( $name)
Get an additional output property.
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
setSquidMaxage( $maxage)
Set the value of the "s-maxage" part of the "Cache-control" HTTP header.
setTarget( $target)
Sets ResourceLoader target for load.php links.
setHTMLTitle( $name)
"HTML title" means the contents of "<title>".
$styles
An array of stylesheet filenames (relative from skins path), with options for CSS media,...
static newFromURL( $url)
THIS IS NOT THE FUNCTION YOU WANT.
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
$mProperties
Additional key => value data.
wrapWikiMsg( $wrap)
This function takes a number of message/argument specifications, wraps them in some overall structure...
buildCssLinks()
Build a set of "<link>" elements for the stylesheets specified in the $this->styles array.
static inlineStyle( $contents, $media='all')
Output a "<style>" tag with the given contents for the given media type (if any).
filterModules( $modules, $position=null, $type=ResourceLoaderModule::TYPE_COMBINED)
Filter an array of modules to remove insufficiently trustworthy members, and modules which are no lon...
prependHTML( $text)
Prepend $text to the body HTML.
static formatTemplates( $templates, $preview=false, $section=false, $more=null)
Returns HTML for the "templates used on this page" list.
static exists( $index)
Returns whether the specified namespace exists.
getHTMLTitle()
Return the "HTML title", i.e.
showFileCopyError( $old, $new)
const ORIGIN_CORE_INDIVIDUAL
clearSubtitle()
Clear the subtitles.
getMetadataAttribute()
Get the value of the "rel" attribute for metadata links.
static getMessage( $code)
Get the message associated with HTTP response code $code.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
$mScripts
Should be private.
getModules( $filter=false, $position=null, $param='mModules')
Get the list of modules to include on this page.
Interface for objects which can provide a context on request.
setFollowPolicy( $policy)
Set the follow policy for the page, but leave the index policy un- touched.
setPageTitle( $name)
"Page title" means the contents of <h1>.
$mDebugtext
Holds the debug lines that will be output as comments in page source if $wgDebugComments is enabled.
if(PHP_SAPI !='cli') $file
checkLastModified( $timestamp)
checkLastModified tells the client to use the client-cached page if possible.
Represents a title within MediaWiki.
Abstraction for resource loader modules, with name registration and maxage functionality.
addReturnTo( $title, $query=array(), $text=null, $options=array())
Add a "return to" link pointing to a specified title.
getAllowedModules( $type)
Show what level of JavaScript / CSS untrustworthiness is allowed on this page.
Dynamic JavaScript and CSS resource loading system.
setProperty( $name, $value)
Set an additional output property.
isPrintable()
Return whether the page is "printable".
setSyndicated( $show=true)
Add or remove feed links in the page header This is mainly kept for backward compatibility,...
string null $mTarget
ResourceLoader target for load.php links.
addInlineStyle( $style_css, $flip='noflip')
Adds inline CSS styles.
if(count( $args)==0) $dir
userCanPreview()
To make it harder for someone to slip a user a fake user-JavaScript or user-CSS preview,...
static linkedStyle( $url, $media='all')
Output a "<link rel=stylesheet>" linking to the given URL for the given media type (if any).
addExtensionStyle( $url)
Register and add a stylesheet from an extension directory.
static inDebugMode()
Determine whether debug mode was requested Order of priority is 1) request param, 2) cookie,...
setLanguageLinks( $newLinkArray)
Reset the language links and add new language links.
setRedirectedFrom( $t)
Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
addWikiTextTitle( $text, Title $title, $linestart, $tidy=false, $interface=false)
Add wikitext with a custom Title object.
$mMetatags
Should be private. Used with addMeta() which adds "<meta>".
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
getHeadScripts()
JS stuff to put in the "<head>".
redirect( $url, $responsecode='302')
Redirect to $url rather than displaying the normal page.
setPrintable()
Set the page as printable, i.e.
$mJQueryDone
Whether jQuery is already handled.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
addModuleScripts( $modules)
Add only JS of one or more modules recognized by the resource loader.
allowClickjacking()
Turn off frame-breaking.
addElement( $element, $attribs=array(), $contents='')
Shortcut for adding an Html::element via addHTML.
showFatalError( $message)
getHTML()
Get the body HTML.
if(PHP_SAPI !='cli') $source
static normalizeCharReferences( $text)
Ensure that any entities and character references are legal for XML and XHTML specifically.
static addModules(OutputPage $out)
Add ResourceLoader modules to the OutputPage object if debugging is enabled.
addMetadataLink( $linkarr)
Add a new <link> with "rel" attribute set to "meta".
showNewSectionLink()
Show an "add new section" link?
static transform( $css, $swapLtrRtlInURL=false, $swapLeftRightInURL=false)
Transform an LTR stylesheet to RTL.
parse( $text, $linestart=true, $interface=false, $language=null)
Parse wikitext and return the HTML.
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
addJsConfigVars( $keys, $value=null)
Add one or more variables to be set in mw.config in JavaScript.
$mPrintable
Should be private.
The main skin class which provides methods and properties for all other skins.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
$mPagetitle
Should be private - has getter and setter. Contains the HTML title.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
getJsConfigVars()
Get the javascript config vars to include on this page.
getTemplateIds()
Get the templates used on this page.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
isSyndicated()
Should we output feed links for this page?
getFileSearchOptions()
Get the files used on this page.
$mFeedLinks
Handles the atom / rss links.
bool $mDoNothing
Whether output is disabled.
static & singleton()
Get an instance of this class.
getXVO()
Get a complete X-Vary-Options header.
const TS_RFC2822
RFC 2822 format, for E-mail and HTTP headers.
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
prepareErrorPage( $pageTitle, $htmlTitle=false)
Prepare this object to display an error page; disable caching and indexing, clear the current text an...
addTemplate(&$template)
Add the output of a QuickTemplate to the output buffer.
getFeedAppendQuery()
Will currently always return null.
$mPageLinkTitle
Used by skin template.
$mIsarticle
Should be private. Is the displayed content related to the source of the corresponding wiki article.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
addFeedLink( $format, $href)
Add a feed link to the page header.
setRobotPolicy( $policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes two arrays as input, and returns a CGI-style string, e.g.
static removeHTMLtags( $text, $processCallback=null, $args=array(), $extratags=array(), $removetags=array())
Cleans up HTML, removes dangerous tags and attributes, and removes HTML comments.
headElement(Skin $sk, $includeStyle=true)
getCategories()
Get the list of category names this page belongs to.