Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors
PluginsActivatedRuleProcessor::process()
Process the rule.
Method of the class: PluginsActivatedRuleProcessor{}
No Hooks.
Return
true|false
. Whether the rule passes or not.
Usage
$PluginsActivatedRuleProcessor = new PluginsActivatedRuleProcessor(); $PluginsActivatedRuleProcessor->process( $rule, $stored_state );
- $rule(object) (required)
- The specific rule being processed by this rule processor.
- $stored_state(object) (required)
- Stored state.
PluginsActivatedRuleProcessor::process() PluginsActivatedRuleProcessor::process code WC 9.7.1
public function process( $rule, $stored_state ) { if ( ! is_countable( $rule->plugins ) || 0 === count( $rule->plugins ) ) { return false; } $active_plugin_slugs = $this->plugins_provider->get_active_plugin_slugs(); foreach ( $rule->plugins as $plugin_slug ) { if ( ! is_string( $plugin_slug ) ) { $logger = wc_get_logger(); $logger->warning( __( 'Invalid plugin slug provided in the plugins activated rule.', 'woocommerce' ) ); return false; } if ( ! in_array( $plugin_slug, $active_plugin_slugs, true ) ) { return false; } } return true; }