MediaWiki  1.23.12
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;
212 
213  // @todo document
214  var $mPreventClickjacking = true;
215 
217  var $mRevisionId = null;
218  private $mRevisionTimestamp = null;
219 
220  var $mFileVersion = null;
221 
230  var $styles = array();
231 
235  protected $mJQueryDone = false;
236 
237  private $mIndexPolicy = 'index';
238  private $mFollowPolicy = 'follow';
239  private $mVaryHeader = array(
240  'Accept-Encoding' => array( 'list-contains=gzip' ),
241  );
242 
249  private $mRedirectedFrom = null;
250 
254  private $mProperties = array();
255 
259  private $mTarget = null;
260 
264  private $mEnableTOC = true;
265 
269  private $mEnableSectionEditLinks = true;
270 
276  function __construct( IContextSource $context = null ) {
277  if ( $context === null ) {
278  # Extensions should use `new RequestContext` instead of `new OutputPage` now.
279  wfDeprecated( __METHOD__, '1.18' );
280  } else {
281  $this->setContext( $context );
282  }
283  }
284 
291  public function redirect( $url, $responsecode = '302' ) {
292  # Strip newlines as a paranoia check for header injection in PHP<5.1.2
293  $this->mRedirect = str_replace( "\n", '', $url );
294  $this->mRedirectCode = $responsecode;
295  }
296 
302  public function getRedirect() {
303  return $this->mRedirect;
304  }
305 
311  public function setStatusCode( $statusCode ) {
312  $this->mStatusCode = $statusCode;
313  }
314 
322  function addMeta( $name, $val ) {
323  array_push( $this->mMetatags, array( $name, $val ) );
324  }
325 
333  function addLink( $linkarr ) {
334  array_push( $this->mLinktags, $linkarr );
335  }
336 
344  function addMetadataLink( $linkarr ) {
345  $linkarr['rel'] = $this->getMetadataAttribute();
346  $this->addLink( $linkarr );
347  }
348 
353  function setCanonicalUrl( $url ) {
354  $this->mCanonicalUrl = $url;
355  }
356 
362  public function getMetadataAttribute() {
363  # note: buggy CC software only reads first "meta" link
364  static $haveMeta = false;
365  if ( $haveMeta ) {
366  return 'alternate meta';
367  } else {
368  $haveMeta = true;
369  return 'meta';
370  }
371  }
372 
378  function addScript( $script ) {
379  $this->mScripts .= $script . "\n";
380  }
381 
390  public function addExtensionStyle( $url ) {
391  array_push( $this->mExtStyles, $url );
392  }
393 
399  function getExtStyle() {
400  return $this->mExtStyles;
401  }
402 
410  public function addScriptFile( $file, $version = null ) {
411  global $wgStylePath, $wgStyleVersion;
412  // See if $file parameter is an absolute URL or begins with a slash
413  if ( substr( $file, 0, 1 ) == '/' || preg_match( '#^[a-z]*://#i', $file ) ) {
414  $path = $file;
415  } else {
416  $path = "{$wgStylePath}/common/{$file}";
417  }
418  if ( is_null( $version ) ) {
419  $version = $wgStyleVersion;
420  }
422  }
423 
429  public function addInlineScript( $script ) {
430  $this->mScripts .= Html::inlineScript( "\n$script\n" ) . "\n";
431  }
432 
438  function getScript() {
439  return $this->mScripts . $this->getHeadItems();
440  }
441 
450  protected function filterModules( $modules, $position = null, $type = ResourceLoaderModule::TYPE_COMBINED ) {
452  $filteredModules = array();
453  foreach ( $modules as $val ) {
454  $module = $resourceLoader->getModule( $val );
455  if ( $module instanceof ResourceLoaderModule
456  && $module->getOrigin() <= $this->getAllowedModules( $type )
457  && ( is_null( $position ) || $module->getPosition() == $position )
458  && ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) )
459  ) {
460  $filteredModules[] = $val;
461  }
462  }
463  return $filteredModules;
464  }
465 
474  public function getModules( $filter = false, $position = null, $param = 'mModules' ) {
475  $modules = array_values( array_unique( $this->$param ) );
476  return $filter
477  ? $this->filterModules( $modules, $position )
478  : $modules;
479  }
480 
488  public function addModules( $modules ) {
489  $this->mModules = array_merge( $this->mModules, (array)$modules );
490  }
491 
500  public function getModuleScripts( $filter = false, $position = null ) {
501  return $this->getModules( $filter, $position, 'mModuleScripts' );
502  }
503 
511  public function addModuleScripts( $modules ) {
512  $this->mModuleScripts = array_merge( $this->mModuleScripts, (array)$modules );
513  }
514 
523  public function getModuleStyles( $filter = false, $position = null ) {
524  return $this->getModules( $filter, $position, 'mModuleStyles' );
525  }
526 
536  public function addModuleStyles( $modules ) {
537  $this->mModuleStyles = array_merge( $this->mModuleStyles, (array)$modules );
538  }
539 
548  public function getModuleMessages( $filter = false, $position = null ) {
549  return $this->getModules( $filter, $position, 'mModuleMessages' );
550  }
551 
559  public function addModuleMessages( $modules ) {
560  $this->mModuleMessages = array_merge( $this->mModuleMessages, (array)$modules );
561  }
562 
566  public function getTarget() {
567  return $this->mTarget;
568  }
569 
575  public function setTarget( $target ) {
576  $this->mTarget = $target;
577  }
578 
584  function getHeadItemsArray() {
585  return $this->mHeadItems;
586  }
587 
593  function getHeadItems() {
594  $s = '';
595  foreach ( $this->mHeadItems as $item ) {
596  $s .= $item;
597  }
598  return $s;
599  }
600 
607  public function addHeadItem( $name, $value ) {
608  $this->mHeadItems[$name] = $value;
609  }
610 
617  public function hasHeadItem( $name ) {
618  return isset( $this->mHeadItems[$name] );
619  }
620 
626  function setETag( $tag ) {
627  $this->mETag = $tag;
628  }
629 
637  public function setArticleBodyOnly( $only ) {
638  $this->mArticleBodyOnly = $only;
639  }
640 
646  public function getArticleBodyOnly() {
648  }
649 
657  public function setProperty( $name, $value ) {
658  $this->mProperties[$name] = $value;
659  }
660 
668  public function getProperty( $name ) {
669  if ( isset( $this->mProperties[$name] ) ) {
670  return $this->mProperties[$name];
671  } else {
672  return null;
673  }
674  }
675 
687  public function checkLastModified( $timestamp ) {
688  global $wgCachePages, $wgCacheEpoch, $wgUseSquid, $wgSquidMaxage;
689 
690  if ( !$timestamp || $timestamp == '19700101000000' ) {
691  wfDebug( __METHOD__ . ": CACHE DISABLED, NO TIMESTAMP\n" );
692  return false;
693  }
694  if ( !$wgCachePages ) {
695  wfDebug( __METHOD__ . ": CACHE DISABLED\n" );
696  return false;
697  }
698 
700  $modifiedTimes = array(
701  'page' => $timestamp,
702  'user' => $this->getUser()->getTouched(),
703  'epoch' => $wgCacheEpoch
704  );
705  if ( $wgUseSquid ) {
706  // bug 44570: the core page itself may not change, but resources might
707  $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $wgSquidMaxage );
708  }
709  wfRunHooks( 'OutputPageCheckLastModified', array( &$modifiedTimes ) );
710 
711  $maxModified = max( $modifiedTimes );
712  $this->mLastModified = wfTimestamp( TS_RFC2822, $maxModified );
713 
714  $clientHeader = $this->getRequest()->getHeader( 'If-Modified-Since' );
715  if ( $clientHeader === false ) {
716  wfDebug( __METHOD__ . ": client did not send If-Modified-Since header\n", 'log' );
717  return false;
718  }
719 
720  # IE sends sizes after the date like this:
721  # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
722  # this breaks strtotime().
723  $clientHeader = preg_replace( '/;.*$/', '', $clientHeader );
724 
725  wfSuppressWarnings(); // E_STRICT system time bitching
726  $clientHeaderTime = strtotime( $clientHeader );
728  if ( !$clientHeaderTime ) {
729  wfDebug( __METHOD__ . ": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
730  return false;
731  }
732  $clientHeaderTime = wfTimestamp( TS_MW, $clientHeaderTime );
733 
734  # Make debug info
735  $info = '';
736  foreach ( $modifiedTimes as $name => $value ) {
737  if ( $info !== '' ) {
738  $info .= ', ';
739  }
740  $info .= "$name=" . wfTimestamp( TS_ISO_8601, $value );
741  }
742 
743  wfDebug( __METHOD__ . ": client sent If-Modified-Since: " .
744  wfTimestamp( TS_ISO_8601, $clientHeaderTime ) . "\n", 'log' );
745  wfDebug( __METHOD__ . ": effective Last-Modified: " .
746  wfTimestamp( TS_ISO_8601, $maxModified ) . "\n", 'log' );
747  if ( $clientHeaderTime < $maxModified ) {
748  wfDebug( __METHOD__ . ": STALE, $info\n", 'log' );
749  return false;
750  }
751 
752  # Not modified
753  # Give a 304 response code and disable body output
754  wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", 'log' );
755  ini_set( 'zlib.output_compression', 0 );
756  $this->getRequest()->response()->header( "HTTP/1.1 304 Not Modified" );
757  $this->sendCacheControl();
758  $this->disable();
759 
760  // Don't output a compressed blob when using ob_gzhandler;
761  // it's technically against HTTP spec and seems to confuse
762  // Firefox when the response gets split over two packets.
764 
765  return true;
766  }
767 
774  public function setLastModified( $timestamp ) {
775  $this->mLastModified = wfTimestamp( TS_RFC2822, $timestamp );
776  }
777 
786  public function setRobotPolicy( $policy ) {
787  $policy = Article::formatRobotPolicy( $policy );
788 
789  if ( isset( $policy['index'] ) ) {
790  $this->setIndexPolicy( $policy['index'] );
791  }
792  if ( isset( $policy['follow'] ) ) {
793  $this->setFollowPolicy( $policy['follow'] );
794  }
795  }
796 
804  public function setIndexPolicy( $policy ) {
805  $policy = trim( $policy );
806  if ( in_array( $policy, array( 'index', 'noindex' ) ) ) {
807  $this->mIndexPolicy = $policy;
808  }
809  }
810 
818  public function setFollowPolicy( $policy ) {
819  $policy = trim( $policy );
820  if ( in_array( $policy, array( 'follow', 'nofollow' ) ) ) {
821  $this->mFollowPolicy = $policy;
822  }
823  }
824 
831  public function setPageTitleActionText( $text ) {
832  $this->mPageTitleActionText = $text;
833  }
834 
840  public function getPageTitleActionText() {
841  if ( isset( $this->mPageTitleActionText ) ) {
843  }
844  return '';
845  }
846 
853  public function setHTMLTitle( $name ) {
854  if ( $name instanceof Message ) {
855  $this->mHTMLtitle = $name->setContext( $this->getContext() )->text();
856  } else {
857  $this->mHTMLtitle = $name;
858  }
859  }
860 
866  public function getHTMLTitle() {
867  return $this->mHTMLtitle;
868  }
869 
875  public function setRedirectedFrom( $t ) {
876  $this->mRedirectedFrom = $t;
877  }
878 
887  public function setPageTitle( $name ) {
888  if ( $name instanceof Message ) {
889  $name = $name->setContext( $this->getContext() )->text();
890  }
891 
892  # change "<script>foo&bar</script>" to "&lt;script&gt;foo&amp;bar&lt;/script&gt;"
893  # but leave "<i>foobar</i>" alone
895  $this->mPagetitle = $nameWithTags;
896 
897  # change "<i>foo&amp;bar</i>" to "foo&bar"
898  $this->setHTMLTitle(
899  $this->msg( 'pagetitle' )->rawParams( Sanitizer::stripAllTags( $nameWithTags ) )
900  ->inContentLanguage()
901  );
902  }
903 
909  public function getPageTitle() {
910  return $this->mPagetitle;
911  }
912 
918  public function setTitle( Title $t ) {
919  $this->getContext()->setTitle( $t );
920  }
921 
927  public function setSubtitle( $str ) {
928  $this->clearSubtitle();
929  $this->addSubtitle( $str );
930  }
931 
938  public function appendSubtitle( $str ) {
939  $this->addSubtitle( $str );
940  }
941 
947  public function addSubtitle( $str ) {
948  if ( $str instanceof Message ) {
949  $this->mSubtitle[] = $str->setContext( $this->getContext() )->parse();
950  } else {
951  $this->mSubtitle[] = $str;
952  }
953  }
954 
960  public function addBacklinkSubtitle( Title $title ) {
961  $query = array();
962  if ( $title->isRedirect() ) {
963  $query['redirect'] = 'no';
964  }
965  $this->addSubtitle( $this->msg( 'backlinksubtitle' )->rawParams( Linker::link( $title, null, array(), $query ) ) );
966  }
967 
971  public function clearSubtitle() {
972  $this->mSubtitle = array();
973  }
974 
980  public function getSubtitle() {
981  return implode( "<br />\n\t\t\t\t", $this->mSubtitle );
982  }
983 
988  public function setPrintable() {
989  $this->mPrintable = true;
990  }
991 
997  public function isPrintable() {
999  }
1000 
1004  public function disable() {
1005  $this->mDoNothing = true;
1006  }
1013  public function isDisabled() {
1014  return $this->mDoNothing;
1015  }
1022  public function showNewSectionLink() {
1023  return $this->mNewSectionLink;
1024  }
1031  public function forceHideNewSectionLink() {
1033  }
1034 
1043  public function setSyndicated( $show = true ) {
1044  if ( $show ) {
1045  $this->setFeedAppendQuery( false );
1046  } else {
1047  $this->mFeedLinks = array();
1048  }
1049  }
1050 
1060  public function setFeedAppendQuery( $val ) {
1061  global $wgAdvertisedFeedTypes;
1062 
1063  $this->mFeedLinks = array();
1064 
1065  foreach ( $wgAdvertisedFeedTypes as $type ) {
1066  $query = "feed=$type";
1067  if ( is_string( $val ) ) {
1068  $query .= '&' . $val;
1069  }
1070  $this->mFeedLinks[$type] = $this->getTitle()->getLocalURL( $query );
1071  }
1072  }
1073 
1080  public function addFeedLink( $format, $href ) {
1081  global $wgAdvertisedFeedTypes;
1082 
1083  if ( in_array( $format, $wgAdvertisedFeedTypes ) ) {
1084  $this->mFeedLinks[$format] = $href;
1085  }
1086  }
1087 
1092  public function isSyndicated() {
1093  return count( $this->mFeedLinks ) > 0;
1094  }
1095 
1100  public function getSyndicationLinks() {
1101  return $this->mFeedLinks;
1102  }
1109  public function getFeedAppendQuery() {
1111  }
1112 
1120  public function setArticleFlag( $v ) {
1121  $this->mIsarticle = $v;
1122  if ( $v ) {
1123  $this->mIsArticleRelated = $v;
1124  }
1125  }
1126 
1133  public function isArticle() {
1134  return $this->mIsarticle;
1135  }
1136 
1143  public function setArticleRelated( $v ) {
1144  $this->mIsArticleRelated = $v;
1145  if ( !$v ) {
1146  $this->mIsarticle = false;
1147  }
1148  }
1155  public function isArticleRelated() {
1156  return $this->mIsArticleRelated;
1157  }
1158 
1165  public function addLanguageLinks( $newLinkArray ) {
1166  $this->mLanguageLinks += $newLinkArray;
1167  }
1168 
1175  public function setLanguageLinks( $newLinkArray ) {
1176  $this->mLanguageLinks = $newLinkArray;
1177  }
1184  public function getLanguageLinks() {
1185  return $this->mLanguageLinks;
1186  }
1193  public function addCategoryLinks( $categories ) {
1195 
1196  if ( !is_array( $categories ) || count( $categories ) == 0 ) {
1197  return;
1198  }
1199 
1200  # Add the links to a LinkBatch
1201  $arr = array( NS_CATEGORY => $categories );
1202  $lb = new LinkBatch;
1203  $lb->setArray( $arr );
1204 
1205  # Fetch existence plus the hiddencat property
1206  $dbr = wfGetDB( DB_SLAVE );
1207  $res = $dbr->select( array( 'page', 'page_props' ),
1208  array( 'page_id', 'page_namespace', 'page_title', 'page_len', 'page_is_redirect', 'page_latest', 'pp_value' ),
1209  $lb->constructSet( 'page', $dbr ),
1210  __METHOD__,
1211  array(),
1212  array( 'page_props' => array( 'LEFT JOIN', array( 'pp_propname' => 'hiddencat', 'pp_page = page_id' ) ) )
1213  );
1214 
1215  # Add the results to the link cache
1216  $lb->addResultToCache( LinkCache::singleton(), $res );
1217 
1218  # Set all the values to 'normal'. This can be done with array_fill_keys in PHP 5.2.0+
1219  $categories = array_combine(
1220  array_keys( $categories ),
1221  array_fill( 0, count( $categories ), 'normal' )
1222  );
1223 
1224  # Mark hidden categories
1225  foreach ( $res as $row ) {
1226  if ( isset( $row->pp_value ) ) {
1227  $categories[$row->page_title] = 'hidden';
1228  }
1229  }
1230 
1231  # Add the remaining categories to the skin
1232  if ( wfRunHooks( 'OutputPageMakeCategoryLinks', array( &$this, $categories, &$this->mCategoryLinks ) ) ) {
1233  foreach ( $categories as $category => $type ) {
1234  $origcategory = $category;
1235  $title = Title::makeTitleSafe( NS_CATEGORY, $category );
1236  $wgContLang->findVariantLink( $category, $title, true );
1237  if ( $category != $origcategory ) {
1238  if ( array_key_exists( $category, $categories ) ) {
1239  continue;
1240  }
1241  }
1242  $text = $wgContLang->convertHtml( $title->getText() );
1243  $this->mCategories[] = $title->getText();
1244  $this->mCategoryLinks[$type][] = Linker::link( $title, $text );
1245  }
1246  }
1247  }
1254  public function setCategoryLinks( $categories ) {
1255  $this->mCategoryLinks = array();
1256  $this->addCategoryLinks( $categories );
1257  }
1258 
1267  public function getCategoryLinks() {
1268  return $this->mCategoryLinks;
1269  }
1276  public function getCategories() {
1277  return $this->mCategories;
1278  }
1279 
1288  public function disallowUserJs() {
1289  $this->reduceAllowedModules(
1292  );
1293 
1294  // Site-wide styles are controlled by a config setting, see bug 71621
1295  // for background on why. User styles are never allowed.
1296  if ( $this->getConfig()->get( 'AllowSiteCSSOnRestrictedPages' ) ) {
1298  } else {
1300  }
1301  $this->reduceAllowedModules(
1303  $styleOrigin
1304  );
1305  }
1306 
1313  public function isUserJsAllowed() {
1314  wfDeprecated( __METHOD__, '1.18' );
1316  }
1317 
1325  public function getAllowedModules( $type ) {
1327  return min( array_values( $this->mAllowedModules ) );
1328  } else {
1329  return isset( $this->mAllowedModules[$type] )
1330  ? $this->mAllowedModules[$type]
1332  }
1333  }
1334 
1343  public function setAllowedModules( $type, $level ) {
1344  wfDeprecated( __METHOD__, '1.24' );
1345  $this->reduceAllowedModules( $type, $level );
1346  }
1347 
1357  public function reduceAllowedModules( $type, $level ) {
1358  $this->mAllowedModules[$type] = min( $this->getAllowedModules( $type ), $level );
1359  }
1366  public function prependHTML( $text ) {
1367  $this->mBodytext = $text . $this->mBodytext;
1368  }
1375  public function addHTML( $text ) {
1376  $this->mBodytext .= $text;
1377  }
1378 
1388  public function addElement( $element, $attribs = array(), $contents = '' ) {
1389  $this->addHTML( Html::element( $element, $attribs, $contents ) );
1390  }
1391 
1395  public function clearHTML() {
1396  $this->mBodytext = '';
1397  }
1404  public function getHTML() {
1405  return $this->mBodytext;
1406  }
1407 
1415  public function parserOptions( $options = null ) {
1416  if ( !$this->mParserOptions ) {
1417  $this->mParserOptions = ParserOptions::newFromContext( $this->getContext() );
1418  $this->mParserOptions->setEditSection( false );
1419  }
1420  return wfSetVar( $this->mParserOptions, $options );
1421  }
1422 
1430  public function setRevisionId( $revid ) {
1431  $val = is_null( $revid ) ? null : intval( $revid );
1432  return wfSetVar( $this->mRevisionId, $val );
1433  }
1440  public function getRevisionId() {
1441  return $this->mRevisionId;
1442  }
1443 
1451  public function setRevisionTimestamp( $timestamp ) {
1452  return wfSetVar( $this->mRevisionTimestamp, $timestamp );
1453  }
1454 
1461  public function getRevisionTimestamp() {
1463  }
1464 
1471  public function setFileVersion( $file ) {
1472  $val = null;
1473  if ( $file instanceof File && $file->exists() ) {
1474  $val = array( 'time' => $file->getTimestamp(), 'sha1' => $file->getSha1() );
1475  }
1476  return wfSetVar( $this->mFileVersion, $val, true );
1477  }
1484  public function getFileVersion() {
1485  return $this->mFileVersion;
1486  }
1487 
1494  public function getTemplateIds() {
1495  return $this->mTemplateIds;
1496  }
1497 
1504  public function getFileSearchOptions() {
1505  return $this->mImageTimeKeys;
1506  }
1507 
1516  public function addWikiText( $text, $linestart = true, $interface = true ) {
1517  $title = $this->getTitle(); // Work around E_STRICT
1518  if ( !$title ) {
1519  throw new MWException( 'Title is null' );
1520  }
1521  $this->addWikiTextTitle( $text, $title, $linestart, /*tidy*/false, $interface );
1522  }
1523 
1531  public function addWikiTextWithTitle( $text, &$title, $linestart = true ) {
1532  $this->addWikiTextTitle( $text, $title, $linestart );
1533  }
1534 
1542  function addWikiTextTitleTidy( $text, &$title, $linestart = true ) {
1543  $this->addWikiTextTitle( $text, $title, $linestart, true );
1544  }
1545 
1552  public function addWikiTextTidy( $text, $linestart = true ) {
1553  $title = $this->getTitle();
1554  $this->addWikiTextTitleTidy( $text, $title, $linestart );
1555  }
1556 
1567  public function addWikiTextTitle( $text, Title $title, $linestart, $tidy = false, $interface = false ) {
1568  global $wgParser;
1569 
1570  wfProfileIn( __METHOD__ );
1571 
1572  $popts = $this->parserOptions();
1573  $oldTidy = $popts->setTidy( $tidy );
1574  $popts->setInterfaceMessage( (bool)$interface );
1575 
1576  $parserOutput = $wgParser->parse(
1577  $text, $title, $popts,
1578  $linestart, true, $this->mRevisionId
1579  );
1580 
1581  $popts->setTidy( $oldTidy );
1582 
1583  $this->addParserOutput( $parserOutput );
1584 
1585  wfProfileOut( __METHOD__ );
1586  }
1593  public function addParserOutputNoText( &$parserOutput ) {
1594  $this->mLanguageLinks += $parserOutput->getLanguageLinks();
1595  $this->addCategoryLinks( $parserOutput->getCategories() );
1596  $this->mNewSectionLink = $parserOutput->getNewSection();
1597  $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
1598 
1599  $this->mParseWarnings = $parserOutput->getWarnings();
1600  if ( !$parserOutput->isCacheable() ) {
1601  $this->enableClientCache( false );
1602  }
1603  $this->mNoGallery = $parserOutput->getNoGallery();
1604  $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
1605  $this->addModules( $parserOutput->getModules() );
1606  $this->addModuleScripts( $parserOutput->getModuleScripts() );
1607  $this->addModuleStyles( $parserOutput->getModuleStyles() );
1608  $this->addModuleMessages( $parserOutput->getModuleMessages() );
1609  $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
1610  $this->mPreventClickjacking = $this->mPreventClickjacking
1611  || $parserOutput->preventClickjacking();
1612 
1613  // Template versioning...
1614  foreach ( (array)$parserOutput->getTemplateIds() as $ns => $dbks ) {
1615  if ( isset( $this->mTemplateIds[$ns] ) ) {
1616  $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1617  } else {
1618  $this->mTemplateIds[$ns] = $dbks;
1619  }
1620  }
1621  // File versioning...
1622  foreach ( (array)$parserOutput->getFileSearchOptions() as $dbk => $data ) {
1623  $this->mImageTimeKeys[$dbk] = $data;
1624  }
1625 
1626  // Hooks registered in the object
1627  global $wgParserOutputHooks;
1628  foreach ( $parserOutput->getOutputHooks() as $hookInfo ) {
1629  list( $hookName, $data ) = $hookInfo;
1630  if ( isset( $wgParserOutputHooks[$hookName] ) ) {
1631  call_user_func( $wgParserOutputHooks[$hookName], $this, $parserOutput, $data );
1632  }
1633  }
1634 
1635  // Link flags are ignored for now, but may in the future be
1636  // used to mark individual language links.
1637  $linkFlags = array();
1638  wfRunHooks( 'LanguageLinks', array( $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ) );
1639  wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) );
1640  }
1647  function addParserOutput( &$parserOutput ) {
1648  $this->addParserOutputNoText( $parserOutput );
1649  $parserOutput->setTOCEnabled( $this->mEnableTOC );
1650 
1651  // Touch section edit links only if not previously disabled
1652  if ( $parserOutput->getEditSectionTokens() ) {
1653  $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks );
1654  }
1655  $text = $parserOutput->getText();
1656  wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
1657  $this->addHTML( $text );
1658  }
1665  public function addTemplate( &$template ) {
1666  $this->addHTML( $template->getHTML() );
1667  }
1668 
1681  public function parse( $text, $linestart = true, $interface = false, $language = null ) {
1682  global $wgParser;
1683 
1684  if ( is_null( $this->getTitle() ) ) {
1685  throw new MWException( 'Empty $mTitle in ' . __METHOD__ );
1686  }
1687 
1688  $popts = $this->parserOptions();
1689  if ( $interface ) {
1690  $popts->setInterfaceMessage( true );
1691  }
1692  if ( $language !== null ) {
1693  $oldLang = $popts->setTargetLanguage( $language );
1694  }
1695 
1696  $parserOutput = $wgParser->parse(
1697  $text, $this->getTitle(), $popts,
1698  $linestart, true, $this->mRevisionId
1699  );
1700 
1701  if ( $interface ) {
1702  $popts->setInterfaceMessage( false );
1703  }
1704  if ( $language !== null ) {
1705  $popts->setTargetLanguage( $oldLang );
1706  }
1707 
1708  return $parserOutput->getText();
1709  }
1710 
1721  public function parseInline( $text, $linestart = true, $interface = false ) {
1722  $parsed = $this->parse( $text, $linestart, $interface );
1723 
1724  $m = array();
1725  if ( preg_match( '/^<p>(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) {
1726  $parsed = $m[1];
1727  }
1728 
1729  return $parsed;
1730  }
1737  public function setSquidMaxage( $maxage ) {
1738  $this->mSquidMaxage = $maxage;
1739  }
1740 
1748  public function enableClientCache( $state ) {
1749  return wfSetVar( $this->mEnableClientCache, $state );
1750  }
1757  function getCacheVaryCookies() {
1758  global $wgCookiePrefix, $wgCacheVaryCookies;
1759  static $cookies;
1760  if ( $cookies === null ) {
1761  $cookies = array_merge(
1762  array(
1763  "{$wgCookiePrefix}Token",
1764  "{$wgCookiePrefix}LoggedOut",
1765  "forceHTTPS",
1766  session_name()
1767  ),
1768  $wgCacheVaryCookies
1769  );
1770  wfRunHooks( 'GetCacheVaryCookies', array( $this, &$cookies ) );
1771  }
1772  return $cookies;
1773  }
1774 
1781  function haveCacheVaryCookies() {
1782  $cookieHeader = $this->getRequest()->getHeader( 'cookie' );
1783  if ( $cookieHeader === false ) {
1784  return false;
1785  }
1786  $cvCookies = $this->getCacheVaryCookies();
1787  foreach ( $cvCookies as $cookieName ) {
1788  # Check for a simple string match, like the way squid does it
1789  if ( strpos( $cookieHeader, $cookieName ) !== false ) {
1790  wfDebug( __METHOD__ . ": found $cookieName\n" );
1791  return true;
1792  }
1793  }
1794  wfDebug( __METHOD__ . ": no cache-varying cookies found\n" );
1795  return false;
1796  }
1797 
1806  public function addVaryHeader( $header, $option = null ) {
1807  if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
1808  $this->mVaryHeader[$header] = (array)$option;
1809  } elseif ( is_array( $option ) ) {
1810  if ( is_array( $this->mVaryHeader[$header] ) ) {
1811  $this->mVaryHeader[$header] = array_merge( $this->mVaryHeader[$header], $option );
1812  } else {
1813  $this->mVaryHeader[$header] = $option;
1814  }
1815  }
1816  $this->mVaryHeader[$header] = array_unique( (array)$this->mVaryHeader[$header] );
1817  }
1818 
1825  public function getVaryHeader() {
1826  return 'Vary: ' . join( ', ', array_keys( $this->mVaryHeader ) );
1827  }
1834  public function getXVO() {
1835  $cvCookies = $this->getCacheVaryCookies();
1836 
1837  $cookiesOption = array();
1838  foreach ( $cvCookies as $cookieName ) {
1839  $cookiesOption[] = 'string-contains=' . $cookieName;
1840  }
1841  $this->addVaryHeader( 'Cookie', $cookiesOption );
1842 
1843  $headers = array();
1844  foreach ( $this->mVaryHeader as $header => $option ) {
1845  $newheader = $header;
1846  if ( is_array( $option ) && count( $option ) > 0 ) {
1847  $newheader .= ';' . implode( ';', $option );
1848  }
1849  $headers[] = $newheader;
1850  }
1851  $xvo = 'X-Vary-Options: ' . implode( ',', $headers );
1852 
1853  return $xvo;
1854  }
1855 
1864  function addAcceptLanguage() {
1865  $lang = $this->getTitle()->getPageLanguage();
1866  if ( !$this->getRequest()->getCheck( 'variant' ) && $lang->hasVariants() ) {
1867  $variants = $lang->getVariants();
1868  $aloption = array();
1869  foreach ( $variants as $variant ) {
1870  if ( $variant === $lang->getCode() ) {
1871  continue;
1872  } else {
1873  $aloption[] = 'string-contains=' . $variant;
1874 
1875  // IE and some other browsers use BCP 47 standards in
1876  // their Accept-Language header, like "zh-CN" or "zh-Hant".
1877  // We should handle these too.
1878  $variantBCP47 = wfBCP47( $variant );
1879  if ( $variantBCP47 !== $variant ) {
1880  $aloption[] = 'string-contains=' . $variantBCP47;
1881  }
1882  }
1883  }
1884  $this->addVaryHeader( 'Accept-Language', $aloption );
1885  }
1886  }
1887 
1898  public function preventClickjacking( $enable = true ) {
1899  $this->mPreventClickjacking = $enable;
1900  }
1907  public function allowClickjacking() {
1908  $this->mPreventClickjacking = false;
1909  }
1910 
1917  public function getPreventClickjacking() {
1919  }
1920 
1928  public function getFrameOptions() {
1929  global $wgBreakFrames, $wgEditPageFrameOptions;
1930  if ( $wgBreakFrames ) {
1931  return 'DENY';
1932  } elseif ( $this->mPreventClickjacking && $wgEditPageFrameOptions ) {
1933  return $wgEditPageFrameOptions;
1934  }
1935  return false;
1936  }
1937 
1941  public function sendCacheControl() {
1942  global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgUseXVO;
1943 
1944  $response = $this->getRequest()->response();
1945  if ( $wgUseETag && $this->mETag ) {
1946  $response->header( "ETag: $this->mETag" );
1947  }
1948 
1949  $this->addVaryHeader( 'Cookie' );
1950  $this->addAcceptLanguage();
1951 
1952  # don't serve compressed data to clients who can't handle it
1953  # maintain different caches for logged-in users and non-logged in ones
1954  $response->header( $this->getVaryHeader() );
1955 
1956  if ( $wgUseXVO ) {
1957  # Add an X-Vary-Options header for Squid with Wikimedia patches
1958  $response->header( $this->getXVO() );
1959  }
1960 
1961  if ( $this->mEnableClientCache ) {
1962  if (
1963  $wgUseSquid && session_id() == '' && !$this->isPrintable() &&
1964  $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies()
1965  ) {
1966  if ( $wgUseESI ) {
1967  # We'll purge the proxy cache explicitly, but require end user agents
1968  # to revalidate against the proxy on each visit.
1969  # Surrogate-Control controls our Squid, Cache-Control downstream caches
1970  wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", 'log' );
1971  # start with a shorter timeout for initial testing
1972  # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
1973  $response->header( 'Surrogate-Control: max-age=' . $wgSquidMaxage . '+' . $this->mSquidMaxage . ', content="ESI/1.0"' );
1974  $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
1975  } else {
1976  # We'll purge the proxy cache for anons explicitly, but require end user agents
1977  # to revalidate against the proxy on each visit.
1978  # IMPORTANT! The Squid needs to replace the Cache-Control header with
1979  # Cache-Control: s-maxage=0, must-revalidate, max-age=0
1980  wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **\n", 'log' );
1981  # start with a shorter timeout for initial testing
1982  # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
1983  $response->header( 'Cache-Control: s-maxage=' . $this->mSquidMaxage . ', must-revalidate, max-age=0' );
1984  }
1985  } else {
1986  # We do want clients to cache if they can, but they *must* check for updates
1987  # on revisiting the page.
1988  wfDebug( __METHOD__ . ": private caching; {$this->mLastModified} **\n", 'log' );
1989  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
1990  $response->header( "Cache-Control: private, must-revalidate, max-age=0" );
1991  }
1992  if ( $this->mLastModified ) {
1993  $response->header( "Last-Modified: {$this->mLastModified}" );
1994  }
1995  } else {
1996  wfDebug( __METHOD__ . ": no caching **\n", 'log' );
1997 
1998  # In general, the absence of a last modified header should be enough to prevent
1999  # the client from using its cache. We send a few other things just to make sure.
2000  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
2001  $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
2002  $response->header( 'Pragma: no-cache' );
2003  }
2004  }
2005 
2014  public static function getStatusMessage( $code ) {
2015  wfDeprecated( __METHOD__, '1.18' );
2016  return HttpStatus::getMessage( $code );
2017  }
2018 
2023  public function output() {
2024  global $wgLanguageCode, $wgDebugRedirects, $wgMimeType, $wgVaryOnXFP,
2025  $wgUseAjax, $wgResponsiveImages;
2026 
2027  if ( $this->mDoNothing ) {
2028  return;
2029  }
2030 
2031  wfProfileIn( __METHOD__ );
2032 
2033  $response = $this->getRequest()->response();
2034 
2035  if ( $this->mRedirect != '' ) {
2036  # Standards require redirect URLs to be absolute
2037  $this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT );
2038 
2039  $redirect = $this->mRedirect;
2040  $code = $this->mRedirectCode;
2041 
2042  if ( wfRunHooks( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) {
2043  if ( $code == '301' || $code == '303' ) {
2044  if ( !$wgDebugRedirects ) {
2045  $message = HttpStatus::getMessage( $code );
2046  $response->header( "HTTP/1.1 $code $message" );
2047  }
2048  $this->mLastModified = wfTimestamp( TS_RFC2822 );
2049  }
2050  if ( $wgVaryOnXFP ) {
2051  $this->addVaryHeader( 'X-Forwarded-Proto' );
2052  }
2053  $this->sendCacheControl();
2054 
2055  $response->header( "Content-Type: text/html; charset=utf-8" );
2056  if ( $wgDebugRedirects ) {
2057  $url = htmlspecialchars( $redirect );
2058  print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2059  print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2060  print "</body>\n</html>\n";
2061  } else {
2062  $response->header( 'Location: ' . $redirect );
2063  }
2064  }
2065 
2066  wfProfileOut( __METHOD__ );
2067  return;
2068  } elseif ( $this->mStatusCode ) {
2069  $message = HttpStatus::getMessage( $this->mStatusCode );
2070  if ( $message ) {
2071  $response->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message );
2072  }
2073  }
2074 
2075  # Buffer output; final headers may depend on later processing
2076  ob_start();
2077 
2078  $response->header( "Content-type: $wgMimeType; charset=UTF-8" );
2079  $response->header( 'Content-language: ' . $wgLanguageCode );
2080 
2081  // Prevent framing, if requested
2082  $frameOptions = $this->getFrameOptions();
2083  if ( $frameOptions ) {
2084  $response->header( "X-Frame-Options: $frameOptions" );
2085  }
2086 
2087  if ( $this->mArticleBodyOnly ) {
2088  echo $this->mBodytext;
2089  } else {
2090 
2091  $sk = $this->getSkin();
2092  // add skin specific modules
2093  $modules = $sk->getDefaultModules();
2094 
2095  // enforce various default modules for all skins
2096  $coreModules = array(
2097  // keep this list as small as possible
2098  'mediawiki.page.startup',
2099  'mediawiki.user',
2100  );
2101 
2102  // Support for high-density display images if enabled
2103  if ( $wgResponsiveImages ) {
2104  $coreModules[] = 'mediawiki.hidpi';
2105  }
2106 
2107  $this->addModules( $coreModules );
2108  foreach ( $modules as $group ) {
2109  $this->addModules( $group );
2110  }
2111  MWDebug::addModules( $this );
2112  if ( $wgUseAjax ) {
2113  // FIXME: deprecate? - not clear why this is useful
2114  wfRunHooks( 'AjaxAddScript', array( &$this ) );
2115  }
2116 
2117  // Hook that allows last minute changes to the output page, e.g.
2118  // adding of CSS or Javascript by extensions.
2119  wfRunHooks( 'BeforePageDisplay', array( &$this, &$sk ) );
2120 
2121  wfProfileIn( 'Output-skin' );
2122  $sk->outputPage();
2123  wfProfileOut( 'Output-skin' );
2124  }
2125 
2126  // This hook allows last minute changes to final overall output by modifying output buffer
2127  wfRunHooks( 'AfterFinalPageOutput', array( $this ) );
2128 
2129  $this->sendCacheControl();
2130 
2131  ob_end_flush();
2132 
2133  wfProfileOut( __METHOD__ );
2134  }
2135 
2142  public function out( $ins ) {
2143  wfDeprecated( __METHOD__, '1.22' );
2144  print $ins;
2145  }
2146 
2151  function blockedPage() {
2152  throw new UserBlockedError( $this->getUser()->mBlock );
2153  }
2154 
2165  public function prepareErrorPage( $pageTitle, $htmlTitle = false ) {
2166  $this->setPageTitle( $pageTitle );
2167  if ( $htmlTitle !== false ) {
2168  $this->setHTMLTitle( $htmlTitle );
2169  }
2170  $this->setRobotPolicy( 'noindex,nofollow' );
2171  $this->setArticleRelated( false );
2172  $this->enableClientCache( false );
2173  $this->mRedirect = '';
2174  $this->clearSubtitle();
2175  $this->clearHTML();
2176  }
2177 
2190  public function showErrorPage( $title, $msg, $params = array() ) {
2191  if ( !$title instanceof Message ) {
2192  $title = $this->msg( $title );
2193  }
2194 
2195  $this->prepareErrorPage( $title );
2196 
2197  if ( $msg instanceof Message ) {
2198  if ( $params !== array() ) {
2199  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 );
2200  }
2201  $this->addHTML( $msg->parseAsBlock() );
2202  } else {
2203  $this->addWikiMsgArray( $msg, $params );
2204  }
2205 
2206  $this->returnToMain();
2207  }
2208 
2215  public function showPermissionsErrorPage( $errors, $action = null ) {
2216  // For some action (read, edit, create and upload), display a "login to do this action"
2217  // error if all of the following conditions are met:
2218  // 1. the user is not logged in
2219  // 2. the only error is insufficient permissions (i.e. no block or something else)
2220  // 3. the error can be avoided simply by logging in
2221  if ( in_array( $action, array( 'read', 'edit', 'createpage', 'createtalk', 'upload' ) )
2222  && $this->getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2223  && ( $errors[0][0] == 'badaccess-groups' || $errors[0][0] == 'badaccess-group0' )
2224  && ( User::groupHasPermission( 'user', $action )
2225  || User::groupHasPermission( 'autoconfirmed', $action ) )
2226  ) {
2227  $displayReturnto = null;
2228 
2229  # Due to bug 32276, if a user does not have read permissions,
2230  # $this->getTitle() will just give Special:Badtitle, which is
2231  # not especially useful as a returnto parameter. Use the title
2232  # from the request instead, if there was one.
2233  $request = $this->getRequest();
2234  $returnto = Title::newFromURL( $request->getVal( 'title', '' ) );
2235  if ( $action == 'edit' ) {
2236  $msg = 'whitelistedittext';
2237  $displayReturnto = $returnto;
2238  } elseif ( $action == 'createpage' || $action == 'createtalk' ) {
2239  $msg = 'nocreatetext';
2240  } elseif ( $action == 'upload' ) {
2241  $msg = 'uploadnologintext';
2242  } else { # Read
2243  $msg = 'loginreqpagetext';
2244  $displayReturnto = Title::newMainPage();
2245  }
2246 
2247  $query = array();
2248 
2249  if ( $returnto ) {
2250  $query['returnto'] = $returnto->getPrefixedText();
2251 
2252  if ( !$request->wasPosted() ) {
2253  $returntoquery = $request->getValues();
2254  unset( $returntoquery['title'] );
2255  unset( $returntoquery['returnto'] );
2256  unset( $returntoquery['returntoquery'] );
2257  $query['returntoquery'] = wfArrayToCgi( $returntoquery );
2258  }
2259  }
2260  $loginLink = Linker::linkKnown(
2261  SpecialPage::getTitleFor( 'Userlogin' ),
2262  $this->msg( 'loginreqlink' )->escaped(),
2263  array(),
2264  $query
2265  );
2266 
2267  $this->prepareErrorPage( $this->msg( 'loginreqtitle' ) );
2268  $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->parse() );
2269 
2270  # Don't return to a page the user can't read otherwise
2271  # we'll end up in a pointless loop
2272  if ( $displayReturnto && $displayReturnto->userCan( 'read', $this->getUser() ) ) {
2273  $this->returnToMain( null, $displayReturnto );
2274  }
2275  } else {
2276  $this->prepareErrorPage( $this->msg( 'permissionserrors' ) );
2277  $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
2278  }
2279  }
2280 
2287  public function versionRequired( $version ) {
2288  $this->prepareErrorPage( $this->msg( 'versionrequired', $version ) );
2289 
2290  $this->addWikiMsg( 'versionrequiredtext', $version );
2291  $this->returnToMain();
2292  }
2293 
2300  public function permissionRequired( $permission ) {
2301  throw new PermissionsError( $permission );
2302  }
2309  public function loginToUse() {
2310  throw new PermissionsError( 'read' );
2311  }
2312 
2320  public function formatPermissionsErrorMessage( $errors, $action = null ) {
2321  if ( $action == null ) {
2322  $text = $this->msg( 'permissionserrorstext', count( $errors ) )->plain() . "\n\n";
2323  } else {
2324  $action_desc = $this->msg( "action-$action" )->plain();
2325  $text = $this->msg(
2326  'permissionserrorstext-withaction',
2327  count( $errors ),
2328  $action_desc
2329  )->plain() . "\n\n";
2330  }
2331 
2332  if ( count( $errors ) > 1 ) {
2333  $text .= '<ul class="permissions-errors">' . "\n";
2334 
2335  foreach ( $errors as $error ) {
2336  $text .= '<li>';
2337  $text .= call_user_func_array( array( $this, 'msg' ), $error )->plain();
2338  $text .= "</li>\n";
2339  }
2340  $text .= '</ul>';
2341  } else {
2342  $text .= "<div class=\"permissions-errors\">\n" .
2343  call_user_func_array( array( $this, 'msg' ), reset( $errors ) )->plain() .
2344  "\n</div>";
2345  }
2346 
2347  return $text;
2348  }
2349 
2371  public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
2372  $this->setRobotPolicy( 'noindex,nofollow' );
2373  $this->setArticleRelated( false );
2374 
2375  // If no reason is given, just supply a default "I can't let you do
2376  // that, Dave" message. Should only occur if called by legacy code.
2377  if ( $protected && empty( $reasons ) ) {
2378  $reasons[] = array( 'badaccess-group0' );
2379  }
2380 
2381  if ( !empty( $reasons ) ) {
2382  // Permissions error
2383  if ( $source ) {
2384  $this->setPageTitle( $this->msg( 'viewsource-title', $this->getTitle()->getPrefixedText() ) );
2385  $this->addBacklinkSubtitle( $this->getTitle() );
2386  } else {
2387  $this->setPageTitle( $this->msg( 'badaccess' ) );
2388  }
2389  $this->addWikiText( $this->formatPermissionsErrorMessage( $reasons, $action ) );
2390  } else {
2391  // Wiki is read only
2392  throw new ReadOnlyError;
2393  }
2394 
2395  // Show source, if supplied
2396  if ( is_string( $source ) ) {
2397  $this->addWikiMsg( 'viewsourcetext' );
2398 
2399  $pageLang = $this->getTitle()->getPageLanguage();
2400  $params = array(
2401  'id' => 'wpTextbox1',
2402  'name' => 'wpTextbox1',
2403  'cols' => $this->getUser()->getOption( 'cols' ),
2404  'rows' => $this->getUser()->getOption( 'rows' ),
2405  'readonly' => 'readonly',
2406  'lang' => $pageLang->getHtmlCode(),
2407  'dir' => $pageLang->getDir(),
2408  );
2409  $this->addHTML( Html::element( 'textarea', $params, $source ) );
2410 
2411  // Show templates used by this article
2412  $templates = Linker::formatTemplates( $this->getTitle()->getTemplateLinksFrom() );
2413  $this->addHTML( "<div class='templatesUsed'>
2414 $templates
2415 </div>
2416 " );
2417  }
2418 
2419  # If the title doesn't exist, it's fairly pointless to print a return
2420  # link to it. After all, you just tried editing it and couldn't, so
2421  # what's there to do there?
2422  if ( $this->getTitle()->exists() ) {
2423  $this->returnToMain( null, $this->getTitle() );
2424  }
2425  }
2426 
2431  public function rateLimited() {
2432  throw new ThrottledError;
2433  }
2434 
2444  public function showLagWarning( $lag ) {
2445  global $wgSlaveLagWarning, $wgSlaveLagCritical;
2446  if ( $lag >= $wgSlaveLagWarning ) {
2447  $message = $lag < $wgSlaveLagCritical
2448  ? 'lag-warn-normal'
2449  : 'lag-warn-high';
2450  $wrap = Html::rawElement( 'div', array( 'class' => "mw-{$message}" ), "\n$1\n" );
2451  $this->wrapWikiMsg( "$wrap\n", array( $message, $this->getLanguage()->formatNum( $lag ) ) );
2452  }
2453  }
2454 
2455  public function showFatalError( $message ) {
2456  $this->prepareErrorPage( $this->msg( 'internalerror' ) );
2457 
2458  $this->addHTML( $message );
2459  }
2460 
2461  public function showUnexpectedValueError( $name, $val ) {
2462  $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() );
2463  }
2464 
2465  public function showFileCopyError( $old, $new ) {
2466  $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() );
2467  }
2468 
2469  public function showFileRenameError( $old, $new ) {
2470  $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() );
2471  }
2472 
2473  public function showFileDeleteError( $name ) {
2474  $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() );
2475  }
2476 
2477  public function showFileNotFoundError( $name ) {
2478  $this->showFatalError( $this->msg( 'filenotfound', $name )->text() );
2479  }
2480 
2489  public function addReturnTo( $title, $query = array(), $text = null, $options = array() ) {
2490  $link = $this->msg( 'returnto' )->rawParams(
2491  Linker::link( $title, $text, array(), $query, $options ) )->escaped();
2492  $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
2493  }
2494 
2503  public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
2504  if ( $returnto == null ) {
2505  $returnto = $this->getRequest()->getText( 'returnto' );
2506  }
2507 
2508  if ( $returntoquery == null ) {
2509  $returntoquery = $this->getRequest()->getText( 'returntoquery' );
2510  }
2511 
2512  if ( $returnto === '' ) {
2513  $returnto = Title::newMainPage();
2514  }
2515 
2516  if ( is_object( $returnto ) ) {
2517  $titleObj = $returnto;
2518  } else {
2519  $titleObj = Title::newFromText( $returnto );
2520  }
2521  if ( !is_object( $titleObj ) ) {
2522  $titleObj = Title::newMainPage();
2523  }
2524 
2525  $this->addReturnTo( $titleObj, wfCgiToArray( $returntoquery ) );
2526  }
2533  public function headElement( Skin $sk, $includeStyle = true ) {
2534  global $wgContLang, $wgMimeType;
2535 
2536  $userdir = $this->getLanguage()->getDir();
2537  $sitedir = $wgContLang->getDir();
2538 
2540 
2541  if ( $this->getHTMLTitle() == '' ) {
2542  $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() )->inContentLanguage() );
2543  }
2544 
2545  $openHead = Html::openElement( 'head' );
2546  if ( $openHead ) {
2547  # Don't bother with the newline if $head == ''
2548  $ret .= "$openHead\n";
2549  }
2550 
2551  if ( !Html::isXmlMimeType( $wgMimeType ) ) {
2552  // Add <meta charset="UTF-8">
2553  // This should be before <title> since it defines the charset used by
2554  // text including the text inside <title>.
2555  // The spec recommends defining XHTML5's charset using the XML declaration
2556  // instead of meta.
2557  // Our XML declaration is output by Html::htmlHeader.
2558  // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
2559  // http://www.whatwg.org/html/semantics.html#charset
2560  $ret .= Html::element( 'meta', array( 'charset' => 'UTF-8' ) ) . "\n";
2561  }
2562 
2563  $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
2564 
2565  // Avoid Internet Explorer "compatibility view", so that
2566  // jQuery can work correctly.
2567  $ret .= Html::element( 'meta', array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EDGE' ) ) . "\n";
2568 
2569  $ret .= (
2570  $this->getHeadLinks() .
2571  "\n" .
2572  $this->buildCssLinks() .
2573  // No newline after buildCssLinks since makeResourceLoaderLink did that already
2574  $this->getHeadScripts() .
2575  "\n" .
2576  $this->getHeadItems()
2577  );
2578 
2579  $closeHead = Html::closeElement( 'head' );
2580  if ( $closeHead ) {
2581  $ret .= "$closeHead\n";
2582  }
2583 
2584  $bodyClasses = array();
2585  $bodyClasses[] = 'mediawiki';
2586 
2587  # Classes for LTR/RTL directionality support
2588  $bodyClasses[] = $userdir;
2589  $bodyClasses[] = "sitedir-$sitedir";
2590 
2591  if ( $this->getLanguage()->capitalizeAllNouns() ) {
2592  # A <body> class is probably not the best way to do this . . .
2593  $bodyClasses[] = 'capitalize-all-nouns';
2594  }
2595 
2596  $bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
2597  $bodyClasses[] = 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
2598  $bodyClasses[] = 'action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
2599 
2600  $bodyAttrs = array();
2601  // While the implode() is not strictly needed, it's used for backwards compatibility
2602  // (this used to be built as a string and hooks likely still expect that).
2603  $bodyAttrs['class'] = implode( ' ', $bodyClasses );
2604 
2605  // Allow skins and extensions to add body attributes they need
2606  $sk->addToBodyAttributes( $this, $bodyAttrs );
2607  wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) );
2608 
2609  $ret .= Html::openElement( 'body', $bodyAttrs ) . "\n";
2610 
2611  return $ret;
2612  }
2619  public function getResourceLoader() {
2620  if ( is_null( $this->mResourceLoader ) ) {
2621  $this->mResourceLoader = new ResourceLoader();
2622  }
2623  return $this->mResourceLoader;
2624  }
2625 
2635  public function makeResourceLoaderLink( $modules, $only, $useESI = false, array $extraQuery = array(), $loadCall = false ) {
2636  global $wgResourceLoaderUseESI;
2637 
2638  $modules = (array)$modules;
2639 
2640  $links = array(
2641  'html' => '',
2642  'states' => array(),
2643  );
2644 
2645  if ( !count( $modules ) ) {
2646  return $links;
2647  }
2648 
2649 
2650  if ( count( $modules ) > 1 ) {
2651  // Remove duplicate module requests
2652  $modules = array_unique( $modules );
2653  // Sort module names so requests are more uniform
2654  sort( $modules );
2655 
2656  if ( ResourceLoader::inDebugMode() ) {
2657  // Recursively call us for every item
2658  foreach ( $modules as $name ) {
2659  $link = $this->makeResourceLoaderLink( $name, $only, $useESI );
2660  $links['html'] .= $link['html'];
2661  $links['states'] += $link['states'];
2662  }
2663  return $links;
2664  }
2665  }
2666 
2667  if ( !is_null( $this->mTarget ) ) {
2668  $extraQuery['target'] = $this->mTarget;
2669  }
2670 
2671  // Create keyed-by-group list of module objects from modules list
2672  $groups = array();
2674  foreach ( $modules as $name ) {
2675  $module = $resourceLoader->getModule( $name );
2676  # Check that we're allowed to include this module on this page
2677  if ( !$module
2678  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS )
2680  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_STYLES )
2681  && $only == ResourceLoaderModule::TYPE_STYLES )
2682  || ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) )
2683  ) {
2684  continue;
2685  }
2686 
2687  $group = $module->getGroup();
2688  if ( !isset( $groups[$group] ) ) {
2689  $groups[$group] = array();
2690  }
2691  $groups[$group][$name] = $module;
2692  }
2693 
2694  foreach ( $groups as $group => $grpModules ) {
2695  // Special handling for user-specific groups
2696  $user = null;
2697  if ( ( $group === 'user' || $group === 'private' ) && $this->getUser()->isLoggedIn() ) {
2698  $user = $this->getUser()->getName();
2699  }
2700 
2701  // Create a fake request based on the one we are about to make so modules return
2702  // correct timestamp and emptiness data
2704  array(), // modules; not determined yet
2705  $this->getLanguage()->getCode(),
2706  $this->getSkin()->getSkinName(),
2707  $user,
2708  null, // version; not determined yet
2710  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2711  $this->isPrintable(),
2712  $this->getRequest()->getBool( 'handheld' ),
2713  $extraQuery
2714  );
2716 
2717  // Extract modules that know they're empty
2718  foreach ( $grpModules as $key => $module ) {
2719  // Inline empty modules: since they're empty, just mark them as 'ready' (bug 46857)
2720  // If we're only getting the styles, we don't need to do anything for empty modules.
2721  if ( $module->isKnownEmpty( $context ) ) {
2722  unset( $grpModules[$key] );
2723  if ( $only !== ResourceLoaderModule::TYPE_STYLES ) {
2724  $links['states'][$key] = 'ready';
2725  }
2726  }
2727  }
2728 
2729  // If there are no non-empty modules, skip this group
2730  if ( count( $grpModules ) === 0 ) {
2731  continue;
2732  }
2733 
2734  // Inline private modules. These can't be loaded through load.php for security
2735  // reasons, see bug 34907. Note that these modules should be loaded from
2736  // getHeadScripts() before the first loader call. Otherwise other modules can't
2737  // properly use them as dependencies (bug 30914)
2738  if ( $group === 'private' ) {
2739  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2740  $links['html'] .= Html::inlineStyle(
2741  $resourceLoader->makeModuleResponse( $context, $grpModules )
2742  );
2743  } else {
2744  $links['html'] .= Html::inlineScript(
2746  $resourceLoader->makeModuleResponse( $context, $grpModules )
2747  )
2748  );
2749  }
2750  $links['html'] .= "\n";
2751  continue;
2752  }
2753 
2754  // Special handling for the user group; because users might change their stuff
2755  // on-wiki like user pages, or user preferences; we need to find the highest
2756  // timestamp of these user-changeable modules so we can ensure cache misses on change
2757  // This should NOT be done for the site group (bug 27564) because anons get that too
2758  // and we shouldn't be putting timestamps in Squid-cached HTML
2759  $version = null;
2760  if ( $group === 'user' ) {
2761  // Get the maximum timestamp
2762  $timestamp = 1;
2763  foreach ( $grpModules as $module ) {
2764  $timestamp = max( $timestamp, $module->getModifiedTime( $context ) );
2765  }
2766  // Add a version parameter so cache will break when things change
2768  }
2769 
2771  array_keys( $grpModules ),
2772  $this->getLanguage()->getCode(),
2773  $this->getSkin()->getSkinName(),
2774  $user,
2775  $version,
2777  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2778  $this->isPrintable(),
2779  $this->getRequest()->getBool( 'handheld' ),
2780  $extraQuery
2781  );
2782  if ( $useESI && $wgResourceLoaderUseESI ) {
2783  $esi = Xml::element( 'esi:include', array( 'src' => $url ) );
2784  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2785  $link = Html::inlineStyle( $esi );
2786  } else {
2787  $link = Html::inlineScript( $esi );
2788  }
2789  } else {
2790  // Automatically select style/script elements
2791  if ( $only === ResourceLoaderModule::TYPE_STYLES ) {
2792  $link = Html::linkedStyle( $url );
2793  } elseif ( $loadCall ) {
2796  Xml::encodeJsCall( 'mw.loader.load', array( $url, 'text/javascript', true ) )
2797  )
2798  );
2799  } else {
2800  $link = Html::linkedScript( $url );
2801 
2802  // For modules requested directly in the html via <link> or <script>,
2803  // tell mw.loader they are being loading to prevent duplicate requests.
2804  foreach ( $grpModules as $key => $module ) {
2805  // Don't output state=loading for the startup module..
2806  if ( $key !== 'startup' ) {
2807  $links['states'][$key] = 'loading';
2808  }
2809  }
2810  }
2811  }
2812 
2813  if ( $group == 'noscript' ) {
2814  $links['html'] .= Html::rawElement( 'noscript', array(), $link ) . "\n";
2815  } else {
2816  $links['html'] .= $link . "\n";
2817  }
2818  }
2819 
2820  return $links;
2821  }
2828  protected static function getHtmlFromLoaderLinks( Array $links ) {
2829  $html = '';
2830  $states = array();
2831  foreach ( $links as $link ) {
2832  if ( !is_array( $link ) ) {
2833  $html .= $link;
2834  } else {
2835  $html .= $link['html'];
2836  $states += $link['states'];
2837  }
2838  }
2839 
2840  if ( count( $states ) ) {
2844  )
2845  ) . "\n" . $html;
2846  }
2847 
2848  return $html;
2849  }
2850 
2857  function getHeadScripts() {
2858  global $wgResourceLoaderExperimentalAsyncLoading;
2859 
2860  // Startup - this will immediately load jquery and mediawiki modules
2861  $links = array();
2862  $links[] = $this->makeResourceLoaderLink( 'startup', ResourceLoaderModule::TYPE_SCRIPTS, true );
2863 
2864  // Load config before anything else
2865  $links[] = Html::inlineScript(
2868  )
2869  );
2870 
2871  // Load embeddable private modules before any loader links
2872  // This needs to be TYPE_COMBINED so these modules are properly wrapped
2873  // in mw.loader.implement() calls and deferred until mw.user is available
2874  $embedScripts = array( 'user.options', 'user.tokens' );
2875  $links[] = $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
2876 
2877  // Scripts and messages "only" requests marked for top inclusion
2878  // Messages should go first
2879  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'top' ), ResourceLoaderModule::TYPE_MESSAGES );
2880  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'top' ), ResourceLoaderModule::TYPE_SCRIPTS );
2881 
2882  // Modules requests - let the client calculate dependencies and batch requests as it likes
2883  // Only load modules that have marked themselves for loading at the top
2884  $modules = $this->getModules( true, 'top' );
2885  if ( $modules ) {
2886  $links[] = Html::inlineScript(
2888  Xml::encodeJsCall( 'mw.loader.load', array( $modules ) )
2889  )
2890  );
2891  }
2892 
2893  if ( $wgResourceLoaderExperimentalAsyncLoading ) {
2894  $links[] = $this->getScriptsForBottomQueue( true );
2895  }
2896 
2897  return self::getHtmlFromLoaderLinks( $links );
2898  }
2899 
2909  function getScriptsForBottomQueue( $inHead ) {
2910  global $wgUseSiteJs, $wgAllowUserJs;
2911 
2912  // Scripts and messages "only" requests marked for bottom inclusion
2913  // If we're in the <head>, use load() calls rather than <script src="..."> tags
2914  // Messages should go first
2915  $links = array();
2916  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'bottom' ),
2917  ResourceLoaderModule::TYPE_MESSAGES, /* $useESI = */ false, /* $extraQuery = */ array(),
2918  /* $loadCall = */ $inHead
2919  );
2920  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'bottom' ),
2921  ResourceLoaderModule::TYPE_SCRIPTS, /* $useESI = */ false, /* $extraQuery = */ array(),
2922  /* $loadCall = */ $inHead
2923  );
2924 
2925  // Modules requests - let the client calculate dependencies and batch requests as it likes
2926  // Only load modules that have marked themselves for loading at the bottom
2927  $modules = $this->getModules( true, 'bottom' );
2928  if ( $modules ) {
2929  $links[] = Html::inlineScript(
2931  Xml::encodeJsCall( 'mw.loader.load', array( $modules, null, true ) )
2932  )
2933  );
2934  }
2935 
2936  // Legacy Scripts
2937  $links[] = "\n" . $this->mScripts;
2938 
2939  // Add site JS if enabled
2941  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2942  );
2943 
2944  // Add user JS if enabled
2945  if ( $wgAllowUserJs && $this->getUser()->isLoggedIn() && $this->getTitle() && $this->getTitle()->isJsSubpage() && $this->userCanPreview() ) {
2946  # XXX: additional security check/prompt?
2947  // We're on a preview of a JS subpage
2948  // Exclude this page from the user module in case it's in there (bug 26283)
2949  $links[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS, false,
2950  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() ), $inHead
2951  );
2952  // Load the previewed JS
2953  $links[] = Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
2954 
2955  // FIXME: If the user is previewing, say, ./vector.js, his ./common.js will be loaded
2956  // asynchronously and may arrive *after* the inline script here. So the previewed code
2957  // may execute before ./common.js runs. Normally, ./common.js runs before ./vector.js...
2958  } else {
2959  // Include the user module normally, i.e., raw to avoid it being wrapped in a closure.
2961  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2962  );
2963  }
2964 
2965  // Group JS is only enabled if site JS is enabled.
2966  $links[] = $this->makeResourceLoaderLink( 'user.groups', ResourceLoaderModule::TYPE_COMBINED,
2967  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2968  );
2969 
2970  return self::getHtmlFromLoaderLinks( $links );
2971  }
2972 
2977  function getBottomScripts() {
2978  global $wgResourceLoaderExperimentalAsyncLoading;
2979 
2980  // Optimise jQuery ready event cross-browser.
2981  // This also enforces $.isReady to be true at </body> which fixes the
2982  // mw.loader bug in Firefox with using document.write between </body>
2983  // and the DOMContentReady event (bug 47457).
2984  $html = Html::inlineScript( 'window.jQuery && jQuery.ready();' );
2985 
2986  if ( !$wgResourceLoaderExperimentalAsyncLoading ) {
2987  $html .= $this->getScriptsForBottomQueue( false );
2988  }
2989 
2990  return $html;
2991  }
2992 
2999  public function getJsConfigVars() {
3000  return $this->mJsConfigVars;
3001  }
3002 
3009  public function addJsConfigVars( $keys, $value = null ) {
3010  if ( is_array( $keys ) ) {
3011  foreach ( $keys as $key => $value ) {
3012  $this->mJsConfigVars[$key] = $value;
3013  }
3014  return;
3015  }
3016 
3017  $this->mJsConfigVars[$keys] = $value;
3018  }
3019 
3032  public function getJSVars() {
3034 
3035  $curRevisionId = 0;
3036  $articleId = 0;
3037  $canonicalSpecialPageName = false; # bug 21115
3038 
3039  $title = $this->getTitle();
3040  $ns = $title->getNamespace();
3041  $canonicalNamespace = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
3042 
3043  $sk = $this->getSkin();
3044  // Get the relevant title so that AJAX features can use the correct page name
3045  // when making API requests from certain special pages (bug 34972).
3046  $relevantTitle = $sk->getRelevantTitle();
3047  $relevantUser = $sk->getRelevantUser();
3048 
3049  if ( $ns == NS_SPECIAL ) {
3050  list( $canonicalSpecialPageName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
3051  } elseif ( $this->canUseWikiPage() ) {
3052  $wikiPage = $this->getWikiPage();
3053  $curRevisionId = $wikiPage->getLatest();
3054  $articleId = $wikiPage->getId();
3055  }
3056 
3057  $lang = $title->getPageLanguage();
3058 
3059  // Pre-process information
3060  $separatorTransTable = $lang->separatorTransformTable();
3061  $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
3062  $compactSeparatorTransTable = array(
3063  implode( "\t", array_keys( $separatorTransTable ) ),
3064  implode( "\t", $separatorTransTable ),
3065  );
3066  $digitTransTable = $lang->digitTransformTable();
3067  $digitTransTable = $digitTransTable ? $digitTransTable : array();
3068  $compactDigitTransTable = array(
3069  implode( "\t", array_keys( $digitTransTable ) ),
3070  implode( "\t", $digitTransTable ),
3071  );
3072 
3073  $user = $this->getUser();
3074 
3075  $vars = array(
3076  'wgCanonicalNamespace' => $canonicalNamespace,
3077  'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3078  'wgNamespaceNumber' => $title->getNamespace(),
3079  'wgPageName' => $title->getPrefixedDBkey(),
3080  'wgTitle' => $title->getText(),
3081  'wgCurRevisionId' => $curRevisionId,
3082  'wgRevisionId' => (int)$this->getRevisionId(),
3083  'wgArticleId' => $articleId,
3084  'wgIsArticle' => $this->isArticle(),
3085  'wgIsRedirect' => $title->isRedirect(),
3086  'wgAction' => Action::getActionName( $this->getContext() ),
3087  'wgUserName' => $user->isAnon() ? null : $user->getName(),
3088  'wgUserGroups' => $user->getEffectiveGroups(),
3089  'wgCategories' => $this->getCategories(),
3090  'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
3091  'wgPageContentLanguage' => $lang->getCode(),
3092  'wgPageContentModel' => $title->getContentModel(),
3093  'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3094  'wgDigitTransformTable' => $compactDigitTransTable,
3095  'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
3096  'wgMonthNames' => $lang->getMonthNamesArray(),
3097  'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
3098  'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3099  );
3100  if ( $user->isLoggedIn() ) {
3101  $vars['wgUserId'] = $user->getId();
3102  $vars['wgUserEditCount'] = $user->getEditCount();
3103  $userReg = wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
3104  $vars['wgUserRegistration'] = $userReg !== null ? ( $userReg * 1000 ) : null;
3105  // Get the revision ID of the oldest new message on the user's talk
3106  // page. This can be used for constructing new message alerts on
3107  // the client side.
3108  $vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
3109  }
3110  if ( $wgContLang->hasVariants() ) {
3111  $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
3112  }
3113  // Same test as SkinTemplate
3114  $vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user ) && ( $title->exists() || $title->quickUserCan( 'create', $user ) );
3115  foreach ( $title->getRestrictionTypes() as $type ) {
3116  $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
3117  }
3118  if ( $title->isMainPage() ) {
3119  $vars['wgIsMainPage'] = true;
3120  }
3121  if ( $this->mRedirectedFrom ) {
3122  $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3123  }
3124  if ( $relevantUser ) {
3125  $vars['wgRelevantUserName'] = $relevantUser->getName();
3126  }
3127 
3128  // Allow extensions to add their custom variables to the mw.config map.
3129  // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
3130  // page-dependant but site-wide (without state).
3131  // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
3132  wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars, $this ) );
3133 
3134  // Merge in variables from addJsConfigVars last
3135  return array_merge( $vars, $this->getJsConfigVars() );
3136  }
3137 
3147  public function userCanPreview() {
3148  if ( $this->getRequest()->getVal( 'action' ) != 'submit'
3149  || !$this->getRequest()->wasPosted()
3150  || !$this->getUser()->matchEditToken(
3151  $this->getRequest()->getVal( 'wpEditToken' ) )
3152  ) {
3153  return false;
3154  }
3155  if ( !$this->getTitle()->isJsSubpage() && !$this->getTitle()->isCssSubpage() ) {
3156  return false;
3157  }
3158  if ( !$this->getTitle()->isSubpageOf( $this->getUser()->getUserPage() ) ) {
3159  // Don't execute another user's CSS or JS on preview (T85855)
3160  return false;
3161  }
3162 
3163  return !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) );
3164  }
3165 
3169  public function getHeadLinksArray() {
3170  global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
3171  $wgSitename, $wgVersion,
3172  $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
3173  $wgDisableLangConversion, $wgCanonicalLanguageLinks,
3174  $wgRightsPage, $wgRightsUrl;
3175 
3176  $tags = array();
3177 
3178  $canonicalUrl = $this->mCanonicalUrl;
3179 
3180  $tags['meta-generator'] = Html::element( 'meta', array(
3181  'name' => 'generator',
3182  'content' => "MediaWiki $wgVersion",
3183  ) );
3184 
3185  $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
3186  if ( $p !== 'index,follow' ) {
3187  // http://www.robotstxt.org/wc/meta-user.html
3188  // Only show if it's different from the default robots policy
3189  $tags['meta-robots'] = Html::element( 'meta', array(
3190  'name' => 'robots',
3191  'content' => $p,
3192  ) );
3193  }
3194 
3195  foreach ( $this->mMetatags as $tag ) {
3196  if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) {
3197  $a = 'http-equiv';
3198  $tag[0] = substr( $tag[0], 5 );
3199  } else {
3200  $a = 'name';
3201  }
3202  $tagName = "meta-{$tag[0]}";
3203  if ( isset( $tags[$tagName] ) ) {
3204  $tagName .= $tag[1];
3205  }
3206  $tags[$tagName] = Html::element( 'meta',
3207  array(
3208  $a => $tag[0],
3209  'content' => $tag[1]
3210  )
3211  );
3212  }
3213 
3214  foreach ( $this->mLinktags as $tag ) {
3215  $tags[] = Html::element( 'link', $tag );
3216  }
3217 
3218  # Universal edit button
3219  if ( $wgUniversalEditButton && $this->isArticleRelated() ) {
3220  $user = $this->getUser();
3221  if ( $this->getTitle()->quickUserCan( 'edit', $user )
3222  && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create', $user ) ) ) {
3223  // Original UniversalEditButton
3224  $msg = $this->msg( 'edit' )->text();
3225  $tags['universal-edit-button'] = Html::element( 'link', array(
3226  'rel' => 'alternate',
3227  'type' => 'application/x-wiki',
3228  'title' => $msg,
3229  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3230  ) );
3231  // Alternate edit link
3232  $tags['alternative-edit'] = Html::element( 'link', array(
3233  'rel' => 'edit',
3234  'title' => $msg,
3235  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3236  ) );
3237  }
3238  }
3239 
3240  # Generally the order of the favicon and apple-touch-icon links
3241  # should not matter, but Konqueror (3.5.9 at least) incorrectly
3242  # uses whichever one appears later in the HTML source. Make sure
3243  # apple-touch-icon is specified first to avoid this.
3244  if ( $wgAppleTouchIcon !== false ) {
3245  $tags['apple-touch-icon'] = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
3246  }
3247 
3248  if ( $wgFavicon !== false ) {
3249  $tags['favicon'] = Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
3250  }
3251 
3252  # OpenSearch description link
3253  $tags['opensearch'] = Html::element( 'link', array(
3254  'rel' => 'search',
3255  'type' => 'application/opensearchdescription+xml',
3256  'href' => wfScript( 'opensearch_desc' ),
3257  'title' => $this->msg( 'opensearch-desc' )->inContentLanguage()->text(),
3258  ) );
3259 
3260  if ( $wgEnableAPI ) {
3261  # Real Simple Discovery link, provides auto-discovery information
3262  # for the MediaWiki API (and potentially additional custom API
3263  # support such as WordPress or Twitter-compatible APIs for a
3264  # blogging extension, etc)
3265  $tags['rsd'] = Html::element( 'link', array(
3266  'rel' => 'EditURI',
3267  'type' => 'application/rsd+xml',
3268  // Output a protocol-relative URL here if $wgServer is protocol-relative
3269  // Whether RSD accepts relative or protocol-relative URLs is completely undocumented, though
3270  'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ), PROTO_RELATIVE ),
3271  ) );
3272  }
3273 
3274  # Language variants
3275  if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
3276  $lang = $this->getTitle()->getPageLanguage();
3277  if ( $lang->hasVariants() ) {
3278 
3279  $urlvar = $lang->getURLVariant();
3280 
3281  if ( !$urlvar ) {
3282  $variants = $lang->getVariants();
3283  foreach ( $variants as $_v ) {
3284  $tags["variant-$_v"] = Html::element( 'link', array(
3285  'rel' => 'alternate',
3286  'hreflang' => wfBCP47( $_v ),
3287  'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
3288  );
3289  }
3290  } else {
3291  $canonicalUrl = $this->getTitle()->getLocalURL();
3292  }
3293  }
3294  }
3295 
3296  # Copyright
3297  $copyright = '';
3298  if ( $wgRightsPage ) {
3299  $copy = Title::newFromText( $wgRightsPage );
3300 
3301  if ( $copy ) {
3302  $copyright = $copy->getLocalURL();
3303  }
3304  }
3305 
3306  if ( !$copyright && $wgRightsUrl ) {
3307  $copyright = $wgRightsUrl;
3308  }
3309 
3310  if ( $copyright ) {
3311  $tags['copyright'] = Html::element( 'link', array(
3312  'rel' => 'copyright',
3313  'href' => $copyright )
3314  );
3315  }
3316 
3317  # Feeds
3318  if ( $wgFeed ) {
3319  foreach ( $this->getSyndicationLinks() as $format => $link ) {
3320  # Use the page name for the title. In principle, this could
3321  # lead to issues with having the same name for different feeds
3322  # corresponding to the same page, but we can't avoid that at
3323  # this low a level.
3324 
3325  $tags[] = $this->feedLink(
3326  $format,
3327  $link,
3328  # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
3329  $this->msg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() )->text()
3330  );
3331  }
3332 
3333  # Recent changes feed should appear on every page (except recentchanges,
3334  # that would be redundant). Put it after the per-page feed to avoid
3335  # changing existing behavior. It's still available, probably via a
3336  # menu in your browser. Some sites might have a different feed they'd
3337  # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3338  # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3339  # If so, use it instead.
3340  if ( $wgOverrideSiteFeed ) {
3341  foreach ( $wgOverrideSiteFeed as $type => $feedUrl ) {
3342  // Note, this->feedLink escapes the url.
3343  $tags[] = $this->feedLink(
3344  $type,
3345  $feedUrl,
3346  $this->msg( "site-{$type}-feed", $wgSitename )->text()
3347  );
3348  }
3349  } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
3350  $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
3351  foreach ( $wgAdvertisedFeedTypes as $format ) {
3352  $tags[] = $this->feedLink(
3353  $format,
3354  $rctitle->getLocalURL( array( 'feed' => $format ) ),
3355  $this->msg( "site-{$format}-feed", $wgSitename )->text() # For grep: 'site-rss-feed', 'site-atom-feed'.
3356  );
3357  }
3358  }
3359  }
3360 
3361  # Canonical URL
3362  global $wgEnableCanonicalServerLink;
3363  if ( $wgEnableCanonicalServerLink ) {
3364  if ( $canonicalUrl !== false ) {
3365  $canonicalUrl = wfExpandUrl( $canonicalUrl, PROTO_CANONICAL );
3366  } else {
3367  $reqUrl = $this->getRequest()->getRequestURL();
3368  $canonicalUrl = wfExpandUrl( $reqUrl, PROTO_CANONICAL );
3369  }
3370  }
3371  if ( $canonicalUrl !== false ) {
3372  $tags[] = Html::element( 'link', array(
3373  'rel' => 'canonical',
3374  'href' => $canonicalUrl
3375  ) );
3376  }
3377 
3378  return $tags;
3379  }
3380 
3384  public function getHeadLinks() {
3385  return implode( "\n", $this->getHeadLinksArray() );
3386  }
3387 
3396  private function feedLink( $type, $url, $text ) {
3397  return Html::element( 'link', array(
3398  'rel' => 'alternate',
3399  'type' => "application/$type+xml",
3400  'title' => $text,
3401  'href' => $url )
3402  );
3403  }
3404 
3414  public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
3415  $options = array();
3416  // Even though we expect the media type to be lowercase, but here we
3417  // force it to lowercase to be safe.
3418  if ( $media ) {
3419  $options['media'] = $media;
3420  }
3421  if ( $condition ) {
3422  $options['condition'] = $condition;
3423  }
3424  if ( $dir ) {
3425  $options['dir'] = $dir;
3426  }
3427  $this->styles[$style] = $options;
3428  }
3435  public function addInlineStyle( $style_css, $flip = 'noflip' ) {
3436  if ( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
3437  # If wanted, and the interface is right-to-left, flip the CSS
3438  $style_css = CSSJanus::transform( $style_css, true, false );
3439  }
3440  $this->mInlineStyles .= Html::inlineStyle( $style_css ) . "\n";
3441  }
3442 
3449  public function buildCssLinks() {
3450  global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs, $wgContLang;
3451 
3452  $this->getSkin()->setupSkinUserCss( $this );
3453 
3454  // Add ResourceLoader styles
3455  // Split the styles into these groups
3456  $styles = array( 'other' => array(), 'user' => array(), 'site' => array(), 'private' => array(), 'noscript' => array() );
3457  $links = array();
3458  $otherTags = ''; // Tags to append after the normal <link> tags
3460 
3461  $moduleStyles = $this->getModuleStyles();
3462 
3463  // Per-site custom styles
3464  $moduleStyles[] = 'site';
3465  $moduleStyles[] = 'noscript';
3466  $moduleStyles[] = 'user.groups';
3467 
3468  // Per-user custom styles
3469  if ( $wgAllowUserCss && $this->getTitle()->isCssSubpage() && $this->userCanPreview() ) {
3470  // We're on a preview of a CSS subpage
3471  // Exclude this page from the user module in case it's in there (bug 26283)
3473  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
3474  );
3475  $otherTags .= $link['html'];
3476 
3477  // Load the previewed CSS
3478  // If needed, Janus it first. This is user-supplied CSS, so it's
3479  // assumed to be right for the content language directionality.
3480  $previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
3481  if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
3482  $previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
3483  }
3484  $otherTags .= Html::inlineStyle( $previewedCSS ) . "\n";
3485  } else {
3486  // Load the user styles normally
3487  $moduleStyles[] = 'user';
3488  }
3489 
3490  // Per-user preference styles
3491  $moduleStyles[] = 'user.cssprefs';
3492 
3493  foreach ( $moduleStyles as $name ) {
3494  $module = $resourceLoader->getModule( $name );
3495  if ( !$module ) {
3496  continue;
3497  }
3498  $group = $module->getGroup();
3499  // Modules in groups different than the ones listed on top (see $styles assignment)
3500  // will be placed in the "other" group
3501  $styles[ isset( $styles[$group] ) ? $group : 'other' ][] = $name;
3502  }
3503 
3504  // We want site, private and user styles to override dynamically added styles from modules, but we want
3505  // dynamically added styles to override statically added styles from other modules. So the order
3506  // has to be other, dynamic, site, private, user
3507  // Add statically added styles for other modules
3508  $links[] = $this->makeResourceLoaderLink( $styles['other'], ResourceLoaderModule::TYPE_STYLES );
3509  // Add normal styles added through addStyle()/addInlineStyle() here
3510  $links[] = implode( "\n", $this->buildCssLinksArray() ) . $this->mInlineStyles;
3511  // Add marker tag to mark the place where the client-side loader should inject dynamic styles
3512  // We use a <meta> tag with a made-up name for this because that's valid HTML
3513  $links[] = Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) ) . "\n";
3514 
3515  // Add site, private and user styles
3516  // 'private' at present only contains user.options, so put that before 'user'
3517  // Any future private modules will likely have a similar user-specific character
3518  foreach ( array( 'site', 'noscript', 'private', 'user' ) as $group ) {
3519  $links[] = $this->makeResourceLoaderLink( $styles[$group],
3521  );
3522  }
3523 
3524  // Add stuff in $otherTags (previewed user CSS if applicable)
3525  return self::getHtmlFromLoaderLinks( $links ) . $otherTags;
3526  }
3527 
3531  public function buildCssLinksArray() {
3532  $links = array();
3533 
3534  // Add any extension CSS
3535  foreach ( $this->mExtStyles as $url ) {
3536  $this->addStyle( $url );
3537  }
3538  $this->mExtStyles = array();
3539 
3540  foreach ( $this->styles as $file => $options ) {
3541  $link = $this->styleLink( $file, $options );
3542  if ( $link ) {
3543  $links[$file] = $link;
3544  }
3545  }
3546  return $links;
3547  }
3548 
3556  protected function styleLink( $style, $options ) {
3557  if ( isset( $options['dir'] ) ) {
3558  if ( $this->getLanguage()->getDir() != $options['dir'] ) {
3559  return '';
3560  }
3561  }
3562 
3563  if ( isset( $options['media'] ) ) {
3564  $media = self::transformCssMedia( $options['media'] );
3565  if ( is_null( $media ) ) {
3566  return '';
3567  }
3568  } else {
3569  $media = 'all';
3570  }
3571 
3572  if ( substr( $style, 0, 1 ) == '/' ||
3573  substr( $style, 0, 5 ) == 'http:' ||
3574  substr( $style, 0, 6 ) == 'https:' ) {
3575  $url = $style;
3576  } else {
3577  global $wgStylePath, $wgStyleVersion;
3578  $url = $wgStylePath . '/' . $style . '?' . $wgStyleVersion;
3579  }
3580 
3581  $link = Html::linkedStyle( $url, $media );
3582 
3583  if ( isset( $options['condition'] ) ) {
3584  $condition = htmlspecialchars( $options['condition'] );
3585  $link = "<!--[if $condition]>$link<![endif]-->";
3586  }
3587  return $link;
3588  }
3589 
3597  public static function transformCssMedia( $media ) {
3598  global $wgRequest;
3599 
3600  // http://www.w3.org/TR/css3-mediaqueries/#syntax
3601  $screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
3602 
3603  // Switch in on-screen display for media testing
3604  $switches = array(
3605  'printable' => 'print',
3606  'handheld' => 'handheld',
3607  );
3608  foreach ( $switches as $switch => $targetMedia ) {
3609  if ( $wgRequest->getBool( $switch ) ) {
3610  if ( $media == $targetMedia ) {
3611  $media = '';
3612  } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3613  // This regex will not attempt to understand a comma-separated media_query_list
3614  //
3615  // Example supported values for $media: 'screen', 'only screen', 'screen and (min-width: 982px)' ),
3616  // Example NOT supported value for $media: '3d-glasses, screen, print and resolution > 90dpi'
3617  //
3618  // If it's a print request, we never want any kind of screen stylesheets
3619  // If it's a handheld request (currently the only other choice with a switch),
3620  // we don't want simple 'screen' but we might want screen queries that
3621  // have a max-width or something, so we'll pass all others on and let the
3622  // client do the query.
3623  if ( $targetMedia == 'print' || $media == 'screen' ) {
3624  return null;
3625  }
3626  }
3627  }
3628  }
3629 
3630  return $media;
3631  }
3632 
3639  public function addWikiMsg( /*...*/ ) {
3640  $args = func_get_args();
3641  $name = array_shift( $args );
3642  $this->addWikiMsgArray( $name, $args );
3643  }
3644 
3653  public function addWikiMsgArray( $name, $args ) {
3654  $this->addHTML( $this->msg( $name, $args )->parseAsBlock() );
3655  }
3656 
3680  public function wrapWikiMsg( $wrap /*, ...*/ ) {
3681  $msgSpecs = func_get_args();
3682  array_shift( $msgSpecs );
3683  $msgSpecs = array_values( $msgSpecs );
3684  $s = $wrap;
3685  foreach ( $msgSpecs as $n => $spec ) {
3686  if ( is_array( $spec ) ) {
3687  $args = $spec;
3688  $name = array_shift( $args );
3689  if ( isset( $args['options'] ) ) {
3690  unset( $args['options'] );
3691  wfDeprecated(
3692  'Adding "options" to ' . __METHOD__ . ' is no longer supported',
3693  '1.20'
3694  );
3695  }
3696  } else {
3697  $args = array();
3698  $name = $spec;
3699  }
3700  $s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
3701  }
3702  $this->addWikiText( $s );
3703  }
3704 
3714  public function includeJQuery( $modules = array() ) {
3715  return array();
3716  }
3723  public function enableTOC( $flag = true ) {
3724  $this->mEnableTOC = $flag;
3725  }
3726 
3731  public function isTOCEnabled() {
3732  return $this->mEnableTOC;
3733  }
3740  public function enableSectionEditLinks( $flag = true ) {
3741  $this->mEnableSectionEditLinks = $flag;
3742  }
3743 
3748  public function sectionEditLinksEnabled() {
3750  }
3751 }
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:1892
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:1187
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:1261
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:316
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:560
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:1137
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:215
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:974
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:1337
OutputPage\enableClientCache
enableClientCache( $state)
Use enableClientCache(false) to force it to send nocache headers.
Definition: OutputPage.php:1742
OutputPage\styleLink
styleLink( $style, $options)
Generate <link> tags for stylesheets.
Definition: OutputPage.php:3550
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:3633
ContextSource\getContext
getContext()
Get the RequestContext object.
Definition: ContextSource.php:40
OutputPage\getLanguageLinks
getLanguageLinks()
Get the list of language links.
Definition: OutputPage.php:1178
OutputPage\reduceAllowedModules
reduceAllowedModules( $type, $level)
Limit the highest level of CSS/JS untrustworthiness allowed.
Definition: OutputPage.php:1351
PROTO_CANONICAL
const PROTO_CANONICAL
Definition: Defines.php:271
wfBCP47
wfBCP47( $code)
Get the normalised IETF language tag See unit test for examples.
Definition: GlobalFunctions.php:3977
OutputPage\addSubtitle
addSubtitle( $str)
Add $str to the subtitle.
Definition: OutputPage.php:941
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:1858
OutputPage\$mEnableSectionEditLinks
bool $mEnableSectionEditLinks
Whether parser output should contain section edit links.
Definition: OutputPage.php:263
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:3026
OutputPage\$mContainsNewMagic
$mContainsNewMagic
Definition: OutputPage.php:170
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ResourceLoader\makeConfigSetScript
static makeConfigSetScript(array $configuration)
Returns JS code which will set the MediaWiki configuration array to the given value.
Definition: ResourceLoader.php:1149
Html\htmlHeader
static htmlHeader( $attribs=array())
Constructs the opening html-tag with necessary doctypes depending on global variables.
Definition: Html.php:804
UserBlockedError
Show an error when the user tries to do something whilst blocked.
Definition: UserBlockedError.php:27
OutputPage\$mLinktags
$mLinktags
Definition: OutputPage.php:42
OutputPage\showFileRenameError
showFileRenameError( $old, $new)
Definition: OutputPage.php:2463
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:2903
OutputPage\$mRedirectedFrom
Title $mRedirectedFrom
If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redire...
Definition: OutputPage.php:246
OutputPage\setTitle
setTitle(Title $t)
Set the Title object to use.
Definition: OutputPage.php:912
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:611
OutputPage\__construct
__construct(IContextSource $context=null)
Constructor for OutputPage.
Definition: OutputPage.php:270
OutputPage\addModuleMessages
addModuleMessages( $modules)
Add only messages of one or more modules recognized by the resource loader.
Definition: OutputPage.php:553
OutputPage\getScript
getScript()
Get all registered JS and CSS tags for the header.
Definition: OutputPage.php:432
OutputPage\addModuleStyles
addModuleStyles( $modules)
Add only CSS of one or more modules recognized by the resource loader.
Definition: OutputPage.php:530
OutputPage\loginToUse
loginToUse()
Produce the stock "please login to use the wiki" page.
Definition: OutputPage.php:2303
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:1149
OutputPage\enableSectionEditLinks
enableSectionEditLinks( $flag=true)
Enables/disables section edit links, doesn't override NOEDITSECTION
Definition: OutputPage.php:3734
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:631
OutputPage\getFrameOptions
getFrameOptions()
Get the X-Frame-Options header value (without the name part), or false if there isn't one.
Definition: OutputPage.php:1922
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3706
text
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
OutputPage\blockedPage
blockedPage()
Produce a "user is blocked" page.
Definition: OutputPage.php:2145
OutputPage\getRevisionId
getRevisionId()
Get the displayed revision ID.
Definition: OutputPage.php:1434
$timestamp
if( $limit) $timestamp
Definition: importImages.php:104
OutputPage\addParserOutput
addParserOutput(&$parserOutput)
Add a ParserOutput object.
Definition: OutputPage.php:1641
OutputPage\addWikiTextTitleTidy
addWikiTextTitleTidy( $text, &$title, $linestart=true)
Add wikitext with a custom Title object and tidy enabled.
Definition: OutputPage.php:1536
OutputPage\clearHTML
clearHTML()
Clear the body HTML.
Definition: OutputPage.php:1389
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:1248
OutputPage\addScript
addScript( $script)
Add raw HTML to the list of scripts (including <script> tag, etc.)
Definition: OutputPage.php:372
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:2497
OutputPage\$mIsArticleRelated
$mIsArticleRelated
Should be private.
Definition: OutputPage.php:71
OutputPage\buildCssLinksArray
buildCssLinksArray()
Definition: OutputPage.php:3525
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:825
$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:1307
OutputPage\getBottomScripts
getBottomScripts()
JS stuff to put at the bottom of the "<body>".
Definition: OutputPage.php:2971
OutputPage\$mCategoryLinks
$mCategoryLinks
Definition: OutputPage.php:108
OutputPage\showFileNotFoundError
showFileNotFoundError( $name)
Definition: OutputPage.php:2471
OutputPage\getHtmlFromLoaderLinks
static getHtmlFromLoaderLinks(Array $links)
Build html output from an array of links from makeResourceLoaderLink.
Definition: OutputPage.php:2822
$resourceLoader
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled also a ContextSource error or success such as when responding to a resource loader request or generating HTML output & $resourceLoader
Definition: hooks.txt:1961
OutputPage\$mModuleMessages
$mModuleMessages
Definition: OutputPage.php:140
OutputPage\getModuleStyles
getModuleStyles( $filter=false, $position=null)
Get the list of module CSS to include on this page.
Definition: OutputPage.php:517
ResourceLoaderModule\TYPE_MESSAGES
const TYPE_MESSAGES
Definition: ResourceLoaderModule.php:33
$params
$params
Definition: styleTest.css.php:40
OutputPage\getHeadLinks
getHeadLinks()
Definition: OutputPage.php:3378
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:2281
OutputPage\parseInline
parseInline( $text, $linestart=true, $interface=false)
Parse wikitext, strip paragraphs, and return the HTML.
Definition: OutputPage.php:1715
OutputPage\addScriptFile
addScriptFile( $file, $version=null)
Add a JavaScript file out of skins/common, or a given relative path.
Definition: OutputPage.php:404
$s
$s
Definition: mergeMessageFileList.php:156
OutputPage\parserOptions
parserOptions( $options=null)
Get/set the ParserOptions object to use for wikitext parsing.
Definition: OutputPage.php:1409
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:1478
OutputPage\getSyndicationLinks
getSyndicationLinks()
Return URLs for each supported syndication format for this page.
Definition: OutputPage.php:1094
OutputPage\$mVaryHeader
$mVaryHeader
Definition: OutputPage.php:237
ContextSource\canUseWikiPage
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
Definition: ContextSource.php:99
ContextSource\getRequest
getRequest()
Get the WebRequest object.
Definition: ContextSource.php:77
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:28
OutputPage\$mJsConfigVars
$mJsConfigVars
Definition: OutputPage.php:142
$wgContLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
Definition: design.txt:56
messages
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. Handler functions that modify $result should generally return false to further attempts at conversion. 'ContribsPager you ll need to handle error messages
Definition: hooks.txt:896
OutputPage\$mHideNewSectionLink
$mHideNewSectionLink
Definition: OutputPage.php:195
User\groupHasPermission
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
Definition: User.php:4147
OutputPage\getRedirect
getRedirect()
Get the URL to redirect to, or an empty string if not redirect URL set.
Definition: OutputPage.php:296
OutputPage\setCanonicalUrl
setCanonicalUrl( $url)
Set the URL to be used for the <link rel="canonical">.
Definition: OutputPage.php:347
OutputPage\$mExtStyles
$mExtStyles
Additional stylesheets. Looks like this is for extensions. Might be replaced by resource loader.
Definition: OutputPage.php:46
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
$link
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
Definition: hooks.txt:2154
ContextSource\getTitle
getTitle()
Get the Title object.
Definition: ContextSource.php:87
OutputPage\$mIndexPolicy
$mIndexPolicy
Definition: OutputPage.php:235
Skin\getHtmlElementAttributes
getHtmlElementAttributes()
Definition: Skin.php:482
Html\inlineScript
static inlineScript( $contents)
Output a "<script>" tag with the given contents.
Definition: Html.php:573
OutputPage\permissionRequired
permissionRequired( $permission)
Display an error page noting that a given permission bit is required.
Definition: OutputPage.php:2294
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:2467
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:1369
OutputPage\addHeadItem
addHeadItem( $name, $value)
Add or replace an header item to the output.
Definition: OutputPage.php:601
OutputPage\addWikiTextTidy
addWikiTextTidy( $text, $linestart=true)
Add wikitext with tidy enabled.
Definition: OutputPage.php:1546
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:494
OutputPage\getRevisionTimestamp
getRevisionTimestamp()
Get the timestamp of displayed revision.
Definition: OutputPage.php:1455
OutputPage\addWikiMsgArray
addWikiMsgArray( $name, $args)
Add a wikitext-formatted message to the output.
Definition: OutputPage.php:3647
OutputPage\enableTOC
enableTOC( $flag=true)
Enables/disables TOC, doesn't override NOTOC
Definition: OutputPage.php:3717
OutputPage\transformCssMedia
static transformCssMedia( $media)
Transform "media" attribute based on request parameters.
Definition: OutputPage.php:3591
OutputPage\setLastModified
setLastModified( $timestamp)
Override the last modified timestamp.
Definition: OutputPage.php:768
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:1025
OutputPage\addWikiTextWithTitle
addWikiTextWithTitle( $text, &$title, $linestart=true)
Add wikitext with a custom Title object.
Definition: OutputPage.php:1525
Html\closeElement
static closeElement( $element)
Returns "</$element>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
Definition: Html.php:235
Xml\encodeJsCall
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
Definition: Xml.php:665
Html\isXmlMimeType
static isXmlMimeType( $mimetype)
Determines if the given mime type is xml.
Definition: Html.php:849
OutputPage\readOnlyPage
readOnlyPage( $source=null, $protected=false, $reasons=array(), $action=null)
Display a page stating that the Wiki is in read-only mode, and optionally show the source of the page...
Definition: OutputPage.php:2365
OutputPage\$mPageTitleActionText
$mPageTitleActionText
Definition: OutputPage.php:205
OutputPage\showErrorPage
showErrorPage( $title, $msg, $params=array())
Output a standard error page.
Definition: OutputPage.php:2184
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:68
Html\openElement
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:166
OutputPage\getModuleMessages
getModuleMessages( $filter=false, $position=null)
Get the list of module messages to include on this page.
Definition: OutputPage.php:542
$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:3390
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:3408
OutputPage\sendCacheControl
sendCacheControl()
Send cache control HTTP headers.
Definition: OutputPage.php:1935
OutputPage\setETag
setETag( $tag)
Set the value of the ETag HTTP header, only used if $wgUseETag is true.
Definition: OutputPage.php:620
OutputPage\out
out( $ins)
Actually output something with print.
Definition: OutputPage.php:2136
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1174
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2464
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:3786
OutputPage\output
output()
Finally, all the text has been munged and accumulated into the object, let's actually output it:
Definition: OutputPage.php:2017
OutputPage\$mEnableTOC
bool $mEnableTOC
Whether parser output should contain table of contents.
Definition: OutputPage.php:259
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:148
OutputPage\$mInlineStyles
$mInlineStyles
Inline CSS styles.
Definition: OutputPage.php:125
OutputPage\setFileVersion
setFileVersion( $file)
Set the displayed file version.
Definition: OutputPage.php:1465
OutputPage\showUnexpectedValueError
showUnexpectedValueError( $name, $val)
Definition: OutputPage.php:2455
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:2613
OutputPage\isTOCEnabled
isTOCEnabled()
Definition: OutputPage.php:3725
ContextSource
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
Definition: ContextSource.php:30
Html\linkedScript
static linkedScript( $url)
Output a "<script>" tag linking to the given URL, e.g., "<script src=foo.js></script>".
Definition: Html.php:592
TS_ISO_8601
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
Definition: GlobalFunctions.php:2495
OutputPage\$mAllowedModules
$mAllowedModules
Definition: OutputPage.php:159
ContextSource\getWikiPage
getWikiPage()
Get the WikiPage object.
Definition: ContextSource.php:112
OutputPage\setFeedAppendQuery
setFeedAppendQuery( $val)
Add default feeds to the page header This is mainly kept for backward compatibility,...
Definition: OutputPage.php:1054
OutputPage\isDisabled
isDisabled()
Return whether the output will be completely disabled.
Definition: OutputPage.php:1007
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:1424
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:1114
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:1282
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:921
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4058
OutputPage\addVaryHeader
addVaryHeader( $header, $option=null)
Add an HTTP header that will influence on the cache.
Definition: OutputPage.php:1800
OutputPage\getStatusMessage
static getStatusMessage( $code)
Get the message associated with the HTTP response code $code.
Definition: OutputPage.php:2008
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:1510
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:1819
OutputPage\addModules
addModules( $modules)
Add one or more modules recognized by the resource loader.
Definition: OutputPage.php:482
OutputPage\showLagWarning
showLagWarning( $lag)
Show a warning about slave lag.
Definition: OutputPage.php:2438
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:932
OutputPage\getPageTitleActionText
getPageTitleActionText()
Get the value of the "action text".
Definition: OutputPage.php:834
OutputPage\getCacheVaryCookies
getCacheVaryCookies()
Get the list of cookies that will influence on the cache.
Definition: OutputPage.php:1751
OutputPage\getHeadItems
getHeadItems()
Get all header items in a string.
Definition: OutputPage.php:587
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:236
OutputPage\addLanguageLinks
addLanguageLinks( $newLinkArray)
Add new language links.
Definition: OutputPage.php:1159
OutputPage\formatPermissionsErrorMessage
formatPermissionsErrorMessage( $errors, $action=null)
Format a list of error messages.
Definition: OutputPage.php:2314
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:93
ResourceLoader\makeLoaderURL
static makeLoaderURL( $modules, $lang, $skin, $user=null, $version=null, $debug=false, $only=null, $printable=false, $handheld=false, $extraQuery=array())
Build a load.php URL.
Definition: ResourceLoader.php:1212
$cookies
return false to override stock group removal can be modified modifiable will be added to $_SESSION & $cookies
Definition: hooks.txt:2843
ResourceLoaderModule\getOrigin
getOrigin()
Get this module's origin.
Definition: ResourceLoaderModule.php:97
OutputPage\addBacklinkSubtitle
addBacklinkSubtitle(Title $title)
Add a subtitle containing a backlink to a page.
Definition: OutputPage.php:954
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:1587
OutputPage\isArticle
isArticle()
Return whether the content displayed page is related to the source of the corresponding article on th...
Definition: OutputPage.php:1127
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:327
OutputPage\addInlineScript
addInlineScript( $script)
Add a self-contained script tag with the given contents.
Definition: OutputPage.php:423
OutputPage\getArticleBodyOnly
getArticleBodyOnly()
Return whether the output will contain only the body of the article.
Definition: OutputPage.php:640
OutputPage\getPreventClickjacking
getPreventClickjacking()
Get the prevent-clickjacking flag.
Definition: OutputPage.php:1911
$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:393
OutputPage\setStatusCode
setStatusCode( $statusCode)
Set the HTTP status code to send with the output.
Definition: OutputPage.php:305
OutputPage\includeJQuery
includeJQuery( $modules=array())
Include jQuery core.
Definition: OutputPage.php:3708
OutputPage\makeResourceLoaderLink
makeResourceLoaderLink( $modules, $only, $useESI=false, array $extraQuery=array(), $loadCall=false)
TODO: Document.
Definition: OutputPage.php:2629
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:1775
OutputPage\getPageTitle
getPageTitle()
Return the "page title", i.e.
Definition: OutputPage.php:903
OutputPage\disable
disable()
Disable output completely, i.e.
Definition: OutputPage.php:998
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:3742
OutputPage\setIndexPolicy
setIndexPolicy( $policy)
Set the index policy for the page, but leave the follow policy un- touched.
Definition: OutputPage.php:798
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
$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:2209
OutputPage\setRevisionTimestamp
setRevisionTimestamp( $timestamp)
Set the timestamp of the revision which will be displayed.
Definition: OutputPage.php:1445
$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:578
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:2425
$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:218
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:662
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:1731
OutputPage\$mNewSectionLink
$mNewSectionLink
Definition: OutputPage.php:194
OutputPage\setTarget
setTarget( $target)
Sets ResourceLoader target for load.php links.
Definition: OutputPage.php:569
OutputPage\setHTMLTitle
setHTMLTitle( $name)
"HTML title" means the contents of "<title>".
Definition: OutputPage.php:847
OutputPage\$styles
$styles
An array of stylesheet filenames (relative from skins path), with options for CSS media,...
Definition: OutputPage.php:228
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:251
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:3674
OutputPage\buildCssLinks
buildCssLinks()
Build a set of "<link>" elements for the stylesheets specified in the $this->styles array.
Definition: OutputPage.php:3443
Html\inlineStyle
static inlineStyle( $contents, $media='all')
Output a "<style>" tag with the given contents for the given media type (if any).
Definition: Html.php:607
OutputPage\filterModules
filterModules( $modules, $position=null, $type=ResourceLoaderModule::TYPE_COMBINED)
Filter an array of modules to remove insufficiently trustworthy members, and modules which are no lon...
Definition: OutputPage.php:444
OutputPage\prependHTML
prependHTML( $text)
Prepend $text to the body HTML.
Definition: OutputPage.php:1360
Linker\formatTemplates
static formatTemplates( $templates, $preview=false, $section=false, $more=null)
Returns HTML for the "templates used on this page" list.
Definition: Linker.php:1936
MWNamespace\exists
static exists( $index)
Returns whether the specified namespace exists.
Definition: Namespace.php:171
OutputPage\$mEnableClientCache
$mEnableClientCache
Definition: OutputPage.php:186
OutputPage\$mCategories
$mCategories
Definition: OutputPage.php:109
OutputPage\getHTMLTitle
getHTMLTitle()
Return the "HTML title", i.e.
Definition: OutputPage.php:860
OutputPage\showFileCopyError
showFileCopyError( $old, $new)
Definition: OutputPage.php:2459
ResourceLoaderModule\ORIGIN_CORE_INDIVIDUAL
const ORIGIN_CORE_INDIVIDUAL
Definition: ResourceLoaderModule.php:40
OutputPage\clearSubtitle
clearSubtitle()
Clear the subtitles.
Definition: OutputPage.php:965
OutputPage\getMetadataAttribute
getMetadataAttribute()
Get the value of the "rel" attribute for metadata links.
Definition: OutputPage.php:356
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:468
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:812
OutputPage\setPageTitle
setPageTitle( $name)
"Page title" means the contents of <h1>.
Definition: OutputPage.php:881
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:681
$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:2483
OutputPage\getAllowedModules
getAllowedModules( $type)
Get the level of JavaScript / CSS untrustworthiness allowed on this page.
Definition: OutputPage.php:1319
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:651
OutputPage\isPrintable
isPrintable()
Return whether the page is "printable".
Definition: OutputPage.php:991
OutputPage\setSyndicated
setSyndicated( $show=true)
Add or remove feed links in the page header This is mainly kept for backward compatibility,...
Definition: OutputPage.php:1037
$wgParser
$wgParser
Definition: Setup.php:587
OutputPage\$mTarget
string null $mTarget
ResourceLoader target for load.php links.
Definition: OutputPage.php:255
OutputPage\addInlineStyle
addInlineStyle( $style_css, $flip='noflip')
Adds inline CSS styles.
Definition: OutputPage.php:3429
$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:3141
Html\linkedStyle
static linkedStyle( $url, $media='all')
Output a "<link rel=stylesheet>" linking to the given URL for the given media type (if any).
Definition: Html.php:628
OutputPage\addExtensionStyle
addExtensionStyle( $url)
Register and add a stylesheet from an extension directory.
Definition: OutputPage.php:384
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:1169
OutputPage\setRedirectedFrom
setRedirectedFrom( $t)
Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
Definition: OutputPage.php:869
OutputPage\addWikiTextTitle
addWikiTextTitle( $text, Title $title, $linestart, $tidy=false, $interface=false)
Add wikitext with a custom Title object.
Definition: OutputPage.php:1561
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:2851
OutputPage\redirect
redirect( $url, $responsecode='302')
Redirect to $url rather than displaying the normal page.
Definition: OutputPage.php:285
$path
$path
Definition: NoLocalSettings.php:35
OutputPage\setPrintable
setPrintable()
Set the page as printable, i.e.
Definition: OutputPage.php:982
OutputPage\getHeadLinksArray
getHeadLinksArray()
Definition: OutputPage.php:3163
OutputPage\$mTemplateIds
$mTemplateIds
Definition: OutputPage.php:147
OutputPage\$mJQueryDone
$mJQueryDone
Whether jQuery is already handled.
Definition: OutputPage.php:233
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:505
OutputPage\allowClickjacking
allowClickjacking()
Turn off frame-breaking.
Definition: OutputPage.php:1901
OutputPage\addElement
addElement( $element, $attribs=array(), $contents='')
Shortcut for adding an Html::element via addHTML.
Definition: OutputPage.php:1382
OutputPage\showFatalError
showFatalError( $message)
Definition: OutputPage.php:2449
OutputPage\getHTML
getHTML()
Get the body HTML.
Definition: OutputPage.php:1398
$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:338
OutputPage\showNewSectionLink
showNewSectionLink()
Show an "add new section" link?
Definition: OutputPage.php:1016
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:1675
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:3003
OutputPage\$mPrintable
$mPrintable
Should be private.
Definition: OutputPage.php:77
Skin
The main skin class which provides methods and properties for all other skins.
Definition: Skin.php:35
$error
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
Definition: hooks.txt:2578
OutputPage\$mPagetitle
$mPagetitle
Should be private - has getter and setter. Contains the HTML title.
Definition: OutputPage.php:49
Html\rawElement
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
Definition: Html.php:124
$query
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1105
OutputPage\$mRevisionTimestamp
$mRevisionTimestamp
Definition: OutputPage.php:216
OutputPage\getJsConfigVars
getJsConfigVars()
Get the javascript config vars to include on this page.
Definition: OutputPage.php:2993
OutputPage\$mContainsOldMagic
$mContainsOldMagic
Definition: OutputPage.php:170
OutputPage\getTemplateIds
getTemplateIds()
Get the templates used on this page.
Definition: OutputPage.php:1488
$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:1086
OutputPage\$mFeedLinksAppendQuery
$mFeedLinksAppendQuery
Definition: OutputPage.php:152
OutputPage\getFileSearchOptions
getFileSearchOptions()
Get the files used on this page.
Definition: OutputPage.php:1498
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:1828
OutputPage\$mPreventClickjacking
$mPreventClickjacking
Definition: OutputPage.php:212
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:2159
OutputPage\addTemplate
addTemplate(&$template)
Add the output of a QuickTemplate to the output buffer.
Definition: OutputPage.php:1659
OutputPage\getFeedAppendQuery
getFeedAppendQuery()
Will currently always return null.
Definition: OutputPage.php:1103
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:1074
OutputPage\setRobotPolicy
setRobotPolicy( $policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
Definition: OutputPage.php:780
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:2527
$type
$type
Definition: testCompression.php:46
OutputPage\getCategories
getCategories()
Get the list of category names this page belongs to.
Definition: OutputPage.php:1270