Completed
Branch 973/fix-visible-recaptcha (0580c7)
by
unknown
03:03 queued 30s
created
core/domain/services/admin/ajax/WordpressHeartbeat.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
             $this->loader->getShared(
60 60
                 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat'
61 61
             );
62
-        } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) {
62
+        } elseif ($screenID === 'front' && ! empty($heartbeat_data[self::RESPONSE_KEY_THANK_YOU_PAGE])) {
63 63
             $this->loader->getShared(
64 64
                 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor'
65 65
             );
Please login to merge, or discard this patch.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -17,52 +17,52 @@
 block discarded – undo
17 17
 class WordpressHeartbeat
18 18
 {
19 19
 
20
-    const RESPONSE_KEY_THANK_YOU_PAGE = 'espresso_thank_you_page';
20
+	const RESPONSE_KEY_THANK_YOU_PAGE = 'espresso_thank_you_page';
21 21
 
22
-    /**
23
-     * @var LoaderInterface $loader
24
-     */
25
-    protected $loader;
22
+	/**
23
+	 * @var LoaderInterface $loader
24
+	 */
25
+	protected $loader;
26 26
 
27
-    /**
28
-     * @var RequestInterface $request
29
-     */
30
-    protected $request;
27
+	/**
28
+	 * @var RequestInterface $request
29
+	 */
30
+	protected $request;
31 31
 
32 32
 
33
-    /**
34
-     * WordpressHeartbeat constructor.
35
-     *
36
-     * @param LoaderInterface  $loader
37
-     * @param RequestInterface $request
38
-     */
39
-    public function __construct(
40
-        LoaderInterface $loader,
41
-        RequestInterface $request
42
-    ) {
43
-        $this->loader = $loader;
44
-        $this->request = $request;
45
-        do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this);
46
-        add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes'));
47
-    }
33
+	/**
34
+	 * WordpressHeartbeat constructor.
35
+	 *
36
+	 * @param LoaderInterface  $loader
37
+	 * @param RequestInterface $request
38
+	 */
39
+	public function __construct(
40
+		LoaderInterface $loader,
41
+		RequestInterface $request
42
+	) {
43
+		$this->loader = $loader;
44
+		$this->request = $request;
45
+		do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this);
46
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes'));
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * @since 4.9.76.p
52
-     * @throws InvalidClassException
53
-     */
54
-    public function resolveRoutes()
55
-    {
56
-        $screenID = $this->request->getRequestParam('screen_id');
57
-        $heartbeat_data = $this->request->getRequestParam('data', [], 'string', true);
58
-        if ($screenID === 'espresso_events') {
59
-            $this->loader->getShared(
60
-                'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat'
61
-            );
62
-        } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) {
63
-            $this->loader->getShared(
64
-                'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor'
65
-            );
66
-        }
67
-    }
50
+	/**
51
+	 * @since 4.9.76.p
52
+	 * @throws InvalidClassException
53
+	 */
54
+	public function resolveRoutes()
55
+	{
56
+		$screenID = $this->request->getRequestParam('screen_id');
57
+		$heartbeat_data = $this->request->getRequestParam('data', [], 'string', true);
58
+		if ($screenID === 'espresso_events') {
59
+			$this->loader->getShared(
60
+				'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat'
61
+			);
62
+		} elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) {
63
+			$this->loader->getShared(
64
+				'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor'
65
+			);
66
+		}
67
+	}
68 68
 }
Please login to merge, or discard this patch.
core/third-party-compatibility.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * ACF compatibility
8 8
  */
9 9
 add_action(
10
-    'plugins_loaded',
11
-    function () {
12
-        if (function_exists('acf_include')) {
13
-            add_filter(
14
-                'acf/get_post_types',
15
-                function ($post_types, $args) {
16
-                    if (! empty($args['show_ui'])) {
17
-                        $ee_post_types = get_post_types(array('show_ee_ui' => 1));
18
-                        $ee_post_types = array_keys($ee_post_types);
19
-                        $post_types = array_merge($post_types, $ee_post_types);
20
-                        $post_types = array_unique($post_types);
21
-                    }
22
-                    return $post_types;
23
-                },
24
-                10,
25
-                2
26
-            );
27
-        }
28
-    },
29
-    100
10
+	'plugins_loaded',
11
+	function () {
12
+		if (function_exists('acf_include')) {
13
+			add_filter(
14
+				'acf/get_post_types',
15
+				function ($post_types, $args) {
16
+					if (! empty($args['show_ui'])) {
17
+						$ee_post_types = get_post_types(array('show_ee_ui' => 1));
18
+						$ee_post_types = array_keys($ee_post_types);
19
+						$post_types = array_merge($post_types, $ee_post_types);
20
+						$post_types = array_unique($post_types);
21
+					}
22
+					return $post_types;
23
+				},
24
+				10,
25
+				2
26
+			);
27
+		}
28
+	},
29
+	100
30 30
 );
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
  */
