Go to the documentation of this file.
26 use WrappedString\WrappedString;
27 use WrappedString\WrappedStringList;
266 'Accept-Encoding' => [
'match=gzip' ],
318 # Extensions should use `new RequestContext` instead of `new OutputPage` now.
331 public function redirect( $url, $responsecode =
'302' ) {
332 # Strip newlines as a paranoia check for header injection in PHP<5.1.2
333 $this->mRedirect = str_replace(
"\n",
'', $url );
334 $this->mRedirectCode = $responsecode;
355 $this->copyrightUrl = $url;
364 $this->mStatusCode = $statusCode;
375 array_push( $this->mMetatags, [
$name, $val ] );
396 array_push( $this->mLinktags, $linkarr );
427 $this->mCanonicalUrl = $url;
447 # note: buggy CC software only reads first "meta" link
448 static $haveMeta =
false;
450 return 'alternate meta';
465 $this->mScripts .= $script;
479 array_push( $this->mExtStyles, $url );
503 if ( substr( $file, 0, 1 ) ==
'/' || preg_match(
'#^[a-z]*://#i', $file ) ) {
506 $path = $this->
getConfig()->get(
'StylePath' ) .
"/common/{$file}";
508 if ( is_null( $version ) ) {
509 $version = $this->
getConfig()->get(
'StyleVersion' );
536 $filteredModules = [];
541 && ( is_null( $position ) || $module->getPosition() == $position )
543 if ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) ) {
547 $filteredModules[] = $val;
550 return $filteredModules;
554 static $warnings = [];
555 if ( isset( $warnings[$this->mTarget][$moduleName] ) ) {
560 'Module "{module}" not loadable on target "{target}".',
562 'module' => $moduleName,
563 'target' => $this->mTarget,
576 public function getModules( $filter =
false, $position =
null, $param =
'mModules',
579 $modules = array_values( array_unique( $this->$param ) );
593 $this->mModules = array_merge( $this->mModules, (
array)
$modules );
604 return $this->
getModules( $filter, $position,
'mModuleScripts',
617 $this->mModuleScripts = array_merge( $this->mModuleScripts, (
array)
$modules );
628 return $this->
getModules( $filter, $position,
'mModuleStyles',
643 $this->mModuleStyles = array_merge( $this->mModuleStyles, (
array)
$modules );
659 $this->mTarget = $target;
694 $this->mHeadItems = array_merge( $this->mHeadItems, (
array)$values );
704 return isset( $this->mHeadItems[
$name] );
722 $this->mArticleBodyOnly = $only;
753 if ( isset( $this->mProperties[
$name] ) ) {
754 return $this->mProperties[
$name];
772 if ( !$timestamp || $timestamp ==
'19700101000000' ) {
773 wfDebug( __METHOD__ .
": CACHE DISABLED, NO TIMESTAMP\n" );
777 if ( !$config->get(
'CachePages' ) ) {
778 wfDebug( __METHOD__ .
": CACHE DISABLED\n" );
784 'page' => $timestamp,
785 'user' => $this->
getUser()->getTouched(),
786 'epoch' => $config->get(
'CacheEpoch' )
788 if ( $config->get(
'UseSquid' ) ) {
790 $modifiedTimes[
'sepoch'] =
wfTimestamp( TS_MW, time() - $config->get(
'SquidMaxage' ) );
792 Hooks::run(
'OutputPageCheckLastModified', [ &$modifiedTimes, $this ] );
794 $maxModified = max( $modifiedTimes );
795 $this->mLastModified =
wfTimestamp( TS_RFC2822, $maxModified );
797 $clientHeader = $this->
getRequest()->getHeader(
'If-Modified-Since' );
798 if ( $clientHeader ===
false ) {
799 wfDebug( __METHOD__ .
": client did not send If-Modified-Since header",
'private' );
803 # IE sends sizes after the date like this:
804 # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
805 # this breaks strtotime().
806 $clientHeader = preg_replace(
'/;.*$/',
'', $clientHeader );
808 MediaWiki\suppressWarnings();
809 $clientHeaderTime = strtotime( $clientHeader );
810 MediaWiki\restoreWarnings();
811 if ( !$clientHeaderTime ) {
813 .
": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
816 $clientHeaderTime =
wfTimestamp( TS_MW, $clientHeaderTime );
821 if ( $info !==
'' ) {
827 wfDebug( __METHOD__ .
": client sent If-Modified-Since: " .
828 wfTimestamp( TS_ISO_8601, $clientHeaderTime ),
'private' );
829 wfDebug( __METHOD__ .
": effective Last-Modified: " .
830 wfTimestamp( TS_ISO_8601, $maxModified ),
'private' );
831 if ( $clientHeaderTime < $maxModified ) {
832 wfDebug( __METHOD__ .
": STALE, $info",
'private' );
837 # Give a 304 Not Modified response code and disable body output
838 wfDebug( __METHOD__ .
": NOT MODIFIED, $info",
'private' );
839 ini_set(
'zlib.output_compression', 0 );
840 $this->
getRequest()->response()->statusHeader( 304 );
859 $this->mLastModified =
wfTimestamp( TS_RFC2822, $timestamp );
873 if ( isset( $policy[
'index'] ) ) {
876 if ( isset( $policy[
'follow'] ) ) {
889 $policy = trim( $policy );
890 if ( in_array( $policy, [
'index',
'noindex' ] ) ) {
891 $this->mIndexPolicy = $policy;
903 $policy = trim( $policy );
904 if ( in_array( $policy, [
'follow',
'nofollow' ] ) ) {
905 $this->mFollowPolicy = $policy;
916 $this->mPageTitleActionText = $text;
935 if (
$name instanceof Message ) {
938 $this->mHTMLtitle =
$name;
957 $this->mRedirectedFrom =
$t;
971 if (
$name instanceof Message ) {
975 # change "<script>foo&bar</script>" to "<script>foo&bar</script>"
976 # but leave "<i>foobar</i>" alone
977 $nameWithTags = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags(
$name ) );
978 $this->mPagetitle = $nameWithTags;
980 # change "<i>foo&bar</i>" to "foo&bar"
982 $this->
msg(
'pagetitle' )->rawParams( Sanitizer::stripAllTags( $nameWithTags ) )
983 ->inContentLanguage()
1021 if ( $str instanceof Message ) {
1022 $this->mSubtitle[] = $str->setContext( $this->
getContext() )->parse();
1024 $this->mSubtitle[] = $str;
1037 if (
$title->isRedirect() ) {
1038 $query[
'redirect'] =
'no';
1040 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1059 $this->mSubtitle = [];
1068 return implode(
"<br />\n\t\t\t\t", $this->mSubtitle );
1076 $this->mPrintable =
true;
1092 $this->mDoNothing =
true;
1134 $this->mFeedLinks = [];
1148 $this->mFeedLinks = [];
1152 if ( is_string( $val ) ) {
1166 if ( in_array( $format, $this->
getConfig()->
get(
'AdvertisedFeedTypes' ) ) ) {
1167 $this->mFeedLinks[$format] = $href;
1176 return count( $this->mFeedLinks ) > 0;
1204 $this->mIsarticle = $v;
1206 $this->mIsArticleRelated = $v;
1227 $this->mIsArticleRelated = $v;
1229 $this->mIsarticle =
false;
1249 $this->mLanguageLinks += $newLinkArray;
1259 $this->mLanguageLinks = $newLinkArray;
1279 if ( !is_array( $categories ) ||
count( $categories ) == 0 ) {
1285 # Set all the values to 'normal'.
1286 $categories = array_fill_keys( array_keys( $categories ),
'normal' );
1288 # Mark hidden categories
1289 foreach (
$res as $row ) {
1290 if ( isset( $row->pp_value ) ) {
1291 $categories[$row->page_title] =
'hidden';
1296 $outputPage = $this;
1297 # Add the remaining categories to the skin
1299 'OutputPageMakeCategoryLinks',
1300 [ &$outputPage, $categories, &$this->mCategoryLinks ] )
1302 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1303 foreach ( $categories
as $category =>
$type ) {
1305 $category = (
string)$category;
1306 $origcategory = $category;
1312 if ( $category != $origcategory && array_key_exists( $category, $categories ) ) {
1327 # Add the links to a LinkBatch
1332 # Fetch existence plus the hiddencat property
1334 $fields = array_merge(
1336 [
'page_namespace',
'page_title',
'pp_value' ]
1339 $res =
$dbr->select( [
'page',
'page_props' ],
1341 $lb->constructSet(
'page',
$dbr ),
1344 [
'page_props' => [
'LEFT JOIN', [
1345 'pp_propname' =>
'hiddencat',
1350 # Add the results to the link cache
1362 $this->mCategoryLinks = [];
1388 if (
$type ===
'all' ) {
1389 $allCategories = [];
1390 foreach ( $this->mCategories
as $categories ) {
1391 $allCategories = array_merge( $allCategories, $categories );
1393 return $allCategories;
1395 if ( !isset( $this->mCategories[
$type] ) ) {
1396 throw new InvalidArgumentException(
'Invalid category type given: ' .
$type );
1398 return $this->mCategories[
$type];
1413 ksort( $this->mIndicators );
1438 $text = $this->
msg(
'helppage-top-gethelp' )->escaped();
1440 if ( $overrideBaseUrl ) {
1443 $toUrlencoded =
wfUrlencode( str_replace(
' ',
'_', $to ) );
1444 $helpUrl =
"//www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded";
1451 'target' =>
'_blank',
1452 'class' =>
'mw-helplink',
1476 if ( $this->
getConfig()->
get(
'AllowSiteCSSOnRestrictedPages' ) ) {
1495 return min( array_values( $this->mAllowedModules ) );
1497 return isset( $this->mAllowedModules[
$type] )
1498 ? $this->mAllowedModules[
$type]
1531 $this->mBodytext .= $text;
1551 $this->mBodytext =
'';
1575 $anonPO->setEditSection(
false );
1576 $anonPO->setAllowUnsafeRawHtml(
false );
1577 if ( !
$options->matches( $anonPO ) ) {
1583 if ( !$this->mParserOptions ) {
1589 $po->setEditSection(
false );
1590 $po->setAllowUnsafeRawHtml(
false );
1591 $po->isBogus =
true;
1599 $this->mParserOptions->setEditSection(
false );
1600 $this->mParserOptions->setAllowUnsafeRawHtml(
false );
1606 return wfSetVar( $this->mParserOptions,
null,
true );
1620 $val = is_null( $revid ) ? null : intval( $revid );
1621 return wfSetVar( $this->mRevisionId, $val );
1641 return wfSetVar( $this->mRevisionTimestamp, $timestamp );
1662 if ( $file instanceof
File && $file->
exists() ) {
1663 $val = [
'time' => $file->getTimestamp(),
'sha1' => $file->getSha1() ];
1665 return wfSetVar( $this->mFileVersion, $val,
true );
1706 public function addWikiText( $text, $linestart =
true, $interface =
true ) {
1758 $tidy =
false, $interface =
false
1763 $oldTidy = $popts->setTidy( $tidy );
1764 $popts->setInterfaceMessage( (
bool)$interface );
1768 $linestart,
true, $this->mRevisionId
1771 $popts->setTidy( $oldTidy );
1800 $this->mHideNewSectionLink =
$parserOutput->getHideNewSection();
1806 $this->mHeadItems = array_merge( $this->mHeadItems,
$parserOutput->getHeadItems() );
1811 $this->mPreventClickjacking = $this->mPreventClickjacking
1816 if ( isset( $this->mTemplateIds[$ns] ) ) {
1817 $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1819 $this->mTemplateIds[$ns] = $dbks;
1824 $this->mImageTimeKeys[$dbk] = $data;
1828 $parserOutputHooks = $this->
getConfig()->get(
'ParserOutputHooks' );
1830 list( $hookName, $data ) = $hookInfo;
1831 if ( isset( $parserOutputHooks[$hookName] ) ) {
1832 call_user_func( $parserOutputHooks[$hookName], $this,
$parserOutput, $data );
1842 if ( !$this->limitReportJSData ) {
1843 $this->limitReportJSData =
$parserOutput->getLimitReportJSData();
1850 $outputPage = $this;
1851 Hooks::run(
'LanguageLinks', [ $this->
getTitle(), &$this->mLanguageLinks, &$linkFlags ] );
1881 $outputPage = $this;
1882 Hooks::run(
'OutputPageBeforeHTML', [ &$outputPage, &$text ] );
1897 $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks );
1924 public function parse( $text, $linestart =
true, $interface =
false, $language =
null ) {
1927 if ( is_null( $this->
getTitle() ) ) {
1928 throw new MWException(
'Empty $mTitle in ' . __METHOD__ );
1933 $popts->setInterfaceMessage(
true );
1935 if ( $language !==
null ) {
1936 $oldLang = $popts->setTargetLanguage( $language );
1941 $linestart,
true, $this->mRevisionId
1945 $popts->setInterfaceMessage(
false );
1947 if ( $language !==
null ) {
1948 $popts->setTargetLanguage( $oldLang );
1964 public function parseInline( $text, $linestart =
true, $interface =
false ) {
1965 $parsed = $this->
parse( $text, $linestart, $interface );
1966 return Parser::stripOuterParagraph( $parsed );
1983 $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
1993 $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
2012 $maxTTL = $maxTTL ?: $this->
getConfig()->get(
'SquidMaxage' );
2014 if ( $mtime ===
null || $mtime ===
false ) {
2019 $adaptiveTTL = max( .9 * $age, $minTTL );
2020 $adaptiveTTL = min( $adaptiveTTL, $maxTTL );
2024 return $adaptiveTTL;
2035 return wfSetVar( $this->mEnableClientCache, $state );
2045 if ( $cookies ===
null ) {
2047 $cookies = array_merge(
2048 SessionManager::singleton()->getVaryCookies(),
2052 $config->get(
'CacheVaryCookies' )
2054 Hooks::run(
'GetCacheVaryCookies', [ $this, &$cookies ] );
2068 if (
$request->getCookie( $cookieName,
'',
'' ) !==
'' ) {
2069 wfDebug( __METHOD__ .
": found $cookieName\n" );
2073 wfDebug( __METHOD__ .
": no cache-varying cookies found\n" );
2086 if ( !array_key_exists(
$header, $this->mVaryHeader ) ) {
2087 $this->mVaryHeader[
$header] = [];
2089 if ( !is_array( $option ) ) {
2092 $this->mVaryHeader[
$header] = array_unique( array_merge( $this->mVaryHeader[
$header], $option ) );
2107 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2110 return 'Vary: ' . implode(
', ', array_keys( $this->mVaryHeader ) );
2119 $this->mLinkHeader[] =
$header;
2128 if ( !$this->mLinkHeader ) {
2132 return 'Link: ' . implode(
',', $this->mLinkHeader );
2143 $cookiesOption = [];
2144 foreach ( $cvCookies
as $cookieName ) {
2145 $cookiesOption[] =
'param=' . $cookieName;
2149 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2154 foreach ( $this->mVaryHeader
as $header => $option ) {
2156 if ( is_array( $option ) &&
count( $option ) > 0 ) {
2157 $newheader .=
';' . implode(
';', $option );
2159 $headers[] = $newheader;
2161 $key =
'Key: ' . implode(
',', $headers );
2181 if ( !$this->
getRequest()->getCheck(
'variant' ) &&
$lang->hasVariants() ) {
2182 $variants =
$lang->getVariants();
2184 foreach ( $variants
as $variant ) {
2185 if ( $variant ===
$lang->getCode() ) {
2188 $aloption[] =
'substr=' . $variant;
2193 $variantBCP47 =
wfBCP47( $variant );
2194 if ( $variantBCP47 !== $variant ) {
2195 $aloption[] =
'substr=' . $variantBCP47;
2214 $this->mPreventClickjacking = $enable;
2223 $this->mPreventClickjacking =
false;
2245 if ( $config->get(
'BreakFrames' ) ) {
2247 } elseif ( $this->mPreventClickjacking && $config->get(
'EditPageFrameOptions' ) ) {
2248 return $config->get(
'EditPageFrameOptions' );
2263 # don't serve compressed data to clients who can't handle it
2264 # maintain different caches for logged-in users and non-logged in ones
2267 if ( $config->get(
'UseKeyHeader' ) ) {
2271 if ( $this->mEnableClientCache ) {
2273 $config->get(
'UseSquid' ) &&
2275 !SessionManager::getGlobalSession()->isPersistent() &&
2277 $this->mCdnMaxage != 0 &&
2280 if ( $config->get(
'UseESI' ) ) {
2281 # We'll purge the proxy cache explicitly, but require end user agents
2282 # to revalidate against the proxy on each visit.
2283 # Surrogate-Control controls our CDN, Cache-Control downstream caches
2285 ": proxy caching with ESI; {$this->mLastModified} **",
'private' );
2286 # start with a shorter timeout for initial testing
2287 # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
2289 "Surrogate-Control: max-age={$config->get( 'SquidMaxage' )}" .
2290 "+{$this->mCdnMaxage}, content=\"ESI/1.0\""
2292 $response->header(
'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
2294 # We'll purge the proxy cache for anons explicitly, but require end user agents
2295 # to revalidate against the proxy on each visit.
2296 # IMPORTANT! The CDN needs to replace the Cache-Control header with
2297 # Cache-Control: s-maxage=0, must-revalidate, max-age=0
2299 ": local proxy caching; {$this->mLastModified} **",
'private' );
2300 # start with a shorter timeout for initial testing
2301 # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2303 "s-maxage={$this->mCdnMaxage}, must-revalidate, max-age=0" );
2306 # We do want clients to cache if they can, but they *must* check for updates
2307 # on revisiting the page.
2308 wfDebug( __METHOD__ .
": private caching; {$this->mLastModified} **",
'private' );
2309 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
2310 $response->header(
"Cache-Control: private, must-revalidate, max-age=0" );
2312 if ( $this->mLastModified ) {
2313 $response->header(
"Last-Modified: {$this->mLastModified}" );
2316 wfDebug( __METHOD__ .
": no caching **",
'private' );
2318 # In general, the absence of a last modified header should be enough to prevent
2319 # the client from using its cache. We send a few other things just to make sure.
2320 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
2321 $response->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2322 $response->header(
'Pragma: no-cache' );
2339 if ( $this->mDoNothing ) {
2340 return $return ?
'' :
null;
2346 if ( $this->mRedirect !=
'' ) {
2347 # Standards require redirect URLs to be absolute
2353 if (
Hooks::run(
"BeforePageRedirect", [ $this, &$redirect, &
$code ] ) ) {
2355 if ( !$config->get(
'DebugRedirects' ) ) {
2360 if ( $config->get(
'VaryOnXFP' ) ) {
2365 $response->header(
"Content-Type: text/html; charset=utf-8" );
2366 if ( $config->get(
'DebugRedirects' ) ) {
2367 $url = htmlspecialchars( $redirect );
2368 print
"<!DOCTYPE html>\n<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2369 print
"<p>Location: <a href=\"$url\">$url</a></p>\n";
2370 print
"</body>\n</html>\n";
2372 $response->header(
'Location: ' . $redirect );
2376 return $return ?
'' :
null;
2377 } elseif ( $this->mStatusCode ) {
2378 $response->statusHeader( $this->mStatusCode );
2381 # Buffer output; final headers may depend on later processing
2384 $response->header(
'Content-type: ' . $config->get(
'MimeType' ) .
'; charset=UTF-8' );
2389 $response->header(
'X-UA-Compatible: IE=Edge' );
2393 if ( $linkHeader ) {
2399 if ( $frameOptions ) {
2400 $response->header(
"X-Frame-Options: $frameOptions" );
2403 if ( $this->mArticleBodyOnly ) {
2407 if ( $this->
getRequest()->getBool(
'safemode' ) ) {
2413 $modules = $sk->getDefaultModules();
2419 'mediawiki.page.startup',
2424 if ( $config->get(
'ResponsiveImages' ) ) {
2425 $coreModules[] =
'mediawiki.hidpi';
2435 $outputPage = $this;
2438 Hooks::run(
'BeforePageDisplay', [ &$outputPage, &$sk ] );
2442 }
catch ( Exception
$e ) {
2450 Hooks::run(
'AfterFinalPageOutput', [ $this ] );
2451 }
catch ( Exception
$e ) {
2459 return ob_get_clean();
2478 if ( $htmlTitle !==
false ) {
2484 $this->mRedirect =
'';
2502 if ( !
$title instanceof Message ) {
2508 if ( $msg instanceof Message ) {
2510 trigger_error(
'Argument ignored: $params. The message parameters argument '
2511 .
'is discarded when the $msg argument is a Message object instead of '
2512 .
'a string.', E_USER_NOTICE );
2514 $this->
addHTML( $msg->parseAsBlock() );
2529 foreach ( $errors
as $key => $error ) {
2530 $errors[$key] = (
array)$error;
2538 if ( in_array( $action, [
'read',
'edit',
'createpage',
'createtalk',
'upload' ] )
2539 && $this->
getUser()->isAnon() &&
count( $errors ) == 1 && isset( $errors[0][0] )
2540 && ( $errors[0][0] ==
'badaccess-groups' || $errors[0][0] ==
'badaccess-group0' )
2544 $displayReturnto =
null;
2546 # Due to T34276, if a user does not have read permissions,
2547 # $this->getTitle() will just give Special:Badtitle, which is
2548 # not especially useful as a returnto parameter. Use the title
2549 # from the request instead, if there was one.
2552 if ( $action ==
'edit' ) {
2553 $msg =
'whitelistedittext';
2554 $displayReturnto = $returnto;
2555 } elseif ( $action ==
'createpage' || $action ==
'createtalk' ) {
2556 $msg =
'nocreatetext';
2557 } elseif ( $action ==
'upload' ) {
2558 $msg =
'uploadnologintext';
2560 $msg =
'loginreqpagetext';
2567 $query[
'returnto'] = $returnto->getPrefixedText();
2570 $returntoquery =
$request->getValues();
2571 unset( $returntoquery[
'title'] );
2572 unset( $returntoquery[
'returnto'] );
2573 unset( $returntoquery[
'returntoquery'] );
2577 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
2580 $this->
msg(
'loginreqlink' )->
text(),
2586 $this->
addHTML( $this->
msg( $msg )->rawParams( $loginLink )->
parse() );
2588 # Don't return to a page the user can't read otherwise
2589 # we'll end up in a pointless loop
2590 if ( $displayReturnto && $displayReturnto->userCan(
'read', $this->getUser() ) ) {
2608 $this->
addWikiMsg(
'versionrequiredtext', $version );
2620 if ( $action ==
null ) {
2621 $text = $this->
msg(
'permissionserrorstext',
count( $errors ) )->plain() .
"\n\n";
2623 $action_desc = $this->
msg(
"action-$action" )->plain();
2625 'permissionserrorstext-withaction',
2628 )->plain() .
"\n\n";
2631 if (
count( $errors ) > 1 ) {
2632 $text .=
'<ul class="permissions-errors">' .
"\n";
2634 foreach ( $errors
as $error ) {
2636 $text .= call_user_func_array( [ $this,
'msg' ], $error )->plain();
2641 $text .=
"<div class=\"permissions-errors\">\n" .
2642 call_user_func_array( [ $this,
'msg' ], reset( $errors ) )->plain() .
2661 if ( func_num_args() > 0 ) {
2662 throw new MWException( __METHOD__ .
' no longer accepts arguments since 1.25.' );
2690 if ( $lag >= $config->get(
'SlaveLagWarning' ) ) {
2691 $lag = floor( $lag );
2692 $message = $lag < $config->get(
'SlaveLagCritical' )
2695 $wrap =
Html::rawElement(
'div', [
'class' =>
"mw-{$message}" ],
"\n$1\n" );
2736 ->getLinkRendererFactory()->createFromLegacyOptions(
$options );
2737 $link = $this->
msg(
'returnto' )->rawParams(
2739 $this->
addHTML(
"<p id=\"mw-returnto\">{$link}</p>\n" );
2750 public function returnToMain( $unused =
null, $returnto =
null, $returntoquery =
null ) {
2751 if ( $returnto ==
null ) {
2752 $returnto = $this->
getRequest()->getText(
'returnto' );
2755 if ( $returntoquery ==
null ) {
2756 $returntoquery = $this->
getRequest()->getText(
'returntoquery' );
2759 if ( $returnto ===
'' ) {
2763 if ( is_object( $returnto ) ) {
2764 $titleObj = $returnto;
2770 if ( !is_object( $titleObj ) || $titleObj->isExternal() ) {
2778 if ( !$this->rlClientContext ) {
2779 $query = ResourceLoader::makeLoaderQuery(
2782 $this->
getSkin()->getSkinName(),
2783 $this->
getUser()->isLoggedIn() ? $this->
getUser()->getName() :
null,
2785 ResourceLoader::inDebugMode(),
2810 if ( !$this->rlClient ) {
2822 $this->
getSkin()->setupSkinUserCss( $this );
2825 $exemptGroups = [
'site' => [],
'noscript' => [],
'private' => [],
'user' => [] ];
2831 $userBatch = [
'user.styles',
'user' ];
2832 $siteBatch = array_diff( $moduleStyles, $userBatch );
2838 $moduleStyles = array_filter( $moduleStyles,
2840 $module = $rl->getModule(
$name );
2843 $exemptStates[
$name] =
'ready';
2847 $group = $module->getGroup();
2848 if ( isset( $exemptGroups[$group] ) ) {
2849 $exemptStates[
$name] =
'ready';
2850 if ( !$module->isKnownEmpty(
$context ) ) {
2852 $exemptGroups[$group][] =
$name;
2860 $this->rlExemptStyleModules = $exemptGroups;
2862 $isUserModuleFiltered = !$this->
filterModules( [
'user' ] );
2865 if ( !$isUserModuleFiltered ) {
2867 $userModule = $rl->getModule(
'user' );
2871 $this->rlUserModuleState = $exemptStates[
'user'] = $userState;
2916 $pieces[] =
Html::element(
'meta', [
'charset' =>
'UTF-8' ] );
2923 $pieces = array_merge( $pieces, array_values( $this->mHeadItems ) );
2927 $bodyClasses[] =
'mediawiki';
2929 # Classes for LTR/RTL directionality support
2930 $bodyClasses[] = $userdir;
2931 $bodyClasses[] =
"sitedir-$sitedir";
2933 $underline = $this->
getUser()->getOption(
'underline' );
2934 if ( $underline < 2 ) {
2938 $bodyClasses[] =
'mw-underline-' . ( $underline ?
'always' :
'never' );
2941 if ( $this->
getLanguage()->capitalizeAllNouns() ) {
2942 # A <body> class is probably not the best way to do this . . .
2943 $bodyClasses[] =
'capitalize-all-nouns';
2949 $bodyClasses[] =
'mw-hide-empty-elt';
2952 $bodyClasses[] =
'skin-' . Sanitizer::escapeClass( $sk->
getSkinName() );
2959 $bodyAttrs[
'class'] = implode(
' ', $bodyClasses );
2963 Hooks::run(
'OutputPageBodyAttributes', [ $this, $sk, &$bodyAttrs ] );
2976 if ( is_null( $this->mResourceLoader ) ) {
2977 $this->mResourceLoader =
new ResourceLoader(
2979 LoggerFactory::getInstance(
'resourceloader' )
3013 $chunks = array_filter( $chunks,
'strlen' );
3014 return WrappedString::join(
"\n", $chunks );
3018 return $this->
getConfig()->get(
'AllowUserJs' )
3020 && $this->
getTitle()->isJsSubpage()
3025 return $this->
getConfig()->get(
'AllowUserCss' )
3027 && $this->
getTitle()->isCssSubpage()
3049 if ( $this->rlUserModuleState ===
'loading' ) {
3052 [
'excludepage' => $this->
getTitle()->getPrefixedDBkey() ]
3054 $chunks[] = ResourceLoader::makeInlineScript(
3078 if ( $this->limitReportJSData ) {
3079 $chunks[] = ResourceLoader::makeInlineScript(
3080 ResourceLoader::makeConfigSetScript(
3081 [
'wgPageParseReport' => $this->limitReportJSData ]
3106 if ( is_array(
$keys ) ) {
3108 $this->mJsConfigVars[$key] =
$value;
3130 $canonicalSpecialPageName =
false; # T23115
3133 $ns =
$title->getNamespace();
3141 $relevantTitle = $sk->getRelevantTitle();
3142 $relevantUser = $sk->getRelevantUser();
3145 list( $canonicalSpecialPageName, ) =
3149 $curRevisionId = $wikiPage->getLatest();
3150 $articleId = $wikiPage->getId();
3156 $separatorTransTable =
$lang->separatorTransformTable();
3157 $separatorTransTable = $separatorTransTable ? $separatorTransTable : [];
3158 $compactSeparatorTransTable = [
3159 implode(
"\t", array_keys( $separatorTransTable ) ),
3160 implode(
"\t", $separatorTransTable ),
3162 $digitTransTable =
$lang->digitTransformTable();
3163 $digitTransTable = $digitTransTable ? $digitTransTable : [];
3164 $compactDigitTransTable = [
3165 implode(
"\t", array_keys( $digitTransTable ) ),
3166 implode(
"\t", $digitTransTable ),
3172 'wgCanonicalNamespace' => $canonicalNamespace,
3173 'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3174 'wgNamespaceNumber' =>
$title->getNamespace(),
3175 'wgPageName' =>
$title->getPrefixedDBkey(),
3176 'wgTitle' =>
$title->getText(),
3177 'wgCurRevisionId' => $curRevisionId,
3179 'wgArticleId' => $articleId,
3181 'wgIsRedirect' => $title->isRedirect(),
3183 'wgUserName' =>
$user->isAnon() ? null :
$user->getName(),
3184 'wgUserGroups' =>
$user->getEffectiveGroups(),
3187 'wgPageContentLanguage' =>
$lang->getCode(),
3188 'wgPageContentModel' => $title->getContentModel(),
3189 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3190 'wgDigitTransformTable' => $compactDigitTransTable,
3191 'wgDefaultDateFormat' =>
$lang->getDefaultDateFormat(),
3192 'wgMonthNames' =>
$lang->getMonthNamesArray(),
3193 'wgMonthNamesShort' =>
$lang->getMonthAbbreviationsArray(),
3194 'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3195 'wgRelevantArticleId' => $relevantTitle->getArticleID(),
3199 if (
$user->isLoggedIn() ) {
3201 $vars[
'wgUserEditCount'] =
$user->getEditCount();
3202 $userReg =
$user->getRegistration();
3203 $vars[
'wgUserRegistration'] = $userReg ?
wfTimestamp( TS_UNIX, $userReg ) * 1000 :
null;
3207 $vars[
'wgUserNewMsgRevisionId'] =
$user->getNewMessageRevisionId();
3221 if (
$title->isMainPage() ) {
3222 $vars[
'wgIsMainPage'] =
true;
3225 if ( $this->mRedirectedFrom ) {
3226 $vars[
'wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3229 if ( $relevantUser ) {
3230 $vars[
'wgRelevantUserName'] = $relevantUser->getName();
3255 $request->getVal(
'action' ) !==
'submit' ||
3256 !
$request->getCheck(
'wpPreview' ) ||
3264 if ( !
$user->isLoggedIn() ) {
3268 if ( !
$user->matchEditToken(
$request->getVal(
'wpEditToken' ) ) ) {
3273 if ( !
$title->isJsSubpage() && !
$title->isCssSubpage() ) {
3276 if ( !
$title->isSubpageOf(
$user->getUserPage() ) ) {
3281 $errors =
$title->getUserPermissionsErrors(
'edit',
$user );
3282 if (
count( $errors ) !== 0 ) {
3301 'name' =>
'generator',
3302 'content' =>
"MediaWiki $wgVersion",
3305 if ( $config->get(
'ReferrerPolicy' ) !==
false ) {
3307 'name' =>
'referrer',
3308 'content' => $config->get(
'ReferrerPolicy' )
3312 $p =
"{$this->mIndexPolicy},{$this->mFollowPolicy}";
3313 if ( $p !==
'index,follow' ) {
3322 foreach ( $this->mMetatags
as $tag ) {
3323 if ( strncasecmp(
$tag[0],
'http:', 5 ) === 0 ) {
3326 } elseif ( strncasecmp(
$tag[0],
'og:', 3 ) === 0 ) {
3331 $tagName =
"meta-{$tag[0]}";
3332 if ( isset( $tags[$tagName] ) ) {
3333 $tagName .=
$tag[1];
3338 'content' =>
$tag[1]
3343 foreach ( $this->mLinktags
as $tag ) {
3347 # Universal edit button
3348 if ( $config->get(
'UniversalEditButton' ) && $this->
isArticleRelated() ) {
3351 && ( $this->
getTitle()->exists() ||
3355 $msg = $this->
msg(
'edit' )->text();
3357 'rel' =>
'alternate',
3358 'type' =>
'application/x-wiki',
3360 'href' => $this->
getTitle()->getEditURL(),
3366 'href' => $this->
getTitle()->getEditURL(),
3371 # Generally the order of the favicon and apple-touch-icon links
3372 # should not matter, but Konqueror (3.5.9 at least) incorrectly
3373 # uses whichever one appears later in the HTML source. Make sure
3374 # apple-touch-icon is specified first to avoid this.
3375 if ( $config->get(
'AppleTouchIcon' ) !==
false ) {
3377 'rel' =>
'apple-touch-icon',
3378 'href' => $config->get(
'AppleTouchIcon' )
3382 if ( $config->get(
'Favicon' ) !==
false ) {
3384 'rel' =>
'shortcut icon',
3385 'href' => $config->get(
'Favicon' )
3389 # OpenSearch description link
3392 'type' =>
'application/opensearchdescription+xml',
3393 'href' =>
wfScript(
'opensearch_desc' ),
3394 'title' => $this->
msg(
'opensearch-desc' )->inContentLanguage()->
text(),
3397 if ( $config->get(
'EnableAPI' ) ) {
3398 # Real Simple Discovery link, provides auto-discovery information
3399 # for the MediaWiki API (and potentially additional custom API
3400 # support such as WordPress or Twitter-compatible APIs for a
3401 # blogging extension, etc)
3404 'type' =>
'application/rsd+xml',
3410 [
'action' =>
'rsd' ] ),
3417 if ( !$config->get(
'DisableLangConversion' ) ) {
3419 if (
$lang->hasVariants() ) {
3420 $variants =
$lang->getVariants();
3421 foreach ( $variants
as $variant ) {
3423 'rel' =>
'alternate',
3424 'hreflang' =>
wfBCP47( $variant ),
3425 'href' => $this->
getTitle()->getLocalURL(
3426 [
'variant' => $variant ] )
3430 # x-default link per https://support.google.com/webmasters/answer/189077?hl=en
3432 'rel' =>
'alternate',
3433 'hreflang' =>
'x-default',
3434 'href' => $this->
getTitle()->getLocalURL() ] );
3439 if ( $this->copyrightUrl !==
null ) {
3443 if ( $config->get(
'RightsPage' ) ) {
3447 $copyright = $copy->getLocalURL();
3451 if ( !$copyright && $config->get(
'RightsUrl' ) ) {
3452 $copyright = $config->get(
'RightsUrl' );
3458 'rel' =>
'copyright',
3459 'href' => $copyright ]
3464 if ( $config->get(
'Feed' ) ) {
3468 # Use the page name for the title. In principle, this could
3469 # lead to issues with having the same name for different feeds
3470 # corresponding to the same page, but we can't avoid that at
3476 # Used
messages:
'page-rss-feed' and 'page-atom-feed' (
for an easier grep)
3478 "page-{$format}-feed", $this->
getTitle()->getPrefixedText()
3483 # Recent changes feed should appear on every page (except recentchanges,
3484 # that would be redundant). Put it after the per-page feed to avoid
3485 # changing existing behavior. It's still available, probably via a
3486 # menu in your browser. Some sites might have a different feed they'd
3487 # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3488 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3489 # If so, use it instead.
3490 $sitename = $config->get(
'Sitename' );
3491 if ( $config->get(
'OverrideSiteFeed' ) ) {
3492 foreach ( $config->get(
'OverrideSiteFeed' )
as $type => $feedUrl ) {
3497 $this->
msg(
"site-{$type}-feed", $sitename )->
text()
3500 } elseif ( !$this->
getTitle()->isSpecial(
'Recentchanges' ) ) {
3502 foreach ( $config->get(
'AdvertisedFeedTypes' )
as $format ) {
3505 $rctitle->getLocalURL( [
'feed' => $format ] ),
3506 # For grep: 'site-rss-feed', 'site-atom-feed'
3507 $this->
msg(
"site-{$format}-feed", $sitename )->text()
3512 # Allow extensions to change the list pf feeds. This hook is primarily for changing,
3513 # manipulating or removing existing feed tags. If you want to add new feeds, you should
3514 # use OutputPage::addFeedLink() instead.
3515 Hooks::run(
'AfterBuildFeedLinks', [ &$feedLinks ] );
3517 $tags += $feedLinks;
3521 if ( $config->get(
'EnableCanonicalServerLink' ) ) {
3522 if ( $canonicalUrl !==
false ) {
3534 if ( in_array( $action, [
'history',
'info' ] ) ) {
3535 $query =
"action={$action}";
3541 $reqUrl = $this->
getRequest()->getRequestURL();
3546 if ( $canonicalUrl !==
false ) {
3548 'rel' =>
'canonical',
3549 'href' => $canonicalUrl
3576 'rel' =>
'alternate',
3577 'type' =>
"application/$type+xml",
3592 public function addStyle( $style, $media =
'', $condition =
'',
$dir =
'' ) {
3598 $options[
'condition'] = $condition;
3614 if ( $flip ===
'flip' && $this->
getLanguage()->isRTL() ) {
3615 # If wanted, and the interface is right-to-left, flip the CSS
3616 $style_css = CSSJanus::transform( $style_css,
true,
false );
3638 [
'excludepage' => $this->
getTitle()->getPrefixedDBkey() ]
3643 $previewedCSS = $this->
getRequest()->getText(
'wpTextbox1' );
3645 $previewedCSS = CSSJanus::transform( $previewedCSS,
true,
false );
3663 [
'name' =>
'ResourceLoaderDynamicStyles',
'content' =>
'' ]
3666 foreach ( $this->rlExemptStyleModules
as $group => $moduleNames ) {
3682 foreach ( $this->mExtStyles
as $url ) {
3685 $this->mExtStyles = [];
3687 foreach ( $this->styles
as $file =>
$options ) {
3690 $links[$file] =
$link;
3710 if ( isset(
$options[
'media'] ) ) {
3712 if ( is_null( $media ) ) {
3719 if ( substr( $style, 0, 1 ) ==
'/' ||
3720 substr( $style, 0, 5 ) ==
'http:' ||
3721 substr( $style, 0, 6 ) ==
'https:' ) {
3725 $url = $config->get(
'StylePath' ) .
'/' . $style .
'?' .
3726 $config->get(
'StyleVersion' );
3731 if ( isset(
$options[
'condition'] ) ) {
3732 $condition = htmlspecialchars(
$options[
'condition'] );
3733 $link =
"<!--[if $condition]>$link<![endif]-->";
3763 $remotePathPrefix = $config->get(
'ResourceBasePath' );
3764 if ( $remotePathPrefix ===
'' ) {
3769 $remotePath = $remotePathPrefix;
3771 if ( strpos(
$path, $remotePath ) !== 0 || substr(
$path, 0, 2 ) ===
'//' ) {
3780 $uploadPath = $config->get(
'UploadPath' );
3781 if ( strpos(
$path, $uploadPath ) === 0 ) {
3782 $localDir = $config->get(
'UploadDirectory' );
3783 $remotePathPrefix = $remotePath = $uploadPath;
3786 $path = RelPath\getRelativePath(
$path, $remotePath );
3802 $hash = md5_file(
"$localPath/$file" );
3803 if ( $hash ===
false ) {
3804 wfLogWarning( __METHOD__ .
": Failed to hash $localPath/$file" );
3807 return "$remotePathPrefix/$file?" . substr( $hash, 0, 5 );
3821 $screenMediaQueryRegex =
'/^(?:only\s+)?screen\b/i';
3825 'printable' =>
'print',
3826 'handheld' =>
'handheld',
3828 foreach ( $switches
as $switch => $targetMedia ) {
3830 if ( $media == $targetMedia ) {
3832 } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3846 if ( $targetMedia ==
'print' || $media ==
'screen' ) {
3863 $args = func_get_args();
3906 $msgSpecs = func_get_args();
3907 array_shift( $msgSpecs );
3908 $msgSpecs = array_values( $msgSpecs );
3910 foreach ( $msgSpecs
as $n => $spec ) {
3911 if ( is_array( $spec ) ) {
3914 if ( isset(
$args[
'options'] ) ) {
3915 unset(
$args[
'options'] );
3917 'Adding "options" to ' . __METHOD__ .
' is no longer supported',
3936 $this->mEnableTOC = $flag;
3953 $this->mEnableSectionEditLinks = $flag;
3974 $themes = array_change_key_case( $themes, CASE_LOWER );
3975 $theme = isset( $themes[$skinName] ) ? $themes[$skinName] :
'MediaWiki';
3977 $themeClass =
"OOUI\\{$theme}Theme";
3978 OOUI\Theme::setSingleton(
new $themeClass() );
3979 OOUI\Element::setDefaultDir(
$dir );
3990 strtolower( $this->
getSkin()->getSkinName() ),
3994 'oojs-ui-core.styles',
3995 'oojs-ui.styles.icons',
3996 'oojs-ui.styles.indicators',
3997 'oojs-ui.styles.textures',
3998 'mediawiki.widgets.styles',
4014 if ( !is_array( $logo ) ) {
4016 $this->
addLinkHeader(
'<' . $logo .
'>;rel=preload;as=image' );
4020 foreach ( $logo
as $dppx => $src ) {
4022 $dppx = substr( $dppx, 0, -1 );
4023 $logosPerDppx[$dppx] = $src;
4027 uksort( $logosPerDppx,
function ( $a , $b ) {
4028 $a = floatval( $a );
4029 $b = floatval( $b );
4035 return ( $a < $b ) ? -1 : 1;
4038 foreach ( $logosPerDppx
as $dppx => $src ) {
4039 $logos[] = [
'dppx' => $dppx,
'src' => $src ];
4042 $logosCount =
count( $logos );
4048 for ( $i = 0; $i < $logosCount; $i++ ) {
4053 $media_query =
'not all and (min-resolution: ' . $logos[ 1 ][
'dppx'] .
'dppx)';
4054 } elseif ( $i !== $logosCount - 1 ) {
4059 $upper_bound = floatval( $logos[ $i + 1 ][
'dppx'] ) - 0.000001;
4060 $media_query =
'(min-resolution: ' . $logos[ $i ][
'dppx'] .
4061 'dppx) and (max-resolution: ' . $upper_bound .
'dppx)';
4064 $media_query =
'(min-resolution: ' . $logos[ $i ][
'dppx'] .
'dppx)';
4068 '<' . $logos[$i][
'src'] .
'>;rel=preload;as=image;media=' . $media_query
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.
output( $return=false)
Finally, all the text has been munged and accumulated into the object, let's actually output it:
addBacklinkSubtitle(Title $title, $query=[])
Add a subtitle containing a backlink to a page.
string $mLastModified
Used for sending cache control.
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:".
getConfig()
Get the Config object.
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...
getSubtitle()
Get the subtitle.
WebRequest clone which takes values from a provided array.
enableClientCache( $state)
Use enableClientCache(false) to force it to send nocache headers.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping $template
addWikiMsg()
Add a wikitext-formatted message to the output.
getContext()
Get the base IContextSource object.
getLanguageLinks()
Get the list of language links.
static buildBacklinkSubtitle(Title $title, $query=[])
Build message object for a subtitle containing a backlink to a page.
Marks HTML that shouldn't be escaped.
Bootstrap a ResourceLoader client on an HTML page.
reduceAllowedModules( $type, $level)
Limit the highest level of CSS/JS untrustworthiness allowed.
wfBCP47( $code)
Get the normalised IETF language tag See unit test for examples.
error also a ContextSource you ll probably need to make sure the header is varied on $request
addSubtitle( $str)
Add $str to the subtitle.
addAcceptLanguage()
T23672: Add Accept-Language to Vary and Key headers if there's no 'variant' parameter existed in GET.
bool $mEnableSectionEditLinks
Whether parser output should contain section edit links.
processing should stop and the error should be shown to the user * false
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.
showFileRenameError( $old, $new)
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.
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 ...
addLink(array $linkarr)
Add a new <link> tag to the page header.
addCategoryLinksToLBAndGetResult(array $categories)
hasHeadItem( $name)
Check if the header item $name is already set.
__construct(IContextSource $context=null)
Constructor for OutputPage.
if(!isset( $args[0])) $lang
getMetaTags()
Returns the current <meta> tags.
addLanguageLinks(array $newLinkArray)
Add new language links.
addLinkHeader( $header)
Add an HTTP Link: header.
addModuleStyles( $modules)
Add only CSS of one or more modules recognized by ResourceLoader.
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
const ORIGIN_USER_SITEWIDE
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.
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
getRevisionId()
Get the displayed revision ID.
setModuleScripts(array $modules)
Ensure the scripts of one or more modules are loaded.
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.
addScript( $script)
Add raw HTML to the list of scripts (including <script> tag, etc.) Internal use only.
bool $mIsarticle
Is the displayed content related to the source of the corresponding wiki article.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
$wgVersion
MediaWiki version number.
returnToMain( $unused=null, $returnto=null, $returntoquery=null)
Add a "return to" link pointing to a specified title, or the title indicated in the request,...
static combineWrappedStrings(array $chunks)
Combine WrappedString chunks and filter out empty ones.
static setupOOUI( $skinName='', $dir='ltr')
Helper function to setup the PHP implementation of OOUI to use in this request.
setPageTitleActionText( $text)
Set the new value of the "action text", this will be added to the "HTML title", separated from it wit...
bool $mHideNewSectionLink
string $mBodytext
Contains all of the "<body>" content.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
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
getBottomScripts()
JS stuff to put at the bottom of the <body>.
addParserOutputContent( $parserOutput)
Add the HTML and enhancements for it (like ResourceLoader modules) associated with a ParserOutput obj...
showFileNotFoundError( $name)
string $mPagetitle
Should be private - has getter and setter.
static newFromAnon()
Get a ParserOptions object for an anonymous user.
addHeadItems( $values)
Add one or more head items to the output.
getModuleStyles( $filter=false, $position=null)
Get the list of module CSS to include on this page.
static htmlHeader(array $attribs=[])
Constructs the opening html-tag with necessary doctypes depending on global variables.
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.
setExemptStates(array $states)
Set state of special modules that are handled by the caller manually.
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.
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 after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
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 If you don't need a full Title object,...
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().
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
Allows to change the fields on the form that will be generated $name
getRequest()
Get the WebRequest object.
addParserOutput( $parserOutput)
Add everything from a ParserOutput object.
int $mRevisionId
To include the variable {{REVISIONID}}.
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
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 before the output is cached my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
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">.
getUser()
Get the User object.
getTitle()
Get the Title object.
getHtmlElementAttributes()
Return values for <html> element.
static inlineScript( $contents)
Output a "<script>" tag with the given contents.
setArray( $array)
Set the link list to a given 2-d array First key is the namespace, second is the DB key,...
setIndicators(array $indicators)
Add an array of indicators, with their identifiers as array keys and HTML contents as values.
static getSelectFields()
Fields that LinkCache needs to select.
showFileDeleteError( $name)
addHTML( $text)
Append $text to the body HTML.
addHeadItem( $name, $value)
Add or replace a head item to the output.
addWikiTextTidy( $text, $linestart=true)
Add wikitext with tidy enabled.
getModuleScripts( $filter=false, $position=null)
Get the list of module JS to include on this page.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
exists()
Returns true if file exists in the repository.
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.
setConfig(array $vars)
Set mw.config variables.
getLanguage()
Get the Language object.
string $mPageTitleActionText
showPermissionsErrorPage(array $errors, $action=null)
Output a standard permission error page.
string $rlUserModuleState
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to interpret a given string a...
getLinkTags()
Returns the current <link> tags.
forceHideNewSectionLink()
Forcibly hide the new section link?
addWikiTextWithTitle( $text, &$title, $linestart=true)
Add wikitext with a custom Title object.
static closeElement( $element)
Returns "</$element>".
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
ResourceLoaderContext $rlClientContext
static isXmlMimeType( $mimetype)
Determines if the given MIME type is xml.
addElement( $element, array $attribs=[], $contents='')
Shortcut for adding an Html::element via addHTML.
null for the wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
addParserOutputMetadata( $parserOutput)
Add all metadata associated with a ParserOutput object, but without the actual HTML.
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.
getKeyHeader()
Get a complete Key header.
getModules( $filter=false, $position=null, $param='mModules', $type=ResourceLoaderModule::TYPE_COMBINED)
Get the list of modules to include on this page.
addStyle( $style, $media='', $condition='', $dir='')
Add a local or specified stylesheet, with the given media options.
namespace and then decline to actually register it file or subcat img or subcat $title
sendCacheControl()
Send cache control HTTP headers.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
int $mCdnMaxageLimit
Upper limit on mCdnMaxage.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
static preloadTitleInfo(ResourceLoaderContext $context, IDatabase $db, array $moduleNames)
styleLink( $style, array $options)
Generate <link> tags for stylesheets.
bool $mEnableTOC
Whether parser output should contain table of contents.
array $mSubtitle
Contains the page subtitle.
setFileVersion( $file)
Set the displayed file version.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
showUnexpectedValueError( $name, $val)
getLinkHeader()
Return a Link: header.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
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>".
getWikiPage()
Get the WikiPage object.
setFeedAppendQuery( $val)
Add default feeds to the page header This is mainly kept for backward compatibility,...
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
isDisabled()
Return whether the output will be completely disabled.
setRevisionId( $revid)
Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISION...
addParserOutputText( $parserOutput)
Add the HTML associated with a ParserOutput object, without any metadata.
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.
setSubtitle( $str)
Replace the subtitle with $str.
string $mInlineStyles
Inline CSS styles.
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...
addLogoPreloadLinkHeaders()
Add Link headers for preloading the wiki's logo.
getVaryHeader()
Return a Vary: header on which to vary caches.
addModules( $modules)
Add one or more modules recognized by ResourceLoader.
showLagWarning( $lag)
Show a warning about replica DB lag.
getPageTitleActionText()
Get the value of the "action text".
getCacheVaryCookies()
Get the list of cookies that will influence on the cache.
setCopyrightUrl( $url)
Set the copyright URL to send with the output.
static getLogo(Config $conf)
when a variable name is used in a it is silently declared as a new masking the global
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
ResourceLoaderClientHtml $rlClient
getOrigin()
Get this module's origin.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
setContext(IContextSource $context)
Set the IContextSource object.
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...
showErrorPage( $title, $msg, $params=[])
Output a standard error page.
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()
array $limitReportJSData
Profiling data.
addParserOutputNoText( $parserOutput)
Add a ParserOutput object, but without Html.
addInlineScript( $script)
Add a self-contained script tag with the given contents Internal use only.
getArticleBodyOnly()
Return whether the output will contain only the body of the article.
getPreventClickjacking()
Get the prevent-clickjacking flag.
getCanonicalUrl()
Returns the URL to be used for the <link rel="canonical"> if one is set.
getExtStyle()
Get all styles added by extensions.
setStatusCode( $statusCode)
Set the HTTP status code to send with the output.
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.
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.
ResourceLoader $mResourceLoader
array $mMetatags
Should be private.
getPageClasses( $title)
TODO: document.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
addCategoryLinks(array $categories)
Add an array of categories, with names in the keys.
setRevisionTimestamp( $timestamp)
Set the timestamp of the revision which will be displayed.
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.
addReturnTo( $title, array $query=[], $text=null, $options=[])
Add a "return to" link pointing to a specified title.
buildExemptModules()
Build exempt modules and legacy non-ResourceLoader styles.
string null $copyrightUrl
The URL to send in a <link> element with rel=copyright.
getProperty( $name)
Get an additional output property.
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
formatPermissionsErrorMessage(array $errors, $action=null)
Format a list of error messages.
array $mExtStyles
Additional stylesheets.
setTarget( $target)
Sets ResourceLoader target for load.php links.
setHTMLTitle( $name)
"HTML title" means the contents of "<title>".
setLanguageLinks(array $newLinkArray)
Reset the language links and add new language links.
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
array $rlExemptStyleModules
$mProperties
Additional key => value data.
wrapWikiMsg( $wrap)
This function takes a number of message/argument specifications, wraps them in some overall structure...
static inlineStyle( $contents, $media='all')
Output a "<style>" tag with the given contents for the given media type (if any).
prependHTML( $text)
Prepend $text to the body HTML.
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.
warnModuleTargetFilter( $moduleName)
getMetadataAttribute()
Get the value of the "rel" attribute for metadata links.
int $mCdnMaxage
Cache stuff.
enableOOUI()
Add ResourceLoader module styles for OOUI and set up the PHP implementation of it for use with MediaW...
$mScripts
Used for JavaScript (predates ResourceLoader)
array $mAllowedModules
What level of 'untrustworthiness' is allowed in CSS/JS modules loaded on this page?
bool $mPrintable
We have to set isPrintable().
this hook is for auditing only $response
error also a ContextSource you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext such as when responding to a resource loader request or generating HTML output & $resourceLoader
Interface for objects which can provide a MediaWiki context on request.
array $mLanguageLinks
Array of Interwiki Prefixed (non DB key) Titles (e.g.
wfGetAllCallers( $limit=3)
Return a string consisting of callers in the stack.
setCategoryLinks(array $categories)
Reset the category links (but not the category list) and add $categories.
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>.
getRlClient()
Call this to freeze the module queue and JS config and create a formatter.
checkLastModified( $timestamp)
checkLastModified tells the client to use the client-cached page if possible.
bool $mNoGallery
Comes from the parser.
static makeLoad(ResourceLoaderContext $mainContext, array $modules, $only, array $extraQuery=[])
Explicily load or embed modules on a page.
array $mHeadItems
Array of elements in "<head>".
string $mRevisionTimestamp
Represents a title within MediaWiki.
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
setCdnMaxage( $maxage)
Set the value of the "s-maxage" part of the "Cache-control" HTTP header.
getAllowedModules( $type)
Show what level of JavaScript / CSS untrustworthiness is allowed on this page.
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
addVaryHeader( $header, array $option=null)
Add an HTTP header that will influence on the cache.
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 Internal use only.
setModules(array $modules)
Ensure one or more modules are loaded.
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.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
setRedirectedFrom( $t)
Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
setModuleStyles(array $modules)
Ensure the styles of one or more modules are loaded.
addWikiTextTitle( $text, Title $title, $linestart, $tidy=false, $interface=false)
Add wikitext with a custom Title object.
addMetadataLink(array $linkarr)
Add a new <link> with "rel" attribute set to "meta".
filterModules(array $modules, $position=null, $type=ResourceLoaderModule::TYPE_COMBINED)
Filter an array of modules to remove insufficiently trustworthy members, and modules which are no lon...
static getRequestId()
Get the unique request ID.
static singleton()
Get an instance of this class.
redirect( $url, $responsecode='302')
Redirect to $url rather than displaying the normal page.
setPrintable()
Set the page as printable, i.e.
readOnlyPage()
Display a page stating that the Wiki is in read-only mode.
adaptCdnTTL( $mtime, $minTTL=0, $maxTTL=0)
Get TTL in [$minTTL,$maxTTL] in pass it to lowerCdnMaxage()
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 ResourceLoader.
allowClickjacking()
Turn off frame-breaking.
showFatalError( $message)
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
passed in as a query string parameter to the various URLs constructed here(i.e. $prevlink) $ldel you ll need to handle error messages
getHTML()
Get the body HTML.
$mLinkHeader
Link: header contents.
usually copyright or history_copyright This message must be in HTML not wikitext & $link
array $styles
An array of stylesheet filenames (relative from skins path), with options for CSS media,...
MediaWiki Logger LoggerFactory implements a PSR[0] compatible message logging system Named Psr Log LoggerInterface instances can be obtained from the MediaWiki Logger LoggerFactory::getInstance() static method. MediaWiki\Logger\LoggerFactory expects a class implementing the MediaWiki\Logger\Spi interface to act as a factory for new Psr\Log\LoggerInterface instances. The "Spi" in MediaWiki\Logger\Spi stands for "service provider interface". An SPI is an API intended to be implemented or extended by a third party. This software design pattern is intended to enable framework extension and replaceable components. It is specifically used in the MediaWiki\Logger\LoggerFactory service to allow alternate PSR-3 logging implementations to be easily integrated with MediaWiki. The service provider interface allows the backend logging library to be implemented in multiple ways. The $wgMWLoggerDefaultSpi global provides the classname of the default MediaWiki\Logger\Spi implementation to be loaded at runtime. This can either be the name of a class implementing the MediaWiki\Logger\Spi with a zero argument const ructor or a callable that will return an MediaWiki\Logger\Spi instance. Alternately the MediaWiki\Logger\LoggerFactory MediaWiki Logger LoggerFactory
static addModules(OutputPage $out)
Add ResourceLoader modules to the OutputPage object if debugging is enabled.
showNewSectionLink()
Show an "add new section" link?
parse( $text, $linestart=true, $interface=false, $language=null)
Parse wikitext and return the HTML.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
string $mPageLinkTitle
Used by skin template.
makeResourceLoaderLink( $modules, $only, array $extraQuery=[])
Explicily load or embed modules on a page.
getIndicators()
Get the indicators associated with this page.
if(! $wgDBerrorLogTZ) $wgRequest
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
addJsConfigVars( $keys, $value=null)
Add one or more variables to be set in mw.config in JavaScript.
bool $mPreventClickjacking
Controls if anti-clickjacking / frame-breaking headers will be sent.
The main skin class which provides methods and properties for all other skins.
getCategories( $type='all')
Get the list of category names this page belongs to.
getJsConfigVars()
Get the javascript config vars to include on this page.
getTemplateIds()
Get the templates used on this page.
bool $mIsArticleRelated
Stores "article flag" toggle.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
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.
bool $mArticleBodyOnly
Flag if output should only contain the body of the article.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
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.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context $parserOutput
getFeedAppendQuery()
Will currently always return null.
lowerCdnMaxage( $maxage)
Lower the value of the "s-maxage" part of the "Cache-control" HTTP header.
string $mHTMLtitle
Stores contents of "<title>" tag.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
the array() calling protocol came about after MediaWiki 1.4rc1.
addFeedLink( $format, $href)
Add a feed link to the page header.
static transformResourcePath(Config $config, $path)
Transform path to web-accessible static resource.
setRobotPolicy( $policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
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
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
static transformFilePath( $remotePathPrefix, $localPath, $file)
Utility method for transformResourceFilePath().
headElement(Skin $sk, $includeStyle=true)