You are here

function codefilter_process_php_inline in Code Filter 6

Same name and namespace in other branches
  1. 5 codefilter.module \codefilter_process_php_inline()
  2. 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 44

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);

  // Remove PHP's own added code tags
  $text = str_replace(array(
    '<code>',
    '</code>',
    "\n",
  ), array(
    '',
    '',
    '',
  ), $text);
  return $text;
}