9 9
 add_action(
10 10
     'plugins_loaded',
11
-    function () {
11
+    function() {
12 12
         if (function_exists('acf_include')) {
13 13
             add_filter(
14 14
                 'acf/get_post_types',
15
-                function ($post_types, $args) {
16
-                    if (! empty($args['show_ui'])) {
15
+                function($post_types, $args) {
16
+                    if ( ! empty($args['show_ui'])) {
17 17
                         $ee_post_types = get_post_types(array('show_ee_ui' => 1));
18 18
                         $ee_post_types = array_keys($ee_post_types);
19 19
                         $post_types = array_merge($post_types, $ee_post_types);
Please login to merge, or discard this patch.
core/domain/entities/editor/CoreBlocksAssetManager.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,20 +14,20 @@
 block discarded – undo
14 14
  */
15 15
 class CoreBlocksAssetManager extends BlockAssetManager
16 16
 {
17
-    const JS_HANDLE_CORE_BLOCKS_EDITOR = 'eventespresso-core-blocks';
18
-    const CSS_HANDLE_CORE_BLOCKS_EDITOR = 'eventespresso-core-blocks';
19
-    const JS_HANDLE_CORE_BLOCKS = 'eventespresso-core-blocks-frontend';
20
-    const CSS_HANDLE_CORE_BLOCKS = 'eventespresso-core-blocks-frontend';
17
+	const JS_HANDLE_CORE_BLOCKS_EDITOR = 'eventespresso-core-blocks';
18
+	const CSS_HANDLE_CORE_BLOCKS_EDITOR = 'eventespresso-core-blocks';
19
+	const JS_HANDLE_CORE_BLOCKS = 'eventespresso-core-blocks-frontend';
20
+	const CSS_HANDLE_CORE_BLOCKS = 'eventespresso-core-blocks-frontend';
21 21
 
22 22
 
23
-    /**
24
-     * @since 4.9.71.p
25
-     */
26
-    public function setAssetHandles()
27
-    {
28
-        $this->setEditorScriptHandle(self::JS_HANDLE_CORE_BLOCKS_EDITOR);
29
-        $this->setEditorStyleHandle(self::CSS_HANDLE_CORE_BLOCKS_EDITOR);
30
-        $this->setScriptHandle(self::JS_HANDLE_CORE_BLOCKS);
31
-        $this->setStyleHandle(self::CSS_HANDLE_CORE_BLOCKS);
32
-    }
23
+	/**
24
+	 * @since 4.9.71.p
25
+	 */
26
+	public function setAssetHandles()
27
+	{
28
+		$this->setEditorScriptHandle(self::JS_HANDLE_CORE_BLOCKS_EDITOR);
29
+		$this->setEditorStyleHandle(self::CSS_HANDLE_CORE_BLOCKS_EDITOR);
30
+		$this->setScriptHandle(self::JS_HANDLE_CORE_BLOCKS);
31
+		$this->setStyleHandle(self::CSS_HANDLE_CORE_BLOCKS);
32
+	}
33 33
 }
Please login to merge, or discard this patch.
core/services/assets/BlockAssetManager.php 2 patches
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -22,249 +22,249 @@
 block discarded – undo
22 22
 abstract class BlockAssetManager extends AssetManager implements BlockAssetManagerInterface
23 23
 {
24 24
 
25
-    /**
26
-     * @var string $editor_script_handle
27
-     */
28
-    private $editor_script_handle;
29
-
30
-    /**
31
-     * @var string $editor_style_handle
32
-     */
33
-    private $editor_style_handle;
34
-
35
-    /**
36
-     * @var string $script_handle
37
-     */
38
-    private $script_handle;
39
-
40
-    /**
41
-     * @var string $style_handle
42
-     */
43
-    private $style_handle;
44
-
45
-
46
-    /**
47
-     * @return string
48
-     */
49
-    public function getEditorScriptHandle()
50
-    {
51
-        return $this->editor_script_handle;
52
-    }
53
-
54
-
55
-    /**
56
-     * @param string $editor_script_handle
57
-     */
58
-    public function setEditorScriptHandle($editor_script_handle)
59
-    {
60
-        if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
61
-            $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
62
-        }
63
-        $this->editor_script_handle = $editor_script_handle;
64
-    }
65
-
66
-
67
-    /**
68
-     * @return string
69
-     */
70
-    public function getEditorStyleHandle()
71
-    {
72
-        return $this->editor_style_handle;
73
-    }
74
-
75
-
76
-    /**
77
-     * @param string $editor_style_handle
78
-     */
79
-    public function setEditorStyleHandle($editor_style_handle)
80
-    {
81
-        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
82
-            $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
83
-        }
84
-        $this->editor_style_handle = $editor_style_handle;
85
-    }
86
-
87
-
88
-    /**
89
-     * @return string
90
-     */
91
-    public function getScriptHandle()
92
-    {
93
-        return $this->script_handle;
94
-    }
95
-
96
-
97
-    /**
98
-     * @param string $script_handle
99
-     */
100
-    public function setScriptHandle($script_handle)
101
-    {
102
-        if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
103
-            $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
104
-        }
105
-        $this->script_handle = $script_handle;
106
-    }
107
-
108
-
109
-    /**
110
-     * @return string
111
-     */
112
-    public function getStyleHandle()
113
-    {
114
-        return $this->style_handle;
115
-    }
116
-
117
-
118
-    /**
119
-     * @param string $style_handle
120
-     */
121
-    public function setStyleHandle($style_handle)
122
-    {
123
-        if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
124
-            $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
125
-        }
126
-        $this->style_handle = $style_handle;
127
-    }
128
-
129
-    /**
130
-     * @since 4.9.71.p
131
-     * @throws InvalidDataTypeException
132
-     * @throws InvalidEntityException
133
-     * @throws DuplicateCollectionIdentifierException
134
-     */
135
-    public function addAssets()
136
-    {
137
-        $this->addEditorScript($this->getEditorScriptHandle());
138
-        $this->addEditorStyle($this->getEditorStyleHandle());
139
-        $this->addScript($this->getScriptHandle());
140
-        $this->addStyle($this->getStyleHandle());
141
-    }
142
-
143
-
144
-    /**
145
-     * @param       $handle
146
-     * @param array $dependencies
147
-     * @since 4.9.71.p
148
-     * @return JavascriptAsset
149
-     * @throws InvalidDataTypeException
150
-     * @throws InvalidEntityException
151
-     * @throws DuplicateCollectionIdentifierException
152
-     */
153
-    public function addEditorScript($handle, array $dependencies = array())
154
-    {
155
-        if ($this->assets->hasJavascriptAsset($handle)){
156
-            return $this->assets->getJavascriptAsset($handle);
157
-        }
158
-        return $this->addJs($handle, $dependencies)->setRequiresTranslation();
159
-    }
160
-
161
-
162
-    /**
163
-     * @param        $handle
164
-     * @param array  $dependencies
165
-     * @since 4.9.71.p
166
-     * @return StylesheetAsset
167
-     * @throws InvalidDataTypeException
168
-     * @throws InvalidEntityException
169
-     * @throws DuplicateCollectionIdentifierException
170
-     */
171
-    public function addEditorStyle($handle, array $dependencies = array())
172
-    {
173
-        if ($this->assets->hasStylesheetAsset($handle)) {
174
-            return $this->assets->getStylesheetAsset($handle);
175
-        }
176
-        return $this->addCss($handle, $dependencies);
177
-    }
178
-
179
-
180
-    /**
181
-     * @param       $handle
182
-     * @param array $dependencies
183
-     * @since 4.9.71.p
184
-     * @return JavascriptAsset
185
-     * @throws InvalidDataTypeException
186
-     * @throws InvalidEntityException
187
-     * @throws DuplicateCollectionIdentifierException
188
-     */
189
-    public function addScript($handle, array $dependencies = array())
190
-    {
191
-        if ($this->assets->hasJavascriptAsset($handle)) {
192
-            return $this->assets->getJavascriptAsset($handle);
193
-        }
194
-        return $this->addJs($handle, $dependencies)->setRequiresTranslation();
195
-    }
196
-
197
-
198
-    /**
199
-     * @param        $handle
200
-     * @param array  $dependencies
201
-     * @since 4.9.71.p
202
-     * @return StylesheetAsset
203
-     * @throws InvalidDataTypeException
204
-     * @throws InvalidEntityException
205
-     * @throws DuplicateCollectionIdentifierException
206
-     */
207
-    public function addStyle($handle, array $dependencies = array())
208
-    {
209
-        if ($this->assets->hasStylesheetAsset($handle)) {
210
-            return $this->assets->getStylesheetAsset($handle);
211
-        }
212
-        return $this->addCss($handle, $dependencies);
213
-    }
214
-
215
-
216
-    /**
217
-     * @return JavascriptAsset|null
218
-     */
219
-    public function getEditorScript()
220
-    {
221
-        return $this->assets->getJavascriptAsset($this->editor_script_handle);
222
-    }
223
-
224
-
225
-    /**
226
-     * @return StylesheetAsset|null
227
-     */
228
-    public function getEditorStyle()
229
-    {
230
-        return $this->assets->getStylesheetAsset($this->editor_style_handle);
231
-    }
232
-
233
-
234
-    /**
235
-     * @return JavascriptAsset|null
236
-     */
237
-    public function getScript()
238
-    {
239
-        return $this->assets->getJavascriptAsset($this->script_handle);
240
-    }
241
-
242
-
243
-    /**
244
-     * @return StylesheetAsset|null
245
-     */
246
-    public function getStyle()
247
-    {
248
-        return $this->assets->getStylesheetAsset($this->style_handle);
249
-    }
250
-
251
-
252
-    /**
253
-     * @return  void
254
-     */
255
-    public function enqueueAssets()
256
-    {
257
-        $assets = array(
258
-            $this->getEditorScript(),
259
-            $this->getEditorStyle(),
260
-            $this->getScript(),
261
-            $this->getStyle(),
262
-        );
263
-        foreach ($assets as $asset) {
264
-            if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
265
-                $asset->enqueueAsset();
266
-            }
267
-        }
268
-    }
25
+	/**
26
+	 * @var string $editor_script_handle
27
+	 */
28
+	private $editor_script_handle;
29
+
30
+	/**
31
+	 * @var string $editor_style_handle
32
+	 */
33
+	private $editor_style_handle;
34
+
35
+	/**
36
+	 * @var string $script_handle
37
+	 */
38
+	private $script_handle;
39
+
40
+	/**
41
+	 * @var string $style_handle
42
+	 */
43
+	private $style_handle;
44
+
45
+
46
+	/**
47
+	 * @return string
48
+	 */
49
+	public function getEditorScriptHandle()
50
+	{
51
+		return $this->editor_script_handle;
52
+	}
53
+
54
+
55
+	/**
56
+	 * @param string $editor_script_handle
57
+	 */
58
+	public function setEditorScriptHandle($editor_script_handle)
59
+	{
60
+		if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
61
+			$editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
62
+		}
63
+		$this->editor_script_handle = $editor_script_handle;
64
+	}
65
+
66
+
67
+	/**
68
+	 * @return string
69
+	 */
70
+	public function getEditorStyleHandle()
71
+	{
72
+		return $this->editor_style_handle;
73
+	}
74
+
75
+
76
+	/**
77
+	 * @param string $editor_style_handle
78
+	 */
79
+	public function setEditorStyleHandle($editor_style_handle)
80
+	{
81
+		if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
82
+			$editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
83
+		}
84
+		$this->editor_style_handle = $editor_style_handle;
85
+	}
86
+
87
+
88
+	/**
89
+	 * @return string
90
+	 */
91
+	public function getScriptHandle()
92
+	{
93
+		return $this->script_handle;
94
+	}
95
+
96
+
97
+	/**
98
+	 * @param string $script_handle
99
+	 */
100
+	public function setScriptHandle($script_handle)
101
+	{
102
+		if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
103
+			$script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
104
+		}
105
+		$this->script_handle = $script_handle;
106
+	}
107
+
108
+
109
+	/**
110
+	 * @return string
111
+	 */
112
+	public function getStyleHandle()
113
+	{
114
+		return $this->style_handle;
115
+	}
116
+
117
+
118
+	/**
119
+	 * @param string $style_handle
120
+	 */
121
+	public function setStyleHandle($style_handle)
122
+	{
123
+		if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
124
+			$style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
125
+		}
126
+		$this->style_handle = $style_handle;
127
+	}
128
+
129
+	/**
130
+	 * @since 4.9.71.p
131
+	 * @throws InvalidDataTypeException
132
+	 * @throws InvalidEntityException
133
+	 * @throws DuplicateCollectionIdentifierException
134
+	 */
135
+	public function addAssets()
136
+	{
137
+		$this->addEditorScript($this->getEditorScriptHandle());
138
+		$this->addEditorStyle($this->getEditorStyleHandle());
139
+		$this->addScript($this->getScriptHandle());
140
+		$this->addStyle($this->getStyleHandle());
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param       $handle
146
+	 * @param array $dependencies
147
+	 * @since 4.9.71.p
148
+	 * @return JavascriptAsset
149
+	 * @throws InvalidDataTypeException
150
+	 * @throws InvalidEntityException
151
+	 * @throws DuplicateCollectionIdentifierException
152
+	 */
153
+	public function addEditorScript($handle, array $dependencies = array())
154
+	{
155
+		if ($this->assets->hasJavascriptAsset($handle)){
156
+			return $this->assets->getJavascriptAsset($handle);
157
+		}
158
+		return $this->addJs($handle, $dependencies)->setRequiresTranslation();
159
+	}
160
+
161
+
162
+	/**
163
+	 * @param        $handle
164
+	 * @param array  $dependencies
165
+	 * @since 4.9.71.p
166
+	 * @return StylesheetAsset
167
+	 * @throws InvalidDataTypeException
168
+	 * @throws InvalidEntityException
169
+	 * @throws DuplicateCollectionIdentifierException
170
+	 */
171
+	public function addEditorStyle($handle, array $dependencies = array())
172
+	{
173
+		if ($this->assets->hasStylesheetAsset($handle)) {
174
+			return $this->assets->getStylesheetAsset($handle);
175
+		}
176
+		return $this->addCss($handle, $dependencies);
177
+	}
178
+
179
+
180
+	/**
181
+	 * @param       $handle
182
+	 * @param array $dependencies
183
+	 * @since 4.9.71.p
184
+	 * @return JavascriptAsset
185
+	 * @throws InvalidDataTypeException
186
+	 * @throws InvalidEntityException
187
+	 * @throws DuplicateCollectionIdentifierException
188
+	 */
189
+	public function addScript($handle, array $dependencies = array())
190
+	{
191
+		if ($this->assets->hasJavascriptAsset($handle)) {
192
+			return $this->assets->getJavascriptAsset($handle);
193
+		}
194
+		return $this->addJs($handle, $dependencies)->setRequiresTranslation();
195
+	}
196
+
197
+
198
+	/**
199
+	 * @param        $handle
200
+	 * @param array  $dependencies
201
+	 * @since 4.9.71.p
202
+	 * @return StylesheetAsset
203
+	 * @throws InvalidDataTypeException
204
+	 * @throws InvalidEntityException
205
+	 * @throws DuplicateCollectionIdentifierException
206
+	 */
207
+	public function addStyle($handle, array $dependencies = array())
208
+	{
209
+		if ($this->assets->hasStylesheetAsset($handle)) {
210
+			return $this->assets->getStylesheetAsset($handle);
211
+		}
212
+		return $this->addCss($handle, $dependencies);
213
+	}
214
+
215
+
216
+	/**
217
+	 * @return JavascriptAsset|null
218
+	 */
219
+	public function getEditorScript()
220
+	{
221
+		return $this->assets->getJavascriptAsset($this->editor_script_handle);
222
+	}
223
+
224
+
225
+	/**
226
+	 * @return StylesheetAsset|null
227
+	 */
228
+	public function getEditorStyle()
229
+	{
230
+		return $this->assets->getStylesheetAsset($this->editor_style_handle);
231
+	}
232
+
233
+
234
+	/**
235
+	 * @return JavascriptAsset|null
236
+	 */
237
+	public function getScript()
238
+	{
239
+		return $this->assets->getJavascriptAsset($this->script_handle);
240
+	}
241
+
242
+
243
+	/**
244
+	 * @return StylesheetAsset|null
245
+	 */
246
+	public function getStyle()
247
+	{
248
+		return $this->assets->getStylesheetAsset($this->style_handle);
249
+	}
250
+
251
+
252
+	/**
253
+	 * @return  void
254
+	 */
255
+	public function enqueueAssets()
256
+	{
257
+		$assets = array(
258
+			$this->getEditorScript(),
259
+			$this->getEditorStyle(),
260
+			$this->getScript(),
261
+			$this->getStyle(),
262
+		);
263
+		foreach ($assets as $asset) {
264
+			if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
265
+				$asset->enqueueAsset();
266
+			}
267
+		}
268
+	}
269 269
 
270 270
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function setEditorScriptHandle($editor_script_handle)
59 59
     {
60
-        if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
61
-            $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
60
+        if (strpos($editor_script_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
61
+            $editor_script_handle = BlockInterface::NAME_SPACE.'-'.$editor_script_handle;
62 62
         }
63 63
         $this->editor_script_handle = $editor_script_handle;
64 64
     }
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function setEditorStyleHandle($editor_style_handle)
80 80
     {
81
-        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
82
-            $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
81
+        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
82
+            $editor_style_handle = BlockInterface::NAME_SPACE.'-'.$editor_style_handle;
83 83
         }
84 84
         $this->editor_style_handle = $editor_style_handle;
85 85
     }
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function setScriptHandle($script_handle)
101 101
     {
102
-        if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
103
-            $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
102
+        if (strpos($script_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
103
+            $script_handle = BlockInterface::NAME_SPACE.'-'.$script_handle;
104 104
         }
105 105
         $this->script_handle = $script_handle;
106 106
     }
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function setStyleHandle($style_handle)
122 122
     {
123
-        if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
124
-            $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
123
+        if (strpos($style_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
124
+            $style_handle = BlockInterface::NAME_SPACE.'-'.$style_handle;
125 125
         }
126 126
         $this->style_handle = $style_handle;
127 127
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function addEditorScript($handle, array $dependencies = array())
154 154
     {
155
-        if ($this->assets->hasJavascriptAsset($handle)){
155
+        if ($this->assets->hasJavascriptAsset($handle)) {
156 156
             return $this->assets->getJavascriptAsset($handle);
157 157
         }
158 158
         return $this->addJs($handle, $dependencies)->setRequiresTranslation();
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_State_Select_Input.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         if (isset($input_settings['value_field_name'])) {
38 38
             $this->valueFieldName = $input_settings['value_field_name'];
39
-            if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
39
+            if ( ! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
40 40
                 throw new InvalidArgumentException(
41 41
                     sprintf(
42 42
                         esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'),
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             $this
54 54
         );
55 55
         $input_settings['html_class'] = isset($input_settings['html_class'])
56
-            ? $input_settings['html_class'] . ' ee-state-select-js'
56
+            ? $input_settings['html_class'].' ee-state-select-js'
57 57
             : 'ee-state-select-js';
58 58
         parent::__construct($state_options, $input_settings);
59 59
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     public function get_state_answer_options($state_options = null)
84 84
     {
85 85
         // if passed something that is NOT an array
86
-        if (! is_array($state_options) || empty($state_options)) {
86
+        if ( ! is_array($state_options) || empty($state_options)) {
87 87
             // get possibly cached list of states
88 88
             $states = EEM_State::instance()->get_all_active_states();
89 89
         }
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
             $states = $state_options;
92 92
             $state_options = array();
93 93
         }
94
-        if (! empty($states)) {
94
+        if ( ! empty($states)) {
95 95
             // set the default
96 96
             $state_options[''][''] = '';
97 97
             foreach ($states as $state) {
98 98
                 if ($state instanceof EE_State) {
99
-                    $state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name();
99
+                    $state_options[$state->country()->name()][$state->get($this->valueFieldName())] = $state->name();
100 100
                 }
101 101
             }
102 102
         }
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -12,94 +12,94 @@
 block discarded – undo
12 12
  */
13 13
 class EE_State_Select_Input extends EE_Select_Input
14 14
 {
15
-    /**
16
-     * @var string the name of the EE_State field to use for option values in the HTML form input.
17
-     */
18
-    protected $valueFieldName;
15
+	/**
16
+	 * @var string the name of the EE_State field to use for option values in the HTML form input.
17
+	 */
18
+	protected $valueFieldName;
19 19
 
20
-    /**
21
-     * @param EE_State[]|array|null $state_options. If a flat array of string is provided,
22
-     * $input_settings['value_field_name'] is ignored. If an array of states is passed, that field will be used for
23
-     * the keys (which will become the option values). If null or empty is passed, all active states will be used,
24
-     * and $input_settings['value_field_name'] will again be used.     *
25
-     * @param array $input_settings same as parent, but also {
26
-     *   @type string $value_field_name the name of the field to use
27
-     *   for the HTML option values, ie, `STA_ID`, `STA_abbrev`, or `STA_name`.
28
-     * }
29
-     * @throws EE_Error
30
-     * @throws InvalidArgumentException
31
-     * @throws InvalidDataTypeException
32
-     * @throws InvalidInterfaceException
33
-     * @throws ReflectionException
34
-     */
35
-    public function __construct($state_options, $input_settings = array())
36
-    {
37
-        if (isset($input_settings['value_field_name'])) {
38
-            $this->valueFieldName = $input_settings['value_field_name'];
39
-            if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
40
-                throw new InvalidArgumentException(
41
-                    sprintf(
42
-                        esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'),
43
-                        $this->valueFieldName()
44
-                    )
45
-                );
46
-            }
47
-        } else {
48
-            $this->valueFieldName = 'STA_ID';
49
-        }
50
-        $state_options = apply_filters(
51
-            'FHEE__EE_State_Select_Input____construct__state_options',
52
-            $this->get_state_answer_options($state_options),
53
-            $this
54
-        );
55
-        $input_settings['html_class'] = isset($input_settings['html_class'])
56
-            ? $input_settings['html_class'] . ' ee-state-select-js'
57
-            : 'ee-state-select-js';
58
-        parent::__construct($state_options, $input_settings);
59
-    }
20
+	/**
21
+	 * @param EE_State[]|array|null $state_options. If a flat array of string is provided,
22
+	 * $input_settings['value_field_name'] is ignored. If an array of states is passed, that field will be used for
23
+	 * the keys (which will become the option values). If null or empty is passed, all active states will be used,
24
+	 * and $input_settings['value_field_name'] will again be used.     *
25
+	 * @param array $input_settings same as parent, but also {
26
+	 *   @type string $value_field_name the name of the field to use
27
+	 *   for the HTML option values, ie, `STA_ID`, `STA_abbrev`, or `STA_name`.
28
+	 * }
29
+	 * @throws EE_Error
30
+	 * @throws InvalidArgumentException
31
+	 * @throws InvalidDataTypeException
32
+	 * @throws InvalidInterfaceException
33
+	 * @throws ReflectionException
34
+	 */
35
+	public function __construct($state_options, $input_settings = array())
36
+	{
37
+		if (isset($input_settings['value_field_name'])) {
38
+			$this->valueFieldName = $input_settings['value_field_name'];
39
+			if (! EEM_State::instance()->has_field((string) $this->valueFieldName())) {
40
+				throw new InvalidArgumentException(
41
+					sprintf(
42
+						esc_html__('An invalid state field "%1$s" was specified for the state input\'s option values.', 'event_espresso'),
43
+						$this->valueFieldName()
44
+					)
45
+				);
46
+			}
47
+		} else {
48
+			$this->valueFieldName = 'STA_ID';
49
+		}
50
+		$state_options = apply_filters(
51
+			'FHEE__EE_State_Select_Input____construct__state_options',
52
+			$this->get_state_answer_options($state_options),
53
+			$this
54
+		);
55
+		$input_settings['html_class'] = isset($input_settings['html_class'])
56
+			? $input_settings['html_class'] . ' ee-state-select-js'
57
+			: 'ee-state-select-js';
58
+		parent::__construct($state_options, $input_settings);
59
+	}
60 60
 
61
-    /**
62
-     * Returns the name of the state field used for the HTML option values.
63
-     * @since 4.10.0.p
64
-     * @return string
65
-     */
66
-    public function valueFieldName()
67
-    {
68
-        return $this->valueFieldName;
69
-    }
61
+	/**
62
+	 * Returns the name of the state field used for the HTML option values.
63
+	 * @since 4.10.0.p
64
+	 * @return string
65
+	 */
66
+	public function valueFieldName()
67
+	{
68
+		return $this->valueFieldName;
69
+	}
70 70
 
71 71
 
72
-    /**
73
-     * get_state_answer_options
74
-     *
75
-     * @param array $state_options
76
-     * @return array
77
-     * @throws EE_Error
78
-     * @throws InvalidArgumentException
79
-     * @throws ReflectionException
80
-     * @throws InvalidDataTypeException
81
-     * @throws InvalidInterfaceException
82
-     */
83
-    public function get_state_answer_options($state_options = null)
84
-    {
85
-        // if passed something that is NOT an array
86
-        if (! is_array($state_options) || empty($state_options)) {
87
-            // get possibly cached list of states
88
-            $states = EEM_State::instance()->get_all_active_states();
89
-        }
90
-        if (is_array($state_options) && reset($state_options) instanceof EE_State) {
91
-            $states = $state_options;
92
-            $state_options = array();
93
-        }
94
-        if (! empty($states)) {
95
-            // set the default
96
-            $state_options[''][''] = '';
97
-            foreach ($states as $state) {
98
-                if ($state instanceof EE_State) {
99
-                    $state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name();
100
-                }
101
-            }
102
-        }
103
-        return $state_options;
104
-    }
72
+	/**
73
+	 * get_state_answer_options
74
+	 *
75
+	 * @param array $state_options
76
+	 * @return array
77
+	 * @throws EE_Error
78
+	 * @throws InvalidArgumentException
79
+	 * @throws ReflectionException
80
+	 * @throws InvalidDataTypeException
81
+	 * @throws InvalidInterfaceException
82
+	 */
83
+	public function get_state_answer_options($state_options = null)
84
+	{
85
+		// if passed something that is NOT an array
86
+		if (! is_array($state_options) || empty($state_options)) {
87
+			// get possibly cached list of states
88
+			$states = EEM_State::instance()->get_all_active_states();
89
+		}
90
+		if (is_array($state_options) && reset($state_options) instanceof EE_State) {
91
+			$states = $state_options;
92
+			$state_options = array();
93
+		}
94
+		if (! empty($states)) {
95
+			// set the default
96
+			$state_options[''][''] = '';
97
+			foreach ($states as $state) {
98
+				if ($state instanceof EE_State) {
99
+					$state_options[ $state->country()->name() ][ $state->get($this->valueFieldName()) ] = $state->name();
100
+				}
101
+			}
102
+		}
103
+		return $state_options;
104
+	}
105 105
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 ),
122 122
             ),
123 123
         );
124
-        $this->_model_relations        = array(
124
+        $this->_model_relations = array(
125 125
             'Ticket'  => new EE_HABTM_Relation('Datetime_Ticket'),
126 126
             'Event'   => new EE_Belongs_To_Relation(),
127 127
             'Checkin' => new EE_Has_Many_Relation(),
@@ -131,16 +131,16 @@  discard block
 block discarded – undo
131 131
         $this->model_chain_to_password = $path_to_event_model;
132 132
         $this->_model_chain_to_wp_user = $path_to_event_model;
133 133
         // this model is generally available for reading
134
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ]       = new EE_Restriction_Generator_Event_Related_Public(
134
+        $this->_cap_restriction_generators[EEM_Base::caps_read]       = new EE_Restriction_Generator_Event_Related_Public(
135 135
             $path_to_event_model
136 136
         );
137
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected(
137
+        $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected(
138 138
             $path_to_event_model
139 139
         );
140
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ]       = new EE_Restriction_Generator_Event_Related_Protected(
140
+        $this->_cap_restriction_generators[EEM_Base::caps_edit]       = new EE_Restriction_Generator_Event_Related_Protected(
141 141
             $path_to_event_model
142 142
         );
143
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ]     = new EE_Restriction_Generator_Event_Related_Protected(
143
+        $this->_cap_restriction_generators[EEM_Base::caps_delete]     = new EE_Restriction_Generator_Event_Related_Protected(
144 144
             $path_to_event_model,
145 145
             EEM_Base::caps_edit
146 146
         );
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
      */
247 247
     private function validateStartAndEndTimeForBlankDate($start_time, $end_time)
248 248
     {
249
-        if (! is_array($start_time)) {
249
+        if ( ! is_array($start_time)) {
250 250
             throw new InvalidDataTypeException('start_time', $start_time, 'array');
251 251
         }
252
-        if (! is_array($end_time)) {
252
+        if ( ! is_array($end_time)) {
253 253
             throw new InvalidDataTypeException('end_time', $end_time, 'array');
254 254
         }
255 255
         if (count($start_time) !== 2) {
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      */
284 284
     public function get_all_event_dates($EVT_ID = 0)
285 285
     {
286
-        if (! $EVT_ID) { // on add_new_event event_id gets set to 0
286
+        if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
287 287
             return $this->create_new_blank_datetime();
288 288
         }
289 289
         $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                 'order_by'                 => array('DTT_order' => 'ASC'),
330 330
                 'default_where_conditions' => 'none',
331 331
             );
332
-        if (! $include_expired) {
332
+        if ( ! $include_expired) {
333 333
             $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
334 334
         }
335 335
         if ($include_deleted) {
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
             ),
449 449
             'default_where_conditions' => EEM_Base::default_where_conditions_this_only
450 450
         );
451
-        if (! $include_expired) {
451
+        if ( ! $include_expired) {
452 452
             $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
453 453
         }
454 454
         if ($include_deleted) {
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
487 487
         $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
488 488
         $query_params = array(array('Ticket.TKT_ID' => $TKT_ID), 'order_by' => array('DTT_EVT_start' => 'asc'));
489
-        if (! $include_expired) {
489
+        if ( ! $include_expired) {
490 490
             $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
491 491
         }
492 492
         if ($include_deleted) {
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
527 527
         $where_params = array('Ticket.TKT_ID' => $TKT_ID);
528 528
         $query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
529
-        if (! $include_expired) {
529
+        if ( ! $include_expired) {
530 530
             $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
531 531
         }
532 532
         if ($include_deleted) {
@@ -649,10 +649,10 @@  discard block
 block discarded – undo
649 649
             $this->get_timezone(),
650 650
             'DTT_EVT_start'
651 651
         );
652
-        $columns_to_select        = array(
653
-            'dtt_year'      => array('YEAR(' . $query_interval . ')', '%s'),
654
-            'dtt_month'     => array('MONTHNAME(' . $query_interval . ')', '%s'),
655
-            'dtt_month_num' => array('MONTH(' . $query_interval . ')', '%s'),
652
+        $columns_to_select = array(
653
+            'dtt_year'      => array('YEAR('.$query_interval.')', '%s'),
654
+            'dtt_month'     => array('MONTHNAME('.$query_interval.')', '%s'),
655
+            'dtt_month_num' => array('MONTH('.$query_interval.')', '%s'),
656 656
         );
657 657
         return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
658 658
     }
@@ -731,17 +731,17 @@  discard block
 block discarded – undo
731 731
                 array('DTT_EVT_end' => array('<', time()))
732 732
             ),
733 733
         );
734
-        if (! empty($stati_to_include)) {
734
+        if ( ! empty($stati_to_include)) {
735 735
             foreach (array_keys($status_query_args) as $status) {
736
-                if (! in_array($status, $stati_to_include, true)) {
737
-                    unset($status_query_args[ $status ]);
736
+                if ( ! in_array($status, $stati_to_include, true)) {
737
+                    unset($status_query_args[$status]);
738 738
                 }
739 739
             }
740 740
         }
741 741
         // loop through and query counts for each stati.
742 742
         $status_query_results = array();
743 743
         foreach ($status_query_args as $status => $status_where_conditions) {
744
-            $status_query_results[ $status ] = EEM_Datetime::count(
744
+            $status_query_results[$status] = EEM_Datetime::count(
745 745
                 array($status_where_conditions),
746 746
                 'DTT_ID',
747 747
                 true
@@ -762,6 +762,6 @@  discard block
 block discarded – undo
762 762
     public function get_datetime_count_for_status($status = EE_Datetime::active, array $query_params = array())
763 763
     {
764 764
         $count = $this->get_datetime_counts_by_status(array($status), $query_params);
765
-        return ! empty($count[ $status ]) ? $count[ $status ] : 0;
765
+        return ! empty($count[$status]) ? $count[$status] : 0;
766 766
     }
767 767
 }
Please login to merge, or discard this patch.
Indentation   +751 added lines, -751 removed lines patch added patch discarded remove patch
@@ -13,755 +13,755 @@
 block discarded – undo
13 13
 class EEM_Datetime extends EEM_Soft_Delete_Base
14 14
 {
15 15
 
16
-    /**
17
-     * @var EEM_Datetime $_instance
18
-     */
19
-    protected static $_instance;
20
-
21
-
22
-    /**
23
-     * private constructor to prevent direct creation
24
-     *
25
-     * @param string $timezone A string representing the timezone we want to set for returned Date Time Strings
26
-     *                         (and any incoming timezone data that gets saved).
27
-     *                         Note this just sends the timezone info to the date time model field objects.
28
-     *                         Default is NULL
29
-     *                         (and will be assumed using the set timezone in the 'timezone_string' wp option)
30
-     * @throws EE_Error
31
-     * @throws InvalidArgumentException
32
-     * @throws InvalidArgumentException
33
-     */
34
-    protected function __construct($timezone)
35
-    {
36
-        $this->singular_item           = esc_html__('Datetime', 'event_espresso');
37
-        $this->plural_item             = esc_html__('Datetimes', 'event_espresso');
38
-        $this->_tables                 = array(
39
-            'Datetime' => new EE_Primary_Table('esp_datetime', 'DTT_ID'),
40
-        );
41
-        $this->_fields                 = array(
42
-            'Datetime' => array(
43
-                'DTT_ID'          => new EE_Primary_Key_Int_Field(
44
-                    'DTT_ID',
45
-                    esc_html__('Datetime ID', 'event_espresso')
46
-                ),
47
-                'EVT_ID'          => new EE_Foreign_Key_Int_Field(
48
-                    'EVT_ID',
49
-                    esc_html__('Event ID', 'event_espresso'),
50
-                    false,
51
-                    0,
52
-                    'Event'
53
-                ),
54
-                'DTT_name'        => new EE_Plain_Text_Field(
55
-                    'DTT_name',
56
-                    esc_html__('Datetime Name', 'event_espresso'),
57
-                    false,
58
-                    ''
59
-                ),
60
-                'DTT_description' => new EE_Post_Content_Field(
61
-                    'DTT_description',
62
-                    esc_html__('Description for Datetime', 'event_espresso'),
63
-                    false,
64
-                    ''
65
-                ),
66
-                'DTT_EVT_start'   => new EE_Datetime_Field(
67
-                    'DTT_EVT_start',
68
-                    esc_html__('Start time/date of Event', 'event_espresso'),
69
-                    false,
70
-                    EE_Datetime_Field::now,
71
-                    $timezone
72
-                ),
73
-                'DTT_EVT_end'     => new EE_Datetime_Field(
74
-                    'DTT_EVT_end',
75
-                    esc_html__('End time/date of Event', 'event_espresso'),
76
-                    false,
77
-                    EE_Datetime_Field::now,
78
-                    $timezone
79
-                ),
80
-                'DTT_reg_limit'   => new EE_Infinite_Integer_Field(
81
-                    'DTT_reg_limit',
82
-                    esc_html__('Registration Limit for this time', 'event_espresso'),
83
-                    true,
84
-                    EE_INF
85
-                ),
86
-                'DTT_sold'        => new EE_Integer_Field(
87
-                    'DTT_sold',
88
-                    esc_html__('How many sales for this Datetime that have occurred', 'event_espresso'),
89
-                    true,
90
-                    0
91
-                ),
92
-                'DTT_reserved'    => new EE_Integer_Field(
93
-                    'DTT_reserved',
94
-                    esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'),
95
-                    false,
96
-                    0
97
-                ),
98
-                'DTT_is_primary'  => new EE_Boolean_Field(
99
-                    'DTT_is_primary',
100
-                    esc_html__('Flag indicating datetime is primary one for event', 'event_espresso'),
101
-                    false,
102
-                    false
103
-                ),
104
-                'DTT_order'       => new EE_Integer_Field(
105
-                    'DTT_order',
106
-                    esc_html__('The order in which the Datetime is displayed', 'event_espresso'),
107
-                    false,
108
-                    0
109
-                ),
110
-                'DTT_parent'      => new EE_Integer_Field(
111
-                    'DTT_parent',
112
-                    esc_html__('Indicates what DTT_ID is the parent of this DTT_ID', 'event_espresso'),
113
-                    true,
114
-                    0
115
-                ),
116
-                'DTT_deleted'     => new EE_Trashed_Flag_Field(
117
-                    'DTT_deleted',
118
-                    esc_html__('Flag indicating datetime is archived', 'event_espresso'),
119
-                    false,
120
-                    false
121
-                ),
122
-            ),
123
-        );
124
-        $this->_model_relations        = array(
125
-            'Ticket'  => new EE_HABTM_Relation('Datetime_Ticket'),
126
-            'Event'   => new EE_Belongs_To_Relation(),
127
-            'Checkin' => new EE_Has_Many_Relation(),
128
-            'Datetime_Ticket' => new EE_Has_Many_Relation(),
129
-        );
130
-        $path_to_event_model = 'Event';
131
-        $this->model_chain_to_password = $path_to_event_model;
132
-        $this->_model_chain_to_wp_user = $path_to_event_model;
133
-        // this model is generally available for reading
134
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ]       = new EE_Restriction_Generator_Event_Related_Public(
135
-            $path_to_event_model
136
-        );
137
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected(
138
-            $path_to_event_model
139
-        );
140
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ]       = new EE_Restriction_Generator_Event_Related_Protected(
141
-            $path_to_event_model
142
-        );
143
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ]     = new EE_Restriction_Generator_Event_Related_Protected(
144
-            $path_to_event_model,
145
-            EEM_Base::caps_edit
146
-        );
147
-        parent::__construct($timezone);
148
-    }
149
-
150
-
151
-    /**
152
-     * create new blank datetime
153
-     *
154
-     * @access public
155
-     * @return EE_Datetime[] array on success, FALSE on fail
156
-     * @throws EE_Error
157
-     * @throws InvalidArgumentException
158
-     * @throws InvalidDataTypeException
159
-     * @throws ReflectionException
160
-     * @throws InvalidInterfaceException
161
-     */
162
-    public function create_new_blank_datetime()
163
-    {
164
-        // makes sure timezone is always set.
165
-        $timezone_string = $this->get_timezone();
166
-        /**
167
-         * Filters the initial start date for the new datetime.
168
-         * Any time included in this value will be overridden later so use additional filters to modify the time.
169
-         *
170
-         * @param int $start_date Unixtimestamp representing now + 30 days in seconds.
171
-         * @return int unixtimestamp
172
-         */
173
-        $start_date = apply_filters(
174
-            'FHEE__EEM_Datetime__create_new_blank_datetime__start_date',
175
-            $this->current_time_for_query('DTT_EVT_start', true) + MONTH_IN_SECONDS
176
-        );
177
-        /**
178
-         * Filters the initial end date for the new datetime.
179
-         * Any time included in this value will be overridden later so use additional filters to modify the time.
180
-         *
181
-         * @param int $end_data Unixtimestamp representing now + 30 days in seconds.
182
-         * @return int unixtimestamp
183
-         */
184
-        $end_date = apply_filters(
185
-            'FHEE__EEM_Datetime__create_new_blank_datetime__end_date',
186
-            $this->current_time_for_query('DTT_EVT_end', true) + MONTH_IN_SECONDS
187
-        );
188
-        $blank_datetime = EE_Datetime::new_instance(
189
-            array(
190
-                'DTT_EVT_start' => $start_date,
191
-                'DTT_EVT_end'   => $end_date,
192
-                'DTT_order'     => 1,
193
-                'DTT_reg_limit' => EE_INF,
194
-            ),
195
-            $timezone_string
196
-        );
197
-        /**
198
-         * Filters the initial start time and format for the new EE_Datetime instance.
199
-         *
200
-         * @param array $start_time An array having size 2.  First element is the time, second element is the time
201
-         *                          format.
202
-         * @return array
203
-         */
204
-        $start_time = apply_filters(
205
-            'FHEE__EEM_Datetime__create_new_blank_datetime__start_time',
206
-            ['8am', 'ga']
207
-        );
208
-        /**
209
-         * Filters the initial end time and format for the new EE_Datetime instance.
210
-         *
211
-         * @param array $end_time An array having size 2.  First element is the time, second element is the time
212
-         *                        format
213
-         * @return array
214
-         */
215
-        $end_time = apply_filters(
216
-            'FHEE__EEM_Datetime__create_new_blank_datetime__end_time',
217
-            ['5pm', 'ga']
218
-        );
219
-        $this->validateStartAndEndTimeForBlankDate($start_time, $end_time);
220
-        $blank_datetime->set_start_time(
221
-            $this->convert_datetime_for_query(
222
-                'DTT_EVT_start',
223
-                $start_time[0],
224
-                $start_time[1],
225
-                $timezone_string
226
-            )
227
-        );
228
-        $blank_datetime->set_end_time(
229
-            $this->convert_datetime_for_query(
230
-                'DTT_EVT_end',
231
-                $end_time[0],
232
-                $end_time[1],
233
-                $timezone_string
234
-            )
235
-        );
236
-        return array($blank_datetime);
237
-    }
238
-
239
-
240
-    /**
241
-     * Validates whether the start_time and end_time are in the expected format.
242
-     * @param array $start_time
243
-     * @param array $end_time
244
-     * @throws InvalidArgumentException
245
-     * @throws InvalidDataTypeException
246
-     */
247
-    private function validateStartAndEndTimeForBlankDate($start_time, $end_time)
248
-    {
249
-        if (! is_array($start_time)) {
250
-            throw new InvalidDataTypeException('start_time', $start_time, 'array');
251
-        }
252
-        if (! is_array($end_time)) {
253
-            throw new InvalidDataTypeException('end_time', $end_time, 'array');
254
-        }
255
-        if (count($start_time) !== 2) {
256
-            throw new InvalidArgumentException(
257
-                sprintf(
258
-                    'The variable %1$s is expected to be an array with two elements.  The first item in the '
259
-                    . 'array should be a valid time string, the second item in the array should be a valid time format',
260
-                    '$start_time'
261
-                )
262
-            );
263
-        }
264
-        if (count($end_time) !== 2) {
265
-            throw new InvalidArgumentException(
266
-                sprintf(
267
-                    'The variable %1$s is expected to be an array with two elements.  The first item in the '
268
-                    . 'array should be a valid time string, the second item in the array should be a valid time format',
269
-                    '$end_time'
270
-                )
271
-            );
272
-        }
273
-    }
274
-
275
-
276
-    /**
277
-     * get event start date from db
278
-     *
279
-     * @access public
280
-     * @param  int $EVT_ID
281
-     * @return EE_Datetime[] array on success, FALSE on fail
282
-     * @throws EE_Error
283
-     */
284
-    public function get_all_event_dates($EVT_ID = 0)
285
-    {
286
-        if (! $EVT_ID) { // on add_new_event event_id gets set to 0
287
-            return $this->create_new_blank_datetime();
288
-        }
289
-        $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
290
-        if (empty($results)) {
291
-            return $this->create_new_blank_datetime();
292
-        }
293
-        return $results;
294
-    }
295
-
296
-
297
-    /**
298
-     * get all datetimes attached to an event ordered by the DTT_order field
299
-     *
300
-     * @public
301
-     * @param  int    $EVT_ID     event id
302
-     * @param boolean $include_expired
303
-     * @param boolean $include_deleted
304
-     * @param  int    $limit      If included then limit the count of results by
305
-     *                            the given number
306
-     * @return EE_Datetime[]
307
-     * @throws EE_Error
308
-     */
309
-    public function get_datetimes_for_event_ordered_by_DTT_order(
310
-        $EVT_ID,
311
-        $include_expired = true,
312
-        $include_deleted = true,
313
-        $limit = null
314
-    ) {
315
-        // sanitize EVT_ID
316
-        $EVT_ID         = absint($EVT_ID);
317
-        $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
318
-        $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
319
-        $where_params = array('Event.EVT_ID' => $EVT_ID);
320
-        $query_params = ! empty($limit)
321
-            ? array(
322
-                $where_params,
323
-                'limit'                    => $limit,
324
-                'order_by'                 => array('DTT_order' => 'ASC'),
325
-                'default_where_conditions' => 'none',
326
-            )
327
-            : array(
328
-                $where_params,
329
-                'order_by'                 => array('DTT_order' => 'ASC'),
330
-                'default_where_conditions' => 'none',
331
-            );
332
-        if (! $include_expired) {
333
-            $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
334
-        }
335
-        if ($include_deleted) {
336
-            $query_params[0]['DTT_deleted'] = array('IN', array(true, false));
337
-        }
338
-        /** @var EE_Datetime[] $result */
339
-        $result = $this->get_all($query_params);
340
-        $this->assume_values_already_prepared_by_model_object($old_assumption);
341
-        return $result;
342
-    }
343
-
344
-
345
-    /**
346
-     * Gets the datetimes for the event (with the given limit), and orders them by "importance".
347
-     * By importance, we mean that the primary datetimes are most important (DEPRECATED FOR NOW),
348
-     * and then the earlier datetimes are the most important.
349
-     * Maybe we'll want this to take into account datetimes that haven't already passed, but we don't yet.
350
-     *
351
-     * @param int $EVT_ID
352
-     * @param int $limit
353
-     * @return EE_Datetime[]|EE_Base_Class[]
354
-     * @throws EE_Error
355
-     */
356
-    public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = null)
357
-    {
358
-        return $this->get_all(
359
-            array(
360
-                array('Event.EVT_ID' => $EVT_ID),
361
-                'limit'                    => $limit,
362
-                'order_by'                 => array('DTT_EVT_start' => 'ASC'),
363
-                'default_where_conditions' => 'none',
364
-            )
365
-        );
366
-    }
367
-
368
-
369
-    /**
370
-     * @param int     $EVT_ID
371
-     * @param boolean $include_expired
372
-     * @param boolean $include_deleted
373
-     * @return EE_Datetime
374
-     * @throws EE_Error
375
-     */
376
-    public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false)
377
-    {
378
-        $results = $this->get_datetimes_for_event_ordered_by_start_time(
379
-            $EVT_ID,
380
-            $include_expired,
381
-            $include_deleted,
382
-            1
383
-        );
384
-        if ($results) {
385
-            return array_shift($results);
386
-        }
387
-        return null;
388
-    }
389
-
390
-
391
-    /**
392
-     * Gets the 'primary' datetime for an event.
393
-     *
394
-     * @param int  $EVT_ID
395
-     * @param bool $try_to_exclude_expired
396
-     * @param bool $try_to_exclude_deleted
397
-     * @return \EE_Datetime
398
-     * @throws EE_Error
399
-     */
400
-    public function get_primary_datetime_for_event(
401
-        $EVT_ID,
402
-        $try_to_exclude_expired = true,
403
-        $try_to_exclude_deleted = true
404
-    ) {
405
-        if ($try_to_exclude_expired) {
406
-            $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
407
-            if ($non_expired) {
408
-                return $non_expired;
409
-            }
410
-        }
411
-        if ($try_to_exclude_deleted) {
412
-            $expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
413
-            if ($expired_even) {
414
-                return $expired_even;
415
-            }
416
-        }
417
-        return $this->get_oldest_datetime_for_event($EVT_ID, true, true);
418
-    }
419
-
420
-
421
-    /**
422
-     * Gets ALL the datetimes for an event (including trashed ones, for now), ordered
423
-     * only by start date
424
-     *
425
-     * @param int     $EVT_ID
426
-     * @param boolean $include_expired
427
-     * @param boolean $include_deleted
428
-     * @param int     $limit
429
-     * @return EE_Datetime[]
430
-     * @throws EE_Error
431
-     */
432
-    public function get_datetimes_for_event_ordered_by_start_time(
433
-        $EVT_ID,
434
-        $include_expired = true,
435
-        $include_deleted = true,
436
-        $limit = null
437
-    ) {
438
-        // sanitize EVT_ID
439
-        $EVT_ID         = absint($EVT_ID);
440
-        $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
441
-        $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
442
-        $query_params = array(
443
-            array(
444
-                'Event.EVT_ID' => $EVT_ID
445
-            ),
446
-            'order_by' => array(
447
-                'DTT_EVT_start' => 'asc'
448
-            ),
449
-            'default_where_conditions' => EEM_Base::default_where_conditions_this_only
450
-        );
451
-        if (! $include_expired) {
452
-            $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
453
-        }
454
-        if ($include_deleted) {
455
-            $query_params[0]['DTT_deleted'] = array('IN', array(true, false));
456
-        }
457
-        if ($limit) {
458
-            $query_params['limit'] = $limit;
459
-        }
460
-        /** @var EE_Datetime[] $result */
461
-        $result = $this->get_all($query_params);
462
-        $this->assume_values_already_prepared_by_model_object($old_assumption);
463
-        return $result;
464
-    }
465
-
466
-
467
-    /**
468
-     * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
469
-     * only by start date
470
-     *
471
-     * @param int     $TKT_ID
472
-     * @param boolean $include_expired
473
-     * @param boolean $include_deleted
474
-     * @param int     $limit
475
-     * @return EE_Datetime[]
476
-     * @throws EE_Error
477
-     */
478
-    public function get_datetimes_for_ticket_ordered_by_start_time(
479
-        $TKT_ID,
480
-        $include_expired = true,
481
-        $include_deleted = true,
482
-        $limit = null
483
-    ) {
484
-        // sanitize TKT_ID
485
-        $TKT_ID         = absint($TKT_ID);
486
-        $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
487
-        $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
488
-        $query_params = array(array('Ticket.TKT_ID' => $TKT_ID), 'order_by' => array('DTT_EVT_start' => 'asc'));
489
-        if (! $include_expired) {
490
-            $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
491
-        }
492
-        if ($include_deleted) {
493
-            $query_params[0]['DTT_deleted'] = array('IN', array(true, false));
494
-        }
495
-        if ($limit) {
496
-            $query_params['limit'] = $limit;
497
-        }
498
-        /** @var EE_Datetime[] $result */
499
-        $result = $this->get_all($query_params);
500
-        $this->assume_values_already_prepared_by_model_object($old_assumption);
501
-        return $result;
502
-    }
503
-
504
-
505
-    /**
506
-     * Gets all the datetimes for a ticket (including trashed ones, for now), ordered by the DTT_order for the
507
-     * datetimes.
508
-     *
509
-     * @param  int      $TKT_ID          ID of ticket to retrieve the datetimes for
510
-     * @param  boolean  $include_expired whether to include expired datetimes or not
511
-     * @param  boolean  $include_deleted whether to include trashed datetimes or not.
512
-     * @param  int|null $limit           if null, no limit, if int then limit results by
513
-     *                                   that number
514
-     * @return EE_Datetime[]
515
-     * @throws EE_Error
516
-     */
517
-    public function get_datetimes_for_ticket_ordered_by_DTT_order(
518
-        $TKT_ID,
519
-        $include_expired = true,
520
-        $include_deleted = true,
521
-        $limit = null
522
-    ) {
523
-        // sanitize id.
524
-        $TKT_ID         = absint($TKT_ID);
525
-        $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
526
-        $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
527
-        $where_params = array('Ticket.TKT_ID' => $TKT_ID);
528
-        $query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
529
-        if (! $include_expired) {
530
-            $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
531
-        }
532
-        if ($include_deleted) {
533
-            $query_params[0]['DTT_deleted'] = array('IN', array(true, false));
534
-        }
535
-        if ($limit) {
536
-            $query_params['limit'] = $limit;
537
-        }
538
-        /** @var EE_Datetime[] $result */
539
-        $result = $this->get_all($query_params);
540
-        $this->assume_values_already_prepared_by_model_object($old_assumption);
541
-        return $result;
542
-    }
543
-
544
-
545
-    /**
546
-     * Gets the most important datetime for a particular event (ie, the primary event usually. But if for some WACK
547
-     * reason it doesn't exist, we consider the earliest event the most important)
548
-     *
549
-     * @param int $EVT_ID
550
-     * @return EE_Datetime
551
-     * @throws EE_Error
552
-     */
553
-    public function get_most_important_datetime_for_event($EVT_ID)
554
-    {
555
-        $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
556
-        if ($results) {
557
-            return array_shift($results);
558
-        }
559
-        return null;
560
-    }
561
-
562
-
563
-    /**
564
-     * This returns a wpdb->results        Array of all DTT month and years matching the incoming query params and
565
-     * grouped by month and year.
566
-     *
567
-     * @param  array  $where_params      @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md#0-where-conditions
568
-     * @param  string $evt_active_status A string representing the evt active status to filter the months by.
569
-     *                                   Can be:
570
-     *                                   - '' = no filter
571
-     *                                   - upcoming = Published events with at least one upcoming datetime.
572
-     *                                   - expired = Events with all datetimes expired.
573
-     *                                   - active = Events that are published and have at least one datetime that
574
-     *                                   starts before now and ends after now.
575
-     *                                   - inactive = Events that are either not published.
576
-     * @return stdClass[]
577
-     * @throws EE_Error
578
-     * @throws InvalidArgumentException
579
-     * @throws InvalidArgumentException
580
-     */
581
-    public function get_dtt_months_and_years($where_params, $evt_active_status = '')
582
-    {
583
-        $current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start');
584
-        $current_time_for_DTT_EVT_end   = $this->current_time_for_query('DTT_EVT_end');
585
-        switch ($evt_active_status) {
586
-            case 'upcoming':
587
-                $where_params['Event.status'] = 'publish';
588
-                // if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
589
-                if (isset($where_params['DTT_EVT_start'])) {
590
-                    $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
591
-                }
592
-                $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start);
593
-                break;
594
-            case 'expired':
595
-                if (isset($where_params['Event.status'])) {
596
-                    unset($where_params['Event.status']);
597
-                }
598
-                // get events to exclude
599
-                $exclude_query[0] = array_merge(
600
-                    $where_params,
601
-                    array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end))
602
-                );
603
-                // first get all events that have datetimes where its not expired.
604
-                $event_ids = $this->_get_all_wpdb_results(
605
-                    $exclude_query,
606
-                    OBJECT_K,
607
-                    'Datetime.EVT_ID'
608
-                );
609
-                $event_ids = array_keys($event_ids);
610
-                if (isset($where_params['DTT_EVT_end'])) {
611
-                    $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
612
-                }
613
-                $where_params['DTT_EVT_end']  = array('<', $current_time_for_DTT_EVT_end);
614
-                $where_params['Event.EVT_ID'] = array('NOT IN', $event_ids);
615
-                break;
616
-            case 'active':
617
-                $where_params['Event.status'] = 'publish';
618
-                if (isset($where_params['DTT_EVT_start'])) {
619
-                    $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
620
-                }
621
-                if (isset($where_params['Datetime.DTT_EVT_end'])) {
622
-                    $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
623
-                }
624
-                $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start);
625
-                $where_params['DTT_EVT_end']   = array('>', $current_time_for_DTT_EVT_end);
626
-                break;
627
-            case 'inactive':
628
-                if (isset($where_params['Event.status'])) {
629
-                    unset($where_params['Event.status']);
630
-                }
631
-                if (isset($where_params['OR'])) {
632
-                    $where_params['AND']['OR'] = $where_params['OR'];
633
-                }
634
-                if (isset($where_params['DTT_EVT_end'])) {
635
-                    $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
636
-                    unset($where_params['DTT_EVT_end']);
637
-                }
638
-                if (isset($where_params['DTT_EVT_start'])) {
639
-                    $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
640
-                    unset($where_params['DTT_EVT_start']);
641
-                }
642
-                $where_params['AND']['Event.status'] = array('!=', 'publish');
643
-                break;
644
-        }
645
-        $query_params[0]          = $where_params;
646
-        $query_params['group_by'] = array('dtt_year', 'dtt_month');
647
-        $query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
648
-        $query_interval           = EEH_DTT_Helper::get_sql_query_interval_for_offset(
649
-            $this->get_timezone(),
650
-            'DTT_EVT_start'
651
-        );
652
-        $columns_to_select        = array(
653
-            'dtt_year'      => array('YEAR(' . $query_interval . ')', '%s'),
654
-            'dtt_month'     => array('MONTHNAME(' . $query_interval . ')', '%s'),
655
-            'dtt_month_num' => array('MONTH(' . $query_interval . ')', '%s'),
656
-        );
657
-        return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
658
-    }
659
-
660
-
661
-    /**
662
-     * Updates the DTT_sold attribute on each datetime (based on the registrations
663
-     * for the tickets for each datetime)
664
-     *
665
-     * @param EE_Base_Class[]|EE_Datetime[] $datetimes
666
-     * @throws EE_Error
667
-     */
668
-    public function update_sold($datetimes)
669
-    {
670
-        EE_Error::doing_it_wrong(
671
-            __FUNCTION__,
672
-            esc_html__(
673
-                'Please use \EEM_Ticket::update_tickets_sold() instead which will in turn correctly update both the Ticket AND Datetime counts.',
674
-                'event_espresso'
675
-            ),
676
-            '4.9.32.rc.005'
677
-        );
678
-        foreach ($datetimes as $datetime) {
679
-            $datetime->update_sold();
680
-        }
681
-    }
682
-
683
-
684
-    /**
685
-     *    Gets the total number of tickets available at a particular datetime
686
-     *    (does NOT take into account the datetime's spaces available)
687
-     *
688
-     * @param int   $DTT_ID
689
-     * @param array $query_params
690
-     * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO
691
-     *             tickets attached to datetime then FALSE is returned.
692
-     */
693
-    public function sum_tickets_currently_available_at_datetime($DTT_ID, array $query_params = array())
694
-    {
695
-        $datetime = $this->get_one_by_ID($DTT_ID);
696
-        if ($datetime instanceof EE_Datetime) {
697
-            return $datetime->tickets_remaining($query_params);
698
-        }
699
-        return 0;
700
-    }
701
-
702
-
703
-    /**
704
-     * This returns an array of counts of datetimes in the database for each Datetime status that can be queried.
705
-     *
706
-     * @param  array $stati_to_include If included you can restrict the statuses we return counts for by including the
707
-     *                                 stati you want counts for as values in the array.  An empty array returns counts
708
-     *                                 for all valid stati.
709
-     * @param  array $query_params     If included can be used to refine the conditions for returning the count (i.e.
710
-     *                                 only for Datetimes connected to a specific event, or specific ticket.
711
-     * @return array  The value returned is an array indexed by Datetime Status and the values are the counts.  The
712
-     * @throws EE_Error
713
-     *                                 stati used as index keys are: EE_Datetime::active EE_Datetime::upcoming
714
-     *                                 EE_Datetime::expired
715
-     */
716
-    public function get_datetime_counts_by_status(array $stati_to_include = array(), array $query_params = array())
717
-    {
718
-        // only accept where conditions for this query.
719
-        $_where            = isset($query_params[0]) ? $query_params[0] : array();
720
-        $status_query_args = array(
721
-            EE_Datetime::active   => array_merge(
722
-                $_where,
723
-                array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time()))
724
-            ),
725
-            EE_Datetime::upcoming => array_merge(
726
-                $_where,
727
-                array('DTT_EVT_start' => array('>', time()))
728
-            ),
729
-            EE_Datetime::expired  => array_merge(
730
-                $_where,
731
-                array('DTT_EVT_end' => array('<', time()))
732
-            ),
733
-        );
734
-        if (! empty($stati_to_include)) {
735
-            foreach (array_keys($status_query_args) as $status) {
736
-                if (! in_array($status, $stati_to_include, true)) {
737
-                    unset($status_query_args[ $status ]);
738
-                }
739
-            }
740
-        }
741
-        // loop through and query counts for each stati.
742
-        $status_query_results = array();
743
-        foreach ($status_query_args as $status => $status_where_conditions) {
744
-            $status_query_results[ $status ] = EEM_Datetime::count(
745
-                array($status_where_conditions),
746
-                'DTT_ID',
747
-                true
748
-            );
749
-        }
750
-        return $status_query_results;
751
-    }
752
-
753
-
754
-    /**
755
-     * Returns the specific count for a given Datetime status matching any given query_params.
756
-     *
757
-     * @param string $status Valid string representation for Datetime status requested. (Defaults to Active).
758
-     * @param array  $query_params
759
-     * @return int
760
-     * @throws EE_Error
761
-     */
762
-    public function get_datetime_count_for_status($status = EE_Datetime::active, array $query_params = array())
763
-    {
764
-        $count = $this->get_datetime_counts_by_status(array($status), $query_params);
765
-        return ! empty($count[ $status ]) ? $count[ $status ] : 0;
766
-    }
16
+	/**
17
+	 * @var EEM_Datetime $_instance
18
+	 */
19
+	protected static $_instance;
20
+
21
+
22
+	/**
23
+	 * private constructor to prevent direct creation
24
+	 *
25
+	 * @param string $timezone A string representing the timezone we want to set for returned Date Time Strings
26
+	 *                         (and any incoming timezone data that gets saved).
27
+	 *                         Note this just sends the timezone info to the date time model field objects.
28
+	 *                         Default is NULL
29
+	 *                         (and will be assumed using the set timezone in the 'timezone_string' wp option)
30
+	 * @throws EE_Error
31
+	 * @throws InvalidArgumentException
32
+	 * @throws InvalidArgumentException
33
+	 */
34
+	protected function __construct($timezone)
35
+	{
36
+		$this->singular_item           = esc_html__('Datetime', 'event_espresso');
37
+		$this->plural_item             = esc_html__('Datetimes', 'event_espresso');
38
+		$this->_tables                 = array(
39
+			'Datetime' => new EE_Primary_Table('esp_datetime', 'DTT_ID'),
40
+		);
41
+		$this->_fields                 = array(
42
+			'Datetime' => array(
43
+				'DTT_ID'          => new EE_Primary_Key_Int_Field(
44
+					'DTT_ID',
45
+					esc_html__('Datetime ID', 'event_espresso')
46
+				),
47
+				'EVT_ID'          => new EE_Foreign_Key_Int_Field(
48
+					'EVT_ID',
49
+					esc_html__('Event ID', 'event_espresso'),
50
+					false,
51
+					0,
52
+					'Event'
53
+				),
54
+				'DTT_name'        => new EE_Plain_Text_Field(
55
+					'DTT_name',
56
+					esc_html__('Datetime Name', 'event_espresso'),
57
+					false,
58
+					''
59
+				),
60
+				'DTT_description' => new EE_Post_Content_Field(
61
+					'DTT_description',
62
+					esc_html__('Description for Datetime', 'event_espresso'),
63
+					false,
64
+					''
65
+				),
66
+				'DTT_EVT_start'   => new EE_Datetime_Field(
67
+					'DTT_EVT_start',
68
+					esc_html__('Start time/date of Event', 'event_espresso'),
69
+					false,
70
+					EE_Datetime_Field::now,
71
+					$timezone
72
+				),
73
+				'DTT_EVT_end'     => new EE_Datetime_Field(
74
+					'DTT_EVT_end',
75
+					esc_html__('End time/date of Event', 'event_espresso'),
76
+					false,
77
+					EE_Datetime_Field::now,
78
+					$timezone
79
+				),
80
+				'DTT_reg_limit'   => new EE_Infinite_Integer_Field(
81
+					'DTT_reg_limit',
82
+					esc_html__('Registration Limit for this time', 'event_espresso'),
83
+					true,
84
+					EE_INF
85
+				),
86
+				'DTT_sold'        => new EE_Integer_Field(
87
+					'DTT_sold',
88
+					esc_html__('How many sales for this Datetime that have occurred', 'event_espresso'),
89
+					true,
90
+					0
91
+				),
92
+				'DTT_reserved'    => new EE_Integer_Field(
93
+					'DTT_reserved',
94
+					esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'),
95
+					false,
96
+					0
97
+				),
98
+				'DTT_is_primary'  => new EE_Boolean_Field(
99
+					'DTT_is_primary',
100
+					esc_html__('Flag indicating datetime is primary one for event', 'event_espresso'),
101
+					false,
102
+					false
103
+				),
104
+				'DTT_order'       => new EE_Integer_Field(
105
+					'DTT_order',
106
+					esc_html__('The order in which the Datetime is displayed', 'event_espresso'),
107
+					false,
108
+					0
109
+				),
110
+				'DTT_parent'      => new EE_Integer_Field(
111
+					'DTT_parent',
112
+					esc_html__('Indicates what DTT_ID is the parent of this DTT_ID', 'event_espresso'),
113
+					true,
114
+					0
115
+				),
116
+				'DTT_deleted'     => new EE_Trashed_Flag_Field(
117
+					'DTT_deleted',
118
+					esc_html__('Flag indicating datetime is archived', 'event_espresso'),
119
+					false,
120
+					false
121
+				),
122
+			),
123
+		);
124
+		$this->_model_relations        = array(
125
+			'Ticket'  => new EE_HABTM_Relation('Datetime_Ticket'),
126
+			'Event'   => new EE_Belongs_To_Relation(),
127
+			'Checkin' => new EE_Has_Many_Relation(),
128
+			'Datetime_Ticket' => new EE_Has_Many_Relation(),
129
+		);
130
+		$path_to_event_model = 'Event';
131
+		$this->model_chain_to_password = $path_to_event_model;
132
+		$this->_model_chain_to_wp_user = $path_to_event_model;
133
+		// this model is generally available for reading
134
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ]       = new EE_Restriction_Generator_Event_Related_Public(
135
+			$path_to_event_model
136
+		);
137
+		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected(
138
+			$path_to_event_model
139
+		);
140
+		$this->_cap_restriction_generators[ EEM_Base::caps_edit ]       = new EE_Restriction_Generator_Event_Related_Protected(
141
+			$path_to_event_model
142
+		);
143
+		$this->_cap_restriction_generators[ EEM_Base::caps_delete ]     = new EE_Restriction_Generator_Event_Related_Protected(
144
+			$path_to_event_model,
145
+			EEM_Base::caps_edit
146
+		);
147
+		parent::__construct($timezone);
148
+	}
149
+
150
+
151
+	/**
152
+	 * create new blank datetime
153
+	 *
154
+	 * @access public
155
+	 * @return EE_Datetime[] array on success, FALSE on fail
156
+	 * @throws EE_Error
157
+	 * @throws InvalidArgumentException
158
+	 * @throws InvalidDataTypeException
159
+	 * @throws ReflectionException
160
+	 * @throws InvalidInterfaceException
161
+	 */
162
+	public function create_new_blank_datetime()
163
+	{
164
+		// makes sure timezone is always set.
165
+		$timezone_string = $this->get_timezone();
166
+		/**
167
+		 * Filters the initial start date for the new datetime.
168
+		 * Any time included in this value will be overridden later so use additional filters to modify the time.
169
+		 *
170
+		 * @param int $start_date Unixtimestamp representing now + 30 days in seconds.
171
+		 * @return int unixtimestamp
172
+		 */
173
+		$start_date = apply_filters(
174
+			'FHEE__EEM_Datetime__create_new_blank_datetime__start_date',
175
+			$this->current_time_for_query('DTT_EVT_start', true) + MONTH_IN_SECONDS
176
+		);
177
+		/**
178
+		 * Filters the initial end date for the new datetime.
179
+		 * Any time included in this value will be overridden later so use additional filters to modify the time.
180
+		 *
181
+		 * @param int $end_data Unixtimestamp representing now + 30 days in seconds.
182
+		 * @return int unixtimestamp
183
+		 */
184
+		$end_date = apply_filters(
185
+			'FHEE__EEM_Datetime__create_new_blank_datetime__end_date',
186
+			$this->current_time_for_query('DTT_EVT_end', true) + MONTH_IN_SECONDS
187
+		);
188
+		$blank_datetime = EE_Datetime::new_instance(
189
+			array(
190
+				'DTT_EVT_start' => $start_date,
191
+				'DTT_EVT_end'   => $end_date,
192
+				'DTT_order'     => 1,
193
+				'DTT_reg_limit' => EE_INF,
194
+			),
195
+			$timezone_string
196
+		);
197
+		/**
198
+		 * Filters the initial start time and format for the new EE_Datetime instance.
199
+		 *
200
+		 * @param array $start_time An array having size 2.  First element is the time, second element is the time
201
+		 *                          format.
202
+		 * @return array
203
+		 */
204
+		$start_time = apply_filters(
205
+			'FHEE__EEM_Datetime__create_new_blank_datetime__start_time',
206
+			['8am', 'ga']
207
+		);
208
+		/**
209
+		 * Filters the initial end time and format for the new EE_Datetime instance.
210
+		 *
211
+		 * @param array $end_time An array having size 2.  First element is the time, second element is the time
212
+		 *                        format
213
+		 * @return array
214
+		 */
215
+		$end_time = apply_filters(
216
+			'FHEE__EEM_Datetime__create_new_blank_datetime__end_time',
217
+			['5pm', 'ga']
218
+		);
219
+		$this->validateStartAndEndTimeForBlankDate($start_time, $end_time);
220
+		$blank_datetime->set_start_time(
221
+			$this->convert_datetime_for_query(
222
+				'DTT_EVT_start',
223
+				$start_time[0],
224
+				$start_time[1],
225
+				$timezone_string
226
+			)
227
+		);
228
+		$blank_datetime->set_end_time(
229
+			$this->convert_datetime_for_query(
230
+				'DTT_EVT_end',
231
+				$end_time[0],
232
+				$end_time[1],
233
+				$timezone_string
234
+			)
235
+		);
236
+		return array($blank_datetime);
237
+	}
238
+
239
+
240
+	/**
241
+	 * Validates whether the start_time and end_time are in the expected format.
242
+	 * @param array $start_time
243
+	 * @param array $end_time
244
+	 * @throws InvalidArgumentException
245
+	 * @throws InvalidDataTypeException
246
+	 */
247
+	private function validateStartAndEndTimeForBlankDate($start_time, $end_time)
248
+	{
249
+		if (! is_array($start_time)) {
250
+			throw new InvalidDataTypeException('start_time', $start_time, 'array');
251
+		}
252
+		if (! is_array($end_time)) {
253
+			throw new InvalidDataTypeException('end_time', $end_time, 'array');
254
+		}
255
+		if (count($start_time) !== 2) {
256
+			throw new InvalidArgumentException(
257
+				sprintf(
258
+					'The variable %1$s is expected to be an array with two elements.  The first item in the '
259
+					. 'array should be a valid time string, the second item in the array should be a valid time format',
260
+					'$start_time'
261
+				)
262
+			);
263
+		}
264
+		if (count($end_time) !== 2) {
265
+			throw new InvalidArgumentException(
266
+				sprintf(
267
+					'The variable %1$s is expected to be an array with two elements.  The first item in the '
268
+					. 'array should be a valid time string, the second item in the array should be a valid time format',
269
+					'$end_time'
270
+				)
271
+			);
272
+		}
273
+	}
274
+
275
+
276
+	/**
277
+	 * get event start date from db
278
+	 *
279
+	 * @access public
280
+	 * @param  int $EVT_ID
281
+	 * @return EE_Datetime[] array on success, FALSE on fail
282
+	 * @throws EE_Error
283
+	 */
284
+	public function get_all_event_dates($EVT_ID = 0)
285
+	{
286
+		if (! $EVT_ID) { // on add_new_event event_id gets set to 0
287
+			return $this->create_new_blank_datetime();
288
+		}
289
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
290
+		if (empty($results)) {
291
+			return $this->create_new_blank_datetime();
292
+		}
293
+		return $results;
294
+	}
295
+
296
+
297
+	/**
298
+	 * get all datetimes attached to an event ordered by the DTT_order field
299
+	 *
300
+	 * @public
301
+	 * @param  int    $EVT_ID     event id
302
+	 * @param boolean $include_expired
303
+	 * @param boolean $include_deleted
304
+	 * @param  int    $limit      If included then limit the count of results by
305
+	 *                            the given number
306
+	 * @return EE_Datetime[]
307
+	 * @throws EE_Error
308
+	 */
309
+	public function get_datetimes_for_event_ordered_by_DTT_order(
310
+		$EVT_ID,
311
+		$include_expired = true,
312
+		$include_deleted = true,
313
+		$limit = null
314
+	) {
315
+		// sanitize EVT_ID
316
+		$EVT_ID         = absint($EVT_ID);
317
+		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
318
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
319
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
320
+		$query_params = ! empty($limit)
321
+			? array(
322
+				$where_params,
323
+				'limit'                    => $limit,
324
+				'order_by'                 => array('DTT_order' => 'ASC'),
325
+				'default_where_conditions' => 'none',
326
+			)
327
+			: array(
328
+				$where_params,
329
+				'order_by'                 => array('DTT_order' => 'ASC'),
330
+				'default_where_conditions' => 'none',
331
+			);
332
+		if (! $include_expired) {
333
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
334
+		}
335
+		if ($include_deleted) {
336
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
337
+		}
338
+		/** @var EE_Datetime[] $result */
339
+		$result = $this->get_all($query_params);
340
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
341
+		return $result;
342
+	}
343
+
344
+
345
+	/**
346
+	 * Gets the datetimes for the event (with the given limit), and orders them by "importance".
347
+	 * By importance, we mean that the primary datetimes are most important (DEPRECATED FOR NOW),
348
+	 * and then the earlier datetimes are the most important.
349
+	 * Maybe we'll want this to take into account datetimes that haven't already passed, but we don't yet.
350
+	 *
351
+	 * @param int $EVT_ID
352
+	 * @param int $limit
353
+	 * @return EE_Datetime[]|EE_Base_Class[]
354
+	 * @throws EE_Error
355
+	 */
356
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = null)
357
+	{
358
+		return $this->get_all(
359
+			array(
360
+				array('Event.EVT_ID' => $EVT_ID),
361
+				'limit'                    => $limit,
362
+				'order_by'                 => array('DTT_EVT_start' => 'ASC'),
363
+				'default_where_conditions' => 'none',
364
+			)
365
+		);
366
+	}
367
+
368
+
369
+	/**
370
+	 * @param int     $EVT_ID
371
+	 * @param boolean $include_expired
372
+	 * @param boolean $include_deleted
373
+	 * @return EE_Datetime
374
+	 * @throws EE_Error
375
+	 */
376
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false)
377
+	{
378
+		$results = $this->get_datetimes_for_event_ordered_by_start_time(
379
+			$EVT_ID,
380
+			$include_expired,
381
+			$include_deleted,
382
+			1
383
+		);
384
+		if ($results) {
385
+			return array_shift($results);
386
+		}
387
+		return null;
388
+	}
389
+
390
+
391
+	/**
392
+	 * Gets the 'primary' datetime for an event.
393
+	 *
394
+	 * @param int  $EVT_ID
395
+	 * @param bool $try_to_exclude_expired
396
+	 * @param bool $try_to_exclude_deleted
397
+	 * @return \EE_Datetime
398
+	 * @throws EE_Error
399
+	 */
400
+	public function get_primary_datetime_for_event(
401
+		$EVT_ID,
402
+		$try_to_exclude_expired = true,
403
+		$try_to_exclude_deleted = true
404
+	) {
405
+		if ($try_to_exclude_expired) {
406
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
407
+			if ($non_expired) {
408
+				return $non_expired;
409
+			}
410
+		}
411
+		if ($try_to_exclude_deleted) {
412
+			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
413
+			if ($expired_even) {
414
+				return $expired_even;
415
+			}
416
+		}
417
+		return $this->get_oldest_datetime_for_event($EVT_ID, true, true);
418
+	}
419
+
420
+
421
+	/**
422
+	 * Gets ALL the datetimes for an event (including trashed ones, for now), ordered
423
+	 * only by start date
424
+	 *
425
+	 * @param int     $EVT_ID
426
+	 * @param boolean $include_expired
427
+	 * @param boolean $include_deleted
428
+	 * @param int     $limit
429
+	 * @return EE_Datetime[]
430
+	 * @throws EE_Error
431
+	 */
432
+	public function get_datetimes_for_event_ordered_by_start_time(
433
+		$EVT_ID,
434
+		$include_expired = true,
435
+		$include_deleted = true,
436
+		$limit = null
437
+	) {
438
+		// sanitize EVT_ID
439
+		$EVT_ID         = absint($EVT_ID);
440
+		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
441
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
442
+		$query_params = array(
443
+			array(
444
+				'Event.EVT_ID' => $EVT_ID
445
+			),
446
+			'order_by' => array(
447
+				'DTT_EVT_start' => 'asc'
448
+			),
449
+			'default_where_conditions' => EEM_Base::default_where_conditions_this_only
450
+		);
451
+		if (! $include_expired) {
452
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
453
+		}
454
+		if ($include_deleted) {
455
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
456
+		}
457
+		if ($limit) {
458
+			$query_params['limit'] = $limit;
459
+		}
460
+		/** @var EE_Datetime[] $result */
461
+		$result = $this->get_all($query_params);
462
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
463
+		return $result;
464
+	}
465
+
466
+
467
+	/**
468
+	 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
469
+	 * only by start date
470
+	 *
471
+	 * @param int     $TKT_ID
472
+	 * @param boolean $include_expired
473
+	 * @param boolean $include_deleted
474
+	 * @param int     $limit
475
+	 * @return EE_Datetime[]
476
+	 * @throws EE_Error
477
+	 */
478
+	public function get_datetimes_for_ticket_ordered_by_start_time(
479
+		$TKT_ID,
480
+		$include_expired = true,
481
+		$include_deleted = true,
482
+		$limit = null
483
+	) {
484
+		// sanitize TKT_ID
485
+		$TKT_ID         = absint($TKT_ID);
486
+		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
487
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
488
+		$query_params = array(array('Ticket.TKT_ID' => $TKT_ID), 'order_by' => array('DTT_EVT_start' => 'asc'));
489
+		if (! $include_expired) {
490
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
491
+		}
492
+		if ($include_deleted) {
493
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
494
+		}
495
+		if ($limit) {
496
+			$query_params['limit'] = $limit;
497
+		}
498
+		/** @var EE_Datetime[] $result */
499
+		$result = $this->get_all($query_params);
500
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
501
+		return $result;
502
+	}
503
+
504
+
505
+	/**
506
+	 * Gets all the datetimes for a ticket (including trashed ones, for now), ordered by the DTT_order for the
507
+	 * datetimes.
508
+	 *
509
+	 * @param  int      $TKT_ID          ID of ticket to retrieve the datetimes for
510
+	 * @param  boolean  $include_expired whether to include expired datetimes or not
511
+	 * @param  boolean  $include_deleted whether to include trashed datetimes or not.
512
+	 * @param  int|null $limit           if null, no limit, if int then limit results by
513
+	 *                                   that number
514
+	 * @return EE_Datetime[]
515
+	 * @throws EE_Error
516
+	 */
517
+	public function get_datetimes_for_ticket_ordered_by_DTT_order(
518
+		$TKT_ID,
519
+		$include_expired = true,
520
+		$include_deleted = true,
521
+		$limit = null
522
+	) {
523
+		// sanitize id.
524
+		$TKT_ID         = absint($TKT_ID);
525
+		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
526
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
527
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
528
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
529
+		if (! $include_expired) {
530
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', true));
531
+		}
532
+		if ($include_deleted) {
533
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
534
+		}
535
+		if ($limit) {
536
+			$query_params['limit'] = $limit;
537
+		}
538
+		/** @var EE_Datetime[] $result */
539
+		$result = $this->get_all($query_params);
540
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
541
+		return $result;
542
+	}
543
+
544
+
545
+	/**
546
+	 * Gets the most important datetime for a particular event (ie, the primary event usually. But if for some WACK
547
+	 * reason it doesn't exist, we consider the earliest event the most important)
548
+	 *
549
+	 * @param int $EVT_ID
550
+	 * @return EE_Datetime
551
+	 * @throws EE_Error
552
+	 */
553
+	public function get_most_important_datetime_for_event($EVT_ID)
554
+	{
555
+		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
556
+		if ($results) {
557
+			return array_shift($results);
558
+		}
559
+		return null;
560
+	}
561
+
562
+
563
+	/**
564
+	 * This returns a wpdb->results        Array of all DTT month and years matching the incoming query params and
565
+	 * grouped by month and year.
566
+	 *
567
+	 * @param  array  $where_params      @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md#0-where-conditions
568
+	 * @param  string $evt_active_status A string representing the evt active status to filter the months by.
569
+	 *                                   Can be:
570
+	 *                                   - '' = no filter
571
+	 *                                   - upcoming = Published events with at least one upcoming datetime.
572
+	 *                                   - expired = Events with all datetimes expired.
573
+	 *                                   - active = Events that are published and have at least one datetime that
574
+	 *                                   starts before now and ends after now.
575
+	 *                                   - inactive = Events that are either not published.
576
+	 * @return stdClass[]
577
+	 * @throws EE_Error
578
+	 * @throws InvalidArgumentException
579
+	 * @throws InvalidArgumentException
580
+	 */
581
+	public function get_dtt_months_and_years($where_params, $evt_active_status = '')
582
+	{
583
+		$current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start');
584
+		$current_time_for_DTT_EVT_end   = $this->current_time_for_query('DTT_EVT_end');
585
+		switch ($evt_active_status) {
586
+			case 'upcoming':
587
+				$where_params['Event.status'] = 'publish';
588
+				// if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
589
+				if (isset($where_params['DTT_EVT_start'])) {
590
+					$where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
591
+				}
592
+				$where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start);
593
+				break;
594
+			case 'expired':
595
+				if (isset($where_params['Event.status'])) {
596
+					unset($where_params['Event.status']);
597
+				}
598
+				// get events to exclude
599
+				$exclude_query[0] = array_merge(
600
+					$where_params,
601
+					array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end))
602
+				);
603
+				// first get all events that have datetimes where its not expired.
604
+				$event_ids = $this->_get_all_wpdb_results(
605
+					$exclude_query,
606
+					OBJECT_K,
607
+					'Datetime.EVT_ID'
608
+				);
609
+				$event_ids = array_keys($event_ids);
610
+				if (isset($where_params['DTT_EVT_end'])) {
611
+					$where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
612
+				}
613
+				$where_params['DTT_EVT_end']  = array('<', $current_time_for_DTT_EVT_end);
614
+				$where_params['Event.EVT_ID'] = array('NOT IN', $event_ids);
615
+				break;
616
+			case 'active':
617
+				$where_params['Event.status'] = 'publish';
618
+				if (isset($where_params['DTT_EVT_start'])) {
619
+					$where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
620
+				}
621
+				if (isset($where_params['Datetime.DTT_EVT_end'])) {
622
+					$where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
623
+				}
624
+				$where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start);
625
+				$where_params['DTT_EVT_end']   = array('>', $current_time_for_DTT_EVT_end);
626
+				break;
627
+			case 'inactive':
628
+				if (isset($where_params['Event.status'])) {
629
+					unset($where_params['Event.status']);
630
+				}
631
+				if (isset($where_params['OR'])) {
632
+					$where_params['AND']['OR'] = $where_params['OR'];
633
+				}
634
+				if (isset($where_params['DTT_EVT_end'])) {
635
+					$where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
636
+					unset($where_params['DTT_EVT_end']);
637
+				}
638
+				if (isset($where_params['DTT_EVT_start'])) {
639
+					$where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
640
+					unset($where_params['DTT_EVT_start']);
641
+				}
642
+				$where_params['AND']['Event.status'] = array('!=', 'publish');
643
+				break;
644
+		}
645
+		$query_params[0]          = $where_params;
646
+		$query_params['group_by'] = array('dtt_year', 'dtt_month');
647
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
648
+		$query_interval           = EEH_DTT_Helper::get_sql_query_interval_for_offset(
649
+			$this->get_timezone(),
650
+			'DTT_EVT_start'
651
+		);
652
+		$columns_to_select        = array(
653
+			'dtt_year'      => array('YEAR(' . $query_interval . ')', '%s'),
654
+			'dtt_month'     => array('MONTHNAME(' . $query_interval . ')', '%s'),
655
+			'dtt_month_num' => array('MONTH(' . $query_interval . ')', '%s'),
656
+		);
657
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
658
+	}
659
+
660
+
661
+	/**
662
+	 * Updates the DTT_sold attribute on each datetime (based on the registrations
663
+	 * for the tickets for each datetime)
664
+	 *
665
+	 * @param EE_Base_Class[]|EE_Datetime[] $datetimes
666
+	 * @throws EE_Error
667
+	 */
668
+	public function update_sold($datetimes)
669
+	{
670
+		EE_Error::doing_it_wrong(
671
+			__FUNCTION__,
672
+			esc_html__(
673
+				'Please use \EEM_Ticket::update_tickets_sold() instead which will in turn correctly update both the Ticket AND Datetime counts.',
674
+				'event_espresso'
675
+			),
676
+			'4.9.32.rc.005'
677
+		);
678
+		foreach ($datetimes as $datetime) {
679
+			$datetime->update_sold();
680
+		}
681
+	}
682
+
683
+
684
+	/**
685
+	 *    Gets the total number of tickets available at a particular datetime
686
+	 *    (does NOT take into account the datetime's spaces available)
687
+	 *
688
+	 * @param int   $DTT_ID
689
+	 * @param array $query_params
690
+	 * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO
691
+	 *             tickets attached to datetime then FALSE is returned.
692
+	 */
693
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, array $query_params = array())
694
+	{
695
+		$datetime = $this->get_one_by_ID($DTT_ID);
696
+		if ($datetime instanceof EE_Datetime) {
697
+			return $datetime->tickets_remaining($query_params);
698
+		}
699
+		return 0;
700
+	}
701
+
702
+
703
+	/**
704
+	 * This returns an array of counts of datetimes in the database for each Datetime status that can be queried.
705
+	 *
706
+	 * @param  array $stati_to_include If included you can restrict the statuses we return counts for by including the
707
+	 *                                 stati you want counts for as values in the array.  An empty array returns counts
708
+	 *                                 for all valid stati.
709
+	 * @param  array $query_params     If included can be used to refine the conditions for returning the count (i.e.
710
+	 *                                 only for Datetimes connected to a specific event, or specific ticket.
711
+	 * @return array  The value returned is an array indexed by Datetime Status and the values are the counts.  The
712
+	 * @throws EE_Error
713
+	 *                                 stati used as index keys are: EE_Datetime::active EE_Datetime::upcoming
714
+	 *                                 EE_Datetime::expired
715
+	 */
716
+	public function get_datetime_counts_by_status(array $stati_to_include = array(), array $query_params = array())
717
+	{
718
+		// only accept where conditions for this query.
719
+		$_where            = isset($query_params[0]) ? $query_params[0] : array();
720
+		$status_query_args = array(
721
+			EE_Datetime::active   => array_merge(
722
+				$_where,
723
+				array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time()))
724
+			),
725
+			EE_Datetime::upcoming => array_merge(
726
+				$_where,
727
+				array('DTT_EVT_start' => array('>', time()))
728
+			),
729
+			EE_Datetime::expired  => array_merge(
730
+				$_where,
731
+				array('DTT_EVT_end' => array('<', time()))
732
+			),
733
+		);
734
+		if (! empty($stati_to_include)) {
735
+			foreach (array_keys($status_query_args) as $status) {
736
+				if (! in_array($status, $stati_to_include, true)) {
737
+					unset($status_query_args[ $status ]);
738
+				}
739
+			}
740
+		}
741
+		// loop through and query counts for each stati.
742
+		$status_query_results = array();
743
+		foreach ($status_query_args as $status => $status_where_conditions) {
744
+			$status_query_results[ $status ] = EEM_Datetime::count(
745
+				array($status_where_conditions),
746
+				'DTT_ID',
747
+				true
748
+			);
749
+		}
750
+		return $status_query_results;
751
+	}
752
+
753
+
754
+	/**
755
+	 * Returns the specific count for a given Datetime status matching any given query_params.
756
+	 *
757
+	 * @param string $status Valid string representation for Datetime status requested. (Defaults to Active).
758
+	 * @param array  $query_params
759
+	 * @return int
760
+	 * @throws EE_Error
761
+	 */
762
+	public function get_datetime_count_for_status($status = EE_Datetime::active, array $query_params = array())
763
+	{
764
+		$count = $this->get_datetime_counts_by_status(array($status), $query_params);
765
+		return ! empty($count[ $status ]) ? $count[ $status ] : 0;
766
+	}
767 767
 }
Please login to merge, or discard this patch.
admin_pages/transactions/Transactions_Admin_Page_Init.core.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@
 block discarded – undo
22 22
     {
23 23
 
24 24
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
25
-        if (! defined('TXN_PG_SLUG')) {
25
+        if ( ! defined('TXN_PG_SLUG')) {
26 26
             define('TXN_PG_SLUG', 'espresso_transactions');
27 27
             define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG)));
28
-            define('TXN_ADMIN', EE_ADMIN_PAGES . 'transactions/');
29
-            define('TXN_ADMIN_URL', admin_url('admin.php?page=' . TXN_PG_SLUG));
30
-            define('TXN_ASSETS_PATH', TXN_ADMIN . 'assets/');
31
-            define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets/'));
32
-            define('TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates/');
33
-            define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates/'));
28
+            define('TXN_ADMIN', EE_ADMIN_PAGES.'transactions/');
29
+            define('TXN_ADMIN_URL', admin_url('admin.php?page='.TXN_PG_SLUG));
30
+            define('TXN_ASSETS_PATH', TXN_ADMIN.'assets/');
31
+            define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/assets/'));
32
+            define('TXN_TEMPLATE_PATH', TXN_ADMIN.'templates/');
33
+            define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/templates/'));
34 34
         }
