function _codefilter_prepare in Code Filter 7
Implements hook_filter_FILTER_prepare().
Escape code tags to prevent other filters from acting on them. <code> </code>, <?php ?>, [?php ?], <% %>, and [% %] tags are escaped.
1 string reference to '_codefilter_prepare'
- codefilter_filter_info in ./
codefilter.module - Implements hook_filter_info().
File
- ./
codefilter.module, line 174 - Text filter for highlighting PHP source code.
Code
function _codefilter_prepare($text, $format) {
$callback_prefix = $format->settings['codefilter_prism'] ? '_codefilter_prism' : '_codefilter';
$text = preg_replace_callback('@<code([^>]*)>(.+?)</code>@s', "{$callback_prefix}_escape_code_tag_callback", $text);
$text = preg_replace_callback('@[\\[<](\\?php)(.+?)(\\?)[\\]>]@s', "{$callback_prefix}_escape_php_tag_callback", $text);
return $text;
}