'currentdayname',
'currentyear',
'currenttime',
+ 'currenthour',
+ 'localmonth',
+ 'localmonthname',
+ 'localmonthnamegen',
+ 'localmonthabbrev',
+ 'localday',
+ 'localday2',
+ 'localdayname',
+ 'localyear',
+ 'localtime',
+ 'localhour',
'numberofarticles',
'numberoffiles',
'sitename',
'namespacee',
'currentweek',
'currentdow',
+ 'localweek',
+ 'localdow',
'revisionid',
+ 'revisionday',
+ 'revisionday2',
+ 'revisionmonth',
+ 'revisionyear',
+ 'revisiontimestamp',
'subpagename',
'subpagenamee',
'displaytitle',
'basepagenamee',
'urlencode',
'currenttimestamp',
+ 'localtimestamp',
'directionmark',
'language',
'contentlanguage',
'pagesinnamespace',
'numberofadmins',
+ 'defaultsort',
);
static public $mObjects = array();
global $wgContLang;
$this->mId = $id;
$wgContLang->getMagic( $this );
+ if ( !$this->mSynonyms ) {
+ $this->mSynonyms = array( 'dkjsagfjsgashfajsh' );
+ #throw new MWException( "Error: invalid magic word '$id'" );
+ wfDebugLog( 'exception', "Error: invalid magic word '$id'\n" );
+ }
}
/**
$escSyn[] = preg_quote( $synonym, '/' );
$this->mBaseRegex = implode( '|', $escSyn );
- $case = $this->mCaseSensitive ? '' : 'i';
+ $case = $this->mCaseSensitive ? '' : 'iu';
$this->mRegex = "/{$this->mBaseRegex}/{$case}";
$this->mRegexStart = "/^(?:{$this->mBaseRegex})/{$case}";
$this->mVariableRegex = str_replace( "\\$1", "(.*?)", $this->mRegex );
if ( $this->mRegex === '' )
$this->initRegex();
- return $this->mCaseSensitive ? '' : 'i';
+ return $this->mCaseSensitive ? '' : 'iu';
}
/**
* Used in matchAndRemove()
* @private
**/
- function pregRemoveAndRecord( $match ) {
+ function pregRemoveAndRecord( ) {
$this->mFound = true;
return '';
}
* Replaces the word with something else
*/
function replace( $replacement, $subject, $limit=-1 ) {
- $res = preg_replace( $this->getRegex(), wfRegexReplacement( $replacement ), $subject, $limit );
+ $res = preg_replace( $this->getRegex(), StringUtils::escapeRegexReplacement( $replacement ), $subject, $limit );
$this->mModified = !($res === $subject);
return $res;
}
* lookup in a list of magic words
*/
function addToArray( &$array, $value ) {
+ global $wgContLang;
foreach ( $this->mSynonyms as $syn ) {
- $array[$syn] = $value;
+ $array[$wgContLang->lc($syn)] = $value;
}
}