35 35
         parent::__construct();
36 36
     }
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -13,58 +13,58 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     * @Constructor
18
-     * @access public
19
-     * @return Transactions_Admin_Page_Init
20
-     */
21
-    public function __construct()
22
-    {
16
+	/**
17
+	 * @Constructor
18
+	 * @access public
19
+	 * @return Transactions_Admin_Page_Init
20
+	 */
21
+	public function __construct()
22
+	{
23 23
 
24
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
25
-        if (! defined('TXN_PG_SLUG')) {
26
-            define('TXN_PG_SLUG', 'espresso_transactions');
27
-            define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG)));
28
-            define('TXN_ADMIN', EE_ADMIN_PAGES . 'transactions/');
29
-            define('TXN_ADMIN_URL', admin_url('admin.php?page=' . TXN_PG_SLUG));
30
-            define('TXN_ASSETS_PATH', TXN_ADMIN . 'assets/');
31
-            define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets/'));
32
-            define('TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates/');
33
-            define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates/'));
34
-        }
35
-        parent::__construct();
36
-    }
24
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
25
+		if (! defined('TXN_PG_SLUG')) {
26
+			define('TXN_PG_SLUG', 'espresso_transactions');
27
+			define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG)));
28
+			define('TXN_ADMIN', EE_ADMIN_PAGES . 'transactions/');
29
+			define('TXN_ADMIN_URL', admin_url('admin.php?page=' . TXN_PG_SLUG));
30
+			define('TXN_ASSETS_PATH', TXN_ADMIN . 'assets/');
31
+			define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets/'));
32
+			define('TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates/');
33
+			define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates/'));
34
+		}
35
+		parent::__construct();
36
+	}
37 37
 
