Index: codefilter.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/codefilter/codefilter.module,v
retrieving revision 1.21.2.6
diff -u -p -r1.21.2.6 codefilter.module
--- codefilter.module 6 Dec 2007 02:04:04 -0000 1.21.2.6
+++ codefilter.module 14 Jan 2008 02:40:48 -0000
@@ -101,15 +101,14 @@ function codefilter_filter($op, $delta =
return t('Allows users to post code verbatim using <code> and <?php ?> tags.');
case 'prepare':
- // Note: we use the bytes 0xFE and 0xFF to replace < > during the filtering process.
- // These bytes are not valid in UTF-8 data and thus least likely to cause problems.
- $text = preg_replace('@(.+?)
@se', "'\xFEcode\xFF'. codefilter_escape('\\1') .'\xFE/code\xFF'", $text);
- $text = preg_replace('@[\[<](\?php|%)(.+?)(\?|%)[\]>]@se', "'\xFEphp\xFF'. codefilter_escape('\\2') .'\xFE/php\xFF'", $text);
+ /* Note: we replace ,
, , [?php ?], <% %>, and [% %] during the filtering process. */
+ $text = preg_replace('@(.+?)
@se', "'[codefilter_code]'. codefilter_escape('$1') .'[/code_codefilter]'", $text);
+ $text = preg_replace('@[\[<](\?php|%)(.+?)(\?|%)[\]>]@se', "'[codefilter_php]'. codefilter_escape('$2') .'[/php_codefilter]'", $text);
return $text;
case 'process':
- $text = preg_replace('@\xFEcode\xFF(.+?)\xFE/code\xFF@se', "codefilter_process_code('$1')", $text);
- $text = preg_replace('@\xFEphp\xFF(.+?)\xFE/php\xFF@se', "codefilter_process_php('$1')", $text);
+ $text = preg_replace('@\[codefilter_code\](.+?)\[/code_codefilter\]@se', "codefilter_process_code('$1')", $text);
+ $text = preg_replace('@\[codefilter_php\](.+?)\[/php_codefilter\]@se', "codefilter_process_php('$1')", $text);
return $text;
default:
@@ -117,4 +116,3 @@ function codefilter_filter($op, $delta =
}
}
-