\\0", $output ); $output = preg_replace( "@(ezc[A-Z][a-zA-Z0-9]+)::([A-Za-z0-9_]+)(?=\()@", "\\0", $output ); $output = preg_replace( "@(ezc[A-Z][a-zA-Z0-9]+)-(>|\>)([A-Za-z0-9_]+)(?=\()@", "\\0", $output ); $output = preg_replace( "@(ezc[A-Z][a-zA-Z0-9]+)::([A-Z_]+)\\b@", "\\0", $output ); $output = preg_replace( "@(?])(ezc[A-Z][a-zA-Z0-9]+)@", "\\0", $output ); $output = preg_replace( "@()(ezc[A-Z][a-zA-Z0-9]+)(\()@", "\\1\\2\\3", $output ); $output = preg_replace( "@(ezc[A-Z][a-zA-Z]+)(::)([A-Z_]+)@", "\\1::\\3", $output ); $output = preg_replace( "@()(ezc[A-Z][a-zA-Z0-9]+)()@", "\\1\\2\\3", $output ); $output = preg_replace( "@()(ezc[A-Z][a-zA-Z0-9]+)(::)([A-Za-z]+)()@", "\\1\\2::\\4\\5", $output ); $output = preg_replace( "@()(ezc[A-Z][a-zA-Z0-9]+Exception)(\ \\$)@", "\\1\\2\\3", $output ); return $output; } function addExampleLineNumbers( $output ) { return preg_replace_callback( '@]*>(.+?)<\/code>@ms', 'callbackAddLineNumbers', $output ); } function callbackAddLineNr( $args ) { return sprintf( "
  • %s
  • \n", $args[1] ); } function callbackAddLineNumbers( $args ) { if ( strstr( $args[0], '<?php' ) !== false ) { $highlighted = highlight_string( html_entity_decode( $args[1] ), true ); // Replace starting with
      $highlighted = preg_replace( '@^@Ds', '
        ', $highlighted ); // Move all
        outside of highlighting do { $highlighted = preg_replace( '@()([^<]*)((
        )+)(.*?)(
        )@ms', '\1\2\6\3\1\5\6', $highlighted, -1, $count ); } while ( $count > 0 ); // Remove empty highlighting $highlighted = preg_replace( '@@', '', $highlighted ); // Replace ending
        with
      $highlighted = preg_replace( '@\\s*
      $@Ds', "
    ", $highlighted ); // Replace manual line breaks by wrapping in
  • $highlighted = preg_replace_callback( '@(.*?)
    @', "callbackAddLineNr", $highlighted ); return $highlighted; } else { return $args[0]; } } ?>