WC_Product_Usage_Notice::query_string_matches
Check whether the screen and GET parameter matches a given rule.
Method of the class: WC_Product_Usage_Notice{}
No Hooks.
Returns
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() WC Product Usage Notice::query string matches code WC 10.5.0
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;
}