Go to the documentation of this file.
26 use Wikimedia\RelPath;
27 use Wikimedia\WrappedString;
28 use Wikimedia\WrappedStringList;
264 'Accept-Encoding' => [
'match=gzip' ],
319 public function redirect( $url, $responsecode =
'302' ) {
320 # Strip newlines as a paranoia check for header injection in PHP<5.1.2
321 $this->mRedirect = str_replace(
"\n",
'', $url );
322 $this->mRedirectCode = $responsecode;
343 $this->copyrightUrl = $url;
352 $this->mStatusCode = $statusCode;
363 array_push( $this->mMetatags, [
$name, $val ] );
384 array_push( $this->mLinktags, $linkarr );
415 $this->mCanonicalUrl = $url;
435 # note: buggy CC software only reads first "meta" link
436 static $haveMeta =
false;
438 return 'alternate meta';
453 $this->mScripts .= $script;
466 if ( substr( $file, 0, 1 ) ==
'/' || preg_match(
'#^[a-z]*://#i', $file ) ) {
469 $path = $this->
getConfig()->get(
'StylePath' ) .
"/common/{$file}";
471 if ( is_null( $version ) ) {
472 $version = $this->
getConfig()->get(
'StyleVersion' );
499 $filteredModules = [];
505 if ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) ) {
509 $filteredModules[] = $val;
512 return $filteredModules;
516 static $warnings = [];
517 if ( isset( $warnings[$this->mTarget][$moduleName] ) ) {
522 'Module "{module}" not loadable on target "{target}".',
524 'module' => $moduleName,
525 'target' => $this->mTarget,
539 public function getModules( $filter =
false, $position =
null, $param =
'mModules',
542 $modules = array_values( array_unique( $this->$param ) );
556 $this->mModules = array_merge( $this->mModules, (
array)
$modules );
567 return $this->
getModules( $filter,
null,
'mModuleScripts',
580 $this->mModuleScripts = array_merge( $this->mModuleScripts, (
array)
$modules );
591 return $this->
getModules( $filter,
null,
'mModuleStyles',
606 $this->mModuleStyles = array_merge( $this->mModuleStyles, (
array)
$modules );
622 $this->mTarget = $target;
657 $this->mHeadItems = array_merge( $this->mHeadItems, (
array)$values );
667 return isset( $this->mHeadItems[
$name] );
677 $this->mAdditionalBodyClasses = array_merge( $this->mAdditionalBodyClasses, (
array)$classes );
688 $this->mArticleBodyOnly = $only;
719 if ( isset( $this->mProperties[
$name] ) ) {
720 return $this->mProperties[
$name];
738 if ( !$timestamp || $timestamp ==
'19700101000000' ) {
739 wfDebug( __METHOD__ .
": CACHE DISABLED, NO TIMESTAMP\n" );
743 if ( !$config->get(
'CachePages' ) ) {
744 wfDebug( __METHOD__ .
": CACHE DISABLED\n" );
750 'page' => $timestamp,
751 'user' => $this->
getUser()->getTouched(),
752 'epoch' => $config->get(
'CacheEpoch' )
754 if ( $config->get(
'UseSquid' ) ) {
756 $modifiedTimes[
'sepoch'] =
wfTimestamp( TS_MW, time() - $config->get(
'SquidMaxage' ) );
758 Hooks::run(
'OutputPageCheckLastModified', [ &$modifiedTimes, $this ] );
760 $maxModified = max( $modifiedTimes );
761 $this->mLastModified =
wfTimestamp( TS_RFC2822, $maxModified );
763 $clientHeader = $this->
getRequest()->getHeader(
'If-Modified-Since' );
764 if ( $clientHeader ===
false ) {
765 wfDebug( __METHOD__ .
": client did not send If-Modified-Since header",
'private' );
769 # IE sends sizes after the date like this:
770 # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
771 # this breaks strtotime().
772 $clientHeader = preg_replace(
'/;.*$/',
'', $clientHeader );
774 Wikimedia\suppressWarnings();
775 $clientHeaderTime = strtotime( $clientHeader );
776 Wikimedia\restoreWarnings();
777 if ( !$clientHeaderTime ) {
779 .
": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
782 $clientHeaderTime =
wfTimestamp( TS_MW, $clientHeaderTime );
787 if ( $info !==
'' ) {
793 wfDebug( __METHOD__ .
": client sent If-Modified-Since: " .
794 wfTimestamp( TS_ISO_8601, $clientHeaderTime ),
'private' );
795 wfDebug( __METHOD__ .
": effective Last-Modified: " .
796 wfTimestamp( TS_ISO_8601, $maxModified ),
'private' );
797 if ( $clientHeaderTime < $maxModified ) {
798 wfDebug( __METHOD__ .
": STALE, $info",
'private' );
803 # Give a 304 Not Modified response code and disable body output
804 wfDebug( __METHOD__ .
": NOT MODIFIED, $info",
'private' );
805 ini_set(
'zlib.output_compression', 0 );
806 $this->
getRequest()->response()->statusHeader( 304 );
825 $this->mLastModified =
wfTimestamp( TS_RFC2822, $timestamp );
839 if ( isset( $policy[
'index'] ) ) {
842 if ( isset( $policy[
'follow'] ) ) {
855 $policy = trim( $policy );
856 if ( in_array( $policy, [
'index',
'noindex' ] ) ) {
857 $this->mIndexPolicy = $policy;
869 $policy = trim( $policy );
870 if ( in_array( $policy, [
'follow',
'nofollow' ] ) ) {
871 $this->mFollowPolicy = $policy;
882 $this->mPageTitleActionText = $text;
904 $this->mHTMLtitle =
$name;
923 $this->mRedirectedFrom =
$t;
941 # change "<script>foo&bar</script>" to "<script>foo&bar</script>"
942 # but leave "<i>foobar</i>" alone
944 $this->mPagetitle = $nameWithTags;
946 # change "<i>foo&bar</i>" to "foo&bar"
949 ->inContentLanguage()
987 if ( $str instanceof
Message ) {
988 $this->mSubtitle[] = $str->setContext( $this->
getContext() )->parse();
990 $this->mSubtitle[] = $str;
1003 if (
$title->isRedirect() ) {
1004 $query[
'redirect'] =
'no';
1006 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1025 $this->mSubtitle = [];
1034 return implode(
"<br />\n\t\t\t\t", $this->mSubtitle );
1042 $this->mPrintable =
true;
1058 $this->mDoNothing =
true;
1100 $this->mFeedLinks = [];
1114 $this->mFeedLinks = [];
1118 if ( is_string( $val ) ) {
1132 if ( in_array( $format, $this->
getConfig()->
get(
'AdvertisedFeedTypes' ) ) ) {
1133 $this->mFeedLinks[$format] = $href;
1142 return count( $this->mFeedLinks ) > 0;
1170 $this->mIsarticle = $v;
1172 $this->mIsArticleRelated = $v;
1193 $this->mIsArticleRelated = $v;
1195 $this->mIsarticle =
false;
1215 $this->mLanguageLinks += $newLinkArray;
1225 $this->mLanguageLinks = $newLinkArray;
1245 if ( !is_array( $categories ) || count( $categories ) == 0 ) {
1251 # Set all the values to 'normal'.
1252 $categories = array_fill_keys( array_keys( $categories ),
'normal' );
1254 # Mark hidden categories
1255 foreach (
$res as $row ) {
1256 if ( isset( $row->pp_value ) ) {
1257 $categories[$row->page_title] =
'hidden';
1262 $outputPage = $this;
1263 # Add the remaining categories to the skin
1265 'OutputPageMakeCategoryLinks',
1266 [ &$outputPage, $categories, &$this->mCategoryLinks ] )
1268 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1269 foreach ( $categories
as $category =>
$type ) {
1271 $category = (
string)$category;
1272 $origcategory = $category;
1278 if ( $category != $origcategory && array_key_exists( $category, $categories ) ) {
1293 # Add the links to a LinkBatch
1298 # Fetch existence plus the hiddencat property
1300 $fields = array_merge(
1302 [
'page_namespace',
'page_title',
'pp_value' ]
1305 $res =
$dbr->select( [
'page',
'page_props' ],
1307 $lb->constructSet(
'page',
$dbr ),
1310 [
'page_props' => [
'LEFT JOIN', [
1311 'pp_propname' =>
'hiddencat',
1316 # Add the results to the link cache
1328 $this->mCategoryLinks = [];
1354 if (
$type ===
'all' ) {
1355 $allCategories = [];
1356 foreach ( $this->mCategories
as $categories ) {
1357 $allCategories = array_merge( $allCategories, $categories );
1359 return $allCategories;
1361 if ( !isset( $this->mCategories[
$type] ) ) {
1362 throw new InvalidArgumentException(
'Invalid category type given: ' .
$type );
1364 return $this->mCategories[
$type];
1379 ksort( $this->mIndicators );
1404 $text = $this->
msg(
'helppage-top-gethelp' )->escaped();
1406 if ( $overrideBaseUrl ) {
1409 $toUrlencoded =
wfUrlencode( str_replace(
' ',
'_', $to ) );
1410 $helpUrl =
"//www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded";
1417 'target' =>
'_blank',
1418 'class' =>
'mw-helplink',
1442 if ( $this->
getConfig()->
get(
'AllowSiteCSSOnRestrictedPages' ) ) {
1461 return min( array_values( $this->mAllowedModules ) );
1463 return isset( $this->mAllowedModules[
$type] )
1464 ? $this->mAllowedModules[
$type]
1497 $this->mBodytext .= $text;
1517 $this->mBodytext =
'';
1538 wfDeprecated( __METHOD__ .
' with non-null $options',
'1.31' );
1545 $anonPO->setAllowUnsafeRawHtml(
false );
1546 if ( !
$options->matches( $anonPO ) ) {
1552 if ( !$this->mParserOptions ) {
1558 $po->setAllowUnsafeRawHtml(
false );
1559 $po->isBogus =
true;
1567 $this->mParserOptions->setAllowUnsafeRawHtml(
false );
1573 return wfSetVar( $this->mParserOptions,
null,
true );
1587 $val = is_null( $revid ) ? null : intval( $revid );
1588 return wfSetVar( $this->mRevisionId, $val );
1608 return wfSetVar( $this->mRevisionTimestamp, $timestamp );
1629 if ( $file instanceof
File && $file->
exists() ) {
1630 $val = [
'time' => $file->getTimestamp(),
'sha1' => $file->getSha1() ];
1632 return wfSetVar( $this->mFileVersion, $val,
true );
1673 public function addWikiText( $text, $linestart =
true, $interface =
true ) {
1725 $tidy =
false, $interface =
false
1730 $oldTidy = $popts->setTidy( $tidy );
1731 $popts->setInterfaceMessage( (
bool)$interface );
1733 $parserOutput =
$wgParser->getFreshParser()->parse(
1735 $linestart,
true, $this->mRevisionId
1738 $popts->setTidy( $oldTidy );
1741 'enableSectionEditLinks' =>
false,
1754 $this->mLanguageLinks += $parserOutput->getLanguageLinks();
1757 $this->mNewSectionLink = $parserOutput->getNewSection();
1758 $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
1760 if ( !$parserOutput->isCacheable() ) {
1763 $this->mNoGallery = $parserOutput->getNoGallery();
1764 $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
1765 $this->
addModules( $parserOutput->getModules() );
1769 $this->mPreventClickjacking = $this->mPreventClickjacking
1770 || $parserOutput->preventClickjacking();
1773 foreach ( (
array)$parserOutput->getTemplateIds()
as $ns => $dbks ) {
1774 if ( isset( $this->mTemplateIds[$ns] ) ) {
1775 $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1777 $this->mTemplateIds[$ns] = $dbks;
1781 foreach ( (
array)$parserOutput->getFileSearchOptions()
as $dbk => $data ) {
1782 $this->mImageTimeKeys[$dbk] = $data;
1786 $parserOutputHooks = $this->
getConfig()->get(
'ParserOutputHooks' );
1787 foreach ( $parserOutput->getOutputHooks()
as $hookInfo ) {
1788 list( $hookName, $data ) = $hookInfo;
1789 if ( isset( $parserOutputHooks[$hookName] ) ) {
1790 call_user_func( $parserOutputHooks[$hookName], $this, $parserOutput, $data );
1795 if ( $parserOutput->getEnableOOUI() ) {
1800 if ( !$this->limitReportJSData ) {
1801 $this->limitReportJSData = $parserOutput->getLimitReportJSData();
1808 $outputPage = $this;
1809 Hooks::run(
'LanguageLinks', [ $this->
getTitle(), &$this->mLanguageLinks, &$linkFlags ] );
1816 if ( $parserOutput->getTOCHTML() ) {
1817 $this->mEnableTOC =
true;
1832 $this->
addModules( $parserOutput->getModules() );
1847 $text = $parserOutput->getText( $poOptions );
1849 $outputPage = $this;
1886 public function parse( $text, $linestart =
true, $interface =
false, $language =
null ) {
1889 if ( is_null( $this->
getTitle() ) ) {
1890 throw new MWException(
'Empty $mTitle in ' . __METHOD__ );
1895 $popts->setInterfaceMessage(
true );
1897 if ( $language !==
null ) {
1898 $oldLang = $popts->setTargetLanguage( $language );
1901 $parserOutput =
$wgParser->getFreshParser()->parse(
1903 $linestart,
true, $this->mRevisionId
1907 $popts->setInterfaceMessage(
false );
1909 if ( $language !==
null ) {
1910 $popts->setTargetLanguage( $oldLang );
1913 return $parserOutput->getText( [
1914 'enableSectionEditLinks' =>
false,
1928 public function parseInline( $text, $linestart =
true, $interface =
false ) {
1929 $parsed = $this->
parse( $text, $linestart, $interface );
1939 $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
1949 $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
1968 $maxTTL = $maxTTL ?: $this->
getConfig()->get(
'SquidMaxage' );
1970 if ( $mtime ===
null || $mtime ===
false ) {
1975 $adaptiveTTL = max( 0.9 * $age, $minTTL );
1976 $adaptiveTTL = min( $adaptiveTTL, $maxTTL );
1980 return $adaptiveTTL;
1991 return wfSetVar( $this->mEnableClientCache, $state );
2001 if ( $cookies ===
null ) {
2003 $cookies = array_merge(
2004 SessionManager::singleton()->getVaryCookies(),
2008 $config->get(
'CacheVaryCookies' )
2010 Hooks::run(
'GetCacheVaryCookies', [ $this, &$cookies ] );
2024 if (
$request->getCookie( $cookieName,
'',
'' ) !==
'' ) {
2025 wfDebug( __METHOD__ .
": found $cookieName\n" );
2029 wfDebug( __METHOD__ .
": no cache-varying cookies found\n" );
2042 if ( !array_key_exists(
$header, $this->mVaryHeader ) ) {
2043 $this->mVaryHeader[
$header] = [];
2045 if ( !is_array( $option ) ) {
2048 $this->mVaryHeader[
$header] = array_unique( array_merge( $this->mVaryHeader[
$header], $option ) );
2063 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2066 return 'Vary: ' . implode(
', ', array_keys( $this->mVaryHeader ) );
2075 $this->mLinkHeader[] =
$header;
2084 if ( !$this->mLinkHeader ) {
2088 return 'Link: ' . implode(
',', $this->mLinkHeader );
2099 $cookiesOption = [];
2100 foreach ( $cvCookies
as $cookieName ) {
2101 $cookiesOption[] =
'param=' . $cookieName;
2105 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2110 foreach ( $this->mVaryHeader
as $header => $option ) {
2112 if ( is_array( $option ) && count( $option ) > 0 ) {
2113 $newheader .=
';' . implode(
';', $option );
2115 $headers[] = $newheader;
2117 $key =
'Key: ' . implode(
',', $headers );
2137 if ( !$this->
getRequest()->getCheck(
'variant' ) &&
$lang->hasVariants() ) {
2138 $variants =
$lang->getVariants();
2140 foreach ( $variants
as $variant ) {
2141 if ( $variant ===
$lang->getCode() ) {
2144 $aloption[] =
'substr=' . $variant;
2150 if ( $variantBCP47 !== $variant ) {
2151 $aloption[] =
'substr=' . $variantBCP47;
2170 $this->mPreventClickjacking = $enable;
2179 $this->mPreventClickjacking =
false;
2201 if ( $config->get(
'BreakFrames' ) ) {
2203 } elseif ( $this->mPreventClickjacking && $config->get(
'EditPageFrameOptions' ) ) {
2204 return $config->get(
'EditPageFrameOptions' );
2219 # don't serve compressed data to clients who can't handle it
2220 # maintain different caches for logged-in users and non-logged in ones
2223 if ( $config->get(
'UseKeyHeader' ) ) {
2227 if ( $this->mEnableClientCache ) {
2229 $config->get(
'UseSquid' ) &&
2231 !SessionManager::getGlobalSession()->isPersistent() &&
2232 !$this->isPrintable() &&
2233 $this->mCdnMaxage != 0 &&
2234 !$this->haveCacheVaryCookies()
2236 if ( $config->get(
'UseESI' ) ) {
2237 # We'll purge the proxy cache explicitly, but require end user agents
2238 # to revalidate against the proxy on each visit.
2239 # Surrogate-Control controls our CDN, Cache-Control downstream caches
2241 ": proxy caching with ESI; {$this->mLastModified} **",
'private' );
2242 # start with a shorter timeout for initial testing
2243 # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
2245 "Surrogate-Control: max-age={$config->get( 'SquidMaxage' )}" .
2246 "+{$this->mCdnMaxage}, content=\"ESI/1.0\""
2248 $response->header(
'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
2250 # We'll purge the proxy cache for anons explicitly, but require end user agents
2251 # to revalidate against the proxy on each visit.
2252 # IMPORTANT! The CDN needs to replace the Cache-Control header with
2253 # Cache-Control: s-maxage=0, must-revalidate, max-age=0
2255 ": local proxy caching; {$this->mLastModified} **",
'private' );
2256 # start with a shorter timeout for initial testing
2257 # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2259 "s-maxage={$this->mCdnMaxage}, must-revalidate, max-age=0" );
2262 # We do want clients to cache if they can, but they *must* check for updates
2263 # on revisiting the page.
2264 wfDebug( __METHOD__ .
": private caching; {$this->mLastModified} **",
'private' );
2265 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
2266 $response->header(
"Cache-Control: private, must-revalidate, max-age=0" );
2268 if ( $this->mLastModified ) {
2269 $response->header(
"Last-Modified: {$this->mLastModified}" );
2272 wfDebug( __METHOD__ .
": no caching **",
'private' );
2274 # In general, the absence of a last modified header should be enough to prevent
2275 # the client from using its cache. We send a few other things just to make sure.
2276 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
2277 $response->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2278 $response->header(
'Pragma: no-cache' );
2295 if ( $this->mDoNothing ) {
2296 return $return ?
'' :
null;
2302 if ( $this->mRedirect !=
'' ) {
2303 # Standards require redirect URLs to be absolute
2309 if (
Hooks::run(
"BeforePageRedirect", [ $this, &$redirect, &
$code ] ) ) {
2311 if ( !$config->get(
'DebugRedirects' ) ) {
2316 if ( $config->get(
'VaryOnXFP' ) ) {
2321 $response->header(
"Content-Type: text/html; charset=utf-8" );
2322 if ( $config->get(
'DebugRedirects' ) ) {
2323 $url = htmlspecialchars( $redirect );
2324 print "<!DOCTYPE html>\n<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2325 print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2326 print "</body>\n</html>\n";
2328 $response->header(
'Location: ' . $redirect );
2332 return $return ?
'' :
null;
2333 } elseif ( $this->mStatusCode ) {
2334 $response->statusHeader( $this->mStatusCode );
2337 # Buffer output; final headers may depend on later processing
2340 $response->header(
'Content-type: ' . $config->get(
'MimeType' ) .
'; charset=UTF-8' );
2345 $response->header(
'X-UA-Compatible: IE=Edge' );
2347 if ( !$this->mArticleBodyOnly ) {
2350 if ( $sk->shouldPreloadLogo() ) {
2356 if ( $linkHeader ) {
2362 if ( $frameOptions ) {
2363 $response->header(
"X-Frame-Options: $frameOptions" );
2366 if ( $this->mArticleBodyOnly ) {
2370 if ( $this->
getRequest()->getBool(
'safemode' ) ) {
2375 foreach ( $sk->getDefaultModules()
as $group ) {
2382 $outputPage = $this;
2389 }
catch ( Exception
$e ) {
2398 }
catch ( Exception
$e ) {
2406 return ob_get_clean();
2425 if ( $htmlTitle !==
false ) {
2431 $this->mRedirect =
'';
2455 if ( $msg instanceof
Message ) {
2457 trigger_error(
'Argument ignored: $params. The message parameters argument '
2458 .
'is discarded when the $msg argument is a Message object instead of '
2459 .
'a string.', E_USER_NOTICE );
2461 $this->
addHTML( $msg->parseAsBlock() );
2476 foreach ( $errors
as $key => $error ) {
2477 $errors[$key] = (
array)$error;
2485 if ( in_array( $action, [
'read',
'edit',
'createpage',
'createtalk',
'upload' ] )
2486 && $this->
getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2487 && ( $errors[0][0] ==
'badaccess-groups' || $errors[0][0] ==
'badaccess-group0' )
2491 $displayReturnto =
null;
2493 # Due to T34276, if a user does not have read permissions,
2494 # $this->getTitle() will just give Special:Badtitle, which is
2495 # not especially useful as a returnto parameter. Use the title
2496 # from the request instead, if there was one.
2499 if ( $action ==
'edit' ) {
2500 $msg =
'whitelistedittext';
2501 $displayReturnto = $returnto;
2502 } elseif ( $action ==
'createpage' || $action ==
'createtalk' ) {
2503 $msg =
'nocreatetext';
2504 } elseif ( $action ==
'upload' ) {
2505 $msg =
'uploadnologintext';
2507 $msg =
'loginreqpagetext';
2514 $query[
'returnto'] = $returnto->getPrefixedText();
2517 $returntoquery =
$request->getValues();
2518 unset( $returntoquery[
'title'] );
2519 unset( $returntoquery[
'returnto'] );
2520 unset( $returntoquery[
'returntoquery'] );
2524 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
2527 $this->
msg(
'loginreqlink' )->
text(),
2533 $this->
addHTML( $this->
msg( $msg )->rawParams( $loginLink )->
parse() );
2535 # Don't return to a page the user can't read otherwise
2536 # we'll end up in a pointless loop
2537 if ( $displayReturnto && $displayReturnto->userCan(
'read', $this->getUser() ) ) {
2555 $this->
addWikiMsg(
'versionrequiredtext', $version );
2567 if ( $action ==
null ) {
2568 $text = $this->
msg(
'permissionserrorstext', count( $errors ) )->plain() .
"\n\n";
2570 $action_desc = $this->
msg(
"action-$action" )->plain();
2572 'permissionserrorstext-withaction',
2575 )->plain() .
"\n\n";
2578 if ( count( $errors ) > 1 ) {
2579 $text .=
'<ul class="permissions-errors">' .
"\n";
2581 foreach ( $errors
as $error ) {
2583 $text .= call_user_func_array( [ $this,
'msg' ], $error )->plain();
2588 $text .=
"<div class=\"permissions-errors\">\n" .
2589 call_user_func_array( [ $this,
'msg' ], reset( $errors ) )->plain() .
2607 if ( $lag >= $config->get(
'SlaveLagWarning' ) ) {
2608 $lag = floor( $lag );
2609 $message = $lag < $config->get(
'SlaveLagCritical' )
2612 $wrap =
Html::rawElement(
'div', [
'class' =>
"mw-{$message}" ],
"\n$1\n" );
2653 ->getLinkRendererFactory()->createFromLegacyOptions(
$options );
2654 $link = $this->
msg(
'returnto' )->rawParams(
2656 $this->
addHTML(
"<p id=\"mw-returnto\">{$link}</p>\n" );
2667 public function returnToMain( $unused =
null, $returnto =
null, $returntoquery =
null ) {
2668 if ( $returnto ==
null ) {
2669 $returnto = $this->
getRequest()->getText(
'returnto' );
2672 if ( $returntoquery ==
null ) {
2673 $returntoquery = $this->
getRequest()->getText(
'returntoquery' );
2676 if ( $returnto ===
'' ) {
2680 if ( is_object( $returnto ) ) {
2681 $titleObj = $returnto;
2687 if ( !is_object( $titleObj ) || $titleObj->isExternal() ) {
2695 if ( !$this->rlClientContext ) {
2699 $this->
getSkin()->getSkinName(),
2700 $this->
getUser()->isLoggedIn() ? $this->
getUser()->getName() :
null,
2727 if ( !$this->rlClient ) {
2739 $this->
getSkin()->setupSkinUserCss( $this );
2742 $exemptGroups = [
'site' => [],
'noscript' => [],
'private' => [],
'user' => [] ];
2748 $userBatch = [
'user.styles',
'user' ];
2749 $siteBatch = array_diff( $moduleStyles, $userBatch );
2755 $moduleStyles = array_filter( $moduleStyles,
2757 $module = $rl->getModule(
$name );
2760 $exemptStates[
$name] =
'ready';
2764 $group = $module->getGroup();
2765 if ( isset( $exemptGroups[$group] ) ) {
2766 $exemptStates[
$name] =
'ready';
2767 if ( !$module->isKnownEmpty(
$context ) ) {
2769 $exemptGroups[$group][] = $name;
2777 $this->rlExemptStyleModules = $exemptGroups;
2779 $isUserModuleFiltered = !$this->
filterModules( [
'user' ] );
2782 if ( !$isUserModuleFiltered ) {
2784 $userModule = $rl->getModule(
'user' );
2788 $this->rlUserModuleState = $exemptStates[
'user'] = $userState;
2835 $pieces[] =
Html::element(
'meta', [
'charset' =>
'UTF-8' ] );
2842 $pieces = array_merge( $pieces, array_values( $this->mHeadItems ) );
2845 $pieces[] =
'<!--[if lt IE 9]>' .
2857 $bodyClasses[] =
'mediawiki';
2859 # Classes for LTR/RTL directionality support
2860 $bodyClasses[] = $userdir;
2861 $bodyClasses[] =
"sitedir-$sitedir";
2863 $underline = $this->
getUser()->getOption(
'underline' );
2864 if ( $underline < 2 ) {
2868 $bodyClasses[] =
'mw-underline-' . ( $underline ?
'always' :
'never' );
2871 if ( $this->
getLanguage()->capitalizeAllNouns() ) {
2872 # A <body> class is probably not the best way to do this . . .
2873 $bodyClasses[] =
'capitalize-all-nouns';
2879 $bodyClasses[] =
'mw-hide-empty-elt';
2889 $bodyAttrs[
'class'] = implode(
' ', $bodyClasses );
2893 Hooks::run(
'OutputPageBodyAttributes', [ $this, $sk, &$bodyAttrs ] );
2906 if ( is_null( $this->mResourceLoader ) ) {
2909 LoggerFactory::getInstance(
'resourceloader' )
2943 $chunks = array_filter( $chunks,
'strlen' );
2944 return WrappedString::join(
"\n", $chunks );
2948 return $this->
getConfig()->get(
'AllowUserJs' )
2950 && $this->
getTitle()->isUserJsConfigPage()
2955 return $this->
getConfig()->get(
'AllowUserCss' )
2957 && $this->
getTitle()->isUserCssConfigPage()
2979 if ( $this->rlUserModuleState ===
'loading' ) {
2982 [
'excludepage' => $this->
getTitle()->getPrefixedDBkey() ]
3008 if ( $this->limitReportJSData ) {
3011 [
'wgPageParseReport' => $this->limitReportJSData ]
3036 if ( is_array(
$keys ) ) {
3038 $this->mJsConfigVars[$key] =
$value;
3060 $canonicalSpecialPageName =
false; # T23115
3063 $ns =
$title->getNamespace();
3071 $relevantTitle = $sk->getRelevantTitle();
3072 $relevantUser = $sk->getRelevantUser();
3075 list( $canonicalSpecialPageName, ) =
3079 $curRevisionId = $wikiPage->getLatest();
3080 $articleId = $wikiPage->getId();
3086 $separatorTransTable =
$lang->separatorTransformTable();
3087 $separatorTransTable = $separatorTransTable ? $separatorTransTable : [];
3088 $compactSeparatorTransTable = [
3089 implode(
"\t", array_keys( $separatorTransTable ) ),
3090 implode(
"\t", $separatorTransTable ),
3092 $digitTransTable =
$lang->digitTransformTable();
3093 $digitTransTable = $digitTransTable ? $digitTransTable : [];
3094 $compactDigitTransTable = [
3095 implode(
"\t", array_keys( $digitTransTable ) ),
3096 implode(
"\t", $digitTransTable ),
3102 'wgCanonicalNamespace' => $canonicalNamespace,
3103 'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3104 'wgNamespaceNumber' =>
$title->getNamespace(),
3105 'wgPageName' =>
$title->getPrefixedDBkey(),
3106 'wgTitle' =>
$title->getText(),
3107 'wgCurRevisionId' => $curRevisionId,
3109 'wgArticleId' => $articleId,
3111 'wgIsRedirect' => $title->isRedirect(),
3113 'wgUserName' =>
$user->isAnon() ? null :
$user->getName(),
3114 'wgUserGroups' =>
$user->getEffectiveGroups(),
3117 'wgPageContentLanguage' =>
$lang->getCode(),
3118 'wgPageContentModel' => $title->getContentModel(),
3119 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3120 'wgDigitTransformTable' => $compactDigitTransTable,
3121 'wgDefaultDateFormat' =>
$lang->getDefaultDateFormat(),
3122 'wgMonthNames' =>
$lang->getMonthNamesArray(),
3123 'wgMonthNamesShort' =>
$lang->getMonthAbbreviationsArray(),
3124 'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3125 'wgRelevantArticleId' => $relevantTitle->getArticleID(),
3129 if (
$user->isLoggedIn() ) {
3131 $vars[
'wgUserEditCount'] =
$user->getEditCount();
3132 $userReg =
$user->getRegistration();
3133 $vars[
'wgUserRegistration'] = $userReg ?
wfTimestamp( TS_UNIX, $userReg ) * 1000 :
null;
3137 $vars[
'wgUserNewMsgRevisionId'] =
$user->getNewMessageRevisionId();
3147 $vars[
'wgRelevantPageIsProbablyEditable'] = $relevantTitle
3148 && $relevantTitle->quickUserCan(
'edit',
$user )
3149 && ( $relevantTitle->exists() || $relevantTitle->quickUserCan(
'create',
$user ) );
3157 if (
$title->isMainPage() ) {
3158 $vars[
'wgIsMainPage'] =
true;
3161 if ( $this->mRedirectedFrom ) {
3162 $vars[
'wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3165 if ( $relevantUser && ( !$relevantUser->isHidden() ||
$user->isAllowed(
'hideuser' ) ) ) {
3168 $vars[
'wgRelevantUserName'] = $relevantUser->getName();
3193 $request->getVal(
'action' ) !==
'submit' ||
3194 !
$request->getCheck(
'wpPreview' ) ||
3202 if ( !
$user->isLoggedIn() ) {
3206 if ( !
$user->matchEditToken(
$request->getVal(
'wpEditToken' ) ) ) {
3212 !
$title->isUserJsConfigPage()
3213 && !
$title->isUserCssConfigPage()
3217 if ( !
$title->isSubpageOf(
$user->getUserPage() ) ) {
3222 $errors =
$title->getUserPermissionsErrors(
'edit',
$user );
3223 if ( count( $errors ) !== 0 ) {
3242 'name' =>
'generator',
3243 'content' =>
"MediaWiki $wgVersion",
3246 if ( $config->get(
'ReferrerPolicy' ) !==
false ) {
3249 foreach ( array_reverse( (
array)$config->get(
'ReferrerPolicy' ) )
as $i => $policy ) {
3251 'name' =>
'referrer',
3252 'content' => $policy,
3257 $p =
"{$this->mIndexPolicy},{$this->mFollowPolicy}";
3258 if ( $p !==
'index,follow' ) {
3267 foreach ( $this->mMetatags
as $tag ) {
3268 if ( strncasecmp( $tag[0],
'http:', 5 ) === 0 ) {
3270 $tag[0] = substr( $tag[0], 5 );
3271 } elseif ( strncasecmp( $tag[0],
'og:', 3 ) === 0 ) {
3276 $tagName =
"meta-{$tag[0]}";
3277 if ( isset( $tags[$tagName] ) ) {
3278 $tagName .= $tag[1];
3283 'content' => $tag[1]
3288 foreach ( $this->mLinktags
as $tag ) {
3292 # Universal edit button
3293 if ( $config->get(
'UniversalEditButton' ) && $this->isArticleRelated() ) {
3296 && ( $this->
getTitle()->exists() ||
3300 $msg = $this->
msg(
'edit' )->text();
3302 'rel' =>
'alternate',
3303 'type' =>
'application/x-wiki',
3305 'href' => $this->
getTitle()->getEditURL(),
3311 'href' => $this->
getTitle()->getEditURL(),
3316 # Generally the order of the favicon and apple-touch-icon links
3317 # should not matter, but Konqueror (3.5.9 at least) incorrectly
3318 # uses whichever one appears later in the HTML source. Make sure
3319 # apple-touch-icon is specified first to avoid this.
3320 if ( $config->get(
'AppleTouchIcon' ) !==
false ) {
3322 'rel' =>
'apple-touch-icon',
3323 'href' => $config->get(
'AppleTouchIcon' )
3327 if ( $config->get(
'Favicon' ) !==
false ) {
3329 'rel' =>
'shortcut icon',
3330 'href' => $config->get(
'Favicon' )
3334 # OpenSearch description link
3337 'type' =>
'application/opensearchdescription+xml',
3338 'href' =>
wfScript(
'opensearch_desc' ),
3339 'title' => $this->
msg(
'opensearch-desc' )->inContentLanguage()->
text(),
3342 if ( $config->get(
'EnableAPI' ) ) {
3343 # Real Simple Discovery link, provides auto-discovery information
3344 # for the MediaWiki API (and potentially additional custom API
3345 # support such as WordPress or Twitter-compatible APIs for a
3346 # blogging extension, etc)
3349 'type' =>
'application/rsd+xml',
3355 [
'action' =>
'rsd' ] ),
3362 if ( !$config->get(
'DisableLangConversion' ) ) {
3364 if (
$lang->hasVariants() ) {
3365 $variants =
$lang->getVariants();
3366 foreach ( $variants
as $variant ) {
3368 'rel' =>
'alternate',
3370 'href' => $this->
getTitle()->getLocalURL(
3371 [
'variant' => $variant ] )
3375 # x-default link per https://support.google.com/webmasters/answer/189077?hl=en
3377 'rel' =>
'alternate',
3378 'hreflang' =>
'x-default',
3379 'href' => $this->
getTitle()->getLocalURL() ] );
3384 if ( $this->copyrightUrl !==
null ) {
3388 if ( $config->get(
'RightsPage' ) ) {
3392 $copyright = $copy->getLocalURL();
3396 if ( !$copyright && $config->get(
'RightsUrl' ) ) {
3397 $copyright = $config->get(
'RightsUrl' );
3404 'href' => $copyright ]
3409 if ( $config->get(
'Feed' ) ) {
3413 # Use the page name for the title. In principle, this could
3414 # lead to issues with having the same name for different feeds
3415 # corresponding to the same page, but we can't avoid that at
3421 # Used
messages:
'page-rss-feed' and 'page-atom-feed' (
for an easier grep)
3423 "page-{$format}-feed", $this->
getTitle()->getPrefixedText()
3428 # Recent changes feed should appear on every page (except recentchanges,
3429 # that would be redundant). Put it after the per-page feed to avoid
3430 # changing existing behavior. It's still available, probably via a
3431 # menu in your browser. Some sites might have a different feed they'd
3432 # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3433 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3434 # If so, use it instead.
3435 $sitename = $config->get(
'Sitename' );
3436 if ( $config->get(
'OverrideSiteFeed' ) ) {
3437 foreach ( $config->get(
'OverrideSiteFeed' )
as $type => $feedUrl ) {
3442 $this->
msg(
"site-{$type}-feed", $sitename )->
text()
3445 } elseif ( !$this->
getTitle()->isSpecial(
'Recentchanges' ) ) {
3447 foreach ( $config->get(
'AdvertisedFeedTypes' )
as $format ) {
3450 $rctitle->getLocalURL( [
'feed' => $format ] ),
3451 # For grep:
'site-rss-feed',
'site-atom-feed'
3452 $this->msg(
"site-{$format}-feed", $sitename )->text()
3457 # Allow extensions to change the list pf feeds. This hook is primarily for changing,
3458 # manipulating or removing existing feed tags. If you want to add new feeds, you should
3459 # use OutputPage::addFeedLink() instead.
3460 Hooks::run(
'AfterBuildFeedLinks', [ &$feedLinks ] );
3462 $tags += $feedLinks;
3466 if ( $config->get(
'EnableCanonicalServerLink' ) ) {
3467 if ( $canonicalUrl !==
false ) {
3479 if ( in_array( $action, [
'history',
'info' ] ) ) {
3480 $query =
"action={$action}";
3486 $reqUrl = $this->
getRequest()->getRequestURL();
3491 if ( $canonicalUrl !==
false ) {
3493 'rel' =>
'canonical',
3494 'href' => $canonicalUrl
3511 'rel' =>
'alternate',
3512 'type' =>
"application/$type+xml",
3527 public function addStyle( $style, $media =
'', $condition =
'', $dir =
'' ) {
3533 $options[
'condition'] = $condition;
3549 if ( $flip ===
'flip' && $this->
getLanguage()->isRTL() ) {
3550 # If wanted, and the interface is right-to-left, flip the CSS
3551 $style_css = CSSJanus::transform( $style_css,
true,
false );
3573 [
'excludepage' => $this->
getTitle()->getPrefixedDBkey() ]
3578 $previewedCSS = $this->
getRequest()->getText(
'wpTextbox1' );
3580 $previewedCSS = CSSJanus::transform( $previewedCSS,
true,
false );
3598 [
'name' =>
'ResourceLoaderDynamicStyles',
'content' =>
'' ]
3601 $separateReq = [
'site.styles',
'user.styles' ];
3602 foreach ( $this->rlExemptStyleModules
as $group => $moduleNames ) {
3605 array_diff( $moduleNames, $separateReq ),
3609 foreach ( array_intersect( $moduleNames, $separateReq )
as $name ) {
3627 foreach ( $this->styles
as $file =>
$options ) {
3630 $links[$file] =
$link;
3650 if ( isset(
$options[
'media'] ) ) {
3652 if ( is_null( $media ) ) {
3659 if ( substr( $style, 0, 1 ) ==
'/' ||
3660 substr( $style, 0, 5 ) ==
'http:' ||
3661 substr( $style, 0, 6 ) ==
'https:' ) {
3665 $url = $config->get(
'StylePath' ) .
'/' . $style .
'?' .
3666 $config->get(
'StyleVersion' );
3671 if ( isset(
$options[
'condition'] ) ) {
3672 $condition = htmlspecialchars(
$options[
'condition'] );
3673 $link =
"<!--[if $condition]>$link<![endif]-->";
3703 $remotePathPrefix = $config->
get(
'ResourceBasePath' );
3704 if ( $remotePathPrefix ===
'' ) {
3709 $remotePath = $remotePathPrefix;
3711 if ( strpos(
$path, $remotePath ) !== 0 || substr(
$path, 0, 2 ) ===
'//' ) {
3720 $uploadPath = $config->
get(
'UploadPath' );
3721 if ( strpos(
$path, $uploadPath ) === 0 ) {
3722 $localDir = $config->
get(
'UploadDirectory' );
3723 $remotePathPrefix = $remotePath = $uploadPath;
3726 $path = RelPath::getRelativePath(
$path, $remotePath );
3742 $hash = md5_file(
"$localPath/$file" );
3743 if ( $hash ===
false ) {
3744 wfLogWarning( __METHOD__ .
": Failed to hash $localPath/$file" );
3747 return "$remotePathPrefix/$file?" . substr( $hash, 0, 5 );
3761 $screenMediaQueryRegex =
'/^(?:only\s+)?screen\b/i';
3765 'printable' =>
'print',
3766 'handheld' =>
'handheld',
3768 foreach ( $switches
as $switch => $targetMedia ) {
3770 if ( $media == $targetMedia ) {
3772 } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3786 if ( $targetMedia ==
'print' || $media ==
'screen' ) {
3803 $args = func_get_args();
3846 $msgSpecs = func_get_args();
3847 array_shift( $msgSpecs );
3848 $msgSpecs = array_values( $msgSpecs );
3850 foreach ( $msgSpecs
as $n => $spec ) {
3851 if ( is_array( $spec ) ) {
3854 if ( isset(
$args[
'options'] ) ) {
3855 unset(
$args[
'options'] );
3857 'Adding "options" to ' . __METHOD__ .
' is no longer supported',
3906 public static function setupOOUI( $skinName =
'default', $dir =
'ltr' ) {
3908 $theme = isset( $themes[$skinName] ) ? $themes[$skinName] : $themes[
'default'];
3910 $themeClass =
"OOUI\\{$theme}Theme";
3911 OOUI\Theme::setSingleton(
new $themeClass() );
3912 OOUI\Element::setDefaultDir( $dir );
3923 strtolower( $this->
getSkin()->getSkinName() ),
3927 'oojs-ui-core.styles',
3928 'oojs-ui.styles.indicators',
3929 'oojs-ui.styles.textures',
3930 'mediawiki.widgets.styles',
3931 'oojs-ui.styles.icons-content',
3932 'oojs-ui.styles.icons-alerts',
3933 'oojs-ui.styles.icons-interactions',
3949 if ( !is_array( $logo ) ) {
3951 $this->
addLinkHeader(
'<' . $logo .
'>;rel=preload;as=image' );
3955 if ( isset( $logo[
'svg'] ) ) {
3958 $this->
addLinkHeader(
'<' . $logo[
'svg'] .
'>;rel=preload;as=image' );
3962 foreach ( $logo
as $dppx => $src ) {
3964 $dppx = substr( $dppx, 0, -1 );
3965 $logosPerDppx[$dppx] = $src;
3969 uksort( $logosPerDppx,
function ( $a , $b ) {
3970 $a = floatval( $a );
3971 $b = floatval( $b );
3977 return ( $a < $b ) ? -1 : 1;
3980 foreach ( $logosPerDppx
as $dppx => $src ) {
3981 $logos[] = [
'dppx' => $dppx,
'src' => $src ];
3984 $logosCount = count( $logos );
3990 for ( $i = 0; $i < $logosCount; $i++ ) {
3995 $media_query =
'not all and (min-resolution: ' . $logos[ 1 ][
'dppx'] .
'dppx)';
3996 } elseif ( $i !== $logosCount - 1 ) {
4001 $upper_bound = floatval( $logos[ $i + 1 ][
'dppx'] ) - 0.000001;
4002 $media_query =
'(min-resolution: ' . $logos[ $i ][
'dppx'] .
4003 'dppx) and (max-resolution: ' . $upper_bound .
'dppx)';
4006 $media_query =
'(min-resolution: ' . $logos[ $i ][
'dppx'] .
'dppx)';
4010 '<' . $logos[$i][
'src'] .
'>;rel=preload;as=image;media=' . $media_query
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:
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
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:".
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.
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.
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.
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.
static makeConfigSetScript(array $configuration)
Returns JS code which will set the MediaWiki configuration array to the given value.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static newDummyContext()
Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need...
showFileRenameError( $old, $new)
Title $mRedirectedFrom
If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redire...
static stripAllTags( $html)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed,...
setTitle(Title $t)
Set the Title object to use.
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.
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 "<
addCategoryLinksToLBAndGetResult(array $categories)
this hook is for auditing only $response
the array() calling protocol came about after MediaWiki 1.4rc1.
hasHeadItem( $name)
Check if the header item $name is already set.
if(!isset( $args[0])) $lang
getMetaTags()
Returns the current <meta> tags.
addParserOutput( $parserOutput, $poOptions=[])
Add everything from a ParserOutput object.
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.
__construct(IContextSource $context)
Constructor for OutputPage.
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
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
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
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 mergeAttributes( $a, $b)
Merge two sets of HTML attributes.
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
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.
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
getBottomScripts()
JS stuff to put at the bottom of the <body>.
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.
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,...
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().
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
int $mRevisionId
To include the variable {{REVISIONID}}.
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.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction 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
setCanonicalUrl( $url)
Set the URL to be used for the <link rel=canonical>>.
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
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.
addParserOutputText( $parserOutput, $poOptions=[])
Add the HTML associated with a ParserOutput object, without any metadata.
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.
static transformCssMedia( $media)
Transform "media" attribute based on request parameters.
setLastModified( $timestamp)
Override the last modified timestamp.
setConfig(array $vars)
Set mw.config variables.
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.
Interface for configuration instances.
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.
sendCacheControl()
Send cache control HTTP headers.
passed in as a query string parameter to the various URLs constructed here(i.e. $prevlink) $ldel you ll need to handle error messages
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 contains a table of contents.
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
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.
getResourceLoader()
Get a ResourceLoader object associated with this OutputPage.
isTOCEnabled()
Whether the output has a table of contents.
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,...
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...
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...
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...
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.
usually copyright or history_copyright This message must be in HTML not wikitext & $link
namespace and then decline to actually register it file or subcat img or subcat $title
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
ResourceLoaderClientHtml $rlClient
addBodyClasses( $classes)
Add a class to the <body> element.
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.
setContext(IContextSource $context)
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.
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.
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
getCanonicalUrl()
Returns the URL to be used for the <link rel=canonical>> if one is set.
setStatusCode( $statusCode)
Set the HTTP status code to send with the output.
static inlineStyle( $contents, $media='all', $attribs=[])
Output a "<style>" tag with the given contents for the given media type (if any).
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.
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
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
static runWithoutAbort( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
array $mMetatags
Should be private.
getPageClasses( $title)
TODO: document.
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():
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=license.
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.
setTarget( $target)
Sets ResourceLoader target for load.php links.
setHTMLTitle( $name)
"HTML title" means the contents of "<title>".
addParserOutputContent( $parserOutput, $poOptions=[])
Add the HTML and enhancements for it (like ResourceLoader modules) associated with a ParserOutput obj...
setLanguageLinks(array $newLinkArray)
Reset the language links and add new language links.
static setupOOUI( $skinName='default', $dir='ltr')
Helper function to setup the PHP implementation of OOUI to use in this request.
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
array $rlExemptStyleModules
and(b) You must cause any modified files to carry prominent notices stating that You changed the files
$mProperties
Additional key => value data.
wrapWikiMsg( $wrap)
This function takes a number of message/argument specifications, wraps them in some overall structure...
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?
static getSkinThemeMap()
Return a map of skin names (in lowercase) to OOUI theme names, defining which theme a given skin shou...
bool $mPrintable
We have to set isPrintable().
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.
Allows to change the fields on the form that will be generated $name
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.
static stripOuterParagraph( $html)
Strip outer.
getAllowedModules( $type)
Show what level of JavaScript / CSS untrustworthiness is allowed on this page.
Dynamic JavaScript and CSS resource loading system.
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.
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
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).
static inDebugMode()
Determine whether debug mode was requested Order of priority is 1) request param, 2) cookie,...
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.
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.
static bcp47( $code)
Get the normalised IETF language tag See unit test for examples.
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.
getHTML()
Get the body HTML.
The Message class provides methods which fulfil two basic services:
$mLinkHeader
Link: header contents.
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 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.
showNewSectionLink()
Show an "add new section" link?
parse( $text, $linestart=true, $interface=false, $language=null)
Parse wikitext and return the HTML.
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.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
if(! $wgDBerrorLogTZ) $wgRequest
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static makeLoaderQuery( $modules, $lang, $skin, $user=null, $version=null, $debug=false, $only=null, $printable=false, $handheld=false, $extraQuery=[])
Build a query array (array representation of query string) for load.php.
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.
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
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.
array $mAdditionalBodyClasses
Additional <body> classes; there are also <body> classes from other sources.
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...
static makeInlineScript( $script)
Returns an HTML script tag that runs given JS code after startup and base modules.
addTemplate(&$template)
Add the output of a QuickTemplate to the output buffer.
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.
addFeedLink( $format, $href)
Add a feed link to the page header.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
static transformResourcePath(Config $config, $path)
Transform path to web-accessible static resource.
static removeHTMLtags( $text, $processCallback=null, $args=[], $extratags=[], $removetags=[], $warnCallback=null)
Cleans up HTML, removes dangerous tags and attributes, and removes HTML comments.
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)