Add ability to define filters to use with preg_replace_callback().
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 10 Feb 2010 18:59:58 +0000 (11:59 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 11 Feb 2010 08:24:53 +0000 (01:24 -0700)
framework/Text_Filter/lib/Horde/Text/Filter.php
framework/Text_Filter/package.xml

index 936af51..c4b176e 100644 (file)
@@ -97,6 +97,13 @@ class Horde_Text_Filter
                 $text = preg_replace(array_keys($patterns['regexp']), array_values($patterns['regexp']), $text);
             }
 
+            /* preg_replace_callback complex patterns. */
+            if (isset($patterns['regexp_callback'])) {
+                foreach ($patterns['regexp_callback'] as $key => $val) {
+                    $text = preg_replace_callback($key, $val, $text);
+                }
+            }
+
             /* Post-processing. */
             $text = $filterOb->postProcess($text);
         }
index f656a09..b544cf8 100644 (file)
@@ -37,7 +37,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
   <api>beta</api>
  </stability>
  <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Add 'noprefetch' parameter to XSS filter (Ticket #8836).
+ <notes>* Add ability to define filters to use with preg_replace_callback().
+ * Add 'noprefetch' parameter to XSS filter (Ticket #8836).
  * Add XSS filtering for data URLs in A HREF parameters (Bug #8715).
  * Add support for Google Closure Compiler in javascript minfiy filter.
  * Fix dimming signatures when mixed with quoted text (Bug #4299).