Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors
IsWooExpressRuleProcessor::process
Passes (or fails) based on whether the site is a Woo Express plan.
Метод класса: IsWooExpressRuleProcessor{}
Хуков нет.
Возвращает
true|false. The result of the operation.
Использование
$IsWooExpressRuleProcessor = new IsWooExpressRuleProcessor(); $IsWooExpressRuleProcessor->process( $rule, $stored_state );
- $rule(объект) (обязательный)
- The rule being processed by this rule processor.
- $stored_state(объект) (обязательный)
- Stored state.
Код IsWooExpressRuleProcessor::process() IsWooExpressRuleProcessor::process WC 10.4.3
public function process( $rule, $stored_state ) {
if ( ! function_exists( 'wc_calypso_bridge_is_woo_express_plan' ) ) {
return false === $rule->value;
}
// If the plan is undefined, only check if it's a Woo Express plan.
if ( ! isset( $rule->plan ) ) {
return wc_calypso_bridge_is_woo_express_plan() === $rule->value;
}
// If a plan name is defined, only evaluate the plan if we're on the Woo Express plan.
if ( wc_calypso_bridge_is_woo_express_plan() ) {
$fn = 'wc_calypso_bridge_is_woo_express_' . (string) $rule->plan . '_plan';
if ( function_exists( $fn ) ) {
return $fn() === $rule->value;
}
// If an invalid plan name is given, only evaluate the rule if we're targeting all plans other than the specified (invalid) one.
return false === $rule->value;
}
return false;
}