From d175324b0ff6c39120a501d16794f42a076c2110 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 26 Apr 2009 09:40:25 +0000 Subject: - Patch #267484 by deviantintegral: corrected the filter api documentation. --- modules/filter/filter.api.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/filter/filter.api.php b/modules/filter/filter.api.php index 293405368..91515640e 100644 --- a/modules/filter/filter.api.php +++ b/modules/filter/filter.api.php @@ -114,16 +114,16 @@ function hook_filter($op, $delta = 0, $format = -1, $text = '', $langcode = '', 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('\\3') . '\xFE/php\xFF'", $text); + // Note: we use [ and ] to replace < > during the filtering process. + // For more information, see "Temporary placeholders and + // delimiters" at http://drupal.org/node/209715. + $text = preg_replace('@(.+?)@se', "'[codefilter-code]' . codefilter_escape('\\1') . '[/codefilter-code]'", $text); + $text = preg_replace('@<(\?(php)?|%)(.+?)(\?|%)>@se', "'[codefilter-php]' . codefilter_escape('\\3') . '[/codefilter-php]'", $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](.+?)[/codefilter-code]@se', "codefilter_process_code('$1')", $text); + $text = preg_replace('@[codefilter-php](.+?)[/codefilter-php]@se', "codefilter_process_php('$1')", $text); return $text; default: -- cgit v1.2.3