You are here

function codefilter_process_php_inline in Code Filter 7

Same name and namespace in other branches
  1. 5 codefilter.module \codefilter_process_php_inline()
  2. 6 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 35
Text filter for highlighting PHP source code.

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 PHPs own added code tags.
  $text = str_replace(array(
    '<code>',
    '</code>',
    "\n",
  ), array(
    '',
    '',
    '',
  ), $text);
  return $text;
}