Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php |
— | — | @@ -365,6 +365,7 @@ |
366 | 366 | 'bool' => 'castBool', |
367 | 367 | 'norm' => 'funcNorm', |
368 | 368 | 'ccnorm' => 'funcCCNorm', |
| 369 | + 'convert' => 'funcConvert', |
369 | 370 | 'specialratio' => 'funcSpecialRatio', |
370 | 371 | 'rmspecials' => 'funcRMSpecials', |
371 | 372 | 'rmdoubles' => 'funcRMDoubles', |
— | — | @@ -1254,6 +1255,16 @@ |
1255 | 1256 | return new AFPData( AFPData::DString, $wgContLang->lc( $s ) ); |
1256 | 1257 | } |
1257 | 1258 | |
| 1259 | + protected function funcConvert( $args ) { |
| 1260 | + global $wgContLang; |
| 1261 | + if( count( $args ) < 2 ) |
| 1262 | + throw new AFPUserVisibleException( 'notenoughargs', $this->mCur->pos, |
| 1263 | + array( 'lang_convert', 2, count($args) ) ); |
| 1264 | + $v = $args[0]->toString(); |
| 1265 | + $s = $args[1]->toString(); |
| 1266 | + return new AFPData( AFPData::DString, $wgContLang->convert( $s, false, $v ) ); |
| 1267 | + } |
| 1268 | + |
1258 | 1269 | protected function funcLen( $args ) { |
1259 | 1270 | if( count( $args ) < 1 ) |
1260 | 1271 | throw new AFPUserVisibleException( 'notenoughargs', $this->mCur->pos, |
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php |
— | — | @@ -57,6 +57,7 @@ |
58 | 58 | 'length(string)' => 'length', |
59 | 59 | 'lcase(string)' => 'lcase', |
60 | 60 | 'ccnorm(string)' => 'ccnorm', |
| 61 | + 'convert("vairant", string)' => 'convert', |
61 | 62 | 'rmdoubles(string)' => 'rmdoubles', |
62 | 63 | 'specialratio(string)' => 'specialratio', |
63 | 64 | 'norm(string)' => 'norm', |
Index: trunk/extensions/AbuseFilter/AbuseFilter.i18n.php |
— | — | @@ -243,6 +243,7 @@ |
244 | 244 | 'abusefilter-edit-builder-funcs-length' => 'String length (length)', |
245 | 245 | 'abusefilter-edit-builder-funcs-lcase' => 'To lower case (lcase)', |
246 | 246 | 'abusefilter-edit-builder-funcs-ccnorm' => 'Normalise confusable characters (ccnorm)', |
| 247 | + 'abusefilter-edit-builder-funcs-convert' => 'Convert string to specified variant (convert)', |
247 | 248 | 'abusefilter-edit-builder-funcs-rmdoubles' => 'Remove double-characters (rmdoubles)', |
248 | 249 | 'abusefilter-edit-builder-funcs-specialratio' => 'Special characters / total characters (specialratio)', |
249 | 250 | 'abusefilter-edit-builder-funcs-norm' => 'Normalise (norm)', |
— | — | @@ -15939,6 +15940,7 @@ |
15940 | 15941 | 'abusefilter-edit-builder-funcs-length' => '字符串长度(length)', |
15941 | 15942 | 'abusefilter-edit-builder-funcs-lcase' => '字母小写化(lcase)', |
15942 | 15943 | 'abusefilter-edit-builder-funcs-ccnorm' => '规范化易混淆字符(ccnorm)', |
| 15944 | + 'abusefilter-edit-builder-funcs-convert' => '转换字符串到指定语言(convert)', |
15943 | 15945 | 'abusefilter-edit-builder-funcs-rmdoubles' => '去除双字节字符(rmdoubles)', |
15944 | 15946 | 'abusefilter-edit-builder-funcs-specialratio' => '特殊字符比(specialratio)', |
15945 | 15947 | 'abusefilter-edit-builder-funcs-norm' => '规范化(norm)', |
— | — | @@ -16299,13 +16301,14 @@ |
16300 | 16302 | 'abusefilter-edit-builder-misc-cond' => '條件式(if X then Y else Z)', |
16301 | 16303 | 'abusefilter-edit-builder-group-funcs' => '函數', |
16302 | 16304 | 'abusefilter-edit-builder-funcs-length' => '字串長度(length)', |
16303 | | - 'abusefilter-edit-builder-funcs-lcase' => '改為小寫(lcase)', |
16304 | | - 'abusefilter-edit-builder-funcs-ccnorm' => '修正混淆字符(ccnorm)', |
16305 | | - 'abusefilter-edit-builder-funcs-rmdoubles' => '去除雙字元(rmdoubles)', |
16306 | | - 'abusefilter-edit-builder-funcs-specialratio' => '特殊字元數與整體字元數比(specialratio)', |
| 16305 | + 'abusefilter-edit-builder-funcs-lcase' => '改為小寫(lcase)', |
| 16306 | + 'abusefilter-edit-builder-funcs-ccnorm' => '修正混淆字符(ccnorm)', |
| 16307 | + 'abusefilter-edit-builder-funcs-convert' => '轉換字串到指定語言(convert)', |
| 16308 | + 'abusefilter-edit-builder-funcs-rmdoubles' => '去除雙字元(rmdoubles)', |
| 16309 | + 'abusefilter-edit-builder-funcs-specialratio' => '特殊字元數與整體字元數比(specialratio)', |
16307 | 16310 | 'abusefilter-edit-builder-funcs-norm' => '正常化(norm)', |
16308 | | - 'abusefilter-edit-builder-funcs-count' => '字串 X 在字串 Y 裡出現的次數(count)', |
16309 | | - 'abusefilter-edit-builder-funcs-rcount' => '正則表示式 X 出現在字串 Y 的次數(rcount)', |
| 16311 | + 'abusefilter-edit-builder-funcs-count' => '字串 X 在字串 Y 裡出現的次數(count)', |
| 16312 | + 'abusefilter-edit-builder-funcs-rcount' => '正則表示式 X 出現在字串 Y 的次數(rcount)', |
16310 | 16313 | 'abusefilter-edit-builder-funcs-rmwhitespace' => '去除空白字元(rmwhitespace)', |
16311 | 16314 | 'abusefilter-edit-builder-funcs-rmspecials' => '去除特殊字元(rmspecials)', |
16312 | 16315 | 'abusefilter-edit-builder-funcs-ip_in_range' => 'IP是否在範圍內?(ip_in_range)', |