Go to the documentation of this file.
26 use WrappedString\WrappedString;
27 use WrappedString\WrappedStringList;
269 'Accept-Encoding' => [
'match=gzip' ],
321 # Extensions should use `new RequestContext` instead of `new OutputPage` now.
334 public function redirect( $url, $responsecode =
'302' ) {
335 # Strip newlines as a paranoia check for header injection in PHP<5.1.2
336 $this->mRedirect = str_replace(
"\n",
'', $url );
337 $this->mRedirectCode = $responsecode;
358 $this->copyrightUrl = $url;
367 $this->mStatusCode = $statusCode;
378 array_push( $this->mMetatags, [
$name, $val ] );
399 array_push( $this->mLinktags, $linkarr );
430 $this->mCanonicalUrl = $url;
450 # note: buggy CC software only reads first "meta" link
451 static $haveMeta =
false;
453 return 'alternate meta';
468 $this->mScripts .= $script;
482 array_push( $this->mExtStyles, $url );
506 if ( substr( $file, 0, 1 ) ==
'/' || preg_match(
'#^[a-z]*://#i', $file ) ) {
509 $path = $this->
getConfig()->get(
'StylePath' ) .
"/common/{$file}";
511 if ( is_null( $version ) ) {
512 $version = $this->
getConfig()->get(
'StyleVersion' );
539 $filteredModules = [];
544 && ( is_null( $position ) || $module->getPosition() == $position )
546 if ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) ) {
550 $filteredModules[] = $val;
553 return $filteredModules;
557 static $warnings = [];
558 if ( isset( $warnings[$this->mTarget][$moduleName] ) ) {
563 'Module "{module}" not loadable on target "{target}".',
565 'module' => $moduleName,
566 'target' => $this->mTarget,
580 public function getModules( $filter =
false, $position =
null, $param =
'mModules',
583 $modules = array_values( array_unique( $this->$param ) );
597 $this->mModules = array_merge( $this->mModules, (
array)
$modules );
608 return $this->
getModules( $filter, $position,
'mModuleScripts',
621 $this->mModuleScripts = array_merge( $this->mModuleScripts, (
array)
$modules );
632 return $this->
getModules( $filter, $position,
'mModuleStyles',
647 $this->mModuleStyles = array_merge( $this->mModuleStyles, (
array)
$modules );
663 $this->mTarget = $target;
698 $this->mHeadItems = array_merge( $this->mHeadItems, (
array)$values );
708 return isset( $this->mHeadItems[
$name] );
718 $this->mAdditionalBodyClasses = array_merge( $this->mAdditionalBodyClasses, (
array)$classes );
736 $this->mArticleBodyOnly = $only;
767 if ( isset( $this->mProperties[
$name] ) ) {
768 return $this->mProperties[
$name];
786 if ( !$timestamp || $timestamp ==
'19700101000000' ) {
787 wfDebug( __METHOD__ .
": CACHE DISABLED, NO TIMESTAMP\n" );
791 if ( !$config->get(
'CachePages' ) ) {
792 wfDebug( __METHOD__ .
": CACHE DISABLED\n" );
798 'page' => $timestamp,
799 'user' => $this->
getUser()->getTouched(),
800 'epoch' => $config->get(
'CacheEpoch' )
802 if ( $config->get(
'UseSquid' ) ) {
804 $modifiedTimes[
'sepoch'] =
wfTimestamp( TS_MW, time() - $config->get(
'SquidMaxage' ) );
806 Hooks::run(
'OutputPageCheckLastModified', [ &$modifiedTimes, $this ] );
808 $maxModified = max( $modifiedTimes );
809 $this->mLastModified =
wfTimestamp( TS_RFC2822, $maxModified );
811 $clientHeader = $this->
getRequest()->getHeader(
'If-Modified-Since' );
812 if ( $clientHeader ===
false ) {
813 wfDebug( __METHOD__ .
": client did not send If-Modified-Since header",
'private' );
817 # IE sends sizes after the date like this:
818 # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
819 # this breaks strtotime().
820 $clientHeader = preg_replace(
'/;.*$/',
'', $clientHeader );
822 MediaWiki\suppressWarnings();
823 $clientHeaderTime = strtotime( $clientHeader );
824 MediaWiki\restoreWarnings();
825 if ( !$clientHeaderTime ) {
827 .
": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
830 $clientHeaderTime =
wfTimestamp( TS_MW, $clientHeaderTime );
835 if ( $info !==
'' ) {
841 wfDebug( __METHOD__ .
": client sent If-Modified-Since: " .
842 wfTimestamp( TS_ISO_8601, $clientHeaderTime ),
'private' );
843 wfDebug( __METHOD__ .
": effective Last-Modified: " .
844 wfTimestamp( TS_ISO_8601, $maxModified ),
'private' );
845 if ( $clientHeaderTime < $maxModified ) {
846 wfDebug( __METHOD__ .
": STALE, $info",
'private' );
851 # Give a 304 Not Modified response code and disable body output
852 wfDebug( __METHOD__ .
": NOT MODIFIED, $info",
'private' );
853 ini_set(
'zlib.output_compression', 0 );
854 $this->
getRequest()->response()->statusHeader( 304 );
873 $this->mLastModified =
wfTimestamp( TS_RFC2822, $timestamp );
887 if ( isset( $policy[
'index'] ) ) {
890 if ( isset( $policy[
'follow'] ) ) {
903 $policy = trim( $policy );
904 if ( in_array( $policy, [
'index',
'noindex' ] ) ) {
905 $this->mIndexPolicy = $policy;
917 $policy = trim( $policy );
918 if ( in_array( $policy, [
'follow',
'nofollow' ] ) ) {
919 $this->mFollowPolicy = $policy;
930 $this->mPageTitleActionText = $text;
949 if (
$name instanceof Message ) {
952 $this->mHTMLtitle =
$name;
971 $this->mRedirectedFrom =
$t;
985 if (
$name instanceof Message ) {
989 # change "<script>foo&bar</script>" to "<script>foo&bar</script>"
990 # but leave "<i>foobar</i>" alone
991 $nameWithTags = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags(
$name ) );
992 $this->mPagetitle = $nameWithTags;
994 # change "<i>foo&bar</i>" to "foo&bar"
996 $this->
msg(
'pagetitle' )->rawParams( Sanitizer::stripAllTags( $nameWithTags ) )
997 ->inContentLanguage()
1035 if ( $str instanceof Message ) {
1036 $this->mSubtitle[] = $str->setContext( $this->
getContext() )->parse();
1038 $this->mSubtitle[] = $str;
1051 if (
$title->isRedirect() ) {
1052 $query[
'redirect'] =
'no';
1054 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1073 $this->mSubtitle = [];
1082 return implode(
"<br />\n\t\t\t\t", $this->mSubtitle );
1090 $this->mPrintable =
true;
1106 $this->mDoNothing =
true;
1148 $this->mFeedLinks = [];
1162 $this->mFeedLinks = [];
1166 if ( is_string( $val ) ) {
1180 if ( in_array( $format, $this->
getConfig()->
get(
'AdvertisedFeedTypes' ) ) ) {
1181 $this->mFeedLinks[$format] = $href;
1190 return count( $this->mFeedLinks ) > 0;
1218 $this->mIsarticle = $v;
1220 $this->mIsArticleRelated = $v;
1241 $this->mIsArticleRelated = $v;
1243 $this->mIsarticle =
false;
1263 $this->mLanguageLinks += $newLinkArray;
1273 $this->mLanguageLinks = $newLinkArray;
1293 if ( !is_array( $categories ) ||
count( $categories ) == 0 ) {
1299 # Set all the values to 'normal'.
1300 $categories = array_fill_keys( array_keys( $categories ),
'normal' );
1302 # Mark hidden categories
1303 foreach (
$res as $row ) {
1304 if ( isset( $row->pp_value ) ) {
1305 $categories[$row->page_title] =
'hidden';
1310 $outputPage = $this;
1311 # Add the remaining categories to the skin
1313 'OutputPageMakeCategoryLinks',
1314 [ &$outputPage, $categories, &$this->mCategoryLinks ] )
1316 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
1317 foreach ( $categories
as $category =>
$type ) {
1319 $category = (
string)$category;
1320 $origcategory = $category;
1326 if ( $category != $origcategory && array_key_exists( $category, $categories ) ) {
1341 # Add the links to a LinkBatch
1346 # Fetch existence plus the hiddencat property
1348 $fields = array_merge(
1350 [
'page_namespace',
'page_title',
'pp_value' ]
1353 $res =
$dbr->select( [
'page',
'page_props' ],
1355 $lb->constructSet(
'page',
$dbr ),
1358 [
'page_props' => [
'LEFT JOIN', [
1359 'pp_propname' =>
'hiddencat',
1364 # Add the results to the link cache
1376 $this->mCategoryLinks = [];
1402 if (
$type ===
'all' ) {
1403 $allCategories = [];
1404 foreach ( $this->mCategories
as $categories ) {
1405 $allCategories = array_merge( $allCategories, $categories );
1407 return $allCategories;
1409 if ( !isset( $this->mCategories[
$type] ) ) {
1410 throw new InvalidArgumentException(
'Invalid category type given: ' .
$type );
1412 return $this->mCategories[
$type];
1427 ksort( $this->mIndicators );
1452 $text = $this->
msg(
'helppage-top-gethelp' )->escaped();
1454 if ( $overrideBaseUrl ) {
1457 $toUrlencoded =
wfUrlencode( str_replace(
' ',
'_', $to ) );
1458 $helpUrl =
"//www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded";
1465 'target' =>
'_blank',
1466 'class' =>
'mw-helplink',
1490 if ( $this->
getConfig()->
get(
'AllowSiteCSSOnRestrictedPages' ) ) {
1509 return min( array_values( $this->mAllowedModules ) );
1511 return isset( $this->mAllowedModules[
$type] )
1512 ? $this->mAllowedModules[
$type]
1545 $this->mBodytext .= $text;
1565 $this->mBodytext =
'';
1589 $anonPO->setEditSection(
false );
1590 $anonPO->setAllowUnsafeRawHtml(
false );
1591 if ( !
$options->matches( $anonPO ) ) {
1597 if ( !$this->mParserOptions ) {
1603 $po->setEditSection(
false );
1604 $po->setAllowUnsafeRawHtml(
false );
1605 $po->isBogus =
true;
1613 $this->mParserOptions->setEditSection(
false );
1614 $this->mParserOptions->setAllowUnsafeRawHtml(
false );
1620 return wfSetVar( $this->mParserOptions,
null,
true );
1634 $val = is_null( $revid ) ? null : intval( $revid );
1635 return wfSetVar( $this->mRevisionId, $val );
1655 return wfSetVar( $this->mRevisionTimestamp, $timestamp );
1676 if ( $file instanceof
File && $file->
exists() ) {
1677 $val = [
'time' => $file->getTimestamp(),
'sha1' => $file->getSha1() ];
1679 return wfSetVar( $this->mFileVersion, $val,
true );
1720 public function addWikiText( $text, $linestart =
true, $interface =
true ) {
1772 $tidy =
false, $interface =
false
1777 $oldTidy = $popts->setTidy( $tidy );
1778 $popts->setInterfaceMessage( (
bool)$interface );
1780 $parserOutput =
$wgParser->getFreshParser()->parse(
1782 $linestart,
true, $this->mRevisionId
1785 $popts->setTidy( $oldTidy );
1799 $this->mLanguageLinks += $parserOutput->getLanguageLinks();
1802 $this->mNewSectionLink = $parserOutput->getNewSection();
1803 $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
1805 if ( !$parserOutput->isCacheable() ) {
1808 $this->mNoGallery = $parserOutput->getNoGallery();
1809 $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
1810 $this->
addModules( $parserOutput->getModules() );
1814 $this->mPreventClickjacking = $this->mPreventClickjacking
1815 || $parserOutput->preventClickjacking();
1818 foreach ( (
array)$parserOutput->getTemplateIds()
as $ns => $dbks ) {
1819 if ( isset( $this->mTemplateIds[$ns] ) ) {
1820 $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1822 $this->mTemplateIds[$ns] = $dbks;
1826 foreach ( (
array)$parserOutput->getFileSearchOptions()
as $dbk => $data ) {
1827 $this->mImageTimeKeys[$dbk] = $data;
1831 $parserOutputHooks = $this->
getConfig()->get(
'ParserOutputHooks' );
1832 foreach ( $parserOutput->getOutputHooks()
as $hookInfo ) {
1833 list( $hookName, $data ) = $hookInfo;
1834 if ( isset( $parserOutputHooks[$hookName] ) ) {
1835 call_user_func( $parserOutputHooks[$hookName], $this, $parserOutput, $data );
1840 if ( $parserOutput->getEnableOOUI() ) {
1845 if ( !$this->limitReportJSData ) {
1846 $this->limitReportJSData = $parserOutput->getLimitReportJSData();
1853 $outputPage = $this;
1854 Hooks::run(
'LanguageLinks', [ $this->
getTitle(), &$this->mLanguageLinks, &$linkFlags ] );
1855 Hooks::run(
'OutputPageParserOutput', [ &$outputPage, $parserOutput ] );
1861 if ( $parserOutput->getTOCEnabled() && $parserOutput->getTOCHTML() ) {
1862 $this->mEnableTOC =
true;
1876 $this->
addModules( $parserOutput->getModules() );
1890 $text = $parserOutput->getText();
1892 $outputPage = $this;
1893 Hooks::run(
'OutputPageBeforeHTML', [ &$outputPage, &$text ] );
1906 if ( $parserOutput->getEditSectionTokens() ) {
1907 $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks );
1934 public function parse( $text, $linestart =
true, $interface =
false, $language =
null ) {
1937 if ( is_null( $this->
getTitle() ) ) {
1938 throw new MWException(
'Empty $mTitle in ' . __METHOD__ );
1943 $popts->setInterfaceMessage(
true );
1945 if ( $language !==
null ) {
1946 $oldLang = $popts->setTargetLanguage( $language );
1949 $parserOutput =
$wgParser->getFreshParser()->parse(
1951 $linestart,
true, $this->mRevisionId
1955 $popts->setInterfaceMessage(
false );
1957 if ( $language !==
null ) {
1958 $popts->setTargetLanguage( $oldLang );
1961 return $parserOutput->getText();
1974 public function parseInline( $text, $linestart =
true, $interface =
false ) {
1975 $parsed = $this->
parse( $text, $linestart, $interface );
1976 return Parser::stripOuterParagraph( $parsed );
1993 $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
2003 $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
2022 $maxTTL = $maxTTL ?: $this->
getConfig()->get(
'SquidMaxage' );
2024 if ( $mtime ===
null || $mtime ===
false ) {
2029 $adaptiveTTL = max( 0.9 * $age, $minTTL );
2030 $adaptiveTTL = min( $adaptiveTTL, $maxTTL );
2034 return $adaptiveTTL;
2045 return wfSetVar( $this->mEnableClientCache, $state );
2055 if ( $cookies ===
null ) {
2057 $cookies = array_merge(
2058 SessionManager::singleton()->getVaryCookies(),
2062 $config->get(
'CacheVaryCookies' )
2064 Hooks::run(
'GetCacheVaryCookies', [ $this, &$cookies ] );
2078 if (
$request->getCookie( $cookieName,
'',
'' ) !==
'' ) {
2079 wfDebug( __METHOD__ .
": found $cookieName\n" );
2083 wfDebug( __METHOD__ .
": no cache-varying cookies found\n" );
2096 if ( !array_key_exists(
$header, $this->mVaryHeader ) ) {
2097 $this->mVaryHeader[
$header] = [];
2099 if ( !is_array( $option ) ) {
2102 $this->mVaryHeader[
$header] = array_unique( array_merge( $this->mVaryHeader[
$header], $option ) );
2117 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2120 return 'Vary: ' . implode(
', ', array_keys( $this->mVaryHeader ) );
2129 $this->mLinkHeader[] =
$header;
2138 if ( !$this->mLinkHeader ) {
2142 return 'Link: ' . implode(
',', $this->mLinkHeader );
2153 $cookiesOption = [];
2154 foreach ( $cvCookies
as $cookieName ) {
2155 $cookiesOption[] =
'param=' . $cookieName;
2159 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2164 foreach ( $this->mVaryHeader
as $header => $option ) {
2166 if ( is_array( $option ) &&
count( $option ) > 0 ) {
2167 $newheader .=
';' . implode(
';', $option );
2169 $headers[] = $newheader;
2171 $key =
'Key: ' . implode(
',', $headers );
2191 if ( !$this->
getRequest()->getCheck(
'variant' ) &&
$lang->hasVariants() ) {
2192 $variants =
$lang->getVariants();
2194 foreach ( $variants
as $variant ) {
2195 if ( $variant ===
$lang->getCode() ) {
2198 $aloption[] =
'substr=' . $variant;
2203 $variantBCP47 =
wfBCP47( $variant );
2204 if ( $variantBCP47 !== $variant ) {
2205 $aloption[] =
'substr=' . $variantBCP47;
2224 $this->mPreventClickjacking = $enable;
2233 $this->mPreventClickjacking =
false;
2255 if ( $config->get(
'BreakFrames' ) ) {
2257 } elseif ( $this->mPreventClickjacking && $config->get(
'EditPageFrameOptions' ) ) {
2258 return $config->get(
'EditPageFrameOptions' );
2273 # don't serve compressed data to clients who can't handle it
2274 # maintain different caches for logged-in users and non-logged in ones
2277 if ( $config->get(
'UseKeyHeader' ) ) {
2281 if ( $this->mEnableClientCache ) {
2283 $config->get(
'UseSquid' ) &&
2285 !SessionManager::getGlobalSession()->isPersistent() &&
2287 $this->mCdnMaxage != 0 &&
2290 if ( $config->get(
'UseESI' ) ) {
2291 # We'll purge the proxy cache explicitly, but require end user agents
2292 # to revalidate against the proxy on each visit.
2293 # Surrogate-Control controls our CDN, Cache-Control downstream caches
2295 ": proxy caching with ESI; {$this->mLastModified} **",
'private' );
2296 # start with a shorter timeout for initial testing
2297 # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
2299 "Surrogate-Control: max-age={$config->get( 'SquidMaxage' )}" .
2300 "+{$this->mCdnMaxage}, content=\"ESI/1.0\""
2302 $response->header(
'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
2304 # We'll purge the proxy cache for anons explicitly, but require end user agents
2305 # to revalidate against the proxy on each visit.
2306 # IMPORTANT! The CDN needs to replace the Cache-Control header with
2307 # Cache-Control: s-maxage=0, must-revalidate, max-age=0
2309 ": local proxy caching; {$this->mLastModified} **",
'private' );
2310 # start with a shorter timeout for initial testing
2311 # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2313 "s-maxage={$this->mCdnMaxage}, must-revalidate, max-age=0" );
2316 # We do want clients to cache if they can, but they *must* check for updates
2317 # on revisiting the page.
2318 wfDebug( __METHOD__ .
": private caching; {$this->mLastModified} **",
'private' );
2319 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
2320 $response->header(
"Cache-Control: private, must-revalidate, max-age=0" );
2322 if ( $this->mLastModified ) {
2323 $response->header(
"Last-Modified: {$this->mLastModified}" );
2326 wfDebug( __METHOD__ .
": no caching **",
'private' );
2328 # In general, the absence of a last modified header should be enough to prevent
2329 # the client from using its cache. We send a few other things just to make sure.
2330 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
2331 $response->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2332 $response->header(
'Pragma: no-cache' );
2349 if ( $this->mDoNothing ) {
2350 return $return ?
'' :
null;
2356 if ( $this->mRedirect !=
'' ) {
2357 # Standards require redirect URLs to be absolute
2363 if (
Hooks::run(
"BeforePageRedirect", [ $this, &$redirect, &
$code ] ) ) {
2365 if ( !$config->get(
'DebugRedirects' ) ) {
2370 if ( $config->get(
'VaryOnXFP' ) ) {
2375 $response->header(
"Content-Type: text/html; charset=utf-8" );
2376 if ( $config->get(
'DebugRedirects' ) ) {
2377 $url = htmlspecialchars( $redirect );
2378 print
"<!DOCTYPE html>\n<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2379 print
"<p>Location: <a href=\"$url\">$url</a></p>\n";
2380 print
"</body>\n</html>\n";
2382 $response->header(
'Location: ' . $redirect );
2386 return $return ?
'' :
null;
2387 } elseif ( $this->mStatusCode ) {
2388 $response->statusHeader( $this->mStatusCode );
2391 # Buffer output; final headers may depend on later processing
2394 $response->header(
'Content-type: ' . $config->get(
'MimeType' ) .
'; charset=UTF-8' );
2399 $response->header(
'X-UA-Compatible: IE=Edge' );
2401 if ( !$this->mArticleBodyOnly ) {
2404 if ( $sk->shouldPreloadLogo() ) {
2410 if ( $linkHeader ) {
2416 if ( $frameOptions ) {
2417 $response->header(
"X-Frame-Options: $frameOptions" );
2420 if ( $this->mArticleBodyOnly ) {
2424 if ( $this->
getRequest()->getBool(
'safemode' ) ) {
2429 foreach ( $sk->getDefaultModules()
as $group ) {
2436 $outputPage = $this;
2439 Hooks::run(
'BeforePageDisplay', [ &$outputPage, &$sk ] );
2443 }
catch ( Exception
$e ) {
2451 Hooks::run(
'AfterFinalPageOutput', [ $this ] );
2452 }
catch ( Exception
$e ) {
2460 return ob_get_clean();
2479 if ( $htmlTitle !==
false ) {
2485 $this->mRedirect =
'';
2503 if ( !
$title instanceof Message ) {
2509 if ( $msg instanceof Message ) {
2511 trigger_error(
'Argument ignored: $params. The message parameters argument '
2512 .
'is discarded when the $msg argument is a Message object instead of '
2513 .
'a string.', E_USER_NOTICE );
2515 $this->
addHTML( $msg->parseAsBlock() );
2530 foreach ( $errors
as $key => $error ) {
2531 $errors[$key] = (
array)$error;
2539 if ( in_array( $action, [
'read',
'edit',
'createpage',
'createtalk',
'upload' ] )
2540 && $this->
getUser()->isAnon() &&
count( $errors ) == 1 && isset( $errors[0][0] )
2541 && ( $errors[0][0] ==
'badaccess-groups' || $errors[0][0] ==
'badaccess-group0' )
2545 $displayReturnto =
null;
2547 # Due to T34276, if a user does not have read permissions,
2548 # $this->getTitle() will just give Special:Badtitle, which is
2549 # not especially useful as a returnto parameter. Use the title
2550 # from the request instead, if there was one.
2553 if ( $action ==
'edit' ) {
2554 $msg =
'whitelistedittext';
2555 $displayReturnto = $returnto;
2556 } elseif ( $action ==
'createpage' || $action ==
'createtalk' ) {
2557 $msg =
'nocreatetext';
2558 } elseif ( $action ==
'upload' ) {
2559 $msg =
'uploadnologintext';
2561 $msg =
'loginreqpagetext';
2568 $query[
'returnto'] = $returnto->getPrefixedText();
2571 $returntoquery =
$request->getValues();
2572 unset( $returntoquery[
'title'] );
2573 unset( $returntoquery[
'returnto'] );
2574 unset( $returntoquery[
'returntoquery'] );
2578 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
2581 $this->
msg(
'loginreqlink' )->
text(),
2587 $this->
addHTML( $this->
msg( $msg )->rawParams( $loginLink )->
parse() );
2589 # Don't return to a page the user can't read otherwise
2590 # we'll end up in a pointless loop
2591 if ( $displayReturnto && $displayReturnto->userCan(
'read', $this->getUser() ) ) {
2609 $this->
addWikiMsg(
'versionrequiredtext', $version );
2621 if ( $action ==
null ) {
2622 $text = $this->
msg(
'permissionserrorstext',
count( $errors ) )->plain() .
"\n\n";
2624 $action_desc = $this->
msg(
"action-$action" )->plain();
2626 'permissionserrorstext-withaction',
2629 )->plain() .
"\n\n";
2632 if (
count( $errors ) > 1 ) {
2633 $text .=
'<ul class="permissions-errors">' .
"\n";
2635 foreach ( $errors
as $error ) {
2637 $text .= call_user_func_array( [ $this,
'msg' ], $error )->plain();
2642 $text .=
"<div class=\"permissions-errors\">\n" .
2643 call_user_func_array( [ $this,
'msg' ], reset( $errors ) )->plain() .
2662 if ( func_num_args() > 0 ) {
2663 throw new MWException( __METHOD__ .
' no longer accepts arguments since 1.25.' );
2691 if ( $lag >= $config->get(
'SlaveLagWarning' ) ) {
2692 $lag = floor( $lag );
2693 $message = $lag < $config->get(
'SlaveLagCritical' )
2696 $wrap =
Html::rawElement(
'div', [
'class' =>
"mw-{$message}" ],
"\n$1\n" );
2737 ->getLinkRendererFactory()->createFromLegacyOptions(
$options );
2738 $link = $this->
msg(
'returnto' )->rawParams(
2740 $this->
addHTML(
"<p id=\"mw-returnto\">{$link}</p>\n" );
2751 public function returnToMain( $unused =
null, $returnto =
null, $returntoquery =
null ) {
2752 if ( $returnto ==
null ) {
2753 $returnto = $this->
getRequest()->getText(
'returnto' );
2756 if ( $returntoquery ==
null ) {
2757 $returntoquery = $this->
getRequest()->getText(
'returntoquery' );
2760 if ( $returnto ===
'' ) {
2764 if ( is_object( $returnto ) ) {
2765 $titleObj = $returnto;
2771 if ( !is_object( $titleObj ) || $titleObj->isExternal() ) {
2779 if ( !$this->rlClientContext ) {
2780 $query = ResourceLoader::makeLoaderQuery(
2783 $this->
getSkin()->getSkinName(),
2784 $this->
getUser()->isLoggedIn() ? $this->
getUser()->getName() :
null,
2786 ResourceLoader::inDebugMode(),
2811 if ( !$this->rlClient ) {
2823 $this->
getSkin()->setupSkinUserCss( $this );
2826 $exemptGroups = [
'site' => [],
'noscript' => [],
'private' => [],
'user' => [] ];
2832 $userBatch = [
'user.styles',
'user' ];
2833 $siteBatch = array_diff( $moduleStyles, $userBatch );
2839 $moduleStyles = array_filter( $moduleStyles,
2841 $module = $rl->getModule(
$name );
2844 $exemptStates[
$name] =
'ready';
2848 $group = $module->getGroup();
2849 if ( isset( $exemptGroups[$group] ) ) {
2850 $exemptStates[
$name] =
'ready';
2851 if ( !$module->isKnownEmpty(
$context ) ) {
2853 $exemptGroups[$group][] =
$name;
2861 $this->rlExemptStyleModules = $exemptGroups;
2863 $isUserModuleFiltered = !$this->
filterModules( [
'user' ] );
2866 if ( !$isUserModuleFiltered ) {
2868 $userModule = $rl->getModule(
'user' );
2872 $this->rlUserModuleState = $exemptStates[
'user'] = $userState;
2917 $pieces[] =
Html::element(
'meta', [
'charset' =>
'UTF-8' ] );
2924 $pieces = array_merge( $pieces, array_values( $this->mHeadItems ) );
2926 $min = ResourceLoader::inDebugMode() ?
'' :
'.min';
2928 $pieces[] =
'<!--[if lt IE 9]>' .
2930 'src' => self::transformResourcePath(
2932 "/resources/lib/html5shiv/html5shiv{$min}.js"
2940 $bodyClasses[] =
'mediawiki';
2942 # Classes for LTR/RTL directionality support
2943 $bodyClasses[] = $userdir;
2944 $bodyClasses[] =
"sitedir-$sitedir";
2946 $underline = $this->
getUser()->getOption(
'underline' );
2947 if ( $underline < 2 ) {
2951 $bodyClasses[] =
'mw-underline-' . ( $underline ?
'always' :
'never' );
2954 if ( $this->
getLanguage()->capitalizeAllNouns() ) {
2955 # A <body> class is probably not the best way to do this . . .
2956 $bodyClasses[] =
'capitalize-all-nouns';
2962 $bodyClasses[] =
'mw-hide-empty-elt';
2965 $bodyClasses[] =
'skin-' . Sanitizer::escapeClass( $sk->
getSkinName() );
2972 $bodyAttrs[
'class'] = implode(
' ', $bodyClasses );
2976 Hooks::run(
'OutputPageBodyAttributes', [ $this, $sk, &$bodyAttrs ] );
2989 if ( is_null( $this->mResourceLoader ) ) {
2990 $this->mResourceLoader =
new ResourceLoader(
2992 LoggerFactory::getInstance(
'resourceloader' )
3026 $chunks = array_filter( $chunks,
'strlen' );
3027 return WrappedString::join(
"\n", $chunks );
3031 return $this->
getConfig()->get(
'AllowUserJs' )
3033 && $this->
getTitle()->isJsSubpage()
3038 return $this->
getConfig()->get(
'AllowUserCss' )
3040 && $this->
getTitle()->isCssSubpage()
3062 if ( $this->rlUserModuleState ===
'loading' ) {
3065 [
'excludepage' => $this->
getTitle()->getPrefixedDBkey() ]
3067 $chunks[] = ResourceLoader::makeInlineScript(
3091 if ( $this->limitReportJSData ) {
3092 $chunks[] = ResourceLoader::makeInlineScript(
3093 ResourceLoader::makeConfigSetScript(
3094 [
'wgPageParseReport' => $this->limitReportJSData ]
3119 if ( is_array(
$keys ) ) {
3121 $this->mJsConfigVars[$key] =
$value;
3143 $canonicalSpecialPageName =
false; # T23115
3146 $ns =
$title->getNamespace();
3154 $relevantTitle = $sk->getRelevantTitle();
3155 $relevantUser = $sk->getRelevantUser();
3158 list( $canonicalSpecialPageName, ) =
3162 $curRevisionId = $wikiPage->getLatest();
3163 $articleId = $wikiPage->getId();
3169 $separatorTransTable =
$lang->separatorTransformTable();
3170 $separatorTransTable = $separatorTransTable ? $separatorTransTable : [];
3171 $compactSeparatorTransTable = [
3172 implode(
"\t", array_keys( $separatorTransTable ) ),
3173 implode(
"\t", $separatorTransTable ),
3175 $digitTransTable =
$lang->digitTransformTable();
3176 $digitTransTable = $digitTransTable ? $digitTransTable : [];
3177 $compactDigitTransTable = [
3178 implode(
"\t", array_keys( $digitTransTable ) ),
3179 implode(
"\t", $digitTransTable ),
3185 'wgCanonicalNamespace' => $canonicalNamespace,
3186 'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3187 'wgNamespaceNumber' =>
$title->getNamespace(),
3188 'wgPageName' =>
$title->getPrefixedDBkey(),
3189 'wgTitle' =>
$title->getText(),
3190 'wgCurRevisionId' => $curRevisionId,
3192 'wgArticleId' => $articleId,
3194 'wgIsRedirect' => $title->isRedirect(),
3196 'wgUserName' =>
$user->isAnon() ? null :
$user->getName(),
3197 'wgUserGroups' =>
$user->getEffectiveGroups(),
3200 'wgPageContentLanguage' =>
$lang->getCode(),
3201 'wgPageContentModel' => $title->getContentModel(),
3202 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3203 'wgDigitTransformTable' => $compactDigitTransTable,
3204 'wgDefaultDateFormat' =>
$lang->getDefaultDateFormat(),
3205 'wgMonthNames' =>
$lang->getMonthNamesArray(),
3206 'wgMonthNamesShort' =>
$lang->getMonthAbbreviationsArray(),
3207 'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3208 'wgRelevantArticleId' => $relevantTitle->getArticleID(),
3212 if (
$user->isLoggedIn() ) {
3214 $vars[
'wgUserEditCount'] =
$user->getEditCount();
3215 $userReg =
$user->getRegistration();
3216 $vars[
'wgUserRegistration'] = $userReg ?
wfTimestamp( TS_UNIX, $userReg ) * 1000 :
null;
3220 $vars[
'wgUserNewMsgRevisionId'] =
$user->getNewMessageRevisionId();
3230 $vars[
'wgRelevantPageIsProbablyEditable'] = $relevantTitle
3231 && $relevantTitle->quickUserCan(
'edit',
$user )
3232 && ( $relevantTitle->exists() || $relevantTitle->quickUserCan(
'create',
$user ) );
3238 if (
$title->isMainPage() ) {
3239 $vars[
'wgIsMainPage'] =
true;
3242 if ( $this->mRedirectedFrom ) {
3243 $vars[
'wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3246 if ( $relevantUser ) {
3247 $vars[
'wgRelevantUserName'] = $relevantUser->getName();
3272 $request->getVal(
'action' ) !==
'submit' ||
3273 !
$request->getCheck(
'wpPreview' ) ||
3281 if ( !
$user->isLoggedIn() ) {
3285 if ( !
$user->matchEditToken(
$request->getVal(
'wpEditToken' ) ) ) {
3290 if ( !
$title->isJsSubpage() && !
$title->isCssSubpage() ) {
3293 if ( !
$title->isSubpageOf(
$user->getUserPage() ) ) {
3298 $errors =
$title->getUserPermissionsErrors(
'edit',
$user );
3299 if (
count( $errors ) !== 0 ) {
3318 'name' =>
'generator',
3319 'content' =>
"MediaWiki $wgVersion",
3322 if ( $config->get(
'ReferrerPolicy' ) !==
false ) {
3324 'name' =>
'referrer',
3325 'content' => $config->get(
'ReferrerPolicy' )
3329 $p =
"{$this->mIndexPolicy},{$this->mFollowPolicy}";
3330 if ( $p !==
'index,follow' ) {
3339 foreach ( $this->mMetatags
as $tag ) {
3340 if ( strncasecmp( $tag[0],
'http:', 5 ) === 0 ) {
3342 $tag[0] = substr( $tag[0], 5 );
3343 } elseif ( strncasecmp( $tag[0],
'og:', 3 ) === 0 ) {
3348 $tagName =
"meta-{$tag[0]}";
3349 if ( isset( $tags[$tagName] ) ) {
3350 $tagName .= $tag[1];
3355 'content' => $tag[1]
3360 foreach ( $this->mLinktags
as $tag ) {
3364 # Universal edit button
3365 if ( $config->get(
'UniversalEditButton' ) && $this->
isArticleRelated() ) {
3368 && ( $this->
getTitle()->exists() ||
3372 $msg = $this->
msg(
'edit' )->text();
3374 'rel' =>
'alternate',
3375 'type' =>
'application/x-wiki',
3377 'href' => $this->
getTitle()->getEditURL(),
3383 'href' => $this->
getTitle()->getEditURL(),
3388 # Generally the order of the favicon and apple-touch-icon links
3389 # should not matter, but Konqueror (3.5.9 at least) incorrectly
3390 # uses whichever one appears later in the HTML source. Make sure
3391 # apple-touch-icon is specified first to avoid this.
3392 if ( $config->get(
'AppleTouchIcon' ) !==
false ) {
3394 'rel' =>
'apple-touch-icon',
3395 'href' => $config->get(
'AppleTouchIcon' )
3399 if ( $config->get(
'Favicon' ) !==
false ) {
3401 'rel' =>
'shortcut icon',
3402 'href' => $config->get(
'Favicon' )
3406 # OpenSearch description link
3409 'type' =>
'application/opensearchdescription+xml',
3410 'href' =>
wfScript(
'opensearch_desc' ),
3411 'title' => $this->
msg(
'opensearch-desc' )->inContentLanguage()->
text(),
3414 if ( $config->get(
'EnableAPI' ) ) {
3415 # Real Simple Discovery link, provides auto-discovery information
3416 # for the MediaWiki API (and potentially additional custom API
3417 # support such as WordPress or Twitter-compatible APIs for a
3418 # blogging extension, etc)
3421 'type' =>
'application/rsd+xml',
3427 [
'action' =>
'rsd' ] ),
3434 if ( !$config->get(
'DisableLangConversion' ) ) {
3436 if (
$lang->hasVariants() ) {
3437 $variants =
$lang->getVariants();
3438 foreach ( $variants
as $variant ) {
3440 'rel' =>
'alternate',
3441 'hreflang' =>
wfBCP47( $variant ),
3442 'href' => $this->
getTitle()->getLocalURL(
3443 [
'variant' => $variant ] )
3447 # x-default link per https://support.google.com/webmasters/answer/189077?hl=en
3449 'rel' =>
'alternate',
3450 'hreflang' =>
'x-default',
3451 'href' => $this->
getTitle()->getLocalURL() ] );
3456 if ( $this->copyrightUrl !==
null ) {
3460 if ( $config->get(
'RightsPage' ) ) {
3464 $copyright = $copy->getLocalURL();
3468 if ( !$copyright && $config->get(
'RightsUrl' ) ) {
3469 $copyright = $config->get(
'RightsUrl' );
3476 'href' => $copyright ]
3481 if ( $config->get(
'Feed' ) ) {
3485 # Use the page name for the title. In principle, this could
3486 # lead to issues with having the same name for different feeds
3487 # corresponding to the same page, but we can't avoid that at
3493 # Used
messages:
'page-rss-feed' and 'page-atom-feed' (
for an easier grep)
3495 "page-{$format}-feed", $this->
getTitle()->getPrefixedText()
3500 # Recent changes feed should appear on every page (except recentchanges,
3501 # that would be redundant). Put it after the per-page feed to avoid
3502 # changing existing behavior. It's still available, probably via a
3503 # menu in your browser. Some sites might have a different feed they'd
3504 # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3505 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3506 # If so, use it instead.
3507 $sitename = $config->get(
'Sitename' );
3508 if ( $config->get(
'OverrideSiteFeed' ) ) {
3509 foreach ( $config->get(
'OverrideSiteFeed' )
as $type => $feedUrl ) {
3514 $this->
msg(
"site-{$type}-feed", $sitename )->
text()
3517 } elseif ( !$this->
getTitle()->isSpecial(
'Recentchanges' ) ) {
3519 foreach ( $config->get(
'AdvertisedFeedTypes' )
as $format ) {
3522 $rctitle->getLocalURL( [
'feed' => $format ] ),
3523 # For grep: 'site-rss-feed', 'site-atom-feed'
3524 $this->
msg(
"site-{$format}-feed", $sitename )->text()
3529 # Allow extensions to change the list pf feeds. This hook is primarily for changing,
3530 # manipulating or removing existing feed tags. If you want to add new feeds, you should
3531 # use OutputPage::addFeedLink() instead.
3532 Hooks::run(
'AfterBuildFeedLinks', [ &$feedLinks ] );
3534 $tags += $feedLinks;
3538 if ( $config->get(
'EnableCanonicalServerLink' ) ) {
3539 if ( $canonicalUrl !==
false ) {
3551 if ( in_array( $action, [
'history',
'info' ] ) ) {
3552 $query =
"action={$action}";
3558 $reqUrl = $this->
getRequest()->getRequestURL();
3563 if ( $canonicalUrl !==
false ) {
3565 'rel' =>
'canonical',
3566 'href' => $canonicalUrl
3583 'rel' =>
'alternate',
3584 'type' =>
"application/$type+xml",
3599 public function addStyle( $style, $media =
'', $condition =
'',
$dir =
'' ) {
3605 $options[
'condition'] = $condition;
3621 if ( $flip ===
'flip' && $this->
getLanguage()->isRTL() ) {
3622 # If wanted, and the interface is right-to-left, flip the CSS
3623 $style_css = CSSJanus::transform( $style_css,
true,
false );
3645 [
'excludepage' => $this->
getTitle()->getPrefixedDBkey() ]
3650 $previewedCSS = $this->
getRequest()->getText(
'wpTextbox1' );
3652 $previewedCSS = CSSJanus::transform( $previewedCSS,
true,
false );
3670 [
'name' =>
'ResourceLoaderDynamicStyles',
'content' =>
'' ]
3673 $separateReq = [
'site.styles',
'user.styles' ];
3674 foreach ( $this->rlExemptStyleModules
as $group => $moduleNames ) {
3677 array_diff( $moduleNames, $separateReq ),
3681 foreach ( array_intersect( $moduleNames, $separateReq )
as $name ) {
3700 foreach ( $this->mExtStyles
as $url ) {
3703 $this->mExtStyles = [];
3705 foreach ( $this->styles
as $file =>
$options ) {
3708 $links[$file] =
$link;
3728 if ( isset(
$options[
'media'] ) ) {
3730 if ( is_null( $media ) ) {
3737 if ( substr( $style, 0, 1 ) ==
'/' ||
3738 substr( $style, 0, 5 ) ==
'http:' ||
3739 substr( $style, 0, 6 ) ==
'https:' ) {
3743 $url = $config->get(
'StylePath' ) .
'/' . $style .
'?' .
3744 $config->get(
'StyleVersion' );
3749 if ( isset(
$options[
'condition'] ) ) {
3750 $condition = htmlspecialchars(
$options[
'condition'] );
3751 $link =
"<!--[if $condition]>$link<![endif]-->";
3781 $remotePathPrefix = $config->get(
'ResourceBasePath' );
3782 if ( $remotePathPrefix ===
'' ) {
3787 $remotePath = $remotePathPrefix;
3789 if ( strpos(
$path, $remotePath ) !== 0 || substr(
$path, 0, 2 ) ===
'//' ) {
3798 $uploadPath = $config->get(
'UploadPath' );
3799 if ( strpos(
$path, $uploadPath ) === 0 ) {
3800 $localDir = $config->get(
'UploadDirectory' );
3801 $remotePathPrefix = $remotePath = $uploadPath;
3804 $path = RelPath\getRelativePath(
$path, $remotePath );
3820 $hash = md5_file(
"$localPath/$file" );
3821 if ( $hash ===
false ) {
3822 wfLogWarning( __METHOD__ .
": Failed to hash $localPath/$file" );
3825 return "$remotePathPrefix/$file?" . substr( $hash, 0, 5 );
3839 $screenMediaQueryRegex =
'/^(?:only\s+)?screen\b/i';
3843 'printable' =>
'print',
3844 'handheld' =>
'handheld',
3846 foreach ( $switches
as $switch => $targetMedia ) {
3848 if ( $media == $targetMedia ) {
3850 } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3864 if ( $targetMedia ==
'print' || $media ==
'screen' ) {
3881 $args = func_get_args();
3924 $msgSpecs = func_get_args();
3925 array_shift( $msgSpecs );
3926 $msgSpecs = array_values( $msgSpecs );
3928 foreach ( $msgSpecs
as $n => $spec ) {
3929 if ( is_array( $spec ) ) {
3932 if ( isset(
$args[
'options'] ) ) {
3933 unset(
$args[
'options'] );
3935 'Adding "options" to ' . __METHOD__ .
' is no longer supported',
3963 $this->mEnableSectionEditLinks = $flag;
3983 $theme = isset( $themes[$skinName] ) ? $themes[$skinName] : $themes[
'default'];
3985 $themeClass =
"OOUI\\{$theme}Theme";
3986 OOUI\Theme::setSingleton(
new $themeClass() );
3987 OOUI\Element::setDefaultDir(
$dir );
3998 strtolower( $this->
getSkin()->getSkinName() ),
4002 'oojs-ui-core.styles',
4003 'oojs-ui.styles.indicators',
4004 'oojs-ui.styles.textures',
4005 'mediawiki.widgets.styles',
4006 'oojs-ui.styles.icons-content',
4007 'oojs-ui.styles.icons-alerts',
4008 'oojs-ui.styles.icons-interactions',
4024 if ( !is_array( $logo ) ) {
4026 $this->
addLinkHeader(
'<' . $logo .
'>;rel=preload;as=image' );
4030 foreach ( $logo
as $dppx => $src ) {
4032 $dppx = substr( $dppx, 0, -1 );
4033 $logosPerDppx[$dppx] = $src;
4037 uksort( $logosPerDppx,
function ( $a , $b ) {
4038 $a = floatval( $a );
4039 $b = floatval( $b );
4045 return ( $a < $b ) ? -1 : 1;
4048 foreach ( $logosPerDppx
as $dppx => $src ) {
4049 $logos[] = [
'dppx' => $dppx,
'src' => $src ];
4052 $logosCount =
count( $logos );
4058 for ( $i = 0; $i < $logosCount; $i++ ) {
4063 $media_query =
'not all and (min-resolution: ' . $logos[ 1 ][
'dppx'] .
'dppx)';
4064 } elseif ( $i !== $logosCount - 1 ) {
4069 $upper_bound = floatval( $logos[ $i + 1 ][
'dppx'] ) - 0.000001;
4070 $media_query =
'(min-resolution: ' . $logos[ $i ][
'dppx'] .
4071 'dppx) and (max-resolution: ' . $upper_bound .
'dppx)';
4074 $media_query =
'(min-resolution: ' . $logos[ $i ][
'dppx'] .
'dppx)';
4078 '<' . $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...
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
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.
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.
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
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
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.
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,...
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.
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
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.
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.
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 contains a 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.
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,...
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
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.
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.
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.
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
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=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.
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 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
$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?
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().
this hook is for auditing only $response
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,...
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
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.
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...
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.
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)