Completed
Pull Request — master (#268)
by Michael
22:46 queued 42s
created
core/domain/entities/notifications/PersistentAdminNotice.php 2 patches
Indentation   +323 added lines, -323 removed lines patch added patch discarded remove patch
@@ -28,332 +28,332 @@
 block discarded – undo
28 28
 class PersistentAdminNotice implements RequiresCapCheckInterface
29 29
 {
30 30
 
31
-    /**
32
-     * @var string $name
33
-     */
34
-    protected $name = '';
35
-
36
-    /**
37
-     * @var string $message
38
-     */
39
-    protected $message = '';
40
-
41
-    /**
42
-     * @var boolean $force_update
43
-     */
44
-    protected $force_update = false;
45
-
46
-    /**
47
-     * @var string $capability
48
-     */
49
-    protected $capability = 'manage_options';
50
-
51
-    /**
52
-     * @var string $cap_context
53
-     */
54
-    protected $cap_context = 'view persistent admin notice';
55
-
56
-    /**
57
-     * @var boolean $dismissed
58
-     */
59
-    protected $dismissed = false;
60
-
61
-    /**
62
-     * @var CapCheckInterface $cap_check
63
-     */
64
-    protected $cap_check;
65
-
66
-    /**
67
-     * if true, then this notice will be deleted from the database
68
-     *
69
-     * @var boolean $purge
70
-     */
71
-    protected $purge = false;
72
-
73
-    /**
74
-     * gets set to true if notice is successfully registered with the PersistentAdminNoticeManager
75
-     * if false, and WP_DEBUG is on, then an exception will be thrown in the admin footer
76
-     *
77
-     * @var boolean $registered
78
-     */
79
-    private $registered = false;
80
-
81
-
82
-
83
-    /**
84
-     * PersistentAdminNotice constructor
85
-     *
86
-     * @param string $name         [required] the name, or key of the Persistent Admin Notice to be stored
87
-     * @param string $message      [required] the message to be stored persistently until dismissed
88
-     * @param bool   $force_update enforce the reappearance of a persistent message
89
-     * @param string $capability   user capability required to view this notice
90
-     * @param string $cap_context  description for why the cap check is being performed
91
-     * @param bool   $dismissed    whether or not the user has already dismissed/viewed this notice
92
-     * @throws InvalidDataTypeException
93
-     */
94
-    public function __construct(
95
-        $name,
96
-        $message,
97
-        $force_update = false,
98
-        $capability = 'manage_options',
99
-        $cap_context = 'view persistent admin notice',
100
-        $dismissed = false
101
-    ) {
102
-        $this->setName($name);
103
-        $this->setMessage($message);
104
-        $this->setForceUpdate($force_update);
105
-        $this->setCapability($capability);
106
-        $this->setCapContext($cap_context);
107
-        $this->setDismissed($dismissed);
108
-        add_action(
109
-            'AHEE__EventEspresso_core_services_notifications_PersistentAdminNoticeManager__registerNotices',
110
-            array($this, 'registerPersistentAdminNotice')
111
-        );
112
-        add_action('shutdown', array($this, 'confirmRegistered'), 999);
113
-    }
114
-
115
-
116
-
117
-    /**
118
-     * @return string
119
-     */
120
-    public function getName()
121
-    {
122
-        return $this->name;
123
-    }
124
-
125
-
126
-
127
-    /**
128
-     * @param string $name
129
-     * @throws InvalidDataTypeException
130
-     */
131
-    private function setName($name)
132
-    {
133
-        if (! is_string($name)) {
134
-            throw new InvalidDataTypeException('$name', $name, 'string');
135
-        }
136
-        $this->name = sanitize_key($name);
137
-    }
138
-
139
-
140
-
141
-    /**
142
-     * @return string
143
-     */
144
-    public function getMessage()
145
-    {
146
-        return $this->message;
147
-    }
148
-
149
-
150
-
151
-    /**
152
-     * @param string $message
153
-     * @throws InvalidDataTypeException
154
-     */
155
-    private function setMessage($message)
156
-    {
157
-        if (! is_string($message)) {
158
-            throw new InvalidDataTypeException('$message', $message, 'string');
159
-        }
160
-        global $allowedtags;
161
-        $allowedtags['br'] = array();
162
-        $this->message     = wp_kses($message, $allowedtags);
163
-    }
164
-
165
-
166
-
167
-    /**
168
-     * @return bool
169
-     */
170
-    public function getForceUpdate()
171
-    {
172
-        return $this->force_update;
173
-    }
174
-
175
-
176
-
177
-    /**
178
-     * @param bool $force_update
179
-     */
180
-    private function setForceUpdate($force_update)
181
-    {
182
-        $this->force_update = filter_var($force_update, FILTER_VALIDATE_BOOLEAN);
183
-    }
184
-
185
-
186
-
187
-    /**
188
-     * @return string
189
-     */
190
-    public function getCapability()
191
-    {
192
-        return $this->capability;
193
-    }
194
-
195
-
196
-
197
-    /**
198
-     * @param string $capability
199
-     * @throws InvalidDataTypeException
200
-     */
201
-    private function setCapability($capability)
202
-    {
203
-        if (! is_string($capability)) {
204
-            throw new InvalidDataTypeException('$capability', $capability, 'string');
205
-        }
206
-        $this->capability = ! empty($capability) ? $capability : 'manage_options';
207
-    }
31
+	/**
32
+	 * @var string $name
33
+	 */
34
+	protected $name = '';
35
+
36
+	/**
37
+	 * @var string $message
38
+	 */
39
+	protected $message = '';
40
+
41
+	/**
42
+	 * @var boolean $force_update
43
+	 */
44
+	protected $force_update = false;
45
+
46
+	/**
47
+	 * @var string $capability
48
+	 */
49
+	protected $capability = 'manage_options';
50
+
51
+	/**
52
+	 * @var string $cap_context
53
+	 */
54
+	protected $cap_context = 'view persistent admin notice';
55
+
56
+	/**
57
+	 * @var boolean $dismissed
58
+	 */
59
+	protected $dismissed = false;
60
+
61
+	/**
62
+	 * @var CapCheckInterface $cap_check
63
+	 */
64
+	protected $cap_check;
65
+
66
+	/**
67
+	 * if true, then this notice will be deleted from the database
68
+	 *
69
+	 * @var boolean $purge
70
+	 */
71
+	protected $purge = false;
72
+
73
+	/**
74
+	 * gets set to true if notice is successfully registered with the PersistentAdminNoticeManager
75
+	 * if false, and WP_DEBUG is on, then an exception will be thrown in the admin footer
76
+	 *
77
+	 * @var boolean $registered
78
+	 */
79
+	private $registered = false;
80
+
81
+
82
+
83
+	/**
84
+	 * PersistentAdminNotice constructor
85
+	 *
86
+	 * @param string $name         [required] the name, or key of the Persistent Admin Notice to be stored
87
+	 * @param string $message      [required] the message to be stored persistently until dismissed
88
+	 * @param bool   $force_update enforce the reappearance of a persistent message
89
+	 * @param string $capability   user capability required to view this notice
90
+	 * @param string $cap_context  description for why the cap check is being performed
91
+	 * @param bool   $dismissed    whether or not the user has already dismissed/viewed this notice
92
+	 * @throws InvalidDataTypeException
93
+	 */
94
+	public function __construct(
95
+		$name,
96
+		$message,
97
+		$force_update = false,
98
+		$capability = 'manage_options',
99
+		$cap_context = 'view persistent admin notice',
100
+		$dismissed = false
101
+	) {
102
+		$this->setName($name);
103
+		$this->setMessage($message);
104
+		$this->setForceUpdate($force_update);
105
+		$this->setCapability($capability);
106
+		$this->setCapContext($cap_context);
107
+		$this->setDismissed($dismissed);
108
+		add_action(
109
+			'AHEE__EventEspresso_core_services_notifications_PersistentAdminNoticeManager__registerNotices',
110
+			array($this, 'registerPersistentAdminNotice')
111
+		);
112
+		add_action('shutdown', array($this, 'confirmRegistered'), 999);
113
+	}
114
+
115
+
116
+
117
+	/**
118
+	 * @return string
119
+	 */
120
+	public function getName()
121
+	{
122
+		return $this->name;
123
+	}
124
+
125
+
126
+
127
+	/**
128
+	 * @param string $name
129
+	 * @throws InvalidDataTypeException
130
+	 */
131
+	private function setName($name)
132
+	{
133
+		if (! is_string($name)) {
134
+			throw new InvalidDataTypeException('$name', $name, 'string');
135
+		}
136
+		$this->name = sanitize_key($name);
137
+	}
138
+
139
+
140
+
141
+	/**
142
+	 * @return string
143
+	 */
144
+	public function getMessage()
145
+	{
146
+		return $this->message;
147
+	}
148
+
149
+
150
+
151
+	/**
152
+	 * @param string $message
153
+	 * @throws InvalidDataTypeException
154
+	 */
155
+	private function setMessage($message)
156
+	{
157
+		if (! is_string($message)) {
158
+			throw new InvalidDataTypeException('$message', $message, 'string');
159
+		}
160
+		global $allowedtags;
161
+		$allowedtags['br'] = array();
162
+		$this->message     = wp_kses($message, $allowedtags);
163
+	}
164
+
165
+
166
+
167
+	/**
168
+	 * @return bool
169
+	 */
170
+	public function getForceUpdate()
171
+	{
172
+		return $this->force_update;
173
+	}
174
+
175
+
176
+
177
+	/**
178
+	 * @param bool $force_update
179
+	 */
180
+	private function setForceUpdate($force_update)
181
+	{
182
+		$this->force_update = filter_var($force_update, FILTER_VALIDATE_BOOLEAN);
183
+	}
184
+
185
+
186
+
187
+	/**
188
+	 * @return string
189
+	 */
190
+	public function getCapability()
191
+	{
192
+		return $this->capability;
193
+	}
194
+
195
+
196
+
197
+	/**
198
+	 * @param string $capability
199
+	 * @throws InvalidDataTypeException
200
+	 */
201
+	private function setCapability($capability)
202
+	{
203
+		if (! is_string($capability)) {
204
+			throw new InvalidDataTypeException('$capability', $capability, 'string');
205
+		}
206
+		$this->capability = ! empty($capability) ? $capability : 'manage_options';
207
+	}
208 208
 
209 209
 
210 210
 
211
-    /**
212
-     * @return string
213
-     */
214
-    public function getCapContext()
215
-    {
216
-        return $this->cap_context;
217
-    }
218
-
219
-
220
-
221
-    /**
222
-     * @param string $cap_context
223
-     * @throws InvalidDataTypeException
224
-     */
225
-    private function setCapContext($cap_context)
226
-    {
227
-        if (! is_string($cap_context)) {
228
-            throw new InvalidDataTypeException('$cap_context', $cap_context, 'string');
229
-        }
230
-        $this->cap_context = ! empty($cap_context) ? $cap_context : 'view persistent admin notice';
231
-    }
232
-
233
-
234
-
235
-    /**
236
-     * @return bool
237
-     */
238
-    public function getDismissed()
239
-    {
240
-        return $this->dismissed;
241
-    }
242
-
243
-
244
-
245
-    /**
246
-     * @param bool $dismissed
247
-     */
248
-    public function setDismissed($dismissed)
249
-    {
250
-        $this->dismissed = filter_var($dismissed, FILTER_VALIDATE_BOOLEAN);
251
-    }
252
-
253
-
254
-
255
-    /**
256
-     * @return CapCheckInterface
257
-     * @throws InvalidDataTypeException
258
-     */
259
-    public function getCapCheck()
260
-    {
261
-        if (! $this->cap_check instanceof CapCheckInterface) {
262
-            $this->setCapCheck(
263
-                new CapCheck(
264
-                    $this->capability,
265
-                    $this->cap_context
266
-                )
267
-            );
268
-        }
269
-        return $this->cap_check;
270
-    }
271
-
272
-
273
-
274
-    /**
275
-     * @param CapCheckInterface $cap_check
276
-     */
277
-    private function setCapCheck(CapCheckInterface $cap_check)
278
-    {
279
-        $this->cap_check = $cap_check;
280
-    }
281
-
282
-
283
-
284
-    /**
285
-     * @return bool
286
-     */
287
-    public function getPurge()
288
-    {
289
-        return $this->purge;
290
-    }
291
-
292
-
293
-
294
-    /**
295
-     * @param bool $purge
296
-     */
297
-    public function setPurge($purge)
298
-    {
299
-        $this->purge = filter_var($purge, FILTER_VALIDATE_BOOLEAN);
300
-    }
301
-
302
-
303
-
304
-    /**
305
-     * given a valid PersistentAdminNotice Collection,
306
-     * this notice will be added if it is not already found in the collection (using its name as the identifier)
307
-     * if an existing notice is found that has already been dismissed,
308
-     * but we are overriding with a forced update, then we will toggle its dismissed state,
309
-     * so that the notice is displayed again
310
-     *
311
-     * @param Collection $persistent_admin_notice_collection
312
-     * @throws InvalidEntityException
313
-     */
314
-    public function registerPersistentAdminNotice(Collection $persistent_admin_notice_collection)
315
-    {
316
-        if ($this->registered) {
317
-            return;
318
-        }
319
-        // first check if this notice has already been added to the collection
320
-        if ($persistent_admin_notice_collection->has($this->name)) {
321
-            /** @var PersistentAdminNotice $existing */
322
-            $existing = $persistent_admin_notice_collection->get($this->name);
323
-            // we don't need to add it again (we can't actually)
324
-            // but if it has already been dismissed, and we are overriding with a forced update
325
-            if ($existing->getDismissed() && $this->getForceUpdate()) {
326
-                // then toggle the notice's dismissed state to true
327
-                // so that it gets displayed again
328
-                $existing->setDismissed(false);
329
-                // and make sure the message is set
330
-                $existing->setMessage($this->message);
331
-            }
332
-        } else {
333
-            $persistent_admin_notice_collection->add($this, $this->name);
334
-        }
335
-        $this->registered = true;
336
-    }
337
-
338
-
339
-
340
-    /**
341
-     * @throws Exception
342
-     */
343
-    public function confirmRegistered()
344
-    {
345
-        if (! $this->registered && WP_DEBUG) {
346
-            throw new DomainException(
347
-                sprintf(
348
-                    esc_html__(
349
-                        'The "%1$s" PersistentAdminNotice was not successfully registered. Please ensure that it is being created prior to either the "admin_notices" or "network_admin_notices" hooks being triggered.',
350
-                        'event_espresso'
351
-                    ),
352
-                    $this->name
353
-                )
354
-            );
355
-        }
356
-    }
211
+	/**
212
+	 * @return string
213
+	 */
214
+	public function getCapContext()
215
+	{
216
+		return $this->cap_context;
217
+	}
218
+
219
+
220
+
221
+	/**
222
+	 * @param string $cap_context
223
+	 * @throws InvalidDataTypeException
224
+	 */
225
+	private function setCapContext($cap_context)
226
+	{
227
+		if (! is_string($cap_context)) {
228
+			throw new InvalidDataTypeException('$cap_context', $cap_context, 'string');
229
+		}
230
+		$this->cap_context = ! empty($cap_context) ? $cap_context : 'view persistent admin notice';
231
+	}
232
+
233
+
234
+
235
+	/**
236
+	 * @return bool
237
+	 */
238
+	public function getDismissed()
239
+	{
240
+		return $this->dismissed;
241
+	}
242
+
243
+
244
+
245
+	/**
246
+	 * @param bool $dismissed
247
+	 */
248
+	public function setDismissed($dismissed)
249
+	{
250
+		$this->dismissed = filter_var($dismissed, FILTER_VALIDATE_BOOLEAN);
251
+	}
252
+
253
+
254
+
255
+	/**
256
+	 * @return CapCheckInterface
257
+	 * @throws InvalidDataTypeException
258
+	 */
259
+	public function getCapCheck()
260
+	{
261
+		if (! $this->cap_check instanceof CapCheckInterface) {
262
+			$this->setCapCheck(
263
+				new CapCheck(
264
+					$this->capability,
265
+					$this->cap_context
266
+				)
267
+			);
268
+		}
269
+		return $this->cap_check;
270
+	}
271
+
272
+
273
+
274
+	/**
275
+	 * @param CapCheckInterface $cap_check
276
+	 */
277
+	private function setCapCheck(CapCheckInterface $cap_check)
278
+	{
279
+		$this->cap_check = $cap_check;
280
+	}
281
+
282
+
283
+
284
+	/**
285
+	 * @return bool
286
+	 */
287
+	public function getPurge()
288
+	{
289
+		return $this->purge;
290
+	}
291
+
292
+
293
+
294
+	/**
295
+	 * @param bool $purge
296
+	 */
297
+	public function setPurge($purge)
298
+	{
299
+		$this->purge = filter_var($purge, FILTER_VALIDATE_BOOLEAN);
300
+	}
301
+
302
+
303
+
304
+	/**
305
+	 * given a valid PersistentAdminNotice Collection,
306
+	 * this notice will be added if it is not already found in the collection (using its name as the identifier)
307
+	 * if an existing notice is found that has already been dismissed,
308
+	 * but we are overriding with a forced update, then we will toggle its dismissed state,
309
+	 * so that the notice is displayed again
310
+	 *
311
+	 * @param Collection $persistent_admin_notice_collection
312
+	 * @throws InvalidEntityException
313
+	 */
314
+	public function registerPersistentAdminNotice(Collection $persistent_admin_notice_collection)
315
+	{
316
+		if ($this->registered) {
317
+			return;
318
+		}
319
+		// first check if this notice has already been added to the collection
320
+		if ($persistent_admin_notice_collection->has($this->name)) {
321
+			/** @var PersistentAdminNotice $existing */
322
+			$existing = $persistent_admin_notice_collection->get($this->name);
323
+			// we don't need to add it again (we can't actually)
324
+			// but if it has already been dismissed, and we are overriding with a forced update
325
+			if ($existing->getDismissed() && $this->getForceUpdate()) {
326
+				// then toggle the notice's dismissed state to true
327
+				// so that it gets displayed again
328
+				$existing->setDismissed(false);
329
+				// and make sure the message is set
330
+				$existing->setMessage($this->message);
331
+			}
332
+		} else {
333
+			$persistent_admin_notice_collection->add($this, $this->name);
334
+		}
335
+		$this->registered = true;
336
+	}
337
+
338
+
339
+
340
+	/**
341
+	 * @throws Exception
342
+	 */
343
+	public function confirmRegistered()
344
+	{
345
+		if (! $this->registered && WP_DEBUG) {
346
+			throw new DomainException(
347
+				sprintf(
348
+					esc_html__(
349
+						'The "%1$s" PersistentAdminNotice was not successfully registered. Please ensure that it is being created prior to either the "admin_notices" or "network_admin_notices" hooks being triggered.',
350
+						'event_espresso'
351
+					),
352
+					$this->name
353
+				)
354
+			);
355
+		}
356
+	}
357 357
 
358 358
 
359 359
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     private function setName($name)
132 132
     {
133
-        if (! is_string($name)) {
133
+        if ( ! is_string($name)) {
134 134
             throw new InvalidDataTypeException('$name', $name, 'string');
135 135
         }
136 136
         $this->name = sanitize_key($name);
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      */
155 155
     private function setMessage($message)
156 156
     {
157
-        if (! is_string($message)) {
157
+        if ( ! is_string($message)) {
158 158
             throw new InvalidDataTypeException('$message', $message, 'string');
159 159
         }
160 160
         global $allowedtags;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      */
201 201
     private function setCapability($capability)
202 202
     {
203
-        if (! is_string($capability)) {
203
+        if ( ! is_string($capability)) {
204 204
             throw new InvalidDataTypeException('$capability', $capability, 'string');
205 205
         }
206 206
         $this->capability = ! empty($capability) ? $capability : 'manage_options';
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     private function setCapContext($cap_context)
226 226
     {
227
-        if (! is_string($cap_context)) {
227
+        if ( ! is_string($cap_context)) {
228 228
             throw new InvalidDataTypeException('$cap_context', $cap_context, 'string');
229 229
         }
230 230
         $this->cap_context = ! empty($cap_context) ? $cap_context : 'view persistent admin notice';
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function getCapCheck()
260 260
     {
261
-        if (! $this->cap_check instanceof CapCheckInterface) {
261
+        if ( ! $this->cap_check instanceof CapCheckInterface) {
262 262
             $this->setCapCheck(
263 263
                 new CapCheck(
264 264
                     $this->capability,
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
      */
343 343
     public function confirmRegistered()
344 344
     {
345
-        if (! $this->registered && WP_DEBUG) {
345
+        if ( ! $this->registered && WP_DEBUG) {
346 346
             throw new DomainException(
347 347
                 sprintf(
348 348
                     esc_html__(
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 2 patches
Indentation   +931 added lines, -931 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if (! defined('EVENT_ESPRESSO_VERSION')) {
3
-    exit('NO direct script access allowed');
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Event Espresso
@@ -16,35 +16,35 @@  discard block
 block discarded – undo
16 16
 
17 17
 
18 18
 if ( ! function_exists('espresso_get_template_part')) {
19
-    /**
20
-     * espresso_get_template_part
21
-     * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
22
-     * so not a very useful function at all except that it adds familiarity PLUS filtering based off of the entire template part name
23
-     *
24
-     * @param string $slug The slug name for the generic template.
25
-     * @param string $name The name of the specialised template.
26
-     * @return string        the html output for the formatted money value
27
-     */
28
-    function espresso_get_template_part($slug = null, $name = null)
29
-    {
30
-        EEH_Template::get_template_part($slug, $name);
31
-    }
19
+	/**
20
+	 * espresso_get_template_part
21
+	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
22
+	 * so not a very useful function at all except that it adds familiarity PLUS filtering based off of the entire template part name
23
+	 *
24
+	 * @param string $slug The slug name for the generic template.
25
+	 * @param string $name The name of the specialised template.
26
+	 * @return string        the html output for the formatted money value
27
+	 */
28
+	function espresso_get_template_part($slug = null, $name = null)
29
+	{
30
+		EEH_Template::get_template_part($slug, $name);
31
+	}
32 32
 }
33 33
 
34 34
 
35 35
 if ( ! function_exists('espresso_get_object_css_class')) {
36
-    /**
37
-     * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38
-     *
39
-     * @param EE_Base_Class $object the EE object the css class is being generated for
40
-     * @param  string       $prefix added to the beginning of the generated class
41
-     * @param  string       $suffix added to the end of the generated class
42
-     * @return string
43
-     */
44
-    function espresso_get_object_css_class($object = null, $prefix = '', $suffix = '')
45
-    {
46
-        return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47
-    }
36
+	/**
37
+	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38
+	 *
39
+	 * @param EE_Base_Class $object the EE object the css class is being generated for
40
+	 * @param  string       $prefix added to the beginning of the generated class
41
+	 * @param  string       $suffix added to the end of the generated class
42
+	 * @return string
43
+	 */
44
+	function espresso_get_object_css_class($object = null, $prefix = '', $suffix = '')
45
+	{
46
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47
+	}
48 48
 }
49 49
 
50 50
 
@@ -59,653 +59,653 @@  discard block
 block discarded – undo
59 59
 class EEH_Template
60 60
 {
61 61
 
62
-    private static $_espresso_themes = array();
63
-
64
-
65
-    /**
66
-     *    is_espresso_theme - returns TRUE or FALSE on whether the currently active WP theme is an espresso theme
67
-     *
68
-     * @return boolean
69
-     */
70
-    public static function is_espresso_theme()
71
-    {
72
-        return wp_get_theme()->get('TextDomain') == 'event_espresso' ? true : false;
73
-    }
74
-
75
-    /**
76
-     *    load_espresso_theme_functions - if current theme is an espresso theme, or uses ee theme template parts, then
77
-     *    load it's functions.php file ( if not already loaded )
78
-     *
79
-     * @return void
80
-     */
81
-    public static function load_espresso_theme_functions()
82
-    {
83
-        if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
84
-            if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php')) {
85
-                require_once(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php');
86
-            }
87
-        }
88
-    }
89
-
90
-
91
-    /**
92
-     *    get_espresso_themes - returns an array of Espresso Child themes located in the /templates/ directory
93
-     *
94
-     * @return array
95
-     */
96
-    public static function get_espresso_themes()
97
-    {
98
-        if (empty(EEH_Template::$_espresso_themes)) {
99
-            $espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
100
-            if (empty($espresso_themes)) {
101
-                return array();
102
-            }
103
-            if (($key = array_search('global_assets', $espresso_themes)) !== false) {
104
-                unset($espresso_themes[$key]);
105
-            }
106
-            EEH_Template::$_espresso_themes = array();
107
-            foreach ($espresso_themes as $espresso_theme) {
108
-                EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
109
-            }
110
-        }
111
-        return EEH_Template::$_espresso_themes;
112
-    }
113
-
114
-
115
-    /**
116
-     * EEH_Template::get_template_part
117
-     * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead,
118
-     * and doesn't add base versions of files so not a very useful function at all except that it adds familiarity PLUS
119
-     * filtering based off of the entire template part name
120
-     *
121
-     * @param string $slug The slug name for the generic template.
122
-     * @param string $name The name of the specialised template.
123
-     * @param array  $template_args
124
-     * @param bool   $return_string
125
-     * @return string        the html output for the formatted money value
126
-     */
127
-    public static function get_template_part(
128
-        $slug = null,
129
-        $name = null,
130
-        $template_args = array(),
131
-        $return_string = false
132
-    ) {
133
-        do_action("get_template_part_{$slug}-{$name}", $slug, $name);
134
-        $templates = array();
135
-        $name      = (string)$name;
136
-        if ($name != '') {
137
-            $templates[] = "{$slug}-{$name}.php";
138
-        }
139
-        // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
140
-        if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", true)) {
141
-            EEH_Template::locate_template($templates, $template_args, true, $return_string);
142
-        }
143
-    }
144
-
145
-
146
-    /**
147
-     *    locate_template
148
-     *    locate a template file by looking in the following places, in the following order:
149
-     *        <server path up to>/wp-content/themes/<current active WordPress theme>/
150
-     *        <assumed full absolute server path>
151
-     *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
152
-     *        <server path up to>/wp-content/uploads/espresso/templates/
153
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
154
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
155
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/
156
-     *    as soon as the template is found in one of these locations, it will be returned or loaded
157
-     *        Example:
158
-     *          You are using the WordPress Twenty Sixteen theme,
159
-     *        and you want to customize the "some-event.template.php" template,
160
-     *          which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
161
-     *          Assuming WP is installed on your server in the "/home/public_html/" folder,
162
-     *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
163
-     *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
164
-     *        /relative/path/to/some-event.template.php
165
-     *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
166
-     *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
167
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
168
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
169
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
170
-     *          Had you passed an absolute path to your template that was in some other location,
171
-     *        ie: "/absolute/path/to/some-event.template.php"
172
-     *          then the search would have been :
173
-     *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
174
-     *        /absolute/path/to/some-event.template.php
175
-     *          and stopped there upon finding it in the second location
176
-     *
177
-     * @param array|string $templates       array of template file names including extension (or just a single string)
178
-     * @param  array       $template_args   an array of arguments to be extracted for use in the template
179
-     * @param  boolean     $load            whether to pass the located template path on to the
180
-     *                                      EEH_Template::display_template() method or simply return it
181
-     * @param  boolean     $return_string   whether to send output immediately to screen, or capture and return as a
182
-     *                                      string
183
-     * @param boolean      $check_if_custom If TRUE, this flags this method to return boolean for whether this will
184
-     *                                      generate a custom template or not. Used in places where you don't actually
185
-     *                                      load the template, you just want to know if there's a custom version of it.
186
-     * @return mixed
187
-     */
188
-    public static function locate_template(
189
-        $templates = array(),
190
-        $template_args = array(),
191
-        $load = true,
192
-        $return_string = true,
193
-        $check_if_custom = false
194
-    ) {
195
-        // first use WP locate_template to check for template in the current theme folder
196
-        $template_path = locate_template($templates);
197
-
198
-        if ($check_if_custom && ! empty($template_path)) {
199
-            return true;
200
-        }
201
-
202
-        // not in the theme
203
-        if (empty($template_path)) {
204
-            // not even a template to look for ?
205
-            if (empty($templates)) {
206
-                // get post_type
207
-                $post_type = EE_Registry::instance()->REQ->get('post_type');
208
-                // get array of EE Custom Post Types
209
-                $EE_CPTs = EE_Register_CPTs::get_CPTs();
210
-                // build template name based on request
211
-                if (isset($EE_CPTs[$post_type])) {
212
-                    $archive_or_single = is_archive() ? 'archive' : '';
213
-                    $archive_or_single = is_single() ? 'single' : $archive_or_single;
214
-                    $templates         = $archive_or_single . '-' . $post_type . '.php';
215
-                }
216
-            }
217
-            // currently active EE template theme
218
-            $current_theme = EE_Config::get_current_theme();
219
-
220
-            // array of paths to folders that may contain templates
221
-            $template_folder_paths = array(
222
-                // first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
223
-                EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
224
-                // then in the root of the /wp-content/uploads/espresso/templates/ folder
225
-                EVENT_ESPRESSO_TEMPLATE_DIR,
226
-            );
227
-
228
-            //add core plugin folders for checking only if we're not $check_if_custom
229
-            if ( ! $check_if_custom) {
230
-                $core_paths            = array(
231
-                    // in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
232
-                    EE_PUBLIC . $current_theme,
233
-                    // in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
234
-                    EE_TEMPLATES . $current_theme,
235
-                    // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
236
-                    EE_PLUGIN_DIR_PATH,
237
-                );
238
-                $template_folder_paths = array_merge($template_folder_paths, $core_paths);
239
-            }
240
-
241
-            // now filter that array
242
-            $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths',
243
-                $template_folder_paths);
244
-            $templates             = is_array($templates) ? $templates : array($templates);
245
-            $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
246
-            // array to hold all possible template paths
247
-            $full_template_paths = array();
248
-
249
-            // loop through $templates
250
-            foreach ($templates as $template) {
251
-                // normalize directory separators
252
-                $template                      = EEH_File::standardise_directory_separators($template);
253
-                $file_name                     = basename($template);
254
-                $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
255
-                // while looping through all template folder paths
256
-                foreach ($template_folder_paths as $template_folder_path) {
257
-                    // normalize directory separators
258
-                    $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
259
-                    // determine if any common base path exists between the two paths
260
-                    $common_base_path = EEH_Template::_find_common_base_path(
261
-                        array($template_folder_path, $template_path_minus_file_name)
262
-                    );
263
-                    if ($common_base_path !== '') {
264
-                        // both paths have a common base, so just tack the filename onto our search path
265
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
266
-                    } else {
267
-                        // no common base path, so let's just concatenate
268
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
269
-                    }
270
-                    // build up our template locations array by adding our resolved paths
271
-                    $full_template_paths[] = $resolved_path;
272
-                }
273
-                // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
274
-                array_unshift($full_template_paths, $template);
275
-                // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
276
-                array_unshift($full_template_paths, get_stylesheet_directory() . DS . $file_name);
277
-            }
278
-            // filter final array of full template paths
279
-            $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths',
280
-                $full_template_paths, $file_name);
281
-            // now loop through our final array of template location paths and check each location
282
-            foreach ((array)$full_template_paths as $full_template_path) {
283
-                if (is_readable($full_template_path)) {
284
-                    $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
285
-                    break;
286
-                }
287
-            }
288
-        }
289
-
290
-        // hook that can be used to display the full template path that will be used
291
-        do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
292
-
293
-        // if we got it and you want to see it...
294
-        if ($template_path && $load && ! $check_if_custom) {
295
-            if ($return_string) {
296
-                return EEH_Template::display_template($template_path, $template_args, true);
297
-            } else {
298
-                EEH_Template::display_template($template_path, $template_args, false);
299
-            }
300
-        }
301
-        return $check_if_custom && ! empty($template_path) ? true : $template_path;
302
-    }
303
-
304
-
305
-    /**
306
-     * _find_common_base_path
307
-     * given two paths, this determines if there is a common base path between the two
308
-     *
309
-     * @param array $paths
310
-     * @return string
311
-     */
312
-    protected static function _find_common_base_path($paths)
313
-    {
314
-        $last_offset      = 0;
315
-        $common_base_path = '';
316
-        while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
317
-            $dir_length = $index - $last_offset + 1;
318
-            $directory  = substr($paths[0], $last_offset, $dir_length);
319
-            foreach ($paths as $path) {
320
-                if (substr($path, $last_offset, $dir_length) != $directory) {
321
-                    return $common_base_path;
322
-                }
323
-            }
324
-            $common_base_path .= $directory;
325
-            $last_offset = $index + 1;
326
-        }
327
-        return substr($common_base_path, 0, -1);
328
-    }
329
-
330
-
331
-    /**
332
-     * load and display a template
333
-     *
334
-     * @param bool|string $template_path server path to the file to be loaded, including file name and extension
335
-     * @param  array      $template_args an array of arguments to be extracted for use in the template
336
-     * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
337
-     * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
338
-     *                                      not found or is not readable
339
-     * @return mixed string
340
-     * @throws \DomainException
341
-     */
62
+	private static $_espresso_themes = array();
63
+
64
+
65
+	/**
66
+	 *    is_espresso_theme - returns TRUE or FALSE on whether the currently active WP theme is an espresso theme
67
+	 *
68
+	 * @return boolean
69
+	 */
70
+	public static function is_espresso_theme()
71
+	{
72
+		return wp_get_theme()->get('TextDomain') == 'event_espresso' ? true : false;
73
+	}
74
+
75
+	/**
76
+	 *    load_espresso_theme_functions - if current theme is an espresso theme, or uses ee theme template parts, then
77
+	 *    load it's functions.php file ( if not already loaded )
78
+	 *
79
+	 * @return void
80
+	 */
81
+	public static function load_espresso_theme_functions()
82
+	{
83
+		if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
84
+			if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php')) {
85
+				require_once(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php');
86
+			}
87
+		}
88
+	}
89
+
90
+
91
+	/**
92
+	 *    get_espresso_themes - returns an array of Espresso Child themes located in the /templates/ directory
93
+	 *
94
+	 * @return array
95
+	 */
96
+	public static function get_espresso_themes()
97
+	{
98
+		if (empty(EEH_Template::$_espresso_themes)) {
99
+			$espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
100
+			if (empty($espresso_themes)) {
101
+				return array();
102
+			}
103
+			if (($key = array_search('global_assets', $espresso_themes)) !== false) {
104
+				unset($espresso_themes[$key]);
105
+			}
106
+			EEH_Template::$_espresso_themes = array();
107
+			foreach ($espresso_themes as $espresso_theme) {
108
+				EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
109
+			}
110
+		}
111
+		return EEH_Template::$_espresso_themes;
112
+	}
113
+
114
+
115
+	/**
116
+	 * EEH_Template::get_template_part
117
+	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead,
118
+	 * and doesn't add base versions of files so not a very useful function at all except that it adds familiarity PLUS
119
+	 * filtering based off of the entire template part name
120
+	 *
121
+	 * @param string $slug The slug name for the generic template.
122
+	 * @param string $name The name of the specialised template.
123
+	 * @param array  $template_args
124
+	 * @param bool   $return_string
125
+	 * @return string        the html output for the formatted money value
126
+	 */
127
+	public static function get_template_part(
128
+		$slug = null,
129
+		$name = null,
130
+		$template_args = array(),
131
+		$return_string = false
132
+	) {
133
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
134
+		$templates = array();
135
+		$name      = (string)$name;
136
+		if ($name != '') {
137
+			$templates[] = "{$slug}-{$name}.php";
138
+		}
139
+		// allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
140
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", true)) {
141
+			EEH_Template::locate_template($templates, $template_args, true, $return_string);
142
+		}
143
+	}
144
+
145
+
146
+	/**
147
+	 *    locate_template
148
+	 *    locate a template file by looking in the following places, in the following order:
149
+	 *        <server path up to>/wp-content/themes/<current active WordPress theme>/
150
+	 *        <assumed full absolute server path>
151
+	 *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
152
+	 *        <server path up to>/wp-content/uploads/espresso/templates/
153
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
154
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
155
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/
156
+	 *    as soon as the template is found in one of these locations, it will be returned or loaded
157
+	 *        Example:
158
+	 *          You are using the WordPress Twenty Sixteen theme,
159
+	 *        and you want to customize the "some-event.template.php" template,
160
+	 *          which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
161
+	 *          Assuming WP is installed on your server in the "/home/public_html/" folder,
162
+	 *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
163
+	 *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
164
+	 *        /relative/path/to/some-event.template.php
165
+	 *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
166
+	 *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
167
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
168
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
169
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
170
+	 *          Had you passed an absolute path to your template that was in some other location,
171
+	 *        ie: "/absolute/path/to/some-event.template.php"
172
+	 *          then the search would have been :
173
+	 *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
174
+	 *        /absolute/path/to/some-event.template.php
175
+	 *          and stopped there upon finding it in the second location
176
+	 *
177
+	 * @param array|string $templates       array of template file names including extension (or just a single string)
178
+	 * @param  array       $template_args   an array of arguments to be extracted for use in the template
179
+	 * @param  boolean     $load            whether to pass the located template path on to the
180
+	 *                                      EEH_Template::display_template() method or simply return it
181
+	 * @param  boolean     $return_string   whether to send output immediately to screen, or capture and return as a
182
+	 *                                      string
183
+	 * @param boolean      $check_if_custom If TRUE, this flags this method to return boolean for whether this will
184
+	 *                                      generate a custom template or not. Used in places where you don't actually
185
+	 *                                      load the template, you just want to know if there's a custom version of it.
186
+	 * @return mixed
187
+	 */
188
+	public static function locate_template(
189
+		$templates = array(),
190
+		$template_args = array(),
191
+		$load = true,
192
+		$return_string = true,
193
+		$check_if_custom = false
194
+	) {
195
+		// first use WP locate_template to check for template in the current theme folder
196
+		$template_path = locate_template($templates);
197
+
198
+		if ($check_if_custom && ! empty($template_path)) {
199
+			return true;
200
+		}
201
+
202
+		// not in the theme
203
+		if (empty($template_path)) {
204
+			// not even a template to look for ?
205
+			if (empty($templates)) {
206
+				// get post_type
207
+				$post_type = EE_Registry::instance()->REQ->get('post_type');
208
+				// get array of EE Custom Post Types
209
+				$EE_CPTs = EE_Register_CPTs::get_CPTs();
210
+				// build template name based on request
211
+				if (isset($EE_CPTs[$post_type])) {
212
+					$archive_or_single = is_archive() ? 'archive' : '';
213
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
214
+					$templates         = $archive_or_single . '-' . $post_type . '.php';
215
+				}
216
+			}
217
+			// currently active EE template theme
218
+			$current_theme = EE_Config::get_current_theme();
219
+
220
+			// array of paths to folders that may contain templates
221
+			$template_folder_paths = array(
222
+				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
223
+				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
224
+				// then in the root of the /wp-content/uploads/espresso/templates/ folder
225
+				EVENT_ESPRESSO_TEMPLATE_DIR,
226
+			);
227
+
228
+			//add core plugin folders for checking only if we're not $check_if_custom
229
+			if ( ! $check_if_custom) {
230
+				$core_paths            = array(
231
+					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
232
+					EE_PUBLIC . $current_theme,
233
+					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
234
+					EE_TEMPLATES . $current_theme,
235
+					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
236
+					EE_PLUGIN_DIR_PATH,
237
+				);
238
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
239
+			}
240
+
241
+			// now filter that array
242
+			$template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths',
243
+				$template_folder_paths);
244
+			$templates             = is_array($templates) ? $templates : array($templates);
245
+			$template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
246
+			// array to hold all possible template paths
247
+			$full_template_paths = array();
248
+
249
+			// loop through $templates
250
+			foreach ($templates as $template) {
251
+				// normalize directory separators
252
+				$template                      = EEH_File::standardise_directory_separators($template);
253
+				$file_name                     = basename($template);
254
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
255
+				// while looping through all template folder paths
256
+				foreach ($template_folder_paths as $template_folder_path) {
257
+					// normalize directory separators
258
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
259
+					// determine if any common base path exists between the two paths
260
+					$common_base_path = EEH_Template::_find_common_base_path(
261
+						array($template_folder_path, $template_path_minus_file_name)
262
+					);
263
+					if ($common_base_path !== '') {
264
+						// both paths have a common base, so just tack the filename onto our search path
265
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
266
+					} else {
267
+						// no common base path, so let's just concatenate
268
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
269
+					}
270
+					// build up our template locations array by adding our resolved paths
271
+					$full_template_paths[] = $resolved_path;
272
+				}
273
+				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
274
+				array_unshift($full_template_paths, $template);
275
+				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
276
+				array_unshift($full_template_paths, get_stylesheet_directory() . DS . $file_name);
277
+			}
278
+			// filter final array of full template paths
279
+			$full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths',
280
+				$full_template_paths, $file_name);
281
+			// now loop through our final array of template location paths and check each location
282
+			foreach ((array)$full_template_paths as $full_template_path) {
283
+				if (is_readable($full_template_path)) {
284
+					$template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
285
+					break;
286
+				}
287
+			}
288
+		}
289
+
290
+		// hook that can be used to display the full template path that will be used
291
+		do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
292
+
293
+		// if we got it and you want to see it...
294
+		if ($template_path && $load && ! $check_if_custom) {
295
+			if ($return_string) {
296
+				return EEH_Template::display_template($template_path, $template_args, true);
297
+			} else {
298
+				EEH_Template::display_template($template_path, $template_args, false);
299
+			}
300
+		}
301
+		return $check_if_custom && ! empty($template_path) ? true : $template_path;
302
+	}
303
+
304
+
305
+	/**
306
+	 * _find_common_base_path
307
+	 * given two paths, this determines if there is a common base path between the two
308
+	 *
309
+	 * @param array $paths
310
+	 * @return string
311
+	 */
312
+	protected static function _find_common_base_path($paths)
313
+	{
314
+		$last_offset      = 0;
315
+		$common_base_path = '';
316
+		while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
317
+			$dir_length = $index - $last_offset + 1;
318
+			$directory  = substr($paths[0], $last_offset, $dir_length);
319
+			foreach ($paths as $path) {
320
+				if (substr($path, $last_offset, $dir_length) != $directory) {
321
+					return $common_base_path;
322
+				}
323
+			}
324
+			$common_base_path .= $directory;
325
+			$last_offset = $index + 1;
326
+		}
327
+		return substr($common_base_path, 0, -1);
328
+	}
329
+
330
+
331
+	/**
332
+	 * load and display a template
333
+	 *
334
+	 * @param bool|string $template_path server path to the file to be loaded, including file name and extension
335
+	 * @param  array      $template_args an array of arguments to be extracted for use in the template
336
+	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
337
+	 * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
338
+	 *                                      not found or is not readable
339
+	 * @return mixed string
340
+	 * @throws \DomainException
341
+	 */
342 342
 	public static function display_template(
343
-        $template_path    = false,
344
-        $template_args    = array(),
345
-        $return_string    = false,
346
-        $throw_exceptions = false
347
-    ) {
348
-
349
-        /**
350
-         * These two filters are intended for last minute changes to templates being loaded and/or template arg
351
-         * modifications.  NOTE... modifying these things can cause breakage as most templates running through
352
-         * the display_template method are templates we DON'T want modified (usually because of js
353
-         * dependencies etc).  So unless you know what you are doing, do NOT filter templates or template args
354
-         * using this.
355
-         *
356
-         * @since 4.6.0
357
-         */
358
-        $template_path = (string) apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
359
-        $template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
360
-
361
-        // you gimme nuttin - YOU GET NUTTIN !!
362
-        if ( ! $template_path || ! is_readable($template_path)) {
363
-            return '';
364
-        }
365
-        // if $template_args are not in an array, then make it so
366
-        if ( ! is_array($template_args) && ! is_object($template_args)) {
367
-            $template_args = array($template_args);
368
-        }
369
-        extract( $template_args, EXTR_SKIP );
370
-        // ignore whether template is accessible ?
371
-        if ( $throw_exceptions && ! is_readable( $template_path ) ) {
372
-            throw new \DomainException(
373
-                    esc_html__(
374
-                            'Invalid, unreadable, or missing file.',
375
-                            'event_espresso'
376
-                    )
377
-            );
378
-        }
379
-
380
-
381
-        if ($return_string) {
382
-            // because we want to return a string, we are going to capture the output
383
-            ob_start();
384
-            include($template_path);
385
-            return ob_get_clean();
386
-        } else {
387
-            include($template_path);
388
-        }
389
-        return '';
390
-    }
391
-
392
-
393
-    /**
394
-     * get_object_css_class - attempts to generate a css class based on the type of EE object passed
395
-     *
396
-     * @param EE_Base_Class $object the EE object the css class is being generated for
397
-     * @param  string       $prefix added to the beginning of the generated class
398
-     * @param  string       $suffix added to the end of the generated class
399
-     * @return string
400
-     */
401
-    public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
402
-    {
403
-        // in the beginning...
404
-        $prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
405
-        // da muddle
406
-        $class = '';
407
-        // the end
408
-        $suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
409
-        // is the passed object an EE object ?
410
-        if ($object instanceof EE_Base_Class) {
411
-            // grab the exact type of object
412
-            $obj_class = get_class($object);
413
-            // depending on the type of object...
414
-            switch ($obj_class) {
415
-                // no specifics just yet...
416
-                default :
417
-                    $class = strtolower(str_replace('_', '-', $obj_class));
418
-                    $class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
419
-
420
-            }
421
-        }
343
+		$template_path    = false,
344
+		$template_args    = array(),
345
+		$return_string    = false,
346
+		$throw_exceptions = false
347
+	) {
348
+
349
+		/**
350
+		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
351
+		 * modifications.  NOTE... modifying these things can cause breakage as most templates running through
352
+		 * the display_template method are templates we DON'T want modified (usually because of js
353
+		 * dependencies etc).  So unless you know what you are doing, do NOT filter templates or template args
354
+		 * using this.
355
+		 *
356
+		 * @since 4.6.0
357
+		 */
358
+		$template_path = (string) apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
359
+		$template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
360
+
361
+		// you gimme nuttin - YOU GET NUTTIN !!
362
+		if ( ! $template_path || ! is_readable($template_path)) {
363
+			return '';
364
+		}
365
+		// if $template_args are not in an array, then make it so
366
+		if ( ! is_array($template_args) && ! is_object($template_args)) {
367
+			$template_args = array($template_args);
368
+		}
369
+		extract( $template_args, EXTR_SKIP );
370
+		// ignore whether template is accessible ?
371
+		if ( $throw_exceptions && ! is_readable( $template_path ) ) {
372
+			throw new \DomainException(
373
+					esc_html__(
374
+							'Invalid, unreadable, or missing file.',
375
+							'event_espresso'
376
+					)
377
+			);
378
+		}
379
+
380
+
381
+		if ($return_string) {
382
+			// because we want to return a string, we are going to capture the output
383
+			ob_start();
384
+			include($template_path);
385
+			return ob_get_clean();
386
+		} else {
387
+			include($template_path);
388
+		}
389
+		return '';
390
+	}
391
+
392
+
393
+	/**
394
+	 * get_object_css_class - attempts to generate a css class based on the type of EE object passed
395
+	 *
396
+	 * @param EE_Base_Class $object the EE object the css class is being generated for
397
+	 * @param  string       $prefix added to the beginning of the generated class
398
+	 * @param  string       $suffix added to the end of the generated class
399
+	 * @return string
400
+	 */
401
+	public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
402
+	{
403
+		// in the beginning...
404
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
405
+		// da muddle
406
+		$class = '';
407
+		// the end
408
+		$suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
409
+		// is the passed object an EE object ?
410
+		if ($object instanceof EE_Base_Class) {
411
+			// grab the exact type of object
412
+			$obj_class = get_class($object);
413
+			// depending on the type of object...
414
+			switch ($obj_class) {
415
+				// no specifics just yet...
416
+				default :
417
+					$class = strtolower(str_replace('_', '-', $obj_class));
418
+					$class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
419
+
420
+			}
421
+		}
422 422
         
423
-        $class_string = $prefix . $class . $suffix;
423
+		$class_string = $prefix . $class . $suffix;
424 424
         
425
-        return apply_filters('FHEE__EEH_Template__get_object_css_class__class_string', $class_string, $object, $prefix, $suffix);
426
-    }
427
-
428
-
429
-
430
-    /**
431
-     * EEH_Template::format_currency
432
-     * This helper takes a raw float value and formats it according to the default config country currency settings, or
433
-     * the country currency settings from the supplied country ISO code
434
-     *
435
-     * @param  float   $amount       raw money value
436
-     * @param  boolean $return_raw   whether to return the formatted float value only with no currency sign or code
437
-     * @param  boolean $display_code whether to display the country code (USD). Default = TRUE
438
-     * @param string   $CNT_ISO      2 letter ISO code for a country
439
-     * @param string   $cur_code_span_class
440
-     * @return string        the html output for the formatted money value
441
-     * @throws \EE_Error
442
-     */
443
-    public static function format_currency(
444
-        $amount = null,
445
-        $return_raw = false,
446
-        $display_code = true,
447
-        $CNT_ISO = '',
448
-        $cur_code_span_class = 'currency-code'
449
-    ) {
450
-        // ensure amount was received
451
-        if ($amount === null) {
452
-            $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
453
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
454
-            return '';
455
-        }
456
-        //ensure amount is float
457
-        $amount  = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float)$amount);
458
-        $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
459
-        // filter raw amount (allows 0.00 to be changed to "free" for example)
460
-        $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
461
-        // still a number or was amount converted to a string like "free" ?
462
-        if (is_float($amount_formatted)) {
463
-            // was a country ISO code passed ? if so generate currency config object for that country
464
-            $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
465
-            // verify results
466
-            if ( ! $mny instanceof EE_Currency_Config) {
467
-                // set default config country currency settings
468
-                $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
469
-                    ? EE_Registry::instance()->CFG->currency
470
-                    : new EE_Currency_Config();
471
-            }
472
-            // format float
473
-            $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
474
-            // add formatting ?
475
-            if ( ! $return_raw) {
476
-                // add currency sign
477
-                if ($mny->sign_b4) {
478
-                    if ($amount >= 0) {
479
-                        $amount_formatted = $mny->sign . $amount_formatted;
480
-                    } else {
481
-                        $amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
482
-                    }
483
-
484
-                } else {
485
-                    $amount_formatted = $amount_formatted . $mny->sign;
486
-                }
487
-
488
-                // filter to allow global setting of display_code
489
-                $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code);
490
-
491
-                // add currency code ?
492
-                $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
493
-            }
494
-            // filter results
495
-            $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted',
496
-                $amount_formatted, $mny, $return_raw);
497
-        }
498
-        // clean up vars
499
-        unset($mny);
500
-        // return formatted currency amount
501
-        return $amount_formatted;
502
-    }
503
-
504
-
505
-    /**
506
-     * This function is used for outputting the localized label for a given status id in the schema requested (and
507
-     * possibly plural).  The intended use of this function is only for cases where wanting a label outside of a
508
-     * related status model or model object (i.e. in documentation etc.)
509
-     *
510
-     * @param  string  $status_id Status ID matching a registered status in the esp_status table.  If there is no
511
-     *                            match, then 'Unknown' will be returned.
512
-     * @param  boolean $plural    Whether to return plural or not
513
-     * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
514
-     * @return string             The localized label for the status id.
515
-     */
516
-    public static function pretty_status($status_id, $plural = false, $schema = 'upper')
517
-    {
518
-        /** @type EEM_Status $EEM_Status */
519
-        $EEM_Status = EE_Registry::instance()->load_model('Status');
520
-        $status     = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural,
521
-            $schema);
522
-        return $status[$status_id];
523
-    }
524
-
525
-
526
-    /**
527
-     * This helper just returns a button or link for the given parameters
528
-     *
529
-     * @param  string $url   the url for the link, note that `esc_url` will be called on it
530
-     * @param  string $label What is the label you want displayed for the button
531
-     * @param  string $class what class is used for the button (defaults to 'button-primary')
532
-     * @param string  $icon
533
-     * @param string  $title
534
-     * @return string the html output for the button
535
-     */
536
-    public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '')
537
-    {
538
-        $icon_html = '';
539
-        if ( ! empty($icon)) {
540
-            $dashicons = preg_split("(ee-icon |dashicons )", $icon);
541
-            $dashicons = array_filter($dashicons);
542
-            $count     = count($dashicons);
543
-            $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
544
-            foreach ($dashicons as $dashicon) {
545
-                $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
546
-                $icon_html .= '<span class="' . $type . $dashicon . '"></span>';
547
-            }
548
-            $icon_html .= $count > 1 ? '</span>' : '';
549
-        }
550
-        $label  = ! empty($icon) ? $icon_html . $label : $label;
551
-        $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . esc_url($url) . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>';
552
-        return $button;
553
-    }
554
-
555
-
556
-    /**
557
-     * This returns a generated link that will load the related help tab on admin pages.
558
-     *
559
-     * @param  string     $help_tab_id the id for the connected help tab
560
-     * @param bool|string $page        The page identifier for the page the help tab is on
561
-     * @param bool|string $action      The action (route) for the admin page the help tab is on.
562
-     * @param bool|string $icon_style  (optional) include css class for the style you want to use for the help icon.
563
-     * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
564
-     * @return string              generated link
565
-     */
566
-    public static function get_help_tab_link(
567
-        $help_tab_id,
568
-        $page = false,
569
-        $action = false,
570
-        $icon_style = false,
571
-        $help_text = false
572
-    ) {
573
-
574
-        if ( ! $page) {
575
-            $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
576
-        }
577
-
578
-        if ( ! $action) {
579
-            $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
580
-        }
581
-
582
-        $action = empty($action) ? 'default' : $action;
583
-
584
-
585
-        $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
586
-        $icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
587
-        $help_text    = ! $help_text ? '' : $help_text;
588
-        return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.',
589
-                'event_espresso') . '" > ' . $help_text . ' </a>';
590
-    }
591
-
592
-
593
-    /**
594
-     * This helper generates the html structure for the jquery joyride plugin with the given params.
595
-     *
596
-     * @link http://zurb.com/playground/jquery-joyride-feature-tour-plugin
597
-     * @see  EE_Admin_Page->_stop_callback() for the construct expected for the $stops param.
598
-     * @param EE_Help_Tour
599
-     * @return string         html
600
-     */
601
-    public static function help_tour_stops_generator(EE_Help_Tour $tour)
602
-    {
603
-        $id    = $tour->get_slug();
604
-        $stops = $tour->get_stops();
605
-
606
-        $content = '<ol style="display:none" id="' . $id . '">';
607
-
608
-        foreach ($stops as $stop) {
609
-            $data_id    = ! empty($stop['id']) ? ' data-id="' . $stop['id'] . '"' : '';
610
-            $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="' . $stop['class'] . '"' : '';
611
-
612
-            //if container is set to modal then let's make sure we set the options accordingly
613
-            if (empty($data_id) && empty($data_class)) {
614
-                $stop['options']['modal']  = true;
615
-                $stop['options']['expose'] = true;
616
-            }
617
-
618
-            $custom_class  = ! empty($stop['custom_class']) ? ' class="' . $stop['custom_class'] . '"' : '';
619
-            $button_text   = ! empty($stop['button_text']) ? ' data-button="' . $stop['button_text'] . '"' : '';
620
-            $inner_content = isset($stop['content']) ? $stop['content'] : '';
621
-
622
-            //options
623
-            if (isset($stop['options']) && is_array($stop['options'])) {
624
-                $options = ' data-options="';
625
-                foreach ($stop['options'] as $option => $value) {
626
-                    $options .= $option . ':' . $value . ';';
627
-                }
628
-                $options .= '"';
629
-            } else {
630
-                $options = '';
631
-            }
632
-
633
-            //let's put all together
634
-            $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
635
-        }
636
-
637
-        $content .= '</ol>';
638
-        return $content;
639
-    }
640
-
641
-
642
-    /**
643
-     * This is a helper method to generate a status legend for a given status array.
644
-     * Note this will only work if the incoming statuses have a key in the EEM_Status->localized_status() methods
645
-     * status_array.
646
-     *
647
-     * @param  array  $status_array  array of statuses that will make up the legend. In format:
648
-     *                               array(
649
-     *                               'status_item' => 'status_name'
650
-     *                               )
651
-     * @param  string $active_status This is used to indicate what the active status is IF that is to be highlighted in
652
-     *                               the legend.
653
-     * @throws EE_Error
654
-     * @return string               html structure for status.
655
-     */
656
-    public static function status_legend($status_array, $active_status = '')
657
-    {
658
-        if ( ! is_array($status_array)) {
659
-            throw new EE_Error(esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
660
-                'event_espresso'));
661
-        }
662
-
663
-        $setup_array = array();
664
-        foreach ($status_array as $item => $status) {
665
-            $setup_array[$item] = array(
666
-                'class'  => 'ee-status-legend ee-status-legend-' . $status,
667
-                'desc'   => EEH_Template::pretty_status($status, false, 'sentence'),
668
-                'status' => $status,
669
-            );
670
-        }
671
-
672
-        $content = '<div class="ee-list-table-legend-container">' . "\n";
673
-        $content .= '<h4 class="status-legend-title">' . esc_html__('Status Legend', 'event_espresso') . '</h4>' . "\n";
674
-        $content .= '<dl class="ee-list-table-legend">' . "\n\t";
675
-        foreach ($setup_array as $item => $details) {
676
-            $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
677
-            $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
678
-            $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
679
-            $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
680
-            $content .= '</dt>' . "\n";
681
-        }
682
-        $content .= '</dl>' . "\n";
683
-        $content .= '</div>' . "\n";
684
-        return $content;
685
-    }
686
-
687
-
688
-    /**
689
-     * Gets HTML for laying out a deeply-nested array (and objects) in a format
690
-     * that's nice for presenting in the wp admin
691
-     *
692
-     * @param mixed $data
693
-     * @return string
694
-     */
695
-    public static function layout_array_as_table($data)
696
-    {
697
-        if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
698
-            $data = (array)$data;
699
-        }
700
-        ob_start();
701
-        if (is_array($data)) {
702
-            if (EEH_Array::is_associative_array($data)) {
703
-                ?>
425
+		return apply_filters('FHEE__EEH_Template__get_object_css_class__class_string', $class_string, $object, $prefix, $suffix);
426
+	}
427
+
428
+
429
+
430
+	/**
431
+	 * EEH_Template::format_currency
432
+	 * This helper takes a raw float value and formats it according to the default config country currency settings, or
433
+	 * the country currency settings from the supplied country ISO code
434
+	 *
435
+	 * @param  float   $amount       raw money value
436
+	 * @param  boolean $return_raw   whether to return the formatted float value only with no currency sign or code
437
+	 * @param  boolean $display_code whether to display the country code (USD). Default = TRUE
438
+	 * @param string   $CNT_ISO      2 letter ISO code for a country
439
+	 * @param string   $cur_code_span_class
440
+	 * @return string        the html output for the formatted money value
441
+	 * @throws \EE_Error
442
+	 */
443
+	public static function format_currency(
444
+		$amount = null,
445
+		$return_raw = false,
446
+		$display_code = true,
447
+		$CNT_ISO = '',
448
+		$cur_code_span_class = 'currency-code'
449
+	) {
450
+		// ensure amount was received
451
+		if ($amount === null) {
452
+			$msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
453
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
454
+			return '';
455
+		}
456
+		//ensure amount is float
457
+		$amount  = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float)$amount);
458
+		$CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
459
+		// filter raw amount (allows 0.00 to be changed to "free" for example)
460
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
461
+		// still a number or was amount converted to a string like "free" ?
462
+		if (is_float($amount_formatted)) {
463
+			// was a country ISO code passed ? if so generate currency config object for that country
464
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
465
+			// verify results
466
+			if ( ! $mny instanceof EE_Currency_Config) {
467
+				// set default config country currency settings
468
+				$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
469
+					? EE_Registry::instance()->CFG->currency
470
+					: new EE_Currency_Config();
471
+			}
472
+			// format float
473
+			$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
474
+			// add formatting ?
475
+			if ( ! $return_raw) {
476
+				// add currency sign
477
+				if ($mny->sign_b4) {
478
+					if ($amount >= 0) {
479
+						$amount_formatted = $mny->sign . $amount_formatted;
480
+					} else {
481
+						$amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
482
+					}
483
+
484
+				} else {
485
+					$amount_formatted = $amount_formatted . $mny->sign;
486
+				}
487
+
488
+				// filter to allow global setting of display_code
489
+				$display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code);
490
+
491
+				// add currency code ?
492
+				$amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
493
+			}
494
+			// filter results
495
+			$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted',
496
+				$amount_formatted, $mny, $return_raw);
497
+		}
498
+		// clean up vars
499
+		unset($mny);
500
+		// return formatted currency amount
501
+		return $amount_formatted;
502
+	}
503
+
504
+
505
+	/**
506
+	 * This function is used for outputting the localized label for a given status id in the schema requested (and
507
+	 * possibly plural).  The intended use of this function is only for cases where wanting a label outside of a
508
+	 * related status model or model object (i.e. in documentation etc.)
509
+	 *
510
+	 * @param  string  $status_id Status ID matching a registered status in the esp_status table.  If there is no
511
+	 *                            match, then 'Unknown' will be returned.
512
+	 * @param  boolean $plural    Whether to return plural or not
513
+	 * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
514
+	 * @return string             The localized label for the status id.
515
+	 */
516
+	public static function pretty_status($status_id, $plural = false, $schema = 'upper')
517
+	{
518
+		/** @type EEM_Status $EEM_Status */
519
+		$EEM_Status = EE_Registry::instance()->load_model('Status');
520
+		$status     = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural,
521
+			$schema);
522
+		return $status[$status_id];
523
+	}
524
+
525
+
526
+	/**
527
+	 * This helper just returns a button or link for the given parameters
528
+	 *
529
+	 * @param  string $url   the url for the link, note that `esc_url` will be called on it
530
+	 * @param  string $label What is the label you want displayed for the button
531
+	 * @param  string $class what class is used for the button (defaults to 'button-primary')
532
+	 * @param string  $icon
533
+	 * @param string  $title
534
+	 * @return string the html output for the button
535
+	 */
536
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '')
537
+	{
538
+		$icon_html = '';
539
+		if ( ! empty($icon)) {
540
+			$dashicons = preg_split("(ee-icon |dashicons )", $icon);
541
+			$dashicons = array_filter($dashicons);
542
+			$count     = count($dashicons);
543
+			$icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
544
+			foreach ($dashicons as $dashicon) {
545
+				$type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
546
+				$icon_html .= '<span class="' . $type . $dashicon . '"></span>';
547
+			}
548
+			$icon_html .= $count > 1 ? '</span>' : '';
549
+		}
550
+		$label  = ! empty($icon) ? $icon_html . $label : $label;
551
+		$button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . esc_url($url) . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>';
552
+		return $button;
553
+	}
554
+
555
+
556
+	/**
557
+	 * This returns a generated link that will load the related help tab on admin pages.
558
+	 *
559
+	 * @param  string     $help_tab_id the id for the connected help tab
560
+	 * @param bool|string $page        The page identifier for the page the help tab is on
561
+	 * @param bool|string $action      The action (route) for the admin page the help tab is on.
562
+	 * @param bool|string $icon_style  (optional) include css class for the style you want to use for the help icon.
563
+	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
564
+	 * @return string              generated link
565
+	 */
566
+	public static function get_help_tab_link(
567
+		$help_tab_id,
568
+		$page = false,
569
+		$action = false,
570
+		$icon_style = false,
571
+		$help_text = false
572
+	) {
573
+
574
+		if ( ! $page) {
575
+			$page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
576
+		}
577
+
578
+		if ( ! $action) {
579
+			$action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
580
+		}
581
+
582
+		$action = empty($action) ? 'default' : $action;
583
+
584
+
585
+		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
586
+		$icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
587
+		$help_text    = ! $help_text ? '' : $help_text;
588
+		return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.',
589
+				'event_espresso') . '" > ' . $help_text . ' </a>';
590
+	}
591
+
592
+
593
+	/**
594
+	 * This helper generates the html structure for the jquery joyride plugin with the given params.
595
+	 *
596
+	 * @link http://zurb.com/playground/jquery-joyride-feature-tour-plugin
597
+	 * @see  EE_Admin_Page->_stop_callback() for the construct expected for the $stops param.
598
+	 * @param EE_Help_Tour
599
+	 * @return string         html
600
+	 */
601
+	public static function help_tour_stops_generator(EE_Help_Tour $tour)
602
+	{
603
+		$id    = $tour->get_slug();
604
+		$stops = $tour->get_stops();
605
+
606
+		$content = '<ol style="display:none" id="' . $id . '">';
607
+
608
+		foreach ($stops as $stop) {
609
+			$data_id    = ! empty($stop['id']) ? ' data-id="' . $stop['id'] . '"' : '';
610
+			$data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="' . $stop['class'] . '"' : '';
611
+
612
+			//if container is set to modal then let's make sure we set the options accordingly
613
+			if (empty($data_id) && empty($data_class)) {
614
+				$stop['options']['modal']  = true;
615
+				$stop['options']['expose'] = true;
616
+			}
617
+
618
+			$custom_class  = ! empty($stop['custom_class']) ? ' class="' . $stop['custom_class'] . '"' : '';
619
+			$button_text   = ! empty($stop['button_text']) ? ' data-button="' . $stop['button_text'] . '"' : '';
620
+			$inner_content = isset($stop['content']) ? $stop['content'] : '';
621
+
622
+			//options
623
+			if (isset($stop['options']) && is_array($stop['options'])) {
624
+				$options = ' data-options="';
625
+				foreach ($stop['options'] as $option => $value) {
626
+					$options .= $option . ':' . $value . ';';
627
+				}
628
+				$options .= '"';
629
+			} else {
630
+				$options = '';
631
+			}
632
+
633
+			//let's put all together
634
+			$content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
635
+		}
636
+
637
+		$content .= '</ol>';
638
+		return $content;
639
+	}
640
+
641
+
642
+	/**
643
+	 * This is a helper method to generate a status legend for a given status array.
644
+	 * Note this will only work if the incoming statuses have a key in the EEM_Status->localized_status() methods
645
+	 * status_array.
646
+	 *
647
+	 * @param  array  $status_array  array of statuses that will make up the legend. In format:
648
+	 *                               array(
649
+	 *                               'status_item' => 'status_name'
650
+	 *                               )
651
+	 * @param  string $active_status This is used to indicate what the active status is IF that is to be highlighted in
652
+	 *                               the legend.
653
+	 * @throws EE_Error
654
+	 * @return string               html structure for status.
655
+	 */
656
+	public static function status_legend($status_array, $active_status = '')
657
+	{
658
+		if ( ! is_array($status_array)) {
659
+			throw new EE_Error(esc_html__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
660
+				'event_espresso'));
661
+		}
662
+
663
+		$setup_array = array();
664
+		foreach ($status_array as $item => $status) {
665
+			$setup_array[$item] = array(
666
+				'class'  => 'ee-status-legend ee-status-legend-' . $status,
667
+				'desc'   => EEH_Template::pretty_status($status, false, 'sentence'),
668
+				'status' => $status,
669
+			);
670
+		}
671
+
672
+		$content = '<div class="ee-list-table-legend-container">' . "\n";
673
+		$content .= '<h4 class="status-legend-title">' . esc_html__('Status Legend', 'event_espresso') . '</h4>' . "\n";
674
+		$content .= '<dl class="ee-list-table-legend">' . "\n\t";
675
+		foreach ($setup_array as $item => $details) {
676
+			$active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
677
+			$content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
678
+			$content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
679
+			$content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
680
+			$content .= '</dt>' . "\n";
681
+		}
682
+		$content .= '</dl>' . "\n";
683
+		$content .= '</div>' . "\n";
684
+		return $content;
685
+	}
686
+
687
+
688
+	/**
689
+	 * Gets HTML for laying out a deeply-nested array (and objects) in a format
690
+	 * that's nice for presenting in the wp admin
691
+	 *
692
+	 * @param mixed $data
693
+	 * @return string
694
+	 */
695
+	public static function layout_array_as_table($data)
696
+	{
697
+		if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
698
+			$data = (array)$data;
699
+		}
700
+		ob_start();
701
+		if (is_array($data)) {
702
+			if (EEH_Array::is_associative_array($data)) {
703
+				?>
704 704
                 <table class="widefat">
705 705
                     <tbody>
706 706
                     <?php
707
-                    foreach ($data as $data_key => $data_values) {
708
-                        ?>
707
+					foreach ($data as $data_key => $data_values) {
708
+						?>
709 709
                         <tr>
710 710
                             <td>
711 711
                                 <?php echo $data_key; ?>
@@ -715,248 +715,248 @@  discard block
 block discarded – undo
715 715
                             </td>
716 716
                         </tr>
717 717
                         <?php
718
-                    } ?>
718
+					} ?>
719 719
                     </tbody>
720 720
                 </table>
721 721
                 <?php
722
-            } else {
723
-                ?>
722
+			} else {
723
+				?>
724 724
                 <ul>
725 725
                     <?php
726
-                    foreach ($data as $datum) {
727
-                        echo "<li>";
728
-                        echo self::layout_array_as_table($datum);
729
-                        echo "</li>";
730
-                    } ?>
726
+					foreach ($data as $datum) {
727
+						echo "<li>";
728
+						echo self::layout_array_as_table($datum);
729
+						echo "</li>";
730
+					} ?>
731 731
                 </ul>
732 732
                 <?php
733
-            }
734
-        } else {
735
-            //simple value
736
-            echo esc_html($data);
737
-        }
738
-        return ob_get_clean();
739
-    }
740
-
741
-
742
-    /**
743
-     * wrapper for self::get_paging_html() that simply echos the generated paging html
744
-     *
745
-     * @since 4.4.0
746
-     * @see   self:get_paging_html() for argument docs.
747
-     * @param        $total_items
748
-     * @param        $current
749
-     * @param        $per_page
750
-     * @param        $url
751
-     * @param bool   $show_num_field
752
-     * @param string $paged_arg_name
753
-     * @param array  $items_label
754
-     * @return string
755
-     */
756
-    public static function paging_html(
757
-        $total_items,
758
-        $current,
759
-        $per_page,
760
-        $url,
761
-        $show_num_field = true,
762
-        $paged_arg_name = 'paged',
763
-        $items_label = array()
764
-    ) {
765
-        echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name,
766
-            $items_label);
767
-    }
768
-
769
-
770
-    /**
771
-     * A method for generating paging similar to WP_List_Table
772
-     *
773
-     * @since    4.4.0
774
-     * @see      wp-admin/includes/class-wp-list-table.php WP_List_Table::pagination()
775
-     * @param  integer $total_items     How many total items there are to page.
776
-     * @param  integer $current         What the current page is.
777
-     * @param  integer $per_page        How many items per page.
778
-     * @param  string  $url             What the base url for page links is.
779
-     * @param  boolean $show_num_field  Whether to show the input for changing page number.
780
-     * @param  string  $paged_arg_name  The name of the key for the paged query argument.
781
-     * @param  array   $items_label     An array of singular/plural values for the items label:
782
-     *                                  array(
783
-     *                                  'single' => 'item',
784
-     *                                  'plural' => 'items'
785
-     *                                  )
786
-     * @return  string
787
-     */
788
-    public static function get_paging_html(
789
-        $total_items,
790
-        $current,
791
-        $per_page,
792
-        $url,
793
-        $show_num_field = true,
794
-        $paged_arg_name = 'paged',
795
-        $items_label = array()
796
-    ) {
797
-        $page_links     = array();
798
-        $disable_first  = $disable_last = '';
799
-        $total_items    = (int)$total_items;
800
-        $per_page       = (int)$per_page;
801
-        $current        = (int)$current;
802
-        $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
803
-
804
-        //filter items_label
805
-        $items_label = apply_filters(
806
-            'FHEE__EEH_Template__get_paging_html__items_label',
807
-            $items_label
808
-        );
809
-
810
-        if (empty($items_label)
811
-            || ! is_array($items_label)
812
-            || ! isset($items_label['single'])
813
-            || ! isset($items_label['plural'])
814
-        ) {
815
-            $items_label = array(
816
-                'single' => __('1 item', 'event_espresso'),
817
-                'plural' => __('%s items', 'event_espresso'),
818
-            );
819
-        } else {
820
-            $items_label = array(
821
-                'single' => '1 ' . esc_html($items_label['single']),
822
-                'plural' => '%s ' . esc_html($items_label['plural']),
823
-            );
824
-        }
825
-
826
-        $total_pages = ceil($total_items / $per_page);
827
-
828
-        if ($total_pages <= 1) {
829
-            return '';
830
-        }
831
-
832
-        $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
833
-
834
-        $output = '<span class="displaying-num">' . $item_label . '</span>';
835
-
836
-        if ($current === 1) {
837
-            $disable_first = ' disabled';
838
-        }
839
-        if ($current == $total_pages) {
840
-            $disable_last = ' disabled';
841
-        }
842
-
843
-        $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
844
-            'first-page' . $disable_first,
845
-            esc_attr__('Go to the first page'),
846
-            esc_url(remove_query_arg($paged_arg_name, $url)),
847
-            '&laquo;'
848
-        );
849
-
850
-        $page_links[] = sprintf(
851
-            '<a class="%s" title="%s" href="%s">%s</a>',
852
-            'prev-page' . $disable_first,
853
-            esc_attr__('Go to the previous page'),
854
-            esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
855
-            '&lsaquo;'
856
-        );
857
-
858
-        if ( ! $show_num_field) {
859
-            $html_current_page = $current;
860
-        } else {
861
-            $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
862
-                esc_attr__('Current page'),
863
-                $current,
864
-                strlen($total_pages)
865
-            );
866
-        }
867
-
868
-        $html_total_pages = sprintf(
869
-            '<span class="total-pages">%s</span>',
870
-            number_format_i18n($total_pages)
871
-        );
872
-        $page_links[]     = sprintf(
873
-            _x('%3$s%1$s of %2$s%4$s', 'paging'),
874
-            $html_current_page,
875
-            $html_total_pages,
876
-            '<span class="paging-input">',
877
-            '</span>'
878
-        );
879
-
880
-        $page_links[] = sprintf(
881
-            '<a class="%s" title="%s" href="%s">%s</a>',
882
-            'next-page' . $disable_last,
883
-            esc_attr__('Go to the next page'),
884
-            esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
885
-            '&rsaquo;'
886
-        );
887
-
888
-        $page_links[] = sprintf(
889
-            '<a class="%s" title="%s" href="%s">%s</a>',
890
-            'last-page' . $disable_last,
891
-            esc_attr__('Go to the last page'),
892
-            esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
893
-            '&raquo;'
894
-        );
895
-
896
-        $output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
897
-        // set page class
898
-        if ($total_pages) {
899
-            $page_class = $total_pages < 2 ? ' one-page' : '';
900
-        } else {
901
-            $page_class = ' no-pages';
902
-        }
903
-
904
-        return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
905
-    }
906
-
907
-
908
-    /**
909
-     * @param string $wrap_class
910
-     * @param string $wrap_id
911
-     * @return string
912
-     */
913
-    public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = array())
914
-    {
915
-        $admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
916
-        if (
917
-            ! $admin &&
918
-            ! apply_filters(
919
-                'FHEE__EEH_Template__powered_by_event_espresso__show_reg_footer',
920
-                EE_Registry::instance()->CFG->admin->show_reg_footer
921
-            )
922
-        ) {
923
-            return '';
924
-        }
925
-        $tag        = $admin ? 'span' : 'div';
926
-        $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
927
-        $wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
928
-        $attributes .= ! empty($wrap_class)
929
-            ? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
930
-            : ' class="powered-by-event-espresso-credit"';
931
-        $query_args = array_merge(
932
-            array(
933
-                'ap_id'        => EE_Registry::instance()->CFG->admin->affiliate_id(),
934
-                'utm_source'   => 'powered_by_event_espresso',
935
-                'utm_medium'   => 'link',
936
-                'utm_campaign' => 'powered_by',
937
-            ),
938
-            $query_args
939
-        );
940
-        $powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text',
941
-            $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso');
942
-        $url        = add_query_arg($query_args, 'https://eventespresso.com/');
943
-        $url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
944
-        return (string)apply_filters(
945
-            'FHEE__EEH_Template__powered_by_event_espresso__html',
946
-            sprintf(
947
-                esc_html_x(
948
-                    '%3$s%1$sOnline event registration and ticketing powered by %2$s%3$s',
949
-                    'Online event registration and ticketing powered by [link to eventespresso.com]',
950
-                    'event_espresso'
951
-                ),
952
-                "<{$tag}{$attributes}>",
953
-                "<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$powered_by}</a></{$tag}>",
954
-                $admin ? '' : '<br />'
955
-            ),
956
-            $wrap_class,
957
-            $wrap_id
958
-        );
959
-    }
733
+			}
734
+		} else {
735
+			//simple value
736
+			echo esc_html($data);
737
+		}
738
+		return ob_get_clean();
739
+	}
740
+
741
+
742
+	/**
743
+	 * wrapper for self::get_paging_html() that simply echos the generated paging html
744
+	 *
745
+	 * @since 4.4.0
746
+	 * @see   self:get_paging_html() for argument docs.
747
+	 * @param        $total_items
748
+	 * @param        $current
749
+	 * @param        $per_page
750
+	 * @param        $url
751
+	 * @param bool   $show_num_field
752
+	 * @param string $paged_arg_name
753
+	 * @param array  $items_label
754
+	 * @return string
755
+	 */
756
+	public static function paging_html(
757
+		$total_items,
758
+		$current,
759
+		$per_page,
760
+		$url,
761
+		$show_num_field = true,
762
+		$paged_arg_name = 'paged',
763
+		$items_label = array()
764
+	) {
765
+		echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name,
766
+			$items_label);
767
+	}
768
+
769
+
770
+	/**
771
+	 * A method for generating paging similar to WP_List_Table
772
+	 *
773
+	 * @since    4.4.0
774
+	 * @see      wp-admin/includes/class-wp-list-table.php WP_List_Table::pagination()
775
+	 * @param  integer $total_items     How many total items there are to page.
776
+	 * @param  integer $current         What the current page is.
777
+	 * @param  integer $per_page        How many items per page.
778
+	 * @param  string  $url             What the base url for page links is.
779
+	 * @param  boolean $show_num_field  Whether to show the input for changing page number.
780
+	 * @param  string  $paged_arg_name  The name of the key for the paged query argument.
781
+	 * @param  array   $items_label     An array of singular/plural values for the items label:
782
+	 *                                  array(
783
+	 *                                  'single' => 'item',
784
+	 *                                  'plural' => 'items'
785
+	 *                                  )
786
+	 * @return  string
787
+	 */
788
+	public static function get_paging_html(
789
+		$total_items,
790
+		$current,
791
+		$per_page,
792
+		$url,
793
+		$show_num_field = true,
794
+		$paged_arg_name = 'paged',
795
+		$items_label = array()
796
+	) {
797
+		$page_links     = array();
798
+		$disable_first  = $disable_last = '';
799
+		$total_items    = (int)$total_items;
800
+		$per_page       = (int)$per_page;
801
+		$current        = (int)$current;
802
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
803
+
804
+		//filter items_label
805
+		$items_label = apply_filters(
806
+			'FHEE__EEH_Template__get_paging_html__items_label',
807
+			$items_label
808
+		);
809
+
810
+		if (empty($items_label)
811
+			|| ! is_array($items_label)
812
+			|| ! isset($items_label['single'])
813
+			|| ! isset($items_label['plural'])
814
+		) {
815
+			$items_label = array(
816
+				'single' => __('1 item', 'event_espresso'),
817
+				'plural' => __('%s items', 'event_espresso'),
818
+			);
819
+		} else {
820
+			$items_label = array(
821
+				'single' => '1 ' . esc_html($items_label['single']),
822
+				'plural' => '%s ' . esc_html($items_label['plural']),
823
+			);
824
+		}
825
+
826
+		$total_pages = ceil($total_items / $per_page);
827
+
828
+		if ($total_pages <= 1) {
829
+			return '';
830
+		}
831
+
832
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
833
+
834
+		$output = '<span class="displaying-num">' . $item_label . '</span>';
835
+
836
+		if ($current === 1) {
837
+			$disable_first = ' disabled';
838
+		}
839
+		if ($current == $total_pages) {
840
+			$disable_last = ' disabled';
841
+		}
842
+
843
+		$page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
844
+			'first-page' . $disable_first,
845
+			esc_attr__('Go to the first page'),
846
+			esc_url(remove_query_arg($paged_arg_name, $url)),
847
+			'&laquo;'
848
+		);
849
+
850
+		$page_links[] = sprintf(
851
+			'<a class="%s" title="%s" href="%s">%s</a>',
852
+			'prev-page' . $disable_first,
853
+			esc_attr__('Go to the previous page'),
854
+			esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
855
+			'&lsaquo;'
856
+		);
857
+
858
+		if ( ! $show_num_field) {
859
+			$html_current_page = $current;
860
+		} else {
861
+			$html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
862
+				esc_attr__('Current page'),
863
+				$current,
864
+				strlen($total_pages)
865
+			);
866
+		}
867
+
868
+		$html_total_pages = sprintf(
869
+			'<span class="total-pages">%s</span>',
870
+			number_format_i18n($total_pages)
871
+		);
872
+		$page_links[]     = sprintf(
873
+			_x('%3$s%1$s of %2$s%4$s', 'paging'),
874
+			$html_current_page,
875
+			$html_total_pages,
876
+			'<span class="paging-input">',
877
+			'</span>'
878
+		);
879
+
880
+		$page_links[] = sprintf(
881
+			'<a class="%s" title="%s" href="%s">%s</a>',
882
+			'next-page' . $disable_last,
883
+			esc_attr__('Go to the next page'),
884
+			esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
885
+			'&rsaquo;'
886
+		);
887
+
888
+		$page_links[] = sprintf(
889
+			'<a class="%s" title="%s" href="%s">%s</a>',
890
+			'last-page' . $disable_last,
891
+			esc_attr__('Go to the last page'),
892
+			esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
893
+			'&raquo;'
894
+		);
895
+
896
+		$output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
897
+		// set page class
898
+		if ($total_pages) {
899
+			$page_class = $total_pages < 2 ? ' one-page' : '';
900
+		} else {
901
+			$page_class = ' no-pages';
902
+		}
903
+
904
+		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
905
+	}
906
+
907
+
908
+	/**
909
+	 * @param string $wrap_class
910
+	 * @param string $wrap_id
911
+	 * @return string
912
+	 */
913
+	public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = array())
914
+	{
915
+		$admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
916
+		if (
917
+			! $admin &&
918
+			! apply_filters(
919
+				'FHEE__EEH_Template__powered_by_event_espresso__show_reg_footer',
920
+				EE_Registry::instance()->CFG->admin->show_reg_footer
921
+			)
922
+		) {
923
+			return '';
924
+		}
925
+		$tag        = $admin ? 'span' : 'div';
926
+		$attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
927
+		$wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
928
+		$attributes .= ! empty($wrap_class)
929
+			? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
930
+			: ' class="powered-by-event-espresso-credit"';
931
+		$query_args = array_merge(
932
+			array(
933
+				'ap_id'        => EE_Registry::instance()->CFG->admin->affiliate_id(),
934
+				'utm_source'   => 'powered_by_event_espresso',
935
+				'utm_medium'   => 'link',
936
+				'utm_campaign' => 'powered_by',
937
+			),
938
+			$query_args
939
+		);
940
+		$powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text',
941
+			$admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso');
942
+		$url        = add_query_arg($query_args, 'https://eventespresso.com/');
943
+		$url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
944
+		return (string)apply_filters(
945
+			'FHEE__EEH_Template__powered_by_event_espresso__html',
946
+			sprintf(
947
+				esc_html_x(
948
+					'%3$s%1$sOnline event registration and ticketing powered by %2$s%3$s',
949
+					'Online event registration and ticketing powered by [link to eventespresso.com]',
950
+					'event_espresso'
951
+				),
952
+				"<{$tag}{$attributes}>",
953
+				"<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$powered_by}</a></{$tag}>",
954
+				$admin ? '' : '<br />'
955
+			),
956
+			$wrap_class,
957
+			$wrap_id
958
+		);
959
+	}
960 960
 
