You appear to be a bot. Output may be restricted
Description
Return an array of implemented functions
Usage
$array = _oiksc_list_functions( $tokens );
Parameters
- $tokens
- ( array ) required – array of tokens from token_get_all()
Returns
array $functions – simple array of function names We're looking for sequences of tokens like this: $t T_FUNCTION function $t+1 T_WHITESPACE $t+2 T_STRING function_name $t+3 ( … $t+n ) $t+n+1 { Here's an idea – return the line number as the key!Source
File name: oik-shortcodes/admin/oik-apis.phpLines:
1 to 19 of 19
function _oiksc_list_functions( $tokens ) { $functions = array(); // set an arbitrary end point past which we won't validly find a function due to their not being enough tokens // allowing us to increment $t without any worries $count = count( $tokens ) - 3; $t = 0; while ( $t < $count ) { $function = _oiksc_get_token( $tokens, $t, T_FUNCTION ); if ( $function ) { $t += 2; $function = _oiksc_get_token( $tokens, $t, T_STRING ); if ( $function ) { $functions[] = $function; } } $t++; } return( $functions ); }View on GitHub