You appear to be a bot. Output may be restricted
Description
Handle the add_action() or add_filter() associationWhen it comes to invoking the action it doesn't matter what method is being used to perform the add we just need to know which function is going to be invoked for the hook. The "add_" context changes as we process the filter or action It starts as the function name being used to add the filter or action. Then it becomes the post ID of the hook When it's called with the post_id it means we now know the name of the function that is being associated to the hook oikai_concoct_hook_name2() was misused to return the previously stored function name we now call oikai_concoct_api_name2() which oikai_handle_token_T_STRING() uses to determine the function name.
Usage
oikai_handle_association( $key, $value, $tokens, $add_ );
Parameters
- $key
- ( mixed ) required –
- $value
- ( string ) required – the string literal being processed
- $tokens
- ( mixed ) required –
- $add_
- ( string ) required – the value of the "add_" context
Returns
voidSource
File name: oik-shortcodes/shortcodes/oik-api-importer.phpLines:
function oikai_handle_association( $key, $value, &$tokens, $add_ ) { //bw_trace2(); switch( $add_ ) { case "add_filter": case "add_action": $post_id = oikai_handle_hook( $key, $value, $tokens, $add_, false ); //bw_context( "add_", $value ); bw_context( "add_", $post_id ); break; case null: break; default: // The value of add_ is the post_id of the hook // we need to obtain the value for the function ( T_STRING ) $func = oikai_concoct_api_name2( $tokens ); //br( "handling $key,$value,$add_,#$func#" ); if ( $func ) { $func = trim( $func, "\"'" ); $post_id = oikai_handle_token_T_STRING( $key, $func, $tokens, false ); /** * Record this action/filter hook association. * * @param string $add_ - the function name registering the action or filter hook * @param ID $post_id - post ID of the function being associated */ do_action( "oikai_record_association", $add_, $post_id ); } } }View on GitHub