oikai_handle_association() – Handle the add_action() or add_filter() association

You appear to be a bot. Output may be restricted


Handle the add_action() or add_filter() association

When 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.


oikai_handle_association( $key, $value, $tokens, $add_ );


( mixed ) required
( string ) required – the string literal being processed
( mixed ) required
( string ) required – the value of the "add_" context




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

1 to 30 of 30
function oikai_handle_association( $key, $value, &$tokens, $add_ ) {
  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 );
    case null:
    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 );