oikai_syntax_source() – Produce a nicely formatted version of the function’s source code

You appear to be a bot. Output may be restricted

Description

Produce a nicely formatted version of the function's source code

Note: You can get sometimes get Warning messages when the source is truncated at an arbitrary line number e.g. Warning: Unterminated comment starting line 100 in \oik-shortcodes\shortcodes\oik-api-importer.php on line 1255 We use the @ prefix on token_get_all() to hide this warning.

Usage

oikai_syntax_source( $sources, $startline, $prepend_php );

Parameters

$sources
( array ) required – source lines for the function
$startline
( int ) required – the start line of the function ( future use )
$prepend_php
( mixed ) optional default: 1 –

Returns

void

Source

File name: oik-shortcodes/shortcodes/oik-api-importer.php
Lines:

1 to 16 of 16
function oikai_syntax_source( $sources, $startline, $prepend_php=true ) {
  if ( $prepend_php ) {
    $content = "<?php\n";
  } else {
    $content = null;
  }  
  $content .= implode( "", $sources );
  //bw_trace2( $content, "content" );
  $tokens = @token_get_all( $content );
  if ( !$prepend_php ) {
    //array_pop( $tokens );
  }
  if ( count( $tokens ) ) { 
    oikai_easy_tokens( $tokens, $startline, $prepend_php );
  }  
}