961 961
 
962 962
 } //end EEH_Template class
@@ -965,33 +965,33 @@  discard block
 block discarded – undo
965 965
 
966 966
 
967 967
 if ( ! function_exists('espresso_pagination')) {
968
-    /**
969
-     *    espresso_pagination
970
-     *
971
-     * @access    public
972
-     * @return    void
973
-     */
974
-    function espresso_pagination()
975
-    {
976
-        global $wp_query;
977
-        $big        = 999999999; // need an unlikely integer
978
-        $pagination = paginate_links(
979
-            array(
980
-                'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
981
-                'format'       => '?paged=%#%',
982
-                'current'      => max(1, get_query_var('paged')),
983
-                'total'        => $wp_query->max_num_pages,
984
-                'show_all'     => true,
985
-                'end_size'     => 10,
986
-                'mid_size'     => 6,
987
-                'prev_next'    => true,
988
-                'prev_text'    => __('&lsaquo; PREV', 'event_espresso'),
989
-                'next_text'    => __('NEXT &rsaquo;', 'event_espresso'),
990
-                'type'         => 'plain',
991
-                'add_args'     => false,
992
-                'add_fragment' => '',
993
-            )
994
-        );
995
-        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
996
-    }
968
+	/**
969
+	 *    espresso_pagination
970
+	 *
971
+	 * @access    public
972
+	 * @return    void
973
+	 */
974
+	function espresso_pagination()
975
+	{
976
+		global $wp_query;
977
+		$big        = 999999999; // need an unlikely integer
978
+		$pagination = paginate_links(
979
+			array(
980
+				'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
981
+				'format'       => '?paged=%#%',
982
+				'current'      => max(1, get_query_var('paged')),
983
+				'total'        => $wp_query->max_num_pages,
984
+				'show_all'     => true,
985
+				'end_size'     => 10,
986
+				'mid_size'     => 6,
987
+				'prev_next'    => true,
988
+				'prev_text'    => __('&lsaquo; PREV', 'event_espresso'),
989
+				'next_text'    => __('NEXT &rsaquo;', 'event_espresso'),
990
+				'type'         => 'plain',
991
+				'add_args'     => false,
992
+				'add_fragment' => '',
993
+			)
994
+		);
995
+		echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
996
+	}
997 997
 }
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined('EVENT_ESPRESSO_VERSION')) {
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3 3
     exit('NO direct script access allowed');
4 4
 }
