Server IP : 172.67.158.161 / Your IP : 3.133.108.103 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/ |
Upload File : |
<?php /** * Rule processor for publishing if wc-admin has been active for at least the * given number of seconds. */ namespace Automattic\WooCommerce\Admin\RemoteInboxNotifications; defined( 'ABSPATH' ) || exit; /** * Rule processor for publishing if wc-admin has been active for at least the * given number of seconds. */ class WCAdminActiveForRuleProcessor implements RuleProcessorInterface { /** * Constructor * * @param object $wcadmin_active_for_provider Provides the amount of time wcadmin has been active for. */ public function __construct( $wcadmin_active_for_provider = null ) { $this->wcadmin_active_for_provider = null === $wcadmin_active_for_provider ? new WCAdminActiveForProvider() : $wcadmin_active_for_provider; } /** * Performs a comparison operation against the amount of time wc-admin has * been active for in days. * * @param object $rule The rule being processed. * @param object $stored_state Stored state. * * @return bool The result of the operation. */ public function process( $rule, $stored_state ) { $active_for_seconds = $this->wcadmin_active_for_provider->get_wcadmin_active_for_in_seconds(); $rule_seconds = $rule->days * DAY_IN_SECONDS; return ComparisonOperation::compare( $active_for_seconds, $rule_seconds, $rule->operation ); } /** * Validates the rule. * * @param object $rule The rule to validate. * * @return bool Pass/fail. */ public function validate( $rule ) { if ( ! isset( $rule->days ) ) { return false; } if ( ! isset( $rule->operation ) ) { return false; } return true; } }