38 38
 
39
-    /**
40
-     *    _set_init_properties
41
-     *
42
-     * @return void
43
-     */
44
-    protected function _set_init_properties()
45
-    {
46
-        $this->label = esc_html__('Transactions Overview', 'event_espresso');
47
-    }
39
+	/**
40
+	 *    _set_init_properties
41
+	 *
42
+	 * @return void
43
+	 */
44
+	protected function _set_init_properties()
45
+	{
46
+		$this->label = esc_html__('Transactions Overview', 'event_espresso');
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     *    _set_menu_map
52
-     *
53
-     * @return void
54
-     */
55
-    protected function _set_menu_map()
56
-    {
57
-        $this->_menu_map = new EE_Admin_Page_Sub_Menu(
58
-            array(
59
-                'menu_group'      => 'main',
60
-                'menu_order'      => 50,
61
-                'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
62
-                'parent_slug'     => 'espresso_events',
63
-                'menu_slug'       => TXN_PG_SLUG,
64
-                'menu_label'      => esc_html__('Transactions', 'event_espresso'),
65
-                'capability'      => 'ee_read_transactions',
66
-                'admin_init_page' => $this,
67
-            )
68
-        );
69
-    }
50
+	/**
51
+	 *    _set_menu_map
52
+	 *
53
+	 * @return void
54
+	 */
55
+	protected function _set_menu_map()
56
+	{
57
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(
58
+			array(
59
+				'menu_group'      => 'main',
60
+				'menu_order'      => 50,
61
+				'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
62
+				'parent_slug'     => 'espresso_events',
63
+				'menu_slug'       => TXN_PG_SLUG,
64
+				'menu_label'      => esc_html__('Transactions', 'event_espresso'),
65
+				'capability'      => 'ee_read_transactions',
66
+				'admin_init_page' => $this,
67
+			)
68
+		);
69
+	}
70 70
 }
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page_Init.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
     {
22 22
         // define some event categories related constants
23 23
         define('EE_VENUES_PG_SLUG', 'espresso_venues');
24
-        define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG));
25
-        define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'venues/assets/');
26
-        define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES . 'venues/templates/');
24
+        define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page='.EE_VENUES_PG_SLUG));
25
+        define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL.'venues/assets/');
26
+        define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES.'venues/templates/');
27 27
 