5 5
 /**
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
     public static function load_espresso_theme_functions()
82 82
     {
83 83
         if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
84
-            if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php')) {
85
-                require_once(EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php');
84
+            if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) {
85
+                require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php');
86 86
             }
87 87
         }
88 88
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public static function get_espresso_themes()
97 97
     {
98 98
         if (empty(EEH_Template::$_espresso_themes)) {
99
-            $espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
99
+            $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
100 100
             if (empty($espresso_themes)) {
101 101
                 return array();
102 102
             }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     ) {
133 133
         do_action("get_template_part_{$slug}-{$name}", $slug, $name);
134 134
         $templates = array();
135
-        $name      = (string)$name;
135
+        $name      = (string) $name;
136 136
         if ($name != '') {
137 137
             $templates[] = "{$slug}-{$name}.php";
138 138
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                 if (isset($EE_CPTs[$post_type])) {
212 212
                     $archive_or_single = is_archive() ? 'archive' : '';
213 213
                     $archive_or_single = is_single() ? 'single' : $archive_or_single;
214
-                    $templates         = $archive_or_single . '-' . $post_type . '.php';
214
+                    $templates         = $archive_or_single.'-'.$post_type.'.php';
215 215
                 }
216 216
             }
217 217
             // currently active EE template theme
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
             // array of paths to folders that may contain templates
221 221
             $template_folder_paths = array(
222 222
                 // first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
223
-                EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
223
+                EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
224 224
                 // then in the root of the /wp-content/uploads/espresso/templates/ folder
225 225
                 EVENT_ESPRESSO_TEMPLATE_DIR,
226 226
             );
227 227
 
228 228
             //add core plugin folders for checking only if we're not $check_if_custom
229 229
             if ( ! $check_if_custom) {
230
-                $core_paths            = array(
230
+                $core_paths = array(
231 231
                     // in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
232
-                    EE_PUBLIC . $current_theme,
232
+                    EE_PUBLIC.$current_theme,
233 233
                     // in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
234
-                    EE_TEMPLATES . $current_theme,
234
+                    EE_TEMPLATES.$current_theme,
235 235
                     // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
236 236
                     EE_PLUGIN_DIR_PATH,
237 237
                 );
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
                     );
263 263
                     if ($common_base_path !== '') {
264 264
                         // both paths have a common base, so just tack the filename onto our search path
265
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
265
+                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
266 266
                     } else {
267 267
                         // no common base path, so let's just concatenate
268
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
268
+                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
269 269
                     }
270 270
                     // build up our template locations array by adding our resolved paths
271 271
                     $full_template_paths[] = $resolved_path;
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
                 // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
274 274
                 array_unshift($full_template_paths, $template);
275 275
                 // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
276
-                array_unshift($full_template_paths, get_stylesheet_directory() . DS . $file_name);
276
+                array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name);
277 277
             }
278 278
             // filter final array of full template paths
279 279
             $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths',
280 280
                 $full_template_paths, $file_name);
281 281
             // now loop through our final array of template location paths and check each location
282
-            foreach ((array)$full_template_paths as $full_template_path) {
282
+            foreach ((array) $full_template_paths as $full_template_path) {
283 283
                 if (is_readable($full_template_path)) {
284 284
                     $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
285 285
                     break;
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
         if ( ! is_array($template_args) && ! is_object($template_args)) {
367 367
             $template_args = array($template_args);
368 368
         }
369
-        extract( $template_args, EXTR_SKIP );
369
+        extract($template_args, EXTR_SKIP);
370 370
         // ignore whether template is accessible ?
371
-        if ( $throw_exceptions && ! is_readable( $template_path ) ) {
371
+        if ($throw_exceptions && ! is_readable($template_path)) {
372 372
             throw new \DomainException(
373 373
                     esc_html__(
374 374
                             'Invalid, unreadable, or missing file.',
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
     public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
402 402
     {
403 403
         // in the beginning...
404
-        $prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
404
+        $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
405 405
         // da muddle
406 406
         $class = '';
407 407
         // the end
408
-        $suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
408
+        $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
409 409
         // is the passed object an EE object ?
410 410
         if ($object instanceof EE_Base_Class) {
411 411
             // grab the exact type of object
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
                 // no specifics just yet...
416 416
                 default :
417 417
                     $class = strtolower(str_replace('_', '-', $obj_class));
418
-                    $class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
418
+                    $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
419 419
 
420 420
             }
421 421
         }
422 422
         
423
-        $class_string = $prefix . $class . $suffix;
423
+        $class_string = $prefix.$class.$suffix;
424 424
         
425 425
         return apply_filters('FHEE__EEH_Template__get_object_css_class__class_string', $class_string, $object, $prefix, $suffix);
426 426
     }
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
             return '';
455 455
         }
456 456
         //ensure amount is float
457
-        $amount  = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float)$amount);
457
+        $amount  = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
458 458
         $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
459 459
         // filter raw amount (allows 0.00 to be changed to "free" for example)
460 460
         $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
@@ -476,20 +476,20 @@  discard block
 block discarded – undo
476 476
                 // add currency sign
477 477
                 if ($mny->sign_b4) {
478 478
                     if ($amount >= 0) {
479
-                        $amount_formatted = $mny->sign . $amount_formatted;
479
+                        $amount_formatted = $mny->sign.$amount_formatted;
480 480
                     } else {
481
-                        $amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
481
+                        $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
482 482
                     }
483 483
 
484 484
                 } else {
485
-                    $amount_formatted = $amount_formatted . $mny->sign;
485
+                    $amount_formatted = $amount_formatted.$mny->sign;
486 486
                 }
487 487
 
488 488
                 // filter to allow global setting of display_code
489 489
                 $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code);
490 490
 
491 491
                 // add currency code ?
492
-                $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
492
+                $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted;
493 493
             }
494 494
             // filter results
495 495
             $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted',
@@ -543,12 +543,12 @@  discard block
 block discarded – undo
543 543
             $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
544 544
             foreach ($dashicons as $dashicon) {
545 545
                 $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
546
-                $icon_html .= '<span class="' . $type . $dashicon . '"></span>';
546
+                $icon_html .= '<span class="'.$type.$dashicon.'"></span>';
547 547
             }
548 548
             $icon_html .= $count > 1 ? '</span>' : '';
549 549
         }
550
-        $label  = ! empty($icon) ? $icon_html . $label : $label;
551
-        $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . esc_url($url) . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>';
550
+        $label  = ! empty($icon) ? $icon_html.$label : $label;
551
+        $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.esc_url($url).'" class="'.$class.'" title="'.$title.'">'.$label.'</a>';
552 552
         return $button;
553 553
     }
554 554
 
@@ -582,11 +582,11 @@  discard block
 block discarded – undo
582 582
         $action = empty($action) ? 'default' : $action;
583 583
 
584 584
 
585
-        $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
585
+        $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
586 586
         $icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
587 587
         $help_text    = ! $help_text ? '' : $help_text;
588
-        return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.',
589
-                'event_espresso') . '" > ' . $help_text . ' </a>';
588
+        return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.',
589
+                'event_espresso').'" > '.$help_text.' </a>';
590 590
     }
591 591
 
592 592
 
@@ -603,11 +603,11 @@  discard block
 block discarded – undo
603 603
         $id    = $tour->get_slug();
604 604
         $stops = $tour->get_stops();
605 605
 
606
-        $content = '<ol style="display:none" id="' . $id . '">';
606
+        $content = '<ol style="display:none" id="'.$id.'">';
607 607
 
608 608
         foreach ($stops as $stop) {
609
-            $data_id    = ! empty($stop['id']) ? ' data-id="' . $stop['id'] . '"' : '';
610
-            $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="' . $stop['class'] . '"' : '';
609
+            $data_id    = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : '';
610
+            $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : '';
611 611
 
612 612
             //if container is set to modal then let's make sure we set the options accordingly
613 613
             if (empty($data_id) && empty($data_class)) {
@@ -615,15 +615,15 @@  discard block
 block discarded – undo
615 615
                 $stop['options']['expose'] = true;
616 616
             }
617 617
 
618
-            $custom_class  = ! empty($stop['custom_class']) ? ' class="' . $stop['custom_class'] . '"' : '';
619
-            $button_text   = ! empty($stop['button_text']) ? ' data-button="' . $stop['button_text'] . '"' : '';
618
+            $custom_class  = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : '';
619
+            $button_text   = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : '';
620 620
             $inner_content = isset($stop['content']) ? $stop['content'] : '';
621 621
 
622 622
             //options
623 623
             if (isset($stop['options']) && is_array($stop['options'])) {
624 624
                 $options = ' data-options="';
625 625
                 foreach ($stop['options'] as $option => $value) {
626
-                    $options .= $option . ':' . $value . ';';
626
+                    $options .= $option.':'.$value.';';
627 627
                 }
628 628
                 $options .= '"';
629 629
             } else {
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
             }
632 632
 
633 633
             //let's put all together
634
-            $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
634
+            $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>';
635 635
         }
636 636
 
637 637
         $content .= '</ol>';
@@ -663,24 +663,24 @@  discard block
 block discarded – undo
663 663
         $setup_array = array();
664 664
         foreach ($status_array as $item => $status) {
665 665
             $setup_array[$item] = array(
666
-                'class'  => 'ee-status-legend ee-status-legend-' . $status,
666
+                'class'  => 'ee-status-legend ee-status-legend-'.$status,
667 667
                 'desc'   => EEH_Template::pretty_status($status, false, 'sentence'),
668 668
                 'status' => $status,
669 669
             );
670 670
         }
671 671
 
672
-        $content = '<div class="ee-list-table-legend-container">' . "\n";
673
-        $content .= '<h4 class="status-legend-title">' . esc_html__('Status Legend', 'event_espresso') . '</h4>' . "\n";
674
-        $content .= '<dl class="ee-list-table-legend">' . "\n\t";
672
+        $content = '<div class="ee-list-table-legend-container">'."\n";
673
+        $content .= '<h4 class="status-legend-title">'.esc_html__('Status Legend', 'event_espresso').'</h4>'."\n";
674
+        $content .= '<dl class="ee-list-table-legend">'."\n\t";
675 675
         foreach ($setup_array as $item => $details) {
676 676
             $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
677
-            $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
678
-            $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
679
-            $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
680
-            $content .= '</dt>' . "\n";
677
+            $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t";
678
+            $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t";
679
+            $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t";
680
+            $content .= '</dt>'."\n";
681 681
         }
682
-        $content .= '</dl>' . "\n";
683
-        $content .= '</div>' . "\n";
682
+        $content .= '</dl>'."\n";
683
+        $content .= '</div>'."\n";
684 684
         return $content;
685 685
     }
686 686
 
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
     public static function layout_array_as_table($data)
696 696
     {
697 697
         if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
698
-            $data = (array)$data;
698
+            $data = (array) $data;
699 699
         }
700 700
         ob_start();
701 701
         if (is_array($data)) {
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
     ) {
797 797
         $page_links     = array();
798 798
         $disable_first  = $disable_last = '';
799
-        $total_items    = (int)$total_items;
800
-        $per_page       = (int)$per_page;
801
-        $current        = (int)$current;
799
+        $total_items    = (int) $total_items;
800
+        $per_page       = (int) $per_page;
801
+        $current        = (int) $current;
802 802
         $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
803 803
 
804 804
         //filter items_label
@@ -818,8 +818,8 @@  discard block
 block discarded – undo
818 818
             );
819 819
         } else {
820 820
             $items_label = array(
821
-                'single' => '1 ' . esc_html($items_label['single']),
822
-                'plural' => '%s ' . esc_html($items_label['plural']),
821
+                'single' => '1 '.esc_html($items_label['single']),
822
+                'plural' => '%s '.esc_html($items_label['plural']),
823 823
             );
824 824
         }
825 825
 
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 
832 832
         $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
833 833
 
834
-        $output = '<span class="displaying-num">' . $item_label . '</span>';
834
+        $output = '<span class="displaying-num">'.$item_label.'</span>';
835 835
 
836 836
         if ($current === 1) {
837 837
             $disable_first = ' disabled';
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
         }
842 842
 
843 843
         $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
844
-            'first-page' . $disable_first,
844
+            'first-page'.$disable_first,
845 845
             esc_attr__('Go to the first page'),
846 846
             esc_url(remove_query_arg($paged_arg_name, $url)),
847 847
             '&laquo;'
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 
850 850
         $page_links[] = sprintf(
851 851
             '<a class="%s" title="%s" href="%s">%s</a>',
852
-            'prev-page' . $disable_first,
852
+            'prev-page'.$disable_first,
853 853
             esc_attr__('Go to the previous page'),
854 854
             esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
855 855
             '&lsaquo;'
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
             '<span class="total-pages">%s</span>',
870 870
             number_format_i18n($total_pages)
871 871
         );
872
-        $page_links[]     = sprintf(
872
+        $page_links[] = sprintf(
873 873
             _x('%3$s%1$s of %2$s%4$s', 'paging'),
874 874
             $html_current_page,
875 875
             $html_total_pages,
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
 
880 880
         $page_links[] = sprintf(
881 881
             '<a class="%s" title="%s" href="%s">%s</a>',
882
-            'next-page' . $disable_last,
882
+            'next-page'.$disable_last,
883 883
             esc_attr__('Go to the next page'),
884 884
             esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
885 885
             '&rsaquo;'
@@ -887,13 +887,13 @@  discard block
 block discarded – undo
887 887
 
888 888
         $page_links[] = sprintf(
889 889
             '<a class="%s" title="%s" href="%s">%s</a>',
890
-            'last-page' . $disable_last,
890
+            'last-page'.$disable_last,
891 891
             esc_attr__('Go to the last page'),
892 892
             esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
893 893
             '&raquo;'
894 894
         );
895 895
 
896
-        $output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
896
+        $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
897 897
         // set page class
898 898
         if ($total_pages) {
899 899
             $page_class = $total_pages < 2 ? ' one-page' : '';
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
             $page_class = ' no-pages';
902 902
         }
903 903
 
904
-        return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
904
+        return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
905 905
     }
906 906
 
907 907
 
@@ -938,10 +938,10 @@  discard block
 block discarded – undo
938 938
             $query_args
939 939
         );
940 940
         $powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text',
941
-            $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso');
941
+            $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso');
942 942
         $url        = add_query_arg($query_args, 'https://eventespresso.com/');
943 943
         $url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
944
-        return (string)apply_filters(
944
+        return (string) apply_filters(
945 945
             'FHEE__EEH_Template__powered_by_event_espresso__html',
946 946
             sprintf(
947 947
                 esc_html_x(
@@ -992,6 +992,6 @@  discard block
 block discarded – undo
992 992
                 'add_fragment' => '',
993 993
             )
994 994
         );
995
-        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
995
+        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">'.$pagination.'</div>' : '';
996 996
     }
997 997
 }
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -38,216 +38,216 @@
 block discarded – undo
38 38
  * @since       4.0
39 39
  */
