Wpwh_Tokens::wpwh_token( $value,  $pieces,  $recipe_id,  $trigger_data,  $user_id,  $replace_args )


Parameters Parameters

$value

(Required)

$pieces

(Required)

$recipe_id

(Required)

$trigger_data

(Required)

$user_id

(Required)


Top ↑

Return Return

(string|null)


Source Source

File: src/integrations/wp-webhooks/tokens/wpwh-tokens.php

	public function wpwh_token( $value, $pieces, $recipe_id, $trigger_data, $user_id, $replace_args ) {
		if ( $pieces ) {
			if ( in_array( 'WPWHTRIGGER', $pieces ) ) {
				global $wpdb;
				$token_info   = explode( '|', $pieces[2] );
				$request_data = $this->get_form_data_from_trigger_meta( 'WPWHTRIGGER_request_body', $replace_args['trigger_id'], $replace_args['trigger_log_id'] );
				if ( count( $token_info ) > 1 ) {
					$value = isset( $request_data[ $token_info[0] ][ $token_info[1] ] ) ? $request_data[ $token_info[0] ][ $token_info[1] ] : '';
				} else {
					$value = isset( $request_data[ $token_info[0] ] ) ? $request_data[ $token_info[0] ] : '';
				}
			}
		}

		return $value;
	}