1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<?php
namespace AutomateWoo\Rules;
use AutomateWoo\ShopDataItem; use Exception;
defined( 'ABSPATH' ) || exit;
/** * Class ShopCurrentDateTime. * * @since 5.1.0 * @package AutomateWoo\Rules */ class ShopCurrentDateTime extends Abstract_Date {
/** * Data item type. * * @var string */ public $data_item = 'shop';
/** * Use is not set comparison. * * @var bool */ public $has_is_set = false;
/** * Use is not set comparison. * * @var bool */ public $has_is_not_set = false;
/** * Init. */ public function init() { $this->title = __( 'Shop - Current Date/Time', 'automatewoo' ); }
/** * Validates rule. * * @param ShopDataItem $shop * @param string $compare * @param array|null $value * * @return bool */ public function validate( $shop, $compare, $value = null ) { try { return $this->validate_date( $compare, $value, $shop->get_current_datetime() ); } catch ( Exception $e ) { return false; } } }
|