MediaWiki  1.23.13
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  }
1422  return wfSetVar( $this->mParserOptions, $options );
1423  }
1424 
1432  public function setRevisionId( $revid ) {
1433  $val = is_null( $revid ) ? null : intval( $revid );
1434  return wfSetVar( $this->mRevisionId, $val );
1435  }
1436 
1442  public function getRevisionId() {
1443  return $this->mRevisionId;
1444  }
1445 
1453  public function setRevisionTimestamp( $timestamp ) {
1454  return wfSetVar( $this->mRevisionTimestamp, $timestamp );
1455  }
1463  public function getRevisionTimestamp() {
1465  }
1473  public function setFileVersion( $file ) {
1474  $val = null;
1475  if ( $file instanceof File && $file->exists() ) {
1476  $val = array( 'time' => $file->getTimestamp(), 'sha1' => $file->getSha1() );
1477  }
1478  return wfSetVar( $this->mFileVersion, $val, true );
1479  }
1480 
1486  public function getFileVersion() {
1487  return $this->mFileVersion;
1488  }
1496  public function getTemplateIds() {
1497  return $this->mTemplateIds;
1498  }
1506  public function getFileSearchOptions() {
1507  return $this->mImageTimeKeys;
1508  }
1509 
1518  public function addWikiText( $text, $linestart = true, $interface = true ) {
1519  $title = $this->getTitle(); // Work around E_STRICT
1520  if ( !$title ) {
1521  throw new MWException( 'Title is null' );
1522  }
1523  $this->addWikiTextTitle( $text, $title, $linestart, /*tidy*/false, $interface );
1524  }
1525 
1533  public function addWikiTextWithTitle( $text, &$title, $linestart = true ) {
1534  $this->addWikiTextTitle( $text, $title, $linestart );
1535  }
1536 
1544  function addWikiTextTitleTidy( $text, &$title, $linestart = true ) {
1545  $this->addWikiTextTitle( $text, $title, $linestart, true );
1546  }
1554  public function addWikiTextTidy( $text, $linestart = true ) {
1555  $title = $this->getTitle();
1556  $this->addWikiTextTitleTidy( $text, $title, $linestart );
1557  }
1558 
1569  public function addWikiTextTitle( $text, Title $title, $linestart, $tidy = false, $interface = false ) {
1570  global $wgParser;
1571 
1572  wfProfileIn( __METHOD__ );
1573 
1574  $popts = $this->parserOptions();
1575  $oldTidy = $popts->setTidy( $tidy );
1576  $popts->setInterfaceMessage( (bool)$interface );
1577 
1578  $parserOutput = $wgParser->parse(
1579  $text, $title, $popts,
1580  $linestart, true, $this->mRevisionId
1581  );
1582 
1583  $popts->setTidy( $oldTidy );
1584 
1585  $this->addParserOutput( $parserOutput );
1586 
1587  wfProfileOut( __METHOD__ );
1588  }
1589 
1595  public function addParserOutputNoText( &$parserOutput ) {
1596  $this->mLanguageLinks += $parserOutput->getLanguageLinks();
1597  $this->addCategoryLinks( $parserOutput->getCategories() );
1598  $this->mNewSectionLink = $parserOutput->getNewSection();
1599  $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
1600 
1601  $this->mParseWarnings = $parserOutput->getWarnings();
1602  if ( !$parserOutput->isCacheable() ) {
1603  $this->enableClientCache( false );
1604  }
1605  $this->mNoGallery = $parserOutput->getNoGallery();
1606  $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
1607  $this->addModules( $parserOutput->getModules() );
1608  $this->addModuleScripts( $parserOutput->getModuleScripts() );
1609  $this->addModuleStyles( $parserOutput->getModuleStyles() );
1610  $this->addModuleMessages( $parserOutput->getModuleMessages() );
1611  $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
1612  $this->mPreventClickjacking = $this->mPreventClickjacking
1613  || $parserOutput->preventClickjacking();
1614 
1615  // Template versioning...
1616  foreach ( (array)$parserOutput->getTemplateIds() as $ns => $dbks ) {
1617  if ( isset( $this->mTemplateIds[$ns] ) ) {
1618  $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1619  } else {
1620  $this->mTemplateIds[$ns] = $dbks;
1621  }
1622  }
1623  // File versioning...
1624  foreach ( (array)$parserOutput->getFileSearchOptions() as $dbk => $data ) {
1625  $this->mImageTimeKeys[$dbk] = $data;
1626  }
1627 
1628  // Hooks registered in the object
1629  global $wgParserOutputHooks;
1630  foreach ( $parserOutput->getOutputHooks() as $hookInfo ) {
1631  list( $hookName, $data ) = $hookInfo;
1632  if ( isset( $wgParserOutputHooks[$hookName] ) ) {
1633  call_user_func( $wgParserOutputHooks[$hookName], $this, $parserOutput, $data );
1634  }
1635  }
1636 
1637  // Link flags are ignored for now, but may in the future be
1638  // used to mark individual language links.
1639  $linkFlags = array();
1640  wfRunHooks( 'LanguageLinks', array( $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ) );
1641  wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) );
1642  }
1643 
1649  function addParserOutput( &$parserOutput ) {
1650  $this->addParserOutputNoText( $parserOutput );
1651  $parserOutput->setTOCEnabled( $this->mEnableTOC );
1652 
1653  // Touch section edit links only if not previously disabled
1654  if ( $parserOutput->getEditSectionTokens() ) {
1655  $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks );
1656  }
1657  $text = $parserOutput->getText();
1658  wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
1659  $this->addHTML( $text );
1660  }
1661 
1667  public function addTemplate( &$template ) {
1668  $this->addHTML( $template->getHTML() );
1669  }
1670 
1683  public function parse( $text, $linestart = true, $interface = false, $language = null ) {
1684  global $wgParser;
1685 
1686  if ( is_null( $this->getTitle() ) ) {
1687  throw new MWException( 'Empty $mTitle in ' . __METHOD__ );
1688  }
1689 
1690  $popts = $this->parserOptions();
1691  if ( $interface ) {
1692  $popts->setInterfaceMessage( true );
1693  }
1694  if ( $language !== null ) {
1695  $oldLang = $popts->setTargetLanguage( $language );
1696  }
1697 
1698  $parserOutput = $wgParser->parse(
1699  $text, $this->getTitle(), $popts,
1700  $linestart, true, $this->mRevisionId
1701  );
1702 
1703  if ( $interface ) {
1704  $popts->setInterfaceMessage( false );
1705  }
1706  if ( $language !== null ) {
1707  $popts->setTargetLanguage( $oldLang );
1708  }
1709 
1710  return $parserOutput->getText();
1711  }
1712 
1723  public function parseInline( $text, $linestart = true, $interface = false ) {
1724  $parsed = $this->parse( $text, $linestart, $interface );
1725 
1726  $m = array();
1727  if ( preg_match( '/^<p>(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) {
1728  $parsed = $m[1];
1729  }
1730 
1731  return $parsed;
1732  }
1733 
1739  public function setSquidMaxage( $maxage ) {
1740  $this->mSquidMaxage = min( $maxage, $this->mCdnMaxageLimit );
1741  }
1742 
1748  public function lowerCdnMaxage( $maxage ) {
1749  $this->mCdnMaxageLimit = min( $maxage, $this->mCdnMaxageLimit );
1750  $this->setSquidMaxage( $this->mSquidMaxage );
1751  }
1752 
1760  public function enableClientCache( $state ) {
1761  return wfSetVar( $this->mEnableClientCache, $state );
1762  }
1763 
1769  function getCacheVaryCookies() {
1770  global $wgCookiePrefix, $wgCacheVaryCookies;
1771  static $cookies;
1772  if ( $cookies === null ) {
1773  $cookies = array_merge(
1774  array(
1775  "{$wgCookiePrefix}Token",
1776  "{$wgCookiePrefix}LoggedOut",
1777  "forceHTTPS",
1778  session_name()
1779  ),
1780  $wgCacheVaryCookies
1781  );
1782  wfRunHooks( 'GetCacheVaryCookies', array( $this, &$cookies ) );
1783  }
1784  return $cookies;
1785  }
1793  function haveCacheVaryCookies() {
1794  $cookieHeader = $this->getRequest()->getHeader( 'cookie' );
1795  if ( $cookieHeader === false ) {
1796  return false;
1797  }
1798  $cvCookies = $this->getCacheVaryCookies();
1799  foreach ( $cvCookies as $cookieName ) {
1800  # Check for a simple string match, like the way squid does it
1801  if ( strpos( $cookieHeader, $cookieName ) !== false ) {
1802  wfDebug( __METHOD__ . ": found $cookieName\n" );
1803  return true;
1804  }
1805  }
1806  wfDebug( __METHOD__ . ": no cache-varying cookies found\n" );
1807  return false;
1808  }
1809 
1818  public function addVaryHeader( $header, $option = null ) {
1819  if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
1820  $this->mVaryHeader[$header] = (array)$option;
1821  } elseif ( is_array( $option ) ) {
1822  if ( is_array( $this->mVaryHeader[$header] ) ) {
1823  $this->mVaryHeader[$header] = array_merge( $this->mVaryHeader[$header], $option );
1824  } else {
1825  $this->mVaryHeader[$header] = $option;
1826  }
1827  }
1828  $this->mVaryHeader[$header] = array_unique( (array)$this->mVaryHeader[$header] );
1829  }
1837  public function getVaryHeader() {
1838  return 'Vary: ' . join( ', ', array_keys( $this->mVaryHeader ) );
1839  }
1840 
1846  public function getXVO() {
1847  $cvCookies = $this->getCacheVaryCookies();
1848 
1849  $cookiesOption = array();
1850  foreach ( $cvCookies as $cookieName ) {
1851  $cookiesOption[] = 'string-contains=' . $cookieName;
1852  }
1853  $this->addVaryHeader( 'Cookie', $cookiesOption );
1854 
1855  $headers = array();
1856  foreach ( $this->mVaryHeader as $header => $option ) {
1857  $newheader = $header;
1858  if ( is_array( $option ) && count( $option ) > 0 ) {
1859  $newheader .= ';' . implode( ';', $option );
1860  }
1861  $headers[] = $newheader;
1862  }
1863  $xvo = 'X-Vary-Options: ' . implode( ',', $headers );
1864 
1865  return $xvo;
1866  }
1867 
1876  function addAcceptLanguage() {
1877  $lang = $this->getTitle()->getPageLanguage();
1878  if ( !$this->getRequest()->getCheck( 'variant' ) && $lang->hasVariants() ) {
1879  $variants = $lang->getVariants();
1880  $aloption = array();
1881  foreach ( $variants as $variant ) {
1882  if ( $variant === $lang->getCode() ) {
1883  continue;
1884  } else {
1885  $aloption[] = 'string-contains=' . $variant;
1886 
1887  // IE and some other browsers use BCP 47 standards in
1888  // their Accept-Language header, like "zh-CN" or "zh-Hant".
1889  // We should handle these too.
1890  $variantBCP47 = wfBCP47( $variant );
1891  if ( $variantBCP47 !== $variant ) {
1892  $aloption[] = 'string-contains=' . $variantBCP47;
1893  }
1894  }
1895  }
1896  $this->addVaryHeader( 'Accept-Language', $aloption );
1897  }
1898  }
1899 
1910  public function preventClickjacking( $enable = true ) {
1911  $this->mPreventClickjacking = $enable;
1912  }
1913 
1919  public function allowClickjacking() {
1920  $this->mPreventClickjacking = false;
1921  }
1929  public function getPreventClickjacking() {
1931  }
1932 
1940  public function getFrameOptions() {
1941  global $wgBreakFrames, $wgEditPageFrameOptions;
1942  if ( $wgBreakFrames ) {
1943  return 'DENY';
1944  } elseif ( $this->mPreventClickjacking && $wgEditPageFrameOptions ) {
1945  return $wgEditPageFrameOptions;
1946  }
1947  return false;
1948  }
1949 
1953  public function sendCacheControl() {
1954  global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgUseXVO;
1955 
1956  $response = $this->getRequest()->response();
1957  if ( $wgUseETag && $this->mETag ) {
1958  $response->header( "ETag: $this->mETag" );
1959  }
1960 
1961  $this->addVaryHeader( 'Cookie' );
1962  $this->addAcceptLanguage();
1963 
1964  # don't serve compressed data to clients who can't handle it
1965  # maintain different caches for logged-in users and non-logged in ones
1966  $response->header( $this->getVaryHeader() );
1967 
1968  if ( $wgUseXVO ) {
1969  # Add an X-Vary-Options header for Squid with Wikimedia patches
1970  $response->header( $this->getXVO() );
1971  }
1972 
1973  if ( $this->mEnableClientCache ) {
1974  if (
1975  $wgUseSquid && session_id() == '' && !$this->isPrintable() &&
1976  $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies()
1977  ) {
1978  if ( $wgUseESI ) {
1979  # We'll purge the proxy cache explicitly, but require end user agents
1980  # to revalidate against the proxy on each visit.
1981  # Surrogate-Control controls our Squid, Cache-Control downstream caches
1982  wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", 'log' );
1983  # start with a shorter timeout for initial testing
1984  # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
1985  $response->header( 'Surrogate-Control: max-age=' . $wgSquidMaxage . '+' . $this->mSquidMaxage . ', content="ESI/1.0"' );
1986  $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
1987  } else {
1988  # We'll purge the proxy cache for anons explicitly, but require end user agents
1989  # to revalidate against the proxy on each visit.
1990  # IMPORTANT! The Squid needs to replace the Cache-Control header with
1991  # Cache-Control: s-maxage=0, must-revalidate, max-age=0
1992  wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **\n", 'log' );
1993  # start with a shorter timeout for initial testing
1994  # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
1995  $response->header( 'Cache-Control: s-maxage=' . $this->mSquidMaxage . ', must-revalidate, max-age=0' );
1996  }
1997  } else {
1998  # We do want clients to cache if they can, but they *must* check for updates
1999  # on revisiting the page.
2000  wfDebug( __METHOD__ . ": private caching; {$this->mLastModified} **\n", 'log' );
2001  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2002  $response->header( "Cache-Control: private, must-revalidate, max-age=0" );
2003  }
2004  if ( $this->mLastModified ) {
2005  $response->header( "Last-Modified: {$this->mLastModified}" );
2006  }
2007  } else {
2008  wfDebug( __METHOD__ . ": no caching **\n", 'log' );
2009 
2010  # In general, the absence of a last modified header should be enough to prevent
2011  # the client from using its cache. We send a few other things just to make sure.
2012  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2013  $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2014  $response->header( 'Pragma: no-cache' );
2015  }
2016  }
2017 
2026  public static function getStatusMessage( $code ) {
2027  wfDeprecated( __METHOD__, '1.18' );
2028  return HttpStatus::getMessage( $code );
2029  }
2030 
2035  public function output() {
2036  global $wgLanguageCode, $wgDebugRedirects, $wgMimeType, $wgVaryOnXFP,
2037  $wgUseAjax, $wgResponsiveImages;
2038 
2039  if ( $this->mDoNothing ) {
2040  return;
2041  }
2042 
2043  wfProfileIn( __METHOD__ );
2044 
2045  $response = $this->getRequest()->response();
2046 
2047  if ( $this->mRedirect != '' ) {
2048  # Standards require redirect URLs to be absolute
2049  $this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT );
2050 
2051  $redirect = $this->mRedirect;
2052  $code = $this->mRedirectCode;
2053 
2054  if ( wfRunHooks( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) {
2055  if ( $code == '301' || $code == '303' ) {
2056  if ( !$wgDebugRedirects ) {
2057  $message = HttpStatus::getMessage( $code );
2058  $response->header( "HTTP/1.1 $code $message" );
2059  }
2060  $this->mLastModified = wfTimestamp( TS_RFC2822 );
2061  }
2062  if ( $wgVaryOnXFP ) {
2063  $this->addVaryHeader( 'X-Forwarded-Proto' );
2064  }
2065  $this->sendCacheControl();
2066 
2067  $response->header( "Content-Type: text/html; charset=utf-8" );
2068  if ( $wgDebugRedirects ) {
2069  $url = htmlspecialchars( $redirect );
2070  print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2071  print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2072  print "</body>\n</html>\n";
2073  } else {
2074  $response->header( 'Location: ' . $redirect );
2075  }
2076  }
2077 
2078  wfProfileOut( __METHOD__ );
2079  return;
2080  } elseif ( $this->mStatusCode ) {
2081  $message = HttpStatus::getMessage( $this->mStatusCode );
2082  if ( $message ) {
2083  $response->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message );
2084  }
2085  }
2086 
2087  # Buffer output; final headers may depend on later processing
2088  ob_start();
2089 
2090  $response->header( "Content-type: $wgMimeType; charset=UTF-8" );
2091  $response->header( 'Content-language: ' . $wgLanguageCode );
2092 
2093  // Prevent framing, if requested
2094  $frameOptions = $this->getFrameOptions();
2095  if ( $frameOptions ) {
2096  $response->header( "X-Frame-Options: $frameOptions" );
2097  }
2098 
2099  if ( $this->mArticleBodyOnly ) {
2100  echo $this->mBodytext;
2101  } else {
2102 
2103  $sk = $this->getSkin();
2104  // add skin specific modules
2105  $modules = $sk->getDefaultModules();
2106 
2107  // enforce various default modules for all skins
2108  $coreModules = array(
2109  // keep this list as small as possible
2110  'mediawiki.page.startup',
2111  'mediawiki.user',
2112  );
2113 
2114  // Support for high-density display images if enabled
2115  if ( $wgResponsiveImages ) {
2116  $coreModules[] = 'mediawiki.hidpi';
2117  }
2118 
2119  $this->addModules( $coreModules );
2120  foreach ( $modules as $group ) {
2121  $this->addModules( $group );
2122  }
2123  MWDebug::addModules( $this );
2124  if ( $wgUseAjax ) {
2125  // FIXME: deprecate? - not clear why this is useful
2126  wfRunHooks( 'AjaxAddScript', array( &$this ) );
2127  }
2128 
2129  // Hook that allows last minute changes to the output page, e.g.
2130  // adding of CSS or Javascript by extensions.
2131  wfRunHooks( 'BeforePageDisplay', array( &$this, &$sk ) );
2132 
2133  wfProfileIn( 'Output-skin' );
2134  $sk->outputPage();
2135  wfProfileOut( 'Output-skin' );
2136  }
2137 
2138  // This hook allows last minute changes to final overall output by modifying output buffer
2139  wfRunHooks( 'AfterFinalPageOutput', array( $this ) );
2140 
2141  $this->sendCacheControl();
2142 
2143  ob_end_flush();
2144 
2145  wfProfileOut( __METHOD__ );
2146  }
2154  public function out( $ins ) {
2155  wfDeprecated( __METHOD__, '1.22' );
2156  print $ins;
2157  }
2158 
2163  function blockedPage() {
2164  throw new UserBlockedError( $this->getUser()->mBlock );
2165  }
2166 
2177  public function prepareErrorPage( $pageTitle, $htmlTitle = false ) {
2178  $this->setPageTitle( $pageTitle );
2179  if ( $htmlTitle !== false ) {
2180  $this->setHTMLTitle( $htmlTitle );
2181  }
2182  $this->setRobotPolicy( 'noindex,nofollow' );
2183  $this->setArticleRelated( false );
2184  $this->enableClientCache( false );
2185  $this->mRedirect = '';
2186  $this->clearSubtitle();
2187  $this->clearHTML();
2188  }
2189 
2202  public function showErrorPage( $title, $msg, $params = array() ) {
2203  if ( !$title instanceof Message ) {
2204  $title = $this->msg( $title );
2205  }
2206 
2207  $this->prepareErrorPage( $title );
2208 
2209  if ( $msg instanceof Message ) {
2210  if ( $params !== array() ) {
2211  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 );
2212  }
2213  $this->addHTML( $msg->parseAsBlock() );
2214  } else {
2215  $this->addWikiMsgArray( $msg, $params );
2216  }
2217 
2218  $this->returnToMain();
2219  }
2227  public function showPermissionsErrorPage( $errors, $action = null ) {
2228  // For some action (read, edit, create and upload), display a "login to do this action"
2229  // error if all of the following conditions are met:
2230  // 1. the user is not logged in
2231  // 2. the only error is insufficient permissions (i.e. no block or something else)
2232  // 3. the error can be avoided simply by logging in
2233  if ( in_array( $action, array( 'read', 'edit', 'createpage', 'createtalk', 'upload' ) )
2234  && $this->getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2235  && ( $errors[0][0] == 'badaccess-groups' || $errors[0][0] == 'badaccess-group0' )
2236  && ( User::groupHasPermission( 'user', $action )
2237  || User::groupHasPermission( 'autoconfirmed', $action ) )
2238  ) {
2239  $displayReturnto = null;
2240 
2241  # Due to bug 32276, if a user does not have read permissions,
2242  # $this->getTitle() will just give Special:Badtitle, which is
2243  # not especially useful as a returnto parameter. Use the title
2244  # from the request instead, if there was one.
2245  $request = $this->getRequest();
2246  $returnto = Title::newFromURL( $request->getVal( 'title', '' ) );
2247  if ( $action == 'edit' ) {
2248  $msg = 'whitelistedittext';
2249  $displayReturnto = $returnto;
2250  } elseif ( $action == 'createpage' || $action == 'createtalk' ) {
2251  $msg = 'nocreatetext';
2252  } elseif ( $action == 'upload' ) {
2253  $msg = 'uploadnologintext';
2254  } else { # Read
2255  $msg = 'loginreqpagetext';
2256  $displayReturnto = Title::newMainPage();
2257  }
2258 
2259  $query = array();
2260 
2261  if ( $returnto ) {
2262  $query['returnto'] = $returnto->getPrefixedText();
2263 
2264  if ( !$request->wasPosted() ) {
2265  $returntoquery = $request->getValues();
2266  unset( $returntoquery['title'] );
2267  unset( $returntoquery['returnto'] );
2268  unset( $returntoquery['returntoquery'] );
2269  $query['returntoquery'] = wfArrayToCgi( $returntoquery );
2270  }
2271  }
2272  $loginLink = Linker::linkKnown(
2273  SpecialPage::getTitleFor( 'Userlogin' ),
2274  $this->msg( 'loginreqlink' )->escaped(),
2275  array(),
2276  $query
2277  );
2278 
2279  $this->prepareErrorPage( $this->msg( 'loginreqtitle' ) );
2280  $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->parse() );
2281 
2282  # Don't return to a page the user can't read otherwise
2283  # we'll end up in a pointless loop
2284  if ( $displayReturnto && $displayReturnto->userCan( 'read', $this->getUser() ) ) {
2285  $this->returnToMain( null, $displayReturnto );
2286  }
2287  } else {
2288  $this->prepareErrorPage( $this->msg( 'permissionserrors' ) );
2289  $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
2290  }
2291  }
2299  public function versionRequired( $version ) {
2300  $this->prepareErrorPage( $this->msg( 'versionrequired', $version ) );
2301 
2302  $this->addWikiMsg( 'versionrequiredtext', $version );
2303  $this->returnToMain();
2304  }
2312  public function permissionRequired( $permission ) {
2313  throw new PermissionsError( $permission );
2314  }
2315 
2321  public function loginToUse() {
2322  throw new PermissionsError( 'read' );
2323  }
2324 
2332  public function formatPermissionsErrorMessage( $errors, $action = null ) {
2333  if ( $action == null ) {
2334  $text = $this->msg( 'permissionserrorstext', count( $errors ) )->plain() . "\n\n";
2335  } else {
2336  $action_desc = $this->msg( "action-$action" )->plain();
2337  $text = $this->msg(
2338  'permissionserrorstext-withaction',
2339  count( $errors ),
2340  $action_desc
2341  )->plain() . "\n\n";
2342  }
2343 
2344  if ( count( $errors ) > 1 ) {
2345  $text .= '<ul class="permissions-errors">' . "\n";
2346 
2347  foreach ( $errors as $error ) {
2348  $text .= '<li>';
2349  $text .= call_user_func_array( array( $this, 'msg' ), $error )->plain();
2350  $text .= "</li>\n";
2351  }
2352  $text .= '</ul>';
2353  } else {
2354  $text .= "<div class=\"permissions-errors\">\n" .
2355  call_user_func_array( array( $this, 'msg' ), reset( $errors ) )->plain() .
2356  "\n</div>";
2357  }
2358 
2359  return $text;
2360  }
2361 
2383  public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
2384  $this->setRobotPolicy( 'noindex,nofollow' );
2385  $this->setArticleRelated( false );
2386 
2387  // If no reason is given, just supply a default "I can't let you do
2388  // that, Dave" message. Should only occur if called by legacy code.
2389  if ( $protected && empty( $reasons ) ) {
2390  $reasons[] = array( 'badaccess-group0' );
2391  }
2392 
2393  if ( !empty( $reasons ) ) {
2394  // Permissions error
2395  if ( $source ) {
2396  $this->setPageTitle( $this->msg( 'viewsource-title', $this->getTitle()->getPrefixedText() ) );
2397  $this->addBacklinkSubtitle( $this->getTitle() );
2398  } else {
2399  $this->setPageTitle( $this->msg( 'badaccess' ) );
2400  }
2401  $this->addWikiText( $this->formatPermissionsErrorMessage( $reasons, $action ) );
2402  } else {
2403  // Wiki is read only
2404  throw new ReadOnlyError;
2405  }
2406 
2407  // Show source, if supplied
2408  if ( is_string( $source ) ) {
2409  $this->addWikiMsg( 'viewsourcetext' );
2410 
2411  $pageLang = $this->getTitle()->getPageLanguage();
2412  $params = array(
2413  'id' => 'wpTextbox1',
2414  'name' => 'wpTextbox1',
2415  'cols' => $this->getUser()->getOption( 'cols' ),
2416  'rows' => $this->getUser()->getOption( 'rows' ),
2417  'readonly' => 'readonly',
2418  'lang' => $pageLang->getHtmlCode(),
2419  'dir' => $pageLang->getDir(),
2420  );
2421  $this->addHTML( Html::element( 'textarea', $params, $source ) );
2422 
2423  // Show templates used by this article
2424  $templates = Linker::formatTemplates( $this->getTitle()->getTemplateLinksFrom() );
2425  $this->addHTML( "<div class='templatesUsed'>
2426 $templates
2427 </div>
2428 " );
2429  }
2430 
2431  # If the title doesn't exist, it's fairly pointless to print a return
2432  # link to it. After all, you just tried editing it and couldn't, so
2433  # what's there to do there?
2434  if ( $this->getTitle()->exists() ) {
2435  $this->returnToMain( null, $this->getTitle() );
2436  }
2437  }
2438 
2443  public function rateLimited() {
2444  throw new ThrottledError;
2445  }
2446 
2456  public function showLagWarning( $lag ) {
2457  global $wgSlaveLagWarning, $wgSlaveLagCritical;
2458  if ( $lag >= $wgSlaveLagWarning ) {
2459  $message = $lag < $wgSlaveLagCritical
2460  ? 'lag-warn-normal'
2461  : 'lag-warn-high';
2462  $wrap = Html::rawElement( 'div', array( 'class' => "mw-{$message}" ), "\n$1\n" );
2463  $this->wrapWikiMsg( "$wrap\n", array( $message, $this->getLanguage()->formatNum( $lag ) ) );
2464  }
2465  }
2467  public function showFatalError( $message ) {
2468  $this->prepareErrorPage( $this->msg( 'internalerror' ) );
2469 
2470  $this->addHTML( $message );
2471  }
2472 
2473  public function showUnexpectedValueError( $name, $val ) {
2474  $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() );
2475  }
2476 
2477  public function showFileCopyError( $old, $new ) {
2478  $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() );
2479  }
2480 
2481  public function showFileRenameError( $old, $new ) {
2482  $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() );
2483  }
2484 
2485  public function showFileDeleteError( $name ) {
2486  $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() );
2487  }
2488 
2489  public function showFileNotFoundError( $name ) {
2490  $this->showFatalError( $this->msg( 'filenotfound', $name )->text() );
2491  }
2492 
2501  public function addReturnTo( $title, $query = array(), $text = null, $options = array() ) {
2502  $link = $this->msg( 'returnto' )->rawParams(
2503  Linker::link( $title, $text, array(), $query, $options ) )->escaped();
2504  $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
2505  }
2506 
2515  public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
2516  if ( $returnto == null ) {
2517  $returnto = $this->getRequest()->getText( 'returnto' );
2518  }
2519 
2520  if ( $returntoquery == null ) {
2521  $returntoquery = $this->getRequest()->getText( 'returntoquery' );
2522  }
2523 
2524  if ( $returnto === '' ) {
2525  $returnto = Title::newMainPage();
2526  }
2527 
2528  if ( is_object( $returnto ) ) {
2529  $titleObj = $returnto;
2530  } else {
2531  $titleObj = Title::newFromText( $returnto );
2532  }
2533  if ( !is_object( $titleObj ) ) {
2534  $titleObj = Title::newMainPage();
2535  }
2536 
2537  $this->addReturnTo( $titleObj, wfCgiToArray( $returntoquery ) );
2538  }
2539 
2545  public function headElement( Skin $sk, $includeStyle = true ) {
2546  global $wgContLang, $wgMimeType;
2547 
2548  $userdir = $this->getLanguage()->getDir();
2549  $sitedir = $wgContLang->getDir();
2550 
2552 
2553  if ( $this->getHTMLTitle() == '' ) {
2554  $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() )->inContentLanguage() );
2555  }
2556 
2557  $openHead = Html::openElement( 'head' );
2558  if ( $openHead ) {
2559  # Don't bother with the newline if $head == ''
2560  $ret .= "$openHead\n";
2561  }
2562 
2563  if ( !Html::isXmlMimeType( $wgMimeType ) ) {
2564  // Add <meta charset="UTF-8">
2565  // This should be before <title> since it defines the charset used by
2566  // text including the text inside <title>.
2567  // The spec recommends defining XHTML5's charset using the XML declaration
2568  // instead of meta.
2569  // Our XML declaration is output by Html::htmlHeader.
2570  // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
2571  // http://www.whatwg.org/html/semantics.html#charset
2572  $ret .= Html::element( 'meta', array( 'charset' => 'UTF-8' ) ) . "\n";
2573  }
2574 
2575  $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
2576 
2577  // Avoid Internet Explorer "compatibility view", so that
2578  // jQuery can work correctly.
2579  $ret .= Html::element( 'meta', array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EDGE' ) ) . "\n";
2580 
2581  $ret .= (
2582  $this->getHeadLinks() .
2583  "\n" .
2584  $this->buildCssLinks() .
2585  // No newline after buildCssLinks since makeResourceLoaderLink did that already
2586  $this->getHeadScripts() .
2587  "\n" .
2588  $this->getHeadItems()
2589  );
2590 
2591  $closeHead = Html::closeElement( 'head' );
2592  if ( $closeHead ) {
2593  $ret .= "$closeHead\n";
2594  }
2595 
2596  $bodyClasses = array();
2597  $bodyClasses[] = 'mediawiki';
2598 
2599  # Classes for LTR/RTL directionality support
2600  $bodyClasses[] = $userdir;
2601  $bodyClasses[] = "sitedir-$sitedir";
2602 
2603  if ( $this->getLanguage()->capitalizeAllNouns() ) {
2604  # A <body> class is probably not the best way to do this . . .
2605  $bodyClasses[] = 'capitalize-all-nouns';
2606  }
2607 
2608  $bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
2609  $bodyClasses[] = 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
2610  $bodyClasses[] = 'action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
2611 
2612  $bodyAttrs = array();
2613  // While the implode() is not strictly needed, it's used for backwards compatibility
2614  // (this used to be built as a string and hooks likely still expect that).
2615  $bodyAttrs['class'] = implode( ' ', $bodyClasses );
2616 
2617  // Allow skins and extensions to add body attributes they need
2618  $sk->addToBodyAttributes( $this, $bodyAttrs );
2619  wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) );
2620 
2621  $ret .= Html::openElement( 'body', $bodyAttrs ) . "\n";
2622 
2623  return $ret;
2624  }
2625 
2631  public function getResourceLoader() {
2632  if ( is_null( $this->mResourceLoader ) ) {
2633  $this->mResourceLoader = new ResourceLoader();
2634  }
2635  return $this->mResourceLoader;
2636  }
2637 
2647  public function makeResourceLoaderLink( $modules, $only, $useESI = false, array $extraQuery = array(), $loadCall = false ) {
2648  global $wgResourceLoaderUseESI;
2649 
2650  $modules = (array)$modules;
2651 
2652  $links = array(
2653  'html' => '',
2654  'states' => array(),
2655  );
2656 
2657  if ( !count( $modules ) ) {
2658  return $links;
2659  }
2660 
2661 
2662  if ( count( $modules ) > 1 ) {
2663  // Remove duplicate module requests
2664  $modules = array_unique( $modules );
2665  // Sort module names so requests are more uniform
2666  sort( $modules );
2667 
2668  if ( ResourceLoader::inDebugMode() ) {
2669  // Recursively call us for every item
2670  foreach ( $modules as $name ) {
2671  $link = $this->makeResourceLoaderLink( $name, $only, $useESI );
2672  $links['html'] .= $link['html'];
2673  $links['states'] += $link['states'];
2674  }
2675  return $links;
2676  }
2677  }
2678 
2679  if ( !is_null( $this->mTarget ) ) {
2680  $extraQuery['target'] = $this->mTarget;
2681  }
2682 
2683  // Create keyed-by-group list of module objects from modules list
2684  $groups = array();
2686  foreach ( $modules as $name ) {
2687  $module = $resourceLoader->getModule( $name );
2688  # Check that we're allowed to include this module on this page
2689  if ( !$module
2690  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS )
2692  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_STYLES )
2693  && $only == ResourceLoaderModule::TYPE_STYLES )
2694  || ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) )
2695  ) {
2696  continue;
2697  }
2698 
2699  $group = $module->getGroup();
2700  if ( !isset( $groups[$group] ) ) {
2701  $groups[$group] = array();
2702  }
2703  $groups[$group][$name] = $module;
2704  }
2705 
2706  foreach ( $groups as $group => $grpModules ) {
2707  // Special handling for user-specific groups
2708  $user = null;
2709  if ( ( $group === 'user' || $group === 'private' ) && $this->getUser()->isLoggedIn() ) {
2710  $user = $this->getUser()->getName();
2711  }
2712 
2713  // Create a fake request based on the one we are about to make so modules return
2714  // correct timestamp and emptiness data
2716  array(), // modules; not determined yet
2717  $this->getLanguage()->getCode(),
2718  $this->getSkin()->getSkinName(),
2719  $user,
2720  null, // version; not determined yet
2722  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2723  $this->isPrintable(),
2724  $this->getRequest()->getBool( 'handheld' ),
2725  $extraQuery
2726  );
2728 
2729  // Extract modules that know they're empty
2730  foreach ( $grpModules as $key => $module ) {
2731  // Inline empty modules: since they're empty, just mark them as 'ready' (bug 46857)
2732  // If we're only getting the styles, we don't need to do anything for empty modules.
2733  if ( $module->isKnownEmpty( $context ) ) {
2734  unset( $grpModules[$key] );
2735  if ( $only !== ResourceLoaderModule::TYPE_STYLES ) {
2736  $links['states'][$key] = 'ready';
2737  }
2738  }
2739  }
2740 
2741  // If there are no non-empty modules, skip this group
2742  if ( count( $grpModules ) === 0 ) {
2743  continue;
2744  }
2745 
2746  // Inline private modules. These can't be loaded through load.php for security
2747  // reasons, see bug 34907. Note that these modules should be loaded from
2748  // getHeadScripts() before the first loader call. Otherwise other modules can't
2749  // properly use them as dependencies (bug 30914)
2750  if ( $group === 'private' ) {
2751  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2752  $links['html'] .= Html::inlineStyle(
2753  $resourceLoader->makeModuleResponse( $context, $grpModules )
2754  );
2755  } else {
2756  $links['html'] .= Html::inlineScript(
2758  $resourceLoader->makeModuleResponse( $context, $grpModules )
2759  )
2760  );
2761  }
2762  $links['html'] .= "\n";
2763  continue;
2764  }
2765 
2766  // Special handling for the user group; because users might change their stuff
2767  // on-wiki like user pages, or user preferences; we need to find the highest
2768  // timestamp of these user-changeable modules so we can ensure cache misses on change
2769  // This should NOT be done for the site group (bug 27564) because anons get that too
2770  // and we shouldn't be putting timestamps in Squid-cached HTML
2771  $version = null;
2772  if ( $group === 'user' ) {
2773  // Get the maximum timestamp
2774  $timestamp = 1;
2775  foreach ( $grpModules as $module ) {
2776  $timestamp = max( $timestamp, $module->getModifiedTime( $context ) );
2777  }
2778  // Add a version parameter so cache will break when things change
2780  }
2781 
2783  array_keys( $grpModules ),
2784  $this->getLanguage()->getCode(),
2785  $this->getSkin()->getSkinName(),
2786  $user,
2787  $version,
2789  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2790  $this->isPrintable(),
2791  $this->getRequest()->getBool( 'handheld' ),
2792  $extraQuery
2793  );
2794  if ( $useESI && $wgResourceLoaderUseESI ) {
2795  $esi = Xml::element( 'esi:include', array( 'src' => $url ) );
2796  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2797  $link = Html::inlineStyle( $esi );
2798  } else {
2799  $link = Html::inlineScript( $esi );
2800  }
2801  } else {
2802  // Automatically select style/script elements
2803  if ( $only === ResourceLoaderModule::TYPE_STYLES ) {
2804  $link = Html::linkedStyle( $url );
2805  } elseif ( $loadCall ) {
2808  Xml::encodeJsCall( 'mw.loader.load', array( $url, 'text/javascript', true ) )
2809  )
2810  );
2811  } else {
2812  $link = Html::linkedScript( $url );
2813 
2814  // For modules requested directly in the html via <link> or <script>,
2815  // tell mw.loader they are being loading to prevent duplicate requests.
2816  foreach ( $grpModules as $key => $module ) {
2817  // Don't output state=loading for the startup module..
2818  if ( $key !== 'startup' ) {
2819  $links['states'][$key] = 'loading';
2820  }
2821  }
2822  }
2823  }
2824 
2825  if ( $group == 'noscript' ) {
2826  $links['html'] .= Html::rawElement( 'noscript', array(), $link ) . "\n";
2827  } else {
2828  $links['html'] .= $link . "\n";
2829  }
2830  }
2831 
2832  return $links;
2833  }
2834 
2840  protected static function getHtmlFromLoaderLinks( Array $links ) {
2841  $html = '';
2842  $states = array();
2843  foreach ( $links as $link ) {
2844  if ( !is_array( $link ) ) {
2845  $html .= $link;
2846  } else {
2847  $html .= $link['html'];
2848  $states += $link['states'];
2849  }
2850  }
2851 
2852  if ( count( $states ) ) {
2856  )
2857  ) . "\n" . $html;
2858  }
2859 
2860  return $html;
2861  }
2869  function getHeadScripts() {
2870  global $wgResourceLoaderExperimentalAsyncLoading;
2871 
2872  // Startup - this will immediately load jquery and mediawiki modules
2873  $links = array();
2874  $links[] = $this->makeResourceLoaderLink( 'startup', ResourceLoaderModule::TYPE_SCRIPTS, true );
2875 
2876  // Load config before anything else
2877  $links[] = Html::inlineScript(
2880  )
2881  );
2882 
2883  // Load embeddable private modules before any loader links
2884  // This needs to be TYPE_COMBINED so these modules are properly wrapped
2885  // in mw.loader.implement() calls and deferred until mw.user is available
2886  $embedScripts = array( 'user.options', 'user.tokens' );
2887  $links[] = $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
2888 
2889  // Scripts and messages "only" requests marked for top inclusion
2890  // Messages should go first
2891  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'top' ), ResourceLoaderModule::TYPE_MESSAGES );
2892  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'top' ), ResourceLoaderModule::TYPE_SCRIPTS );
2893 
2894  // Modules requests - let the client calculate dependencies and batch requests as it likes
2895  // Only load modules that have marked themselves for loading at the top
2896  $modules = $this->getModules( true, 'top' );
2897  if ( $modules ) {
2898  $links[] = Html::inlineScript(
2900  Xml::encodeJsCall( 'mw.loader.load', array( $modules ) )
2901  )
2902  );
2903  }
2904 
2905  if ( $wgResourceLoaderExperimentalAsyncLoading ) {
2906  $links[] = $this->getScriptsForBottomQueue( true );
2907  }
2908 
2909  return self::getHtmlFromLoaderLinks( $links );
2910  }
2911 
2921  function getScriptsForBottomQueue( $inHead ) {
2922  global $wgUseSiteJs, $wgAllowUserJs;
2923 
2924  // Scripts and messages "only" requests marked for bottom inclusion
2925  // If we're in the <head>, use load() calls rather than <script src="..."> tags
2926  // Messages should go first
2927  $links = array();
2928  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'bottom' ),
2929  ResourceLoaderModule::TYPE_MESSAGES, /* $useESI = */ false, /* $extraQuery = */ array(),
2930  /* $loadCall = */ $inHead
2931  );
2932  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'bottom' ),
2933  ResourceLoaderModule::TYPE_SCRIPTS, /* $useESI = */ false, /* $extraQuery = */ array(),
2934  /* $loadCall = */ $inHead
2935  );
2936 
2937  // Modules requests - let the client calculate dependencies and batch requests as it likes
2938  // Only load modules that have marked themselves for loading at the bottom
2939  $modules = $this->getModules( true, 'bottom' );
2940  if ( $modules ) {
2941  $links[] = Html::inlineScript(
2943  Xml::encodeJsCall( 'mw.loader.load', array( $modules, null, true ) )
2944  )
2945  );
2946  }
2947 
2948  // Legacy Scripts
2949  $links[] = "\n" . $this->mScripts;
2950 
2951  // Add site JS if enabled
2953  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2954  );
2955 
2956  // Add user JS if enabled
2957  if ( $wgAllowUserJs && $this->getUser()->isLoggedIn() && $this->getTitle() && $this->getTitle()->isJsSubpage() && $this->userCanPreview() ) {
2958  # XXX: additional security check/prompt?
2959  // We're on a preview of a JS subpage
2960  // Exclude this page from the user module in case it's in there (bug 26283)
2961  $links[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS, false,
2962  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() ), $inHead
2963  );
2964  // Load the previewed JS
2965  $links[] = Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
2966 
2967  // FIXME: If the user is previewing, say, ./vector.js, his ./common.js will be loaded
2968  // asynchronously and may arrive *after* the inline script here. So the previewed code
2969  // may execute before ./common.js runs. Normally, ./common.js runs before ./vector.js...
2970  } else {
2971  // Include the user module normally, i.e., raw to avoid it being wrapped in a closure.
2973  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2974  );
2975  }
2976 
2977  // Group JS is only enabled if site JS is enabled.
2978  $links[] = $this->makeResourceLoaderLink( 'user.groups', ResourceLoaderModule::TYPE_COMBINED,
2979  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2980  );
2981 
2983  }
2984 
2989  function getBottomScripts() {
2990  global $wgResourceLoaderExperimentalAsyncLoading;
2991 
2992  // Optimise jQuery ready event cross-browser.
2993  // This also enforces $.isReady to be true at </body> which fixes the
2994  // mw.loader bug in Firefox with using document.write between </body>
2995  // and the DOMContentReady event (bug 47457).
2996  $html = Html::inlineScript( 'window.jQuery && jQuery.ready();' );
2997 
2998  if ( !$wgResourceLoaderExperimentalAsyncLoading ) {
2999  $html .= $this->getScriptsForBottomQueue( false );
3000  }
3001 
3002  return $html;
3003  }
3011  public function getJsConfigVars() {
3012  return $this->mJsConfigVars;
3013  }
3021  public function addJsConfigVars( $keys, $value = null ) {
3022  if ( is_array( $keys ) ) {
3023  foreach ( $keys as $key => $value ) {
3024  $this->mJsConfigVars[$key] = $value;
3025  }
3026  return;
3027  }
3028 
3029  $this->mJsConfigVars[$keys] = $value;
3030  }
3031 
3044  public function getJSVars() {
3046 
3047  $curRevisionId = 0;
3048  $articleId = 0;
3049  $canonicalSpecialPageName = false; # bug 21115
3050 
3051  $title = $this->getTitle();
3052  $ns = $title->getNamespace();
3053  $canonicalNamespace = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
3054 
3055  $sk = $this->getSkin();
3056  // Get the relevant title so that AJAX features can use the correct page name
3057  // when making API requests from certain special pages (bug 34972).
3058  $relevantTitle = $sk->getRelevantTitle();
3059  $relevantUser = $sk->getRelevantUser();
3060 
3061  if ( $ns == NS_SPECIAL ) {
3062  list( $canonicalSpecialPageName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
3063  } elseif ( $this->canUseWikiPage() ) {
3064  $wikiPage = $this->getWikiPage();
3065  $curRevisionId = $wikiPage->getLatest();
3066  $articleId = $wikiPage->getId();
3067  }
3068 
3069  $lang = $title->getPageLanguage();
3070 
3071  // Pre-process information
3072  $separatorTransTable = $lang->separatorTransformTable();
3073  $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
3074  $compactSeparatorTransTable = array(
3075  implode( "\t", array_keys( $separatorTransTable ) ),
3076  implode( "\t", $separatorTransTable ),
3077  );
3078  $digitTransTable = $lang->digitTransformTable();
3079  $digitTransTable = $digitTransTable ? $digitTransTable : array();
3080  $compactDigitTransTable = array(
3081  implode( "\t", array_keys( $digitTransTable ) ),
3082  implode( "\t", $digitTransTable ),
3083  );
3084 
3085  $user = $this->getUser();
3086 
3087  $vars = array(
3088  'wgCanonicalNamespace' => $canonicalNamespace,
3089  'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3090  'wgNamespaceNumber' => $title->getNamespace(),
3091  'wgPageName' => $title->getPrefixedDBkey(),
3092  'wgTitle' => $title->getText(),
3093  'wgCurRevisionId' => $curRevisionId,
3094  'wgRevisionId' => (int)$this->getRevisionId(),
3095  'wgArticleId' => $articleId,
3096  'wgIsArticle' => $this->isArticle(),
3097  'wgIsRedirect' => $title->isRedirect(),
3098  'wgAction' => Action::getActionName( $this->getContext() ),
3099  'wgUserName' => $user->isAnon() ? null : $user->getName(),
3100  'wgUserGroups' => $user->getEffectiveGroups(),
3101  'wgCategories' => $this->getCategories(),
3102  'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
3103  'wgPageContentLanguage' => $lang->getCode(),
3104  'wgPageContentModel' => $title->getContentModel(),
3105  'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3106  'wgDigitTransformTable' => $compactDigitTransTable,
3107  'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
3108  'wgMonthNames' => $lang->getMonthNamesArray(),
3109  'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
3110  'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3111  );
3112  if ( $user->isLoggedIn() ) {
3113  $vars['wgUserId'] = $user->getId();
3114  $vars['wgUserEditCount'] = $user->getEditCount();
3115  $userReg = wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
3116  $vars['wgUserRegistration'] = $userReg !== null ? ( $userReg * 1000 ) : null;
3117  // Get the revision ID of the oldest new message on the user's talk
3118  // page. This can be used for constructing new message alerts on
3119  // the client side.
3120  $vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
3121  }
3122  if ( $wgContLang->hasVariants() ) {
3123  $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
3124  }
3125  // Same test as SkinTemplate
3126  $vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user ) && ( $title->exists() || $title->quickUserCan( 'create', $user ) );
3127  foreach ( $title->getRestrictionTypes() as $type ) {
3128  $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
3129  }
3130  if ( $title->isMainPage() ) {
3131  $vars['wgIsMainPage'] = true;
3132  }
3133  if ( $this->mRedirectedFrom ) {
3134  $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3135  }
3136  if ( $relevantUser ) {
3137  $vars['wgRelevantUserName'] = $relevantUser->getName();
3138  }
3139 
3140  // Allow extensions to add their custom variables to the mw.config map.
3141  // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
3142  // page-dependant but site-wide (without state).
3143  // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
3144  wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars, $this ) );
3145 
3146  // Merge in variables from addJsConfigVars last
3147  return array_merge( $vars, $this->getJsConfigVars() );
3148  }
3149 
3159  public function userCanPreview() {
3160  if ( $this->getRequest()->getVal( 'action' ) != 'submit'
3161  || !$this->getRequest()->wasPosted()
3162  || !$this->getUser()->matchEditToken(
3163  $this->getRequest()->getVal( 'wpEditToken' ) )
3164  ) {
3165  return false;
3166  }
3167  if ( !$this->getTitle()->isJsSubpage() && !$this->getTitle()->isCssSubpage() ) {
3168  return false;
3169  }
3170  if ( !$this->getTitle()->isSubpageOf( $this->getUser()->getUserPage() ) ) {
3171  // Don't execute another user's CSS or JS on preview (T85855)
3172  return false;
3173  }
3175  return !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) );
3176  }
3177 
3181  public function getHeadLinksArray() {
3182  global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
3183  $wgSitename, $wgVersion,
3184  $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
3185  $wgDisableLangConversion, $wgCanonicalLanguageLinks,
3186  $wgRightsPage, $wgRightsUrl;
3187 
3188  $tags = array();
3189 
3190  $canonicalUrl = $this->mCanonicalUrl;
3191 
3192  $tags['meta-generator'] = Html::element( 'meta', array(
3193  'name' => 'generator',
3194  'content' => "MediaWiki $wgVersion",
3195  ) );
3196 
3197  $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
3198  if ( $p !== 'index,follow' ) {
3199  // http://www.robotstxt.org/wc/meta-user.html
3200  // Only show if it's different from the default robots policy
3201  $tags['meta-robots'] = Html::element( 'meta', array(
3202  'name' => 'robots',
3203  'content' => $p,
3204  ) );
3205  }
3206 
3207  foreach ( $this->mMetatags as $tag ) {
3208  if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) {
3209  $a = 'http-equiv';
3210  $tag[0] = substr( $tag[0], 5 );
3211  } else {
3212  $a = 'name';
3213  }
3214  $tagName = "meta-{$tag[0]}";
3215  if ( isset( $tags[$tagName] ) ) {
3216  $tagName .= $tag[1];
3217  }
3218  $tags[$tagName] = Html::element( 'meta',
3219  array(
3220  $a => $tag[0],
3221  'content' => $tag[1]
3222  )
3223  );
3224  }
3225 
3226  foreach ( $this->mLinktags as $tag ) {
3227  $tags[] = Html::element( 'link', $tag );
3228  }
3229 
3230  # Universal edit button
3231  if ( $wgUniversalEditButton && $this->isArticleRelated() ) {
3232  $user = $this->getUser();
3233  if ( $this->getTitle()->quickUserCan( 'edit', $user )
3234  && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create', $user ) ) ) {
3235  // Original UniversalEditButton
3236  $msg = $this->msg( 'edit' )->text();
3237  $tags['universal-edit-button'] = Html::element( 'link', array(
3238  'rel' => 'alternate',
3239  'type' => 'application/x-wiki',
3240  'title' => $msg,
3241  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3242  ) );
3243  // Alternate edit link
3244  $tags['alternative-edit'] = Html::element( 'link', array(
3245  'rel' => 'edit',
3246  'title' => $msg,
3247  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3248  ) );
3249  }
3250  }
3251 
3252  # Generally the order of the favicon and apple-touch-icon links
3253  # should not matter, but Konqueror (3.5.9 at least) incorrectly
3254  # uses whichever one appears later in the HTML source. Make sure
3255  # apple-touch-icon is specified first to avoid this.
3256  if ( $wgAppleTouchIcon !== false ) {
3257  $tags['apple-touch-icon'] = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
3258  }
3259 
3260  if ( $wgFavicon !== false ) {
3261  $tags['favicon'] = Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
3262  }
3263 
3264  # OpenSearch description link
3265  $tags['opensearch'] = Html::element( 'link', array(
3266  'rel' => 'search',
3267  'type' => 'application/opensearchdescription+xml',
3268  'href' => wfScript( 'opensearch_desc' ),
3269  'title' => $this->msg( 'opensearch-desc' )->inContentLanguage()->text(),
3270  ) );
3271 
3272  if ( $wgEnableAPI ) {
3273  # Real Simple Discovery link, provides auto-discovery information
3274  # for the MediaWiki API (and potentially additional custom API
3275  # support such as WordPress or Twitter-compatible APIs for a
3276  # blogging extension, etc)
3277  $tags['rsd'] = Html::element( 'link', array(
3278  'rel' => 'EditURI',
3279  'type' => 'application/rsd+xml',
3280  // Output a protocol-relative URL here if $wgServer is protocol-relative
3281  // Whether RSD accepts relative or protocol-relative URLs is completely undocumented, though
3282  'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ), PROTO_RELATIVE ),
3283  ) );
3284  }
3285 
3286  # Language variants
3287  if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
3288  $lang = $this->getTitle()->getPageLanguage();
3289  if ( $lang->hasVariants() ) {
3290 
3291  $urlvar = $lang->getURLVariant();
3292 
3293  if ( !$urlvar ) {
3294  $variants = $lang->getVariants();
3295  foreach ( $variants as $_v ) {
3296  $tags["variant-$_v"] = Html::element( 'link', array(
3297  'rel' => 'alternate',
3298  'hreflang' => wfBCP47( $_v ),
3299  'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
3300  );
3301  }
3302  } else {
3303  $canonicalUrl = $this->getTitle()->getLocalURL();
3304  }
3305  }
3306  }
3307 
3308  # Copyright
3309  $copyright = '';
3310  if ( $wgRightsPage ) {
3311  $copy = Title::newFromText( $wgRightsPage );
3312 
3313  if ( $copy ) {
3314  $copyright = $copy->getLocalURL();
3315  }
3316  }
3317 
3318  if ( !$copyright && $wgRightsUrl ) {
3319  $copyright = $wgRightsUrl;
3320  }
3321 
3322  if ( $copyright ) {
3323  $tags['copyright'] = Html::element( 'link', array(
3324  'rel' => 'copyright',
3325  'href' => $copyright )
3326  );
3327  }
3328 
3329  # Feeds
3330  if ( $wgFeed ) {
3331  foreach ( $this->getSyndicationLinks() as $format => $link ) {
3332  # Use the page name for the title. In principle, this could
3333  # lead to issues with having the same name for different feeds
3334  # corresponding to the same page, but we can't avoid that at
3335  # this low a level.
3336 
3337  $tags[] = $this->feedLink(
3338  $format,
3339  $link,
3340  # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
3341  $this->msg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() )->text()
3342  );
3343  }
3344 
3345  # Recent changes feed should appear on every page (except recentchanges,
3346  # that would be redundant). Put it after the per-page feed to avoid
3347  # changing existing behavior. It's still available, probably via a
3348  # menu in your browser. Some sites might have a different feed they'd
3349  # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3350  # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3351  # If so, use it instead.
3352  if ( $wgOverrideSiteFeed ) {
3353  foreach ( $wgOverrideSiteFeed as $type => $feedUrl ) {
3354  // Note, this->feedLink escapes the url.
3355  $tags[] = $this->feedLink(
3356  $type,
3357  $feedUrl,
3358  $this->msg( "site-{$type}-feed", $wgSitename )->text()
3359  );
3360  }
3361  } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
3362  $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
3363  foreach ( $wgAdvertisedFeedTypes as $format ) {
3364  $tags[] = $this->feedLink(
3365  $format,
3366  $rctitle->getLocalURL( array( 'feed' => $format ) ),
3367  $this->msg( "site-{$format}-feed", $wgSitename )->text() # For grep: 'site-rss-feed', 'site-atom-feed'.
3368  );
3369  }
3370  }
3371  }
3372 
3373  # Canonical URL
3374  global $wgEnableCanonicalServerLink;
3375  if ( $wgEnableCanonicalServerLink ) {
3376  if ( $canonicalUrl !== false ) {
3377  $canonicalUrl = wfExpandUrl( $canonicalUrl, PROTO_CANONICAL );
3378  } else {
3379  $reqUrl = $this->getRequest()->getRequestURL();
3380  $canonicalUrl = wfExpandUrl( $reqUrl, PROTO_CANONICAL );
3381  }
3382  }
3383  if ( $canonicalUrl !== false ) {
3384  $tags[] = Html::element( 'link', array(
3385  'rel' => 'canonical',
3386  'href' => $canonicalUrl
3387  ) );
3388  }
3390  return $tags;
3391  }
3392 
3396  public function getHeadLinks() {
3397  return implode( "\n", $this->getHeadLinksArray() );
3398  }
3399 
3408  private function feedLink( $type, $url, $text ) {
3409  return Html::element( 'link', array(
3410  'rel' => 'alternate',
3411  'type' => "application/$type+xml",
3412  'title' => $text,
3413  'href' => $url )
3414  );
3415  }
3416 
3426  public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
3427  $options = array();
3428  // Even though we expect the media type to be lowercase, but here we
3429  // force it to lowercase to be safe.
3430  if ( $media ) {
3431  $options['media'] = $media;
3432  }
3433  if ( $condition ) {
3434  $options['condition'] = $condition;
3435  }
3436  if ( $dir ) {
3437  $options['dir'] = $dir;
3438  }
3439  $this->styles[$style] = $options;
3440  }
3441 
3447  public function addInlineStyle( $style_css, $flip = 'noflip' ) {
3448  if ( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
3449  # If wanted, and the interface is right-to-left, flip the CSS
3450  $style_css = CSSJanus::transform( $style_css, true, false );
3451  }
3452  $this->mInlineStyles .= Html::inlineStyle( $style_css ) . "\n";
3453  }
3461  public function buildCssLinks() {
3462  global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs, $wgContLang;
3463 
3464  $this->getSkin()->setupSkinUserCss( $this );
3465 
3466  // Add ResourceLoader styles
3467  // Split the styles into these groups
3468  $styles = array( 'other' => array(), 'user' => array(), 'site' => array(), 'private' => array(), 'noscript' => array() );
3469  $links = array();
3470  $otherTags = ''; // Tags to append after the normal <link> tags
3472 
3473  $moduleStyles = $this->getModuleStyles();
3474 
3475  // Per-site custom styles
3476  $moduleStyles[] = 'site';
3477  $moduleStyles[] = 'noscript';
3478  $moduleStyles[] = 'user.groups';
3479 
3480  // Per-user custom styles
3481  if ( $wgAllowUserCss && $this->getTitle()->isCssSubpage() && $this->userCanPreview() ) {
3482  // We're on a preview of a CSS subpage
3483  // Exclude this page from the user module in case it's in there (bug 26283)
3484  $link = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_STYLES, false,
3485  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
3486  );
3487  $otherTags .= $link['html'];
3488 
3489  // Load the previewed CSS
3490  // If needed, Janus it first. This is user-supplied CSS, so it's
3491  // assumed to be right for the content language directionality.
3492  $previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
3493  if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
3494  $previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
3495  }
3496  $otherTags .= Html::inlineStyle( $previewedCSS ) . "\n";
3497  } else {
3498  // Load the user styles normally
3499  $moduleStyles[] = 'user';
3500  }
3501 
3502  // Per-user preference styles
3503  $moduleStyles[] = 'user.cssprefs';
3504 
3505  foreach ( $moduleStyles as $name ) {
3506  $module = $resourceLoader->getModule( $name );
3507  if ( !$module ) {
3508  continue;
3509  }
3510  $group = $module->getGroup();
3511  // Modules in groups different than the ones listed on top (see $styles assignment)
3512  // will be placed in the "other" group
3513  $styles[ isset( $styles[$group] ) ? $group : 'other' ][] = $name;
3514  }
3515 
3516  // We want site, private and user styles to override dynamically added styles from modules, but we want
3517  // dynamically added styles to override statically added styles from other modules. So the order
3518  // has to be other, dynamic, site, private, user
3519  // Add statically added styles for other modules
3520  $links[] = $this->makeResourceLoaderLink( $styles['other'], ResourceLoaderModule::TYPE_STYLES );
3521  // Add normal styles added through addStyle()/addInlineStyle() here
3522  $links[] = implode( "\n", $this->buildCssLinksArray() ) . $this->mInlineStyles;
3523  // Add marker tag to mark the place where the client-side loader should inject dynamic styles
3524  // We use a <meta> tag with a made-up name for this because that's valid HTML
3525  $links[] = Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) ) . "\n";
3526 
3527  // Add site, private and user styles
3528  // 'private' at present only contains user.options, so put that before 'user'
3529  // Any future private modules will likely have a similar user-specific character
3530  foreach ( array( 'site', 'noscript', 'private', 'user' ) as $group ) {
3531  $links[] = $this->makeResourceLoaderLink( $styles[$group],
3533  );
3534  }
3535 
3536  // Add stuff in $otherTags (previewed user CSS if applicable)
3537  return self::getHtmlFromLoaderLinks( $links ) . $otherTags;
3538  }
3539 
3543  public function buildCssLinksArray() {
3544  $links = array();
3545 
3546  // Add any extension CSS
3547  foreach ( $this->mExtStyles as $url ) {
3548  $this->addStyle( $url );
3549  }
3550  $this->mExtStyles = array();
3551 
3552  foreach ( $this->styles as $file => $options ) {
3553  $link = $this->styleLink( $file, $options );
3554  if ( $link ) {
3555  $links[$file] = $link;
3556  }
3557  }
3558  return $links;
3559  }
3560 
3568  protected function styleLink( $style, $options ) {
3569  if ( isset( $options['dir'] ) ) {
3570  if ( $this->getLanguage()->getDir() != $options['dir'] ) {
3571  return '';
3572  }
3573  }
3574 
3575  if ( isset( $options['media'] ) ) {
3576  $media = self::transformCssMedia( $options['media'] );
3577  if ( is_null( $media ) ) {
3578  return '';
3579  }
3580  } else {
3581  $media = 'all';
3582  }
3583 
3584  if ( substr( $style, 0, 1 ) == '/' ||
3585  substr( $style, 0, 5 ) == 'http:' ||
3586  substr( $style, 0, 6 ) == 'https:' ) {
3587  $url = $style;
3588  } else {
3589  global $wgStylePath, $wgStyleVersion;
3590  $url = $wgStylePath . '/' . $style . '?' . $wgStyleVersion;
3591  }
3592 
3593  $link = Html::linkedStyle( $url, $media );
3594 
3595  if ( isset( $options['condition'] ) ) {
3596  $condition = htmlspecialchars( $options['condition'] );
3597  $link = "<!--[if $condition]>$link<![endif]-->";
3598  }
3599  return $link;
3600  }
3601 
3609  public static function transformCssMedia( $media ) {
3610  global $wgRequest;
3611 
3612  // http://www.w3.org/TR/css3-mediaqueries/#syntax
3613  $screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
3614 
3615  // Switch in on-screen display for media testing
3616  $switches = array(
3617  'printable' => 'print',
3618  'handheld' => 'handheld',
3619  );
3620  foreach ( $switches as $switch => $targetMedia ) {
3621  if ( $wgRequest->getBool( $switch ) ) {
3622  if ( $media == $targetMedia ) {
3623  $media = '';
3624  } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3625  // This regex will not attempt to understand a comma-separated media_query_list
3626  //
3627  // Example supported values for $media: 'screen', 'only screen', 'screen and (min-width: 982px)' ),
3628  // Example NOT supported value for $media: '3d-glasses, screen, print and resolution > 90dpi'
3629  //
3630  // If it's a print request, we never want any kind of screen stylesheets
3631  // If it's a handheld request (currently the only other choice with a switch),
3632  // we don't want simple 'screen' but we might want screen queries that
3633  // have a max-width or something, so we'll pass all others on and let the
3634  // client do the query.
3635  if ( $targetMedia == 'print' || $media == 'screen' ) {
3636  return null;
3637  }
3638  }
3639  }
3640  }
3641 
3642  return $media;
3643  }
3651  public function addWikiMsg( /*...*/ ) {
3652  $args = func_get_args();
3653  $name = array_shift( $args );
3654  $this->addWikiMsgArray( $name, $args );
3655  }
3656 
3665  public function addWikiMsgArray( $name, $args ) {
3666  $this->addHTML( $this->msg( $name, $args )->parseAsBlock() );
3667  }
3668 
3692  public function wrapWikiMsg( $wrap /*, ...*/ ) {
3693  $msgSpecs = func_get_args();
3694  array_shift( $msgSpecs );
3695  $msgSpecs = array_values( $msgSpecs );
3696  $s = $wrap;
3697  foreach ( $msgSpecs as $n => $spec ) {
3698  if ( is_array( $spec ) ) {
3699  $args = $spec;
3700  $name = array_shift( $args );
3701  if ( isset( $args['options'] ) ) {
3702  unset( $args['options'] );
3703  wfDeprecated(
3704  'Adding "options" to ' . __METHOD__ . ' is no longer supported',
3705  '1.20'
3706  );
3707  }
3708  } else {
3709  $args = array();
3710  $name = $spec;
3711  }
3712  $s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
3713  }
3714  $this->addWikiText( $s );
3715  }
3716 
3726  public function includeJQuery( $modules = array() ) {
3727  return array();
3728  }
3729 
3735  public function enableTOC( $flag = true ) {
3736  $this->mEnableTOC = $flag;
3737  }
3738 
3743  public function isTOCEnabled() {
3744  return $this->mEnableTOC;
3745  }
3746 
3752  public function enableSectionEditLinks( $flag = true ) {
3753  $this->mEnableSectionEditLinks = $flag;
3754  }
3755 
3760  public function sectionEditLinksEnabled() {
3762  }
3763 }
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:1903
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:1753
OutputPage\styleLink
styleLink( $style, $options)
Generate <link> tags for stylesheets.
Definition: OutputPage.php:3561
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:3644
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:3977
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:1869
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:3037
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:804
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:2474
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:2914
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:2314
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:3745
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:1933
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3706
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:2156
OutputPage\getRevisionId
getRevisionId()
Get the displayed revision ID.
Definition: OutputPage.php:1435
$timestamp
if( $limit) $timestamp
Definition: importImages.php:104
OutputPage\addParserOutput
addParserOutput(&$parserOutput)
Add a ParserOutput object.
Definition: OutputPage.php:1642
OutputPage\addWikiTextTitleTidy
addWikiTextTitleTidy( $text, &$title, $linestart=true)
Add wikitext with a custom Title object and tidy enabled.
Definition: OutputPage.php:1537
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:2508
OutputPage\$mIsArticleRelated
$mIsArticleRelated
Should be private.
Definition: OutputPage.php:71
OutputPage\buildCssLinksArray
buildCssLinksArray()
Definition: OutputPage.php:3536
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:2982
OutputPage\$mCategoryLinks
$mCategoryLinks
Definition: OutputPage.php:108
OutputPage\showFileNotFoundError
showFileNotFoundError( $name)
Definition: OutputPage.php:2482
OutputPage\getHtmlFromLoaderLinks
static getHtmlFromLoaderLinks(Array $links)
Build html output from an array of links from makeResourceLoaderLink.
Definition: OutputPage.php:2833
$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 such as when responding to a resource loader request or generating HTML output & $resourceLoader
Definition: hooks.txt:1961
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:3389
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:2292
OutputPage\parseInline
parseInline( $text, $linestart=true, $interface=false)
Parse wikitext, strip paragraphs, and return the HTML.
Definition: OutputPage.php:1716
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:1143
OutputPage\getFileVersion
getFileVersion()
Get the displayed file version.
Definition: OutputPage.php:1479
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:4147
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:2154
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:573
OutputPage\permissionRequired
permissionRequired( $permission)
Display an error page noting that a given permission bit is required.
Definition: OutputPage.php:2305
Sanitizer\stripAllTags
static stripAllTags( $text)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed,...
Definition: Sanitizer.php:1735
OutputPage\showFileDeleteError
showFileDeleteError( $name)
Definition: OutputPage.php:2478
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:1547
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:1456
OutputPage\addWikiMsgArray
addWikiMsgArray( $name, $args)
Add a wikitext-formatted message to the output.
Definition: OutputPage.php:3658
OutputPage\enableTOC
enableTOC( $flag=true)
Enables/disables TOC, doesn't override NOTOC
Definition: OutputPage.php:3728
OutputPage\transformCssMedia
static transformCssMedia( $media)
Transform "media" attribute based on request parameters.
Definition: OutputPage.php:3602
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:1526
Html\closeElement
static closeElement( $element)
Returns "</$element>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
Definition: Html.php:235
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:849
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:2376
OutputPage\$mPageTitleActionText
$mPageTitleActionText
Definition: OutputPage.php:205
OutputPage\showErrorPage
showErrorPage( $title, $msg, $params=array())
Output a standard error page.
Definition: OutputPage.php:2195
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:166
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:3401
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:3419
OutputPage\sendCacheControl
sendCacheControl()
Send cache control HTTP headers.
Definition: OutputPage.php:1946
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:2147
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:3786
OutputPage\output
output()
Finally, all the text has been munged and accumulated into the object, let's actually output it:
Definition: OutputPage.php:2028
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:148
OutputPage\$mInlineStyles
$mInlineStyles
Inline CSS styles.
Definition: OutputPage.php:125
OutputPage\setFileVersion
setFileVersion( $file)
Set the displayed file version.
Definition: OutputPage.php:1466
OutputPage\showUnexpectedValueError
showUnexpectedValueError( $name, $val)
Definition: OutputPage.php:2466
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:2624
OutputPage\isTOCEnabled
isTOCEnabled()
Definition: OutputPage.php:3736
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:592
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:1425
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:4058
OutputPage\addVaryHeader
addVaryHeader( $header, $option=null)
Add an HTTP header that will influence on the cache.
Definition: OutputPage.php:1811
OutputPage\getStatusMessage
static getStatusMessage( $code)
Get the message associated with the HTTP response code $code.
Definition: OutputPage.php:2019
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:1511
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:1830
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:2449
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:1762
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:2325
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:2843
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:1588
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:1922
$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:3719
OutputPage\makeResourceLoaderLink
makeResourceLoaderLink( $modules, $only, $useESI=false, array $extraQuery=array(), $loadCall=false)
TODO: Document.
Definition: OutputPage.php:2640
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:1786
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:3753
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:2220
OutputPage\setRevisionTimestamp
setRevisionTimestamp( $timestamp)
Set the timestamp of the revision which will be displayed.
Definition: OutputPage.php:1446
$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:2436
$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:396
OutputPage\setSquidMaxage
setSquidMaxage( $maxage)
Set the value of the "s-maxage" part of the "Cache-control" HTTP header.
Definition: OutputPage.php:1732
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:271
$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:3685
OutputPage\buildCssLinks
buildCssLinks()
Build a set of "<link>" elements for the stylesheets specified in the $this->styles array.
Definition: OutputPage.php:3454
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:607
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:1936
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:2470
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:2494
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:3440
$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:3152
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:628
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:1562
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:2862
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:3174
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:1912
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:2460
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:1316
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:1676
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:3014
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:2578
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:124
$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:3004
OutputPage\$mContainsOldMagic
$mContainsOldMagic
Definition: OutputPage.php:170
OutputPage\getTemplateIds
getTemplateIds()
Get the templates used on this page.
Definition: OutputPage.php:1489
$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:1499
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:1839
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:2170
OutputPage\addTemplate
addTemplate(&$template)
Add the output of a QuickTemplate to the output buffer.
Definition: OutputPage.php:1660
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:1741
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:2538
$type
$type
Definition: testCompression.php:46
OutputPage\getCategories
getCategories()
Get the list of category names this page belongs to.
Definition: OutputPage.php:1271