oikai_easy_tokens() – Display tokens

You appear to be a bot. Output may be restricted

Description

Display the PHP source of a method or API

We need two passes of the tokens The first pass sets any links and also detects hooks and hook associations The second displays the results – with the links active.

Usage

oikai_easy_tokens( $tokens, $start, $prepend_php );

Parameters

$tokens
( array ) required – the array of tokens
$start
( string ) required – the start line number ( future use )
$prepend_php
( bool ) required – true if the <?php token has been automatically prepended and now we want to remove it.

Returns

void

TO DO

Improve the logic to strip unwanted leading tokens to either take into account the number of tokens to strip OR any new line characters in string literals

Source

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

1 to 15 of 15
function oikai_easy_tokens( $tokens, $start, $prepend_php ) {
  wp_enqueue_style( "oikai-tokens-css", oik_url( "css/oikai-tokens.css", "oik-shortcodes" ) );
  if ( $prepend_php ) {  
    array_shift( $tokens );
  }
  // @TODO Either strip the last token if it's T_WHITESPACE OR make sure we see it. Otherwise the line numbers can appear to be incorrect.
  // $count = count( $tokens );
  // $last = end( $tokens );
  //bw_trace2( $tokens, "pretokens1", false );
  //p( "Pass 1" );
  oikai_process_tokens1( $tokens );
  //bw_trace2( $tokens, "pretokens2", false );
  //p( "Pass 2" );
  oikai_process_tokens2( $tokens );
}