*/
public $mUsedOptions;
- var $mVersion = Parser::VERSION, # Compatibility check
+ public $mVersion = Parser::VERSION, # Compatibility check
$mCacheTime = '', # Time when this object was generated, or -1 for uncacheable. Used in ParserCache.
$mCacheExpiry = null, # Seconds after which the object should expire, use 0 for uncachable. Used in ParserCache.
$mContainsOldMagic, # Boolean variable indicating if the input contained variables like {{CURRENTDAY}}
/**
* @return string TS_MW timestamp
*/
- function getCacheTime() {
+ public function getCacheTime() {
return wfTimestamp( TS_MW, $this->mCacheTime );
}
/**
* @return bool
*/
- function containsOldMagic() {
+ public function containsOldMagic() {
return $this->mContainsOldMagic;
}
* @param bool $com
* @return bool
*/
- function setContainsOldMagic( $com ) {
+ public function setContainsOldMagic( $com ) {
return wfSetVar( $this->mContainsOldMagic, $com );
}
* @param string $t
* @return string
*/
- function setCacheTime( $t ) {
+ public function setCacheTime( $t ) {
return wfSetVar( $this->mCacheTime, $t );
}
* @since 1.23
* @return int|null Revision id, if any was set
*/
- function getCacheRevisionId() {
+ public function getCacheRevisionId() {
return $this->mCacheRevisionId;
}
* @since 1.23
* @param int $id Revision id
*/
- function setCacheRevisionId( $id ) {
+ public function setCacheRevisionId( $id ) {
$this->mCacheRevisionId = $id;
}
*
* @param int $seconds
*/
- function updateCacheExpiry( $seconds ) {
+ public function updateCacheExpiry( $seconds ) {
$seconds = (int)$seconds;
if ( $this->mCacheExpiry === null || $this->mCacheExpiry > $seconds ) {
* value of $wgParserCacheExpireTime.
* @return int|mixed|null
*/
- function getCacheExpiry() {
+ public function getCacheExpiry() {
global $wgParserCacheExpireTime;
if ( $this->mCacheTime < 0 ) {
/**
* @return bool
*/
- function isCacheable() {
+ public function isCacheable() {
return $this->getCacheExpiry() > 0;
}
* @param Parser $parser
* @return void
*/
- static function register( $parser ) {
+ public static function register( $parser ) {
global $wgAllowDisplayTitle, $wgAllowSlowParserFunctions;
# Syntax for arguments (see Parser::setFunctionHook):
* @param string $part1
* @return array
*/
- static function intFunction( $parser, $part1 = '' /*, ... */ ) {
+ public static function intFunction( $parser, $part1 = '' /*, ... */ ) {
if ( strval( $part1 ) !== '' ) {
$args = array_slice( func_get_args(), 2 );
$message = wfMessage( $part1, $args )
*
* @return string
*/
- static function formatDate( $parser, $date, $defaultPref = null ) {
+ public static function formatDate( $parser, $date, $defaultPref = null ) {
$lang = $parser->getFunctionLang();
$df = DateFormatter::getInstance( $lang );
return $date;
}
- static function ns( $parser, $part1 = '' ) {
+ public static function ns( $parser, $part1 = '' ) {
global $wgContLang;
if ( intval( $part1 ) || $part1 == "0" ) {
$index = intval( $part1 );
}
}
- static function nse( $parser, $part1 = '' ) {
+ public static function nse( $parser, $part1 = '' ) {
$ret = self::ns( $parser, $part1 );
if ( is_string( $ret ) ) {
$ret = wfUrlencode( str_replace( ' ', '_', $ret ) );
* @param string $arg (optional): The type of encoding.
* @return string
*/
- static function urlencode( $parser, $s = '', $arg = null ) {
+ public static function urlencode( $parser, $s = '', $arg = null ) {
static $magicWords = null;
if ( is_null( $magicWords ) ) {
$magicWords = new MagicWordArray( array( 'url_path', 'url_query', 'url_wiki' ) );
return $parser->markerSkipCallback( $s, $func );
}
- static function lcfirst( $parser, $s = '' ) {
+ public static function lcfirst( $parser, $s = '' ) {
global $wgContLang;
return $wgContLang->lcfirst( $s );
}
- static function ucfirst( $parser, $s = '' ) {
+ public static function ucfirst( $parser, $s = '' ) {
global $wgContLang;
return $wgContLang->ucfirst( $s );
}
* @param string $s
* @return string
*/
- static function lc( $parser, $s = '' ) {
+ public static function lc( $parser, $s = '' ) {
global $wgContLang;
return $parser->markerSkipCallback( $s, array( $wgContLang, 'lc' ) );
}
* @param string $s
* @return string
*/
- static function uc( $parser, $s = '' ) {
+ public static function uc( $parser, $s = '' ) {
global $wgContLang;
return $parser->markerSkipCallback( $s, array( $wgContLang, 'uc' ) );
}
- static function localurl( $parser, $s = '', $arg = null ) {
+ public static function localurl( $parser, $s = '', $arg = null ) {
return self::urlFunction( 'getLocalURL', $s, $arg );
}
- static function localurle( $parser, $s = '', $arg = null ) {
+ public static function localurle( $parser, $s = '', $arg = null ) {
$temp = self::urlFunction( 'getLocalURL', $s, $arg );
if ( !is_string( $temp ) ) {
return $temp;
}
}
- static function fullurl( $parser, $s = '', $arg = null ) {
+ public static function fullurl( $parser, $s = '', $arg = null ) {
return self::urlFunction( 'getFullURL', $s, $arg );
}
- static function fullurle( $parser, $s = '', $arg = null ) {
+ public static function fullurle( $parser, $s = '', $arg = null ) {
$temp = self::urlFunction( 'getFullURL', $s, $arg );
if ( !is_string( $temp ) ) {
return $temp;
}
}
- static function canonicalurl( $parser, $s = '', $arg = null ) {
+ public static function canonicalurl( $parser, $s = '', $arg = null ) {
return self::urlFunction( 'getCanonicalURL', $s, $arg );
}
- static function canonicalurle( $parser, $s = '', $arg = null ) {
+ public static function canonicalurle( $parser, $s = '', $arg = null ) {
$temp = self::urlFunction( 'getCanonicalURL', $s, $arg );
if ( !is_string( $temp ) ) {
return $temp;
}
}
- static function urlFunction( $func, $s = '', $arg = null ) {
+ public static function urlFunction( $func, $s = '', $arg = null ) {
$title = Title::newFromText( $s );
# Due to order of execution of a lot of bits, the values might be encoded
# before arriving here; if that's true, then the title can't be created
* @param string $arg
* @return string
*/
- static function formatnum( $parser, $num = '', $arg = null ) {
+ public static function formatnum( $parser, $num = '', $arg = null ) {
if ( self::matchAgainstMagicword( 'rawsuffix', $arg ) ) {
$func = array( $parser->getFunctionLang(), 'parseFormattedNumber' );
} elseif ( self::matchAgainstMagicword( 'nocommafysuffix', $arg ) ) {
* @param string $word
* @return string
*/
- static function grammar( $parser, $case = '', $word = '' ) {
+ public static function grammar( $parser, $case = '', $word = '' ) {
$word = $parser->killMarkers( $word );
return $parser->getFunctionLang()->convertGrammar( $word, $case );
}
* @param string $username
* @return string
*/
- static function gender( $parser, $username ) {
+ public static function gender( $parser, $username ) {
wfProfileIn( __METHOD__ );
$forms = array_slice( func_get_args(), 2 );
* @param string $text
* @return string
*/
- static function plural( $parser, $text = '' ) {
+ public static function plural( $parser, $text = '' ) {
$forms = array_slice( func_get_args(), 2 );
$text = $parser->getFunctionLang()->parseFormattedNumber( $text );
settype( $text, ctype_digit( $text ) ? 'int' : 'float' );
*
* @param Parser $parser Parent parser
* @param string $text Desired title text
+ * @param string $uarg
* @return string
*/
- static function displaytitle( $parser, $text = '', $uarg = '' ) {
+ public static function displaytitle( $parser, $text = '', $uarg = '' ) {
global $wgRestrictDisplayTitle;
static $magicWords = null;
return $mwObject->matchStartToEnd( $value );
}
- static function formatRaw( $num, $raw ) {
+ public static function formatRaw( $num, $raw ) {
if ( self::matchAgainstMagicword( 'rawsuffix', $raw ) ) {
return $num;
} else {
return $wgContLang->formatNum( $num );
}
}
- static function numberofpages( $parser, $raw = null ) {
+ public static function numberofpages( $parser, $raw = null ) {
return self::formatRaw( SiteStats::pages(), $raw );
}
- static function numberofusers( $parser, $raw = null ) {
+ public static function numberofusers( $parser, $raw = null ) {
return self::formatRaw( SiteStats::users(), $raw );
}
- static function numberofactiveusers( $parser, $raw = null ) {
+ public static function numberofactiveusers( $parser, $raw = null ) {
return self::formatRaw( SiteStats::activeUsers(), $raw );
}
- static function numberofarticles( $parser, $raw = null ) {
+ public static function numberofarticles( $parser, $raw = null ) {
return self::formatRaw( SiteStats::articles(), $raw );
}
- static function numberoffiles( $parser, $raw = null ) {
+ public static function numberoffiles( $parser, $raw = null ) {
return self::formatRaw( SiteStats::images(), $raw );
}
- static function numberofadmins( $parser, $raw = null ) {
+ public static function numberofadmins( $parser, $raw = null ) {
return self::formatRaw( SiteStats::numberingroup( 'sysop' ), $raw );
}
- static function numberofedits( $parser, $raw = null ) {
+ public static function numberofedits( $parser, $raw = null ) {
return self::formatRaw( SiteStats::edits(), $raw );
}
- static function numberofviews( $parser, $raw = null ) {
+ public static function numberofviews( $parser, $raw = null ) {
global $wgDisableCounters;
return !$wgDisableCounters ? self::formatRaw( SiteStats::views(), $raw ) : '';
}
- static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
+ public static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
return self::formatRaw( SiteStats::pagesInNs( intval( $namespace ) ), $raw );
}
- static function numberingroup( $parser, $name = '', $raw = null ) {
+ public static function numberingroup( $parser, $name = '', $raw = null ) {
return self::formatRaw( SiteStats::numberingroup( strtolower( $name ) ), $raw );
}
* @param string $title
* @return mixed|string
*/
- static function mwnamespace( $parser, $title = null ) {
+ public static function mwnamespace( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return str_replace( '_', ' ', $t->getNsText() );
}
- static function namespacee( $parser, $title = null ) {
+ public static function namespacee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return wfUrlencode( $t->getNsText() );
}
- static function namespacenumber( $parser, $title = null ) {
+ public static function namespacenumber( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return $t->getNamespace();
}
- static function talkspace( $parser, $title = null ) {
+ public static function talkspace( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canTalk() ) {
return '';
}
return str_replace( '_', ' ', $t->getTalkNsText() );
}
- static function talkspacee( $parser, $title = null ) {
+ public static function talkspacee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canTalk() ) {
return '';
}
return wfUrlencode( $t->getTalkNsText() );
}
- static function subjectspace( $parser, $title = null ) {
+ public static function subjectspace( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return str_replace( '_', ' ', $t->getSubjectNsText() );
}
- static function subjectspacee( $parser, $title = null ) {
+ public static function subjectspacee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
* @param string $title
* @return string
*/
- static function pagename( $parser, $title = null ) {
+ public static function pagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return wfEscapeWikiText( $t->getText() );
}
- static function pagenamee( $parser, $title = null ) {
+ public static function pagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return wfEscapeWikiText( $t->getPartialURL() );
}
- static function fullpagename( $parser, $title = null ) {
+ public static function fullpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canTalk() ) {
return '';
}
return wfEscapeWikiText( $t->getPrefixedText() );
}
- static function fullpagenamee( $parser, $title = null ) {
+ public static function fullpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canTalk() ) {
return '';
}
return wfEscapeWikiText( $t->getPrefixedURL() );
}
- static function subpagename( $parser, $title = null ) {
+ public static function subpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return wfEscapeWikiText( $t->getSubpageText() );
}
- static function subpagenamee( $parser, $title = null ) {
+ public static function subpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return wfEscapeWikiText( $t->getSubpageUrlForm() );
}
- static function rootpagename( $parser, $title = null ) {
+ public static function rootpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return wfEscapeWikiText( $t->getRootText() );
}
- static function rootpagenamee( $parser, $title = null ) {
+ public static function rootpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getRootText() ) ) );
}
- static function basepagename( $parser, $title = null ) {
+ public static function basepagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return wfEscapeWikiText( $t->getBaseText() );
}
- static function basepagenamee( $parser, $title = null ) {
+ public static function basepagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) ) );
}
- static function talkpagename( $parser, $title = null ) {
+ public static function talkpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canTalk() ) {
return '';
}
return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
}
- static function talkpagenamee( $parser, $title = null ) {
+ public static function talkpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canTalk() ) {
return '';
}
return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() );
}
- static function subjectpagename( $parser, $title = null ) {
+ public static function subjectpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedText() );
}
- static function subjectpagenamee( $parser, $title = null ) {
+ public static function subjectpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
* @param string $arg2
* @return string
*/
- static function pagesincategory( $parser, $name = '', $arg1 = null, $arg2 = null ) {
+ public static function pagesincategory( $parser, $name = '', $arg1 = null, $arg2 = null ) {
global $wgContLang;
static $magicWords = null;
if ( is_null( $magicWords ) ) {
* @param string $raw Should number be human readable with commas or just number
* @return string
*/
- static function pagesize( $parser, $page = '', $raw = null ) {
+ public static function pagesize( $parser, $page = '', $raw = null ) {
$title = Title::newFromText( $page );
if ( !is_object( $title ) ) {
*
* @return string
*/
- static function protectionlevel( $parser, $type = '', $title = '' ) {
+ public static function protectionlevel( $parser, $type = '', $title = '' ) {
$titleObject = Title::newFromText( $title );
if ( !( $titleObject instanceof Title ) ) {
$titleObject = $parser->mTitle;
* @param string $inLanguage Language code (in which to get name)
* @return string
*/
- static function language( $parser, $code = '', $inLanguage = '' ) {
+ public static function language( $parser, $code = '', $inLanguage = '' ) {
$code = strtolower( $code );
$inLanguage = strtolower( $inLanguage );
$lang = Language::fetchLanguageName( $code, $inLanguage );
* @param int $direction
* @return string
*/
- static function pad( $parser, $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) {
+ public static function pad( $parser, $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) {
$padding = $parser->killMarkers( $padding );
$lengthOfPadding = mb_strlen( $padding );
if ( $lengthOfPadding == 0 ) {
}
}
- static function padleft( $parser, $string = '', $length = 0, $padding = '0' ) {
+ public static function padleft( $parser, $string = '', $length = 0, $padding = '0' ) {
return self::pad( $parser, $string, $length, $padding, STR_PAD_LEFT );
}
- static function padright( $parser, $string = '', $length = 0, $padding = '0' ) {
+ public static function padright( $parser, $string = '', $length = 0, $padding = '0' ) {
return self::pad( $parser, $string, $length, $padding );
}
* @param string $text
* @return string
*/
- static function anchorencode( $parser, $text ) {
+ public static function anchorencode( $parser, $text ) {
$text = $parser->killMarkers( $text );
return (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
}
- static function special( $parser, $text ) {
+ public static function special( $parser, $text ) {
list( $page, $subpage ) = SpecialPageFactory::resolveAlias( $text );
if ( $page ) {
$title = SpecialPage::getTitleFor( $page, $subpage );
}
}
- static function speciale( $parser, $text ) {
+ public static function speciale( $parser, $text ) {
return wfUrlencode( str_replace( ' ', '_', self::special( $parser, $text ) ) );
}
* @param Parser $parser
* @return void
*/
- static function register( $parser ) {
+ public static function register( $parser ) {
global $wgRawHtml;
$parser->setHook( 'pre', array( __CLASS__, 'pre' ) );
$parser->setHook( 'nowiki', array( __CLASS__, 'nowiki' ) );
* @param Parser $parser
* @return string HTML
*/
- static function pre( $text, $attribs, $parser ) {
+ public static function pre( $text, $attribs, $parser ) {
// Backwards-compatibility hack
$content = StringUtils::delimiterReplace( '<nowiki>', '</nowiki>', '$1', $text, 'i' );
* @throws MWException
* @return array
*/
- static function html( $content, $attributes, $parser ) {
+ public static function html( $content, $attributes, $parser ) {
global $wgRawHtml;
if ( $wgRawHtml ) {
return array( $content, 'markerType' => 'nowiki' );
* @param Parser $parser
* @return array
*/
- static function nowiki( $content, $attributes, $parser ) {
+ public static function nowiki( $content, $attributes, $parser ) {
$content = strtr( $content, array( '-{' => '-{', '}-' => '}-' ) );
return array( Xml::escapeTagsOnly( $content ), 'markerType' => 'nowiki' );
}
* @param Parser $parser
* @return string HTML
*/
- static function gallery( $content, $attributes, $parser ) {
+ public static function gallery( $content, $attributes, $parser ) {
return $parser->renderImageGallery( $content, $attributes );
}
}
* @ingroup Parser
*/
class DateFormatter {
- var $mSource, $mTarget;
- var $monthNames = '', $rxDM, $rxMD, $rxDMY, $rxYDM, $rxMDY, $rxYMD;
+ public $mSource, $mTarget;
+ public $monthNames = '', $rxDM, $rxMD, $rxDMY, $rxYDM, $rxMDY, $rxYMD;
- var $regexes, $pDays, $pMonths, $pYears;
- var $rules, $xMonths, $preferences;
+ public $regexes, $pDays, $pMonths, $pYears;
+ public $rules, $xMonths, $preferences;
protected $lang;
/**
* @param Language $lang In which language to format the date
*/
- function __construct( Language $lang ) {
+ public function __construct( Language $lang ) {
$this->lang = $lang;
$this->monthNames = $this->getMonthRegex();
*
* @return string
*/
- function reformat( $preference, $text, $options = array( 'linked' ) ) {
+ public function reformat( $preference, $text, $options = array( 'linked' ) ) {
$linked = in_array( 'linked', $options );
$match_whole = in_array( 'match-whole', $options );
* @param array $matches
* @return string
*/
- function replace( $matches ) {
+ public function replace( $matches ) {
# Extract information from $matches
$linked = true;
if ( isset( $this->mLinked ) ) {
* @param bool $link
* @return string
*/
- function formatDate( $bits, $link = true ) {
+ public function formatDate( $bits, $link = true ) {
$format = $this->targets[$this->mTarget];
if ( !$link ) {
* @todo document
* @return string
*/
- function getMonthRegex() {
+ public function getMonthRegex() {
$names = array();
for ( $i = 1; $i <= 12; $i++ ) {
$names[] = $this->lang->getMonthName( $i );
* @param string $monthName Month name
* @return string ISO month name
*/
- function makeIsoMonth( $monthName ) {
+ public function makeIsoMonth( $monthName ) {
$n = $this->xMonths[$this->lang->lc( $monthName )];
return sprintf( '%02d', $n );
}
* @param string $year Year name
* @return string ISO year name
*/
- function makeIsoYear( $year ) {
+ public function makeIsoYear( $year ) {
# Assumes the year is in a nice format, as enforced by the regex
if ( substr( $year, -2 ) == 'BC' ) {
$num = intval( substr( $year, 0, -3 ) ) - 1;
* @param string $iso
* @return int|string
*/
- function makeNormalYear( $iso ) {
+ public function makeNormalYear( $iso ) {
if ( $iso[0] == '-' ) {
$text = ( intval( substr( $iso, 1 ) ) + 1 ) . ' BC';
} else {
* @ingroup Parser
*/
class LinkHolderArray {
- var $internals = array(), $interwikis = array();
- var $size = 0;
+ public $internals = array();
+ public $interwikis = array();
+ public $size = 0;
/**
* @var Parser
*/
- var $parent;
+ public $parent;
protected $tempIdOffset;
/**
* @param Parser $parent
*/
- function __construct( $parent ) {
+ public function __construct( $parent ) {
$this->parent = $parent;
}
/**
* Reduce memory usage to reduce the impact of circular references
*/
- function __destruct() {
+ public function __destruct() {
foreach ( $this as $name => $value ) {
unset( $this->$name );
}
* Compact the titles, only serialize the text form.
* @return array
*/
- function __sleep() {
+ public function __sleep() {
foreach ( $this->internals as &$nsLinks ) {
foreach ( $nsLinks as &$entry ) {
unset( $entry['title'] );
/**
* Recreate the Title objects
*/
- function __wakeup() {
+ public function __wakeup() {
foreach ( $this->internals as &$nsLinks ) {
foreach ( $nsLinks as &$entry ) {
$entry['title'] = Title::newFromText( $entry['pdbk'] );
* Merge another LinkHolderArray into this one
* @param LinkHolderArray $other
*/
- function merge( $other ) {
+ public function merge( $other ) {
foreach ( $other->internals as $ns => $entries ) {
$this->size += count( $entries );
if ( !isset( $this->internals[$ns] ) ) {
* @param array $texts Array of strings
* @return array
*/
- function mergeForeign( $other, $texts ) {
+ public function mergeForeign( $other, $texts ) {
$this->tempIdOffset = $idOffset = $this->parent->nextLinkID();
$maxId = 0;
* @param string $text
* @return LinkHolderArray
*/
- function getSubArray( $text ) {
+ public function getSubArray( $text ) {
$sub = new LinkHolderArray( $this->parent );
# Internal links
* Returns true if the memory requirements of this object are getting large
* @return bool
*/
- function isBig() {
+ public function isBig() {
global $wgLinkHolderBatchSize;
return $this->size > $wgLinkHolderBatchSize;
}
* Clear all stored link holders.
* Make sure you don't have any text left using these link holders, before you call this
*/
- function clear() {
+ public function clear() {
$this->internals = array();
$this->interwikis = array();
$this->size = 0;
* @param string $prefix [optional]
* @return string
*/
- function makeHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
+ public function makeHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
wfProfileIn( __METHOD__ );
if ( !is_object( $nt ) ) {
# Fail gracefully
* @param string $text
* @return array Array of link CSS classes, indexed by PDBK.
*/
- function replace( &$text ) {
+ public function replace( &$text ) {
wfProfileIn( __METHOD__ );
/** @todo FIXME: replaceInternal doesn't return a value */
* @param string $text
* @return string
*/
- function replaceText( $text ) {
+ public function replaceText( $text ) {
wfProfileIn( __METHOD__ );
$text = preg_replace_callback(
* @return string
* @private
*/
- function replaceTextCallback( $matches ) {
+ public function replaceTextCallback( $matches ) {
$type = $matches[1];
$key = $matches[2];
if ( $type == 'LINK' ) {
*
* @return string
*/
- function replaceCallback( $m ) {
+ public function replaceCallback( $m ) {
$marker = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}" . Parser::MARKER_SUFFIX;
$this->mMarkerIndex++;
$this->mTokens->setPair( $marker, $m[0] );
const TOC_END = '</mw:toc>';
# Persistent:
- var $mTagHooks = array();
- var $mTransparentTagHooks = array();
- var $mFunctionHooks = array();
- var $mFunctionSynonyms = array( 0 => array(), 1 => array() );
- var $mFunctionTagHooks = array();
- var $mStripList = array();
- var $mDefaultStripList = array();
- var $mVarCache = array();
- var $mImageParams = array();
- var $mImageParamsMagicArray = array();
- var $mMarkerIndex = 0;
- var $mFirstCall = true;
+ public $mTagHooks = array();
+ public $mTransparentTagHooks = array();
+ public $mFunctionHooks = array();
+ public $mFunctionSynonyms = array( 0 => array(), 1 => array() );
+ public $mFunctionTagHooks = array();
+ public $mStripList = array();
+ public $mDefaultStripList = array();
+ public $mVarCache = array();
+ public $mImageParams = array();
+ public $mImageParamsMagicArray = array();
+ public $mMarkerIndex = 0;
+ public $mFirstCall = true;
# Initialised by initialiseVariables()
/**
* @var MagicWordArray
*/
- var $mVariables;
+ public $mVariables;
/**
* @var MagicWordArray
*/
- var $mSubstWords;
- var $mConf, $mPreprocessor, $mExtLinkBracketedRegex, $mUrlProtocols; # Initialised in constructor
+ public $mSubstWords;
+ public $mConf, $mPreprocessor, $mExtLinkBracketedRegex, $mUrlProtocols; # Initialised in constructor
# Cleared with clearState():
/**
* @var ParserOutput
*/
- var $mOutput;
- var $mAutonumber, $mDTopen;
+ public $mOutput;
+ public $mAutonumber, $mDTopen;
/**
* @var StripState
*/
- var $mStripState;
+ public $mStripState;
- var $mIncludeCount, $mArgStack, $mLastSection, $mInPre;
+ public $mIncludeCount, $mArgStack, $mLastSection, $mInPre;
/**
* @var LinkHolderArray
*/
- var $mLinkHolders;
+ public $mLinkHolders;
- var $mLinkID;
- var $mIncludeSizes, $mPPNodeCount, $mGeneratedPPNodeCount, $mHighestExpansionDepth;
- var $mDefaultSort;
- var $mTplRedirCache, $mTplDomCache, $mHeadings, $mDoubleUnderscores;
- var $mExpensiveFunctionCount; # number of expensive parser function calls
- var $mShowToc, $mForceTocPosition;
+ public $mLinkID;
+ public $mIncludeSizes, $mPPNodeCount, $mGeneratedPPNodeCount, $mHighestExpansionDepth;
+ public $mDefaultSort;
+ public $mTplRedirCache, $mTplDomCache, $mHeadings, $mDoubleUnderscores;
+ public $mExpensiveFunctionCount; # number of expensive parser function calls
+ public $mShowToc, $mForceTocPosition;
/**
* @var User
*/
- var $mUser; # User object; only used when doing pre-save transform
+ public $mUser; # User object; only used when doing pre-save transform
# Temporary
# These are variables reset at least once per parse regardless of $clearState
/**
* @var ParserOptions
*/
- var $mOptions;
+ public $mOptions;
/**
* @var Title
*/
- var $mTitle; # Title context, used for self-link rendering and similar things
- var $mOutputType; # Output type, one of the OT_xxx constants
- var $ot; # Shortcut alias, see setOutputType()
- var $mRevisionObject; # The revision object of the specified revision ID
- var $mRevisionId; # ID to display in {{REVISIONID}} tags
- var $mRevisionTimestamp; # The timestamp of the specified revision ID
- var $mRevisionUser; # User to display in {{REVISIONUSER}} tag
- var $mRevisionSize; # Size to display in {{REVISIONSIZE}} variable
- var $mRevIdForTs; # The revision ID which was used to fetch the timestamp
- var $mInputSize = false; # For {{PAGESIZE}} on current page.
+ public $mTitle; # Title context, used for self-link rendering and similar things
+ public $mOutputType; # Output type, one of the OT_xxx constants
+ public $ot; # Shortcut alias, see setOutputType()
+ public $mRevisionObject; # The revision object of the specified revision ID
+ public $mRevisionId; # ID to display in {{REVISIONID}} tags
+ public $mRevisionTimestamp; # The timestamp of the specified revision ID
+ public $mRevisionUser; # User to display in {{REVISIONUSER}} tag
+ public $mRevisionSize; # Size to display in {{REVISIONSIZE}} variable
+ public $mRevIdForTs; # The revision ID which was used to fetch the timestamp
+ public $mInputSize = false; # For {{PAGESIZE}} on current page.
/**
* @var string
*/
- var $mUniqPrefix;
+ public $mUniqPrefix;
/**
* @var array Array with the language name of each language link (i.e. the
* interwiki prefix) in the key, value arbitrary. Used to avoid sending
* duplicate language links to the ParserOutput.
*/
- var $mLangLinkLanguages;
+ public $mLangLinkLanguages;
/**
* @var bool Recursive call protection.
/**
* Reduce memory usage to reduce the impact of circular references
*/
- function __destruct() {
+ public function __destruct() {
if ( isset( $this->mLinkHolders ) ) {
unset( $this->mLinkHolders );
}
/**
* Allow extensions to clean up when the parser is cloned
*/
- function __clone() {
+ public function __clone() {
$this->mInParse = false;
wfRunHooks( 'ParserCloned', array( $this ) );
}
/**
* Do various kinds of initialisation on the first call of the parser
*/
- function firstCallInit() {
+ public function firstCallInit() {
if ( !$this->mFirstCall ) {
return;
}
*
* @private
*/
- function clearState() {
+ public function clearState() {
wfProfileIn( __METHOD__ );
if ( $this->mFirstCall ) {
$this->firstCallInit();
*
* @return string
*/
- function recursiveTagParse( $text, $frame = false ) {
+ public function recursiveTagParse( $text, $frame = false ) {
wfProfileIn( __METHOD__ );
wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) );
wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) );
* @param bool|PPFrame $frame
* @return mixed|string
*/
- function preprocess( $text, Title $title = null, ParserOptions $options, $revid = null, $frame = false ) {
+ public function preprocess( $text, Title $title = null, ParserOptions $options, $revid = null, $frame = false ) {
wfProfileIn( __METHOD__ );
$magicScopeVariable = $this->lock();
$this->startParse( $title, $options, self::OT_PREPROCESS, true );
*
* @param User|null $user User object or null (to reset)
*/
- function setUser( $user ) {
+ public function setUser( $user ) {
$this->mUser = $user;
}
*
* @param Title $t
*/
- function setTitle( $t ) {
+ public function setTitle( $t ) {
if ( !$t ) {
$t = Title::newFromText( 'NO TITLE' );
}
*
* @return Title
*/
- function getTitle() {
+ public function getTitle() {
return $this->mTitle;
}
* @param Title $x Title object or null to just get the current one
* @return Title
*/
- function Title( $x = null ) {
+ public function Title( $x = null ) {
return wfSetVar( $this->mTitle, $x );
}
*
* @param int $ot New value
*/
- function setOutputType( $ot ) {
+ public function setOutputType( $ot ) {
$this->mOutputType = $ot;
# Shortcut alias
$this->ot = array(
* @param int|null $x New value or null to just get the current one
* @return int
*/
- function OutputType( $x = null ) {
+ public function OutputType( $x = null ) {
return wfSetVar( $this->mOutputType, $x );
}
*
* @return ParserOutput
*/
- function getOutput() {
+ public function getOutput() {
return $this->mOutput;
}
*
* @return ParserOptions
*/
- function getOptions() {
+ public function getOptions() {
return $this->mOptions;
}
* @param ParserOptions $x New value or null to just get the current one
* @return ParserOptions Current ParserOptions object
*/
- function Options( $x = null ) {
+ public function Options( $x = null ) {
return wfSetVar( $this->mOptions, $x );
}
/**
* @return int
*/
- function nextLinkID() {
+ public function nextLinkID() {
return $this->mLinkID++;
}
/**
* @param int $id
*/
- function setLinkID( $id ) {
+ public function setLinkID( $id ) {
$this->mLinkID = $id;
}
* Get a language object for use in parser functions such as {{FORMATNUM:}}
* @return Language
*/
- function getFunctionLang() {
+ public function getFunctionLang() {
return $this->getTargetLanguage();
}
* Get the language object for language conversion
* @return Language|null
*/
- function getConverterLanguage() {
+ public function getConverterLanguage() {
return $this->getTargetLanguage();
}
*
* @return User
*/
- function getUser() {
+ public function getUser() {
if ( !is_null( $this->mUser ) ) {
return $this->mUser;
}
*
* @return Preprocessor
*/
- function getPreprocessor() {
+ public function getPreprocessor() {
if ( !isset( $this->mPreprocessor ) ) {
$class = $this->mPreprocessorClass;
$this->mPreprocessor = new $class( $this );
*
* @return array
*/
- function getStripList() {
+ public function getStripList() {
return $this->mStripList;
}
*
* @return string
*/
- function insertStripItem( $text ) {
+ public function insertStripItem( $text ) {
$rnd = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}-" . self::MARKER_SUFFIX;
$this->mMarkerIndex++;
$this->mStripState->addGeneral( $rnd, $text );
* @param string $text
* @return string
*/
- function doTableStuff( $text ) {
+ public function doTableStuff( $text ) {
wfProfileIn( __METHOD__ );
$lines = StringUtils::explode( "\n", $text );
*
* @return string
*/
- function internalParse( $text, $isMain = true, $frame = false ) {
+ public function internalParse( $text, $isMain = true, $frame = false ) {
wfProfileIn( __METHOD__ );
$origText = $text;
*
* @return string
*/
- function doMagicLinks( $text ) {
+ public function doMagicLinks( $text ) {
wfProfileIn( __METHOD__ );
$prots = wfUrlProtocolsWithoutProtRel();
$urlChar = self::EXT_LINK_URL_CLASS;
* @param array $m
* @return HTML|string
*/
- function magicLinkCallback( $m ) {
+ public function magicLinkCallback( $m ) {
if ( isset( $m[1] ) && $m[1] !== '' ) {
# Skip anchor
return $m[0];
* @return string HTML
* @private
*/
- function makeFreeExternalLink( $url ) {
+ public function makeFreeExternalLink( $url ) {
wfProfileIn( __METHOD__ );
$trail = '';
*
* @return string
*/
- function doHeadings( $text ) {
+ public function doHeadings( $text ) {
wfProfileIn( __METHOD__ );
for ( $i = 6; $i >= 1; --$i ) {
$h = str_repeat( '=', $i );
*
* @return string The altered text
*/
- function doAllQuotes( $text ) {
+ public function doAllQuotes( $text ) {
wfProfileIn( __METHOD__ );
$outtext = '';
$lines = StringUtils::explode( "\n", $text );
* @throws MWException
* @return string
*/
- function replaceExternalLinks( $text ) {
+ public function replaceExternalLinks( $text ) {
wfProfileIn( __METHOD__ );
$bits = preg_split( $this->mExtLinkBracketedRegex, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
* nofollow if appropriate
* @return array Associative array of HTML attributes
*/
- function getExternalLinkAttribs( $url = false ) {
+ public function getExternalLinkAttribs( $url = false ) {
$attribs = array();
$attribs['rel'] = self::getExternalLinkRel( $url, $this->mTitle );
* the URL differently; as a workaround, just use the output for
* statistical records, not for actual linking/output.
*/
- static function replaceUnusualEscapes( $url ) {
+ public static function replaceUnusualEscapes( $url ) {
return preg_replace_callback( '/%[0-9A-Fa-f]{2}/',
array( __CLASS__, 'replaceUnusualEscapesCallback' ), $url );
}
*
* @private
*/
- function replaceInternalLinks( $s ) {
+ public function replaceInternalLinks( $s ) {
$this->mLinkHolders->merge( $this->replaceInternalLinks2( $s ) );
return $s;
}
*
* @private
*/
- function replaceInternalLinks2( &$s ) {
+ public function replaceInternalLinks2( &$s ) {
global $wgExtraInterlanguageLinkPrefixes;
wfProfileIn( __METHOD__ );
* @param string $prefix
* @return string HTML-wikitext mix oh yuck
*/
- function makeKnownLinkHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
+ public function makeKnownLinkHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
list( $inside, $trail ) = Linker::splitTrail( $trail );
if ( is_string( $query ) ) {
* @param string $text More-or-less HTML
* @return string Less-or-more HTML with NOPARSE bits
*/
- function armorLinks( $text ) {
+ public function armorLinks( $text ) {
return preg_replace( '/\b((?i)' . $this->mUrlProtocols . ')/',
"{$this->mUniqPrefix}NOPARSE$1", $text );
}
* Return true if subpage links should be expanded on this page.
* @return bool
*/
- function areSubpagesAllowed() {
+ public function areSubpagesAllowed() {
# Some namespaces don't allow subpages
return MWNamespace::hasSubpages( $this->mTitle->getNamespace() );
}
* @return string The full name of the link
* @private
*/
- function maybeDoSubpageLink( $target, &$text ) {
+ public function maybeDoSubpageLink( $target, &$text ) {
return Linker::normalizeSubpageLink( $this->mTitle, $target, $text );
}
*
* @return string
*/
- function closeParagraph() {
+ public function closeParagraph() {
$result = '';
if ( $this->mLastSection != '' ) {
$result = '</' . $this->mLastSection . ">\n";
*
* @return int
*/
- function getCommon( $st1, $st2 ) {
+ public function getCommon( $st1, $st2 ) {
$fl = strlen( $st1 );
$shorter = strlen( $st2 );
if ( $fl < $shorter ) {
*
* @return string
*/
- function openList( $char ) {
+ public function openList( $char ) {
$result = $this->closeParagraph();
if ( '*' === $char ) {
*
* @return string
*/
- function nextItem( $char ) {
+ public function nextItem( $char ) {
if ( '*' === $char || '#' === $char ) {
return "</li>\n<li>";
} elseif ( ':' === $char || ';' === $char ) {
*
* @return string
*/
- function closeList( $char ) {
+ public function closeList( $char ) {
if ( '*' === $char ) {
$text = "</li></ul>";
} elseif ( '#' === $char ) {
* @private
* @return string The lists rendered as HTML
*/
- function doBlockLevels( $text, $linestart ) {
+ public function doBlockLevels( $text, $linestart ) {
wfProfileIn( __METHOD__ );
# Parsing through the text line by line. The main thing
* @throws MWException
* @return string The position of the ':', or false if none found
*/
- function findColonNoLinks( $str, &$before, &$after ) {
+ public function findColonNoLinks( $str, &$before, &$after ) {
wfProfileIn( __METHOD__ );
$pos = strpos( $str, ':' );
* @throws MWException
* @return string
*/
- function getVariableValue( $index, $frame = false ) {
+ public function getVariableValue( $index, $frame = false ) {
global $wgContLang, $wgSitename, $wgServer, $wgServerName;
global $wgArticlePath, $wgScriptPath, $wgStylePath;
*
* @private
*/
- function initialiseVariables() {
+ public function initialiseVariables() {
wfProfileIn( __METHOD__ );
$variableIDs = MagicWord::getVariableIDs();
$substIDs = MagicWord::getSubstIDs();
*
* @return PPNode
*/
- function preprocessToDom( $text, $flags = 0 ) {
+ public function preprocessToDom( $text, $flags = 0 ) {
$dom = $this->getPreprocessor()->preprocessToObj( $text, $flags );
return $dom;
}
*
* @return array
*/
- static function createAssocArgs( $args ) {
+ public static function createAssocArgs( $args ) {
$assocArgs = array();
$index = 1;
foreach ( $args as $arg ) {
* @param string|int|null $max Maximum allowed, when an explicit limit has been
* exceeded, provide the values (optional)
*/
- function limitationWarn( $limitationType, $current = '', $max = '' ) {
+ public function limitationWarn( $limitationType, $current = '', $max = '' ) {
# does no harm if $current and $max are present but are unnecessary for the message
$warning = wfMessage( "$limitationType-warning" )->numParams( $current, $max )
->inLanguage( $this->mOptions->getUserLangObj() )->text();
*
* @return array
*/
- function getTemplateDom( $title ) {
+ public function getTemplateDom( $title ) {
$cacheTitle = $title;
$titleText = $title->getPrefixedDBkey();
* @param Title $title
* @return array ( string or false, Title )
*/
- function fetchTemplateAndTitle( $title ) {
+ public function fetchTemplateAndTitle( $title ) {
// Defaults to Parser::statelessFetchTemplate()
$templateCb = $this->mOptions->getTemplateCallback();
$stuff = call_user_func( $templateCb, $title, $this );
* @param Title $title
* @return string|bool
*/
- function fetchTemplate( $title ) {
+ public function fetchTemplate( $title ) {
$rv = $this->fetchTemplateAndTitle( $title );
return $rv[0];
}
*
* @return array
*/
- static function statelessFetchTemplate( $title, $parser = false ) {
+ public static function statelessFetchTemplate( $title, $parser = false ) {
$text = $skip = false;
$finalTitle = $title;
$deps = array();
* @param array $options Array of options to RepoGroup::findFile
* @return File|bool
*/
- function fetchFile( $title, $options = array() ) {
+ public function fetchFile( $title, $options = array() ) {
$res = $this->fetchFileAndTitle( $title, $options );
return $res[0];
}
* @param array $options Array of options to RepoGroup::findFile
* @return array ( File or false, Title of file )
*/
- function fetchFileAndTitle( $title, $options = array() ) {
+ public function fetchFileAndTitle( $title, $options = array() ) {
$file = $this->fetchFileNoRegister( $title, $options );
$time = $file ? $file->getTimestamp() : false;
*
* @return string
*/
- function interwikiTransclude( $title, $action ) {
+ public function interwikiTransclude( $title, $action ) {
global $wgEnableScaryTranscluding;
if ( !$wgEnableScaryTranscluding ) {
* @param string $url
* @return mixed|string
*/
- function fetchScaryTemplateMaybeFromCache( $url ) {
+ public function fetchScaryTemplateMaybeFromCache( $url ) {
global $wgTranscludeCacheExpiry;
$dbr = wfGetDB( DB_SLAVE );
$tsCond = $dbr->timestamp( time() - $wgTranscludeCacheExpiry );
*
* @return array
*/
- function argSubstitution( $piece, $frame ) {
+ public function argSubstitution( $piece, $frame ) {
wfProfileIn( __METHOD__ );
$error = false;
* @throws MWException
* @return string
*/
- function extensionSubstitution( $params, $frame ) {
+ public function extensionSubstitution( $params, $frame ) {
$name = $frame->expand( $params['name'] );
$attrText = !isset( $params['attr'] ) ? null : $frame->expand( $params['attr'] );
$content = !isset( $params['inner'] ) ? null : $frame->expand( $params['inner'] );
* @param int $size The size of the text
* @return bool False if this inclusion would take it over the maximum, true otherwise
*/
- function incrementIncludeSize( $type, $size ) {
+ public function incrementIncludeSize( $type, $size ) {
if ( $this->mIncludeSizes[$type] + $size > $this->mOptions->getMaxIncludeSize() ) {
return false;
} else {
*
* @return bool False if the limit has been exceeded
*/
- function incrementExpensiveFunctionCount() {
+ public function incrementExpensiveFunctionCount() {
$this->mExpensiveFunctionCount++;
return $this->mExpensiveFunctionCount <= $this->mOptions->getExpensiveParserFunctionLimit();
}
*
* @return string
*/
- function doDoubleUnderscore( $text ) {
+ public function doDoubleUnderscore( $text ) {
wfProfileIn( __METHOD__ );
# The position of __TOC__ needs to be recorded
* @return mixed|string
* @private
*/
- function formatHeadings( $text, $origText, $isMain = true ) {
+ public function formatHeadings( $text, $origText, $isMain = true ) {
global $wgMaxTocLevel, $wgExperimentalHtmlIds;
# Inhibit editsection links if requested in the page
* or null to use default value
* @return string
*/
- function getUserSig( &$user, $nickname = false, $fancySig = null ) {
+ public function getUserSig( &$user, $nickname = false, $fancySig = null ) {
global $wgMaxSigChars;
$username = $user->getName();
* @param string $text
* @return string|bool An expanded string, or false if invalid.
*/
- function validateSig( $text ) {
+ public function validateSig( $text ) {
return Xml::isWellFormedXmlFragment( $text ) ? $text : false;
}
* @throws MWException
* @return callable|null The old value of the mTagHooks array associated with the hook
*/
- function setTransparentTagHook( $tag, $callback ) {
+ public function setTransparentTagHook( $tag, $callback ) {
$tag = strtolower( $tag );
if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) {
throw new MWException( "Invalid character {$m[0]} in setTransparentHook('$tag', ...) call" );
/**
* Remove all tag hooks
*/
- function clearTagHooks() {
+ public function clearTagHooks() {
$this->mTagHooks = array();
$this->mFunctionTagHooks = array();
$this->mStripList = $this->mDefaultStripList;
*
* @return array
*/
- function getFunctionHooks() {
+ public function getFunctionHooks() {
return array_keys( $this->mFunctionHooks );
}
* @throws MWException
* @return null
*/
- function setFunctionTagHook( $tag, $callback, $flags ) {
+ public function setFunctionTagHook( $tag, $callback, $flags ) {
$tag = strtolower( $tag );
if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) {
throw new MWException( "Invalid character {$m[0]} in setFunctionTagHook('$tag', ...) call" );
*
* @return array Array of link CSS classes, indexed by PDBK.
*/
- function replaceLinkHolders( &$text, $options = 0 ) {
+ public function replaceLinkHolders( &$text, $options = 0 ) {
return $this->mLinkHolders->replace( $text );
}
* @param string $text
* @return string
*/
- function replaceLinkHoldersText( $text ) {
+ public function replaceLinkHoldersText( $text ) {
return $this->mLinkHolders->replaceText( $text );
}
* @param array $params
* @return string HTML
*/
- function renderImageGallery( $text, $params ) {
+ public function renderImageGallery( $text, $params ) {
wfProfileIn( __METHOD__ );
$mode = false;
* @param string $handler
* @return array
*/
- function getImageParams( $handler ) {
+ public function getImageParams( $handler ) {
if ( $handler ) {
$handlerClass = get_class( $handler );
} else {
* @param LinkHolderArray|bool $holders
* @return string HTML
*/
- function makeImage( $title, $options, $holders = false ) {
+ public function makeImage( $title, $options, $holders = false ) {
# Check if the options text is of the form "options|alt text"
# Options are:
# * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang
* Set a flag in the output object indicating that the content is dynamic and
* shouldn't be cached.
*/
- function disableCache() {
+ public function disableCache() {
wfDebug( "Parser output marked as uncacheable.\n" );
if ( !$this->mOutput ) {
throw new MWException( __METHOD__ .
* @param bool|PPFrame $frame
* @return string
*/
- function attributeStripCallback( &$text, $frame = false ) {
+ public function attributeStripCallback( &$text, $frame = false ) {
$text = $this->replaceVariables( $text, $frame );
$text = $this->mStripState->unstripBoth( $text );
return $text;
*
* @return array
*/
- function getTags() {
+ public function getTags() {
return array_merge(
array_keys( $this->mTransparentTagHooks ),
array_keys( $this->mTagHooks ),
*
* @return string
*/
- function replaceTransparentTags( $text ) {
+ public function replaceTransparentTags( $text ) {
$matches = array();
$elements = array_keys( $this->mTransparentTagHooks );
$text = self::extractTagsAndParams( $elements, $text, $matches, $this->mUniqPrefix );
*
* @return int|null
*/
- function getRevisionId() {
+ public function getRevisionId() {
return $this->mRevisionId;
}
* the default server-local timestamp
* @return string
*/
- function getRevisionTimestamp() {
+ public function getRevisionTimestamp() {
if ( is_null( $this->mRevisionTimestamp ) ) {
wfProfileIn( __METHOD__ );
*
* @return string User name
*/
- function getRevisionUser() {
+ public function getRevisionUser() {
if ( is_null( $this->mRevisionUser ) ) {
$revObject = $this->getRevisionObject();
*
* @return int|null Revision size
*/
- function getRevisionSize() {
+ public function getRevisionSize() {
if ( is_null( $this->mRevisionSize ) ) {
$revObject = $this->getRevisionObject();
*
* @return string
*/
- function testSrvus( $text, Title $title, ParserOptions $options, $outputType = self::OT_HTML ) {
+ public function testSrvus( $text, Title $title, ParserOptions $options, $outputType = self::OT_HTML ) {
$magicScopeVariable = $this->lock();
$this->startParse( $title, $options, $outputType, true );
* @param ParserOptions $options
* @return string
*/
- function testPst( $text, Title $title, ParserOptions $options ) {
+ public function testPst( $text, Title $title, ParserOptions $options ) {
return $this->preSaveTransform( $text, $title, $options->getUser(), $options );
}
* @param ParserOptions $options
* @return string
*/
- function testPreprocess( $text, Title $title, ParserOptions $options ) {
+ public function testPreprocess( $text, Title $title, ParserOptions $options ) {
return $this->testSrvus( $text, $title, $options, self::OT_PREPROCESS );
}
*
* @return string
*/
- function markerSkipCallback( $s, $callback ) {
+ public function markerSkipCallback( $s, $callback ) {
$i = 0;
$out = '';
while ( $i < strlen( $s ) ) {
* @param string $text Input string
* @return string
*/
- function killMarkers( $text ) {
+ public function killMarkers( $text ) {
return $this->mStripState->killMarkers( $text );
}
*
* @return array
*/
- function serializeHalfParsedText( $text ) {
+ public function serializeHalfParsedText( $text ) {
wfProfileIn( __METHOD__ );
$data = array(
'text' => $text,
* @throws MWException
* @return string
*/
- function unserializeHalfParsedText( $data ) {
+ public function unserializeHalfParsedText( $data ) {
if ( !isset( $data['version'] ) || $data['version'] != self::HALF_PARSED_VERSION ) {
throw new MWException( __METHOD__ . ': invalid version' );
}
*
* @return bool
*/
- function isValidHalfParsedText( $data ) {
+ public function isValidHalfParsedText( $data ) {
return isset( $data['version'] ) && $data['version'] == self::HALF_PARSED_VERSION;
}
* @param ParserOptions $popts
* @return string
*/
- function getETag( $article, $popts ) {
+ public function getETag( $article, $popts ) {
return 'W/"' . $this->getParserOutputKey( $article,
$popts->optionsHash( ParserOptions::legacyOptions(), $article->getTitle() ) ) .
"--" . $article->getTouched() . '"';
*/
class ParserDiffTest
{
- var $parsers, $conf;
- var $shortOutput = false;
+ public $parsers;
+ public $conf;
+ public $shortOutput = false;
+ public $dtUniqPrefix;
- var $dtUniqPrefix;
-
- function __construct( $conf ) {
+ public function __construct( $conf ) {
if ( !isset( $conf['parsers'] ) ) {
throw new MWException( __METHOD__ . ': no parsers specified' );
}
$this->conf = $conf;
}
- function init() {
+ public function init() {
if ( !is_null( $this->parsers ) ) {
return;
}
}
}
- function __call( $name, $args ) {
+ public function __call( $name, $args ) {
$this->init();
$results = array();
$mismatch = false;
return $lastResult;
}
- function formatArray( $array ) {
+ public function formatArray( $array ) {
if ( $this->shortOutput ) {
foreach ( $array as $key => $value ) {
if ( $value instanceof ParserOutput ) {
return var_export( $array, true );
}
- function setFunctionHook( $id, $callback, $flags = 0 ) {
+ public function setFunctionHook( $id, $callback, $flags = 0 ) {
$this->init();
foreach ( $this->parsers as $parser ) {
$parser->setFunctionHook( $id, $callback, $flags );
* @param Parser $parser
* @return bool
*/
- function onClearState( &$parser ) {
+ public function onClearState( &$parser ) {
// hack marker prefixes to get identical output
if ( !isset( $this->dtUniqPrefix ) ) {
$this->dtUniqPrefix = $parser->uniqPrefix();
/**
* Interlanguage links are removed and returned in an array
*/
- var $mInterwikiMagic;
+ public $mInterwikiMagic;
/**
* Allow external images inline?
*/
- var $mAllowExternalImages;
+ public $mAllowExternalImages;
/**
* If not, any exception?
*/
- var $mAllowExternalImagesFrom;
+ public $mAllowExternalImagesFrom;
/**
* If not or it doesn't match, should we check an on-wiki whitelist?
*/
- var $mEnableImageWhitelist;
+ public $mEnableImageWhitelist;
/**
* Date format index
*/
- var $mDateFormat = null;
+ public $mDateFormat = null;
/**
* Create "edit section" links?
*/
- var $mEditSection = true;
+ public $mEditSection = true;
/**
* Allow inclusion of special pages?
*/
- var $mAllowSpecialInclusion;
+ public $mAllowSpecialInclusion;
/**
* Use tidy to cleanup output HTML?
*/
- var $mTidy = false;
+ public $mTidy = false;
/**
* Which lang to call for PLURAL and GRAMMAR
*/
- var $mInterfaceMessage = false;
+ public $mInterfaceMessage = false;
/**
* Overrides $mInterfaceMessage with arbitrary language
*/
- var $mTargetLanguage = null;
+ public $mTargetLanguage = null;
/**
* Maximum size of template expansions, in bytes
*/
- var $mMaxIncludeSize;
+ public $mMaxIncludeSize;
/**
* Maximum number of nodes touched by PPFrame::expand()
*/
- var $mMaxPPNodeCount;
+ public $mMaxPPNodeCount;
/**
* Maximum number of nodes generated by Preprocessor::preprocessToObj()
*/
- var $mMaxGeneratedPPNodeCount;
+ public $mMaxGeneratedPPNodeCount;
/**
* Maximum recursion depth in PPFrame::expand()
*/
- var $mMaxPPExpandDepth;
+ public $mMaxPPExpandDepth;
/**
* Maximum recursion depth for templates within templates
*/
- var $mMaxTemplateDepth;
+ public $mMaxTemplateDepth;
/**
* Maximum number of calls per parse to expensive parser functions
*/
- var $mExpensiveParserFunctionLimit;
+ public $mExpensiveParserFunctionLimit;
/**
* Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS
*/
- var $mRemoveComments = true;
+ public $mRemoveComments = true;
/**
* Callback for template fetching. Used as first argument to call_user_func().
*/
- var $mTemplateCallback =
+ public $mTemplateCallback =
array( 'Parser', 'statelessFetchTemplate' );
/**
* Enable limit report in an HTML comment on output
*/
- var $mEnableLimitReport = false;
+ public $mEnableLimitReport = false;
/**
* Timestamp used for {{CURRENTDAY}} etc.
*/
- var $mTimestamp;
+ public $mTimestamp;
/**
* Target attribute for external links
*/
- var $mExternalLinkTarget;
+ public $mExternalLinkTarget;
/**
* Clean up signature texts?
* 1) Strip ~~~, ~~~~ and ~~~~~ out of signatures
* 2) Substitute all transclusions
*/
- var $mCleanSignatures;
+ public $mCleanSignatures;
/**
* Transform wiki markup when saving the page?
*/
- var $mPreSaveTransform = true;
+ public $mPreSaveTransform = true;
/**
* Whether content conversion should be disabled
*/
- var $mDisableContentConversion;
+ public $mDisableContentConversion;
/**
* Whether title conversion should be disabled
*/
- var $mDisableTitleConversion;
+ public $mDisableTitleConversion;
/**
* Automatically number headings?
*/
- var $mNumberHeadings;
+ public $mNumberHeadings;
/**
* Thumb size preferred by the user.
*/
- var $mThumbSize;
+ public $mThumbSize;
/**
* Maximum article size of an article to be marked as "stub"
/**
* Language object of the User language.
*/
- var $mUserLang;
+ public $mUserLang;
/**
* @var User
* Stored user object
*/
- var $mUser;
+ public $mUser;
/**
* Parsing the page for a "preview" operation?
*/
- var $mIsPreview = false;
+ public $mIsPreview = false;
/**
* Parsing the page for a "preview" operation on a single section?
*/
- var $mIsSectionPreview = false;
+ public $mIsSectionPreview = false;
/**
* Parsing the printable version of the page?
*/
- var $mIsPrintable = false;
+ public $mIsPrintable = false;
/**
* Extra key that should be present in the caching key.
*/
- var $mExtraKey = '';
+ public $mExtraKey = '';
/**
* Function to be called when an option is accessed.
*/
protected $onAccessCallback = null;
- function getInterwikiMagic() {
+ public function getInterwikiMagic() {
return $this->mInterwikiMagic;
}
- function getAllowExternalImages() {
+ public function getAllowExternalImages() {
return $this->mAllowExternalImages;
}
- function getAllowExternalImagesFrom() {
+ public function getAllowExternalImagesFrom() {
return $this->mAllowExternalImagesFrom;
}
- function getEnableImageWhitelist() {
+ public function getEnableImageWhitelist() {
return $this->mEnableImageWhitelist;
}
- function getEditSection() {
+ public function getEditSection() {
return $this->mEditSection;
}
- function getNumberHeadings() {
+ public function getNumberHeadings() {
$this->optionUsed( 'numberheadings' );
return $this->mNumberHeadings;
}
- function getAllowSpecialInclusion() {
+ public function getAllowSpecialInclusion() {
return $this->mAllowSpecialInclusion;
}
- function getTidy() {
+ public function getTidy() {
return $this->mTidy;
}
- function getInterfaceMessage() {
+ public function getInterfaceMessage() {
return $this->mInterfaceMessage;
}
- function getTargetLanguage() {
+ public function getTargetLanguage() {
return $this->mTargetLanguage;
}
- function getMaxIncludeSize() {
+ public function getMaxIncludeSize() {
return $this->mMaxIncludeSize;
}
- function getMaxPPNodeCount() {
+ public function getMaxPPNodeCount() {
return $this->mMaxPPNodeCount;
}
- function getMaxGeneratedPPNodeCount() {
+ public function getMaxGeneratedPPNodeCount() {
return $this->mMaxGeneratedPPNodeCount;
}
- function getMaxPPExpandDepth() {
+ public function getMaxPPExpandDepth() {
return $this->mMaxPPExpandDepth;
}
- function getMaxTemplateDepth() {
+ public function getMaxTemplateDepth() {
return $this->mMaxTemplateDepth;
}
/* @since 1.20 */
- function getExpensiveParserFunctionLimit() {
+ public function getExpensiveParserFunctionLimit() {
return $this->mExpensiveParserFunctionLimit;
}
- function getRemoveComments() {
+ public function getRemoveComments() {
return $this->mRemoveComments;
}
- function getTemplateCallback() {
+ public function getTemplateCallback() {
return $this->mTemplateCallback;
}
- function getEnableLimitReport() {
+ public function getEnableLimitReport() {
return $this->mEnableLimitReport;
}
- function getCleanSignatures() {
+ public function getCleanSignatures() {
return $this->mCleanSignatures;
}
- function getExternalLinkTarget() {
+ public function getExternalLinkTarget() {
return $this->mExternalLinkTarget;
}
- function getDisableContentConversion() {
+ public function getDisableContentConversion() {
return $this->mDisableContentConversion;
}
- function getDisableTitleConversion() {
+ public function getDisableTitleConversion() {
return $this->mDisableTitleConversion;
}
- function getThumbSize() {
+ public function getThumbSize() {
$this->optionUsed( 'thumbsize' );
return $this->mThumbSize;
}
- function getStubThreshold() {
+ public function getStubThreshold() {
$this->optionUsed( 'stubthreshold' );
return $this->mStubThreshold;
}
- function getIsPreview() {
+ public function getIsPreview() {
return $this->mIsPreview;
}
- function getIsSectionPreview() {
+ public function getIsSectionPreview() {
return $this->mIsSectionPreview;
}
- function getIsPrintable() {
+ public function getIsPrintable() {
$this->optionUsed( 'printable' );
return $this->mIsPrintable;
}
- function getUser() {
+ public function getUser() {
return $this->mUser;
}
- function getPreSaveTransform() {
+ public function getPreSaveTransform() {
return $this->mPreSaveTransform;
}
- function getDateFormat() {
+ public function getDateFormat() {
$this->optionUsed( 'dateformat' );
if ( !isset( $this->mDateFormat ) ) {
$this->mDateFormat = $this->mUser->getDatePreference();
return $this->mDateFormat;
}
- function getTimestamp() {
+ public function getTimestamp() {
if ( !isset( $this->mTimestamp ) ) {
$this->mTimestamp = wfTimestampNow();
}
* @return Language
* @since 1.19
*/
- function getUserLangObj() {
+ public function getUserLangObj() {
$this->optionUsed( 'userlang' );
return $this->mUserLang;
}
* @return string Language code
* @since 1.17
*/
- function getUserLang() {
+ public function getUserLang() {
return $this->getUserLangObj()->getCode();
}
- function setInterwikiMagic( $x ) {
+ public function setInterwikiMagic( $x ) {
return wfSetVar( $this->mInterwikiMagic, $x );
}
- function setAllowExternalImages( $x ) {
+ public function setAllowExternalImages( $x ) {
return wfSetVar( $this->mAllowExternalImages, $x );
}
- function setAllowExternalImagesFrom( $x ) {
+ public function setAllowExternalImagesFrom( $x ) {
return wfSetVar( $this->mAllowExternalImagesFrom, $x );
}
- function setEnableImageWhitelist( $x ) {
+ public function setEnableImageWhitelist( $x ) {
return wfSetVar( $this->mEnableImageWhitelist, $x );
}
- function setDateFormat( $x ) {
+ public function setDateFormat( $x ) {
return wfSetVar( $this->mDateFormat, $x );
}
- function setEditSection( $x ) {
+ public function setEditSection( $x ) {
return wfSetVar( $this->mEditSection, $x );
}
- function setNumberHeadings( $x ) {
+ public function setNumberHeadings( $x ) {
return wfSetVar( $this->mNumberHeadings, $x );
}
- function setAllowSpecialInclusion( $x ) {
+ public function setAllowSpecialInclusion( $x ) {
return wfSetVar( $this->mAllowSpecialInclusion, $x );
}
- function setTidy( $x ) {
+ public function setTidy( $x ) {
return wfSetVar( $this->mTidy, $x );
}
- function setInterfaceMessage( $x ) {
+ public function setInterfaceMessage( $x ) {
return wfSetVar( $this->mInterfaceMessage, $x );
}
- function setTargetLanguage( $x ) {
+ public function setTargetLanguage( $x ) {
return wfSetVar( $this->mTargetLanguage, $x, true );
}
- function setMaxIncludeSize( $x ) {
+ public function setMaxIncludeSize( $x ) {
return wfSetVar( $this->mMaxIncludeSize, $x );
}
- function setMaxPPNodeCount( $x ) {
+ public function setMaxPPNodeCount( $x ) {
return wfSetVar( $this->mMaxPPNodeCount, $x );
}
- function setMaxGeneratedPPNodeCount( $x ) {
+ public function setMaxGeneratedPPNodeCount( $x ) {
return wfSetVar( $this->mMaxGeneratedPPNodeCount, $x );
}
- function setMaxTemplateDepth( $x ) {
+ public function setMaxTemplateDepth( $x ) {
return wfSetVar( $this->mMaxTemplateDepth, $x );
}
/* @since 1.20 */
- function setExpensiveParserFunctionLimit( $x ) {
+ public function setExpensiveParserFunctionLimit( $x ) {
return wfSetVar( $this->mExpensiveParserFunctionLimit, $x );
}
- function setRemoveComments( $x ) {
+ public function setRemoveComments( $x ) {
return wfSetVar( $this->mRemoveComments, $x );
}
- function setTemplateCallback( $x ) {
+ public function setTemplateCallback( $x ) {
return wfSetVar( $this->mTemplateCallback, $x );
}
- function enableLimitReport( $x = true ) {
+ public function enableLimitReport( $x = true ) {
return wfSetVar( $this->mEnableLimitReport, $x );
}
- function setTimestamp( $x ) {
+ public function setTimestamp( $x ) {
return wfSetVar( $this->mTimestamp, $x );
}
- function setCleanSignatures( $x ) {
+ public function setCleanSignatures( $x ) {
return wfSetVar( $this->mCleanSignatures, $x );
}
- function setExternalLinkTarget( $x ) {
+ public function setExternalLinkTarget( $x ) {
return wfSetVar( $this->mExternalLinkTarget, $x );
}
- function disableContentConversion( $x = true ) {
+ public function disableContentConversion( $x = true ) {
return wfSetVar( $this->mDisableContentConversion, $x );
}
- function disableTitleConversion( $x = true ) {
+ public function disableTitleConversion( $x = true ) {
return wfSetVar( $this->mDisableTitleConversion, $x );
}
- function setUserLang( $x ) {
+ public function setUserLang( $x ) {
if ( is_string( $x ) ) {
$x = Language::factory( $x );
}
return wfSetVar( $this->mUserLang, $x );
}
- function setThumbSize( $x ) {
+ public function setThumbSize( $x ) {
return wfSetVar( $this->mThumbSize, $x );
}
- function setStubThreshold( $x ) {
+ public function setStubThreshold( $x ) {
return wfSetVar( $this->mStubThreshold, $x );
}
- function setPreSaveTransform( $x ) {
+ public function setPreSaveTransform( $x ) {
return wfSetVar( $this->mPreSaveTransform, $x );
}
- function setIsPreview( $x ) {
+ public function setIsPreview( $x ) {
return wfSetVar( $this->mIsPreview, $x );
}
- function setIsSectionPreview( $x ) {
+ public function setIsSectionPreview( $x ) {
return wfSetVar( $this->mIsSectionPreview, $x );
}
- function setIsPrintable( $x ) {
+ public function setIsPrintable( $x ) {
return wfSetVar( $this->mIsPrintable, $x );
}
/**
* Extra key that should be present in the parser cache key.
*/
- function addExtraKey( $key ) {
+ public function addExtraKey( $key ) {
$this->mExtraKey .= '!' . $key;
}
* @param User $user
* @param Language $lang
*/
- function __construct( $user = null, $lang = null ) {
+ public function __construct( $user = null, $lang = null ) {
if ( $user === null ) {
global $wgUser;
if ( $wgUser === null ) {
* This is a private API with the parser.
* @param callable $callback
*/
- function registerWatcher( $callback ) {
+ public function registerWatcher( $callback ) {
$this->onAccessCallback = $callback;
}
* @ingroup Parser
*/
class ParserOutput extends CacheTime {
- var $mText, # The output text
+ public $mText, # The output text
$mLanguageLinks, # List of the full text of language links, in the order they appear
$mCategories, # Map of category names to sort keys
$mTitleText, # title text of the chosen language variant
const EDITSECTION_REGEX =
'#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
- function __construct( $text = '', $languageLinks = array(), $categoryLinks = array(),
+ public function __construct( $text = '', $languageLinks = array(), $categoryLinks = array(),
$containsOldMagic = false, $titletext = ''
) {
$this->mText = $text;
$this->mTitleText = $titletext;
}
- function getText() {
+ public function getText() {
wfProfileIn( __METHOD__ );
$text = $this->mText;
if ( $this->mEditSectionTokens ) {
* @throws MWException
* @return mixed
*/
- function replaceEditSectionLinksCallback( $m ) {
+ public function replaceEditSectionLinksCallback( $m ) {
global $wgOut, $wgLang;
$args = array(
htmlspecialchars_decode( $m[1] ),
return call_user_func_array( array( $skin, 'doEditSectionLink' ), $args );
}
- function &getLanguageLinks() {
+ public function &getLanguageLinks() {
return $this->mLanguageLinks;
}
- function getInterwikiLinks() {
+ public function getInterwikiLinks() {
return $this->mInterwikiLinks;
}
- function getCategoryLinks() {
+ public function getCategoryLinks() {
return array_keys( $this->mCategories );
}
- function &getCategories() {
+ public function &getCategories() {
return $this->mCategories;
}
- function getTitleText() {
+ public function getTitleText() {
return $this->mTitleText;
}
- function getSections() {
+ public function getSections() {
return $this->mSections;
}
- function getEditSectionTokens() {
+ public function getEditSectionTokens() {
return $this->mEditSectionTokens;
}
- function &getLinks() {
+ public function &getLinks() {
return $this->mLinks;
}
- function &getTemplates() {
+ public function &getTemplates() {
return $this->mTemplates;
}
- function &getTemplateIds() {
+ public function &getTemplateIds() {
return $this->mTemplateIds;
}
- function &getImages() {
+ public function &getImages() {
return $this->mImages;
}
- function &getFileSearchOptions() {
+ public function &getFileSearchOptions() {
return $this->mFileSearchOptions;
}
- function &getExternalLinks() {
+ public function &getExternalLinks() {
return $this->mExternalLinks;
}
- function getNoGallery() {
+ public function getNoGallery() {
return $this->mNoGallery;
}
- function getHeadItems() {
+ public function getHeadItems() {
return $this->mHeadItems;
}
- function getModules() {
+ public function getModules() {
return $this->mModules;
}
- function getModuleScripts() {
+ public function getModuleScripts() {
return $this->mModuleScripts;
}
- function getModuleStyles() {
+ public function getModuleStyles() {
return $this->mModuleStyles;
}
- function getModuleMessages() {
+ public function getModuleMessages() {
return $this->mModuleMessages;
}
/** @since 1.23 */
- function getJsConfigVars() {
+ public function getJsConfigVars() {
return $this->mJsConfigVars;
}
- function getOutputHooks() {
+ public function getOutputHooks() {
return (array)$this->mOutputHooks;
}
- function getWarnings() {
+ public function getWarnings() {
return array_keys( $this->mWarnings );
}
- function getIndexPolicy() {
+ public function getIndexPolicy() {
return $this->mIndexPolicy;
}
- function getTOCHTML() {
+ public function getTOCHTML() {
return $this->mTOCHTML;
}
- function getTimestamp() {
+ public function getTimestamp() {
return $this->mTimestamp;
}
- function getLimitReportData() {
+ public function getLimitReportData() {
return $this->mLimitReportData;
}
- function getTOCEnabled() {
+ public function getTOCEnabled() {
return $this->mTOCEnabled;
}
- function setText( $text ) {
+ public function setText( $text ) {
return wfSetVar( $this->mText, $text );
}
- function setLanguageLinks( $ll ) {
+ public function setLanguageLinks( $ll ) {
return wfSetVar( $this->mLanguageLinks, $ll );
}
- function setCategoryLinks( $cl ) {
+ public function setCategoryLinks( $cl ) {
return wfSetVar( $this->mCategories, $cl );
}
- function setTitleText( $t ) {
+ public function setTitleText( $t ) {
return wfSetVar( $this->mTitleText, $t );
}
- function setSections( $toc ) {
+ public function setSections( $toc ) {
return wfSetVar( $this->mSections, $toc );
}
- function setEditSectionTokens( $t ) {
+ public function setEditSectionTokens( $t ) {
return wfSetVar( $this->mEditSectionTokens, $t );
}
- function setIndexPolicy( $policy ) {
+ public function setIndexPolicy( $policy ) {
return wfSetVar( $this->mIndexPolicy, $policy );
}
- function setTOCHTML( $tochtml ) {
+ public function setTOCHTML( $tochtml ) {
return wfSetVar( $this->mTOCHTML, $tochtml );
}
- function setTimestamp( $timestamp ) {
+ public function setTimestamp( $timestamp ) {
return wfSetVar( $this->mTimestamp, $timestamp );
}
- function setTOCEnabled( $flag ) {
+ public function setTOCEnabled( $flag ) {
return wfSetVar( $this->mTOCEnabled, $flag );
}
- function addCategory( $c, $sort ) {
+ public function addCategory( $c, $sort ) {
$this->mCategories[$c] = $sort;
}
- function addLanguageLink( $t ) {
+ public function addLanguageLink( $t ) {
$this->mLanguageLinks[] = $t;
}
- function addWarning( $s ) {
+ public function addWarning( $s ) {
$this->mWarnings[$s] = 1;
}
- function addOutputHook( $hook, $data = false ) {
+ public function addOutputHook( $hook, $data = false ) {
$this->mOutputHooks[] = array( $hook, $data );
}
- function setNewSection( $value ) {
+ public function setNewSection( $value ) {
$this->mNewSection = (bool)$value;
}
- function hideNewSection( $value ) {
+ public function hideNewSection( $value ) {
$this->mHideNewSection = (bool)$value;
}
- function getHideNewSection() {
+ public function getHideNewSection() {
return (bool)$this->mHideNewSection;
}
- function getNewSection() {
+ public function getNewSection() {
return (bool)$this->mNewSection;
}
* @param string $url The url to check
* @return bool
*/
- static function isLinkInternal( $internal, $url ) {
+ public static function isLinkInternal( $internal, $url ) {
return (bool)preg_match( '/^' .
# If server is proto relative, check also for http/https links
( substr( $internal, 0, 2 ) === '//' ? '(?:https?:)?' : '' ) .
);
}
- function addExternalLink( $url ) {
+ public function addExternalLink( $url ) {
# We don't register links pointing to our own server, unless... :-)
global $wgServer, $wgRegisterInternalExternals;
* @param Title $title
* @param int|null $id Optional known page_id so we can skip the lookup
*/
- function addLink( Title $title, $id = null ) {
+ public function addLink( Title $title, $id = null ) {
if ( $title->isExternal() ) {
// Don't record interwikis in pagelinks
$this->addInterwikiLink( $title );
* @param string $sha1 Base 36 SHA-1 of file (or false if non-existing)
* @return void
*/
- function addImage( $name, $timestamp = null, $sha1 = null ) {
+ public function addImage( $name, $timestamp = null, $sha1 = null ) {
$this->mImages[$name] = 1;
if ( $timestamp !== null && $sha1 !== null ) {
$this->mFileSearchOptions[$name] = array( 'time' => $timestamp, 'sha1' => $sha1 );
* @param int $rev_id
* @return void
*/
- function addTemplate( $title, $page_id, $rev_id ) {
+ public function addTemplate( $title, $page_id, $rev_id ) {
$ns = $title->getNamespace();
$dbk = $title->getDBkey();
if ( !isset( $this->mTemplates[$ns] ) ) {
* @param Title $title Title object, must be an interwiki link
* @throws MWException If given invalid input
*/
- function addInterwikiLink( $title ) {
+ public function addInterwikiLink( $title ) {
if ( !$title->isExternal() ) {
throw new MWException( 'Non-interwiki link passed, internal parser error.' );
}
* @param string $section
* @param string|bool $tag
*/
- function addHeadItem( $section, $tag = false ) {
+ public function addHeadItem( $section, $tag = false ) {
if ( $tag !== false ) {
$this->mHeadItems[$tag] = $section;
} else {
* Resets the parse start timestamps for future calls to getTimeSinceStart()
* @since 1.22
*/
- function resetParseStartTime() {
+ public function resetParseStartTime() {
$this->mParseStartTime = self::getTimes();
}
* @param string $clock
* @return float|null
*/
- function getTimeSinceStart( $clock ) {
+ public function getTimeSinceStart( $clock ) {
if ( !isset( $this->mParseStartTime[$clock] ) ) {
return null;
}
* @param string $key Message key
* @param mixed $value Appropriate for Message::params()
*/
- function setLimitReportData( $key, $value ) {
+ public function setLimitReportData( $key, $value ) {
$this->mLimitReportData[$key] = $value;
}
/**
* Save space for for serialization by removing useless values
*/
- function __sleep() {
+ public function __sleep() {
return array_diff(
array_keys( get_object_vars( $this ) ),
array( 'mSecondaryDataUpdates', 'mParseStartTime' )
*
* @param Parser $parser
*/
- function __construct( $parser );
+ public function __construct( $parser );
/**
* Create a new top-level frame for expansion of a page
*
* @return PPFrame
*/
- function newFrame();
+ public function newFrame();
/**
* Create a new custom frame for programmatic use of parameter replacement
*
* @return PPFrame
*/
- function newCustomFrame( $args );
+ public function newCustomFrame( $args );
/**
* Create a new custom node for programmatic use of parameter replacement
*
* @param array $values
*/
- function newPartNodeArray( $values );
+ public function newPartNodeArray( $values );
/**
* Preprocess text to a PPNode
*
* @return PPNode
*/
- function preprocessToObj( $text, $flags = 0 );
+ public function preprocessToObj( $text, $flags = 0 );
}
/**
*
* @return PPFrame
*/
- function newChild( $args = false, $title = false, $indexOffset = 0 );
+ public function newChild( $args = false, $title = false, $indexOffset = 0 );
/**
* Expand a document tree node, caching the result on its parent with the given key
*/
- function cachedExpand( $key, $root, $flags = 0 );
+ public function cachedExpand( $key, $root, $flags = 0 );
/**
* Expand a document tree node
*/
- function expand( $root, $flags = 0 );
+ public function expand( $root, $flags = 0 );
/**
* Implode with flags for expand()
*/
- function implodeWithFlags( $sep, $flags /*, ... */ );
+ public function implodeWithFlags( $sep, $flags /*, ... */ );
/**
* Implode with no flags specified
*/
- function implode( $sep /*, ... */ );
+ public function implode( $sep /*, ... */ );
/**
* Makes an object that, when expand()ed, will be the same as one obtained
* with implode()
*/
- function virtualImplode( $sep /*, ... */ );
+ public function virtualImplode( $sep /*, ... */ );
/**
* Virtual implode with brackets
*/
- function virtualBracketedImplode( $start, $sep, $end /*, ... */ );
+ public function virtualBracketedImplode( $start, $sep, $end /*, ... */ );
/**
* Returns true if there are no arguments in this frame
*
* @return bool
*/
- function isEmpty();
+ public function isEmpty();
/**
* Returns all arguments of this frame
*/
- function getArguments();
+ public function getArguments();
/**
* Returns all numbered arguments of this frame
*/
- function getNumberedArguments();
+ public function getNumberedArguments();
/**
* Returns all named arguments of this frame
*/
- function getNamedArguments();
+ public function getNamedArguments();
/**
* Get an argument to this frame by name
*/
- function getArgument( $name );
+ public function getArgument( $name );
/**
* Returns true if the infinite loop check is OK, false if a loop is detected
* @param Title $title
* @return bool
*/
- function loopCheck( $title );
+ public function loopCheck( $title );
/**
* Return true if the frame is a template frame
*/
- function isTemplate();
+ public function isTemplate();
/**
* Set the "volatile" flag.
*
* @param bool $flag
*/
- function setVolatile( $flag = true );
+ public function setVolatile( $flag = true );
/**
* Get the "volatile" flag.
* @see self::setVolatile()
* @return bool
*/
- function isVolatile();
+ public function isVolatile();
/**
* Get the TTL of the frame's output.
*
* @return int|null
*/
- function getTTL();
+ public function getTTL();
/**
* Set the TTL of the output of this frame and all of its ancestors.
* @see self::getTTL()
* @param int $ttl
*/
- function setTTL( $ttl );
+ public function setTTL( $ttl );
/**
* Get a title of frame
*
* @return Title
*/
- function getTitle();
+ public function getTitle();
}
/**
* Get an array-type node containing the children of this node.
* Returns false if this is not a tree node.
*/
- function getChildren();
+ public function getChildren();
/**
* Get the first child of a tree node. False if there isn't one.
*
* @return PPNode
*/
- function getFirstChild();
+ public function getFirstChild();
/**
* Get the next sibling of any node. False if there isn't one
*/
- function getNextSibling();
+ public function getNextSibling();
/**
* Get all children of this tree node which have a given name.
* Returns an array-type node, or false if this is not a tree node.
*/
- function getChildrenOfType( $type );
+ public function getChildrenOfType( $type );
/**
* Returns the length of the array, or false if this is not an array-type node
*/
- function getLength();
+ public function getLength();
/**
* Returns an item of an array-type node
*/
- function item( $i );
+ public function item( $i );
/**
* Get the name of this node. The following names are defined here:
*
* The subclass may define various other names for tree and leaf nodes.
*/
- function getName();
+ public function getName();
/**
* Split a "<part>" node into an associative array containing:
* index String index
* value PPNode value
*/
- function splitArg();
+ public function splitArg();
/**
* Split an "<ext>" node into an associative array containing name, attr, inner and close
* All values in the resulting array are PPNodes. Inner and close are optional.
*/
- function splitExt();
+ public function splitExt();
/**
* Split an "<h>" node
*/
- function splitHeading();
+ public function splitHeading();
}
/**
* @var Parser
*/
- var $parser;
+ public $parser;
- var $memoryLimit;
+ public $memoryLimit;
const CACHE_VERSION = 1;
- function __construct( $parser ) {
+ public function __construct( $parser ) {
$this->parser = $parser;
$mem = ini_get( 'memory_limit' );
$this->memoryLimit = false;
/**
* @return PPFrame_DOM
*/
- function newFrame() {
+ public function newFrame() {
return new PPFrame_DOM( $this );
}
* @param array $args
* @return PPCustomFrame_DOM
*/
- function newCustomFrame( $args ) {
+ public function newCustomFrame( $args ) {
return new PPCustomFrame_DOM( $this, $args );
}
* @param array $values
* @return PPNode_DOM
*/
- function newPartNodeArray( $values ) {
+ public function newPartNodeArray( $values ) {
//NOTE: DOM manipulation is slower than building & parsing XML! (or so Tim sais)
$xml = "<list>";
* @throws MWException
* @return bool
*/
- function memCheck() {
+ public function memCheck() {
if ( $this->memoryLimit === false ) {
return true;
}
* @throws MWException
* @return PPNode_DOM
*/
- function preprocessToObj( $text, $flags = 0 ) {
+ public function preprocessToObj( $text, $flags = 0 ) {
wfProfileIn( __METHOD__ );
global $wgMemc, $wgPreprocessorCacheThreshold;
* @param int $flags
* @return string
*/
- function preprocessToXml( $text, $flags = 0 ) {
+ public function preprocessToXml( $text, $flags = 0 ) {
wfProfileIn( __METHOD__ );
$rules = array(
'{' => array(
* @ingroup Parser
*/
class PPDStack {
- var $stack, $rootAccum;
+ public $stack, $rootAccum;
/**
* @var PPDStack
*/
- var $top;
- var $out;
- var $elementClass = 'PPDStackElement';
+ public $top;
+ public $out;
+ public $elementClass = 'PPDStackElement';
- static $false = false;
+ public static $false = false;
- function __construct() {
+ public function __construct() {
$this->stack = array();
$this->top = false;
$this->rootAccum = '';
/**
* @return int
*/
- function count() {
+ public function count() {
return count( $this->stack );
}
- function &getAccum() {
+ public function &getAccum() {
return $this->accum;
}
- function getCurrentPart() {
+ public function getCurrentPart() {
if ( $this->top === false ) {
return false;
} else {
}
}
- function push( $data ) {
+ public function push( $data ) {
if ( $data instanceof $this->elementClass ) {
$this->stack[] = $data;
} else {
$this->accum =& $this->top->getAccum();
}
- function pop() {
+ public function pop() {
if ( !count( $this->stack ) ) {
throw new MWException( __METHOD__ . ': no elements remaining' );
}
return $temp;
}
- function addPart( $s = '' ) {
+ public function addPart( $s = '' ) {
$this->top->addPart( $s );
$this->accum =& $this->top->getAccum();
}
/**
* @return array
*/
- function getFlags() {
+ public function getFlags() {
if ( !count( $this->stack ) ) {
return array(
'findEquals' => false,
* @ingroup Parser
*/
class PPDStackElement {
- var $open, // Opening character (\n for heading)
+ public $open, // Opening character (\n for heading)
$close, // Matching closing character
$count, // Number of opening characters found (number of "=" for heading)
$parts, // Array of PPDPart objects describing pipe-separated parts.
$lineStart; // True if the open char appeared at the start of the input line. Not set for headings.
- var $partClass = 'PPDPart';
+ public $partClass = 'PPDPart';
- function __construct( $data = array() ) {
+ public function __construct( $data = array() ) {
$class = $this->partClass;
$this->parts = array( new $class );
}
}
- function &getAccum() {
+ public function &getAccum() {
return $this->parts[count( $this->parts ) - 1]->out;
}
- function addPart( $s = '' ) {
+ public function addPart( $s = '' ) {
$class = $this->partClass;
$this->parts[] = new $class( $s );
}
- function getCurrentPart() {
+ public function getCurrentPart() {
return $this->parts[count( $this->parts ) - 1];
}
/**
* @return array
*/
- function getFlags() {
+ public function getFlags() {
$partCount = count( $this->parts );
$findPipe = $this->open != "\n" && $this->open != '[';
return array(
* @param bool|int $openingCount
* @return string
*/
- function breakSyntax( $openingCount = false ) {
+ public function breakSyntax( $openingCount = false ) {
if ( $this->open == "\n" ) {
$s = $this->parts[0]->out;
} else {
* @ingroup Parser
*/
class PPDPart {
- var $out; // Output accumulator string
+ public $out; // Output accumulator string
// Optional member variables:
// eqpos Position of equals sign in output accumulator
// commentEnd Past-the-end input pointer for the last comment encountered
// visualEnd Past-the-end input pointer for the end of the accumulator minus comments
- function __construct( $out = '' ) {
+ public function __construct( $out = '' ) {
$this->out = $out;
}
}
/**
* @var Preprocessor
*/
- var $preprocessor;
+ public $preprocessor;
/**
* @var Parser
*/
- var $parser;
+ public $parser;
/**
* @var Title
*/
- var $title;
- var $titleCache;
+ public $title;
+ public $titleCache;
/**
* Hashtable listing templates which are disallowed for expansion in this frame,
* having been encountered previously in parent frames.
*/
- var $loopCheckHash;
+ public $loopCheckHash;
/**
* Recursion depth of this frame, top = 0
* Note that this is NOT the same as expansion depth in expand()
*/
- var $depth;
+ public $depth;
private $volatile = false;
private $ttl = null;
* Construct a new preprocessor frame.
* @param Preprocessor $preprocessor The parent preprocessor
*/
- function __construct( $preprocessor ) {
+ public function __construct( $preprocessor ) {
$this->preprocessor = $preprocessor;
$this->parser = $preprocessor->parser;
$this->title = $this->parser->mTitle;
* @param int $indexOffset
* @return PPTemplateFrame_DOM
*/
- function newChild( $args = false, $title = false, $indexOffset = 0 ) {
+ public function newChild( $args = false, $title = false, $indexOffset = 0 ) {
$namedArgs = array();
$numberedArgs = array();
if ( $title === false ) {
* @param int $flags
* @return string
*/
- function cachedExpand( $key, $root, $flags = 0 ) {
+ public function cachedExpand( $key, $root, $flags = 0 ) {
// we don't have a parent, so we don't have a cache
return $this->expand( $root, $flags );
}
* @param int $flags
* @return string
*/
- function expand( $root, $flags = 0 ) {
+ public function expand( $root, $flags = 0 ) {
static $expansionDepth = 0;
if ( is_string( $root ) ) {
return $root;
* @param int $flags
* @return string
*/
- function implodeWithFlags( $sep, $flags /*, ... */ ) {
+ public function implodeWithFlags( $sep, $flags /*, ... */ ) {
$args = array_slice( func_get_args(), 2 );
$first = true;
* @param string $sep
* @return string
*/
- function implode( $sep /*, ... */ ) {
+ public function implode( $sep /*, ... */ ) {
$args = array_slice( func_get_args(), 1 );
$first = true;
* @param string $sep
* @return array
*/
- function virtualImplode( $sep /*, ... */ ) {
+ public function virtualImplode( $sep /*, ... */ ) {
$args = array_slice( func_get_args(), 1 );
$out = array();
$first = true;
* @param string $end
* @return array
*/
- function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
+ public function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
$args = array_slice( func_get_args(), 3 );
$out = array( $start );
$first = true;
return $out;
}
- function __toString() {
+ public function __toString() {
return 'frame{}';
}
- function getPDBK( $level = false ) {
+ public function getPDBK( $level = false ) {
if ( $level === false ) {
return $this->title->getPrefixedDBkey();
} else {
/**
* @return array
*/
- function getArguments() {
+ public function getArguments() {
return array();
}
/**
* @return array
*/
- function getNumberedArguments() {
+ public function getNumberedArguments() {
return array();
}
/**
* @return array
*/
- function getNamedArguments() {
+ public function getNamedArguments() {
return array();
}
*
* @return bool
*/
- function isEmpty() {
+ public function isEmpty() {
return true;
}
- function getArgument( $name ) {
+ public function getArgument( $name ) {
return false;
}
* @param Title $title
* @return bool
*/
- function loopCheck( $title ) {
+ public function loopCheck( $title ) {
return !isset( $this->loopCheckHash[$title->getPrefixedDBkey()] );
}
*
* @return bool
*/
- function isTemplate() {
+ public function isTemplate() {
return false;
}
*
* @return Title
*/
- function getTitle() {
+ public function getTitle() {
return $this->title;
}
*
* @param bool $flag
*/
- function setVolatile( $flag = true ) {
+ public function setVolatile( $flag = true ) {
$this->volatile = $flag;
}
*
* @return bool
*/
- function isVolatile() {
+ public function isVolatile() {
return $this->volatile;
}
*
* @param int $ttl
*/
- function setTTL( $ttl ) {
+ public function setTTL( $ttl ) {
if ( $ttl !== null && ( $this->ttl === null || $ttl < $this->ttl ) ) {
$this->ttl = $ttl;
}
*
* @return int|null
*/
- function getTTL() {
+ public function getTTL() {
return $this->ttl;
}
}
* @ingroup Parser
*/
class PPTemplateFrame_DOM extends PPFrame_DOM {
- var $numberedArgs, $namedArgs;
+ public $numberedArgs, $namedArgs;
/**
* @var PPFrame_DOM
*/
- var $parent;
- var $numberedExpansionCache, $namedExpansionCache;
+ public $parent;
+ public $numberedExpansionCache, $namedExpansionCache;
/**
* @param Preprocessor $preprocessor
* @param array $namedArgs
* @param bool|Title $title
*/
- function __construct( $preprocessor, $parent = false, $numberedArgs = array(),
+ public function __construct( $preprocessor, $parent = false, $numberedArgs = array(),
$namedArgs = array(), $title = false
) {
parent::__construct( $preprocessor );
$this->numberedExpansionCache = $this->namedExpansionCache = array();
}
- function __toString() {
+ public function __toString() {
$s = 'tplframe{';
$first = true;
$args = $this->numberedArgs + $this->namedArgs;
* @param int $flags
* @return string
*/
- function cachedExpand( $key, $root, $flags = 0 ) {
+ public function cachedExpand( $key, $root, $flags = 0 ) {
if ( isset( $this->parent->childExpansionCache[$key] ) ) {
return $this->parent->childExpansionCache[$key];
}
*
* @return bool
*/
- function isEmpty() {
+ public function isEmpty() {
return !count( $this->numberedArgs ) && !count( $this->namedArgs );
}
- function getArguments() {
+ public function getArguments() {
$arguments = array();
foreach ( array_merge(
array_keys( $this->numberedArgs ),
return $arguments;
}
- function getNumberedArguments() {
+ public function getNumberedArguments() {
$arguments = array();
foreach ( array_keys( $this->numberedArgs ) as $key ) {
$arguments[$key] = $this->getArgument( $key );
return $arguments;
}
- function getNamedArguments() {
+ public function getNamedArguments() {
$arguments = array();
foreach ( array_keys( $this->namedArgs ) as $key ) {
$arguments[$key] = $this->getArgument( $key );
return $arguments;
}
- function getNumberedArgument( $index ) {
+ public function getNumberedArgument( $index ) {
if ( !isset( $this->numberedArgs[$index] ) ) {
return false;
}
return $this->numberedExpansionCache[$index];
}
- function getNamedArgument( $name ) {
+ public function getNamedArgument( $name ) {
if ( !isset( $this->namedArgs[$name] ) ) {
return false;
}
return $this->namedExpansionCache[$name];
}
- function getArgument( $name ) {
+ public function getArgument( $name ) {
$text = $this->getNumberedArgument( $name );
if ( $text === false ) {
$text = $this->getNamedArgument( $name );
*
* @return bool
*/
- function isTemplate() {
+ public function isTemplate() {
return true;
}
- function setVolatile( $flag = true ) {
+ public function setVolatile( $flag = true ) {
parent::setVolatile( $flag );
$this->parent->setVolatile( $flag );
}
- function setTTL( $ttl ) {
+ public function setTTL( $ttl ) {
parent::setTTL( $ttl );
$this->parent->setTTL( $ttl );
}
* @ingroup Parser
*/
class PPCustomFrame_DOM extends PPFrame_DOM {
- var $args;
+ public $args;
- function __construct( $preprocessor, $args ) {
+ public function __construct( $preprocessor, $args ) {
parent::__construct( $preprocessor );
$this->args = $args;
}
- function __toString() {
+ public function __toString() {
$s = 'cstmframe{';
$first = true;
foreach ( $this->args as $name => $value ) {
/**
* @return bool
*/
- function isEmpty() {
+ public function isEmpty() {
return !count( $this->args );
}
- function getArgument( $index ) {
+ public function getArgument( $index ) {
if ( !isset( $this->args[$index] ) ) {
return false;
}
return $this->args[$index];
}
- function getArguments() {
+ public function getArguments() {
return $this->args;
}
}
/**
* @var DOMElement
*/
- var $node;
- var $xpath;
+ public $node;
+ public $xpath;
- function __construct( $node, $xpath = false ) {
+ public function __construct( $node, $xpath = false ) {
$this->node = $node;
}
/**
* @return DOMXPath
*/
- function getXPath() {
+ public function getXPath() {
if ( $this->xpath === null ) {
$this->xpath = new DOMXPath( $this->node->ownerDocument );
}
return $this->xpath;
}
- function __toString() {
+ public function __toString() {
if ( $this->node instanceof DOMNodeList ) {
$s = '';
foreach ( $this->node as $node ) {
/**
* @return bool|PPNode_DOM
*/
- function getChildren() {
+ public function getChildren() {
return $this->node->childNodes ? new self( $this->node->childNodes ) : false;
}
/**
* @return bool|PPNode_DOM
*/
- function getFirstChild() {
+ public function getFirstChild() {
return $this->node->firstChild ? new self( $this->node->firstChild ) : false;
}
/**
* @return bool|PPNode_DOM
*/
- function getNextSibling() {
+ public function getNextSibling() {
return $this->node->nextSibling ? new self( $this->node->nextSibling ) : false;
}
*
* @return bool|PPNode_DOM
*/
- function getChildrenOfType( $type ) {
+ public function getChildrenOfType( $type ) {
return new self( $this->getXPath()->query( $type, $this->node ) );
}
/**
* @return int
*/
- function getLength() {
+ public function getLength() {
if ( $this->node instanceof DOMNodeList ) {
return $this->node->length;
} else {
* @param int $i
* @return bool|PPNode_DOM
*/
- function item( $i ) {
+ public function item( $i ) {
$item = $this->node->item( $i );
return $item ? new self( $item ) : false;
}
/**
* @return string
*/
- function getName() {
+ public function getName() {
if ( $this->node instanceof DOMNodeList ) {
return '#nodelist';
} else {
* @throws MWException
* @return array
*/
- function splitArg() {
+ public function splitArg() {
$xpath = $this->getXPath();
$names = $xpath->query( 'name', $this->node );
$values = $xpath->query( 'value', $this->node );
* @throws MWException
* @return array
*/
- function splitExt() {
+ public function splitExt() {
$xpath = $this->getXPath();
$names = $xpath->query( 'name', $this->node );
$attrs = $xpath->query( 'attr', $this->node );
* @throws MWException
* @return array
*/
- function splitHeading() {
+ public function splitHeading() {
if ( $this->getName() !== 'h' ) {
throw new MWException( 'Invalid h node passed to ' . __METHOD__ );
}
* @ingroup Parser
*/
class Preprocessor_Hash implements Preprocessor {
+
/**
* @var Parser
*/
- var $parser;
+ public $parser;
const CACHE_VERSION = 1;
- function __construct( $parser ) {
+ public function __construct( $parser ) {
$this->parser = $parser;
}
/**
* @return PPFrame_Hash
*/
- function newFrame() {
+ public function newFrame() {
return new PPFrame_Hash( $this );
}
* @param array $args
* @return PPCustomFrame_Hash
*/
- function newCustomFrame( $args ) {
+ public function newCustomFrame( $args ) {
return new PPCustomFrame_Hash( $this, $args );
}
* @param array $values
* @return PPNode_Hash_Array
*/
- function newPartNodeArray( $values ) {
+ public function newPartNodeArray( $values ) {
$list = array();
foreach ( $values as $k => $val ) {
* @throws MWException
* @return PPNode_Hash_Tree
*/
- function preprocessToObj( $text, $flags = 0 ) {
+ public function preprocessToObj( $text, $flags = 0 ) {
wfProfileIn( __METHOD__ );
// Check cache.
* @ingroup Parser
*/
class PPDStack_Hash extends PPDStack {
- function __construct() {
+ public function __construct() {
$this->elementClass = 'PPDStackElement_Hash';
parent::__construct();
$this->rootAccum = new PPDAccum_Hash;
* @ingroup Parser
*/
class PPDStackElement_Hash extends PPDStackElement {
- function __construct( $data = array() ) {
+ public function __construct( $data = array() ) {
$this->partClass = 'PPDPart_Hash';
parent::__construct( $data );
}
* @param int|bool $openingCount
* @return PPDAccum_Hash
*/
- function breakSyntax( $openingCount = false ) {
+ public function breakSyntax( $openingCount = false ) {
if ( $this->open == "\n" ) {
$accum = $this->parts[0]->out;
} else {
* @ingroup Parser
*/
class PPDPart_Hash extends PPDPart {
- function __construct( $out = '' ) {
+ public function __construct( $out = '' ) {
$accum = new PPDAccum_Hash;
if ( $out !== '' ) {
$accum->addLiteral( $out );
* @ingroup Parser
*/
class PPDAccum_Hash {
- var $firstNode, $lastNode;
+ public $firstNode, $lastNode;
- function __construct() {
+ public function __construct() {
$this->firstNode = $this->lastNode = false;
}
* Append a string literal
* @param string $s
*/
- function addLiteral( $s ) {
+ public function addLiteral( $s ) {
if ( $this->lastNode === false ) {
$this->firstNode = $this->lastNode = new PPNode_Hash_Text( $s );
} elseif ( $this->lastNode instanceof PPNode_Hash_Text ) {
* Append a PPNode
* @param PPNode $node
*/
- function addNode( PPNode $node ) {
+ public function addNode( PPNode $node ) {
if ( $this->lastNode === false ) {
$this->firstNode = $this->lastNode = $node;
} else {
* @param string $name
* @param string $value
*/
- function addNodeWithText( $name, $value ) {
+ public function addNodeWithText( $name, $value ) {
$node = PPNode_Hash_Tree::newWithText( $name, $value );
$this->addNode( $node );
}
* subsequently be modified, especially nextSibling.
* @param PPDAccum_Hash $accum
*/
- function addAccum( $accum ) {
+ public function addAccum( $accum ) {
if ( $accum->lastNode === false ) {
// nothing to add
} elseif ( $this->lastNode === false ) {
/**
* @var Parser
*/
- var $parser;
+ public $parser;
/**
* @var Preprocessor
*/
- var $preprocessor;
+ public $preprocessor;
/**
* @var Title
*/
- var $title;
- var $titleCache;
+ public $title;
+ public $titleCache;
/**
* Hashtable listing templates which are disallowed for expansion in this frame,
* having been encountered previously in parent frames.
*/
- var $loopCheckHash;
+ public $loopCheckHash;
/**
* Recursion depth of this frame, top = 0
* Note that this is NOT the same as expansion depth in expand()
*/
- var $depth;
+ public $depth;
private $volatile = false;
private $ttl = null;
* Construct a new preprocessor frame.
* @param Preprocessor $preprocessor The parent preprocessor
*/
- function __construct( $preprocessor ) {
+ public function __construct( $preprocessor ) {
$this->preprocessor = $preprocessor;
$this->parser = $preprocessor->parser;
$this->title = $this->parser->mTitle;
* @throws MWException
* @return PPTemplateFrame_Hash
*/
- function newChild( $args = false, $title = false, $indexOffset = 0 ) {
+ public function newChild( $args = false, $title = false, $indexOffset = 0 ) {
$namedArgs = array();
$numberedArgs = array();
if ( $title === false ) {
* @param int $flags
* @return string
*/
- function cachedExpand( $key, $root, $flags = 0 ) {
+ public function cachedExpand( $key, $root, $flags = 0 ) {
// we don't have a parent, so we don't have a cache
return $this->expand( $root, $flags );
}
* @param int $flags
* @return string
*/
- function expand( $root, $flags = 0 ) {
+ public function expand( $root, $flags = 0 ) {
static $expansionDepth = 0;
if ( is_string( $root ) ) {
return $root;
* @param int $flags
* @return string
*/
- function implodeWithFlags( $sep, $flags /*, ... */ ) {
+ public function implodeWithFlags( $sep, $flags /*, ... */ ) {
$args = array_slice( func_get_args(), 2 );
$first = true;
* @param string $sep
* @return string
*/
- function implode( $sep /*, ... */ ) {
+ public function implode( $sep /*, ... */ ) {
$args = array_slice( func_get_args(), 1 );
$first = true;
* @param string $sep
* @return PPNode_Hash_Array
*/
- function virtualImplode( $sep /*, ... */ ) {
+ public function virtualImplode( $sep /*, ... */ ) {
$args = array_slice( func_get_args(), 1 );
$out = array();
$first = true;
* @param string $end
* @return PPNode_Hash_Array
*/
- function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
+ public function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
$args = array_slice( func_get_args(), 3 );
$out = array( $start );
$first = true;
return new PPNode_Hash_Array( $out );
}
- function __toString() {
+ public function __toString() {
return 'frame{}';
}
* @param bool $level
* @return array|bool|string
*/
- function getPDBK( $level = false ) {
+ public function getPDBK( $level = false ) {
if ( $level === false ) {
return $this->title->getPrefixedDBkey();
} else {
/**
* @return array
*/
- function getArguments() {
+ public function getArguments() {
return array();
}
/**
* @return array
*/
- function getNumberedArguments() {
+ public function getNumberedArguments() {
return array();
}
/**
* @return array
*/
- function getNamedArguments() {
+ public function getNamedArguments() {
return array();
}
*
* @return bool
*/
- function isEmpty() {
+ public function isEmpty() {
return true;
}
* @param string $name
* @return bool
*/
- function getArgument( $name ) {
+ public function getArgument( $name ) {
return false;
}
*
* @return bool
*/
- function loopCheck( $title ) {
+ public function loopCheck( $title ) {
return !isset( $this->loopCheckHash[$title->getPrefixedDBkey()] );
}
*
* @return bool
*/
- function isTemplate() {
+ public function isTemplate() {
return false;
}
*
* @return Title
*/
- function getTitle() {
+ public function getTitle() {
return $this->title;
}
*
* @param bool $flag
*/
- function setVolatile( $flag = true ) {
+ public function setVolatile( $flag = true ) {
$this->volatile = $flag;
}
*
* @return bool
*/
- function isVolatile() {
+ public function isVolatile() {
return $this->volatile;
}
*
* @param int $ttl
*/
- function setTTL( $ttl ) {
+ public function setTTL( $ttl ) {
if ( $ttl !== null && ( $this->ttl === null || $ttl < $this->ttl ) ) {
$this->ttl = $ttl;
}
*
* @return int|null
*/
- function getTTL() {
+ public function getTTL() {
return $this->ttl;
}
}
* @ingroup Parser
*/
class PPTemplateFrame_Hash extends PPFrame_Hash {
- var $numberedArgs, $namedArgs, $parent;
- var $numberedExpansionCache, $namedExpansionCache;
+ public $numberedArgs, $namedArgs, $parent;
+ public $numberedExpansionCache, $namedExpansionCache;
/**
* @param Preprocessor $preprocessor
* @param array $namedArgs
* @param bool|Title $title
*/
- function __construct( $preprocessor, $parent = false, $numberedArgs = array(),
+ public function __construct( $preprocessor, $parent = false, $numberedArgs = array(),
$namedArgs = array(), $title = false
) {
parent::__construct( $preprocessor );
$this->numberedExpansionCache = $this->namedExpansionCache = array();
}
- function __toString() {
+ public function __toString() {
$s = 'tplframe{';
$first = true;
$args = $this->numberedArgs + $this->namedArgs;
* @param int $flags
* @return string
*/
- function cachedExpand( $key, $root, $flags = 0 ) {
+ public function cachedExpand( $key, $root, $flags = 0 ) {
if ( isset( $this->parent->childExpansionCache[$key] ) ) {
return $this->parent->childExpansionCache[$key];
}
*
* @return bool
*/
- function isEmpty() {
+ public function isEmpty() {
return !count( $this->numberedArgs ) && !count( $this->namedArgs );
}
/**
* @return array
*/
- function getArguments() {
+ public function getArguments() {
$arguments = array();
foreach ( array_merge(
array_keys( $this->numberedArgs ),
/**
* @return array
*/
- function getNumberedArguments() {
+ public function getNumberedArguments() {
$arguments = array();
foreach ( array_keys( $this->numberedArgs ) as $key ) {
$arguments[$key] = $this->getArgument( $key );
/**
* @return array
*/
- function getNamedArguments() {
+ public function getNamedArguments() {
$arguments = array();
foreach ( array_keys( $this->namedArgs ) as $key ) {
$arguments[$key] = $this->getArgument( $key );
* @param int $index
* @return array|bool
*/
- function getNumberedArgument( $index ) {
+ public function getNumberedArgument( $index ) {
if ( !isset( $this->numberedArgs[$index] ) ) {
return false;
}
* @param string $name
* @return bool
*/
- function getNamedArgument( $name ) {
+ public function getNamedArgument( $name ) {
if ( !isset( $this->namedArgs[$name] ) ) {
return false;
}
* @param string $name
* @return array|bool
*/
- function getArgument( $name ) {
+ public function getArgument( $name ) {
$text = $this->getNumberedArgument( $name );
if ( $text === false ) {
$text = $this->getNamedArgument( $name );
*
* @return bool
*/
- function isTemplate() {
+ public function isTemplate() {
return true;
}
- function setVolatile( $flag = true ) {
+ public function setVolatile( $flag = true ) {
parent::setVolatile( $flag );
$this->parent->setVolatile( $flag );
}
- function setTTL( $ttl ) {
+ public function setTTL( $ttl ) {
parent::setTTL( $ttl );
$this->parent->setTTL( $ttl );
}
* @ingroup Parser
*/
class PPCustomFrame_Hash extends PPFrame_Hash {
- var $args;
+ public $args;
- function __construct( $preprocessor, $args ) {
+ public function __construct( $preprocessor, $args ) {
parent::__construct( $preprocessor );
$this->args = $args;
}
- function __toString() {
+ public function __toString() {
$s = 'cstmframe{';
$first = true;
foreach ( $this->args as $name => $value ) {
/**
* @return bool
*/
- function isEmpty() {
+ public function isEmpty() {
return !count( $this->args );
}
* @param int $index
* @return bool
*/
- function getArgument( $index ) {
+ public function getArgument( $index ) {
if ( !isset( $this->args[$index] ) ) {
return false;
}
return $this->args[$index];
}
- function getArguments() {
+ public function getArguments() {
return $this->args;
}
}
* @ingroup Parser
*/
class PPNode_Hash_Tree implements PPNode {
- var $name, $firstChild, $lastChild, $nextSibling;
+ public $name, $firstChild, $lastChild, $nextSibling;
- function __construct( $name ) {
+ public function __construct( $name ) {
$this->name = $name;
$this->firstChild = $this->lastChild = $this->nextSibling = false;
}
- function __toString() {
+ public function __toString() {
$inner = '';
$attribs = '';
for ( $node = $this->firstChild; $node; $node = $node->nextSibling ) {
* @param string $text
* @return PPNode_Hash_Tree
*/
- static function newWithText( $name, $text ) {
+ public static function newWithText( $name, $text ) {
$obj = new self( $name );
$obj->addChild( new PPNode_Hash_Text( $text ) );
return $obj;
}
- function addChild( $node ) {
+ public function addChild( $node ) {
if ( $this->lastChild === false ) {
$this->firstChild = $this->lastChild = $node;
} else {
/**
* @return PPNode_Hash_Array
*/
- function getChildren() {
+ public function getChildren() {
$children = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
$children[] = $child;
return new PPNode_Hash_Array( $children );
}
- function getFirstChild() {
+ public function getFirstChild() {
return $this->firstChild;
}
- function getNextSibling() {
+ public function getNextSibling() {
return $this->nextSibling;
}
- function getChildrenOfType( $name ) {
+ public function getChildrenOfType( $name ) {
$children = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
if ( isset( $child->name ) && $child->name === $name ) {
/**
* @return bool
*/
- function getLength() {
+ public function getLength() {
return false;
}
* @param int $i
* @return bool
*/
- function item( $i ) {
+ public function item( $i ) {
return false;
}
/**
* @return string
*/
- function getName() {
+ public function getName() {
return $this->name;
}
* @throws MWException
* @return array
*/
- function splitArg() {
+ public function splitArg() {
$bits = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
if ( !isset( $child->name ) ) {
* @throws MWException
* @return array
*/
- function splitExt() {
+ public function splitExt() {
$bits = array();
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
if ( !isset( $child->name ) ) {
* @throws MWException
* @return array
*/
- function splitHeading() {
+ public function splitHeading() {
if ( $this->name !== 'h' ) {
throw new MWException( 'Invalid h node passed to ' . __METHOD__ );
}
* @throws MWException
* @return array
*/
- function splitTemplate() {
+ public function splitTemplate() {
$parts = array();
$bits = array( 'lineStart' => '' );
for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
* @ingroup Parser
*/
class PPNode_Hash_Text implements PPNode {
- var $value, $nextSibling;
+ public $value, $nextSibling;
- function __construct( $value ) {
+ public function __construct( $value ) {
if ( is_object( $value ) ) {
throw new MWException( __CLASS__ . ' given object instead of string' );
}
$this->value = $value;
}
- function __toString() {
+ public function __toString() {
return htmlspecialchars( $this->value );
}
- function getNextSibling() {
+ public function getNextSibling() {
return $this->nextSibling;
}
- function getChildren() {
+ public function getChildren() {
return false;
}
- function getFirstChild() {
+ public function getFirstChild() {
return false;
}
- function getChildrenOfType( $name ) {
+ public function getChildrenOfType( $name ) {
return false;
}
- function getLength() {
+ public function getLength() {
return false;
}
- function item( $i ) {
+ public function item( $i ) {
return false;
}
- function getName() {
+ public function getName() {
return '#text';
}
- function splitArg() {
+ public function splitArg() {
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitExt() {
+ public function splitExt() {
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitHeading() {
+ public function splitHeading() {
throw new MWException( __METHOD__ . ': not supported' );
}
}
* @ingroup Parser
*/
class PPNode_Hash_Array implements PPNode {
- var $value, $nextSibling;
+ public $value, $nextSibling;
- function __construct( $value ) {
+ public function __construct( $value ) {
$this->value = $value;
}
- function __toString() {
+ public function __toString() {
return var_export( $this, true );
}
- function getLength() {
+ public function getLength() {
return count( $this->value );
}
- function item( $i ) {
+ public function item( $i ) {
return $this->value[$i];
}
- function getName() {
+ public function getName() {
return '#nodelist';
}
- function getNextSibling() {
+ public function getNextSibling() {
return $this->nextSibling;
}
- function getChildren() {
+ public function getChildren() {
return false;
}
- function getFirstChild() {
+ public function getFirstChild() {
return false;
}
- function getChildrenOfType( $name ) {
+ public function getChildrenOfType( $name ) {
return false;
}
- function splitArg() {
+ public function splitArg() {
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitExt() {
+ public function splitExt() {
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitHeading() {
+ public function splitHeading() {
throw new MWException( __METHOD__ . ': not supported' );
}
}
* @ingroup Parser
*/
class PPNode_Hash_Attr implements PPNode {
- var $name, $value, $nextSibling;
+ public $name, $value, $nextSibling;
- function __construct( $name, $value ) {
+ public function __construct( $name, $value ) {
$this->name = $name;
$this->value = $value;
}
- function __toString() {
+ public function __toString() {
return "<@{$this->name}>" . htmlspecialchars( $this->value ) . "</@{$this->name}>";
}
- function getName() {
+ public function getName() {
return $this->name;
}
- function getNextSibling() {
+ public function getNextSibling() {
return $this->nextSibling;
}
- function getChildren() {
+ public function getChildren() {
return false;
}
- function getFirstChild() {
+ public function getFirstChild() {
return false;
}
- function getChildrenOfType( $name ) {
+ public function getChildrenOfType( $name ) {
return false;
}
- function getLength() {
+ public function getLength() {
return false;
}
- function item( $i ) {
+ public function item( $i ) {
return false;
}
- function splitArg() {
+ public function splitArg() {
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitExt() {
+ public function splitExt() {
throw new MWException( __METHOD__ . ': not supported' );
}
- function splitHeading() {
+ public function splitHeading() {
throw new MWException( __METHOD__ . ': not supported' );
}
}
/**
* @param string $prefix
*/
- function __construct( $prefix ) {
+ public function __construct( $prefix ) {
$this->prefix = $prefix;
$this->data = array(
'nowiki' => array(),
* @param string $marker
* @param string $value
*/
- function addNoWiki( $marker, $value ) {
+ public function addNoWiki( $marker, $value ) {
$this->addItem( 'nowiki', $marker, $value );
}
* @param string $marker
* @param string $value
*/
- function addGeneral( $marker, $value ) {
+ public function addGeneral( $marker, $value ) {
$this->addItem( 'general', $marker, $value );
}
* @param string $text
* @return mixed
*/
- function unstripGeneral( $text ) {
+ public function unstripGeneral( $text ) {
return $this->unstripType( 'general', $text );
}
* @param string $text
* @return mixed
*/
- function unstripNoWiki( $text ) {
+ public function unstripNoWiki( $text ) {
return $this->unstripType( 'nowiki', $text );
}
* @param string $text
* @return mixed
*/
- function unstripBoth( $text ) {
+ public function unstripBoth( $text ) {
$text = $this->unstripType( 'general', $text );
$text = $this->unstripType( 'nowiki', $text );
return $text;
*
* @return StripState
*/
- function getSubState( $text ) {
+ public function getSubState( $text ) {
$subState = new StripState( $this->prefix );
$pos = 0;
while ( true ) {
* @param array $texts
* @return array
*/
- function merge( $otherState, $texts ) {
+ public function merge( $otherState, $texts ) {
$mergePrefix = Parser::getRandomString();
foreach ( $otherState->data as $type => $items ) {
* @param string $text Input string
* @return string
*/
- function killMarkers( $text ) {
+ public function killMarkers( $text ) {
return preg_replace( $this->regex, '', $text );
}
}