Index: codefilter.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/codefilter/codefilter.module,v
retrieving revision 1.29
diff -u -p -r1.29 codefilter.module
--- codefilter.module	14 Jan 2008 10:00:46 -0000	1.29
+++ codefilter.module	23 Aug 2010 07:36:34 -0000
@@ -105,6 +105,20 @@ function codefilter_escape($text, $type 
 }
 
 /**
+ * Callback to replace <code> elements.
+ */
+function _codefilter_escape_code_tag($matches) {
+  return codefilter_escape($matches[1], 'code');
+}
+
+/**
+ * Callback to replace <?php ?>, [?php ?], <% %>, and [% %] elements.
+ */
+function _codefilter_escape_php_tag($matches) {
+  return codefilter_escape($matches[2], 'php');
+}
+
+/**
  * Implementation of hook_filter()
  */
 function codefilter_filter($op, $delta = 0, $format = -1, $text = '') {
@@ -118,13 +132,13 @@ function codefilter_filter($op, $delta =
     case 'prepare':
       /* Note: we replace <code> </code>, <?php ?>, [?php ?], <% %>, and [% %]
          to prevent other filters from acting on them. */
-      $text = preg_replace('@<code>(.+?)</code>@se', "codefilter_escape('$1', 'code')", $text);
-      $text = preg_replace('@[\[<](\?php|%)(.+?)(\?|%)[\]>]@se', "codefilter_escape('$2', 'php')", $text);
+      $text = preg_replace_callback('@<code>(.+?)</code>@s', '_codefilter_escape_code_tag', $text);
+      $text = preg_replace_callback('@[\[<](\?php|%)(.+?)(\?|%)[\]>]@s', '_codefilter_escape_php_tag', $text);
       return $text;
 
     case 'process':
-      $text = preg_replace('@\[codefilter_code\](.+?)\[/codefilter_code\]@se', "codefilter_process_code('$1')", $text);
-      $text = preg_replace('@\[codefilter_php\](.+?)\[/codefilter_php\]@se', "codefilter_process_php('$1')", $text);
+      $text = preg_replace_callback('@\[codefilter_code\](.+?)\[/codefilter_code\]@s', 'codefilter_process_code', $text);
+      $text = preg_replace_callback('@\[codefilter_php\](.+?)\[/codefilter_php\]@s', 'codefilter_process_php', $text);
       return $text;
 
     default:
