function codefilter_process_php_inline in Code Filter 5
Same name and namespace in other branches
- 6 codefilter.module \codefilter_process_php_inline()
- 7 codefilter.module \codefilter_process_php_inline()
Helper function for codefilter_process_code().
1 string reference to 'codefilter_process_php_inline'
- codefilter_process_code in ./
codefilter.module - Processes chunks of escaped code into HTML.
File
- ./
codefilter.module, line 48
Code
function codefilter_process_php_inline($matches) {
// Undo nl2br
$text = str_replace('<br />', '', $matches[0]);
// Decode entities (the highlighter re-entifies) and highlight text
$text = highlight_string(decode_entities($text), 1);
// In PHP4, highlight_string() returns font tags; replace them with span tags.
$text = str_replace(array(
'<font color="',
'</font>',
), array(
'<span style="color: ',
'</span>',
), $text);
// Remove PHP's own added code tags
$text = str_replace(array(
'<code>',
'</code>',
"\n",
), array(
'',
'',
'',
), $text);
return $text;
}