40 40
 if (function_exists('espresso_version')) {
41
-    if (! function_exists('espresso_duplicate_plugin_error')) {
42
-        /**
43
-         *    espresso_duplicate_plugin_error
44
-         *    displays if more than one version of EE is activated at the same time
45
-         */
46
-        function espresso_duplicate_plugin_error()
47
-        {
48
-            ?>
41
+	if (! function_exists('espresso_duplicate_plugin_error')) {
42
+		/**
43
+		 *    espresso_duplicate_plugin_error
44
+		 *    displays if more than one version of EE is activated at the same time
45
+		 */
46
+		function espresso_duplicate_plugin_error()
47
+		{
48
+			?>
49 49
             <div class="error">
50 50
                 <p>
51 51
                     <?php
52
-                    echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                    ); ?>
52
+					echo esc_html__(
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+					); ?>
56 56
                 </p>
57 57
             </div>
58 58
             <?php
59
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-        }
61
-    }
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+		}
61
+	}
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 
64 64
 } else {
65
-    define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
66
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
67
-        /**
68
-         * espresso_minimum_php_version_error
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
65
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
66
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
67
+		/**
68
+		 * espresso_minimum_php_version_error
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                        esc_html__(
79
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                            'event_espresso'
81
-                        ),
82
-                        EE_MIN_PHP_VER_REQUIRED,
83
-                        PHP_VERSION,
84
-                        '<br/>',
85
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+						esc_html__(
79
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+							'event_espresso'
81
+						),
82
+						EE_MIN_PHP_VER_REQUIRED,
83
+						PHP_VERSION,
84
+						'<br/>',
85
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
-        /**
98
-         * espresso_version
99
-         * Returns the plugin version
100
-         *
101
-         * @return string
102
-         */
103
-        function espresso_version()
104
-        {
105
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.54.rc.034');
106
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
+		/**
98
+		 * espresso_version
99
+		 * Returns the plugin version
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function espresso_version()
104
+		{
105
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.54.rc.034');
106
+		}
107 107
 
108
-        /**
109
-         * espresso_plugin_activation
110
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
-         */
112
-        function espresso_plugin_activation()
113
-        {
114
-            update_option('ee_espresso_activation', true);
115
-        }
108
+		/**
109
+		 * espresso_plugin_activation
110
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
+		 */
112
+		function espresso_plugin_activation()
113
+		{
114
+			update_option('ee_espresso_activation', true);
115
+		}
116 116
 
117
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118
-        /**
119
-         *    espresso_load_error_handling
120
-         *    this function loads EE's class for handling exceptions and errors
121
-         */
122
-        function espresso_load_error_handling()
123
-        {
124
-            static $error_handling_loaded = false;
125
-            if ($error_handling_loaded) {
126
-                return;
127
-            }
128
-            // load debugging tools
129
-            if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
130
-                require_once   EE_HELPERS . 'EEH_Debug_Tools.helper.php';
131
-                \EEH_Debug_Tools::instance();
132
-            }
133
-            // load error handling
134
-            if (is_readable(EE_CORE . 'EE_Error.core.php')) {
135
-                require_once EE_CORE . 'EE_Error.core.php';
136
-            } else {
137
-                wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
138
-            }
139
-            $error_handling_loaded = true;
140
-        }
117
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118
+		/**
119
+		 *    espresso_load_error_handling
120
+		 *    this function loads EE's class for handling exceptions and errors
121
+		 */
122
+		function espresso_load_error_handling()
123
+		{
124
+			static $error_handling_loaded = false;
125
+			if ($error_handling_loaded) {
126
+				return;
127
+			}
128
+			// load debugging tools
129
+			if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
130
+				require_once   EE_HELPERS . 'EEH_Debug_Tools.helper.php';
131
+				\EEH_Debug_Tools::instance();
132
+			}
133
+			// load error handling
134
+			if (is_readable(EE_CORE . 'EE_Error.core.php')) {
135
+				require_once EE_CORE . 'EE_Error.core.php';
136
+			} else {
137
+				wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
138
+			}
139
+			$error_handling_loaded = true;
140
+		}
141 141
 
