WC_Product_Usage_Notice::get_current_notice_rule()
Get product usage notice rule from a given WP_Screen object.
Метод класса: WC_Product_Usage_Notice{}
Хуков нет.
Возвращает
Массив
.
Использование
$result = WC_Product_Usage_Notice::get_current_notice_rule( $screen );
- $screen(\WP_Screen) (обязательный)
- Current \WP_Screen object.
Код WC_Product_Usage_Notice::get_current_notice_rule() WC Product Usage Notice::get current notice rule WC 9.4.2
private static function get_current_notice_rule( $screen ) { foreach ( self::$product_usage_notice_rules['products'] as $product_id => $rule ) { if ( ! isset( $rule['screens'][ $screen->id ] ) ) { continue; } // Check query strings. if ( ! self::query_string_matches( $screen, $rule ) ) { continue; } $product_id = absint( $product_id ); $state = WC_Helper::get_product_subscription_state( $product_id ); if ( $state['expired'] || $state['unregistered'] ) { $rule['id'] = $product_id; $rule['state'] = $state; return $rule; } } return array(); }