28 28
         parent::__construct();
29
-        $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
29
+        $this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.'/';
30 30
     }
31 31
 
32 32
     protected function _set_init_properties()
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -17,39 +17,39 @@
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    public function __construct()
21
-    {
22
-        // define some event categories related constants
23
-        define('EE_VENUES_PG_SLUG', 'espresso_venues');
24
-        define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG));
25
-        define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'venues/assets/');
26
-        define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES . 'venues/templates/');
20
+	public function __construct()
21
+	{
22
+		// define some event categories related constants
23
+		define('EE_VENUES_PG_SLUG', 'espresso_venues');
24
+		define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG));
25
+		define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'venues/assets/');
26
+		define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES . 'venues/templates/');
27 27
 
28
-        parent::__construct();
29
-        $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
30
-    }
28
+		parent::__construct();
29
+		$this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . '/';
30
+	}
31 31
 
32
-    protected function _set_init_properties()
33
-    {
34
-        $this->label = esc_html__('Event Venues', 'event_espresso');
35
-        $this->menu_label = esc_html__('Venues', 'event_espresso');
36
-        $this->menu_slug = EE_VENUES_PG_SLUG;
37
-    }
32
+	protected function _set_init_properties()
33
+	{
34
+		$this->label = esc_html__('Event Venues', 'event_espresso');
35
+		$this->menu_label = esc_html__('Venues', 'event_espresso');
36
+		$this->menu_slug = EE_VENUES_PG_SLUG;
37
+	}
38 38
 
