MediaWiki  1.23.6
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 
160 
166  var $mDoNothing = false;
167 
168  // Parser related.
170 
175  protected $mParserOptions = null;
176 
184 
185  // Gwicke work on squid caching? Roughly from 2003.
186  var $mEnableClientCache = true;
187 
192  var $mArticleBodyOnly = false;
193 
194  var $mNewSectionLink = false;
195  var $mHideNewSectionLink = false;
196 
202  var $mNoGallery = false;
203 
204  // should be private.
205  var $mPageTitleActionText = '';
207 
208  // Cache stuff. Looks like mEnableClientCache
209  var $mSquidMaxage = 0;
210 
211  // @todo document
213 
215  var $mRevisionId = null;
216  private $mRevisionTimestamp = null;
217 
218  var $mFileVersion = null;
219 
228  var $styles = array();
229 
233  protected $mJQueryDone = false;
234 
235  private $mIndexPolicy = 'index';
236  private $mFollowPolicy = 'follow';
237  private $mVaryHeader = array(
238  'Accept-Encoding' => array( 'list-contains=gzip' ),
239  );
240 
247  private $mRedirectedFrom = null;
248 
252  private $mProperties = array();
253 
257  private $mTarget = null;
258 
262  private $mEnableTOC = true;
263 
267  private $mEnableSectionEditLinks = true;
268 
274  function __construct( IContextSource $context = null ) {
275  if ( $context === null ) {
276  # Extensions should use `new RequestContext` instead of `new OutputPage` now.
277  wfDeprecated( __METHOD__, '1.18' );
278  } else {
279  $this->setContext( $context );
280  }
281  }
282 
289  public function redirect( $url, $responsecode = '302' ) {
290  # Strip newlines as a paranoia check for header injection in PHP<5.1.2
291  $this->mRedirect = str_replace( "\n", '', $url );
292  $this->mRedirectCode = $responsecode;
293  }
294 
300  public function getRedirect() {
301  return $this->mRedirect;
302  }
303 
309  public function setStatusCode( $statusCode ) {
310  $this->mStatusCode = $statusCode;
311  }
312 
320  function addMeta( $name, $val ) {
321  array_push( $this->mMetatags, array( $name, $val ) );
322  }
323 
331  function addLink( $linkarr ) {
332  array_push( $this->mLinktags, $linkarr );
333  }
334 
342  function addMetadataLink( $linkarr ) {
343  $linkarr['rel'] = $this->getMetadataAttribute();
344  $this->addLink( $linkarr );
345  }
346 
351  function setCanonicalUrl( $url ) {
352  $this->mCanonicalUrl = $url;
353  }
354 
360  public function getMetadataAttribute() {
361  # note: buggy CC software only reads first "meta" link
362  static $haveMeta = false;
363  if ( $haveMeta ) {
364  return 'alternate meta';
365  } else {
366  $haveMeta = true;
367  return 'meta';
368  }
369  }
370 
376  function addScript( $script ) {
377  $this->mScripts .= $script . "\n";
378  }
379 
388  public function addExtensionStyle( $url ) {
389  array_push( $this->mExtStyles, $url );
390  }
391 
397  function getExtStyle() {
398  return $this->mExtStyles;
399  }
400 
408  public function addScriptFile( $file, $version = null ) {
409  global $wgStylePath, $wgStyleVersion;
410  // See if $file parameter is an absolute URL or begins with a slash
411  if ( substr( $file, 0, 1 ) == '/' || preg_match( '#^[a-z]*://#i', $file ) ) {
412  $path = $file;
413  } else {
414  $path = "{$wgStylePath}/common/{$file}";
415  }
416  if ( is_null( $version ) ) {
417  $version = $wgStyleVersion;
418  }
420  }
421 
427  public function addInlineScript( $script ) {
428  $this->mScripts .= Html::inlineScript( "\n$script\n" ) . "\n";
429  }
430 
436  function getScript() {
437  return $this->mScripts . $this->getHeadItems();
438  }
439 
448  protected function filterModules( $modules, $position = null, $type = ResourceLoaderModule::TYPE_COMBINED ) {
450  $filteredModules = array();
451  foreach ( $modules as $val ) {
452  $module = $resourceLoader->getModule( $val );
453  if ( $module instanceof ResourceLoaderModule
454  && $module->getOrigin() <= $this->getAllowedModules( $type )
455  && ( is_null( $position ) || $module->getPosition() == $position )
456  && ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) )
457  ) {
458  $filteredModules[] = $val;
459  }
460  }
461  return $filteredModules;
462  }
463 
472  public function getModules( $filter = false, $position = null, $param = 'mModules' ) {
473  $modules = array_values( array_unique( $this->$param ) );
474  return $filter
475  ? $this->filterModules( $modules, $position )
476  : $modules;
477  }
478 
486  public function addModules( $modules ) {
487  $this->mModules = array_merge( $this->mModules, (array)$modules );
488  }
489 
498  public function getModuleScripts( $filter = false, $position = null ) {
499  return $this->getModules( $filter, $position, 'mModuleScripts' );
500  }
501 
509  public function addModuleScripts( $modules ) {
510  $this->mModuleScripts = array_merge( $this->mModuleScripts, (array)$modules );
511  }
512 
521  public function getModuleStyles( $filter = false, $position = null ) {
522  return $this->getModules( $filter, $position, 'mModuleStyles' );
523  }
524 
534  public function addModuleStyles( $modules ) {
535  $this->mModuleStyles = array_merge( $this->mModuleStyles, (array)$modules );
536  }
537 
546  public function getModuleMessages( $filter = false, $position = null ) {
547  return $this->getModules( $filter, $position, 'mModuleMessages' );
548  }
549 
557  public function addModuleMessages( $modules ) {
558  $this->mModuleMessages = array_merge( $this->mModuleMessages, (array)$modules );
559  }
560 
564  public function getTarget() {
565  return $this->mTarget;
566  }
567 
573  public function setTarget( $target ) {
574  $this->mTarget = $target;
575  }
576 
582  function getHeadItemsArray() {
583  return $this->mHeadItems;
584  }
585 
591  function getHeadItems() {
592  $s = '';
593  foreach ( $this->mHeadItems as $item ) {
594  $s .= $item;
595  }
596  return $s;
597  }
598 
605  public function addHeadItem( $name, $value ) {
606  $this->mHeadItems[$name] = $value;
607  }
608 
615  public function hasHeadItem( $name ) {
616  return isset( $this->mHeadItems[$name] );
617  }
618 
624  function setETag( $tag ) {
625  $this->mETag = $tag;
626  }
627 
635  public function setArticleBodyOnly( $only ) {
636  $this->mArticleBodyOnly = $only;
637  }
638 
644  public function getArticleBodyOnly() {
646  }
647 
655  public function setProperty( $name, $value ) {
656  $this->mProperties[$name] = $value;
657  }
658 
666  public function getProperty( $name ) {
667  if ( isset( $this->mProperties[$name] ) ) {
668  return $this->mProperties[$name];
669  } else {
670  return null;
671  }
672  }
673 
685  public function checkLastModified( $timestamp ) {
686  global $wgCachePages, $wgCacheEpoch, $wgUseSquid, $wgSquidMaxage;
687 
688  if ( !$timestamp || $timestamp == '19700101000000' ) {
689  wfDebug( __METHOD__ . ": CACHE DISABLED, NO TIMESTAMP\n" );
690  return false;
691  }
692  if ( !$wgCachePages ) {
693  wfDebug( __METHOD__ . ": CACHE DISABLED\n" );
694  return false;
695  }
696 
698  $modifiedTimes = array(
699  'page' => $timestamp,
700  'user' => $this->getUser()->getTouched(),
701  'epoch' => $wgCacheEpoch
702  );
703  if ( $wgUseSquid ) {
704  // bug 44570: the core page itself may not change, but resources might
705  $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $wgSquidMaxage );
706  }
707  wfRunHooks( 'OutputPageCheckLastModified', array( &$modifiedTimes ) );
708 
709  $maxModified = max( $modifiedTimes );
710  $this->mLastModified = wfTimestamp( TS_RFC2822, $maxModified );
711 
712  $clientHeader = $this->getRequest()->getHeader( 'If-Modified-Since' );
713  if ( $clientHeader === false ) {
714  wfDebug( __METHOD__ . ": client did not send If-Modified-Since header\n", 'log' );
715  return false;
716  }
717 
718  # IE sends sizes after the date like this:
719  # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
720  # this breaks strtotime().
721  $clientHeader = preg_replace( '/;.*$/', '', $clientHeader );
722 
723  wfSuppressWarnings(); // E_STRICT system time bitching
724  $clientHeaderTime = strtotime( $clientHeader );
726  if ( !$clientHeaderTime ) {
727  wfDebug( __METHOD__ . ": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
728  return false;
729  }
730  $clientHeaderTime = wfTimestamp( TS_MW, $clientHeaderTime );
731 
732  # Make debug info
733  $info = '';
734  foreach ( $modifiedTimes as $name => $value ) {
735  if ( $info !== '' ) {
736  $info .= ', ';
737  }
738  $info .= "$name=" . wfTimestamp( TS_ISO_8601, $value );
739  }
740 
741  wfDebug( __METHOD__ . ": client sent If-Modified-Since: " .
742  wfTimestamp( TS_ISO_8601, $clientHeaderTime ) . "\n", 'log' );
743  wfDebug( __METHOD__ . ": effective Last-Modified: " .
744  wfTimestamp( TS_ISO_8601, $maxModified ) . "\n", 'log' );
745  if ( $clientHeaderTime < $maxModified ) {
746  wfDebug( __METHOD__ . ": STALE, $info\n", 'log' );
747  return false;
748  }
749 
750  # Not modified
751  # Give a 304 response code and disable body output
752  wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", 'log' );
753  ini_set( 'zlib.output_compression', 0 );
754  $this->getRequest()->response()->header( "HTTP/1.1 304 Not Modified" );
755  $this->sendCacheControl();
756  $this->disable();
757 
758  // Don't output a compressed blob when using ob_gzhandler;
759  // it's technically against HTTP spec and seems to confuse
760  // Firefox when the response gets split over two packets.
762 
763  return true;
764  }
765 
772  public function setLastModified( $timestamp ) {
773  $this->mLastModified = wfTimestamp( TS_RFC2822, $timestamp );
774  }
775 
784  public function setRobotPolicy( $policy ) {
785  $policy = Article::formatRobotPolicy( $policy );
786 
787  if ( isset( $policy['index'] ) ) {
788  $this->setIndexPolicy( $policy['index'] );
789  }
790  if ( isset( $policy['follow'] ) ) {
791  $this->setFollowPolicy( $policy['follow'] );
792  }
793  }
794 
802  public function setIndexPolicy( $policy ) {
803  $policy = trim( $policy );
804  if ( in_array( $policy, array( 'index', 'noindex' ) ) ) {
805  $this->mIndexPolicy = $policy;
806  }
807  }
808 
816  public function setFollowPolicy( $policy ) {
817  $policy = trim( $policy );
818  if ( in_array( $policy, array( 'follow', 'nofollow' ) ) ) {
819  $this->mFollowPolicy = $policy;
820  }
821  }
822 
829  public function setPageTitleActionText( $text ) {
830  $this->mPageTitleActionText = $text;
831  }
832 
838  public function getPageTitleActionText() {
839  if ( isset( $this->mPageTitleActionText ) ) {
841  }
842  return '';
843  }
844 
851  public function setHTMLTitle( $name ) {
852  if ( $name instanceof Message ) {
853  $this->mHTMLtitle = $name->setContext( $this->getContext() )->text();
854  } else {
855  $this->mHTMLtitle = $name;
856  }
857  }
858 
864  public function getHTMLTitle() {
865  return $this->mHTMLtitle;
866  }
867 
873  public function setRedirectedFrom( $t ) {
874  $this->mRedirectedFrom = $t;
875  }
876 
885  public function setPageTitle( $name ) {
886  if ( $name instanceof Message ) {
887  $name = $name->setContext( $this->getContext() )->text();
888  }
889 
890  # change "<script>foo&bar</script>" to "&lt;script&gt;foo&amp;bar&lt;/script&gt;"
891  # but leave "<i>foobar</i>" alone
893  $this->mPagetitle = $nameWithTags;
894 
895  # change "<i>foo&amp;bar</i>" to "foo&bar"
896  $this->setHTMLTitle(
897  $this->msg( 'pagetitle' )->rawParams( Sanitizer::stripAllTags( $nameWithTags ) )
898  ->inContentLanguage()
899  );
900  }
901 
907  public function getPageTitle() {
908  return $this->mPagetitle;
909  }
910 
916  public function setTitle( Title $t ) {
917  $this->getContext()->setTitle( $t );
918  }
919 
925  public function setSubtitle( $str ) {
926  $this->clearSubtitle();
927  $this->addSubtitle( $str );
928  }
929 
936  public function appendSubtitle( $str ) {
937  $this->addSubtitle( $str );
938  }
939 
945  public function addSubtitle( $str ) {
946  if ( $str instanceof Message ) {
947  $this->mSubtitle[] = $str->setContext( $this->getContext() )->parse();
948  } else {
949  $this->mSubtitle[] = $str;
950  }
951  }
952 
958  public function addBacklinkSubtitle( Title $title ) {
959  $query = array();
960  if ( $title->isRedirect() ) {
961  $query['redirect'] = 'no';
962  }
963  $this->addSubtitle( $this->msg( 'backlinksubtitle' )->rawParams( Linker::link( $title, null, array(), $query ) ) );
964  }
965 
969  public function clearSubtitle() {
970  $this->mSubtitle = array();
971  }
972 
978  public function getSubtitle() {
979  return implode( "<br />\n\t\t\t\t", $this->mSubtitle );
980  }
981 
986  public function setPrintable() {
987  $this->mPrintable = true;
988  }
989 
995  public function isPrintable() {
996  return $this->mPrintable;
997  }
998 
1002  public function disable() {
1003  $this->mDoNothing = true;
1004  }
1005 
1011  public function isDisabled() {
1012  return $this->mDoNothing;
1013  }
1014 
1020  public function showNewSectionLink() {
1021  return $this->mNewSectionLink;
1022  }
1023 
1029  public function forceHideNewSectionLink() {
1031  }
1032 
1041  public function setSyndicated( $show = true ) {
1042  if ( $show ) {
1043  $this->setFeedAppendQuery( false );
1044  } else {
1045  $this->mFeedLinks = array();
1046  }
1047  }
1048 
1058  public function setFeedAppendQuery( $val ) {
1059  global $wgAdvertisedFeedTypes;
1060 
1061  $this->mFeedLinks = array();
1062 
1063  foreach ( $wgAdvertisedFeedTypes as $type ) {
1064  $query = "feed=$type";
1065  if ( is_string( $val ) ) {
1066  $query .= '&' . $val;
1067  }
1068  $this->mFeedLinks[$type] = $this->getTitle()->getLocalURL( $query );
1069  }
1070  }
1078  public function addFeedLink( $format, $href ) {
1079  global $wgAdvertisedFeedTypes;
1080 
1081  if ( in_array( $format, $wgAdvertisedFeedTypes ) ) {
1082  $this->mFeedLinks[$format] = $href;
1083  }
1084  }
1085 
1090  public function isSyndicated() {
1091  return count( $this->mFeedLinks ) > 0;
1092  }
1093 
1098  public function getSyndicationLinks() {
1099  return $this->mFeedLinks;
1100  }
1101 
1107  public function getFeedAppendQuery() {
1109  }
1110 
1118  public function setArticleFlag( $v ) {
1119  $this->mIsarticle = $v;
1120  if ( $v ) {
1121  $this->mIsArticleRelated = $v;
1122  }
1123  }
1131  public function isArticle() {
1132  return $this->mIsarticle;
1133  }
1141  public function setArticleRelated( $v ) {
1142  $this->mIsArticleRelated = $v;
1143  if ( !$v ) {
1144  $this->mIsarticle = false;
1145  }
1146  }
1147 
1153  public function isArticleRelated() {
1154  return $this->mIsArticleRelated;
1155  }
1163  public function addLanguageLinks( $newLinkArray ) {
1164  $this->mLanguageLinks += $newLinkArray;
1165  }
1173  public function setLanguageLinks( $newLinkArray ) {
1174  $this->mLanguageLinks = $newLinkArray;
1175  }
1176 
1182  public function getLanguageLinks() {
1183  return $this->mLanguageLinks;
1184  }
1185 
1191  public function addCategoryLinks( $categories ) {
1193 
1194  if ( !is_array( $categories ) || count( $categories ) == 0 ) {
1195  return;
1196  }
1197 
1198  # Add the links to a LinkBatch
1199  $arr = array( NS_CATEGORY => $categories );
1200  $lb = new LinkBatch;
1201  $lb->setArray( $arr );
1202 
1203  # Fetch existence plus the hiddencat property
1204  $dbr = wfGetDB( DB_SLAVE );
1205  $res = $dbr->select( array( 'page', 'page_props' ),
1206  array( 'page_id', 'page_namespace', 'page_title', 'page_len', 'page_is_redirect', 'page_latest', 'pp_value' ),
1207  $lb->constructSet( 'page', $dbr ),
1208  __METHOD__,
1209  array(),
1210  array( 'page_props' => array( 'LEFT JOIN', array( 'pp_propname' => 'hiddencat', 'pp_page = page_id' ) ) )
1211  );
1212 
1213  # Add the results to the link cache
1214  $lb->addResultToCache( LinkCache::singleton(), $res );
1215 
1216  # Set all the values to 'normal'. This can be done with array_fill_keys in PHP 5.2.0+
1217  $categories = array_combine(
1218  array_keys( $categories ),
1219  array_fill( 0, count( $categories ), 'normal' )
1220  );
1221 
1222  # Mark hidden categories
1223  foreach ( $res as $row ) {
1224  if ( isset( $row->pp_value ) ) {
1225  $categories[$row->page_title] = 'hidden';
1226  }
1227  }
1228 
1229  # Add the remaining categories to the skin
1230  if ( wfRunHooks( 'OutputPageMakeCategoryLinks', array( &$this, $categories, &$this->mCategoryLinks ) ) ) {
1231  foreach ( $categories as $category => $type ) {
1232  $origcategory = $category;
1233  $title = Title::makeTitleSafe( NS_CATEGORY, $category );
1234  $wgContLang->findVariantLink( $category, $title, true );
1235  if ( $category != $origcategory ) {
1236  if ( array_key_exists( $category, $categories ) ) {
1237  continue;
1238  }
1239  }
1240  $text = $wgContLang->convertHtml( $title->getText() );
1241  $this->mCategories[] = $title->getText();
1242  $this->mCategoryLinks[$type][] = Linker::link( $title, $text );
1243  }
1244  }
1245  }
1246 
1252  public function setCategoryLinks( $categories ) {
1253  $this->mCategoryLinks = array();
1254  $this->addCategoryLinks( $categories );
1255  }
1256 
1265  public function getCategoryLinks() {
1266  return $this->mCategoryLinks;
1267  }
1268 
1274  public function getCategories() {
1275  return $this->mCategories;
1276  }
1284  public function disallowUserJs() {
1286  }
1294  public function isUserJsAllowed() {
1295  wfDeprecated( __METHOD__, '1.18' );
1297  }
1298 
1307  public function getAllowedModules( $type = null ) {
1309  }
1310 
1320  public function setAllowedModules( $type, $level ) {
1321  wfDeprecated( __METHOD__, '1.24' );
1322  $this->reduceAllowedModuleOrigin( $level );
1323  }
1324 
1334  public function reduceAllowedModules( $type, $level ) {
1335  wfDeprecated( __METHOD__, '1.24' );
1336  $this->reduceAllowedModuleOrigin( $level );
1337  }
1338 
1347  public function reduceAllowedModuleOrigin( $level ) {
1348  $this->mAllowedModuleOrigin = min( $this->mAllowedModuleOrigin, $level );
1349  }
1350 
1356  public function prependHTML( $text ) {
1357  $this->mBodytext = $text . $this->mBodytext;
1358  }
1359 
1365  public function addHTML( $text ) {
1366  $this->mBodytext .= $text;
1367  }
1368 
1378  public function addElement( $element, $attribs = array(), $contents = '' ) {
1379  $this->addHTML( Html::element( $element, $attribs, $contents ) );
1380  }
1381 
1385  public function clearHTML() {
1386  $this->mBodytext = '';
1387  }
1388 
1394  public function getHTML() {
1395  return $this->mBodytext;
1396  }
1397 
1405  public function parserOptions( $options = null ) {
1406  if ( !$this->mParserOptions ) {
1407  $this->mParserOptions = ParserOptions::newFromContext( $this->getContext() );
1408  $this->mParserOptions->setEditSection( false );
1409  }
1410  return wfSetVar( $this->mParserOptions, $options );
1411  }
1412 
1420  public function setRevisionId( $revid ) {
1421  $val = is_null( $revid ) ? null : intval( $revid );
1422  return wfSetVar( $this->mRevisionId, $val );
1423  }
1424 
1430  public function getRevisionId() {
1431  return $this->mRevisionId;
1432  }
1433 
1441  public function setRevisionTimestamp( $timestamp ) {
1442  return wfSetVar( $this->mRevisionTimestamp, $timestamp );
1443  }
1451  public function getRevisionTimestamp() {
1453  }
1461  public function setFileVersion( $file ) {
1462  $val = null;
1463  if ( $file instanceof File && $file->exists() ) {
1464  $val = array( 'time' => $file->getTimestamp(), 'sha1' => $file->getSha1() );
1465  }
1466  return wfSetVar( $this->mFileVersion, $val, true );
1467  }
1468 
1474  public function getFileVersion() {
1475  return $this->mFileVersion;
1476  }
1484  public function getTemplateIds() {
1485  return $this->mTemplateIds;
1486  }
1494  public function getFileSearchOptions() {
1495  return $this->mImageTimeKeys;
1496  }
1497 
1506  public function addWikiText( $text, $linestart = true, $interface = true ) {
1507  $title = $this->getTitle(); // Work around E_STRICT
1508  if ( !$title ) {
1509  throw new MWException( 'Title is null' );
1510  }
1511  $this->addWikiTextTitle( $text, $title, $linestart, /*tidy*/false, $interface );
1512  }
1513 
1521  public function addWikiTextWithTitle( $text, &$title, $linestart = true ) {
1522  $this->addWikiTextTitle( $text, $title, $linestart );
1523  }
1524 
1532  function addWikiTextTitleTidy( $text, &$title, $linestart = true ) {
1533  $this->addWikiTextTitle( $text, $title, $linestart, true );
1534  }
1542  public function addWikiTextTidy( $text, $linestart = true ) {
1543  $title = $this->getTitle();
1544  $this->addWikiTextTitleTidy( $text, $title, $linestart );
1545  }
1546 
1557  public function addWikiTextTitle( $text, Title $title, $linestart, $tidy = false, $interface = false ) {
1558  global $wgParser;
1559 
1560  wfProfileIn( __METHOD__ );
1561 
1562  $popts = $this->parserOptions();
1563  $oldTidy = $popts->setTidy( $tidy );
1564  $popts->setInterfaceMessage( (bool)$interface );
1565 
1566  $parserOutput = $wgParser->parse(
1567  $text, $title, $popts,
1568  $linestart, true, $this->mRevisionId
1569  );
1570 
1571  $popts->setTidy( $oldTidy );
1572 
1573  $this->addParserOutput( $parserOutput );
1574 
1575  wfProfileOut( __METHOD__ );
1576  }
1577 
1583  public function addParserOutputNoText( &$parserOutput ) {
1584  $this->mLanguageLinks += $parserOutput->getLanguageLinks();
1585  $this->addCategoryLinks( $parserOutput->getCategories() );
1586  $this->mNewSectionLink = $parserOutput->getNewSection();
1587  $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
1588 
1589  $this->mParseWarnings = $parserOutput->getWarnings();
1590  if ( !$parserOutput->isCacheable() ) {
1591  $this->enableClientCache( false );
1592  }
1593  $this->mNoGallery = $parserOutput->getNoGallery();
1594  $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
1595  $this->addModules( $parserOutput->getModules() );
1596  $this->addModuleScripts( $parserOutput->getModuleScripts() );
1597  $this->addModuleStyles( $parserOutput->getModuleStyles() );
1598  $this->addModuleMessages( $parserOutput->getModuleMessages() );
1599  $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
1600  $this->mPreventClickjacking = $this->mPreventClickjacking
1601  || $parserOutput->preventClickjacking();
1602 
1603  // Template versioning...
1604  foreach ( (array)$parserOutput->getTemplateIds() as $ns => $dbks ) {
1605  if ( isset( $this->mTemplateIds[$ns] ) ) {
1606  $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1607  } else {
1608  $this->mTemplateIds[$ns] = $dbks;
1609  }
1610  }
1611  // File versioning...
1612  foreach ( (array)$parserOutput->getFileSearchOptions() as $dbk => $data ) {
1613  $this->mImageTimeKeys[$dbk] = $data;
1614  }
1615 
1616  // Hooks registered in the object
1617  global $wgParserOutputHooks;
1618  foreach ( $parserOutput->getOutputHooks() as $hookInfo ) {
1619  list( $hookName, $data ) = $hookInfo;
1620  if ( isset( $wgParserOutputHooks[$hookName] ) ) {
1621  call_user_func( $wgParserOutputHooks[$hookName], $this, $parserOutput, $data );
1622  }
1623  }
1624 
1625  // Link flags are ignored for now, but may in the future be
1626  // used to mark individual language links.
1627  $linkFlags = array();
1628  wfRunHooks( 'LanguageLinks', array( $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ) );
1629  wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) );
1630  }
1631 
1637  function addParserOutput( &$parserOutput ) {
1638  $this->addParserOutputNoText( $parserOutput );
1639  $parserOutput->setTOCEnabled( $this->mEnableTOC );
1640 
1641  // Touch section edit links only if not previously disabled
1642  if ( $parserOutput->getEditSectionTokens() ) {
1643  $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks );
1644  }
1645  $text = $parserOutput->getText();
1646  wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
1647  $this->addHTML( $text );
1648  }
1649 
1655  public function addTemplate( &$template ) {
1656  $this->addHTML( $template->getHTML() );
1657  }
1658 
1671  public function parse( $text, $linestart = true, $interface = false, $language = null ) {
1672  global $wgParser;
1673 
1674  if ( is_null( $this->getTitle() ) ) {
1675  throw new MWException( 'Empty $mTitle in ' . __METHOD__ );
1676  }
1677 
1678  $popts = $this->parserOptions();
1679  if ( $interface ) {
1680  $popts->setInterfaceMessage( true );
1681  }
1682  if ( $language !== null ) {
1683  $oldLang = $popts->setTargetLanguage( $language );
1684  }
1685 
1686  $parserOutput = $wgParser->parse(
1687  $text, $this->getTitle(), $popts,
1688  $linestart, true, $this->mRevisionId
1689  );
1690 
1691  if ( $interface ) {
1692  $popts->setInterfaceMessage( false );
1693  }
1694  if ( $language !== null ) {
1695  $popts->setTargetLanguage( $oldLang );
1696  }
1697 
1698  return $parserOutput->getText();
1699  }
1700 
1711  public function parseInline( $text, $linestart = true, $interface = false ) {
1712  $parsed = $this->parse( $text, $linestart, $interface );
1713 
1714  $m = array();
1715  if ( preg_match( '/^<p>(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) {
1716  $parsed = $m[1];
1717  }
1718 
1719  return $parsed;
1720  }
1721 
1727  public function setSquidMaxage( $maxage ) {
1728  $this->mSquidMaxage = $maxage;
1729  }
1730 
1738  public function enableClientCache( $state ) {
1739  return wfSetVar( $this->mEnableClientCache, $state );
1740  }
1741 
1747  function getCacheVaryCookies() {
1748  global $wgCookiePrefix, $wgCacheVaryCookies;
1749  static $cookies;
1750  if ( $cookies === null ) {
1751  $cookies = array_merge(
1752  array(
1753  "{$wgCookiePrefix}Token",
1754  "{$wgCookiePrefix}LoggedOut",
1755  "forceHTTPS",
1756  session_name()
1757  ),
1758  $wgCacheVaryCookies
1759  );
1760  wfRunHooks( 'GetCacheVaryCookies', array( $this, &$cookies ) );
1761  }
1762  return $cookies;
1763  }
1771  function haveCacheVaryCookies() {
1772  $cookieHeader = $this->getRequest()->getHeader( 'cookie' );
1773  if ( $cookieHeader === false ) {
1774  return false;
1775  }
1776  $cvCookies = $this->getCacheVaryCookies();
1777  foreach ( $cvCookies as $cookieName ) {
1778  # Check for a simple string match, like the way squid does it
1779  if ( strpos( $cookieHeader, $cookieName ) !== false ) {
1780  wfDebug( __METHOD__ . ": found $cookieName\n" );
1781  return true;
1782  }
1783  }
1784  wfDebug( __METHOD__ . ": no cache-varying cookies found\n" );
1785  return false;
1786  }
1787 
1796  public function addVaryHeader( $header, $option = null ) {
1797  if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
1798  $this->mVaryHeader[$header] = (array)$option;
1799  } elseif ( is_array( $option ) ) {
1800  if ( is_array( $this->mVaryHeader[$header] ) ) {
1801  $this->mVaryHeader[$header] = array_merge( $this->mVaryHeader[$header], $option );
1802  } else {
1803  $this->mVaryHeader[$header] = $option;
1804  }
1805  }
1806  $this->mVaryHeader[$header] = array_unique( (array)$this->mVaryHeader[$header] );
1807  }
1815  public function getVaryHeader() {
1816  return 'Vary: ' . join( ', ', array_keys( $this->mVaryHeader ) );
1817  }
1818 
1824  public function getXVO() {
1825  $cvCookies = $this->getCacheVaryCookies();
1826 
1827  $cookiesOption = array();
1828  foreach ( $cvCookies as $cookieName ) {
1829  $cookiesOption[] = 'string-contains=' . $cookieName;
1830  }
1831  $this->addVaryHeader( 'Cookie', $cookiesOption );
1832 
1833  $headers = array();
1834  foreach ( $this->mVaryHeader as $header => $option ) {
1835  $newheader = $header;
1836  if ( is_array( $option ) && count( $option ) > 0 ) {
1837  $newheader .= ';' . implode( ';', $option );
1838  }
1839  $headers[] = $newheader;
1840  }
1841  $xvo = 'X-Vary-Options: ' . implode( ',', $headers );
1842 
1843  return $xvo;
1844  }
1845 
1854  function addAcceptLanguage() {
1855  $lang = $this->getTitle()->getPageLanguage();
1856  if ( !$this->getRequest()->getCheck( 'variant' ) && $lang->hasVariants() ) {
1857  $variants = $lang->getVariants();
1858  $aloption = array();
1859  foreach ( $variants as $variant ) {
1860  if ( $variant === $lang->getCode() ) {
1861  continue;
1862  } else {
1863  $aloption[] = 'string-contains=' . $variant;
1864 
1865  // IE and some other browsers use BCP 47 standards in
1866  // their Accept-Language header, like "zh-CN" or "zh-Hant".
1867  // We should handle these too.
1868  $variantBCP47 = wfBCP47( $variant );
1869  if ( $variantBCP47 !== $variant ) {
1870  $aloption[] = 'string-contains=' . $variantBCP47;
1871  }
1872  }
1873  }
1874  $this->addVaryHeader( 'Accept-Language', $aloption );
1875  }
1876  }
1877 
1888  public function preventClickjacking( $enable = true ) {
1889  $this->mPreventClickjacking = $enable;
1890  }
1891 
1897  public function allowClickjacking() {
1898  $this->mPreventClickjacking = false;
1899  }
1907  public function getPreventClickjacking() {
1909  }
1910 
1918  public function getFrameOptions() {
1919  global $wgBreakFrames, $wgEditPageFrameOptions;
1920  if ( $wgBreakFrames ) {
1921  return 'DENY';
1922  } elseif ( $this->mPreventClickjacking && $wgEditPageFrameOptions ) {
1923  return $wgEditPageFrameOptions;
1924  }
1925  return false;
1926  }
1927 
1931  public function sendCacheControl() {
1932  global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgUseXVO;
1933 
1934  $response = $this->getRequest()->response();
1935  if ( $wgUseETag && $this->mETag ) {
1936  $response->header( "ETag: $this->mETag" );
1937  }
1938 
1939  $this->addVaryHeader( 'Cookie' );
1940  $this->addAcceptLanguage();
1941 
1942  # don't serve compressed data to clients who can't handle it
1943  # maintain different caches for logged-in users and non-logged in ones
1944  $response->header( $this->getVaryHeader() );
1945 
1946  if ( $wgUseXVO ) {
1947  # Add an X-Vary-Options header for Squid with Wikimedia patches
1948  $response->header( $this->getXVO() );
1949  }
1950 
1951  if ( $this->mEnableClientCache ) {
1952  if (
1953  $wgUseSquid && session_id() == '' && !$this->isPrintable() &&
1954  $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies()
1955  ) {
1956  if ( $wgUseESI ) {
1957  # We'll purge the proxy cache explicitly, but require end user agents
1958  # to revalidate against the proxy on each visit.
1959  # Surrogate-Control controls our Squid, Cache-Control downstream caches
1960  wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", 'log' );
1961  # start with a shorter timeout for initial testing
1962  # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
1963  $response->header( 'Surrogate-Control: max-age=' . $wgSquidMaxage . '+' . $this->mSquidMaxage . ', content="ESI/1.0"' );
1964  $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
1965  } else {
1966  # We'll purge the proxy cache for anons explicitly, but require end user agents
1967  # to revalidate against the proxy on each visit.
1968  # IMPORTANT! The Squid needs to replace the Cache-Control header with
1969  # Cache-Control: s-maxage=0, must-revalidate, max-age=0
1970  wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **\n", 'log' );
1971  # start with a shorter timeout for initial testing
1972  # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
1973  $response->header( 'Cache-Control: s-maxage=' . $this->mSquidMaxage . ', must-revalidate, max-age=0' );
1974  }
1975  } else {
1976  # We do want clients to cache if they can, but they *must* check for updates
1977  # on revisiting the page.
1978  wfDebug( __METHOD__ . ": private caching; {$this->mLastModified} **\n", 'log' );
1979  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
1980  $response->header( "Cache-Control: private, must-revalidate, max-age=0" );
1981  }
1982  if ( $this->mLastModified ) {
1983  $response->header( "Last-Modified: {$this->mLastModified}" );
1984  }
1985  } else {
1986  wfDebug( __METHOD__ . ": no caching **\n", 'log' );
1987 
1988  # In general, the absence of a last modified header should be enough to prevent
1989  # the client from using its cache. We send a few other things just to make sure.
1990  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
1991  $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
1992  $response->header( 'Pragma: no-cache' );
1993  }
1994  }
1995 
2004  public static function getStatusMessage( $code ) {
2005  wfDeprecated( __METHOD__, '1.18' );
2006  return HttpStatus::getMessage( $code );
2007  }
2008 
2013  public function output() {
2014  global $wgLanguageCode, $wgDebugRedirects, $wgMimeType, $wgVaryOnXFP,
2015  $wgUseAjax, $wgResponsiveImages;
2016 
2017  if ( $this->mDoNothing ) {
2018  return;
2019  }
2020 
2021  wfProfileIn( __METHOD__ );
2022 
2023  $response = $this->getRequest()->response();
2024 
2025  if ( $this->mRedirect != '' ) {
2026  # Standards require redirect URLs to be absolute
2027  $this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT );
2028 
2029  $redirect = $this->mRedirect;
2030  $code = $this->mRedirectCode;
2031 
2032  if ( wfRunHooks( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) {
2033  if ( $code == '301' || $code == '303' ) {
2034  if ( !$wgDebugRedirects ) {
2035  $message = HttpStatus::getMessage( $code );
2036  $response->header( "HTTP/1.1 $code $message" );
2037  }
2038  $this->mLastModified = wfTimestamp( TS_RFC2822 );
2039  }
2040  if ( $wgVaryOnXFP ) {
2041  $this->addVaryHeader( 'X-Forwarded-Proto' );
2042  }
2043  $this->sendCacheControl();
2044 
2045  $response->header( "Content-Type: text/html; charset=utf-8" );
2046  if ( $wgDebugRedirects ) {
2047  $url = htmlspecialchars( $redirect );
2048  print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2049  print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2050  print "</body>\n</html>\n";
2051  } else {
2052  $response->header( 'Location: ' . $redirect );
2053  }
2054  }
2055 
2056  wfProfileOut( __METHOD__ );
2057  return;
2058  } elseif ( $this->mStatusCode ) {
2059  $message = HttpStatus::getMessage( $this->mStatusCode );
2060  if ( $message ) {
2061  $response->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message );
2062  }
2063  }
2064 
2065  # Buffer output; final headers may depend on later processing
2066  ob_start();
2067 
2068  $response->header( "Content-type: $wgMimeType; charset=UTF-8" );
2069  $response->header( 'Content-language: ' . $wgLanguageCode );
2070 
2071  // Prevent framing, if requested
2072  $frameOptions = $this->getFrameOptions();
2073  if ( $frameOptions ) {
2074  $response->header( "X-Frame-Options: $frameOptions" );
2075  }
2076 
2077  if ( $this->mArticleBodyOnly ) {
2078  echo $this->mBodytext;
2079  } else {
2080 
2081  $sk = $this->getSkin();
2082  // add skin specific modules
2083  $modules = $sk->getDefaultModules();
2084 
2085  // enforce various default modules for all skins
2086  $coreModules = array(
2087  // keep this list as small as possible
2088  'mediawiki.page.startup',
2089  'mediawiki.user',
2090  );
2091 
2092  // Support for high-density display images if enabled
2093  if ( $wgResponsiveImages ) {
2094  $coreModules[] = 'mediawiki.hidpi';
2095  }
2096 
2097  $this->addModules( $coreModules );
2098  foreach ( $modules as $group ) {
2099  $this->addModules( $group );
2100  }
2101  MWDebug::addModules( $this );
2102  if ( $wgUseAjax ) {
2103  // FIXME: deprecate? - not clear why this is useful
2104  wfRunHooks( 'AjaxAddScript', array( &$this ) );
2105  }
2106 
2107  // Hook that allows last minute changes to the output page, e.g.
2108  // adding of CSS or Javascript by extensions.
2109  wfRunHooks( 'BeforePageDisplay', array( &$this, &$sk ) );
2110 
2111  wfProfileIn( 'Output-skin' );
2112  $sk->outputPage();
2113  wfProfileOut( 'Output-skin' );
2114  }
2115 
2116  // This hook allows last minute changes to final overall output by modifying output buffer
2117  wfRunHooks( 'AfterFinalPageOutput', array( $this ) );
2118 
2119  $this->sendCacheControl();
2120 
2121  ob_end_flush();
2122 
2123  wfProfileOut( __METHOD__ );
2124  }
2132  public function out( $ins ) {
2133  wfDeprecated( __METHOD__, '1.22' );
2134  print $ins;
2135  }
2136 
2141  function blockedPage() {
2142  throw new UserBlockedError( $this->getUser()->mBlock );
2143  }
2144 
2155  public function prepareErrorPage( $pageTitle, $htmlTitle = false ) {
2156  $this->setPageTitle( $pageTitle );
2157  if ( $htmlTitle !== false ) {
2158  $this->setHTMLTitle( $htmlTitle );
2159  }
2160  $this->setRobotPolicy( 'noindex,nofollow' );
2161  $this->setArticleRelated( false );
2162  $this->enableClientCache( false );
2163  $this->mRedirect = '';
2164  $this->clearSubtitle();
2165  $this->clearHTML();
2166  }
2167 
2180  public function showErrorPage( $title, $msg, $params = array() ) {
2181  if ( !$title instanceof Message ) {
2182  $title = $this->msg( $title );
2183  }
2184 
2185  $this->prepareErrorPage( $title );
2186 
2187  if ( $msg instanceof Message ) {
2188  if ( $params !== array() ) {
2189  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 );
2190  }
2191  $this->addHTML( $msg->parseAsBlock() );
2192  } else {
2193  $this->addWikiMsgArray( $msg, $params );
2194  }
2195 
2196  $this->returnToMain();
2197  }
2205  public function showPermissionsErrorPage( $errors, $action = null ) {
2206  // For some action (read, edit, create and upload), display a "login to do this action"
2207  // error if all of the following conditions are met:
2208  // 1. the user is not logged in
2209  // 2. the only error is insufficient permissions (i.e. no block or something else)
2210  // 3. the error can be avoided simply by logging in
2211  if ( in_array( $action, array( 'read', 'edit', 'createpage', 'createtalk', 'upload' ) )
2212  && $this->getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2213  && ( $errors[0][0] == 'badaccess-groups' || $errors[0][0] == 'badaccess-group0' )
2214  && ( User::groupHasPermission( 'user', $action )
2215  || User::groupHasPermission( 'autoconfirmed', $action ) )
2216  ) {
2217  $displayReturnto = null;
2218 
2219  # Due to bug 32276, if a user does not have read permissions,
2220  # $this->getTitle() will just give Special:Badtitle, which is
2221  # not especially useful as a returnto parameter. Use the title
2222  # from the request instead, if there was one.
2223  $request = $this->getRequest();
2224  $returnto = Title::newFromURL( $request->getVal( 'title', '' ) );
2225  if ( $action == 'edit' ) {
2226  $msg = 'whitelistedittext';
2227  $displayReturnto = $returnto;
2228  } elseif ( $action == 'createpage' || $action == 'createtalk' ) {
2229  $msg = 'nocreatetext';
2230  } elseif ( $action == 'upload' ) {
2231  $msg = 'uploadnologintext';
2232  } else { # Read
2233  $msg = 'loginreqpagetext';
2234  $displayReturnto = Title::newMainPage();
2235  }
2236 
2237  $query = array();
2238 
2239  if ( $returnto ) {
2240  $query['returnto'] = $returnto->getPrefixedText();
2241 
2242  if ( !$request->wasPosted() ) {
2243  $returntoquery = $request->getValues();
2244  unset( $returntoquery['title'] );
2245  unset( $returntoquery['returnto'] );
2246  unset( $returntoquery['returntoquery'] );
2247  $query['returntoquery'] = wfArrayToCgi( $returntoquery );
2248  }
2249  }
2250  $loginLink = Linker::linkKnown(
2251  SpecialPage::getTitleFor( 'Userlogin' ),
2252  $this->msg( 'loginreqlink' )->escaped(),
2253  array(),
2254  $query
2255  );
2256 
2257  $this->prepareErrorPage( $this->msg( 'loginreqtitle' ) );
2258  $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->parse() );
2259 
2260  # Don't return to a page the user can't read otherwise
2261  # we'll end up in a pointless loop
2262  if ( $displayReturnto && $displayReturnto->userCan( 'read', $this->getUser() ) ) {
2263  $this->returnToMain( null, $displayReturnto );
2264  }
2265  } else {
2266  $this->prepareErrorPage( $this->msg( 'permissionserrors' ) );
2267  $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
2268  }
2269  }
2277  public function versionRequired( $version ) {
2278  $this->prepareErrorPage( $this->msg( 'versionrequired', $version ) );
2279 
2280  $this->addWikiMsg( 'versionrequiredtext', $version );
2281  $this->returnToMain();
2282  }
2290  public function permissionRequired( $permission ) {
2291  throw new PermissionsError( $permission );
2292  }
2293 
2299  public function loginToUse() {
2300  throw new PermissionsError( 'read' );
2301  }
2302 
2310  public function formatPermissionsErrorMessage( $errors, $action = null ) {
2311  if ( $action == null ) {
2312  $text = $this->msg( 'permissionserrorstext', count( $errors ) )->plain() . "\n\n";
2313  } else {
2314  $action_desc = $this->msg( "action-$action" )->plain();
2315  $text = $this->msg(
2316  'permissionserrorstext-withaction',
2317  count( $errors ),
2318  $action_desc
2319  )->plain() . "\n\n";
2320  }
2321 
2322  if ( count( $errors ) > 1 ) {
2323  $text .= '<ul class="permissions-errors">' . "\n";
2324 
2325  foreach ( $errors as $error ) {
2326  $text .= '<li>';
2327  $text .= call_user_func_array( array( $this, 'msg' ), $error )->plain();
2328  $text .= "</li>\n";
2329  }
2330  $text .= '</ul>';
2331  } else {
2332  $text .= "<div class=\"permissions-errors\">\n" .
2333  call_user_func_array( array( $this, 'msg' ), reset( $errors ) )->plain() .
2334  "\n</div>";
2335  }
2336 
2337  return $text;
2338  }
2339 
2361  public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
2362  $this->setRobotPolicy( 'noindex,nofollow' );
2363  $this->setArticleRelated( false );
2364 
2365  // If no reason is given, just supply a default "I can't let you do
2366  // that, Dave" message. Should only occur if called by legacy code.
2367  if ( $protected && empty( $reasons ) ) {
2368  $reasons[] = array( 'badaccess-group0' );
2369  }
2370 
2371  if ( !empty( $reasons ) ) {
2372  // Permissions error
2373  if ( $source ) {
2374  $this->setPageTitle( $this->msg( 'viewsource-title', $this->getTitle()->getPrefixedText() ) );
2375  $this->addBacklinkSubtitle( $this->getTitle() );
2376  } else {
2377  $this->setPageTitle( $this->msg( 'badaccess' ) );
2378  }
2379  $this->addWikiText( $this->formatPermissionsErrorMessage( $reasons, $action ) );
2380  } else {
2381  // Wiki is read only
2382  throw new ReadOnlyError;
2383  }
2384 
2385  // Show source, if supplied
2386  if ( is_string( $source ) ) {
2387  $this->addWikiMsg( 'viewsourcetext' );
2388 
2389  $pageLang = $this->getTitle()->getPageLanguage();
2390  $params = array(
2391  'id' => 'wpTextbox1',
2392  'name' => 'wpTextbox1',
2393  'cols' => $this->getUser()->getOption( 'cols' ),
2394  'rows' => $this->getUser()->getOption( 'rows' ),
2395  'readonly' => 'readonly',
2396  'lang' => $pageLang->getHtmlCode(),
2397  'dir' => $pageLang->getDir(),
2398  );
2399  $this->addHTML( Html::element( 'textarea', $params, $source ) );
2400 
2401  // Show templates used by this article
2402  $templates = Linker::formatTemplates( $this->getTitle()->getTemplateLinksFrom() );
2403  $this->addHTML( "<div class='templatesUsed'>
2404 $templates
2405 </div>
2406 " );
2407  }
2408 
2409  # If the title doesn't exist, it's fairly pointless to print a return
2410  # link to it. After all, you just tried editing it and couldn't, so
2411  # what's there to do there?
2412  if ( $this->getTitle()->exists() ) {
2413  $this->returnToMain( null, $this->getTitle() );
2414  }
2415  }
2416 
2421  public function rateLimited() {
2422  throw new ThrottledError;
2423  }
2424 
2434  public function showLagWarning( $lag ) {
2435  global $wgSlaveLagWarning, $wgSlaveLagCritical;
2436  if ( $lag >= $wgSlaveLagWarning ) {
2437  $message = $lag < $wgSlaveLagCritical
2438  ? 'lag-warn-normal'
2439  : 'lag-warn-high';
2440  $wrap = Html::rawElement( 'div', array( 'class' => "mw-{$message}" ), "\n$1\n" );
2441  $this->wrapWikiMsg( "$wrap\n", array( $message, $this->getLanguage()->formatNum( $lag ) ) );
2442  }
2443  }
2445  public function showFatalError( $message ) {
2446  $this->prepareErrorPage( $this->msg( 'internalerror' ) );
2447 
2448  $this->addHTML( $message );
2449  }
2450 
2451  public function showUnexpectedValueError( $name, $val ) {
2452  $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() );
2453  }
2454 
2455  public function showFileCopyError( $old, $new ) {
2456  $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() );
2457  }
2458 
2459  public function showFileRenameError( $old, $new ) {
2460  $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() );
2461  }
2462 
2463  public function showFileDeleteError( $name ) {
2464  $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() );
2465  }
2466 
2467  public function showFileNotFoundError( $name ) {
2468  $this->showFatalError( $this->msg( 'filenotfound', $name )->text() );
2469  }
2470 
2479  public function addReturnTo( $title, $query = array(), $text = null, $options = array() ) {
2480  $link = $this->msg( 'returnto' )->rawParams(
2481  Linker::link( $title, $text, array(), $query, $options ) )->escaped();
2482  $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
2483  }
2484 
2493  public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
2494  if ( $returnto == null ) {
2495  $returnto = $this->getRequest()->getText( 'returnto' );
2496  }
2497 
2498  if ( $returntoquery == null ) {
2499  $returntoquery = $this->getRequest()->getText( 'returntoquery' );
2500  }
2501 
2502  if ( $returnto === '' ) {
2503  $returnto = Title::newMainPage();
2504  }
2505 
2506  if ( is_object( $returnto ) ) {
2507  $titleObj = $returnto;
2508  } else {
2509  $titleObj = Title::newFromText( $returnto );
2510  }
2511  if ( !is_object( $titleObj ) ) {
2512  $titleObj = Title::newMainPage();
2513  }
2514 
2515  $this->addReturnTo( $titleObj, wfCgiToArray( $returntoquery ) );
2516  }
2517 
2523  public function headElement( Skin $sk, $includeStyle = true ) {
2524  global $wgContLang, $wgMimeType;
2525 
2526  $userdir = $this->getLanguage()->getDir();
2527  $sitedir = $wgContLang->getDir();
2528 
2530 
2531  if ( $this->getHTMLTitle() == '' ) {
2532  $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() )->inContentLanguage() );
2533  }
2534 
2535  $openHead = Html::openElement( 'head' );
2536  if ( $openHead ) {
2537  # Don't bother with the newline if $head == ''
2538  $ret .= "$openHead\n";
2539  }
2540 
2541  if ( !Html::isXmlMimeType( $wgMimeType ) ) {
2542  // Add <meta charset="UTF-8">
2543  // This should be before <title> since it defines the charset used by
2544  // text including the text inside <title>.
2545  // The spec recommends defining XHTML5's charset using the XML declaration
2546  // instead of meta.
2547  // Our XML declaration is output by Html::htmlHeader.
2548  // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
2549  // http://www.whatwg.org/html/semantics.html#charset
2550  $ret .= Html::element( 'meta', array( 'charset' => 'UTF-8' ) ) . "\n";
2551  }
2552 
2553  $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
2554 
2555  // Avoid Internet Explorer "compatibility view", so that
2556  // jQuery can work correctly.
2557  $ret .= Html::element( 'meta', array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EDGE' ) ) . "\n";
2558 
2559  $ret .= (
2560  $this->getHeadLinks() .
2561  "\n" .
2562  $this->buildCssLinks() .
2563  // No newline after buildCssLinks since makeResourceLoaderLink did that already
2564  $this->getHeadScripts() .
2565  "\n" .
2566  $this->getHeadItems()
2567  );
2568 
2569  $closeHead = Html::closeElement( 'head' );
2570  if ( $closeHead ) {
2571  $ret .= "$closeHead\n";
2572  }
2573 
2574  $bodyClasses = array();
2575  $bodyClasses[] = 'mediawiki';
2576 
2577  # Classes for LTR/RTL directionality support
2578  $bodyClasses[] = $userdir;
2579  $bodyClasses[] = "sitedir-$sitedir";
2580 
2581  if ( $this->getLanguage()->capitalizeAllNouns() ) {
2582  # A <body> class is probably not the best way to do this . . .
2583  $bodyClasses[] = 'capitalize-all-nouns';
2584  }
2585 
2586  $bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
2587  $bodyClasses[] = 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
2588  $bodyClasses[] = 'action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
2589 
2590  $bodyAttrs = array();
2591  // While the implode() is not strictly needed, it's used for backwards compatibility
2592  // (this used to be built as a string and hooks likely still expect that).
2593  $bodyAttrs['class'] = implode( ' ', $bodyClasses );
2594 
2595  // Allow skins and extensions to add body attributes they need
2596  $sk->addToBodyAttributes( $this, $bodyAttrs );
2597  wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) );
2598 
2599  $ret .= Html::openElement( 'body', $bodyAttrs ) . "\n";
2600 
2601  return $ret;
2602  }
2603 
2609  public function getResourceLoader() {
2610  if ( is_null( $this->mResourceLoader ) ) {
2611  $this->mResourceLoader = new ResourceLoader();
2612  }
2613  return $this->mResourceLoader;
2614  }
2615 
2625  protected function makeResourceLoaderLink( $modules, $only, $useESI = false, array $extraQuery = array(), $loadCall = false ) {
2626  global $wgResourceLoaderUseESI;
2627 
2628  $modules = (array)$modules;
2629 
2630  $links = array(
2631  'html' => '',
2632  'states' => array(),
2633  );
2634 
2635  if ( !count( $modules ) ) {
2636  return $links;
2637  }
2638 
2639 
2640  if ( count( $modules ) > 1 ) {
2641  // Remove duplicate module requests
2642  $modules = array_unique( $modules );
2643  // Sort module names so requests are more uniform
2644  sort( $modules );
2645 
2646  if ( ResourceLoader::inDebugMode() ) {
2647  // Recursively call us for every item
2648  foreach ( $modules as $name ) {
2649  $link = $this->makeResourceLoaderLink( $name, $only, $useESI );
2650  $links['html'] .= $link['html'];
2651  $links['states'] += $link['states'];
2652  }
2653  return $links;
2654  }
2655  }
2656 
2657  if ( !is_null( $this->mTarget ) ) {
2658  $extraQuery['target'] = $this->mTarget;
2659  }
2660 
2661  // Create keyed-by-group list of module objects from modules list
2662  $groups = array();
2664  foreach ( $modules as $name ) {
2665  $module = $resourceLoader->getModule( $name );
2666  # Check that we're allowed to include this module on this page
2667  if ( !$module
2668  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS )
2670  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_STYLES )
2671  && $only == ResourceLoaderModule::TYPE_STYLES )
2672  || ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) )
2673  ) {
2674  continue;
2675  }
2676 
2677  $group = $module->getGroup();
2678  if ( !isset( $groups[$group] ) ) {
2679  $groups[$group] = array();
2680  }
2681  $groups[$group][$name] = $module;
2682  }
2683 
2684  foreach ( $groups as $group => $grpModules ) {
2685  // Special handling for user-specific groups
2686  $user = null;
2687  if ( ( $group === 'user' || $group === 'private' ) && $this->getUser()->isLoggedIn() ) {
2688  $user = $this->getUser()->getName();
2689  }
2690 
2691  // Create a fake request based on the one we are about to make so modules return
2692  // correct timestamp and emptiness data
2694  array(), // modules; not determined yet
2695  $this->getLanguage()->getCode(),
2696  $this->getSkin()->getSkinName(),
2697  $user,
2698  null, // version; not determined yet
2700  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2701  $this->isPrintable(),
2702  $this->getRequest()->getBool( 'handheld' ),
2703  $extraQuery
2704  );
2706 
2707  // Extract modules that know they're empty
2708  foreach ( $grpModules as $key => $module ) {
2709  // Inline empty modules: since they're empty, just mark them as 'ready' (bug 46857)
2710  // If we're only getting the styles, we don't need to do anything for empty modules.
2711  if ( $module->isKnownEmpty( $context ) ) {
2712  unset( $grpModules[$key] );
2713  if ( $only !== ResourceLoaderModule::TYPE_STYLES ) {
2714  $links['states'][$key] = 'ready';
2715  }
2716  }
2717  }
2718 
2719  // If there are no non-empty modules, skip this group
2720  if ( count( $grpModules ) === 0 ) {
2721  continue;
2722  }
2723 
2724  // Inline private modules. These can't be loaded through load.php for security
2725  // reasons, see bug 34907. Note that these modules should be loaded from
2726  // getHeadScripts() before the first loader call. Otherwise other modules can't
2727  // properly use them as dependencies (bug 30914)
2728  if ( $group === 'private' ) {
2729  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2730  $links['html'] .= Html::inlineStyle(
2731  $resourceLoader->makeModuleResponse( $context, $grpModules )
2732  );
2733  } else {
2734  $links['html'] .= Html::inlineScript(
2736  $resourceLoader->makeModuleResponse( $context, $grpModules )
2737  )
2738  );
2739  }
2740  $links['html'] .= "\n";
2741  continue;
2742  }
2743 
2744  // Special handling for the user group; because users might change their stuff
2745  // on-wiki like user pages, or user preferences; we need to find the highest
2746  // timestamp of these user-changeable modules so we can ensure cache misses on change
2747  // This should NOT be done for the site group (bug 27564) because anons get that too
2748  // and we shouldn't be putting timestamps in Squid-cached HTML
2749  $version = null;
2750  if ( $group === 'user' ) {
2751  // Get the maximum timestamp
2752  $timestamp = 1;
2753  foreach ( $grpModules as $module ) {
2754  $timestamp = max( $timestamp, $module->getModifiedTime( $context ) );
2755  }
2756  // Add a version parameter so cache will break when things change
2758  }
2759 
2761  array_keys( $grpModules ),
2762  $this->getLanguage()->getCode(),
2763  $this->getSkin()->getSkinName(),
2764  $user,
2765  $version,
2767  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2768  $this->isPrintable(),
2769  $this->getRequest()->getBool( 'handheld' ),
2770  $extraQuery
2771  );
2772  if ( $useESI && $wgResourceLoaderUseESI ) {
2773  $esi = Xml::element( 'esi:include', array( 'src' => $url ) );
2774  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2775  $link = Html::inlineStyle( $esi );
2776  } else {
2777  $link = Html::inlineScript( $esi );
2778  }
2779  } else {
2780  // Automatically select style/script elements
2781  if ( $only === ResourceLoaderModule::TYPE_STYLES ) {
2782  $link = Html::linkedStyle( $url );
2783  } elseif ( $loadCall ) {
2786  Xml::encodeJsCall( 'mw.loader.load', array( $url, 'text/javascript', true ) )
2787  )
2788  );
2789  } else {
2790  $link = Html::linkedScript( $url );
2791 
2792  // For modules requested directly in the html via <link> or <script>,
2793  // tell mw.loader they are being loading to prevent duplicate requests.
2794  foreach ( $grpModules as $key => $module ) {
2795  // Don't output state=loading for the startup module..
2796  if ( $key !== 'startup' ) {
2797  $links['states'][$key] = 'loading';
2798  }
2799  }
2800  }
2801  }
2802 
2803  if ( $group == 'noscript' ) {
2804  $links['html'] .= Html::rawElement( 'noscript', array(), $link ) . "\n";
2805  } else {
2806  $links['html'] .= $link . "\n";
2807  }
2808  }
2809 
2810  return $links;
2811  }
2812 
2818  protected static function getHtmlFromLoaderLinks( Array $links ) {
2819  $html = '';
2820  $states = array();
2821  foreach ( $links as $link ) {
2822  if ( !is_array( $link ) ) {
2823  $html .= $link;
2824  } else {
2825  $html .= $link['html'];
2826  $states += $link['states'];
2827  }
2828  }
2829 
2830  if ( count( $states ) ) {
2834  )
2835  ) . "\n" . $html;
2836  }
2837 
2838  return $html;
2839  }
2847  function getHeadScripts() {
2848  global $wgResourceLoaderExperimentalAsyncLoading;
2849 
2850  // Startup - this will immediately load jquery and mediawiki modules
2851  $links = array();
2852  $links[] = $this->makeResourceLoaderLink( 'startup', ResourceLoaderModule::TYPE_SCRIPTS, true );
2853 
2854  // Load config before anything else
2855  $links[] = Html::inlineScript(
2858  )
2859  );
2860 
2861  // Load embeddable private modules before any loader links
2862  // This needs to be TYPE_COMBINED so these modules are properly wrapped
2863  // in mw.loader.implement() calls and deferred until mw.user is available
2864  $embedScripts = array( 'user.options', 'user.tokens' );
2865  $links[] = $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
2866 
2867  // Scripts and messages "only" requests marked for top inclusion
2868  // Messages should go first
2869  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'top' ), ResourceLoaderModule::TYPE_MESSAGES );
2870  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'top' ), ResourceLoaderModule::TYPE_SCRIPTS );
2871 
2872  // Modules requests - let the client calculate dependencies and batch requests as it likes
2873  // Only load modules that have marked themselves for loading at the top
2874  $modules = $this->getModules( true, 'top' );
2875  if ( $modules ) {
2876  $links[] = Html::inlineScript(
2878  Xml::encodeJsCall( 'mw.loader.load', array( $modules ) )
2879  )
2880  );
2881  }
2882 
2883  if ( $wgResourceLoaderExperimentalAsyncLoading ) {
2884  $links[] = $this->getScriptsForBottomQueue( true );
2885  }
2886 
2887  return self::getHtmlFromLoaderLinks( $links );
2888  }
2889 
2899  function getScriptsForBottomQueue( $inHead ) {
2900  global $wgUseSiteJs, $wgAllowUserJs;
2901 
2902  // Scripts and messages "only" requests marked for bottom inclusion
2903  // If we're in the <head>, use load() calls rather than <script src="..."> tags
2904  // Messages should go first
2905  $links = array();
2906  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'bottom' ),
2907  ResourceLoaderModule::TYPE_MESSAGES, /* $useESI = */ false, /* $extraQuery = */ array(),
2908  /* $loadCall = */ $inHead
2909  );
2910  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'bottom' ),
2911  ResourceLoaderModule::TYPE_SCRIPTS, /* $useESI = */ false, /* $extraQuery = */ array(),
2912  /* $loadCall = */ $inHead
2913  );
2914 
2915  // Modules requests - let the client calculate dependencies and batch requests as it likes
2916  // Only load modules that have marked themselves for loading at the bottom
2917  $modules = $this->getModules( true, 'bottom' );
2918  if ( $modules ) {
2919  $links[] = Html::inlineScript(
2921  Xml::encodeJsCall( 'mw.loader.load', array( $modules, null, true ) )
2922  )
2923  );
2924  }
2925 
2926  // Legacy Scripts
2927  $links[] = "\n" . $this->mScripts;
2928 
2929  // Add site JS if enabled
2931  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2932  );
2933 
2934  // Add user JS if enabled
2935  if ( $wgAllowUserJs && $this->getUser()->isLoggedIn() && $this->getTitle() && $this->getTitle()->isJsSubpage() && $this->userCanPreview() ) {
2936  # XXX: additional security check/prompt?
2937  // We're on a preview of a JS subpage
2938  // Exclude this page from the user module in case it's in there (bug 26283)
2939  $links[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS, false,
2940  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() ), $inHead
2941  );
2942  // Load the previewed JS
2943  $links[] = Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
2944 
2945  // FIXME: If the user is previewing, say, ./vector.js, his ./common.js will be loaded
2946  // asynchronously and may arrive *after* the inline script here. So the previewed code
2947  // may execute before ./common.js runs. Normally, ./common.js runs before ./vector.js...
2948  } else {
2949  // Include the user module normally, i.e., raw to avoid it being wrapped in a closure.
2951  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2952  );
2953  }
2954 
2955  // Group JS is only enabled if site JS is enabled.
2956  $links[] = $this->makeResourceLoaderLink( 'user.groups', ResourceLoaderModule::TYPE_COMBINED,
2957  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2958  );
2959 
2961  }
2962 
2967  function getBottomScripts() {
2968  global $wgResourceLoaderExperimentalAsyncLoading;
2969 
2970  // Optimise jQuery ready event cross-browser.
2971  // This also enforces $.isReady to be true at </body> which fixes the
2972  // mw.loader bug in Firefox with using document.write between </body>
2973  // and the DOMContentReady event (bug 47457).
2974  $html = Html::inlineScript( 'window.jQuery && jQuery.ready();' );
2975 
2976  if ( !$wgResourceLoaderExperimentalAsyncLoading ) {
2977  $html .= $this->getScriptsForBottomQueue( false );
2978  }
2979 
2980  return $html;
2981  }
2989  public function getJsConfigVars() {
2990  return $this->mJsConfigVars;
2991  }
2999  public function addJsConfigVars( $keys, $value = null ) {
3000  if ( is_array( $keys ) ) {
3001  foreach ( $keys as $key => $value ) {
3002  $this->mJsConfigVars[$key] = $value;
3003  }
3004  return;
3005  }
3006 
3007  $this->mJsConfigVars[$keys] = $value;
3008  }
3009 
3022  public function getJSVars() {
3024 
3025  $curRevisionId = 0;
3026  $articleId = 0;
3027  $canonicalSpecialPageName = false; # bug 21115
3028 
3029  $title = $this->getTitle();
3030  $ns = $title->getNamespace();
3031  $canonicalNamespace = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
3032 
3033  $sk = $this->getSkin();
3034  // Get the relevant title so that AJAX features can use the correct page name
3035  // when making API requests from certain special pages (bug 34972).
3036  $relevantTitle = $sk->getRelevantTitle();
3037  $relevantUser = $sk->getRelevantUser();
3038 
3039  if ( $ns == NS_SPECIAL ) {
3040  list( $canonicalSpecialPageName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
3041  } elseif ( $this->canUseWikiPage() ) {
3042  $wikiPage = $this->getWikiPage();
3043  $curRevisionId = $wikiPage->getLatest();
3044  $articleId = $wikiPage->getId();
3045  }
3046 
3047  $lang = $title->getPageLanguage();
3048 
3049  // Pre-process information
3050  $separatorTransTable = $lang->separatorTransformTable();
3051  $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
3052  $compactSeparatorTransTable = array(
3053  implode( "\t", array_keys( $separatorTransTable ) ),
3054  implode( "\t", $separatorTransTable ),
3055  );
3056  $digitTransTable = $lang->digitTransformTable();
3057  $digitTransTable = $digitTransTable ? $digitTransTable : array();
3058  $compactDigitTransTable = array(
3059  implode( "\t", array_keys( $digitTransTable ) ),
3060  implode( "\t", $digitTransTable ),
3061  );
3062 
3063  $user = $this->getUser();
3064 
3065  $vars = array(
3066  'wgCanonicalNamespace' => $canonicalNamespace,
3067  'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3068  'wgNamespaceNumber' => $title->getNamespace(),
3069  'wgPageName' => $title->getPrefixedDBkey(),
3070  'wgTitle' => $title->getText(),
3071  'wgCurRevisionId' => $curRevisionId,
3072  'wgRevisionId' => (int)$this->getRevisionId(),
3073  'wgArticleId' => $articleId,
3074  'wgIsArticle' => $this->isArticle(),
3075  'wgIsRedirect' => $title->isRedirect(),
3076  'wgAction' => Action::getActionName( $this->getContext() ),
3077  'wgUserName' => $user->isAnon() ? null : $user->getName(),
3078  'wgUserGroups' => $user->getEffectiveGroups(),
3079  'wgCategories' => $this->getCategories(),
3080  'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
3081  'wgPageContentLanguage' => $lang->getCode(),
3082  'wgPageContentModel' => $title->getContentModel(),
3083  'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3084  'wgDigitTransformTable' => $compactDigitTransTable,
3085  'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
3086  'wgMonthNames' => $lang->getMonthNamesArray(),
3087  'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
3088  'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3089  );
3090  if ( $user->isLoggedIn() ) {
3091  $vars['wgUserId'] = $user->getId();
3092  $vars['wgUserEditCount'] = $user->getEditCount();
3093  $userReg = wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
3094  $vars['wgUserRegistration'] = $userReg !== null ? ( $userReg * 1000 ) : null;
3095  // Get the revision ID of the oldest new message on the user's talk
3096  // page. This can be used for constructing new message alerts on
3097  // the client side.
3098  $vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
3099  }
3100  if ( $wgContLang->hasVariants() ) {
3101  $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
3102  }
3103  // Same test as SkinTemplate
3104  $vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user ) && ( $title->exists() || $title->quickUserCan( 'create', $user ) );
3105  foreach ( $title->getRestrictionTypes() as $type ) {
3106  $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
3107  }
3108  if ( $title->isMainPage() ) {
3109  $vars['wgIsMainPage'] = true;
3110  }
3111  if ( $this->mRedirectedFrom ) {
3112  $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3113  }
3114  if ( $relevantUser ) {
3115  $vars['wgRelevantUserName'] = $relevantUser->getName();
3116  }
3117 
3118  // Allow extensions to add their custom variables to the mw.config map.
3119  // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
3120  // page-dependant but site-wide (without state).
3121  // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
3122  wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars, $this ) );
3123 
3124  // Merge in variables from addJsConfigVars last
3125  return array_merge( $vars, $this->getJsConfigVars() );
3126  }
3127 
3137  public function userCanPreview() {
3138  if ( $this->getRequest()->getVal( 'action' ) != 'submit'
3139  || !$this->getRequest()->wasPosted()
3140  || !$this->getUser()->matchEditToken(
3141  $this->getRequest()->getVal( 'wpEditToken' ) )
3142  ) {
3143  return false;
3144  }
3145  if ( !$this->getTitle()->isJsSubpage() && !$this->getTitle()->isCssSubpage() ) {
3146  return false;
3147  }
3149  return !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) );
3150  }
3151 
3155  public function getHeadLinksArray() {
3156  global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
3157  $wgSitename, $wgVersion,
3158  $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
3159  $wgDisableLangConversion, $wgCanonicalLanguageLinks,
3160  $wgRightsPage, $wgRightsUrl;
3161 
3162  $tags = array();
3163 
3164  $canonicalUrl = $this->mCanonicalUrl;
3165 
3166  $tags['meta-generator'] = Html::element( 'meta', array(
3167  'name' => 'generator',
3168  'content' => "MediaWiki $wgVersion",
3169  ) );
3170 
3171  $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
3172  if ( $p !== 'index,follow' ) {
3173  // http://www.robotstxt.org/wc/meta-user.html
3174  // Only show if it's different from the default robots policy
3175  $tags['meta-robots'] = Html::element( 'meta', array(
3176  'name' => 'robots',
3177  'content' => $p,
3178  ) );
3179  }
3180 
3181  foreach ( $this->mMetatags as $tag ) {
3182  if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) {
3183  $a = 'http-equiv';
3184  $tag[0] = substr( $tag[0], 5 );
3185  } else {
3186  $a = 'name';
3187  }
3188  $tagName = "meta-{$tag[0]}";
3189  if ( isset( $tags[$tagName] ) ) {
3190  $tagName .= $tag[1];
3191  }
3192  $tags[$tagName] = Html::element( 'meta',
3193  array(
3194  $a => $tag[0],
3195  'content' => $tag[1]
3196  )
3197  );
3198  }
3199 
3200  foreach ( $this->mLinktags as $tag ) {
3201  $tags[] = Html::element( 'link', $tag );
3202  }
3203 
3204  # Universal edit button
3205  if ( $wgUniversalEditButton && $this->isArticleRelated() ) {
3206  $user = $this->getUser();
3207  if ( $this->getTitle()->quickUserCan( 'edit', $user )
3208  && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create', $user ) ) ) {
3209  // Original UniversalEditButton
3210  $msg = $this->msg( 'edit' )->text();
3211  $tags['universal-edit-button'] = Html::element( 'link', array(
3212  'rel' => 'alternate',
3213  'type' => 'application/x-wiki',
3214  'title' => $msg,
3215  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3216  ) );
3217  // Alternate edit link
3218  $tags['alternative-edit'] = Html::element( 'link', array(
3219  'rel' => 'edit',
3220  'title' => $msg,
3221  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3222  ) );
3223  }
3224  }
3225 
3226  # Generally the order of the favicon and apple-touch-icon links
3227  # should not matter, but Konqueror (3.5.9 at least) incorrectly
3228  # uses whichever one appears later in the HTML source. Make sure
3229  # apple-touch-icon is specified first to avoid this.
3230  if ( $wgAppleTouchIcon !== false ) {
3231  $tags['apple-touch-icon'] = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
3232  }
3233 
3234  if ( $wgFavicon !== false ) {
3235  $tags['favicon'] = Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
3236  }
3237 
3238  # OpenSearch description link
3239  $tags['opensearch'] = Html::element( 'link', array(
3240  'rel' => 'search',
3241  'type' => 'application/opensearchdescription+xml',
3242  'href' => wfScript( 'opensearch_desc' ),
3243  'title' => $this->msg( 'opensearch-desc' )->inContentLanguage()->text(),
3244  ) );
3245 
3246  if ( $wgEnableAPI ) {
3247  # Real Simple Discovery link, provides auto-discovery information
3248  # for the MediaWiki API (and potentially additional custom API
3249  # support such as WordPress or Twitter-compatible APIs for a
3250  # blogging extension, etc)
3251  $tags['rsd'] = Html::element( 'link', array(
3252  'rel' => 'EditURI',
3253  'type' => 'application/rsd+xml',
3254  // Output a protocol-relative URL here if $wgServer is protocol-relative
3255  // Whether RSD accepts relative or protocol-relative URLs is completely undocumented, though
3256  'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ), PROTO_RELATIVE ),
3257  ) );
3258  }
3259 
3260  # Language variants
3261  if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
3262  $lang = $this->getTitle()->getPageLanguage();
3263  if ( $lang->hasVariants() ) {
3264 
3265  $urlvar = $lang->getURLVariant();
3266 
3267  if ( !$urlvar ) {
3268  $variants = $lang->getVariants();
3269  foreach ( $variants as $_v ) {
3270  $tags["variant-$_v"] = Html::element( 'link', array(
3271  'rel' => 'alternate',
3272  'hreflang' => wfBCP47( $_v ),
3273  'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
3274  );
3275  }
3276  } else {
3277  $canonicalUrl = $this->getTitle()->getLocalURL();
3278  }
3279  }
3280  }
3281 
3282  # Copyright
3283  $copyright = '';
3284  if ( $wgRightsPage ) {
3285  $copy = Title::newFromText( $wgRightsPage );
3286 
3287  if ( $copy ) {
3288  $copyright = $copy->getLocalURL();
3289  }
3290  }
3291 
3292  if ( !$copyright && $wgRightsUrl ) {
3293  $copyright = $wgRightsUrl;
3294  }
3295 
3296  if ( $copyright ) {
3297  $tags['copyright'] = Html::element( 'link', array(
3298  'rel' => 'copyright',
3299  'href' => $copyright )
3300  );
3301  }
3302 
3303  # Feeds
3304  if ( $wgFeed ) {
3305  foreach ( $this->getSyndicationLinks() as $format => $link ) {
3306  # Use the page name for the title. In principle, this could
3307  # lead to issues with having the same name for different feeds
3308  # corresponding to the same page, but we can't avoid that at
3309  # this low a level.
3310 
3311  $tags[] = $this->feedLink(
3312  $format,
3313  $link,
3314  # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
3315  $this->msg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() )->text()
3316  );
3317  }
3318 
3319  # Recent changes feed should appear on every page (except recentchanges,
3320  # that would be redundant). Put it after the per-page feed to avoid
3321  # changing existing behavior. It's still available, probably via a
3322  # menu in your browser. Some sites might have a different feed they'd
3323  # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3324  # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3325  # If so, use it instead.
3326  if ( $wgOverrideSiteFeed ) {
3327  foreach ( $wgOverrideSiteFeed as $type => $feedUrl ) {
3328  // Note, this->feedLink escapes the url.
3329  $tags[] = $this->feedLink(
3330  $type,
3331  $feedUrl,
3332  $this->msg( "site-{$type}-feed", $wgSitename )->text()
3333  );
3334  }
3335  } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
3336  $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
3337  foreach ( $wgAdvertisedFeedTypes as $format ) {
3338  $tags[] = $this->feedLink(
3339  $format,
3340  $rctitle->getLocalURL( array( 'feed' => $format ) ),
3341  $this->msg( "site-{$format}-feed", $wgSitename )->text() # For grep: 'site-rss-feed', 'site-atom-feed'.
3342  );
3343  }
3344  }
3345  }
3346 
3347  # Canonical URL
3348  global $wgEnableCanonicalServerLink;
3349  if ( $wgEnableCanonicalServerLink ) {
3350  if ( $canonicalUrl !== false ) {
3351  $canonicalUrl = wfExpandUrl( $canonicalUrl, PROTO_CANONICAL );
3352  } else {
3353  $reqUrl = $this->getRequest()->getRequestURL();
3354  $canonicalUrl = wfExpandUrl( $reqUrl, PROTO_CANONICAL );
3355  }
3356  }
3357  if ( $canonicalUrl !== false ) {
3358  $tags[] = Html::element( 'link', array(
3359  'rel' => 'canonical',
3360  'href' => $canonicalUrl
3361  ) );
3362  }
3364  return $tags;
3365  }
3366 
3370  public function getHeadLinks() {
3371  return implode( "\n", $this->getHeadLinksArray() );
3372  }
3373 
3382  private function feedLink( $type, $url, $text ) {
3383  return Html::element( 'link', array(
3384  'rel' => 'alternate',
3385  'type' => "application/$type+xml",
3386  'title' => $text,
3387  'href' => $url )
3388  );
3389  }
3390 
3400  public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
3401  $options = array();
3402  // Even though we expect the media type to be lowercase, but here we
3403  // force it to lowercase to be safe.
3404  if ( $media ) {
3405  $options['media'] = $media;
3406  }
3407  if ( $condition ) {
3408  $options['condition'] = $condition;
3409  }
3410  if ( $dir ) {
3411  $options['dir'] = $dir;
3412  }
3413  $this->styles[$style] = $options;
3414  }
3415 
3421  public function addInlineStyle( $style_css, $flip = 'noflip' ) {
3422  if ( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
3423  # If wanted, and the interface is right-to-left, flip the CSS
3424  $style_css = CSSJanus::transform( $style_css, true, false );
3425  }
3426  $this->mInlineStyles .= Html::inlineStyle( $style_css ) . "\n";
3427  }
3435  public function buildCssLinks() {
3436  global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs, $wgContLang;
3437 
3438  $this->getSkin()->setupSkinUserCss( $this );
3439 
3440  // Add ResourceLoader styles
3441  // Split the styles into these groups
3442  $styles = array( 'other' => array(), 'user' => array(), 'site' => array(), 'private' => array(), 'noscript' => array() );
3443  $links = array();
3444  $otherTags = ''; // Tags to append after the normal <link> tags
3446 
3447  $moduleStyles = $this->getModuleStyles();
3448 
3449  // Per-site custom styles
3450  $moduleStyles[] = 'site';
3451  $moduleStyles[] = 'noscript';
3452  $moduleStyles[] = 'user.groups';
3453 
3454  // Per-user custom styles
3455  if ( $wgAllowUserCss && $this->getTitle()->isCssSubpage() && $this->userCanPreview() ) {
3456  // We're on a preview of a CSS subpage
3457  // Exclude this page from the user module in case it's in there (bug 26283)
3458  $link = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_STYLES, false,
3459  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
3460  );
3461  $otherTags .= $link['html'];
3462 
3463  // Load the previewed CSS
3464  // If needed, Janus it first. This is user-supplied CSS, so it's
3465  // assumed to be right for the content language directionality.
3466  $previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
3467  if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
3468  $previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
3469  }
3470  $otherTags .= Html::inlineStyle( $previewedCSS ) . "\n";
3471  } else {
3472  // Load the user styles normally
3473  $moduleStyles[] = 'user';
3474  }
3475 
3476  // Per-user preference styles
3477  $moduleStyles[] = 'user.cssprefs';
3478 
3479  foreach ( $moduleStyles as $name ) {
3480  $module = $resourceLoader->getModule( $name );
3481  if ( !$module ) {
3482  continue;
3483  }
3484  $group = $module->getGroup();
3485  // Modules in groups different than the ones listed on top (see $styles assignment)
3486  // will be placed in the "other" group
3487  $styles[ isset( $styles[$group] ) ? $group : 'other' ][] = $name;
3488  }
3489 
3490  // We want site, private and user styles to override dynamically added styles from modules, but we want
3491  // dynamically added styles to override statically added styles from other modules. So the order
3492  // has to be other, dynamic, site, private, user
3493  // Add statically added styles for other modules
3494  $links[] = $this->makeResourceLoaderLink( $styles['other'], ResourceLoaderModule::TYPE_STYLES );
3495  // Add normal styles added through addStyle()/addInlineStyle() here
3496  $links[] = implode( "\n", $this->buildCssLinksArray() ) . $this->mInlineStyles;
3497  // Add marker tag to mark the place where the client-side loader should inject dynamic styles
3498  // We use a <meta> tag with a made-up name for this because that's valid HTML
3499  $links[] = Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) ) . "\n";
3500 
3501  // Add site, private and user styles
3502  // 'private' at present only contains user.options, so put that before 'user'
3503  // Any future private modules will likely have a similar user-specific character
3504  foreach ( array( 'site', 'noscript', 'private', 'user' ) as $group ) {
3505  $links[] = $this->makeResourceLoaderLink( $styles[$group],
3507  );
3508  }
3509 
3510  // Add stuff in $otherTags (previewed user CSS if applicable)
3511  return self::getHtmlFromLoaderLinks( $links ) . $otherTags;
3512  }
3513 
3517  public function buildCssLinksArray() {
3518  $links = array();
3519 
3520  // Add any extension CSS
3521  foreach ( $this->mExtStyles as $url ) {
3522  $this->addStyle( $url );
3523  }
3524  $this->mExtStyles = array();
3525 
3526  foreach ( $this->styles as $file => $options ) {
3527  $link = $this->styleLink( $file, $options );
3528  if ( $link ) {
3529  $links[$file] = $link;
3530  }
3531  }
3532  return $links;
3533  }
3534 
3542  protected function styleLink( $style, $options ) {
3543  if ( isset( $options['dir'] ) ) {
3544  if ( $this->getLanguage()->getDir() != $options['dir'] ) {
3545  return '';
3546  }
3547  }
3548 
3549  if ( isset( $options['media'] ) ) {
3550  $media = self::transformCssMedia( $options['media'] );
3551  if ( is_null( $media ) ) {
3552  return '';
3553  }
3554  } else {
3555  $media = 'all';
3556  }
3557 
3558  if ( substr( $style, 0, 1 ) == '/' ||
3559  substr( $style, 0, 5 ) == 'http:' ||
3560  substr( $style, 0, 6 ) == 'https:' ) {
3561  $url = $style;
3562  } else {
3563  global $wgStylePath, $wgStyleVersion;
3564  $url = $wgStylePath . '/' . $style . '?' . $wgStyleVersion;
3565  }
3566 
3567  $link = Html::linkedStyle( $url, $media );
3568 
3569  if ( isset( $options['condition'] ) ) {
3570  $condition = htmlspecialchars( $options['condition'] );
3571  $link = "<!--[if $condition]>$link<![endif]-->";
3572  }
3573  return $link;
3574  }
3575 
3583  public static function transformCssMedia( $media ) {
3584  global $wgRequest;
3585 
3586  // http://www.w3.org/TR/css3-mediaqueries/#syntax
3587  $screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
3588 
3589  // Switch in on-screen display for media testing
3590  $switches = array(
3591  'printable' => 'print',
3592  'handheld' => 'handheld',
3593  );
3594  foreach ( $switches as $switch => $targetMedia ) {
3595  if ( $wgRequest->getBool( $switch ) ) {
3596  if ( $media == $targetMedia ) {
3597  $media = '';
3598  } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3599  // This regex will not attempt to understand a comma-separated media_query_list
3600  //
3601  // Example supported values for $media: 'screen', 'only screen', 'screen and (min-width: 982px)' ),
3602  // Example NOT supported value for $media: '3d-glasses, screen, print and resolution > 90dpi'
3603  //
3604  // If it's a print request, we never want any kind of screen stylesheets
3605  // If it's a handheld request (currently the only other choice with a switch),
3606  // we don't want simple 'screen' but we might want screen queries that
3607  // have a max-width or something, so we'll pass all others on and let the
3608  // client do the query.
3609  if ( $targetMedia == 'print' || $media == 'screen' ) {
3610  return null;
3611  }
3612  }
3613  }
3614  }
3615 
3616  return $media;
3617  }
3625  public function addWikiMsg( /*...*/ ) {
3626  $args = func_get_args();
3627  $name = array_shift( $args );
3628  $this->addWikiMsgArray( $name, $args );
3629  }
3630 
3639  public function addWikiMsgArray( $name, $args ) {
3640  $this->addHTML( $this->msg( $name, $args )->parseAsBlock() );
3641  }
3642 
3666  public function wrapWikiMsg( $wrap /*, ...*/ ) {
3667  $msgSpecs = func_get_args();
3668  array_shift( $msgSpecs );
3669  $msgSpecs = array_values( $msgSpecs );
3670  $s = $wrap;
3671  foreach ( $msgSpecs as $n => $spec ) {
3672  if ( is_array( $spec ) ) {
3673  $args = $spec;
3674  $name = array_shift( $args );
3675  if ( isset( $args['options'] ) ) {
3676  unset( $args['options'] );
3677  wfDeprecated(
3678  'Adding "options" to ' . __METHOD__ . ' is no longer supported',
3679  '1.20'
3680  );
3681  }
3682  } else {
3683  $args = array();
3684  $name = $spec;
3685  }
3686  $s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
3687  }
3688  $this->addWikiText( $s );
3689  }
3690 
3700  public function includeJQuery( $modules = array() ) {
3701  return array();
3702  }
3703 
3709  public function enableTOC( $flag = true ) {
3710  $this->mEnableTOC = $flag;
3711  }
3712 
3717  public function isTOCEnabled() {
3718  return $this->mEnableTOC;
3719  }
3720 
3726  public function enableSectionEditLinks( $flag = true ) {
3727  $this->mEnableSectionEditLinks = $flag;
3728  }
3729 
3734  public function sectionEditLinksEnabled() {
3736  }
3737 }
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:1881
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:1184
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:1258
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:313
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:33
OutputPage\getTarget
getTarget()
Definition: OutputPage.php:557
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:1134
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:212
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:971
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:1313
OutputPage\enableClientCache
enableClientCache( $state)
Use enableClientCache(false) to force it to send nocache headers.
Definition: OutputPage.php:1731
OutputPage\styleLink
styleLink( $style, $options)
Generate <link> tags for stylesheets.
Definition: OutputPage.php:3535
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:3618
ContextSource\getContext
getContext()
Get the RequestContext object.
Definition: ContextSource.php:40
OutputPage\getLanguageLinks
getLanguageLinks()
Get the list of language links.
Definition: OutputPage.php:1175
OutputPage\reduceAllowedModules
reduceAllowedModules( $type, $level)
Limit the highest level of CSS/JS untrustworthiness allowed.
Definition: OutputPage.php:1327
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:3929
OutputPage\addSubtitle
addSubtitle( $str)
Add $str to the subtitle.
Definition: OutputPage.php:938
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:1847
OutputPage\$mEnableSectionEditLinks
bool $mEnableSectionEditLinks
Whether parser output should contain section edit links.
Definition: OutputPage.php:260
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:3015
OutputPage\$mContainsNewMagic
$mContainsNewMagic
Definition: OutputPage.php:167
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:801
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:2452
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:2892
OutputPage\$mRedirectedFrom
Title $mRedirectedFrom
If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redire...
Definition: OutputPage.php:243
OutputPage\setTitle
setTitle(Title $t)
Set the Title object to use.
Definition: OutputPage.php:909
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:608
OutputPage\__construct
__construct(IContextSource $context=null)
Constructor for OutputPage.
Definition: OutputPage.php:267
OutputPage\addModuleMessages
addModuleMessages( $modules)
Add only messages of one or more modules recognized by the resource loader.
Definition: OutputPage.php:550
OutputPage\getScript
getScript()
Get all registered JS and CSS tags for the header.
Definition: OutputPage.php:429
OutputPage\addModuleStyles
addModuleStyles( $modules)
Add only CSS of one or more modules recognized by the resource loader.
Definition: OutputPage.php:527
OutputPage\loginToUse
loginToUse()
Produce the stock "please login to use the wiki" page.
Definition: OutputPage.php:2292
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:2139
OutputPage\isArticleRelated
isArticleRelated()
Return whether this page is related an article on the wiki.
Definition: OutputPage.php:1146
OutputPage\enableSectionEditLinks
enableSectionEditLinks( $flag=true)
Enables/disables section edit links, doesn't override NOEDITSECTION
Definition: OutputPage.php:3719
OutputPage\setArticleBodyOnly
setArticleBodyOnly( $only)
Set whether the output should only contain the body of the article, without any skin,...
Definition: OutputPage.php:628
OutputPage\getFrameOptions
getFrameOptions()
Get the X-Frame-Options header value (without the name part), or false if there isn't one.
Definition: OutputPage.php:1911
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3659
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:2134
OutputPage\getRevisionId
getRevisionId()
Get the displayed revision ID.
Definition: OutputPage.php:1423
$timestamp
if( $limit) $timestamp
Definition: importImages.php:104
OutputPage\addParserOutput
addParserOutput(&$parserOutput)
Add a ParserOutput object.
Definition: OutputPage.php:1630
OutputPage\addWikiTextTitleTidy
addWikiTextTitleTidy( $text, &$title, $linestart=true)
Add wikitext with a custom Title object and tidy enabled.
Definition: OutputPage.php:1525
OutputPage\clearHTML
clearHTML()
Clear the body HTML.
Definition: OutputPage.php:1378
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:1245
OutputPage\addScript
addScript( $script)
Add raw HTML to the list of scripts (including <script> tag, etc.)
Definition: OutputPage.php:369
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:2483
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:2486
OutputPage\$mIsArticleRelated
$mIsArticleRelated
Should be private.
Definition: OutputPage.php:71
OutputPage\buildCssLinksArray
buildCssLinksArray()
Definition: OutputPage.php:3510
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:822
$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:286
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2387
OutputPage\isUserJsAllowed
isUserJsAllowed()
Return whether user JavaScript is allowed for this page.
Definition: OutputPage.php:1287
OutputPage\getBottomScripts
getBottomScripts()
JS stuff to put at the bottom of the "<body>".
Definition: OutputPage.php:2960
OutputPage\$mCategoryLinks
$mCategoryLinks
Definition: OutputPage.php:108
OutputPage\showFileNotFoundError
showFileNotFoundError( $name)
Definition: OutputPage.php:2460
OutputPage\getHtmlFromLoaderLinks
static getHtmlFromLoaderLinks(Array $links)
Build html output from an array of links from makeResourceLoaderLink.
Definition: OutputPage.php:2811
$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:1956
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:514
ResourceLoaderModule\TYPE_MESSAGES
const TYPE_MESSAGES
Definition: ResourceLoaderModule.php:33
$params
$params
Definition: styleTest.css.php:40
OutputPage\getHeadLinks
getHeadLinks()
Definition: OutputPage.php:3363
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:2270
OutputPage\parseInline
parseInline( $text, $linestart=true, $interface=false)
Parse wikitext, strip paragraphs, and return the HTML.
Definition: OutputPage.php:1704
OutputPage\addScriptFile
addScriptFile( $file, $version=null)
Add a JavaScript file out of skins/common, or a given relative path.
Definition: OutputPage.php:401
$s
$s
Definition: mergeMessageFileList.php:156
OutputPage\parserOptions
parserOptions( $options=null)
Get/set the ParserOptions object to use for wikitext parsing.
Definition: OutputPage.php:1398
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:1467
OutputPage\getSyndicationLinks
getSyndicationLinks()
Return URLs for each supported syndication format for this page.
Definition: OutputPage.php:1091
OutputPage\$mVaryHeader
$mVaryHeader
Definition: OutputPage.php:234
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:192
User\groupHasPermission
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
Definition: User.php:4146
OutputPage\getRedirect
getRedirect()
Get the URL to redirect to, or an empty string if not redirect URL set.
Definition: OutputPage.php:293
OutputPage\setCanonicalUrl
setCanonicalUrl( $url)
Set the URL to be used for the <link rel="canonical">.
Definition: OutputPage.php:344
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:2149
ContextSource\getTitle
getTitle()
Get the Title object.
Definition: ContextSource.php:87
OutputPage\$mIndexPolicy
$mIndexPolicy
Definition: OutputPage.php:232
Skin\getHtmlElementAttributes
getHtmlElementAttributes()
Definition: Skin.php:482
Html\inlineScript
static inlineScript( $contents)
Output a "<script>" tag with the given contents.
Definition: Html.php:570
OutputPage\permissionRequired
permissionRequired( $permission)
Display an error page noting that a given permission bit is required.
Definition: OutputPage.php:2283
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:2456
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:1358
OutputPage\addHeadItem
addHeadItem( $name, $value)
Add or replace an header item to the output.
Definition: OutputPage.php:598
OutputPage\addWikiTextTidy
addWikiTextTidy( $text, $linestart=true)
Add wikitext with tidy enabled.
Definition: OutputPage.php:1535
OutputPage\$mArticleBodyOnly
$mArticleBodyOnly
Flag if output should only contain the body of the article.
Definition: OutputPage.php:189
OutputPage\getModuleScripts
getModuleScripts( $filter=false, $position=null)
Get the list of module JS to include on this page.
Definition: OutputPage.php:491
OutputPage\getRevisionTimestamp
getRevisionTimestamp()
Get the timestamp of displayed revision.
Definition: OutputPage.php:1444
OutputPage\addWikiMsgArray
addWikiMsgArray( $name, $args)
Add a wikitext-formatted message to the output.
Definition: OutputPage.php:3632
OutputPage\enableTOC
enableTOC( $flag=true)
Enables/disables TOC, doesn't override NOTOC
Definition: OutputPage.php:3702
OutputPage\transformCssMedia
static transformCssMedia( $media)
Transform "media" attribute based on request parameters.
Definition: OutputPage.php:3576
OutputPage\setLastModified
setLastModified( $timestamp)
Override the last modified timestamp.
Definition: OutputPage.php:765
OutputPage\$mInlineMsg
$mInlineMsg
Definition: OutputPage.php:145
OutputPage\$mNoGallery
$mNoGallery
Comes from the parser.
Definition: OutputPage.php:199
$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
OutputPage\getAllowedModules
getAllowedModules( $type=null)
Get the level of JavaScript / CSS untrustworthiness allowed on this page.
Definition: OutputPage.php:1300
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:154
OutputPage\$mParseWarnings
$mParseWarnings
Definition: OutputPage.php:203
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:459
OutputPage\forceHideNewSectionLink
forceHideNewSectionLink()
Forcibly hide the new section link?
Definition: OutputPage.php:1022
OutputPage\addWikiTextWithTitle
addWikiTextWithTitle( $text, &$title, $linestart=true)
Add wikitext with a custom Title object.
Definition: OutputPage.php:1514
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:846
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:2354
OutputPage\$mPageTitleActionText
$mPageTitleActionText
Definition: OutputPage.php:202
OutputPage\showErrorPage
showErrorPage( $title, $msg, $params=array())
Output a standard error page.
Definition: OutputPage.php:2173
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:539
$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:3375
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:3393
OutputPage\sendCacheControl
sendCacheControl()
Send cache control HTTP headers.
Definition: OutputPage.php:1924
OutputPage\setETag
setETag( $tag)
Set the value of the ETag HTTP header, only used if $wgUseETag is true.
Definition: OutputPage.php:617
OutputPage\out
out( $ins)
Actually output something with print.
Definition: OutputPage.php:2125
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1127
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2417
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:3739
OutputPage\output
output()
Finally, all the text has been munged and accumulated into the object, let's actually output it:
Definition: OutputPage.php:2006
OutputPage\$mEnableTOC
bool $mEnableTOC
Whether parser output should contain table of contents.
Definition: OutputPage.php:256
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:1454
OutputPage\showUnexpectedValueError
showUnexpectedValueError( $name, $val)
Definition: OutputPage.php:2444
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:2602
OutputPage\isTOCEnabled
isTOCEnabled()
Definition: OutputPage.php:3710
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:589
TS_ISO_8601
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
Definition: GlobalFunctions.php:2448
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:1051
OutputPage\$mAllowedModuleOrigin
int $mAllowedModuleOrigin
The level of 'untrustworthiness' allowed for modules loaded on this page.
Definition: OutputPage.php:158
OutputPage\isDisabled
isDisabled()
Return whether the output will be completely disabled.
Definition: OutputPage.php:1004
wfTimestampOrNull
wfTimestampOrNull( $outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.
Definition: GlobalFunctions.php:2501
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:1413
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:1111
OutputPage\disallowUserJs
disallowUserJs()
Restrict the page to loading modules bundled the software.
Definition: OutputPage.php:1277
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:918
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4010
OutputPage\addVaryHeader
addVaryHeader( $header, $option=null)
Add an HTTP header that will influence on the cache.
Definition: OutputPage.php:1789
OutputPage\getStatusMessage
static getStatusMessage( $code)
Get the message associated with the HTTP response code $code.
Definition: OutputPage.php:1997
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:1499
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:412
OutputPage\getVaryHeader
getVaryHeader()
Return a Vary: header on which to vary caches.
Definition: OutputPage.php:1808
OutputPage\addModules
addModules( $modules)
Add one or more modules recognized by the resource loader.
Definition: OutputPage.php:479
OutputPage\showLagWarning
showLagWarning( $lag)
Show a warning about slave lag.
Definition: OutputPage.php:2427
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:929
OutputPage\getPageTitleActionText
getPageTitleActionText()
Get the value of the "action text".
Definition: OutputPage.php:831
OutputPage\getCacheVaryCookies
getCacheVaryCookies()
Get the list of cookies that will influence on the cache.
Definition: OutputPage.php:1740
OutputPage\getHeadItems
getHeadItems()
Get all header items in a string.
Definition: OutputPage.php:584
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:233
OutputPage\addLanguageLinks
addLanguageLinks( $newLinkArray)
Add new language links.
Definition: OutputPage.php:1156
OutputPage\formatPermissionsErrorMessage
formatPermissionsErrorMessage( $errors, $action=null)
Format a list of error messages.
Definition: OutputPage.php:2303
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:2838
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:951
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:1576
OutputPage\isArticle
isArticle()
Return whether the content displayed page is related to the source of the corresponding article on th...
Definition: OutputPage.php:1124
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:172
OutputPage\addLink
addLink( $linkarr)
Add a new <link> tag to the page header.
Definition: OutputPage.php:324
OutputPage\addInlineScript
addInlineScript( $script)
Add a self-contained script tag with the given contents.
Definition: OutputPage.php:420
OutputPage\getArticleBodyOnly
getArticleBodyOnly()
Return whether the output will contain only the body of the article.
Definition: OutputPage.php:637
OutputPage\getPreventClickjacking
getPreventClickjacking()
Get the prevent-clickjacking flag.
Definition: OutputPage.php:1900
$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:390
OutputPage\setStatusCode
setStatusCode( $statusCode)
Set the HTTP status code to send with the output.
Definition: OutputPage.php:302
OutputPage\includeJQuery
includeJQuery( $modules=array())
Include jQuery core.
Definition: OutputPage.php:3693
OutputPage\makeResourceLoaderLink
makeResourceLoaderLink( $modules, $only, $useESI=false, array $extraQuery=array(), $loadCall=false)
TODO: Document.
Definition: OutputPage.php:2618
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:1764
OutputPage\getPageTitle
getPageTitle()
Return the "page title", i.e.
Definition: OutputPage.php:900
OutputPage\disable
disable()
Disable output completely, i.e.
Definition: OutputPage.php:995
TS_MW
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
Definition: GlobalFunctions.php:2431
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:933
OutputPage\sectionEditLinksEnabled
sectionEditLinksEnabled()
Definition: OutputPage.php:3727
OutputPage\setIndexPolicy
setIndexPolicy( $policy)
Set the index policy for the page, but leave the follow policy un- touched.
Definition: OutputPage.php:795
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
Skin\getRelevantTitle
getRelevantTitle()
Return the "relevant" title.
Definition: Skin.php:344
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
Skin\getPageClasses
getPageClasses( $title)
TODO: document.
Definition: Skin.php:455
OutputPage\showPermissionsErrorPage
showPermissionsErrorPage( $errors, $action=null)
Output a standard permission error page.
Definition: OutputPage.php:2198
OutputPage\setRevisionTimestamp
setRevisionTimestamp( $timestamp)
Set the timestamp of the revision which will be displayed.
Definition: OutputPage.php:1434
$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:575
wfClearOutputBuffers
wfClearOutputBuffers()
More legible than passing a 'false' parameter to wfResetOutputBuffers():
Definition: GlobalFunctions.php:2270
OutputPage\rateLimited
rateLimited()
Turn off regular page output and return an error response for when rate limiting has triggered.
Definition: OutputPage.php:2414
$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:215
TS_ISO_8601_BASIC
const TS_ISO_8601_BASIC
ISO 8601 basic format with no timezone: 19860209T200000Z.
Definition: GlobalFunctions.php:2472
OutputPage\reduceAllowedModuleOrigin
reduceAllowedModuleOrigin( $level)
Limit the highest level of CSS/JS untrustworthiness allowed.
Definition: OutputPage.php:1340
OutputPage\getProperty
getProperty( $name)
Get an additional output property.
Definition: OutputPage.php:659
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:1720
OutputPage\$mNewSectionLink
$mNewSectionLink
Definition: OutputPage.php:191
OutputPage\setTarget
setTarget( $target)
Sets ResourceLoader target for load.php links.
Definition: OutputPage.php:566
OutputPage\setHTMLTitle
setHTMLTitle( $name)
"HTML title" means the contents of "<title>".
Definition: OutputPage.php:844
OutputPage\$styles
$styles
An array of stylesheet filenames (relative from skins path), with options for CSS media,...
Definition: OutputPage.php:225
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:248
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:3659
OutputPage\buildCssLinks
buildCssLinks()
Build a set of "<link>" elements for the stylesheets specified in the $this->styles array.
Definition: OutputPage.php:3428
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:604
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:441
OutputPage\prependHTML
prependHTML( $text)
Prepend $text to the body HTML.
Definition: OutputPage.php:1349
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:183
OutputPage\$mCategories
$mCategories
Definition: OutputPage.php:109
OutputPage\getHTMLTitle
getHTMLTitle()
Return the "HTML title", i.e.
Definition: OutputPage.php:857
OutputPage\showFileCopyError
showFileCopyError( $old, $new)
Definition: OutputPage.php:2448
ResourceLoaderModule\ORIGIN_CORE_INDIVIDUAL
const ORIGIN_CORE_INDIVIDUAL
Definition: ResourceLoaderModule.php:40
OutputPage\clearSubtitle
clearSubtitle()
Clear the subtitles.
Definition: OutputPage.php:962
OutputPage\getMetadataAttribute
getMetadataAttribute()
Get the value of the "rel" attribute for metadata links.
Definition: OutputPage.php:353
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:465
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:809
OutputPage\setPageTitle
setPageTitle( $name)
"Page title" means the contents of <h1>.
Definition: OutputPage.php:878
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:678
$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:2472
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:648
OutputPage\isPrintable
isPrintable()
Return whether the page is "printable".
Definition: OutputPage.php:988
OutputPage\setSyndicated
setSyndicated( $show=true)
Add or remove feed links in the page header This is mainly kept for backward compatibility,...
Definition: OutputPage.php:1034
$wgParser
$wgParser
Definition: Setup.php:567
OutputPage\$mTarget
string null $mTarget
ResourceLoader target for load.php links.
Definition: OutputPage.php:252
OutputPage\addInlineStyle
addInlineStyle( $style_css, $flip='noflip')
Adds inline CSS styles.
Definition: OutputPage.php:3414
$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:3130
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:625
OutputPage\addExtensionStyle
addExtensionStyle( $url)
Register and add a stylesheet from an extension directory.
Definition: OutputPage.php:381
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:1166
OutputPage\setRedirectedFrom
setRedirectedFrom( $t)
Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
Definition: OutputPage.php:866
OutputPage\addWikiTextTitle
addWikiTextTitle( $text, Title $title, $linestart, $tidy=false, $interface=false)
Add wikitext with a custom Title object.
Definition: OutputPage.php:1550
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:2426
OutputPage\getHeadScripts
getHeadScripts()
JS stuff to put in the "<head>".
Definition: OutputPage.php:2840
OutputPage\redirect
redirect( $url, $responsecode='302')
Redirect to $url rather than displaying the normal page.
Definition: OutputPage.php:282
$path
$path
Definition: NoLocalSettings.php:35
OutputPage\setPrintable
setPrintable()
Set the page as printable, i.e.
Definition: OutputPage.php:979
OutputPage\getHeadLinksArray
getHeadLinksArray()
Definition: OutputPage.php:3148
OutputPage\$mTemplateIds
$mTemplateIds
Definition: OutputPage.php:147
OutputPage\$mJQueryDone
$mJQueryDone
Whether jQuery is already handled.
Definition: OutputPage.php:230
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:502
OutputPage\allowClickjacking
allowClickjacking()
Turn off frame-breaking.
Definition: OutputPage.php:1890
OutputPage\addElement
addElement( $element, $attribs=array(), $contents='')
Shortcut for adding an Html::element via addHTML.
Definition: OutputPage.php:1371
OutputPage\showFatalError
showFatalError( $message)
Definition: OutputPage.php:2438
OutputPage\getHTML
getHTML()
Get the body HTML.
Definition: OutputPage.php:1387
Skin\getRelevantUser
getRelevantUser()
Return the "relevant" user.
Definition: Skin.php:368
$keys
$keys
Definition: testCompression.php:63
OutputPage\$mCanonicalUrl
$mCanonicalUrl
Definition: OutputPage.php:43
$source
if(PHP_SAPI !='cli') $source
Definition: mwdoc-filter.php:18
OutputPage\$mModules
$mModules
Definition: OutputPage.php:140
ResourceLoaderModule\TYPE_STYLES
const TYPE_STYLES
Definition: ResourceLoaderModule.php:32
Sanitizer\normalizeCharReferences
static normalizeCharReferences( $text)
Ensure that any entities and character references are legal for XML and XHTML specifically.
Definition: Sanitizer.php:1316
MWDebug\addModules
static addModules(OutputPage $out)
Add ResourceLoader modules to the OutputPage object if debugging is enabled.
Definition: Debug.php:87
OutputPage\addMetadataLink
addMetadataLink( $linkarr)
Add a new <link> with "rel" attribute set to "meta".
Definition: OutputPage.php:335
OutputPage\showNewSectionLink
showNewSectionLink()
Show an "add new section" link?
Definition: OutputPage.php:1013
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:1664
OutputPage\$mStatusCode
$mStatusCode
Definition: OutputPage.php:88
$t
$t
Definition: testCompression.php:65
OutputPage\$mSquidMaxage
$mSquidMaxage
Definition: OutputPage.php:206
$vars
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
Definition: hooks.txt:1679
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:2992
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:2573
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:213
OutputPage\getJsConfigVars
getJsConfigVars()
Get the javascript config vars to include on this page.
Definition: OutputPage.php:2982
OutputPage\$mContainsOldMagic
$mContainsOldMagic
Definition: OutputPage.php:167
OutputPage\getTemplateIds
getTemplateIds()
Get the templates used on this page.
Definition: OutputPage.php:1477
$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:1083
OutputPage\$mFeedLinksAppendQuery
$mFeedLinksAppendQuery
Definition: OutputPage.php:152
OutputPage\getFileSearchOptions
getFileSearchOptions()
Get the files used on this page.
Definition: OutputPage.php:1487
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:180
OutputPage\$mDoNothing
bool $mDoNothing
Whether output is disabled.
Definition: OutputPage.php:164
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:1817
OutputPage\$mPreventClickjacking
$mPreventClickjacking
Definition: OutputPage.php:209
TS_RFC2822
const TS_RFC2822
RFC 2822 format, for E-mail and HTTP headers.
Definition: GlobalFunctions.php:2441
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:2148
OutputPage\addTemplate
addTemplate(&$template)
Add the output of a QuickTemplate to the output buffer.
Definition: OutputPage.php:1648
OutputPage\getFeedAppendQuery
getFeedAppendQuery()
Will currently always return null.
Definition: OutputPage.php:1100
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:497
OutputPage\addFeedLink
addFeedLink( $format, $href)
Add a feed link to the page header.
Definition: OutputPage.php:1071
OutputPage\setRobotPolicy
setRobotPolicy( $policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
Definition: OutputPage.php:777
wfArrayToCgi
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes two arrays as input, and returns a CGI-style string, e.g.
Definition: GlobalFunctions.php:367
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:2516
$type
$type
Definition: testCompression.php:46
OutputPage\getCategories
getCategories()
Get the list of category names this page belongs to.
Definition: OutputPage.php:1267