AUTONAMI_TOKENS::parse_tokens( mixed $value, mixed $pieces, mixed $recipe_id, mixed $trigger_data, mixed $user_id, mixed $replace_args )

Method parse_tokens


Parameters Parameters

$value

(Required)

$pieces

(Required)

$recipe_id

(Required)

$trigger_data

(Required)

$user_id

(Required)

$replace_args

(Required)


Top ↑

Return Return

(void)


Source Source

File: src/integrations/autonami/tokens/autonami-tokens.php

	public function parse_tokens( $value, $pieces, $recipe_id, $trigger_data, $user_id, $replace_args ) {

		if ( ! is_array( $pieces ) || ! isset( $pieces[1] ) || ! isset( $pieces[2] ) ) {
			return $value;
		}

		$autonami_parse_tokens = array_merge(
			$this->get_list_triggers(),
			$this->get_tag_triggers()
		);

		if ( ! in_array( $pieces[1], $autonami_parse_tokens, true ) ) {
			return $value;
		}

		$meta_key = $pieces[2];

		$value = Automator()->db->token->get( $meta_key, $replace_args );

		return $value;

	}