diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-04-26 09:40:25 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-04-26 09:40:25 +0000 |
commit | d175324b0ff6c39120a501d16794f42a076c2110 (patch) | |
tree | 749d89408e523ea60852aa562333ef15b1e1b45f | |
parent | 2abe0e012294513a534e5570db0b239aad4e02ce (diff) | |
download | brdo-d175324b0ff6c39120a501d16794f42a076c2110.tar.gz brdo-d175324b0ff6c39120a501d16794f42a076c2110.tar.bz2 |
- Patch #267484 by deviantintegral: corrected the filter api documentation.
-rw-r--r-- | modules/filter/filter.api.php | 14 |
1 files 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('@<code>(.+?)</code>@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('@<code>(.+?)</code>@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: |