262 'Accept-Encoding' => [
'match=gzip' ],
306 # Extensions should use `new RequestContext` instead of `new OutputPage` now.
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;
467 array_push( $this->mExtStyles, $url );
491 if ( substr( $file, 0, 1 ) ==
'/' || preg_match(
'#^[a-z]*://#i' , $file ) ) {
494 $path = $this->
getConfig ()->get(
'StylePath' ) .
"/common/{$file}" ;
496 if ( is_null( $version ) ) {
497 $version = $this->
getConfig ()->get(
'StyleVersion' );
524 $filteredModules = [];
525 foreach ( $modules
as $val ) {
529 && ( is_null( $position ) || $module->getPosition() == $position )
530 && ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) )
532 $filteredModules[] = $val;
535 return $filteredModules;
546 public function getModules ( $filter =
false , $position = null, $param =
'mModules' ,
549 $modules = array_values( array_unique( $this->$param ) );
563 $this->mModules = array_merge( $this->mModules, (
array )
$modules );
574 return $this->
getModules ( $filter, $position,
'mModuleScripts' ,
587 $this->mModuleScripts = array_merge( $this->mModuleScripts, (
array )
$modules );
598 return $this->
getModules ( $filter, $position,
'mModuleStyles' ,
613 $this->mModuleStyles = array_merge( $this->mModuleStyles, (
array )
$modules );
629 $this->mTarget = $target;
664 $this->mHeadItems = array_merge( $this->mHeadItems, (
array )$values );
674 return isset( $this->mHeadItems[
$name ] );
692 $this->mArticleBodyOnly = $only;
723 if ( isset( $this->mProperties[
$name ] ) ) {
724 return $this->mProperties[
$name ];
743 wfDebug ( __METHOD__ .
": CACHE DISABLED, NO TIMESTAMP\n" );
747 if ( !$config->get(
'CachePages' ) ) {
748 wfDebug ( __METHOD__ .
": CACHE DISABLED\n" );
755 'user' => $this->
getUser ()->getTouched(),
756 'epoch' => $config->get(
'CacheEpoch' )
758 if ( $config->get(
'UseSquid' ) ) {
760 $modifiedTimes[
'sepoch' ] =
wfTimestamp (
TS_MW , time() - $config->get(
'SquidMaxage' ) );
762 Hooks::run (
'OutputPageCheckLastModified' , [ &$modifiedTimes, $this ] );
764 $maxModified = max( $modifiedTimes );
767 $clientHeader = $this->
getRequest ()->getHeader(
'If-Modified-Since' );
768 if ( $clientHeader ===
false ) {
769 wfDebug ( __METHOD__ .
": client did not send If-Modified-Since header" ,
'private' );
773 # IE sends sizes after the date like this:
774 # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
775 # this breaks strtotime().
776 $clientHeader = preg_replace(
'/;.*$/' ,
'' , $clientHeader );
778 MediaWiki\suppressWarnings();
779 $clientHeaderTime = strtotime( $clientHeader );
780 MediaWiki\restoreWarnings();
781 if ( !$clientHeaderTime ) {
783 .
": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
791 if ( $info !==
'' ) {
797 wfDebug ( __METHOD__ .
": client sent If-Modified-Since: " .
799 wfDebug ( __METHOD__ .
": effective Last-Modified: " .
801 if ( $clientHeaderTime < $maxModified ) {
802 wfDebug ( __METHOD__ .
": STALE, $info" ,
'private' );
807 # Give a 304 Not Modified response code and disable body output
808 wfDebug ( __METHOD__ .
": NOT MODIFIED, $info" ,
'private' );
809 ini_set(
'zlib.output_compression' , 0 );
810 $this->
getRequest ()->response()->statusHeader( 304 );
843 if ( isset( $policy[
'index' ] ) ) {
846 if ( isset( $policy[
'follow' ] ) ) {
859 $policy = trim( $policy );
860 if ( in_array( $policy, [
'index' ,
'noindex' ] ) ) {
861 $this->mIndexPolicy = $policy;
873 $policy = trim( $policy );
874 if ( in_array( $policy, [
'follow' ,
'nofollow' ] ) ) {
875 $this->mFollowPolicy = $policy;
886 $this->mPageTitleActionText = $text;
908 $this->mHTMLtitle =
$name ;
927 $this->mRedirectedFrom =
$t ;
945 # change "<script>foo&bar</script>" to "<script>foo&bar</script>"
946 # but leave "<i>foobar</i>" alone
948 $this->mPagetitle = $nameWithTags;
950 # change "<i>foo&bar</i>" to "foo&bar"
953 ->inContentLanguage()
991 if ( $str instanceof
Message ) {
992 $this->mSubtitle[] = $str->setContext( $this->
getContext () )->parse();
994 $this->mSubtitle[] = $str;
1008 $query [
'redirect' ] =
'no' ;
1028 $this->mSubtitle = [];
1037 return implode(
"<br />\n\t\t\t\t" , $this->mSubtitle );
1045 $this->mPrintable =
true ;
1061 $this->mDoNothing =
true ;
1103 $this->mFeedLinks = [];
1117 $this->mFeedLinks = [];
1121 if ( is_string( $val ) ) {
1135 if ( in_array( $format, $this->
getConfig ()->
get (
'AdvertisedFeedTypes' ) ) ) {
1136 $this->mFeedLinks[$format] = $href;
1145 return count( $this->mFeedLinks ) > 0;
1173 $this->mIsarticle = $v;
1175 $this->mIsArticleRelated = $v;
1196 $this->mIsArticleRelated = $v;
1198 $this->mIsarticle =
false ;
1218 $this->mLanguageLinks += $newLinkArray;
1228 $this->mLanguageLinks = $newLinkArray;
1248 if ( !is_array( $categories ) || count( $categories ) == 0 ) {
1252 # Add the links to a LinkBatch
1257 # Fetch existence plus the hiddencat property
1259 $fields = array_merge(
1261 [
'page_namespace' ,
'page_title' ,
'pp_value' ]
1264 $res =
$dbr ->select( [
'page' ,
'page_props' ],
1266 $lb->constructSet(
'page' ,
$dbr ),
1269 [
'page_props' => [
'LEFT JOIN' , [
1270 'pp_propname' =>
'hiddencat' ,
1275 # Add the results to the link cache
1278 # Set all the values to 'normal'.
1279 $categories = array_fill_keys( array_keys( $categories ),
'normal' );
1281 # Mark hidden categories
1282 foreach (
$res as $row ) {
1283 if ( isset( $row->pp_value ) ) {
1284 $categories[$row->page_title] =
'hidden' ;
1288 # Add the remaining categories to the skin
1290 'OutputPageMakeCategoryLinks' ,
1291 [ &$this, $categories, &$this->mCategoryLinks ] )
1293 foreach ( $categories
as $category =>
$type ) {
1295 $category = (
string )$category;
1296 $origcategory = $category;
1301 $wgContLang->findVariantLink( $category,
$title ,
true );
1302 if ( $category != $origcategory && array_key_exists( $category, $categories ) ) {
1305 $text = $wgContLang->convertHtml(
$title ->getText() );
1306 $this->mCategories[] =
$title ->getText();
1318 $this->mCategoryLinks = [];
1355 ksort( $this->mIndicators );
1380 $text = $this->
msg (
'helppage-top-gethelp' )->escaped();
1382 if ( $overrideBaseUrl ) {
1385 $toUrlencoded =
wfUrlencode ( str_replace(
' ' ,
'_' , $to ) );
1386 $helpUrl =
"//www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded" ;
1393 'target' =>
'_blank' ,
1394 'class' =>
'mw-helplink' ,
1418 if ( $this->
getConfig ()->
get (
'AllowSiteCSSOnRestrictedPages' ) ) {
1437 return min( array_values( $this->mAllowedModules ) );
1439 return isset( $this->mAllowedModules[
$type ] )
1440 ? $this->mAllowedModules[
$type ]
1473 $this->mBodytext .= $text;
1493 $this->mBodytext =
'' ;
1517 $anonPO->setEditSection(
false );
1518 if ( !
$options ->matches( $anonPO ) ) {
1524 if ( !$this->mParserOptions ) {
1530 $po->setEditSection(
false );
1531 $po->isBogus =
true ;
1539 $this->mParserOptions->setEditSection(
false );
1545 return wfSetVar ( $this->mParserOptions, null,
true );
1559 $val = is_null( $revid ) ? null : intval( $revid );
1560 return wfSetVar ( $this->mRevisionId, $val );
1601 if ( $file instanceof
File && $file->
exists () ) {
1602 $val = [
'time' => $file->getTimestamp(),
'sha1' => $file->getSha1() ];
1604 return wfSetVar ( $this->mFileVersion, $val,
true );
1645 public function addWikiText ( $text, $linestart =
true , $interface =
true ) {
1697 $tidy =
false , $interface =
false
1702 $oldTidy = $popts->setTidy( $tidy );
1703 $popts->setInterfaceMessage( (
bool )$interface );
1706 $text, $title, $popts,
1707 $linestart,
true , $this->mRevisionId
1710 $popts->setTidy( $oldTidy );
1740 $this->mHideNewSectionLink =
$parserOutput ->getHideNewSection();
1746 $this->mHeadItems = array_merge( $this->mHeadItems,
$parserOutput ->getHeadItems() );
1751 $this->mPreventClickjacking = $this->mPreventClickjacking
1756 if ( isset( $this->mTemplateIds[$ns] ) ) {
1757 $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1759 $this->mTemplateIds[$ns] = $dbks;
1764 $this->mImageTimeKeys[$dbk] = $data;
1768 $parserOutputHooks = $this->
getConfig ()->get(
'ParserOutputHooks' );
1770 list ( $hookName, $data ) = $hookInfo;
1771 if ( isset( $parserOutputHooks[$hookName] ) ) {
1772 call_user_func( $parserOutputHooks[$hookName], $this,
$parserOutput , $data );
1784 Hooks::run (
'LanguageLinks' , [ $this->
getTitle (), &$this->mLanguageLinks, &$linkFlags ] );
1813 Hooks::run (
'OutputPageBeforeHTML' , [ &$this, &$text ] );
1828 $parserOutput ->setEditSectionTokens( $this->mEnableSectionEditLinks );
1855 public function parse ( $text, $linestart =
true , $interface =
false , $language = null ) {
1858 if ( is_null( $this->
getTitle () ) ) {
1859 throw new MWException (
'Empty $mTitle in ' . __METHOD__ );
1864 $popts->setInterfaceMessage(
true );
1866 if ( $language !== null ) {
1867 $oldLang = $popts->setTargetLanguage( $language );
1872 $linestart,
true , $this->mRevisionId
1876 $popts->setInterfaceMessage(
false );
1878 if ( $language !== null ) {
1879 $popts->setTargetLanguage( $oldLang );
1895 public function parseInline ( $text, $linestart =
true , $interface =
false ) {
1896 $parsed = $this->
parse ( $text, $linestart, $interface );
1914 $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
1924 $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
1943 $maxTTL = $maxTTL ?: $this->
getConfig ()->get(
'SquidMaxage' );
1945 if ( $mtime === null || $mtime ===
false ) {
1950 $adaptiveTTL = max( .9 * $age, $minTTL );
1951 $adaptiveTTL = min( $adaptiveTTL, $maxTTL );
1955 return $adaptiveTTL;
1966 return wfSetVar ( $this->mEnableClientCache, $state );
1976 if ( $cookies === null ) {
1978 $cookies = array_merge(
1979 SessionManager::singleton()->getVaryCookies(),
1983 $config->get(
'CacheVaryCookies' )
1985 Hooks::run (
'GetCacheVaryCookies' , [ $this, &$cookies ] );
1999 if (
$request ->getCookie( $cookieName,
'' ,
'' ) !==
'' ) {
2000 wfDebug ( __METHOD__ .
": found $cookieName\n" );
2004 wfDebug ( __METHOD__ .
": no cache-varying cookies found\n" );
2017 if ( !array_key_exists(
$header , $this->mVaryHeader ) ) {
2018 $this->mVaryHeader[
$header ] = [];
2020 if ( !is_array( $option ) ) {
2023 $this->mVaryHeader[
$header ] = array_unique( array_merge( $this->mVaryHeader[
$header ], $option ) );
2038 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2041 return 'Vary: ' . implode(
', ' , array_keys( $this->mVaryHeader ) );
2052 $cookiesOption = [];
2053 foreach ( $cvCookies
as $cookieName ) {
2054 $cookiesOption[] =
'param=' . $cookieName;
2058 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2063 foreach ( $this->mVaryHeader
as $header => $option ) {
2065 if ( is_array( $option ) && count( $option ) > 0 ) {
2066 $newheader .=
';' . implode(
';' , $option );
2068 $headers[] = $newheader;
2070 $key =
'Key: ' . implode(
',' , $headers );
2090 if ( !$this->
getRequest ()->getCheck(
'variant' ) &&
$lang ->hasVariants() ) {
2091 $variants =
$lang ->getVariants();
2093 foreach ( $variants
as $variant ) {
2094 if ( $variant ===
$lang ->getCode() ) {
2097 $aloption[] =
'substr=' . $variant;
2102 $variantBCP47 =
wfBCP47 ( $variant );
2103 if ( $variantBCP47 !== $variant ) {
2104 $aloption[] =
'substr=' . $variantBCP47;
2123 $this->mPreventClickjacking = $enable;
2132 $this->mPreventClickjacking =
false ;
2154 if ( $config->get(
'BreakFrames' ) ) {
2156 } elseif ( $this->mPreventClickjacking && $config->get(
'EditPageFrameOptions' ) ) {
2157 return $config->get(
'EditPageFrameOptions' );
2172 # don't serve compressed data to clients who can't handle it
2173 # maintain different caches for logged-in users and non-logged in ones
2176 if ( $config->get(
'UseKeyHeader' ) ) {
2180 if ( $this->mEnableClientCache ) {
2182 $config->get(
'UseSquid' ) &&
2184 !SessionManager::getGlobalSession()->isPersistent() &&
2186 $this->mCdnMaxage != 0 &&
2189 if ( $config->get(
'UseESI' ) ) {
2190 # We'll purge the proxy cache explicitly, but require end user agents
2191 # to revalidate against the proxy on each visit.
2192 # Surrogate-Control controls our CDN, Cache-Control downstream caches
2193 wfDebug ( __METHOD__ .
": proxy caching with ESI; {$this->mLastModified} **" ,
'private' );
2194 # start with a shorter timeout for initial testing
2195 # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
2196 $response ->header(
'Surrogate-Control: max-age=' . $config->get(
'SquidMaxage' )
2197 .
'+' . $this->mCdnMaxage .
', content="ESI/1.0"' );
2198 $response ->header(
'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
2200 # We'll purge the proxy cache for anons explicitly, but require end user agents
2201 # to revalidate against the proxy on each visit.
2202 # IMPORTANT! The CDN needs to replace the Cache-Control header with
2203 # Cache-Control: s-maxage=0, must-revalidate, max-age=0
2204 wfDebug ( __METHOD__ .
": local proxy caching; {$this->mLastModified} **" ,
'private' );
2205 # start with a shorter timeout for initial testing
2206 # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2207 $response ->header(
'Cache-Control: s-maxage=' . $this->mCdnMaxage
2208 .
', must-revalidate, max-age=0' );
2211 # We do want clients to cache if they can, but they *must* check for updates
2212 # on revisiting the page.
2213 wfDebug ( __METHOD__ .
": private caching; {$this->mLastModified} **" ,
'private' );
2214 $response ->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s' , 0 ) .
' GMT' );
2215 $response ->header(
"Cache-Control: private, must-revalidate, max-age=0" );
2217 if ( $this->mLastModified ) {
2218 $response ->header(
"Last-Modified: {$this->mLastModified}" );
2221 wfDebug ( __METHOD__ .
": no caching **" ,
'private' );
2223 # In general, the absence of a last modified header should be enough to prevent
2224 # the client from using its cache. We send a few other things just to make sure.
2225 $response ->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s' , 0 ) .
' GMT' );
2226 $response ->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2227 $response ->header(
'Pragma: no-cache' );
2244 if ( $this->mDoNothing ) {
2245 return $return ?
'' : null;
2251 if ( $this->mRedirect !=
'' ) {
2252 # Standards require redirect URLs to be absolute
2258 if (
Hooks::run (
"BeforePageRedirect" , [ $this, &$redirect, &
$code ] ) ) {
2260 if ( !$config->get(
'DebugRedirects' ) ) {
2265 if ( $config->get(
'VaryOnXFP' ) ) {
2270 $response ->header(
"Content-Type: text/html; charset=utf-8" );
2271 if ( $config->get(
'DebugRedirects' ) ) {
2272 $url = htmlspecialchars( $redirect );
2273 print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n" ;
2274 print "<p>Location: <a href=\"$url\">$url</a></p>\n" ;
2275 print "</body>\n</html>\n" ;
2277 $response ->header(
'Location: ' . $redirect );
2281 return $return ?
'' : null;
2282 } elseif ( $this->mStatusCode ) {
2283 $response ->statusHeader( $this->mStatusCode );
2286 # Buffer output; final headers may depend on later processing
2289 $response ->header(
'Content-type: ' . $config->get(
'MimeType' ) .
'; charset=UTF-8' );
2290 $response ->header(
'Content-language: ' . $wgContLang->getHtmlCode() );
2294 $response ->header(
'X-UA-Compatible: IE=Edge' );
2298 if ( $frameOptions ) {
2299 $response ->header(
"X-Frame-Options: $frameOptions" );
2302 if ( $this->mArticleBodyOnly ) {
2307 $modules = $sk->getDefaultModules();
2313 'mediawiki.page.startup' ,
2318 if ( $config->get(
'ResponsiveImages' ) ) {
2319 $coreModules[] =
'mediawiki.hidpi' ;
2330 Hooks::run (
'BeforePageDisplay' , [ &$this, &$sk ] );
2342 Hooks::run (
'AfterFinalPageOutput' , [ $this ] );
2351 return ob_get_clean();
2370 if ( $htmlTitle !==
false ) {
2376 $this->mRedirect =
'' ;
2400 if ( $msg instanceof Message ) {
2402 trigger_error(
'Argument ignored: $params. The message parameters argument '
2403 .
'is discarded when the $msg argument is a Message object instead of '
2404 .
'a string.' , E_USER_NOTICE );
2406 $this->
addHTML ( $msg->parseAsBlock() );
2421 foreach ( $errors
as $key => $error ) {
2422 $errors[$key] = (
array )$error;
2430 if ( in_array( $action, [
'read' ,
'edit' ,
'createpage' ,
'createtalk' ,
'upload' ] )
2431 && $this->
getUser ()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2432 && ( $errors[0][0] ==
'badaccess-groups' || $errors[0][0] ==
'badaccess-group0' )
2436 $displayReturnto = null;
2438 # Due to bug 32276, if a user does not have read permissions,
2439 # $this->getTitle() will just give Special:Badtitle, which is
2440 # not especially useful as a returnto parameter. Use the title
2441 # from the request instead, if there was one.
2444 if ( $action ==
'edit' ) {
2445 $msg =
'whitelistedittext' ;
2446 $displayReturnto = $returnto;
2447 } elseif ( $action ==
'createpage' || $action ==
'createtalk' ) {
2448 $msg =
'nocreatetext' ;
2449 } elseif ( $action ==
'upload' ) {
2450 $msg =
'uploadnologintext' ;
2452 $msg =
'loginreqpagetext' ;
2459 $query [
'returnto' ] = $returnto->getPrefixedText();
2462 $returntoquery =
$request ->getValues();
2463 unset( $returntoquery[
'title' ] );
2464 unset( $returntoquery[
'returnto' ] );
2465 unset( $returntoquery[
'returntoquery' ] );
2471 $this->
msg (
'loginreqlink' )->escaped(),
2477 $this->
addHTML ( $this->
msg ( $msg )->rawParams( $loginLink )->
parse () );
2479 # Don't return to a page the user can't read otherwise
2480 # we'll end up in a pointless loop
2481 if ( $displayReturnto && $displayReturnto->userCan(
'read' , $this->getUser() ) ) {
2499 $this->
addWikiMsg (
'versionrequiredtext' , $version );
2511 if ( $action == null ) {
2512 $text = $this->
msg (
'permissionserrorstext' , count( $errors ) )->plain() .
"\n\n" ;
2514 $action_desc = $this->
msg (
"action-$action" )->plain();
2516 'permissionserrorstext-withaction' ,
2519 )->plain() .
"\n\n" ;
2522 if ( count( $errors ) > 1 ) {
2523 $text .=
'<ul class="permissions-errors">' .
"\n" ;
2525 foreach ( $errors
as $error ) {
2527 $text .= call_user_func_array( [ $this,
'msg' ], $error )->plain();
2532 $text .=
"<div class=\"permissions-errors\">\n" .
2533 call_user_func_array( [ $this,
'msg' ], reset( $errors ) )->plain() .
2552 if ( func_num_args() > 0 ) {
2553 throw new MWException ( __METHOD__ .
' no longer accepts arguments since 1.25.' );
2581 if ( $lag >= $config->get(
'SlaveLagWarning' ) ) {
2582 $lag = floor( $lag );
2583 $message = $lag < $config->get(
'SlaveLagCritical' )
2586 $wrap =
Html::rawElement (
'div' , [
'class' =>
"mw-{$message}" ],
"\n$1\n" );
2626 $link = $this->
msg (
'returnto' )->rawParams(
2628 $this->
addHTML (
"<p id=\"mw-returnto\">{$link}</p>\n" );
2639 public function returnToMain ( $unused = null, $returnto = null, $returntoquery = null ) {
2640 if ( $returnto == null ) {
2641 $returnto = $this->
getRequest ()->getText(
'returnto' );
2644 if ( $returntoquery == null ) {
2645 $returntoquery = $this->
getRequest ()->getText(
'returntoquery' );
2648 if ( $returnto ===
'' ) {
2652 if ( is_object( $returnto ) ) {
2653 $titleObj = $returnto;
2657 if ( !is_object( $titleObj ) ) {
2665 if ( !$this->rlClientContext ) {
2669 $this->
getSkin ()->getSkinName(),
2670 $this->
getUser ()->isLoggedIn() ? $this->
getUser ()->getName() : null,
2697 if ( !$this->rlClient ) {
2710 $this->
getSkin ()->setupSkinUserCss( $this );
2713 $exemptGroups = [
'site' => [],
'noscript' => [],
'private' => [],
'user' => [] ];
2719 $userBatch = [
'user.styles' ,
'user' ];
2720 $siteBatch = array_diff( $moduleStyles, $userBatch );
2726 $moduleStyles = array_filter( $moduleStyles,
2728 $module = $rl->getModule(
$name );
2731 $exemptStates[
$name ] =
'ready' ;
2735 $group = $module->getGroup();
2736 if ( isset( $exemptGroups[$group] ) ) {
2737 $exemptStates[
$name ] =
'ready' ;
2738 if ( !$module->isKnownEmpty(
$context ) ) {
2740 $exemptGroups[$group][] =
$name ;
2748 $this->rlExemptStyleModules = $exemptGroups;
2750 $isUserModuleFiltered = !$this->
filterModules ( [
'user' ] );
2753 if ( !$isUserModuleFiltered ) {
2755 $userModule = $rl->getModule(
'user' );
2759 $this->rlUserModuleState = $exemptStates[
'user' ] = $userState;
2782 $sitedir = $wgContLang->getDir();
2804 $pieces[] =
Html::element (
'meta' , [
'charset' =>
'UTF-8' ] );
2811 $pieces = array_merge( $pieces, array_values( $this->mHeadItems ) );
2815 $bodyClasses[] =
'mediawiki' ;
2817 # Classes for LTR/RTL directionality support
2818 $bodyClasses[] = $userdir;
2819 $bodyClasses[] =
"sitedir-$sitedir" ;
2821 if ( $this->
getLanguage ()->capitalizeAllNouns() ) {
2822 # A <body> class is probably not the best way to do this . . .
2823 $bodyClasses[] =
'capitalize-all-nouns' ;
2829 $bodyClasses[] =
'mw-hide-empty-elt' ;
2839 $bodyAttrs[
'class' ] = implode(
' ' , $bodyClasses );
2843 Hooks::run (
'OutputPageBodyAttributes' , [ $this, $sk, &$bodyAttrs ] );
2847 return self::combineWrappedStrings( $pieces );
2856 if ( is_null( $this->mResourceLoader ) ) {
2859 LoggerFactory::getInstance(
'resourceloader' )
2893 $chunks = array_filter( $chunks,
'strlen' );
2894 return WrappedString::join(
"\n" , $chunks );
2898 return $this->
getConfig ()->get(
'AllowUserJs' )
2900 && $this->
getTitle ()->isJsSubpage()
2905 return $this->
getConfig ()->get(
'AllowUserCss' )
2907 && $this->
getTitle ()->isCssSubpage()
2929 if ( $this->rlUserModuleState ===
'loading' ) {
2932 [
'excludepage' => $this->
getTitle ()->getPrefixedDBkey() ]
2958 return self::combineWrappedStrings( $chunks );
2978 if ( is_array(
$keys ) ) {
2980 $this->mJsConfigVars[$key] =
$value ;
3002 $canonicalSpecialPageName =
false ; # bug 21115
3005 $ns = $title->getNamespace();
3008 : $title->getNsText();
3013 $relevantTitle = $sk->getRelevantTitle();
3014 $relevantUser = $sk->getRelevantUser();
3017 list ( $canonicalSpecialPageName, ) =
3021 $curRevisionId = $wikiPage->getLatest();
3022 $articleId = $wikiPage->getId();
3025 $lang = $title->getPageViewLanguage();
3028 $separatorTransTable =
$lang ->separatorTransformTable();
3029 $separatorTransTable = $separatorTransTable ? $separatorTransTable : [];
3030 $compactSeparatorTransTable = [
3031 implode(
"\t" , array_keys( $separatorTransTable ) ),
3032 implode(
"\t" , $separatorTransTable ),
3034 $digitTransTable =
$lang ->digitTransformTable();
3035 $digitTransTable = $digitTransTable ? $digitTransTable : [];
3036 $compactDigitTransTable = [
3037 implode(
"\t" , array_keys( $digitTransTable ) ),
3038 implode(
"\t" , $digitTransTable ),
3044 'wgCanonicalNamespace' => $canonicalNamespace,
3045 'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3046 'wgNamespaceNumber' => $title->getNamespace(),
3047 'wgPageName' => $title->getPrefixedDBkey(),
3048 'wgTitle' => $title->getText(),
3049 'wgCurRevisionId' => $curRevisionId,
3051 'wgArticleId' => $articleId,
3053 'wgIsRedirect' => $title->isRedirect(),
3055 'wgUserName' =>
$user ->isAnon() ? null :
$user ->getName(),
3056 'wgUserGroups' =>
$user ->getEffectiveGroups(),
3059 'wgPageContentLanguage' =>
$lang ->getCode(),
3060 'wgPageContentModel' => $title->getContentModel(),
3061 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3062 'wgDigitTransformTable' => $compactDigitTransTable,
3063 'wgDefaultDateFormat' =>
$lang ->getDefaultDateFormat(),
3064 'wgMonthNames' =>
$lang ->getMonthNamesArray(),
3065 'wgMonthNamesShort' =>
$lang ->getMonthAbbreviationsArray(),
3066 'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3067 'wgRelevantArticleId' => $relevantTitle->getArticleID(),
3071 if (
$user ->isLoggedIn() ) {
3073 $vars [
'wgUserEditCount' ] =
$user ->getEditCount();
3074 $userReg =
$user ->getRegistration();
3079 $vars [
'wgUserNewMsgRevisionId' ] =
$user ->getNewMessageRevisionId();
3082 if ( $wgContLang->hasVariants() ) {
3083 $vars [
'wgUserVariant' ] = $wgContLang->getPreferredVariant();
3086 $vars [
'wgIsProbablyEditable' ] = $title->quickUserCan(
'edit' ,
$user )
3087 && ( $title->exists() || $title->quickUserCan(
'create' ,
$user ) );
3089 foreach ( $title->getRestrictionTypes()
as $type ) {
3090 $vars [
'wgRestriction' . ucfirst(
$type )] = $title->getRestrictions(
$type );
3093 if ( $title->isMainPage() ) {
3094 $vars [
'wgIsMainPage' ] =
true ;
3097 if ( $this->mRedirectedFrom ) {
3098 $vars [
'wgRedirectedFrom' ] = $this->mRedirectedFrom->getPrefixedDBkey();
3101 if ( $relevantUser ) {
3102 $vars [
'wgRelevantUserName' ] = $relevantUser->getName();
3127 $request ->getVal(
'action' ) !==
'submit' ||
3128 !
$request ->getCheck(
'wpPreview' ) ||
3136 if ( !
$user ->isLoggedIn() ) {
3140 if ( !
$user ->matchEditToken(
$request ->getVal(
'wpEditToken' ) ) ) {
3145 if ( !
$title ->isJsSubpage() && !
$title ->isCssSubpage() ) {
3148 if ( !
$title ->isSubpageOf(
$user ->getUserPage() ) ) {
3153 $errors =
$title ->getUserPermissionsErrors(
'edit' ,
$user );
3154 if ( count( $errors ) !== 0 ) {
3173 'name' =>
'generator' ,
3174 'content' =>
"MediaWiki $wgVersion" ,
3177 if ( $config->get(
'ReferrerPolicy' ) !==
false ) {
3179 'name' =>
'referrer' ,
3180 'content' => $config->get(
'ReferrerPolicy' )
3184 $p =
"{$this->mIndexPolicy},{$this->mFollowPolicy}" ;
3185 if ( $p !==
'index,follow' ) {
3194 foreach ( $this->mMetatags
as $tag ) {
3195 if ( 0 == strcasecmp(
'http:' , substr( $tag[0], 0, 5 ) ) ) {
3197 $tag[0] = substr( $tag[0], 5 );
3201 $tagName =
"meta-{$tag[0]}" ;
3202 if ( isset( $tags[$tagName] ) ) {
3203 $tagName .= $tag[1];
3208 'content' => $tag[1]
3213 foreach ( $this->mLinktags
as $tag ) {
3217 # Universal edit button
3218 if ( $config->get(
'UniversalEditButton' ) && $this->
isArticleRelated () ) {
3221 && ( $this->
getTitle ()->exists() ||
3225 $msg = $this->
msg (
'edit' )->text();
3227 'rel' =>
'alternate' ,
3228 'type' =>
'application/x-wiki' ,
3230 'href' => $this->
getTitle ()->getEditURL(),
3236 'href' => $this->
getTitle ()->getEditURL(),
3241 # Generally the order of the favicon and apple-touch-icon links
3242 # should not matter, but Konqueror (3.5.9 at least) incorrectly
3243 # uses whichever one appears later in the HTML source. Make sure
3244 # apple-touch-icon is specified first to avoid this.
3245 if ( $config->get(
'AppleTouchIcon' ) !==
false ) {
3247 'rel' =>
'apple-touch-icon' ,
3248 'href' => $config->get(
'AppleTouchIcon' )
3252 if ( $config->get(
'Favicon' ) !==
false ) {
3254 'rel' =>
'shortcut icon' ,
3255 'href' => $config->get(
'Favicon' )
3259 # OpenSearch description link
3262 'type' =>
'application/opensearchdescription+xml' ,
3263 'href' =>
wfScript (
'opensearch_desc' ),
3264 'title' => $this->
msg (
'opensearch-desc' )->inContentLanguage()->
text (),
3267 if ( $config->get(
'EnableAPI' ) ) {
3268 # Real Simple Discovery link, provides auto-discovery information
3269 # for the MediaWiki API (and potentially additional custom API
3270 # support such as WordPress or Twitter-compatible APIs for a
3271 # blogging extension, etc)
3274 'type' =>
'application/rsd+xml' ,
3280 [
'action' =>
'rsd' ] ),
3287 if ( !$config->get(
'DisableLangConversion' ) ) {
3289 if (
$lang ->hasVariants() ) {
3290 $variants =
$lang ->getVariants();
3291 foreach ( $variants
as $variant ) {
3293 'rel' =>
'alternate' ,
3294 'hreflang' =>
wfBCP47 ( $variant ),
3295 'href' => $this->
getTitle ()->getLocalURL(
3296 [
'variant' => $variant ] )
3300 # x-default link per https://support.google.com/webmasters/answer/189077?hl=en
3302 'rel' =>
'alternate' ,
3303 'hreflang' =>
'x-default' ,
3304 'href' => $this->
getTitle ()->getLocalURL() ] );
3309 if ( $this->copyrightUrl !== null ) {
3313 if ( $config->get(
'RightsPage' ) ) {
3317 $copyright = $copy->getLocalURL();
3321 if ( !$copyright && $config->get(
'RightsUrl' ) ) {
3322 $copyright = $config->get(
'RightsUrl' );
3328 'rel' =>
'copyright' ,
3329 'href' => $copyright ]
3334 if ( $config->get(
'Feed' ) ) {
3338 # Use the page name for the title. In principle, this could
3339 # lead to issues with having the same name for different feeds
3340 # corresponding to the same page, but we can't avoid that at
3346 # Used
messages :
'page-rss-feed' and 'page-atom-feed' (
for an easier grep)
3348 "page-{$format}-feed" , $this->
getTitle ()->getPrefixedText()
3353 # Recent changes feed should appear on every page (except recentchanges,
3354 # that would be redundant). Put it after the per-page feed to avoid
3355 # changing existing behavior. It's still available, probably via a
3356 # menu in your browser. Some sites might have a different feed they'd
3357 # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3358 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3359 # If so, use it instead.
3360 $sitename = $config->get(
'Sitename' );
3361 if ( $config->get(
'OverrideSiteFeed' ) ) {
3362 foreach ( $config->get(
'OverrideSiteFeed' )
as $type => $feedUrl ) {
3367 $this->
msg (
"site-{$type}-feed" , $sitename )->
text ()
3370 } elseif ( !$this->
getTitle ()->isSpecial(
'Recentchanges' ) ) {
3372 foreach ( $config->get(
'AdvertisedFeedTypes' )
as $format ) {
3375 $rctitle->getLocalURL( [
'feed' => $format ] ),
3376 # For grep: 'site-rss-feed', 'site-atom-feed'
3377 $this->
msg (
"site-{$format}-feed" , $sitename )->text()
3382 # Allow extensions to change the list pf feeds. This hook is primarily for changing,
3383 # manipulating or removing existing feed tags. If you want to add new feeds, you should
3384 # use OutputPage::addFeedLink() instead.
3385 Hooks::run (
'AfterBuildFeedLinks' , [ &$feedLinks ] );
3387 $tags += $feedLinks;
3391 if ( $config->get(
'EnableCanonicalServerLink' ) ) {
3392 if ( $canonicalUrl !==
false ) {
3404 if ( in_array( $action, [
'history' ,
'info' ] ) ) {
3405 $query =
"action={$action}" ;
3411 $reqUrl = $this->
getRequest ()->getRequestURL();
3416 if ( $canonicalUrl !==
false ) {
3418 'rel' =>
'canonical' ,
3419 'href' => $canonicalUrl
3446 'rel' =>
'alternate' ,
3447 'type' =>
"application/$type+xml" ,
3462 public function addStyle ( $style, $media =
'' , $condition =
'' ,
$dir =
'' ) {
3468 $options [
'condition' ] = $condition;
3484 if ( $flip ===
'flip' && $this->
getLanguage ()->isRTL() ) {
3485 # If wanted, and the interface is right-to-left, flip the CSS
3486 $style_css = CSSJanus::transform( $style_css,
true ,
false );
3509 [
'excludepage' => $this->
getTitle ()->getPrefixedDBkey() ]
3514 $previewedCSS = $this->
getRequest ()->getText(
'wpTextbox1' );
3515 if ( $this->
getLanguage ()->getDir() !== $wgContLang->getDir() ) {
3516 $previewedCSS = CSSJanus::transform( $previewedCSS,
true ,
false );
3534 [
'name' =>
'ResourceLoaderDynamicStyles' ,
'content' =>
'' ]
3537 foreach ( $this->rlExemptStyleModules
as $group => $moduleNames ) {
3543 return self::combineWrappedStrings( array_merge( $chunks, $append ) );
3553 foreach ( $this->mExtStyles
as $url ) {
3556 $this->mExtStyles = [];
3558 foreach ( $this->styles
as $file =>
$options ) {
3561 $links[$file] =
$link ;
3575 if ( isset( $options[
'dir' ] ) ) {
3576 if ( $this->
getLanguage ()->getDir() != $options[
'dir' ] ) {
3581 if ( isset( $options[
'media' ] ) ) {
3582 $media = self::transformCssMedia( $options[
'media' ] );
3583 if ( is_null( $media ) ) {
3590 if ( substr( $style, 0, 1 ) ==
'/' ||
3591 substr( $style, 0, 5 ) ==
'http:' ||
3592 substr( $style, 0, 6 ) ==
'https:' ) {
3596 $url = $config->get(
'StylePath' ) .
'/' . $style .
'?' .
3597 $config->get(
'StyleVersion' );
3602 if ( isset( $options[
'condition' ] ) ) {
3603 $condition = htmlspecialchars( $options[
'condition' ] );
3604 $link =
"<!--[if $condition]>$link<![endif]-->" ;
3632 $remotePathPrefix = $config->
get (
'ResourceBasePath' );
3633 if ( $remotePathPrefix ===
'' ) {
3638 $remotePath = $remotePathPrefix;
3640 if ( strpos(
$path , $remotePath ) !== 0 ) {
3644 $path = RelPath\getRelativePath(
$path , $remotePath );
3645 return self::transformFilePath( $remotePathPrefix, $IP,
$path );
3660 $hash = md5_file(
"$localPath/$file" );
3661 if ( $hash ===
false ) {
3662 wfLogWarning ( __METHOD__ .
": Failed to hash $localPath/$file" );
3665 return "$remotePathPrefix/$file?" . substr( $hash, 0, 5 );
3679 $screenMediaQueryRegex =
'/^(?:only\s+)?screen\b/i' ;
3683 'printable' =>
'print' ,
3684 'handheld' =>
'handheld' ,
3686 foreach ( $switches
as $switch => $targetMedia ) {
3687 if ( $wgRequest->getBool( $switch ) ) {
3688 if ( $media == $targetMedia ) {
3690 } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3704 if ( $targetMedia ==
'print' || $media ==
'screen' ) {
3721 $args = func_get_args();
3764 $msgSpecs = func_get_args();
3765 array_shift( $msgSpecs );
3766 $msgSpecs = array_values( $msgSpecs );
3768 foreach ( $msgSpecs
as $n => $spec ) {
3769 if ( is_array( $spec ) ) {
3772 if ( isset(
$args [
'options' ] ) ) {
3773 unset(
$args [
'options' ] );
3775 'Adding "options" to ' . __METHOD__ .
' is no longer supported' ,
3794 $this->mEnableTOC = $flag;
3811 $this->mEnableSectionEditLinks = $flag;
3832 $themes = array_change_key_case( $themes, CASE_LOWER );
3833 $theme = isset( $themes[$skinName] ) ? $themes[$skinName] :
'MediaWiki' ;
3835 $themeClass =
"OOUI\\{$theme}Theme" ;
3836 OOUI\Theme::setSingleton(
new $themeClass() );
3837 OOUI\Element::setDefaultDir(
$dir );
3848 strtolower( $this->
getSkin ()->getSkinName() ),
3852 'oojs-ui-core.styles' ,
3853 'oojs-ui.styles.icons' ,
3854 'oojs-ui.styles.indicators' ,
3855 'oojs-ui.styles.textures' ,
3856 'mediawiki.widgets.styles' ,
getPreventClickjacking()
Get the prevent-clickjacking flag.
setContext(IContextSource $context)
Set the IContextSource object.
string $rlUserModuleState
addInlineStyle($style_css, $flip= 'noflip')
Adds inline CSS styles Internal use only.
prependHTML($text)
Prepend $text to the body HTML.
isDisabled()
Return whether the output will be completely disabled.
static closeElement($element)
Returns "$element>".
showFileRenameError($old, $new)
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
ResourceLoader $mResourceLoader
array $rlExemptStyleModules
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
Interface for objects which can provide a MediaWiki context on request.
setConfig(array $vars)
Set mw.config variables.
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
getPageTitleActionText()
Get the value of the "action text".
getMetadataAttribute()
Get the value of the "rel" attribute for metadata links.
getHeadItemsArray()
Get an array of head items.
static inlineScript($contents)
Output a "".
string null $mTarget
ResourceLoader target for load.php links.
getArticleBodyOnly()
Return whether the output will contain only the body of the article.
static escapeClass($class)
Given a value, escape it so that it can be used as a CSS class and return it.
addHelpLink($to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
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...
string $mPageLinkTitle
Used by skin template.
addParserOutputContent($parserOutput)
Add the HTML and enhancements for it (like ResourceLoader modules) associated with a ParserOutput obj...
userCanPreview()
To make it harder for someone to slip a user a fake user-JavaScript or user-CSS preview, a random token is associated with the login session.
addParserOutputText($parserOutput)
Add the HTML associated with a ParserOutput object, without any metadata.
setPrintable()
Set the page as printable, i.e.
string null $copyrightUrl
The URL to send in a element with rel=copyright.
disable()
Disable output completely, i.e.
static exists($index)
Returns whether the specified namespace exists.
wfUrlencode($s)
We want some things to be included as literal characters in our title URLs for prettiness, which urlencode encodes by default.
setStatusCode($statusCode)
Set the HTTP status code to send with the output.
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 $response
addExtensionStyle($url)
Register and add a stylesheet from an extension directory.
static stripAllTags($text)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed, encoded as plain text.
when a variable name is used in a it is silently declared as a new local masking the global
const ORIGIN_CORE_INDIVIDUAL
wfExpandUrl($url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
formatPermissionsErrorMessage(array $errors, $action=null)
Format a list of error messages.
string $mRevisionTimestamp
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
array $mLanguageLinks
Array of Interwiki Prefixed (non DB key) Titles (e.g.
getRlClient()
Call this to freeze the module queue and JS config and create a formatter.
getFileSearchOptions()
Get the files used on this page.
setCategoryLinks(array $categories)
Reset the category links (but not the category list) and add $categories.
isSyndicated()
Should we output feed links for this page?
array $styles
An array of stylesheet filenames (relative from skins path), with options for CSS media...
isPrintable()
Return whether the page is "printable".
getTitle()
Get the Title object.
prepareErrorPage($pageTitle, $htmlTitle=false)
Prepare this object to display an error page; disable caching and indexing, clear the current text an...
$mProperties
Additional key => value data.
get($name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
getAllowedModules($type)
Show what level of JavaScript / CSS untrustworthiness is allowed on this page.
addElement($element, array $attribs=[], $contents= '')
Shortcut for adding an Html::element via addHTML.
array bool $mDoNothing
Whether output is disabled.
addModules($modules)
Add one or more modules recognized by ResourceLoader.
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
reduceAllowedModules($type, $level)
Limit the highest level of CSS/JS untrustworthiness allowed.
setPageTitleActionText($text)
Set the new value of the "action text", this will be added to the "HTML title", separated from it wit...
bool $mPreventClickjacking
Controls if anti-clickjacking / frame-breaking headers will be sent.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
addMetadataLink(array $linkarr)
Add a new \ with "rel" attribute set to "meta".
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
preventClickjacking($enable=true)
Set a flag which will cause an X-Frame-Options header appropriate for edit pages to be sent...
enableClientCache($state)
Use enableClientCache(false) to force it to send nocache headers.
getCategories()
Get the list of category names this page belongs to.
getJsConfigVars()
Get the javascript config vars to include on this page.
enableOOUI()
Add ResourceLoader module styles for OOUI and set up the PHP implementation of it for use with MediaW...
usually copyright or history_copyright This message must be in HTML not wikitext & $link
addParserOutput($parserOutput)
Add everything from a ParserOutput object.
passed in as a query string parameter to the various URLs constructed here(i.e.$prevlink) $ldel you ll need to handle error messages
bool $mPrintable
We have to set isPrintable().
clearSubtitle()
Clear the subtitles.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getRequest()
Get the WebRequest object.
addWikiTextWithTitle($text, &$title, $linestart=true)
Add wikitext with a custom Title object.
bool $mIsArticleRelated
Stores "article flag" toggle.
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
array $mAllowedModules
What level of 'untrustworthiness' is allowed in CSS/JS modules loaded on this page?
bool $mNoGallery
Comes from the parser.
static transformFilePath($remotePathPrefix, $localPath, $file)
Utility method for transformResourceFilePath().
getTemplateIds()
Get the templates used on this page.
wfCgiToArray($query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
setCopyrightUrl($url)
Set the copyright URL to send with the output.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
getHTML()
Get the body HTML.
static buildBacklinkSubtitle(Title $title, $query=[])
Build message object for a subtitle containing a backlink to a page.
feedLink($type, $url, $text)
Generate a " " for a feed.
static openElement($element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
getLanguageLinks()
Get the list of language links.
addAcceptLanguage()
T23672: Add Accept-Language to Vary and Key headers if there's no 'variant' parameter existed in GET...
static stripOuterParagraph($html)
Strip outer.
static groupHasPermission($group, $role)
Check, if the given group has the given permission.
static singleton()
Get an instance of this class.
static getCanonicalName($index)
Returns the canonical (English) name for a given index.
adaptCdnTTL($mtime, $minTTL=0, $maxTTL=0)
Get TTL in [$minTTL,$maxTTL] in pass it to lowerCdnMaxage()
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...
wfAppendQuery($url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
headElement(Skin $sk, $includeStyle=true)
getJSVars()
Get an array containing the variables to be set in mw.config in JavaScript.
setExemptStates(array $states)
Set state of special modules that are handled by the caller manually.
static transformResourcePath(Config $config, $path)
Transform path to web-accessible static resource.
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 unsetoffset-wrap String Wrap the message in html(usually something like"<
getModuleScripts($filter=false, $position=null)
Get the list of module JS to include on this page.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context $parserOutput
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
$mFeedLinks
Handles the Atom / RSS links.
getSubtitle()
Get the subtitle.
isArticleRelated()
Return whether this page is related an article on the wiki.
setRedirectedFrom($t)
Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
static preloadTitleInfo(ResourceLoaderContext $context, IDatabase $db, array $moduleNames)
showErrorPage($title, $msg, $params=[])
Output a standard error page.
static mergeAttributes($a, $b)
Merge two sets of HTML attributes.
getConfig()
Get the Config object.
getMetaTags()
Returns the current tags.
lowerCdnMaxage($maxage)
Lower the value of the "s-maxage" part of the "Cache-control" HTTP header.
getCategoryLinks()
Get the list of category links, in a 2-D array with the following format: $arr[$type][] = $link...
bool $mArticleBodyOnly
Flag if output should only contain the body of the article.
setPageTitle($name)
"Page title" means the contents of \
.
setRobotPolicy($policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
bool $mEnableSectionEditLinks
Whether parser output should contain section edit links.
addTemplate(&$template)
Add the output of a QuickTemplate to the output buffer.
clearHTML()
Clear the body HTML.
getFrameOptions()
Get the X-Frame-Options header value (without the name part), or false if there isn't one...
Bootstrap a ResourceLoader client on an HTML page.
A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to interpret a given string a...
setCdnMaxage($maxage)
Set the value of the "s-maxage" part of the "Cache-control" HTTP header.
enableSectionEditLinks($flag=true)
Enables/disables section edit links, doesn't override NOEDITSECTION
getIndicators()
Get the indicators associated with this page.
getContext()
Get the base IContextSource object.
addWikiMsg()
Add a wikitext-formatted message to the output.
static combineWrappedStrings(array $chunks)
Combine WrappedString chunks and filter out empty ones.
showNewSectionLink()
Show an "add new section" link?
Title $mRedirectedFrom
If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redire...
const ORIGIN_USER_SITEWIDE
and(b) You must cause any modified files to carry prominent notices stating that You changed the files
wfDeprecated($function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
string $mHTMLtitle
Stores contents of "
" tag.
bool $mHideNewSectionLink
string $mBodytext
Contains all of the "" content.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
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
static makeTitleSafe($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
getModuleStyles($filter=false, $position=null)
Get the list of module CSS to include on this page.
parseInline($text, $linestart=true, $interface=false)
Parse wikitext, strip paragraphs, and return the HTML.
styleLink($style, array $options)
Generate \ tags for stylesheets.
static makeInlineScript($script)
Construct an inline script tag with given JS code.
getHtmlElementAttributes()
Return values for element.
wfBCP47($code)
Get the normalised IETF language tag See unit test for examples.
namespace and then decline to actually register it file or subcat img or subcat $title
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
static addModules(OutputPage $out)
Add ResourceLoader modules to the OutputPage object if debugging is enabled.
addLink(array $linkarr)
Add a new \ tag to the page header.
addStyle($style, $media= '', $condition= '', $dir= '')
Add a local or specified stylesheet, with the given media options.
static inlineStyle($contents, $media= 'all')
Output a "