dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pre-fill the link cache with talk page of the user performing the action, and the...
[lhc/web/wiklou.git]
/
includes
/
MagicWord.php
diff --git
a/includes/MagicWord.php
b/includes/MagicWord.php
index
e616639
..
60bfd0f
100644
(file)
--- a/
includes/MagicWord.php
+++ b/
includes/MagicWord.php
@@
-43,6
+43,16
@@
class MagicWord {
'currentyear',
'currenttime',
'currenthour',
'currentyear',
'currenttime',
'currenthour',
+ 'localmonth',
+ 'localmonthname',
+ 'localmonthnamegen',
+ 'localmonthabbrev',
+ 'localday',
+ 'localday2',
+ 'localdayname',
+ 'localyear',
+ 'localtime',
+ 'localhour',
'numberofarticles',
'numberoffiles',
'sitename',
'numberofarticles',
'numberoffiles',
'sitename',
@@
-57,7
+67,14
@@
class MagicWord {
'namespacee',
'currentweek',
'currentdow',
'namespacee',
'currentweek',
'currentdow',
+ 'localweek',
+ 'localdow',
'revisionid',
'revisionid',
+ 'revisionday',
+ 'revisionday2',
+ 'revisionmonth',
+ 'revisionyear',
+ 'revisiontimestamp',
'subpagename',
'subpagenamee',
'displaytitle',
'subpagename',
'subpagenamee',
'displaytitle',
@@
-78,11
+95,13
@@
class MagicWord {
'basepagenamee',
'urlencode',
'currenttimestamp',
'basepagenamee',
'urlencode',
'currenttimestamp',
+ 'localtimestamp',
'directionmark',
'language',
'contentlanguage',
'pagesinnamespace',
'numberofadmins',
'directionmark',
'language',
'contentlanguage',
'pagesinnamespace',
'numberofadmins',
+ 'defaultsort',
);
static public $mObjects = array();
);
static public $mObjects = array();
@@
-137,6
+156,11
@@
class MagicWord {
global $wgContLang;
$this->mId = $id;
$wgContLang->getMagic( $this );
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" );
+ }
}
/**
}
/**
@@
-155,7
+179,7
@@
class MagicWord {
$escSyn[] = preg_quote( $synonym, '/' );
$this->mBaseRegex = implode( '|', $escSyn );
$escSyn[] = preg_quote( $synonym, '/' );
$this->mBaseRegex = implode( '|', $escSyn );
- $case = $this->mCaseSensitive ? '' : 'i';
+ $case = $this->mCaseSensitive ? '' : 'i
u
';
$this->mRegex = "/{$this->mBaseRegex}/{$case}";
$this->mRegexStart = "/^(?:{$this->mBaseRegex})/{$case}";
$this->mVariableRegex = str_replace( "\\$1", "(.*?)", $this->mRegex );
$this->mRegex = "/{$this->mBaseRegex}/{$case}";
$this->mRegexStart = "/^(?:{$this->mBaseRegex})/{$case}";
$this->mVariableRegex = str_replace( "\\$1", "(.*?)", $this->mRegex );
@@
-182,7
+206,7
@@
class MagicWord {
if ( $this->mRegex === '' )
$this->initRegex();
if ( $this->mRegex === '' )
$this->initRegex();
- return $this->mCaseSensitive ? '' : 'i';
+ return $this->mCaseSensitive ? '' : 'i
u
';
}
/**
}
/**
@@
-266,7
+290,7
@@
class MagicWord {
* Used in matchAndRemove()
* @private
**/
* Used in matchAndRemove()
* @private
**/
- function pregRemoveAndRecord(
$match
) {
+ function pregRemoveAndRecord( ) {
$this->mFound = true;
return '';
}
$this->mFound = true;
return '';
}
@@
-275,7
+299,7
@@
class MagicWord {
* Replaces the word with something else
*/
function replace( $replacement, $subject, $limit=-1 ) {
* Replaces the word with something else
*/
function replace( $replacement, $subject, $limit=-1 ) {
- $res = preg_replace( $this->getRegex(),
wf
RegexReplacement( $replacement ), $subject, $limit );
+ $res = preg_replace( $this->getRegex(),
StringUtils::escape
RegexReplacement( $replacement ), $subject, $limit );
$this->mModified = !($res === $subject);
return $res;
}
$this->mModified = !($res === $subject);
return $res;
}
@@
-355,8
+379,9
@@
class MagicWord {
* lookup in a list of magic words
*/
function addToArray( &$array, $value ) {
* lookup in a list of magic words
*/
function addToArray( &$array, $value ) {
+ global $wgContLang;
foreach ( $this->mSynonyms as $syn ) {
foreach ( $this->mSynonyms as $syn ) {
- $array[$
syn
] = $value;
+ $array[$
wgContLang->lc($syn)
] = $value;
}
}
}
}