272 'Accept-Encoding' => [
'match=gzip' ],
316 # Extensions should use `new RequestContext` instead of `new OutputPage` now.
329 public function redirect ( $url, $responsecode =
'302' ) {
330 # Strip newlines as a paranoia check for header injection in PHP<5.1.2
331 $this->mRedirect = str_replace(
"\n" ,
'' , $url );
332 $this->mRedirectCode = $responsecode;
353 $this->copyrightUrl = $url;
362 $this->mStatusCode = $statusCode;
373 array_push( $this->mMetatags, [
$name , $val ] );
394 array_push( $this->mLinktags, $linkarr );
425 $this->mCanonicalUrl = $url;
445 # note: buggy CC software only reads first "meta" link
446 static $haveMeta =
false ;
448 return 'alternate meta' ;
463 $this->mScripts .= $script;
477 array_push( $this->mExtStyles, $url );
501 if ( substr( $file, 0, 1 ) ==
'/' || preg_match(
'#^[a-z]*://#i' , $file ) ) {
504 $path = $this->
getConfig ()->get(
'StylePath' ) .
"/common/{$file}" ;
534 $filteredModules = [];
535 foreach ( $modules
as $val ) {
539 && ( is_null( $position ) || $module->getPosition() == $position )
540 && ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) )
542 $filteredModules[] = $val;
545 return $filteredModules;
556 public function getModules ( $filter =
false , $position = null, $param =
'mModules' ) {
557 $modules = array_values( array_unique( $this->$param ) );
571 $this->mModules = array_merge( $this->mModules, (
array )$modules );
583 return $this->
getModules ( $filter, $position,
'mModuleScripts' );
594 $this->mModuleScripts = array_merge( $this->mModuleScripts, (
array )$modules );
606 return $this->
getModules ( $filter, $position,
'mModuleStyles' );
619 $this->mModuleStyles = array_merge( $this->mModuleStyles, (
array )$modules );
658 $this->mTarget = $target;
693 return isset( $this->mHeadItems[
$name ] );
713 $this->mArticleBodyOnly = $only;
744 if ( isset( $this->mProperties[
$name ] ) ) {
745 return $this->mProperties[
$name ];
764 wfDebug ( __METHOD__ .
": CACHE DISABLED, NO TIMESTAMP\n" );
768 if ( !$config->get(
'CachePages' ) ) {
769 wfDebug ( __METHOD__ .
": CACHE DISABLED\n" );
776 'user' => $this->
getUser ()->getTouched(),
777 'epoch' => $config->get(
'CacheEpoch' )
779 if ( $config->get(
'UseSquid' ) ) {
781 $modifiedTimes[
'sepoch' ] =
wfTimestamp (
TS_MW , time() - $config->get(
'SquidMaxage' ) );
783 Hooks::run (
'OutputPageCheckLastModified' , [ &$modifiedTimes ] );
785 $maxModified = max( $modifiedTimes );
788 $clientHeader = $this->
getRequest ()->getHeader(
'If-Modified-Since' );
789 if ( $clientHeader ===
false ) {
790 wfDebug ( __METHOD__ .
": client did not send If-Modified-Since header" ,
'private' );
794 # IE sends sizes after the date like this:
795 # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
796 # this breaks strtotime().
797 $clientHeader = preg_replace(
'/;.*$/' ,
'' , $clientHeader );
799 MediaWiki\suppressWarnings();
800 $clientHeaderTime = strtotime( $clientHeader );
801 MediaWiki\restoreWarnings();
802 if ( !$clientHeaderTime ) {
804 .
": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
812 if ( $info !==
'' ) {
818 wfDebug ( __METHOD__ .
": client sent If-Modified-Since: " .
820 wfDebug ( __METHOD__ .
": effective Last-Modified: " .
822 if ( $clientHeaderTime < $maxModified ) {
823 wfDebug ( __METHOD__ .
": STALE, $info" ,
'private' );
828 # Give a 304 Not Modified response code and disable body output
829 wfDebug ( __METHOD__ .
": NOT MODIFIED, $info" ,
'private' );
830 ini_set(
'zlib.output_compression' , 0 );
831 $this->
getRequest ()->response()->statusHeader( 304 );
864 if ( isset( $policy[
'index' ] ) ) {
867 if ( isset( $policy[
'follow' ] ) ) {
880 $policy = trim( $policy );
881 if ( in_array( $policy, [
'index' ,
'noindex' ] ) ) {
882 $this->mIndexPolicy = $policy;
894 $policy = trim( $policy );
895 if ( in_array( $policy, [
'follow' ,
'nofollow' ] ) ) {
896 $this->mFollowPolicy = $policy;
907 $this->mPageTitleActionText = $text;
929 $this->mHTMLtitle =
$name ;
948 $this->mRedirectedFrom =
$t ;
966 # change "<script>foo&bar</script>" to "<script>foo&bar</script>"
967 # but leave "<i>foobar</i>" alone
969 $this->mPagetitle = $nameWithTags;
971 # change "<i>foo&bar</i>" to "foo&bar"
974 ->inContentLanguage()
1012 if ( $str instanceof
Message ) {
1013 $this->mSubtitle[] = $str->setContext( $this->
getContext () )->parse();
1015 $this->mSubtitle[] = $str;
1029 $query [
'redirect' ] =
'no' ;
1049 $this->mSubtitle = [];
1058 return implode(
"<br />\n\t\t\t\t" , $this->mSubtitle );
1066 $this->mPrintable =
true ;
1082 $this->mDoNothing =
true ;
1124 $this->mFeedLinks = [];
1138 $this->mFeedLinks = [];
1142 if ( is_string( $val ) ) {
1156 if ( in_array( $format, $this->
getConfig ()->
get (
'AdvertisedFeedTypes' ) ) ) {
1157 $this->mFeedLinks[$format] = $href;
1166 return count( $this->mFeedLinks ) > 0;
1194 $this->mIsarticle = $v;
1196 $this->mIsArticleRelated = $v;
1217 $this->mIsArticleRelated = $v;
1219 $this->mIsarticle =
false ;
1239 $this->mLanguageLinks += $newLinkArray;
1249 $this->mLanguageLinks = $newLinkArray;
1269 if ( !is_array( $categories ) || count( $categories ) == 0 ) {
1273 # Add the links to a LinkBatch
1278 # Fetch existence plus the hiddencat property
1280 $fields = [
'page_id' ,
'page_namespace' ,
'page_title' ,
'page_len' ,
1281 'page_is_redirect' ,
'page_latest' ,
'pp_value' ];
1283 if ( $this->
getConfig ()->
get (
'ContentHandlerUseDB' ) ) {
1284 $fields[] =
'page_content_model' ;
1286 if ( $this->
getConfig ()->
get (
'PageLanguageUseDB' ) ) {
1287 $fields[] =
'page_lang' ;
1290 $res =
$dbr ->select( [
'page' ,
'page_props' ],
1292 $lb->constructSet(
'page' ,
$dbr ),
1295 [
'page_props' => [
'LEFT JOIN' , [
1296 'pp_propname' =>
'hiddencat' ,
1301 # Add the results to the link cache
1304 # Set all the values to 'normal'.
1305 $categories = array_fill_keys( array_keys( $categories ),
'normal' );
1307 # Mark hidden categories
1308 foreach (
$res as $row ) {
1309 if ( isset( $row->pp_value ) ) {
1310 $categories[$row->page_title] =
'hidden' ;
1314 # Add the remaining categories to the skin
1316 'OutputPageMakeCategoryLinks' ,
1317 [ &$this, $categories, &$this->mCategoryLinks ] )
1319 foreach ( $categories
as $category =>
$type ) {
1321 $category = (
string )$category;
1322 $origcategory = $category;
1327 $wgContLang->findVariantLink( $category,
$title ,
true );
1328 if ( $category != $origcategory && array_key_exists( $category, $categories ) ) {
1331 $text = $wgContLang->convertHtml(
$title ->getText() );
1332 $this->mCategories[] =
$title ->getText();
1344 $this->mCategoryLinks = [];
1381 ksort( $this->mIndicators );
1406 $text = $this->
msg (
'helppage-top-gethelp' )->escaped();
1408 if ( $overrideBaseUrl ) {
1411 $toUrlencoded =
wfUrlencode ( str_replace(
' ' ,
'_' , $to ) );
1412 $helpUrl =
"//www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded" ;
1419 'target' =>
'_blank' ,
1420 'class' =>
'mw-helplink' ,
1444 if ( $this->
getConfig ()->
get (
'AllowSiteCSSOnRestrictedPages' ) ) {
1463 return min( array_values( $this->mAllowedModules ) );
1465 return isset( $this->mAllowedModules[
$type ] )
1466 ? $this->mAllowedModules[
$type ]
1499 $this->mBodytext .= $text;
1519 $this->mBodytext =
'' ;
1543 $anonPO->setEditSection(
false );
1544 $anonPO->setAllowUnsafeRawHtml(
false );
1545 if ( !
$options ->matches( $anonPO ) ) {
1551 if ( !$this->mParserOptions ) {
1557 $po->setEditSection(
false );
1558 $po->setAllowUnsafeRawHtml(
false );
1559 $po->isBogus =
true ;
1567 $this->mParserOptions->setEditSection(
false );
1568 $this->mParserOptions->setAllowUnsafeRawHtml(
false );
1574 return wfSetVar ( $this->mParserOptions, null,
true );
1588 $val = is_null( $revid ) ? null : intval( $revid );
1589 return wfSetVar ( $this->mRevisionId, $val );
1630 if ( $file instanceof
File && $file->
exists () ) {
1631 $val = [
'time' => $file->getTimestamp(),
'sha1' => $file->getSha1() ];
1633 return wfSetVar ( $this->mFileVersion, $val,
true );
1674 public function addWikiText ( $text, $linestart =
true , $interface =
true ) {
1726 $tidy =
false , $interface =
false
1731 $oldTidy = $popts->setTidy( $tidy );
1732 $popts->setInterfaceMessage( (
bool )$interface );
1735 $text, $title, $popts,
1736 $linestart,
true , $this->mRevisionId
1739 $popts->setTidy( $oldTidy );
1769 $this->mHideNewSectionLink =
$parserOutput ->getHideNewSection();
1775 $this->mHeadItems = array_merge( $this->mHeadItems,
$parserOutput ->getHeadItems() );
1780 $this->mPreventClickjacking = $this->mPreventClickjacking
1785 if ( isset( $this->mTemplateIds[$ns] ) ) {
1786 $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1788 $this->mTemplateIds[$ns] = $dbks;
1793 $this->mImageTimeKeys[$dbk] = $data;
1797 $parserOutputHooks = $this->
getConfig ()->get(
'ParserOutputHooks' );
1799 list ( $hookName, $data ) = $hookInfo;
1800 if ( isset( $parserOutputHooks[$hookName] ) ) {
1801 call_user_func( $parserOutputHooks[$hookName], $this,
$parserOutput , $data );
1813 Hooks::run (
'LanguageLinks' , [ $this->
getTitle (), &$this->mLanguageLinks, &$linkFlags ] );
1842 Hooks::run (
'OutputPageBeforeHTML' , [ &$this, &$text ] );
1857 $parserOutput ->setEditSectionTokens( $this->mEnableSectionEditLinks );
1884 public function parse ( $text, $linestart =
true , $interface =
false , $language = null ) {
1887 if ( is_null( $this->
getTitle () ) ) {
1888 throw new MWException (
'Empty $mTitle in ' . __METHOD__ );
1893 $popts->setInterfaceMessage(
true );
1895 if ( $language !== null ) {
1896 $oldLang = $popts->setTargetLanguage( $language );
1901 $linestart,
true , $this->mRevisionId
1905 $popts->setInterfaceMessage(
false );
1907 if ( $language !== null ) {
1908 $popts->setTargetLanguage( $oldLang );
1924 public function parseInline ( $text, $linestart =
true , $interface =
false ) {
1925 $parsed = $this->
parse ( $text, $linestart, $interface );
1943 $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
1953 $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
1965 return wfSetVar ( $this->mEnableClientCache, $state );
1975 if ( $cookies === null ) {
1977 $cookies = array_merge(
1978 SessionManager::singleton()->getVaryCookies(),
1982 $config->get(
'CacheVaryCookies' )
1984 Hooks::run (
'GetCacheVaryCookies' , [ $this, &$cookies ] );
1998 if (
$request ->getCookie( $cookieName,
'' ,
'' ) !==
'' ) {
1999 wfDebug ( __METHOD__ .
": found $cookieName\n" );
2003 wfDebug ( __METHOD__ .
": no cache-varying cookies found\n" );
2016 if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
2017 $this->mVaryHeader[$header] = [];
2019 if ( !is_array( $option ) ) {
2022 $this->mVaryHeader[$header] = array_unique( array_merge( $this->mVaryHeader[$header], $option ) );
2037 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2040 return 'Vary: ' . implode(
', ' , array_keys( $this->mVaryHeader ) );
2051 $cookiesOption = [];
2052 foreach ( $cvCookies
as $cookieName ) {
2053 $cookiesOption[] =
'param=' . $cookieName;
2057 foreach ( SessionManager::singleton()->getVaryHeaders()
as $header =>
$options ) {
2062 foreach ( $this->mVaryHeader
as $header => $option ) {
2063 $newheader = $header;
2064 if ( is_array( $option ) && count( $option ) > 0 ) {
2065 $newheader .=
';' . implode(
';' , $option );
2067 $headers[] = $newheader;
2069 $key =
'Key: ' . implode(
',' , $headers );
2089 if ( !$this->
getRequest ()->getCheck(
'variant' ) &&
$lang ->hasVariants() ) {
2090 $variants =
$lang ->getVariants();
2092 foreach ( $variants
as $variant ) {
2093 if ( $variant ===
$lang ->getCode() ) {
2096 $aloption[] =
'substr=' . $variant;
2101 $variantBCP47 =
wfBCP47 ( $variant );
2102 if ( $variantBCP47 !== $variant ) {
2103 $aloption[] =
'substr=' . $variantBCP47;
2122 $this->mPreventClickjacking = $enable;
2131 $this->mPreventClickjacking =
false ;
2153 if ( $config->get(
'BreakFrames' ) ) {
2155 } elseif ( $this->mPreventClickjacking && $config->get(
'EditPageFrameOptions' ) ) {
2156 return $config->get(
'EditPageFrameOptions' );
2168 $response ->header(
"ETag: $this->mETag" );
2174 # don't serve compressed data to clients who can't handle it
2175 # maintain different caches for logged-in users and non-logged in ones
2178 if ( $config->get(
'UseKeyHeader' ) ) {
2182 if ( $this->mEnableClientCache ) {
2184 $config->get(
'UseSquid' ) &&
2186 !SessionManager::getGlobalSession()->isPersistent() &&
2188 $this->mCdnMaxage != 0 &&
2191 if ( $config->get(
'UseESI' ) ) {
2192 # We'll purge the proxy cache explicitly, but require end user agents
2193 # to revalidate against the proxy on each visit.
2194 # Surrogate-Control controls our CDN, Cache-Control downstream caches
2195 wfDebug ( __METHOD__ .
": proxy caching with ESI; {$this->mLastModified} **" ,
'private' );
2196 # start with a shorter timeout for initial testing
2197 # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
2198 $response ->header(
'Surrogate-Control: max-age=' . $config->get(
'SquidMaxage' )
2199 .
'+' . $this->mCdnMaxage .
', content="ESI/1.0"' );
2200 $response ->header(
'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
2202 # We'll purge the proxy cache for anons explicitly, but require end user agents
2203 # to revalidate against the proxy on each visit.
2204 # IMPORTANT! The CDN needs to replace the Cache-Control header with
2205 # Cache-Control: s-maxage=0, must-revalidate, max-age=0
2206 wfDebug ( __METHOD__ .
": local proxy caching; {$this->mLastModified} **" ,
'private' );
2207 # start with a shorter timeout for initial testing
2208 # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2209 $response ->header(
'Cache-Control: s-maxage=' . $this->mCdnMaxage
2210 .
', must-revalidate, max-age=0' );
2213 # We do want clients to cache if they can, but they *must* check for updates
2214 # on revisiting the page.
2215 wfDebug ( __METHOD__ .
": private caching; {$this->mLastModified} **" ,
'private' );
2216 $response ->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s' , 0 ) .
' GMT' );
2217 $response ->header(
"Cache-Control: private, must-revalidate, max-age=0" );
2219 if ( $this->mLastModified ) {
2220 $response ->header(
"Last-Modified: {$this->mLastModified}" );
2223 wfDebug ( __METHOD__ .
": no caching **" ,
'private' );
2225 # In general, the absence of a last modified header should be enough to prevent
2226 # the client from using its cache. We send a few other things just to make sure.
2227 $response ->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s' , 0 ) .
' GMT' );
2228 $response ->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2229 $response ->header(
'Pragma: no-cache' );
2238 if ( $this->mDoNothing ) {
2245 if ( $this->mRedirect !=
'' ) {
2246 # Standards require redirect URLs to be absolute
2252 if (
Hooks::run (
"BeforePageRedirect" , [ $this, &$redirect, &
$code ] ) ) {
2254 if ( !$config->get(
'DebugRedirects' ) ) {
2259 if ( $config->get(
'VaryOnXFP' ) ) {
2264 $response ->header(
"Content-Type: text/html; charset=utf-8" );
2265 if ( $config->get(
'DebugRedirects' ) ) {
2266 $url = htmlspecialchars( $redirect );
2267 print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n" ;
2268 print "<p>Location: <a href=\"$url\">$url</a></p>\n" ;
2269 print "</body>\n</html>\n" ;
2271 $response ->header(
'Location: ' . $redirect );
2276 } elseif ( $this->mStatusCode ) {
2277 $response ->statusHeader( $this->mStatusCode );
2280 # Buffer output; final headers may depend on later processing
2283 $response ->header(
'Content-type: ' . $config->get(
'MimeType' ) .
'; charset=UTF-8' );
2284 $response ->header(
'Content-language: ' . $config->get(
'LanguageCode' ) );
2288 $response ->header(
'X-UA-Compatible: IE=Edge' );
2292 if ( $frameOptions ) {
2293 $response ->header(
"X-Frame-Options: $frameOptions" );
2296 if ( $this->mArticleBodyOnly ) {
2301 $modules = $sk->getDefaultModules();
2307 'mediawiki.page.startup' ,
2312 if ( $config->get(
'ResponsiveImages' ) ) {
2313 $coreModules[] =
'mediawiki.hidpi' ;
2317 foreach ( $modules
as $group ) {
2324 Hooks::run (
'BeforePageDisplay' , [ &$this, &$sk ] );
2336 Hooks::run (
'AfterFinalPageOutput' , [ $this ] );
2360 if ( $htmlTitle !==
false ) {
2366 $this->mRedirect =
'' ;
2390 if ( $msg instanceof Message ) {
2392 trigger_error(
'Argument ignored: $params. The message parameters argument '
2393 .
'is discarded when the $msg argument is a Message object instead of '
2394 .
'a string.' , E_USER_NOTICE );
2396 $this->
addHTML ( $msg->parseAsBlock() );
2416 if ( in_array( $action, [
'read' ,
'edit' ,
'createpage' ,
'createtalk' ,
'upload' ] )
2417 && $this->
getUser ()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2418 && ( $errors[0][0] ==
'badaccess-groups' || $errors[0][0] ==
'badaccess-group0' )
2422 $displayReturnto = null;
2424 # Due to bug 32276, if a user does not have read permissions,
2425 # $this->getTitle() will just give Special:Badtitle, which is
2426 # not especially useful as a returnto parameter. Use the title
2427 # from the request instead, if there was one.
2430 if ( $action ==
'edit' ) {
2431 $msg =
'whitelistedittext' ;
2432 $displayReturnto = $returnto;
2433 } elseif ( $action ==
'createpage' || $action ==
'createtalk' ) {
2434 $msg =
'nocreatetext' ;
2435 } elseif ( $action ==
'upload' ) {
2436 $msg =
'uploadnologintext' ;
2438 $msg =
'loginreqpagetext' ;
2445 $query [
'returnto' ] = $returnto->getPrefixedText();
2448 $returntoquery =
$request ->getValues();
2449 unset( $returntoquery[
'title' ] );
2450 unset( $returntoquery[
'returnto' ] );
2451 unset( $returntoquery[
'returntoquery' ] );
2457 $this->
msg (
'loginreqlink' )->escaped(),
2463 $this->
addHTML ( $this->
msg ( $msg )->rawParams( $loginLink )->
parse () );
2465 # Don't return to a page the user can't read otherwise
2466 # we'll end up in a pointless loop
2467 if ( $displayReturnto && $displayReturnto->userCan(
'read' , $this->getUser() ) ) {
2497 if ( $action == null ) {
2498 $text = $this->
msg (
'permissionserrorstext' , count( $errors ) )->plain() .
"\n\n" ;
2500 $action_desc = $this->
msg (
"action-$action" )->plain();
2502 'permissionserrorstext-withaction' ,
2505 )->plain() .
"\n\n" ;
2508 if ( count( $errors ) > 1 ) {
2509 $text .=
'<ul class="permissions-errors">' .
"\n" ;
2511 foreach ( $errors
as $error ) {
2513 $text .= call_user_func_array( [ $this,
'msg' ], $error )->plain();
2518 $text .=
"<div class=\"permissions-errors\">\n" .
2519 call_user_func_array( [ $this,
'msg' ], reset( $errors ) )->plain() .
2538 if ( func_num_args() > 0 ) {
2539 throw new MWException ( __METHOD__ .
' no longer accepts arguments since 1.25.' );
2567 if ( $lag >= $config->get(
'SlaveLagWarning' ) ) {
2568 $message = $lag < $config->get(
'SlaveLagCritical' )
2571 $wrap =
Html::rawElement (
'div' , [
'class' =>
"mw-{$message}" ],
"\n$1\n" );
2611 $link = $this->
msg (
'returnto' )->rawParams(
2613 $this->
addHTML (
"<p id=\"mw-returnto\">{$link}</p>\n" );
2624 public function returnToMain ( $unused = null, $returnto = null, $returntoquery = null ) {
2625 if ( $returnto == null ) {
2626 $returnto = $this->
getRequest ()->getText(
'returnto' );
2629 if ( $returntoquery == null ) {
2630 $returntoquery = $this->
getRequest ()->getText(
'returntoquery' );
2633 if ( $returnto ===
'' ) {
2637 if ( is_object( $returnto ) ) {
2638 $titleObj = $returnto;
2644 if ( !is_object( $titleObj ) || $titleObj->isExternal() ) {
2660 $sitedir = $wgContLang->getDir();
2670 # Don't bother with the newline if $head == ''
2671 $ret .=
"$openHead\n" ;
2692 $ret .= $item .
"\n" ;
2695 foreach ( $this->mHeadItems
as $item ) {
2696 $ret .= $item .
"\n" ;
2701 $ret .=
"$closeHead\n" ;
2705 $bodyClasses[] =
'mediawiki' ;
2707 # Classes for LTR/RTL directionality support
2708 $bodyClasses[] = $userdir;
2709 $bodyClasses[] =
"sitedir-$sitedir" ;
2711 if ( $this->
getLanguage ()->capitalizeAllNouns() ) {
2712 # A <body> class is probably not the best way to do this . . .
2713 $bodyClasses[] =
'capitalize-all-nouns' ;
2724 $bodyAttrs[
'class' ] = implode(
' ' , $bodyClasses );
2728 Hooks::run (
'OutputPageBodyAttributes' , [ $this, $sk, &$bodyAttrs ] );
2741 if ( is_null( $this->mResourceLoader ) ) {
2744 LoggerFactory::getInstance(
'resourceloader' )
2761 $modules = (
array )$modules;
2770 if ( !count( $modules ) ) {
2774 if ( count( $modules ) > 1 ) {
2776 $modules = array_unique( $modules );
2782 foreach ( $modules
as $name ) {
2784 $links[
'html' ] = array_merge( $links[
'html' ],
$link [
'html' ] );
2785 $links[
'states' ] +=
$link [
'states' ];
2791 if ( !is_null( $this->mTarget ) ) {
2796 $sortedModules = [];
2798 foreach ( $modules
as $name ) {
2800 # Check that we're allowed to include this module on this page
2808 || ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) )
2813 $sortedModules[$module->getSource()][$module->getGroup()][
$name ] = $module;
2816 foreach ( $sortedModules
as $source => $groups ) {
2817 foreach ( $groups
as $group => $grpModules ) {
2820 if ( ( $group ===
'user' || $group ===
'private' ) && $this->
getUser ()->isLoggedIn() ) {
2829 $this->
getSkin ()->getSkinName(),
2843 foreach ( $grpModules
as $key => $module ) {
2846 if ( $module->isKnownEmpty(
$context ) ) {
2847 unset( $grpModules[
$key ] );
2849 $links[
'states' ][
$key ] =
'ready' ;
2853 $isRaw |= $module->isRaw();
2857 if ( count( $grpModules ) === 0 ) {
2865 if ( $group ===
'private' ) {
2884 if ( $group ===
'user' ) {
2896 if (
$context ->getRaw() || $isRaw ) {
2900 'async' => !isset( $extraQuery[
'sync' ] ),
2911 foreach ( $grpModules
as $key => $module ) {
2913 if (
$key !==
'startup' ) {
2914 $links[
'states' ][
$key ] =
'loading' ;
2919 if ( $group ==
'noscript' ) {
2922 $links[
'html' ][] =
$link ;
2939 if ( !is_array( $link ) ) {
2943 $states += $link[
'states' ];
2949 if ( count( $states ) ) {
2955 return WrappedString::join(
"\n" ,
$html );
2981 return self::getHtmlFromLoaderLinks( $links );
2999 'document.documentElement.className = document.documentElement.className'
3000 .
'.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" );'
3011 $embedScripts = [
'user.options' ];
3037 return self::getHtmlFromLoaderLinks( $links );
3060 $modules = $this->
getModules (
true ,
'bottom' );
3073 if ( $this->
getConfig ()->
get (
'AllowUserJs' )
3075 && $this->
getTitle ()->isJsSubpage()
3081 [
'excludepage' => $this->
getTitle ()->getPrefixedDBkey() ]
3114 return self::getHtmlFromLoaderLinks( $links );
3142 if ( is_array(
$keys ) ) {
3166 $canonicalSpecialPageName =
false ; # bug 21115
3169 $ns = $title->getNamespace();
3172 : $title->getNsText();
3177 $relevantTitle = $sk->getRelevantTitle();
3178 $relevantUser = $sk->getRelevantUser();
3181 list ( $canonicalSpecialPageName, ) =
3185 $curRevisionId = $wikiPage->getLatest();
3186 $articleId = $wikiPage->getId();
3189 $lang = $title->getPageViewLanguage();
3192 $separatorTransTable =
$lang ->separatorTransformTable();
3193 $separatorTransTable = $separatorTransTable ? $separatorTransTable : [];
3194 $compactSeparatorTransTable = [
3195 implode(
"\t" , array_keys( $separatorTransTable ) ),
3196 implode(
"\t" , $separatorTransTable ),
3198 $digitTransTable =
$lang ->digitTransformTable();
3199 $digitTransTable = $digitTransTable ? $digitTransTable : [];
3200 $compactDigitTransTable = [
3201 implode(
"\t" , array_keys( $digitTransTable ) ),
3202 implode(
"\t" , $digitTransTable ),
3208 'wgCanonicalNamespace' => $canonicalNamespace,
3209 'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3210 'wgNamespaceNumber' => $title->getNamespace(),
3211 'wgPageName' => $title->getPrefixedDBkey(),
3212 'wgTitle' => $title->getText(),
3213 'wgCurRevisionId' => $curRevisionId,
3215 'wgArticleId' => $articleId,
3217 'wgIsRedirect' => $title->isRedirect(),
3219 'wgUserName' =>
$user ->isAnon() ? null :
$user ->getName(),
3220 'wgUserGroups' =>
$user ->getEffectiveGroups(),
3223 'wgPageContentLanguage' =>
$lang ->getCode(),
3224 'wgPageContentModel' => $title->getContentModel(),
3225 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3226 'wgDigitTransformTable' => $compactDigitTransTable,
3227 'wgDefaultDateFormat' =>
$lang ->getDefaultDateFormat(),
3228 'wgMonthNames' =>
$lang ->getMonthNamesArray(),
3229 'wgMonthNamesShort' =>
$lang ->getMonthAbbreviationsArray(),
3230 'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3231 'wgRelevantArticleId' => $relevantTitle->getArticleID(),
3235 if (
$user ->isLoggedIn() ) {
3237 $vars [
'wgUserEditCount' ] =
$user ->getEditCount();
3239 $vars [
'wgUserRegistration' ] = $userReg !== null ? ( $userReg * 1000 ) : null;
3243 $vars[
'wgUserNewMsgRevisionId' ] =
$user ->getNewMessageRevisionId();
3246 if ( $wgContLang->hasVariants() ) {
3247 $vars [
'wgUserVariant' ] = $wgContLang->getPreferredVariant();
3250 $vars [
'wgIsProbablyEditable' ] = $title->quickUserCan(
'edit' ,
$user )
3251 && ( $title->exists() || $title->quickUserCan(
'create' ,
$user ) );
3253 foreach ( $title->getRestrictionTypes()
as $type ) {
3254 $vars [
'wgRestriction' . ucfirst(
$type )] = $title->getRestrictions(
$type );
3257 if ( $title->isMainPage() ) {
3258 $vars [
'wgIsMainPage' ] =
true ;
3261 if ( $this->mRedirectedFrom ) {
3262 $vars [
'wgRedirectedFrom' ] = $this->mRedirectedFrom->getPrefixedDBkey();
3265 if ( $relevantUser ) {
3266 $vars [
'wgRelevantUserName' ] = $relevantUser->getName();
3291 $request ->getVal(
'action' ) !==
'submit' ||
3292 !
$request ->getCheck(
'wpPreview' ) ||
3300 if ( !$this->
getUser ()->isLoggedIn() ) {
3304 if ( !
$user ->matchEditToken(
$request ->getVal(
'wpEditToken' ) ) ) {
3309 if ( !
$title ->isJsSubpage() && !
$title ->isCssSubpage() ) {
3312 if ( !
$title ->isSubpageOf(
$user ->getUserPage() ) ) {
3317 $errors =
$title ->getUserPermissionsErrors(
'edit' ,
$user );
3318 if ( count( $errors ) !== 0 ) {
3337 'name' =>
'generator' ,
3338 'content' =>
"MediaWiki $wgVersion" ,
3341 if ( $config->get(
'ReferrerPolicy' ) !==
false ) {
3343 'name' =>
'referrer' ,
3344 'content' => $config->get(
'ReferrerPolicy' )
3348 $p =
"{$this->mIndexPolicy},{$this->mFollowPolicy}" ;
3349 if ( $p !==
'index,follow' ) {
3358 foreach ( $this->mMetatags
as $tag ) {
3359 if ( 0 == strcasecmp(
'http:' , substr( $tag[0], 0, 5 ) ) ) {
3361 $tag[0] = substr( $tag[0], 5 );
3365 $tagName =
"meta-{$tag[0]}" ;
3366 if ( isset( $tags[$tagName] ) ) {
3367 $tagName .= $tag[1];
3372 'content' => $tag[1]
3377 foreach ( $this->mLinktags
as $tag ) {
3381 # Universal edit button
3382 if ( $config->get(
'UniversalEditButton' ) && $this->
isArticleRelated () ) {
3385 && ( $this->
getTitle ()->exists() ||
3389 $msg = $this->
msg (
'edit' )->text();
3391 'rel' =>
'alternate' ,
3392 'type' =>
'application/x-wiki' ,
3394 'href' => $this->
getTitle ()->getEditURL(),
3400 'href' => $this->
getTitle ()->getEditURL(),
3405 # Generally the order of the favicon and apple-touch-icon links
3406 # should not matter, but Konqueror (3.5.9 at least) incorrectly
3407 # uses whichever one appears later in the HTML source. Make sure
3408 # apple-touch-icon is specified first to avoid this.
3409 if ( $config->get(
'AppleTouchIcon' ) !==
false ) {
3411 'rel' =>
'apple-touch-icon' ,
3412 'href' => $config->get(
'AppleTouchIcon' )
3416 if ( $config->get(
'Favicon' ) !==
false ) {
3418 'rel' =>
'shortcut icon' ,
3419 'href' => $config->get(
'Favicon' )
3423 # OpenSearch description link
3426 'type' =>
'application/opensearchdescription+xml' ,
3427 'href' =>
wfScript (
'opensearch_desc' ),
3428 'title' => $this->
msg (
'opensearch-desc' )->inContentLanguage()->
text (),
3431 if ( $config->get(
'EnableAPI' ) ) {
3432 # Real Simple Discovery link, provides auto-discovery information
3433 # for the MediaWiki API (and potentially additional custom API
3434 # support such as WordPress or Twitter-compatible APIs for a
3435 # blogging extension, etc)
3438 'type' =>
'application/rsd+xml' ,
3444 [
'action' =>
'rsd' ] ),
3451 if ( !$config->get(
'DisableLangConversion' ) ) {
3453 if (
$lang ->hasVariants() ) {
3454 $variants =
$lang ->getVariants();
3455 foreach ( $variants
as $variant ) {
3457 'rel' =>
'alternate' ,
3458 'hreflang' =>
wfBCP47 ( $variant ),
3459 'href' => $this->
getTitle ()->getLocalURL(
3460 [
'variant' => $variant ] )
3464 # x-default link per https://support.google.com/webmasters/answer/189077?hl=en
3466 'rel' =>
'alternate' ,
3467 'hreflang' =>
'x-default' ,
3468 'href' => $this->
getTitle ()->getLocalURL() ] );
3473 if ( $this->copyrightUrl !== null ) {
3477 if ( $config->get(
'RightsPage' ) ) {
3481 $copyright = $copy->getLocalURL();
3485 if ( !$copyright && $config->get(
'RightsUrl' ) ) {
3486 $copyright = $config->get(
'RightsUrl' );
3492 'rel' =>
'copyright' ,
3493 'href' => $copyright ]
3498 if ( $config->get(
'Feed' ) ) {
3502 # Use the page name for the title. In principle, this could
3503 # lead to issues with having the same name for different feeds
3504 # corresponding to the same page, but we can't avoid that at
3510 # Used
messages :
'page-rss-feed' and 'page-atom-feed' (
for an easier grep)
3512 "page-{$format}-feed" , $this->
getTitle ()->getPrefixedText()
3517 # Recent changes feed should appear on every page (except recentchanges,
3518 # that would be redundant). Put it after the per-page feed to avoid
3519 # changing existing behavior. It's still available, probably via a
3520 # menu in your browser. Some sites might have a different feed they'd
3521 # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3522 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3523 # If so, use it instead.
3524 $sitename = $config->get(
'Sitename' );
3525 if ( $config->get(
'OverrideSiteFeed' ) ) {
3526 foreach ( $config->get(
'OverrideSiteFeed' )
as $type => $feedUrl ) {
3531 $this->
msg (
"site-{$type}-feed" , $sitename )->
text ()
3534 } elseif ( !$this->
getTitle ()->isSpecial(
'Recentchanges' ) ) {
3536 foreach ( $config->get(
'AdvertisedFeedTypes' )
as $format ) {
3539 $rctitle->getLocalURL( [
'feed' => $format ] ),
3540 # For grep: 'site-rss-feed', 'site-atom-feed'
3541 $this->
msg (
"site-{$format}-feed" , $sitename )->text()
3546 # Allow extensions to change the list pf feeds. This hook is primarily for changing,
3547 # manipulating or removing existing feed tags. If you want to add new feeds, you should
3548 # use OutputPage::addFeedLink() instead.
3549 Hooks::run (
'AfterBuildFeedLinks' , [ &$feedLinks ] );
3551 $tags += $feedLinks;
3555 if ( $config->get(
'EnableCanonicalServerLink' ) ) {
3556 if ( $canonicalUrl !==
false ) {
3568 if ( in_array( $action, [
'history' ,
'info' ] ) ) {
3569 $query =
"action={$action}" ;
3575 $reqUrl = $this->
getRequest ()->getRequestURL();
3580 if ( $canonicalUrl !==
false ) {
3582 'rel' =>
'canonical' ,
3583 'href' => $canonicalUrl
3610 'rel' =>
'alternate' ,
3611 'type' =>
"application/$type+xml" ,
3626 public function addStyle ( $style, $media =
'' , $condition =
'' ,
$dir =
'' ) {
3632 $options [
'condition' ] = $condition;
3648 if ( $flip ===
'flip' && $this->
getLanguage ()->isRTL() ) {
3649 # If wanted, and the interface is right-to-left, flip the CSS
3650 $style_css = CSSJanus::transform( $style_css,
true ,
false );
3664 $this->
getSkin ()->setupSkinUserCss( $this );
3682 $moduleStyles[] =
'site' ;
3683 $moduleStyles[] =
'noscript' ;
3684 $moduleStyles[] =
'user.groups' ;
3687 if ( $this->
getConfig ()->
get (
'AllowUserCss' ) && $this->
getTitle ()->isCssSubpage()
3693 [
'excludepage' => $this->
getTitle ()->getPrefixedDBkey() ]
3695 $otherTags = array_merge( $otherTags,
$link [
'html' ] );
3700 $previewedCSS = $this->
getRequest ()->getText(
'wpTextbox1' );
3701 if ( $this->
getLanguage ()->getDir() !== $wgContLang->getDir() ) {
3702 $previewedCSS = CSSJanus::transform( $previewedCSS,
true ,
false );
3707 $moduleStyles[] =
'user' ;
3711 $moduleStyles[] =
'user.cssprefs' ;
3713 foreach ( $moduleStyles
as $name ) {
3718 if ( $name ===
'site' ) {
3726 $group = $module->getGroup();
3749 [
'name' =>
'ResourceLoaderDynamicStyles' ,
'content' =>
'' ]
3755 foreach ( [
'site' ,
'noscript' ,
'private' ,
'user' ]
as $group ) {
3762 return self::getHtmlFromLoaderLinks( $links ) . implode(
'' , $otherTags );
3772 foreach ( $this->mExtStyles
as $url ) {
3775 $this->mExtStyles = [];
3777 foreach ( $this->styles
as $file =>
$options ) {
3780 $links[$file] =
$link ;
3794 if ( isset( $options[
'dir' ] ) ) {
3795 if ( $this->
getLanguage ()->getDir() != $options[
'dir' ] ) {
3800 if ( isset( $options[
'media' ] ) ) {
3801 $media = self::transformCssMedia( $options[
'media' ] );
3802 if ( is_null( $media ) ) {
3809 if ( substr( $style, 0, 1 ) ==
'/' ||
3810 substr( $style, 0, 5 ) ==
'http:' ||
3811 substr( $style, 0, 6 ) ==
'https:' ) {
3815 $url = $config->get(
'StylePath' ) .
'/' . $style .
'?' .
3816 $config->get(
'StyleVersion' );
3821 if ( isset( $options[
'condition' ] ) ) {
3822 $condition = htmlspecialchars( $options[
'condition' ] );
3823 $link =
"<!--[if $condition]>$link<![endif]-->" ;
3851 $remotePathPrefix = $config->
get (
'ResourceBasePath' );
3852 if ( $remotePathPrefix ===
'' ) {
3857 $remotePath = $remotePathPrefix;
3859 if ( strpos(
$path , $remotePath ) !== 0 ) {
3863 $path = RelPath\getRelativePath(
$path , $remotePath );
3864 return self::transformFilePath( $remotePathPrefix, $IP,
$path );
3879 $hash = md5_file(
"$localPath/$file" );
3880 if ( $hash ===
false ) {
3881 wfLogWarning ( __METHOD__ .
": Failed to hash $localPath/$file" );
3884 return "$remotePathPrefix/$file?" . substr( $hash, 0, 5 );
3898 $screenMediaQueryRegex =
'/^(?:only\s+)?screen\b/i' ;
3902 'printable' =>
'print' ,
3903 'handheld' =>
'handheld' ,
3905 foreach ( $switches
as $switch => $targetMedia ) {
3906 if ( $wgRequest->getBool( $switch ) ) {
3907 if ( $media == $targetMedia ) {
3909 } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3923 if ( $targetMedia ==
'print' || $media ==
'screen' ) {
3940 $args = func_get_args();
3983 $msgSpecs = func_get_args();
3984 array_shift( $msgSpecs );
3985 $msgSpecs = array_values( $msgSpecs );
3987 foreach ( $msgSpecs
as $n => $spec ) {
3988 if ( is_array( $spec ) ) {
3991 if ( isset(
$args [
'options' ] ) ) {
3992 unset(
$args [
'options' ] );
3994 'Adding "options" to ' . __METHOD__ .
' is no longer supported' ,
4013 $this->mEnableTOC = $flag;
4030 $this->mEnableSectionEditLinks = $flag;
4051 $themes = array_change_key_case( $themes, CASE_LOWER );
4052 $theme = isset( $themes[$skinName] ) ? $themes[$skinName] :
'MediaWiki' ;
4054 $themeClass =
"OOUI\\{$theme}Theme" ;
4055 OOUI\Theme::setSingleton(
new $themeClass() );
4056 OOUI\Element::setDefaultDir(
$dir );
4067 strtolower( $this->
getSkin ()->getSkinName() ),
4071 'oojs-ui-core.styles' ,
4072 'oojs-ui.styles.icons' ,
4073 'oojs-ui.styles.indicators' ,
4074 'oojs-ui.styles.textures' ,
4075 'mediawiki.widgets.styles' ,
4079 $this->
addMeta (
'X-OOUI-PHP' ,
'1' );
getPreventClickjacking()
Get the prevent-clickjacking flag.
setContext(IContextSource $context)
Set the IContextSource object.
addInlineStyle($style_css, $flip= 'noflip')
Adds inline CSS styles Internal use only.
const TS_RFC2822
RFC 2822 format, for E-mail and HTTP headers.
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
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
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.
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 makeConfigSetScript(array $configuration)
Returns JS code which will set the MediaWiki configuration array to the given value.
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
Represents a title within MediaWiki.
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
array $mLanguageLinks
Array of Interwiki Prefixed (non DB key) Titles (e.g.
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.
addMetadataLink(array $linkarr)
Add a new \ with "rel" attribute set to "meta".
the value to return A Title object or null for latest to be modified or replaced by the hook handler or if authentication is not possible after cache objects are set for highlighting & $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
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...
addParserOutput($parserOutput)
Add everything from a ParserOutput object.
bool $mPrintable
We have to set isPrintable().
static makeLoaderStateScript($name, $state=null)
Returns a JS call to mw.loader.state, which sets the state of a module or modules to a given value...
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.
getHeadScripts()
JS stuff to put in the "".
bool $mIsArticleRelated
Stores "article flag" toggle.
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
getExternalHeadScripts()
tags to put in "".
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...
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.
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 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"<
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 makePackedModulesString($modules)
Convert an array of module names to a packed query string.
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.
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.
$mETag
Contains an HTTP Entity Tags (see RFC 2616 section 3.13) which is used as a unique identifier for the...
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 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 "