Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php |
— | — | @@ -303,6 +303,7 @@ |
304 | 304 | 'specialratio' => 'funcSpecialRatio', |
305 | 305 | 'rmspecials' => 'funcRMSpecials', |
306 | 306 | 'rmdoubles' => 'funcRMDoubles', |
| 307 | + 'rmwhitespace' => 'funcRMWhitespace', |
307 | 308 | 'count' => 'funcCount' |
308 | 309 | ); |
309 | 310 | |
— | — | @@ -1003,6 +1004,10 @@ |
1004 | 1005 | return AntiSpoof::listToString($ret); |
1005 | 1006 | } |
1006 | 1007 | |
| 1008 | + protected function rmwhitespace( $s ) { |
| 1009 | + return preg_replace( '/\s+/u', '', $s ); |
| 1010 | + } |
| 1011 | + |
1007 | 1012 | protected function funcRMSpecials( $args ) { |
1008 | 1013 | if( count( $args ) < 1 ) |
1009 | 1014 | throw new AFPExpection( "No params passed to ".__METHOD__ ); |
— | — | @@ -1013,6 +1018,16 @@ |
1014 | 1019 | return new AFPData( AFPData::DString, $s ); |
1015 | 1020 | } |
1016 | 1021 | |
| 1022 | + protected function funcRMWhitespace( $args ) { |
| 1023 | + if( count( $args ) < 1 ) |
| 1024 | + throw new AFPExpection( "No params passed to ".__METHOD__ ); |
| 1025 | + $s = $args[0]->toString(); |
| 1026 | + |
| 1027 | + $s = $this->rmwhitespace( $s ); |
| 1028 | + |
| 1029 | + return new AFPData( AFPData::DString, $s ); |
| 1030 | + } |
| 1031 | + |
1017 | 1032 | protected function funcRMDoubles( $args ) { |
1018 | 1033 | if( count( $args ) < 1 ) |
1019 | 1034 | throw new AFPExpection( "No params passed to ".__METHOD__ ); |
— | — | @@ -1031,6 +1046,7 @@ |
1032 | 1047 | $s = $this->ccnorm($s); |
1033 | 1048 | $s = $this->rmdoubles( $s ); |
1034 | 1049 | $s = $this->rmspecials( $s ); |
| 1050 | + $s = $this->rmwhitespace( $s ); |
1035 | 1051 | |
1036 | 1052 | return new AFPData( AFPData::DString, $s ); |
1037 | 1053 | } |