MediaWiki  1.28.0
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  if ( !$options->matches( $anonPO ) ) {
1519  wfLogWarning( __METHOD__ . ': Setting a changed bogus ParserOptions: ' . wfGetAllCallers( 5 ) );
1520  $options->isBogus = false;
1521  }
1522  }
1523 
1524  if ( !$this->mParserOptions ) {
1525  if ( !$this->getContext()->getUser()->isSafeToLoad() ) {
1526  // $wgUser isn't unstubbable yet, so don't try to get a
1527  // ParserOptions for it. And don't cache this ParserOptions
1528  // either.
1530  $po->setEditSection( false );
1531  $po->isBogus = true;
1532  if ( $options !== null ) {
1533  $this->mParserOptions = empty( $options->isBogus ) ? $options : null;
1534  }
1535  return $po;
1536  }
1537 
1538  $this->mParserOptions = ParserOptions::newFromContext( $this->getContext() );
1539  $this->mParserOptions->setEditSection( false );
1540  }
1541 
1542  if ( $options !== null && !empty( $options->isBogus ) ) {
1543  // They're trying to restore the bogus pre-$wgUser PO. Do the right
1544  // thing.
1545  return wfSetVar( $this->mParserOptions, null, true );
1546  } else {
1547  return wfSetVar( $this->mParserOptions, $options );
1548  }
1549  }
1550 
1558  public function setRevisionId( $revid ) {
1559  $val = is_null( $revid ) ? null : intval( $revid );
1560  return wfSetVar( $this->mRevisionId, $val );
1561  }
1562 
1568  public function getRevisionId() {
1569  return $this->mRevisionId;
1570  }
1571 
1579  public function setRevisionTimestamp( $timestamp ) {
1580  return wfSetVar( $this->mRevisionTimestamp, $timestamp );
1581  }
1582 
1589  public function getRevisionTimestamp() {
1591  }
1592 
1599  public function setFileVersion( $file ) {
1600  $val = null;
1601  if ( $file instanceof File && $file->exists() ) {
1602  $val = [ 'time' => $file->getTimestamp(), 'sha1' => $file->getSha1() ];
1603  }
1604  return wfSetVar( $this->mFileVersion, $val, true );
1605  }
1606 
1612  public function getFileVersion() {
1613  return $this->mFileVersion;
1614  }
1615 
1622  public function getTemplateIds() {
1623  return $this->mTemplateIds;
1624  }
1625 
1632  public function getFileSearchOptions() {
1633  return $this->mImageTimeKeys;
1634  }
1635 
1645  public function addWikiText( $text, $linestart = true, $interface = true ) {
1646  $title = $this->getTitle(); // Work around E_STRICT
1647  if ( !$title ) {
1648  throw new MWException( 'Title is null' );
1649  }
1650  $this->addWikiTextTitle( $text, $title, $linestart, /*tidy*/false, $interface );
1651  }
1652 
1660  public function addWikiTextWithTitle( $text, &$title, $linestart = true ) {
1661  $this->addWikiTextTitle( $text, $title, $linestart );
1662  }
1663 
1671  function addWikiTextTitleTidy( $text, &$title, $linestart = true ) {
1672  $this->addWikiTextTitle( $text, $title, $linestart, true );
1673  }
1674 
1681  public function addWikiTextTidy( $text, $linestart = true ) {
1682  $title = $this->getTitle();
1683  $this->addWikiTextTitleTidy( $text, $title, $linestart );
1684  }
1685 
1696  public function addWikiTextTitle( $text, Title $title, $linestart,
1697  $tidy = false, $interface = false
1698  ) {
1699  global $wgParser;
1700 
1701  $popts = $this->parserOptions();
1702  $oldTidy = $popts->setTidy( $tidy );
1703  $popts->setInterfaceMessage( (bool)$interface );
1704 
1705  $parserOutput = $wgParser->getFreshParser()->parse(
1706  $text, $title, $popts,
1707  $linestart, true, $this->mRevisionId
1708  );
1709 
1710  $popts->setTidy( $oldTidy );
1711 
1712  $this->addParserOutput( $parserOutput );
1713 
1714  }
1715 
1723  wfDeprecated( __METHOD__, '1.24' );
1725  }
1726 
1736  $this->mLanguageLinks += $parserOutput->getLanguageLinks();
1737  $this->addCategoryLinks( $parserOutput->getCategories() );
1738  $this->setIndicators( $parserOutput->getIndicators() );
1739  $this->mNewSectionLink = $parserOutput->getNewSection();
1740  $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
1741 
1742  if ( !$parserOutput->isCacheable() ) {
1743  $this->enableClientCache( false );
1744  }
1745  $this->mNoGallery = $parserOutput->getNoGallery();
1746  $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
1747  $this->addModules( $parserOutput->getModules() );
1748  $this->addModuleScripts( $parserOutput->getModuleScripts() );
1749  $this->addModuleStyles( $parserOutput->getModuleStyles() );
1750  $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
1751  $this->mPreventClickjacking = $this->mPreventClickjacking
1752  || $parserOutput->preventClickjacking();
1753 
1754  // Template versioning...
1755  foreach ( (array)$parserOutput->getTemplateIds() as $ns => $dbks ) {
1756  if ( isset( $this->mTemplateIds[$ns] ) ) {
1757  $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1758  } else {
1759  $this->mTemplateIds[$ns] = $dbks;
1760  }
1761  }
1762  // File versioning...
1763  foreach ( (array)$parserOutput->getFileSearchOptions() as $dbk => $data ) {
1764  $this->mImageTimeKeys[$dbk] = $data;
1765  }
1766 
1767  // Hooks registered in the object
1768  $parserOutputHooks = $this->getConfig()->get( 'ParserOutputHooks' );
1769  foreach ( $parserOutput->getOutputHooks() as $hookInfo ) {
1770  list( $hookName, $data ) = $hookInfo;
1771  if ( isset( $parserOutputHooks[$hookName] ) ) {
1772  call_user_func( $parserOutputHooks[$hookName], $this, $parserOutput, $data );
1773  }
1774  }
1775 
1776  // enable OOUI if requested via ParserOutput
1777  if ( $parserOutput->getEnableOOUI() ) {
1778  $this->enableOOUI();
1779  }
1780 
1781  // Link flags are ignored for now, but may in the future be
1782  // used to mark individual language links.
1783  $linkFlags = [];
1784  Hooks::run( 'LanguageLinks', [ $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ] );
1785  Hooks::run( 'OutputPageParserOutput', [ &$this, $parserOutput ] );
1786  }
1787 
1797 
1798  $this->addModules( $parserOutput->getModules() );
1799  $this->addModuleScripts( $parserOutput->getModuleScripts() );
1800  $this->addModuleStyles( $parserOutput->getModuleStyles() );
1801 
1802  $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
1803  }
1804 
1811  public function addParserOutputText( $parserOutput ) {
1812  $text = $parserOutput->getText();
1813  Hooks::run( 'OutputPageBeforeHTML', [ &$this, &$text ] );
1814  $this->addHTML( $text );
1815  }
1816 
1824  $parserOutput->setTOCEnabled( $this->mEnableTOC );
1825 
1826  // Touch section edit links only if not previously disabled
1827  if ( $parserOutput->getEditSectionTokens() ) {
1828  $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks );
1829  }
1830 
1832  }
1833 
1839  public function addTemplate( &$template ) {
1840  $this->addHTML( $template->getHTML() );
1841  }
1842 
1855  public function parse( $text, $linestart = true, $interface = false, $language = null ) {
1856  global $wgParser;
1857 
1858  if ( is_null( $this->getTitle() ) ) {
1859  throw new MWException( 'Empty $mTitle in ' . __METHOD__ );
1860  }
1861 
1862  $popts = $this->parserOptions();
1863  if ( $interface ) {
1864  $popts->setInterfaceMessage( true );
1865  }
1866  if ( $language !== null ) {
1867  $oldLang = $popts->setTargetLanguage( $language );
1868  }
1869 
1870  $parserOutput = $wgParser->getFreshParser()->parse(
1871  $text, $this->getTitle(), $popts,
1872  $linestart, true, $this->mRevisionId
1873  );
1874 
1875  if ( $interface ) {
1876  $popts->setInterfaceMessage( false );
1877  }
1878  if ( $language !== null ) {
1879  $popts->setTargetLanguage( $oldLang );
1880  }
1881 
1882  return $parserOutput->getText();
1883  }
1884 
1895  public function parseInline( $text, $linestart = true, $interface = false ) {
1896  $parsed = $this->parse( $text, $linestart, $interface );
1897  return Parser::stripOuterParagraph( $parsed );
1898  }
1899 
1904  public function setSquidMaxage( $maxage ) {
1905  $this->setCdnMaxage( $maxage );
1906  }
1907 
1913  public function setCdnMaxage( $maxage ) {
1914  $this->mCdnMaxage = min( $maxage, $this->mCdnMaxageLimit );
1915  }
1916 
1923  public function lowerCdnMaxage( $maxage ) {
1924  $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
1925  $this->setCdnMaxage( $this->mCdnMaxage );
1926  }
1927 
1941  public function adaptCdnTTL( $mtime, $minTTL = 0, $maxTTL = 0 ) {
1942  $minTTL = $minTTL ?: IExpiringStore::TTL_MINUTE;
1943  $maxTTL = $maxTTL ?: $this->getConfig()->get( 'SquidMaxage' );
1944 
1945  if ( $mtime === null || $mtime === false ) {
1946  return $minTTL; // entity does not exist
1947  }
1948 
1949  $age = time() - wfTimestamp( TS_UNIX, $mtime );
1950  $adaptiveTTL = max( .9 * $age, $minTTL );
1951  $adaptiveTTL = min( $adaptiveTTL, $maxTTL );
1952 
1953  $this->lowerCdnMaxage( (int)$adaptiveTTL );
1954 
1955  return $adaptiveTTL;
1956  }
1957 
1965  public function enableClientCache( $state ) {
1966  return wfSetVar( $this->mEnableClientCache, $state );
1967  }
1968 
1974  function getCacheVaryCookies() {
1975  static $cookies;
1976  if ( $cookies === null ) {
1977  $config = $this->getConfig();
1978  $cookies = array_merge(
1979  SessionManager::singleton()->getVaryCookies(),
1980  [
1981  'forceHTTPS',
1982  ],
1983  $config->get( 'CacheVaryCookies' )
1984  );
1985  Hooks::run( 'GetCacheVaryCookies', [ $this, &$cookies ] );
1986  }
1987  return $cookies;
1988  }
1989 
1997  $request = $this->getRequest();
1998  foreach ( $this->getCacheVaryCookies() as $cookieName ) {
1999  if ( $request->getCookie( $cookieName, '', '' ) !== '' ) {
2000  wfDebug( __METHOD__ . ": found $cookieName\n" );
2001  return true;
2002  }
2003  }
2004  wfDebug( __METHOD__ . ": no cache-varying cookies found\n" );
2005  return false;
2006  }
2007 
2016  public function addVaryHeader( $header, array $option = null ) {
2017  if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
2018  $this->mVaryHeader[$header] = [];
2019  }
2020  if ( !is_array( $option ) ) {
2021  $option = [];
2022  }
2023  $this->mVaryHeader[$header] = array_unique( array_merge( $this->mVaryHeader[$header], $option ) );
2024  }
2025 
2032  public function getVaryHeader() {
2033  // If we vary on cookies, let's make sure it's always included here too.
2034  if ( $this->getCacheVaryCookies() ) {
2035  $this->addVaryHeader( 'Cookie' );
2036  }
2037 
2038  foreach ( SessionManager::singleton()->getVaryHeaders() as $header => $options ) {
2039  $this->addVaryHeader( $header, $options );
2040  }
2041  return 'Vary: ' . implode( ', ', array_keys( $this->mVaryHeader ) );
2042  }
2043 
2049  public function getKeyHeader() {
2050  $cvCookies = $this->getCacheVaryCookies();
2051 
2052  $cookiesOption = [];
2053  foreach ( $cvCookies as $cookieName ) {
2054  $cookiesOption[] = 'param=' . $cookieName;
2055  }
2056  $this->addVaryHeader( 'Cookie', $cookiesOption );
2057 
2058  foreach ( SessionManager::singleton()->getVaryHeaders() as $header => $options ) {
2059  $this->addVaryHeader( $header, $options );
2060  }
2061 
2062  $headers = [];
2063  foreach ( $this->mVaryHeader as $header => $option ) {
2064  $newheader = $header;
2065  if ( is_array( $option ) && count( $option ) > 0 ) {
2066  $newheader .= ';' . implode( ';', $option );
2067  }
2068  $headers[] = $newheader;
2069  }
2070  $key = 'Key: ' . implode( ',', $headers );
2071 
2072  return $key;
2073  }
2074 
2083  function addAcceptLanguage() {
2084  $title = $this->getTitle();
2085  if ( !$title instanceof Title ) {
2086  return;
2087  }
2088 
2089  $lang = $title->getPageLanguage();
2090  if ( !$this->getRequest()->getCheck( 'variant' ) && $lang->hasVariants() ) {
2091  $variants = $lang->getVariants();
2092  $aloption = [];
2093  foreach ( $variants as $variant ) {
2094  if ( $variant === $lang->getCode() ) {
2095  continue;
2096  } else {
2097  $aloption[] = 'substr=' . $variant;
2098 
2099  // IE and some other browsers use BCP 47 standards in
2100  // their Accept-Language header, like "zh-CN" or "zh-Hant".
2101  // We should handle these too.
2102  $variantBCP47 = wfBCP47( $variant );
2103  if ( $variantBCP47 !== $variant ) {
2104  $aloption[] = 'substr=' . $variantBCP47;
2105  }
2106  }
2107  }
2108  $this->addVaryHeader( 'Accept-Language', $aloption );
2109  }
2110  }
2111 
2122  public function preventClickjacking( $enable = true ) {
2123  $this->mPreventClickjacking = $enable;
2124  }
2125 
2131  public function allowClickjacking() {
2132  $this->mPreventClickjacking = false;
2133  }
2134 
2141  public function getPreventClickjacking() {
2143  }
2144 
2152  public function getFrameOptions() {
2153  $config = $this->getConfig();
2154  if ( $config->get( 'BreakFrames' ) ) {
2155  return 'DENY';
2156  } elseif ( $this->mPreventClickjacking && $config->get( 'EditPageFrameOptions' ) ) {
2157  return $config->get( 'EditPageFrameOptions' );
2158  }
2159  return false;
2160  }
2161 
2165  public function sendCacheControl() {
2166  $response = $this->getRequest()->response();
2167  $config = $this->getConfig();
2168 
2169  $this->addVaryHeader( 'Cookie' );
2170  $this->addAcceptLanguage();
2171 
2172  # don't serve compressed data to clients who can't handle it
2173  # maintain different caches for logged-in users and non-logged in ones
2174  $response->header( $this->getVaryHeader() );
2175 
2176  if ( $config->get( 'UseKeyHeader' ) ) {
2177  $response->header( $this->getKeyHeader() );
2178  }
2179 
2180  if ( $this->mEnableClientCache ) {
2181  if (
2182  $config->get( 'UseSquid' ) &&
2183  !$response->hasCookies() &&
2184  !SessionManager::getGlobalSession()->isPersistent() &&
2185  !$this->isPrintable() &&
2186  $this->mCdnMaxage != 0 &&
2187  !$this->haveCacheVaryCookies()
2188  ) {
2189  if ( $config->get( 'UseESI' ) ) {
2190  # We'll purge the proxy cache explicitly, but require end user agents
2191  # to revalidate against the proxy on each visit.
2192  # Surrogate-Control controls our CDN, Cache-Control downstream caches
2193  wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **", 'private' );
2194  # start with a shorter timeout for initial testing
2195  # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
2196  $response->header( 'Surrogate-Control: max-age=' . $config->get( 'SquidMaxage' )
2197  . '+' . $this->mCdnMaxage . ', content="ESI/1.0"' );
2198  $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
2199  } else {
2200  # We'll purge the proxy cache for anons explicitly, but require end user agents
2201  # to revalidate against the proxy on each visit.
2202  # IMPORTANT! The CDN needs to replace the Cache-Control header with
2203  # Cache-Control: s-maxage=0, must-revalidate, max-age=0
2204  wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **", 'private' );
2205  # start with a shorter timeout for initial testing
2206  # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2207  $response->header( 'Cache-Control: s-maxage=' . $this->mCdnMaxage
2208  . ', must-revalidate, max-age=0' );
2209  }
2210  } else {
2211  # We do want clients to cache if they can, but they *must* check for updates
2212  # on revisiting the page.
2213  wfDebug( __METHOD__ . ": private caching; {$this->mLastModified} **", 'private' );
2214  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2215  $response->header( "Cache-Control: private, must-revalidate, max-age=0" );
2216  }
2217  if ( $this->mLastModified ) {
2218  $response->header( "Last-Modified: {$this->mLastModified}" );
2219  }
2220  } else {
2221  wfDebug( __METHOD__ . ": no caching **", 'private' );
2222 
2223  # In general, the absence of a last modified header should be enough to prevent
2224  # the client from using its cache. We send a few other things just to make sure.
2225  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2226  $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2227  $response->header( 'Pragma: no-cache' );
2228  }
2229  }
2230 
2241  public function output( $return = false ) {
2243 
2244  if ( $this->mDoNothing ) {
2245  return $return ? '' : null;
2246  }
2247 
2248  $response = $this->getRequest()->response();
2249  $config = $this->getConfig();
2250 
2251  if ( $this->mRedirect != '' ) {
2252  # Standards require redirect URLs to be absolute
2253  $this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT );
2254 
2255  $redirect = $this->mRedirect;
2257 
2258  if ( Hooks::run( "BeforePageRedirect", [ $this, &$redirect, &$code ] ) ) {
2259  if ( $code == '301' || $code == '303' ) {
2260  if ( !$config->get( 'DebugRedirects' ) ) {
2261  $response->statusHeader( $code );
2262  }
2263  $this->mLastModified = wfTimestamp( TS_RFC2822 );
2264  }
2265  if ( $config->get( 'VaryOnXFP' ) ) {
2266  $this->addVaryHeader( 'X-Forwarded-Proto' );
2267  }
2268  $this->sendCacheControl();
2269 
2270  $response->header( "Content-Type: text/html; charset=utf-8" );
2271  if ( $config->get( 'DebugRedirects' ) ) {
2272  $url = htmlspecialchars( $redirect );
2273  print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2274  print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2275  print "</body>\n</html>\n";
2276  } else {
2277  $response->header( 'Location: ' . $redirect );
2278  }
2279  }
2280 
2281  return $return ? '' : null;
2282  } elseif ( $this->mStatusCode ) {
2283  $response->statusHeader( $this->mStatusCode );
2284  }
2285 
2286  # Buffer output; final headers may depend on later processing
2287  ob_start();
2288 
2289  $response->header( 'Content-type: ' . $config->get( 'MimeType' ) . '; charset=UTF-8' );
2290  $response->header( 'Content-language: ' . $wgContLang->getHtmlCode() );
2291 
2292  // Avoid Internet Explorer "compatibility view" in IE 8-10, so that
2293  // jQuery etc. can work correctly.
2294  $response->header( 'X-UA-Compatible: IE=Edge' );
2295 
2296  // Prevent framing, if requested
2297  $frameOptions = $this->getFrameOptions();
2298  if ( $frameOptions ) {
2299  $response->header( "X-Frame-Options: $frameOptions" );
2300  }
2301 
2302  if ( $this->mArticleBodyOnly ) {
2303  echo $this->mBodytext;
2304  } else {
2305  $sk = $this->getSkin();
2306  // add skin specific modules
2307  $modules = $sk->getDefaultModules();
2308 
2309  // Enforce various default modules for all pages and all skins
2310  $coreModules = [
2311  // Keep this list as small as possible
2312  'site',
2313  'mediawiki.page.startup',
2314  'mediawiki.user',
2315  ];
2316 
2317  // Support for high-density display images if enabled
2318  if ( $config->get( 'ResponsiveImages' ) ) {
2319  $coreModules[] = 'mediawiki.hidpi';
2320  }
2321 
2322  $this->addModules( $coreModules );
2323  foreach ( $modules as $group ) {
2324  $this->addModules( $group );
2325  }
2326  MWDebug::addModules( $this );
2327 
2328  // Hook that allows last minute changes to the output page, e.g.
2329  // adding of CSS or Javascript by extensions.
2330  Hooks::run( 'BeforePageDisplay', [ &$this, &$sk ] );
2331 
2332  try {
2333  $sk->outputPage();
2334  } catch ( Exception $e ) {
2335  ob_end_clean(); // bug T129657
2336  throw $e;
2337  }
2338  }
2339 
2340  try {
2341  // This hook allows last minute changes to final overall output by modifying output buffer
2342  Hooks::run( 'AfterFinalPageOutput', [ $this ] );
2343  } catch ( Exception $e ) {
2344  ob_end_clean(); // bug T129657
2345  throw $e;
2346  }
2347 
2348  $this->sendCacheControl();
2349 
2350  if ( $return ) {
2351  return ob_get_clean();
2352  } else {
2353  ob_end_flush();
2354  return null;
2355  }
2356  }
2357 
2368  public function prepareErrorPage( $pageTitle, $htmlTitle = false ) {
2369  $this->setPageTitle( $pageTitle );
2370  if ( $htmlTitle !== false ) {
2371  $this->setHTMLTitle( $htmlTitle );
2372  }
2373  $this->setRobotPolicy( 'noindex,nofollow' );
2374  $this->setArticleRelated( false );
2375  $this->enableClientCache( false );
2376  $this->mRedirect = '';
2377  $this->clearSubtitle();
2378  $this->clearHTML();
2379  }
2380 
2393  public function showErrorPage( $title, $msg, $params = [] ) {
2394  if ( !$title instanceof Message ) {
2395  $title = $this->msg( $title );
2396  }
2397 
2398  $this->prepareErrorPage( $title );
2399 
2400  if ( $msg instanceof Message ) {
2401  if ( $params !== [] ) {
2402  trigger_error( 'Argument ignored: $params. The message parameters argument '
2403  . 'is discarded when the $msg argument is a Message object instead of '
2404  . 'a string.', E_USER_NOTICE );
2405  }
2406  $this->addHTML( $msg->parseAsBlock() );
2407  } else {
2408  $this->addWikiMsgArray( $msg, $params );
2409  }
2410 
2411  $this->returnToMain();
2412  }
2413 
2420  public function showPermissionsErrorPage( array $errors, $action = null ) {
2421  foreach ( $errors as $key => $error ) {
2422  $errors[$key] = (array)$error;
2423  }
2424 
2425  // For some action (read, edit, create and upload), display a "login to do this action"
2426  // error if all of the following conditions are met:
2427  // 1. the user is not logged in
2428  // 2. the only error is insufficient permissions (i.e. no block or something else)
2429  // 3. the error can be avoided simply by logging in
2430  if ( in_array( $action, [ 'read', 'edit', 'createpage', 'createtalk', 'upload' ] )
2431  && $this->getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2432  && ( $errors[0][0] == 'badaccess-groups' || $errors[0][0] == 'badaccess-group0' )
2433  && ( User::groupHasPermission( 'user', $action )
2434  || User::groupHasPermission( 'autoconfirmed', $action ) )
2435  ) {
2436  $displayReturnto = null;
2437 
2438  # Due to bug 32276, if a user does not have read permissions,
2439  # $this->getTitle() will just give Special:Badtitle, which is
2440  # not especially useful as a returnto parameter. Use the title
2441  # from the request instead, if there was one.
2442  $request = $this->getRequest();
2443  $returnto = Title::newFromText( $request->getVal( 'title', '' ) );
2444  if ( $action == 'edit' ) {
2445  $msg = 'whitelistedittext';
2446  $displayReturnto = $returnto;
2447  } elseif ( $action == 'createpage' || $action == 'createtalk' ) {
2448  $msg = 'nocreatetext';
2449  } elseif ( $action == 'upload' ) {
2450  $msg = 'uploadnologintext';
2451  } else { # Read
2452  $msg = 'loginreqpagetext';
2453  $displayReturnto = Title::newMainPage();
2454  }
2455 
2456  $query = [];
2457 
2458  if ( $returnto ) {
2459  $query['returnto'] = $returnto->getPrefixedText();
2460 
2461  if ( !$request->wasPosted() ) {
2462  $returntoquery = $request->getValues();
2463  unset( $returntoquery['title'] );
2464  unset( $returntoquery['returnto'] );
2465  unset( $returntoquery['returntoquery'] );
2466  $query['returntoquery'] = wfArrayToCgi( $returntoquery );
2467  }
2468  }
2469  $loginLink = Linker::linkKnown(
2470  SpecialPage::getTitleFor( 'Userlogin' ),
2471  $this->msg( 'loginreqlink' )->escaped(),
2472  [],
2473  $query
2474  );
2475 
2476  $this->prepareErrorPage( $this->msg( 'loginreqtitle' ) );
2477  $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->parse() );
2478 
2479  # Don't return to a page the user can't read otherwise
2480  # we'll end up in a pointless loop
2481  if ( $displayReturnto && $displayReturnto->userCan( 'read', $this->getUser() ) ) {
2482  $this->returnToMain( null, $displayReturnto );
2483  }
2484  } else {
2485  $this->prepareErrorPage( $this->msg( 'permissionserrors' ) );
2486  $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
2487  }
2488  }
2489 
2496  public function versionRequired( $version ) {
2497  $this->prepareErrorPage( $this->msg( 'versionrequired', $version ) );
2498 
2499  $this->addWikiMsg( 'versionrequiredtext', $version );
2500  $this->returnToMain();
2501  }
2502 
2510  public function formatPermissionsErrorMessage( array $errors, $action = null ) {
2511  if ( $action == null ) {
2512  $text = $this->msg( 'permissionserrorstext', count( $errors ) )->plain() . "\n\n";
2513  } else {
2514  $action_desc = $this->msg( "action-$action" )->plain();
2515  $text = $this->msg(
2516  'permissionserrorstext-withaction',
2517  count( $errors ),
2518  $action_desc
2519  )->plain() . "\n\n";
2520  }
2521 
2522  if ( count( $errors ) > 1 ) {
2523  $text .= '<ul class="permissions-errors">' . "\n";
2524 
2525  foreach ( $errors as $error ) {
2526  $text .= '<li>';
2527  $text .= call_user_func_array( [ $this, 'msg' ], $error )->plain();
2528  $text .= "</li>\n";
2529  }
2530  $text .= '</ul>';
2531  } else {
2532  $text .= "<div class=\"permissions-errors\">\n" .
2533  call_user_func_array( [ $this, 'msg' ], reset( $errors ) )->plain() .
2534  "\n</div>";
2535  }
2536 
2537  return $text;
2538  }
2539 
2551  public function readOnlyPage() {
2552  if ( func_num_args() > 0 ) {
2553  throw new MWException( __METHOD__ . ' no longer accepts arguments since 1.25.' );
2554  }
2555 
2556  throw new ReadOnlyError;
2557  }
2558 
2565  public function rateLimited() {
2566  wfDeprecated( __METHOD__, '1.25' );
2567  throw new ThrottledError;
2568  }
2569 
2579  public function showLagWarning( $lag ) {
2580  $config = $this->getConfig();
2581  if ( $lag >= $config->get( 'SlaveLagWarning' ) ) {
2582  $lag = floor( $lag ); // floor to avoid nano seconds to display
2583  $message = $lag < $config->get( 'SlaveLagCritical' )
2584  ? 'lag-warn-normal'
2585  : 'lag-warn-high';
2586  $wrap = Html::rawElement( 'div', [ 'class' => "mw-{$message}" ], "\n$1\n" );
2587  $this->wrapWikiMsg( "$wrap\n", [ $message, $this->getLanguage()->formatNum( $lag ) ] );
2588  }
2589  }
2590 
2591  public function showFatalError( $message ) {
2592  $this->prepareErrorPage( $this->msg( 'internalerror' ) );
2593 
2594  $this->addHTML( $message );
2595  }
2596 
2597  public function showUnexpectedValueError( $name, $val ) {
2598  $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() );
2599  }
2600 
2601  public function showFileCopyError( $old, $new ) {
2602  $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() );
2603  }
2604 
2605  public function showFileRenameError( $old, $new ) {
2606  $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() );
2607  }
2608 
2609  public function showFileDeleteError( $name ) {
2610  $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() );
2611  }
2612 
2613  public function showFileNotFoundError( $name ) {
2614  $this->showFatalError( $this->msg( 'filenotfound', $name )->text() );
2615  }
2616 
2625  public function addReturnTo( $title, array $query = [], $text = null, $options = [] ) {
2626  $link = $this->msg( 'returnto' )->rawParams(
2627  Linker::link( $title, $text, [], $query, $options ) )->escaped();
2628  $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
2629  }
2630 
2639  public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
2640  if ( $returnto == null ) {
2641  $returnto = $this->getRequest()->getText( 'returnto' );
2642  }
2643 
2644  if ( $returntoquery == null ) {
2645  $returntoquery = $this->getRequest()->getText( 'returntoquery' );
2646  }
2647 
2648  if ( $returnto === '' ) {
2649  $returnto = Title::newMainPage();
2650  }
2651 
2652  if ( is_object( $returnto ) ) {
2653  $titleObj = $returnto;
2654  } else {
2655  $titleObj = Title::newFromText( $returnto );
2656  }
2657  if ( !is_object( $titleObj ) ) {
2658  $titleObj = Title::newMainPage();
2659  }
2660 
2661  $this->addReturnTo( $titleObj, wfCgiToArray( $returntoquery ) );
2662  }
2663 
2664  private function getRlClientContext() {
2665  if ( !$this->rlClientContext ) {
2667  [], // modules; not relevant
2668  $this->getLanguage()->getCode(),
2669  $this->getSkin()->getSkinName(),
2670  $this->getUser()->isLoggedIn() ? $this->getUser()->getName() : null,
2671  null, // version; not relevant
2673  null, // only; not relevant
2674  $this->isPrintable(),
2675  $this->getRequest()->getBool( 'handheld' )
2676  );
2677  $this->rlClientContext = new ResourceLoaderContext(
2678  $this->getResourceLoader(),
2679  new FauxRequest( $query )
2680  );
2681  }
2682  return $this->rlClientContext;
2683  }
2684 
2696  public function getRlClient() {
2697  if ( !$this->rlClient ) {
2698  $context = $this->getRlClientContext();
2699  $rl = $this->getResourceLoader();
2700  $this->addModules( [
2701  'user.options',
2702  'user.tokens',
2703  ] );
2704  $this->addModuleStyles( [
2705  'site.styles',
2706  'noscript',
2707  'user.styles',
2708  'user.cssprefs',
2709  ] );
2710  $this->getSkin()->setupSkinUserCss( $this );
2711 
2712  // Prepare exempt modules for buildExemptModules()
2713  $exemptGroups = [ 'site' => [], 'noscript' => [], 'private' => [], 'user' => [] ];
2714  $exemptStates = [];
2715  $moduleStyles = $this->getModuleStyles( /*filter*/ true );
2716 
2717  // Preload getTitleInfo for isKnownEmpty calls below and in ResourceLoaderClientHtml
2718  // Separate user-specific batch for improved cache-hit ratio.
2719  $userBatch = [ 'user.styles', 'user' ];
2720  $siteBatch = array_diff( $moduleStyles, $userBatch );
2721  $dbr = wfGetDB( DB_REPLICA );
2724 
2725  // Filter out modules handled by buildExemptModules()
2726  $moduleStyles = array_filter( $moduleStyles,
2727  function ( $name ) use ( $rl, $context, &$exemptGroups, &$exemptStates ) {
2728  $module = $rl->getModule( $name );
2729  if ( $module ) {
2730  if ( $name === 'user.styles' && $this->isUserCssPreview() ) {
2731  $exemptStates[$name] = 'ready';
2732  // Special case in buildExemptModules()
2733  return false;
2734  }
2735  $group = $module->getGroup();
2736  if ( isset( $exemptGroups[$group] ) ) {
2737  $exemptStates[$name] = 'ready';
2738  if ( !$module->isKnownEmpty( $context ) ) {
2739  // E.g. Don't output empty <styles>
2740  $exemptGroups[$group][] = $name;
2741  }
2742  return false;
2743  }
2744  }
2745  return true;
2746  }
2747  );
2748  $this->rlExemptStyleModules = $exemptGroups;
2749 
2750  $isUserModuleFiltered = !$this->filterModules( [ 'user' ] );
2751  // If this page filters out 'user', makeResourceLoaderLink will drop it.
2752  // Avoid indefinite "loading" state or untrue "ready" state (T145368).
2753  if ( !$isUserModuleFiltered ) {
2754  // Manually handled by getBottomScripts()
2755  $userModule = $rl->getModule( 'user' );
2756  $userState = $userModule->isKnownEmpty( $context ) && !$this->isUserJsPreview()
2757  ? 'ready'
2758  : 'loading';
2759  $this->rlUserModuleState = $exemptStates['user'] = $userState;
2760  }
2761 
2763  $rlClient->setConfig( $this->getJSVars() );
2764  $rlClient->setModules( $this->getModules( /*filter*/ true ) );
2765  $rlClient->setModuleStyles( $moduleStyles );
2766  $rlClient->setModuleScripts( $this->getModuleScripts( /*filter*/ true ) );
2767  $rlClient->setExemptStates( $exemptStates );
2768  $this->rlClient = $rlClient;
2769  }
2770  return $this->rlClient;
2771  }
2772 
2778  public function headElement( Skin $sk, $includeStyle = true ) {
2780 
2781  $userdir = $this->getLanguage()->getDir();
2782  $sitedir = $wgContLang->getDir();
2783 
2784  $pieces = [];
2786  $this->getRlClient()->getDocumentAttributes(),
2788  ) );
2789  $pieces[] = Html::openElement( 'head' );
2790 
2791  if ( $this->getHTMLTitle() == '' ) {
2792  $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() )->inContentLanguage() );
2793  }
2794 
2795  if ( !Html::isXmlMimeType( $this->getConfig()->get( 'MimeType' ) ) ) {
2796  // Add <meta charset="UTF-8">
2797  // This should be before <title> since it defines the charset used by
2798  // text including the text inside <title>.
2799  // The spec recommends defining XHTML5's charset using the XML declaration
2800  // instead of meta.
2801  // Our XML declaration is output by Html::htmlHeader.
2802  // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
2803  // http://www.whatwg.org/html/semantics.html#charset
2804  $pieces[] = Html::element( 'meta', [ 'charset' => 'UTF-8' ] );
2805  }
2806 
2807  $pieces[] = Html::element( 'title', null, $this->getHTMLTitle() );
2808  $pieces[] = $this->getRlClient()->getHeadHtml();
2809  $pieces[] = $this->buildExemptModules();
2810  $pieces = array_merge( $pieces, array_values( $this->getHeadLinksArray() ) );
2811  $pieces = array_merge( $pieces, array_values( $this->mHeadItems ) );
2812  $pieces[] = Html::closeElement( 'head' );
2813 
2814  $bodyClasses = [];
2815  $bodyClasses[] = 'mediawiki';
2816 
2817  # Classes for LTR/RTL directionality support
2818  $bodyClasses[] = $userdir;
2819  $bodyClasses[] = "sitedir-$sitedir";
2820 
2821  if ( $this->getLanguage()->capitalizeAllNouns() ) {
2822  # A <body> class is probably not the best way to do this . . .
2823  $bodyClasses[] = 'capitalize-all-nouns';
2824  }
2825 
2826  // Parser feature migration class
2827  // The idea is that this will eventually be removed, after the wikitext
2828  // which requires it is cleaned up.
2829  $bodyClasses[] = 'mw-hide-empty-elt';
2830 
2831  $bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
2832  $bodyClasses[] = 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
2833  $bodyClasses[] =
2834  'action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
2835 
2836  $bodyAttrs = [];
2837  // While the implode() is not strictly needed, it's used for backwards compatibility
2838  // (this used to be built as a string and hooks likely still expect that).
2839  $bodyAttrs['class'] = implode( ' ', $bodyClasses );
2840 
2841  // Allow skins and extensions to add body attributes they need
2842  $sk->addToBodyAttributes( $this, $bodyAttrs );
2843  Hooks::run( 'OutputPageBodyAttributes', [ $this, $sk, &$bodyAttrs ] );
2844 
2845  $pieces[] = Html::openElement( 'body', $bodyAttrs );
2846 
2847  return self::combineWrappedStrings( $pieces );
2848  }
2849 
2855  public function getResourceLoader() {
2856  if ( is_null( $this->mResourceLoader ) ) {
2857  $this->mResourceLoader = new ResourceLoader(
2858  $this->getConfig(),
2859  LoggerFactory::getInstance( 'resourceloader' )
2860  );
2861  }
2862  return $this->mResourceLoader;
2863  }
2864 
2873  public function makeResourceLoaderLink( $modules, $only, array $extraQuery = [] ) {
2874  // Apply 'target' and 'origin' filters
2875  $modules = $this->filterModules( (array)$modules, null, $only );
2876 
2878  $this->getRlClientContext(),
2879  $modules,
2880  $only,
2881  $extraQuery
2882  );
2883  }
2884 
2891  protected static function combineWrappedStrings( array $chunks ) {
2892  // Filter out empty values
2893  $chunks = array_filter( $chunks, 'strlen' );
2894  return WrappedString::join( "\n", $chunks );
2895  }
2896 
2897  private function isUserJsPreview() {
2898  return $this->getConfig()->get( 'AllowUserJs' )
2899  && $this->getTitle()
2900  && $this->getTitle()->isJsSubpage()
2901  && $this->userCanPreview();
2902  }
2903 
2904  private function isUserCssPreview() {
2905  return $this->getConfig()->get( 'AllowUserCss' )
2906  && $this->getTitle()
2907  && $this->getTitle()->isCssSubpage()
2908  && $this->userCanPreview();
2909  }
2910 
2917  public function getBottomScripts() {
2918  $chunks = [];
2919  $chunks[] = $this->getRlClient()->getBodyHtml();
2920 
2921  // Legacy non-ResourceLoader scripts
2922  $chunks[] = $this->mScripts;
2923 
2924  // Exempt 'user' module
2925  // - May need excludepages for live preview. (T28283)
2926  // - Must use TYPE_COMBINED so its response is handled by mw.loader.implement() which
2927  // ensures execution is scheduled after the "site" module.
2928  // - Don't load if module state is already resolved as "ready".
2929  if ( $this->rlUserModuleState === 'loading' ) {
2930  if ( $this->isUserJsPreview() ) {
2931  $chunks[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_COMBINED,
2932  [ 'excludepage' => $this->getTitle()->getPrefixedDBkey() ]
2933  );
2935  Xml::encodeJsCall( 'mw.loader.using', [
2936  [ 'user', 'site' ],
2937  new XmlJsCode(
2938  'function () {'
2939  . Xml::encodeJsCall( '$.globalEval', [
2940  $this->getRequest()->getText( 'wpTextbox1' )
2941  ] )
2942  . '}'
2943  )
2944  ] )
2945  );
2946  // FIXME: If the user is previewing, say, ./vector.js, his ./common.js will be loaded
2947  // asynchronously and may arrive *after* the inline script here. So the previewed code
2948  // may execute before ./common.js runs. Normally, ./common.js runs before ./vector.js.
2949  // Similarly, when previewing ./common.js and the user module does arrive first,
2950  // it will arrive without common.js and the inline script runs after.
2951  // Thus running common after the excluded subpage.
2952  } else {
2953  // Load normally
2954  $chunks[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_COMBINED );
2955  }
2956  }
2957 
2958  return self::combineWrappedStrings( $chunks );
2959  }
2960 
2967  public function getJsConfigVars() {
2968  return $this->mJsConfigVars;
2969  }
2970 
2977  public function addJsConfigVars( $keys, $value = null ) {
2978  if ( is_array( $keys ) ) {
2979  foreach ( $keys as $key => $value ) {
2980  $this->mJsConfigVars[$key] = $value;
2981  }
2982  return;
2983  }
2984 
2985  $this->mJsConfigVars[$keys] = $value;
2986  }
2987 
2997  public function getJSVars() {
2999 
3000  $curRevisionId = 0;
3001  $articleId = 0;
3002  $canonicalSpecialPageName = false; # bug 21115
3003 
3004  $title = $this->getTitle();
3005  $ns = $title->getNamespace();
3006  $canonicalNamespace = MWNamespace::exists( $ns )
3008  : $title->getNsText();
3009 
3010  $sk = $this->getSkin();
3011  // Get the relevant title so that AJAX features can use the correct page name
3012  // when making API requests from certain special pages (bug 34972).
3013  $relevantTitle = $sk->getRelevantTitle();
3014  $relevantUser = $sk->getRelevantUser();
3015 
3016  if ( $ns == NS_SPECIAL ) {
3017  list( $canonicalSpecialPageName, /*...*/ ) =
3018  SpecialPageFactory::resolveAlias( $title->getDBkey() );
3019  } elseif ( $this->canUseWikiPage() ) {
3020  $wikiPage = $this->getWikiPage();
3021  $curRevisionId = $wikiPage->getLatest();
3022  $articleId = $wikiPage->getId();
3023  }
3024 
3025  $lang = $title->getPageViewLanguage();
3026 
3027  // Pre-process information
3028  $separatorTransTable = $lang->separatorTransformTable();
3029  $separatorTransTable = $separatorTransTable ? $separatorTransTable : [];
3030  $compactSeparatorTransTable = [
3031  implode( "\t", array_keys( $separatorTransTable ) ),
3032  implode( "\t", $separatorTransTable ),
3033  ];
3034  $digitTransTable = $lang->digitTransformTable();
3035  $digitTransTable = $digitTransTable ? $digitTransTable : [];
3036  $compactDigitTransTable = [
3037  implode( "\t", array_keys( $digitTransTable ) ),
3038  implode( "\t", $digitTransTable ),
3039  ];
3040 
3041  $user = $this->getUser();
3042 
3043  $vars = [
3044  'wgCanonicalNamespace' => $canonicalNamespace,
3045  'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3046  'wgNamespaceNumber' => $title->getNamespace(),
3047  'wgPageName' => $title->getPrefixedDBkey(),
3048  'wgTitle' => $title->getText(),
3049  'wgCurRevisionId' => $curRevisionId,
3050  'wgRevisionId' => (int)$this->getRevisionId(),
3051  'wgArticleId' => $articleId,
3052  'wgIsArticle' => $this->isArticle(),
3053  'wgIsRedirect' => $title->isRedirect(),
3054  'wgAction' => Action::getActionName( $this->getContext() ),
3055  'wgUserName' => $user->isAnon() ? null : $user->getName(),
3056  'wgUserGroups' => $user->getEffectiveGroups(),
3057  'wgCategories' => $this->getCategories(),
3058  'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
3059  'wgPageContentLanguage' => $lang->getCode(),
3060  'wgPageContentModel' => $title->getContentModel(),
3061  'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3062  'wgDigitTransformTable' => $compactDigitTransTable,
3063  'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
3064  'wgMonthNames' => $lang->getMonthNamesArray(),
3065  'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
3066  'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3067  'wgRelevantArticleId' => $relevantTitle->getArticleID(),
3068  'wgRequestId' => WebRequest::getRequestId(),
3069  ];
3070 
3071  if ( $user->isLoggedIn() ) {
3072  $vars['wgUserId'] = $user->getId();
3073  $vars['wgUserEditCount'] = $user->getEditCount();
3074  $userReg = $user->getRegistration();
3075  $vars['wgUserRegistration'] = $userReg ? wfTimestamp( TS_UNIX, $userReg ) * 1000 : null;
3076  // Get the revision ID of the oldest new message on the user's talk
3077  // page. This can be used for constructing new message alerts on
3078  // the client side.
3079  $vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
3080  }
3081 
3082  if ( $wgContLang->hasVariants() ) {
3083  $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
3084  }
3085  // Same test as SkinTemplate
3086  $vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user )
3087  && ( $title->exists() || $title->quickUserCan( 'create', $user ) );
3088 
3089  foreach ( $title->getRestrictionTypes() as $type ) {
3090  $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
3091  }
3092 
3093  if ( $title->isMainPage() ) {
3094  $vars['wgIsMainPage'] = true;
3095  }
3096 
3097  if ( $this->mRedirectedFrom ) {
3098  $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3099  }
3100 
3101  if ( $relevantUser ) {
3102  $vars['wgRelevantUserName'] = $relevantUser->getName();
3103  }
3104 
3105  // Allow extensions to add their custom variables to the mw.config map.
3106  // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
3107  // page-dependant but site-wide (without state).
3108  // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
3109  Hooks::run( 'MakeGlobalVariablesScript', [ &$vars, $this ] );
3110 
3111  // Merge in variables from addJsConfigVars last
3112  return array_merge( $vars, $this->getJsConfigVars() );
3113  }
3114 
3124  public function userCanPreview() {
3125  $request = $this->getRequest();
3126  if (
3127  $request->getVal( 'action' ) !== 'submit' ||
3128  !$request->getCheck( 'wpPreview' ) ||
3129  !$request->wasPosted()
3130  ) {
3131  return false;
3132  }
3133 
3134  $user = $this->getUser();
3135 
3136  if ( !$user->isLoggedIn() ) {
3137  // Anons have predictable edit tokens
3138  return false;
3139  }
3140  if ( !$user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
3141  return false;
3142  }
3143 
3144  $title = $this->getTitle();
3145  if ( !$title->isJsSubpage() && !$title->isCssSubpage() ) {
3146  return false;
3147  }
3148  if ( !$title->isSubpageOf( $user->getUserPage() ) ) {
3149  // Don't execute another user's CSS or JS on preview (T85855)
3150  return false;
3151  }
3152 
3153  $errors = $title->getUserPermissionsErrors( 'edit', $user );
3154  if ( count( $errors ) !== 0 ) {
3155  return false;
3156  }
3157 
3158  return true;
3159  }
3160 
3164  public function getHeadLinksArray() {
3166 
3167  $tags = [];
3168  $config = $this->getConfig();
3169 
3170  $canonicalUrl = $this->mCanonicalUrl;
3171 
3172  $tags['meta-generator'] = Html::element( 'meta', [
3173  'name' => 'generator',
3174  'content' => "MediaWiki $wgVersion",
3175  ] );
3176 
3177  if ( $config->get( 'ReferrerPolicy' ) !== false ) {
3178  $tags['meta-referrer'] = Html::element( 'meta', [
3179  'name' => 'referrer',
3180  'content' => $config->get( 'ReferrerPolicy' )
3181  ] );
3182  }
3183 
3184  $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
3185  if ( $p !== 'index,follow' ) {
3186  // http://www.robotstxt.org/wc/meta-user.html
3187  // Only show if it's different from the default robots policy
3188  $tags['meta-robots'] = Html::element( 'meta', [
3189  'name' => 'robots',
3190  'content' => $p,
3191  ] );
3192  }
3193 
3194  foreach ( $this->mMetatags as $tag ) {
3195  if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) {
3196  $a = 'http-equiv';
3197  $tag[0] = substr( $tag[0], 5 );
3198  } else {
3199  $a = 'name';
3200  }
3201  $tagName = "meta-{$tag[0]}";
3202  if ( isset( $tags[$tagName] ) ) {
3203  $tagName .= $tag[1];
3204  }
3205  $tags[$tagName] = Html::element( 'meta',
3206  [
3207  $a => $tag[0],
3208  'content' => $tag[1]
3209  ]
3210  );
3211  }
3212 
3213  foreach ( $this->mLinktags as $tag ) {
3214  $tags[] = Html::element( 'link', $tag );
3215  }
3216 
3217  # Universal edit button
3218  if ( $config->get( 'UniversalEditButton' ) && $this->isArticleRelated() ) {
3219  $user = $this->getUser();
3220  if ( $this->getTitle()->quickUserCan( 'edit', $user )
3221  && ( $this->getTitle()->exists() ||
3222  $this->getTitle()->quickUserCan( 'create', $user ) )
3223  ) {
3224  // Original UniversalEditButton
3225  $msg = $this->msg( 'edit' )->text();
3226  $tags['universal-edit-button'] = Html::element( 'link', [
3227  'rel' => 'alternate',
3228  'type' => 'application/x-wiki',
3229  'title' => $msg,
3230  'href' => $this->getTitle()->getEditURL(),
3231  ] );
3232  // Alternate edit link
3233  $tags['alternative-edit'] = Html::element( 'link', [
3234  'rel' => 'edit',
3235  'title' => $msg,
3236  'href' => $this->getTitle()->getEditURL(),
3237  ] );
3238  }
3239  }
3240 
3241  # Generally the order of the favicon and apple-touch-icon links
3242  # should not matter, but Konqueror (3.5.9 at least) incorrectly
3243  # uses whichever one appears later in the HTML source. Make sure
3244  # apple-touch-icon is specified first to avoid this.
3245  if ( $config->get( 'AppleTouchIcon' ) !== false ) {
3246  $tags['apple-touch-icon'] = Html::element( 'link', [
3247  'rel' => 'apple-touch-icon',
3248  'href' => $config->get( 'AppleTouchIcon' )
3249  ] );
3250  }
3251 
3252  if ( $config->get( 'Favicon' ) !== false ) {
3253  $tags['favicon'] = Html::element( 'link', [
3254  'rel' => 'shortcut icon',
3255  'href' => $config->get( 'Favicon' )
3256  ] );
3257  }
3258 
3259  # OpenSearch description link
3260  $tags['opensearch'] = Html::element( 'link', [
3261  'rel' => 'search',
3262  'type' => 'application/opensearchdescription+xml',
3263  'href' => wfScript( 'opensearch_desc' ),
3264  'title' => $this->msg( 'opensearch-desc' )->inContentLanguage()->text(),
3265  ] );
3266 
3267  if ( $config->get( 'EnableAPI' ) ) {
3268  # Real Simple Discovery link, provides auto-discovery information
3269  # for the MediaWiki API (and potentially additional custom API
3270  # support such as WordPress or Twitter-compatible APIs for a
3271  # blogging extension, etc)
3272  $tags['rsd'] = Html::element( 'link', [
3273  'rel' => 'EditURI',
3274  'type' => 'application/rsd+xml',
3275  // Output a protocol-relative URL here if $wgServer is protocol-relative.
3276  // Whether RSD accepts relative or protocol-relative URLs is completely
3277  // undocumented, though.
3278  'href' => wfExpandUrl( wfAppendQuery(
3279  wfScript( 'api' ),
3280  [ 'action' => 'rsd' ] ),
3282  ),
3283  ] );
3284  }
3285 
3286  # Language variants
3287  if ( !$config->get( 'DisableLangConversion' ) ) {
3288  $lang = $this->getTitle()->getPageLanguage();
3289  if ( $lang->hasVariants() ) {
3290  $variants = $lang->getVariants();
3291  foreach ( $variants as $variant ) {
3292  $tags["variant-$variant"] = Html::element( 'link', [
3293  'rel' => 'alternate',
3294  'hreflang' => wfBCP47( $variant ),
3295  'href' => $this->getTitle()->getLocalURL(
3296  [ 'variant' => $variant ] )
3297  ]
3298  );
3299  }
3300  # x-default link per https://support.google.com/webmasters/answer/189077?hl=en
3301  $tags["variant-x-default"] = Html::element( 'link', [
3302  'rel' => 'alternate',
3303  'hreflang' => 'x-default',
3304  'href' => $this->getTitle()->getLocalURL() ] );
3305  }
3306  }
3307 
3308  # Copyright
3309  if ( $this->copyrightUrl !== null ) {
3310  $copyright = $this->copyrightUrl;
3311  } else {
3312  $copyright = '';
3313  if ( $config->get( 'RightsPage' ) ) {
3314  $copy = Title::newFromText( $config->get( 'RightsPage' ) );
3315 
3316  if ( $copy ) {
3317  $copyright = $copy->getLocalURL();
3318  }
3319  }
3320 
3321  if ( !$copyright && $config->get( 'RightsUrl' ) ) {
3322  $copyright = $config->get( 'RightsUrl' );
3323  }
3324  }
3325 
3326  if ( $copyright ) {
3327  $tags['copyright'] = Html::element( 'link', [
3328  'rel' => 'copyright',
3329  'href' => $copyright ]
3330  );
3331  }
3332 
3333  # Feeds
3334  if ( $config->get( 'Feed' ) ) {
3335  $feedLinks = [];
3336 
3337  foreach ( $this->getSyndicationLinks() as $format => $link ) {
3338  # Use the page name for the title. In principle, this could
3339  # lead to issues with having the same name for different feeds
3340  # corresponding to the same page, but we can't avoid that at
3341  # this low a level.
3342 
3343  $feedLinks[] = $this->feedLink(
3344  $format,
3345  $link,
3346  # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
3347  $this->msg(
3348  "page-{$format}-feed", $this->getTitle()->getPrefixedText()
3349  )->text()
3350  );
3351  }
3352 
3353  # Recent changes feed should appear on every page (except recentchanges,
3354  # that would be redundant). Put it after the per-page feed to avoid
3355  # changing existing behavior. It's still available, probably via a
3356  # menu in your browser. Some sites might have a different feed they'd
3357  # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3358  # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3359  # If so, use it instead.
3360  $sitename = $config->get( 'Sitename' );
3361  if ( $config->get( 'OverrideSiteFeed' ) ) {
3362  foreach ( $config->get( 'OverrideSiteFeed' ) as $type => $feedUrl ) {
3363  // Note, this->feedLink escapes the url.
3364  $feedLinks[] = $this->feedLink(
3365  $type,
3366  $feedUrl,
3367  $this->msg( "site-{$type}-feed", $sitename )->text()
3368  );
3369  }
3370  } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
3371  $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
3372  foreach ( $config->get( 'AdvertisedFeedTypes' ) as $format ) {
3373  $feedLinks[] = $this->feedLink(
3374  $format,
3375  $rctitle->getLocalURL( [ 'feed' => $format ] ),
3376  # For grep: 'site-rss-feed', 'site-atom-feed'
3377  $this->msg( "site-{$format}-feed", $sitename )->text()
3378  );
3379  }
3380  }
3381 
3382  # Allow extensions to change the list pf feeds. This hook is primarily for changing,
3383  # manipulating or removing existing feed tags. If you want to add new feeds, you should
3384  # use OutputPage::addFeedLink() instead.
3385  Hooks::run( 'AfterBuildFeedLinks', [ &$feedLinks ] );
3386 
3387  $tags += $feedLinks;
3388  }
3389 
3390  # Canonical URL
3391  if ( $config->get( 'EnableCanonicalServerLink' ) ) {
3392  if ( $canonicalUrl !== false ) {
3393  $canonicalUrl = wfExpandUrl( $canonicalUrl, PROTO_CANONICAL );
3394  } else {
3395  if ( $this->isArticleRelated() ) {
3396  // This affects all requests where "setArticleRelated" is true. This is
3397  // typically all requests that show content (query title, curid, oldid, diff),
3398  // and all wikipage actions (edit, delete, purge, info, history etc.).
3399  // It does not apply to File pages and Special pages.
3400  // 'history' and 'info' actions address page metadata rather than the page
3401  // content itself, so they may not be canonicalized to the view page url.
3402  // TODO: this ought to be better encapsulated in the Action class.
3403  $action = Action::getActionName( $this->getContext() );
3404  if ( in_array( $action, [ 'history', 'info' ] ) ) {
3405  $query = "action={$action}";
3406  } else {
3407  $query = '';
3408  }
3409  $canonicalUrl = $this->getTitle()->getCanonicalURL( $query );
3410  } else {
3411  $reqUrl = $this->getRequest()->getRequestURL();
3412  $canonicalUrl = wfExpandUrl( $reqUrl, PROTO_CANONICAL );
3413  }
3414  }
3415  }
3416  if ( $canonicalUrl !== false ) {
3417  $tags[] = Html::element( 'link', [
3418  'rel' => 'canonical',
3419  'href' => $canonicalUrl
3420  ] );
3421  }
3422 
3423  return $tags;
3424  }
3425 
3431  public function getHeadLinks() {
3432  wfDeprecated( __METHOD__, '1.24' );
3433  return implode( "\n", $this->getHeadLinksArray() );
3434  }
3435 
3444  private function feedLink( $type, $url, $text ) {
3445  return Html::element( 'link', [
3446  'rel' => 'alternate',
3447  'type' => "application/$type+xml",
3448  'title' => $text,
3449  'href' => $url ]
3450  );
3451  }
3452 
3462  public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
3463  $options = [];
3464  if ( $media ) {
3465  $options['media'] = $media;
3466  }
3467  if ( $condition ) {
3468  $options['condition'] = $condition;
3469  }
3470  if ( $dir ) {
3471  $options['dir'] = $dir;
3472  }
3473  $this->styles[$style] = $options;
3474  }
3475 
3483  public function addInlineStyle( $style_css, $flip = 'noflip' ) {
3484  if ( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
3485  # If wanted, and the interface is right-to-left, flip the CSS
3486  $style_css = CSSJanus::transform( $style_css, true, false );
3487  }
3488  $this->mInlineStyles .= Html::inlineStyle( $style_css );
3489  }
3490 
3496  protected function buildExemptModules() {
3498 
3500  $chunks = [];
3501  // Things that go after the ResourceLoaderDynamicStyles marker
3502  $append = [];
3503 
3504  // Exempt 'user' styles module (may need 'excludepages' for live preview)
3505  if ( $this->isUserCssPreview() ) {
3506  $append[] = $this->makeResourceLoaderLink(
3507  'user.styles',
3509  [ 'excludepage' => $this->getTitle()->getPrefixedDBkey() ]
3510  );
3511 
3512  // Load the previewed CSS. Janus it if needed.
3513  // User-supplied CSS is assumed to in the wiki's content language.
3514  $previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
3515  if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
3516  $previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
3517  }
3518  $append[] = Html::inlineStyle( $previewedCSS );
3519  }
3520 
3521  // We want site, private and user styles to override dynamically added styles from
3522  // general modules, but we want dynamically added styles to override statically added
3523  // style modules. So the order has to be:
3524  // - page style modules (formatted by ResourceLoaderClientHtml::getHeadHtml())
3525  // - dynamically loaded styles (added by mw.loader before ResourceLoaderDynamicStyles)
3526  // - ResourceLoaderDynamicStyles marker
3527  // - site/private/user styles
3528 
3529  // Add legacy styles added through addStyle()/addInlineStyle() here
3530  $chunks[] = implode( '', $this->buildCssLinksArray() ) . $this->mInlineStyles;
3531 
3532  $chunks[] = Html::element(
3533  'meta',
3534  [ 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ]
3535  );
3536 
3537  foreach ( $this->rlExemptStyleModules as $group => $moduleNames ) {
3538  $chunks[] = $this->makeResourceLoaderLink( $moduleNames,
3540  );
3541  }
3542 
3543  return self::combineWrappedStrings( array_merge( $chunks, $append ) );
3544  }
3545 
3549  public function buildCssLinksArray() {
3550  $links = [];
3551 
3552  // Add any extension CSS
3553  foreach ( $this->mExtStyles as $url ) {
3554  $this->addStyle( $url );
3555  }
3556  $this->mExtStyles = [];
3557 
3558  foreach ( $this->styles as $file => $options ) {
3559  $link = $this->styleLink( $file, $options );
3560  if ( $link ) {
3561  $links[$file] = $link;
3562  }
3563  }
3564  return $links;
3565  }
3566 
3574  protected function styleLink( $style, array $options ) {
3575  if ( isset( $options['dir'] ) ) {
3576  if ( $this->getLanguage()->getDir() != $options['dir'] ) {
3577  return '';
3578  }
3579  }
3580 
3581  if ( isset( $options['media'] ) ) {
3582  $media = self::transformCssMedia( $options['media'] );
3583  if ( is_null( $media ) ) {
3584  return '';
3585  }
3586  } else {
3587  $media = 'all';
3588  }
3589 
3590  if ( substr( $style, 0, 1 ) == '/' ||
3591  substr( $style, 0, 5 ) == 'http:' ||
3592  substr( $style, 0, 6 ) == 'https:' ) {
3593  $url = $style;
3594  } else {
3595  $config = $this->getConfig();
3596  $url = $config->get( 'StylePath' ) . '/' . $style . '?' .
3597  $config->get( 'StyleVersion' );
3598  }
3599 
3600  $link = Html::linkedStyle( $url, $media );
3601 
3602  if ( isset( $options['condition'] ) ) {
3603  $condition = htmlspecialchars( $options['condition'] );
3604  $link = "<!--[if $condition]>$link<![endif]-->";
3605  }
3606  return $link;
3607  }
3608 
3630  public static function transformResourcePath( Config $config, $path ) {
3631  global $IP;
3632  $remotePathPrefix = $config->get( 'ResourceBasePath' );
3633  if ( $remotePathPrefix === '' ) {
3634  // The configured base path is required to be empty string for
3635  // wikis in the domain root
3636  $remotePath = '/';
3637  } else {
3638  $remotePath = $remotePathPrefix;
3639  }
3640  if ( strpos( $path, $remotePath ) !== 0 ) {
3641  // Path is outside wgResourceBasePath, ignore.
3642  return $path;
3643  }
3644  $path = RelPath\getRelativePath( $path, $remotePath );
3645  return self::transformFilePath( $remotePathPrefix, $IP, $path );
3646  }
3647 
3659  public static function transformFilePath( $remotePathPrefix, $localPath, $file ) {
3660  $hash = md5_file( "$localPath/$file" );
3661  if ( $hash === false ) {
3662  wfLogWarning( __METHOD__ . ": Failed to hash $localPath/$file" );
3663  $hash = '';
3664  }
3665  return "$remotePathPrefix/$file?" . substr( $hash, 0, 5 );
3666  }
3667 
3675  public static function transformCssMedia( $media ) {
3677 
3678  // http://www.w3.org/TR/css3-mediaqueries/#syntax
3679  $screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
3680 
3681  // Switch in on-screen display for media testing
3682  $switches = [
3683  'printable' => 'print',
3684  'handheld' => 'handheld',
3685  ];
3686  foreach ( $switches as $switch => $targetMedia ) {
3687  if ( $wgRequest->getBool( $switch ) ) {
3688  if ( $media == $targetMedia ) {
3689  $media = '';
3690  } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3691  /* This regex will not attempt to understand a comma-separated media_query_list
3692  *
3693  * Example supported values for $media:
3694  * 'screen', 'only screen', 'screen and (min-width: 982px)' ),
3695  * Example NOT supported value for $media:
3696  * '3d-glasses, screen, print and resolution > 90dpi'
3697  *
3698  * If it's a print request, we never want any kind of screen stylesheets
3699  * If it's a handheld request (currently the only other choice with a switch),
3700  * we don't want simple 'screen' but we might want screen queries that
3701  * have a max-width or something, so we'll pass all others on and let the
3702  * client do the query.
3703  */
3704  if ( $targetMedia == 'print' || $media == 'screen' ) {
3705  return null;
3706  }
3707  }
3708  }
3709  }
3710 
3711  return $media;
3712  }
3713 
3720  public function addWikiMsg( /*...*/ ) {
3721  $args = func_get_args();
3722  $name = array_shift( $args );
3723  $this->addWikiMsgArray( $name, $args );
3724  }
3725 
3734  public function addWikiMsgArray( $name, $args ) {
3735  $this->addHTML( $this->msg( $name, $args )->parseAsBlock() );
3736  }
3737 
3763  public function wrapWikiMsg( $wrap /*, ...*/ ) {
3764  $msgSpecs = func_get_args();
3765  array_shift( $msgSpecs );
3766  $msgSpecs = array_values( $msgSpecs );
3767  $s = $wrap;
3768  foreach ( $msgSpecs as $n => $spec ) {
3769  if ( is_array( $spec ) ) {
3770  $args = $spec;
3771  $name = array_shift( $args );
3772  if ( isset( $args['options'] ) ) {
3773  unset( $args['options'] );
3774  wfDeprecated(
3775  'Adding "options" to ' . __METHOD__ . ' is no longer supported',
3776  '1.20'
3777  );
3778  }
3779  } else {
3780  $args = [];
3781  $name = $spec;
3782  }
3783  $s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
3784  }
3785  $this->addWikiText( $s );
3786  }
3787 
3793  public function enableTOC( $flag = true ) {
3794  $this->mEnableTOC = $flag;
3795  }
3796 
3801  public function isTOCEnabled() {
3802  return $this->mEnableTOC;
3803  }
3804 
3810  public function enableSectionEditLinks( $flag = true ) {
3811  $this->mEnableSectionEditLinks = $flag;
3812  }
3813 
3818  public function sectionEditLinksEnabled() {
3820  }
3821 
3829  public static function setupOOUI( $skinName = '', $dir = 'ltr' ) {
3830  $themes = ExtensionRegistry::getInstance()->getAttribute( 'SkinOOUIThemes' );
3831  // Make keys (skin names) lowercase for case-insensitive matching.
3832  $themes = array_change_key_case( $themes, CASE_LOWER );
3833  $theme = isset( $themes[$skinName] ) ? $themes[$skinName] : 'MediaWiki';
3834  // For example, 'OOUI\MediaWikiTheme'.
3835  $themeClass = "OOUI\\{$theme}Theme";
3836  OOUI\Theme::setSingleton( new $themeClass() );
3837  OOUI\Element::setDefaultDir( $dir );
3838  }
3839 
3846  public function enableOOUI() {
3847  self::setupOOUI(
3848  strtolower( $this->getSkin()->getSkinName() ),
3849  $this->getLanguage()->getDir()
3850  );
3851  $this->addModuleStyles( [
3852  'oojs-ui-core.styles',
3853  'oojs-ui.styles.icons',
3854  'oojs-ui.styles.indicators',
3855  'oojs-ui.styles.textures',
3856  'mediawiki.widgets.styles',
3857  ] );
3858  }
3859 }
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:802
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:802
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:2889
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:1230
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:6034
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:1046
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:1046
$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#l01936">hooks.txt:1936</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#l03549">OutputPage.php:3549</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#l02664">OutputPage.php:2664</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#l01895">OutputPage.php:1895</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#l03574">OutputPage.php:3574</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#l01421">ResourceLoader.php:1421</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#l00953">hooks.txt:953</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#l03462">OutputPage.php:3462</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#l01007">hooks.txt:1007</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#l02613">OutputPage.php:2613</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#l02016">OutputPage.php:2016</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#l00802">hooks.txt:802</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#l01855">OutputPage.php:1855</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#l00660">ParserOptions.php:660</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#l00242">hooks.txt:242</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#l01476">ResourceLoader.php:1476</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#l01722">OutputPage.php:1722</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#l03431">OutputPage.php:3431</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#l02573">hooks.txt:2573</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#l01904">OutputPage.php:1904</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#l01579">OutputPage.php:1579</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#l02601">OutputPage.php:2601</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#l02496">OutputPage.php:2496</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#l00336">SpecialPageFactory.php:336</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#l03793">OutputPage.php:3793</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#l03675">OutputPage.php:3675</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#l02855">OutputPage.php:2855</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#l01568">OutputPage.php:1568</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#l03829">OutputPage.php:3829</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#l01612">OutputPage.php:1612</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#l03763">OutputPage.php:3763</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#l02917">OutputPage.php:2917</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#l01599">OutputPage.php:1599</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#l02625">OutputPage.php:2625</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#l01556">ResourceLoader.php:1556</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#l01558">OutputPage.php:1558</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#l02049">OutputPage.php:2049</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#l02241">OutputPage.php:2241</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#l02597">OutputPage.php:2597</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#l02420">OutputPage.php:2420</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#l01974">OutputPage.php:1974</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#l02609">OutputPage.php:2609</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#l01681">OutputPage.php:1681</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#l02032">OutputPage.php:2032</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#l02159">hooks.txt:2159</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#l02491">hooks.txt:2491</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#l01589">OutputPage.php:1589</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#l02977">OutputPage.php:2977</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#l00300">hooks.txt:300</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#l00912">Article.php:912</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_b0f92a87ee026d34ca8fad24187d57bf.html">includes</a></li><li class="navelem"><a class="el" href="OutputPage_8php.html">OutputPage.php</a></li> <li class="footer">Generated on Mon Feb 20 2017 09:15:49 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>