39 39
 
40
-    protected function _set_menu_map()
41
-    {
42
-        $this->_menu_map = new EE_Admin_Page_Sub_Menu(
43
-            array(
44
-                'menu_group'      => 'management',
45
-                'menu_order'      => 40,
46
-                'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
47
-                'parent_slug'     => 'espresso_events',
48
-                'menu_slug'       => EE_VENUES_PG_SLUG,
49
-                'menu_label'      => esc_html__('Venues', 'event_espresso'),
50
-                'capability'      => 'ee_read_venues',
51
-                'admin_init_page' => $this,
52
-            )
53
-        );
54
-    }
40
+	protected function _set_menu_map()
41
+	{
42
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(
43
+			array(
44
+				'menu_group'      => 'management',
45
+				'menu_order'      => 40,
46
+				'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
47
+				'parent_slug'     => 'espresso_events',
48
+				'menu_slug'       => EE_VENUES_PG_SLUG,
49
+				'menu_label'      => esc_html__('Venues', 'event_espresso'),
50
+				'capability'      => 'ee_read_venues',
51
+				'admin_init_page' => $this,
52
+			)
53
+		);
54
+	}
55 55
 }
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page_Init.core.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@
 block discarded – undo
24 24
 
25 25
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
26 26
 
27
-        if (! defined('EE_MSG_PG_SLUG')) {
27
+        if ( ! defined('EE_MSG_PG_SLUG')) {
28 28
             define('EE_MSG_PG_SLUG', 'espresso_messages');
29 29
             define('EE_MSG_PG_NAME', ucwords(str_replace('_', '', EE_MSG_PG_SLUG)));
30
-            define('EE_MSG_ADMIN', EE_ADMIN_PAGES . 'messages/');
31
-            define('EE_MSG_ADMIN_URL', admin_url('admin.php?page=' . EE_MSG_PG_SLUG));
32
-            define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN . 'assets/');
33
-            define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'messages/assets/');
34
-            define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN . 'templates/');
35
-            define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'messages/templates/');
30
+            define('EE_MSG_ADMIN', EE_ADMIN_PAGES.'messages/');
31
+            define('EE_MSG_ADMIN_URL', admin_url('admin.php?page='.EE_MSG_PG_SLUG));
32
+            define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN.'assets/');
33
+            define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL.'messages/assets/');
34
+            define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN.'templates/');
35
+            define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL.'messages/templates/');
36 36
         }
