MediaWiki  1.23.13
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  $registerExternalLink = true;
205  if ( !$wgRegisterInternalExternals ) {
206  $registerExternalLink = !self::isLinkInternal( $wgServer, $url );
207  }
208  if ( $registerExternalLink ) {
209  $this->mExternalLinks[$url] = 1;
210  }
211  }
212 
219  function addLink( Title $title, $id = null ) {
220  if ( $title->isExternal() ) {
221  // Don't record interwikis in pagelinks
222  $this->addInterwikiLink( $title );
223  return;
224  }
225  $ns = $title->getNamespace();
226  $dbk = $title->getDBkey();
227  if ( $ns == NS_MEDIA ) {
228  // Normalize this pseudo-alias if it makes it down here...
229  $ns = NS_FILE;
230  } elseif ( $ns == NS_SPECIAL ) {
231  // We don't record Special: links currently
232  // It might actually be wise to, but we'd need to do some normalization.
233  return;
234  } elseif ( $dbk === '' ) {
235  // Don't record self links - [[#Foo]]
236  return;
237  }
238  if ( !isset( $this->mLinks[$ns] ) ) {
239  $this->mLinks[$ns] = array();
240  }
241  if ( is_null( $id ) ) {
242  $id = $title->getArticleID();
243  }
244  $this->mLinks[$ns][$dbk] = $id;
245  }
246 
254  function addImage( $name, $timestamp = null, $sha1 = null ) {
255  $this->mImages[$name] = 1;
256  if ( $timestamp !== null && $sha1 !== null ) {
257  $this->mFileSearchOptions[$name] = array( 'time' => $timestamp, 'sha1' => $sha1 );
258  }
259  }
260 
268  function addTemplate( $title, $page_id, $rev_id ) {
269  $ns = $title->getNamespace();
270  $dbk = $title->getDBkey();
271  if ( !isset( $this->mTemplates[$ns] ) ) {
272  $this->mTemplates[$ns] = array();
273  }
274  $this->mTemplates[$ns][$dbk] = $page_id;
275  if ( !isset( $this->mTemplateIds[$ns] ) ) {
276  $this->mTemplateIds[$ns] = array();
277  }
278  $this->mTemplateIds[$ns][$dbk] = $rev_id; // For versioning
279  }
280 
285  function addInterwikiLink( $title ) {
286  if ( !$title->isExternal() ) {
287  throw new MWException( 'Non-interwiki link passed, internal parser error.' );
288  }
289  $prefix = $title->getInterwiki();
290  if ( !isset( $this->mInterwikiLinks[$prefix] ) ) {
291  $this->mInterwikiLinks[$prefix] = array();
292  }
293  $this->mInterwikiLinks[$prefix][$title->getDBkey()] = 1;
294  }
295 
301  function addHeadItem( $section, $tag = false ) {
302  if ( $tag !== false ) {
303  $this->mHeadItems[$tag] = $section;
304  } else {
305  $this->mHeadItems[] = $section;
306  }
307  }
308 
309  public function addModules( $modules ) {
310  $this->mModules = array_merge( $this->mModules, (array)$modules );
311  }
312 
313  public function addModuleScripts( $modules ) {
314  $this->mModuleScripts = array_merge( $this->mModuleScripts, (array)$modules );
315  }
316 
317  public function addModuleStyles( $modules ) {
318  $this->mModuleStyles = array_merge( $this->mModuleStyles, (array)$modules );
319  }
320 
321  public function addModuleMessages( $modules ) {
322  $this->mModuleMessages = array_merge( $this->mModuleMessages, (array)$modules );
323  }
324 
332  public function addJsConfigVars( $keys, $value = null ) {
333  if ( is_array( $keys ) ) {
334  foreach ( $keys as $key => $value ) {
335  $this->mJsConfigVars[$key] = $value;
336  }
337  return;
338  }
339 
340  $this->mJsConfigVars[$keys] = $value;
341  }
342 
348  public function addOutputPageMetadata( OutputPage $out ) {
349  $this->addModules( $out->getModules() );
350  $this->addModuleScripts( $out->getModuleScripts() );
351  $this->addModuleStyles( $out->getModuleStyles() );
352  $this->addModuleMessages( $out->getModuleMessages() );
353  $this->addJsConfigVars( $out->getJsConfigVars() );
354 
355  $this->mHeadItems = array_merge( $this->mHeadItems, $out->getHeadItemsArray() );
356  $this->mPreventClickjacking = $this->mPreventClickjacking || $out->getPreventClickjacking();
357  }
358 
366  public function setDisplayTitle( $text ) {
367  $this->setTitleText( $text );
368  $this->setProperty( 'displaytitle', $text );
369  }
370 
376  public function getDisplayTitle() {
377  $t = $this->getTitleText();
378  if ( $t === '' ) {
379  return false;
380  }
381  return $t;
382  }
383 
387  public function setFlag( $flag ) {
388  $this->mFlags[$flag] = true;
389  }
390 
391  public function getFlag( $flag ) {
392  return isset( $this->mFlags[$flag] );
393  }
394 
452  public function setProperty( $name, $value ) {
453  $this->mProperties[$name] = $value;
454  }
455 
456  public function getProperty( $name ) {
457  return isset( $this->mProperties[$name] ) ? $this->mProperties[$name] : false;
458  }
459 
460  public function getProperties() {
461  if ( !isset( $this->mProperties ) ) {
462  $this->mProperties = array();
463  }
464  return $this->mProperties;
465  }
466 
472  public function getUsedOptions() {
473  if ( !isset( $this->mAccessedOptions ) ) {
474  return array();
475  }
476  return array_keys( $this->mAccessedOptions );
477  }
478 
488  public function recordOption( $option ) {
489  $this->mAccessedOptions[$option] = true;
490  }
491 
502  public function addSecondaryDataUpdate( DataUpdate $update ) {
503  $this->mSecondaryDataUpdates[] = $update;
504  }
505 
522  public function getSecondaryDataUpdates( Title $title = null, $recursive = true ) {
523  if ( is_null( $title ) ) {
524  $title = Title::newFromText( $this->getTitleText() );
525  }
526 
527  $linksUpdate = new LinksUpdate( $title, $this, $recursive );
528 
529  return array_merge( $this->mSecondaryDataUpdates, array( $linksUpdate ) );
530  }
531 
573  public function setExtensionData( $key, $value ) {
574  if ( $value === null ) {
575  unset( $this->mExtensionData[$key] );
576  } else {
577  $this->mExtensionData[$key] = $value;
578  }
579  }
580 
592  public function getExtensionData( $key ) {
593  if ( isset( $this->mExtensionData[$key] ) ) {
594  return $this->mExtensionData[$key];
595  }
596 
597  return null;
598  }
599 
600  private static function getTimes( $clock = null ) {
601  $ret = array();
602  if ( !$clock || $clock === 'wall' ) {
603  $ret['wall'] = microtime( true );
604  }
605  if ( ( !$clock || $clock === 'cpu' ) && function_exists( 'getrusage' ) ) {
606  $ru = getrusage();
607  $ret['cpu'] = $ru['ru_utime.tv_sec'] + $ru['ru_utime.tv_usec'] / 1e6;
608  $ret['cpu'] += $ru['ru_stime.tv_sec'] + $ru['ru_stime.tv_usec'] / 1e6;
609  }
610  return $ret;
611  }
612 
617  function resetParseStartTime() {
618  $this->mParseStartTime = self::getTimes();
619  }
620 
632  function getTimeSinceStart( $clock ) {
633  if ( !isset( $this->mParseStartTime[$clock] ) ) {
634  return null;
635  }
636 
637  $end = self::getTimes( $clock );
638  return $end[$clock] - $this->mParseStartTime[$clock];
639  }
640 
660  function setLimitReportData( $key, $value ) {
661  $this->mLimitReportData[$key] = $value;
662  }
663 
671  public function preventClickjacking( $flag = null ) {
672  return wfSetVar( $this->mPreventClickjacking, $flag );
673  }
674 
678  function __sleep() {
679  return array_diff(
680  array_keys( get_object_vars( $this ) ),
681  array( 'mSecondaryDataUpdates', 'mParseStartTime' )
682  );
683  }
684 }
ParserOutput\addOutputPageMetadata
addOutputPageMetadata(OutputPage $out)
Copy items from the OutputPage object into this one.
Definition: ParserOutput.php:348
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:2823
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:313
ParserOutput\resetParseStartTime
resetParseStartTime()
Resets the parse start timestamps for future calls to getTimeSinceStart()
Definition: ParserOutput.php:617
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:522
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:366
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:472
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:660
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:678
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:309
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:268
$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:387
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:219
$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:460
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:391
ParserOutput\getTimestamp
getTimestamp()
Definition: ParserOutput.php:145
ParserOutput\addModuleMessages
addModuleMessages( $modules)
Definition: ParserOutput.php:321
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:632
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:254
$wgOut
$wgOut
Definition: Setup.php:582
ParserOutput\$mExternalLinks
$mExternalLinks
Definition: ParserOutput.php:34
ParserOutput\getTimes
static getTimes( $clock=null)
Definition: ParserOutput.php:600
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:317
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:376
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:488
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:452
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:573
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:502
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:456
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:332
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:2702
ParserOutput\$mTemplates
$mTemplates
Definition: ParserOutput.php:30
ParserOutput\getExtensionData
getExtensionData( $key)
Gets extensions data previously attached to this ParserOutput using setExtensionData().
Definition: ParserOutput.php:592
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:285
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:301
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:671
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