MediaWiki  1.23.15
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  // If we vary on cookies, let's make sure it's always included here too.
1839  if ( $this->getCacheVaryCookies() ) {
1840  $this->addVaryHeader( 'Cookie' );
1841  }
1842 
1843  return 'Vary: ' . join( ', ', array_keys( $this->mVaryHeader ) );
1844  }
1845 
1851  public function getXVO() {
1852  $cvCookies = $this->getCacheVaryCookies();
1853 
1854  $cookiesOption = array();
1855  foreach ( $cvCookies as $cookieName ) {
1856  $cookiesOption[] = 'string-contains=' . $cookieName;
1857  }
1858  $this->addVaryHeader( 'Cookie', $cookiesOption );
1859 
1860  $headers = array();
1861  foreach ( $this->mVaryHeader as $header => $option ) {
1862  $newheader = $header;
1863  if ( is_array( $option ) && count( $option ) > 0 ) {
1864  $newheader .= ';' . implode( ';', $option );
1865  }
1866  $headers[] = $newheader;
1867  }
1868  $xvo = 'X-Vary-Options: ' . implode( ',', $headers );
1869 
1870  return $xvo;
1871  }
1872 
1881  function addAcceptLanguage() {
1882  $lang = $this->getTitle()->getPageLanguage();
1883  if ( !$this->getRequest()->getCheck( 'variant' ) && $lang->hasVariants() ) {
1884  $variants = $lang->getVariants();
1885  $aloption = array();
1886  foreach ( $variants as $variant ) {
1887  if ( $variant === $lang->getCode() ) {
1888  continue;
1889  } else {
1890  $aloption[] = 'string-contains=' . $variant;
1891 
1892  // IE and some other browsers use BCP 47 standards in
1893  // their Accept-Language header, like "zh-CN" or "zh-Hant".
1894  // We should handle these too.
1895  $variantBCP47 = wfBCP47( $variant );
1896  if ( $variantBCP47 !== $variant ) {
1897  $aloption[] = 'string-contains=' . $variantBCP47;
1898  }
1899  }
1900  }
1901  $this->addVaryHeader( 'Accept-Language', $aloption );
1902  }
1903  }
1904 
1915  public function preventClickjacking( $enable = true ) {
1916  $this->mPreventClickjacking = $enable;
1917  }
1918 
1924  public function allowClickjacking() {
1925  $this->mPreventClickjacking = false;
1926  }
1934  public function getPreventClickjacking() {
1936  }
1937 
1945  public function getFrameOptions() {
1946  global $wgBreakFrames, $wgEditPageFrameOptions;
1947  if ( $wgBreakFrames ) {
1948  return 'DENY';
1949  } elseif ( $this->mPreventClickjacking && $wgEditPageFrameOptions ) {
1950  return $wgEditPageFrameOptions;
1951  }
1952  return false;
1953  }
1954 
1958  public function sendCacheControl() {
1959  global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgUseXVO;
1960 
1961  $response = $this->getRequest()->response();
1962  if ( $wgUseETag && $this->mETag ) {
1963  $response->header( "ETag: $this->mETag" );
1964  }
1965 
1966  $this->addVaryHeader( 'Cookie' );
1967  $this->addAcceptLanguage();
1968 
1969  # don't serve compressed data to clients who can't handle it
1970  # maintain different caches for logged-in users and non-logged in ones
1971  $response->header( $this->getVaryHeader() );
1972 
1973  if ( $wgUseXVO ) {
1974  # Add an X-Vary-Options header for Squid with Wikimedia patches
1975  $response->header( $this->getXVO() );
1976  }
1977 
1978  if ( $this->mEnableClientCache ) {
1979  if (
1980  $wgUseSquid && session_id() == '' && !$this->isPrintable() &&
1981  $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies()
1982  ) {
1983  if ( $wgUseESI ) {
1984  # We'll purge the proxy cache explicitly, but require end user agents
1985  # to revalidate against the proxy on each visit.
1986  # Surrogate-Control controls our Squid, Cache-Control downstream caches
1987  wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", 'log' );
1988  # start with a shorter timeout for initial testing
1989  # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
1990  $response->header( 'Surrogate-Control: max-age=' . $wgSquidMaxage . '+' . $this->mSquidMaxage . ', content="ESI/1.0"' );
1991  $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
1992  } else {
1993  # We'll purge the proxy cache for anons explicitly, but require end user agents
1994  # to revalidate against the proxy on each visit.
1995  # IMPORTANT! The Squid needs to replace the Cache-Control header with
1996  # Cache-Control: s-maxage=0, must-revalidate, max-age=0
1997  wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **\n", 'log' );
1998  # start with a shorter timeout for initial testing
1999  # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
2000  $response->header( 'Cache-Control: s-maxage=' . $this->mSquidMaxage . ', must-revalidate, max-age=0' );
2001  }
2002  } else {
2003  # We do want clients to cache if they can, but they *must* check for updates
2004  # on revisiting the page.
2005  wfDebug( __METHOD__ . ": private caching; {$this->mLastModified} **\n", 'log' );
2006  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2007  $response->header( "Cache-Control: private, must-revalidate, max-age=0" );
2008  }
2009  if ( $this->mLastModified ) {
2010  $response->header( "Last-Modified: {$this->mLastModified}" );
2011  }
2012  } else {
2013  wfDebug( __METHOD__ . ": no caching **\n", 'log' );
2014 
2015  # In general, the absence of a last modified header should be enough to prevent
2016  # the client from using its cache. We send a few other things just to make sure.
2017  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2018  $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2019  $response->header( 'Pragma: no-cache' );
2020  }
2021  }
2022 
2031  public static function getStatusMessage( $code ) {
2032  wfDeprecated( __METHOD__, '1.18' );
2033  return HttpStatus::getMessage( $code );
2034  }
2035 
2040  public function output() {
2041  global $wgLanguageCode, $wgDebugRedirects, $wgMimeType, $wgVaryOnXFP,
2042  $wgUseAjax, $wgResponsiveImages;
2043 
2044  if ( $this->mDoNothing ) {
2045  return;
2046  }
2047 
2048  wfProfileIn( __METHOD__ );
2049 
2050  $response = $this->getRequest()->response();
2051 
2052  if ( $this->mRedirect != '' ) {
2053  # Standards require redirect URLs to be absolute
2054  $this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT );
2055 
2056  $redirect = $this->mRedirect;
2057  $code = $this->mRedirectCode;
2058 
2059  if ( wfRunHooks( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) {
2060  if ( $code == '301' || $code == '303' ) {
2061  if ( !$wgDebugRedirects ) {
2062  $message = HttpStatus::getMessage( $code );
2063  $response->header( "HTTP/1.1 $code $message" );
2064  }
2065  $this->mLastModified = wfTimestamp( TS_RFC2822 );
2066  }
2067  if ( $wgVaryOnXFP ) {
2068  $this->addVaryHeader( 'X-Forwarded-Proto' );
2069  }
2070  $this->sendCacheControl();
2071 
2072  $response->header( "Content-Type: text/html; charset=utf-8" );
2073  if ( $wgDebugRedirects ) {
2074  $url = htmlspecialchars( $redirect );
2075  print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2076  print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2077  print "</body>\n</html>\n";
2078  } else {
2079  $response->header( 'Location: ' . $redirect );
2080  }
2081  }
2082 
2083  wfProfileOut( __METHOD__ );
2084  return;
2085  } elseif ( $this->mStatusCode ) {
2086  $message = HttpStatus::getMessage( $this->mStatusCode );
2087  if ( $message ) {
2088  $response->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message );
2089  }
2090  }
2091 
2092  # Buffer output; final headers may depend on later processing
2093  ob_start();
2094 
2095  $response->header( "Content-type: $wgMimeType; charset=UTF-8" );
2096  $response->header( 'Content-language: ' . $wgLanguageCode );
2097 
2098  // Prevent framing, if requested
2099  $frameOptions = $this->getFrameOptions();
2100  if ( $frameOptions ) {
2101  $response->header( "X-Frame-Options: $frameOptions" );
2102  }
2103 
2104  if ( $this->mArticleBodyOnly ) {
2105  echo $this->mBodytext;
2106  } else {
2107 
2108  $sk = $this->getSkin();
2109  // add skin specific modules
2110  $modules = $sk->getDefaultModules();
2111 
2112  // enforce various default modules for all skins
2113  $coreModules = array(
2114  // keep this list as small as possible
2115  'mediawiki.page.startup',
2116  'mediawiki.user',
2117  );
2118 
2119  // Support for high-density display images if enabled
2120  if ( $wgResponsiveImages ) {
2121  $coreModules[] = 'mediawiki.hidpi';
2122  }
2123 
2124  $this->addModules( $coreModules );
2125  foreach ( $modules as $group ) {
2126  $this->addModules( $group );
2127  }
2128  MWDebug::addModules( $this );
2129  if ( $wgUseAjax ) {
2130  // FIXME: deprecate? - not clear why this is useful
2131  wfRunHooks( 'AjaxAddScript', array( &$this ) );
2132  }
2133 
2134  // Hook that allows last minute changes to the output page, e.g.
2135  // adding of CSS or Javascript by extensions.
2136  wfRunHooks( 'BeforePageDisplay', array( &$this, &$sk ) );
2137 
2138  wfProfileIn( 'Output-skin' );
2139  $sk->outputPage();
2140  wfProfileOut( 'Output-skin' );
2141  }
2142 
2143  // This hook allows last minute changes to final overall output by modifying output buffer
2144  wfRunHooks( 'AfterFinalPageOutput', array( $this ) );
2145 
2146  $this->sendCacheControl();
2147 
2148  ob_end_flush();
2149 
2150  wfProfileOut( __METHOD__ );
2151  }
2159  public function out( $ins ) {
2160  wfDeprecated( __METHOD__, '1.22' );
2161  print $ins;
2162  }
2163 
2168  function blockedPage() {
2169  throw new UserBlockedError( $this->getUser()->mBlock );
2170  }
2171 
2182  public function prepareErrorPage( $pageTitle, $htmlTitle = false ) {
2183  $this->setPageTitle( $pageTitle );
2184  if ( $htmlTitle !== false ) {
2185  $this->setHTMLTitle( $htmlTitle );
2186  }
2187  $this->setRobotPolicy( 'noindex,nofollow' );
2188  $this->setArticleRelated( false );
2189  $this->enableClientCache( false );
2190  $this->mRedirect = '';
2191  $this->clearSubtitle();
2192  $this->clearHTML();
2193  }
2194 
2207  public function showErrorPage( $title, $msg, $params = array() ) {
2208  if ( !$title instanceof Message ) {
2209  $title = $this->msg( $title );
2210  }
2211 
2212  $this->prepareErrorPage( $title );
2213 
2214  if ( $msg instanceof Message ) {
2215  if ( $params !== array() ) {
2216  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 );
2217  }
2218  $this->addHTML( $msg->parseAsBlock() );
2219  } else {
2220  $this->addWikiMsgArray( $msg, $params );
2221  }
2222 
2223  $this->returnToMain();
2224  }
2232  public function showPermissionsErrorPage( $errors, $action = null ) {
2233  // For some action (read, edit, create and upload), display a "login to do this action"
2234  // error if all of the following conditions are met:
2235  // 1. the user is not logged in
2236  // 2. the only error is insufficient permissions (i.e. no block or something else)
2237  // 3. the error can be avoided simply by logging in
2238  if ( in_array( $action, array( 'read', 'edit', 'createpage', 'createtalk', 'upload' ) )
2239  && $this->getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2240  && ( $errors[0][0] == 'badaccess-groups' || $errors[0][0] == 'badaccess-group0' )
2241  && ( User::groupHasPermission( 'user', $action )
2242  || User::groupHasPermission( 'autoconfirmed', $action ) )
2243  ) {
2244  $displayReturnto = null;
2245 
2246  # Due to bug 32276, if a user does not have read permissions,
2247  # $this->getTitle() will just give Special:Badtitle, which is
2248  # not especially useful as a returnto parameter. Use the title
2249  # from the request instead, if there was one.
2250  $request = $this->getRequest();
2251  $returnto = Title::newFromURL( $request->getVal( 'title', '' ) );
2252  if ( $action == 'edit' ) {
2253  $msg = 'whitelistedittext';
2254  $displayReturnto = $returnto;
2255  } elseif ( $action == 'createpage' || $action == 'createtalk' ) {
2256  $msg = 'nocreatetext';
2257  } elseif ( $action == 'upload' ) {
2258  $msg = 'uploadnologintext';
2259  } else { # Read
2260  $msg = 'loginreqpagetext';
2261  $displayReturnto = Title::newMainPage();
2262  }
2263 
2264  $query = array();
2265 
2266  if ( $returnto ) {
2267  $query['returnto'] = $returnto->getPrefixedText();
2268 
2269  if ( !$request->wasPosted() ) {
2270  $returntoquery = $request->getValues();
2271  unset( $returntoquery['title'] );
2272  unset( $returntoquery['returnto'] );
2273  unset( $returntoquery['returntoquery'] );
2274  $query['returntoquery'] = wfArrayToCgi( $returntoquery );
2275  }
2276  }
2277  $loginLink = Linker::linkKnown(
2278  SpecialPage::getTitleFor( 'Userlogin' ),
2279  $this->msg( 'loginreqlink' )->escaped(),
2280  array(),
2281  $query
2282  );
2283 
2284  $this->prepareErrorPage( $this->msg( 'loginreqtitle' ) );
2285  $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->parse() );
2286 
2287  # Don't return to a page the user can't read otherwise
2288  # we'll end up in a pointless loop
2289  if ( $displayReturnto && $displayReturnto->userCan( 'read', $this->getUser() ) ) {
2290  $this->returnToMain( null, $displayReturnto );
2291  }
2292  } else {
2293  $this->prepareErrorPage( $this->msg( 'permissionserrors' ) );
2294  $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
2295  }
2296  }
2304  public function versionRequired( $version ) {
2305  $this->prepareErrorPage( $this->msg( 'versionrequired', $version ) );
2306 
2307  $this->addWikiMsg( 'versionrequiredtext', $version );
2308  $this->returnToMain();
2309  }
2317  public function permissionRequired( $permission ) {
2318  throw new PermissionsError( $permission );
2319  }
2320 
2326  public function loginToUse() {
2327  throw new PermissionsError( 'read' );
2328  }
2329 
2337  public function formatPermissionsErrorMessage( $errors, $action = null ) {
2338  if ( $action == null ) {
2339  $text = $this->msg( 'permissionserrorstext', count( $errors ) )->plain() . "\n\n";
2340  } else {
2341  $action_desc = $this->msg( "action-$action" )->plain();
2342  $text = $this->msg(
2343  'permissionserrorstext-withaction',
2344  count( $errors ),
2345  $action_desc
2346  )->plain() . "\n\n";
2347  }
2348 
2349  if ( count( $errors ) > 1 ) {
2350  $text .= '<ul class="permissions-errors">' . "\n";
2351 
2352  foreach ( $errors as $error ) {
2353  $text .= '<li>';
2354  $text .= call_user_func_array( array( $this, 'msg' ), $error )->plain();
2355  $text .= "</li>\n";
2356  }
2357  $text .= '</ul>';
2358  } else {
2359  $text .= "<div class=\"permissions-errors\">\n" .
2360  call_user_func_array( array( $this, 'msg' ), reset( $errors ) )->plain() .
2361  "\n</div>";
2362  }
2363 
2364  return $text;
2365  }
2366 
2388  public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
2389  $this->setRobotPolicy( 'noindex,nofollow' );
2390  $this->setArticleRelated( false );
2391 
2392  // If no reason is given, just supply a default "I can't let you do
2393  // that, Dave" message. Should only occur if called by legacy code.
2394  if ( $protected && empty( $reasons ) ) {
2395  $reasons[] = array( 'badaccess-group0' );
2396  }
2397 
2398  if ( !empty( $reasons ) ) {
2399  // Permissions error
2400  if ( $source ) {
2401  $this->setPageTitle( $this->msg( 'viewsource-title', $this->getTitle()->getPrefixedText() ) );
2402  $this->addBacklinkSubtitle( $this->getTitle() );
2403  } else {
2404  $this->setPageTitle( $this->msg( 'badaccess' ) );
2405  }
2406  $this->addWikiText( $this->formatPermissionsErrorMessage( $reasons, $action ) );
2407  } else {
2408  // Wiki is read only
2409  throw new ReadOnlyError;
2410  }
2411 
2412  // Show source, if supplied
2413  if ( is_string( $source ) ) {
2414  $this->addWikiMsg( 'viewsourcetext' );
2415 
2416  $pageLang = $this->getTitle()->getPageLanguage();
2417  $params = array(
2418  'id' => 'wpTextbox1',
2419  'name' => 'wpTextbox1',
2420  'cols' => $this->getUser()->getOption( 'cols' ),
2421  'rows' => $this->getUser()->getOption( 'rows' ),
2422  'readonly' => 'readonly',
2423  'lang' => $pageLang->getHtmlCode(),
2424  'dir' => $pageLang->getDir(),
2425  );
2426  $this->addHTML( Html::element( 'textarea', $params, $source ) );
2427 
2428  // Show templates used by this article
2429  $templates = Linker::formatTemplates( $this->getTitle()->getTemplateLinksFrom() );
2430  $this->addHTML( "<div class='templatesUsed'>
2431 $templates
2432 </div>
2433 " );
2434  }
2435 
2436  # If the title doesn't exist, it's fairly pointless to print a return
2437  # link to it. After all, you just tried editing it and couldn't, so
2438  # what's there to do there?
2439  if ( $this->getTitle()->exists() ) {
2440  $this->returnToMain( null, $this->getTitle() );
2441  }
2442  }
2443 
2448  public function rateLimited() {
2449  throw new ThrottledError;
2450  }
2451 
2461  public function showLagWarning( $lag ) {
2462  global $wgSlaveLagWarning, $wgSlaveLagCritical;
2463  if ( $lag >= $wgSlaveLagWarning ) {
2464  $message = $lag < $wgSlaveLagCritical
2465  ? 'lag-warn-normal'
2466  : 'lag-warn-high';
2467  $wrap = Html::rawElement( 'div', array( 'class' => "mw-{$message}" ), "\n$1\n" );
2468  $this->wrapWikiMsg( "$wrap\n", array( $message, $this->getLanguage()->formatNum( $lag ) ) );
2469  }
2470  }
2472  public function showFatalError( $message ) {
2473  $this->prepareErrorPage( $this->msg( 'internalerror' ) );
2474 
2475  $this->addHTML( $message );
2476  }
2477 
2478  public function showUnexpectedValueError( $name, $val ) {
2479  $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() );
2480  }
2481 
2482  public function showFileCopyError( $old, $new ) {
2483  $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() );
2484  }
2485 
2486  public function showFileRenameError( $old, $new ) {
2487  $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() );
2488  }
2489 
2490  public function showFileDeleteError( $name ) {
2491  $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() );
2492  }
2493 
2494  public function showFileNotFoundError( $name ) {
2495  $this->showFatalError( $this->msg( 'filenotfound', $name )->text() );
2496  }
2497 
2506  public function addReturnTo( $title, $query = array(), $text = null, $options = array() ) {
2507  $link = $this->msg( 'returnto' )->rawParams(
2508  Linker::link( $title, $text, array(), $query, $options ) )->escaped();
2509  $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
2510  }
2511 
2520  public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
2521  if ( $returnto == null ) {
2522  $returnto = $this->getRequest()->getText( 'returnto' );
2523  }
2524 
2525  if ( $returntoquery == null ) {
2526  $returntoquery = $this->getRequest()->getText( 'returntoquery' );
2527  }
2528 
2529  if ( $returnto === '' ) {
2530  $returnto = Title::newMainPage();
2531  }
2532 
2533  if ( is_object( $returnto ) ) {
2534  $titleObj = $returnto;
2535  } else {
2536  $titleObj = Title::newFromText( $returnto );
2537  }
2538  if ( !is_object( $titleObj ) ) {
2539  $titleObj = Title::newMainPage();
2540  }
2541 
2542  $this->addReturnTo( $titleObj, wfCgiToArray( $returntoquery ) );
2543  }
2544 
2550  public function headElement( Skin $sk, $includeStyle = true ) {
2551  global $wgContLang, $wgMimeType;
2552 
2553  $userdir = $this->getLanguage()->getDir();
2554  $sitedir = $wgContLang->getDir();
2555 
2557 
2558  if ( $this->getHTMLTitle() == '' ) {
2559  $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() )->inContentLanguage() );
2560  }
2561 
2562  $openHead = Html::openElement( 'head' );
2563  if ( $openHead ) {
2564  # Don't bother with the newline if $head == ''
2565  $ret .= "$openHead\n";
2566  }
2567 
2568  if ( !Html::isXmlMimeType( $wgMimeType ) ) {
2569  // Add <meta charset="UTF-8">
2570  // This should be before <title> since it defines the charset used by
2571  // text including the text inside <title>.
2572  // The spec recommends defining XHTML5's charset using the XML declaration
2573  // instead of meta.
2574  // Our XML declaration is output by Html::htmlHeader.
2575  // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
2576  // http://www.whatwg.org/html/semantics.html#charset
2577  $ret .= Html::element( 'meta', array( 'charset' => 'UTF-8' ) ) . "\n";
2578  }
2579 
2580  $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
2581 
2582  // Avoid Internet Explorer "compatibility view", so that
2583  // jQuery can work correctly.
2584  $ret .= Html::element( 'meta', array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EDGE' ) ) . "\n";
2585 
2586  $ret .= (
2587  $this->getHeadLinks() .
2588  "\n" .
2589  $this->buildCssLinks() .
2590  // No newline after buildCssLinks since makeResourceLoaderLink did that already
2591  $this->getHeadScripts() .
2592  "\n" .
2593  $this->getHeadItems()
2594  );
2595 
2596  $closeHead = Html::closeElement( 'head' );
2597  if ( $closeHead ) {
2598  $ret .= "$closeHead\n";
2599  }
2600 
2601  $bodyClasses = array();
2602  $bodyClasses[] = 'mediawiki';
2603 
2604  # Classes for LTR/RTL directionality support
2605  $bodyClasses[] = $userdir;
2606  $bodyClasses[] = "sitedir-$sitedir";
2607 
2608  if ( $this->getLanguage()->capitalizeAllNouns() ) {
2609  # A <body> class is probably not the best way to do this . . .
2610  $bodyClasses[] = 'capitalize-all-nouns';
2611  }
2612 
2613  $bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
2614  $bodyClasses[] = 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
2615  $bodyClasses[] = 'action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
2616 
2617  $bodyAttrs = array();
2618  // While the implode() is not strictly needed, it's used for backwards compatibility
2619  // (this used to be built as a string and hooks likely still expect that).
2620  $bodyAttrs['class'] = implode( ' ', $bodyClasses );
2621 
2622  // Allow skins and extensions to add body attributes they need
2623  $sk->addToBodyAttributes( $this, $bodyAttrs );
2624  wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) );
2625 
2626  $ret .= Html::openElement( 'body', $bodyAttrs ) . "\n";
2627 
2628  return $ret;
2629  }
2630 
2636  public function getResourceLoader() {
2637  if ( is_null( $this->mResourceLoader ) ) {
2638  $this->mResourceLoader = new ResourceLoader();
2639  }
2640  return $this->mResourceLoader;
2641  }
2642 
2652  public function makeResourceLoaderLink( $modules, $only, $useESI = false, array $extraQuery = array(), $loadCall = false ) {
2653  global $wgResourceLoaderUseESI;
2654 
2655  $modules = (array)$modules;
2656 
2657  $links = array(
2658  'html' => '',
2659  'states' => array(),
2660  );
2661 
2662  if ( !count( $modules ) ) {
2663  return $links;
2664  }
2665 
2666 
2667  if ( count( $modules ) > 1 ) {
2668  // Remove duplicate module requests
2669  $modules = array_unique( $modules );
2670  // Sort module names so requests are more uniform
2671  sort( $modules );
2672 
2673  if ( ResourceLoader::inDebugMode() ) {
2674  // Recursively call us for every item
2675  foreach ( $modules as $name ) {
2676  $link = $this->makeResourceLoaderLink( $name, $only, $useESI );
2677  $links['html'] .= $link['html'];
2678  $links['states'] += $link['states'];
2679  }
2680  return $links;
2681  }
2682  }
2683 
2684  if ( !is_null( $this->mTarget ) ) {
2685  $extraQuery['target'] = $this->mTarget;
2686  }
2687 
2688  // Create keyed-by-group list of module objects from modules list
2689  $groups = array();
2691  foreach ( $modules as $name ) {
2692  $module = $resourceLoader->getModule( $name );
2693  # Check that we're allowed to include this module on this page
2694  if ( !$module
2695  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS )
2697  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_STYLES )
2698  && $only == ResourceLoaderModule::TYPE_STYLES )
2699  || ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) )
2700  ) {
2701  continue;
2702  }
2703 
2704  $group = $module->getGroup();
2705  if ( !isset( $groups[$group] ) ) {
2706  $groups[$group] = array();
2707  }
2708  $groups[$group][$name] = $module;
2709  }
2710 
2711  foreach ( $groups as $group => $grpModules ) {
2712  // Special handling for user-specific groups
2713  $user = null;
2714  if ( ( $group === 'user' || $group === 'private' ) && $this->getUser()->isLoggedIn() ) {
2715  $user = $this->getUser()->getName();
2716  }
2717 
2718  // Create a fake request based on the one we are about to make so modules return
2719  // correct timestamp and emptiness data
2721  array(), // modules; not determined yet
2722  $this->getLanguage()->getCode(),
2723  $this->getSkin()->getSkinName(),
2724  $user,
2725  null, // version; not determined yet
2727  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2728  $this->isPrintable(),
2729  $this->getRequest()->getBool( 'handheld' ),
2730  $extraQuery
2731  );
2733 
2734  // Extract modules that know they're empty
2735  foreach ( $grpModules as $key => $module ) {
2736  // Inline empty modules: since they're empty, just mark them as 'ready' (bug 46857)
2737  // If we're only getting the styles, we don't need to do anything for empty modules.
2738  if ( $module->isKnownEmpty( $context ) ) {
2739  unset( $grpModules[$key] );
2740  if ( $only !== ResourceLoaderModule::TYPE_STYLES ) {
2741  $links['states'][$key] = 'ready';
2742  }
2743  }
2744  }
2745 
2746  // If there are no non-empty modules, skip this group
2747  if ( count( $grpModules ) === 0 ) {
2748  continue;
2749  }
2750 
2751  // Inline private modules. These can't be loaded through load.php for security
2752  // reasons, see bug 34907. Note that these modules should be loaded from
2753  // getHeadScripts() before the first loader call. Otherwise other modules can't
2754  // properly use them as dependencies (bug 30914)
2755  if ( $group === 'private' ) {
2756  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2757  $links['html'] .= Html::inlineStyle(
2758  $resourceLoader->makeModuleResponse( $context, $grpModules )
2759  );
2760  } else {
2761  $links['html'] .= Html::inlineScript(
2763  $resourceLoader->makeModuleResponse( $context, $grpModules )
2764  )
2765  );
2766  }
2767  $links['html'] .= "\n";
2768  continue;
2769  }
2770 
2771  // Special handling for the user group; because users might change their stuff
2772  // on-wiki like user pages, or user preferences; we need to find the highest
2773  // timestamp of these user-changeable modules so we can ensure cache misses on change
2774  // This should NOT be done for the site group (bug 27564) because anons get that too
2775  // and we shouldn't be putting timestamps in Squid-cached HTML
2776  $version = null;
2777  if ( $group === 'user' ) {
2778  // Get the maximum timestamp
2779  $timestamp = 1;
2780  foreach ( $grpModules as $module ) {
2781  $timestamp = max( $timestamp, $module->getModifiedTime( $context ) );
2782  }
2783  // Add a version parameter so cache will break when things change
2785  }
2786 
2788  array_keys( $grpModules ),
2789  $this->getLanguage()->getCode(),
2790  $this->getSkin()->getSkinName(),
2791  $user,
2792  $version,
2794  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2795  $this->isPrintable(),
2796  $this->getRequest()->getBool( 'handheld' ),
2797  $extraQuery
2798  );
2799  if ( $useESI && $wgResourceLoaderUseESI ) {
2800  $esi = Xml::element( 'esi:include', array( 'src' => $url ) );
2801  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2802  $link = Html::inlineStyle( $esi );
2803  } else {
2804  $link = Html::inlineScript( $esi );
2805  }
2806  } else {
2807  // Automatically select style/script elements
2808  if ( $only === ResourceLoaderModule::TYPE_STYLES ) {
2809  $link = Html::linkedStyle( $url );
2810  } elseif ( $loadCall ) {
2813  Xml::encodeJsCall( 'mw.loader.load', array( $url, 'text/javascript', true ) )
2814  )
2815  );
2816  } else {
2817  $link = Html::linkedScript( $url );
2818 
2819  // For modules requested directly in the html via <link> or <script>,
2820  // tell mw.loader they are being loading to prevent duplicate requests.
2821  foreach ( $grpModules as $key => $module ) {
2822  // Don't output state=loading for the startup module..
2823  if ( $key !== 'startup' ) {
2824  $links['states'][$key] = 'loading';
2825  }
2826  }
2827  }
2828  }
2829 
2830  if ( $group == 'noscript' ) {
2831  $links['html'] .= Html::rawElement( 'noscript', array(), $link ) . "\n";
2832  } else {
2833  $links['html'] .= $link . "\n";
2834  }
2835  }
2836 
2837  return $links;
2838  }
2839 
2845  protected static function getHtmlFromLoaderLinks( Array $links ) {
2846  $html = '';
2847  $states = array();
2848  foreach ( $links as $link ) {
2849  if ( !is_array( $link ) ) {
2850  $html .= $link;
2851  } else {
2852  $html .= $link['html'];
2853  $states += $link['states'];
2854  }
2855  }
2856 
2857  if ( count( $states ) ) {
2861  )
2862  ) . "\n" . $html;
2863  }
2864 
2865  return $html;
2866  }
2874  function getHeadScripts() {
2875  global $wgResourceLoaderExperimentalAsyncLoading;
2876 
2877  // Startup - this will immediately load jquery and mediawiki modules
2878  $links = array();
2879  $links[] = $this->makeResourceLoaderLink( 'startup', ResourceLoaderModule::TYPE_SCRIPTS, true );
2880 
2881  // Load config before anything else
2882  $links[] = Html::inlineScript(
2885  )
2886  );
2887 
2888  // Load embeddable private modules before any loader links
2889  // This needs to be TYPE_COMBINED so these modules are properly wrapped
2890  // in mw.loader.implement() calls and deferred until mw.user is available
2891  $embedScripts = array( 'user.options', 'user.tokens' );
2892  $links[] = $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
2893 
2894  // Scripts and messages "only" requests marked for top inclusion
2895  // Messages should go first
2896  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'top' ), ResourceLoaderModule::TYPE_MESSAGES );
2897  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'top' ), ResourceLoaderModule::TYPE_SCRIPTS );
2898 
2899  // Modules requests - let the client calculate dependencies and batch requests as it likes
2900  // Only load modules that have marked themselves for loading at the top
2901  $modules = $this->getModules( true, 'top' );
2902  if ( $modules ) {
2903  $links[] = Html::inlineScript(
2905  Xml::encodeJsCall( 'mw.loader.load', array( $modules ) )
2906  )
2907  );
2908  }
2909 
2910  if ( $wgResourceLoaderExperimentalAsyncLoading ) {
2911  $links[] = $this->getScriptsForBottomQueue( true );
2912  }
2913 
2914  return self::getHtmlFromLoaderLinks( $links );
2915  }
2916 
2926  function getScriptsForBottomQueue( $inHead ) {
2927  global $wgUseSiteJs, $wgAllowUserJs;
2928 
2929  // Scripts and messages "only" requests marked for bottom inclusion
2930  // If we're in the <head>, use load() calls rather than <script src="..."> tags
2931  // Messages should go first
2932  $links = array();
2933  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'bottom' ),
2934  ResourceLoaderModule::TYPE_MESSAGES, /* $useESI = */ false, /* $extraQuery = */ array(),
2935  /* $loadCall = */ $inHead
2936  );
2937  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'bottom' ),
2938  ResourceLoaderModule::TYPE_SCRIPTS, /* $useESI = */ false, /* $extraQuery = */ array(),
2939  /* $loadCall = */ $inHead
2940  );
2941 
2942  // Modules requests - let the client calculate dependencies and batch requests as it likes
2943  // Only load modules that have marked themselves for loading at the bottom
2944  $modules = $this->getModules( true, 'bottom' );
2945  if ( $modules ) {
2946  $links[] = Html::inlineScript(
2948  Xml::encodeJsCall( 'mw.loader.load', array( $modules, null, true ) )
2949  )
2950  );
2951  }
2952 
2953  // Legacy Scripts
2954  $links[] = "\n" . $this->mScripts;
2955 
2956  // Add site JS if enabled
2958  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2959  );
2960 
2961  // Add user JS if enabled
2962  if ( $wgAllowUserJs && $this->getTitle() && $this->getTitle()->isJsSubpage() && $this->userCanPreview() ) {
2963  # XXX: additional security check/prompt?
2964  // We're on a preview of a JS subpage
2965  // Exclude this page from the user module in case it's in there (bug 26283)
2966  $links[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS, false,
2967  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() ), $inHead
2968  );
2969  // Load the previewed JS
2970  $links[] = Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
2971 
2972  // FIXME: If the user is previewing, say, ./vector.js, his ./common.js will be loaded
2973  // asynchronously and may arrive *after* the inline script here. So the previewed code
2974  // may execute before ./common.js runs. Normally, ./common.js runs before ./vector.js...
2975  } else {
2976  // Include the user module normally, i.e., raw to avoid it being wrapped in a closure.
2978  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2979  );
2980  }
2981 
2982  // Group JS is only enabled if site JS is enabled.
2983  $links[] = $this->makeResourceLoaderLink( 'user.groups', ResourceLoaderModule::TYPE_COMBINED,
2984  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2985  );
2986 
2988  }
2989 
2994  function getBottomScripts() {
2995  global $wgResourceLoaderExperimentalAsyncLoading;
2996 
2997  // Optimise jQuery ready event cross-browser.
2998  // This also enforces $.isReady to be true at </body> which fixes the
2999  // mw.loader bug in Firefox with using document.write between </body>
3000  // and the DOMContentReady event (bug 47457).
3001  $html = Html::inlineScript( 'window.jQuery && jQuery.ready();' );
3002 
3003  if ( !$wgResourceLoaderExperimentalAsyncLoading ) {
3004  $html .= $this->getScriptsForBottomQueue( false );
3005  }
3006 
3007  return $html;
3008  }
3016  public function getJsConfigVars() {
3017  return $this->mJsConfigVars;
3018  }
3026  public function addJsConfigVars( $keys, $value = null ) {
3027  if ( is_array( $keys ) ) {
3028  foreach ( $keys as $key => $value ) {
3029  $this->mJsConfigVars[$key] = $value;
3030  }
3031  return;
3032  }
3033 
3034  $this->mJsConfigVars[$keys] = $value;
3035  }
3036 
3049  public function getJSVars() {
3051 
3052  $curRevisionId = 0;
3053  $articleId = 0;
3054  $canonicalSpecialPageName = false; # bug 21115
3055 
3056  $title = $this->getTitle();
3057  $ns = $title->getNamespace();
3058  $canonicalNamespace = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
3059 
3060  $sk = $this->getSkin();
3061  // Get the relevant title so that AJAX features can use the correct page name
3062  // when making API requests from certain special pages (bug 34972).
3063  $relevantTitle = $sk->getRelevantTitle();
3064  $relevantUser = $sk->getRelevantUser();
3065 
3066  if ( $ns == NS_SPECIAL ) {
3067  list( $canonicalSpecialPageName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
3068  } elseif ( $this->canUseWikiPage() ) {
3069  $wikiPage = $this->getWikiPage();
3070  $curRevisionId = $wikiPage->getLatest();
3071  $articleId = $wikiPage->getId();
3072  }
3073 
3074  $lang = $title->getPageLanguage();
3075 
3076  // Pre-process information
3077  $separatorTransTable = $lang->separatorTransformTable();
3078  $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
3079  $compactSeparatorTransTable = array(
3080  implode( "\t", array_keys( $separatorTransTable ) ),
3081  implode( "\t", $separatorTransTable ),
3082  );
3083  $digitTransTable = $lang->digitTransformTable();
3084  $digitTransTable = $digitTransTable ? $digitTransTable : array();
3085  $compactDigitTransTable = array(
3086  implode( "\t", array_keys( $digitTransTable ) ),
3087  implode( "\t", $digitTransTable ),
3088  );
3089 
3090  $user = $this->getUser();
3091 
3092  $vars = array(
3093  'wgCanonicalNamespace' => $canonicalNamespace,
3094  'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3095  'wgNamespaceNumber' => $title->getNamespace(),
3096  'wgPageName' => $title->getPrefixedDBkey(),
3097  'wgTitle' => $title->getText(),
3098  'wgCurRevisionId' => $curRevisionId,
3099  'wgRevisionId' => (int)$this->getRevisionId(),
3100  'wgArticleId' => $articleId,
3101  'wgIsArticle' => $this->isArticle(),
3102  'wgIsRedirect' => $title->isRedirect(),
3103  'wgAction' => Action::getActionName( $this->getContext() ),
3104  'wgUserName' => $user->isAnon() ? null : $user->getName(),
3105  'wgUserGroups' => $user->getEffectiveGroups(),
3106  'wgCategories' => $this->getCategories(),
3107  'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
3108  'wgPageContentLanguage' => $lang->getCode(),
3109  'wgPageContentModel' => $title->getContentModel(),
3110  'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3111  'wgDigitTransformTable' => $compactDigitTransTable,
3112  'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
3113  'wgMonthNames' => $lang->getMonthNamesArray(),
3114  'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
3115  'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3116  );
3117  if ( $user->isLoggedIn() ) {
3118  $vars['wgUserId'] = $user->getId();
3119  $vars['wgUserEditCount'] = $user->getEditCount();
3120  $userReg = wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
3121  $vars['wgUserRegistration'] = $userReg !== null ? ( $userReg * 1000 ) : null;
3122  // Get the revision ID of the oldest new message on the user's talk
3123  // page. This can be used for constructing new message alerts on
3124  // the client side.
3125  $vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
3126  }
3127  if ( $wgContLang->hasVariants() ) {
3128  $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
3129  }
3130  // Same test as SkinTemplate
3131  $vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user ) && ( $title->exists() || $title->quickUserCan( 'create', $user ) );
3132  foreach ( $title->getRestrictionTypes() as $type ) {
3133  $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
3134  }
3135  if ( $title->isMainPage() ) {
3136  $vars['wgIsMainPage'] = true;
3137  }
3138  if ( $this->mRedirectedFrom ) {
3139  $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3140  }
3141  if ( $relevantUser ) {
3142  $vars['wgRelevantUserName'] = $relevantUser->getName();
3143  }
3144 
3145  // Allow extensions to add their custom variables to the mw.config map.
3146  // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
3147  // page-dependant but site-wide (without state).
3148  // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
3149  wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars, $this ) );
3150 
3151  // Merge in variables from addJsConfigVars last
3152  return array_merge( $vars, $this->getJsConfigVars() );
3153  }
3154 
3164  public function userCanPreview() {
3165  if ( $this->getRequest()->getVal( 'action' ) != 'submit'
3166  || !$this->getRequest()->wasPosted()
3167  || !$this->getUser()->isLoggedIn()
3168  || !$this->getUser()->matchEditToken(
3169  $this->getRequest()->getVal( 'wpEditToken' ) )
3170  ) {
3171  return false;
3172  }
3173  if ( !$this->getTitle()->isJsSubpage() && !$this->getTitle()->isCssSubpage() ) {
3174  return false;
3175  }
3176  if ( !$this->getTitle()->isSubpageOf( $this->getUser()->getUserPage() ) ) {
3177  // Don't execute another user's CSS or JS on preview (T85855)
3178  return false;
3179  }
3181  return !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) );
3182  }
3183 
3187  public function getHeadLinksArray() {
3188  global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
3189  $wgSitename, $wgVersion,
3190  $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
3191  $wgDisableLangConversion, $wgCanonicalLanguageLinks,
3192  $wgRightsPage, $wgRightsUrl;
3193 
3194  $tags = array();
3195 
3196  $canonicalUrl = $this->mCanonicalUrl;
3197 
3198  $tags['meta-generator'] = Html::element( 'meta', array(
3199  'name' => 'generator',
3200  'content' => "MediaWiki $wgVersion",
3201  ) );
3202 
3203  $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
3204  if ( $p !== 'index,follow' ) {
3205  // http://www.robotstxt.org/wc/meta-user.html
3206  // Only show if it's different from the default robots policy
3207  $tags['meta-robots'] = Html::element( 'meta', array(
3208  'name' => 'robots',
3209  'content' => $p,
3210  ) );
3211  }
3212 
3213  foreach ( $this->mMetatags as $tag ) {
3214  if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) {
3215  $a = 'http-equiv';
3216  $tag[0] = substr( $tag[0], 5 );
3217  } else {
3218  $a = 'name';
3219  }
3220  $tagName = "meta-{$tag[0]}";
3221  if ( isset( $tags[$tagName] ) ) {
3222  $tagName .= $tag[1];
3223  }
3224  $tags[$tagName] = Html::element( 'meta',
3225  array(
3226  $a => $tag[0],
3227  'content' => $tag[1]
3228  )
3229  );
3230  }
3231 
3232  foreach ( $this->mLinktags as $tag ) {
3233  $tags[] = Html::element( 'link', $tag );
3234  }
3235 
3236  # Universal edit button
3237  if ( $wgUniversalEditButton && $this->isArticleRelated() ) {
3238  $user = $this->getUser();
3239  if ( $this->getTitle()->quickUserCan( 'edit', $user )
3240  && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create', $user ) ) ) {
3241  // Original UniversalEditButton
3242  $msg = $this->msg( 'edit' )->text();
3243  $tags['universal-edit-button'] = Html::element( 'link', array(
3244  'rel' => 'alternate',
3245  'type' => 'application/x-wiki',
3246  'title' => $msg,
3247  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3248  ) );
3249  // Alternate edit link
3250  $tags['alternative-edit'] = Html::element( 'link', array(
3251  'rel' => 'edit',
3252  'title' => $msg,
3253  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3254  ) );
3255  }
3256  }
3257 
3258  # Generally the order of the favicon and apple-touch-icon links
3259  # should not matter, but Konqueror (3.5.9 at least) incorrectly
3260  # uses whichever one appears later in the HTML source. Make sure
3261  # apple-touch-icon is specified first to avoid this.
3262  if ( $wgAppleTouchIcon !== false ) {
3263  $tags['apple-touch-icon'] = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
3264  }
3265 
3266  if ( $wgFavicon !== false ) {
3267  $tags['favicon'] = Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
3268  }
3269 
3270  # OpenSearch description link
3271  $tags['opensearch'] = Html::element( 'link', array(
3272  'rel' => 'search',
3273  'type' => 'application/opensearchdescription+xml',
3274  'href' => wfScript( 'opensearch_desc' ),
3275  'title' => $this->msg( 'opensearch-desc' )->inContentLanguage()->text(),
3276  ) );
3277 
3278  if ( $wgEnableAPI ) {
3279  # Real Simple Discovery link, provides auto-discovery information
3280  # for the MediaWiki API (and potentially additional custom API
3281  # support such as WordPress or Twitter-compatible APIs for a
3282  # blogging extension, etc)
3283  $tags['rsd'] = Html::element( 'link', array(
3284  'rel' => 'EditURI',
3285  'type' => 'application/rsd+xml',
3286  // Output a protocol-relative URL here if $wgServer is protocol-relative
3287  // Whether RSD accepts relative or protocol-relative URLs is completely undocumented, though
3288  'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ), PROTO_RELATIVE ),
3289  ) );
3290  }
3291 
3292  # Language variants
3293  if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
3294  $lang = $this->getTitle()->getPageLanguage();
3295  if ( $lang->hasVariants() ) {
3296 
3297  $urlvar = $lang->getURLVariant();
3298 
3299  if ( !$urlvar ) {
3300  $variants = $lang->getVariants();
3301  foreach ( $variants as $_v ) {
3302  $tags["variant-$_v"] = Html::element( 'link', array(
3303  'rel' => 'alternate',
3304  'hreflang' => wfBCP47( $_v ),
3305  'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
3306  );
3307  }
3308  } else {
3309  $canonicalUrl = $this->getTitle()->getLocalURL();
3310  }
3311  }
3312  }
3313 
3314  # Copyright
3315  $copyright = '';
3316  if ( $wgRightsPage ) {
3317  $copy = Title::newFromText( $wgRightsPage );
3318 
3319  if ( $copy ) {
3320  $copyright = $copy->getLocalURL();
3321  }
3322  }
3323 
3324  if ( !$copyright && $wgRightsUrl ) {
3325  $copyright = $wgRightsUrl;
3326  }
3327 
3328  if ( $copyright ) {
3329  $tags['copyright'] = Html::element( 'link', array(
3330  'rel' => 'copyright',
3331  'href' => $copyright )
3332  );
3333  }
3334 
3335  # Feeds
3336  if ( $wgFeed ) {
3337  foreach ( $this->getSyndicationLinks() as $format => $link ) {
3338  # Use the page name for the title. In principle, this could
3339  # lead to issues with having the same name for different feeds
3340  # corresponding to the same page, but we can't avoid that at
3341  # this low a level.
3342 
3343  $tags[] = $this->feedLink(
3344  $format,
3345  $link,
3346  # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
3347  $this->msg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() )->text()
3348  );
3349  }
3350 
3351  # Recent changes feed should appear on every page (except recentchanges,
3352  # that would be redundant). Put it after the per-page feed to avoid
3353  # changing existing behavior. It's still available, probably via a
3354  # menu in your browser. Some sites might have a different feed they'd
3355  # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3356  # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3357  # If so, use it instead.
3358  if ( $wgOverrideSiteFeed ) {
3359  foreach ( $wgOverrideSiteFeed as $type => $feedUrl ) {
3360  // Note, this->feedLink escapes the url.
3361  $tags[] = $this->feedLink(
3362  $type,
3363  $feedUrl,
3364  $this->msg( "site-{$type}-feed", $wgSitename )->text()
3365  );
3366  }
3367  } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
3368  $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
3369  foreach ( $wgAdvertisedFeedTypes as $format ) {
3370  $tags[] = $this->feedLink(
3371  $format,
3372  $rctitle->getLocalURL( array( 'feed' => $format ) ),
3373  $this->msg( "site-{$format}-feed", $wgSitename )->text() # For grep: 'site-rss-feed', 'site-atom-feed'.
3374  );
3375  }
3376  }
3377  }
3378 
3379  # Canonical URL
3380  global $wgEnableCanonicalServerLink;
3381  if ( $wgEnableCanonicalServerLink ) {
3382  if ( $canonicalUrl !== false ) {
3383  $canonicalUrl = wfExpandUrl( $canonicalUrl, PROTO_CANONICAL );
3384  } else {
3385  $reqUrl = $this->getRequest()->getRequestURL();
3386  $canonicalUrl = wfExpandUrl( $reqUrl, PROTO_CANONICAL );
3387  }
3388  }
3389  if ( $canonicalUrl !== false ) {
3390  $tags[] = Html::element( 'link', array(
3391  'rel' => 'canonical',
3392  'href' => $canonicalUrl
3393  ) );
3394  }
3396  return $tags;
3397  }
3398 
3402  public function getHeadLinks() {
3403  return implode( "\n", $this->getHeadLinksArray() );
3404  }
3405 
3414  private function feedLink( $type, $url, $text ) {
3415  return Html::element( 'link', array(
3416  'rel' => 'alternate',
3417  'type' => "application/$type+xml",
3418  'title' => $text,
3419  'href' => $url )
3420  );
3421  }
3422 
3432  public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
3433  $options = array();
3434  // Even though we expect the media type to be lowercase, but here we
3435  // force it to lowercase to be safe.
3436  if ( $media ) {
3437  $options['media'] = $media;
3438  }
3439  if ( $condition ) {
3440  $options['condition'] = $condition;
3441  }
3442  if ( $dir ) {
3443  $options['dir'] = $dir;
3444  }
3445  $this->styles[$style] = $options;
3446  }
3447 
3453  public function addInlineStyle( $style_css, $flip = 'noflip' ) {
3454  if ( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
3455  # If wanted, and the interface is right-to-left, flip the CSS
3456  $style_css = CSSJanus::transform( $style_css, true, false );
3457  }
3458  $this->mInlineStyles .= Html::inlineStyle( $style_css ) . "\n";
3459  }
3467  public function buildCssLinks() {
3468  global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs, $wgContLang;
3469 
3470  $this->getSkin()->setupSkinUserCss( $this );
3471 
3472  // Add ResourceLoader styles
3473  // Split the styles into these groups
3474  $styles = array( 'other' => array(), 'user' => array(), 'site' => array(), 'private' => array(), 'noscript' => array() );
3475  $links = array();
3476  $otherTags = ''; // Tags to append after the normal <link> tags
3478 
3479  $moduleStyles = $this->getModuleStyles();
3480 
3481  // Per-site custom styles
3482  $moduleStyles[] = 'site';
3483  $moduleStyles[] = 'noscript';
3484  $moduleStyles[] = 'user.groups';
3485 
3486  // Per-user custom styles
3487  if ( $wgAllowUserCss && $this->getTitle()->isCssSubpage() && $this->userCanPreview() ) {
3488  // We're on a preview of a CSS subpage
3489  // Exclude this page from the user module in case it's in there (bug 26283)
3490  $link = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_STYLES, false,
3491  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
3492  );
3493  $otherTags .= $link['html'];
3494 
3495  // Load the previewed CSS
3496  // If needed, Janus it first. This is user-supplied CSS, so it's
3497  // assumed to be right for the content language directionality.
3498  $previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
3499  if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
3500  $previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
3501  }
3502  $otherTags .= Html::inlineStyle( $previewedCSS ) . "\n";
3503  } else {
3504  // Load the user styles normally
3505  $moduleStyles[] = 'user';
3506  }
3507 
3508  // Per-user preference styles
3509  $moduleStyles[] = 'user.cssprefs';
3510 
3511  foreach ( $moduleStyles as $name ) {
3512  $module = $resourceLoader->getModule( $name );
3513  if ( !$module ) {
3514  continue;
3515  }
3516  $group = $module->getGroup();
3517  // Modules in groups different than the ones listed on top (see $styles assignment)
3518  // will be placed in the "other" group
3519  $styles[ isset( $styles[$group] ) ? $group : 'other' ][] = $name;
3520  }
3521 
3522  // We want site, private and user styles to override dynamically added styles from modules, but we want
3523  // dynamically added styles to override statically added styles from other modules. So the order
3524  // has to be other, dynamic, site, private, user
3525  // Add statically added styles for other modules
3526  $links[] = $this->makeResourceLoaderLink( $styles['other'], ResourceLoaderModule::TYPE_STYLES );
3527  // Add normal styles added through addStyle()/addInlineStyle() here
3528  $links[] = implode( "\n", $this->buildCssLinksArray() ) . $this->mInlineStyles;
3529  // Add marker tag to mark the place where the client-side loader should inject dynamic styles
3530  // We use a <meta> tag with a made-up name for this because that's valid HTML
3531  $links[] = Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) ) . "\n";
3532 
3533  // Add site, private and user styles
3534  // 'private' at present only contains user.options, so put that before 'user'
3535  // Any future private modules will likely have a similar user-specific character
3536  foreach ( array( 'site', 'noscript', 'private', 'user' ) as $group ) {
3537  $links[] = $this->makeResourceLoaderLink( $styles[$group],
3539  );
3540  }
3541 
3542  // Add stuff in $otherTags (previewed user CSS if applicable)
3543  return self::getHtmlFromLoaderLinks( $links ) . $otherTags;
3544  }
3545 
3549  public function buildCssLinksArray() {
3550  $links = array();
3551 
3552  // Add any extension CSS
3553  foreach ( $this->mExtStyles as $url ) {
3554  $this->addStyle( $url );
3555  }
3556  $this->mExtStyles = array();
3557 
3558  foreach ( $this->styles as $file => $options ) {
3559  $link = $this->styleLink( $file, $options );
3560  if ( $link ) {
3561  $links[$file] = $link;
3562  }
3563  }
3564  return $links;
3565  }
3566 
3574  protected function styleLink( $style, $options ) {
3575  if ( isset( $options['dir'] ) ) {
3576  if ( $this->getLanguage()->getDir() != $options['dir'] ) {
3577  return '';
3578  }
3579  }
3580 
3581  if ( isset( $options['media'] ) ) {
3582  $media = self::transformCssMedia( $options['media'] );
3583  if ( is_null( $media ) ) {
3584  return '';
3585  }
3586  } else {
3587  $media = 'all';
3588  }
3589 
3590  if ( substr( $style, 0, 1 ) == '/' ||
3591  substr( $style, 0, 5 ) == 'http:' ||
3592  substr( $style, 0, 6 ) == 'https:' ) {
3593  $url = $style;
3594  } else {
3595  global $wgStylePath, $wgStyleVersion;
3596  $url = $wgStylePath . '/' . $style . '?' . $wgStyleVersion;
3597  }
3598 
3599  $link = Html::linkedStyle( $url, $media );
3600 
3601  if ( isset( $options['condition'] ) ) {
3602  $condition = htmlspecialchars( $options['condition'] );
3603  $link = "<!--[if $condition]>$link<![endif]-->";
3604  }
3605  return $link;
3606  }
3607 
3615  public static function transformCssMedia( $media ) {
3616  global $wgRequest;
3617 
3618  // http://www.w3.org/TR/css3-mediaqueries/#syntax
3619  $screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
3620 
3621  // Switch in on-screen display for media testing
3622  $switches = array(
3623  'printable' => 'print',
3624  'handheld' => 'handheld',
3625  );
3626  foreach ( $switches as $switch => $targetMedia ) {
3627  if ( $wgRequest->getBool( $switch ) ) {
3628  if ( $media == $targetMedia ) {
3629  $media = '';
3630  } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3631  // This regex will not attempt to understand a comma-separated media_query_list
3632  //
3633  // Example supported values for $media: 'screen', 'only screen', 'screen and (min-width: 982px)' ),
3634  // Example NOT supported value for $media: '3d-glasses, screen, print and resolution > 90dpi'
3635  //
3636  // If it's a print request, we never want any kind of screen stylesheets
3637  // If it's a handheld request (currently the only other choice with a switch),
3638  // we don't want simple 'screen' but we might want screen queries that
3639  // have a max-width or something, so we'll pass all others on and let the
3640  // client do the query.
3641  if ( $targetMedia == 'print' || $media == 'screen' ) {
3642  return null;
3643  }
3644  }
3645  }
3646  }
3647 
3648  return $media;
3649  }
3657  public function addWikiMsg( /*...*/ ) {
3658  $args = func_get_args();
3659  $name = array_shift( $args );
3660  $this->addWikiMsgArray( $name, $args );
3661  }
3662 
3671  public function addWikiMsgArray( $name, $args ) {
3672  $this->addHTML( $this->msg( $name, $args )->parseAsBlock() );
3673  }
3674 
3698  public function wrapWikiMsg( $wrap /*, ...*/ ) {
3699  $msgSpecs = func_get_args();
3700  array_shift( $msgSpecs );
3701  $msgSpecs = array_values( $msgSpecs );
3702  $s = $wrap;
3703  foreach ( $msgSpecs as $n => $spec ) {
3704  if ( is_array( $spec ) ) {
3705  $args = $spec;
3706  $name = array_shift( $args );
3707  if ( isset( $args['options'] ) ) {
3708  unset( $args['options'] );
3709  wfDeprecated(
3710  'Adding "options" to ' . __METHOD__ . ' is no longer supported',
3711  '1.20'
3712  );
3713  }
3714  } else {
3715  $args = array();
3716  $name = $spec;
3717  }
3718  $s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
3719  }
3720  $this->addWikiText( $s );
3721  }
3722 
3732  public function includeJQuery( $modules = array() ) {
3733  return array();
3734  }
3735 
3741  public function enableTOC( $flag = true ) {
3742  $this->mEnableTOC = $flag;
3743  }
3744 
3749  public function isTOCEnabled() {
3750  return $this->mEnableTOC;
3751  }
3752 
3758  public function enableSectionEditLinks( $flag = true ) {
3759  $this->mEnableSectionEditLinks = $flag;
3760  }
3761 
3766  public function sectionEditLinksEnabled() {
3768  }
3769 }
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:1908
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:3567
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:3650
ContextSource\getContext
getContext()
Get the RequestContext object.
Definition: ContextSource.php:40
OutputPage\getLanguageLinks
getLanguageLinks()
Get the list of language links.
Definition: OutputPage.php:1179
OutputPage\reduceAllowedModules
reduceAllowedModules( $type, $level)
Limit the highest level of CSS/JS untrustworthiness allowed.
Definition: OutputPage.php:1352
PROTO_CANONICAL
const PROTO_CANONICAL
Definition: Defines.php:271
wfBCP47
wfBCP47( $code)
Get the normalised IETF language tag See unit test for examples.
Definition: GlobalFunctions.php:3985
$request
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled also a ContextSource error or success you ll probably need to make sure the header is varied on WebRequest $request
Definition: hooks.txt:1961
OutputPage\addSubtitle
addSubtitle( $str)
Add $str to the subtitle.
Definition: OutputPage.php:942
OutputPage\addAcceptLanguage
addAcceptLanguage()
bug 21672: Add Accept-Language to Vary and XVO headers if there's no 'variant' parameter existed in G...
Definition: OutputPage.php:1874
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:3042
OutputPage\$mContainsNewMagic
$mContainsNewMagic
Definition: OutputPage.php:170
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ResourceLoader\makeConfigSetScript
static makeConfigSetScript(array $configuration)
Returns JS code which will set the MediaWiki configuration array to the given value.
Definition: ResourceLoader.php:1149
Html\htmlHeader
static htmlHeader( $attribs=array())
Constructs the opening html-tag with necessary doctypes depending on global variables.
Definition: Html.php:746
UserBlockedError
Show an error when the user tries to do something whilst blocked.
Definition: UserBlockedError.php:27
OutputPage\$mLinktags
$mLinktags
Definition: OutputPage.php:42
OutputPage\showFileRenameError
showFileRenameError( $old, $new)
Definition: OutputPage.php:2479
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:2919
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:2319
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:3751
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:1938
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3714
text
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
OutputPage\blockedPage
blockedPage()
Produce a "user is blocked" page.
Definition: OutputPage.php:2161
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:2513
OutputPage\$mIsArticleRelated
$mIsArticleRelated
Should be private.
Definition: OutputPage.php:71
OutputPage\buildCssLinksArray
buildCssLinksArray()
Definition: OutputPage.php:3542
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:2987
OutputPage\$mCategoryLinks
$mCategoryLinks
Definition: OutputPage.php:108
OutputPage\showFileNotFoundError
showFileNotFoundError( $name)
Definition: OutputPage.php:2487
OutputPage\getHtmlFromLoaderLinks
static getHtmlFromLoaderLinks(Array $links)
Build html output from an array of links from makeResourceLoaderLink.
Definition: OutputPage.php:2838
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:3395
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:2297
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
$resourceLoader
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled also a ContextSource error or success you ll probably need to make sure the header is varied on WebRequest such as when responding to a resource loader request or generating HTML output & $resourceLoader
Definition: hooks.txt:1961
OutputPage\getSyndicationLinks
getSyndicationLinks()
Return URLs for each supported syndication format for this page.
Definition: OutputPage.php:1095
OutputPage\$mVaryHeader
$mVaryHeader
Definition: OutputPage.php:238
ContextSource\canUseWikiPage
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
Definition: ContextSource.php:99
ContextSource\getRequest
getRequest()
Get the WebRequest object.
Definition: ContextSource.php:77
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:28
OutputPage\$mJsConfigVars
$mJsConfigVars
Definition: OutputPage.php:142
$wgContLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
Definition: design.txt:56
messages
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. Handler functions that modify $result should generally return false to further attempts at conversion. 'ContribsPager you ll need to handle error messages
Definition: hooks.txt:896
OutputPage\$mHideNewSectionLink
$mHideNewSectionLink
Definition: OutputPage.php:195
User\groupHasPermission
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
Definition: User.php:4166
OutputPage\getRedirect
getRedirect()
Get the URL to redirect to, or an empty string if not redirect URL set.
Definition: OutputPage.php:297
OutputPage\setCanonicalUrl
setCanonicalUrl( $url)
Set the URL to be used for the <link rel="canonical">.
Definition: OutputPage.php:348
OutputPage\$mExtStyles
$mExtStyles
Additional stylesheets. Looks like this is for extensions. Might be replaced by resource loader.
Definition: OutputPage.php:46
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
$link
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
Definition: hooks.txt:2160
ContextSource\getTitle
getTitle()
Get the Title object.
Definition: ContextSource.php:87
OutputPage\$mIndexPolicy
$mIndexPolicy
Definition: OutputPage.php:236
Skin\getHtmlElementAttributes
getHtmlElementAttributes()
Definition: Skin.php:482
Html\inlineScript
static inlineScript( $contents)
Output a "<script>" tag with the given contents.
Definition: Html.php:509
OutputPage\permissionRequired
permissionRequired( $permission)
Display an error page noting that a given permission bit is required.
Definition: OutputPage.php:2310
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:2483
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:3664
OutputPage\enableTOC
enableTOC( $flag=true)
Enables/disables TOC, doesn't override NOTOC
Definition: OutputPage.php:3734
OutputPage\transformCssMedia
static transformCssMedia( $media)
Transform "media" attribute based on request parameters.
Definition: OutputPage.php:3608
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>".
Definition: Html.php:218
Xml\encodeJsCall
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
Definition: Xml.php:665
Html\isXmlMimeType
static isXmlMimeType( $mimetype)
Determines if the given mime type is xml.
Definition: Html.php:791
OutputPage\readOnlyPage
readOnlyPage( $source=null, $protected=false, $reasons=array(), $action=null)
Display a page stating that the Wiki is in read-only mode, and optionally show the source of the page...
Definition: OutputPage.php:2381
OutputPage\$mPageTitleActionText
$mPageTitleActionText
Definition: OutputPage.php:205
OutputPage\showErrorPage
showErrorPage( $title, $msg, $params=array())
Output a standard error page.
Definition: OutputPage.php:2200
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:68
Html\openElement
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:159
OutputPage\getModuleMessages
getModuleMessages( $filter=false, $position=null)
Get the list of module messages to include on this page.
Definition: OutputPage.php:543
$lb
if( $wgAPIRequestLog) $lb
Definition: api.php:126
File
Implements some public methods and some protected utility functions which are required by multiple ch...
Definition: File.php:50
OutputPage\feedLink
feedLink( $type, $url, $text)
Generate a "<link rel/>" for a feed.
Definition: OutputPage.php:3407
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:3425
OutputPage\sendCacheControl
sendCacheControl()
Send cache control HTTP headers.
Definition: OutputPage.php:1951
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:2152
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1174
OutputPage\$mCdnMaxageLimit
int $mCdnMaxageLimit
Upper limit on mSquidMaxage *.
Definition: OutputPage.php:210
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2464
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:3794
OutputPage\output
output()
Finally, all the text has been munged and accumulated into the object, let's actually output it:
Definition: OutputPage.php:2033
OutputPage\$mEnableTOC
bool $mEnableTOC
Whether parser output should contain table of contents.
Definition: OutputPage.php:260
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:141
OutputPage\$mInlineStyles
$mInlineStyles
Inline CSS styles.
Definition: OutputPage.php:125
OutputPage\setFileVersion
setFileVersion( $file)
Set the displayed file version.
Definition: OutputPage.php:1466
OutputPage\showUnexpectedValueError
showUnexpectedValueError( $name, $val)
Definition: OutputPage.php:2471
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:2629
OutputPage\isTOCEnabled
isTOCEnabled()
Definition: OutputPage.php:3742
ContextSource
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
Definition: ContextSource.php:30
Html\linkedScript
static linkedScript( $url)
Output a "<script>" tag linking to the given URL, e.g., "<script src=foo.js></script>".
Definition: Html.php:526
TS_ISO_8601
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
Definition: GlobalFunctions.php:2495
OutputPage\$mAllowedModules
$mAllowedModules
Definition: OutputPage.php:159
ContextSource\getWikiPage
getWikiPage()
Get the WikiPage object.
Definition: ContextSource.php:112
OutputPage\setFeedAppendQuery
setFeedAppendQuery( $val)
Add default feeds to the page header This is mainly kept for backward compatibility,...
Definition: OutputPage.php:1055
OutputPage\isDisabled
isDisabled()
Return whether the output will be completely disabled.
Definition: OutputPage.php:1008
wfTimestampOrNull
wfTimestampOrNull( $outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.
Definition: GlobalFunctions.php:2548
OutputPage\setRevisionId
setRevisionId( $revid)
Set the revision ID which will be seen by the wiki text parser for things such as embedded {{REVISION...
Definition: OutputPage.php: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:4066
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:2024
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:2454
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:2330
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:93
ResourceLoader\makeLoaderURL
static makeLoaderURL( $modules, $lang, $skin, $user=null, $version=null, $debug=false, $only=null, $printable=false, $handheld=false, $extraQuery=array())
Build a load.php URL.
Definition: ResourceLoader.php:1212
$cookies
return false to override stock group removal can be modified modifiable will be added to $_SESSION & $cookies
Definition: hooks.txt:2849
ResourceLoaderModule\getOrigin
getOrigin()
Get this module's origin.
Definition: ResourceLoaderModule.php:97
OutputPage\addBacklinkSubtitle
addBacklinkSubtitle(Title $title)
Add a subtitle containing a backlink to a page.
Definition: OutputPage.php:955
ContextSource\setContext
setContext(IContextSource $context)
Set the IContextSource object.
Definition: ContextSource.php:57
OutputPage\addParserOutputNoText
addParserOutputNoText(&$parserOutput)
Add a ParserOutput object, but without Html.
Definition: OutputPage.php: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:1927
$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:3725
OutputPage\makeResourceLoaderLink
makeResourceLoaderLink( $modules, $only, $useESI=false, array $extraQuery=array(), $loadCall=false)
TODO: Document.
Definition: OutputPage.php:2645
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:3759
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:2225
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:2441
$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:3691
OutputPage\buildCssLinks
buildCssLinks()
Build a set of "<link>" elements for the stylesheets specified in the $this->styles array.
Definition: OutputPage.php:3460
Html\inlineStyle
static inlineStyle( $contents, $media='all')
Output a "<style>" tag with the given contents for the given media type (if any).
Definition: Html.php:540
OutputPage\filterModules
filterModules( $modules, $position=null, $type=ResourceLoaderModule::TYPE_COMBINED)
Filter an array of modules to remove insufficiently trustworthy members, and modules which are no lon...
Definition: OutputPage.php:445
OutputPage\prependHTML
prependHTML( $text)
Prepend $text to the body HTML.
Definition: OutputPage.php:1361
Linker\formatTemplates
static formatTemplates( $templates, $preview=false, $section=false, $more=null)
Returns HTML for the "templates used on this page" list.
Definition: Linker.php:1945
MWNamespace\exists
static exists( $index)
Returns whether the specified namespace exists.
Definition: Namespace.php:171
OutputPage\$mEnableClientCache
$mEnableClientCache
Definition: OutputPage.php:186
OutputPage\$mCategories
$mCategories
Definition: OutputPage.php:109
OutputPage\getHTMLTitle
getHTMLTitle()
Return the "HTML title", i.e.
Definition: OutputPage.php:861
OutputPage\showFileCopyError
showFileCopyError( $old, $new)
Definition: OutputPage.php:2475
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:2499
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:3446
$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:3157
Html\linkedStyle
static linkedStyle( $url, $media='all')
Output a "<link rel=stylesheet>" linking to the given URL for the given media type (if any).
Definition: Html.php:570
OutputPage\addExtensionStyle
addExtensionStyle( $url)
Register and add a stylesheet from an extension directory.
Definition: OutputPage.php:385
OutputPage\$mRedirectCode
$mRedirectCode
Definition: OutputPage.php:150
ResourceLoader\inDebugMode
static inDebugMode()
Determine whether debug mode was requested Order of priority is 1) request param, 2) cookie,...
Definition: ResourceLoader.php:1188
OutputPage\setLanguageLinks
setLanguageLinks( $newLinkArray)
Reset the language links and add new language links.
Definition: OutputPage.php:1170
OutputPage\setRedirectedFrom
setRedirectedFrom( $t)
Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
Definition: OutputPage.php:870
OutputPage\addWikiTextTitle
addWikiTextTitle( $text, Title $title, $linestart, $tidy=false, $interface=false)
Add wikitext with a custom Title object.
Definition: OutputPage.php: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:2867
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:3180
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:1917
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:2465
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:3019
OutputPage\$mPrintable
$mPrintable
Should be private.
Definition: OutputPage.php:77
Skin
The main skin class which provides methods and properties for all other skins.
Definition: Skin.php:35
$error
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
Definition: hooks.txt:2584
OutputPage\$mPagetitle
$mPagetitle
Should be private - has getter and setter. Contains the HTML title.
Definition: OutputPage.php:49
Html\rawElement
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
Definition: Html.php:121
$query
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1105
OutputPage\$mRevisionTimestamp
$mRevisionTimestamp
Definition: OutputPage.php:217
OutputPage\getJsConfigVars
getJsConfigVars()
Get the javascript config vars to include on this page.
Definition: OutputPage.php:3009
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:1844
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:2175
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:2543
$type
$type
Definition: testCompression.php:46
OutputPage\getCategories
getCategories()
Get the list of category names this page belongs to.
Definition: OutputPage.php:1271