- Patch #267484 by deviantintegral: corrected the filter api documentation.

merge-requests/26/head
Dries Buytaert 2009-04-26 09:40:25 +00:00
parent 2abe0e0122
commit d175324b0f
1 changed files with 7 additions and 7 deletions

View File

@ -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: