WC_Product_Usage_Notice::query_string_matches()private staticWC 1.0

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

Method of the class: WC_Product_Usage_Notice{}

No Hooks.

Return

true|false.

Usage

$result = WC_Product_Usage_Notice::query_string_matches( $screen, $rule );
$screen(\WP_Screen) (required)
Current \WP_Screen object.
$rule(array) (required)
Product usage notice rule.

WC_Product_Usage_Notice::query_string_matches() code WC 9.5.1

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;
}