/** @var bool */
private $mFound = false;
- static public $mVariableIDsInitialised = false;
- static public $mVariableIDs = [
+ public static $mVariableIDsInitialised = false;
+ public static $mVariableIDs = [
'!',
'currentmonth',
'currentmonth1',
];
/* Array of caching hints for ParserCache */
- static public $mCacheTTLs = [
+ public static $mCacheTTLs = [
'currentmonth' => 86400,
'currentmonth1' => 86400,
'currentmonthname' => 86400,
'numberingroup' => 3600,
];
- static public $mDoubleUnderscoreIDs = [
+ public static $mDoubleUnderscoreIDs = [
'notoc',
'nogallery',
'forcetoc',
'nocontentconvert',
];
- static public $mSubstIDs = [
+ public static $mSubstIDs = [
'subst',
'safesubst',
];
- static public $mObjects = [];
- static public $mDoubleUnderscoreArray = null;
+ public static $mObjects = [];
+ public static $mDoubleUnderscoreArray = null;
/**#@-*/
- function __construct( $id = 0, $syn = [], $cs = false ) {
+ public function __construct( $id = 0, $syn = [], $cs = false ) {
$this->mId = $id;
$this->mSynonyms = (array)$syn;
$this->mCaseSensitive = $cs;
*
* @return MagicWord
*/
- static function &get( $id ) {
+ public static function &get( $id ) {
if ( !isset( self::$mObjects[$id] ) ) {
$mw = new MagicWord();
$mw->load( $id );
*
* @return array
*/
- static function getVariableIDs() {
+ public static function getVariableIDs() {
if ( !self::$mVariableIDsInitialised ) {
# Get variable IDs
Hooks::run( 'MagicWordwgVariableIDs', [ &self::$mVariableIDs ] );
* Get an array of parser substitution modifier IDs
* @return array
*/
- static function getSubstIDs() {
+ public static function getSubstIDs() {
return self::$mSubstIDs;
}
* @param int $id
* @return int
*/
- static function getCacheTTL( $id ) {
+ public static function getCacheTTL( $id ) {
if ( array_key_exists( $id, self::$mCacheTTLs ) ) {
return self::$mCacheTTLs[$id];
} else {
*
* @return MagicWordArray
*/
- static function getDoubleUnderscoreArray() {
+ public static function getDoubleUnderscoreArray() {
if ( is_null( self::$mDoubleUnderscoreArray ) ) {
Hooks::run( 'GetDoubleUnderscoreIDs', [ &self::$mDoubleUnderscoreIDs ] );
self::$mDoubleUnderscoreArray = new MagicWordArray( self::$mDoubleUnderscoreIDs );
* @param int $id
* @throws MWException
*/
- function load( $id ) {
+ public function load( $id ) {
global $wgContLang;
$this->mId = $id;
$wgContLang->getMagic( $this );
* Preliminary initialisation
* @private
*/
- function initRegex() {
+ public function initRegex() {
// Sort the synonyms by length, descending, so that the longest synonym
// matches in precedence to the shortest
$synonyms = $this->mSynonyms;
*
* @return int
*/
- function compareStringLength( $s1, $s2 ) {
+ public function compareStringLength( $s1, $s2 ) {
$l1 = strlen( $s1 );
$l2 = strlen( $s2 );
if ( $l1 < $l2 ) {
*
* @return string
*/
- function getRegex() {
+ public function getRegex() {
if ( $this->mRegex == '' ) {
$this->initRegex();
}
*
* @return string
*/
- function getRegexCase() {
+ public function getRegexCase() {
if ( $this->mRegex === '' ) {
$this->initRegex();
}
*
* @return string
*/
- function getRegexStart() {
+ public function getRegexStart() {
if ( $this->mRegex == '' ) {
$this->initRegex();
}
* @return string
* @since 1.23
*/
- function getRegexStartToEnd() {
+ public function getRegexStartToEnd() {
if ( $this->mRegexStartToEnd == '' ) {
$this->initRegex();
}
*
* @return string
*/
- function getBaseRegex() {
+ public function getBaseRegex() {
if ( $this->mRegex == '' ) {
$this->initRegex();
}
*
* @return bool
*/
- function match( $text ) {
+ public function match( $text ) {
return (bool)preg_match( $this->getRegex(), $text );
}
*
* @return bool
*/
- function matchStart( $text ) {
+ public function matchStart( $text ) {
return (bool)preg_match( $this->getRegexStart(), $text );
}
* @return bool
* @since 1.23
*/
- function matchStartToEnd( $text ) {
+ public function matchStartToEnd( $text ) {
return (bool)preg_match( $this->getRegexStartToEnd(), $text );
}
*
* @return string
*/
- function matchVariableStartToEnd( $text ) {
+ public function matchVariableStartToEnd( $text ) {
$matches = [];
$matchcount = preg_match( $this->getVariableStartToEndRegex(), $text, $matches );
if ( $matchcount == 0 ) {
*
* @return bool
*/
- function matchAndRemove( &$text ) {
+ public function matchAndRemove( &$text ) {
$this->mFound = false;
$text = preg_replace_callback(
$this->getRegex(),
* @param string $text
* @return bool
*/
- function matchStartAndRemove( &$text ) {
+ public function matchStartAndRemove( &$text ) {
$this->mFound = false;
$text = preg_replace_callback(
$this->getRegexStart(),
*
* @return string
*/
- function pregRemoveAndRecord() {
+ public function pregRemoveAndRecord() {
$this->mFound = true;
return '';
}
*
* @return string
*/
- function replace( $replacement, $subject, $limit = -1 ) {
+ public function replace( $replacement, $subject, $limit = -1 ) {
$res = preg_replace(
$this->getRegex(),
StringUtils::escapeRegexReplacement( $replacement ),
*
* @return string
*/
- function substituteCallback( $text, $callback ) {
+ public function substituteCallback( $text, $callback ) {
$res = preg_replace_callback( $this->getVariableRegex(), $callback, $text );
$this->mModified = $res !== $text;
return $res;
*
* @return string
*/
- function getVariableRegex() {
+ public function getVariableRegex() {
if ( $this->mVariableRegex == '' ) {
$this->initRegex();
}
*
* @return string
*/
- function getVariableStartToEndRegex() {
+ public function getVariableStartToEndRegex() {
if ( $this->mVariableStartToEndRegex == '' ) {
$this->initRegex();
}
*
* @return string
*/
- function getSynonym( $i ) {
+ public function getSynonym( $i ) {
return $this->mSynonyms[$i];
}
/**
* @return array
*/
- function getSynonyms() {
+ public function getSynonyms() {
return $this->mSynonyms;
}
*
* @return bool
*/
- function getWasModified() {
+ public function getWasModified() {
return $this->mModified;
}
*
* @return bool
*/
- function replaceMultiple( $magicarr, $subject, &$result ) {
+ public function replaceMultiple( $magicarr, $subject, &$result ) {
wfDeprecated( __METHOD__, '1.25' );
$search = [];
$replace = [];
* @param array $array
* @param string $value
*/
- function addToArray( &$array, $value ) {
+ public function addToArray( &$array, $value ) {
global $wgContLang;
foreach ( $this->mSynonyms as $syn ) {
$array[$wgContLang->lc( $syn )] = $value;
/**
* @return bool
*/
- function isCaseSensitive() {
+ public function isCaseSensitive() {
return $this->mCaseSensitive;
}
/**
* @return int
*/
- function getId() {
+ public function getId() {
return $this->mId;
}
}