Reverted r49855, r49656, r49401, r49399, r49397. The language converter cannot be used outside the parser at present without generating a large number of bugs, due to global lifetime state variables, inappropriate $wgParser references, etc. Some refactoring needs to be done before it can be used in this way.

This commit is contained in:
Tim Starling 2009-05-26 07:46:29 +00:00
parent 09a32d6533
commit da372fdec0
3 changed files with 6 additions and 21 deletions

View file

@ -57,7 +57,6 @@ class AbuseFilter {
'length(string)' => 'length',
'lcase(string)' => 'lcase',
'ccnorm(string)' => 'ccnorm',
'convert("vairant", string)' => 'convert',
'rmdoubles(string)' => 'rmdoubles',
'specialratio(string)' => 'specialratio',
'norm(string)' => 'norm',

View file

@ -246,7 +246,6 @@ Please ask a user with permission to add restricted actions to make the change f
'abusefilter-edit-builder-funcs-length' => 'String length (length)',
'abusefilter-edit-builder-funcs-lcase' => 'To lower case (lcase)',
'abusefilter-edit-builder-funcs-ccnorm' => 'Normalise confusable characters (ccnorm)',
'abusefilter-edit-builder-funcs-convert' => 'Convert string to specified variant (convert)',
'abusefilter-edit-builder-funcs-rmdoubles' => 'Remove double-characters (rmdoubles)',
'abusefilter-edit-builder-funcs-specialratio' => 'Special characters / total characters (specialratio)',
'abusefilter-edit-builder-funcs-norm' => 'Normalise (norm)',
@ -17712,7 +17711,6 @@ $messages['zh-hans'] = array(
'abusefilter-edit-builder-funcs-length' => '字符串长度length',
'abusefilter-edit-builder-funcs-lcase' => '字母小写化lcase',
'abusefilter-edit-builder-funcs-ccnorm' => '规范化易混淆字符ccnorm',
'abusefilter-edit-builder-funcs-convert' => '转换字符串到指定语言convert',
'abusefilter-edit-builder-funcs-rmdoubles' => '去除双字节字符rmdoubles',
'abusefilter-edit-builder-funcs-specialratio' => '特殊字符比specialratio',
'abusefilter-edit-builder-funcs-norm' => '规范化norm',
@ -18073,14 +18071,13 @@ $messages['zh-hant'] = array(
'abusefilter-edit-builder-misc-cond' => '條件式(if X then Y else Z)',
'abusefilter-edit-builder-group-funcs' => '函數',
'abusefilter-edit-builder-funcs-length' => '字串長度length',
'abusefilter-edit-builder-funcs-lcase' => '改為小寫lcase',
'abusefilter-edit-builder-funcs-ccnorm' => '修正混淆字符ccnorm',
'abusefilter-edit-builder-funcs-convert' => '轉換字串到指定語言convert',
'abusefilter-edit-builder-funcs-rmdoubles' => '去除雙字元rmdoubles',
'abusefilter-edit-builder-funcs-specialratio' => '特殊字元數與整體字元數比specialratio',
'abusefilter-edit-builder-funcs-lcase' => '改為小寫(lcase)',
'abusefilter-edit-builder-funcs-ccnorm' => '修正混淆字符(ccnorm)',
'abusefilter-edit-builder-funcs-rmdoubles' => '去除雙字元(rmdoubles)',
'abusefilter-edit-builder-funcs-specialratio' => '特殊字元數與整體字元數比(specialratio)',
'abusefilter-edit-builder-funcs-norm' => '正常化norm',
'abusefilter-edit-builder-funcs-count' => '字串 X 在字串 Y 裡出現的次數count',
'abusefilter-edit-builder-funcs-rcount' => '正則表示式 X 出現在字串 Y 的次數rcount',
'abusefilter-edit-builder-funcs-count' => '字串 X 在字串 Y 裡出現的次數(count)',
'abusefilter-edit-builder-funcs-rcount' => '正則表示式 X 出現在字串 Y 的次數(rcount)',
'abusefilter-edit-builder-funcs-rmwhitespace' => '去除空白字元rmwhitespace',
'abusefilter-edit-builder-funcs-rmspecials' => '去除特殊字元rmspecials',
'abusefilter-edit-builder-funcs-ip_in_range' => 'IP是否在範圍內ip_in_range',

View file

@ -365,7 +365,6 @@ class AbuseFilterParser {
'bool' => 'castBool',
'norm' => 'funcNorm',
'ccnorm' => 'funcCCNorm',
'convert' => 'funcConvert',
'specialratio' => 'funcSpecialRatio',
'rmspecials' => 'funcRMSpecials',
'rmdoubles' => 'funcRMDoubles',
@ -1257,16 +1256,6 @@ class AbuseFilterParser {
return new AFPData( AFPData::DString, $wgContLang->lc( $s ) );
}
protected function funcConvert( $args ) {
global $wgContLang;
if( count( $args ) < 2 )
throw new AFPUserVisibleException( 'notenoughargs', $this->mCur->pos,
array( 'lang_convert', 2, count($args) ) );
$v = $args[0]->toString();
$s = $args[1]->toString();
return new AFPData( AFPData::DString, $wgContLang->convert( $s, false, $v ) );
}
protected function funcLen( $args ) {
if( count( $args ) < 1 )
throw new AFPUserVisibleException( 'notenoughargs', $this->mCur->pos,