Automattic\WooCommerce\Internal\StockNotifications

Notification::verification_key_matches │ public │ WC 11.3.0

Check whether the given key matches the stored verification key hash, ignoring expiration.

Метод класса: Notification{}

Хуков нет.

Возвращает

bool. True if a verification key is stored and the given key matches it, false otherwise.

Использование

$Notification = new Notification();
$Notification->verification_key_matches( $key ): bool;
$key(строка) (обязательный)
The key to check.

Список изменений

С версии 11.3.0 Введена.

Код Notification::verification_key_matches() WC 11.3.0

public function verification_key_matches( string $key ): bool {
	$action_key = (string) $this->get_meta( 'verification_action_key' );

	if ( ! str_contains( $action_key, ':' ) ) {
		return false;
	}

	list( , $hash ) = explode( ':', $action_key, 2 );

	return wp_verify_fast_hash( $key, $hash );
}