142
-        /**
143
-         *    espresso_load_required
144
-         *    given a class name and path, this function will load that file or throw an exception
145
-         *
146
-         * @param    string $classname
147
-         * @param    string $full_path_to_file
148
-         * @throws    EE_Error
149
-         */
150
-        function espresso_load_required($classname, $full_path_to_file)
151
-        {
152
-            if (is_readable($full_path_to_file)) {
153
-                require_once $full_path_to_file;
154
-            } else {
155
-                throw new \EE_Error (
156
-                    sprintf(
157
-                        esc_html__(
158
-                            'The %s class file could not be located or is not readable due to file permissions.',
159
-                            'event_espresso'
160
-                        ),
161
-                        $classname
162
-                    )
163
-                );
164
-            }
165
-        }
142
+		/**
143
+		 *    espresso_load_required
144
+		 *    given a class name and path, this function will load that file or throw an exception
145
+		 *
146
+		 * @param    string $classname
147
+		 * @param    string $full_path_to_file
148
+		 * @throws    EE_Error
149
+		 */
150
+		function espresso_load_required($classname, $full_path_to_file)
151
+		{
152
+			if (is_readable($full_path_to_file)) {
153
+				require_once $full_path_to_file;
154
+			} else {
155
+				throw new \EE_Error (
156
+					sprintf(
157
+						esc_html__(
158
+							'The %s class file could not be located or is not readable due to file permissions.',
159
+							'event_espresso'
160
+						),
161
+						$classname
162
+					)
163
+				);
164
+			}
165
+		}
166 166
 
