MediaWiki  1.23.16
OutputPage.php
Go to the documentation of this file.
1 <?php
38 class OutputPage extends ContextSource {
40  var $mMetatags = array();
41 
42  var $mLinktags = array();
43  var $mCanonicalUrl = false;
44 
46  var $mExtStyles = array();
47 
49  var $mPagetitle = '';
50 
52  var $mBodytext = '';
53 
59  public $mDebugtext = '';
60 
62  var $mHTMLtitle = '';
63 
65  var $mIsarticle = false;
66 
71  var $mIsArticleRelated = true;
72 
77  var $mPrintable = false;
78 
85  private $mSubtitle = array();
86 
87  var $mRedirect = '';
89 
94  var $mLastModified = '';
95 
106  var $mETag = false;
107 
110 
113 
120  var $mScripts = '';
121 
125  var $mInlineStyles = '';
126 
127  //
129 
134  var $mPageLinkTitle = '';
135 
138 
139  // @todo FIXME: Next variables probably comes from the resource loader
143 
146 
149 
150  var $mRedirectCode = '';
151 
153 
159  protected $mAllowedModules = array(
161  );
162 
168  var $mDoNothing = false;
169 
170  // Parser related.
172 
177  protected $mParserOptions = null;
178 
185  var $mFeedLinks = array();
186 
187  // Gwicke work on squid caching? Roughly from 2003.
188  var $mEnableClientCache = true;
189 
194  var $mArticleBodyOnly = false;
195 
196  var $mNewSectionLink = false;
197  var $mHideNewSectionLink = false;
198 
204  var $mNoGallery = false;
205 
206  // should be private.
207  var $mPageTitleActionText = '';
208  var $mParseWarnings = array();
209 
210  // Cache stuff. Looks like mEnableClientCache
211  var $mSquidMaxage = 0;
213  protected $mCdnMaxageLimit = INF;
214 
215  // @todo document
217 
219  var $mRevisionId = null;
220  private $mRevisionTimestamp = null;
221 
222  var $mFileVersion = null;
223 
232  var $styles = array();
233 
237  protected $mJQueryDone = false;
238 
239  private $mIndexPolicy = 'index';
240  private $mFollowPolicy = 'follow';
241  private $mVaryHeader = array(
242  'Accept-Encoding' => array( 'list-contains=gzip' ),
243  );
244 
251  private $mRedirectedFrom = null;
252 
256  private $mProperties = array();
257 
261  private $mTarget = null;
262 
266  private $mEnableTOC = true;
267 
271  private $mEnableSectionEditLinks = true;
272 
278  function __construct( IContextSource $context = null ) {
279  if ( $context === null ) {
280  # Extensions should use `new RequestContext` instead of `new OutputPage` now.
281  wfDeprecated( __METHOD__, '1.18' );
282  } else {
283  $this->setContext( $context );
284  }
285  }
286 
293  public function redirect( $url, $responsecode = '302' ) {
294  # Strip newlines as a paranoia check for header injection in PHP<5.1.2
295  $this->mRedirect = str_replace( "\n", '', $url );
296  $this->mRedirectCode = $responsecode;
297  }
298 
304  public function getRedirect() {
305  return $this->mRedirect;
306  }
307 
313  public function setStatusCode( $statusCode ) {
314  $this->mStatusCode = $statusCode;
315  }
316 
324  function addMeta( $name, $val ) {
325  array_push( $this->mMetatags, array( $name, $val ) );
326  }
327 
335  function addLink( $linkarr ) {
336  array_push( $this->mLinktags, $linkarr );
337  }
338 
346  function addMetadataLink( $linkarr ) {
347  $linkarr['rel'] = $this->getMetadataAttribute();
348  $this->addLink( $linkarr );
349  }
350 
355  function setCanonicalUrl( $url ) {
356  $this->mCanonicalUrl = $url;
357  }
358 
364  public function getMetadataAttribute() {
365  # note: buggy CC software only reads first "meta" link
366  static $haveMeta = false;
367  if ( $haveMeta ) {
368  return 'alternate meta';
369  } else {
370  $haveMeta = true;
371  return 'meta';
372  }
373  }
374 
380  function addScript( $script ) {
381  $this->mScripts .= $script . "\n";
382  }
383 
392  public function addExtensionStyle( $url ) {
393  array_push( $this->mExtStyles, $url );
394  }
395 
401  function getExtStyle() {
402  return $this->mExtStyles;
403  }
404 
412  public function addScriptFile( $file, $version = null ) {
413  global $wgStylePath, $wgStyleVersion;
414  // See if $file parameter is an absolute URL or begins with a slash
415  if ( substr( $file, 0, 1 ) == '/' || preg_match( '#^[a-z]*://#i', $file ) ) {
416  $path = $file;
417  } else {
418  $path = "{$wgStylePath}/common/{$file}";
419  }
420  if ( is_null( $version ) ) {
421  $version = $wgStyleVersion;
422  }
424  }
425 
431  public function addInlineScript( $script ) {
432  $this->mScripts .= Html::inlineScript( "\n$script\n" ) . "\n";
433  }
434 
440  function getScript() {
441  return $this->mScripts . $this->getHeadItems();
442  }
443 
452  protected function filterModules( $modules, $position = null, $type = ResourceLoaderModule::TYPE_COMBINED ) {
454  $filteredModules = array();
455  foreach ( $modules as $val ) {
456  $module = $resourceLoader->getModule( $val );
457  if ( $module instanceof ResourceLoaderModule
458  && $module->getOrigin() <= $this->getAllowedModules( $type )
459  && ( is_null( $position ) || $module->getPosition() == $position )
460  && ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) )
461  ) {
462  $filteredModules[] = $val;
463  }
464  }
465  return $filteredModules;
466  }
467 
476  public function getModules( $filter = false, $position = null, $param = 'mModules' ) {
477  $modules = array_values( array_unique( $this->$param ) );
478  return $filter
479  ? $this->filterModules( $modules, $position )
480  : $modules;
481  }
482 
490  public function addModules( $modules ) {
491  $this->mModules = array_merge( $this->mModules, (array)$modules );
492  }
493 
502  public function getModuleScripts( $filter = false, $position = null ) {
503  return $this->getModules( $filter, $position, 'mModuleScripts' );
504  }
505 
513  public function addModuleScripts( $modules ) {
514  $this->mModuleScripts = array_merge( $this->mModuleScripts, (array)$modules );
515  }
516 
525  public function getModuleStyles( $filter = false, $position = null ) {
526  return $this->getModules( $filter, $position, 'mModuleStyles' );
527  }
528 
538  public function addModuleStyles( $modules ) {
539  $this->mModuleStyles = array_merge( $this->mModuleStyles, (array)$modules );
540  }
541 
550  public function getModuleMessages( $filter = false, $position = null ) {
551  return $this->getModules( $filter, $position, 'mModuleMessages' );
552  }
553 
561  public function addModuleMessages( $modules ) {
562  $this->mModuleMessages = array_merge( $this->mModuleMessages, (array)$modules );
563  }
564 
568  public function getTarget() {
569  return $this->mTarget;
570  }
571 
577  public function setTarget( $target ) {
578  $this->mTarget = $target;
579  }
580 
586  function getHeadItemsArray() {
587  return $this->mHeadItems;
588  }
589 
595  function getHeadItems() {
596  $s = '';
597  foreach ( $this->mHeadItems as $item ) {
598  $s .= $item;
599  }
600  return $s;
601  }
602 
609  public function addHeadItem( $name, $value ) {
610  $this->mHeadItems[$name] = $value;
611  }
612 
619  public function hasHeadItem( $name ) {
620  return isset( $this->mHeadItems[$name] );
621  }
622 
628  function setETag( $tag ) {
629  $this->mETag = $tag;
630  }
631 
639  public function setArticleBodyOnly( $only ) {
640  $this->mArticleBodyOnly = $only;
641  }
642 
648  public function getArticleBodyOnly() {
650  }
651 
659  public function setProperty( $name, $value ) {
660  $this->mProperties[$name] = $value;
661  }
662 
670  public function getProperty( $name ) {
671  if ( isset( $this->mProperties[$name] ) ) {
672  return $this->mProperties[$name];
673  } else {
674  return null;
675  }
676  }
677 
689  public function checkLastModified( $timestamp ) {
690  global $wgCachePages, $wgCacheEpoch, $wgUseSquid, $wgSquidMaxage;
691 
692  if ( !$timestamp || $timestamp == '19700101000000' ) {
693  wfDebug( __METHOD__ . ": CACHE DISABLED, NO TIMESTAMP\n" );
694  return false;
695  }
696  if ( !$wgCachePages ) {
697  wfDebug( __METHOD__ . ": CACHE DISABLED\n" );
698  return false;
699  }
700 
702  $modifiedTimes = array(
703  'page' => $timestamp,
704  'user' => $this->getUser()->getTouched(),
705  'epoch' => $wgCacheEpoch
706  );
707  if ( $wgUseSquid ) {
708  // bug 44570: the core page itself may not change, but resources might
709  $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $wgSquidMaxage );
710  }
711  wfRunHooks( 'OutputPageCheckLastModified', array( &$modifiedTimes ) );
712 
713  $maxModified = max( $modifiedTimes );
714  $this->mLastModified = wfTimestamp( TS_RFC2822, $maxModified );
715 
716  $clientHeader = $this->getRequest()->getHeader( 'If-Modified-Since' );
717  if ( $clientHeader === false ) {
718  wfDebug( __METHOD__ . ": client did not send If-Modified-Since header\n", 'log' );
719  return false;
720  }
721 
722  # IE sends sizes after the date like this:
723  # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
724  # this breaks strtotime().
725  $clientHeader = preg_replace( '/;.*$/', '', $clientHeader );
726 
727  wfSuppressWarnings(); // E_STRICT system time bitching
728  $clientHeaderTime = strtotime( $clientHeader );
730  if ( !$clientHeaderTime ) {
731  wfDebug( __METHOD__ . ": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
732  return false;
733  }
734  $clientHeaderTime = wfTimestamp( TS_MW, $clientHeaderTime );
735 
736  # Make debug info
737  $info = '';
738  foreach ( $modifiedTimes as $name => $value ) {
739  if ( $info !== '' ) {
740  $info .= ', ';
741  }
742  $info .= "$name=" . wfTimestamp( TS_ISO_8601, $value );
743  }
744 
745  wfDebug( __METHOD__ . ": client sent If-Modified-Since: " .
746  wfTimestamp( TS_ISO_8601, $clientHeaderTime ) . "\n", 'log' );
747  wfDebug( __METHOD__ . ": effective Last-Modified: " .
748  wfTimestamp( TS_ISO_8601, $maxModified ) . "\n", 'log' );
749  if ( $clientHeaderTime < $maxModified ) {
750  wfDebug( __METHOD__ . ": STALE, $info\n", 'log' );
751  return false;
752  }
753 
754  # Not modified
755  # Give a 304 response code and disable body output
756  wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", 'log' );
757  ini_set( 'zlib.output_compression', 0 );
758  $this->getRequest()->response()->header( "HTTP/1.1 304 Not Modified" );
759  $this->sendCacheControl();
760  $this->disable();
761 
762  // Don't output a compressed blob when using ob_gzhandler;
763  // it's technically against HTTP spec and seems to confuse
764  // Firefox when the response gets split over two packets.
766 
767  return true;
768  }
769 
776  public function setLastModified( $timestamp ) {
777  $this->mLastModified = wfTimestamp( TS_RFC2822, $timestamp );
778  }
779 
788  public function setRobotPolicy( $policy ) {
789  $policy = Article::formatRobotPolicy( $policy );
790 
791  if ( isset( $policy['index'] ) ) {
792  $this->setIndexPolicy( $policy['index'] );
793  }
794  if ( isset( $policy['follow'] ) ) {
795  $this->setFollowPolicy( $policy['follow'] );
796  }
797  }
798 
806  public function setIndexPolicy( $policy ) {
807  $policy = trim( $policy );
808  if ( in_array( $policy, array( 'index', 'noindex' ) ) ) {
809  $this->mIndexPolicy = $policy;
810  }
811  }
812 
820  public function setFollowPolicy( $policy ) {
821  $policy = trim( $policy );
822  if ( in_array( $policy, array( 'follow', 'nofollow' ) ) ) {
823  $this->mFollowPolicy = $policy;
824  }
825  }
826 
833  public function setPageTitleActionText( $text ) {
834  $this->mPageTitleActionText = $text;
835  }
836 
842  public function getPageTitleActionText() {
843  if ( isset( $this->mPageTitleActionText ) ) {
845  }
846  return '';
847  }
848 
855  public function setHTMLTitle( $name ) {
856  if ( $name instanceof Message ) {
857  $this->mHTMLtitle = $name->setContext( $this->getContext() )->text();
858  } else {
859  $this->mHTMLtitle = $name;
860  }
861  }
862 
868  public function getHTMLTitle() {
869  return $this->mHTMLtitle;
870  }
871 
877  public function setRedirectedFrom( $t ) {
878  $this->mRedirectedFrom = $t;
879  }
880 
889  public function setPageTitle( $name ) {
890  if ( $name instanceof Message ) {
891  $name = $name->setContext( $this->getContext() )->text();
892  }
893 
894  # change "<script>foo&bar</script>" to "&lt;script&gt;foo&amp;bar&lt;/script&gt;"
895  # but leave "<i>foobar</i>" alone
897  $this->mPagetitle = $nameWithTags;
898 
899  # change "<i>foo&amp;bar</i>" to "foo&bar"
900  $this->setHTMLTitle(
901  $this->msg( 'pagetitle' )->rawParams( Sanitizer::stripAllTags( $nameWithTags ) )
902  ->inContentLanguage()
903  );
904  }
905 
911  public function getPageTitle() {
912  return $this->mPagetitle;
913  }
914 
920  public function setTitle( Title $t ) {
921  $this->getContext()->setTitle( $t );
922  }
923 
929  public function setSubtitle( $str ) {
930  $this->clearSubtitle();
931  $this->addSubtitle( $str );
932  }
933 
940  public function appendSubtitle( $str ) {
941  $this->addSubtitle( $str );
942  }
943 
949  public function addSubtitle( $str ) {
950  if ( $str instanceof Message ) {
951  $this->mSubtitle[] = $str->setContext( $this->getContext() )->parse();
952  } else {
953  $this->mSubtitle[] = $str;
954  }
955  }
956 
962  public function addBacklinkSubtitle( Title $title ) {
963  $query = array();
964  if ( $title->isRedirect() ) {
965  $query['redirect'] = 'no';
966  }
967  $this->addSubtitle( $this->msg( 'backlinksubtitle' )->rawParams( Linker::link( $title, null, array(), $query ) ) );
968  }
969 
973  public function clearSubtitle() {
974  $this->mSubtitle = array();
975  }
976 
982  public function getSubtitle() {
983  return implode( "<br />\n\t\t\t\t", $this->mSubtitle );
984  }
985 
990  public function setPrintable() {
991  $this->mPrintable = true;
992  }
993 
999  public function isPrintable() {
1000  return $this->mPrintable;
1001  }
1002 
1006  public function disable() {
1007  $this->mDoNothing = true;
1008  }
1009 
1015  public function isDisabled() {
1016  return $this->mDoNothing;
1017  }
1018 
1024  public function showNewSectionLink() {
1025  return $this->mNewSectionLink;
1026  }
1027 
1033  public function forceHideNewSectionLink() {
1035  }
1036 
1045  public function setSyndicated( $show = true ) {
1046  if ( $show ) {
1047  $this->setFeedAppendQuery( false );
1048  } else {
1049  $this->mFeedLinks = array();
1050  }
1051  }
1052 
1062  public function setFeedAppendQuery( $val ) {
1063  global $wgAdvertisedFeedTypes;
1064 
1065  $this->mFeedLinks = array();
1066 
1067  foreach ( $wgAdvertisedFeedTypes as $type ) {
1068  $query = "feed=$type";
1069  if ( is_string( $val ) ) {
1070  $query .= '&' . $val;
1071  }
1072  $this->mFeedLinks[$type] = $this->getTitle()->getLocalURL( $query );
1073  }
1074  }
1082  public function addFeedLink( $format, $href ) {
1083  global $wgAdvertisedFeedTypes;
1084 
1085  if ( in_array( $format, $wgAdvertisedFeedTypes ) ) {
1086  $this->mFeedLinks[$format] = $href;
1087  }
1088  }
1089 
1094  public function isSyndicated() {
1095  return count( $this->mFeedLinks ) > 0;
1096  }
1097 
1102  public function getSyndicationLinks() {
1103  return $this->mFeedLinks;
1104  }
1105 
1111  public function getFeedAppendQuery() {
1113  }
1114 
1122  public function setArticleFlag( $v ) {
1123  $this->mIsarticle = $v;
1124  if ( $v ) {
1125  $this->mIsArticleRelated = $v;
1126  }
1127  }
1135  public function isArticle() {
1136  return $this->mIsarticle;
1137  }
1145  public function setArticleRelated( $v ) {
1146  $this->mIsArticleRelated = $v;
1147  if ( !$v ) {
1148  $this->mIsarticle = false;
1149  }
1150  }
1151 
1157  public function isArticleRelated() {
1158  return $this->mIsArticleRelated;
1159  }
1167  public function addLanguageLinks( $newLinkArray ) {
1168  $this->mLanguageLinks += $newLinkArray;
1169  }
1177  public function setLanguageLinks( $newLinkArray ) {
1178  $this->mLanguageLinks = $newLinkArray;
1179  }
1180 
1186  public function getLanguageLinks() {
1187  return $this->mLanguageLinks;
1188  }
1189 
1195  public function addCategoryLinks( $categories ) {
1197 
1198  if ( !is_array( $categories ) || count( $categories ) == 0 ) {
1199  return;
1200  }
1201 
1202  # Add the links to a LinkBatch
1203  $arr = array( NS_CATEGORY => $categories );
1204  $lb = new LinkBatch;
1205  $lb->setArray( $arr );
1206 
1207  # Fetch existence plus the hiddencat property
1208  $dbr = wfGetDB( DB_SLAVE );
1209  $res = $dbr->select( array( 'page', 'page_props' ),
1210  array( 'page_id', 'page_namespace', 'page_title', 'page_len', 'page_is_redirect', 'page_latest', 'pp_value' ),
1211  $lb->constructSet( 'page', $dbr ),
1212  __METHOD__,
1213  array(),
1214  array( 'page_props' => array( 'LEFT JOIN', array( 'pp_propname' => 'hiddencat', 'pp_page = page_id' ) ) )
1215  );
1216 
1217  # Add the results to the link cache
1218  $lb->addResultToCache( LinkCache::singleton(), $res );
1219 
1220  # Set all the values to 'normal'. This can be done with array_fill_keys in PHP 5.2.0+
1221  $categories = array_combine(
1222  array_keys( $categories ),
1223  array_fill( 0, count( $categories ), 'normal' )
1224  );
1225 
1226  # Mark hidden categories
1227  foreach ( $res as $row ) {
1228  if ( isset( $row->pp_value ) ) {
1229  $categories[$row->page_title] = 'hidden';
1230  }
1231  }
1232 
1233  # Add the remaining categories to the skin
1234  if ( wfRunHooks( 'OutputPageMakeCategoryLinks', array( &$this, $categories, &$this->mCategoryLinks ) ) ) {
1235  foreach ( $categories as $category => $type ) {
1236  $origcategory = $category;
1237  $title = Title::makeTitleSafe( NS_CATEGORY, $category );
1238  $wgContLang->findVariantLink( $category, $title, true );
1239  if ( $category != $origcategory ) {
1240  if ( array_key_exists( $category, $categories ) ) {
1241  continue;
1242  }
1243  }
1244  $text = $wgContLang->convertHtml( $title->getText() );
1245  $this->mCategories[] = $title->getText();
1246  $this->mCategoryLinks[$type][] = Linker::link( $title, $text );
1247  }
1248  }
1249  }
1250 
1256  public function setCategoryLinks( $categories ) {
1257  $this->mCategoryLinks = array();
1258  $this->addCategoryLinks( $categories );
1259  }
1260 
1269  public function getCategoryLinks() {
1270  return $this->mCategoryLinks;
1271  }
1272 
1278  public function getCategories() {
1279  return $this->mCategories;
1280  }
1281 
1290  public function disallowUserJs() {
1291  $this->reduceAllowedModules(
1294  );
1295 
1296  // Site-wide styles are controlled by a config setting, see bug 71621
1297  // for background on why. User styles are never allowed.
1298  if ( $this->getConfig()->get( 'AllowSiteCSSOnRestrictedPages' ) ) {
1300  } else {
1302  }
1303  $this->reduceAllowedModules(
1305  $styleOrigin
1306  );
1307  }
1315  public function isUserJsAllowed() {
1316  wfDeprecated( __METHOD__, '1.18' );
1318  }
1319 
1327  public function getAllowedModules( $type ) {
1329  return min( array_values( $this->mAllowedModules ) );
1330  } else {
1331  return isset( $this->mAllowedModules[$type] )
1332  ? $this->mAllowedModules[$type]
1334  }
1335  }
1336 
1345  public function setAllowedModules( $type, $level ) {
1346  wfDeprecated( __METHOD__, '1.24' );
1347  $this->reduceAllowedModules( $type, $level );
1348  }
1349 
1359  public function reduceAllowedModules( $type, $level ) {
1360  $this->mAllowedModules[$type] = min( $this->getAllowedModules( $type ), $level );
1361  }
1362 
1368  public function prependHTML( $text ) {
1369  $this->mBodytext = $text . $this->mBodytext;
1370  }
1371 
1377  public function addHTML( $text ) {
1378  $this->mBodytext .= $text;
1379  }
1380 
1390  public function addElement( $element, $attribs = array(), $contents = '' ) {
1391  $this->addHTML( Html::element( $element, $attribs, $contents ) );
1392  }
1393 
1397  public function clearHTML() {
1398  $this->mBodytext = '';
1399  }
1400 
1406  public function getHTML() {
1407  return $this->mBodytext;
1408  }
1409 
1417  public function parserOptions( $options = null ) {
1418  if ( !$this->mParserOptions ) {
1419  $this->mParserOptions = ParserOptions::newFromContext( $this->getContext() );
1420  $this->mParserOptions->setEditSection( false );
1421  $this->mParserOptions->setAllowUnsafeRawHtml( false );
1422  }
1423  return wfSetVar( $this->mParserOptions, $options );
1424  }
1425 
1433  public function setRevisionId( $revid ) {
1434  $val = is_null( $revid ) ? null : intval( $revid );
1435  return wfSetVar( $this->mRevisionId, $val );
1436  }
1437 
1443  public function getRevisionId() {
1444  return $this->mRevisionId;
1445  }
1446 
1454  public function setRevisionTimestamp( $timestamp ) {
1455  return wfSetVar( $this->mRevisionTimestamp, $timestamp );
1456  }
1464  public function getRevisionTimestamp() {
1466  }
1474  public function setFileVersion( $file ) {
1475  $val = null;
1476  if ( $file instanceof File && $file->exists() ) {
1477  $val = array( 'time' => $file->getTimestamp(), 'sha1' => $file->getSha1() );
1478  }
1479  return wfSetVar( $this->mFileVersion, $val, true );
1480  }
1481 
1487  public function getFileVersion() {
1488  return $this->mFileVersion;
1489  }
1497  public function getTemplateIds() {
1498  return $this->mTemplateIds;
1499  }
1507  public function getFileSearchOptions() {
1508  return $this->mImageTimeKeys;
1509  }
1510 
1519  public function addWikiText( $text, $linestart = true, $interface = true ) {
1520  $title = $this->getTitle(); // Work around E_STRICT
1521  if ( !$title ) {
1522  throw new MWException( 'Title is null' );
1523  }
1524  $this->addWikiTextTitle( $text, $title, $linestart, /*tidy*/false, $interface );
1525  }
1526 
1534  public function addWikiTextWithTitle( $text, &$title, $linestart = true ) {
1535  $this->addWikiTextTitle( $text, $title, $linestart );
1536  }
1537 
1545  function addWikiTextTitleTidy( $text, &$title, $linestart = true ) {
1546  $this->addWikiTextTitle( $text, $title, $linestart, true );
1547  }
1555  public function addWikiTextTidy( $text, $linestart = true ) {
1556  $title = $this->getTitle();
1557  $this->addWikiTextTitleTidy( $text, $title, $linestart );
1558  }
1559 
1570  public function addWikiTextTitle( $text, Title $title, $linestart, $tidy = false, $interface = false ) {
1571  global $wgParser;
1572 
1573  wfProfileIn( __METHOD__ );
1574 
1575  $popts = $this->parserOptions();
1576  $oldTidy = $popts->setTidy( $tidy );
1577  $popts->setInterfaceMessage( (bool)$interface );
1578 
1579  $parserOutput = $wgParser->parse(
1580  $text, $title, $popts,
1581  $linestart, true, $this->mRevisionId
1582  );
1583 
1584  $popts->setTidy( $oldTidy );
1585 
1586  $this->addParserOutput( $parserOutput );
1587 
1588  wfProfileOut( __METHOD__ );
1589  }
1590 
1596  public function addParserOutputNoText( &$parserOutput ) {
1597  $this->mLanguageLinks += $parserOutput->getLanguageLinks();
1598  $this->addCategoryLinks( $parserOutput->getCategories() );
1599  $this->mNewSectionLink = $parserOutput->getNewSection();
1600  $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
1601 
1602  $this->mParseWarnings = $parserOutput->getWarnings();
1603  if ( !$parserOutput->isCacheable() ) {
1604  $this->enableClientCache( false );
1605  }
1606  $this->mNoGallery = $parserOutput->getNoGallery();
1607  $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
1608  $this->addModules( $parserOutput->getModules() );
1609  $this->addModuleScripts( $parserOutput->getModuleScripts() );
1610  $this->addModuleStyles( $parserOutput->getModuleStyles() );
1611  $this->addModuleMessages( $parserOutput->getModuleMessages() );
1612  $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
1613  $this->mPreventClickjacking = $this->mPreventClickjacking
1614  || $parserOutput->preventClickjacking();
1615 
1616  // Template versioning...
1617  foreach ( (array)$parserOutput->getTemplateIds() as $ns => $dbks ) {
1618  if ( isset( $this->mTemplateIds[$ns] ) ) {
1619  $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1620  } else {
1621  $this->mTemplateIds[$ns] = $dbks;
1622  }
1623  }
1624  // File versioning...
1625  foreach ( (array)$parserOutput->getFileSearchOptions() as $dbk => $data ) {
1626  $this->mImageTimeKeys[$dbk] = $data;
1627  }
1628 
1629  // Hooks registered in the object
1630  global $wgParserOutputHooks;
1631  foreach ( $parserOutput->getOutputHooks() as $hookInfo ) {
1632  list( $hookName, $data ) = $hookInfo;
1633  if ( isset( $wgParserOutputHooks[$hookName] ) ) {
1634  call_user_func( $wgParserOutputHooks[$hookName], $this, $parserOutput, $data );
1635  }
1636  }
1637 
1638  // Link flags are ignored for now, but may in the future be
1639  // used to mark individual language links.
1640  $linkFlags = array();
1641  wfRunHooks( 'LanguageLinks', array( $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ) );
1642  wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) );
1643  }
1644 
1650  function addParserOutput( &$parserOutput ) {
1651  $this->addParserOutputNoText( $parserOutput );
1652  $parserOutput->setTOCEnabled( $this->mEnableTOC );
1653 
1654  // Touch section edit links only if not previously disabled
1655  if ( $parserOutput->getEditSectionTokens() ) {
1656  $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks );
1657  }
1658  $text = $parserOutput->getText();
1659  wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
1660  $this->addHTML( $text );
1661  }
1662 
1668  public function addTemplate( &$template ) {
1669  $this->addHTML( $template->getHTML() );
1670  }
1671 
1684  public function parse( $text, $linestart = true, $interface = false, $language = null ) {
1685  global $wgParser;
1686 
1687  if ( is_null( $this->getTitle() ) ) {
1688  throw new MWException( 'Empty $mTitle in ' . __METHOD__ );
1689  }
1690 
1691  $popts = $this->parserOptions();
1692  if ( $interface ) {
1693  $popts->setInterfaceMessage( true );
1694  }
1695  if ( $language !== null ) {
1696  $oldLang = $popts->setTargetLanguage( $language );
1697  }
1698 
1699  $parserOutput = $wgParser->parse(
1700  $text, $this->getTitle(), $popts,
1701  $linestart, true, $this->mRevisionId
1702  );
1703 
1704  if ( $interface ) {
1705  $popts->setInterfaceMessage( false );
1706  }
1707  if ( $language !== null ) {
1708  $popts->setTargetLanguage( $oldLang );
1709  }
1710 
1711  return $parserOutput->getText();
1712  }
1713 
1724  public function parseInline( $text, $linestart = true, $interface = false ) {
1725  $parsed = $this->parse( $text, $linestart, $interface );
1726 
1727  $m = array();
1728  if ( preg_match( '/^<p>(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) {
1729  $parsed = $m[1];
1730  }
1731 
1732  return $parsed;
1733  }
1734 
1740  public function setSquidMaxage( $maxage ) {
1741  $this->mSquidMaxage = min( $maxage, $this->mCdnMaxageLimit );
1742  }
1743 
1749  public function lowerCdnMaxage( $maxage ) {
1750  $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
1751  $this->setSquidMaxage( $this->mSquidMaxage );
1752  }
1753 
1761  public function enableClientCache( $state ) {
1762  return wfSetVar( $this->mEnableClientCache, $state );
1763  }
1764 
1770  function getCacheVaryCookies() {
1771  global $wgCookiePrefix, $wgCacheVaryCookies;
1772  static $cookies;
1773  if ( $cookies === null ) {
1774  $cookies = array_merge(
1775  array(
1776  "{$wgCookiePrefix}Token",
1777  "{$wgCookiePrefix}LoggedOut",
1778  "forceHTTPS",
1779  session_name()
1780  ),
1781  $wgCacheVaryCookies
1782  );
1783  wfRunHooks( 'GetCacheVaryCookies', array( $this, &$cookies ) );
1784  }
1785  return $cookies;
1786  }
1794  function haveCacheVaryCookies() {
1795  $cookieHeader = $this->getRequest()->getHeader( 'cookie' );
1796  if ( $cookieHeader === false ) {
1797  return false;
1798  }
1799  $cvCookies = $this->getCacheVaryCookies();
1800  foreach ( $cvCookies as $cookieName ) {
1801  # Check for a simple string match, like the way squid does it
1802  if ( strpos( $cookieHeader, $cookieName ) !== false ) {
1803  wfDebug( __METHOD__ . ": found $cookieName\n" );
1804  return true;
1805  }
1806  }
1807  wfDebug( __METHOD__ . ": no cache-varying cookies found\n" );
1808  return false;
1809  }
1810 
1819  public function addVaryHeader( $header, $option = null ) {
1820  if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
1821  $this->mVaryHeader[$header] = (array)$option;
1822  } elseif ( is_array( $option ) ) {
1823  if ( is_array( $this->mVaryHeader[$header] ) ) {
1824  $this->mVaryHeader[$header] = array_merge( $this->mVaryHeader[$header], $option );
1825  } else {
1826  $this->mVaryHeader[$header] = $option;
1827  }
1828  }
1829  $this->mVaryHeader[$header] = array_unique( (array)$this->mVaryHeader[$header] );
1830  }
1838  public function getVaryHeader() {
1839  // If we vary on cookies, let's make sure it's always included here too.
1840  if ( $this->getCacheVaryCookies() ) {
1841  $this->addVaryHeader( 'Cookie' );
1842  }
1843 
1844  return 'Vary: ' . join( ', ', array_keys( $this->mVaryHeader ) );
1845  }
1846 
1852  public function getXVO() {
1853  $cvCookies = $this->getCacheVaryCookies();
1854 
1855  $cookiesOption = array();
1856  foreach ( $cvCookies as $cookieName ) {
1857  $cookiesOption[] = 'string-contains=' . $cookieName;
1858  }
1859  $this->addVaryHeader( 'Cookie', $cookiesOption );
1860 
1861  $headers = array();
1862  foreach ( $this->mVaryHeader as $header => $option ) {
1863  $newheader = $header;
1864  if ( is_array( $option ) && count( $option ) > 0 ) {
1865  $newheader .= ';' . implode( ';', $option );
1866  }
1867  $headers[] = $newheader;
1868  }
1869  $xvo = 'X-Vary-Options: ' . implode( ',', $headers );
1870 
1871  return $xvo;
1872  }
1873 
1882  function addAcceptLanguage() {
1883  $lang = $this->getTitle()->getPageLanguage();
1884  if ( !$this->getRequest()->getCheck( 'variant' ) && $lang->hasVariants() ) {
1885  $variants = $lang->getVariants();
1886  $aloption = array();
1887  foreach ( $variants as $variant ) {
1888  if ( $variant === $lang->getCode() ) {
1889  continue;
1890  } else {
1891  $aloption[] = 'string-contains=' . $variant;
1892 
1893  // IE and some other browsers use BCP 47 standards in
1894  // their Accept-Language header, like "zh-CN" or "zh-Hant".
1895  // We should handle these too.
1896  $variantBCP47 = wfBCP47( $variant );
1897  if ( $variantBCP47 !== $variant ) {
1898  $aloption[] = 'string-contains=' . $variantBCP47;
1899  }
1900  }
1901  }
1902  $this->addVaryHeader( 'Accept-Language', $aloption );
1903  }
1904  }
1905 
1916  public function preventClickjacking( $enable = true ) {
1917  $this->mPreventClickjacking = $enable;
1918  }
1919 
1925  public function allowClickjacking() {
1926  $this->mPreventClickjacking = false;
1927  }
1935  public function getPreventClickjacking() {
1937  }
1938 
1946  public function getFrameOptions() {
1947  global $wgBreakFrames, $wgEditPageFrameOptions;
1948  if ( $wgBreakFrames ) {
1949  return 'DENY';
1950  } elseif ( $this->mPreventClickjacking && $wgEditPageFrameOptions ) {
1951  return $wgEditPageFrameOptions;
1952  }
1953  return false;
1954  }
1955 
1959  public function sendCacheControl() {
1960  global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgUseXVO;
1961 
1962  $response = $this->getRequest()->response();
1963  if ( $wgUseETag && $this->mETag ) {
1964  $response->header( "ETag: $this->mETag" );
1965  }
1966 
1967  $this->addVaryHeader( 'Cookie' );
1968  $this->addAcceptLanguage();
1969 
1970  # don't serve compressed data to clients who can't handle it
1971  # maintain different caches for logged-in users and non-logged in ones
1972  $response->header( $this->getVaryHeader() );
1973 
1974  if ( $wgUseXVO ) {
1975  # Add an X-Vary-Options header for Squid with Wikimedia patches
1976  $response->header( $this->getXVO() );
1977  }
1978 
1979  if ( $this->mEnableClientCache ) {
1980  if (
1981  $wgUseSquid && session_id() == '' && !$this->isPrintable() &&
1982  $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies()
1983  ) {
1984  if ( $wgUseESI ) {
1985  # We'll purge the proxy cache explicitly, but require end user agents
1986  # to revalidate against the proxy on each visit.
1987  # Surrogate-Control controls our Squid, Cache-Control downstream caches
1988  wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", 'log' );
1989  # start with a shorter timeout for initial testing
1990  # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
1991  $response->header( 'Surrogate-Control: max-age=' . $wgSquidMaxage . '+' . $this->mSquidMaxage . ', content="ESI/1.0"' );
1992  $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
1993  } else {
1994  # We'll purge the proxy cache for anons explicitly, but require end user agents
1995  # to revalidate against the proxy on each visit.
1996  # IMPORTANT! The Squid needs to replace the Cache-Control header with
1997  # Cache-Control: s-maxage=0, must-revalidate, max-age=0
1998  wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **\n", 'log' );
1999  # start with a shorter timeout for initial testing
2000  # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2001  $response->header( 'Cache-Control: s-maxage=' . $this->mSquidMaxage . ', must-revalidate, max-age=0' );
2002  }
2003  } else {
2004  # We do want clients to cache if they can, but they *must* check for updates
2005  # on revisiting the page.
2006  wfDebug( __METHOD__ . ": private caching; {$this->mLastModified} **\n", 'log' );
2007  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2008  $response->header( "Cache-Control: private, must-revalidate, max-age=0" );
2009  }
2010  if ( $this->mLastModified ) {
2011  $response->header( "Last-Modified: {$this->mLastModified}" );
2012  }
2013  } else {
2014  wfDebug( __METHOD__ . ": no caching **\n", 'log' );
2015 
2016  # In general, the absence of a last modified header should be enough to prevent
2017  # the client from using its cache. We send a few other things just to make sure.
2018  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2019  $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2020  $response->header( 'Pragma: no-cache' );
2021  }
2022  }
2023 
2032  public static function getStatusMessage( $code ) {
2033  wfDeprecated( __METHOD__, '1.18' );
2034  return HttpStatus::getMessage( $code );
2035  }
2036 
2041  public function output() {
2042  global $wgLanguageCode, $wgDebugRedirects, $wgMimeType, $wgVaryOnXFP,
2043  $wgUseAjax, $wgResponsiveImages;
2044 
2045  if ( $this->mDoNothing ) {
2046  return;
2047  }
2048 
2049  wfProfileIn( __METHOD__ );
2050 
2051  $response = $this->getRequest()->response();
2052 
2053  if ( $this->mRedirect != '' ) {
2054  # Standards require redirect URLs to be absolute
2055  $this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT );
2056 
2057  $redirect = $this->mRedirect;
2058  $code = $this->mRedirectCode;
2059 
2060  if ( wfRunHooks( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) {
2061  if ( $code == '301' || $code == '303' ) {
2062  if ( !$wgDebugRedirects ) {
2063  $message = HttpStatus::getMessage( $code );
2064  $response->header( "HTTP/1.1 $code $message" );
2065  }
2066  $this->mLastModified = wfTimestamp( TS_RFC2822 );
2067  }
2068  if ( $wgVaryOnXFP ) {
2069  $this->addVaryHeader( 'X-Forwarded-Proto' );
2070  }
2071  $this->sendCacheControl();
2072 
2073  $response->header( "Content-Type: text/html; charset=utf-8" );
2074  if ( $wgDebugRedirects ) {
2075  $url = htmlspecialchars( $redirect );
2076  print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2077  print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2078  print "</body>\n</html>\n";
2079  } else {
2080  $response->header( 'Location: ' . $redirect );
2081  }
2082  }
2083 
2084  wfProfileOut( __METHOD__ );
2085  return;
2086  } elseif ( $this->mStatusCode ) {
2087  $message = HttpStatus::getMessage( $this->mStatusCode );
2088  if ( $message ) {
2089  $response->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message );
2090  }
2091  }
2092 
2093  # Buffer output; final headers may depend on later processing
2094  ob_start();
2095 
2096  $response->header( "Content-type: $wgMimeType; charset=UTF-8" );
2097  $response->header( 'Content-language: ' . $wgLanguageCode );
2098 
2099  // Prevent framing, if requested
2100  $frameOptions = $this->getFrameOptions();
2101  if ( $frameOptions ) {
2102  $response->header( "X-Frame-Options: $frameOptions" );
2103  }
2104 
2105  if ( $this->mArticleBodyOnly ) {
2106  echo $this->mBodytext;
2107  } else {
2108 
2109  $sk = $this->getSkin();
2110  // add skin specific modules
2111  $modules = $sk->getDefaultModules();
2112 
2113  // enforce various default modules for all skins
2114  $coreModules = array(
2115  // keep this list as small as possible
2116  'mediawiki.page.startup',
2117  'mediawiki.user',
2118  );
2119 
2120  // Support for high-density display images if enabled
2121  if ( $wgResponsiveImages ) {
2122  $coreModules[] = 'mediawiki.hidpi';
2123  }
2124 
2125  $this->addModules( $coreModules );
2126  foreach ( $modules as $group ) {
2127  $this->addModules( $group );
2128  }
2129  MWDebug::addModules( $this );
2130  if ( $wgUseAjax ) {
2131  // FIXME: deprecate? - not clear why this is useful
2132  wfRunHooks( 'AjaxAddScript', array( &$this ) );
2133  }
2134 
2135  // Hook that allows last minute changes to the output page, e.g.
2136  // adding of CSS or Javascript by extensions.
2137  wfRunHooks( 'BeforePageDisplay', array( &$this, &$sk ) );
2138 
2139  wfProfileIn( 'Output-skin' );
2140  $sk->outputPage();
2141  wfProfileOut( 'Output-skin' );
2142  }
2143 
2144  // This hook allows last minute changes to final overall output by modifying output buffer
2145  wfRunHooks( 'AfterFinalPageOutput', array( $this ) );
2146 
2147  $this->sendCacheControl();
2148 
2149  ob_end_flush();
2150 
2151  wfProfileOut( __METHOD__ );
2152  }
2160  public function out( $ins ) {
2161  wfDeprecated( __METHOD__, '1.22' );
2162  print $ins;
2163  }
2164 
2169  function blockedPage() {
2170  throw new UserBlockedError( $this->getUser()->mBlock );
2171  }
2172 
2183  public function prepareErrorPage( $pageTitle, $htmlTitle = false ) {
2184  $this->setPageTitle( $pageTitle );
2185  if ( $htmlTitle !== false ) {
2186  $this->setHTMLTitle( $htmlTitle );
2187  }
2188  $this->setRobotPolicy( 'noindex,nofollow' );
2189  $this->setArticleRelated( false );
2190  $this->enableClientCache( false );
2191  $this->mRedirect = '';
2192  $this->clearSubtitle();
2193  $this->clearHTML();
2194  }
2195 
2208  public function showErrorPage( $title, $msg, $params = array() ) {
2209  if ( !$title instanceof Message ) {
2210  $title = $this->msg( $title );
2211  }
2212 
2213  $this->prepareErrorPage( $title );
2214 
2215  if ( $msg instanceof Message ) {
2216  if ( $params !== array() ) {
2217  trigger_error( 'Argument ignored: $params. The message parameters argument is discarded when the $msg argument is a Message object instead of a string.', E_USER_NOTICE );
2218  }
2219  $this->addHTML( $msg->parseAsBlock() );
2220  } else {
2221  $this->addWikiMsgArray( $msg, $params );
2222  }
2223 
2224  $this->returnToMain();
2225  }
2233  public function showPermissionsErrorPage( $errors, $action = null ) {
2234  // For some action (read, edit, create and upload), display a "login to do this action"
2235  // error if all of the following conditions are met:
2236  // 1. the user is not logged in
2237  // 2. the only error is insufficient permissions (i.e. no block or something else)
2238  // 3. the error can be avoided simply by logging in
2239  if ( in_array( $action, array( 'read', 'edit', 'createpage', 'createtalk', 'upload' ) )
2240  && $this->getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2241  && ( $errors[0][0] == 'badaccess-groups' || $errors[0][0] == 'badaccess-group0' )
2242  && ( User::groupHasPermission( 'user', $action )
2243  || User::groupHasPermission( 'autoconfirmed', $action ) )
2244  ) {
2245  $displayReturnto = null;
2246 
2247  # Due to bug 32276, if a user does not have read permissions,
2248  # $this->getTitle() will just give Special:Badtitle, which is
2249  # not especially useful as a returnto parameter. Use the title
2250  # from the request instead, if there was one.
2251  $request = $this->getRequest();
2252  $returnto = Title::newFromURL( $request->getVal( 'title', '' ) );
2253  if ( $action == 'edit' ) {
2254  $msg = 'whitelistedittext';
2255  $displayReturnto = $returnto;
2256  } elseif ( $action == 'createpage' || $action == 'createtalk' ) {
2257  $msg = 'nocreatetext';
2258  } elseif ( $action == 'upload' ) {
2259  $msg = 'uploadnologintext';
2260  } else { # Read
2261  $msg = 'loginreqpagetext';
2262  $displayReturnto = Title::newMainPage();
2263  }
2264 
2265  $query = array();
2266 
2267  if ( $returnto ) {
2268  $query['returnto'] = $returnto->getPrefixedText();
2269 
2270  if ( !$request->wasPosted() ) {
2271  $returntoquery = $request->getValues();
2272  unset( $returntoquery['title'] );
2273  unset( $returntoquery['returnto'] );
2274  unset( $returntoquery['returntoquery'] );
2275  $query['returntoquery'] = wfArrayToCgi( $returntoquery );
2276  }
2277  }
2278  $loginLink = Linker::linkKnown(
2279  SpecialPage::getTitleFor( 'Userlogin' ),
2280  $this->msg( 'loginreqlink' )->escaped(),
2281  array(),
2282  $query
2283  );
2284 
2285  $this->prepareErrorPage( $this->msg( 'loginreqtitle' ) );
2286  $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->parse() );
2287 
2288  # Don't return to a page the user can't read otherwise
2289  # we'll end up in a pointless loop
2290  if ( $displayReturnto && $displayReturnto->userCan( 'read', $this->getUser() ) ) {
2291  $this->returnToMain( null, $displayReturnto );
2292  }
2293  } else {
2294  $this->prepareErrorPage( $this->msg( 'permissionserrors' ) );
2295  $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
2296  }
2297  }
2305  public function versionRequired( $version ) {
2306  $this->prepareErrorPage( $this->msg( 'versionrequired', $version ) );
2307 
2308  $this->addWikiMsg( 'versionrequiredtext', $version );
2309  $this->returnToMain();
2310  }
2318  public function permissionRequired( $permission ) {
2319  throw new PermissionsError( $permission );
2320  }
2321 
2327  public function loginToUse() {
2328  throw new PermissionsError( 'read' );
2329  }
2330 
2338  public function formatPermissionsErrorMessage( $errors, $action = null ) {
2339  if ( $action == null ) {
2340  $text = $this->msg( 'permissionserrorstext', count( $errors ) )->plain() . "\n\n";
2341  } else {
2342  $action_desc = $this->msg( "action-$action" )->plain();
2343  $text = $this->msg(
2344  'permissionserrorstext-withaction',
2345  count( $errors ),
2346  $action_desc
2347  )->plain() . "\n\n";
2348  }
2349 
2350  if ( count( $errors ) > 1 ) {
2351  $text .= '<ul class="permissions-errors">' . "\n";
2352 
2353  foreach ( $errors as $error ) {
2354  $text .= '<li>';
2355  $text .= call_user_func_array( array( $this, 'msg' ), $error )->plain();
2356  $text .= "</li>\n";
2357  }
2358  $text .= '</ul>';
2359  } else {
2360  $text .= "<div class=\"permissions-errors\">\n" .
2361  call_user_func_array( array( $this, 'msg' ), reset( $errors ) )->plain() .
2362  "\n</div>";
2363  }
2364 
2365  return $text;
2366  }
2367 
2389  public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
2390  $this->setRobotPolicy( 'noindex,nofollow' );
2391  $this->setArticleRelated( false );
2392 
2393  // If no reason is given, just supply a default "I can't let you do
2394  // that, Dave" message. Should only occur if called by legacy code.
2395  if ( $protected && empty( $reasons ) ) {
2396  $reasons[] = array( 'badaccess-group0' );
2397  }
2398 
2399  if ( !empty( $reasons ) ) {
2400  // Permissions error
2401  if ( $source ) {
2402  $this->setPageTitle( $this->msg( 'viewsource-title', $this->getTitle()->getPrefixedText() ) );
2403  $this->addBacklinkSubtitle( $this->getTitle() );
2404  } else {
2405  $this->setPageTitle( $this->msg( 'badaccess' ) );
2406  }
2407  $this->addWikiText( $this->formatPermissionsErrorMessage( $reasons, $action ) );
2408  } else {
2409  // Wiki is read only
2410  throw new ReadOnlyError;
2411  }
2412 
2413  // Show source, if supplied
2414  if ( is_string( $source ) ) {
2415  $this->addWikiMsg( 'viewsourcetext' );
2416 
2417  $pageLang = $this->getTitle()->getPageLanguage();
2418  $params = array(
2419  'id' => 'wpTextbox1',
2420  'name' => 'wpTextbox1',
2421  'cols' => $this->getUser()->getOption( 'cols' ),
2422  'rows' => $this->getUser()->getOption( 'rows' ),
2423  'readonly' => 'readonly',
2424  'lang' => $pageLang->getHtmlCode(),
2425  'dir' => $pageLang->getDir(),
2426  );
2427  $this->addHTML( Html::element( 'textarea', $params, $source ) );
2428 
2429  // Show templates used by this article
2430  $templates = Linker::formatTemplates( $this->getTitle()->getTemplateLinksFrom() );
2431  $this->addHTML( "<div class='templatesUsed'>
2432 $templates
2433 </div>
2434 " );
2435  }
2436 
2437  # If the title doesn't exist, it's fairly pointless to print a return
2438  # link to it. After all, you just tried editing it and couldn't, so
2439  # what's there to do there?
2440  if ( $this->getTitle()->exists() ) {
2441  $this->returnToMain( null, $this->getTitle() );
2442  }
2443  }
2444 
2449  public function rateLimited() {
2450  throw new ThrottledError;
2451  }
2452 
2462  public function showLagWarning( $lag ) {
2463  global $wgSlaveLagWarning, $wgSlaveLagCritical;
2464  if ( $lag >= $wgSlaveLagWarning ) {
2465  $message = $lag < $wgSlaveLagCritical
2466  ? 'lag-warn-normal'
2467  : 'lag-warn-high';
2468  $wrap = Html::rawElement( 'div', array( 'class' => "mw-{$message}" ), "\n$1\n" );
2469  $this->wrapWikiMsg( "$wrap\n", array( $message, $this->getLanguage()->formatNum( $lag ) ) );
2470  }
2471  }
2473  public function showFatalError( $message ) {
2474  $this->prepareErrorPage( $this->msg( 'internalerror' ) );
2475 
2476  $this->addHTML( $message );
2477  }
2478 
2479  public function showUnexpectedValueError( $name, $val ) {
2480  $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() );
2481  }
2482 
2483  public function showFileCopyError( $old, $new ) {
2484  $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() );
2485  }
2486 
2487  public function showFileRenameError( $old, $new ) {
2488  $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() );
2489  }
2490 
2491  public function showFileDeleteError( $name ) {
2492  $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() );
2493  }
2494 
2495  public function showFileNotFoundError( $name ) {
2496  $this->showFatalError( $this->msg( 'filenotfound', $name )->text() );
2497  }
2498 
2507  public function addReturnTo( $title, $query = array(), $text = null, $options = array() ) {
2508  $link = $this->msg( 'returnto' )->rawParams(
2509  Linker::link( $title, $text, array(), $query, $options ) )->escaped();
2510  $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
2511  }
2512 
2521  public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
2522  if ( $returnto == null ) {
2523  $returnto = $this->getRequest()->getText( 'returnto' );
2524  }
2525 
2526  if ( $returntoquery == null ) {
2527  $returntoquery = $this->getRequest()->getText( 'returntoquery' );
2528  }
2529 
2530  if ( $returnto === '' ) {
2531  $returnto = Title::newMainPage();
2532  }
2533 
2534  if ( is_object( $returnto ) ) {
2535  $titleObj = $returnto;
2536  } else {
2537  $titleObj = Title::newFromText( $returnto );
2538  }
2539  // We don't want people to return to external interwiki. That
2540  // might potentially be used as part of a phishing scheme
2541  if ( !is_object( $titleObj ) || $titleObj->isExternal() ) {
2542  $titleObj = Title::newMainPage();
2543  }
2544 
2545  $this->addReturnTo( $titleObj, wfCgiToArray( $returntoquery ) );
2546  }
2547 
2553  public function headElement( Skin $sk, $includeStyle = true ) {
2554  global $wgContLang, $wgMimeType;
2555 
2556  $userdir = $this->getLanguage()->getDir();
2557  $sitedir = $wgContLang->getDir();
2558 
2560 
2561  if ( $this->getHTMLTitle() == '' ) {
2562  $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() )->inContentLanguage() );
2563  }
2564 
2565  $openHead = Html::openElement( 'head' );
2566  if ( $openHead ) {
2567  # Don't bother with the newline if $head == ''
2568  $ret .= "$openHead\n";
2569  }
2570 
2571  if ( !Html::isXmlMimeType( $wgMimeType ) ) {
2572  // Add <meta charset="UTF-8">
2573  // This should be before <title> since it defines the charset used by
2574  // text including the text inside <title>.
2575  // The spec recommends defining XHTML5's charset using the XML declaration
2576  // instead of meta.
2577  // Our XML declaration is output by Html::htmlHeader.
2578  // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
2579  // http://www.whatwg.org/html/semantics.html#charset
2580  $ret .= Html::element( 'meta', array( 'charset' => 'UTF-8' ) ) . "\n";
2581  }
2582 
2583  $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
2584 
2585  // Avoid Internet Explorer "compatibility view", so that
2586  // jQuery can work correctly.
2587  $ret .= Html::element( 'meta', array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EDGE' ) ) . "\n";
2588 
2589  $ret .= (
2590  $this->getHeadLinks() .
2591  "\n" .
2592  $this->buildCssLinks() .
2593  // No newline after buildCssLinks since makeResourceLoaderLink did that already
2594  $this->getHeadScripts() .
2595  "\n" .
2596  $this->getHeadItems()
2597  );
2598 
2599  $closeHead = Html::closeElement( 'head' );
2600  if ( $closeHead ) {
2601  $ret .= "$closeHead\n";
2602  }
2603 
2604  $bodyClasses = array();
2605  $bodyClasses[] = 'mediawiki';
2606 
2607  # Classes for LTR/RTL directionality support
2608  $bodyClasses[] = $userdir;
2609  $bodyClasses[] = "sitedir-$sitedir";
2610 
2611  if ( $this->getLanguage()->capitalizeAllNouns() ) {
2612  # A <body> class is probably not the best way to do this . . .
2613  $bodyClasses[] = 'capitalize-all-nouns';
2614  }
2615 
2616  $bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
2617  $bodyClasses[] = 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
2618  $bodyClasses[] = 'action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
2619 
2620  $bodyAttrs = array();
2621  // While the implode() is not strictly needed, it's used for backwards compatibility
2622  // (this used to be built as a string and hooks likely still expect that).
2623  $bodyAttrs['class'] = implode( ' ', $bodyClasses );
2624 
2625  // Allow skins and extensions to add body attributes they need
2626  $sk->addToBodyAttributes( $this, $bodyAttrs );
2627  wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) );
2628 
2629  $ret .= Html::openElement( 'body', $bodyAttrs ) . "\n";
2630 
2631  return $ret;
2632  }
2633 
2639  public function getResourceLoader() {
2640  if ( is_null( $this->mResourceLoader ) ) {
2641  $this->mResourceLoader = new ResourceLoader();
2642  }
2643  return $this->mResourceLoader;
2644  }
2645 
2655  public function makeResourceLoaderLink( $modules, $only, $useESI = false, array $extraQuery = array(), $loadCall = false ) {
2656  global $wgResourceLoaderUseESI;
2657 
2658  $modules = (array)$modules;
2659 
2660  $links = array(
2661  'html' => '',
2662  'states' => array(),
2663  );
2664 
2665  if ( !count( $modules ) ) {
2666  return $links;
2667  }
2668 
2669 
2670  if ( count( $modules ) > 1 ) {
2671  // Remove duplicate module requests
2672  $modules = array_unique( $modules );
2673  // Sort module names so requests are more uniform
2674  sort( $modules );
2675 
2676  if ( ResourceLoader::inDebugMode() ) {
2677  // Recursively call us for every item
2678  foreach ( $modules as $name ) {
2679  $link = $this->makeResourceLoaderLink( $name, $only, $useESI );
2680  $links['html'] .= $link['html'];
2681  $links['states'] += $link['states'];
2682  }
2683  return $links;
2684  }
2685  }
2686 
2687  if ( !is_null( $this->mTarget ) ) {
2688  $extraQuery['target'] = $this->mTarget;
2689  }
2690 
2691  // Create keyed-by-group list of module objects from modules list
2692  $groups = array();
2694  foreach ( $modules as $name ) {
2695  $module = $resourceLoader->getModule( $name );
2696  # Check that we're allowed to include this module on this page
2697  if ( !$module
2698  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS )
2700  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_STYLES )
2701  && $only == ResourceLoaderModule::TYPE_STYLES )
2702  || ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) )
2703  ) {
2704  continue;
2705  }
2706 
2707  $group = $module->getGroup();
2708  if ( !isset( $groups[$group] ) ) {
2709  $groups[$group] = array();
2710  }
2711  $groups[$group][$name] = $module;
2712  }
2713 
2714  foreach ( $groups as $group => $grpModules ) {
2715  // Special handling for user-specific groups
2716  $user = null;
2717  if ( ( $group === 'user' || $group === 'private' ) && $this->getUser()->isLoggedIn() ) {
2718  $user = $this->getUser()->getName();
2719  }
2720 
2721  // Create a fake request based on the one we are about to make so modules return
2722  // correct timestamp and emptiness data
2724  array(), // modules; not determined yet
2725  $this->getLanguage()->getCode(),
2726  $this->getSkin()->getSkinName(),
2727  $user,
2728  null, // version; not determined yet
2730  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2731  $this->isPrintable(),
2732  $this->getRequest()->getBool( 'handheld' ),
2733  $extraQuery
2734  );
2736 
2737  // Extract modules that know they're empty
2738  foreach ( $grpModules as $key => $module ) {
2739  // Inline empty modules: since they're empty, just mark them as 'ready' (bug 46857)
2740  // If we're only getting the styles, we don't need to do anything for empty modules.
2741  if ( $module->isKnownEmpty( $context ) ) {
2742  unset( $grpModules[$key] );
2743  if ( $only !== ResourceLoaderModule::TYPE_STYLES ) {
2744  $links['states'][$key] = 'ready';
2745  }
2746  }
2747  }
2748 
2749  // If there are no non-empty modules, skip this group
2750  if ( count( $grpModules ) === 0 ) {
2751  continue;
2752  }
2753 
2754  // Inline private modules. These can't be loaded through load.php for security
2755  // reasons, see bug 34907. Note that these modules should be loaded from
2756  // getHeadScripts() before the first loader call. Otherwise other modules can't
2757  // properly use them as dependencies (bug 30914)
2758  if ( $group === 'private' ) {
2759  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2760  $links['html'] .= Html::inlineStyle(
2761  $resourceLoader->makeModuleResponse( $context, $grpModules )
2762  );
2763  } else {
2764  $links['html'] .= Html::inlineScript(
2766  $resourceLoader->makeModuleResponse( $context, $grpModules )
2767  )
2768  );
2769  }
2770  $links['html'] .= "\n";
2771  continue;
2772  }
2773 
2774  // Special handling for the user group; because users might change their stuff
2775  // on-wiki like user pages, or user preferences; we need to find the highest
2776  // timestamp of these user-changeable modules so we can ensure cache misses on change
2777  // This should NOT be done for the site group (bug 27564) because anons get that too
2778  // and we shouldn't be putting timestamps in Squid-cached HTML
2779  $version = null;
2780  if ( $group === 'user' ) {
2781  // Get the maximum timestamp
2782  $timestamp = 1;
2783  foreach ( $grpModules as $module ) {
2784  $timestamp = max( $timestamp, $module->getModifiedTime( $context ) );
2785  }
2786  // Add a version parameter so cache will break when things change
2788  }
2789 
2791  array_keys( $grpModules ),
2792  $this->getLanguage()->getCode(),
2793  $this->getSkin()->getSkinName(),
2794  $user,
2795  $version,
2797  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2798  $this->isPrintable(),
2799  $this->getRequest()->getBool( 'handheld' ),
2800  $extraQuery
2801  );
2802  if ( $useESI && $wgResourceLoaderUseESI ) {
2803  $esi = Xml::element( 'esi:include', array( 'src' => $url ) );
2804  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2805  $link = Html::inlineStyle( $esi );
2806  } else {
2807  $link = Html::inlineScript( $esi );
2808  }
2809  } else {
2810  // Automatically select style/script elements
2811  if ( $only === ResourceLoaderModule::TYPE_STYLES ) {
2812  $link = Html::linkedStyle( $url );
2813  } elseif ( $loadCall ) {
2816  Xml::encodeJsCall( 'mw.loader.load', array( $url, 'text/javascript', true ) )
2817  )
2818  );
2819  } else {
2820  $link = Html::linkedScript( $url );
2821 
2822  // For modules requested directly in the html via <link> or <script>,
2823  // tell mw.loader they are being loading to prevent duplicate requests.
2824  foreach ( $grpModules as $key => $module ) {
2825  // Don't output state=loading for the startup module..
2826  if ( $key !== 'startup' ) {
2827  $links['states'][$key] = 'loading';
2828  }
2829  }
2830  }
2831  }
2832 
2833  if ( $group == 'noscript' ) {
2834  $links['html'] .= Html::rawElement( 'noscript', array(), $link ) . "\n";
2835  } else {
2836  $links['html'] .= $link . "\n";
2837  }
2838  }
2839 
2840  return $links;
2841  }
2842 
2848  protected static function getHtmlFromLoaderLinks( Array $links ) {
2849  $html = '';
2850  $states = array();
2851  foreach ( $links as $link ) {
2852  if ( !is_array( $link ) ) {
2853  $html .= $link;
2854  } else {
2855  $html .= $link['html'];
2856  $states += $link['states'];
2857  }
2858  }
2859 
2860  if ( count( $states ) ) {
2864  )
2865  ) . "\n" . $html;
2866  }
2867 
2868  return $html;
2869  }
2877  function getHeadScripts() {
2878  global $wgResourceLoaderExperimentalAsyncLoading;
2879 
2880  // Startup - this will immediately load jquery and mediawiki modules
2881  $links = array();
2882  $links[] = $this->makeResourceLoaderLink( 'startup', ResourceLoaderModule::TYPE_SCRIPTS, true );
2883 
2884  // Load config before anything else
2885  $links[] = Html::inlineScript(
2888  )
2889  );
2890 
2891  // Load embeddable private modules before any loader links
2892  // This needs to be TYPE_COMBINED so these modules are properly wrapped
2893  // in mw.loader.implement() calls and deferred until mw.user is available
2894  $embedScripts = array( 'user.options', 'user.tokens' );
2895  $links[] = $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
2896 
2897  // Scripts and messages "only" requests marked for top inclusion
2898  // Messages should go first
2899  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'top' ), ResourceLoaderModule::TYPE_MESSAGES );
2900  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'top' ), ResourceLoaderModule::TYPE_SCRIPTS );
2901 
2902  // Modules requests - let the client calculate dependencies and batch requests as it likes
2903  // Only load modules that have marked themselves for loading at the top
2904  $modules = $this->getModules( true, 'top' );
2905  if ( $modules ) {
2906  $links[] = Html::inlineScript(
2908  Xml::encodeJsCall( 'mw.loader.load', array( $modules ) )
2909  )
2910  );
2911  }
2912 
2913  if ( $wgResourceLoaderExperimentalAsyncLoading ) {
2914  $links[] = $this->getScriptsForBottomQueue( true );
2915  }
2916 
2917  return self::getHtmlFromLoaderLinks( $links );
2918  }
2919 
2929  function getScriptsForBottomQueue( $inHead ) {
2930  global $wgUseSiteJs, $wgAllowUserJs;
2931 
2932  // Scripts and messages "only" requests marked for bottom inclusion
2933  // If we're in the <head>, use load() calls rather than <script src="..."> tags
2934  // Messages should go first
2935  $links = array();
2936  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'bottom' ),
2937  ResourceLoaderModule::TYPE_MESSAGES, /* $useESI = */ false, /* $extraQuery = */ array(),
2938  /* $loadCall = */ $inHead
2939  );
2940  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'bottom' ),
2941  ResourceLoaderModule::TYPE_SCRIPTS, /* $useESI = */ false, /* $extraQuery = */ array(),
2942  /* $loadCall = */ $inHead
2943  );
2944 
2945  // Modules requests - let the client calculate dependencies and batch requests as it likes
2946  // Only load modules that have marked themselves for loading at the bottom
2947  $modules = $this->getModules( true, 'bottom' );
2948  if ( $modules ) {
2949  $links[] = Html::inlineScript(
2951  Xml::encodeJsCall( 'mw.loader.load', array( $modules, null, true ) )
2952  )
2953  );
2954  }
2955 
2956  // Legacy Scripts
2957  $links[] = "\n" . $this->mScripts;
2958 
2959  // Add site JS if enabled
2961  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2962  );
2963 
2964  // Add user JS if enabled
2965  if ( $wgAllowUserJs && $this->getTitle() && $this->getTitle()->isJsSubpage() && $this->userCanPreview() ) {
2966  # XXX: additional security check/prompt?
2967  // We're on a preview of a JS subpage
2968  // Exclude this page from the user module in case it's in there (bug 26283)
2969  $links[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS, false,
2970  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() ), $inHead
2971  );
2972  // Load the previewed JS
2973  $links[] = Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
2974 
2975  // FIXME: If the user is previewing, say, ./vector.js, his ./common.js will be loaded
2976  // asynchronously and may arrive *after* the inline script here. So the previewed code
2977  // may execute before ./common.js runs. Normally, ./common.js runs before ./vector.js...
2978  } else {
2979  // Include the user module normally, i.e., raw to avoid it being wrapped in a closure.
2981  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2982  );
2983  }
2984 
2985  // Group JS is only enabled if site JS is enabled.
2986  $links[] = $this->makeResourceLoaderLink( 'user.groups', ResourceLoaderModule::TYPE_COMBINED,
2987  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2988  );
2989 
2991  }
2992 
2997  function getBottomScripts() {
2998  global $wgResourceLoaderExperimentalAsyncLoading;
2999 
3000  // Optimise jQuery ready event cross-browser.
3001  // This also enforces $.isReady to be true at </body> which fixes the
3002  // mw.loader bug in Firefox with using document.write between </body>
3003  // and the DOMContentReady event (bug 47457).
3004  $html = Html::inlineScript( 'window.jQuery && jQuery.ready();' );
3005 
3006  if ( !$wgResourceLoaderExperimentalAsyncLoading ) {
3007  $html .= $this->getScriptsForBottomQueue( false );
3008  }
3009 
3010  return $html;
3011  }
3019  public function getJsConfigVars() {
3020  return $this->mJsConfigVars;
3021  }
3029  public function addJsConfigVars( $keys, $value = null ) {
3030  if ( is_array( $keys ) ) {
3031  foreach ( $keys as $key => $value ) {
3032  $this->mJsConfigVars[$key] = $value;
3033  }
3034  return;
3035  }
3036 
3037  $this->mJsConfigVars[$keys] = $value;
3038  }
3039 
3052  public function getJSVars() {
3054 
3055  $curRevisionId = 0;
3056  $articleId = 0;
3057  $canonicalSpecialPageName = false; # bug 21115
3058 
3059  $title = $this->getTitle();
3060  $ns = $title->getNamespace();
3061  $canonicalNamespace = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
3062 
3063  $sk = $this->getSkin();
3064  // Get the relevant title so that AJAX features can use the correct page name
3065  // when making API requests from certain special pages (bug 34972).
3066  $relevantTitle = $sk->getRelevantTitle();
3067  $relevantUser = $sk->getRelevantUser();
3068 
3069  if ( $ns == NS_SPECIAL ) {
3070  list( $canonicalSpecialPageName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
3071  } elseif ( $this->canUseWikiPage() ) {
3072  $wikiPage = $this->getWikiPage();
3073  $curRevisionId = $wikiPage->getLatest();
3074  $articleId = $wikiPage->getId();
3075  }
3076 
3077  $lang = $title->getPageLanguage();
3078 
3079  // Pre-process information
3080  $separatorTransTable = $lang->separatorTransformTable();
3081  $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
3082  $compactSeparatorTransTable = array(
3083  implode( "\t", array_keys( $separatorTransTable ) ),
3084  implode( "\t", $separatorTransTable ),
3085  );
3086  $digitTransTable = $lang->digitTransformTable();
3087  $digitTransTable = $digitTransTable ? $digitTransTable : array();
3088  $compactDigitTransTable = array(
3089  implode( "\t", array_keys( $digitTransTable ) ),
3090  implode( "\t", $digitTransTable ),
3091  );
3092 
3093  $user = $this->getUser();
3094 
3095  $vars = array(
3096  'wgCanonicalNamespace' => $canonicalNamespace,
3097  'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3098  'wgNamespaceNumber' => $title->getNamespace(),
3099  'wgPageName' => $title->getPrefixedDBkey(),
3100  'wgTitle' => $title->getText(),
3101  'wgCurRevisionId' => $curRevisionId,
3102  'wgRevisionId' => (int)$this->getRevisionId(),
3103  'wgArticleId' => $articleId,
3104  'wgIsArticle' => $this->isArticle(),
3105  'wgIsRedirect' => $title->isRedirect(),
3106  'wgAction' => Action::getActionName( $this->getContext() ),
3107  'wgUserName' => $user->isAnon() ? null : $user->getName(),
3108  'wgUserGroups' => $user->getEffectiveGroups(),
3109  'wgCategories' => $this->getCategories(),
3110  'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
3111  'wgPageContentLanguage' => $lang->getCode(),
3112  'wgPageContentModel' => $title->getContentModel(),
3113  'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3114  'wgDigitTransformTable' => $compactDigitTransTable,
3115  'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
3116  'wgMonthNames' => $lang->getMonthNamesArray(),
3117  'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
3118  'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3119  );
3120  if ( $user->isLoggedIn() ) {
3121  $vars['wgUserId'] = $user->getId();
3122  $vars['wgUserEditCount'] = $user->getEditCount();
3123  $userReg = wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
3124  $vars['wgUserRegistration'] = $userReg !== null ? ( $userReg * 1000 ) : null;
3125  // Get the revision ID of the oldest new message on the user's talk
3126  // page. This can be used for constructing new message alerts on
3127  // the client side.
3128  $vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
3129  }
3130  if ( $wgContLang->hasVariants() ) {
3131  $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
3132  }
3133  // Same test as SkinTemplate
3134  $vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user ) && ( $title->exists() || $title->quickUserCan( 'create', $user ) );
3135  foreach ( $title->getRestrictionTypes() as $type ) {
3136  $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
3137  }
3138  if ( $title->isMainPage() ) {
3139  $vars['wgIsMainPage'] = true;
3140  }
3141  if ( $this->mRedirectedFrom ) {
3142  $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3143  }
3144  if ( $relevantUser ) {
3145  $vars['wgRelevantUserName'] = $relevantUser->getName();
3146  }
3147 
3148  // Allow extensions to add their custom variables to the mw.config map.
3149  // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
3150  // page-dependant but site-wide (without state).
3151  // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
3152  wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars, $this ) );
3153 
3154  // Merge in variables from addJsConfigVars last
3155  return array_merge( $vars, $this->getJsConfigVars() );
3156  }
3157 
3167  public function userCanPreview() {
3168  if ( $this->getRequest()->getVal( 'action' ) != 'submit'
3169  || !$this->getRequest()->wasPosted()
3170  || !$this->getUser()->isLoggedIn()
3171  || !$this->getUser()->matchEditToken(
3172  $this->getRequest()->getVal( 'wpEditToken' ) )
3173  ) {
3174  return false;
3175  }
3176  if ( !$this->getTitle()->isJsSubpage() && !$this->getTitle()->isCssSubpage() ) {
3177  return false;
3178  }
3179  if ( !$this->getTitle()->isSubpageOf( $this->getUser()->getUserPage() ) ) {
3180  // Don't execute another user's CSS or JS on preview (T85855)
3181  return false;
3182  }
3184  return !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) );
3185  }
3186 
3190  public function getHeadLinksArray() {
3191  global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
3192  $wgSitename, $wgVersion,
3193  $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
3194  $wgDisableLangConversion, $wgCanonicalLanguageLinks,
3195  $wgRightsPage, $wgRightsUrl;
3196 
3197  $tags = array();
3198 
3199  $canonicalUrl = $this->mCanonicalUrl;
3200 
3201  $tags['meta-generator'] = Html::element( 'meta', array(
3202  'name' => 'generator',
3203  'content' => "MediaWiki $wgVersion",
3204  ) );
3205 
3206  $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
3207  if ( $p !== 'index,follow' ) {
3208  // http://www.robotstxt.org/wc/meta-user.html
3209  // Only show if it's different from the default robots policy
3210  $tags['meta-robots'] = Html::element( 'meta', array(
3211  'name' => 'robots',
3212  'content' => $p,
3213  ) );
3214  }
3215 
3216  foreach ( $this->mMetatags as $tag ) {
3217  if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) {
3218  $a = 'http-equiv';
3219  $tag[0] = substr( $tag[0], 5 );
3220  } else {
3221  $a = 'name';
3222  }
3223  $tagName = "meta-{$tag[0]}";
3224  if ( isset( $tags[$tagName] ) ) {
3225  $tagName .= $tag[1];
3226  }
3227  $tags[$tagName] = Html::element( 'meta',
3228  array(
3229  $a => $tag[0],
3230  'content' => $tag[1]
3231  )
3232  );
3233  }
3234 
3235  foreach ( $this->mLinktags as $tag ) {
3236  $tags[] = Html::element( 'link', $tag );
3237  }
3238 
3239  # Universal edit button
3240  if ( $wgUniversalEditButton && $this->isArticleRelated() ) {
3241  $user = $this->getUser();
3242  if ( $this->getTitle()->quickUserCan( 'edit', $user )
3243  && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create', $user ) ) ) {
3244  // Original UniversalEditButton
3245  $msg = $this->msg( 'edit' )->text();
3246  $tags['universal-edit-button'] = Html::element( 'link', array(
3247  'rel' => 'alternate',
3248  'type' => 'application/x-wiki',
3249  'title' => $msg,
3250  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3251  ) );
3252  // Alternate edit link
3253  $tags['alternative-edit'] = Html::element( 'link', array(
3254  'rel' => 'edit',
3255  'title' => $msg,
3256  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3257  ) );
3258  }
3259  }
3260 
3261  # Generally the order of the favicon and apple-touch-icon links
3262  # should not matter, but Konqueror (3.5.9 at least) incorrectly
3263  # uses whichever one appears later in the HTML source. Make sure
3264  # apple-touch-icon is specified first to avoid this.
3265  if ( $wgAppleTouchIcon !== false ) {
3266  $tags['apple-touch-icon'] = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
3267  }
3268 
3269  if ( $wgFavicon !== false ) {
3270  $tags['favicon'] = Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
3271  }
3272 
3273  # OpenSearch description link
3274  $tags['opensearch'] = Html::element( 'link', array(
3275  'rel' => 'search',
3276  'type' => 'application/opensearchdescription+xml',
3277  'href' => wfScript( 'opensearch_desc' ),
3278  'title' => $this->msg( 'opensearch-desc' )->inContentLanguage()->text(),
3279  ) );
3280 
3281  if ( $wgEnableAPI ) {
3282  # Real Simple Discovery link, provides auto-discovery information
3283  # for the MediaWiki API (and potentially additional custom API
3284  # support such as WordPress or Twitter-compatible APIs for a
3285  # blogging extension, etc)
3286  $tags['rsd'] = Html::element( 'link', array(
3287  'rel' => 'EditURI',
3288  'type' => 'application/rsd+xml',
3289  // Output a protocol-relative URL here if $wgServer is protocol-relative
3290  // Whether RSD accepts relative or protocol-relative URLs is completely undocumented, though
3291  'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ), PROTO_RELATIVE ),
3292  ) );
3293  }
3294 
3295  # Language variants
3296  if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
3297  $lang = $this->getTitle()->getPageLanguage();
3298  if ( $lang->hasVariants() ) {
3299 
3300  $urlvar = $lang->getURLVariant();
3301 
3302  if ( !$urlvar ) {
3303  $variants = $lang->getVariants();
3304  foreach ( $variants as $_v ) {
3305  $tags["variant-$_v"] = Html::element( 'link', array(
3306  'rel' => 'alternate',
3307  'hreflang' => wfBCP47( $_v ),
3308  'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
3309  );
3310  }
3311  } else {
3312  $canonicalUrl = $this->getTitle()->getLocalURL();
3313  }
3314  }
3315  }
3316 
3317  # Copyright
3318  $copyright = '';
3319  if ( $wgRightsPage ) {
3320  $copy = Title::newFromText( $wgRightsPage );
3321 
3322  if ( $copy ) {
3323  $copyright = $copy->getLocalURL();
3324  }
3325  }
3326 
3327  if ( !$copyright && $wgRightsUrl ) {
3328  $copyright = $wgRightsUrl;
3329  }
3330 
3331  if ( $copyright ) {
3332  $tags['copyright'] = Html::element( 'link', array(
3333  'rel' => 'copyright',
3334  'href' => $copyright )
3335  );
3336  }
3337 
3338  # Feeds
3339  if ( $wgFeed ) {
3340  foreach ( $this->getSyndicationLinks() as $format => $link ) {
3341  # Use the page name for the title. In principle, this could
3342  # lead to issues with having the same name for different feeds
3343  # corresponding to the same page, but we can't avoid that at
3344  # this low a level.
3345 
3346  $tags[] = $this->feedLink(
3347  $format,
3348  $link,
3349  # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
3350  $this->msg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() )->text()
3351  );
3352  }
3353 
3354  # Recent changes feed should appear on every page (except recentchanges,
3355  # that would be redundant). Put it after the per-page feed to avoid
3356  # changing existing behavior. It's still available, probably via a
3357  # menu in your browser. Some sites might have a different feed they'd
3358  # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3359  # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3360  # If so, use it instead.
3361  if ( $wgOverrideSiteFeed ) {
3362  foreach ( $wgOverrideSiteFeed as $type => $feedUrl ) {
3363  // Note, this->feedLink escapes the url.
3364  $tags[] = $this->feedLink(
3365  $type,
3366  $feedUrl,
3367  $this->msg( "site-{$type}-feed", $wgSitename )->text()
3368  );
3369  }
3370  } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
3371  $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
3372  foreach ( $wgAdvertisedFeedTypes as $format ) {
3373  $tags[] = $this->feedLink(
3374  $format,
3375  $rctitle->getLocalURL( array( 'feed' => $format ) ),
3376  $this->msg( "site-{$format}-feed", $wgSitename )->text() # For grep: 'site-rss-feed', 'site-atom-feed'.
3377  );
3378  }
3379  }
3380  }
3381 
3382  # Canonical URL
3383  global $wgEnableCanonicalServerLink;
3384  if ( $wgEnableCanonicalServerLink ) {
3385  if ( $canonicalUrl !== false ) {
3386  $canonicalUrl = wfExpandUrl( $canonicalUrl, PROTO_CANONICAL );
3387  } else {
3388  $reqUrl = $this->getRequest()->getRequestURL();
3389  $canonicalUrl = wfExpandUrl( $reqUrl, PROTO_CANONICAL );
3390  }
3391  }
3392  if ( $canonicalUrl !== false ) {
3393  $tags[] = Html::element( 'link', array(
3394  'rel' => 'canonical',
3395  'href' => $canonicalUrl
3396  ) );
3397  }
3399  return $tags;
3400  }
3401 
3405  public function getHeadLinks() {
3406  return implode( "\n", $this->getHeadLinksArray() );
3407  }
3408 
3417  private function feedLink( $type, $url, $text ) {
3418  return Html::element( 'link', array(
3419  'rel' => 'alternate',
3420  'type' => "application/$type+xml",
3421  'title' => $text,
3422  'href' => $url )
3423  );
3424  }
3425 
3435  public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
3436  $options = array();
3437  // Even though we expect the media type to be lowercase, but here we
3438  // force it to lowercase to be safe.
3439  if ( $media ) {
3440  $options['media'] = $media;
3441  }
3442  if ( $condition ) {
3443  $options['condition'] = $condition;
3444  }
3445  if ( $dir ) {
3446  $options['dir'] = $dir;
3447  }
3448  $this->styles[$style] = $options;
3449  }
3450 
3456  public function addInlineStyle( $style_css, $flip = 'noflip' ) {
3457  if ( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
3458  # If wanted, and the interface is right-to-left, flip the CSS
3459  $style_css = CSSJanus::transform( $style_css, true, false );
3460  }
3461  $this->mInlineStyles .= Html::inlineStyle( $style_css ) . "\n";
3462  }
3470  public function buildCssLinks() {
3471  global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs, $wgContLang;
3472 
3473  $this->getSkin()->setupSkinUserCss( $this );
3474 
3475  // Add ResourceLoader styles
3476  // Split the styles into these groups
3477  $styles = array( 'other' => array(), 'user' => array(), 'site' => array(), 'private' => array(), 'noscript' => array() );
3478  $links = array();
3479  $otherTags = ''; // Tags to append after the normal <link> tags
3481 
3482  $moduleStyles = $this->getModuleStyles();
3483 
3484  // Per-site custom styles
3485  $moduleStyles[] = 'site';
3486  $moduleStyles[] = 'noscript';
3487  $moduleStyles[] = 'user.groups';
3488 
3489  // Per-user custom styles
3490  if ( $wgAllowUserCss && $this->getTitle()->isCssSubpage() && $this->userCanPreview() ) {
3491  // We're on a preview of a CSS subpage
3492  // Exclude this page from the user module in case it's in there (bug 26283)
3493  $link = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_STYLES, false,
3494  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
3495  );
3496  $otherTags .= $link['html'];
3497 
3498  // Load the previewed CSS
3499  // If needed, Janus it first. This is user-supplied CSS, so it's
3500  // assumed to be right for the content language directionality.
3501  $previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
3502  if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
3503  $previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
3504  }
3505  $otherTags .= Html::inlineStyle( $previewedCSS ) . "\n";
3506  } else {
3507  // Load the user styles normally
3508  $moduleStyles[] = 'user';
3509  }
3510 
3511  // Per-user preference styles
3512  $moduleStyles[] = 'user.cssprefs';
3513 
3514  foreach ( $moduleStyles as $name ) {
3515  $module = $resourceLoader->getModule( $name );
3516  if ( !$module ) {
3517  continue;
3518  }
3519  $group = $module->getGroup();
3520  // Modules in groups different than the ones listed on top (see $styles assignment)
3521  // will be placed in the "other" group
3522  $styles[ isset( $styles[$group] ) ? $group : 'other' ][] = $name;
3523  }
3524 
3525  // We want site, private and user styles to override dynamically added styles from modules, but we want
3526  // dynamically added styles to override statically added styles from other modules. So the order
3527  // has to be other, dynamic, site, private, user
3528  // Add statically added styles for other modules
3529  $links[] = $this->makeResourceLoaderLink( $styles['other'], ResourceLoaderModule::TYPE_STYLES );
3530  // Add normal styles added through addStyle()/addInlineStyle() here
3531  $links[] = implode( "\n", $this->buildCssLinksArray() ) . $this->mInlineStyles;
3532  // Add marker tag to mark the place where the client-side loader should inject dynamic styles
3533  // We use a <meta> tag with a made-up name for this because that's valid HTML
3534  $links[] = Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) ) . "\n";
3535 
3536  // Add site, private and user styles
3537  // 'private' at present only contains user.options, so put that before 'user'
3538  // Any future private modules will likely have a similar user-specific character
3539  foreach ( array( 'site', 'noscript', 'private', 'user' ) as $group ) {
3540  $links[] = $this->makeResourceLoaderLink( $styles[$group],
3542  );
3543  }
3544 
3545  // Add stuff in $otherTags (previewed user CSS if applicable)
3546  return self::getHtmlFromLoaderLinks( $links ) . $otherTags;
3547  }
3548 
3552  public function buildCssLinksArray() {
3553  $links = array();
3554 
3555  // Add any extension CSS
3556  foreach ( $this->mExtStyles as $url ) {
3557  $this->addStyle( $url );
3558  }
3559  $this->mExtStyles = array();
3560 
3561  foreach ( $this->styles as $file => $options ) {
3562  $link = $this->styleLink( $file, $options );
3563  if ( $link ) {
3564  $links[$file] = $link;
3565  }
3566  }
3567  return $links;
3568  }
3569 
3577  protected function styleLink( $style, $options ) {
3578  if ( isset( $options['dir'] ) ) {
3579  if ( $this->getLanguage()->getDir() != $options['dir'] ) {
3580  return '';
3581  }
3582  }
3583 
3584  if ( isset( $options['media'] ) ) {
3585  $media = self::transformCssMedia( $options['media'] );
3586  if ( is_null( $media ) ) {
3587  return '';
3588  }
3589  } else {
3590  $media = 'all';
3591  }
3592 
3593  if ( substr( $style, 0, 1 ) == '/' ||
3594  substr( $style, 0, 5 ) == 'http:' ||
3595  substr( $style, 0, 6 ) == 'https:' ) {
3596  $url = $style;
3597  } else {
3598  global $wgStylePath, $wgStyleVersion;
3599  $url = $wgStylePath . '/' . $style . '?' . $wgStyleVersion;
3600  }
3601 
3602  $link = Html::linkedStyle( $url, $media );
3603 
3604  if ( isset( $options['condition'] ) ) {
3605  $condition = htmlspecialchars( $options['condition'] );
3606  $link = "<!--[if $condition]>$link<![endif]-->";
3607  }
3608  return $link;
3609  }
3610 
3618  public static function transformCssMedia( $media ) {
3619  global $wgRequest;
3620 
3621  // http://www.w3.org/TR/css3-mediaqueries/#syntax
3622  $screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
3623 
3624  // Switch in on-screen display for media testing
3625  $switches = array(
3626  'printable' => 'print',
3627  'handheld' => 'handheld',
3628  );
3629  foreach ( $switches as $switch => $targetMedia ) {
3630  if ( $wgRequest->getBool( $switch ) ) {
3631  if ( $media == $targetMedia ) {
3632  $media = '';
3633  } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3634  // This regex will not attempt to understand a comma-separated media_query_list
3635  //
3636  // Example supported values for $media: 'screen', 'only screen', 'screen and (min-width: 982px)' ),
3637  // Example NOT supported value for $media: '3d-glasses, screen, print and resolution > 90dpi'
3638  //
3639  // If it's a print request, we never want any kind of screen stylesheets
3640  // If it's a handheld request (currently the only other choice with a switch),
3641  // we don't want simple 'screen' but we might want screen queries that
3642  // have a max-width or something, so we'll pass all others on and let the
3643  // client do the query.
3644  if ( $targetMedia == 'print' || $media == 'screen' ) {
3645  return null;
3646  }
3647  }
3648  }
3649  }
3650 
3651  return $media;
3652  }
3660  public function addWikiMsg( /*...*/ ) {
3661  $args = func_get_args();
3662  $name = array_shift( $args );
3663  $this->addWikiMsgArray( $name, $args );
3664  }
3665 
3674  public function addWikiMsgArray( $name, $args ) {
3675  $this->addHTML( $this->msg( $name, $args )->parseAsBlock() );
3676  }
3677 
3701  public function wrapWikiMsg( $wrap /*, ...*/ ) {
3702  $msgSpecs = func_get_args();
3703  array_shift( $msgSpecs );
3704  $msgSpecs = array_values( $msgSpecs );
3705  $s = $wrap;
3706  foreach ( $msgSpecs as $n => $spec ) {
3707  if ( is_array( $spec ) ) {
3708  $args = $spec;
3709  $name = array_shift( $args );
3710  if ( isset( $args['options'] ) ) {
3711  unset( $args['options'] );
3712  wfDeprecated(
3713  'Adding "options" to ' . __METHOD__ . ' is no longer supported',
3714  '1.20'
3715  );
3716  }
3717  } else {
3718  $args = array();
3719  $name = $spec;
3720  }
3721  $s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
3722  }
3723  $this->addWikiText( $s );
3724  }
3725 
3735  public function includeJQuery( $modules = array() ) {
3736  return array();
3737  }
3738 
3744  public function enableTOC( $flag = true ) {
3745  $this->mEnableTOC = $flag;
3746  }
3747 
3752  public function isTOCEnabled() {
3753  return $this->mEnableTOC;
3754  }
3755 
3761  public function enableSectionEditLinks( $flag = true ) {
3762  $this->mEnableSectionEditLinks = $flag;
3763  }
3764 
3769  public function sectionEditLinksEnabled() {
3771  }
3772 }
ReadOnlyError
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
Definition: ReadOnlyError.php:28
Action\getActionName
static getActionName(IContextSource $context)
Get the action that will be executed, not necessarily the one passed passed through the "action" requ...
Definition: Action.php:112
OutputPage\preventClickjacking
preventClickjacking( $enable=true)
Set a flag which will cause an X-Frame-Options header appropriate for edit pages to be sent.
Definition: OutputPage.php:1909
OutputPage\$mModuleScripts
$mModuleScripts
Definition: OutputPage.php:140
ResourceLoader\makeLoaderConditionalScript
static makeLoaderConditionalScript( $script)
Returns JS code which runs given JS code if the client-side framework is present.
Definition: ResourceLoader.php:1138
OutputPage\addCategoryLinks
addCategoryLinks( $categories)
Add an array of categories, with names in the keys.
Definition: OutputPage.php:1188
ParserOptions
Set options of the Parser.
Definition: ParserOptions.php:31
OutputPage\getCategoryLinks
getCategoryLinks()
Get the list of category links, in a 2-D array with the following format: $arr[$type][] = $link,...
Definition: OutputPage.php:1262
OutputPage\addMeta
addMeta( $name, $val)
Add a new "<meta>" tag To add an http-equiv meta tag, precede the name with "http:".
Definition: OutputPage.php:317
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:33
ContextSource\getConfig
getConfig()
Get the Config object.
Definition: ContextSource.php:67
OutputPage\getTarget
getTarget()
Definition: OutputPage.php:561
OutputPage\setArticleRelated
setArticleRelated( $v)
Set whether this page is related an article on the wiki Setting false will cause the change of "artic...
Definition: OutputPage.php:1138
ResourceLoaderContext
Object passed around to modules which contains information about the state of a specific loader reque...
Definition: ResourceLoaderContext.php:29
OutputPage\$mRevisionId
$mRevisionId
should be private. To include the variable {{REVISIONID}}
Definition: OutputPage.php:216
OutputPage\$mHeadItems
$mHeadItems
Array of elements in "<head>". Parser might add its own headers!
Definition: OutputPage.php:137
OutputPage\getSubtitle
getSubtitle()
Get the subtitle.
Definition: OutputPage.php:975
FauxRequest
WebRequest clone which takes values from a provided array.
Definition: WebRequest.php:1275
OutputPage\setAllowedModules
setAllowedModules( $type, $level)
Set the highest level of CSS/JS untrustworthiness allowed.
Definition: OutputPage.php:1338
OutputPage\enableClientCache
enableClientCache( $state)
Use enableClientCache(false) to force it to send nocache headers.
Definition: OutputPage.php:1754
OutputPage\styleLink
styleLink( $style, $options)
Generate <link> tags for stylesheets.
Definition: OutputPage.php:3570
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
OutputPage\addWikiMsg
addWikiMsg()
Add a wikitext-formatted message to the output.
Definition: OutputPage.php:3653
ContextSource\getContext
getContext()
Get the RequestContext object.
Definition: ContextSource.php:40
OutputPage\getLanguageLinks
getLanguageLinks()
Get the list of language links.
Definition: OutputPage.php:1179
OutputPage\reduceAllowedModules
reduceAllowedModules( $type, $level)
Limit the highest level of CSS/JS untrustworthiness allowed.
Definition: OutputPage.php:1352
PROTO_CANONICAL
const PROTO_CANONICAL
Definition: Defines.php:271
wfBCP47
wfBCP47( $code)
Get the normalised IETF language tag See unit test for examples.
Definition: GlobalFunctions.php:3985
$request
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 my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled also a ContextSource error or success you ll probably need to make sure the header is varied on WebRequest $request
Definition: hooks.txt:1961
OutputPage\addSubtitle
addSubtitle( $str)
Add $str to the subtitle.
Definition: OutputPage.php:942
OutputPage\addAcceptLanguage
addAcceptLanguage()
bug 21672: Add Accept-Language to Vary and XVO headers if there's no 'variant' parameter existed in G...
Definition: OutputPage.php:1875
OutputPage\$mEnableSectionEditLinks
bool $mEnableSectionEditLinks
Whether parser output should contain section edit links.
Definition: OutputPage.php:264
Article\formatRobotPolicy
static formatRobotPolicy( $policy)
Converts a String robot policy into an associative array, to allow merging of several policies using ...
Definition: Article.php:947
OutputPage\getJSVars
getJSVars()
Get an array containing the variables to be set in mw.config in JavaScript.
Definition: OutputPage.php:3045
OutputPage\$mContainsNewMagic
$mContainsNewMagic
Definition: OutputPage.php:170
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ResourceLoader\makeConfigSetScript
static makeConfigSetScript(array $configuration)
Returns JS code which will set the MediaWiki configuration array to the given value.
Definition: ResourceLoader.php:1149
Html\htmlHeader
static htmlHeader( $attribs=array())
Constructs the opening html-tag with necessary doctypes depending on global variables.
Definition: Html.php:746
UserBlockedError
Show an error when the user tries to do something whilst blocked.
Definition: UserBlockedError.php:27
OutputPage\$mLinktags
$mLinktags
Definition: OutputPage.php:42
OutputPage\showFileRenameError
showFileRenameError( $old, $new)
Definition: OutputPage.php:2480
OutputPage\$mBodytext
$mBodytext
Contains all of the "<body>" content. Should be private we got set/get accessors and the append() met...
Definition: OutputPage.php:52
OutputPage\getScriptsForBottomQueue
getScriptsForBottomQueue( $inHead)
JS stuff to put at the 'bottom', which can either be the bottom of the "<body>" or the bottom of the ...
Definition: OutputPage.php:2922
OutputPage\$mRedirectedFrom
Title $mRedirectedFrom
If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redire...
Definition: OutputPage.php:247
OutputPage\setTitle
setTitle(Title $t)
Set the Title object to use.
Definition: OutputPage.php:913
ResourceLoaderModule\TYPE_COMBINED
const TYPE_COMBINED
Definition: ResourceLoaderModule.php:34
$html
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition: hooks.txt:1530
ContextSource\msg
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:175
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:30
$response
$response
Definition: opensearch_desc.php:32
OutputPage\hasHeadItem
hasHeadItem( $name)
Check if the header item $name is already set.
Definition: OutputPage.php:612
OutputPage\__construct
__construct(IContextSource $context=null)
Constructor for OutputPage.
Definition: OutputPage.php:271
OutputPage\addModuleMessages
addModuleMessages( $modules)
Add only messages of one or more modules recognized by the resource loader.
Definition: OutputPage.php:554
OutputPage\getScript
getScript()
Get all registered JS and CSS tags for the header.
Definition: OutputPage.php:433
OutputPage\addModuleStyles
addModuleStyles( $modules)
Add only CSS of one or more modules recognized by the resource loader.
Definition: OutputPage.php:531
OutputPage\loginToUse
loginToUse()
Produce the stock "please login to use the wiki" page.
Definition: OutputPage.php:2320
OutputPage\$mLanguageLinks
$mLanguageLinks
Should be private. Array of Interwiki Prefixed (non DB key) Titles (e.g. 'fr:Test page')
Definition: OutputPage.php:112
OutputPage\$mSubtitle
$mSubtitle
Should be private.
Definition: OutputPage.php:85
wfSetVar
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
Definition: GlobalFunctions.php:2186
OutputPage\isArticleRelated
isArticleRelated()
Return whether this page is related an article on the wiki.
Definition: OutputPage.php:1150
OutputPage\enableSectionEditLinks
enableSectionEditLinks( $flag=true)
Enables/disables section edit links, doesn't override NOEDITSECTION
Definition: OutputPage.php:3754
ResourceLoaderModule\ORIGIN_USER_SITEWIDE
const ORIGIN_USER_SITEWIDE
Definition: ResourceLoaderModule.php:44
OutputPage\setArticleBodyOnly
setArticleBodyOnly( $only)
Set whether the output should only contain the body of the article, without any skin,...
Definition: OutputPage.php:632
OutputPage\getFrameOptions
getFrameOptions()
Get the X-Frame-Options header value (without the name part), or false if there isn't one.
Definition: OutputPage.php:1939
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3714
text
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
Definition: design.txt:12
OutputPage\blockedPage
blockedPage()
Produce a "user is blocked" page.
Definition: OutputPage.php:2162
OutputPage\getRevisionId
getRevisionId()
Get the displayed revision ID.
Definition: OutputPage.php:1436
$timestamp
if( $limit) $timestamp
Definition: importImages.php:104
OutputPage\addParserOutput
addParserOutput(&$parserOutput)
Add a ParserOutput object.
Definition: OutputPage.php:1643
OutputPage\addWikiTextTitleTidy
addWikiTextTitleTidy( $text, &$title, $linestart=true)
Add wikitext with a custom Title object and tidy enabled.
Definition: OutputPage.php:1538
OutputPage\clearHTML
clearHTML()
Clear the body HTML.
Definition: OutputPage.php:1390
Title\newMainPage
static newMainPage()
Create a new Title for the Main Page.
Definition: Title.php:441
OutputPage\setCategoryLinks
setCategoryLinks( $categories)
Reset the category links (but not the category list) and add $categories.
Definition: OutputPage.php:1249
OutputPage\addScript
addScript( $script)
Add raw HTML to the list of scripts (including <script> tag, etc.)
Definition: OutputPage.php:373
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:2530
OutputPage\returnToMain
returnToMain( $unused=null, $returnto=null, $returntoquery=null)
Add a "return to" link pointing to a specified title, or the title indicated in the request,...
Definition: OutputPage.php:2514
OutputPage\$mIsArticleRelated
$mIsArticleRelated
Should be private.
Definition: OutputPage.php:71
OutputPage\buildCssLinksArray
buildCssLinksArray()
Definition: OutputPage.php:3545
OutputPage\$mHTMLtitle
$mHTMLtitle
Should be private. Stores contents of "<title>" tag.
Definition: OutputPage.php:62
wfProfileIn
wfProfileIn( $functionname)
Begin profiling of a function.
Definition: Profiler.php:33
OutputPage\setPageTitleActionText
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:826
$n
$n
Definition: RandomTest.php:76
$ret
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 & $ret
Definition: hooks.txt:1530
$wgCookiePrefix
if( $wgRCFilterByAge) if( $wgSkipSkin) if( $wgLocalInterwiki) if( $wgSharedPrefix===false) if(! $wgCookiePrefix) $wgCookiePrefix
Definition: Setup.php:284
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2434
OutputPage\isUserJsAllowed
isUserJsAllowed()
Return whether user JavaScript is allowed for this page.
Definition: OutputPage.php:1308
OutputPage\getBottomScripts
getBottomScripts()
JS stuff to put at the bottom of the "<body>".
Definition: OutputPage.php:2990
OutputPage\$mCategoryLinks
$mCategoryLinks
Definition: OutputPage.php:108
OutputPage\showFileNotFoundError
showFileNotFoundError( $name)
Definition: OutputPage.php:2488
OutputPage\getHtmlFromLoaderLinks
static getHtmlFromLoaderLinks(Array $links)
Build html output from an array of links from makeResourceLoaderLink.
Definition: OutputPage.php:2841
OutputPage\$mModuleMessages
$mModuleMessages
Definition: OutputPage.php:140
OutputPage\getModuleStyles
getModuleStyles( $filter=false, $position=null)
Get the list of module CSS to include on this page.
Definition: OutputPage.php:518
ResourceLoaderModule\TYPE_MESSAGES
const TYPE_MESSAGES
Definition: ResourceLoaderModule.php:33
$params
$params
Definition: styleTest.css.php:40
OutputPage\getHeadLinks
getHeadLinks()
Definition: OutputPage.php:3398
Skin\addToBodyAttributes
addToBodyAttributes( $out, &$bodyAttrs)
This will be called by OutputPage::headElement when it is creating the "<body>" tag,...
Definition: Skin.php:498
OutputPage\versionRequired
versionRequired( $version)
Display an error page indicating that a given version of MediaWiki is required to use it.
Definition: OutputPage.php:2298
OutputPage\parseInline
parseInline( $text, $linestart=true, $interface=false)
Parse wikitext, strip paragraphs, and return the HTML.
Definition: OutputPage.php:1717
OutputPage\addScriptFile
addScriptFile( $file, $version=null)
Add a JavaScript file out of skins/common, or a given relative path.
Definition: OutputPage.php:405
$s
$s
Definition: mergeMessageFileList.php:156
OutputPage\parserOptions
parserOptions( $options=null)
Get/set the ParserOptions object to use for wikitext parsing.
Definition: OutputPage.php:1410
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:74
Sanitizer\escapeClass
static escapeClass( $class)
Given a value, escape it so that it can be used as a CSS class and return it.
Definition: Sanitizer.php:1144
OutputPage\getFileVersion
getFileVersion()
Get the displayed file version.
Definition: OutputPage.php:1480
$resourceLoader
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 my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled also a ContextSource error or success you ll probably need to make sure the header is varied on WebRequest such as when responding to a resource loader request or generating HTML output & $resourceLoader
Definition: hooks.txt:1961
OutputPage\getSyndicationLinks
getSyndicationLinks()
Return URLs for each supported syndication format for this page.
Definition: OutputPage.php:1095
OutputPage\$mVaryHeader
$mVaryHeader
Definition: OutputPage.php:238
ContextSource\canUseWikiPage
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
Definition: ContextSource.php:99
ContextSource\getRequest
getRequest()
Get the WebRequest object.
Definition: ContextSource.php:77
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:28
OutputPage\$mJsConfigVars
$mJsConfigVars
Definition: OutputPage.php:142
$wgContLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
Definition: design.txt:56
messages
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. Handler functions that modify $result should generally return false to further attempts at conversion. 'ContribsPager you ll need to handle error messages
Definition: hooks.txt:896
OutputPage\$mHideNewSectionLink
$mHideNewSectionLink
Definition: OutputPage.php:195
User\groupHasPermission
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
Definition: User.php:4166
OutputPage\getRedirect
getRedirect()
Get the URL to redirect to, or an empty string if not redirect URL set.
Definition: OutputPage.php:297
OutputPage\setCanonicalUrl
setCanonicalUrl( $url)
Set the URL to be used for the <link rel="canonical">.
Definition: OutputPage.php:348
OutputPage\$mExtStyles
$mExtStyles
Additional stylesheets. Looks like this is for extensions. Might be replaced by resource loader.
Definition: OutputPage.php:46
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
$link
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
Definition: hooks.txt:2160
ContextSource\getTitle
getTitle()
Get the Title object.
Definition: ContextSource.php:87
OutputPage\$mIndexPolicy
$mIndexPolicy
Definition: OutputPage.php:236
Skin\getHtmlElementAttributes
getHtmlElementAttributes()
Definition: Skin.php:482
Html\inlineScript
static inlineScript( $contents)
Output a "<script>" tag with the given contents.
Definition: Html.php:509
OutputPage\permissionRequired
permissionRequired( $permission)
Display an error page noting that a given permission bit is required.
Definition: OutputPage.php:2311
Sanitizer\stripAllTags
static stripAllTags( $text)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed,...
Definition: Sanitizer.php:1736
OutputPage\showFileDeleteError
showFileDeleteError( $name)
Definition: OutputPage.php:2484
Linker\linkKnown
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:264
OutputPage\addHTML
addHTML( $text)
Append $text to the body HTML.
Definition: OutputPage.php:1370
OutputPage\addHeadItem
addHeadItem( $name, $value)
Add or replace an header item to the output.
Definition: OutputPage.php:602
OutputPage\addWikiTextTidy
addWikiTextTidy( $text, $linestart=true)
Add wikitext with tidy enabled.
Definition: OutputPage.php:1548
OutputPage\$mArticleBodyOnly
$mArticleBodyOnly
Flag if output should only contain the body of the article.
Definition: OutputPage.php:192
OutputPage\getModuleScripts
getModuleScripts( $filter=false, $position=null)
Get the list of module JS to include on this page.
Definition: OutputPage.php:495
OutputPage\getRevisionTimestamp
getRevisionTimestamp()
Get the timestamp of displayed revision.
Definition: OutputPage.php:1457
OutputPage\addWikiMsgArray
addWikiMsgArray( $name, $args)
Add a wikitext-formatted message to the output.
Definition: OutputPage.php:3667
OutputPage\enableTOC
enableTOC( $flag=true)
Enables/disables TOC, doesn't override NOTOC
Definition: OutputPage.php:3737
OutputPage\transformCssMedia
static transformCssMedia( $media)
Transform "media" attribute based on request parameters.
Definition: OutputPage.php:3611
OutputPage\setLastModified
setLastModified( $timestamp)
Override the last modified timestamp.
Definition: OutputPage.php:769
OutputPage\$mInlineMsg
$mInlineMsg
Definition: OutputPage.php:145
OutputPage\$mNoGallery
$mNoGallery
Comes from the parser.
Definition: OutputPage.php:202
$dbr
$dbr
Definition: testCompression.php:48
Linker\link
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
Definition: Linker.php:192
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:154
OutputPage\$mParseWarnings
$mParseWarnings
Definition: OutputPage.php:206
ResourceLoader\makeLoaderQuery
static makeLoaderQuery( $modules, $lang, $skin, $user=null, $version=null, $debug=false, $only=null, $printable=false, $handheld=false, $extraQuery=array())
Build a query array (array representation of query string) for load.php.
Definition: ResourceLoader.php:1241
wfAppendQuery
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
Definition: GlobalFunctions.php:506
OutputPage\forceHideNewSectionLink
forceHideNewSectionLink()
Forcibly hide the new section link?
Definition: OutputPage.php:1026
OutputPage\addWikiTextWithTitle
addWikiTextWithTitle( $text, &$title, $linestart=true)
Add wikitext with a custom Title object.
Definition: OutputPage.php:1527
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:218
Xml\encodeJsCall
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
Definition: Xml.php:665
Html\isXmlMimeType
static isXmlMimeType( $mimetype)
Determines if the given mime type is xml.
Definition: Html.php:791
OutputPage\readOnlyPage
readOnlyPage( $source=null, $protected=false, $reasons=array(), $action=null)
Display a page stating that the Wiki is in read-only mode, and optionally show the source of the page...
Definition: OutputPage.php:2382
OutputPage\$mPageTitleActionText
$mPageTitleActionText
Definition: OutputPage.php:205
OutputPage\showErrorPage
showErrorPage( $title, $msg, $params=array())
Output a standard error page.
Definition: OutputPage.php:2201
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:68
Html\openElement
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:159
OutputPage\getModuleMessages
getModuleMessages( $filter=false, $position=null)
Get the list of module messages to include on this page.
Definition: OutputPage.php:543
$lb
if( $wgAPIRequestLog) $lb
Definition: api.php:126
File
Implements some public methods and some protected utility functions which are required by multiple ch...
Definition: File.php:50
OutputPage\feedLink
feedLink( $type, $url, $text)
Generate a "<link rel/>" for a feed.
Definition: OutputPage.php:3410
OutputPage\$mLastModified
$mLastModified
mLastModified and mEtag are used for sending cache control.
Definition: OutputPage.php:94
MWException
MediaWiki exception.
Definition: MWException.php:26
OutputPage\addStyle
addStyle( $style, $media='', $condition='', $dir='')
Add a local or specified stylesheet, with the given media options.
Definition: OutputPage.php:3428
OutputPage\sendCacheControl
sendCacheControl()
Send cache control HTTP headers.
Definition: OutputPage.php:1952
OutputPage\setETag
setETag( $tag)
Set the value of the ETag HTTP header, only used if $wgUseETag is true.
Definition: OutputPage.php:621
OutputPage\out
out( $ins)
Actually output something with print.
Definition: OutputPage.php:2153
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1174
OutputPage\$mCdnMaxageLimit
int $mCdnMaxageLimit
Upper limit on mSquidMaxage *.
Definition: OutputPage.php:210
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2464
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:3794
OutputPage\output
output()
Finally, all the text has been munged and accumulated into the object, let's actually output it:
Definition: OutputPage.php:2034
OutputPage\$mEnableTOC
bool $mEnableTOC
Whether parser output should contain table of contents.
Definition: OutputPage.php:260
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:141
OutputPage\$mInlineStyles
$mInlineStyles
Inline CSS styles.
Definition: OutputPage.php:125
OutputPage\setFileVersion
setFileVersion( $file)
Set the displayed file version.
Definition: OutputPage.php:1467
OutputPage\showUnexpectedValueError
showUnexpectedValueError( $name, $val)
Definition: OutputPage.php:2472
ResourceLoader\makeLoaderStateScript
static makeLoaderStateScript( $name, $state=null)
Returns a JS call to mw.loader.state, which sets the state of a module or modules to a given value.
Definition: ResourceLoader.php:1019
OutputPage\getResourceLoader
getResourceLoader()
Get a ResourceLoader object associated with this OutputPage.
Definition: OutputPage.php:2632
OutputPage\isTOCEnabled
isTOCEnabled()
Definition: OutputPage.php:3745
ContextSource
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
Definition: ContextSource.php:30
Html\linkedScript
static linkedScript( $url)
Output a "<script>" tag linking to the given URL, e.g., "<script src=foo.js></script>".
Definition: Html.php:526
TS_ISO_8601
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
Definition: GlobalFunctions.php:2495
OutputPage\$mAllowedModules
$mAllowedModules
Definition: OutputPage.php:159
ContextSource\getWikiPage
getWikiPage()
Get the WikiPage object.
Definition: ContextSource.php:112
OutputPage\setFeedAppendQuery
setFeedAppendQuery( $val)
Add default feeds to the page header This is mainly kept for backward compatibility,...
Definition: OutputPage.php:1055
OutputPage\isDisabled
isDisabled()
Return whether the output will be completely disabled.
Definition: OutputPage.php:1008
wfTimestampOrNull
wfTimestampOrNull( $outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.
Definition: GlobalFunctions.php:2548
OutputPage\setRevisionId
setRevisionId( $revid)
Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISION...
Definition: OutputPage.php:1426
wfProfileOut
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Definition: Profiler.php:46
PROTO_CURRENT
const PROTO_CURRENT
Definition: Defines.php:270
OutputPage\setArticleFlag
setArticleFlag( $v)
Set whether the displayed content is related to the source of the corresponding article on the wiki S...
Definition: OutputPage.php:1115
OutputPage\disallowUserJs
disallowUserJs()
Do not allow scripts which can be modified by wiki users to load on this page; only allow scripts bun...
Definition: OutputPage.php:1283
ContextSource\getSkin
getSkin()
Get the Skin object.
Definition: ContextSource.php:164
ResourceLoaderModule\TYPE_SCRIPTS
const TYPE_SCRIPTS
Definition: ResourceLoaderModule.php:31
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:39
OutputPage\setSubtitle
setSubtitle( $str)
Replace the subtitle with $str.
Definition: OutputPage.php:922
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4066
OutputPage\addVaryHeader
addVaryHeader( $header, $option=null)
Add an HTTP header that will influence on the cache.
Definition: OutputPage.php:1812
OutputPage\getStatusMessage
static getStatusMessage( $code)
Get the message associated with the HTTP response code $code.
Definition: OutputPage.php:2025
OutputPage\addWikiText
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...
Definition: OutputPage.php:1512
ThrottledError
Show an error when the user hits a rate limit.
Definition: ThrottledError.php:27
wfCgiToArray
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
Definition: GlobalFunctions.php:459
OutputPage\getVaryHeader
getVaryHeader()
Return a Vary: header on which to vary caches.
Definition: OutputPage.php:1831
OutputPage\addModules
addModules( $modules)
Add one or more modules recognized by the resource loader.
Definition: OutputPage.php:483
OutputPage\showLagWarning
showLagWarning( $lag)
Show a warning about slave lag.
Definition: OutputPage.php:2455
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
OutputPage\appendSubtitle
appendSubtitle( $str)
Add $str to the subtitle.
Definition: OutputPage.php:933
OutputPage\getPageTitleActionText
getPageTitleActionText()
Get the value of the "action text".
Definition: OutputPage.php:835
OutputPage\getCacheVaryCookies
getCacheVaryCookies()
Get the list of cookies that will influence on the cache.
Definition: OutputPage.php:1763
OutputPage\getHeadItems
getHeadItems()
Get all header items in a string.
Definition: OutputPage.php:588
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
OutputPage\$mFollowPolicy
$mFollowPolicy
Definition: OutputPage.php:237
OutputPage\addLanguageLinks
addLanguageLinks( $newLinkArray)
Add new language links.
Definition: OutputPage.php:1160
OutputPage\formatPermissionsErrorMessage
formatPermissionsErrorMessage( $errors, $action=null)
Format a list of error messages.
Definition: OutputPage.php:2331
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:93
ResourceLoader\makeLoaderURL
static makeLoaderURL( $modules, $lang, $skin, $user=null, $version=null, $debug=false, $only=null, $printable=false, $handheld=false, $extraQuery=array())
Build a load.php URL.
Definition: ResourceLoader.php:1212
$cookies
return false to override stock group removal can be modified modifiable will be added to $_SESSION & $cookies
Definition: hooks.txt:2849
ResourceLoaderModule\getOrigin
getOrigin()
Get this module's origin.
Definition: ResourceLoaderModule.php:97
OutputPage\addBacklinkSubtitle
addBacklinkSubtitle(Title $title)
Add a subtitle containing a backlink to a page.
Definition: OutputPage.php:955
ContextSource\setContext
setContext(IContextSource $context)
Set the IContextSource object.
Definition: ContextSource.php:57
OutputPage\addParserOutputNoText
addParserOutputNoText(&$parserOutput)
Add a ParserOutput object, but without Html.
Definition: OutputPage.php:1589
OutputPage\isArticle
isArticle()
Return whether the content displayed page is related to the source of the corresponding article on th...
Definition: OutputPage.php:1128
OutputPage
This class should be covered by a general architecture document which does not exist as of January 20...
Definition: OutputPage.php:38
list
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
OutputPage\$mParserOptions
ParserOptions $mParserOptions
lazy initialised, use parserOptions()
Definition: OutputPage.php:175
OutputPage\addLink
addLink( $linkarr)
Add a new <link> tag to the page header.
Definition: OutputPage.php:328
OutputPage\addInlineScript
addInlineScript( $script)
Add a self-contained script tag with the given contents.
Definition: OutputPage.php:424
OutputPage\getArticleBodyOnly
getArticleBodyOnly()
Return whether the output will contain only the body of the article.
Definition: OutputPage.php:641
OutputPage\getPreventClickjacking
getPreventClickjacking()
Get the prevent-clickjacking flag.
Definition: OutputPage.php:1928
$options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:1530
OutputPage\getExtStyle
getExtStyle()
Get all styles added by extensions.
Definition: OutputPage.php:394
OutputPage\setStatusCode
setStatusCode( $statusCode)
Set the HTTP status code to send with the output.
Definition: OutputPage.php:306
OutputPage\includeJQuery
includeJQuery( $modules=array())
Include jQuery core.
Definition: OutputPage.php:3728
OutputPage\makeResourceLoaderLink
makeResourceLoaderLink( $modules, $only, $useESI=false, array $extraQuery=array(), $loadCall=false)
TODO: Document.
Definition: OutputPage.php:2648
OutputPage\haveCacheVaryCookies
haveCacheVaryCookies()
Check if the request has a cache-varying cookie header If it does, it's very important that we don't ...
Definition: OutputPage.php:1787
OutputPage\getPageTitle
getPageTitle()
Return the "page title", i.e.
Definition: OutputPage.php:904
OutputPage\disable
disable()
Disable output completely, i.e.
Definition: OutputPage.php:999
TS_MW
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
Definition: GlobalFunctions.php:2478
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:980
OutputPage\sectionEditLinksEnabled
sectionEditLinksEnabled()
Definition: OutputPage.php:3762
OutputPage\setIndexPolicy
setIndexPolicy( $policy)
Set the index policy for the page, but leave the follow policy un- touched.
Definition: OutputPage.php:799
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
Skin\getRelevantTitle
getRelevantTitle()
Return the "relevant" title.
Definition: Skin.php:344
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
Skin\getPageClasses
getPageClasses( $title)
TODO: document.
Definition: Skin.php:455
OutputPage\showPermissionsErrorPage
showPermissionsErrorPage( $errors, $action=null)
Output a standard permission error page.
Definition: OutputPage.php:2226
OutputPage\setRevisionTimestamp
setRevisionTimestamp( $timestamp)
Set the timestamp of the revision which will be displayed.
Definition: OutputPage.php:1447
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
OutputPage\$mImageTimeKeys
$mImageTimeKeys
Definition: OutputPage.php:148
OutputPage\getHeadItemsArray
getHeadItemsArray()
Get an array of head items.
Definition: OutputPage.php:579
wfClearOutputBuffers
wfClearOutputBuffers()
More legible than passing a 'false' parameter to wfResetOutputBuffers():
Definition: GlobalFunctions.php:2317
OutputPage\rateLimited
rateLimited()
Turn off regular page output and return an error response for when rate limiting has triggered.
Definition: OutputPage.php:2442
$value
$value
Definition: styleTest.css.php:45
ResourceLoaderModule\ORIGIN_USER_INDIVIDUAL
const ORIGIN_USER_INDIVIDUAL
Definition: ResourceLoaderModule.php:47
OutputPage\$mFileVersion
$mFileVersion
Definition: OutputPage.php:219
TS_ISO_8601_BASIC
const TS_ISO_8601_BASIC
ISO 8601 basic format with no timezone: 19860209T200000Z.
Definition: GlobalFunctions.php:2519
OutputPage\getProperty
getProperty( $name)
Get an additional output property.
Definition: OutputPage.php:663
OutputPage\$mRedirect
$mRedirect
Definition: OutputPage.php:87
ParserOptions\newFromContext
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
Definition: ParserOptions.php:429
OutputPage\setSquidMaxage
setSquidMaxage( $maxage)
Set the value of the "s-maxage" part of the "Cache-control" HTTP header.
Definition: OutputPage.php:1733
OutputPage\$mNewSectionLink
$mNewSectionLink
Definition: OutputPage.php:194
OutputPage\setTarget
setTarget( $target)
Sets ResourceLoader target for load.php links.
Definition: OutputPage.php:570
OutputPage\setHTMLTitle
setHTMLTitle( $name)
"HTML title" means the contents of "<title>".
Definition: OutputPage.php:848
OutputPage\$styles
$styles
An array of stylesheet filenames (relative from skins path), with options for CSS media,...
Definition: OutputPage.php:229
Title\newFromURL
static newFromURL( $url)
THIS IS NOT THE FUNCTION YOU WANT.
Definition: Title.php:241
SpecialPageFactory\resolveAlias
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
Definition: SpecialPageFactory.php:272
$version
$version
Definition: parserTests.php:86
OutputPage\$mResourceLoader
$mResourceLoader
Definition: OutputPage.php:141
OutputPage\$mProperties
$mProperties
Additional key => value data.
Definition: OutputPage.php:252
PROTO_RELATIVE
const PROTO_RELATIVE
Definition: Defines.php:269
OutputPage\wrapWikiMsg
wrapWikiMsg( $wrap)
This function takes a number of message/argument specifications, wraps them in some overall structure...
Definition: OutputPage.php:3694
OutputPage\buildCssLinks
buildCssLinks()
Build a set of "<link>" elements for the stylesheets specified in the $this->styles array.
Definition: OutputPage.php:3463
Html\inlineStyle
static inlineStyle( $contents, $media='all')
Output a "<style>" tag with the given contents for the given media type (if any).
Definition: Html.php:540
OutputPage\filterModules
filterModules( $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:445
OutputPage\prependHTML
prependHTML( $text)
Prepend $text to the body HTML.
Definition: OutputPage.php:1361
Linker\formatTemplates
static formatTemplates( $templates, $preview=false, $section=false, $more=null)
Returns HTML for the "templates used on this page" list.
Definition: Linker.php:1945
MWNamespace\exists
static exists( $index)
Returns whether the specified namespace exists.
Definition: Namespace.php:171
OutputPage\$mEnableClientCache
$mEnableClientCache
Definition: OutputPage.php:186
OutputPage\$mCategories
$mCategories
Definition: OutputPage.php:109
OutputPage\getHTMLTitle
getHTMLTitle()
Return the "HTML title", i.e.
Definition: OutputPage.php:861
OutputPage\showFileCopyError
showFileCopyError( $old, $new)
Definition: OutputPage.php:2476
ResourceLoaderModule\ORIGIN_CORE_INDIVIDUAL
const ORIGIN_CORE_INDIVIDUAL
Definition: ResourceLoaderModule.php:40
OutputPage\clearSubtitle
clearSubtitle()
Clear the subtitles.
Definition: OutputPage.php:966
OutputPage\getMetadataAttribute
getMetadataAttribute()
Get the value of the "rel" attribute for metadata links.
Definition: OutputPage.php:357
HttpStatus\getMessage
static getMessage( $code)
Get the message associated with HTTP response code $code.
Definition: HttpStatus.php:37
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
OutputPage\$mScripts
$mScripts
Should be private.
Definition: OutputPage.php:120
OutputPage\getModules
getModules( $filter=false, $position=null, $param='mModules')
Get the list of modules to include on this page.
Definition: OutputPage.php:469
IContextSource
Interface for objects which can provide a context on request.
Definition: IContextSource.php:29
ResourceLoaderModule\ORIGIN_ALL
const ORIGIN_ALL
Definition: ResourceLoaderModule.php:50
OutputPage\setFollowPolicy
setFollowPolicy( $policy)
Set the follow policy for the page, but leave the index policy un- touched.
Definition: OutputPage.php:813
OutputPage\setPageTitle
setPageTitle( $name)
"Page title" means the contents of <h1>.
Definition: OutputPage.php:882
OutputPage\$mDebugtext
$mDebugtext
Holds the debug lines that will be output as comments in page source if $wgDebugComments is enabled.
Definition: OutputPage.php:59
$file
if(PHP_SAPI !='cli') $file
Definition: UtfNormalTest2.php:30
OutputPage\checkLastModified
checkLastModified( $timestamp)
checkLastModified tells the client to use the client-cached page if possible.
Definition: OutputPage.php:682
$args
if( $line===false) $args
Definition: cdb.php:62
OutputPage\$mLinkColours
$mLinkColours
Definition: OutputPage.php:128
DB_SLAVE
const DB_SLAVE
Definition: Defines.php:55
Title
Represents a title within MediaWiki.
Definition: Title.php:35
ResourceLoaderModule
Abstraction for resource loader modules, with name registration and maxage functionality.
Definition: ResourceLoaderModule.php:28
OutputPage\addReturnTo
addReturnTo( $title, $query=array(), $text=null, $options=array())
Add a "return to" link pointing to a specified title.
Definition: OutputPage.php:2500
OutputPage\getAllowedModules
getAllowedModules( $type)
Get the level of JavaScript / CSS untrustworthiness allowed on this page.
Definition: OutputPage.php:1320
ResourceLoader
Dynamic JavaScript and CSS resource loading system.
Definition: ResourceLoader.php:31
OutputPage\setProperty
setProperty( $name, $value)
Set an additional output property.
Definition: OutputPage.php:652
OutputPage\isPrintable
isPrintable()
Return whether the page is "printable".
Definition: OutputPage.php:992
OutputPage\setSyndicated
setSyndicated( $show=true)
Add or remove feed links in the page header This is mainly kept for backward compatibility,...
Definition: OutputPage.php:1038
$wgParser
$wgParser
Definition: Setup.php:587
OutputPage\$mTarget
string null $mTarget
ResourceLoader target for load.php links.
Definition: OutputPage.php:256
OutputPage\addInlineStyle
addInlineStyle( $style_css, $flip='noflip')
Adds inline CSS styles.
Definition: OutputPage.php:3449
$dir
if(count( $args)==0) $dir
Definition: importImages.php:49
OutputPage\userCanPreview
userCanPreview()
To make it harder for someone to slip a user a fake user-JavaScript or user-CSS preview,...
Definition: OutputPage.php:3160
Html\linkedStyle
static linkedStyle( $url, $media='all')
Output a "<link rel=stylesheet>" linking to the given URL for the given media type (if any).
Definition: Html.php:570
OutputPage\addExtensionStyle
addExtensionStyle( $url)
Register and add a stylesheet from an extension directory.
Definition: OutputPage.php:385
OutputPage\$mRedirectCode
$mRedirectCode
Definition: OutputPage.php:150
ResourceLoader\inDebugMode
static inDebugMode()
Determine whether debug mode was requested Order of priority is 1) request param, 2) cookie,...
Definition: ResourceLoader.php:1188
OutputPage\setLanguageLinks
setLanguageLinks( $newLinkArray)
Reset the language links and add new language links.
Definition: OutputPage.php:1170
OutputPage\setRedirectedFrom
setRedirectedFrom( $t)
Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
Definition: OutputPage.php:870
OutputPage\addWikiTextTitle
addWikiTextTitle( $text, Title $title, $linestart, $tidy=false, $interface=false)
Add wikitext with a custom Title object.
Definition: OutputPage.php:1563
OutputPage\$mMetatags
$mMetatags
Should be private. Used with addMeta() which adds "<meta>".
Definition: OutputPage.php:40
TS_UNIX
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
Definition: GlobalFunctions.php:2473
OutputPage\getHeadScripts
getHeadScripts()
JS stuff to put in the "<head>".
Definition: OutputPage.php:2870
OutputPage\redirect
redirect( $url, $responsecode='302')
Redirect to $url rather than displaying the normal page.
Definition: OutputPage.php:286
$path
$path
Definition: NoLocalSettings.php:35
OutputPage\setPrintable
setPrintable()
Set the page as printable, i.e.
Definition: OutputPage.php:983
OutputPage\getHeadLinksArray
getHeadLinksArray()
Definition: OutputPage.php:3183
OutputPage\$mTemplateIds
$mTemplateIds
Definition: OutputPage.php:147
OutputPage\$mJQueryDone
$mJQueryDone
Whether jQuery is already handled.
Definition: OutputPage.php:234
as
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
Definition: distributors.txt:9
OutputPage\addModuleScripts
addModuleScripts( $modules)
Add only JS of one or more modules recognized by the resource loader.
Definition: OutputPage.php:506
OutputPage\allowClickjacking
allowClickjacking()
Turn off frame-breaking.
Definition: OutputPage.php:1918
OutputPage\addElement
addElement( $element, $attribs=array(), $contents='')
Shortcut for adding an Html::element via addHTML.
Definition: OutputPage.php:1383
OutputPage\showFatalError
showFatalError( $message)
Definition: OutputPage.php:2466
OutputPage\getHTML
getHTML()
Get the body HTML.
Definition: OutputPage.php:1399
Skin\getRelevantUser
getRelevantUser()
Return the "relevant" user.
Definition: Skin.php:368
$keys
$keys
Definition: testCompression.php:63
OutputPage\$mCanonicalUrl
$mCanonicalUrl
Definition: OutputPage.php:43
$source
if(PHP_SAPI !='cli') $source
Definition: mwdoc-filter.php:18
OutputPage\$mModules
$mModules
Definition: OutputPage.php:140
ResourceLoaderModule\TYPE_STYLES
const TYPE_STYLES
Definition: ResourceLoaderModule.php:32
Sanitizer\normalizeCharReferences
static normalizeCharReferences( $text)
Ensure that any entities and character references are legal for XML and XHTML specifically.
Definition: Sanitizer.php:1317
MWDebug\addModules
static addModules(OutputPage $out)
Add ResourceLoader modules to the OutputPage object if debugging is enabled.
Definition: Debug.php:87
OutputPage\addMetadataLink
addMetadataLink( $linkarr)
Add a new <link> with "rel" attribute set to "meta".
Definition: OutputPage.php:339
OutputPage\showNewSectionLink
showNewSectionLink()
Show an "add new section" link?
Definition: OutputPage.php:1017
CSSJanus\transform
static transform( $css, $swapLtrRtlInURL=false, $swapLeftRightInURL=false)
Transform an LTR stylesheet to RTL.
Definition: CSSJanus.php:139
OutputPage\parse
parse( $text, $linestart=true, $interface=false, $language=null)
Parse wikitext and return the HTML.
Definition: OutputPage.php:1677
OutputPage\$mStatusCode
$mStatusCode
Definition: OutputPage.php:88
$t
$t
Definition: testCompression.php:65
OutputPage\$mSquidMaxage
$mSquidMaxage
Definition: OutputPage.php:209
$vars
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
Definition: hooks.txt:1684
Skin\getSkinName
getSkinName()
Definition: Skin.php:208
OutputPage\addJsConfigVars
addJsConfigVars( $keys, $value=null)
Add one or more variables to be set in mw.config in JavaScript.
Definition: OutputPage.php:3022
OutputPage\$mPrintable
$mPrintable
Should be private.
Definition: OutputPage.php:77
Skin
The main skin class which provides methods and properties for all other skins.
Definition: Skin.php:35
$error
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
Definition: hooks.txt:2584
OutputPage\$mPagetitle
$mPagetitle
Should be private - has getter and setter. Contains the HTML title.
Definition: OutputPage.php:49
Html\rawElement
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
Definition: Html.php:121
$query
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1105
OutputPage\$mRevisionTimestamp
$mRevisionTimestamp
Definition: OutputPage.php:217
OutputPage\getJsConfigVars
getJsConfigVars()
Get the javascript config vars to include on this page.
Definition: OutputPage.php:3012
OutputPage\$mContainsOldMagic
$mContainsOldMagic
Definition: OutputPage.php:170
OutputPage\getTemplateIds
getTemplateIds()
Get the templates used on this page.
Definition: OutputPage.php:1490
$attribs
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
Definition: hooks.txt:1530
OutputPage\$mModuleStyles
$mModuleStyles
Definition: OutputPage.php:140
OutputPage\isSyndicated
isSyndicated()
Should we output feed links for this page?
Definition: OutputPage.php:1087
OutputPage\$mFeedLinksAppendQuery
$mFeedLinksAppendQuery
Definition: OutputPage.php:152
OutputPage\getFileSearchOptions
getFileSearchOptions()
Get the files used on this page.
Definition: OutputPage.php:1500
OutputPage\$mETag
$mETag
Should be private.
Definition: OutputPage.php:106
$res
$res
Definition: database.txt:21
OutputPage\$mFeedLinks
$mFeedLinks
Handles the atom / rss links.
Definition: OutputPage.php:183
OutputPage\$mDoNothing
bool $mDoNothing
Whether output is disabled.
Definition: OutputPage.php:167
LinkCache\singleton
static & singleton()
Get an instance of this class.
Definition: LinkCache.php:49
OutputPage\getXVO
getXVO()
Get a complete X-Vary-Options header.
Definition: OutputPage.php:1845
OutputPage\$mPreventClickjacking
$mPreventClickjacking
Definition: OutputPage.php:213
TS_RFC2822
const TS_RFC2822
RFC 2822 format, for E-mail and HTTP headers.
Definition: GlobalFunctions.php:2488
MWNamespace\getCanonicalName
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
Definition: Namespace.php:237
OutputPage\prepareErrorPage
prepareErrorPage( $pageTitle, $htmlTitle=false)
Prepare this object to display an error page; disable caching and indexing, clear the current text an...
Definition: OutputPage.php:2176
OutputPage\addTemplate
addTemplate(&$template)
Add the output of a QuickTemplate to the output buffer.
Definition: OutputPage.php:1661
OutputPage\getFeedAppendQuery
getFeedAppendQuery()
Will currently always return null.
Definition: OutputPage.php:1104
OutputPage\lowerCdnMaxage
lowerCdnMaxage( $maxage)
Lower the value of the "s-maxage" part of the "Cache-control" HTTP header.
Definition: OutputPage.php:1742
OutputPage\$mPageLinkTitle
$mPageLinkTitle
Used by skin template.
Definition: OutputPage.php:134
OutputPage\$mIsarticle
$mIsarticle
Should be private. Is the displayed content related to the source of the corresponding wiki article.
Definition: OutputPage.php:65
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:544
OutputPage\addFeedLink
addFeedLink( $format, $href)
Add a feed link to the page header.
Definition: OutputPage.php:1075
OutputPage\setRobotPolicy
setRobotPolicy( $policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
Definition: OutputPage.php:781
wfArrayToCgi
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes two arrays as input, and returns a CGI-style string, e.g.
Definition: GlobalFunctions.php:414
Sanitizer\removeHTMLtags
static removeHTMLtags( $text, $processCallback=null, $args=array(), $extratags=array(), $removetags=array())
Cleans up HTML, removes dangerous tags and attributes, and removes HTML comments.
Definition: Sanitizer.php:366
OutputPage\headElement
headElement(Skin $sk, $includeStyle=true)
Definition: OutputPage.php:2546
$type
$type
Definition: testCompression.php:46
OutputPage\getCategories
getCategories()
Get the list of category names this page belongs to.
Definition: OutputPage.php:1271