Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php |
— | — | @@ -446,6 +446,7 @@ |
447 | 447 | 'strlen' => 'funcLen', |
448 | 448 | 'strpos' => 'funcStrPos', |
449 | 449 | 'str_replace' => 'funcStrReplace', |
| 450 | + 'rescape' => 'funcStrRegexEscape', |
450 | 451 | 'set' => 'funcSetVar', |
451 | 452 | 'set_var' => 'funcSetVar', |
452 | 453 | ); |
— | — | @@ -1742,6 +1743,17 @@ |
1743 | 1744 | return new AFPData( AFPData::DString, str_replace( $search, $replace, $subject ) ); |
1744 | 1745 | } |
1745 | 1746 | |
| 1747 | + protected function funcStrRegexEscape( $args ) { |
| 1748 | + if ( count( $args ) < 1 ) { |
| 1749 | + throw new AFPUserVisibleException( 'notenoughargs', $this->mCur->pos, |
| 1750 | + array( 'rescape', 1, count( $args ) ) ); |
| 1751 | + } |
| 1752 | + |
| 1753 | + $string = $args[0]->toString(); |
| 1754 | + |
| 1755 | + return new AFPData( AFPData::DString, preg_quote( $string ) ); |
| 1756 | + } |
| 1757 | + |
1746 | 1758 | protected function funcSetVar( $args ) { |
1747 | 1759 | if ( count( $args ) < 2 ) { |
1748 | 1760 | throw new AFPUserVisibleException( |