MediaWiki  1.23.16
ParserOutput.php
Go to the documentation of this file.
1 <?php
2 
24 class ParserOutput extends CacheTime {
25  var $mText, # The output text
26  $mLanguageLinks, # List of the full text of language links, in the order they appear
27  $mCategories, # Map of category names to sort keys
28  $mTitleText, # title text of the chosen language variant
29  $mLinks = array(), # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken.
30  $mTemplates = array(), # 2-D map of NS/DBK to ID for the template references. ID=zero for broken.
31  $mTemplateIds = array(), # 2-D map of NS/DBK to rev ID for the template references. ID=zero for broken.
32  $mImages = array(), # DB keys of the images used, in the array key only
33  $mFileSearchOptions = array(), # DB keys of the images used mapped to sha1 and MW timestamp
34  $mExternalLinks = array(), # External link URLs, in the key only
35  $mInterwikiLinks = array(), # 2-D map of prefix/DBK (in keys only) for the inline interwiki links in the document.
36  $mNewSection = false, # Show a new section link?
37  $mHideNewSection = false, # Hide the new section link?
38  $mNoGallery = false, # No gallery on category page? (__NOGALLERY__)
39  $mHeadItems = array(), # Items to put in the <head> section
40  $mModules = array(), # Modules to be loaded by the resource loader
41  $mModuleScripts = array(), # Modules of which only the JS will be loaded by the resource loader
42  $mModuleStyles = array(), # Modules of which only the CSSS will be loaded by the resource loader
43  $mModuleMessages = array(), # Modules of which only the messages will be loaded by the resource loader
44  $mJsConfigVars = array(), # JavaScript config variable for mw.config combined with this page
45  $mOutputHooks = array(), # Hook tags as per $wgParserOutputHooks
46  $mWarnings = array(), # Warning text to be returned to the user. Wikitext formatted, in the key only
47  $mSections = array(), # Table of contents
48  $mEditSectionTokens = false, # prefix/suffix markers if edit sections were output as tokens
49  $mProperties = array(), # Name/value pairs to be cached in the DB
50  $mTOCHTML = '', # HTML of the TOC
51  $mTimestamp, # Timestamp of the revision
52  $mTOCEnabled = true; # Whether TOC should be shown, can't override __NOTOC__
53  private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change.
54  private $mAccessedOptions = array(); # List of ParserOptions (stored in the keys)
55  private $mSecondaryDataUpdates = array(); # List of DataUpdate, used to save info from the page somewhere else.
56  private $mExtensionData = array(); # extra data used by extensions
57  private $mLimitReportData = array(); # Parser limit report data
58  private $mParseStartTime = array(); # Timestamps for getTimeSinceStart()
59  private $mPreventClickjacking = false; # Whether to emit X-Frame-Options: DENY
60 
61  const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
62 
63  function __construct( $text = '', $languageLinks = array(), $categoryLinks = array(),
64  $containsOldMagic = false, $titletext = ''
65  ) {
66  $this->mText = $text;
67  $this->mLanguageLinks = $languageLinks;
68  $this->mCategories = $categoryLinks;
69  $this->mContainsOldMagic = $containsOldMagic;
70  $this->mTitleText = $titletext;
71  }
72 
73  function getText() {
74  wfProfileIn( __METHOD__ );
75  $text = $this->mText;
76  if ( $this->mEditSectionTokens ) {
77  $text = preg_replace_callback( ParserOutput::EDITSECTION_REGEX,
78  array( &$this, 'replaceEditSectionLinksCallback' ), $text );
79  } else {
80  $text = preg_replace( ParserOutput::EDITSECTION_REGEX, '', $text );
81  }
82 
83  // If you have an old cached version of this class - sorry, you can't disable the TOC
84  if ( isset( $this->mTOCEnabled ) && $this->mTOCEnabled ) {
85  $text = str_replace( array( Parser::TOC_START, Parser::TOC_END ), '', $text );
86  } else {
87  $text = preg_replace(
88  '#' . preg_quote( Parser::TOC_START ) . '.*?' . preg_quote( Parser::TOC_END ) . '#s',
89  '',
90  $text
91  );
92  }
93  wfProfileOut( __METHOD__ );
94  return $text;
95  }
96 
106  $args = array(
107  htmlspecialchars_decode( $m[1] ),
108  htmlspecialchars_decode( $m[2] ),
109  isset( $m[4] ) ? $m[3] : null,
110  );
111  $args[0] = Title::newFromText( $args[0] );
112  if ( !is_object( $args[0] ) ) {
113  throw new MWException( "Bad parser output text." );
114  }
115  $args[] = $wgLang->getCode();
116  $skin = $wgOut->getSkin();
117  return call_user_func_array( array( $skin, 'doEditSectionLink' ), $args );
118  }
119 
120  function &getLanguageLinks() { return $this->mLanguageLinks; }
121  function getInterwikiLinks() { return $this->mInterwikiLinks; }
122  function getCategoryLinks() { return array_keys( $this->mCategories ); }
123  function &getCategories() { return $this->mCategories; }
124  function getTitleText() { return $this->mTitleText; }
125  function getSections() { return $this->mSections; }
126  function getEditSectionTokens() { return $this->mEditSectionTokens; }
127  function &getLinks() { return $this->mLinks; }
128  function &getTemplates() { return $this->mTemplates; }
129  function &getTemplateIds() { return $this->mTemplateIds; }
130  function &getImages() { return $this->mImages; }
131  function &getFileSearchOptions() { return $this->mFileSearchOptions; }
132  function &getExternalLinks() { return $this->mExternalLinks; }
133  function getNoGallery() { return $this->mNoGallery; }
134  function getHeadItems() { return $this->mHeadItems; }
135  function getModules() { return $this->mModules; }
136  function getModuleScripts() { return $this->mModuleScripts; }
137  function getModuleStyles() { return $this->mModuleStyles; }
138  function getModuleMessages() { return $this->mModuleMessages; }
140  function getJsConfigVars() { return $this->mJsConfigVars; }
141  function getOutputHooks() { return (array)$this->mOutputHooks; }
142  function getWarnings() { return array_keys( $this->mWarnings ); }
143  function getIndexPolicy() { return $this->mIndexPolicy; }
144  function getTOCHTML() { return $this->mTOCHTML; }
145  function getTimestamp() { return $this->mTimestamp; }
146  function getLimitReportData() { return $this->mLimitReportData; }
147  function getTOCEnabled() { return $this->mTOCEnabled; }
148 
149  function setText( $text ) { return wfSetVar( $this->mText, $text ); }
150  function setLanguageLinks( $ll ) { return wfSetVar( $this->mLanguageLinks, $ll ); }
151  function setCategoryLinks( $cl ) { return wfSetVar( $this->mCategories, $cl ); }
152 
153  function setTitleText( $t ) { return wfSetVar( $this->mTitleText, $t ); }
154  function setSections( $toc ) { return wfSetVar( $this->mSections, $toc ); }
155  function setEditSectionTokens( $t ) { return wfSetVar( $this->mEditSectionTokens, $t ); }
156  function setIndexPolicy( $policy ) { return wfSetVar( $this->mIndexPolicy, $policy ); }
157  function setTOCHTML( $tochtml ) { return wfSetVar( $this->mTOCHTML, $tochtml ); }
158  function setTimestamp( $timestamp ) { return wfSetVar( $this->mTimestamp, $timestamp ); }
159  function setTOCEnabled( $flag ) { return wfSetVar( $this->mTOCEnabled, $flag ); }
160 
161  function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; }
162  function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; }
163  function addWarning( $s ) { $this->mWarnings[$s] = 1; }
164 
165  function addOutputHook( $hook, $data = false ) {
166  $this->mOutputHooks[] = array( $hook, $data );
167  }
168 
169  function setNewSection( $value ) {
170  $this->mNewSection = (bool)$value;
171  }
172  function hideNewSection( $value ) {
173  $this->mHideNewSection = (bool)$value;
174  }
175  function getHideNewSection() {
176  return (bool)$this->mHideNewSection;
177  }
178  function getNewSection() {
179  return (bool)$this->mNewSection;
180  }
181 
189  static function isLinkInternal( $internal, $url ) {
190  return (bool)preg_match( '/^' .
191  # If server is proto relative, check also for http/https links
192  ( substr( $internal, 0, 2 ) === '//' ? '(?:https?:)?' : '' ) .
193  preg_quote( $internal, '/' ) .
194  # check for query/path/anchor or end of link in each case
195  '(?:[\?\/\#]|$)/i',
196  $url
197  );
198  }
199 
200  function addExternalLink( $url ) {
201  # We don't register links pointing to our own server, unless... :-)
202  global $wgServer, $wgRegisterInternalExternals;
203 
204  # Replace unnecessary URL escape codes with the referenced character
205  # This prevents spammers from hiding links from the filters
206  $url = Parser::replaceUnusualEscapes( $url );
207 
208  $registerExternalLink = true;
209  if ( !$wgRegisterInternalExternals ) {
210  $registerExternalLink = !self::isLinkInternal( $wgServer, $url );
211  }
212  if ( $registerExternalLink ) {
213  $this->mExternalLinks[$url] = 1;
214  }
215  }
216 
223  function addLink( Title $title, $id = null ) {
224  if ( $title->isExternal() ) {
225  // Don't record interwikis in pagelinks
226  $this->addInterwikiLink( $title );
227  return;
228  }
229  $ns = $title->getNamespace();
230  $dbk = $title->getDBkey();
231  if ( $ns == NS_MEDIA ) {
232  // Normalize this pseudo-alias if it makes it down here...
233  $ns = NS_FILE;
234  } elseif ( $ns == NS_SPECIAL ) {
235  // We don't record Special: links currently
236  // It might actually be wise to, but we'd need to do some normalization.
237  return;
238  } elseif ( $dbk === '' ) {
239  // Don't record self links - [[#Foo]]
240  return;
241  }
242  if ( !isset( $this->mLinks[$ns] ) ) {
243  $this->mLinks[$ns] = array();
244  }
245  if ( is_null( $id ) ) {
246  $id = $title->getArticleID();
247  }
248  $this->mLinks[$ns][$dbk] = $id;
249  }
250 
258  function addImage( $name, $timestamp = null, $sha1 = null ) {
259  $this->mImages[$name] = 1;
260  if ( $timestamp !== null && $sha1 !== null ) {
261  $this->mFileSearchOptions[$name] = array( 'time' => $timestamp, 'sha1' => $sha1 );
262  }
263  }
264 
272  function addTemplate( $title, $page_id, $rev_id ) {
273  $ns = $title->getNamespace();
274  $dbk = $title->getDBkey();
275  if ( !isset( $this->mTemplates[$ns] ) ) {
276  $this->mTemplates[$ns] = array();
277  }
278  $this->mTemplates[$ns][$dbk] = $page_id;
279  if ( !isset( $this->mTemplateIds[$ns] ) ) {
280  $this->mTemplateIds[$ns] = array();
281  }
282  $this->mTemplateIds[$ns][$dbk] = $rev_id; // For versioning
283  }
284 
289  function addInterwikiLink( $title ) {
290  if ( !$title->isExternal() ) {
291  throw new MWException( 'Non-interwiki link passed, internal parser error.' );
292  }
293  $prefix = $title->getInterwiki();
294  if ( !isset( $this->mInterwikiLinks[$prefix] ) ) {
295  $this->mInterwikiLinks[$prefix] = array();
296  }
297  $this->mInterwikiLinks[$prefix][$title->getDBkey()] = 1;
298  }
299 
305  function addHeadItem( $section, $tag = false ) {
306  if ( $tag !== false ) {
307  $this->mHeadItems[$tag] = $section;
308  } else {
309  $this->mHeadItems[] = $section;
310  }
311  }
312 
313  public function addModules( $modules ) {
314  $this->mModules = array_merge( $this->mModules, (array)$modules );
315  }
316 
317  public function addModuleScripts( $modules ) {
318  $this->mModuleScripts = array_merge( $this->mModuleScripts, (array)$modules );
319  }
320 
321  public function addModuleStyles( $modules ) {
322  $this->mModuleStyles = array_merge( $this->mModuleStyles, (array)$modules );
323  }
324 
325  public function addModuleMessages( $modules ) {
326  $this->mModuleMessages = array_merge( $this->mModuleMessages, (array)$modules );
327  }
328 
336  public function addJsConfigVars( $keys, $value = null ) {
337  if ( is_array( $keys ) ) {
338  foreach ( $keys as $key => $value ) {
339  $this->mJsConfigVars[$key] = $value;
340  }
341  return;
342  }
343 
344  $this->mJsConfigVars[$keys] = $value;
345  }
346 
352  public function addOutputPageMetadata( OutputPage $out ) {
353  $this->addModules( $out->getModules() );
354  $this->addModuleScripts( $out->getModuleScripts() );
355  $this->addModuleStyles( $out->getModuleStyles() );
356  $this->addModuleMessages( $out->getModuleMessages() );
357  $this->addJsConfigVars( $out->getJsConfigVars() );
358 
359  $this->mHeadItems = array_merge( $this->mHeadItems, $out->getHeadItemsArray() );
360  $this->mPreventClickjacking = $this->mPreventClickjacking || $out->getPreventClickjacking();
361  }
362 
370  public function setDisplayTitle( $text ) {
371  $this->setTitleText( $text );
372  $this->setProperty( 'displaytitle', $text );
373  }
374 
380  public function getDisplayTitle() {
381  $t = $this->getTitleText();
382  if ( $t === '' ) {
383  return false;
384  }
385  return $t;
386  }
387 
391  public function setFlag( $flag ) {
392  $this->mFlags[$flag] = true;
393  }
394 
395  public function getFlag( $flag ) {
396  return isset( $this->mFlags[$flag] );
397  }
398 
456  public function setProperty( $name, $value ) {
457  $this->mProperties[$name] = $value;
458  }
459 
460  public function getProperty( $name ) {
461  return isset( $this->mProperties[$name] ) ? $this->mProperties[$name] : false;
462  }
463 
464  public function getProperties() {
465  if ( !isset( $this->mProperties ) ) {
466  $this->mProperties = array();
467  }
468  return $this->mProperties;
469  }
470 
476  public function getUsedOptions() {
477  if ( !isset( $this->mAccessedOptions ) ) {
478  return array();
479  }
480  return array_keys( $this->mAccessedOptions );
481  }
482 
492  public function recordOption( $option ) {
493  $this->mAccessedOptions[$option] = true;
494  }
495 
506  public function addSecondaryDataUpdate( DataUpdate $update ) {
507  $this->mSecondaryDataUpdates[] = $update;
508  }
509 
526  public function getSecondaryDataUpdates( Title $title = null, $recursive = true ) {
527  if ( is_null( $title ) ) {
528  $title = Title::newFromText( $this->getTitleText() );
529  }
530 
531  $linksUpdate = new LinksUpdate( $title, $this, $recursive );
532 
533  return array_merge( $this->mSecondaryDataUpdates, array( $linksUpdate ) );
534  }
535 
577  public function setExtensionData( $key, $value ) {
578  if ( $value === null ) {
579  unset( $this->mExtensionData[$key] );
580  } else {
581  $this->mExtensionData[$key] = $value;
582  }
583  }
584 
596  public function getExtensionData( $key ) {
597  if ( isset( $this->mExtensionData[$key] ) ) {
598  return $this->mExtensionData[$key];
599  }
600 
601  return null;
602  }
603 
604  private static function getTimes( $clock = null ) {
605  $ret = array();
606  if ( !$clock || $clock === 'wall' ) {
607  $ret['wall'] = microtime( true );
608  }
609  if ( ( !$clock || $clock === 'cpu' ) && function_exists( 'getrusage' ) ) {
610  $ru = getrusage();
611  $ret['cpu'] = $ru['ru_utime.tv_sec'] + $ru['ru_utime.tv_usec'] / 1e6;
612  $ret['cpu'] += $ru['ru_stime.tv_sec'] + $ru['ru_stime.tv_usec'] / 1e6;
613  }
614  return $ret;
615  }
616 
621  function resetParseStartTime() {
622  $this->mParseStartTime = self::getTimes();
623  }
624 
636  function getTimeSinceStart( $clock ) {
637  if ( !isset( $this->mParseStartTime[$clock] ) ) {
638  return null;
639  }
640 
641  $end = self::getTimes( $clock );
642  return $end[$clock] - $this->mParseStartTime[$clock];
643  }
644 
664  function setLimitReportData( $key, $value ) {
665  $this->mLimitReportData[$key] = $value;
666  }
667 
675  public function preventClickjacking( $flag = null ) {
676  return wfSetVar( $this->mPreventClickjacking, $flag );
677  }
678 
682  function __sleep() {
683  return array_diff(
684  array_keys( get_object_vars( $this ) ),
685  array( 'mSecondaryDataUpdates', 'mParseStartTime' )
686  );
687  }
688 }
ParserOutput\addOutputPageMetadata
addOutputPageMetadata(OutputPage $out)
Copy items from the OutputPage object into this one.
Definition: ParserOutput.php:352
check
in this case you re responsible for computing and outputting the entire conflict i the difference between revisions and your text headers and sections and Diff overridable Default is either copyrightwarning or copyrightwarning2 overridable Default is editpage tos summary such as anonymity and the real check
Definition: hooks.txt:1038
ID
occurs before session is loaded can be modified ID
Definition: hooks.txt:2829
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
ParserOutput\$mProperties
$mProperties
Definition: ParserOutput.php:49
of
globals txt Globals are evil The original MediaWiki code relied on globals for processing context far too often MediaWiki development since then has been a story of slowly moving context out of global variables and into objects Storing processing context in object member variables allows those objects to be reused in a much more flexible way Consider the elegance of
Definition: globals.txt:10
ParserOutput\setTitleText
setTitleText( $t)
Definition: ParserOutput.php:153
ParserOutput
Definition: ParserOutput.php:24
query
For a write query
Definition: database.txt:26
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
ParserOutput\$mInterwikiLinks
$mInterwikiLinks
Definition: ParserOutput.php:35
CacheTime
Parser cache specific expiry check.
Definition: CacheTime.php:29
ParserOutput\addModuleScripts
addModuleScripts( $modules)
Definition: ParserOutput.php:317
ParserOutput\resetParseStartTime
resetParseStartTime()
Resets the parse start timestamps for future calls to getTimeSinceStart()
Definition: ParserOutput.php:621
ParserOutput\getSecondaryDataUpdates
getSecondaryDataUpdates(Title $title=null, $recursive=true)
Returns any DataUpdate jobs to be executed in order to store secondary information extracted from the...
Definition: ParserOutput.php:526
ParserOutput\setDisplayTitle
setDisplayTitle( $text)
Override the title to be used for display – this is assumed to have been validated (check equal norma...
Definition: ParserOutput.php:370
ParserOutput\setTimestamp
setTimestamp( $timestamp)
Definition: ParserOutput.php:158
ParserOutput\getUsedOptions
getUsedOptions()
Returns the options from its ParserOptions which have been taken into account to produce this output ...
Definition: ParserOutput.php:476
is
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * is(N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER
ParserOutput\setLimitReportData
setLimitReportData( $key, $value)
Sets parser limit report data for a key.
Definition: ParserOutput.php:664
wfSetVar
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
Definition: GlobalFunctions.php:2186
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
ParserOutput\$mModuleMessages
$mModuleMessages
Definition: ParserOutput.php:43
$timestamp
if( $limit) $timestamp
Definition: importImages.php:104
ParserOutput\__sleep
__sleep()
Save space for for serialization by removing useless values.
Definition: ParserOutput.php:682
ParserOutput\setNewSection
setNewSection( $value)
Definition: ParserOutput.php:169
ParserOutput\getModules
getModules()
Definition: ParserOutput.php:135
ParserOutput\getImages
& getImages()
Definition: ParserOutput.php:130
ParserOutput\addModules
addModules( $modules)
Definition: ParserOutput.php:313
ParserOutput\$mEditSectionTokens
$mEditSectionTokens
Definition: ParserOutput.php:48
contents
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database such as a description of the tables and their contents
Definition: database.txt:2
ParserOutput\addTemplate
addTemplate( $title, $page_id, $rev_id)
Register a template dependency for this output.
Definition: ParserOutput.php:272
$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
ParserOutput\getJsConfigVars
getJsConfigVars()
Definition: ParserOutput.php:140
LinksUpdate
See docs/deferred.txt.
Definition: LinksUpdate.php:28
NS_FILE
const NS_FILE
Definition: Defines.php:85
ParserOutput\$mImages
$mImages
Definition: ParserOutput.php:32
ParserOutput\setFlag
setFlag( $flag)
Fairly generic flag setter thingy.
Definition: ParserOutput.php:391
ParserOutput\hideNewSection
hideNewSection( $value)
Definition: ParserOutput.php:172
ParserOutput\$mOutputHooks
$mOutputHooks
Definition: ParserOutput.php:45
ParserOutput\addLink
addLink(Title $title, $id=null)
Record a local or interwiki inline link for saving in future link tables.
Definition: ParserOutput.php:223
$s
$s
Definition: mergeMessageFileList.php:156
ParserOutput\$mFileSearchOptions
$mFileSearchOptions
Definition: ParserOutput.php:33
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
ParserOutput\getHeadItems
getHeadItems()
Definition: ParserOutput.php:134
DataUpdate
Abstract base class for update jobs that do something with some secondary data extracted from article...
Definition: DataUpdate.php:32
ParserOutput\getProperties
getProperties()
Definition: ParserOutput.php:464
ParserOutput\getModuleStyles
getModuleStyles()
Definition: ParserOutput.php:137
key
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 in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database key
Definition: design.txt:25
title
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
Definition: All_system_messages.txt:2703
ParserOutput\$mNoGallery
$mNoGallery
Definition: ParserOutput.php:38
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:68
ParserOutput\setTOCEnabled
setTOCEnabled( $flag)
Definition: ParserOutput.php:159
MWException
MediaWiki exception.
Definition: MWException.php:26
$out
$out
Definition: UtfNormalGenerate.php:167
ParserOutput\getCategoryLinks
getCategoryLinks()
Definition: ParserOutput.php:122
ParserOutput\getFlag
getFlag( $flag)
Definition: ParserOutput.php:395
ParserOutput\getTimestamp
getTimestamp()
Definition: ParserOutput.php:145
ParserOutput\addModuleMessages
addModuleMessages( $modules)
Definition: ParserOutput.php:325
ParserOutput\isLinkInternal
static isLinkInternal( $internal, $url)
Checks, if a url is pointing to the own server.
Definition: ParserOutput.php:189
ParserOutput\addExternalLink
addExternalLink( $url)
Definition: ParserOutput.php:200
ParserOutput\getInterwikiLinks
getInterwikiLinks()
Definition: ParserOutput.php:121
ParserOutput\getTimeSinceStart
getTimeSinceStart( $clock)
Returns the time since resetParseStartTime() was last called.
Definition: ParserOutput.php:636
wfProfileOut
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Definition: Profiler.php:46
ParserOutput\addImage
addImage( $name, $timestamp=null, $sha1=null)
Register a file dependency for this output.
Definition: ParserOutput.php:258
$wgOut
$wgOut
Definition: Setup.php:582
ParserOutput\$mExternalLinks
$mExternalLinks
Definition: ParserOutput.php:34
ParserOutput\getTimes
static getTimes( $clock=null)
Definition: ParserOutput.php:604
ParserOutput\addCategory
addCategory( $c, $sort)
Definition: ParserOutput.php:161
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
ParserOutput\getTOCEnabled
getTOCEnabled()
Definition: ParserOutput.php:147
ParserOutput\addModuleStyles
addModuleStyles( $modules)
Definition: ParserOutput.php:321
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ParserOutput\setText
setText( $text)
Definition: ParserOutput.php:149
ParserOutput\getDisplayTitle
getDisplayTitle()
Get the title to be used for display.
Definition: ParserOutput.php:380
ParserOutput\setLanguageLinks
setLanguageLinks( $ll)
Definition: ParserOutput.php:150
ParserOutput\setEditSectionTokens
setEditSectionTokens( $t)
Definition: ParserOutput.php:155
OutputPage
This class should be covered by a general architecture document which does not exist as of January 20...
Definition: OutputPage.php:38
ParserOutput\getLanguageLinks
& getLanguageLinks()
Definition: ParserOutput.php:120
ParserOutput\$mHideNewSection
$mHideNewSection
Definition: ParserOutput.php:37
$sort
$sort
Definition: profileinfo.php:301
ParserOutput\$mLanguageLinks
$mLanguageLinks
Definition: ParserOutput.php:25
ParserOutput\getModuleScripts
getModuleScripts()
Definition: ParserOutput.php:136
ParserOutput\getExternalLinks
& getExternalLinks()
Definition: ParserOutput.php:132
ParserOutput\getTemplateIds
& getTemplateIds()
Definition: ParserOutput.php:129
ParserOutput\getTOCHTML
getTOCHTML()
Definition: ParserOutput.php:144
will
</td >< td > &</td >< td > t want your writing to be edited mercilessly and redistributed at will
Definition: All_system_messages.txt:914
ParserOutput\recordOption
recordOption( $option)
Tags a parser option for use in the cache key for this parser output.
Definition: ParserOutput.php:492
ParserOutput\addOutputHook
addOutputHook( $hook, $data=false)
Definition: ParserOutput.php:165
$section
$section
Definition: Utf8Test.php:88
ParserOutput\getTitleText
getTitleText()
Definition: ParserOutput.php:124
ParserOutput\$mWarnings
$mWarnings
Definition: ParserOutput.php:46
ParserOutput\setProperty
setProperty( $name, $value)
Set a property to be stored in the page_props database table.
Definition: ParserOutput.php:456
ParserOutput\getNewSection
getNewSection()
Definition: ParserOutput.php:178
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
ParserOutput\setExtensionData
setExtensionData( $key, $value)
Attaches arbitrary data to this ParserObject.
Definition: ParserOutput.php:577
user
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 and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Definition: distributors.txt:9
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
$value
$value
Definition: styleTest.css.php:45
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:67
ParserOutput\$mSections
$mSections
Definition: ParserOutput.php:47
$linksUpdate
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 after in associative array form externallinks $linksUpdate
Definition: hooks.txt:1530
variable
controlled by $wgMainCacheType controlled by $wgParserCacheType controlled by $wgMessageCacheType If you set CACHE_NONE to one of the three control variable
Definition: memcached.txt:78
ParserOutput\getOutputHooks
getOutputHooks()
Definition: ParserOutput.php:141
ParserOutput\$mLinks
$mLinks
Definition: ParserOutput.php:29
ParserOutput\getHideNewSection
getHideNewSection()
Definition: ParserOutput.php:175
ParserOutput\$mTitleText
$mTitleText
Definition: ParserOutput.php:25
ParserOutput\$mJsConfigVars
$mJsConfigVars
Definition: ParserOutput.php:44
ParserOutput\getNoGallery
getNoGallery()
Definition: ParserOutput.php:133
ParserOutput\addWarning
addWarning( $s)
Definition: ParserOutput.php:163
ParserOutput\addSecondaryDataUpdate
addSecondaryDataUpdate(DataUpdate $update)
Adds an update job to the output.
Definition: ParserOutput.php:506
tags
pre inside other HTML tags(bug 54946) !! wikitext a< div >< pre > foo</pre ></div >< pre ></pre > !! html< p >a</p >< div >< pre > foo</pre ></div >< pre ></pre > !! end !! test HTML pre followed by indent-pre !! wikitext< pre >foo</pre > bar !! html< pre >foo</pre >< pre >bar</pre > !! end !!test Block tag pre !!options parsoid !! wikitext< p >< pre >foo</pre ></p > !! html< p data-parsoid
ParserOutput\getTemplates
& getTemplates()
Definition: ParserOutput.php:128
only
published in in Madrid In the first edition of the Vocabolario for was published In in Rotterdam was the Dictionnaire Universel ! html< p > The first monolingual dictionary written in a Romance language was< i > Sebastián Covarrubias</i >< i > Tesoro de la lengua castellana o published in in Madrid In the first edition of the< i > Vocabolario dell< a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)"> Accademia della Crusca</a ></i > for was published In in Rotterdam was the< i > Dictionnaire Universel</i ></p > ! end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html php< p >< i > foo</i ></p > ! html parsoid< p >< i > foo</i >< b ></b ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html php< p >< b > foo</b ></p > ! html parsoid< p >< b > foo</b >< i ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html php< p >< b > foo</b ></p > ! html parsoid< p >< b > foo</b >< i ></i ></p > !end ! test Italics and ! options ! wikitext foo ! html< p >< b >< i > foo</i ></b ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html php< p >< b > foo</b > bar</p > ! html parsoid< p >< b > foo</b > bar< i ></i ></p > !end ! test Italics and ! wikitext foo bar ! html php< p >< b > foo</b > bar</p > ! html parsoid< p >< b > foo</b > bar< b ></b ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< i > this is about< b > foo s family</b ></i ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< i > this is about< b > foo s</b > family</i ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< b > this is about< i > foo</i ></b >< i > s family</i ></p > !end ! test Italics and ! options ! wikitext this is about foo s family ! html< p >< i > this is about</i > foo< b > s family</b ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< b > this is about< i > foo s</i > family</b ></p > !end ! test Italicized possessive ! wikitext The s talk page ! html< p > The< i >< a href="/wiki/Main_Page" title="Main Page"> Main Page</a ></i > s talk page</p > ! end ! test Parsoid only
Definition: parserTests.txt:396
ParserOutput\setSections
setSections( $toc)
Definition: ParserOutput.php:154
ParserOutput\setCategoryLinks
setCategoryLinks( $cl)
Definition: ParserOutput.php:151
$skin
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 $skin
Definition: hooks.txt:1530
ParserOutput\$mTOCEnabled
$mTOCEnabled
Definition: ParserOutput.php:52
ParserOutput\$mText
$mText
Definition: ParserOutput.php:25
broken
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 broken
Definition: hooks.txt:1530
$args
if( $line===false) $args
Definition: cdb.php:62
ParserOutput\getFileSearchOptions
& getFileSearchOptions()
Definition: ParserOutput.php:131
Title
Represents a title within MediaWiki.
Definition: Title.php:35
$wgLang
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 $wgLang
Definition: design.txt:56
ParserOutput\getProperty
getProperty( $name)
Definition: ParserOutput.php:460
ParserOutput\getModuleMessages
getModuleMessages()
Definition: ParserOutput.php:138
ParserOutput\$mModuleStyles
$mModuleStyles
Definition: ParserOutput.php:42
output
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 in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
ParserOutput\$mTOCHTML
$mTOCHTML
Definition: ParserOutput.php:50
ParserOutput\$mModules
$mModules
Definition: ParserOutput.php:40
in
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning in
Definition: maintenance.txt:1
on
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going on
Definition: hooks.txt:86
https
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 https
Definition: design.txt:12
ParserOutput\$mCategories
$mCategories
Definition: ParserOutput.php:25
used
you don t have to do a grep find to see where the $wgReverseTitle variable is used
Definition: hooks.txt:117
ParserOutput\addJsConfigVars
addJsConfigVars( $keys, $value=null)
Add one or more variables to be set in mw.config in JavaScript.
Definition: ParserOutput.php:336
ParserOutput\getCategories
& getCategories()
Definition: ParserOutput.php:123
ParserOutput\replaceEditSectionLinksCallback
replaceEditSectionLinksCallback( $m)
callback used by getText to replace editsection tokens
Definition: ParserOutput.php:104
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
$keys
$keys
Definition: testCompression.php:63
ParserOutput\getLimitReportData
getLimitReportData()
Definition: ParserOutput.php:146
ParserOutput\getEditSectionTokens
getEditSectionTokens()
Definition: ParserOutput.php:126
Warning
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks this Boolean value will be checked to determine if the password was valid return false to implement your own hashing method this String will be used as the hash which may be added to this hook is run right before returning the options to the caller Warning
Definition: hooks.txt:2708
ParserOutput\$mTemplates
$mTemplates
Definition: ParserOutput.php:30
ParserOutput\getExtensionData
getExtensionData( $key)
Gets extensions data previously attached to this ParserOutput using setExtensionData().
Definition: ParserOutput.php:596
ParserOutput\addLanguageLink
addLanguageLink( $t)
Definition: ParserOutput.php:162
$t
$t
Definition: testCompression.php:65
ParserOutput\$mHeadItems
$mHeadItems
Definition: ParserOutput.php:39
ParserOutput\$mTemplateIds
$mTemplateIds
Definition: ParserOutput.php:31
ParserOutput\addInterwikiLink
addInterwikiLink( $title)
Definition: ParserOutput.php:289
ParserOutput\setTOCHTML
setTOCHTML( $tochtml)
Definition: ParserOutput.php:157
ParserOutput\$mNewSection
$mNewSection
Definition: ParserOutput.php:36
order
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 in any order
Definition: design.txt:12
ParserOutput\getSections
getSections()
Definition: ParserOutput.php:125
ParserOutput\addHeadItem
addHeadItem( $section, $tag=false)
Add some text to the "<head>".
Definition: ParserOutput.php:305
server
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 and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same so they can t rely on Unix and must forbid reads to even standard directories like tmp lest users read each others files We cannot assume that the user has the ability to install or run any programs not written as web accessible PHP scripts Since anything that works on cheap shared hosting will work if you have shell or root access MediaWiki s design is based around catering to the lowest common denominator Although we support higher end setups as the way many things work by default is tailored toward shared hosting These defaults are unconventional from the point of view of and they certainly aren t ideal for someone who s installing MediaWiki as MediaWiki does not conform to normal Unix filesystem layout Hopefully we ll offer direct support for standard layouts in the but for now *any change to the location of files is unsupported *Moving things and leaving symlinks will *probably *not break but it is *strongly *advised not to try any more intrusive changes to get MediaWiki to conform more closely to your filesystem hierarchy Any such attempt will almost certainly result in unnecessary bugs The standard recommended location to install relative to the web is it should be possible to enable the appropriate rewrite rules by if you can reconfigure the web server
Definition: distributors.txt:53
ParserOutput\$mModuleScripts
$mModuleScripts
Definition: ParserOutput.php:41
were
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 were
Definition: skin.txt:10
section
section
Definition: parserTests.txt:378
ParserOutput\$mTimestamp
$mTimestamp
Definition: ParserOutput.php:50
ParserOutput\getLinks
& getLinks()
Definition: ParserOutput.php:127
ParserOutput\setIndexPolicy
setIndexPolicy( $policy)
Definition: ParserOutput.php:156
ParserOutput\getIndexPolicy
getIndexPolicy()
Definition: ParserOutput.php:143
ParserOutput\preventClickjacking
preventClickjacking( $flag=null)
Get or set the prevent-clickjacking flag.
Definition: ParserOutput.php:675
ParserOutput\getWarnings
getWarnings()
Definition: ParserOutput.php:142
page
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 page
Definition: hooks.txt:1961