* changes in an incompatible way, so the parser cache
* can automatically discard old data.
*/
-define( 'MW_PARSER_VERSION', '1.6.0' );
+define( 'MW_PARSER_VERSION', '1.6.1' );
/**
* Variable substitution O(N^2) attack
class Parser
{
/**#@+
- * @access private
+ * @private
*/
# Persistent:
var $mTagHooks, $mFunctionHooks;
/**
* Constructor
*
- * @access public
+ * @public
*/
function Parser() {
$this->mTagHooks = array();
/**
* Clear Parser state
*
- * @access private
+ * @private
*/
function clearState() {
$this->mOutput = new ParserOutput;
/**
* Accessor for mUniqPrefix.
*
- * @access public
+ * @public
*/
function UniqPrefix() {
return $this->mUniqPrefix;
* Convert wikitext to HTML
* Do not call this function recursively.
*
- * @access private
+ * @private
* @param string $text Text we want to parse
* @param Title &$title A title object
* @param array $options
/**
* Get a random string
*
- * @access private
+ * @private
* @static
*/
function getRandomString() {
* If $tag is set to STRIP_COMMENTS, the function will extract
* <!-- HTML comments -->
*
- * @access private
+ * @private
* @static
*/
function extractTagsAndParams($tag, $text, &$content, &$tags, &$params, $uniq_prefix = ''){
* for cases where $tags and $params isn't needed
* i.e. where tags will never have params, like <nowiki>
*
- * @access private
+ * @private
* @static
*/
function extractTags( $tag, $text, &$content, $uniq_prefix = '' ) {
* for section editing, where these comments cause confusion when
* counting the sections in the wikisource
*
- * @access private
+ * @private
*/
function strip( $text, &$state, $stripcomments = false ) {
$render = ($this->mOutputType == OT_HTML);
* restores pre, math, and hiero removed by strip()
*
* always call unstripNoWiki() after this one
- * @access private
+ * @private
*/
function unstrip( $text, &$state ) {
if ( !is_array( $state ) ) {
/**
* always call this after unstrip() to preserve the order
*
- * @access private
+ * @private
*/
function unstripNoWiki( $text, &$state ) {
if ( !is_array( $state ) ) {
* Returns the unique tag which must be inserted into the stripped text
* The tag will be replaced with the original text in unstrip()
*
- * @access private
+ * @private
*/
function insertStripItem( $text, &$state ) {
$rnd = $this->mUniqPrefix . '-item' . Parser::getRandomString();
*
* @param string $text Hideous HTML input
* @return string Corrected HTML output
- * @access public
+ * @public
* @static
*/
function tidy( $text ) {
/**
* Spawn an external HTML tidy process and get corrected markup back from it.
*
- * @access private
+ * @private
* @static
*/
function externalTidy( $text ) {
*
* 'pear install tidy' should be able to compile the extension module.
*
- * @access private
+ * @private
* @static
*/
function internalTidy( $text ) {
/**
* parse the wiki syntax used to render tables
*
- * @access private
+ * @private
*/
function doTableStuff ( $t ) {
$fname = 'Parser::doTableStuff';
* Helper function for parse() that transforms wiki markup into
* HTML. Only called for $mOutputType == OT_HTML.
*
- * @access private
+ * @private
*/
function internalParse( $text ) {
$args = array();
* Replace special strings like "ISBN xxx" and "RFC xxx" with
* magic external links.
*
- * @access private
+ * @private
*/
function &doMagicLinks( &$text ) {
$text = $this->magicISBN( $text );
/**
* Parse headers and return html
*
- * @access private
+ * @private
*/
function doHeadings( $text ) {
$fname = 'Parser::doHeadings';
/**
* Replace single quotes with HTML markup
- * @access private
+ * @private
* @return string the altered text
*/
function doAllQuotes( $text ) {
/**
* Helper function for doAllQuotes()
- * @access private
+ * @private
*/
function doQuotes( $text ) {
$arr = preg_split( "/(''+)/", $text, -1, PREG_SPLIT_DELIM_CAPTURE );
* Note: this is all very hackish and the order of execution matters a lot.
* Make sure to run maintenance/parserTests.php if you change this code.
*
- * @access private
+ * @private
*/
function replaceExternalLinks( $text ) {
global $wgContLang;
/**
* Replace anything that looks like a URL with a link
- * @access private
+ * @private
*/
function replaceFreeExternalLinks( $text ) {
global $wgContLang;
preg_match( '/^('.EXT_LINK_URL_CLASS.'+)(.*)$/s', $bits[$i + 1], $m ))
{
# add protocol, arg
- $url .= $bits[$i] . $bits[$i + 1]; # protocol, url as arg to previous link
+ $url .= $bits[$i] . $m[1]; # protocol, url as arg to previous link
$i += 2;
$trail = $m[2];
}
* Callback function used in replaceUnusualEscapes().
* Replaces unusual URL escape codes with their equivalent character
* @static
- * @access private
+ * @private
*/
function replaceUnusualEscapesCallback( $matches ) {
$char = urldecode( $matches[0] );
/**
* make an image if it's allowed, either through the global
* option or through the exception
- * @access private
+ * @private
*/
function maybeMakeExternalImage( $url ) {
$sk =& $this->mOptions->getSkin();
/**
* Process [[ ]] wikilinks
*
- * @access private
+ * @private
*/
function replaceInternalLinks( $s ) {
global $wgContLang;
* @param string $target the source of the link
* @param string &$text the link text, modified as necessary
* @return string the full name of the link
- * @access private
+ * @private
*/
function maybeDoSubpageLink($target, &$text) {
# Valid link forms:
/**#@+
* Used by doBlockLevels()
- * @access private
+ * @private
*/
/* private */ function closeParagraph() {
$result = '';
/**
* Make lists from lines starting with ':', '*', '#', etc.
*
- * @access private
+ * @private
* @return string the lists rendered as HTML
*/
function doBlockLevels( $text, $linestart ) {
'<td|<th|<div|<\\/div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix.'-pre|<\\/li|<\\/ul)/iS', $t );
if ( $openmatch or $closematch ) {
$paragraphStack = false;
+ # TODO bug 5718: paragraph closed
$output .= $this->closeParagraph();
if ( $preOpenMatch and !$preCloseMatch ) {
$this->mInPre = true;
/**
* Return value of a magic variable (like PAGENAME)
*
- * @access private
+ * @private
*/
function getVariableValue( $index ) {
global $wgContLang, $wgSitename, $wgServer, $wgServerName, $wgScriptPath;
return $this->mTitle->getSubpageText();
case MAG_SUBPAGENAMEE:
return $this->mTitle->getSubpageUrlForm();
+ case MAG_TALKPAGENAME:
+ if( $this->mTitle->canTalk() ) {
+ $talkPage = $this->mTitle->getTalkPage();
+ return $talkPage->getPrefixedText();
+ } else {
+ return '';
+ }
+ case MAG_TALKPAGENAMEE:
+ if( $this->mTitle->canTalk() ) {
+ $talkPage = $this->mTitle->getTalkPage();
+ return $talkPage->getPrefixedUrl();
+ } else {
+ return '';
+ }
+ case MAG_SUBJECTPAGENAME:
+ $subjPage = $this->mTitle->getSubjectPage();
+ return $subjPage->getPrefixedText();
+ case MAG_SUBJECTPAGENAMEE:
+ $subjPage = $this->mTitle->getSubjectPage();
+ return $subjPage->getPrefixedUrl();
case MAG_REVISIONID:
return $this->mRevisionId;
case MAG_NAMESPACE:
return $wgContLang->getNsText( $this->mTitle->getNamespace() );
case MAG_NAMESPACEE:
return wfUrlencode( $wgContLang->getNsText( $this->mTitle->getNamespace() ) );
+ case MAG_TALKSPACE:
+ return $this->mTitle->canTalk() ? $this->mTitle->getTalkNsText() : '';
+ case MAG_TALKSPACEE:
+ return $this->mTitle->canTalk() ? wfUrlencode( $this->mTitle->getTalkNsText() ) : '';
+ case MAG_SUBJECTSPACE:
+ return $this->mTitle->getSubjectNsText();
+ case MAG_SUBJECTSPACEE:
+ return( wfUrlencode( $this->mTitle->getSubjectNsText() ) );
case MAG_CURRENTDAYNAME:
return $varCache[$index] = $wgContLang->getWeekdayName( date( 'w', $ts ) + 1 );
case MAG_CURRENTYEAR:
return $varCache[$index] = $wgContLang->formatNum( wfNumberOfArticles() );
case MAG_NUMBEROFFILES:
return $varCache[$index] = $wgContLang->formatNum( wfNumberOfFiles() );
+ case MAG_NUMBEROFUSERS:
+ return $varCache[$index] = $wgContLang->formatNum( wfNumberOfUsers() );
case MAG_SITENAME:
return $wgSitename;
case MAG_SERVER:
/**
* initialise the magic variables (like CURRENTMONTHNAME)
*
- * @access private
+ * @private
*/
function initialiseVariables() {
$fname = 'Parser::initialiseVariables';
* 4 => callback # replacement callback to call if {{{{..}}}} is found
* )
* )
- * @access private
+ * @private
*/
function replace_callback ($text, $callbacks) {
$openingBraceStack = array(); # this array will hold a stack of parentheses which are not closed yet
* @param string $tex The text to transform
* @param array $args Key-value pairs representing template parameters to substitute
* @param bool $argsOnly Only do argument (triple-brace) expansion, not double-brace expansion
- * @access private
+ * @private
*/
function replaceVariables( $text, $args = array(), $argsOnly = false ) {
# Prevent too big inclusions
/**
* Replace magic variables
- * @access private
+ * @private
*/
function variableSubstitution( $matches ) {
$fname = 'Parser::variableSubstitution';
* $piece['title']: the title, i.e. the part before the |
* $piece['parts']: the parameter array
* @return string the text of the template
- * @access private
+ * @private
*/
function braceSubstitution( $piece ) {
- global $wgContLang, $wgAllowDisplayTitle;
+ global $wgContLang, $wgLang, $wgAllowDisplayTitle, $action;
$fname = 'Parser::braceSubstitution';
wfProfileIn( $fname );
}
}
+ $lang = $this->mOptions->getInterfaceMessage() ? $wgLang : $wgContLang;
# GRAMMAR
if ( !$found && $argc == 1 ) {
$mwGrammar =& MagicWord::get( MAG_GRAMMAR );
if ( $mwGrammar->matchStartAndRemove( $part1 ) ) {
- $text = $linestart . $wgContLang->convertGrammar( $args[0], $part1 );
+ $text = $linestart . $lang->convertGrammar( $args[0], $part1 );
$found = true;
}
}
$mwPluralForm =& MagicWord::get( MAG_PLURAL );
if ( $mwPluralForm->matchStartAndRemove( $part1 ) ) {
if ($argc==2) {$args[2]=$args[1];}
- $text = $linestart . $wgContLang->convertPlural( $part1, $args[0], $args[1], $args[2]);
+ $text = $linestart . $lang->convertPlural( $part1, $args[0], $args[1], $args[2]);
$found = true;
}
}
# DISPLAYTITLE
if ( !$found && $argc == 1 && $wgAllowDisplayTitle ) {
- global $wgOut;
-
- # Only the first one counts...
- if ( $wgOut->mPageLinkTitle == "" ) {
- $param = $args[0];
+ $mwDT =& MagicWord::get( MAG_DISPLAYTITLE );
+ if ( $mwDT->matchStartAndRemove( $part1 ) ) {
+
+ # Set title in parser output object
+ $param = $args[0];
$parserOptions = new ParserOptions;
$local_parser = new Parser ();
$t2 = $local_parser->parse ( $param, $this->mTitle, $parserOptions, false );
- $wgOut->mPageLinkTitle = $wgOut->getPageTitle();
- $wgOut->mPagetitle = $t2->GetText();
+ $this->mOutput->mHTMLtitle = $t2->GetText();
# Add subtitle
$t = $this->mTitle->getPrefixedText();
- $st = trim ( $wgOut->getSubtitle () );
- if ( $st != "" ) $st .= " ";
- $st .= str_replace ( "$1", $t, wfMsg('displaytitle') );
- $wgOut->setSubtitle ( $st );
+ $this->mOutput->mSubtitle .= wfMsg('displaytitle', $t);
+ $text = "" ;
+ $found = true ;
}
- $text = "" ;
- $found = true ;
}
+ # NUMBEROFUSERS, NUMBEROFARTICLES, and NUMBEROFFILES
+ if( !$found ) {
+ $mwWordsToCheck = array( MAG_NUMBEROFUSERS => 'wfNumberOfUsers', MAG_NUMBEROFARTICLES => 'wfNumberOfArticles', MAG_NUMBEROFFILES => 'wfNumberOfFiles' );
+ foreach( $mwWordsToCheck as $word => $func ) {
+ $mwCurrentWord =& MagicWord::get( $word );
+ if( $mwCurrentWord->matchStartAndRemove( $part1 ) ) {
+ $mwRawSuffix =& MagicWord::get( MAG_RAWSUFFIX );
+ if( $mwRawSuffix->match( $args[0] ) ) {
+ # Raw and unformatted
+ $text = $linestart . call_user_func( $func );
+ } else {
+ # Formatted according to the content default
+ $text = $linestart . $wgContLang->formatNum( call_user_func( $func ) );
+ }
+ $found = true;
+ }
+ }
+ }
+
+ /*$mwNumUsers =& MagicWord::get( MAG_NUMBEROFUSERS );
+ if( $mwNumUsers->matchStartAndRemove( $part1 ) ) {
+ $mwRawSuffix =& MagicWord::get( MAG_RAWSUFFIX );
+ if( $mwRawSuffix->match( $args[0] ) ) {
+ # Raw and unformatted
+ $text = $linestart . wfNumberOfUsers();
+ } else {
+ # Default; formatted form
+ $text = $linestart . $wgContLang->formatNum( wfNumberOfUsers() );
+ }
+ $found = true;
+ }
+ }*/
+
# Extensions
if ( !$found && substr( $part1, 0, 1 ) == '#' ) {
$colonPos = strpos( $part1, ':' );
if ( $colonPos !== false ) {
$function = strtolower( substr( $part1, 1, $colonPos - 1 ) );
if ( isset( $this->mFunctionHooks[$function] ) ) {
- $funcArgs = array_merge( array( &$this, substr( $part1, $colonPos + 1 ) ), $args );
+ $funcArgs = array_map( 'trim', $args );
+ $funcArgs = array_merge( array( &$this, trim( substr( $part1, $colonPos + 1 ) ) ), $funcArgs );
$result = call_user_func_array( $this->mFunctionHooks[$function], $funcArgs );
$found = true;
+
+ // The text is usually already parsed, doesn't need triple-brace tags expanded, etc.
+ //$noargs = true;
+ //$noparse = true;
+
if ( is_array( $result ) ) {
$text = $linestart . $result[0];
unset( $result[0] );
if ( $nowiki && $found && $this->mOutputType == OT_HTML ) {
$text = wfEscapeWikiText( $text );
} elseif ( ($this->mOutputType == OT_HTML || $this->mOutputType == OT_WIKI) && $found ) {
- if ( !$noargs ) {
+ if ( $noargs ) {
+ $assocArgs = array();
+ } else {
# Clean up argument array
$assocArgs = array();
$index = 1;
/**
* Triple brace replacement -- used for template arguments
- * @access private
+ * @private
*/
function argSubstitution( $matches ) {
$arg = trim( $matches['title'] );
/**
* Returns true if the function is allowed to include this entity
- * @access private
+ * @private
*/
function incrementIncludeCount( $dbk ) {
if ( !array_key_exists( $dbk, $this->mIncludeCount ) ) {
*
* @param string $text
* @param boolean $isMain
- * @access private
+ * @private
*/
function formatHeadings( $text, $isMain=true ) {
global $wgMaxTocLevel, $wgContLang;
$doShowToc = false;
}
+ # Allow user to stipulate that a page should have a "new section"
+ # link added via __NEWSECTIONLINK__
+ $mw =& MagicWord::get( MAG_NEWSECTIONLINK );
+ if( $mw->matchAndRemove( $text ) )
+ $this->mOutput->setNewSection( true );
+
# if the string __TOC__ (not case-sensitive) occurs in the HTML,
# override above conditions and always show TOC at that place
# Increase TOC level
$toclevel++;
$sublevelCount[$toclevel] = 0;
- $toc .= $sk->tocIndent();
+ if( $toclevel<$wgMaxTocLevel ) {
+ $toc .= $sk->tocIndent();
+ }
}
elseif ( $level < $prevlevel && $toclevel > 1 ) {
# Decrease TOC level, find level to jump to
}
}
}
-
- $toc .= $sk->tocUnindent( $prevtoclevel - $toclevel );
+ if( $toclevel<$wgMaxTocLevel ) {
+ $toc .= $sk->tocUnindent( $prevtoclevel - $toclevel );
+ }
}
else {
# No change in level, end TOC line
- $toc .= $sk->tocLineEnd();
+ if( $toclevel<$wgMaxTocLevel ) {
+ $toc .= $sk->tocLineEnd();
+ }
}
$levelCount[$toclevel] = $level;
}
if( $doShowToc ) {
- $toc .= $sk->tocUnindent( $toclevel - 1 );
+ if( $toclevel<$wgMaxTocLevel ) {
+ $toc .= $sk->tocUnindent( $toclevel - 1 );
+ }
$toc = $sk->tocList( $toc );
}
/**
* Return an HTML link for the "ISBN 123456" text
- * @access private
+ * @private
*/
function magicISBN( $text ) {
$fname = 'Parser::magicISBN';
/**
* Return an HTML link for the "RFC 1234" text
*
- * @access private
+ * @private
* @param string $text Text to be processed
* @param string $keyword Magic keyword to use (default RFC)
* @param string $urlmsg Interface message to use (default rfcurl)
* @param ParserOptions $options parsing options
* @param bool $clearState whether to clear the parser state first
* @return string the altered wiki markup
- * @access public
+ * @public
*/
function preSaveTransform( $text, &$title, &$user, $options, $clearState = true ) {
$this->mOptions = $options;
);
$text = str_replace( array_keys( $pairs ), array_values( $pairs ), $text );
$text = $this->strip( $text, $stripState, true );
- $text = $this->pstPass2( $text, $user );
+ $text = $this->pstPass2( $text, $stripState, $user );
$text = $this->unstrip( $text, $stripState );
$text = $this->unstripNoWiki( $text, $stripState );
return $text;
/**
* Pre-save transform helper function
- * @access private
+ * @private
*/
- function pstPass2( $text, &$user ) {
+ function pstPass2( $text, &$stripState, &$user ) {
global $wgContLang, $wgLocaltimezone;
/* Note: This is the timestamp saved as hardcoded wikitext to
* the database, we use $wgContLang here in order to give
- * everyone the same signiture and use the default one rather
- * than the one selected in each users preferences.
+ * everyone the same signature and use the default one rather
+ * than the one selected in each user's preferences.
*/
if ( isset( $wgLocaltimezone ) ) {
$oldtz = getenv( 'TZ' );
# Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags
$text = $this->replaceVariables( $text );
+ # Strip out <nowiki> etc. added via replaceVariables
+ $text = $this->strip( $text, $stripState );
+
# Signatures
$sigText = $this->getUserSig( $user );
$text = strtr( $text, array(
*
* @param User $user
* @return string
- * @access private
+ * @private
*/
function getUserSig( &$user ) {
$username = $user->getName();
# Sig. might contain markup; validate this
if( $this->validateSig( $nickname ) !== false ) {
# Validated; clean up (if needed) and return it
- return( $this->cleanSig( $nickname ) );
+ return $this->cleanSig( $nickname, true );
} else {
# Failed to validate; fall back to the default
$nickname = $username;
* 2) Substitute all transclusions
*
* @param string $text
+ * @param $parsing Whether we're cleaning (preferences save) or parsing
* @return string Signature text
*/
- function cleanSig( $text ) {
+ function cleanSig( $text, $parsing = false ) {
+ global $wgTitle;
+ $this->startExternalParse( $wgTitle, new ParserOptions(), $parsing ? OT_WIKI : OT_MSG );
+
$substWord = MagicWord::get( MAG_SUBST );
$substRegex = '/\{\{(?!(?:' . $substWord->getBaseRegex() . '))/x' . $substWord->getRegexCase();
$substText = '{{' . $substWord->getSynonym( 0 );
$text = preg_replace( $substRegex, $substText, $text );
$text = preg_replace( '/~{3,5}/', '', $text );
$text = $this->replaceVariables( $text );
-
+
+ $this->clearState();
return $text;
}
/**
* Set up some variables which are usually set up in parse()
* so that an external function can call some class members with confidence
- * @access public
+ * @public
*/
function startExternalParse( &$title, $options, $outputType, $clearState = true ) {
$this->mTitle =& $title;
* @param string $text the text to transform
* @param ParserOptions $options options
* @return string the text with variables substituted
- * @access public
+ * @public
*/
function transformMsg( $text, $options ) {
global $wgTitle;
* Transform and return $text. Use $parser for any required context, e.g. use
* $parser->getTitle() and $parser->getOptions() not $wgTitle or $wgOut->mParserOptions
*
- * @access public
+ * @public
*
* @param mixed $tag The tag to use, e.g. 'hook' for <hook>
* @param mixed $callback The callback function (and object) to use for the tag
* noargs Don't replace triple-brace arguments in the return value
* isHTML The returned text is HTML, armour it against wikitext transformation
*
- * @access public
+ * @public
*
* @param string $name The function name. Function names are case-insensitive.
* @param mixed $callback The callback function (and object) to use
/**
* @param array $matches
* @return string
- * @access private
+ * @private
*/
function replaceLinkHoldersTextCallback( $matches ) {
$type = $matches[1];
* @param string $text
* @param array $args
* @return string
- * @access private
+ * @private
*/
function attributeStripCallback( &$text, $args ) {
$text = $this->replaceVariables( $text, $args );
$mLinks, # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken.
$mTemplates, # 2-D map of NS/DBK to ID for the template references. ID=zero for broken.
$mImages, # DB keys of the images used, in the array key only
- $mExternalLinks; # External link URLs, in the key only
+ $mExternalLinks, # External link URLs, in the key only
+ $mHTMLtitle, # Display HTML title
+ $mSubtitle, # Additional subtitle
+ $mNewSection; # Show a new section link?
function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(),
$containsOldMagic = false, $titletext = '' )
$this->mTemplates = array();
$this->mImages = array();
$this->mExternalLinks = array();
+ $this->mHTMLtitle = "" ;
+ $this->mSubtitle = "" ;
+ $this->mNewSection = false;
}
function getText() { return $this->mText; }
function addImage( $name ) { $this->mImages[$name] = 1; }
function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; }
function addExternalLink( $url ) { $this->mExternalLinks[$url] = 1; }
+
+ function setNewSection( $value ) {
+ $this->mNewSection = (bool)$value;
+ }
+ function getNewSection() {
+ return (bool)$this->mNewSection;
+ }
function addLink( $title, $id ) {
$ns = $title->getNamespace();
*
* @param string $touched the affected article's last touched timestamp
* @return bool
- * @access public
+ * @public
*/
function expired( $touched ) {
global $wgCacheEpoch;
var $mEditSection; # Create "edit section" links
var $mNumberHeadings; # Automatically number headings
var $mAllowSpecialInclusion; # Allow inclusion of special pages
- var $mTidy; # Ask for tidy cleanup
+ var $mTidy; # Ask for tidy cleanup
+ var $mInterfaceMessage; # Which lang to call for PLURAL and GRAMMAR
function getUseTeX() { return $this->mUseTeX; }
function getUseDynamicDates() { return $this->mUseDynamicDates; }
function getEditSection() { return $this->mEditSection; }
function getNumberHeadings() { return $this->mNumberHeadings; }
function getAllowSpecialInclusion() { return $this->mAllowSpecialInclusion; }
- function getTidy() { return $this->mTidy; }
+ function getTidy() { return $this->mTidy; }
+ function getInterfaceMessage() { return $this->mInterfaceMessage; }
function setUseTeX( $x ) { return wfSetVar( $this->mUseTeX, $x ); }
function setUseDynamicDates( $x ) { return wfSetVar( $this->mUseDynamicDates, $x ); }
function setEditSection( $x ) { return wfSetVar( $this->mEditSection, $x ); }
function setNumberHeadings( $x ) { return wfSetVar( $this->mNumberHeadings, $x ); }
function setAllowSpecialInclusion( $x ) { return wfSetVar( $this->mAllowSpecialInclusion, $x ); }
- function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); }
+ function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); }
function setSkin( &$x ) { $this->mSkin =& $x; }
+ function setInterfaceMessage( $x ) { return wfSetVar( $this->mInterfaceMessage, $x); }
function ParserOptions() {
global $wgUser;
$this->mNumberHeadings = $user->getOption( 'numberheadings' );
$this->mAllowSpecialInclusion = $wgAllowSpecialInclusion;
$this->mTidy = false;
+ $this->mInterfaceMessage = false;
wfProfileOut( $fname );
}
}
return $numImages;
}
+/**
+ * Return the number of user accounts
+ * @return integer
+ */
+function wfNumberOfUsers() {
+ wfProfileIn( 'wfNumberOfUsers' );
+ $dbr =& wfGetDB( DB_SLAVE );
+ $count = $dbr->selectField( 'site_stats', 'ss_users', array(), 'wfNumberOfUsers' );
+ wfProfileOut( 'wfNumberOfUsers' );
+ return (int)$count;
+}
+
/**
* Get various statistics from the database
- * @access private
+ * @private
*/
function wfLoadSiteStats() {
global $wgNumberOfArticles, $wgTotalViews, $wgTotalEdits;
* Escape html tags
* Basically replacing " > and < with HTML entities ( ", >, <)
*
- * @param string $in Text that might contain HTML tags
+ * @param $in String: text that might contain HTML tags.
* @return string Escaped string
*/
function wfEscapeHTMLTagsOnly( $in ) {