MediaWiki  1.28.3
OutputPage.php
Go to the documentation of this file.
1 <?php
27 
43 class OutputPage extends ContextSource {
45  protected $mMetatags = [];
46 
48  protected $mLinktags = [];
49 
51  protected $mCanonicalUrl = false;
52 
57  protected $mExtStyles = [];
58 
62  public $mPagetitle = '';
63 
68  public $mBodytext = '';
69 
71  private $mHTMLtitle = '';
72 
77  private $mIsarticle = false;
78 
80  private $mIsArticleRelated = true;
81 
86  private $mPrintable = false;
87 
92  private $mSubtitle = [];
93 
95  public $mRedirect = '';
96 
98  protected $mStatusCode;
99 
104  protected $mLastModified = '';
105 
107  protected $mCategoryLinks = [];
108 
110  protected $mCategories = [];
111 
113  protected $mIndicators = [];
114 
116  private $mLanguageLinks = [];
117 
124  private $mScripts = '';
125 
127  protected $mInlineStyles = '';
128 
133  public $mPageLinkTitle = '';
134 
136  protected $mHeadItems = [];
137 
139  protected $mModules = [];
140 
142  protected $mModuleScripts = [];
143 
145  protected $mModuleStyles = [];
146 
148  protected $mResourceLoader;
149 
151  private $rlClient;
152 
155 
158 
161 
163  protected $mJsConfigVars = [];
164 
166  protected $mTemplateIds = [];
167 
169  protected $mImageTimeKeys = [];
170 
172  public $mRedirectCode = '';
173 
174  protected $mFeedLinksAppendQuery = null;
175 
181  protected $mAllowedModules = [
183  ];
184 
186  protected $mDoNothing = false;
187 
188  // Parser related.
189 
191  protected $mContainsNewMagic = 0;
192 
197  protected $mParserOptions = null;
198 
204  private $mFeedLinks = [];
205 
206  // Gwicke work on squid caching? Roughly from 2003.
207  protected $mEnableClientCache = true;
208 
210  private $mArticleBodyOnly = false;
211 
213  protected $mNewSectionLink = false;
214 
216  protected $mHideNewSectionLink = false;
217 
223  public $mNoGallery = false;
224 
226  private $mPageTitleActionText = '';
227 
229  protected $mCdnMaxage = 0;
231  protected $mCdnMaxageLimit = INF;
232 
238  protected $mPreventClickjacking = true;
239 
241  private $mRevisionId = null;
242 
244  private $mRevisionTimestamp = null;
245 
247  protected $mFileVersion = null;
248 
257  protected $styles = [];
258 
259  private $mIndexPolicy = 'index';
260  private $mFollowPolicy = 'follow';
261  private $mVaryHeader = [
262  'Accept-Encoding' => [ 'match=gzip' ],
263  ];
264 
271  private $mRedirectedFrom = null;
272 
276  private $mProperties = [];
277 
281  private $mTarget = null;
282 
286  private $mEnableTOC = true;
287 
291  private $mEnableSectionEditLinks = true;
292 
296  private $copyrightUrl;
297 
304  function __construct( IContextSource $context = null ) {
305  if ( $context === null ) {
306  # Extensions should use `new RequestContext` instead of `new OutputPage` now.
307  wfDeprecated( __METHOD__, '1.18' );
308  } else {
309  $this->setContext( $context );
310  }
311  }
312 
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;
323  }
324 
330  public function getRedirect() {
331  return $this->mRedirect;
332  }
333 
342  public function setCopyrightUrl( $url ) {
343  $this->copyrightUrl = $url;
344  }
345 
351  public function setStatusCode( $statusCode ) {
352  $this->mStatusCode = $statusCode;
353  }
354 
362  function addMeta( $name, $val ) {
363  array_push( $this->mMetatags, [ $name, $val ] );
364  }
365 
372  public function getMetaTags() {
373  return $this->mMetatags;
374  }
375 
383  function addLink( array $linkarr ) {
384  array_push( $this->mLinktags, $linkarr );
385  }
386 
393  public function getLinkTags() {
394  return $this->mLinktags;
395  }
396 
404  function addMetadataLink( array $linkarr ) {
405  $linkarr['rel'] = $this->getMetadataAttribute();
406  $this->addLink( $linkarr );
407  }
408 
414  function setCanonicalUrl( $url ) {
415  $this->mCanonicalUrl = $url;
416  }
417 
425  public function getCanonicalUrl() {
426  return $this->mCanonicalUrl;
427  }
428 
434  public function getMetadataAttribute() {
435  # note: buggy CC software only reads first "meta" link
436  static $haveMeta = false;
437  if ( $haveMeta ) {
438  return 'alternate meta';
439  } else {
440  $haveMeta = true;
441  return 'meta';
442  }
443  }
444 
452  function addScript( $script ) {
453  $this->mScripts .= $script;
454  }
455 
465  public function addExtensionStyle( $url ) {
466  wfDeprecated( __METHOD__, '1.27' );
467  array_push( $this->mExtStyles, $url );
468  }
469 
476  function getExtStyle() {
477  wfDeprecated( __METHOD__, '1.27' );
478  return $this->mExtStyles;
479  }
480 
489  public function addScriptFile( $file, $version = null ) {
490  // See if $file parameter is an absolute URL or begins with a slash
491  if ( substr( $file, 0, 1 ) == '/' || preg_match( '#^[a-z]*://#i', $file ) ) {
492  $path = $file;
493  } else {
494  $path = $this->getConfig()->get( 'StylePath' ) . "/common/{$file}";
495  }
496  if ( is_null( $version ) ) {
497  $version = $this->getConfig()->get( 'StyleVersion' );
498  }
499  $this->addScript( Html::linkedScript( wfAppendQuery( $path, $version ) ) );
500  }
501 
508  public function addInlineScript( $script ) {
509  $this->mScripts .= Html::inlineScript( $script );
510  }
511 
520  protected function filterModules( array $modules, $position = null,
522  ) {
524  $filteredModules = [];
525  foreach ( $modules as $val ) {
526  $module = $resourceLoader->getModule( $val );
527  if ( $module instanceof ResourceLoaderModule
528  && $module->getOrigin() <= $this->getAllowedModules( $type )
529  && ( is_null( $position ) || $module->getPosition() == $position )
530  && ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) )
531  ) {
532  $filteredModules[] = $val;
533  }
534  }
535  return $filteredModules;
536  }
537 
546  public function getModules( $filter = false, $position = null, $param = 'mModules',
548  ) {
549  $modules = array_values( array_unique( $this->$param ) );
550  return $filter
551  ? $this->filterModules( $modules, $position, $type )
552  : $modules;
553  }
554 
562  public function addModules( $modules ) {
563  $this->mModules = array_merge( $this->mModules, (array)$modules );
564  }
565 
573  public function getModuleScripts( $filter = false, $position = null ) {
574  return $this->getModules( $filter, $position, 'mModuleScripts',
576  );
577  }
578 
586  public function addModuleScripts( $modules ) {
587  $this->mModuleScripts = array_merge( $this->mModuleScripts, (array)$modules );
588  }
589 
597  public function getModuleStyles( $filter = false, $position = null ) {
598  return $this->getModules( $filter, $position, 'mModuleStyles',
600  );
601  }
602 
612  public function addModuleStyles( $modules ) {
613  $this->mModuleStyles = array_merge( $this->mModuleStyles, (array)$modules );
614  }
615 
619  public function getTarget() {
620  return $this->mTarget;
621  }
622 
628  public function setTarget( $target ) {
629  $this->mTarget = $target;
630  }
631 
637  function getHeadItemsArray() {
638  return $this->mHeadItems;
639  }
640 
653  public function addHeadItem( $name, $value ) {
654  $this->mHeadItems[$name] = $value;
655  }
656 
663  public function addHeadItems( $values ) {
664  $this->mHeadItems = array_merge( $this->mHeadItems, (array)$values );
665  }
666 
673  public function hasHeadItem( $name ) {
674  return isset( $this->mHeadItems[$name] );
675  }
676 
681  public function setETag( $tag ) {
682  }
683 
691  public function setArticleBodyOnly( $only ) {
692  $this->mArticleBodyOnly = $only;
693  }
694 
700  public function getArticleBodyOnly() {
702  }
703 
711  public function setProperty( $name, $value ) {
712  $this->mProperties[$name] = $value;
713  }
714 
722  public function getProperty( $name ) {
723  if ( isset( $this->mProperties[$name] ) ) {
724  return $this->mProperties[$name];
725  } else {
726  return null;
727  }
728  }
729 
741  public function checkLastModified( $timestamp ) {
742  if ( !$timestamp || $timestamp == '19700101000000' ) {
743  wfDebug( __METHOD__ . ": CACHE DISABLED, NO TIMESTAMP\n" );
744  return false;
745  }
746  $config = $this->getConfig();
747  if ( !$config->get( 'CachePages' ) ) {
748  wfDebug( __METHOD__ . ": CACHE DISABLED\n" );
749  return false;
750  }
751 
753  $modifiedTimes = [
754  'page' => $timestamp,
755  'user' => $this->getUser()->getTouched(),
756  'epoch' => $config->get( 'CacheEpoch' )
757  ];
758  if ( $config->get( 'UseSquid' ) ) {
759  // bug 44570: the core page itself may not change, but resources might
760  $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $config->get( 'SquidMaxage' ) );
761  }
762  Hooks::run( 'OutputPageCheckLastModified', [ &$modifiedTimes, $this ] );
763 
764  $maxModified = max( $modifiedTimes );
765  $this->mLastModified = wfTimestamp( TS_RFC2822, $maxModified );
766 
767  $clientHeader = $this->getRequest()->getHeader( 'If-Modified-Since' );
768  if ( $clientHeader === false ) {
769  wfDebug( __METHOD__ . ": client did not send If-Modified-Since header", 'private' );
770  return false;
771  }
772 
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 );
777 
778  MediaWiki\suppressWarnings(); // E_STRICT system time bitching
779  $clientHeaderTime = strtotime( $clientHeader );
780  MediaWiki\restoreWarnings();
781  if ( !$clientHeaderTime ) {
782  wfDebug( __METHOD__
783  . ": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
784  return false;
785  }
786  $clientHeaderTime = wfTimestamp( TS_MW, $clientHeaderTime );
787 
788  # Make debug info
789  $info = '';
790  foreach ( $modifiedTimes as $name => $value ) {
791  if ( $info !== '' ) {
792  $info .= ', ';
793  }
794  $info .= "$name=" . wfTimestamp( TS_ISO_8601, $value );
795  }
796 
797  wfDebug( __METHOD__ . ": client sent If-Modified-Since: " .
798  wfTimestamp( TS_ISO_8601, $clientHeaderTime ), 'private' );
799  wfDebug( __METHOD__ . ": effective Last-Modified: " .
800  wfTimestamp( TS_ISO_8601, $maxModified ), 'private' );
801  if ( $clientHeaderTime < $maxModified ) {
802  wfDebug( __METHOD__ . ": STALE, $info", 'private' );
803  return false;
804  }
805 
806  # Not modified
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 );
811  $this->sendCacheControl();
812  $this->disable();
813 
814  // Don't output a compressed blob when using ob_gzhandler;
815  // it's technically against HTTP spec and seems to confuse
816  // Firefox when the response gets split over two packets.
818 
819  return true;
820  }
821 
828  public function setLastModified( $timestamp ) {
829  $this->mLastModified = wfTimestamp( TS_RFC2822, $timestamp );
830  }
831 
840  public function setRobotPolicy( $policy ) {
841  $policy = Article::formatRobotPolicy( $policy );
842 
843  if ( isset( $policy['index'] ) ) {
844  $this->setIndexPolicy( $policy['index'] );
845  }
846  if ( isset( $policy['follow'] ) ) {
847  $this->setFollowPolicy( $policy['follow'] );
848  }
849  }
850 
858  public function setIndexPolicy( $policy ) {
859  $policy = trim( $policy );
860  if ( in_array( $policy, [ 'index', 'noindex' ] ) ) {
861  $this->mIndexPolicy = $policy;
862  }
863  }
864 
872  public function setFollowPolicy( $policy ) {
873  $policy = trim( $policy );
874  if ( in_array( $policy, [ 'follow', 'nofollow' ] ) ) {
875  $this->mFollowPolicy = $policy;
876  }
877  }
878 
885  public function setPageTitleActionText( $text ) {
886  $this->mPageTitleActionText = $text;
887  }
888 
894  public function getPageTitleActionText() {
896  }
897 
904  public function setHTMLTitle( $name ) {
905  if ( $name instanceof Message ) {
906  $this->mHTMLtitle = $name->setContext( $this->getContext() )->text();
907  } else {
908  $this->mHTMLtitle = $name;
909  }
910  }
911 
917  public function getHTMLTitle() {
918  return $this->mHTMLtitle;
919  }
920 
926  public function setRedirectedFrom( $t ) {
927  $this->mRedirectedFrom = $t;
928  }
929 
940  public function setPageTitle( $name ) {
941  if ( $name instanceof Message ) {
942  $name = $name->setContext( $this->getContext() )->text();
943  }
944 
945  # change "<script>foo&bar</script>" to "&lt;script&gt;foo&amp;bar&lt;/script&gt;"
946  # but leave "<i>foobar</i>" alone
948  $this->mPagetitle = $nameWithTags;
949 
950  # change "<i>foo&amp;bar</i>" to "foo&bar"
951  $this->setHTMLTitle(
952  $this->msg( 'pagetitle' )->rawParams( Sanitizer::stripAllTags( $nameWithTags ) )
953  ->inContentLanguage()
954  );
955  }
956 
962  public function getPageTitle() {
963  return $this->mPagetitle;
964  }
965 
971  public function setTitle( Title $t ) {
972  $this->getContext()->setTitle( $t );
973  }
974 
980  public function setSubtitle( $str ) {
981  $this->clearSubtitle();
982  $this->addSubtitle( $str );
983  }
984 
990  public function addSubtitle( $str ) {
991  if ( $str instanceof Message ) {
992  $this->mSubtitle[] = $str->setContext( $this->getContext() )->parse();
993  } else {
994  $this->mSubtitle[] = $str;
995  }
996  }
997 
1006  public static function buildBacklinkSubtitle( Title $title, $query = [] ) {
1007  if ( $title->isRedirect() ) {
1008  $query['redirect'] = 'no';
1009  }
1010  return wfMessage( 'backlinksubtitle' )
1011  ->rawParams( Linker::link( $title, null, [], $query ) );
1012  }
1013 
1020  public function addBacklinkSubtitle( Title $title, $query = [] ) {
1021  $this->addSubtitle( self::buildBacklinkSubtitle( $title, $query ) );
1022  }
1023 
1027  public function clearSubtitle() {
1028  $this->mSubtitle = [];
1029  }
1030 
1036  public function getSubtitle() {
1037  return implode( "<br />\n\t\t\t\t", $this->mSubtitle );
1038  }
1039 
1044  public function setPrintable() {
1045  $this->mPrintable = true;
1046  }
1047 
1053  public function isPrintable() {
1054  return $this->mPrintable;
1055  }
1056 
1060  public function disable() {
1061  $this->mDoNothing = true;
1062  }
1063 
1069  public function isDisabled() {
1070  return $this->mDoNothing;
1071  }
1072 
1078  public function showNewSectionLink() {
1079  return $this->mNewSectionLink;
1080  }
1081 
1087  public function forceHideNewSectionLink() {
1089  }
1090 
1099  public function setSyndicated( $show = true ) {
1100  if ( $show ) {
1101  $this->setFeedAppendQuery( false );
1102  } else {
1103  $this->mFeedLinks = [];
1104  }
1105  }
1106 
1116  public function setFeedAppendQuery( $val ) {
1117  $this->mFeedLinks = [];
1118 
1119  foreach ( $this->getConfig()->get( 'AdvertisedFeedTypes' ) as $type ) {
1120  $query = "feed=$type";
1121  if ( is_string( $val ) ) {
1122  $query .= '&' . $val;
1123  }
1124  $this->mFeedLinks[$type] = $this->getTitle()->getLocalURL( $query );
1125  }
1126  }
1127 
1134  public function addFeedLink( $format, $href ) {
1135  if ( in_array( $format, $this->getConfig()->get( 'AdvertisedFeedTypes' ) ) ) {
1136  $this->mFeedLinks[$format] = $href;
1137  }
1138  }
1139 
1144  public function isSyndicated() {
1145  return count( $this->mFeedLinks ) > 0;
1146  }
1147 
1152  public function getSyndicationLinks() {
1153  return $this->mFeedLinks;
1154  }
1155 
1161  public function getFeedAppendQuery() {
1163  }
1164 
1172  public function setArticleFlag( $v ) {
1173  $this->mIsarticle = $v;
1174  if ( $v ) {
1175  $this->mIsArticleRelated = $v;
1176  }
1177  }
1178 
1185  public function isArticle() {
1186  return $this->mIsarticle;
1187  }
1188 
1195  public function setArticleRelated( $v ) {
1196  $this->mIsArticleRelated = $v;
1197  if ( !$v ) {
1198  $this->mIsarticle = false;
1199  }
1200  }
1201 
1207  public function isArticleRelated() {
1208  return $this->mIsArticleRelated;
1209  }
1210 
1217  public function addLanguageLinks( array $newLinkArray ) {
1218  $this->mLanguageLinks += $newLinkArray;
1219  }
1220 
1227  public function setLanguageLinks( array $newLinkArray ) {
1228  $this->mLanguageLinks = $newLinkArray;
1229  }
1230 
1236  public function getLanguageLinks() {
1237  return $this->mLanguageLinks;
1238  }
1239 
1245  public function addCategoryLinks( array $categories ) {
1247 
1248  if ( !is_array( $categories ) || count( $categories ) == 0 ) {
1249  return;
1250  }
1251 
1252  # Add the links to a LinkBatch
1253  $arr = [ NS_CATEGORY => $categories ];
1254  $lb = new LinkBatch;
1255  $lb->setArray( $arr );
1256 
1257  # Fetch existence plus the hiddencat property
1258  $dbr = wfGetDB( DB_REPLICA );
1259  $fields = array_merge(
1261  [ 'page_namespace', 'page_title', 'pp_value' ]
1262  );
1263 
1264  $res = $dbr->select( [ 'page', 'page_props' ],
1265  $fields,
1266  $lb->constructSet( 'page', $dbr ),
1267  __METHOD__,
1268  [],
1269  [ 'page_props' => [ 'LEFT JOIN', [
1270  'pp_propname' => 'hiddencat',
1271  'pp_page = page_id'
1272  ] ] ]
1273  );
1274 
1275  # Add the results to the link cache
1276  $lb->addResultToCache( LinkCache::singleton(), $res );
1277 
1278  # Set all the values to 'normal'.
1279  $categories = array_fill_keys( array_keys( $categories ), 'normal' );
1280 
1281  # Mark hidden categories
1282  foreach ( $res as $row ) {
1283  if ( isset( $row->pp_value ) ) {
1284  $categories[$row->page_title] = 'hidden';
1285  }
1286  }
1287 
1288  # Add the remaining categories to the skin
1289  if ( Hooks::run(
1290  'OutputPageMakeCategoryLinks',
1291  [ &$this, $categories, &$this->mCategoryLinks ] )
1292  ) {
1293  foreach ( $categories as $category => $type ) {
1294  // array keys will cast numeric category names to ints, so cast back to string
1295  $category = (string)$category;
1296  $origcategory = $category;
1297  $title = Title::makeTitleSafe( NS_CATEGORY, $category );
1298  if ( !$title ) {
1299  continue;
1300  }
1301  $wgContLang->findVariantLink( $category, $title, true );
1302  if ( $category != $origcategory && array_key_exists( $category, $categories ) ) {
1303  continue;
1304  }
1305  $text = $wgContLang->convertHtml( $title->getText() );
1306  $this->mCategories[] = $title->getText();
1307  $this->mCategoryLinks[$type][] = Linker::link( $title, $text );
1308  }
1309  }
1310  }
1311 
1317  public function setCategoryLinks( array $categories ) {
1318  $this->mCategoryLinks = [];
1319  $this->addCategoryLinks( $categories );
1320  }
1321 
1330  public function getCategoryLinks() {
1331  return $this->mCategoryLinks;
1332  }
1333 
1339  public function getCategories() {
1340  return $this->mCategories;
1341  }
1342 
1352  public function setIndicators( array $indicators ) {
1353  $this->mIndicators = $indicators + $this->mIndicators;
1354  // Keep ordered by key
1355  ksort( $this->mIndicators );
1356  }
1357 
1366  public function getIndicators() {
1367  return $this->mIndicators;
1368  }
1369 
1378  public function addHelpLink( $to, $overrideBaseUrl = false ) {
1379  $this->addModuleStyles( 'mediawiki.helplink' );
1380  $text = $this->msg( 'helppage-top-gethelp' )->escaped();
1381 
1382  if ( $overrideBaseUrl ) {
1383  $helpUrl = $to;
1384  } else {
1385  $toUrlencoded = wfUrlencode( str_replace( ' ', '_', $to ) );
1386  $helpUrl = "//www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded";
1387  }
1388 
1390  'a',
1391  [
1392  'href' => $helpUrl,
1393  'target' => '_blank',
1394  'class' => 'mw-helplink',
1395  ],
1396  $text
1397  );
1398 
1399  $this->setIndicators( [ 'mw-helplink' => $link ] );
1400  }
1401 
1410  public function disallowUserJs() {
1411  $this->reduceAllowedModules(
1414  );
1415 
1416  // Site-wide styles are controlled by a config setting, see bug 71621
1417  // for background on why. User styles are never allowed.
1418  if ( $this->getConfig()->get( 'AllowSiteCSSOnRestrictedPages' ) ) {
1420  } else {
1422  }
1423  $this->reduceAllowedModules(
1425  $styleOrigin
1426  );
1427  }
1428 
1435  public function getAllowedModules( $type ) {
1437  return min( array_values( $this->mAllowedModules ) );
1438  } else {
1439  return isset( $this->mAllowedModules[$type] )
1440  ? $this->mAllowedModules[$type]
1442  }
1443  }
1444 
1454  public function reduceAllowedModules( $type, $level ) {
1455  $this->mAllowedModules[$type] = min( $this->getAllowedModules( $type ), $level );
1456  }
1457 
1463  public function prependHTML( $text ) {
1464  $this->mBodytext = $text . $this->mBodytext;
1465  }
1466 
1472  public function addHTML( $text ) {
1473  $this->mBodytext .= $text;
1474  }
1475 
1485  public function addElement( $element, array $attribs = [], $contents = '' ) {
1486  $this->addHTML( Html::element( $element, $attribs, $contents ) );
1487  }
1488 
1492  public function clearHTML() {
1493  $this->mBodytext = '';
1494  }
1495 
1501  public function getHTML() {
1502  return $this->mBodytext;
1503  }
1504 
1512  public function parserOptions( $options = null ) {
1513  if ( $options !== null && !empty( $options->isBogus ) ) {
1514  // Someone is trying to set a bogus pre-$wgUser PO. Check if it has
1515  // been changed somehow, and keep it if so.
1516  $anonPO = ParserOptions::newFromAnon();
1517  $anonPO->setEditSection( false );
1518  $anonPO->setAllowUnsafeRawHtml( false );
1519  if ( !$options->matches( $anonPO ) ) {
1520  wfLogWarning( __METHOD__ . ': Setting a changed bogus ParserOptions: ' . wfGetAllCallers( 5 ) );
1521  $options->isBogus = false;
1522  }
1523  }
1524 
1525  if ( !$this->mParserOptions ) {
1526  if ( !$this->getContext()->getUser()->isSafeToLoad() ) {
1527  // $wgUser isn't unstubbable yet, so don't try to get a
1528  // ParserOptions for it. And don't cache this ParserOptions
1529  // either.
1531  $po->setEditSection( false );
1532  $po->setAllowUnsafeRawHtml( false );
1533  $po->isBogus = true;
1534  if ( $options !== null ) {
1535  $this->mParserOptions = empty( $options->isBogus ) ? $options : null;
1536  }
1537  return $po;
1538  }
1539 
1540  $this->mParserOptions = ParserOptions::newFromContext( $this->getContext() );
1541  $this->mParserOptions->setEditSection( false );
1542  $this->mParserOptions->setAllowUnsafeRawHtml( false );
1543  }
1544 
1545  if ( $options !== null && !empty( $options->isBogus ) ) {
1546  // They're trying to restore the bogus pre-$wgUser PO. Do the right
1547  // thing.
1548  return wfSetVar( $this->mParserOptions, null, true );
1549  } else {
1550  return wfSetVar( $this->mParserOptions, $options );
1551  }
1552  }
1553 
1561  public function setRevisionId( $revid ) {
1562  $val = is_null( $revid ) ? null : intval( $revid );
1563  return wfSetVar( $this->mRevisionId, $val );
1564  }
1565 
1571  public function getRevisionId() {
1572  return $this->mRevisionId;
1573  }
1574 
1582  public function setRevisionTimestamp( $timestamp ) {
1583  return wfSetVar( $this->mRevisionTimestamp, $timestamp );
1584  }
1585 
1592  public function getRevisionTimestamp() {
1594  }
1595 
1602  public function setFileVersion( $file ) {
1603  $val = null;
1604  if ( $file instanceof File && $file->exists() ) {
1605  $val = [ 'time' => $file->getTimestamp(), 'sha1' => $file->getSha1() ];
1606  }
1607  return wfSetVar( $this->mFileVersion, $val, true );
1608  }
1609 
1615  public function getFileVersion() {
1616  return $this->mFileVersion;
1617  }
1618 
1625  public function getTemplateIds() {
1626  return $this->mTemplateIds;
1627  }
1628 
1635  public function getFileSearchOptions() {
1636  return $this->mImageTimeKeys;
1637  }
1638 
1648  public function addWikiText( $text, $linestart = true, $interface = true ) {
1649  $title = $this->getTitle(); // Work around E_STRICT
1650  if ( !$title ) {
1651  throw new MWException( 'Title is null' );
1652  }
1653  $this->addWikiTextTitle( $text, $title, $linestart, /*tidy*/false, $interface );
1654  }
1655 
1663  public function addWikiTextWithTitle( $text, &$title, $linestart = true ) {
1664  $this->addWikiTextTitle( $text, $title, $linestart );
1665  }
1666 
1674  function addWikiTextTitleTidy( $text, &$title, $linestart = true ) {
1675  $this->addWikiTextTitle( $text, $title, $linestart, true );
1676  }
1677 
1684  public function addWikiTextTidy( $text, $linestart = true ) {
1685  $title = $this->getTitle();
1686  $this->addWikiTextTitleTidy( $text, $title, $linestart );
1687  }
1688 
1699  public function addWikiTextTitle( $text, Title $title, $linestart,
1700  $tidy = false, $interface = false
1701  ) {
1702  global $wgParser;
1703 
1704  $popts = $this->parserOptions();
1705  $oldTidy = $popts->setTidy( $tidy );
1706  $popts->setInterfaceMessage( (bool)$interface );
1707 
1708  $parserOutput = $wgParser->getFreshParser()->parse(
1709  $text, $title, $popts,
1710  $linestart, true, $this->mRevisionId
1711  );
1712 
1713  $popts->setTidy( $oldTidy );
1714 
1715  $this->addParserOutput( $parserOutput );
1716 
1717  }
1718 
1726  wfDeprecated( __METHOD__, '1.24' );
1728  }
1729 
1739  $this->mLanguageLinks += $parserOutput->getLanguageLinks();
1740  $this->addCategoryLinks( $parserOutput->getCategories() );
1741  $this->setIndicators( $parserOutput->getIndicators() );
1742  $this->mNewSectionLink = $parserOutput->getNewSection();
1743  $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
1744 
1745  if ( !$parserOutput->isCacheable() ) {
1746  $this->enableClientCache( false );
1747  }
1748  $this->mNoGallery = $parserOutput->getNoGallery();
1749  $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
1750  $this->addModules( $parserOutput->getModules() );
1751  $this->addModuleScripts( $parserOutput->getModuleScripts() );
1752  $this->addModuleStyles( $parserOutput->getModuleStyles() );
1753  $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
1754  $this->mPreventClickjacking = $this->mPreventClickjacking
1755  || $parserOutput->preventClickjacking();
1756 
1757  // Template versioning...
1758  foreach ( (array)$parserOutput->getTemplateIds() as $ns => $dbks ) {
1759  if ( isset( $this->mTemplateIds[$ns] ) ) {
1760  $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1761  } else {
1762  $this->mTemplateIds[$ns] = $dbks;
1763  }
1764  }
1765  // File versioning...
1766  foreach ( (array)$parserOutput->getFileSearchOptions() as $dbk => $data ) {
1767  $this->mImageTimeKeys[$dbk] = $data;
1768  }
1769 
1770  // Hooks registered in the object
1771  $parserOutputHooks = $this->getConfig()->get( 'ParserOutputHooks' );
1772  foreach ( $parserOutput->getOutputHooks() as $hookInfo ) {
1773  list( $hookName, $data ) = $hookInfo;
1774  if ( isset( $parserOutputHooks[$hookName] ) ) {
1775  call_user_func( $parserOutputHooks[$hookName], $this, $parserOutput, $data );
1776  }
1777  }
1778 
1779  // enable OOUI if requested via ParserOutput
1780  if ( $parserOutput->getEnableOOUI() ) {
1781  $this->enableOOUI();
1782  }
1783 
1784  // Link flags are ignored for now, but may in the future be
1785  // used to mark individual language links.
1786  $linkFlags = [];
1787  Hooks::run( 'LanguageLinks', [ $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ] );
1788  Hooks::run( 'OutputPageParserOutput', [ &$this, $parserOutput ] );
1789  }
1790 
1800 
1801  $this->addModules( $parserOutput->getModules() );
1802  $this->addModuleScripts( $parserOutput->getModuleScripts() );
1803  $this->addModuleStyles( $parserOutput->getModuleStyles() );
1804 
1805  $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
1806  }
1807 
1814  public function addParserOutputText( $parserOutput ) {
1815  $text = $parserOutput->getText();
1816  Hooks::run( 'OutputPageBeforeHTML', [ &$this, &$text ] );
1817  $this->addHTML( $text );
1818  }
1819 
1827  $parserOutput->setTOCEnabled( $this->mEnableTOC );
1828 
1829  // Touch section edit links only if not previously disabled
1830  if ( $parserOutput->getEditSectionTokens() ) {
1831  $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks );
1832  }
1833 
1835  }
1836 
1842  public function addTemplate( &$template ) {
1843  $this->addHTML( $template->getHTML() );
1844  }
1845 
1858  public function parse( $text, $linestart = true, $interface = false, $language = null ) {
1859  global $wgParser;
1860 
1861  if ( is_null( $this->getTitle() ) ) {
1862  throw new MWException( 'Empty $mTitle in ' . __METHOD__ );
1863  }
1864 
1865  $popts = $this->parserOptions();
1866  if ( $interface ) {
1867  $popts->setInterfaceMessage( true );
1868  }
1869  if ( $language !== null ) {
1870  $oldLang = $popts->setTargetLanguage( $language );
1871  }
1872 
1873  $parserOutput = $wgParser->getFreshParser()->parse(
1874  $text, $this->getTitle(), $popts,
1875  $linestart, true, $this->mRevisionId
1876  );
1877 
1878  if ( $interface ) {
1879  $popts->setInterfaceMessage( false );
1880  }
1881  if ( $language !== null ) {
1882  $popts->setTargetLanguage( $oldLang );
1883  }
1884 
1885  return $parserOutput->getText();
1886  }
1887 
1898  public function parseInline( $text, $linestart = true, $interface = false ) {
1899  $parsed = $this->parse( $text, $linestart, $interface );
1900  return Parser::stripOuterParagraph( $parsed );
1901  }
1902 
1907  public function setSquidMaxage( $maxage ) {
1908  $this->setCdnMaxage( $maxage );
1909  }
1910 
1916  public function setCdnMaxage( $maxage ) {
1917  $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
1918  }
1919 
1926  public function lowerCdnMaxage( $maxage ) {
1927  $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
1928  $this->setCdnMaxage( $this->mCdnMaxage );
1929  }
1930 
1944  public function adaptCdnTTL( $mtime, $minTTL = 0, $maxTTL = 0 ) {
1945  $minTTL = $minTTL ?: IExpiringStore::TTL_MINUTE;
1946  $maxTTL = $maxTTL ?: $this->getConfig()->get( 'SquidMaxage' );
1947 
1948  if ( $mtime === null || $mtime === false ) {
1949  return $minTTL; // entity does not exist
1950  }
1951 
1952  $age = time() - wfTimestamp( TS_UNIX, $mtime );
1953  $adaptiveTTL = max( .9 * $age, $minTTL );
1954  $adaptiveTTL = min( $adaptiveTTL, $maxTTL );
1955 
1956  $this->lowerCdnMaxage( (int)$adaptiveTTL );
1957 
1958  return $adaptiveTTL;
1959  }
1960 
1968  public function enableClientCache( $state ) {
1969  return wfSetVar( $this->mEnableClientCache, $state );
1970  }
1971 
1977  function getCacheVaryCookies() {
1978  static $cookies;
1979  if ( $cookies === null ) {
1980  $config = $this->getConfig();
1981  $cookies = array_merge(
1982  SessionManager::singleton()->getVaryCookies(),
1983  [
1984  'forceHTTPS',
1985  ],
1986  $config->get( 'CacheVaryCookies' )
1987  );
1988  Hooks::run( 'GetCacheVaryCookies', [ $this, &$cookies ] );
1989  }
1990  return $cookies;
1991  }
1992 
2000  $request = $this->getRequest();
2001  foreach ( $this->getCacheVaryCookies() as $cookieName ) {
2002  if ( $request->getCookie( $cookieName, '', '' ) !== '' ) {
2003  wfDebug( __METHOD__ . ": found $cookieName\n" );
2004  return true;
2005  }
2006  }
2007  wfDebug( __METHOD__ . ": no cache-varying cookies found\n" );
2008  return false;
2009  }
2010 
2019  public function addVaryHeader( $header, array $option = null ) {
2020  if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
2021  $this->mVaryHeader[$header] = [];
2022  }
2023  if ( !is_array( $option ) ) {
2024  $option = [];
2025  }
2026  $this->mVaryHeader[$header] = array_unique( array_merge( $this->mVaryHeader[$header], $option ) );
2027  }
2028 
2035  public function getVaryHeader() {
2036  // If we vary on cookies, let's make sure it's always included here too.
2037  if ( $this->getCacheVaryCookies() ) {
2038  $this->addVaryHeader( 'Cookie' );
2039  }
2040 
2041  foreach ( SessionManager::singleton()->getVaryHeaders() as $header => $options ) {
2042  $this->addVaryHeader( $header, $options );
2043  }
2044  return 'Vary: ' . implode( ', ', array_keys( $this->mVaryHeader ) );
2045  }
2046 
2052  public function getKeyHeader() {
2053  $cvCookies = $this->getCacheVaryCookies();
2054 
2055  $cookiesOption = [];
2056  foreach ( $cvCookies as $cookieName ) {
2057  $cookiesOption[] = 'param=' . $cookieName;
2058  }
2059  $this->addVaryHeader( 'Cookie', $cookiesOption );
2060 
2061  foreach ( SessionManager::singleton()->getVaryHeaders() as $header => $options ) {
2062  $this->addVaryHeader( $header, $options );
2063  }
2064 
2065  $headers = [];
2066  foreach ( $this->mVaryHeader as $header => $option ) {
2067  $newheader = $header;
2068  if ( is_array( $option ) && count( $option ) > 0 ) {
2069  $newheader .= ';' . implode( ';', $option );
2070  }
2071  $headers[] = $newheader;
2072  }
2073  $key = 'Key: ' . implode( ',', $headers );
2074 
2075  return $key;
2076  }
2077 
2086  function addAcceptLanguage() {
2087  $title = $this->getTitle();
2088  if ( !$title instanceof Title ) {
2089  return;
2090  }
2091 
2092  $lang = $title->getPageLanguage();
2093  if ( !$this->getRequest()->getCheck( 'variant' ) && $lang->hasVariants() ) {
2094  $variants = $lang->getVariants();
2095  $aloption = [];
2096  foreach ( $variants as $variant ) {
2097  if ( $variant === $lang->getCode() ) {
2098  continue;
2099  } else {
2100  $aloption[] = 'substr=' . $variant;
2101 
2102  // IE and some other browsers use BCP 47 standards in
2103  // their Accept-Language header, like "zh-CN" or "zh-Hant".
2104  // We should handle these too.
2105  $variantBCP47 = wfBCP47( $variant );
2106  if ( $variantBCP47 !== $variant ) {
2107  $aloption[] = 'substr=' . $variantBCP47;
2108  }
2109  }
2110  }
2111  $this->addVaryHeader( 'Accept-Language', $aloption );
2112  }
2113  }
2114 
2125  public function preventClickjacking( $enable = true ) {
2126  $this->mPreventClickjacking = $enable;
2127  }
2128 
2134  public function allowClickjacking() {
2135  $this->mPreventClickjacking = false;
2136  }
2137 
2144  public function getPreventClickjacking() {
2146  }
2147 
2155  public function getFrameOptions() {
2156  $config = $this->getConfig();
2157  if ( $config->get( 'BreakFrames' ) ) {
2158  return 'DENY';
2159  } elseif ( $this->mPreventClickjacking && $config->get( 'EditPageFrameOptions' ) ) {
2160  return $config->get( 'EditPageFrameOptions' );
2161  }
2162  return false;
2163  }
2164 
2168  public function sendCacheControl() {
2169  $response = $this->getRequest()->response();
2170  $config = $this->getConfig();
2171 
2172  $this->addVaryHeader( 'Cookie' );
2173  $this->addAcceptLanguage();
2174 
2175  # don't serve compressed data to clients who can't handle it
2176  # maintain different caches for logged-in users and non-logged in ones
2177  $response->header( $this->getVaryHeader() );
2178 
2179  if ( $config->get( 'UseKeyHeader' ) ) {
2180  $response->header( $this->getKeyHeader() );
2181  }
2182 
2183  if ( $this->mEnableClientCache ) {
2184  if (
2185  $config->get( 'UseSquid' ) &&
2186  !$response->hasCookies() &&
2187  !SessionManager::getGlobalSession()->isPersistent() &&
2188  !$this->isPrintable() &&
2189  $this->mCdnMaxage != 0 &&
2190  !$this->haveCacheVaryCookies()
2191  ) {
2192  if ( $config->get( 'UseESI' ) ) {
2193  # We'll purge the proxy cache explicitly, but require end user agents
2194  # to revalidate against the proxy on each visit.
2195  # Surrogate-Control controls our CDN, Cache-Control downstream caches
2196  wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **", 'private' );
2197  # start with a shorter timeout for initial testing
2198  # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
2199  $response->header( 'Surrogate-Control: max-age=' . $config->get( 'SquidMaxage' )
2200  . '+' . $this->mCdnMaxage . ', content="ESI/1.0"' );
2201  $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
2202  } else {
2203  # We'll purge the proxy cache for anons explicitly, but require end user agents
2204  # to revalidate against the proxy on each visit.
2205  # IMPORTANT! The CDN needs to replace the Cache-Control header with
2206  # Cache-Control: s-maxage=0, must-revalidate, max-age=0
2207  wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **", 'private' );
2208  # start with a shorter timeout for initial testing
2209  # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2210  $response->header( 'Cache-Control: s-maxage=' . $this->mCdnMaxage
2211  . ', must-revalidate, max-age=0' );
2212  }
2213  } else {
2214  # We do want clients to cache if they can, but they *must* check for updates
2215  # on revisiting the page.
2216  wfDebug( __METHOD__ . ": private caching; {$this->mLastModified} **", 'private' );
2217  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2218  $response->header( "Cache-Control: private, must-revalidate, max-age=0" );
2219  }
2220  if ( $this->mLastModified ) {
2221  $response->header( "Last-Modified: {$this->mLastModified}" );
2222  }
2223  } else {
2224  wfDebug( __METHOD__ . ": no caching **", 'private' );
2225 
2226  # In general, the absence of a last modified header should be enough to prevent
2227  # the client from using its cache. We send a few other things just to make sure.
2228  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2229  $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2230  $response->header( 'Pragma: no-cache' );
2231  }
2232  }
2233 
2244  public function output( $return = false ) {
2246 
2247  if ( $this->mDoNothing ) {
2248  return $return ? '' : null;
2249  }
2250 
2251  $response = $this->getRequest()->response();
2252  $config = $this->getConfig();
2253 
2254  if ( $this->mRedirect != '' ) {
2255  # Standards require redirect URLs to be absolute
2256  $this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT );
2257 
2258  $redirect = $this->mRedirect;
2260 
2261  if ( Hooks::run( "BeforePageRedirect", [ $this, &$redirect, &$code ] ) ) {
2262  if ( $code == '301' || $code == '303' ) {
2263  if ( !$config->get( 'DebugRedirects' ) ) {
2264  $response->statusHeader( $code );
2265  }
2266  $this->mLastModified = wfTimestamp( TS_RFC2822 );
2267  }
2268  if ( $config->get( 'VaryOnXFP' ) ) {
2269  $this->addVaryHeader( 'X-Forwarded-Proto' );
2270  }
2271  $this->sendCacheControl();
2272 
2273  $response->header( "Content-Type: text/html; charset=utf-8" );
2274  if ( $config->get( 'DebugRedirects' ) ) {
2275  $url = htmlspecialchars( $redirect );
2276  print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2277  print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2278  print "</body>\n</html>\n";
2279  } else {
2280  $response->header( 'Location: ' . $redirect );
2281  }
2282  }
2283 
2284  return $return ? '' : null;
2285  } elseif ( $this->mStatusCode ) {
2286  $response->statusHeader( $this->mStatusCode );
2287  }
2288 
2289  # Buffer output; final headers may depend on later processing
2290  ob_start();
2291 
2292  $response->header( 'Content-type: ' . $config->get( 'MimeType' ) . '; charset=UTF-8' );
2293  $response->header( 'Content-language: ' . $wgContLang->getHtmlCode() );
2294 
2295  // Avoid Internet Explorer "compatibility view" in IE 8-10, so that
2296  // jQuery etc. can work correctly.
2297  $response->header( 'X-UA-Compatible: IE=Edge' );
2298 
2299  // Prevent framing, if requested
2300  $frameOptions = $this->getFrameOptions();
2301  if ( $frameOptions ) {
2302  $response->header( "X-Frame-Options: $frameOptions" );
2303  }
2304 
2305  if ( $this->mArticleBodyOnly ) {
2306  echo $this->mBodytext;
2307  } else {
2308  $sk = $this->getSkin();
2309  // add skin specific modules
2310  $modules = $sk->getDefaultModules();
2311 
2312  // Enforce various default modules for all pages and all skins
2313  $coreModules = [
2314  // Keep this list as small as possible
2315  'site',
2316  'mediawiki.page.startup',
2317  'mediawiki.user',
2318  ];
2319 
2320  // Support for high-density display images if enabled
2321  if ( $config->get( 'ResponsiveImages' ) ) {
2322  $coreModules[] = 'mediawiki.hidpi';
2323  }
2324 
2325  $this->addModules( $coreModules );
2326  foreach ( $modules as $group ) {
2327  $this->addModules( $group );
2328  }
2329  MWDebug::addModules( $this );
2330 
2331  // Hook that allows last minute changes to the output page, e.g.
2332  // adding of CSS or Javascript by extensions.
2333  Hooks::run( 'BeforePageDisplay', [ &$this, &$sk ] );
2334 
2335  try {
2336  $sk->outputPage();
2337  } catch ( Exception $e ) {
2338  ob_end_clean(); // bug T129657
2339  throw $e;
2340  }
2341  }
2342 
2343  try {
2344  // This hook allows last minute changes to final overall output by modifying output buffer
2345  Hooks::run( 'AfterFinalPageOutput', [ $this ] );
2346  } catch ( Exception $e ) {
2347  ob_end_clean(); // bug T129657
2348  throw $e;
2349  }
2350 
2351  $this->sendCacheControl();
2352 
2353  if ( $return ) {
2354  return ob_get_clean();
2355  } else {
2356  ob_end_flush();
2357  return null;
2358  }
2359  }
2360 
2371  public function prepareErrorPage( $pageTitle, $htmlTitle = false ) {
2372  $this->setPageTitle( $pageTitle );
2373  if ( $htmlTitle !== false ) {
2374  $this->setHTMLTitle( $htmlTitle );
2375  }
2376  $this->setRobotPolicy( 'noindex,nofollow' );
2377  $this->setArticleRelated( false );
2378  $this->enableClientCache( false );
2379  $this->mRedirect = '';
2380  $this->clearSubtitle();
2381  $this->clearHTML();
2382  }
2383 
2396  public function showErrorPage( $title, $msg, $params = [] ) {
2397  if ( !$title instanceof Message ) {
2398  $title = $this->msg( $title );
2399  }
2400 
2401  $this->prepareErrorPage( $title );
2402 
2403  if ( $msg instanceof Message ) {
2404  if ( $params !== [] ) {
2405  trigger_error( 'Argument ignored: $params. The message parameters argument '
2406  . 'is discarded when the $msg argument is a Message object instead of '
2407  . 'a string.', E_USER_NOTICE );
2408  }
2409  $this->addHTML( $msg->parseAsBlock() );
2410  } else {
2411  $this->addWikiMsgArray( $msg, $params );
2412  }
2413 
2414  $this->returnToMain();
2415  }
2416 
2423  public function showPermissionsErrorPage( array $errors, $action = null ) {
2424  foreach ( $errors as $key => $error ) {
2425  $errors[$key] = (array)$error;
2426  }
2427 
2428  // For some action (read, edit, create and upload), display a "login to do this action"
2429  // error if all of the following conditions are met:
2430  // 1. the user is not logged in
2431  // 2. the only error is insufficient permissions (i.e. no block or something else)
2432  // 3. the error can be avoided simply by logging in
2433  if ( in_array( $action, [ 'read', 'edit', 'createpage', 'createtalk', 'upload' ] )
2434  && $this->getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2435  && ( $errors[0][0] == 'badaccess-groups' || $errors[0][0] == 'badaccess-group0' )
2436  && ( User::groupHasPermission( 'user', $action )
2437  || User::groupHasPermission( 'autoconfirmed', $action ) )
2438  ) {
2439  $displayReturnto = null;
2440 
2441  # Due to bug 32276, if a user does not have read permissions,
2442  # $this->getTitle() will just give Special:Badtitle, which is
2443  # not especially useful as a returnto parameter. Use the title
2444  # from the request instead, if there was one.
2445  $request = $this->getRequest();
2446  $returnto = Title::newFromText( $request->getVal( 'title', '' ) );
2447  if ( $action == 'edit' ) {
2448  $msg = 'whitelistedittext';
2449  $displayReturnto = $returnto;
2450  } elseif ( $action == 'createpage' || $action == 'createtalk' ) {
2451  $msg = 'nocreatetext';
2452  } elseif ( $action == 'upload' ) {
2453  $msg = 'uploadnologintext';
2454  } else { # Read
2455  $msg = 'loginreqpagetext';
2456  $displayReturnto = Title::newMainPage();
2457  }
2458 
2459  $query = [];
2460 
2461  if ( $returnto ) {
2462  $query['returnto'] = $returnto->getPrefixedText();
2463 
2464  if ( !$request->wasPosted() ) {
2465  $returntoquery = $request->getValues();
2466  unset( $returntoquery['title'] );
2467  unset( $returntoquery['returnto'] );
2468  unset( $returntoquery['returntoquery'] );
2469  $query['returntoquery'] = wfArrayToCgi( $returntoquery );
2470  }
2471  }
2472  $loginLink = Linker::linkKnown(
2473  SpecialPage::getTitleFor( 'Userlogin' ),
2474  $this->msg( 'loginreqlink' )->escaped(),
2475  [],
2476  $query
2477  );
2478 
2479  $this->prepareErrorPage( $this->msg( 'loginreqtitle' ) );
2480  $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->parse() );
2481 
2482  # Don't return to a page the user can't read otherwise
2483  # we'll end up in a pointless loop
2484  if ( $displayReturnto && $displayReturnto->userCan( 'read', $this->getUser() ) ) {
2485  $this->returnToMain( null, $displayReturnto );
2486  }
2487  } else {
2488  $this->prepareErrorPage( $this->msg( 'permissionserrors' ) );
2489  $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
2490  }
2491  }
2492 
2499  public function versionRequired( $version ) {
2500  $this->prepareErrorPage( $this->msg( 'versionrequired', $version ) );
2501 
2502  $this->addWikiMsg( 'versionrequiredtext', $version );
2503  $this->returnToMain();
2504  }
2505 
2513  public function formatPermissionsErrorMessage( array $errors, $action = null ) {
2514  if ( $action == null ) {
2515  $text = $this->msg( 'permissionserrorstext', count( $errors ) )->plain() . "\n\n";
2516  } else {
2517  $action_desc = $this->msg( "action-$action" )->plain();
2518  $text = $this->msg(
2519  'permissionserrorstext-withaction',
2520  count( $errors ),
2521  $action_desc
2522  )->plain() . "\n\n";
2523  }
2524 
2525  if ( count( $errors ) > 1 ) {
2526  $text .= '<ul class="permissions-errors">' . "\n";
2527 
2528  foreach ( $errors as $error ) {
2529  $text .= '<li>';
2530  $text .= call_user_func_array( [ $this, 'msg' ], $error )->plain();
2531  $text .= "</li>\n";
2532  }
2533  $text .= '</ul>';
2534  } else {
2535  $text .= "<div class=\"permissions-errors\">\n" .
2536  call_user_func_array( [ $this, 'msg' ], reset( $errors ) )->plain() .
2537  "\n</div>";
2538  }
2539 
2540  return $text;
2541  }
2542 
2554  public function readOnlyPage() {
2555  if ( func_num_args() > 0 ) {
2556  throw new MWException( __METHOD__ . ' no longer accepts arguments since 1.25.' );
2557  }
2558 
2559  throw new ReadOnlyError;
2560  }
2561 
2568  public function rateLimited() {
2569  wfDeprecated( __METHOD__, '1.25' );
2570  throw new ThrottledError;
2571  }
2572 
2582  public function showLagWarning( $lag ) {
2583  $config = $this->getConfig();
2584  if ( $lag >= $config->get( 'SlaveLagWarning' ) ) {
2585  $lag = floor( $lag ); // floor to avoid nano seconds to display
2586  $message = $lag < $config->get( 'SlaveLagCritical' )
2587  ? 'lag-warn-normal'
2588  : 'lag-warn-high';
2589  $wrap = Html::rawElement( 'div', [ 'class' => "mw-{$message}" ], "\n$1\n" );
2590  $this->wrapWikiMsg( "$wrap\n", [ $message, $this->getLanguage()->formatNum( $lag ) ] );
2591  }
2592  }
2593 
2594  public function showFatalError( $message ) {
2595  $this->prepareErrorPage( $this->msg( 'internalerror' ) );
2596 
2597  $this->addHTML( $message );
2598  }
2599 
2600  public function showUnexpectedValueError( $name, $val ) {
2601  $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() );
2602  }
2603 
2604  public function showFileCopyError( $old, $new ) {
2605  $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() );
2606  }
2607 
2608  public function showFileRenameError( $old, $new ) {
2609  $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() );
2610  }
2611 
2612  public function showFileDeleteError( $name ) {
2613  $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() );
2614  }
2615 
2616  public function showFileNotFoundError( $name ) {
2617  $this->showFatalError( $this->msg( 'filenotfound', $name )->text() );
2618  }
2619 
2628  public function addReturnTo( $title, array $query = [], $text = null, $options = [] ) {
2629  $link = $this->msg( 'returnto' )->rawParams(
2630  Linker::link( $title, $text, [], $query, $options ) )->escaped();
2631  $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
2632  }
2633 
2642  public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
2643  if ( $returnto == null ) {
2644  $returnto = $this->getRequest()->getText( 'returnto' );
2645  }
2646 
2647  if ( $returntoquery == null ) {
2648  $returntoquery = $this->getRequest()->getText( 'returntoquery' );
2649  }
2650 
2651  if ( $returnto === '' ) {
2652  $returnto = Title::newMainPage();
2653  }
2654 
2655  if ( is_object( $returnto ) ) {
2656  $titleObj = $returnto;
2657  } else {
2658  $titleObj = Title::newFromText( $returnto );
2659  }
2660  // We don't want people to return to external interwiki. That
2661  // might potentially be used as part of a phishing scheme
2662  if ( !is_object( $titleObj ) || $titleObj->isExternal() ) {
2663  $titleObj = Title::newMainPage();
2664  }
2665 
2666  $this->addReturnTo( $titleObj, wfCgiToArray( $returntoquery ) );
2667  }
2668 
2669  private function getRlClientContext() {
2670  if ( !$this->rlClientContext ) {
2672  [], // modules; not relevant
2673  $this->getLanguage()->getCode(),
2674  $this->getSkin()->getSkinName(),
2675  $this->getUser()->isLoggedIn() ? $this->getUser()->getName() : null,
2676  null, // version; not relevant
2678  null, // only; not relevant
2679  $this->isPrintable(),
2680  $this->getRequest()->getBool( 'handheld' )
2681  );
2682  $this->rlClientContext = new ResourceLoaderContext(
2683  $this->getResourceLoader(),
2684  new FauxRequest( $query )
2685  );
2686  }
2687  return $this->rlClientContext;
2688  }
2689 
2701  public function getRlClient() {
2702  if ( !$this->rlClient ) {
2703  $context = $this->getRlClientContext();
2704  $rl = $this->getResourceLoader();
2705  $this->addModules( [
2706  'user.options',
2707  'user.tokens',
2708  ] );
2709  $this->addModuleStyles( [
2710  'site.styles',
2711  'noscript',
2712  'user.styles',
2713  'user.cssprefs',
2714  ] );
2715  $this->getSkin()->setupSkinUserCss( $this );
2716 
2717  // Prepare exempt modules for buildExemptModules()
2718  $exemptGroups = [ 'site' => [], 'noscript' => [], 'private' => [], 'user' => [] ];
2719  $exemptStates = [];
2720  $moduleStyles = $this->getModuleStyles( /*filter*/ true );
2721 
2722  // Preload getTitleInfo for isKnownEmpty calls below and in ResourceLoaderClientHtml
2723  // Separate user-specific batch for improved cache-hit ratio.
2724  $userBatch = [ 'user.styles', 'user' ];
2725  $siteBatch = array_diff( $moduleStyles, $userBatch );
2726  $dbr = wfGetDB( DB_REPLICA );
2729 
2730  // Filter out modules handled by buildExemptModules()
2731  $moduleStyles = array_filter( $moduleStyles,
2732  function ( $name ) use ( $rl, $context, &$exemptGroups, &$exemptStates ) {
2733  $module = $rl->getModule( $name );
2734  if ( $module ) {
2735  if ( $name === 'user.styles' && $this->isUserCssPreview() ) {
2736  $exemptStates[$name] = 'ready';
2737  // Special case in buildExemptModules()
2738  return false;
2739  }
2740  $group = $module->getGroup();
2741  if ( isset( $exemptGroups[$group] ) ) {
2742  $exemptStates[$name] = 'ready';
2743  if ( !$module->isKnownEmpty( $context ) ) {
2744  // E.g. Don't output empty <styles>
2745  $exemptGroups[$group][] = $name;
2746  }
2747  return false;
2748  }
2749  }
2750  return true;
2751  }
2752  );
2753  $this->rlExemptStyleModules = $exemptGroups;
2754 
2755  $isUserModuleFiltered = !$this->filterModules( [ 'user' ] );
2756  // If this page filters out 'user', makeResourceLoaderLink will drop it.
2757  // Avoid indefinite "loading" state or untrue "ready" state (T145368).
2758  if ( !$isUserModuleFiltered ) {
2759  // Manually handled by getBottomScripts()
2760  $userModule = $rl->getModule( 'user' );
2761  $userState = $userModule->isKnownEmpty( $context ) && !$this->isUserJsPreview()
2762  ? 'ready'
2763  : 'loading';
2764  $this->rlUserModuleState = $exemptStates['user'] = $userState;
2765  }
2766 
2768  $rlClient->setConfig( $this->getJSVars() );
2769  $rlClient->setModules( $this->getModules( /*filter*/ true ) );
2770  $rlClient->setModuleStyles( $moduleStyles );
2771  $rlClient->setModuleScripts( $this->getModuleScripts( /*filter*/ true ) );
2772  $rlClient->setExemptStates( $exemptStates );
2773  $this->rlClient = $rlClient;
2774  }
2775  return $this->rlClient;
2776  }
2777 
2783  public function headElement( Skin $sk, $includeStyle = true ) {
2785 
2786  $userdir = $this->getLanguage()->getDir();
2787  $sitedir = $wgContLang->getDir();
2788 
2789  $pieces = [];
2791  $this->getRlClient()->getDocumentAttributes(),
2793  ) );
2794  $pieces[] = Html::openElement( 'head' );
2795 
2796  if ( $this->getHTMLTitle() == '' ) {
2797  $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() )->inContentLanguage() );
2798  }
2799 
2800  if ( !Html::isXmlMimeType( $this->getConfig()->get( 'MimeType' ) ) ) {
2801  // Add <meta charset="UTF-8">
2802  // This should be before <title> since it defines the charset used by
2803  // text including the text inside <title>.
2804  // The spec recommends defining XHTML5's charset using the XML declaration
2805  // instead of meta.
2806  // Our XML declaration is output by Html::htmlHeader.
2807  // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
2808  // http://www.whatwg.org/html/semantics.html#charset
2809  $pieces[] = Html::element( 'meta', [ 'charset' => 'UTF-8' ] );
2810  }
2811 
2812  $pieces[] = Html::element( 'title', null, $this->getHTMLTitle() );
2813  $pieces[] = $this->getRlClient()->getHeadHtml();
2814  $pieces[] = $this->buildExemptModules();
2815  $pieces = array_merge( $pieces, array_values( $this->getHeadLinksArray() ) );
2816  $pieces = array_merge( $pieces, array_values( $this->mHeadItems ) );
2817  $pieces[] = Html::closeElement( 'head' );
2818 
2819  $bodyClasses = [];
2820  $bodyClasses[] = 'mediawiki';
2821 
2822  # Classes for LTR/RTL directionality support
2823  $bodyClasses[] = $userdir;
2824  $bodyClasses[] = "sitedir-$sitedir";
2825 
2826  if ( $this->getLanguage()->capitalizeAllNouns() ) {
2827  # A <body> class is probably not the best way to do this . . .
2828  $bodyClasses[] = 'capitalize-all-nouns';
2829  }
2830 
2831  // Parser feature migration class
2832  // The idea is that this will eventually be removed, after the wikitext
2833  // which requires it is cleaned up.
2834  $bodyClasses[] = 'mw-hide-empty-elt';
2835 
2836  $bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
2837  $bodyClasses[] = 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
2838  $bodyClasses[] =
2839  'action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
2840 
2841  $bodyAttrs = [];
2842  // While the implode() is not strictly needed, it's used for backwards compatibility
2843  // (this used to be built as a string and hooks likely still expect that).
2844  $bodyAttrs['class'] = implode( ' ', $bodyClasses );
2845 
2846  // Allow skins and extensions to add body attributes they need
2847  $sk->addToBodyAttributes( $this, $bodyAttrs );
2848  Hooks::run( 'OutputPageBodyAttributes', [ $this, $sk, &$bodyAttrs ] );
2849 
2850  $pieces[] = Html::openElement( 'body', $bodyAttrs );
2851 
2852  return self::combineWrappedStrings( $pieces );
2853  }
2854 
2860  public function getResourceLoader() {
2861  if ( is_null( $this->mResourceLoader ) ) {
2862  $this->mResourceLoader = new ResourceLoader(
2863  $this->getConfig(),
2864  LoggerFactory::getInstance( 'resourceloader' )
2865  );
2866  }
2867  return $this->mResourceLoader;
2868  }
2869 
2878  public function makeResourceLoaderLink( $modules, $only, array $extraQuery = [] ) {
2879  // Apply 'target' and 'origin' filters
2880  $modules = $this->filterModules( (array)$modules, null, $only );
2881 
2883  $this->getRlClientContext(),
2884  $modules,
2885  $only,
2886  $extraQuery
2887  );
2888  }
2889 
2896  protected static function combineWrappedStrings( array $chunks ) {
2897  // Filter out empty values
2898  $chunks = array_filter( $chunks, 'strlen' );
2899  return WrappedString::join( "\n", $chunks );
2900  }
2901 
2902  private function isUserJsPreview() {
2903  return $this->getConfig()->get( 'AllowUserJs' )
2904  && $this->getTitle()
2905  && $this->getTitle()->isJsSubpage()
2906  && $this->userCanPreview();
2907  }
2908 
2909  private function isUserCssPreview() {
2910  return $this->getConfig()->get( 'AllowUserCss' )
2911  && $this->getTitle()
2912  && $this->getTitle()->isCssSubpage()
2913  && $this->userCanPreview();
2914  }
2915 
2922  public function getBottomScripts() {
2923  $chunks = [];
2924  $chunks[] = $this->getRlClient()->getBodyHtml();
2925 
2926  // Legacy non-ResourceLoader scripts
2927  $chunks[] = $this->mScripts;
2928 
2929  // Exempt 'user' module
2930  // - May need excludepages for live preview. (T28283)
2931  // - Must use TYPE_COMBINED so its response is handled by mw.loader.implement() which
2932  // ensures execution is scheduled after the "site" module.
2933  // - Don't load if module state is already resolved as "ready".
2934  if ( $this->rlUserModuleState === 'loading' ) {
2935  if ( $this->isUserJsPreview() ) {
2936  $chunks[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_COMBINED,
2937  [ 'excludepage' => $this->getTitle()->getPrefixedDBkey() ]
2938  );
2940  Xml::encodeJsCall( 'mw.loader.using', [
2941  [ 'user', 'site' ],
2942  new XmlJsCode(
2943  'function () {'
2944  . Xml::encodeJsCall( '$.globalEval', [
2945  $this->getRequest()->getText( 'wpTextbox1' )
2946  ] )
2947  . '}'
2948  )
2949  ] )
2950  );
2951  // FIXME: If the user is previewing, say, ./vector.js, his ./common.js will be loaded
2952  // asynchronously and may arrive *after* the inline script here. So the previewed code
2953  // may execute before ./common.js runs. Normally, ./common.js runs before ./vector.js.
2954  // Similarly, when previewing ./common.js and the user module does arrive first,
2955  // it will arrive without common.js and the inline script runs after.
2956  // Thus running common after the excluded subpage.
2957  } else {
2958  // Load normally
2959  $chunks[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_COMBINED );
2960  }
2961  }
2962 
2963  return self::combineWrappedStrings( $chunks );
2964  }
2965 
2972  public function getJsConfigVars() {
2973  return $this->mJsConfigVars;
2974  }
2975 
2982  public function addJsConfigVars( $keys, $value = null ) {
2983  if ( is_array( $keys ) ) {
2984  foreach ( $keys as $key => $value ) {
2985  $this->mJsConfigVars[$key] = $value;
2986  }
2987  return;
2988  }
2989 
2990  $this->mJsConfigVars[$keys] = $value;
2991  }
2992 
3002  public function getJSVars() {
3004 
3005  $curRevisionId = 0;
3006  $articleId = 0;
3007  $canonicalSpecialPageName = false; # bug 21115
3008 
3009  $title = $this->getTitle();
3010  $ns = $title->getNamespace();
3011  $canonicalNamespace = MWNamespace::exists( $ns )
3013  : $title->getNsText();
3014 
3015  $sk = $this->getSkin();
3016  // Get the relevant title so that AJAX features can use the correct page name
3017  // when making API requests from certain special pages (bug 34972).
3018  $relevantTitle = $sk->getRelevantTitle();
3019  $relevantUser = $sk->getRelevantUser();
3020 
3021  if ( $ns == NS_SPECIAL ) {
3022  list( $canonicalSpecialPageName, /*...*/ ) =
3023  SpecialPageFactory::resolveAlias( $title->getDBkey() );
3024  } elseif ( $this->canUseWikiPage() ) {
3025  $wikiPage = $this->getWikiPage();
3026  $curRevisionId = $wikiPage->getLatest();
3027  $articleId = $wikiPage->getId();
3028  }
3029 
3030  $lang = $title->getPageViewLanguage();
3031 
3032  // Pre-process information
3033  $separatorTransTable = $lang->separatorTransformTable();
3034  $separatorTransTable = $separatorTransTable ? $separatorTransTable : [];
3035  $compactSeparatorTransTable = [
3036  implode( "\t", array_keys( $separatorTransTable ) ),
3037  implode( "\t", $separatorTransTable ),
3038  ];
3039  $digitTransTable = $lang->digitTransformTable();
3040  $digitTransTable = $digitTransTable ? $digitTransTable : [];
3041  $compactDigitTransTable = [
3042  implode( "\t", array_keys( $digitTransTable ) ),
3043  implode( "\t", $digitTransTable ),
3044  ];
3045 
3046  $user = $this->getUser();
3047 
3048  $vars = [
3049  'wgCanonicalNamespace' => $canonicalNamespace,
3050  'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3051  'wgNamespaceNumber' => $title->getNamespace(),
3052  'wgPageName' => $title->getPrefixedDBkey(),
3053  'wgTitle' => $title->getText(),
3054  'wgCurRevisionId' => $curRevisionId,
3055  'wgRevisionId' => (int)$this->getRevisionId(),
3056  'wgArticleId' => $articleId,
3057  'wgIsArticle' => $this->isArticle(),
3058  'wgIsRedirect' => $title->isRedirect(),
3059  'wgAction' => Action::getActionName( $this->getContext() ),
3060  'wgUserName' => $user->isAnon() ? null : $user->getName(),
3061  'wgUserGroups' => $user->getEffectiveGroups(),
3062  'wgCategories' => $this->getCategories(),
3063  'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
3064  'wgPageContentLanguage' => $lang->getCode(),
3065  'wgPageContentModel' => $title->getContentModel(),
3066  'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3067  'wgDigitTransformTable' => $compactDigitTransTable,
3068  'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
3069  'wgMonthNames' => $lang->getMonthNamesArray(),
3070  'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
3071  'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3072  'wgRelevantArticleId' => $relevantTitle->getArticleID(),
3073  'wgRequestId' => WebRequest::getRequestId(),
3074  ];
3075 
3076  if ( $user->isLoggedIn() ) {
3077  $vars['wgUserId'] = $user->getId();
3078  $vars['wgUserEditCount'] = $user->getEditCount();
3079  $userReg = $user->getRegistration();
3080  $vars['wgUserRegistration'] = $userReg ? wfTimestamp( TS_UNIX, $userReg ) * 1000 : null;
3081  // Get the revision ID of the oldest new message on the user's talk
3082  // page. This can be used for constructing new message alerts on
3083  // the client side.
3084  $vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
3085  }
3086 
3087  if ( $wgContLang->hasVariants() ) {
3088  $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
3089  }
3090  // Same test as SkinTemplate
3091  $vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user )
3092  && ( $title->exists() || $title->quickUserCan( 'create', $user ) );
3093 
3094  foreach ( $title->getRestrictionTypes() as $type ) {
3095  $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
3096  }
3097 
3098  if ( $title->isMainPage() ) {
3099  $vars['wgIsMainPage'] = true;
3100  }
3101 
3102  if ( $this->mRedirectedFrom ) {
3103  $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3104  }
3105 
3106  if ( $relevantUser ) {
3107  $vars['wgRelevantUserName'] = $relevantUser->getName();
3108  }
3109 
3110  // Allow extensions to add their custom variables to the mw.config map.
3111  // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
3112  // page-dependant but site-wide (without state).
3113  // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
3114  Hooks::run( 'MakeGlobalVariablesScript', [ &$vars, $this ] );
3115 
3116  // Merge in variables from addJsConfigVars last
3117  return array_merge( $vars, $this->getJsConfigVars() );
3118  }
3119 
3129  public function userCanPreview() {
3130  $request = $this->getRequest();
3131  if (
3132  $request->getVal( 'action' ) !== 'submit' ||
3133  !$request->getCheck( 'wpPreview' ) ||
3134  !$request->wasPosted()
3135  ) {
3136  return false;
3137  }
3138 
3139  $user = $this->getUser();
3140 
3141  if ( !$user->isLoggedIn() ) {
3142  // Anons have predictable edit tokens
3143  return false;
3144  }
3145  if ( !$user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
3146  return false;
3147  }
3148 
3149  $title = $this->getTitle();
3150  if ( !$title->isJsSubpage() && !$title->isCssSubpage() ) {
3151  return false;
3152  }
3153  if ( !$title->isSubpageOf( $user->getUserPage() ) ) {
3154  // Don't execute another user's CSS or JS on preview (T85855)
3155  return false;
3156  }
3157 
3158  $errors = $title->getUserPermissionsErrors( 'edit', $user );
3159  if ( count( $errors ) !== 0 ) {
3160  return false;
3161  }
3162 
3163  return true;
3164  }
3165 
3169  public function getHeadLinksArray() {
3171 
3172  $tags = [];
3173  $config = $this->getConfig();
3174 
3175  $canonicalUrl = $this->mCanonicalUrl;
3176 
3177  $tags['meta-generator'] = Html::element( 'meta', [
3178  'name' => 'generator',
3179  'content' => "MediaWiki $wgVersion",
3180  ] );
3181 
3182  if ( $config->get( 'ReferrerPolicy' ) !== false ) {
3183  $tags['meta-referrer'] = Html::element( 'meta', [
3184  'name' => 'referrer',
3185  'content' => $config->get( 'ReferrerPolicy' )
3186  ] );
3187  }
3188 
3189  $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
3190  if ( $p !== 'index,follow' ) {
3191  // http://www.robotstxt.org/wc/meta-user.html
3192  // Only show if it's different from the default robots policy
3193  $tags['meta-robots'] = Html::element( 'meta', [
3194  'name' => 'robots',
3195  'content' => $p,
3196  ] );
3197  }
3198 
3199  foreach ( $this->mMetatags as $tag ) {
3200  if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) {
3201  $a = 'http-equiv';
3202  $tag[0] = substr( $tag[0], 5 );
3203  } else {
3204  $a = 'name';
3205  }
3206  $tagName = "meta-{$tag[0]}";
3207  if ( isset( $tags[$tagName] ) ) {
3208  $tagName .= $tag[1];
3209  }
3210  $tags[$tagName] = Html::element( 'meta',
3211  [
3212  $a => $tag[0],
3213  'content' => $tag[1]
3214  ]
3215  );
3216  }
3217 
3218  foreach ( $this->mLinktags as $tag ) {
3219  $tags[] = Html::element( 'link', $tag );
3220  }
3221 
3222  # Universal edit button
3223  if ( $config->get( 'UniversalEditButton' ) && $this->isArticleRelated() ) {
3224  $user = $this->getUser();
3225  if ( $this->getTitle()->quickUserCan( 'edit', $user )
3226  && ( $this->getTitle()->exists() ||
3227  $this->getTitle()->quickUserCan( 'create', $user ) )
3228  ) {
3229  // Original UniversalEditButton
3230  $msg = $this->msg( 'edit' )->text();
3231  $tags['universal-edit-button'] = Html::element( 'link', [
3232  'rel' => 'alternate',
3233  'type' => 'application/x-wiki',
3234  'title' => $msg,
3235  'href' => $this->getTitle()->getEditURL(),
3236  ] );
3237  // Alternate edit link
3238  $tags['alternative-edit'] = Html::element( 'link', [
3239  'rel' => 'edit',
3240  'title' => $msg,
3241  'href' => $this->getTitle()->getEditURL(),
3242  ] );
3243  }
3244  }
3245 
3246  # Generally the order of the favicon and apple-touch-icon links
3247  # should not matter, but Konqueror (3.5.9 at least) incorrectly
3248  # uses whichever one appears later in the HTML source. Make sure
3249  # apple-touch-icon is specified first to avoid this.
3250  if ( $config->get( 'AppleTouchIcon' ) !== false ) {
3251  $tags['apple-touch-icon'] = Html::element( 'link', [
3252  'rel' => 'apple-touch-icon',
3253  'href' => $config->get( 'AppleTouchIcon' )
3254  ] );
3255  }
3256 
3257  if ( $config->get( 'Favicon' ) !== false ) {
3258  $tags['favicon'] = Html::element( 'link', [
3259  'rel' => 'shortcut icon',
3260  'href' => $config->get( 'Favicon' )
3261  ] );
3262  }
3263 
3264  # OpenSearch description link
3265  $tags['opensearch'] = Html::element( 'link', [
3266  'rel' => 'search',
3267  'type' => 'application/opensearchdescription+xml',
3268  'href' => wfScript( 'opensearch_desc' ),
3269  'title' => $this->msg( 'opensearch-desc' )->inContentLanguage()->text(),
3270  ] );
3271 
3272  if ( $config->get( 'EnableAPI' ) ) {
3273  # Real Simple Discovery link, provides auto-discovery information
3274  # for the MediaWiki API (and potentially additional custom API
3275  # support such as WordPress or Twitter-compatible APIs for a
3276  # blogging extension, etc)
3277  $tags['rsd'] = Html::element( 'link', [
3278  'rel' => 'EditURI',
3279  'type' => 'application/rsd+xml',
3280  // Output a protocol-relative URL here if $wgServer is protocol-relative.
3281  // Whether RSD accepts relative or protocol-relative URLs is completely
3282  // undocumented, though.
3283  'href' => wfExpandUrl( wfAppendQuery(
3284  wfScript( 'api' ),
3285  [ 'action' => 'rsd' ] ),
3287  ),
3288  ] );
3289  }
3290 
3291  # Language variants
3292  if ( !$config->get( 'DisableLangConversion' ) ) {
3293  $lang = $this->getTitle()->getPageLanguage();
3294  if ( $lang->hasVariants() ) {
3295  $variants = $lang->getVariants();
3296  foreach ( $variants as $variant ) {
3297  $tags["variant-$variant"] = Html::element( 'link', [
3298  'rel' => 'alternate',
3299  'hreflang' => wfBCP47( $variant ),
3300  'href' => $this->getTitle()->getLocalURL(
3301  [ 'variant' => $variant ] )
3302  ]
3303  );
3304  }
3305  # x-default link per https://support.google.com/webmasters/answer/189077?hl=en
3306  $tags["variant-x-default"] = Html::element( 'link', [
3307  'rel' => 'alternate',
3308  'hreflang' => 'x-default',
3309  'href' => $this->getTitle()->getLocalURL() ] );
3310  }
3311  }
3312 
3313  # Copyright
3314  if ( $this->copyrightUrl !== null ) {
3315  $copyright = $this->copyrightUrl;
3316  } else {
3317  $copyright = '';
3318  if ( $config->get( 'RightsPage' ) ) {
3319  $copy = Title::newFromText( $config->get( 'RightsPage' ) );
3320 
3321  if ( $copy ) {
3322  $copyright = $copy->getLocalURL();
3323  }
3324  }
3325 
3326  if ( !$copyright && $config->get( 'RightsUrl' ) ) {
3327  $copyright = $config->get( 'RightsUrl' );
3328  }
3329  }
3330 
3331  if ( $copyright ) {
3332  $tags['copyright'] = Html::element( 'link', [
3333  'rel' => 'copyright',
3334  'href' => $copyright ]
3335  );
3336  }
3337 
3338  # Feeds
3339  if ( $config->get( 'Feed' ) ) {
3340  $feedLinks = [];
3341 
3342  foreach ( $this->getSyndicationLinks() as $format => $link ) {
3343  # Use the page name for the title. In principle, this could
3344  # lead to issues with having the same name for different feeds
3345  # corresponding to the same page, but we can't avoid that at
3346  # this low a level.
3347 
3348  $feedLinks[] = $this->feedLink(
3349  $format,
3350  $link,
3351  # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
3352  $this->msg(
3353  "page-{$format}-feed", $this->getTitle()->getPrefixedText()
3354  )->text()
3355  );
3356  }
3357 
3358  # Recent changes feed should appear on every page (except recentchanges,
3359  # that would be redundant). Put it after the per-page feed to avoid
3360  # changing existing behavior. It's still available, probably via a
3361  # menu in your browser. Some sites might have a different feed they'd
3362  # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3363  # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3364  # If so, use it instead.
3365  $sitename = $config->get( 'Sitename' );
3366  if ( $config->get( 'OverrideSiteFeed' ) ) {
3367  foreach ( $config->get( 'OverrideSiteFeed' ) as $type => $feedUrl ) {
3368  // Note, this->feedLink escapes the url.
3369  $feedLinks[] = $this->feedLink(
3370  $type,
3371  $feedUrl,
3372  $this->msg( "site-{$type}-feed", $sitename )->text()
3373  );
3374  }
3375  } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
3376  $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
3377  foreach ( $config->get( 'AdvertisedFeedTypes' ) as $format ) {
3378  $feedLinks[] = $this->feedLink(
3379  $format,
3380  $rctitle->getLocalURL( [ 'feed' => $format ] ),
3381  # For grep: 'site-rss-feed', 'site-atom-feed'
3382  $this->msg( "site-{$format}-feed", $sitename )->text()
3383  );
3384  }
3385  }
3386 
3387  # Allow extensions to change the list pf feeds. This hook is primarily for changing,
3388  # manipulating or removing existing feed tags. If you want to add new feeds, you should
3389  # use OutputPage::addFeedLink() instead.
3390  Hooks::run( 'AfterBuildFeedLinks', [ &$feedLinks ] );
3391 
3392  $tags += $feedLinks;
3393  }
3394 
3395  # Canonical URL
3396  if ( $config->get( 'EnableCanonicalServerLink' ) ) {
3397  if ( $canonicalUrl !== false ) {
3398  $canonicalUrl = wfExpandUrl( $canonicalUrl, PROTO_CANONICAL );
3399  } else {
3400  if ( $this->isArticleRelated() ) {
3401  // This affects all requests where "setArticleRelated" is true. This is
3402  // typically all requests that show content (query title, curid, oldid, diff),
3403  // and all wikipage actions (edit, delete, purge, info, history etc.).
3404  // It does not apply to File pages and Special pages.
3405  // 'history' and 'info' actions address page metadata rather than the page
3406  // content itself, so they may not be canonicalized to the view page url.
3407  // TODO: this ought to be better encapsulated in the Action class.
3408  $action = Action::getActionName( $this->getContext() );
3409  if ( in_array( $action, [ 'history', 'info' ] ) ) {
3410  $query = "action={$action}";
3411  } else {
3412  $query = '';
3413  }
3414  $canonicalUrl = $this->getTitle()->getCanonicalURL( $query );
3415  } else {
3416  $reqUrl = $this->getRequest()->getRequestURL();
3417  $canonicalUrl = wfExpandUrl( $reqUrl, PROTO_CANONICAL );
3418  }
3419  }
3420  }
3421  if ( $canonicalUrl !== false ) {
3422  $tags[] = Html::element( 'link', [
3423  'rel' => 'canonical',
3424  'href' => $canonicalUrl
3425  ] );
3426  }
3427 
3428  return $tags;
3429  }
3430 
3436  public function getHeadLinks() {
3437  wfDeprecated( __METHOD__, '1.24' );
3438  return implode( "\n", $this->getHeadLinksArray() );
3439  }
3440 
3449  private function feedLink( $type, $url, $text ) {
3450  return Html::element( 'link', [
3451  'rel' => 'alternate',
3452  'type' => "application/$type+xml",
3453  'title' => $text,
3454  'href' => $url ]
3455  );
3456  }
3457 
3467  public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
3468  $options = [];
3469  if ( $media ) {
3470  $options['media'] = $media;
3471  }
3472  if ( $condition ) {
3473  $options['condition'] = $condition;
3474  }
3475  if ( $dir ) {
3476  $options['dir'] = $dir;
3477  }
3478  $this->styles[$style] = $options;
3479  }
3480 
3488  public function addInlineStyle( $style_css, $flip = 'noflip' ) {
3489  if ( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
3490  # If wanted, and the interface is right-to-left, flip the CSS
3491  $style_css = CSSJanus::transform( $style_css, true, false );
3492  }
3493  $this->mInlineStyles .= Html::inlineStyle( $style_css );
3494  }
3495 
3501  protected function buildExemptModules() {
3503 
3505  $chunks = [];
3506  // Things that go after the ResourceLoaderDynamicStyles marker
3507  $append = [];
3508 
3509  // Exempt 'user' styles module (may need 'excludepages' for live preview)
3510  if ( $this->isUserCssPreview() ) {
3511  $append[] = $this->makeResourceLoaderLink(
3512  'user.styles',
3514  [ 'excludepage' => $this->getTitle()->getPrefixedDBkey() ]
3515  );
3516 
3517  // Load the previewed CSS. Janus it if needed.
3518  // User-supplied CSS is assumed to in the wiki's content language.
3519  $previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
3520  if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
3521  $previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
3522  }
3523  $append[] = Html::inlineStyle( $previewedCSS );
3524  }
3525 
3526  // We want site, private and user styles to override dynamically added styles from
3527  // general modules, but we want dynamically added styles to override statically added
3528  // style modules. So the order has to be:
3529  // - page style modules (formatted by ResourceLoaderClientHtml::getHeadHtml())
3530  // - dynamically loaded styles (added by mw.loader before ResourceLoaderDynamicStyles)
3531  // - ResourceLoaderDynamicStyles marker
3532  // - site/private/user styles
3533 
3534  // Add legacy styles added through addStyle()/addInlineStyle() here
3535  $chunks[] = implode( '', $this->buildCssLinksArray() ) . $this->mInlineStyles;
3536 
3537  $chunks[] = Html::element(
3538  'meta',
3539  [ 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ]
3540  );
3541 
3542  foreach ( $this->rlExemptStyleModules as $group => $moduleNames ) {
3543  $chunks[] = $this->makeResourceLoaderLink( $moduleNames,
3545  );
3546  }
3547 
3548  return self::combineWrappedStrings( array_merge( $chunks, $append ) );
3549  }
3550 
3554  public function buildCssLinksArray() {
3555  $links = [];
3556 
3557  // Add any extension CSS
3558  foreach ( $this->mExtStyles as $url ) {
3559  $this->addStyle( $url );
3560  }
3561  $this->mExtStyles = [];
3562 
3563  foreach ( $this->styles as $file => $options ) {
3564  $link = $this->styleLink( $file, $options );
3565  if ( $link ) {
3566  $links[$file] = $link;
3567  }
3568  }
3569  return $links;
3570  }
3571 
3579  protected function styleLink( $style, array $options ) {
3580  if ( isset( $options['dir'] ) ) {
3581  if ( $this->getLanguage()->getDir() != $options['dir'] ) {
3582  return '';
3583  }
3584  }
3585 
3586  if ( isset( $options['media'] ) ) {
3587  $media = self::transformCssMedia( $options['media'] );
3588  if ( is_null( $media ) ) {
3589  return '';
3590  }
3591  } else {
3592  $media = 'all';
3593  }
3594 
3595  if ( substr( $style, 0, 1 ) == '/' ||
3596  substr( $style, 0, 5 ) == 'http:' ||
3597  substr( $style, 0, 6 ) == 'https:' ) {
3598  $url = $style;
3599  } else {
3600  $config = $this->getConfig();
3601  $url = $config->get( 'StylePath' ) . '/' . $style . '?' .
3602  $config->get( 'StyleVersion' );
3603  }
3604 
3605  $link = Html::linkedStyle( $url, $media );
3606 
3607  if ( isset( $options['condition'] ) ) {
3608  $condition = htmlspecialchars( $options['condition'] );
3609  $link = "<!--[if $condition]>$link<![endif]-->";
3610  }
3611  return $link;
3612  }
3613 
3635  public static function transformResourcePath( Config $config, $path ) {
3636  global $IP;
3637  $remotePathPrefix = $config->get( 'ResourceBasePath' );
3638  if ( $remotePathPrefix === '' ) {
3639  // The configured base path is required to be empty string for
3640  // wikis in the domain root
3641  $remotePath = '/';
3642  } else {
3643  $remotePath = $remotePathPrefix;
3644  }
3645  if ( strpos( $path, $remotePath ) !== 0 ) {
3646  // Path is outside wgResourceBasePath, ignore.
3647  return $path;
3648  }
3649  $path = RelPath\getRelativePath( $path, $remotePath );
3650  return self::transformFilePath( $remotePathPrefix, $IP, $path );
3651  }
3652 
3664  public static function transformFilePath( $remotePathPrefix, $localPath, $file ) {
3665  $hash = md5_file( "$localPath/$file" );
3666  if ( $hash === false ) {
3667  wfLogWarning( __METHOD__ . ": Failed to hash $localPath/$file" );
3668  $hash = '';
3669  }
3670  return "$remotePathPrefix/$file?" . substr( $hash, 0, 5 );
3671  }
3672 
3680  public static function transformCssMedia( $media ) {
3682 
3683  // http://www.w3.org/TR/css3-mediaqueries/#syntax
3684  $screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
3685 
3686  // Switch in on-screen display for media testing
3687  $switches = [
3688  'printable' => 'print',
3689  'handheld' => 'handheld',
3690  ];
3691  foreach ( $switches as $switch => $targetMedia ) {
3692  if ( $wgRequest->getBool( $switch ) ) {
3693  if ( $media == $targetMedia ) {
3694  $media = '';
3695  } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3696  /* This regex will not attempt to understand a comma-separated media_query_list
3697  *
3698  * Example supported values for $media:
3699  * 'screen', 'only screen', 'screen and (min-width: 982px)' ),
3700  * Example NOT supported value for $media:
3701  * '3d-glasses, screen, print and resolution > 90dpi'
3702  *
3703  * If it's a print request, we never want any kind of screen stylesheets
3704  * If it's a handheld request (currently the only other choice with a switch),
3705  * we don't want simple 'screen' but we might want screen queries that
3706  * have a max-width or something, so we'll pass all others on and let the
3707  * client do the query.
3708  */
3709  if ( $targetMedia == 'print' || $media == 'screen' ) {
3710  return null;
3711  }
3712  }
3713  }
3714  }
3715 
3716  return $media;
3717  }
3718 
3725  public function addWikiMsg( /*...*/ ) {
3726  $args = func_get_args();
3727  $name = array_shift( $args );
3728  $this->addWikiMsgArray( $name, $args );
3729  }
3730 
3739  public function addWikiMsgArray( $name, $args ) {
3740  $this->addHTML( $this->msg( $name, $args )->parseAsBlock() );
3741  }
3742 
3768  public function wrapWikiMsg( $wrap /*, ...*/ ) {
3769  $msgSpecs = func_get_args();
3770  array_shift( $msgSpecs );
3771  $msgSpecs = array_values( $msgSpecs );
3772  $s = $wrap;
3773  foreach ( $msgSpecs as $n => $spec ) {
3774  if ( is_array( $spec ) ) {
3775  $args = $spec;
3776  $name = array_shift( $args );
3777  if ( isset( $args['options'] ) ) {
3778  unset( $args['options'] );
3779  wfDeprecated(
3780  'Adding "options" to ' . __METHOD__ . ' is no longer supported',
3781  '1.20'
3782  );
3783  }
3784  } else {
3785  $args = [];
3786  $name = $spec;
3787  }
3788  $s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
3789  }
3790  $this->addWikiText( $s );
3791  }
3792 
3798  public function enableTOC( $flag = true ) {
3799  $this->mEnableTOC = $flag;
3800  }
3801 
3806  public function isTOCEnabled() {
3807  return $this->mEnableTOC;
3808  }
3809 
3815  public function enableSectionEditLinks( $flag = true ) {
3816  $this->mEnableSectionEditLinks = $flag;
3817  }
3818 
3823  public function sectionEditLinksEnabled() {
3825  }
3826 
3834  public static function setupOOUI( $skinName = '', $dir = 'ltr' ) {
3835  $themes = ExtensionRegistry::getInstance()->getAttribute( 'SkinOOUIThemes' );
3836  // Make keys (skin names) lowercase for case-insensitive matching.
3837  $themes = array_change_key_case( $themes, CASE_LOWER );
3838  $theme = isset( $themes[$skinName] ) ? $themes[$skinName] : 'MediaWiki';
3839  // For example, 'OOUI\MediaWikiTheme'.
3840  $themeClass = "OOUI\\{$theme}Theme";
3841  OOUI\Theme::setSingleton( new $themeClass() );
3842  OOUI\Element::setDefaultDir( $dir );
3843  }
3844 
3851  public function enableOOUI() {
3852  self::setupOOUI(
3853  strtolower( $this->getSkin()->getSkinName() ),
3854  $this->getLanguage()->getDir()
3855  );
3856  $this->addModuleStyles( [
3857  'oojs-ui-core.styles',
3858  'oojs-ui.styles.icons',
3859  'oojs-ui.styles.indicators',
3860  'oojs-ui.styles.textures',
3861  'mediawiki.widgets.styles',
3862  ] );
3863  }
3864 }
getPreventClickjacking()
Get the prevent-clickjacking flag.
setContext(IContextSource $context)
Set the IContextSource object.
string $rlUserModuleState
Definition: OutputPage.php:157
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 "".
Definition: Html.php:305
showFileRenameError($old, $new)
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
ResourceLoader $mResourceLoader
Definition: OutputPage.php:148
array $rlExemptStyleModules
Definition: OutputPage.php:160
array $mTemplateIds
Definition: OutputPage.php:166
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
Definition: deferred.txt:11
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".
Definition: OutputPage.php:894
getMetadataAttribute()
Get the value of the "rel" attribute for metadata links.
Definition: OutputPage.php:434
getHeadItemsArray()
Get an array of head items.
Definition: OutputPage.php:637
static inlineScript($contents)
Output a "".
Definition: Html.php:612
string null $mTarget
ResourceLoader target for load.php links.
Definition: OutputPage.php:281
getArticleBodyOnly()
Return whether the output will contain only the body of the article.
Definition: OutputPage.php:700
static escapeClass($class)
Given a value, escape it so that it can be used as a CSS class and return it.
Definition: Sanitizer.php:1247
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...
Definition: OutputPage.php:520
string $mPageLinkTitle
Used by skin template.
Definition: OutputPage.php:133
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.
Definition: OutputPage.php:296
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.
Definition: OutputPage.php:351
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:262
this hook is for auditing only $response
Definition: hooks.txt:806
addExtensionStyle($url)
Register and add a stylesheet from an extension directory.
Definition: OutputPage.php:465
static stripAllTags($text)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed, encoded as plain text.
Definition: Sanitizer.php:1823
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
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
Definition: OutputPage.php:244
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
Definition: defines.php:28
array $mLanguageLinks
Array of Interwiki Prefixed (non DB key) Titles (e.g.
Definition: OutputPage.php:116
IContextSource $context
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...
Definition: OutputPage.php:257
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.
Definition: OutputPage.php:276
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.
Definition: OutputPage.php:186
addModules($modules)
Add one or more modules recognized by ResourceLoader.
Definition: OutputPage.php:562
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...
Definition: OutputPage.php:885
bool $mPreventClickjacking
Controls if anti-clickjacking / frame-breaking headers will be sent.
Definition: OutputPage.php:238
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
Definition: defines.php:6
addMetadataLink(array $linkarr)
Add a new \ with "rel" attribute set to "meta".
Definition: OutputPage.php:404
if($line===false) $args
Definition: cdb.php:64
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
Definition: hooks.txt:806
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.
array $mJsConfigVars
Definition: OutputPage.php:163
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
Definition: hooks.txt:2893
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
Definition: hooks.txt:1234
bool $mPrintable
We have to set isPrintable().
Definition: OutputPage.php:86
clearSubtitle()
Clear the subtitles.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:32
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.
Definition: OutputPage.php:80
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?
Definition: OutputPage.php:181
bool $mNoGallery
Comes from the parser.
Definition: OutputPage.php:223
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.
Definition: OutputPage.php:342
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 '/'...
Definition: Html.php:247
$modules
getLanguageLinks()
Get the list of language links.
array $mFileVersion
Definition: OutputPage.php:247
array $mModuleStyles
Definition: OutputPage.php:145
addAcceptLanguage()
T23672: Add Accept-Language to Vary and Key headers if there's no 'variant' parameter existed in GET...
static stripOuterParagraph($html)
Strip outer.
Definition: Parser.php:6057
static groupHasPermission($group, $role)
Check, if the given group has the given permission.
Definition: User.php:4625
static singleton()
Get an instance of this class.
Definition: LinkCache.php:64
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"&lt
getModuleScripts($filter=false, $position=null)
Get the list of module JS to include on this page.
Definition: OutputPage.php:573
if($limit) $timestamp
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
Definition: hooks.txt:1050
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
Definition: hooks.txt:1050
$mFeedLinks
Handles the Atom / RSS links.
Definition: OutputPage.php:204
$res
Definition: database.txt:21
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.
Definition: OutputPage.php:926
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.
Definition: Sanitizer.php:871
getConfig()
Get the Config object.
$mFeedLinksAppendQuery
Definition: OutputPage.php:174
getMetaTags()
Returns the current tags.
Definition: OutputPage.php:372
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.
Definition: OutputPage.php:210
setPageTitle($name)
"Page title" means the contents of \.
Definition: OutputPage.php:940
setRobotPolicy($policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
Definition: OutputPage.php:840
bool $mEnableSectionEditLinks
Whether parser output should contain section edit links.
Definition: OutputPage.php:291
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...
Definition: Xml.php:884
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.
$params
showNewSectionLink()
Show an "add new section" link?
const NS_CATEGORY
Definition: Defines.php:70
Title $mRedirectedFrom
If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redire...
Definition: OutputPage.php:271
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. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00071">OutputPage.php:71</a></div></div> <div class="ttc" id="classOutputPage_html_a3feffe321006a7b9c5eab9ac2c023bb5"><div class="ttname"><a href="classOutputPage.html#a3feffe321006a7b9c5eab9ac2c023bb5">OutputPage\$mHideNewSectionLink</a></div><div class="ttdeci">bool $mHideNewSectionLink</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00216">OutputPage.php:216</a></div></div> <div class="ttc" id="classOutputPage_html_a905182025f38e9304a183457c997e764"><div class="ttname"><a href="classOutputPage.html#a905182025f38e9304a183457c997e764">OutputPage\$mBodytext</a></div><div class="ttdeci">string $mBodytext</div><div class="ttdoc">Contains all of the "<body>" content. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00068">OutputPage.php:68</a></div></div> <div class="ttc" id="time_2defines_8php_html_abfeadc51b922aa4f32f1c5f6a3c2f5f2"><div class="ttname"><a href="time_2defines_8php.html#abfeadc51b922aa4f32f1c5f6a3c2f5f2">TS_MW</a></div><div class="ttdeci">const TS_MW</div><div class="ttdoc">MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS) </div><div class="ttdef"><b>Definition:</b> <a href="time_2defines_8php_source.html#l00011">defines.php:11</a></div></div> <div class="ttc" id="hooks_8txt_html_aba139000bb01a5085f96e2beb07f949b"><div class="ttname"><a href="hooks_8txt.html#aba139000bb01a5085f96e2beb07f949b">$attribs</a></div><div class="ttdeci">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</div><div class="ttdef"><b>Definition:</b> <a href="hooks_8txt_source.html#l01940">hooks.txt:1940</a></div></div> <div class="ttc" id="classTitle_html_acd8c320154e49f2bc750102b2219e55c"><div class="ttname"><a href="classTitle.html#acd8c320154e49f2bc750102b2219e55c">Title\makeTitleSafe</a></div><div class="ttdeci">static makeTitleSafe($ns, $title, $fragment= '', $interwiki= '')</div><div class="ttdoc">Create a new Title from a namespace index and a DB key. </div><div class="ttdef"><b>Definition:</b> <a href="Title_8php_source.html#l00535">Title.php:535</a></div></div> <div class="ttc" id="classOutputPage_html_ad0d7ef039708dd0d3cdc83ad3bd6f23e"><div class="ttname"><a href="classOutputPage.html#ad0d7ef039708dd0d3cdc83ad3bd6f23e">OutputPage\buildCssLinksArray</a></div><div class="ttdeci">buildCssLinksArray()</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l03554">OutputPage.php:3554</a></div></div> <div class="ttc" id="classOutputPage_html_a073ae934e9aaf301f075576157027f51"><div class="ttname"><a href="classOutputPage.html#a073ae934e9aaf301f075576157027f51">OutputPage\getRlClientContext</a></div><div class="ttdeci">getRlClientContext()</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02669">OutputPage.php:2669</a></div></div> <div class="ttc" id="classOutputPage_html_a50507820b7fb637b0f4924f31d98600c"><div class="ttname"><a href="classOutputPage.html#a50507820b7fb637b0f4924f31d98600c">OutputPage\getModuleStyles</a></div><div class="ttdeci">getModuleStyles($filter=false, $position=null)</div><div class="ttdoc">Get the list of module CSS to include on this page. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00597">OutputPage.php:597</a></div></div> <div class="ttc" id="classOutputPage_html_aaa1c0ae62fd0a36703d1736b7ecc8c7c"><div class="ttname"><a href="classOutputPage.html#aaa1c0ae62fd0a36703d1736b7ecc8c7c">OutputPage\parseInline</a></div><div class="ttdeci">parseInline($text, $linestart=true, $interface=false)</div><div class="ttdoc">Parse wikitext, strip paragraphs, and return the HTML. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01898">OutputPage.php:1898</a></div></div> <div class="ttc" id="classOutputPage_html_a0acf51550b84db556540479b7cc4fba5"><div class="ttname"><a href="classOutputPage.html#a0acf51550b84db556540479b7cc4fba5">OutputPage\styleLink</a></div><div class="ttdeci">styleLink($style, array $options)</div><div class="ttdoc">Generate \<link\> tags for stylesheets. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l03579">OutputPage.php:3579</a></div></div> <div class="ttc" id="classResourceLoader_html_a5e720bc042a40216b017b18ccf4af321"><div class="ttname"><a href="classResourceLoader.html#a5e720bc042a40216b017b18ccf4af321">ResourceLoader\makeInlineScript</a></div><div class="ttdeci">static makeInlineScript($script)</div><div class="ttdoc">Construct an inline script tag with given JS code. </div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoader_8php_source.html#l01426">ResourceLoader.php:1426</a></div></div> <div class="ttc" id="classSkin_html_a490d80986a84dc6cc98a9f389bb6f670"><div class="ttname"><a href="classSkin.html#a490d80986a84dc6cc98a9f389bb6f670">Skin\getHtmlElementAttributes</a></div><div class="ttdeci">getHtmlElementAttributes()</div><div class="ttdoc">Return values for <html> element. </div><div class="ttdef"><b>Definition:</b> <a href="Skin_8php_source.html#l00396">Skin.php:396</a></div></div> <div class="ttc" id="GlobalFunctions_8php_html_a8fc068abfbf5ce2e9ac658781b8e8659"><div class="ttname"><a href="GlobalFunctions_8php.html#a8fc068abfbf5ce2e9ac658781b8e8659">wfBCP47</a></div><div class="ttdeci">wfBCP47($code)</div><div class="ttdoc">Get the normalised IETF language tag See unit test for examples. </div><div class="ttdef"><b>Definition:</b> <a href="GlobalFunctions_8php_source.html#l03383">GlobalFunctions.php:3383</a></div></div> <div class="ttc" id="hooks_8txt_html_a82840e2424b6b7e1b1bfe79de4db9b00"><div class="ttname"><a href="hooks_8txt.html#a82840e2424b6b7e1b1bfe79de4db9b00">$title</a></div><div class="ttdeci">namespace and then decline to actually register it file or subcat img or subcat $title</div><div class="ttdef"><b>Definition:</b> <a href="hooks_8txt_source.html#l00957">hooks.txt:957</a></div></div> <div class="ttc" id="classLinker_html_a9d961d811ed0d290a337f992b08fca2e"><div class="ttname"><a href="classLinker.html#a9d961d811ed0d290a337f992b08fca2e">Linker\linkKnown</a></div><div class="ttdeci">static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])</div><div class="ttdoc">Identical to link(), except $options defaults to 'known'. </div><div class="ttdef"><b>Definition:</b> <a href="Linker_8php_source.html#l00255">Linker.php:255</a></div></div> <div class="ttc" id="classMWDebug_html_a3538a8910feb064f85dc40a74ab19ec5"><div class="ttname"><a href="classMWDebug.html#a3538a8910feb064f85dc40a74ab19ec5">MWDebug\addModules</a></div><div class="ttdeci">static addModules(OutputPage $out)</div><div class="ttdoc">Add ResourceLoader modules to the OutputPage object if debugging is enabled. </div><div class="ttdef"><b>Definition:</b> <a href="MWDebug_8php_source.html#l00096">MWDebug.php:96</a></div></div> <div class="ttc" id="classOutputPage_html_a0a5a13c217ca4eed7a88945bd63ec730"><div class="ttname"><a href="classOutputPage.html#a0a5a13c217ca4eed7a88945bd63ec730">OutputPage\addLink</a></div><div class="ttdeci">addLink(array $linkarr)</div><div class="ttdoc">Add a new \<link\> tag to the page header. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00383">OutputPage.php:383</a></div></div> <div class="ttc" id="classOutputPage_html_a7a1e5451f23d157679422576a666912c"><div class="ttname"><a href="classOutputPage.html#a7a1e5451f23d157679422576a666912c">OutputPage\addStyle</a></div><div class="ttdeci">addStyle($style, $media= '', $condition= '', $dir= '')</div><div class="ttdoc">Add a local or specified stylesheet, with the given media options. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l03467">OutputPage.php:3467</a></div></div> <div class="ttc" id="classHtml_html_a7d66939a3f3ee87a5775e6de49939cf5"><div class="ttname"><a href="classHtml.html#a7d66939a3f3ee87a5775e6de49939cf5">Html\inlineStyle</a></div><div class="ttdeci">static inlineStyle($contents, $media= 'all')</div><div class="ttdoc">Output a "<style>" tag with the given contents for the given media type (if any). ...</div><div class="ttdef"><b>Definition:</b> <a href="Html_8php_source.html#l00627">Html.php:627</a></div></div> <div class="ttc" id="classHooks_html_a4d65939e05d81fe900cab2edf720040c"><div class="ttname"><a href="classHooks.html#a4d65939e05d81fe900cab2edf720040c">Hooks\run</a></div><div class="ttdeci">static run($event, array $args=[], $deprecatedVersion=null)</div><div class="ttdoc">Call hook functions defined in Hooks::register and $wgHooks. </div><div class="ttdef"><b>Definition:</b> <a href="Hooks_8php_source.html#l00131">Hooks.php:131</a></div></div> <div class="ttc" id="group__Constants_html_gabdf7fe8fc0c2bc5c556aebeccdd6c230"><div class="ttname"><a href="group__Constants.html#gabdf7fe8fc0c2bc5c556aebeccdd6c230">PROTO_RELATIVE</a></div><div class="ttdeci">const PROTO_RELATIVE</div><div class="ttdef"><b>Definition:</b> <a href="Defines_8php_source.html#l00225">Defines.php:225</a></div></div> <div class="ttc" id="design_8txt_html_aaa89c2ef41e614c0ab4f3149ebafe385"><div class="ttname"><a href="design_8txt.html#aaa89c2ef41e614c0ab4f3149ebafe385">text</a></div><div class="ttdeci">design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text</div><div class="ttdef"><b>Definition:</b> <a href="design_8txt_source.html#l00012">design.txt:12</a></div></div> <div class="ttc" id="classOutputPage_html_af511b1bb037b8e436645fe15d3d3269a"><div class="ttname"><a href="classOutputPage.html#af511b1bb037b8e436645fe15d3d3269a">OutputPage\$mCategories</a></div><div class="ttdeci">array $mCategories</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00110">OutputPage.php:110</a></div></div> <div class="ttc" id="classAction_html_abdc62032f952f5976e6b43b8c6c47cc9"><div class="ttname"><a href="classAction.html#abdc62032f952f5976e6b43b8c6c47cc9">Action\getActionName</a></div><div class="ttdeci">static getActionName(IContextSource $context)</div><div class="ttdoc">Get the action that will be executed, not necessarily the one passed passed through the "action" requ...</div><div class="ttdef"><b>Definition:</b> <a href="Action_8php_source.html#l00122">Action.php:122</a></div></div> <div class="ttc" id="hooks_8txt_html_aa5c3decea0436db81bfd52a0ebcb3c22"><div class="ttname"><a href="hooks_8txt.html#aa5c3decea0436db81bfd52a0ebcb3c22">$tag</a></div><div class="ttdeci">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 $tag</div><div class="ttdef"><b>Definition:</b> <a href="hooks_8txt_source.html#l01011">hooks.txt:1011</a></div></div> <div class="ttc" id="classOutputPage_html_abdbd64e6df0ad5f5691bd0d63e5e32da"><div class="ttname"><a href="classOutputPage.html#abdbd64e6df0ad5f5691bd0d63e5e32da">OutputPage\showFileNotFoundError</a></div><div class="ttdeci">showFileNotFoundError($name)</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02616">OutputPage.php:2616</a></div></div> <div class="ttc" id="updateCredits_8php_html_a4f44601f2b9dc8a1644bce53c94ce622"><div class="ttname"><a href="updateCredits_8php.html#a4f44601f2b9dc8a1644bce53c94ce622">$header</a></div><div class="ttdeci">$header</div><div class="ttdef"><b>Definition:</b> <a href="updateCredits_8php_source.html#l00037">updateCredits.php:37</a></div></div> <div class="ttc" id="classOutputPage_html_a6a3d84be750825d461e862b69f3c0857"><div class="ttname"><a href="classOutputPage.html#a6a3d84be750825d461e862b69f3c0857">OutputPage\setFollowPolicy</a></div><div class="ttdeci">setFollowPolicy($policy)</div><div class="ttdoc">Set the follow policy for the page, but leave the index policy un- touched. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00872">OutputPage.php:872</a></div></div> <div class="ttc" id="classOutputPage_html_a21a60c27ebc894ac4cb14919da84dc20"><div class="ttname"><a href="classOutputPage.html#a21a60c27ebc894ac4cb14919da84dc20">OutputPage\$mNewSectionLink</a></div><div class="ttdeci">bool $mNewSectionLink</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00213">OutputPage.php:213</a></div></div> <div class="ttc" id="classHtml_html_a575ca79447ccfad0975d02a77895e9aa"><div class="ttname"><a href="classHtml.html#a575ca79447ccfad0975d02a77895e9aa">Html\htmlHeader</a></div><div class="ttdeci">static htmlHeader(array $attribs=[])</div><div class="ttdoc">Constructs the opening html-tag with necessary doctypes depending on global variables. </div><div class="ttdef"><b>Definition:</b> <a href="Html_8php_source.html#l00919">Html.php:919</a></div></div> <div class="ttc" id="namespaceFauxRequest_html"><div class="ttname"><a href="namespaceFauxRequest.html">FauxRequest</a></div></div> <div class="ttc" id="classOutputPage_html_a671be7cc33f16ff0eb6c456c20227c6e"><div class="ttname"><a href="classOutputPage.html#a671be7cc33f16ff0eb6c456c20227c6e">OutputPage\$mVaryHeader</a></div><div class="ttdeci">$mVaryHeader</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00261">OutputPage.php:261</a></div></div> <div class="ttc" id="classSkin_html_af826daedb40661be82b88cf839aac9d1"><div class="ttname"><a href="classSkin.html#af826daedb40661be82b88cf839aac9d1">Skin\getPageClasses</a></div><div class="ttdeci">getPageClasses($title)</div><div class="ttdoc">TODO: document. </div><div class="ttdef"><b>Definition:</b> <a href="Skin_8php_source.html#l00368">Skin.php:368</a></div></div> <div class="ttc" id="distributors_8txt_html_a7b0adad6be9193b56d3beaec2672f963"><div class="ttname"><a href="distributors_8txt.html#a7b0adad6be9193b56d3beaec2672f963">as</a></div><div class="ttdeci">This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as</div><div class="ttdef"><b>Definition:</b> <a href="distributors_8txt_source.html#l00009">distributors.txt:9</a></div></div> <div class="ttc" id="classOutputPage_html_aa5e61919db9bcc577162509d3a4ecbad"><div class="ttname"><a href="classOutputPage.html#aa5e61919db9bcc577162509d3a4ecbad">OutputPage\addVaryHeader</a></div><div class="ttdeci">addVaryHeader($header, array $option=null)</div><div class="ttdoc">Add an HTTP header that will influence on the cache. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02019">OutputPage.php:2019</a></div></div> <div class="ttc" id="hooks_8txt_html_aff741ced333f22e57bcc68c2c3adcc7e"><div class="ttname"><a href="hooks_8txt.html#aff741ced333f22e57bcc68c2c3adcc7e">$code</a></div><div class="ttdeci">this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code</div><div class="ttdef"><b>Definition:</b> <a href="hooks_8txt_source.html#l00806">hooks.txt:806</a></div></div> <div class="ttc" id="classOutputPage_html"><div class="ttname"><a href="classOutputPage.html">OutputPage</a></div><div class="ttdoc">This class should be covered by a general architecture document which does not exist as of January 20...</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00043">OutputPage.php:43</a></div></div> <div class="ttc" id="classOutputPage_html_a8035589ca29e2a598e57cf1b4cc56d42"><div class="ttname"><a href="classOutputPage.html#a8035589ca29e2a598e57cf1b4cc56d42">OutputPage\parse</a></div><div class="ttdeci">parse($text, $linestart=true, $interface=false, $language=null)</div><div class="ttdoc">Parse wikitext and return the HTML. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01858">OutputPage.php:1858</a></div></div> <div class="ttc" id="classParserOptions_html_abbb45f7fd3d62e75fdeb1bd96f817abc"><div class="ttname"><a href="classParserOptions.html#abbb45f7fd3d62e75fdeb1bd96f817abc">ParserOptions\newFromAnon</a></div><div class="ttdeci">static newFromAnon()</div><div class="ttdoc">Get a ParserOptions object for an anonymous user. </div><div class="ttdef"><b>Definition:</b> <a href="ParserOptions_8php_source.html#l00693">ParserOptions.php:693</a></div></div> <div class="ttc" id="hooks_8txt_html_a25ba9c89b51c3382b9b86a7a63fd4405"><div class="ttname"><a href="hooks_8txt.html#a25ba9c89b51c3382b9b86a7a63fd4405">$user</a></div><div class="ttdeci">please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user</div><div class="ttdef"><b>Definition:</b> <a href="hooks_8txt_source.html#l00246">hooks.txt:246</a></div></div> <div class="ttc" id="classLinker_html_ad97e40cfea2343c5cae8307cf1fe47a4"><div class="ttname"><a href="classLinker.html#ad97e40cfea2343c5cae8307cf1fe47a4">Linker\link</a></div><div class="ttdeci">static link($target, $html=null, $customAttribs=[], $query=[], $options=[])</div><div class="ttdoc">This function returns an HTML link to the given target. </div><div class="ttdef"><b>Definition:</b> <a href="Linker_8php_source.html#l00203">Linker.php:203</a></div></div> <div class="ttc" id="classOutputPage_html_a5f860e2d3f13ff6790cf164a8127da2d"><div class="ttname"><a href="classOutputPage.html#a5f860e2d3f13ff6790cf164a8127da2d">OutputPage\getFeedAppendQuery</a></div><div class="ttdeci">getFeedAppendQuery()</div><div class="ttdoc">Will currently always return null. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01161">OutputPage.php:1161</a></div></div> <div class="ttc" id="classOutputPage_html_ae6a23b2345a86cf28131f4b4c8de891b"><div class="ttname"><a href="classOutputPage.html#ae6a23b2345a86cf28131f4b4c8de891b">OutputPage\$mCategoryLinks</a></div><div class="ttdeci">array $mCategoryLinks</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00107">OutputPage.php:107</a></div></div> <div class="ttc" id="classLinkCache_html_ad558902be1d6c99f28857c6ad323b1eb"><div class="ttname"><a href="classLinkCache.html#ad558902be1d6c99f28857c6ad323b1eb">LinkCache\getSelectFields</a></div><div class="ttdeci">static getSelectFields()</div><div class="ttdoc">Fields that LinkCache needs to select. </div><div class="ttdef"><b>Definition:</b> <a href="LinkCache_8php_source.html#l00210">LinkCache.php:210</a></div></div> <div class="ttc" id="classOutputPage_html_aed7f95440b43b300d7d5fab3403c1866"><div class="ttname"><a href="classOutputPage.html#aed7f95440b43b300d7d5fab3403c1866">OutputPage\setTarget</a></div><div class="ttdeci">setTarget($target)</div><div class="ttdoc">Sets ResourceLoader target for load.php links. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00628">OutputPage.php:628</a></div></div> <div class="ttc" id="classOutputPage_html_a3b0569a781829829e0875fe5969f6426"><div class="ttname"><a href="classOutputPage.html#a3b0569a781829829e0875fe5969f6426">OutputPage\setTitle</a></div><div class="ttdeci">setTitle(Title $t)</div><div class="ttdoc">Set the Title object to use. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00971">OutputPage.php:971</a></div></div> <div class="ttc" id="classOutputPage_html_ad13e795771bbce676a6841998abb09df"><div class="ttname"><a href="classOutputPage.html#ad13e795771bbce676a6841998abb09df">OutputPage\addBacklinkSubtitle</a></div><div class="ttdeci">addBacklinkSubtitle(Title $title, $query=[])</div><div class="ttdoc">Add a subtitle containing a backlink to a page. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01020">OutputPage.php:1020</a></div></div> <div class="ttc" id="classOutputPage_html_a1275bc698729b5f15e687b7ec49bd611"><div class="ttname"><a href="classOutputPage.html#a1275bc698729b5f15e687b7ec49bd611">OutputPage\$mStatusCode</a></div><div class="ttdeci">int $mStatusCode</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00098">OutputPage.php:98</a></div></div> <div class="ttc" id="classOutputPage_html_a030c036f1938af782222d925b21be9a5"><div class="ttname"><a href="classOutputPage.html#a030c036f1938af782222d925b21be9a5">OutputPage\$mCanonicalUrl</a></div><div class="ttdeci">bool $mCanonicalUrl</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00051">OutputPage.php:51</a></div></div> <div class="ttc" id="classOutputPage_html_a294d125150b7a095cf5529e1fc75fd54"><div class="ttname"><a href="classOutputPage.html#a294d125150b7a095cf5529e1fc75fd54">OutputPage\$mLinktags</a></div><div class="ttdeci">array $mLinktags</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00048">OutputPage.php:48</a></div></div> <div class="ttc" id="classOutputPage_html_a0b492edfed8cf9eafc32580008e26027"><div class="ttname"><a href="classOutputPage.html#a0b492edfed8cf9eafc32580008e26027">OutputPage\addMeta</a></div><div class="ttdeci">addMeta($name, $val)</div><div class="ttdoc">Add a new "<meta>" tag To add an http-equiv meta tag, precede the name with "http:". </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00362">OutputPage.php:362</a></div></div> <div class="ttc" id="classOutputPage_html_add837040d9e9601c9ad7fd4855399b0b"><div class="ttname"><a href="classOutputPage.html#add837040d9e9601c9ad7fd4855399b0b">OutputPage\addLanguageLinks</a></div><div class="ttdeci">addLanguageLinks(array $newLinkArray)</div><div class="ttdoc">Add new language links. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01217">OutputPage.php:1217</a></div></div> <div class="ttc" id="classOutputPage_html_af352fd56bac015bc8277aad6072f5a27"><div class="ttname"><a href="classOutputPage.html#af352fd56bac015bc8277aad6072f5a27">OutputPage\getTarget</a></div><div class="ttdeci">getTarget()</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00619">OutputPage.php:619</a></div></div> <div class="ttc" id="classOutputPage_html_aa98dc63b7217f9ff5cdcb3135782e48b"><div class="ttname"><a href="classOutputPage.html#aa98dc63b7217f9ff5cdcb3135782e48b">OutputPage\addHeadItems</a></div><div class="ttdeci">addHeadItems($values)</div><div class="ttdoc">Add one or more head items to the output. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00663">OutputPage.php:663</a></div></div> <div class="ttc" id="GlobalFunctions_8php_html_a3767c8d03afbee6be3231add01d62ca1"><div class="ttname"><a href="GlobalFunctions_8php.html#a3767c8d03afbee6be3231add01d62ca1">wfGetAllCallers</a></div><div class="ttdeci">wfGetAllCallers($limit=3)</div><div class="ttdoc">Return a string consisting of callers in the stack. </div><div class="ttdef"><b>Definition:</b> <a href="GlobalFunctions_8php_source.html#l01589">GlobalFunctions.php:1589</a></div></div> <div class="ttc" id="classOutputPage_html_ac59084e3de662e92cff290d230b3fdce"><div class="ttname"><a href="classOutputPage.html#ac59084e3de662e92cff290d230b3fdce">OutputPage\$mLastModified</a></div><div class="ttdeci">string $mLastModified</div><div class="ttdoc">Used for sending cache control. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00104">OutputPage.php:104</a></div></div> <div class="ttc" id="injection_8txt_html_a9be135e7ed50352b0681046d2258704d"><div class="ttname"><a href="injection_8txt.html#a9be135e7ed50352b0681046d2258704d">php</a></div><div class="ttdeci">injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php</div><div class="ttdef"><b>Definition:</b> <a href="injection_8txt_source.html#l00035">injection.txt:35</a></div></div> <div class="ttc" id="GlobalFunctions_8php_html_a79db634652da5a2541f9c1c69c73f20f"><div class="ttname"><a href="GlobalFunctions_8php.html#a79db634652da5a2541f9c1c69c73f20f">wfSetVar</a></div><div class="ttdeci">wfSetVar(&$dest, $source, $force=false)</div><div class="ttdoc">Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...</div><div class="ttdef"><b>Definition:</b> <a href="GlobalFunctions_8php_source.html#l01723">GlobalFunctions.php:1723</a></div></div> <div class="ttc" id="classResourceLoaderModule_html_a52bc16ee3a7bd5ab6f9dce699ae0ba04"><div class="ttname"><a href="classResourceLoaderModule.html#a52bc16ee3a7bd5ab6f9dce699ae0ba04">ResourceLoaderModule\TYPE_STYLES</a></div><div class="ttdeci">const TYPE_STYLES</div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoaderModule_8php_source.html#l00036">ResourceLoaderModule.php:36</a></div></div> <div class="ttc" id="classResourceLoader_html_a337cdcaa27834db6a2180bb7a8e5c754"><div class="ttname"><a href="classResourceLoader.html#a337cdcaa27834db6a2180bb7a8e5c754">ResourceLoader\inDebugMode</a></div><div class="ttdeci">static inDebugMode()</div><div class="ttdoc">Determine whether debug mode was requested Order of priority is 1) request param, 2) cookie...</div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoader_8php_source.html#l01481">ResourceLoader.php:1481</a></div></div> <div class="ttc" id="opensearch__desc_8php_html_a3ad3a4240c0f97c7e85aff5c52a454d4"><div class="ttname"><a href="opensearch__desc_8php.html#a3ad3a4240c0f97c7e85aff5c52a454d4">print</a></div><div class="ttdeci">print</div><div class="ttdef"><b>Definition:</b> <a href="opensearch__desc_8php_source.html#l00046">opensearch_desc.php:46</a></div></div> <div class="ttc" id="classOutputPage_html_a3a5bf26cb814f42796b03302c2b1b4ad"><div class="ttname"><a href="classOutputPage.html#a3a5bf26cb814f42796b03302c2b1b4ad">OutputPage\addParserOutputNoText</a></div><div class="ttdeci">addParserOutputNoText($parserOutput)</div><div class="ttdoc">Add a ParserOutput object, but without Html. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01725">OutputPage.php:1725</a></div></div> <div class="ttc" id="group__Constants_html_ga1dfb07ffcecaf8578d3ea3b0784b9a0b"><div class="ttname"><a href="group__Constants.html#ga1dfb07ffcecaf8578d3ea3b0784b9a0b">PROTO_CANONICAL</a></div><div class="ttdeci">const PROTO_CANONICAL</div><div class="ttdef"><b>Definition:</b> <a href="Defines_8php_source.html#l00227">Defines.php:227</a></div></div> <div class="ttc" id="classResourceLoaderModule_html_a5a21480d171b8c5ab7e208c1595496a0"><div class="ttname"><a href="classResourceLoaderModule.html#a5a21480d171b8c5ab7e208c1595496a0">ResourceLoaderModule\TYPE_COMBINED</a></div><div class="ttdeci">const TYPE_COMBINED</div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoaderModule_8php_source.html#l00037">ResourceLoaderModule.php:37</a></div></div> <div class="ttc" id="classOutputPage_html_af89070ecdf543e1e68be7918378ea6b4"><div class="ttname"><a href="classOutputPage.html#af89070ecdf543e1e68be7918378ea6b4">OutputPage\getHeadLinks</a></div><div class="ttdeci">getHeadLinks()</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l03436">OutputPage.php:3436</a></div></div> <div class="ttc" id="classSanitizer_html_a76c20917238c34cb63b7f47377d2baa3"><div class="ttname"><a href="classSanitizer.html#a76c20917238c34cb63b7f47377d2baa3">Sanitizer\removeHTMLtags</a></div><div class="ttdeci">static removeHTMLtags($text, $processCallback=null, $args=[], $extratags=[], $removetags=[], $warnCallback=null)</div><div class="ttdoc">Cleans up HTML, removes dangerous tags and attributes, and removes HTML comments. ...</div><div class="ttdef"><b>Definition:</b> <a href="Sanitizer_8php_source.html#l00462">Sanitizer.php:462</a></div></div> <div class="ttc" id="hooks_8txt_html_a9a91825f641ae063ec98b842676f4510"><div class="ttname"><a href="hooks_8txt.html#a9a91825f641ae063ec98b842676f4510">$request</a></div><div class="ttdeci">error also a ContextSource you ll probably need to make sure the header is varied on $request</div><div class="ttdef"><b>Definition:</b> <a href="hooks_8txt_source.html#l02577">hooks.txt:2577</a></div></div> <div class="ttc" id="classOutputPage_html_a433b8859b4eb6e96f46a9dbb8f5b21ec"><div class="ttname"><a href="classOutputPage.html#a433b8859b4eb6e96f46a9dbb8f5b21ec">OutputPage\$mRevisionId</a></div><div class="ttdeci">int $mRevisionId</div><div class="ttdoc">To include the variable {{REVISIONID}}. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00241">OutputPage.php:241</a></div></div> <div class="ttc" id="classOutputPage_html_af6953b51223474d812a669df88dc9dfd"><div class="ttname"><a href="classOutputPage.html#af6953b51223474d812a669df88dc9dfd">OutputPage\setSquidMaxage</a></div><div class="ttdeci">setSquidMaxage($maxage)</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01907">OutputPage.php:1907</a></div></div> <div class="ttc" id="classOutputPage_html_add6cc41891d878d9067c72b328e1de2f"><div class="ttname"><a href="classOutputPage.html#add6cc41891d878d9067c72b328e1de2f">OutputPage\setRevisionTimestamp</a></div><div class="ttdeci">setRevisionTimestamp($timestamp)</div><div class="ttdoc">Set the timestamp of the revision which will be displayed. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01582">OutputPage.php:1582</a></div></div> <div class="ttc" id="classOutputPage_html_a8a610730ab03ac9c6c711871b7363cbe"><div class="ttname"><a href="classOutputPage.html#a8a610730ab03ac9c6c711871b7363cbe">OutputPage\showFileCopyError</a></div><div class="ttdeci">showFileCopyError($old, $new)</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02604">OutputPage.php:2604</a></div></div> <div class="ttc" id="classOutputPage_html_a1a35b75f40e8ee3e94ba08d1228f853a"><div class="ttname"><a href="classOutputPage.html#a1a35b75f40e8ee3e94ba08d1228f853a">OutputPage\getSyndicationLinks</a></div><div class="ttdeci">getSyndicationLinks()</div><div class="ttdoc">Return URLs for each supported syndication format for this page. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01152">OutputPage.php:1152</a></div></div> <div class="ttc" id="namespaceWrappedString_1_1WrappedString_html"><div class="ttname"><a href="namespaceWrappedString_1_1WrappedString.html">WrappedString</a></div></div> <div class="ttc" id="classOutputPage_html_a6de9ff4af88bdff421144b7c165c05c2"><div class="ttname"><a href="classOutputPage.html#a6de9ff4af88bdff421144b7c165c05c2">OutputPage\versionRequired</a></div><div class="ttdeci">versionRequired($version)</div><div class="ttdoc">Display an error page indicating that a given version of MediaWiki is required to use it...</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02499">OutputPage.php:2499</a></div></div> <div class="ttc" id="classSpecialPageFactory_html_adcf9ed88afa106ddce0dcc7c8a8ef8ea"><div class="ttname"><a href="classSpecialPageFactory.html#adcf9ed88afa106ddce0dcc7c8a8ef8ea">SpecialPageFactory\resolveAlias</a></div><div class="ttdeci">static resolveAlias($alias)</div><div class="ttdoc">Given a special page name with a possible subpage, return an array where the first element is the spe...</div><div class="ttdef"><b>Definition:</b> <a href="SpecialPageFactory_8php_source.html#l00337">SpecialPageFactory.php:337</a></div></div> <div class="ttc" id="classOutputPage_html_a64723d91c439f469a1b4029f9aa4e221"><div class="ttname"><a href="classOutputPage.html#a64723d91c439f469a1b4029f9aa4e221">OutputPage\enableTOC</a></div><div class="ttdeci">enableTOC($flag=true)</div><div class="ttdoc">Enables/disables TOC, doesn't override NOTOC </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l03798">OutputPage.php:3798</a></div></div> <div class="ttc" id="classOutputPage_html_a25ce0e4633bcf074279838b727a67ff0"><div class="ttname"><a href="classOutputPage.html#a25ce0e4633bcf074279838b727a67ff0">OutputPage\transformCssMedia</a></div><div class="ttdeci">static transformCssMedia($media)</div><div class="ttdoc">Transform "media" attribute based on request parameters. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l03680">OutputPage.php:3680</a></div></div> <div class="ttc" id="classSanitizer_html_a7e83e99163ef9b2640ea5dbe82841a77"><div class="ttname"><a href="classSanitizer.html#a7e83e99163ef9b2640ea5dbe82841a77">Sanitizer\normalizeCharReferences</a></div><div class="ttdeci">static normalizeCharReferences($text)</div><div class="ttdoc">Ensure that any entities and character references are legal for XML and XHTML specifically. </div><div class="ttdef"><b>Definition:</b> <a href="Sanitizer_8php_source.html#l01400">Sanitizer.php:1400</a></div></div> <div class="ttc" id="classOutputPage_html_a2670a987a71116a9da67e0fff5aadc9b"><div class="ttname"><a href="classOutputPage.html#a2670a987a71116a9da67e0fff5aadc9b">OutputPage\setArticleBodyOnly</a></div><div class="ttdeci">setArticleBodyOnly($only)</div><div class="ttdoc">Set whether the output should only contain the body of the article, without any skin, sidebar, etc. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00691">OutputPage.php:691</a></div></div> <div class="ttc" id="classOutputPage_html_ad3c1c4a4229f4c06f5eaaa0fa7e6d5be"><div class="ttname"><a href="classOutputPage.html#ad3c1c4a4229f4c06f5eaaa0fa7e6d5be">OutputPage\getProperty</a></div><div class="ttdeci">getProperty($name)</div><div class="ttdoc">Get an additional output property. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00722">OutputPage.php:722</a></div></div> <div class="ttc" id="classOutputPage_html_ad37dc926166096712154a6e2e3ca33d8"><div class="ttname"><a href="classOutputPage.html#ad37dc926166096712154a6e2e3ca33d8">OutputPage\addHeadItem</a></div><div class="ttdeci">addHeadItem($name, $value)</div><div class="ttdoc">Add or replace a head item to the output. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00653">OutputPage.php:653</a></div></div> <div class="ttc" id="classHtml_html_ada5267488ca8c4f1965d3539944059e5"><div class="ttname"><a href="classHtml.html#ada5267488ca8c4f1965d3539944059e5">Html\isXmlMimeType</a></div><div class="ttdeci">static isXmlMimeType($mimetype)</div><div class="ttdoc">Determines if the given MIME type is xml. </div><div class="ttdef"><b>Definition:</b> <a href="Html_8php_source.html#l00958">Html.php:958</a></div></div> <div class="ttc" id="classFile_html_a4487966efdadb09d367edeb6fe08a9c3"><div class="ttname"><a href="classFile.html#a4487966efdadb09d367edeb6fe08a9c3">File\exists</a></div><div class="ttdeci">exists()</div><div class="ttdoc">Returns true if file exists in the repository. </div><div class="ttdef"><b>Definition:</b> <a href="File_8php_source.html#l00876">File.php:876</a></div></div> <div class="ttc" id="GlobalFunctions_8php_html_aa1d453df706a70f66abdf47b6c0a221c"><div class="ttname"><a href="GlobalFunctions_8php.html#aa1d453df706a70f66abdf47b6c0a221c">wfArrayToCgi</a></div><div class="ttdeci">wfArrayToCgi($array1, $array2=null, $prefix= '')</div><div class="ttdoc">This function takes one or two arrays as input, and returns a CGI-style string, e.g. </div><div class="ttdef"><b>Definition:</b> <a href="GlobalFunctions_8php_source.html#l00406">GlobalFunctions.php:406</a></div></div> <div class="ttc" id="classOutputPage_html_ae3443d128fef247f051519ab4c4a7f6a"><div class="ttname"><a href="classOutputPage.html#ae3443d128fef247f051519ab4c4a7f6a">OutputPage\$mRedirectCode</a></div><div class="ttdeci">string $mRedirectCode</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00172">OutputPage.php:172</a></div></div> <div class="ttc" id="classOutputPage_html_a6c81739da3b9bc50554a7eda0e3ab042"><div class="ttname"><a href="classOutputPage.html#a6c81739da3b9bc50554a7eda0e3ab042">OutputPage\__construct</a></div><div class="ttdeci">__construct(IContextSource $context=null)</div><div class="ttdoc">Constructor for OutputPage. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00304">OutputPage.php:304</a></div></div> <div class="ttc" id="classOutputPage_html_a195b2f7c4021cadc450bf99fc20fb378"><div class="ttname"><a href="classOutputPage.html#a195b2f7c4021cadc450bf99fc20fb378">OutputPage\$mImageTimeKeys</a></div><div class="ttdeci">array $mImageTimeKeys</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00169">OutputPage.php:169</a></div></div> <div class="ttc" id="classOutputPage_html_a9585cc35248eda7efe8a8792ecf248dc"><div class="ttname"><a href="classOutputPage.html#a9585cc35248eda7efe8a8792ecf248dc">OutputPage\getResourceLoader</a></div><div class="ttdeci">getResourceLoader()</div><div class="ttdoc">Get a ResourceLoader object associated with this OutputPage. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02860">OutputPage.php:2860</a></div></div> <div class="ttc" id="classOutputPage_html_acaa0afb71bf33d0aa188407794516c70"><div class="ttname"><a href="classOutputPage.html#acaa0afb71bf33d0aa188407794516c70">OutputPage\getRevisionId</a></div><div class="ttdeci">getRevisionId()</div><div class="ttdoc">Get the displayed revision ID. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01571">OutputPage.php:1571</a></div></div> <div class="ttc" id="classOutputPage_html_a25af79e53d58536bd343061ecc5398b7"><div class="ttname"><a href="classOutputPage.html#a25af79e53d58536bd343061ecc5398b7">OutputPage\setupOOUI</a></div><div class="ttdeci">static setupOOUI($skinName= '', $dir= 'ltr')</div><div class="ttdoc">Helper function to setup the PHP implementation of OOUI to use in this request. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l03834">OutputPage.php:3834</a></div></div> <div class="ttc" id="GlobalFunctions_8php_html_aa7ec0fc303580abed6ac798349db580c"><div class="ttname"><a href="GlobalFunctions_8php.html#aa7ec0fc303580abed6ac798349db580c">wfClearOutputBuffers</a></div><div class="ttdeci">wfClearOutputBuffers()</div><div class="ttdoc">More legible than passing a 'false' parameter to wfResetOutputBuffers(): </div><div class="ttdef"><b>Definition:</b> <a href="GlobalFunctions_8php_source.html#l01865">GlobalFunctions.php:1865</a></div></div> <div class="ttc" id="classOutputPage_html_a3e3c33a8aeff2ca5c1f48d97605259e7"><div class="ttname"><a href="classOutputPage.html#a3e3c33a8aeff2ca5c1f48d97605259e7">OutputPage\getFileVersion</a></div><div class="ttdeci">getFileVersion()</div><div class="ttdoc">Get the displayed file version. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01615">OutputPage.php:1615</a></div></div> <div class="ttc" id="design_8txt_html_a151e6372335f583233d859073a2aa100"><div class="ttname"><a href="design_8txt.html#a151e6372335f583233d859073a2aa100">$wgContLang</a></div><div class="ttdeci">this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang</div><div class="ttdef"><b>Definition:</b> <a href="design_8txt_source.html#l00056">design.txt:56</a></div></div> <div class="ttc" id="classOutputPage_html_afb8cc09f33554842914ddeb78639aeed"><div class="ttname"><a href="classOutputPage.html#afb8cc09f33554842914ddeb78639aeed">OutputPage\setIndexPolicy</a></div><div class="ttdeci">setIndexPolicy($policy)</div><div class="ttdoc">Set the index policy for the page, but leave the follow policy un- touched. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00858">OutputPage.php:858</a></div></div> <div class="ttc" id="classOutputPage_html_a2b5e49a97e61d2fee5c92c9524bf92ca"><div class="ttname"><a href="classOutputPage.html#a2b5e49a97e61d2fee5c92c9524bf92ca">OutputPage\setProperty</a></div><div class="ttdeci">setProperty($name, $value)</div><div class="ttdoc">Set an additional output property. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00711">OutputPage.php:711</a></div></div> <div class="ttc" id="classResourceLoaderClientHtml_html_af17b9b3a9e70f8f456c0eaffd5389411"><div class="ttname"><a href="classResourceLoaderClientHtml.html#af17b9b3a9e70f8f456c0eaffd5389411">ResourceLoaderClientHtml\makeLoad</a></div><div class="ttdeci">static makeLoad(ResourceLoaderContext $mainContext, array $modules, $only, array $extraQuery=[])</div><div class="ttdoc">Explicily load or embed modules on a page. </div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoaderClientHtml_8php_source.html#l00401">ResourceLoaderClientHtml.php:401</a></div></div> <div class="ttc" id="classOutputPage_html_acec518bad61fc88f0c3deca963d855d8"><div class="ttname"><a href="classOutputPage.html#acec518bad61fc88f0c3deca963d855d8">OutputPage\forceHideNewSectionLink</a></div><div class="ttdeci">forceHideNewSectionLink()</div><div class="ttdoc">Forcibly hide the new section link? </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01087">OutputPage.php:1087</a></div></div> <div class="ttc" id="logger_8txt_html_a2d4dcfb81a3319f223f49e727b603cd8"><div class="ttname"><a href="logger_8txt.html#a2d4dcfb81a3319f223f49e727b603cd8">LoggerFactory</a></div><div class="ttdeci">MediaWiki Logger LoggerFactory implements a PSR[0] compatible message logging system Named Psr Log LoggerInterface instances can be obtained from the MediaWiki Logger LoggerFactory::getInstance() static method.MediaWiki\Logger\LoggerFactory expects a class implementing the MediaWiki\Logger\Spi interface to act as a factory for new Psr\Log\LoggerInterface instances.The"Spi"in MediaWiki\Logger\Spi stands for"service provider interface".An SPI is an API intended to be implemented or extended by a third party.This software design pattern is intended to enable framework extension and replaceable components.It is specifically used in the MediaWiki\Logger\LoggerFactory service to allow alternate PSR-3 logging implementations to be easily integrated with MediaWiki.The service provider interface allows the backend logging library to be implemented in multiple ways.The $wgMWLoggerDefaultSpi global provides the classname of the default MediaWiki\Logger\Spi implementation to be loaded at runtime.This can either be the name of a class implementing the MediaWiki\Logger\Spi with a zero argument const ructor or a callable that will return an MediaWiki\Logger\Spi instance.Alternately the MediaWiki\Logger\LoggerFactory MediaWiki Logger LoggerFactory</div><div class="ttdef"><b>Definition:</b> <a href="logger_8txt_source.html#l00005">logger.txt:5</a></div></div> <div class="ttc" id="classOutputPage_html_ac5edd2167a9f85e4d2257af9662652d2"><div class="ttname"><a href="classOutputPage.html#ac5edd2167a9f85e4d2257af9662652d2">OutputPage\wrapWikiMsg</a></div><div class="ttdeci">wrapWikiMsg($wrap)</div><div class="ttdoc">This function takes a number of message/argument specifications, wraps them in some overall structure...</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l03768">OutputPage.php:3768</a></div></div> <div class="ttc" id="classResourceLoaderClientHtml_html_a429dc77e37d85ff3a0ab60b2732c155f"><div class="ttname"><a href="classResourceLoaderClientHtml.html#a429dc77e37d85ff3a0ab60b2732c155f">ResourceLoaderClientHtml\setModuleScripts</a></div><div class="ttdeci">setModuleScripts(array $modules)</div><div class="ttdoc">Ensure the scripts of one or more modules are loaded. </div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoaderClientHtml_8php_source.html#l00103">ResourceLoaderClientHtml.php:103</a></div></div> <div class="ttc" id="classOutputPage_html_a1dbd46a260249138845ccb6bce086090"><div class="ttname"><a href="classOutputPage.html#a1dbd46a260249138845ccb6bce086090">OutputPage\$mIsarticle</a></div><div class="ttdeci">bool $mIsarticle</div><div class="ttdoc">Is the displayed content related to the source of the corresponding wiki article. ...</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00077">OutputPage.php:77</a></div></div> <div class="ttc" id="namespaceConfig_html"><div class="ttname"><a href="namespaceConfig.html">Config</a></div></div> <div class="ttc" id="classOutputPage_html_aebd9a6e15140d9129190b3143baa4fdf"><div class="ttname"><a href="classOutputPage.html#aebd9a6e15140d9129190b3143baa4fdf">OutputPage\getBottomScripts</a></div><div class="ttdeci">getBottomScripts()</div><div class="ttdoc">JS stuff to put at the bottom of the <body>. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02922">OutputPage.php:2922</a></div></div> <div class="ttc" id="classOutputPage_html_a0f8a850bc9376a121f746edd3f90351f"><div class="ttname"><a href="classOutputPage.html#a0f8a850bc9376a121f746edd3f90351f">OutputPage\setFileVersion</a></div><div class="ttdeci">setFileVersion($file)</div><div class="ttdoc">Set the displayed file version. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01602">OutputPage.php:1602</a></div></div> <div class="ttc" id="classOutputPage_html_a32357beb62615652b97f2c416d805715"><div class="ttname"><a href="classOutputPage.html#a32357beb62615652b97f2c416d805715">OutputPage\getRedirect</a></div><div class="ttdeci">getRedirect()</div><div class="ttdoc">Get the URL to redirect to, or an empty string if not redirect URL set. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00330">OutputPage.php:330</a></div></div> <div class="ttc" id="classOutputPage_html_a73bd96a7dfd5ee922f734f5874caaf19"><div class="ttname"><a href="classOutputPage.html#a73bd96a7dfd5ee922f734f5874caaf19">OutputPage\addReturnTo</a></div><div class="ttdeci">addReturnTo($title, array $query=[], $text=null, $options=[])</div><div class="ttdoc">Add a "return to" link pointing to a specified title. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02628">OutputPage.php:2628</a></div></div> <div class="ttc" id="classResourceLoader_html_a15b0fb203d740d80f7a8d9aa1996e052"><div class="ttname"><a href="classResourceLoader.html#a15b0fb203d740d80f7a8d9aa1996e052">ResourceLoader\makeLoaderQuery</a></div><div class="ttdeci">static makeLoaderQuery($modules, $lang, $skin, $user=null, $version=null, $debug=false, $only=null, $printable=false, $handheld=false, $extraQuery=[])</div><div class="ttdoc">Build a query array (array representation of query string) for load.php. </div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoader_8php_source.html#l01561">ResourceLoader.php:1561</a></div></div> <div class="ttc" id="classOutputPage_html_ad836d88e679e1812c4a3d501377e5963"><div class="ttname"><a href="classOutputPage.html#ad836d88e679e1812c4a3d501377e5963">OutputPage\$mIndexPolicy</a></div><div class="ttdeci">$mIndexPolicy</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00259">OutputPage.php:259</a></div></div> <div class="ttc" id="classOutputPage_html_a8a195beaa4f23a362fc942b107d5a1a9"><div class="ttname"><a href="classOutputPage.html#a8a195beaa4f23a362fc942b107d5a1a9">OutputPage\setRevisionId</a></div><div class="ttdeci">setRevisionId($revid)</div><div class="ttdoc">Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISION...</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01561">OutputPage.php:1561</a></div></div> <div class="ttc" id="classOutputPage_html_af0ba3170ef41dfefee04683f704944d8"><div class="ttname"><a href="classOutputPage.html#af0ba3170ef41dfefee04683f704944d8">OutputPage\getKeyHeader</a></div><div class="ttdeci">getKeyHeader()</div><div class="ttdoc">Get a complete Key header. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02052">OutputPage.php:2052</a></div></div> <div class="ttc" id="classOutputPage_html_a4ef483d1cf4a9deccbae3de6b7ee5670"><div class="ttname"><a href="classOutputPage.html#a4ef483d1cf4a9deccbae3de6b7ee5670">OutputPage\output</a></div><div class="ttdeci">output($return=false)</div><div class="ttdoc">Finally, all the text has been munged and accumulated into the object, let's actually output it: ...</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02244">OutputPage.php:2244</a></div></div> <div class="ttc" id="rdbms_2defines_8php_html_a3f7dbdc9e22b2fa86ee6d63452072534"><div class="ttname"><a href="rdbms_2defines_8php.html#a3f7dbdc9e22b2fa86ee6d63452072534">DB_REPLICA</a></div><div class="ttdeci">const DB_REPLICA</div><div class="ttdef"><b>Definition:</b> <a href="rdbms_2defines_8php_source.html#l00022">defines.php:22</a></div></div> <div class="ttc" id="classLinkBatch_html_af729dcb9268abd17b2948550ce3a21b9"><div class="ttname"><a href="classLinkBatch.html#af729dcb9268abd17b2948550ce3a21b9">LinkBatch\setArray</a></div><div class="ttdeci">setArray($array)</div><div class="ttdoc">Set the link list to a given 2-d array First key is the namespace, second is the DB key...</div><div class="ttdef"><b>Definition:</b> <a href="LinkBatch_8php_source.html#l00096">LinkBatch.php:96</a></div></div> <div class="ttc" id="classOutputPage_html_aaaed566db54e8402875b9c83facb64c8"><div class="ttname"><a href="classOutputPage.html#aaaed566db54e8402875b9c83facb64c8">OutputPage\showUnexpectedValueError</a></div><div class="ttdeci">showUnexpectedValueError($name, $val)</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02600">OutputPage.php:2600</a></div></div> <div class="ttc" id="GlobalFunctions_8php_html_ad0015ddead36d67a7eedcd20edb3474b"><div class="ttname"><a href="GlobalFunctions_8php.html#ad0015ddead36d67a7eedcd20edb3474b">wfLogWarning</a></div><div class="ttdeci">wfLogWarning($msg, $callerOffset=1, $level=E_USER_WARNING)</div><div class="ttdoc">Send a warning as a PHP error and the debug log. </div><div class="ttdef"><b>Definition:</b> <a href="GlobalFunctions_8php_source.html#l01153">GlobalFunctions.php:1153</a></div></div> <div class="ttc" id="classOutputPage_html_a925bb60cb941e1b5db0f0af194a19703"><div class="ttname"><a href="classOutputPage.html#a925bb60cb941e1b5db0f0af194a19703">OutputPage\$mSubtitle</a></div><div class="ttdeci">array $mSubtitle</div><div class="ttdoc">Contains the page subtitle. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00092">OutputPage.php:92</a></div></div> <div class="ttc" id="classOutputPage_html_a232bb330000336185e67afd7416ca284"><div class="ttname"><a href="classOutputPage.html#a232bb330000336185e67afd7416ca284">OutputPage\redirect</a></div><div class="ttdeci">redirect($url, $responsecode= '302')</div><div class="ttdoc">Redirect to $url rather than displaying the normal page. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00319">OutputPage.php:319</a></div></div> <div class="ttc" id="classOutputPage_html_a8156613bf23495bc76f27a88d6e63fa5"><div class="ttname"><a href="classOutputPage.html#a8156613bf23495bc76f27a88d6e63fa5">OutputPage\$mPagetitle</a></div><div class="ttdeci">string $mPagetitle</div><div class="ttdoc">Should be private - has getter and setter. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00062">OutputPage.php:62</a></div></div> <div class="ttc" id="classResourceLoaderModule_html_ad3f8b6431503c33669f565128495639e"><div class="ttname"><a href="classResourceLoaderModule.html#ad3f8b6431503c33669f565128495639e">ResourceLoaderModule\TYPE_SCRIPTS</a></div><div class="ttdeci">const TYPE_SCRIPTS</div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoaderModule_8php_source.html#l00035">ResourceLoaderModule.php:35</a></div></div> <div class="ttc" id="NoLocalSettings_8php_html_a0a4baf0b22973c07685c3981f0d17fc4"><div class="ttname"><a href="NoLocalSettings_8php.html#a0a4baf0b22973c07685c3981f0d17fc4">$path</a></div><div class="ttdeci">$path</div><div class="ttdef"><b>Definition:</b> <a href="NoLocalSettings_8php_source.html#l00026">NoLocalSettings.php:26</a></div></div> <div class="ttc" id="namespaceTitle_html"><div class="ttname"><a href="namespaceTitle.html">Title</a></div></div> <div class="ttc" id="classOutputPage_html_a7b65b571803fab1ddbab17573315a5bc"><div class="ttname"><a href="classOutputPage.html#a7b65b571803fab1ddbab17573315a5bc">OutputPage\showPermissionsErrorPage</a></div><div class="ttdeci">showPermissionsErrorPage(array $errors, $action=null)</div><div class="ttdoc">Output a standard permission error page. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02423">OutputPage.php:2423</a></div></div> <div class="ttc" id="classOutputPage_html_abcd6bfe25a20e4f0a56126fc6efa51cf"><div class="ttname"><a href="classOutputPage.html#abcd6bfe25a20e4f0a56126fc6efa51cf">OutputPage\getCacheVaryCookies</a></div><div class="ttdeci">getCacheVaryCookies()</div><div class="ttdoc">Get the list of cookies that will influence on the cache. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01977">OutputPage.php:1977</a></div></div> <div class="ttc" id="classOutputPage_html_abeab34b27669cc8a3854eea55f5a6eba"><div class="ttname"><a href="classOutputPage.html#abeab34b27669cc8a3854eea55f5a6eba">OutputPage\$rlClientContext</a></div><div class="ttdeci">ResourceLoaderContext $rlClientContext</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00154">OutputPage.php:154</a></div></div> <div class="ttc" id="classOutputPage_html_a7fa6a137980265694e6aa84198a0d8f5"><div class="ttname"><a href="classOutputPage.html#a7fa6a137980265694e6aa84198a0d8f5">OutputPage\setArticleFlag</a></div><div class="ttdeci">setArticleFlag($v)</div><div class="ttdoc">Set whether the displayed content is related to the source of the corresponding article on the wiki S...</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01172">OutputPage.php:1172</a></div></div> <div class="ttc" id="classOutputPage_html_ad843efcec1f915688d2a4d6c79b17e5c"><div class="ttname"><a href="classOutputPage.html#ad843efcec1f915688d2a4d6c79b17e5c">OutputPage\showFileDeleteError</a></div><div class="ttdeci">showFileDeleteError($name)</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02612">OutputPage.php:2612</a></div></div> <div class="ttc" id="classXml_html_a60640cfebaa2daf82f1dfb70b846e040"><div class="ttname"><a href="classXml.html#a60640cfebaa2daf82f1dfb70b846e040">Xml\encodeJsCall</a></div><div class="ttdeci">static encodeJsCall($name, $args, $pretty=false)</div><div class="ttdoc">Create a call to a JavaScript function. </div><div class="ttdef"><b>Definition:</b> <a href="Xml_8php_source.html#l00682">Xml.php:682</a></div></div> <div class="ttc" id="classResourceLoaderClientHtml_html_a23c489387c72a8688b445234d6ddb070"><div class="ttname"><a href="classResourceLoaderClientHtml.html#a23c489387c72a8688b445234d6ddb070">ResourceLoaderClientHtml\setModules</a></div><div class="ttdeci">setModules(array $modules)</div><div class="ttdoc">Ensure one or more modules are loaded. </div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoaderClientHtml_8php_source.html#l00083">ResourceLoaderClientHtml.php:83</a></div></div> <div class="ttc" id="classFile_html"><div class="ttname"><a href="classFile.html">File</a></div><div class="ttdoc">Implements some public methods and some protected utility functions which are required by multiple ch...</div><div class="ttdef"><b>Definition:</b> <a href="File_8php_source.html#l00050">File.php:50</a></div></div> <div class="ttc" id="classOutputPage_html_aa93ad6de2db94d9c22705906584893c5"><div class="ttname"><a href="classOutputPage.html#aa93ad6de2db94d9c22705906584893c5">OutputPage\addWikiTextTidy</a></div><div class="ttdeci">addWikiTextTidy($text, $linestart=true)</div><div class="ttdoc">Add wikitext with tidy enabled. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01684">OutputPage.php:1684</a></div></div> <div class="ttc" id="classOutputPage_html_a413856bad81088166dc6da5588895090"><div class="ttname"><a href="classOutputPage.html#a413856bad81088166dc6da5588895090">OutputPage\$mPageTitleActionText</a></div><div class="ttdeci">string $mPageTitleActionText</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00226">OutputPage.php:226</a></div></div> <div class="ttc" id="classResourceLoader_html"><div class="ttname"><a href="classResourceLoader.html">ResourceLoader</a></div><div class="ttdoc">Dynamic JavaScript and CSS resource loading system. </div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoader_8php_source.html#l00036">ResourceLoader.php:36</a></div></div> <div class="ttc" id="classContextSource_html_aeec47883940f61b3fc268e8053a0a01a"><div class="ttname"><a href="classContextSource.html#aeec47883940f61b3fc268e8053a0a01a">ContextSource\getWikiPage</a></div><div class="ttdeci">getWikiPage()</div><div class="ttdoc">Get the WikiPage object. </div><div class="ttdef"><b>Definition:</b> <a href="ContextSource_8php_source.html#l00112">ContextSource.php:112</a></div></div> <div class="ttc" id="classSkin_html_a5224a834760245b3187149c58e00d335"><div class="ttname"><a href="classSkin.html#a5224a834760245b3187149c58e00d335">Skin\getSkinName</a></div><div class="ttdeci">getSkinName()</div><div class="ttdef"><b>Definition:</b> <a href="Skin_8php_source.html#l00137">Skin.php:137</a></div></div> <div class="ttc" id="classHtml_html_ae33b3a5c765550abd96775e4e44df7c3"><div class="ttname"><a href="classHtml.html#ae33b3a5c765550abd96775e4e44df7c3">Html\linkedStyle</a></div><div class="ttdeci">static linkedStyle($url, $media= 'all')</div><div class="ttdoc">Output a "<link rel=stylesheet>" linking to the given URL for the given media type (if any)...</div><div class="ttdef"><b>Definition:</b> <a href="Html_8php_source.html#l00656">Html.php:656</a></div></div> <div class="ttc" id="classHtml_html_a1c74fee14762ec4d50e09a94c94327ef"><div class="ttname"><a href="classHtml.html#a1c74fee14762ec4d50e09a94c94327ef">Html\element</a></div><div class="ttdeci">static element($element, $attribs=[], $contents= '')</div><div class="ttdoc">Identical to rawElement(), but HTML-escapes $contents (like Xml::element()). </div><div class="ttdef"><b>Definition:</b> <a href="Html_8php_source.html#l00229">Html.php:229</a></div></div> <div class="ttc" id="classOutputPage_html_acb7603b840f300086ee43e4071775843"><div class="ttname"><a href="classOutputPage.html#acb7603b840f300086ee43e4071775843">OutputPage\setIndicators</a></div><div class="ttdeci">setIndicators(array $indicators)</div><div class="ttdoc">Add an array of indicators, with their identifiers as array keys and HTML contents as values...</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01352">OutputPage.php:1352</a></div></div> <div class="ttc" id="classOutputPage_html_aacaccc2e7f9237d87a613f334e5f406e"><div class="ttname"><a href="classOutputPage.html#aacaccc2e7f9237d87a613f334e5f406e">OutputPage\disallowUserJs</a></div><div class="ttdeci">disallowUserJs()</div><div class="ttdoc">Do not allow scripts which can be modified by wiki users to load on this page; only allow scripts bun...</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01410">OutputPage.php:1410</a></div></div> <div class="ttc" id="classResourceLoaderModule_html_a913ce5b41905ee75a79435626a9cc4ef"><div class="ttname"><a href="classResourceLoaderModule.html#a913ce5b41905ee75a79435626a9cc4ef">ResourceLoaderModule\getOrigin</a></div><div class="ttdeci">getOrigin()</div><div class="ttdoc">Get this module's origin. </div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoaderModule_8php_source.html#l00125">ResourceLoaderModule.php:125</a></div></div> <div class="ttc" id="testCompression_8php_html_af20635b6c08e03bfee9e3fc036fa80f3"><div class="ttname"><a href="testCompression_8php.html#af20635b6c08e03bfee9e3fc036fa80f3">$keys</a></div><div class="ttdeci">$keys</div><div class="ttdef"><b>Definition:</b> <a href="testCompression_8php_source.html#l00065">testCompression.php:65</a></div></div> <div class="ttc" id="classOutputPage_html_af90b249eef3f3aab3e4fafe27d2ddf28"><div class="ttname"><a href="classOutputPage.html#af90b249eef3f3aab3e4fafe27d2ddf28">OutputPage\getModules</a></div><div class="ttdeci">getModules($filter=false, $position=null, $param= 'mModules', $type=ResourceLoaderModule::TYPE_COMBINED)</div><div class="ttdoc">Get the list of modules to include on this page. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00546">OutputPage.php:546</a></div></div> <div class="ttc" id="classContextSource_html_a4a84d5f0344e114f266fef48c6558999"><div class="ttname"><a href="classContextSource.html#a4a84d5f0344e114f266fef48c6558999">ContextSource\getUser</a></div><div class="ttdeci">getUser()</div><div class="ttdoc">Get the User object. </div><div class="ttdef"><b>Definition:</b> <a href="ContextSource_8php_source.html#l00132">ContextSource.php:132</a></div></div> <div class="ttc" id="classOutputPage_html_ac43a3cad0175d6088d38af8248223678"><div class="ttname"><a href="classOutputPage.html#ac43a3cad0175d6088d38af8248223678">OutputPage\getVaryHeader</a></div><div class="ttdeci">getVaryHeader()</div><div class="ttdoc">Return a Vary: header on which to vary caches. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02035">OutputPage.php:2035</a></div></div> <div class="ttc" id="hooks_8txt_html_a18cb89f02456c7d0191cae3c91e677de"><div class="ttname"><a href="hooks_8txt.html#a18cb89f02456c7d0191cae3c91e677de">$vars</a></div><div class="ttdeci">static configuration should be added through ResourceLoaderGetConfigVars instead & $vars</div><div class="ttdef"><b>Definition:</b> <a href="hooks_8txt_source.html#l02163">hooks.txt:2163</a></div></div> <div class="ttc" id="classThrottledError_html"><div class="ttname"><a href="classThrottledError.html">ThrottledError</a></div><div class="ttdoc">Show an error when the user hits a rate limit. </div><div class="ttdef"><b>Definition:</b> <a href="ThrottledError_8php_source.html#l00027">ThrottledError.php:27</a></div></div> <div class="ttc" id="hooks_8txt_html_a7f3af9b6dc4889b59c9971064987d675"><div class="ttname"><a href="hooks_8txt.html#a7f3af9b6dc4889b59c9971064987d675">$type</a></div><div class="ttdeci">do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type</div><div class="ttdef"><b>Definition:</b> <a href="hooks_8txt_source.html#l02495">hooks.txt:2495</a></div></div> <div class="ttc" id="classOutputPage_html_a4829fa8b52d3e210d3d2214d4025e5ca"><div class="ttname"><a href="classOutputPage.html#a4829fa8b52d3e210d3d2214d4025e5ca">OutputPage\addModuleStyles</a></div><div class="ttdeci">addModuleStyles($modules)</div><div class="ttdoc">Add only CSS of one or more modules recognized by ResourceLoader. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00612">OutputPage.php:612</a></div></div> <div class="ttc" id="namespaceMWException_html"><div class="ttname"><a href="namespaceMWException.html">MWException</a></div></div> <div class="ttc" id="classOutputPage_html_a74be7ed873b6f223ab26c7619216eb7c"><div class="ttname"><a href="classOutputPage.html#a74be7ed873b6f223ab26c7619216eb7c">OutputPage\$mRedirect</a></div><div class="ttdeci">string $mRedirect</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00095">OutputPage.php:95</a></div></div> <div class="ttc" id="classOutputPage_html_a5c16e383a4603aa4b10a3d850d220f64"><div class="ttname"><a href="classOutputPage.html#a5c16e383a4603aa4b10a3d850d220f64">OutputPage\addModuleScripts</a></div><div class="ttdeci">addModuleScripts($modules)</div><div class="ttdoc">Add only JS of one or more modules recognized by ResourceLoader. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00586">OutputPage.php:586</a></div></div> <div class="ttc" id="classOutputPage_html_ac1ef46b27a8983bb52715b491dbff9ad"><div class="ttname"><a href="classOutputPage.html#ac1ef46b27a8983bb52715b491dbff9ad">OutputPage\setCanonicalUrl</a></div><div class="ttdeci">setCanonicalUrl($url)</div><div class="ttdoc">Set the URL to be used for the <link rel="canonical">. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00414">OutputPage.php:414</a></div></div> <div class="ttc" id="classOutputPage_html_a78717094923ded7d7f41340e0522c189"><div class="ttname"><a href="classOutputPage.html#a78717094923ded7d7f41340e0522c189">OutputPage\setLastModified</a></div><div class="ttdeci">setLastModified($timestamp)</div><div class="ttdoc">Override the last modified timestamp. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00828">OutputPage.php:828</a></div></div> <div class="ttc" id="classOutputPage_html_af1c117c7597a9d09ccb84cee9232b64c"><div class="ttname"><a href="classOutputPage.html#af1c117c7597a9d09ccb84cee9232b64c">OutputPage\setSyndicated</a></div><div class="ttdeci">setSyndicated($show=true)</div><div class="ttdoc">Add or remove feed links in the page header This is mainly kept for backward compatibility, see OutputPage::addFeedLink() for the new version. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01099">OutputPage.php:1099</a></div></div> <div class="ttc" id="classOutputPage_html_a54d111eb0e932e01a083f6c55a8804e3"><div class="ttname"><a href="classOutputPage.html#a54d111eb0e932e01a083f6c55a8804e3">OutputPage\getRevisionTimestamp</a></div><div class="ttdeci">getRevisionTimestamp()</div><div class="ttdoc">Get the timestamp of displayed revision. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01592">OutputPage.php:1592</a></div></div> <div class="ttc" id="classOutputPage_html_abfea8e505f0a8d95dc8beb316c4579d5"><div class="ttname"><a href="classOutputPage.html#abfea8e505f0a8d95dc8beb316c4579d5">OutputPage\getLinkTags</a></div><div class="ttdeci">getLinkTags()</div><div class="ttdoc">Returns the current <link> tags. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00393">OutputPage.php:393</a></div></div> <div class="ttc" id="classOutputPage_html_ab511abf28c1a15bb11327bf958591a20"><div class="ttname"><a href="classOutputPage.html#ab511abf28c1a15bb11327bf958591a20">OutputPage\$rlClient</a></div><div class="ttdeci">ResourceLoaderClientHtml $rlClient</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00151">OutputPage.php:151</a></div></div> <div class="ttc" id="classOutputPage_html_a009756705931a3399dbe89b257517730"><div class="ttname"><a href="classOutputPage.html#a009756705931a3399dbe89b257517730">OutputPage\isArticle</a></div><div class="ttdeci">isArticle()</div><div class="ttdoc">Return whether the content displayed page is related to the source of the corresponding article on th...</div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l01185">OutputPage.php:1185</a></div></div> <div class="ttc" id="classResourceLoaderContext_html"><div class="ttname"><a href="classResourceLoaderContext.html">ResourceLoaderContext</a></div><div class="ttdoc">Object passed around to modules which contains information about the state of a specific loader reque...</div><div class="ttdef"><b>Definition:</b> <a href="ResourceLoaderContext_8php_source.html#l00031">ResourceLoaderContext.php:31</a></div></div> <div class="ttc" id="classOutputPage_html_aaf8b7eebb1212345cd8b3b5fe77f2ba1"><div class="ttname"><a href="classOutputPage.html#aaf8b7eebb1212345cd8b3b5fe77f2ba1">OutputPage\$mParserOptions</a></div><div class="ttdeci">ParserOptions $mParserOptions</div><div class="ttdoc">lazy initialised, use parserOptions() </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l00197">OutputPage.php:197</a></div></div> <div class="ttc" id="namespaceException_html"><div class="ttname"><a href="namespaceException.html">Exception</a></div></div> <div class="ttc" id="classOutputPage_html_a81c86f0fc996076ed05467f63b3fb154"><div class="ttname"><a href="classOutputPage.html#a81c86f0fc996076ed05467f63b3fb154">OutputPage\addJsConfigVars</a></div><div class="ttdeci">addJsConfigVars($keys, $value=null)</div><div class="ttdoc">Add one or more variables to be set in mw.config in JavaScript. </div><div class="ttdef"><b>Definition:</b> <a href="OutputPage_8php_source.html#l02982">OutputPage.php:2982</a></div></div> <div class="ttc" id="hooks_8txt_html_ae2d36f45856c4960c998f6c76c83b7a8"><div class="ttname"><a href="hooks_8txt.html#ae2d36f45856c4960c998f6c76c83b7a8">$name</a></div><div class="ttdeci">Allows to change the fields on the form that will be generated $name</div><div class="ttdef"><b>Definition:</b> <a href="hooks_8txt_source.html#l00304">hooks.txt:304</a></div></div> <div class="ttc" id="classContextSource_html_a42220e4622a75fd36e754b0e632fdc09"><div class="ttname"><a href="classContextSource.html#a42220e4622a75fd36e754b0e632fdc09">ContextSource\getSkin</a></div><div class="ttdeci">getSkin()</div><div class="ttdoc">Get the Skin object. </div><div class="ttdef"><b>Definition:</b> <a href="ContextSource_8php_source.html#l00152">ContextSource.php:152</a></div></div> <div class="ttc" id="classArticle_html_a7d076b903fbfec072c74038be0b53a47"><div class="ttname"><a href="classArticle.html#a7d076b903fbfec072c74038be0b53a47">Article\formatRobotPolicy</a></div><div class="ttdeci">static formatRobotPolicy($policy)</div><div class="ttdoc">Converts a String robot policy into an associative array, to allow merging of several policies using ...</div><div class="ttdef"><b>Definition:</b> <a href="Article_8php_source.html#l00911">Article.php:911</a></div></div> </div><!-- fragment --></div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="dir_8a18e807163faa1f0c426c97f3962518.html">includes</a></li><li class="navelem"><a class="el" href="OutputPage_8php.html">OutputPage.php</a></li> <li class="footer">Generated on Wed Nov 15 2017 21:46:47 for MediaWiki by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.8 </li> </ul> </div> </body> </html>