37 37
 
38 38
         parent::__construct();
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -13,52 +13,52 @@
 block discarded – undo
13 13
  */
14 14
 class Messages_Admin_Page_Init extends EE_Admin_Page_Init
15 15
 {
16
-    /**
17
-     *constructor
18
-     *
19
-     * @Constructor
20
-     * @access public
21
-     * @return void
22
-     */
23
-    public function __construct()
24
-    {
16
+	/**
17
+	 *constructor
18
+	 *
19
+	 * @Constructor
20
+	 * @access public
21
+	 * @return void
22
+	 */
23
+	public function __construct()
24
+	{
25 25
 
26
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
26
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
27 27
 
28
-        if (! defined('EE_MSG_PG_SLUG')) {
29
-            define('EE_MSG_PG_SLUG', 'espresso_messages');
30
-            define('EE_MSG_PG_NAME', ucwords(str_replace('_', '', EE_MSG_PG_SLUG)));
31
-            define('EE_MSG_ADMIN', EE_ADMIN_PAGES . 'messages/');
32
-            define('EE_MSG_ADMIN_URL', admin_url('admin.php?page=' . EE_MSG_PG_SLUG));
33
-            define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN . 'assets/');
34
-            define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'messages/assets/');
35
-            define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN . 'templates/');
36
-            define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'messages/templates/');
37
-        }
28
+		if (! defined('EE_MSG_PG_SLUG')) {
29
+			define('EE_MSG_PG_SLUG', 'espresso_messages');
30
+			define('EE_MSG_PG_NAME', ucwords(str_replace('_', '', EE_MSG_PG_SLUG)));
31
+			define('EE_MSG_ADMIN', EE_ADMIN_PAGES . 'messages/');
32
+			define('EE_MSG_ADMIN_URL', admin_url('admin.php?page=' . EE_MSG_PG_SLUG));
33
+			define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN . 'assets/');
34
+			define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'messages/assets/');
35
+			define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN . 'templates/');
36
+			define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'messages/templates/');
37
+		}
38 38
 
