MediaWiki  1.23.2
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 
154  # What level of 'untrustworthiness' is allowed in CSS/JS modules loaded on this page?
155  # @see ResourceLoaderModule::$origin
156  # ResourceLoaderModule::ORIGIN_ALL is assumed unless overridden;
157  protected $mAllowedModules = array(
159  );
160 
166  var $mDoNothing = false;
167 
168  // Parser related.
170 
175  protected $mParserOptions = null;
176 
183  var $mFeedLinks = array();
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 = '';
206  var $mParseWarnings = array();
207 
208  // Cache stuff. Looks like mEnableClientCache
209  var $mSquidMaxage = 0;
210 
211  // @todo document
212  var $mPreventClickjacking = true;
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() {
997  }
998 
1002  public function disable() {
1003  $this->mDoNothing = true;
1004  }
1011  public function isDisabled() {
1012  return $this->mDoNothing;
1013  }
1020  public function showNewSectionLink() {
1021  return $this->mNewSectionLink;
1022  }
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  }
1071 
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  }
1107  public function getFeedAppendQuery() {
1109  }
1110 
1118  public function setArticleFlag( $v ) {
1119  $this->mIsarticle = $v;
1120  if ( $v ) {
1121  $this->mIsArticleRelated = $v;
1122  }
1123  }
1124 
1131  public function isArticle() {
1132  return $this->mIsarticle;
1133  }
1134 
1141  public function setArticleRelated( $v ) {
1142  $this->mIsArticleRelated = $v;
1143  if ( !$v ) {
1144  $this->mIsarticle = false;
1145  }
1146  }
1153  public function isArticleRelated() {
1154  return $this->mIsArticleRelated;
1155  }
1156 
1163  public function addLanguageLinks( $newLinkArray ) {
1164  $this->mLanguageLinks += $newLinkArray;
1165  }
1166 
1173  public function setLanguageLinks( $newLinkArray ) {
1174  $this->mLanguageLinks = $newLinkArray;
1175  }
1182  public function getLanguageLinks() {
1183  return $this->mLanguageLinks;
1184  }
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  }
1252  public function setCategoryLinks( $categories ) {
1253  $this->mCategoryLinks = array();
1254  $this->addCategoryLinks( $categories );
1255  }
1256 
1265  public function getCategoryLinks() {
1266  return $this->mCategoryLinks;
1267  }
1274  public function getCategories() {
1275  return $this->mCategories;
1276  }
1277 
1282  public function disallowUserJs() {
1283  $this->reduceAllowedModules(
1286  );
1287  }
1288 
1295  public function isUserJsAllowed() {
1296  wfDeprecated( __METHOD__, '1.18' );
1298  }
1299 
1306  public function getAllowedModules( $type ) {
1308  return min( array_values( $this->mAllowedModules ) );
1309  } else {
1310  return isset( $this->mAllowedModules[$type] )
1311  ? $this->mAllowedModules[$type]
1313  }
1314  }
1321  public function setAllowedModules( $type, $level ) {
1322  $this->mAllowedModules[$type] = $level;
1323  }
1330  public function reduceAllowedModules( $type, $level ) {
1331  $this->mAllowedModules[$type] = min( $this->getAllowedModules( $type ), $level );
1332  }
1339  public function prependHTML( $text ) {
1340  $this->mBodytext = $text . $this->mBodytext;
1341  }
1348  public function addHTML( $text ) {
1349  $this->mBodytext .= $text;
1350  }
1351 
1361  public function addElement( $element, $attribs = array(), $contents = '' ) {
1362  $this->addHTML( Html::element( $element, $attribs, $contents ) );
1363  }
1364 
1368  public function clearHTML() {
1369  $this->mBodytext = '';
1370  }
1377  public function getHTML() {
1378  return $this->mBodytext;
1379  }
1380 
1388  public function parserOptions( $options = null ) {
1389  if ( !$this->mParserOptions ) {
1390  $this->mParserOptions = ParserOptions::newFromContext( $this->getContext() );
1391  $this->mParserOptions->setEditSection( false );
1392  }
1393  return wfSetVar( $this->mParserOptions, $options );
1394  }
1395 
1403  public function setRevisionId( $revid ) {
1404  $val = is_null( $revid ) ? null : intval( $revid );
1405  return wfSetVar( $this->mRevisionId, $val );
1406  }
1413  public function getRevisionId() {
1414  return $this->mRevisionId;
1415  }
1416 
1424  public function setRevisionTimestamp( $timestamp ) {
1425  return wfSetVar( $this->mRevisionTimestamp, $timestamp );
1426  }
1427 
1434  public function getRevisionTimestamp() {
1436  }
1437 
1444  public function setFileVersion( $file ) {
1445  $val = null;
1446  if ( $file instanceof File && $file->exists() ) {
1447  $val = array( 'time' => $file->getTimestamp(), 'sha1' => $file->getSha1() );
1448  }
1449  return wfSetVar( $this->mFileVersion, $val, true );
1450  }
1457  public function getFileVersion() {
1458  return $this->mFileVersion;
1459  }
1460 
1467  public function getTemplateIds() {
1468  return $this->mTemplateIds;
1469  }
1470 
1477  public function getFileSearchOptions() {
1478  return $this->mImageTimeKeys;
1479  }
1480 
1489  public function addWikiText( $text, $linestart = true, $interface = true ) {
1490  $title = $this->getTitle(); // Work around E_STRICT
1491  if ( !$title ) {
1492  throw new MWException( 'Title is null' );
1493  }
1494  $this->addWikiTextTitle( $text, $title, $linestart, /*tidy*/false, $interface );
1495  }
1496 
1504  public function addWikiTextWithTitle( $text, &$title, $linestart = true ) {
1505  $this->addWikiTextTitle( $text, $title, $linestart );
1506  }
1507 
1515  function addWikiTextTitleTidy( $text, &$title, $linestart = true ) {
1516  $this->addWikiTextTitle( $text, $title, $linestart, true );
1517  }
1518 
1525  public function addWikiTextTidy( $text, $linestart = true ) {
1526  $title = $this->getTitle();
1527  $this->addWikiTextTitleTidy( $text, $title, $linestart );
1528  }
1529 
1540  public function addWikiTextTitle( $text, Title $title, $linestart, $tidy = false, $interface = false ) {
1541  global $wgParser;
1542 
1543  wfProfileIn( __METHOD__ );
1544 
1545  $popts = $this->parserOptions();
1546  $oldTidy = $popts->setTidy( $tidy );
1547  $popts->setInterfaceMessage( (bool)$interface );
1548 
1549  $parserOutput = $wgParser->parse(
1550  $text, $title, $popts,
1551  $linestart, true, $this->mRevisionId
1552  );
1553 
1554  $popts->setTidy( $oldTidy );
1555 
1556  $this->addParserOutput( $parserOutput );
1557 
1558  wfProfileOut( __METHOD__ );
1559  }
1566  public function addParserOutputNoText( &$parserOutput ) {
1567  $this->mLanguageLinks += $parserOutput->getLanguageLinks();
1568  $this->addCategoryLinks( $parserOutput->getCategories() );
1569  $this->mNewSectionLink = $parserOutput->getNewSection();
1570  $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
1571 
1572  $this->mParseWarnings = $parserOutput->getWarnings();
1573  if ( !$parserOutput->isCacheable() ) {
1574  $this->enableClientCache( false );
1575  }
1576  $this->mNoGallery = $parserOutput->getNoGallery();
1577  $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
1578  $this->addModules( $parserOutput->getModules() );
1579  $this->addModuleScripts( $parserOutput->getModuleScripts() );
1580  $this->addModuleStyles( $parserOutput->getModuleStyles() );
1581  $this->addModuleMessages( $parserOutput->getModuleMessages() );
1582  $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
1583  $this->mPreventClickjacking = $this->mPreventClickjacking
1584  || $parserOutput->preventClickjacking();
1585 
1586  // Template versioning...
1587  foreach ( (array)$parserOutput->getTemplateIds() as $ns => $dbks ) {
1588  if ( isset( $this->mTemplateIds[$ns] ) ) {
1589  $this->mTemplateIds[$ns] = $dbks + $this->mTemplateIds[$ns];
1590  } else {
1591  $this->mTemplateIds[$ns] = $dbks;
1592  }
1593  }
1594  // File versioning...
1595  foreach ( (array)$parserOutput->getFileSearchOptions() as $dbk => $data ) {
1596  $this->mImageTimeKeys[$dbk] = $data;
1597  }
1598 
1599  // Hooks registered in the object
1600  global $wgParserOutputHooks;
1601  foreach ( $parserOutput->getOutputHooks() as $hookInfo ) {
1602  list( $hookName, $data ) = $hookInfo;
1603  if ( isset( $wgParserOutputHooks[$hookName] ) ) {
1604  call_user_func( $wgParserOutputHooks[$hookName], $this, $parserOutput, $data );
1605  }
1606  }
1607 
1608  // Link flags are ignored for now, but may in the future be
1609  // used to mark individual language links.
1610  $linkFlags = array();
1611  wfRunHooks( 'LanguageLinks', array( $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ) );
1612  wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) );
1613  }
1620  function addParserOutput( &$parserOutput ) {
1621  $this->addParserOutputNoText( $parserOutput );
1622  $parserOutput->setTOCEnabled( $this->mEnableTOC );
1623 
1624  // Touch section edit links only if not previously disabled
1625  if ( $parserOutput->getEditSectionTokens() ) {
1626  $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks );
1627  }
1628  $text = $parserOutput->getText();
1629  wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
1630  $this->addHTML( $text );
1631  }
1638  public function addTemplate( &$template ) {
1639  $this->addHTML( $template->getHTML() );
1640  }
1641 
1654  public function parse( $text, $linestart = true, $interface = false, $language = null ) {
1655  global $wgParser;
1656 
1657  if ( is_null( $this->getTitle() ) ) {
1658  throw new MWException( 'Empty $mTitle in ' . __METHOD__ );
1659  }
1660 
1661  $popts = $this->parserOptions();
1662  if ( $interface ) {
1663  $popts->setInterfaceMessage( true );
1664  }
1665  if ( $language !== null ) {
1666  $oldLang = $popts->setTargetLanguage( $language );
1667  }
1668 
1669  $parserOutput = $wgParser->parse(
1670  $text, $this->getTitle(), $popts,
1671  $linestart, true, $this->mRevisionId
1672  );
1673 
1674  if ( $interface ) {
1675  $popts->setInterfaceMessage( false );
1676  }
1677  if ( $language !== null ) {
1678  $popts->setTargetLanguage( $oldLang );
1679  }
1680 
1681  return $parserOutput->getText();
1682  }
1683 
1694  public function parseInline( $text, $linestart = true, $interface = false ) {
1695  $parsed = $this->parse( $text, $linestart, $interface );
1696 
1697  $m = array();
1698  if ( preg_match( '/^<p>(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) {
1699  $parsed = $m[1];
1700  }
1701 
1702  return $parsed;
1703  }
1710  public function setSquidMaxage( $maxage ) {
1711  $this->mSquidMaxage = $maxage;
1712  }
1713 
1721  public function enableClientCache( $state ) {
1722  return wfSetVar( $this->mEnableClientCache, $state );
1723  }
1730  function getCacheVaryCookies() {
1731  global $wgCookiePrefix, $wgCacheVaryCookies;
1732  static $cookies;
1733  if ( $cookies === null ) {
1734  $cookies = array_merge(
1735  array(
1736  "{$wgCookiePrefix}Token",
1737  "{$wgCookiePrefix}LoggedOut",
1738  "forceHTTPS",
1739  session_name()
1740  ),
1741  $wgCacheVaryCookies
1742  );
1743  wfRunHooks( 'GetCacheVaryCookies', array( $this, &$cookies ) );
1744  }
1745  return $cookies;
1746  }
1747 
1754  function haveCacheVaryCookies() {
1755  $cookieHeader = $this->getRequest()->getHeader( 'cookie' );
1756  if ( $cookieHeader === false ) {
1757  return false;
1758  }
1759  $cvCookies = $this->getCacheVaryCookies();
1760  foreach ( $cvCookies as $cookieName ) {
1761  # Check for a simple string match, like the way squid does it
1762  if ( strpos( $cookieHeader, $cookieName ) !== false ) {
1763  wfDebug( __METHOD__ . ": found $cookieName\n" );
1764  return true;
1765  }
1766  }
1767  wfDebug( __METHOD__ . ": no cache-varying cookies found\n" );
1768  return false;
1769  }
1770 
1779  public function addVaryHeader( $header, $option = null ) {
1780  if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
1781  $this->mVaryHeader[$header] = (array)$option;
1782  } elseif ( is_array( $option ) ) {
1783  if ( is_array( $this->mVaryHeader[$header] ) ) {
1784  $this->mVaryHeader[$header] = array_merge( $this->mVaryHeader[$header], $option );
1785  } else {
1786  $this->mVaryHeader[$header] = $option;
1787  }
1788  }
1789  $this->mVaryHeader[$header] = array_unique( (array)$this->mVaryHeader[$header] );
1790  }
1791 
1798  public function getVaryHeader() {
1799  return 'Vary: ' . join( ', ', array_keys( $this->mVaryHeader ) );
1800  }
1807  public function getXVO() {
1808  $cvCookies = $this->getCacheVaryCookies();
1809 
1810  $cookiesOption = array();
1811  foreach ( $cvCookies as $cookieName ) {
1812  $cookiesOption[] = 'string-contains=' . $cookieName;
1813  }
1814  $this->addVaryHeader( 'Cookie', $cookiesOption );
1815 
1816  $headers = array();
1817  foreach ( $this->mVaryHeader as $header => $option ) {
1818  $newheader = $header;
1819  if ( is_array( $option ) && count( $option ) > 0 ) {
1820  $newheader .= ';' . implode( ';', $option );
1821  }
1822  $headers[] = $newheader;
1823  }
1824  $xvo = 'X-Vary-Options: ' . implode( ',', $headers );
1825 
1826  return $xvo;
1827  }
1828 
1837  function addAcceptLanguage() {
1838  $lang = $this->getTitle()->getPageLanguage();
1839  if ( !$this->getRequest()->getCheck( 'variant' ) && $lang->hasVariants() ) {
1840  $variants = $lang->getVariants();
1841  $aloption = array();
1842  foreach ( $variants as $variant ) {
1843  if ( $variant === $lang->getCode() ) {
1844  continue;
1845  } else {
1846  $aloption[] = 'string-contains=' . $variant;
1847 
1848  // IE and some other browsers use BCP 47 standards in
1849  // their Accept-Language header, like "zh-CN" or "zh-Hant".
1850  // We should handle these too.
1851  $variantBCP47 = wfBCP47( $variant );
1852  if ( $variantBCP47 !== $variant ) {
1853  $aloption[] = 'string-contains=' . $variantBCP47;
1854  }
1855  }
1856  }
1857  $this->addVaryHeader( 'Accept-Language', $aloption );
1858  }
1859  }
1860 
1871  public function preventClickjacking( $enable = true ) {
1872  $this->mPreventClickjacking = $enable;
1873  }
1880  public function allowClickjacking() {
1881  $this->mPreventClickjacking = false;
1882  }
1883 
1890  public function getPreventClickjacking() {
1892  }
1893 
1901  public function getFrameOptions() {
1902  global $wgBreakFrames, $wgEditPageFrameOptions;
1903  if ( $wgBreakFrames ) {
1904  return 'DENY';
1905  } elseif ( $this->mPreventClickjacking && $wgEditPageFrameOptions ) {
1906  return $wgEditPageFrameOptions;
1907  }
1908  return false;
1909  }
1910 
1914  public function sendCacheControl() {
1915  global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgUseXVO;
1916 
1917  $response = $this->getRequest()->response();
1918  if ( $wgUseETag && $this->mETag ) {
1919  $response->header( "ETag: $this->mETag" );
1920  }
1921 
1922  $this->addVaryHeader( 'Cookie' );
1923  $this->addAcceptLanguage();
1924 
1925  # don't serve compressed data to clients who can't handle it
1926  # maintain different caches for logged-in users and non-logged in ones
1927  $response->header( $this->getVaryHeader() );
1928 
1929  if ( $wgUseXVO ) {
1930  # Add an X-Vary-Options header for Squid with Wikimedia patches
1931  $response->header( $this->getXVO() );
1932  }
1933 
1934  if ( $this->mEnableClientCache ) {
1935  if (
1936  $wgUseSquid && session_id() == '' && !$this->isPrintable() &&
1937  $this->mSquidMaxage != 0 && !$this->haveCacheVaryCookies()
1938  ) {
1939  if ( $wgUseESI ) {
1940  # We'll purge the proxy cache explicitly, but require end user agents
1941  # to revalidate against the proxy on each visit.
1942  # Surrogate-Control controls our Squid, Cache-Control downstream caches
1943  wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", 'log' );
1944  # start with a shorter timeout for initial testing
1945  # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
1946  $response->header( 'Surrogate-Control: max-age=' . $wgSquidMaxage . '+' . $this->mSquidMaxage . ', content="ESI/1.0"' );
1947  $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
1948  } else {
1949  # We'll purge the proxy cache for anons explicitly, but require end user agents
1950  # to revalidate against the proxy on each visit.
1951  # IMPORTANT! The Squid needs to replace the Cache-Control header with
1952  # Cache-Control: s-maxage=0, must-revalidate, max-age=0
1953  wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **\n", 'log' );
1954  # start with a shorter timeout for initial testing
1955  # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
1956  $response->header( 'Cache-Control: s-maxage=' . $this->mSquidMaxage . ', must-revalidate, max-age=0' );
1957  }
1958  } else {
1959  # We do want clients to cache if they can, but they *must* check for updates
1960  # on revisiting the page.
1961  wfDebug( __METHOD__ . ": private caching; {$this->mLastModified} **\n", 'log' );
1962  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
1963  $response->header( "Cache-Control: private, must-revalidate, max-age=0" );
1964  }
1965  if ( $this->mLastModified ) {
1966  $response->header( "Last-Modified: {$this->mLastModified}" );
1967  }
1968  } else {
1969  wfDebug( __METHOD__ . ": no caching **\n", 'log' );
1970 
1971  # In general, the absence of a last modified header should be enough to prevent
1972  # the client from using its cache. We send a few other things just to make sure.
1973  $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
1974  $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
1975  $response->header( 'Pragma: no-cache' );
1976  }
1977  }
1978 
1987  public static function getStatusMessage( $code ) {
1988  wfDeprecated( __METHOD__, '1.18' );
1989  return HttpStatus::getMessage( $code );
1990  }
1991 
1996  public function output() {
1997  global $wgLanguageCode, $wgDebugRedirects, $wgMimeType, $wgVaryOnXFP,
1998  $wgUseAjax, $wgResponsiveImages;
1999 
2000  if ( $this->mDoNothing ) {
2001  return;
2002  }
2003 
2004  wfProfileIn( __METHOD__ );
2005 
2006  $response = $this->getRequest()->response();
2007 
2008  if ( $this->mRedirect != '' ) {
2009  # Standards require redirect URLs to be absolute
2010  $this->mRedirect = wfExpandUrl( $this->mRedirect, PROTO_CURRENT );
2011 
2012  $redirect = $this->mRedirect;
2013  $code = $this->mRedirectCode;
2014 
2015  if ( wfRunHooks( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) {
2016  if ( $code == '301' || $code == '303' ) {
2017  if ( !$wgDebugRedirects ) {
2018  $message = HttpStatus::getMessage( $code );
2019  $response->header( "HTTP/1.1 $code $message" );
2020  }
2021  $this->mLastModified = wfTimestamp( TS_RFC2822 );
2022  }
2023  if ( $wgVaryOnXFP ) {
2024  $this->addVaryHeader( 'X-Forwarded-Proto' );
2025  }
2026  $this->sendCacheControl();
2027 
2028  $response->header( "Content-Type: text/html; charset=utf-8" );
2029  if ( $wgDebugRedirects ) {
2030  $url = htmlspecialchars( $redirect );
2031  print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
2032  print "<p>Location: <a href=\"$url\">$url</a></p>\n";
2033  print "</body>\n</html>\n";
2034  } else {
2035  $response->header( 'Location: ' . $redirect );
2036  }
2037  }
2038 
2039  wfProfileOut( __METHOD__ );
2040  return;
2041  } elseif ( $this->mStatusCode ) {
2042  $message = HttpStatus::getMessage( $this->mStatusCode );
2043  if ( $message ) {
2044  $response->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message );
2045  }
2046  }
2047 
2048  # Buffer output; final headers may depend on later processing
2049  ob_start();
2050 
2051  $response->header( "Content-type: $wgMimeType; charset=UTF-8" );
2052  $response->header( 'Content-language: ' . $wgLanguageCode );
2053 
2054  // Prevent framing, if requested
2055  $frameOptions = $this->getFrameOptions();
2056  if ( $frameOptions ) {
2057  $response->header( "X-Frame-Options: $frameOptions" );
2058  }
2059 
2060  if ( $this->mArticleBodyOnly ) {
2061  echo $this->mBodytext;
2062  } else {
2063 
2064  $sk = $this->getSkin();
2065  // add skin specific modules
2066  $modules = $sk->getDefaultModules();
2067 
2068  // enforce various default modules for all skins
2069  $coreModules = array(
2070  // keep this list as small as possible
2071  'mediawiki.page.startup',
2072  'mediawiki.user',
2073  );
2074 
2075  // Support for high-density display images if enabled
2076  if ( $wgResponsiveImages ) {
2077  $coreModules[] = 'mediawiki.hidpi';
2078  }
2079 
2080  $this->addModules( $coreModules );
2081  foreach ( $modules as $group ) {
2082  $this->addModules( $group );
2083  }
2084  MWDebug::addModules( $this );
2085  if ( $wgUseAjax ) {
2086  // FIXME: deprecate? - not clear why this is useful
2087  wfRunHooks( 'AjaxAddScript', array( &$this ) );
2088  }
2089 
2090  // Hook that allows last minute changes to the output page, e.g.
2091  // adding of CSS or Javascript by extensions.
2092  wfRunHooks( 'BeforePageDisplay', array( &$this, &$sk ) );
2093 
2094  wfProfileIn( 'Output-skin' );
2095  $sk->outputPage();
2096  wfProfileOut( 'Output-skin' );
2097  }
2098 
2099  // This hook allows last minute changes to final overall output by modifying output buffer
2100  wfRunHooks( 'AfterFinalPageOutput', array( $this ) );
2101 
2102  $this->sendCacheControl();
2103 
2104  ob_end_flush();
2105 
2106  wfProfileOut( __METHOD__ );
2107  }
2108 
2115  public function out( $ins ) {
2116  wfDeprecated( __METHOD__, '1.22' );
2117  print $ins;
2118  }
2119 
2124  function blockedPage() {
2125  throw new UserBlockedError( $this->getUser()->mBlock );
2126  }
2127 
2138  public function prepareErrorPage( $pageTitle, $htmlTitle = false ) {
2139  $this->setPageTitle( $pageTitle );
2140  if ( $htmlTitle !== false ) {
2141  $this->setHTMLTitle( $htmlTitle );
2142  }
2143  $this->setRobotPolicy( 'noindex,nofollow' );
2144  $this->setArticleRelated( false );
2145  $this->enableClientCache( false );
2146  $this->mRedirect = '';
2147  $this->clearSubtitle();
2148  $this->clearHTML();
2149  }
2150 
2163  public function showErrorPage( $title, $msg, $params = array() ) {
2164  if ( !$title instanceof Message ) {
2165  $title = $this->msg( $title );
2166  }
2167 
2168  $this->prepareErrorPage( $title );
2169 
2170  if ( $msg instanceof Message ) {
2171  if ( $params !== array() ) {
2172  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 );
2173  }
2174  $this->addHTML( $msg->parseAsBlock() );
2175  } else {
2176  $this->addWikiMsgArray( $msg, $params );
2177  }
2178 
2179  $this->returnToMain();
2180  }
2181 
2188  public function showPermissionsErrorPage( $errors, $action = null ) {
2189  // For some action (read, edit, create and upload), display a "login to do this action"
2190  // error if all of the following conditions are met:
2191  // 1. the user is not logged in
2192  // 2. the only error is insufficient permissions (i.e. no block or something else)
2193  // 3. the error can be avoided simply by logging in
2194  if ( in_array( $action, array( 'read', 'edit', 'createpage', 'createtalk', 'upload' ) )
2195  && $this->getUser()->isAnon() && count( $errors ) == 1 && isset( $errors[0][0] )
2196  && ( $errors[0][0] == 'badaccess-groups' || $errors[0][0] == 'badaccess-group0' )
2197  && ( User::groupHasPermission( 'user', $action )
2198  || User::groupHasPermission( 'autoconfirmed', $action ) )
2199  ) {
2200  $displayReturnto = null;
2201 
2202  # Due to bug 32276, if a user does not have read permissions,
2203  # $this->getTitle() will just give Special:Badtitle, which is
2204  # not especially useful as a returnto parameter. Use the title
2205  # from the request instead, if there was one.
2206  $request = $this->getRequest();
2207  $returnto = Title::newFromURL( $request->getVal( 'title', '' ) );
2208  if ( $action == 'edit' ) {
2209  $msg = 'whitelistedittext';
2210  $displayReturnto = $returnto;
2211  } elseif ( $action == 'createpage' || $action == 'createtalk' ) {
2212  $msg = 'nocreatetext';
2213  } elseif ( $action == 'upload' ) {
2214  $msg = 'uploadnologintext';
2215  } else { # Read
2216  $msg = 'loginreqpagetext';
2217  $displayReturnto = Title::newMainPage();
2218  }
2219 
2220  $query = array();
2221 
2222  if ( $returnto ) {
2223  $query['returnto'] = $returnto->getPrefixedText();
2224 
2225  if ( !$request->wasPosted() ) {
2226  $returntoquery = $request->getValues();
2227  unset( $returntoquery['title'] );
2228  unset( $returntoquery['returnto'] );
2229  unset( $returntoquery['returntoquery'] );
2230  $query['returntoquery'] = wfArrayToCgi( $returntoquery );
2231  }
2232  }
2233  $loginLink = Linker::linkKnown(
2234  SpecialPage::getTitleFor( 'Userlogin' ),
2235  $this->msg( 'loginreqlink' )->escaped(),
2236  array(),
2237  $query
2238  );
2239 
2240  $this->prepareErrorPage( $this->msg( 'loginreqtitle' ) );
2241  $this->addHTML( $this->msg( $msg )->rawParams( $loginLink )->parse() );
2242 
2243  # Don't return to a page the user can't read otherwise
2244  # we'll end up in a pointless loop
2245  if ( $displayReturnto && $displayReturnto->userCan( 'read', $this->getUser() ) ) {
2246  $this->returnToMain( null, $displayReturnto );
2247  }
2248  } else {
2249  $this->prepareErrorPage( $this->msg( 'permissionserrors' ) );
2250  $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
2251  }
2252  }
2253 
2260  public function versionRequired( $version ) {
2261  $this->prepareErrorPage( $this->msg( 'versionrequired', $version ) );
2262 
2263  $this->addWikiMsg( 'versionrequiredtext', $version );
2264  $this->returnToMain();
2265  }
2266 
2273  public function permissionRequired( $permission ) {
2274  throw new PermissionsError( $permission );
2275  }
2282  public function loginToUse() {
2283  throw new PermissionsError( 'read' );
2284  }
2285 
2293  public function formatPermissionsErrorMessage( $errors, $action = null ) {
2294  if ( $action == null ) {
2295  $text = $this->msg( 'permissionserrorstext', count( $errors ) )->plain() . "\n\n";
2296  } else {
2297  $action_desc = $this->msg( "action-$action" )->plain();
2298  $text = $this->msg(
2299  'permissionserrorstext-withaction',
2300  count( $errors ),
2301  $action_desc
2302  )->plain() . "\n\n";
2303  }
2304 
2305  if ( count( $errors ) > 1 ) {
2306  $text .= '<ul class="permissions-errors">' . "\n";
2307 
2308  foreach ( $errors as $error ) {
2309  $text .= '<li>';
2310  $text .= call_user_func_array( array( $this, 'msg' ), $error )->plain();
2311  $text .= "</li>\n";
2312  }
2313  $text .= '</ul>';
2314  } else {
2315  $text .= "<div class=\"permissions-errors\">\n" .
2316  call_user_func_array( array( $this, 'msg' ), reset( $errors ) )->plain() .
2317  "\n</div>";
2318  }
2319 
2320  return $text;
2321  }
2322 
2344  public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
2345  $this->setRobotPolicy( 'noindex,nofollow' );
2346  $this->setArticleRelated( false );
2347 
2348  // If no reason is given, just supply a default "I can't let you do
2349  // that, Dave" message. Should only occur if called by legacy code.
2350  if ( $protected && empty( $reasons ) ) {
2351  $reasons[] = array( 'badaccess-group0' );
2352  }
2353 
2354  if ( !empty( $reasons ) ) {
2355  // Permissions error
2356  if ( $source ) {
2357  $this->setPageTitle( $this->msg( 'viewsource-title', $this->getTitle()->getPrefixedText() ) );
2358  $this->addBacklinkSubtitle( $this->getTitle() );
2359  } else {
2360  $this->setPageTitle( $this->msg( 'badaccess' ) );
2361  }
2362  $this->addWikiText( $this->formatPermissionsErrorMessage( $reasons, $action ) );
2363  } else {
2364  // Wiki is read only
2365  throw new ReadOnlyError;
2366  }
2367 
2368  // Show source, if supplied
2369  if ( is_string( $source ) ) {
2370  $this->addWikiMsg( 'viewsourcetext' );
2371 
2372  $pageLang = $this->getTitle()->getPageLanguage();
2373  $params = array(
2374  'id' => 'wpTextbox1',
2375  'name' => 'wpTextbox1',
2376  'cols' => $this->getUser()->getOption( 'cols' ),
2377  'rows' => $this->getUser()->getOption( 'rows' ),
2378  'readonly' => 'readonly',
2379  'lang' => $pageLang->getHtmlCode(),
2380  'dir' => $pageLang->getDir(),
2381  );
2382  $this->addHTML( Html::element( 'textarea', $params, $source ) );
2383 
2384  // Show templates used by this article
2385  $templates = Linker::formatTemplates( $this->getTitle()->getTemplateLinksFrom() );
2386  $this->addHTML( "<div class='templatesUsed'>
2387 $templates
2388 </div>
2389 " );
2390  }
2391 
2392  # If the title doesn't exist, it's fairly pointless to print a return
2393  # link to it. After all, you just tried editing it and couldn't, so
2394  # what's there to do there?
2395  if ( $this->getTitle()->exists() ) {
2396  $this->returnToMain( null, $this->getTitle() );
2397  }
2398  }
2399 
2404  public function rateLimited() {
2405  throw new ThrottledError;
2406  }
2407 
2417  public function showLagWarning( $lag ) {
2418  global $wgSlaveLagWarning, $wgSlaveLagCritical;
2419  if ( $lag >= $wgSlaveLagWarning ) {
2420  $message = $lag < $wgSlaveLagCritical
2421  ? 'lag-warn-normal'
2422  : 'lag-warn-high';
2423  $wrap = Html::rawElement( 'div', array( 'class' => "mw-{$message}" ), "\n$1\n" );
2424  $this->wrapWikiMsg( "$wrap\n", array( $message, $this->getLanguage()->formatNum( $lag ) ) );
2425  }
2426  }
2427 
2428  public function showFatalError( $message ) {
2429  $this->prepareErrorPage( $this->msg( 'internalerror' ) );
2430 
2431  $this->addHTML( $message );
2432  }
2433 
2434  public function showUnexpectedValueError( $name, $val ) {
2435  $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() );
2436  }
2437 
2438  public function showFileCopyError( $old, $new ) {
2439  $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() );
2440  }
2441 
2442  public function showFileRenameError( $old, $new ) {
2443  $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() );
2444  }
2445 
2446  public function showFileDeleteError( $name ) {
2447  $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() );
2448  }
2449 
2450  public function showFileNotFoundError( $name ) {
2451  $this->showFatalError( $this->msg( 'filenotfound', $name )->text() );
2452  }
2453 
2462  public function addReturnTo( $title, $query = array(), $text = null, $options = array() ) {
2463  $link = $this->msg( 'returnto' )->rawParams(
2464  Linker::link( $title, $text, array(), $query, $options ) )->escaped();
2465  $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
2466  }
2467 
2476  public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
2477  if ( $returnto == null ) {
2478  $returnto = $this->getRequest()->getText( 'returnto' );
2479  }
2480 
2481  if ( $returntoquery == null ) {
2482  $returntoquery = $this->getRequest()->getText( 'returntoquery' );
2483  }
2484 
2485  if ( $returnto === '' ) {
2486  $returnto = Title::newMainPage();
2487  }
2488 
2489  if ( is_object( $returnto ) ) {
2490  $titleObj = $returnto;
2491  } else {
2492  $titleObj = Title::newFromText( $returnto );
2493  }
2494  if ( !is_object( $titleObj ) ) {
2495  $titleObj = Title::newMainPage();
2496  }
2497 
2498  $this->addReturnTo( $titleObj, wfCgiToArray( $returntoquery ) );
2499  }
2506  public function headElement( Skin $sk, $includeStyle = true ) {
2507  global $wgContLang, $wgMimeType;
2508 
2509  $userdir = $this->getLanguage()->getDir();
2510  $sitedir = $wgContLang->getDir();
2511 
2513 
2514  if ( $this->getHTMLTitle() == '' ) {
2515  $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() )->inContentLanguage() );
2516  }
2517 
2518  $openHead = Html::openElement( 'head' );
2519  if ( $openHead ) {
2520  # Don't bother with the newline if $head == ''
2521  $ret .= "$openHead\n";
2522  }
2523 
2524  if ( !Html::isXmlMimeType( $wgMimeType ) ) {
2525  // Add <meta charset="UTF-8">
2526  // This should be before <title> since it defines the charset used by
2527  // text including the text inside <title>.
2528  // The spec recommends defining XHTML5's charset using the XML declaration
2529  // instead of meta.
2530  // Our XML declaration is output by Html::htmlHeader.
2531  // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
2532  // http://www.whatwg.org/html/semantics.html#charset
2533  $ret .= Html::element( 'meta', array( 'charset' => 'UTF-8' ) ) . "\n";
2534  }
2535 
2536  $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
2537 
2538  // Avoid Internet Explorer "compatibility view", so that
2539  // jQuery can work correctly.
2540  $ret .= Html::element( 'meta', array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EDGE' ) ) . "\n";
2541 
2542  $ret .= (
2543  $this->getHeadLinks() .
2544  "\n" .
2545  $this->buildCssLinks() .
2546  // No newline after buildCssLinks since makeResourceLoaderLink did that already
2547  $this->getHeadScripts() .
2548  "\n" .
2549  $this->getHeadItems()
2550  );
2551 
2552  $closeHead = Html::closeElement( 'head' );
2553  if ( $closeHead ) {
2554  $ret .= "$closeHead\n";
2555  }
2556 
2557  $bodyClasses = array();
2558  $bodyClasses[] = 'mediawiki';
2559 
2560  # Classes for LTR/RTL directionality support
2561  $bodyClasses[] = $userdir;
2562  $bodyClasses[] = "sitedir-$sitedir";
2563 
2564  if ( $this->getLanguage()->capitalizeAllNouns() ) {
2565  # A <body> class is probably not the best way to do this . . .
2566  $bodyClasses[] = 'capitalize-all-nouns';
2567  }
2568 
2569  $bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
2570  $bodyClasses[] = 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
2571  $bodyClasses[] = 'action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
2572 
2573  $bodyAttrs = array();
2574  // While the implode() is not strictly needed, it's used for backwards compatibility
2575  // (this used to be built as a string and hooks likely still expect that).
2576  $bodyAttrs['class'] = implode( ' ', $bodyClasses );
2577 
2578  // Allow skins and extensions to add body attributes they need
2579  $sk->addToBodyAttributes( $this, $bodyAttrs );
2580  wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) );
2581 
2582  $ret .= Html::openElement( 'body', $bodyAttrs ) . "\n";
2583 
2584  return $ret;
2585  }
2592  public function getResourceLoader() {
2593  if ( is_null( $this->mResourceLoader ) ) {
2594  $this->mResourceLoader = new ResourceLoader();
2595  }
2596  return $this->mResourceLoader;
2597  }
2598 
2608  protected function makeResourceLoaderLink( $modules, $only, $useESI = false, array $extraQuery = array(), $loadCall = false ) {
2609  global $wgResourceLoaderUseESI;
2610 
2611  $modules = (array)$modules;
2612 
2613  $links = array(
2614  'html' => '',
2615  'states' => array(),
2616  );
2617 
2618  if ( !count( $modules ) ) {
2619  return $links;
2620  }
2621 
2622 
2623  if ( count( $modules ) > 1 ) {
2624  // Remove duplicate module requests
2625  $modules = array_unique( $modules );
2626  // Sort module names so requests are more uniform
2627  sort( $modules );
2628 
2629  if ( ResourceLoader::inDebugMode() ) {
2630  // Recursively call us for every item
2631  foreach ( $modules as $name ) {
2632  $link = $this->makeResourceLoaderLink( $name, $only, $useESI );
2633  $links['html'] .= $link['html'];
2634  $links['states'] += $link['states'];
2635  }
2636  return $links;
2637  }
2638  }
2639 
2640  if ( !is_null( $this->mTarget ) ) {
2641  $extraQuery['target'] = $this->mTarget;
2642  }
2643 
2644  // Create keyed-by-group list of module objects from modules list
2645  $groups = array();
2647  foreach ( $modules as $name ) {
2648  $module = $resourceLoader->getModule( $name );
2649  # Check that we're allowed to include this module on this page
2650  if ( !$module
2651  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS )
2653  || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_STYLES )
2654  && $only == ResourceLoaderModule::TYPE_STYLES )
2655  || ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) )
2656  ) {
2657  continue;
2658  }
2659 
2660  $group = $module->getGroup();
2661  if ( !isset( $groups[$group] ) ) {
2662  $groups[$group] = array();
2663  }
2664  $groups[$group][$name] = $module;
2665  }
2666 
2667  foreach ( $groups as $group => $grpModules ) {
2668  // Special handling for user-specific groups
2669  $user = null;
2670  if ( ( $group === 'user' || $group === 'private' ) && $this->getUser()->isLoggedIn() ) {
2671  $user = $this->getUser()->getName();
2672  }
2673 
2674  // Create a fake request based on the one we are about to make so modules return
2675  // correct timestamp and emptiness data
2677  array(), // modules; not determined yet
2678  $this->getLanguage()->getCode(),
2679  $this->getSkin()->getSkinName(),
2680  $user,
2681  null, // version; not determined yet
2683  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2684  $this->isPrintable(),
2685  $this->getRequest()->getBool( 'handheld' ),
2686  $extraQuery
2687  );
2689 
2690  // Extract modules that know they're empty
2691  foreach ( $grpModules as $key => $module ) {
2692  // Inline empty modules: since they're empty, just mark them as 'ready' (bug 46857)
2693  // If we're only getting the styles, we don't need to do anything for empty modules.
2694  if ( $module->isKnownEmpty( $context ) ) {
2695  unset( $grpModules[$key] );
2696  if ( $only !== ResourceLoaderModule::TYPE_STYLES ) {
2697  $links['states'][$key] = 'ready';
2698  }
2699  }
2700  }
2701 
2702  // If there are no non-empty modules, skip this group
2703  if ( count( $grpModules ) === 0 ) {
2704  continue;
2705  }
2706 
2707  // Inline private modules. These can't be loaded through load.php for security
2708  // reasons, see bug 34907. Note that these modules should be loaded from
2709  // getHeadScripts() before the first loader call. Otherwise other modules can't
2710  // properly use them as dependencies (bug 30914)
2711  if ( $group === 'private' ) {
2712  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2713  $links['html'] .= Html::inlineStyle(
2714  $resourceLoader->makeModuleResponse( $context, $grpModules )
2715  );
2716  } else {
2717  $links['html'] .= Html::inlineScript(
2719  $resourceLoader->makeModuleResponse( $context, $grpModules )
2720  )
2721  );
2722  }
2723  $links['html'] .= "\n";
2724  continue;
2725  }
2726 
2727  // Special handling for the user group; because users might change their stuff
2728  // on-wiki like user pages, or user preferences; we need to find the highest
2729  // timestamp of these user-changeable modules so we can ensure cache misses on change
2730  // This should NOT be done for the site group (bug 27564) because anons get that too
2731  // and we shouldn't be putting timestamps in Squid-cached HTML
2732  $version = null;
2733  if ( $group === 'user' ) {
2734  // Get the maximum timestamp
2735  $timestamp = 1;
2736  foreach ( $grpModules as $module ) {
2737  $timestamp = max( $timestamp, $module->getModifiedTime( $context ) );
2738  }
2739  // Add a version parameter so cache will break when things change
2741  }
2742 
2744  array_keys( $grpModules ),
2745  $this->getLanguage()->getCode(),
2746  $this->getSkin()->getSkinName(),
2747  $user,
2748  $version,
2750  $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only,
2751  $this->isPrintable(),
2752  $this->getRequest()->getBool( 'handheld' ),
2753  $extraQuery
2754  );
2755  if ( $useESI && $wgResourceLoaderUseESI ) {
2756  $esi = Xml::element( 'esi:include', array( 'src' => $url ) );
2757  if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
2758  $link = Html::inlineStyle( $esi );
2759  } else {
2760  $link = Html::inlineScript( $esi );
2761  }
2762  } else {
2763  // Automatically select style/script elements
2764  if ( $only === ResourceLoaderModule::TYPE_STYLES ) {
2765  $link = Html::linkedStyle( $url );
2766  } elseif ( $loadCall ) {
2769  Xml::encodeJsCall( 'mw.loader.load', array( $url, 'text/javascript', true ) )
2770  )
2771  );
2772  } else {
2773  $link = Html::linkedScript( $url );
2774 
2775  // For modules requested directly in the html via <link> or <script>,
2776  // tell mw.loader they are being loading to prevent duplicate requests.
2777  foreach ( $grpModules as $key => $module ) {
2778  // Don't output state=loading for the startup module..
2779  if ( $key !== 'startup' ) {
2780  $links['states'][$key] = 'loading';
2781  }
2782  }
2783  }
2784  }
2785 
2786  if ( $group == 'noscript' ) {
2787  $links['html'] .= Html::rawElement( 'noscript', array(), $link ) . "\n";
2788  } else {
2789  $links['html'] .= $link . "\n";
2790  }
2791  }
2792 
2793  return $links;
2794  }
2801  protected static function getHtmlFromLoaderLinks( Array $links ) {
2802  $html = '';
2803  $states = array();
2804  foreach ( $links as $link ) {
2805  if ( !is_array( $link ) ) {
2806  $html .= $link;
2807  } else {
2808  $html .= $link['html'];
2809  $states += $link['states'];
2810  }
2811  }
2812 
2813  if ( count( $states ) ) {
2817  )
2818  ) . "\n" . $html;
2819  }
2820 
2821  return $html;
2822  }
2823 
2830  function getHeadScripts() {
2831  global $wgResourceLoaderExperimentalAsyncLoading;
2832 
2833  // Startup - this will immediately load jquery and mediawiki modules
2834  $links = array();
2835  $links[] = $this->makeResourceLoaderLink( 'startup', ResourceLoaderModule::TYPE_SCRIPTS, true );
2836 
2837  // Load config before anything else
2838  $links[] = Html::inlineScript(
2841  )
2842  );
2843 
2844  // Load embeddable private modules before any loader links
2845  // This needs to be TYPE_COMBINED so these modules are properly wrapped
2846  // in mw.loader.implement() calls and deferred until mw.user is available
2847  $embedScripts = array( 'user.options', 'user.tokens' );
2848  $links[] = $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
2849 
2850  // Scripts and messages "only" requests marked for top inclusion
2851  // Messages should go first
2852  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'top' ), ResourceLoaderModule::TYPE_MESSAGES );
2853  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'top' ), ResourceLoaderModule::TYPE_SCRIPTS );
2854 
2855  // Modules requests - let the client calculate dependencies and batch requests as it likes
2856  // Only load modules that have marked themselves for loading at the top
2857  $modules = $this->getModules( true, 'top' );
2858  if ( $modules ) {
2859  $links[] = Html::inlineScript(
2861  Xml::encodeJsCall( 'mw.loader.load', array( $modules ) )
2862  )
2863  );
2864  }
2865 
2866  if ( $wgResourceLoaderExperimentalAsyncLoading ) {
2867  $links[] = $this->getScriptsForBottomQueue( true );
2868  }
2869 
2870  return self::getHtmlFromLoaderLinks( $links );
2871  }
2872 
2882  function getScriptsForBottomQueue( $inHead ) {
2883  global $wgUseSiteJs, $wgAllowUserJs;
2884 
2885  // Scripts and messages "only" requests marked for bottom inclusion
2886  // If we're in the <head>, use load() calls rather than <script src="..."> tags
2887  // Messages should go first
2888  $links = array();
2889  $links[] = $this->makeResourceLoaderLink( $this->getModuleMessages( true, 'bottom' ),
2890  ResourceLoaderModule::TYPE_MESSAGES, /* $useESI = */ false, /* $extraQuery = */ array(),
2891  /* $loadCall = */ $inHead
2892  );
2893  $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'bottom' ),
2894  ResourceLoaderModule::TYPE_SCRIPTS, /* $useESI = */ false, /* $extraQuery = */ array(),
2895  /* $loadCall = */ $inHead
2896  );
2897 
2898  // Modules requests - let the client calculate dependencies and batch requests as it likes
2899  // Only load modules that have marked themselves for loading at the bottom
2900  $modules = $this->getModules( true, 'bottom' );
2901  if ( $modules ) {
2902  $links[] = Html::inlineScript(
2904  Xml::encodeJsCall( 'mw.loader.load', array( $modules, null, true ) )
2905  )
2906  );
2907  }
2908 
2909  // Legacy Scripts
2910  $links[] = "\n" . $this->mScripts;
2911 
2912  // Add site JS if enabled
2914  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2915  );
2916 
2917  // Add user JS if enabled
2918  if ( $wgAllowUserJs && $this->getUser()->isLoggedIn() && $this->getTitle() && $this->getTitle()->isJsSubpage() && $this->userCanPreview() ) {
2919  # XXX: additional security check/prompt?
2920  // We're on a preview of a JS subpage
2921  // Exclude this page from the user module in case it's in there (bug 26283)
2922  $links[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS, false,
2923  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() ), $inHead
2924  );
2925  // Load the previewed JS
2926  $links[] = Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
2927 
2928  // FIXME: If the user is previewing, say, ./vector.js, his ./common.js will be loaded
2929  // asynchronously and may arrive *after* the inline script here. So the previewed code
2930  // may execute before ./common.js runs. Normally, ./common.js runs before ./vector.js...
2931  } else {
2932  // Include the user module normally, i.e., raw to avoid it being wrapped in a closure.
2934  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2935  );
2936  }
2937 
2938  // Group JS is only enabled if site JS is enabled.
2939  $links[] = $this->makeResourceLoaderLink( 'user.groups', ResourceLoaderModule::TYPE_COMBINED,
2940  /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
2941  );
2942 
2943  return self::getHtmlFromLoaderLinks( $links );
2944  }
2945 
2950  function getBottomScripts() {
2951  global $wgResourceLoaderExperimentalAsyncLoading;
2952 
2953  // Optimise jQuery ready event cross-browser.
2954  // This also enforces $.isReady to be true at </body> which fixes the
2955  // mw.loader bug in Firefox with using document.write between </body>
2956  // and the DOMContentReady event (bug 47457).
2957  $html = Html::inlineScript( 'window.jQuery && jQuery.ready();' );
2958 
2959  if ( !$wgResourceLoaderExperimentalAsyncLoading ) {
2960  $html .= $this->getScriptsForBottomQueue( false );
2961  }
2962 
2963  return $html;
2964  }
2965 
2972  public function getJsConfigVars() {
2973  return $this->mJsConfigVars;
2974  }
2975 
2982  public function addJsConfigVars( $keys, $value = null ) {
2983  if ( is_array( $keys ) ) {
2984  foreach ( $keys as $key => $value ) {
2985  $this->mJsConfigVars[$key] = $value;
2986  }
2987  return;
2988  }
2989 
2990  $this->mJsConfigVars[$keys] = $value;
2991  }
2992 
3005  public function getJSVars() {
3007 
3008  $curRevisionId = 0;
3009  $articleId = 0;
3010  $canonicalSpecialPageName = false; # bug 21115
3011 
3012  $title = $this->getTitle();
3013  $ns = $title->getNamespace();
3014  $canonicalNamespace = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
3015 
3016  $sk = $this->getSkin();
3017  // Get the relevant title so that AJAX features can use the correct page name
3018  // when making API requests from certain special pages (bug 34972).
3019  $relevantTitle = $sk->getRelevantTitle();
3020  $relevantUser = $sk->getRelevantUser();
3021 
3022  if ( $ns == NS_SPECIAL ) {
3023  list( $canonicalSpecialPageName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
3024  } elseif ( $this->canUseWikiPage() ) {
3025  $wikiPage = $this->getWikiPage();
3026  $curRevisionId = $wikiPage->getLatest();
3027  $articleId = $wikiPage->getId();
3028  }
3029 
3030  $lang = $title->getPageLanguage();
3031 
3032  // Pre-process information
3033  $separatorTransTable = $lang->separatorTransformTable();
3034  $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
3035  $compactSeparatorTransTable = array(
3036  implode( "\t", array_keys( $separatorTransTable ) ),
3037  implode( "\t", $separatorTransTable ),
3038  );
3039  $digitTransTable = $lang->digitTransformTable();
3040  $digitTransTable = $digitTransTable ? $digitTransTable : array();
3041  $compactDigitTransTable = array(
3042  implode( "\t", array_keys( $digitTransTable ) ),
3043  implode( "\t", $digitTransTable ),
3044  );
3045 
3046  $user = $this->getUser();
3047 
3048  $vars = array(
3049  'wgCanonicalNamespace' => $canonicalNamespace,
3050  'wgCanonicalSpecialPageName' => $canonicalSpecialPageName,
3051  'wgNamespaceNumber' => $title->getNamespace(),
3052  'wgPageName' => $title->getPrefixedDBkey(),
3053  'wgTitle' => $title->getText(),
3054  'wgCurRevisionId' => $curRevisionId,
3055  'wgRevisionId' => (int)$this->getRevisionId(),
3056  'wgArticleId' => $articleId,
3057  'wgIsArticle' => $this->isArticle(),
3058  'wgIsRedirect' => $title->isRedirect(),
3059  'wgAction' => Action::getActionName( $this->getContext() ),
3060  'wgUserName' => $user->isAnon() ? null : $user->getName(),
3061  'wgUserGroups' => $user->getEffectiveGroups(),
3062  'wgCategories' => $this->getCategories(),
3063  'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
3064  'wgPageContentLanguage' => $lang->getCode(),
3065  'wgPageContentModel' => $title->getContentModel(),
3066  'wgSeparatorTransformTable' => $compactSeparatorTransTable,
3067  'wgDigitTransformTable' => $compactDigitTransTable,
3068  'wgDefaultDateFormat' => $lang->getDefaultDateFormat(),
3069  'wgMonthNames' => $lang->getMonthNamesArray(),
3070  'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(),
3071  'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
3072  );
3073  if ( $user->isLoggedIn() ) {
3074  $vars['wgUserId'] = $user->getId();
3075  $vars['wgUserEditCount'] = $user->getEditCount();
3076  $userReg = wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
3077  $vars['wgUserRegistration'] = $userReg !== null ? ( $userReg * 1000 ) : null;
3078  // Get the revision ID of the oldest new message on the user's talk
3079  // page. This can be used for constructing new message alerts on
3080  // the client side.
3081  $vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
3082  }
3083  if ( $wgContLang->hasVariants() ) {
3084  $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
3085  }
3086  // Same test as SkinTemplate
3087  $vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', $user ) && ( $title->exists() || $title->quickUserCan( 'create', $user ) );
3088  foreach ( $title->getRestrictionTypes() as $type ) {
3089  $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
3090  }
3091  if ( $title->isMainPage() ) {
3092  $vars['wgIsMainPage'] = true;
3093  }
3094  if ( $this->mRedirectedFrom ) {
3095  $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
3096  }
3097  if ( $relevantUser ) {
3098  $vars['wgRelevantUserName'] = $relevantUser->getName();
3099  }
3100 
3101  // Allow extensions to add their custom variables to the mw.config map.
3102  // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
3103  // page-dependant but site-wide (without state).
3104  // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
3105  wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars, $this ) );
3106 
3107  // Merge in variables from addJsConfigVars last
3108  return array_merge( $vars, $this->getJsConfigVars() );
3109  }
3110 
3120  public function userCanPreview() {
3121  if ( $this->getRequest()->getVal( 'action' ) != 'submit'
3122  || !$this->getRequest()->wasPosted()
3123  || !$this->getUser()->matchEditToken(
3124  $this->getRequest()->getVal( 'wpEditToken' ) )
3125  ) {
3126  return false;
3127  }
3128  if ( !$this->getTitle()->isJsSubpage() && !$this->getTitle()->isCssSubpage() ) {
3129  return false;
3130  }
3131 
3132  return !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) );
3133  }
3134 
3138  public function getHeadLinksArray() {
3139  global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
3140  $wgSitename, $wgVersion,
3141  $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
3142  $wgDisableLangConversion, $wgCanonicalLanguageLinks,
3143  $wgRightsPage, $wgRightsUrl;
3144 
3145  $tags = array();
3146 
3147  $canonicalUrl = $this->mCanonicalUrl;
3148 
3149  $tags['meta-generator'] = Html::element( 'meta', array(
3150  'name' => 'generator',
3151  'content' => "MediaWiki $wgVersion",
3152  ) );
3153 
3154  $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
3155  if ( $p !== 'index,follow' ) {
3156  // http://www.robotstxt.org/wc/meta-user.html
3157  // Only show if it's different from the default robots policy
3158  $tags['meta-robots'] = Html::element( 'meta', array(
3159  'name' => 'robots',
3160  'content' => $p,
3161  ) );
3162  }
3163 
3164  foreach ( $this->mMetatags as $tag ) {
3165  if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) {
3166  $a = 'http-equiv';
3167  $tag[0] = substr( $tag[0], 5 );
3168  } else {
3169  $a = 'name';
3170  }
3171  $tagName = "meta-{$tag[0]}";
3172  if ( isset( $tags[$tagName] ) ) {
3173  $tagName .= $tag[1];
3174  }
3175  $tags[$tagName] = Html::element( 'meta',
3176  array(
3177  $a => $tag[0],
3178  'content' => $tag[1]
3179  )
3180  );
3181  }
3182 
3183  foreach ( $this->mLinktags as $tag ) {
3184  $tags[] = Html::element( 'link', $tag );
3185  }
3186 
3187  # Universal edit button
3188  if ( $wgUniversalEditButton && $this->isArticleRelated() ) {
3189  $user = $this->getUser();
3190  if ( $this->getTitle()->quickUserCan( 'edit', $user )
3191  && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create', $user ) ) ) {
3192  // Original UniversalEditButton
3193  $msg = $this->msg( 'edit' )->text();
3194  $tags['universal-edit-button'] = Html::element( 'link', array(
3195  'rel' => 'alternate',
3196  'type' => 'application/x-wiki',
3197  'title' => $msg,
3198  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3199  ) );
3200  // Alternate edit link
3201  $tags['alternative-edit'] = Html::element( 'link', array(
3202  'rel' => 'edit',
3203  'title' => $msg,
3204  'href' => $this->getTitle()->getLocalURL( 'action=edit' )
3205  ) );
3206  }
3207  }
3208 
3209  # Generally the order of the favicon and apple-touch-icon links
3210  # should not matter, but Konqueror (3.5.9 at least) incorrectly
3211  # uses whichever one appears later in the HTML source. Make sure
3212  # apple-touch-icon is specified first to avoid this.
3213  if ( $wgAppleTouchIcon !== false ) {
3214  $tags['apple-touch-icon'] = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
3215  }
3216 
3217  if ( $wgFavicon !== false ) {
3218  $tags['favicon'] = Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
3219  }
3220 
3221  # OpenSearch description link
3222  $tags['opensearch'] = Html::element( 'link', array(
3223  'rel' => 'search',
3224  'type' => 'application/opensearchdescription+xml',
3225  'href' => wfScript( 'opensearch_desc' ),
3226  'title' => $this->msg( 'opensearch-desc' )->inContentLanguage()->text(),
3227  ) );
3228 
3229  if ( $wgEnableAPI ) {
3230  # Real Simple Discovery link, provides auto-discovery information
3231  # for the MediaWiki API (and potentially additional custom API
3232  # support such as WordPress or Twitter-compatible APIs for a
3233  # blogging extension, etc)
3234  $tags['rsd'] = Html::element( 'link', array(
3235  'rel' => 'EditURI',
3236  'type' => 'application/rsd+xml',
3237  // Output a protocol-relative URL here if $wgServer is protocol-relative
3238  // Whether RSD accepts relative or protocol-relative URLs is completely undocumented, though
3239  'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ), PROTO_RELATIVE ),
3240  ) );
3241  }
3242 
3243  # Language variants
3244  if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
3245  $lang = $this->getTitle()->getPageLanguage();
3246  if ( $lang->hasVariants() ) {
3247 
3248  $urlvar = $lang->getURLVariant();
3249 
3250  if ( !$urlvar ) {
3251  $variants = $lang->getVariants();
3252  foreach ( $variants as $_v ) {
3253  $tags["variant-$_v"] = Html::element( 'link', array(
3254  'rel' => 'alternate',
3255  'hreflang' => wfBCP47( $_v ),
3256  'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
3257  );
3258  }
3259  } else {
3260  $canonicalUrl = $this->getTitle()->getLocalURL();
3261  }
3262  }
3263  }
3264 
3265  # Copyright
3266  $copyright = '';
3267  if ( $wgRightsPage ) {
3268  $copy = Title::newFromText( $wgRightsPage );
3269 
3270  if ( $copy ) {
3271  $copyright = $copy->getLocalURL();
3272  }
3273  }
3274 
3275  if ( !$copyright && $wgRightsUrl ) {
3276  $copyright = $wgRightsUrl;
3277  }
3278 
3279  if ( $copyright ) {
3280  $tags['copyright'] = Html::element( 'link', array(
3281  'rel' => 'copyright',
3282  'href' => $copyright )
3283  );
3284  }
3285 
3286  # Feeds
3287  if ( $wgFeed ) {
3288  foreach ( $this->getSyndicationLinks() as $format => $link ) {
3289  # Use the page name for the title. In principle, this could
3290  # lead to issues with having the same name for different feeds
3291  # corresponding to the same page, but we can't avoid that at
3292  # this low a level.
3293 
3294  $tags[] = $this->feedLink(
3295  $format,
3296  $link,
3297  # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
3298  $this->msg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() )->text()
3299  );
3300  }
3301 
3302  # Recent changes feed should appear on every page (except recentchanges,
3303  # that would be redundant). Put it after the per-page feed to avoid
3304  # changing existing behavior. It's still available, probably via a
3305  # menu in your browser. Some sites might have a different feed they'd
3306  # like to promote instead of the RC feed (maybe like a "Recent New Articles"
3307  # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
3308  # If so, use it instead.
3309  if ( $wgOverrideSiteFeed ) {
3310  foreach ( $wgOverrideSiteFeed as $type => $feedUrl ) {
3311  // Note, this->feedLink escapes the url.
3312  $tags[] = $this->feedLink(
3313  $type,
3314  $feedUrl,
3315  $this->msg( "site-{$type}-feed", $wgSitename )->text()
3316  );
3317  }
3318  } elseif ( !$this->getTitle()->isSpecial( 'Recentchanges' ) ) {
3319  $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
3320  foreach ( $wgAdvertisedFeedTypes as $format ) {
3321  $tags[] = $this->feedLink(
3322  $format,
3323  $rctitle->getLocalURL( array( 'feed' => $format ) ),
3324  $this->msg( "site-{$format}-feed", $wgSitename )->text() # For grep: 'site-rss-feed', 'site-atom-feed'.
3325  );
3326  }
3327  }
3328  }
3329 
3330  # Canonical URL
3331  global $wgEnableCanonicalServerLink;
3332  if ( $wgEnableCanonicalServerLink ) {
3333  if ( $canonicalUrl !== false ) {
3334  $canonicalUrl = wfExpandUrl( $canonicalUrl, PROTO_CANONICAL );
3335  } else {
3336  $reqUrl = $this->getRequest()->getRequestURL();
3337  $canonicalUrl = wfExpandUrl( $reqUrl, PROTO_CANONICAL );
3338  }
3339  }
3340  if ( $canonicalUrl !== false ) {
3341  $tags[] = Html::element( 'link', array(
3342  'rel' => 'canonical',
3343  'href' => $canonicalUrl
3344  ) );
3345  }
3346 
3347  return $tags;
3348  }
3349 
3353  public function getHeadLinks() {
3354  return implode( "\n", $this->getHeadLinksArray() );
3355  }
3356 
3365  private function feedLink( $type, $url, $text ) {
3366  return Html::element( 'link', array(
3367  'rel' => 'alternate',
3368  'type' => "application/$type+xml",
3369  'title' => $text,
3370  'href' => $url )
3371  );
3372  }
3373 
3383  public function addStyle( $style, $media = '', $condition = '', $dir = '' ) {
3384  $options = array();
3385  // Even though we expect the media type to be lowercase, but here we
3386  // force it to lowercase to be safe.
3387  if ( $media ) {
3388  $options['media'] = $media;
3389  }
3390  if ( $condition ) {
3391  $options['condition'] = $condition;
3392  }
3393  if ( $dir ) {
3394  $options['dir'] = $dir;
3395  }
3396  $this->styles[$style] = $options;
3397  }
3404  public function addInlineStyle( $style_css, $flip = 'noflip' ) {
3405  if ( $flip === 'flip' && $this->getLanguage()->isRTL() ) {
3406  # If wanted, and the interface is right-to-left, flip the CSS
3407  $style_css = CSSJanus::transform( $style_css, true, false );
3408  }
3409  $this->mInlineStyles .= Html::inlineStyle( $style_css ) . "\n";
3410  }
3411 
3418  public function buildCssLinks() {
3419  global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs, $wgContLang;
3420 
3421  $this->getSkin()->setupSkinUserCss( $this );
3422 
3423  // Add ResourceLoader styles
3424  // Split the styles into these groups
3425  $styles = array( 'other' => array(), 'user' => array(), 'site' => array(), 'private' => array(), 'noscript' => array() );
3426  $links = array();
3427  $otherTags = ''; // Tags to append after the normal <link> tags
3429 
3430  $moduleStyles = $this->getModuleStyles();
3431 
3432  // Per-site custom styles
3433  $moduleStyles[] = 'site';
3434  $moduleStyles[] = 'noscript';
3435  $moduleStyles[] = 'user.groups';
3436 
3437  // Per-user custom styles
3438  if ( $wgAllowUserCss && $this->getTitle()->isCssSubpage() && $this->userCanPreview() ) {
3439  // We're on a preview of a CSS subpage
3440  // Exclude this page from the user module in case it's in there (bug 26283)
3442  array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
3443  );
3444  $otherTags .= $link['html'];
3445 
3446  // Load the previewed CSS
3447  // If needed, Janus it first. This is user-supplied CSS, so it's
3448  // assumed to be right for the content language directionality.
3449  $previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
3450  if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
3451  $previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
3452  }
3453  $otherTags .= Html::inlineStyle( $previewedCSS ) . "\n";
3454  } else {
3455  // Load the user styles normally
3456  $moduleStyles[] = 'user';
3457  }
3458 
3459  // Per-user preference styles
3460  $moduleStyles[] = 'user.cssprefs';
3461 
3462  foreach ( $moduleStyles as $name ) {
3463  $module = $resourceLoader->getModule( $name );
3464  if ( !$module ) {
3465  continue;
3466  }
3467  $group = $module->getGroup();
3468  // Modules in groups different than the ones listed on top (see $styles assignment)
3469  // will be placed in the "other" group
3470  $styles[ isset( $styles[$group] ) ? $group : 'other' ][] = $name;
3471  }
3472 
3473  // We want site, private and user styles to override dynamically added styles from modules, but we want
3474  // dynamically added styles to override statically added styles from other modules. So the order
3475  // has to be other, dynamic, site, private, user
3476  // Add statically added styles for other modules
3477  $links[] = $this->makeResourceLoaderLink( $styles['other'], ResourceLoaderModule::TYPE_STYLES );
3478  // Add normal styles added through addStyle()/addInlineStyle() here
3479  $links[] = implode( "\n", $this->buildCssLinksArray() ) . $this->mInlineStyles;
3480  // Add marker tag to mark the place where the client-side loader should inject dynamic styles
3481  // We use a <meta> tag with a made-up name for this because that's valid HTML
3482  $links[] = Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) ) . "\n";
3483 
3484  // Add site, private and user styles
3485  // 'private' at present only contains user.options, so put that before 'user'
3486  // Any future private modules will likely have a similar user-specific character
3487  foreach ( array( 'site', 'noscript', 'private', 'user' ) as $group ) {
3488  $links[] = $this->makeResourceLoaderLink( $styles[$group],
3490  );
3491  }
3492 
3493  // Add stuff in $otherTags (previewed user CSS if applicable)
3494  return self::getHtmlFromLoaderLinks( $links ) . $otherTags;
3495  }
3496 
3500  public function buildCssLinksArray() {
3501  $links = array();
3502 
3503  // Add any extension CSS
3504  foreach ( $this->mExtStyles as $url ) {
3505  $this->addStyle( $url );
3506  }
3507  $this->mExtStyles = array();
3508 
3509  foreach ( $this->styles as $file => $options ) {
3510  $link = $this->styleLink( $file, $options );
3511  if ( $link ) {
3512  $links[$file] = $link;
3513  }
3514  }
3515  return $links;
3516  }
3517 
3525  protected function styleLink( $style, $options ) {
3526  if ( isset( $options['dir'] ) ) {
3527  if ( $this->getLanguage()->getDir() != $options['dir'] ) {
3528  return '';
3529  }
3530  }
3531 
3532  if ( isset( $options['media'] ) ) {
3533  $media = self::transformCssMedia( $options['media'] );
3534  if ( is_null( $media ) ) {
3535  return '';
3536  }
3537  } else {
3538  $media = 'all';
3539  }
3540 
3541  if ( substr( $style, 0, 1 ) == '/' ||
3542  substr( $style, 0, 5 ) == 'http:' ||
3543  substr( $style, 0, 6 ) == 'https:' ) {
3544  $url = $style;
3545  } else {
3546  global $wgStylePath, $wgStyleVersion;
3547  $url = $wgStylePath . '/' . $style . '?' . $wgStyleVersion;
3548  }
3549 
3550  $link = Html::linkedStyle( $url, $media );
3551 
3552  if ( isset( $options['condition'] ) ) {
3553  $condition = htmlspecialchars( $options['condition'] );
3554  $link = "<!--[if $condition]>$link<![endif]-->";
3555  }
3556  return $link;
3557  }
3558 
3566  public static function transformCssMedia( $media ) {
3567  global $wgRequest;
3568 
3569  // http://www.w3.org/TR/css3-mediaqueries/#syntax
3570  $screenMediaQueryRegex = '/^(?:only\s+)?screen\b/i';
3571 
3572  // Switch in on-screen display for media testing
3573  $switches = array(
3574  'printable' => 'print',
3575  'handheld' => 'handheld',
3576  );
3577  foreach ( $switches as $switch => $targetMedia ) {
3578  if ( $wgRequest->getBool( $switch ) ) {
3579  if ( $media == $targetMedia ) {
3580  $media = '';
3581  } elseif ( preg_match( $screenMediaQueryRegex, $media ) === 1 ) {
3582  // This regex will not attempt to understand a comma-separated media_query_list
3583  //
3584  // Example supported values for $media: 'screen', 'only screen', 'screen and (min-width: 982px)' ),
3585  // Example NOT supported value for $media: '3d-glasses, screen, print and resolution > 90dpi'
3586  //
3587  // If it's a print request, we never want any kind of screen stylesheets
3588  // If it's a handheld request (currently the only other choice with a switch),
3589  // we don't want simple 'screen' but we might want screen queries that
3590  // have a max-width or something, so we'll pass all others on and let the
3591  // client do the query.
3592  if ( $targetMedia == 'print' || $media == 'screen' ) {
3593  return null;
3594  }
3595  }
3596  }
3597  }
3598 
3599  return $media;
3600  }
3601 
3608  public function addWikiMsg( /*...*/ ) {
3609  $args = func_get_args();
3610  $name = array_shift( $args );
3611  $this->addWikiMsgArray( $name, $args );
3612  }
3613 
3622  public function addWikiMsgArray( $name, $args ) {
3623  $this->addHTML( $this->msg( $name, $args )->parseAsBlock() );
3624  }
3625 
3649  public function wrapWikiMsg( $wrap /*, ...*/ ) {
3650  $msgSpecs = func_get_args();
3651  array_shift( $msgSpecs );
3652  $msgSpecs = array_values( $msgSpecs );
3653  $s = $wrap;
3654  foreach ( $msgSpecs as $n => $spec ) {
3655  if ( is_array( $spec ) ) {
3656  $args = $spec;
3657  $name = array_shift( $args );
3658  if ( isset( $args['options'] ) ) {
3659  unset( $args['options'] );
3660  wfDeprecated(
3661  'Adding "options" to ' . __METHOD__ . ' is no longer supported',
3662  '1.20'
3663  );
3664  }
3665  } else {
3666  $args = array();
3667  $name = $spec;
3668  }
3669  $s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
3670  }
3671  $this->addWikiText( $s );
3672  }
3673 
3683  public function includeJQuery( $modules = array() ) {
3684  return array();
3685  }
3692  public function enableTOC( $flag = true ) {
3693  $this->mEnableTOC = $flag;
3694  }
3695 
3700  public function isTOCEnabled() {
3701  return $this->mEnableTOC;
3702  }
3709  public function enableSectionEditLinks( $flag = true ) {
3710  $this->mEnableSectionEditLinks = $flag;
3711  }
3712 
3717  public function sectionEditLinksEnabled() {
3719  }
3720 }
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:1865
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:1185
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:1259
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:314
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:33
OutputPage\getTarget
getTarget()
Definition: OutputPage.php:558
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:1135
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:213
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:972
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:1315
OutputPage\enableClientCache
enableClientCache( $state)
Use enableClientCache(false) to force it to send nocache headers.
Definition: OutputPage.php:1715
OutputPage\styleLink
styleLink( $style, $options)
Generate <link> tags for stylesheets.
Definition: OutputPage.php:3519
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:3602
ContextSource\getContext
getContext()
Get the RequestContext object.
Definition: ContextSource.php:40
OutputPage\getLanguageLinks
getLanguageLinks()
Get the list of language links.
Definition: OutputPage.php:1176
OutputPage\reduceAllowedModules
reduceAllowedModules( $type, $level)
As for setAllowedModules(), but don't inadvertently make the page more accessible.
Definition: OutputPage.php:1324
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:3920
OutputPage\addSubtitle
addSubtitle( $str)
Add $str to the subtitle.
Definition: OutputPage.php:939
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:1831
OutputPage\$mEnableSectionEditLinks
bool $mEnableSectionEditLinks
Whether parser output should contain section edit links.
Definition: OutputPage.php:261
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:2999
OutputPage\$mContainsNewMagic
$mContainsNewMagic
Definition: OutputPage.php:168
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:2436
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:2876
OutputPage\$mRedirectedFrom
Title $mRedirectedFrom
If the current page was reached through a redirect, $mRedirectedFrom contains the Title of the redire...
Definition: OutputPage.php:244
OutputPage\setTitle
setTitle(Title $t)
Set the Title object to use.
Definition: OutputPage.php:910
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:609
OutputPage\__construct
__construct(IContextSource $context=null)
Constructor for OutputPage.
Definition: OutputPage.php:268
OutputPage\addModuleMessages
addModuleMessages( $modules)
Add only messages of one or more modules recognized by the resource loader.
Definition: OutputPage.php:551
OutputPage\getScript
getScript()
Get all registered JS and CSS tags for the header.
Definition: OutputPage.php:430
OutputPage\addModuleStyles
addModuleStyles( $modules)
Add only CSS of one or more modules recognized by the resource loader.
Definition: OutputPage.php:528
OutputPage\loginToUse
loginToUse()
Produce the stock "please login to use the wiki" page.
Definition: OutputPage.php:2276
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:1147
OutputPage\enableSectionEditLinks
enableSectionEditLinks( $flag=true)
Enables/disables section edit links, doesn't override NOEDITSECTION
Definition: OutputPage.php:3703
OutputPage\setArticleBodyOnly
setArticleBodyOnly( $only)
Set whether the output should only contain the body of the article, without any skin,...
Definition: OutputPage.php:629
OutputPage\getFrameOptions
getFrameOptions()
Get the X-Frame-Options header value (without the name part), or false if there isn't one.
Definition: OutputPage.php:1895
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3650
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:2118
OutputPage\getRevisionId
getRevisionId()
Get the displayed revision ID.
Definition: OutputPage.php:1407
$timestamp
if( $limit) $timestamp
Definition: importImages.php:104
OutputPage\addParserOutput
addParserOutput(&$parserOutput)
Add a ParserOutput object.
Definition: OutputPage.php:1614
OutputPage\addWikiTextTitleTidy
addWikiTextTitleTidy( $text, &$title, $linestart=true)
Add wikitext with a custom Title object and tidy enabled.
Definition: OutputPage.php:1509
OutputPage\clearHTML
clearHTML()
Clear the body HTML.
Definition: OutputPage.php:1362
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:1246
OutputPage\addScript
addScript( $script)
Add raw HTML to the list of scripts (including <script> tag, etc.)
Definition: OutputPage.php:370
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:2470
OutputPage\$mIsArticleRelated
$mIsArticleRelated
Should be private.
Definition: OutputPage.php:71
OutputPage\buildCssLinksArray
buildCssLinksArray()
Definition: OutputPage.php:3494
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:823
$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:1289
OutputPage\getBottomScripts
getBottomScripts()
JS stuff to put at the bottom of the "<body>".
Definition: OutputPage.php:2944
OutputPage\$mCategoryLinks
$mCategoryLinks
Definition: OutputPage.php:108
OutputPage\showFileNotFoundError
showFileNotFoundError( $name)
Definition: OutputPage.php:2444
OutputPage\getHtmlFromLoaderLinks
static getHtmlFromLoaderLinks(Array $links)
Build html output from an array of links from makeResourceLoaderLink.
Definition: OutputPage.php:2795
$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:515
ResourceLoaderModule\TYPE_MESSAGES
const TYPE_MESSAGES
Definition: ResourceLoaderModule.php:33
$params
$params
Definition: styleTest.css.php:40
OutputPage\getHeadLinks
getHeadLinks()
Definition: OutputPage.php:3347
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:2254
OutputPage\parseInline
parseInline( $text, $linestart=true, $interface=false)
Parse wikitext, strip paragraphs, and return the HTML.
Definition: OutputPage.php:1688
OutputPage\addScriptFile
addScriptFile( $file, $version=null)
Add a JavaScript file out of skins/common, or a given relative path.
Definition: OutputPage.php:402
$s
$s
Definition: mergeMessageFileList.php:156
OutputPage\parserOptions
parserOptions( $options=null)
Get/set the ParserOptions object to use for wikitext parsing.
Definition: OutputPage.php:1382
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:1126
OutputPage\getFileVersion
getFileVersion()
Get the displayed file version.
Definition: OutputPage.php:1451
OutputPage\getSyndicationLinks
getSyndicationLinks()
Return URLs for each supported syndication format for this page.
Definition: OutputPage.php:1092
OutputPage\$mVaryHeader
$mVaryHeader
Definition: OutputPage.php:235
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:193
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:294
OutputPage\setCanonicalUrl
setCanonicalUrl( $url)
Set the URL to be used for the <link rel="canonical">.
Definition: OutputPage.php:345
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:233
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:2267
Sanitizer\stripAllTags
static stripAllTags( $text)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed,...
Definition: Sanitizer.php:1718
OutputPage\showFileDeleteError
showFileDeleteError( $name)
Definition: OutputPage.php:2440
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:1342
OutputPage\addHeadItem
addHeadItem( $name, $value)
Add or replace an header item to the output.
Definition: OutputPage.php:599
OutputPage\addWikiTextTidy
addWikiTextTidy( $text, $linestart=true)
Add wikitext with tidy enabled.
Definition: OutputPage.php:1519
OutputPage\$mArticleBodyOnly
$mArticleBodyOnly
Flag if output should only contain the body of the article.
Definition: OutputPage.php:190
OutputPage\getModuleScripts
getModuleScripts( $filter=false, $position=null)
Get the list of module JS to include on this page.
Definition: OutputPage.php:492
OutputPage\getRevisionTimestamp
getRevisionTimestamp()
Get the timestamp of displayed revision.
Definition: OutputPage.php:1428
OutputPage\addWikiMsgArray
addWikiMsgArray( $name, $args)
Add a wikitext-formatted message to the output.
Definition: OutputPage.php:3616
OutputPage\enableTOC
enableTOC( $flag=true)
Enables/disables TOC, doesn't override NOTOC
Definition: OutputPage.php:3686
OutputPage\transformCssMedia
static transformCssMedia( $media)
Transform "media" attribute based on request parameters.
Definition: OutputPage.php:3560
OutputPage\setLastModified
setLastModified( $timestamp)
Override the last modified timestamp.
Definition: OutputPage.php:766
OutputPage\$mInlineMsg
$mInlineMsg
Definition: OutputPage.php:145
OutputPage\$mNoGallery
$mNoGallery
Comes from the parser.
Definition: OutputPage.php:200
$dbr
$dbr
Definition: testCompression.php:48
Linker\link
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
Definition: Linker.php:192
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:154
OutputPage\$mParseWarnings
$mParseWarnings
Definition: OutputPage.php:204
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:1023
OutputPage\addWikiTextWithTitle
addWikiTextWithTitle( $text, &$title, $linestart=true)
Add wikitext with a custom Title object.
Definition: OutputPage.php:1498
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:2338
OutputPage\$mPageTitleActionText
$mPageTitleActionText
Definition: OutputPage.php:203
OutputPage\showErrorPage
showErrorPage( $title, $msg, $params=array())
Output a standard error page.
Definition: OutputPage.php:2157
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:540
$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:3359
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:3377
OutputPage\sendCacheControl
sendCacheControl()
Send cache control HTTP headers.
Definition: OutputPage.php:1908
OutputPage\setETag
setETag( $tag)
Set the value of the ETag HTTP header, only used if $wgUseETag is true.
Definition: OutputPage.php:618
OutputPage\out
out( $ins)
Actually output something with print.
Definition: OutputPage.php:2109
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:3730
OutputPage\output
output()
Finally, all the text has been munged and accumulated into the object, let's actually output it:
Definition: OutputPage.php:1990
OutputPage\$mEnableTOC
bool $mEnableTOC
Whether parser output should contain table of contents.
Definition: OutputPage.php:257
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:1438
OutputPage\showUnexpectedValueError
showUnexpectedValueError( $name, $val)
Definition: OutputPage.php:2428
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:2586
OutputPage\isTOCEnabled
isTOCEnabled()
Definition: OutputPage.php:3694
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
OutputPage\$mAllowedModules
$mAllowedModules
Definition: OutputPage.php:157
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:1052
OutputPage\isDisabled
isDisabled()
Return whether the output will be completely disabled.
Definition: OutputPage.php:1005
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:1397
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:1112
OutputPage\disallowUserJs
disallowUserJs()
Do not allow scripts which can be modified by wiki users to load on this page; only allow scripts bun...
Definition: OutputPage.php:1276
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:919
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4001
OutputPage\addVaryHeader
addVaryHeader( $header, $option=null)
Add an HTTP header that will influence on the cache.
Definition: OutputPage.php:1773
OutputPage\getStatusMessage
static getStatusMessage( $code)
Get the message associated with the HTTP response code $code.
Definition: OutputPage.php:1981
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:1483
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:1792
OutputPage\addModules
addModules( $modules)
Add one or more modules recognized by the resource loader.
Definition: OutputPage.php:480
OutputPage\showLagWarning
showLagWarning( $lag)
Show a warning about slave lag.
Definition: OutputPage.php:2411
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:930
OutputPage\getPageTitleActionText
getPageTitleActionText()
Get the value of the "action text".
Definition: OutputPage.php:832
OutputPage\getCacheVaryCookies
getCacheVaryCookies()
Get the list of cookies that will influence on the cache.
Definition: OutputPage.php:1724
OutputPage\getHeadItems
getHeadItems()
Get all header items in a string.
Definition: OutputPage.php:585
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:234
OutputPage\addLanguageLinks
addLanguageLinks( $newLinkArray)
Add new language links.
Definition: OutputPage.php:1157
OutputPage\formatPermissionsErrorMessage
formatPermissionsErrorMessage( $errors, $action=null)
Format a list of error messages.
Definition: OutputPage.php:2287
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:952
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:1560
OutputPage\isArticle
isArticle()
Return whether the content displayed page is related to the source of the corresponding article on th...
Definition: OutputPage.php:1125
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:173
OutputPage\addLink
addLink( $linkarr)
Add a new <link> tag to the page header.
Definition: OutputPage.php:325
OutputPage\addInlineScript
addInlineScript( $script)
Add a self-contained script tag with the given contents.
Definition: OutputPage.php:421
OutputPage\getArticleBodyOnly
getArticleBodyOnly()
Return whether the output will contain only the body of the article.
Definition: OutputPage.php:638
OutputPage\getPreventClickjacking
getPreventClickjacking()
Get the prevent-clickjacking flag.
Definition: OutputPage.php:1884
$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:391
OutputPage\setStatusCode
setStatusCode( $statusCode)
Set the HTTP status code to send with the output.
Definition: OutputPage.php:303
OutputPage\includeJQuery
includeJQuery( $modules=array())
Include jQuery core.
Definition: OutputPage.php:3677
OutputPage\makeResourceLoaderLink
makeResourceLoaderLink( $modules, $only, $useESI=false, array $extraQuery=array(), $loadCall=false)
TODO: Document.
Definition: OutputPage.php:2602
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:1748
OutputPage\getPageTitle
getPageTitle()
Return the "page title", i.e.
Definition: OutputPage.php:901
OutputPage\disable
disable()
Disable output completely, i.e.
Definition: OutputPage.php:996
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:3711
OutputPage\setIndexPolicy
setIndexPolicy( $policy)
Set the index policy for the page, but leave the follow policy un- touched.
Definition: OutputPage.php:796
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
Skin\getPageClasses
getPageClasses( $title)
TODO: document.
Definition: Skin.php:455
OutputPage\showPermissionsErrorPage
showPermissionsErrorPage( $errors, $action=null)
Output a standard permission error page.
Definition: OutputPage.php:2182
OutputPage\setRevisionTimestamp
setRevisionTimestamp( $timestamp)
Set the timestamp of the revision which will be displayed.
Definition: OutputPage.php:1418
$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:576
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:2398
$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:216
TS_ISO_8601_BASIC
const TS_ISO_8601_BASIC
ISO 8601 basic format with no timezone: 19860209T200000Z.
Definition: GlobalFunctions.php:2472
OutputPage\getProperty
getProperty( $name)
Get an additional output property.
Definition: OutputPage.php:660
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:1704
OutputPage\$mNewSectionLink
$mNewSectionLink
Definition: OutputPage.php:192
OutputPage\setTarget
setTarget( $target)
Sets ResourceLoader target for load.php links.
Definition: OutputPage.php:567
OutputPage\setHTMLTitle
setHTMLTitle( $name)
"HTML title" means the contents of "<title>".
Definition: OutputPage.php:845
OutputPage\$styles
$styles
An array of stylesheet filenames (relative from skins path), with options for CSS media,...
Definition: OutputPage.php:226
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:249
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:3643
OutputPage\buildCssLinks
buildCssLinks()
Build a set of "<link>" elements for the stylesheets specified in the $this->styles array.
Definition: OutputPage.php:3412
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:442
OutputPage\prependHTML
prependHTML( $text)
Prepend $text to the body HTML.
Definition: OutputPage.php:1333
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:184
OutputPage\$mCategories
$mCategories
Definition: OutputPage.php:109
OutputPage\getHTMLTitle
getHTMLTitle()
Return the "HTML title", i.e.
Definition: OutputPage.php:858
OutputPage\showFileCopyError
showFileCopyError( $old, $new)
Definition: OutputPage.php:2432
ResourceLoaderModule\ORIGIN_CORE_INDIVIDUAL
const ORIGIN_CORE_INDIVIDUAL
Definition: ResourceLoaderModule.php:40
OutputPage\clearSubtitle
clearSubtitle()
Clear the subtitles.
Definition: OutputPage.php:963
OutputPage\getMetadataAttribute
getMetadataAttribute()
Get the value of the "rel" attribute for metadata links.
Definition: OutputPage.php:354
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:466
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:810
OutputPage\setPageTitle
setPageTitle( $name)
"Page title" means the contents of <h1>.
Definition: OutputPage.php:879
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:679
$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:2456
OutputPage\getAllowedModules
getAllowedModules( $type)
Show what level of JavaScript / CSS untrustworthiness is allowed on this page.
Definition: OutputPage.php:1300
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:649
OutputPage\isPrintable
isPrintable()
Return whether the page is "printable".
Definition: OutputPage.php:989
OutputPage\setSyndicated
setSyndicated( $show=true)
Add or remove feed links in the page header This is mainly kept for backward compatibility,...
Definition: OutputPage.php:1035
$wgParser
$wgParser
Definition: Setup.php:567
OutputPage\$mTarget
string null $mTarget
ResourceLoader target for load.php links.
Definition: OutputPage.php:253
OutputPage\addInlineStyle
addInlineStyle( $style_css, $flip='noflip')
Adds inline CSS styles.
Definition: OutputPage.php:3398
$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:3114
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:382
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:1167
OutputPage\setRedirectedFrom
setRedirectedFrom( $t)
Set $mRedirectedFrom, the Title of the page which redirected us to the current page.
Definition: OutputPage.php:867
OutputPage\addWikiTextTitle
addWikiTextTitle( $text, Title $title, $linestart, $tidy=false, $interface=false)
Add wikitext with a custom Title object.
Definition: OutputPage.php:1534
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:2824
OutputPage\redirect
redirect( $url, $responsecode='302')
Redirect to $url rather than displaying the normal page.
Definition: OutputPage.php:283
$path
$path
Definition: NoLocalSettings.php:35
OutputPage\setPrintable
setPrintable()
Set the page as printable, i.e.
Definition: OutputPage.php:980
OutputPage\getHeadLinksArray
getHeadLinksArray()
Definition: OutputPage.php:3132
OutputPage\$mTemplateIds
$mTemplateIds
Definition: OutputPage.php:147
OutputPage\$mJQueryDone
$mJQueryDone
Whether jQuery is already handled.
Definition: OutputPage.php:231
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:503
OutputPage\allowClickjacking
allowClickjacking()
Turn off frame-breaking.
Definition: OutputPage.php:1874
OutputPage\addElement
addElement( $element, $attribs=array(), $contents='')
Shortcut for adding an Html::element via addHTML.
Definition: OutputPage.php:1355
OutputPage\showFatalError
showFatalError( $message)
Definition: OutputPage.php:2422
OutputPage\getHTML
getHTML()
Get the body HTML.
Definition: OutputPage.php:1371
$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:1299
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:336
OutputPage\showNewSectionLink
showNewSectionLink()
Show an "add new section" link?
Definition: OutputPage.php:1014
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:1648
OutputPage\$mStatusCode
$mStatusCode
Definition: OutputPage.php:88
$t
$t
Definition: testCompression.php:65
OutputPage\$mSquidMaxage
$mSquidMaxage
Definition: OutputPage.php:207
$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:2976
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:214
OutputPage\getJsConfigVars
getJsConfigVars()
Get the javascript config vars to include on this page.
Definition: OutputPage.php:2966
OutputPage\$mContainsOldMagic
$mContainsOldMagic
Definition: OutputPage.php:168
OutputPage\getTemplateIds
getTemplateIds()
Get the templates used on this page.
Definition: OutputPage.php:1461
$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:1084
OutputPage\$mFeedLinksAppendQuery
$mFeedLinksAppendQuery
Definition: OutputPage.php:152
OutputPage\getFileSearchOptions
getFileSearchOptions()
Get the files used on this page.
Definition: OutputPage.php:1471
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:181
OutputPage\$mDoNothing
bool $mDoNothing
Whether output is disabled.
Definition: OutputPage.php:165
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:1801
OutputPage\$mPreventClickjacking
$mPreventClickjacking
Definition: OutputPage.php:210
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:2132
OutputPage\addTemplate
addTemplate(&$template)
Add the output of a QuickTemplate to the output buffer.
Definition: OutputPage.php:1632
OutputPage\getFeedAppendQuery
getFeedAppendQuery()
Will currently always return null.
Definition: OutputPage.php:1101
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:1072
OutputPage\setRobotPolicy
setRobotPolicy( $policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
Definition: OutputPage.php:778
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:2500
$type
$type
Definition: testCompression.php:46
OutputPage\getCategories
getCategories()
Get the list of category names this page belongs to.
Definition: OutputPage.php:1268