WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
класс не описан

Automattic\WooCommerce\Admin\RemoteInboxNotifications

PublishAfterTimeRuleProcessor{} WC 1.0

Rule processor for sending after a specified date/time.

Хуков нет.

Возвращает

Null. Ничего.

Использование

$PublishAfterTimeRuleProcessor = new PublishAfterTimeRuleProcessor();
// use class methods

Методы

  1. __construct( $date_time_provider = null )
  2. process( $rule, $stored_state )
  3. validate( $rule )

Код PublishAfterTimeRuleProcessor{} WC 4.6.0

<?php
class PublishAfterTimeRuleProcessor implements RuleProcessorInterface {
	/**
	 * Constructor.
	 *
	 * @param DateTimeProviderInterface $date_time_provider The DateTime provider.
	 */
	public function __construct( $date_time_provider = null ) {
		$this->date_time_provider = null === $date_time_provider
			? new CurrentDateTimeProvider()
			: $date_time_provider;
	}

	/**
	 * Process the rule.
	 *
	 * @param object $rule         The specific rule being processed by this rule processor.
	 * @param object $stored_state Stored state.
	 *
	 * @return bool Whether the rule passes or not.
	 */
	public function process( $rule, $stored_state ) {
		return $this->date_time_provider->get_now() >= new \DateTime( $rule->publish_after );
	}

	/**
	 * Validates the rule.
	 *
	 * @param object $rule The rule to validate.
	 *
	 * @return bool Pass/fail.
	 */
	public function validate( $rule ) {
		if ( ! isset( $rule->publish_after ) ) {
			return false;
		}

		return true;
	}
}