167
-        /**
168
-         * @since 4.9.27
169
-         * @throws \EE_Error
170
-         * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
171
-         * @throws \EventEspresso\core\exceptions\InvalidEntityException
172
-         * @throws \EventEspresso\core\exceptions\InvalidIdentifierException
173
-         * @throws \EventEspresso\core\exceptions\InvalidClassException
174
-         * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
175
-         * @throws \EventEspresso\core\services\container\exceptions\ServiceExistsException
176
-         * @throws \EventEspresso\core\services\container\exceptions\ServiceNotFoundException
177
-         * @throws \OutOfBoundsException
178
-         */
179
-        function bootstrap_espresso()
180
-        {
181
-            require_once __DIR__ . '/core/espresso_definitions.php';
182
-            try {
183
-                espresso_load_error_handling();
184
-                espresso_load_required(
185
-                    'EEH_Base',
186
-                    EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'
187
-                );
188
-                espresso_load_required(
189
-                    'EEH_File',
190
-                    EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php'
191
-                );
192
-                espresso_load_required(
193
-                    'EEH_File',
194
-                    EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'
195
-                );
196
-                espresso_load_required(
197
-                    'EEH_Array',
198
-                    EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php'
199
-                );
200
-                // instantiate and configure PSR4 autoloader
201
-                espresso_load_required(
202
-                    'Psr4Autoloader',
203
-                    EE_CORE . 'Psr4Autoloader.php'
204
-                );
205
-                espresso_load_required(
206
-                    'EE_Psr4AutoloaderInit',
207
-                    EE_CORE . 'EE_Psr4AutoloaderInit.core.php'
208
-                );
209
-                $AutoloaderInit = new EE_Psr4AutoloaderInit();
210
-                $AutoloaderInit->initializeAutoloader();
211
-                espresso_load_required(
212
-                    'EE_Request',
213
-                    EE_CORE . 'request_stack' . DS . 'EE_Request.core.php'
214
-                );
215
-                espresso_load_required(
216
-                    'EE_Response',
217
-                    EE_CORE . 'request_stack' . DS . 'EE_Response.core.php'
218
-                );
219
-                espresso_load_required(
220
-                    'EE_Bootstrap',
221
-                    EE_CORE . 'EE_Bootstrap.core.php'
222
-                );
223
-                // bootstrap EE and the request stack
224
-                new EE_Bootstrap(
225
-                    new EE_Request($_GET, $_POST, $_COOKIE),
226
-                    new EE_Response()
227
-                );
228
-            } catch (Exception $e) {
229
-                require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php';
230
-                new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e);
231
-            }
232
-        }
233
-        bootstrap_espresso();
234
-    }
167
+		/**
168
+		 * @since 4.9.27
169
+		 * @throws \EE_Error
170
+		 * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
171
+		 * @throws \EventEspresso\core\exceptions\InvalidEntityException
172
+		 * @throws \EventEspresso\core\exceptions\InvalidIdentifierException
173
+		 * @throws \EventEspresso\core\exceptions\InvalidClassException
174
+		 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
175
+		 * @throws \EventEspresso\core\services\container\exceptions\ServiceExistsException
176
+		 * @throws \EventEspresso\core\services\container\exceptions\ServiceNotFoundException
177
+		 * @throws \OutOfBoundsException
178
+		 */
179
+		function bootstrap_espresso()
180
+		{
181
+			require_once __DIR__ . '/core/espresso_definitions.php';
182
+			try {
183
+				espresso_load_error_handling();
184
+				espresso_load_required(
185
+					'EEH_Base',
186
+					EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'
187
+				);
188
+				espresso_load_required(
189
+					'EEH_File',
190
+					EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php'
191
+				);
192
+				espresso_load_required(
193
+					'EEH_File',
194
+					EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'
195
+				);
196
+				espresso_load_required(
197
+					'EEH_Array',
198
+					EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php'
199
+				);
200
+				// instantiate and configure PSR4 autoloader
201
+				espresso_load_required(
202
+					'Psr4Autoloader',
203
+					EE_CORE . 'Psr4Autoloader.php'
204
+				);
205
+				espresso_load_required(
206
+					'EE_Psr4AutoloaderInit',
207
+					EE_CORE . 'EE_Psr4AutoloaderInit.core.php'
208
+				);
209
+				$AutoloaderInit = new EE_Psr4AutoloaderInit();
210
+				$AutoloaderInit->initializeAutoloader();
211
+				espresso_load_required(
212
+					'EE_Request',
213
+					EE_CORE . 'request_stack' . DS . 'EE_Request.core.php'
214
+				);
215
+				espresso_load_required(
216
+					'EE_Response',
217
+					EE_CORE . 'request_stack' . DS . 'EE_Response.core.php'
218
+				);
219
+				espresso_load_required(
220
+					'EE_Bootstrap',
221
+					EE_CORE . 'EE_Bootstrap.core.php'
222
+				);
223
+				// bootstrap EE and the request stack
224
+				new EE_Bootstrap(
225
+					new EE_Request($_GET, $_POST, $_COOKIE),
226
+					new EE_Response()
227
+				);
228
+			} catch (Exception $e) {
229
+				require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php';
230
+				new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e);
231
+			}
232
+		}
233
+		bootstrap_espresso();
234
+	}
235 235
 }
236 236
 if (! function_exists('espresso_deactivate_plugin')) {
237
-    /**
238
-     *    deactivate_plugin
239
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
240
-     *
241
-     * @access public
242
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
243
-     * @return    void
244
-     */
245
-    function espresso_deactivate_plugin($plugin_basename = '')
246
-    {
247
-        if (! function_exists('deactivate_plugins')) {
248
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
249
-        }
250
-        unset($_GET['activate'], $_REQUEST['activate']);
251
-        deactivate_plugins($plugin_basename);
252
-    }
237
+	/**
238
+	 *    deactivate_plugin
239
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
240
+	 *
241
+	 * @access public
242
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
243
+	 * @return    void
244
+	 */
245
+	function espresso_deactivate_plugin($plugin_basename = '')
246
+	{
247
+		if (! function_exists('deactivate_plugins')) {
248
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
249
+		}
250
+		unset($_GET['activate'], $_REQUEST['activate']);
251
+		deactivate_plugins($plugin_basename);
252
+	}
253 253
 }
Please login to merge, or discard this patch.