39
-        parent::__construct();
40
-    }
39
+		parent::__construct();
40
+	}
41 41
 
42 42
 
43
-    protected function _set_init_properties()
44
-    {
45
-        $this->label = esc_html__('Messages System', 'event_espresso');
46
-    }
43
+	protected function _set_init_properties()
44
+	{
45
+		$this->label = esc_html__('Messages System', 'event_espresso');
46
+	}
47 47
 
48 48
 
49
-    protected function _set_menu_map()
50
-    {
51
-        $this->_menu_map = new EE_Admin_Page_Sub_Menu(
52
-            array(
53
-                'menu_group'      => 'management',
54
-                'menu_order'      => 10,
55
-                'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
56
-                'parent_slug'     => 'espresso_events',
57
-                'menu_slug'       => EE_MSG_PG_SLUG,
58
-                'menu_label'      => esc_html__('Messages', 'event_espresso'),
59
-                'capability'      => 'ee_read_global_messages',
60
-                'admin_init_page' => $this,
61
-            )
62
-        );
63
-    }
49
+	protected function _set_menu_map()
50
+	{
51
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(
52
+			array(
53
+				'menu_group'      => 'management',
54
+				'menu_order'      => 10,
55
+				'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
56
+				'parent_slug'     => 'espresso_events',
57
+				'menu_slug'       => EE_MSG_PG_SLUG,
58
+				'menu_label'      => esc_html__('Messages', 'event_espresso'),
59
+				'capability'      => 'ee_read_global_messages',
60
+				'admin_init_page' => $this,
61
+			)
62
+		);
63
+	}
64 64
 }
Please login to merge, or discard this patch.