WC_Product_Usage_Notice::query_string_matches()private staticWC 1.0

Check whether the screen and GET parameter matches a given rule.

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

Хуков нет.

Возвращает

true|false.

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

$result = WC_Product_Usage_Notice::query_string_matches( $screen, $rule );
$screen(\WP_Screen) (обязательный)
Current \WP_Screen object.
$rule(массив) (обязательный)
Product usage notice rule.

Код WC_Product_Usage_Notice::query_string_matches() WC 9.4.2

private static function query_string_matches( $screen, $rule ) {
	if ( empty( $rule['screens'][ $screen->id ]['qs'] ) ) {
		return true;
	}

	$qs = $rule['screens'][ $screen->id ]['qs'];
	foreach ( $qs as $key => $val ) {
		// phpcs:disable WordPress.Security.NonceVerification.Recommended
		if ( empty( $_GET[ $key ] ) || $_GET[ $key ] !== $val ) {
			return false;
		}
		// phpcs:enable WordPress.Security.NonceVerification.Recommended
	}
	return true;
}