Completed
Branch fix/kses-1 (1a6385)
by
unknown
10:13 queued 08:31
created
public/template_tags.php 1 patch
Indentation   +1057 added lines, -1057 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function is_espresso_event($event = null)
21 21
 {
22
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
23
-        // extract EE_Event object from passed param regardless of what it is (within reason of course)
24
-        $event = EEH_Event_View::get_event($event);
25
-        // do we have a valid event ?
26
-        return $event instanceof EE_Event;
27
-    }
28
-    return false;
22
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
23
+		// extract EE_Event object from passed param regardless of what it is (within reason of course)
24
+		$event = EEH_Event_View::get_event($event);
25
+		// do we have a valid event ?
26
+		return $event instanceof EE_Event;
27
+	}
28
+	return false;
29 29
 }
30 30
 
31 31
 /**
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function is_espresso_event_single()
38 38
 {
39
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
40
-        global $wp_query;
41
-        // return conditionals set by CPTs
42
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : false;
43
-    }
44
-    return false;
39
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
40
+		global $wp_query;
41
+		// return conditionals set by CPTs
42
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : false;
43
+	}
44
+	return false;
45 45
 }
46 46
 
47 47
 /**
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function is_espresso_event_archive()
54 54
 {
55
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
56
-        global $wp_query;
57
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : false;
58
-    }
59
-    return false;
55
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
56
+		global $wp_query;
57
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : false;
58
+	}
59
+	return false;
60 60
 }
61 61
 
62 62
 /**
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function is_espresso_event_taxonomy()
69 69
 {
70
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
71
-        global $wp_query;
72
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : false;
73
-    }
74
-    return false;
70
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
71
+		global $wp_query;
72
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : false;
73
+	}
74
+	return false;
75 75
 }
76 76
 
77 77
 /**
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function is_espresso_venue($venue = null)
87 87
 {
88
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
89
-        // extract EE_Venue object from passed param regardless of what it is (within reason of course)
90
-        $venue = EEH_Venue_View::get_venue($venue, false);
91
-        // do we have a valid event ?
92
-        return $venue instanceof EE_Venue;
93
-    }
94
-    return false;
88
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
89
+		// extract EE_Venue object from passed param regardless of what it is (within reason of course)
90
+		$venue = EEH_Venue_View::get_venue($venue, false);
91
+		// do we have a valid event ?
92
+		return $venue instanceof EE_Venue;
93
+	}
94
+	return false;
95 95
 }
96 96
 
97 97
 /**
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
  */
103 103
 function is_espresso_venue_single()
104 104
 {
105
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
106
-        global $wp_query;
107
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : false;
108
-    }
109
-    return false;
105
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
106
+		global $wp_query;
107
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : false;
108
+	}
109
+	return false;
110 110
 }
111 111
 
112 112
 /**
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
  */
118 118
 function is_espresso_venue_archive()
119 119
 {
120
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
121
-        global $wp_query;
122
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : false;
123
-    }
124
-    return false;
120
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
121
+		global $wp_query;
122
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : false;
123
+	}
124
+	return false;
125 125
 }
126 126
 
127 127
 /**
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
  */
133 133
 function is_espresso_venue_taxonomy()
134 134
 {
135
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
136
-        global $wp_query;
137
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : false;
138
-    }
139
-    return false;
135
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
136
+		global $wp_query;
137
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : false;
138
+	}
139
+	return false;
140 140
 }
141 141
 
142 142
 /**
@@ -148,62 +148,62 @@  discard block
 block discarded – undo
148 148
  */
149 149
 function can_use_espresso_conditionals($conditional_tag)
150 150
 {
151
-    if (! did_action('AHEE__EE_System__initialize')) {
152
-        EE_Error::doing_it_wrong(
153
-            __FUNCTION__,
154
-            sprintf(
155
-                esc_html__(
156
-                    'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.',
157
-                    'event_espresso'
158
-                ),
159
-                $conditional_tag
160
-            ),
161
-            '4.4.0'
162
-        );
163
-        return false;
164
-    }
165
-    return true;
151
+	if (! did_action('AHEE__EE_System__initialize')) {
152
+		EE_Error::doing_it_wrong(
153
+			__FUNCTION__,
154
+			sprintf(
155
+				esc_html__(
156
+					'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.',
157
+					'event_espresso'
158
+				),
159
+				$conditional_tag
160
+			),
161
+			'4.4.0'
162
+		);
163
+		return false;
164
+	}
165
+	return true;
166 166
 }
167 167
 
168 168
 
169 169
 /*************************** Event Queries ***************************/
170 170
 
171 171
 if (! function_exists('espresso_get_events')) {
172
-    /**
173
-     *    espresso_get_events
174
-     *
175
-     * @param array $params
176
-     * @return array
177
-     */
178
-    function espresso_get_events($params = [])
179
-    {
180
-        //set default params
181
-        $default_espresso_events_params = [
182
-            'limit'         => 10,
183
-            'show_expired'  => false,
184
-            'month'         => null,
185
-            'category_slug' => null,
186
-            'order_by'      => 'start_date',
187
-            'sort'          => 'ASC',
188
-        ];
189
-        // allow the defaults to be filtered
190
-        $default_espresso_events_params = apply_filters(
191
-            'espresso_get_events__default_espresso_events_params',
192
-            $default_espresso_events_params
193
-        );
194
-        // grab params and merge with defaults, then extract
195
-        $params = array_merge($default_espresso_events_params, $params);
196
-        // run the query
197
-        $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params);
198
-        // assign results to a variable so we can return it
199
-        $events = $events_query->have_posts() ? $events_query->posts : [];
200
-        // but first reset the query and postdata
201
-        wp_reset_query();
202
-        wp_reset_postdata();
203
-        EED_Events_Archive::remove_all_events_archive_filters();
204
-        unset($events_query);
205
-        return $events;
206
-    }
172
+	/**
173
+	 *    espresso_get_events
174
+	 *
175
+	 * @param array $params
176
+	 * @return array
177
+	 */
178
+	function espresso_get_events($params = [])
179
+	{
180
+		//set default params
181
+		$default_espresso_events_params = [
182
+			'limit'         => 10,
183
+			'show_expired'  => false,
184
+			'month'         => null,
185
+			'category_slug' => null,
186
+			'order_by'      => 'start_date',
187
+			'sort'          => 'ASC',
188
+		];
189
+		// allow the defaults to be filtered
190
+		$default_espresso_events_params = apply_filters(
191
+			'espresso_get_events__default_espresso_events_params',
192
+			$default_espresso_events_params
193
+		);
194
+		// grab params and merge with defaults, then extract
195
+		$params = array_merge($default_espresso_events_params, $params);
196
+		// run the query
197
+		$events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params);
198
+		// assign results to a variable so we can return it
199
+		$events = $events_query->have_posts() ? $events_query->posts : [];
200
+		// but first reset the query and postdata
201
+		wp_reset_query();
202
+		wp_reset_postdata();
203
+		EED_Events_Archive::remove_all_events_archive_filters();
204
+		unset($events_query);
205
+		return $events;
206
+	}
207 207
 }
208 208
 
209 209
 
@@ -218,357 +218,357 @@  discard block
 block discarded – undo
218 218
  */
219 219
 function espresso_load_ticket_selector()
220 220
 {
221
-    EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module');
221
+	EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module');
222 222
 }
223 223
 
224 224
 if (! function_exists('espresso_ticket_selector')) {
225
-    /**
226
-     * espresso_ticket_selector
227
-     *
228
-     * @param null $event
229
-     * @throws EE_Error
230
-     * @throws ReflectionException
231
-     */
232
-    function espresso_ticket_selector($event = null)
233
-    {
234
-        if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) {
235
-            espresso_load_ticket_selector();
236
-            EED_Ticket_Selector::set_definitions();
237
-            echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped
238
-        }
239
-    }
225
+	/**
226
+	 * espresso_ticket_selector
227
+	 *
228
+	 * @param null $event
229
+	 * @throws EE_Error
230
+	 * @throws ReflectionException
231
+	 */
232
+	function espresso_ticket_selector($event = null)
233
+	{
234
+		if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) {
235
+			espresso_load_ticket_selector();
236
+			EED_Ticket_Selector::set_definitions();
237
+			echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped
238
+		}
239
+	}
240 240
 }
241 241
 
242 242
 
243 243
 if (! function_exists('espresso_view_details_btn')) {
244
-    /**
245
-     * espresso_view_details_btn
246
-     *
247
-     * @param null $event
248
-     * @throws EE_Error
249
-     * @throws ReflectionException
250
-     */
251
-    function espresso_view_details_btn($event = null)
252
-    {
253
-        if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) {
254
-            espresso_load_ticket_selector();
255
-            echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped
256
-        }
257
-    }
244
+	/**
245
+	 * espresso_view_details_btn
246
+	 *
247
+	 * @param null $event
248
+	 * @throws EE_Error
249
+	 * @throws ReflectionException
250
+	 */
251
+	function espresso_view_details_btn($event = null)
252
+	{
253
+		if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) {
254
+			espresso_load_ticket_selector();
255
+			echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped
256
+		}
257
+	}
258 258
 }
259 259
 
260 260
 
261 261
 /*************************** EEH_Event_View ***************************/
262 262
 
263 263
 if (! function_exists('espresso_load_event_list_assets')) {
264
-    /**
265
-     * espresso_load_event_list_assets
266
-     * ensures that event list styles and scripts are loaded
267
-     *
268
-     * @return void
269
-     */
270
-    function espresso_load_event_list_assets()
271
-    {
272
-        $event_list = EED_Events_Archive::instance();
273
-        add_action('AHEE__EE_System__initialize_last', [$event_list, 'load_event_list_assets'], 10);
274
-        add_filter('FHEE_enable_default_espresso_css', '__return_true');
275
-    }
264
+	/**
265
+	 * espresso_load_event_list_assets
266
+	 * ensures that event list styles and scripts are loaded
267
+	 *
268
+	 * @return void
269
+	 */
270
+	function espresso_load_event_list_assets()
271
+	{
272
+		$event_list = EED_Events_Archive::instance();
273
+		add_action('AHEE__EE_System__initialize_last', [$event_list, 'load_event_list_assets'], 10);
274
+		add_filter('FHEE_enable_default_espresso_css', '__return_true');
275
+	}
276 276
 }
277 277
 
278 278
 
279 279
 if (! function_exists('espresso_event_reg_button')) {
280
-    /**
281
-     * espresso_event_reg_button
282
-     * returns the "Register Now" button if event is active,
283
-     * an inactive button like status banner if the event is not active
284
-     * or a "Read More" button if so desired
285
-     *
286
-     * @param null $btn_text_if_active
287
-     * @param bool $btn_text_if_inactive
288
-     * @param bool $EVT_ID
289
-     * @return void
290
-     * @throws EE_Error
291
-     * @throws ReflectionException
292
-     */
293
-    function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false)
294
-    {
295
-        $event = EEH_Event_View::get_event($EVT_ID);
296
-        if (! $event instanceof EE_Event) {
297
-            return;
298
-        }
299
-        $event_status = $event->get_active_status();
300
-        switch ($event_status) {
301
-            case EE_Datetime::sold_out :
302
-                $btn_text = __('Sold Out', 'event_espresso');
303
-                $class    = 'ee-pink';
304
-                break;
305
-            case EE_Datetime::expired :
306
-                $btn_text = __('Event is Over', 'event_espresso');
307
-                $class    = 'ee-grey';
308
-                break;
309
-            case EE_Datetime::inactive :
310
-                $btn_text = __('Event Not Active', 'event_espresso');
311
-                $class    = 'ee-grey';
312
-                break;
313
-            case EE_Datetime::cancelled :
314
-                $btn_text = __('Event was Cancelled', 'event_espresso');
315
-                $class    = 'ee-red';
316
-                break;
317
-            case EE_Datetime::upcoming :
318
-            case EE_Datetime::active :
319
-            default :
320
-                $btn_text = ! empty($btn_text_if_active)
321
-                    ? $btn_text_if_active
322
-                    : __('Register Now', 'event_espresso');
323
-                $class    = 'ee-green';
324
-        }
325
-        if ($event_status < 1 && ! empty($btn_text_if_inactive)) {
326
-            $btn_text = $btn_text_if_inactive;
327
-            $class    = 'ee-grey';
328
-        }
329
-        ?>
280
+	/**
281
+	 * espresso_event_reg_button
282
+	 * returns the "Register Now" button if event is active,
283
+	 * an inactive button like status banner if the event is not active
284
+	 * or a "Read More" button if so desired
285
+	 *
286
+	 * @param null $btn_text_if_active
287
+	 * @param bool $btn_text_if_inactive
288
+	 * @param bool $EVT_ID
289
+	 * @return void
290
+	 * @throws EE_Error
291
+	 * @throws ReflectionException
292
+	 */
293
+	function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false)
294
+	{
295
+		$event = EEH_Event_View::get_event($EVT_ID);
296
+		if (! $event instanceof EE_Event) {
297
+			return;
298
+		}
299
+		$event_status = $event->get_active_status();
300
+		switch ($event_status) {
301
+			case EE_Datetime::sold_out :
302
+				$btn_text = __('Sold Out', 'event_espresso');
303
+				$class    = 'ee-pink';
304
+				break;
305
+			case EE_Datetime::expired :
306
+				$btn_text = __('Event is Over', 'event_espresso');
307
+				$class    = 'ee-grey';
308
+				break;
309
+			case EE_Datetime::inactive :
310
+				$btn_text = __('Event Not Active', 'event_espresso');
311
+				$class    = 'ee-grey';
312
+				break;
313
+			case EE_Datetime::cancelled :
314
+				$btn_text = __('Event was Cancelled', 'event_espresso');
315
+				$class    = 'ee-red';
316
+				break;
317
+			case EE_Datetime::upcoming :
318
+			case EE_Datetime::active :
319
+			default :
320
+				$btn_text = ! empty($btn_text_if_active)
321
+					? $btn_text_if_active
322
+					: __('Register Now', 'event_espresso');
323
+				$class    = 'ee-green';
324
+		}
325
+		if ($event_status < 1 && ! empty($btn_text_if_inactive)) {
326
+			$btn_text = $btn_text_if_inactive;
327
+			$class    = 'ee-grey';
328
+		}
329
+		?>
330 330
         <a class="ee-button ee-register-button <?php echo esc_attr($class); ?>"
331 331
            href="<?php espresso_event_link_url($EVT_ID); ?>"
332 332
             <?php echo EED_Events_Archive::link_target(); // already escaped
333
-            ?>
333
+			?>
334 334
         >
335 335
             <?php echo esc_html($btn_text); ?>
336 336
         </a>
337 337
         <?php
338
-    }
338
+	}
339 339
 }
340 340
 
341 341
 
342 342
 if (! function_exists('espresso_display_ticket_selector')) {
343
-    /**
344
-     * espresso_display_ticket_selector
345
-     * whether or not to display the Ticket Selector for an event
346
-     *
347
-     * @param bool $EVT_ID
348
-     * @return boolean
349
-     * @throws EE_Error
350
-     * @throws ReflectionException
351
-     */
352
-    function espresso_display_ticket_selector($EVT_ID = false)
353
-    {
354
-        return EEH_Event_View::display_ticket_selector($EVT_ID);
355
-    }
343
+	/**
344
+	 * espresso_display_ticket_selector
345
+	 * whether or not to display the Ticket Selector for an event
346
+	 *
347
+	 * @param bool $EVT_ID
348
+	 * @return boolean
349
+	 * @throws EE_Error
350
+	 * @throws ReflectionException
351
+	 */
352
+	function espresso_display_ticket_selector($EVT_ID = false)
353
+	{
354
+		return EEH_Event_View::display_ticket_selector($EVT_ID);
355
+	}
356 356
 }
357 357
 
358 358
 
359 359
 if (! function_exists('espresso_event_status_banner')) {
360
-    /**
361
-     * espresso_event_status
362
-     * returns a banner showing the event status if it is sold out, expired, or inactive
363
-     *
364
-     * @param bool $EVT_ID
365
-     * @return string
366
-     * @throws EE_Error
367
-     * @throws ReflectionException
368
-     */
369
-    function espresso_event_status_banner($EVT_ID = false)
370
-    {
371
-        return EEH_Event_View::event_status($EVT_ID);
372
-    }
360
+	/**
361
+	 * espresso_event_status
362
+	 * returns a banner showing the event status if it is sold out, expired, or inactive
363
+	 *
364
+	 * @param bool $EVT_ID
365
+	 * @return string
366
+	 * @throws EE_Error
367
+	 * @throws ReflectionException
368
+	 */
369
+	function espresso_event_status_banner($EVT_ID = false)
370
+	{
371
+		return EEH_Event_View::event_status($EVT_ID);
372
+	}
373 373
 }
374 374
 
375 375
 
376 376
 if (! function_exists('espresso_event_status')) {
377
-    /**
378
-     * espresso_event_status
379
-     * returns the event status if it is sold out, expired, or inactive
380
-     *
381
-     * @param int  $EVT_ID
382
-     * @param bool $echo
383
-     * @return string
384
-     * @throws EE_Error
385
-     * @throws ReflectionException
386
-     */
387
-    function espresso_event_status($EVT_ID = 0, $echo = true)
388
-    {
389
-        return EEH_Event_View::event_active_status($EVT_ID, $echo);
390
-    }
377
+	/**
378
+	 * espresso_event_status
379
+	 * returns the event status if it is sold out, expired, or inactive
380
+	 *
381
+	 * @param int  $EVT_ID
382
+	 * @param bool $echo
383
+	 * @return string
384
+	 * @throws EE_Error
385
+	 * @throws ReflectionException
386
+	 */
387
+	function espresso_event_status($EVT_ID = 0, $echo = true)
388
+	{
389
+		return EEH_Event_View::event_active_status($EVT_ID, $echo);
390
+	}
391 391
 }
392 392
 
393 393
 
394 394
 if (! function_exists('espresso_event_categories')) {
395
-    /**
396
-     * espresso_event_categories
397
-     * returns the terms associated with an event
398
-     *
399
-     * @param int  $EVT_ID
400
-     * @param bool $hide_uncategorized
401
-     * @param bool $echo
402
-     * @return string
403
-     * @throws EE_Error
404
-     * @throws ReflectionException
405
-     */
406
-    function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = true, $echo = true)
407
-    {
408
-        if ($echo) {
409
-            echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); // already escaped
410
-            return '';
411
-        }
412
-        return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized);
413
-    }
395
+	/**
396
+	 * espresso_event_categories
397
+	 * returns the terms associated with an event
398
+	 *
399
+	 * @param int  $EVT_ID
400
+	 * @param bool $hide_uncategorized
401
+	 * @param bool $echo
402
+	 * @return string
403
+	 * @throws EE_Error
404
+	 * @throws ReflectionException
405
+	 */
406
+	function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = true, $echo = true)
407
+	{
408
+		if ($echo) {
409
+			echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); // already escaped
410
+			return '';
411
+		}
412
+		return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized);
413
+	}
414 414
 }
415 415
 
416 416
 
417 417
 if (! function_exists('espresso_event_tickets_available')) {
418
-    /**
419
-     * espresso_event_tickets_available
420
-     * returns the ticket types available for purchase for an event
421
-     *
422
-     * @param int  $EVT_ID
423
-     * @param bool $echo
424
-     * @param bool $format
425
-     * @return string
426
-     * @throws EE_Error
427
-     * @throws ReflectionException
428
-     */
429
-    function espresso_event_tickets_available($EVT_ID = 0, $echo = true, $format = true)
430
-    {
431
-        $tickets = EEH_Event_View::event_tickets_available($EVT_ID);
432
-        if (is_array($tickets) && ! empty($tickets)) {
433
-            // if formatting then $html will be a string, else it will be an array of ticket objects
434
-            $html =
435
-                $format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : [];
436
-            foreach ($tickets as $ticket) {
437
-                if ($ticket instanceof EE_Ticket) {
438
-                    if ($format) {
439
-                        $html .= '<li id="ee-event-tickets-li-'
440
-                                 . esc_attr($ticket->ID())
441
-                                 . '" class="ee-event-tickets-li">';
442
-                        $html .= esc_html($ticket->name()) . ' ';
443
-                        $html .= EEH_Template::format_currency(
444
-                            $ticket->get_ticket_total_with_taxes()
445
-                        ); // already escaped
446
-                        $html .= '</li>';
447
-                    } else {
448
-                        $html[] = $ticket;
449
-                    }
450
-                }
451
-            }
452
-            if ($format) {
453
-                $html .= '</ul>';
454
-            }
455
-            if ($echo && $format) {
456
-                echo wp_kses($html, AllowedTags::getAllowedTags());
457
-                return '';
458
-            }
459
-            return $html;
460
-        }
461
-        return '';
462
-    }
418
+	/**
419
+	 * espresso_event_tickets_available
420
+	 * returns the ticket types available for purchase for an event
421
+	 *
422
+	 * @param int  $EVT_ID
423
+	 * @param bool $echo
424
+	 * @param bool $format
425
+	 * @return string
426
+	 * @throws EE_Error
427
+	 * @throws ReflectionException
428
+	 */
429
+	function espresso_event_tickets_available($EVT_ID = 0, $echo = true, $format = true)
430
+	{
431
+		$tickets = EEH_Event_View::event_tickets_available($EVT_ID);
432
+		if (is_array($tickets) && ! empty($tickets)) {
433
+			// if formatting then $html will be a string, else it will be an array of ticket objects
434
+			$html =
435
+				$format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : [];
436
+			foreach ($tickets as $ticket) {
437
+				if ($ticket instanceof EE_Ticket) {
438
+					if ($format) {
439
+						$html .= '<li id="ee-event-tickets-li-'
440
+								 . esc_attr($ticket->ID())
441
+								 . '" class="ee-event-tickets-li">';
442
+						$html .= esc_html($ticket->name()) . ' ';
443
+						$html .= EEH_Template::format_currency(
444
+							$ticket->get_ticket_total_with_taxes()
445
+						); // already escaped
446
+						$html .= '</li>';
447
+					} else {
448
+						$html[] = $ticket;
449
+					}
450
+				}
451
+			}
452
+			if ($format) {
453
+				$html .= '</ul>';
454
+			}
455
+			if ($echo && $format) {
456
+				echo wp_kses($html, AllowedTags::getAllowedTags());
457
+				return '';
458
+			}
459
+			return $html;
460
+		}
461
+		return '';
462
+	}
463 463
 }
464 464
 
465 465
 if (! function_exists('espresso_event_date_obj')) {
466
-    /**
467
-     * espresso_event_date_obj
468
-     * returns the primary date object for an event
469
-     *
470
-     * @param bool $EVT_ID
471
-     * @return EE_Datetime|null
472
-     * @throws EE_Error
473
-     * @throws ReflectionException
474
-     */
475
-    function espresso_event_date_obj($EVT_ID = false)
476
-    {
477
-        return EEH_Event_View::get_primary_date_obj($EVT_ID);
478
-    }
466
+	/**
467
+	 * espresso_event_date_obj
468
+	 * returns the primary date object for an event
469
+	 *
470
+	 * @param bool $EVT_ID
471
+	 * @return EE_Datetime|null
472
+	 * @throws EE_Error
473
+	 * @throws ReflectionException
474
+	 */
475
+	function espresso_event_date_obj($EVT_ID = false)
476
+	{
477
+		return EEH_Event_View::get_primary_date_obj($EVT_ID);
478
+	}
479 479
 }
480 480
 
481 481
 
482 482
 if (! function_exists('espresso_event_date')) {
483
-    /**
484
-     * espresso_event_date
485
-     * returns the primary date for an event
486
-     *
487
-     * @param string $date_format
488
-     * @param string $time_format
489
-     * @param bool   $EVT_ID
490
-     * @param bool   $echo
491
-     * @return string
492
-     * @throws EE_Error
493
-     * @throws ReflectionException
494
-     */
495
-    function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true)
496
-    {
497
-        $date_format = ! empty($date_format) ? $date_format : get_option('date_format');
498
-        $time_format = ! empty($time_format) ? $time_format : get_option('time_format');
499
-        $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format);
500
-        $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format);
501
-        if ($echo) {
502
-            echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); // already escaped
503
-            return '';
504
-        }
505
-        return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID);
506
-
507
-    }
483
+	/**
484
+	 * espresso_event_date
485
+	 * returns the primary date for an event
486
+	 *
487
+	 * @param string $date_format
488
+	 * @param string $time_format
489
+	 * @param bool   $EVT_ID
490
+	 * @param bool   $echo
491
+	 * @return string
492
+	 * @throws EE_Error
493
+	 * @throws ReflectionException
494
+	 */
495
+	function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true)
496
+	{
497
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
498
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
499
+		$date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format);
500
+		$time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format);
501
+		if ($echo) {
502
+			echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); // already escaped
503
+			return '';
504
+		}
505
+		return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID);
506
+
507
+	}
508 508
 }
509 509
 
510 510
 
511 511
 if (! function_exists('espresso_list_of_event_dates')) {
512
-    /**
513
-     * espresso_list_of_event_dates
514
-     * returns a unordered list of dates for an event
515
-     *
516
-     * @param int    $EVT_ID
517
-     * @param string $date_format
518
-     * @param string $time_format
519
-     * @param bool   $echo
520
-     * @param null   $show_expired
521
-     * @param bool   $format
522
-     * @param bool   $add_breaks
523
-     * @param null   $limit
524
-     * @return string
525
-     * @throws EE_Error
526
-     * @throws ReflectionException
527
-     */
528
-    function espresso_list_of_event_dates(
529
-        $EVT_ID = 0,
530
-        $date_format = '',
531
-        $time_format = '',
532
-        $echo = true,
533
-        $show_expired = null,
534
-        $format = true,
535
-        $add_breaks = true,
536
-        $limit = null
537
-    ) {
538
-        $allowedtags = AllowedTags::getAllowedTags();
539
-        $date_format = ! empty($date_format) ? $date_format : get_option('date_format');
540
-        $time_format = ! empty($time_format) ? $time_format : get_option('time_format');
541
-        $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format);
542
-        $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format);
543
-        $datetimes   = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, $limit);
544
-        if (! $format) {
545
-            return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes);
546
-        }
547
-        $newline = $add_breaks ? '<br />' : '';
548
-        if (is_array($datetimes) && ! empty($datetimes)) {
549
-            global $post;
550
-            $html =
551
-                '<ul id="ee-event-datetimes-ul-' . esc_attr($post->ID) . '" class="ee-event-datetimes-ul ee-clearfix">';
552
-            foreach ($datetimes as $datetime) {
553
-                if ($datetime instanceof EE_Datetime) {
554
-
555
-                    $datetime_name        = $datetime->name();
556
-                    $datetime_html        = ! empty($datetime_name)
557
-                        ? '
512
+	/**
513
+	 * espresso_list_of_event_dates
514
+	 * returns a unordered list of dates for an event
515
+	 *
516
+	 * @param int    $EVT_ID
517
+	 * @param string $date_format
518
+	 * @param string $time_format
519
+	 * @param bool   $echo
520
+	 * @param null   $show_expired
521
+	 * @param bool   $format
522
+	 * @param bool   $add_breaks
523
+	 * @param null   $limit
524
+	 * @return string
525
+	 * @throws EE_Error
526
+	 * @throws ReflectionException
527
+	 */
528
+	function espresso_list_of_event_dates(
529
+		$EVT_ID = 0,
530
+		$date_format = '',
531
+		$time_format = '',
532
+		$echo = true,
533
+		$show_expired = null,
534
+		$format = true,
535
+		$add_breaks = true,
536
+		$limit = null
537
+	) {
538
+		$allowedtags = AllowedTags::getAllowedTags();
539
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
540
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
541
+		$date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format);
542
+		$time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format);
543
+		$datetimes   = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, $limit);
544
+		if (! $format) {
545
+			return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes);
546
+		}
547
+		$newline = $add_breaks ? '<br />' : '';
548
+		if (is_array($datetimes) && ! empty($datetimes)) {
549
+			global $post;
550
+			$html =
551
+				'<ul id="ee-event-datetimes-ul-' . esc_attr($post->ID) . '" class="ee-event-datetimes-ul ee-clearfix">';
552
+			foreach ($datetimes as $datetime) {
553
+				if ($datetime instanceof EE_Datetime) {
554
+
555
+					$datetime_name        = $datetime->name();
556
+					$datetime_html        = ! empty($datetime_name)
557
+						? '
558 558
                         <strong class="ee-event-datetimes-li-date-name">
559 559
                           ' . esc_html($datetime_name) . '
560 560
                        </strong>' . $newline
561
-                        : '';
561
+						: '';
562 562
 
563
-                    $datetime_description = $datetime->description();
564
-                    $datetime_html .= ! empty($datetime_description)
565
-                        ? '
563
+					$datetime_description = $datetime->description();
564
+					$datetime_html .= ! empty($datetime_description)
565
+						? '
566 566
                         <span class="ee-event-datetimes-li-date-desc">
567 567
                             ' . wp_kses($datetime_description, $allowedtags) . '
568 568
                         </span>' . $newline
569
-                        : '';
569
+						: '';
570 570
 
571
-                    $datetime_html .= '
571
+					$datetime_html .= '
572 572
                         <span class="dashicons dashicons-calendar"></span>
573 573
                         <span class="ee-event-datetimes-li-daterange">' . $datetime->date_range($date_format) . '</span>
574 574
                         <br/>
@@ -576,482 +576,482 @@  discard block
 block discarded – undo
576 576
                         <span class="ee-event-datetimes-li-timerange">' . $datetime->time_range($time_format) . '</span>
577 577
                         ';
578 578
 
579
-                    $datetime_html = apply_filters(
580
-                        'FHEE__espresso_list_of_event_dates__datetime_html',
581
-                        $datetime_html,
582
-                        $datetime
583
-                    );
579
+					$datetime_html = apply_filters(
580
+						'FHEE__espresso_list_of_event_dates__datetime_html',
581
+						$datetime_html,
582
+						$datetime
583
+					);
584 584
 
585
-                    $DTD_ID        = esc_attr($datetime->ID());
586
-                    $active_status = esc_attr(' ee-event-datetimes-li-' . $datetime->get_active_status());
585
+					$DTD_ID        = esc_attr($datetime->ID());
586
+					$active_status = esc_attr(' ee-event-datetimes-li-' . $datetime->get_active_status());
587 587
 
588
-                    $html .= '
588
+					$html .= '
589 589
                     <li id="ee-event-datetimes-li-' . $DTD_ID . '" class="ee-event-datetimes-li' . $active_status . '">
590 590
                         ' . $datetime_html . '
591 591
                     </li>';
592
-                }
593
-            }
594
-            $html .= '</ul>';
595
-        } else {
596
-            $html =
597
-                '
592
+				}
593
+			}
594
+			$html .= '</ul>';
595
+		} else {
596
+			$html =
597
+				'
598 598
             <p>
599 599
                 <span class="dashicons dashicons-marker pink-text"></span>
600 600
                 ' . esc_html__(
601
-                    'There are no upcoming dates for this event.',
602
-                    'event_espresso'
603
-                ) . '
601
+					'There are no upcoming dates for this event.',
602
+					'event_espresso'
603
+				) . '
604 604
             </p>
605 605
             <br/>';
606
-        }
607
-        if ($echo) {
608
-            echo wp_kses($html, AllowedTags::getAllowedTags());
609
-            return '';
610
-        }
611
-        return $html;
612
-    }
606
+		}
607
+		if ($echo) {
608
+			echo wp_kses($html, AllowedTags::getAllowedTags());
609
+			return '';
610
+		}
611
+		return $html;
612
+	}
613 613
 }
614 614
 
615 615
 
616 616
 if (! function_exists('espresso_event_end_date')) {
617
-    /**
618
-     * espresso_event_end_date
619
-     * returns the last date for an event
620
-     *
621
-     * @param string $date_format
622
-     * @param string $time_format
623
-     * @param bool   $EVT_ID
624
-     * @param bool   $echo
625
-     * @return string
626
-     * @throws EE_Error
627
-     * @throws ReflectionException
628
-     */
629
-    function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true)
630
-    {
631
-        $date_format = ! empty($date_format) ? $date_format : get_option('date_format');
632
-        $time_format = ! empty($time_format) ? $time_format : get_option('time_format');
633
-        $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format);
634
-        $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format);
635
-        if ($echo) {
636
-            echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); // already escaped
637
-            return '';
638
-        }
639
-        return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID);
640
-    }
617
+	/**
618
+	 * espresso_event_end_date
619
+	 * returns the last date for an event
620
+	 *
621
+	 * @param string $date_format
622
+	 * @param string $time_format
623
+	 * @param bool   $EVT_ID
624
+	 * @param bool   $echo
625
+	 * @return string
626
+	 * @throws EE_Error
627
+	 * @throws ReflectionException
628
+	 */
629
+	function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true)
630
+	{
631
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
632
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
633
+		$date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format);
634
+		$time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format);
635
+		if ($echo) {
636
+			echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); // already escaped
637
+			return '';
638
+		}
639
+		return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID);
640
+	}
641 641
 }
642 642
 
643 643
 if (! function_exists('espresso_event_date_range')) {
644
-    /**
645
-     * espresso_event_date_range
646
-     * returns the first and last chronologically ordered dates for an event (if different)
647
-     *
648
-     * @param string $date_format
649
-     * @param string $time_format
650
-     * @param string $single_date_format
651
-     * @param string $single_time_format
652
-     * @param bool   $EVT_ID
653
-     * @param bool   $echo
654
-     * @return string
655
-     * @throws EE_Error
656
-     * @throws ReflectionException
657
-     */
658
-    function espresso_event_date_range(
659
-        $date_format = '',
660
-        $time_format = '',
661
-        $single_date_format = '',
662
-        $single_time_format = '',
663
-        $EVT_ID = false,
664
-        $echo = true
665
-    ) {
666
-        // set and filter date and time formats when a range is returned
667
-        $date_format = ! empty($date_format) ? $date_format : get_option('date_format');
668
-        $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format);
669
-        // get the start and end date with NO time portion
670
-        $the_event_date     = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID);
671
-        $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID);
672
-        // now we can determine if date range spans more than one day
673
-        if ($the_event_date != $the_event_end_date) {
674
-            $time_format = ! empty($time_format) ? $time_format : get_option('time_format');
675
-            $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format);
676
-            $html        = sprintf(
677
-            /* translators: 1: first event date, 2: last event date */
678
-                esc_html__('%1$s - %2$s', 'event_espresso'),
679
-                EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID),
680
-                EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID)
681
-            );
682
-        } else {
683
-            // set and filter date and time formats when only a single datetime is returned
684
-            $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format');
685
-            $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format');
686
-            $single_date_format =
687
-                apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format);
688
-            $single_time_format =
689
-                apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format);
690
-            $html               =
691
-                EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID);
692
-        }
693
-        if ($echo) {
694
-            echo wp_kses($html, AllowedTags::getAllowedTags());
695
-            return '';
696
-        }
697
-        return $html;
698
-    }
644
+	/**
645
+	 * espresso_event_date_range
646
+	 * returns the first and last chronologically ordered dates for an event (if different)
647
+	 *
648
+	 * @param string $date_format
649
+	 * @param string $time_format
650
+	 * @param string $single_date_format
651
+	 * @param string $single_time_format
652
+	 * @param bool   $EVT_ID
653
+	 * @param bool   $echo
654
+	 * @return string
655
+	 * @throws EE_Error
656
+	 * @throws ReflectionException
657
+	 */
658
+	function espresso_event_date_range(
659
+		$date_format = '',
660
+		$time_format = '',
661
+		$single_date_format = '',
662
+		$single_time_format = '',
663
+		$EVT_ID = false,
664
+		$echo = true
665
+	) {
666
+		// set and filter date and time formats when a range is returned
667
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
668
+		$date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format);
669
+		// get the start and end date with NO time portion
670
+		$the_event_date     = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID);
671
+		$the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID);
672
+		// now we can determine if date range spans more than one day
673
+		if ($the_event_date != $the_event_end_date) {
674
+			$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
675
+			$time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format);
676
+			$html        = sprintf(
677
+			/* translators: 1: first event date, 2: last event date */
678
+				esc_html__('%1$s - %2$s', 'event_espresso'),
679
+				EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID),
680
+				EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID)
681
+			);
682
+		} else {
683
+			// set and filter date and time formats when only a single datetime is returned
684
+			$single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format');
685
+			$single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format');
686
+			$single_date_format =
687
+				apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format);
688
+			$single_time_format =
689
+				apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format);
690
+			$html               =
691
+				EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID);
692
+		}
693
+		if ($echo) {
694
+			echo wp_kses($html, AllowedTags::getAllowedTags());
695
+			return '';
696
+		}
697
+		return $html;
698
+	}
699 699
 }
700 700
 
701 701
 if (! function_exists('espresso_next_upcoming_datetime_obj')) {
702
-    /**
703
-     * espresso_next_upcoming_datetime_obj
704
-     * returns the next upcoming datetime object for an event
705
-     *
706
-     * @param int $EVT_ID
707
-     * @return EE_Datetime|null
708
-     * @throws EE_Error
709
-     */
710
-    function espresso_next_upcoming_datetime_obj($EVT_ID = 0)
711
-    {
712
-        return EEH_Event_View::get_next_upcoming_date_obj($EVT_ID);
713
-    }
702
+	/**
703
+	 * espresso_next_upcoming_datetime_obj
704
+	 * returns the next upcoming datetime object for an event
705
+	 *
706
+	 * @param int $EVT_ID
707
+	 * @return EE_Datetime|null
708
+	 * @throws EE_Error
709
+	 */
710
+	function espresso_next_upcoming_datetime_obj($EVT_ID = 0)
711
+	{
712
+		return EEH_Event_View::get_next_upcoming_date_obj($EVT_ID);
713
+	}
714 714
 }
715 715
 
716 716
 if (! function_exists('espresso_next_upcoming_datetime')) {
717
-    /**
718
-     * espresso_next_upcoming_datetime
719
-     * returns the start date and time for the next upcoming event.
720
-     *
721
-     * @param string $date_format
722
-     * @param string $time_format
723
-     * @param int    $EVT_ID
724
-     * @param bool   $echo
725
-     * @return string
726
-     * @throws EE_Error
727
-     * @throws ReflectionException
728
-     */
729
-    function espresso_next_upcoming_datetime($date_format = '', $time_format = '', $EVT_ID = 0, $echo = true)
730
-    {
731
-
732
-        $date_format = ! empty($date_format) ? $date_format : get_option('date_format');
733
-        $date_format = apply_filters('FHEE__espresso_next_upcoming_datetime__date_format', $date_format);
734
-
735
-        $time_format = ! empty($time_format) ? $time_format : get_option('time_format');
736
-        $time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format);
737
-
738
-        $datetime_format = trim($date_format . ' ' . $time_format);
739
-
740
-        $datetime = espresso_next_upcoming_datetime_obj($EVT_ID);
741
-
742
-        if (! $datetime instanceof EE_Datetime) {
743
-            return '';
744
-        }
745
-        if ($echo) {
746
-            echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format));
747
-            return '';
748
-        }
749
-        return $datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format);
750
-    }
717
+	/**
718
+	 * espresso_next_upcoming_datetime
719
+	 * returns the start date and time for the next upcoming event.
720
+	 *
721
+	 * @param string $date_format
722
+	 * @param string $time_format
723
+	 * @param int    $EVT_ID
724
+	 * @param bool   $echo
725
+	 * @return string
726
+	 * @throws EE_Error
727
+	 * @throws ReflectionException
728
+	 */
729
+	function espresso_next_upcoming_datetime($date_format = '', $time_format = '', $EVT_ID = 0, $echo = true)
730
+	{
731
+
732
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
733
+		$date_format = apply_filters('FHEE__espresso_next_upcoming_datetime__date_format', $date_format);
734
+
735
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
736
+		$time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format);
737
+
738
+		$datetime_format = trim($date_format . ' ' . $time_format);
739
+
740
+		$datetime = espresso_next_upcoming_datetime_obj($EVT_ID);
741
+
742
+		if (! $datetime instanceof EE_Datetime) {
743
+			return '';
744
+		}
745
+		if ($echo) {
746
+			echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format));
747
+			return '';
748
+		}
749
+		return $datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format);
750
+	}
751 751
 }
752 752
 
753 753
 if (! function_exists('espresso_event_date_as_calendar_page')) {
754
-    /**
755
-     * espresso_event_date_as_calendar_page
756
-     * returns the primary date for an event, stylized to appear as the page of a calendar
757
-     *
758
-     * @param bool $EVT_ID
759
-     * @return void
760
-     * @throws EE_Error
761
-     * @throws ReflectionException
762
-     */
763
-    function espresso_event_date_as_calendar_page($EVT_ID = false)
764
-    {
765
-        EEH_Event_View::event_date_as_calendar_page($EVT_ID);
766
-    }
754
+	/**
755
+	 * espresso_event_date_as_calendar_page
756
+	 * returns the primary date for an event, stylized to appear as the page of a calendar
757
+	 *
758
+	 * @param bool $EVT_ID
759
+	 * @return void
760
+	 * @throws EE_Error
761
+	 * @throws ReflectionException
762
+	 */
763
+	function espresso_event_date_as_calendar_page($EVT_ID = false)
764
+	{
765
+		EEH_Event_View::event_date_as_calendar_page($EVT_ID);
766
+	}
767 767
 }
768 768
 
769 769
 
770 770
 if (! function_exists('espresso_event_link_url')) {
771
-    /**
772
-     * espresso_event_link_url
773
-     *
774
-     * @param int  $EVT_ID
775
-     * @param bool $echo
776
-     * @return string
777
-     * @throws EE_Error
778
-     * @throws ReflectionException
779
-     */
780
-    function espresso_event_link_url($EVT_ID = 0, $echo = true)
781
-    {
782
-        if ($echo) {
783
-            echo EEH_Event_View::event_link_url($EVT_ID); // already escaped
784
-            return '';
785
-        }
786
-        return EEH_Event_View::event_link_url($EVT_ID);
787
-    }
771
+	/**
772
+	 * espresso_event_link_url
773
+	 *
774
+	 * @param int  $EVT_ID
775
+	 * @param bool $echo
776
+	 * @return string
777
+	 * @throws EE_Error
778
+	 * @throws ReflectionException
779
+	 */
780
+	function espresso_event_link_url($EVT_ID = 0, $echo = true)
781
+	{
782
+		if ($echo) {
783
+			echo EEH_Event_View::event_link_url($EVT_ID); // already escaped
784
+			return '';
785
+		}
786
+		return EEH_Event_View::event_link_url($EVT_ID);
787
+	}
788 788
 }
789 789
 
790 790
 
791 791
 if (! function_exists('espresso_event_has_content_or_excerpt')) {
792
-    /**
793
-     *    espresso_event_has_content_or_excerpt
794
-     *
795
-     * @access    public
796
-     * @param bool $EVT_ID
797
-     * @return    boolean
798
-     * @throws EE_Error
799
-     * @throws ReflectionException
800
-     */
801
-    function espresso_event_has_content_or_excerpt($EVT_ID = false)
802
-    {
803
-        return EEH_Event_View::event_has_content_or_excerpt($EVT_ID);
804
-    }
792
+	/**
793
+	 *    espresso_event_has_content_or_excerpt
794
+	 *
795
+	 * @access    public
796
+	 * @param bool $EVT_ID
797
+	 * @return    boolean
798
+	 * @throws EE_Error
799
+	 * @throws ReflectionException
800
+	 */
801
+	function espresso_event_has_content_or_excerpt($EVT_ID = false)
802
+	{
803
+		return EEH_Event_View::event_has_content_or_excerpt($EVT_ID);
804
+	}
805 805
 }
806 806
 
807 807
 
808 808
 if (! function_exists('espresso_event_content_or_excerpt')) {
809
-    /**
810
-     * espresso_event_content_or_excerpt
811
-     *
812
-     * @param int  $num_words
813
-     * @param null $more
814
-     * @param bool $echo
815
-     * @return string
816
-     */
817
-    function espresso_event_content_or_excerpt($num_words = 55, $more = null, $echo = true)
818
-    {
819
-        if ($echo) {
820
-            echo EEH_Event_View::event_content_or_excerpt($num_words, $more); // already escaped
821
-            return '';
822
-        }
823
-        return EEH_Event_View::event_content_or_excerpt($num_words, $more);
824
-    }
809
+	/**
810
+	 * espresso_event_content_or_excerpt
811
+	 *
812
+	 * @param int  $num_words
813
+	 * @param null $more
814
+	 * @param bool $echo
815
+	 * @return string
816
+	 */
817
+	function espresso_event_content_or_excerpt($num_words = 55, $more = null, $echo = true)
818
+	{
819
+		if ($echo) {
820
+			echo EEH_Event_View::event_content_or_excerpt($num_words, $more); // already escaped
821
+			return '';
822
+		}
823
+		return EEH_Event_View::event_content_or_excerpt($num_words, $more);
824
+	}
825 825
 }
826 826
 
827 827
 
828 828
 if (! function_exists('espresso_event_phone')) {
829
-    /**
830
-     * espresso_event_phone
831
-     *
832
-     * @param int  $EVT_ID
833
-     * @param bool $echo
834
-     * @return string
835
-     * @throws EE_Error
836
-     * @throws ReflectionException
837
-     */
838
-    function espresso_event_phone($EVT_ID = 0, $echo = true)
839
-    {
840
-        if ($echo) {
841
-            echo EEH_Event_View::event_phone($EVT_ID); // already escaped
842
-            return '';
843
-        }
844
-        return EEH_Event_View::event_phone($EVT_ID);
845
-    }
829
+	/**
830
+	 * espresso_event_phone
831
+	 *
832
+	 * @param int  $EVT_ID
833
+	 * @param bool $echo
834
+	 * @return string
835
+	 * @throws EE_Error
836
+	 * @throws ReflectionException
837
+	 */
838
+	function espresso_event_phone($EVT_ID = 0, $echo = true)
839
+	{
840
+		if ($echo) {
841
+			echo EEH_Event_View::event_phone($EVT_ID); // already escaped
842
+			return '';
843
+		}
844
+		return EEH_Event_View::event_phone($EVT_ID);
845
+	}
846 846
 }
847 847
 
848 848
 
849 849
 if (! function_exists('espresso_edit_event_link')) {
850
-    /**
851
-     * espresso_edit_event_link
852
-     * returns a link to edit an event
853
-     *
854
-     * @param int  $EVT_ID
855
-     * @param bool $echo
856
-     * @return string
857
-     * @throws EE_Error
858
-     * @throws ReflectionException
859
-     */
860
-    function espresso_edit_event_link($EVT_ID = 0, $echo = true)
861
-    {
862
-        if ($echo) {
863
-            echo EEH_Event_View::edit_event_link($EVT_ID); // already escaped
864
-            return '';
865
-        }
866
-        return EEH_Event_View::edit_event_link($EVT_ID);
867
-    }
850
+	/**
851
+	 * espresso_edit_event_link
852
+	 * returns a link to edit an event
853
+	 *
854
+	 * @param int  $EVT_ID
855
+	 * @param bool $echo
856
+	 * @return string
857
+	 * @throws EE_Error
858
+	 * @throws ReflectionException
859
+	 */
860
+	function espresso_edit_event_link($EVT_ID = 0, $echo = true)
861
+	{
862
+		if ($echo) {
863
+			echo EEH_Event_View::edit_event_link($EVT_ID); // already escaped
864
+			return '';
865
+		}
866
+		return EEH_Event_View::edit_event_link($EVT_ID);
867
+	}
868 868
 }
869 869
 
870 870
 
871 871
 if (! function_exists('espresso_organization_name')) {
872
-    /**
873
-     * espresso_organization_name
874
-     *
875
-     * @param bool $echo
876
-     * @return string
877
-     * @throws EE_Error
878
-     */
879
-    function espresso_organization_name($echo = true)
880
-    {
881
-        if ($echo) {
882
-            echo EE_Registry::instance()->CFG->organization->get_pretty('name'); // already escaped
883
-            return '';
884
-        }
885
-        return EE_Registry::instance()->CFG->organization->get_pretty('name');
886
-    }
872
+	/**
873
+	 * espresso_organization_name
874
+	 *
875
+	 * @param bool $echo
876
+	 * @return string
877
+	 * @throws EE_Error
878
+	 */
879
+	function espresso_organization_name($echo = true)
880
+	{
881
+		if ($echo) {
882
+			echo EE_Registry::instance()->CFG->organization->get_pretty('name'); // already escaped
883
+			return '';
884
+		}
885
+		return EE_Registry::instance()->CFG->organization->get_pretty('name');
886
+	}
887 887
 }
888 888
 
889 889
 if (! function_exists('espresso_organization_address')) {
890
-    /**
891
-     * espresso_organization_address
892
-     *
893
-     * @param string $type
894
-     * @return string
895
-     */
896
-    function espresso_organization_address($type = 'inline')
897
-    {
898
-        if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) {
899
-            $address = new EventEspresso\core\domain\entities\GenericAddress(
900
-                EE_Registry::instance()->CFG->organization->address_1,
901
-                EE_Registry::instance()->CFG->organization->address_2,
902
-                EE_Registry::instance()->CFG->organization->city,
903
-                EE_Registry::instance()->CFG->organization->STA_ID,
904
-                EE_Registry::instance()->CFG->organization->zip,
905
-                EE_Registry::instance()->CFG->organization->CNT_ISO
906
-            );
907
-            return EEH_Address::format($address, $type);
908
-        }
909
-        return '';
910
-    }
890
+	/**
891
+	 * espresso_organization_address
892
+	 *
893
+	 * @param string $type
894
+	 * @return string
895
+	 */
896
+	function espresso_organization_address($type = 'inline')
897
+	{
898
+		if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) {
899
+			$address = new EventEspresso\core\domain\entities\GenericAddress(
900
+				EE_Registry::instance()->CFG->organization->address_1,
901
+				EE_Registry::instance()->CFG->organization->address_2,
902
+				EE_Registry::instance()->CFG->organization->city,
903
+				EE_Registry::instance()->CFG->organization->STA_ID,
904
+				EE_Registry::instance()->CFG->organization->zip,
905
+				EE_Registry::instance()->CFG->organization->CNT_ISO
906
+			);
907
+			return EEH_Address::format($address, $type);
908
+		}
909
+		return '';
910
+	}
911 911
 }
912 912
 
913 913
 if (! function_exists('espresso_organization_email')) {
914
-    /**
915
-     * espresso_organization_email
916
-     *
917
-     * @param bool $echo
918
-     * @return string
919
-     * @throws EE_Error
920
-     */
921
-    function espresso_organization_email($echo = true)
922
-    {
923
-        if ($echo) {
924
-            echo EE_Registry::instance()->CFG->organization->get_pretty('email'); // already escaped
925
-            return '';
926
-        }
927
-        return EE_Registry::instance()->CFG->organization->get_pretty('email');
928
-    }
914
+	/**
915
+	 * espresso_organization_email
916
+	 *
917
+	 * @param bool $echo
918
+	 * @return string
919
+	 * @throws EE_Error
920
+	 */
921
+	function espresso_organization_email($echo = true)
922
+	{
923
+		if ($echo) {
924
+			echo EE_Registry::instance()->CFG->organization->get_pretty('email'); // already escaped
925
+			return '';
926
+		}
927
+		return EE_Registry::instance()->CFG->organization->get_pretty('email');
928
+	}
929 929
 }
930 930
 
931 931
 if (! function_exists('espresso_organization_logo_url')) {
932
-    /**
933
-     * espresso_organization_logo_url
934
-     *
935
-     * @param bool $echo
936
-     * @return string
937
-     * @throws EE_Error
938
-     */
939
-    function espresso_organization_logo_url($echo = true)
940
-    {
941
-        if ($echo) {
942
-            echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); // already escaped
943
-            return '';
944
-        }
945
-        return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
946
-    }
932
+	/**
933
+	 * espresso_organization_logo_url
934
+	 *
935
+	 * @param bool $echo
936
+	 * @return string
937
+	 * @throws EE_Error
938
+	 */
939
+	function espresso_organization_logo_url($echo = true)
940
+	{
941
+		if ($echo) {
942
+			echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); // already escaped
943
+			return '';
944
+		}
945
+		return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
946
+	}
947 947
 }
948 948
 
949 949
 if (! function_exists('espresso_organization_facebook')) {
950
-    /**
951
-     * espresso_organization_facebook
952
-     *
953
-     * @param bool $echo
954
-     * @return string
955
-     * @throws EE_Error
956
-     */
957
-    function espresso_organization_facebook($echo = true)
958
-    {
959
-        if ($echo) {
960
-            echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); // already escaped
961
-            return '';
962
-        }
963
-        return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
964
-    }
950
+	/**
951
+	 * espresso_organization_facebook
952
+	 *
953
+	 * @param bool $echo
954
+	 * @return string
955
+	 * @throws EE_Error
956
+	 */
957
+	function espresso_organization_facebook($echo = true)
958
+	{
959
+		if ($echo) {
960
+			echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); // already escaped
961
+			return '';
962
+		}
963
+		return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
964
+	}
965 965
 }
966 966
 
967 967
 if (! function_exists('espresso_organization_twitter')) {
968
-    /**
969
-     * espresso_organization_twitter
970
-     *
971
-     * @param bool $echo
972
-     * @return string
973
-     * @throws EE_Error
974
-     */
975
-    function espresso_organization_twitter($echo = true)
976
-    {
977
-        if ($echo) {
978
-            echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); // already escaped
979
-            return '';
980
-        }
981
-        return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
982
-    }
968
+	/**
969
+	 * espresso_organization_twitter
970
+	 *
971
+	 * @param bool $echo
972
+	 * @return string
973
+	 * @throws EE_Error
974
+	 */
975
+	function espresso_organization_twitter($echo = true)
976
+	{
977
+		if ($echo) {
978
+			echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); // already escaped
979
+			return '';
980
+		}
981
+		return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
982
+	}
983 983
 }
984 984
 
985 985
 if (! function_exists('espresso_organization_linkedin')) {
986
-    /**
987
-     * espresso_organization_linkedin
988
-     *
989
-     * @param bool $echo
990
-     * @return string
991
-     * @throws EE_Error
992
-     */
993
-    function espresso_organization_linkedin($echo = true)
994
-    {
995
-        if ($echo) {
996
-            echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); // already escaped
997
-            return '';
998
-        }
999
-        return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
1000
-    }
986
+	/**
987
+	 * espresso_organization_linkedin
988
+	 *
989
+	 * @param bool $echo
990
+	 * @return string
991
+	 * @throws EE_Error
992
+	 */
993
+	function espresso_organization_linkedin($echo = true)
994
+	{
995
+		if ($echo) {
996
+			echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); // already escaped
997
+			return '';
998
+		}
999
+		return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
1000
+	}
1001 1001
 }
1002 1002
 
1003 1003
 if (! function_exists('espresso_organization_pinterest')) {
1004
-    /**
1005
-     * espresso_organization_pinterest
1006
-     *
1007
-     * @param bool $echo
1008
-     * @return string
1009
-     * @throws EE_Error
1010
-     */
1011
-    function espresso_organization_pinterest($echo = true)
1012
-    {
1013
-        if ($echo) {
1014
-            echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); // already escaped
1015
-            return '';
1016
-        }
1017
-        return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
1018
-    }
1004
+	/**
1005
+	 * espresso_organization_pinterest
1006
+	 *
1007
+	 * @param bool $echo
1008
+	 * @return string
1009
+	 * @throws EE_Error
1010
+	 */
1011
+	function espresso_organization_pinterest($echo = true)
1012
+	{
1013
+		if ($echo) {
1014
+			echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); // already escaped
1015
+			return '';
1016
+		}
1017
+		return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
1018
+	}
1019 1019
 }
1020 1020
 
1021 1021
 if (! function_exists('espresso_organization_google')) {
1022
-    /**
1023
-     * espresso_organization_google
1024
-     *
1025
-     * @param bool $echo
1026
-     * @return string
1027
-     * @throws EE_Error
1028
-     */
1029
-    function espresso_organization_google($echo = true)
1030
-    {
1031
-        if ($echo) {
1032
-            echo EE_Registry::instance()->CFG->organization->get_pretty('google'); // already escaped
1033
-            return '';
1034
-        }
1035
-        return EE_Registry::instance()->CFG->organization->get_pretty('google');
1036
-    }
1022
+	/**
1023
+	 * espresso_organization_google
1024
+	 *
1025
+	 * @param bool $echo
1026
+	 * @return string
1027
+	 * @throws EE_Error
1028
+	 */
1029
+	function espresso_organization_google($echo = true)
1030
+	{
1031
+		if ($echo) {
1032
+			echo EE_Registry::instance()->CFG->organization->get_pretty('google'); // already escaped
1033
+			return '';
1034
+		}
1035
+		return EE_Registry::instance()->CFG->organization->get_pretty('google');
1036
+	}
1037 1037
 }
1038 1038
 
1039 1039
 if (! function_exists('espresso_organization_instagram')) {
1040
-    /**
1041
-     * espresso_organization_instagram
1042
-     *
1043
-     * @param bool $echo
1044
-     * @return string
1045
-     * @throws EE_Error
1046
-     */
1047
-    function espresso_organization_instagram($echo = true)
1048
-    {
1049
-        if ($echo) {
1050
-            echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); // already escaped
1051
-            return '';
1052
-        }
1053
-        return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
1054
-    }
1040
+	/**
1041
+	 * espresso_organization_instagram
1042
+	 *
1043
+	 * @param bool $echo
1044
+	 * @return string
1045
+	 * @throws EE_Error
1046
+	 */
1047
+	function espresso_organization_instagram($echo = true)
1048
+	{
1049
+		if ($echo) {
1050
+			echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); // already escaped
1051
+			return '';
1052
+		}
1053
+		return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
1054
+	}
1055 1055
 }
1056 1056
 
1057 1057
 
@@ -1059,345 +1059,345 @@  discard block
 block discarded – undo
1059 1059
 
1060 1060
 
1061 1061
 if (! function_exists('espresso_event_venues')) {
1062
-    /**
1063
-     * espresso_event_venues
1064
-     *
1065
-     * @return array  all venues related to an event
1066
-     * @throws EE_Error
1067
-     * @throws ReflectionException
1068
-     */
1069
-    function espresso_event_venues()
1070
-    {
1071
-        return EEH_Venue_View::get_event_venues();
1072
-    }
1062
+	/**
1063
+	 * espresso_event_venues
1064
+	 *
1065
+	 * @return array  all venues related to an event
1066
+	 * @throws EE_Error
1067
+	 * @throws ReflectionException
1068
+	 */
1069
+	function espresso_event_venues()
1070
+	{
1071
+		return EEH_Venue_View::get_event_venues();
1072
+	}
1073 1073
 }
1074 1074
 
1075 1075
 
1076 1076
 if (! function_exists('espresso_venue_id')) {
1077
-    /**
1078
-     *    espresso_venue_name
1079
-     *
1080
-     * @access    public
1081
-     * @param int $EVT_ID
1082
-     * @return    string
1083
-     * @throws EE_Error
1084
-     * @throws ReflectionException
1085
-     */
1086
-    function espresso_venue_id($EVT_ID = 0)
1087
-    {
1088
-        $venue = EEH_Venue_View::get_venue($EVT_ID);
1089
-        return $venue instanceof EE_Venue ? $venue->ID() : 0;
1090
-    }
1077
+	/**
1078
+	 *    espresso_venue_name
1079
+	 *
1080
+	 * @access    public
1081
+	 * @param int $EVT_ID
1082
+	 * @return    string
1083
+	 * @throws EE_Error
1084
+	 * @throws ReflectionException
1085
+	 */
1086
+	function espresso_venue_id($EVT_ID = 0)
1087
+	{
1088
+		$venue = EEH_Venue_View::get_venue($EVT_ID);
1089
+		return $venue instanceof EE_Venue ? $venue->ID() : 0;
1090
+	}
1091 1091
 }
1092 1092
 
1093 1093
 
1094 1094
 if (! function_exists('espresso_is_venue_private')) {
1095
-    /**
1096
-     * Return whether a venue is private or not.
1097
-     *
1098
-     * @param int $VNU_ID optional, the venue id to check.
1099
-     *
1100
-     * @return bool | null
1101
-     * @throws EE_Error
1102
-     * @throws ReflectionException
1103
-     * @see EEH_Venue_View::get_venue() for more info on expected return results.
1104
-     */
1105
-    function espresso_is_venue_private($VNU_ID = 0)
1106
-    {
1107
-        return EEH_Venue_View::is_venue_private($VNU_ID);
1108
-    }
1095
+	/**
1096
+	 * Return whether a venue is private or not.
1097
+	 *
1098
+	 * @param int $VNU_ID optional, the venue id to check.
1099
+	 *
1100
+	 * @return bool | null
1101
+	 * @throws EE_Error
1102
+	 * @throws ReflectionException
1103
+	 * @see EEH_Venue_View::get_venue() for more info on expected return results.
1104
+	 */
1105
+	function espresso_is_venue_private($VNU_ID = 0)
1106
+	{
1107
+		return EEH_Venue_View::is_venue_private($VNU_ID);
1108
+	}
1109 1109
 }
1110 1110
 
1111 1111
 
1112 1112
 if (! function_exists('espresso_venue_is_password_protected')) {
1113
-    /**
1114
-     * returns true or false if a venue is password protected or not
1115
-     *
1116
-     * @param int $VNU_ID optional, the venue id to check.
1117
-     * @return bool
1118
-     * @throws EE_Error
1119
-     * @throws ReflectionException
1120
-     */
1121
-    function espresso_venue_is_password_protected($VNU_ID = 0)
1122
-    {
1123
-        EE_Registry::instance()->load_helper('Venue_View');
1124
-        return EEH_Venue_View::is_venue_password_protected($VNU_ID);
1125
-    }
1113
+	/**
1114
+	 * returns true or false if a venue is password protected or not
1115
+	 *
1116
+	 * @param int $VNU_ID optional, the venue id to check.
1117
+	 * @return bool
1118
+	 * @throws EE_Error
1119
+	 * @throws ReflectionException
1120
+	 */
1121
+	function espresso_venue_is_password_protected($VNU_ID = 0)
1122
+	{
1123
+		EE_Registry::instance()->load_helper('Venue_View');
1124
+		return EEH_Venue_View::is_venue_password_protected($VNU_ID);
1125
+	}
1126 1126
 }
1127 1127
 
1128 1128
 
1129 1129
 if (! function_exists('espresso_password_protected_venue_form')) {
1130
-    /**
1131
-     * Returns a password form if venue is password protected.
1132
-     *
1133
-     * @param int $VNU_ID optional, the venue id to check.
1134
-     * @return string
1135
-     * @throws EE_Error
1136
-     * @throws ReflectionException
1137
-     */
1138
-    function espresso_password_protected_venue_form($VNU_ID = 0)
1139
-    {
1140
-        EE_Registry::instance()->load_helper('Venue_View');
1141
-        return EEH_Venue_View::password_protected_venue_form($VNU_ID);
1142
-    }
1130
+	/**
1131
+	 * Returns a password form if venue is password protected.
1132
+	 *
1133
+	 * @param int $VNU_ID optional, the venue id to check.
1134
+	 * @return string
1135
+	 * @throws EE_Error
1136
+	 * @throws ReflectionException
1137
+	 */
1138
+	function espresso_password_protected_venue_form($VNU_ID = 0)
1139
+	{
1140
+		EE_Registry::instance()->load_helper('Venue_View');
1141
+		return EEH_Venue_View::password_protected_venue_form($VNU_ID);
1142
+	}
1143 1143
 }
1144 1144
 
1145 1145
 
1146 1146
 if (! function_exists('espresso_venue_name')) {
1147
-    /**
1148
-     *    espresso_venue_name
1149
-     *
1150
-     * @access    public
1151
-     * @param int    $VNU_ID
1152
-     * @param string $link_to - options( details, website, none ) whether to turn Venue name into a clickable link to the Venue's details page or website
1153
-     * @param bool   $echo
1154
-     * @return    string
1155
-     * @throws EE_Error
1156
-     * @throws ReflectionException
1157
-     */
1158
-    function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = true)
1159
-    {
1160
-        if ($echo) {
1161
-            echo EEH_Venue_View::venue_name($link_to, $VNU_ID); // already escaped
1162
-            return '';
1163
-        }
1164
-        return EEH_Venue_View::venue_name($link_to, $VNU_ID);
1165
-    }
1147
+	/**
1148
+	 *    espresso_venue_name
1149
+	 *
1150
+	 * @access    public
1151
+	 * @param int    $VNU_ID
1152
+	 * @param string $link_to - options( details, website, none ) whether to turn Venue name into a clickable link to the Venue's details page or website
1153
+	 * @param bool   $echo
1154
+	 * @return    string
1155
+	 * @throws EE_Error
1156
+	 * @throws ReflectionException
1157
+	 */
1158
+	function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = true)
1159
+	{
1160
+		if ($echo) {
1161
+			echo EEH_Venue_View::venue_name($link_to, $VNU_ID); // already escaped
1162
+			return '';
1163
+		}
1164
+		return EEH_Venue_View::venue_name($link_to, $VNU_ID);
1165
+	}
1166 1166
 }
1167 1167
 
1168 1168
 
1169 1169
 if (! function_exists('espresso_venue_link')) {
1170
-    /**
1171
-     *    espresso_venue_link
1172
-     *
1173
-     * @access    public
1174
-     * @param int    $VNU_ID
1175
-     * @param string $text
1176
-     * @return    string
1177
-     * @throws EE_Error
1178
-     * @throws ReflectionException
1179
-     */
1180
-    function espresso_venue_link($VNU_ID = 0, $text = '')
1181
-    {
1182
-        return EEH_Venue_View::venue_details_link($VNU_ID, $text);
1183
-    }
1170
+	/**
1171
+	 *    espresso_venue_link
1172
+	 *
1173
+	 * @access    public
1174
+	 * @param int    $VNU_ID
1175
+	 * @param string $text
1176
+	 * @return    string
1177
+	 * @throws EE_Error
1178
+	 * @throws ReflectionException
1179
+	 */
1180
+	function espresso_venue_link($VNU_ID = 0, $text = '')
1181
+	{
1182
+		return EEH_Venue_View::venue_details_link($VNU_ID, $text);
1183
+	}
1184 1184
 }
1185 1185
 
1186 1186
 
1187 1187
 if (! function_exists('espresso_venue_description')) {
1188
-    /**
1189
-     *    espresso_venue_description
1190
-     *
1191
-     * @access    public
1192
-     * @param bool $VNU_ID
1193
-     * @param bool $echo
1194
-     * @return    string
1195
-     * @throws EE_Error
1196
-     * @throws ReflectionException
1197
-     */
1198
-    function espresso_venue_description($VNU_ID = false, $echo = true)
1199
-    {
1200
-        if ($echo) {
1201
-            echo EEH_Venue_View::venue_description($VNU_ID); // already escaped
1202
-            return '';
1203
-        }
1204
-        return EEH_Venue_View::venue_description($VNU_ID);
1205
-    }
1188
+	/**
1189
+	 *    espresso_venue_description
1190
+	 *
1191
+	 * @access    public
1192
+	 * @param bool $VNU_ID
1193
+	 * @param bool $echo
1194
+	 * @return    string
1195
+	 * @throws EE_Error
1196
+	 * @throws ReflectionException
1197
+	 */
1198
+	function espresso_venue_description($VNU_ID = false, $echo = true)
1199
+	{
1200
+		if ($echo) {
1201
+			echo EEH_Venue_View::venue_description($VNU_ID); // already escaped
1202
+			return '';
1203
+		}
1204
+		return EEH_Venue_View::venue_description($VNU_ID);
1205
+	}
1206 1206
 }
1207 1207
 
1208 1208
 
1209 1209
 if (! function_exists('espresso_venue_excerpt')) {
1210
-    /**
1211
-     *    espresso_venue_excerpt
1212
-     *
1213
-     * @access    public
1214
-     * @param int  $VNU_ID
1215
-     * @param bool $echo
1216
-     * @return    string
1217
-     * @throws EE_Error
1218
-     * @throws ReflectionException
1219
-     */
1220
-    function espresso_venue_excerpt($VNU_ID = 0, $echo = true)
1221
-    {
1222
-        if ($echo) {
1223
-            echo EEH_Venue_View::venue_excerpt($VNU_ID); // already escaped
1224
-            return '';
1225
-        }
1226
-        return EEH_Venue_View::venue_excerpt($VNU_ID);
1227
-    }
1210
+	/**
1211
+	 *    espresso_venue_excerpt
1212
+	 *
1213
+	 * @access    public
1214
+	 * @param int  $VNU_ID
1215
+	 * @param bool $echo
1216
+	 * @return    string
1217
+	 * @throws EE_Error
1218
+	 * @throws ReflectionException
1219
+	 */
1220
+	function espresso_venue_excerpt($VNU_ID = 0, $echo = true)
1221
+	{
1222
+		if ($echo) {
1223
+			echo EEH_Venue_View::venue_excerpt($VNU_ID); // already escaped
1224
+			return '';
1225
+		}
1226
+		return EEH_Venue_View::venue_excerpt($VNU_ID);
1227
+	}
1228 1228
 }
1229 1229
 
1230 1230
 
1231 1231
 if (! function_exists('espresso_venue_categories')) {
1232
-    /**
1233
-     * espresso_venue_categories
1234
-     * returns the terms associated with a venue
1235
-     *
1236
-     * @param int  $VNU_ID
1237
-     * @param bool $hide_uncategorized
1238
-     * @param bool $echo
1239
-     * @return string
1240
-     * @throws EE_Error
1241
-     * @throws ReflectionException
1242
-     */
1243
-    function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = true, $echo = true)
1244
-    {
1245
-        if ($echo) {
1246
-            echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); // already escaped
1247
-            return '';
1248
-        }
1249
-        return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized);
1250
-    }
1232
+	/**
1233
+	 * espresso_venue_categories
1234
+	 * returns the terms associated with a venue
1235
+	 *
1236
+	 * @param int  $VNU_ID
1237
+	 * @param bool $hide_uncategorized
1238
+	 * @param bool $echo
1239
+	 * @return string
1240
+	 * @throws EE_Error
1241
+	 * @throws ReflectionException
1242
+	 */
1243
+	function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = true, $echo = true)
1244
+	{
1245
+		if ($echo) {
1246
+			echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); // already escaped
1247
+			return '';
1248
+		}
1249
+		return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized);
1250
+	}
1251 1251
 }
1252 1252
 
1253 1253
 
1254 1254
 if (! function_exists('espresso_venue_address')) {
1255
-    /**
1256
-     * espresso_venue_address
1257
-     * returns a formatted block of html  for displaying a venue's address
1258
-     *
1259
-     * @param string $type 'inline' or 'multiline'
1260
-     * @param int    $VNU_ID
1261
-     * @param bool   $echo
1262
-     * @return string
1263
-     * @throws EE_Error
1264
-     * @throws ReflectionException
1265
-     */
1266
-    function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = true)
1267
-    {
1268
-        if ($echo) {
1269
-            echo EEH_Venue_View::venue_address($type, $VNU_ID); // already escaped
1270
-            return '';
1271
-        }
1272
-        return EEH_Venue_View::venue_address($type, $VNU_ID);
1273
-    }
1255
+	/**
1256
+	 * espresso_venue_address
1257
+	 * returns a formatted block of html  for displaying a venue's address
1258
+	 *
1259
+	 * @param string $type 'inline' or 'multiline'
1260
+	 * @param int    $VNU_ID
1261
+	 * @param bool   $echo
1262
+	 * @return string
1263
+	 * @throws EE_Error
1264
+	 * @throws ReflectionException
1265
+	 */
1266
+	function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = true)
1267
+	{
1268
+		if ($echo) {
1269
+			echo EEH_Venue_View::venue_address($type, $VNU_ID); // already escaped
1270
+			return '';
1271
+		}
1272
+		return EEH_Venue_View::venue_address($type, $VNU_ID);
1273
+	}
1274 1274
 }
1275 1275
 
1276 1276
 
1277 1277
 if (! function_exists('espresso_venue_raw_address')) {
1278
-    /**
1279
-     * espresso_venue_address
1280
-     * returns an UN-formatted string containing a venue's address
1281
-     *
1282
-     * @param string $type 'inline' or 'multiline'
1283
-     * @param int    $VNU_ID
1284
-     * @param bool   $echo
1285
-     * @return string
1286
-     * @throws EE_Error
1287
-     * @throws ReflectionException
1288
-     */
1289
-    function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = true)
1290
-    {
1291
-        if ($echo) {
1292
-            echo EEH_Venue_View::venue_address($type, $VNU_ID, false, false); // already escaped
1293
-            return '';
1294
-        }
1295
-        return EEH_Venue_View::venue_address($type, $VNU_ID, false, false);
1296
-    }
1278
+	/**
1279
+	 * espresso_venue_address
1280
+	 * returns an UN-formatted string containing a venue's address
1281
+	 *
1282
+	 * @param string $type 'inline' or 'multiline'
1283
+	 * @param int    $VNU_ID
1284
+	 * @param bool   $echo
1285
+	 * @return string
1286
+	 * @throws EE_Error
1287
+	 * @throws ReflectionException
1288
+	 */
1289
+	function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = true)
1290
+	{
1291
+		if ($echo) {
1292
+			echo EEH_Venue_View::venue_address($type, $VNU_ID, false, false); // already escaped
1293
+			return '';
1294
+		}
1295
+		return EEH_Venue_View::venue_address($type, $VNU_ID, false, false);
1296
+	}
1297 1297
 }
1298 1298
 
1299 1299
 
1300 1300
 if (! function_exists('espresso_venue_has_address')) {
1301
-    /**
1302
-     * espresso_venue_has_address
1303
-     * returns TRUE or FALSE if a Venue has address information
1304
-     *
1305
-     * @param int $VNU_ID
1306
-     * @return bool
1307
-     * @throws EE_Error
1308
-     * @throws ReflectionException
1309
-     */
1310
-    function espresso_venue_has_address($VNU_ID = 0)
1311
-    {
1312
-        return EEH_Venue_View::venue_has_address($VNU_ID);
1313
-    }
1301
+	/**
1302
+	 * espresso_venue_has_address
1303
+	 * returns TRUE or FALSE if a Venue has address information
1304
+	 *
1305
+	 * @param int $VNU_ID
1306
+	 * @return bool
1307
+	 * @throws EE_Error
1308
+	 * @throws ReflectionException
1309
+	 */
1310
+	function espresso_venue_has_address($VNU_ID = 0)
1311
+	{
1312
+		return EEH_Venue_View::venue_has_address($VNU_ID);
1313
+	}
1314 1314
 }
1315 1315
 
1316 1316
 
1317 1317
 if (! function_exists('espresso_venue_gmap')) {
1318
-    /**
1319
-     * espresso_venue_gmap
1320
-     * returns a google map for the venue address
1321
-     *
1322
-     * @param int   $VNU_ID
1323
-     * @param bool  $map_ID
1324
-     * @param array $gmap
1325
-     * @param bool  $echo
1326
-     * @return string
1327
-     * @throws EE_Error
1328
-     * @throws ReflectionException
1329
-     */
1330
-    function espresso_venue_gmap($VNU_ID = 0, $map_ID = false, $gmap = [], $echo = true)
1331
-    {
1332
-        if ($echo) {
1333
-            echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); // already escaped
1334
-            return '';
1335
-        }
1336
-        return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap);
1337
-    }
1318
+	/**
1319
+	 * espresso_venue_gmap
1320
+	 * returns a google map for the venue address
1321
+	 *
1322
+	 * @param int   $VNU_ID
1323
+	 * @param bool  $map_ID
1324
+	 * @param array $gmap
1325
+	 * @param bool  $echo
1326
+	 * @return string
1327
+	 * @throws EE_Error
1328
+	 * @throws ReflectionException
1329
+	 */
1330
+	function espresso_venue_gmap($VNU_ID = 0, $map_ID = false, $gmap = [], $echo = true)
1331
+	{
1332
+		if ($echo) {
1333
+			echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); // already escaped
1334
+			return '';
1335
+		}
1336
+		return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap);
1337
+	}
1338 1338
 }
1339 1339
 
1340 1340
 
1341 1341
 if (! function_exists('espresso_venue_phone')) {
1342
-    /**
1343
-     * espresso_venue_phone
1344
-     *
1345
-     * @param int  $VNU_ID
1346
-     * @param bool $echo
1347
-     * @return string
1348
-     * @throws EE_Error
1349
-     * @throws ReflectionException
1350
-     */
1351
-    function espresso_venue_phone($VNU_ID = 0, $echo = true)
1352
-    {
1353
-        if ($echo) {
1354
-            echo EEH_Venue_View::venue_phone($VNU_ID); // already escaped
1355
-            return '';
1356
-        }
1357
-        return EEH_Venue_View::venue_phone($VNU_ID);
1358
-    }
1342
+	/**
1343
+	 * espresso_venue_phone
1344
+	 *
1345
+	 * @param int  $VNU_ID
1346
+	 * @param bool $echo
1347
+	 * @return string
1348
+	 * @throws EE_Error
1349
+	 * @throws ReflectionException
1350
+	 */
1351
+	function espresso_venue_phone($VNU_ID = 0, $echo = true)
1352
+	{
1353
+		if ($echo) {
1354
+			echo EEH_Venue_View::venue_phone($VNU_ID); // already escaped
1355
+			return '';
1356
+		}
1357
+		return EEH_Venue_View::venue_phone($VNU_ID);
1358
+	}
1359 1359
 }
1360 1360
 
1361 1361
 
1362 1362
 if (! function_exists('espresso_venue_website')) {
1363
-    /**
1364
-     * espresso_venue_website
1365
-     *
1366
-     * @param int  $VNU_ID
1367
-     * @param bool $echo
1368
-     * @return string
1369
-     * @throws EE_Error
1370
-     * @throws ReflectionException
1371
-     */
1372
-    function espresso_venue_website($VNU_ID = 0, $echo = true)
1373
-    {
1374
-        if ($echo) {
1375
-            echo EEH_Venue_View::venue_website_link($VNU_ID); // already escaped
1376
-            return '';
1377
-        }
1378
-        return EEH_Venue_View::venue_website_link($VNU_ID);
1379
-    }
1363
+	/**
1364
+	 * espresso_venue_website
1365
+	 *
1366
+	 * @param int  $VNU_ID
1367
+	 * @param bool $echo
1368
+	 * @return string
1369
+	 * @throws EE_Error
1370
+	 * @throws ReflectionException
1371
+	 */
1372
+	function espresso_venue_website($VNU_ID = 0, $echo = true)
1373
+	{
1374
+		if ($echo) {
1375
+			echo EEH_Venue_View::venue_website_link($VNU_ID); // already escaped
1376
+			return '';
1377
+		}
1378
+		return EEH_Venue_View::venue_website_link($VNU_ID);
1379
+	}
1380 1380
 }
1381 1381
 
1382 1382
 
1383 1383
 if (! function_exists('espresso_edit_venue_link')) {
1384
-    /**
1385
-     * espresso_edit_venue_link
1386
-     *
1387
-     * @param int  $VNU_ID
1388
-     * @param bool $echo
1389
-     * @return string
1390
-     * @throws EE_Error
1391
-     * @throws ReflectionException
1392
-     */
1393
-    function espresso_edit_venue_link($VNU_ID = 0, $echo = true)
1394
-    {
1395
-        if ($echo) {
1396
-            echo EEH_Venue_View::edit_venue_link($VNU_ID); // already escaped
1397
-            return '';
1398
-        }
1399
-        return EEH_Venue_View::edit_venue_link($VNU_ID);
1400
-    }
1384
+	/**
1385
+	 * espresso_edit_venue_link
1386
+	 *
1387
+	 * @param int  $VNU_ID
1388
+	 * @param bool $echo
1389
+	 * @return string
1390
+	 * @throws EE_Error
1391
+	 * @throws ReflectionException
1392
+	 */
1393
+	function espresso_edit_venue_link($VNU_ID = 0, $echo = true)
1394
+	{
1395
+		if ($echo) {
1396
+			echo EEH_Venue_View::edit_venue_link($VNU_ID); // already escaped
1397
+			return '';
1398
+		}
1399
+		return EEH_Venue_View::edit_venue_link($VNU_ID);
1400
+	}
1401 1401
 }
1402 1402
 
1403 1403
 
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_venues-details.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,43 +5,43 @@
 block discarded – undo
5 5
 global $post;
6 6
 ?>
7 7
 <div class="venue-content">
8
-<?php if ( apply_filters( 'FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE )): ?>
8
+<?php if (apply_filters('FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE)): ?>
9 9
 	<div class="entry-meta">
10
-		<span class="tags-links"><?php espresso_venue_categories( $post->ID, TRUE, TRUE ); ?></span>
10
+		<span class="tags-links"><?php espresso_venue_categories($post->ID, TRUE, TRUE); ?></span>
11 11
 		<?php
12
-			if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
12
+			if ( ! post_password_required() && (comments_open() || get_comments_number())) :
13 13
 		?>
14
-		<span class="comments-link"><?php comments_popup_link( esc_html__( 'Leave a comment', 'event_espresso' ), esc_html__( '1 Comment', 'event_espresso' ), esc_html__( '% Comments', 'event_espresso' ) ); ?></span>
14
+		<span class="comments-link"><?php comments_popup_link(esc_html__('Leave a comment', 'event_espresso'), esc_html__('1 Comment', 'event_espresso'), esc_html__('% Comments', 'event_espresso')); ?></span>
15 15
 		<?php
16 16
 			endif;
17 17
 
18
-			edit_post_link( esc_html__( 'Edit', 'event_espresso' ), '<span class="edit-link">', '</span>' );
18
+			edit_post_link(esc_html__('Edit', 'event_espresso'), '<span class="edit-link">', '</span>');
19 19
 		?>
20 20
 	</div>
21 21
 <?php  endif; ?>
22 22
 	
23 23
 	<h3 class="event-venues-h3 ee-event-h3">
24
-		<?php esc_html_e( 'Details', 'event_espresso' ); ?>
24
+		<?php esc_html_e('Details', 'event_espresso'); ?>
25 25
 	</h3>
26 26
 
27
-	<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?>
27
+	<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?>
28 28
 	<p>
29
-		<span class="small-text"><strong><?php esc_html_e( 'Venue Phone:', 'event_espresso' ); ?> </strong></span><?php echo wp_kses($venue_phone, AllowedTags::getAllowedTags()); ?>
29
+		<span class="small-text"><strong><?php esc_html_e('Venue Phone:', 'event_espresso'); ?> </strong></span><?php echo wp_kses($venue_phone, AllowedTags::getAllowedTags()); ?>
30 30
 	</p>
31 31
 	<?php endif; ?>
32
-	<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?>
32
+	<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?>
33 33
 	<p>
34
-		<span class="small-text"><strong><?php esc_html_e( 'Venue Website:', 'event_espresso' ); ?> </strong></span><?php echo wp_kses($venue_website, AllowedTags::getAllowedTags()); ?>
34
+		<span class="small-text"><strong><?php esc_html_e('Venue Website:', 'event_espresso'); ?> </strong></span><?php echo wp_kses($venue_website, AllowedTags::getAllowedTags()); ?>
35 35
 	</p>
36 36
 	<?php endif; ?>
37 37
 	<?php 
38
-	do_action( 'AHEE__content_espresso_venues_details_template__before_the_content', $post ); 
39
-	if ( is_archive() && has_excerpt( $post->ID )) {
38
+	do_action('AHEE__content_espresso_venues_details_template__before_the_content', $post); 
39
+	if (is_archive() && has_excerpt($post->ID)) {
40 40
 		the_excerpt();
41 41
 	} else {
42 42
 		the_content();
43 43
 	}
44
-	do_action( 'AHEE__content_espresso_venues_details_template__after_the_content', $post ); 
44
+	do_action('AHEE__content_espresso_venues_details_template__after_the_content', $post); 
45 45
 	?>
46 46
 </div>
47 47
 <!-- .venue-content -->
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_events-venues.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -3,75 +3,75 @@
 block discarded – undo
3 3
 use EventEspresso\core\services\request\sanitizers\AllowedTags;
4 4
 
5 5
 if (
6
-	( is_single() && espresso_display_venue_in_event_details() )
7
-	|| ( is_archive() && espresso_display_venue_in_event_list() )
6
+	(is_single() && espresso_display_venue_in_event_details())
7
+	|| (is_archive() && espresso_display_venue_in_event_list())
8 8
 ) :
9 9
 	global $post;
10
-	do_action( 'AHEE_event_details_before_venue_details', $post );
11
-	$venue_name = espresso_venue_name( 0, 'details', FALSE );
12
-	if ( empty( $venue_name ) && espresso_is_venue_private() ) {
13
-		do_action( 'AHEE_event_details_after_venue_details', $post );
10
+	do_action('AHEE_event_details_before_venue_details', $post);
11
+	$venue_name = espresso_venue_name(0, 'details', FALSE);
12
+	if (empty($venue_name) && espresso_is_venue_private()) {
13
+		do_action('AHEE_event_details_after_venue_details', $post);
14 14
 		return '';
15 15
 	}
16 16
 ?>
17 17
 
18 18
 <div class="espresso-venue-dv<?php echo espresso_is_venue_private() ? ' espresso-private-venue-dv' : ''; ?>">
19 19
 	<h4>
20
-        <strong><?php esc_html_e( 'Venue:', 'event_espresso' ); ?></strong>&nbsp;&nbsp;
20
+        <strong><?php esc_html_e('Venue:', 'event_espresso'); ?></strong>&nbsp;&nbsp;
21 21
         <strong> <?php echo wp_kses($venue_name, AllowedTags::getAllowedTags()); ?></strong>
22 22
     </h4>
23 23
 	<p><span class="smaller-text tags-links"><?php echo espresso_venue_categories(); ?></span></p>
24
-<?php  if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?>
24
+<?php  if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?>
25 25
 	<p>
26 26
 		<span class="small-text">
27
-            <strong><?php esc_html_e( 'Venue Phone:', 'event_espresso' ); ?></strong>
27
+            <strong><?php esc_html_e('Venue Phone:', 'event_espresso'); ?></strong>
28 28
         </span>
29 29
         <?php echo wp_kses($venue_phone, AllowedTags::getAllowedTags()); ?>
30 30
 	</p>
31
-<?php endif;  ?>
32
-<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?>
31
+<?php endif; ?>
32
+<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?>
33 33
 	<p>
34 34
 		<span class="small-text">
35
-            <strong><?php esc_html_e( 'Venue Website:', 'event_espresso' ); ?></strong>
35
+            <strong><?php esc_html_e('Venue Website:', 'event_espresso'); ?></strong>
36 36
         </span>
37 37
         <?php echo wp_kses($venue_website, AllowedTags::getAllowedTags()); ?>
38 38
 	</p>
39 39
 <?php endif; ?>
40
-<?php  if ( espresso_venue_has_address( $post->ID )) : ?>
41
-	<strong><span class="dashicons dashicons-location-alt"></span><?php esc_html_e( 'Address:', 'event_espresso' ); ?></strong>
42
-	<?php espresso_venue_address( 'inline' ); // already escaped ?>
43
-	<?php espresso_venue_gmap( $post->ID ); // already escaped ?>
40
+<?php  if (espresso_venue_has_address($post->ID)) : ?>
41
+	<strong><span class="dashicons dashicons-location-alt"></span><?php esc_html_e('Address:', 'event_espresso'); ?></strong>
42
+	<?php espresso_venue_address('inline'); // already escaped ?>
43
+	<?php espresso_venue_gmap($post->ID); // already escaped ?>
44 44
 	<div class="clear"><br/></div>
45
-<?php endif;  ?>
45
+<?php endif; ?>
46 46
 
47
-	<?php $VNU_ID = espresso_venue_id( $post->ID ); ?>
48
-	<?php if ( is_single() ) : ?>
49
-		<?php $venue_description = espresso_venue_description( $VNU_ID, FALSE ); ?>
50
-		<?php if ( $venue_description ) : ?>
47
+	<?php $VNU_ID = espresso_venue_id($post->ID); ?>
48
+	<?php if (is_single()) : ?>
49
+		<?php $venue_description = espresso_venue_description($VNU_ID, FALSE); ?>
50
+		<?php if ($venue_description) : ?>
51 51
 	<p>
52
-		<strong><?php esc_html_e( 'Description:', 'event_espresso' ); ?></strong><br/>
53
-		<?php echo do_shortcode( $venue_description ); ?>
52
+		<strong><?php esc_html_e('Description:', 'event_espresso'); ?></strong><br/>
53
+		<?php echo do_shortcode($venue_description); ?>
54 54
 	</p>
55
-		<?php endif;  ?>
55
+		<?php endif; ?>
56 56
 	<?php else : ?>
57
-		<?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?>
58
-		<?php if ( $venue_excerpt ) : ?>
57
+		<?php $venue_excerpt = espresso_venue_excerpt($VNU_ID, FALSE); ?>
58
+		<?php if ($venue_excerpt) : ?>
59 59
 	<p>
60
-		<strong><?php esc_html_e( 'Description:', 'event_espresso' ); ?></strong><br/>
60
+		<strong><?php esc_html_e('Description:', 'event_espresso'); ?></strong><br/>
61 61
 		<?php echo wp_kses($venue_excerpt, AllowedTags::getAllowedTags()); ?>
62 62
 	</p>
63
-			<?php endif;  ?>
64
-		<?php endif;  ?>
63
+			<?php endif; ?>
64
+		<?php endif; ?>
65 65
 </div>
66 66
 <!-- .espresso-venue-dv -->
67 67
 <?php
68
-do_action( 'AHEE_event_details_after_venue_details', $post );
68
+do_action('AHEE_event_details_after_venue_details', $post);
69 69
 else :
70
-	if ( espresso_venue_is_password_protected() ) :
70
+	if (espresso_venue_is_password_protected()) :
71 71
 ?>
72 72
 	<div class="espresso-venue-dv  espresso-password-protected-venue-dv" >
73 73
 		<h3 class="event-venues-h3 ee-event-h3">
74
-			<?php esc_html_e( 'Location', 'event_espresso' );?>
74
+			<?php esc_html_e('Location', 'event_espresso'); ?>
75 75
 		</h3>
76 76
 		<?php echo espresso_password_protected_venue_form(); ?>
77 77
 	</div>
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_event_attendees.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
 use EventEspresso\core\services\request\sanitizers\AllowedTags;
16 16
 
17 17
 $gravatar = $show_gravatar
18
-    ? get_avatar(
19
-        $contact->email(),
20
-        (int) apply_filters('FHEE__loop-espresso_attendees-shortcode__template__avatar_size', 32)
21
-    )
22
-    : '';
18
+	? get_avatar(
19
+		$contact->email(),
20
+		(int) apply_filters('FHEE__loop-espresso_attendees-shortcode__template__avatar_size', 32)
21
+	)
22
+	: '';
23 23
 ?>
24 24
 <?php do_action( 'AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar ); ?>
25 25
 <li><?php echo wp_kses($gravatar . '&nbsp;' .  $contact->full_name(true), AllowedTags::getAllowedTags()); ?></li>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
     )
22 22
     : '';
23 23
 ?>
24
-<?php do_action( 'AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar ); ?>
25
-<li><?php echo wp_kses($gravatar . '&nbsp;' .  $contact->full_name(true), AllowedTags::getAllowedTags()); ?></li>
26
-<?php do_action( 'AHEE__content-espresso_event_attendees__after', $contact, $show_gravatar ); ?>
24
+<?php do_action('AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar); ?>
25
+<li><?php echo wp_kses($gravatar.'&nbsp;'.$contact->full_name(true), AllowedTags::getAllowedTags()); ?></li>
26
+<?php do_action('AHEE__content-espresso_event_attendees__after', $contact, $show_gravatar); ?>
27 27
 
28 28
 <!--<br >-->
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_events-details.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,27 +4,27 @@  discard block
 block discarded – undo
4 4
 <div class="event-content">
5 5
 <?php use EventEspresso\core\services\request\sanitizers\AllowedTags;
6 6
 
7
-if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_entry_meta', TRUE )): ?>
7
+if (apply_filters('FHEE__content_espresso_events_details_template__display_entry_meta', TRUE)): ?>
8 8
 
9 9
 	<div class="entry-meta">
10 10
 
11 11
 		<span class="tags-links">
12
-            <?php espresso_event_categories( $post->ID, TRUE, TRUE ); ?>
12
+            <?php espresso_event_categories($post->ID, TRUE, TRUE); ?>
13 13
         </span>
14 14
 
15
-	    <?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
15
+	    <?php if ( ! post_password_required() && (comments_open() || get_comments_number())) : ?>
16 16
 	    <span class="comments-link">
17 17
         <?php comments_popup_link(
18
-            esc_html__( 'Leave a comment', 'event_espresso' ),
19
-            esc_html__( '1 Comment', 'event_espresso' ),
20
-            esc_html__( '% Comments', 'event_espresso' )
18
+            esc_html__('Leave a comment', 'event_espresso'),
19
+            esc_html__('1 Comment', 'event_espresso'),
20
+            esc_html__('% Comments', 'event_espresso')
21 21
         ); ?>
22 22
         </span>
23 23
 
24 24
         <?php
25 25
             endif;
26 26
             edit_post_link(
27
-                esc_html__( 'Edit', 'event_espresso' ),
27
+                esc_html__('Edit', 'event_espresso'),
28 28
                 '<span class="edit-link">',
29 29
                 '</span>'
30 30
             );
@@ -32,25 +32,25 @@  discard block
 block discarded – undo
32 32
 	</div>
33 33
 
34 34
 <?php endif;
35
-	$event_phone = espresso_event_phone( $post->ID, FALSE );
35
+	$event_phone = espresso_event_phone($post->ID, FALSE);
36 36
 
37
-	if ( $event_phone != '' ) : ?>
37
+	if ($event_phone != '') : ?>
38 38
 	<p class="event-phone">
39 39
 		<span class="small-text">
40
-            <strong><?php esc_html_e( 'Event Phone:', 'event_espresso' ); ?> </strong>
40
+            <strong><?php esc_html_e('Event Phone:', 'event_espresso'); ?> </strong>
41 41
         </span>
42 42
         <?php echo wp_kses($event_phone, AllowedTags::getAllowedTags()); ?>
43 43
 	</p>
44
-<?php endif;  ?>
44
+<?php endif; ?>
45 45
 
46 46
 <?php
47
-	if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_the_content', true ) ) {
48
-		do_action( 'AHEE_event_details_before_the_content', $post );
47
+	if (apply_filters('FHEE__content_espresso_events_details_template__display_the_content', true)) {
48
+		do_action('AHEE_event_details_before_the_content', $post);
49 49
 		echo apply_filters(
50 50
 			'FHEE__content_espresso_events_details_template__the_content',
51
-			espresso_event_content_or_excerpt( 55, null, false ) 
51
+			espresso_event_content_or_excerpt(55, null, false) 
52 52
 		);
53
-		do_action( 'AHEE_event_details_after_the_content', $post );
53
+		do_action('AHEE_event_details_after_the_content', $post);
54 54
 	}
55 55
  ?>
56 56
 </div>
Please login to merge, or discard this patch.
widgets/upcoming_events/EEW_Upcoming_Events.widget.php 2 patches
Indentation   +594 added lines, -594 removed lines patch added patch discarded remove patch
@@ -13,109 +13,109 @@  discard block
 block discarded – undo
13 13
 class EEW_Upcoming_Events extends EspressoWidget
14 14
 {
15 15
 
16
-    /**
17
-     * @var string
18
-     */
19
-    private $title;
20
-    /**
21
-     * @var string
22
-     */
23
-    private $events_category;
24
-
25
-    /**
26
-     * @var bool
27
-     */
28
-    private $show_expired;
29
-
30
-    /**
31
-     * @var string
32
-     */
33
-    private $image_size;
34
-
35
-    /**
36
-     * @var bool
37
-     */
38
-    private $show_desc;
39
-
40
-    /**
41
-     * @var bool
42
-     */
43
-    private $show_dates;
44
-
45
-    /**
46
-     * @var string
47
-     */
48
-    private $date_limit;
49
-
50
-    /**
51
-     * @var string
52
-     */
53
-    private $date_range;
54
-
55
-    /**
56
-     * @var string
57
-     */
58
-    private $limit;
59
-
60
-    /**
61
-     * @var string
62
-     */
63
-    private $order;
64
-
65
-
66
-    /**
67
-     * Register widget with WordPress.
68
-     */
69
-    public function __construct()
70
-    {
71
-        parent::__construct(
72
-            esc_html__('Event Espresso Upcoming Events', 'event_espresso'),
73
-            ['description' => esc_html__('A widget to display your upcoming events.', 'event_espresso')]
74
-        );
75
-    }
76
-
77
-
78
-    /**
79
-     * Back-end widget form.
80
-     *
81
-     * @param array $instance Previously saved values from database.
82
-     * @return void
83
-     * @throws EE_Error
84
-     * @throws ReflectionException
85
-     * @see WP_Widget::form()
86
-     */
87
-    public function form($instance)
88
-    {
89
-
90
-        EE_Registry::instance()->load_class('Question_Option', [], false, false, true);
91
-        // Set up some default widget settings.
92
-        $defaults = [
93
-            'title'           => esc_html__('Upcoming Events', 'event_espresso'),
94
-            'category_name'   => '',
95
-            'show_expired'    => 0,
96
-            'show_desc'       => true,
97
-            'show_dates'      => true,
98
-            'show_everywhere' => false,
99
-            'date_limit'      => 2,
100
-            'limit'           => 10,
101
-            'sort'            => 'ASC',
102
-            'date_range'      => false,
103
-            'image_size'      => 'medium',
104
-        ];
105
-
106
-        $instance = wp_parse_args((array) $instance, $defaults);
107
-        // don't add HTML labels for EE_Form_Fields generated inputs
108
-        add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
109
-        $yes_no_values = [
110
-            EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]),
111
-            EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]),
112
-        ];
113
-        $sort_values   = [
114
-            EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]),
115
-            EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]),
116
-        ];
117
-
118
-        ?>
16
+	/**
17
+	 * @var string
18
+	 */
19
+	private $title;
20
+	/**
21
+	 * @var string
22
+	 */
23
+	private $events_category;
24
+
25
+	/**
26
+	 * @var bool
27
+	 */
28
+	private $show_expired;
29
+
30
+	/**
31
+	 * @var string
32
+	 */
33
+	private $image_size;
34
+
35
+	/**
36
+	 * @var bool
37
+	 */
38
+	private $show_desc;
39
+
40
+	/**
41
+	 * @var bool
42
+	 */
43
+	private $show_dates;
44
+
45
+	/**
46
+	 * @var string
47
+	 */
48
+	private $date_limit;
49
+
50
+	/**
51
+	 * @var string
52
+	 */
53
+	private $date_range;
54
+
55
+	/**
56
+	 * @var string
57
+	 */
58
+	private $limit;
59
+
60
+	/**
61
+	 * @var string
62
+	 */
63
+	private $order;
64
+
65
+
66
+	/**
67
+	 * Register widget with WordPress.
68
+	 */
69
+	public function __construct()
70
+	{
71
+		parent::__construct(
72
+			esc_html__('Event Espresso Upcoming Events', 'event_espresso'),
73
+			['description' => esc_html__('A widget to display your upcoming events.', 'event_espresso')]
74
+		);
75
+	}
76
+
77
+
78
+	/**
79
+	 * Back-end widget form.
80
+	 *
81
+	 * @param array $instance Previously saved values from database.
82
+	 * @return void
83
+	 * @throws EE_Error
84
+	 * @throws ReflectionException
85
+	 * @see WP_Widget::form()
86
+	 */
87
+	public function form($instance)
88
+	{
89
+
90
+		EE_Registry::instance()->load_class('Question_Option', [], false, false, true);
91
+		// Set up some default widget settings.
92
+		$defaults = [
93
+			'title'           => esc_html__('Upcoming Events', 'event_espresso'),
94
+			'category_name'   => '',
95
+			'show_expired'    => 0,
96
+			'show_desc'       => true,
97
+			'show_dates'      => true,
98
+			'show_everywhere' => false,
99
+			'date_limit'      => 2,
100
+			'limit'           => 10,
101
+			'sort'            => 'ASC',
102
+			'date_range'      => false,
103
+			'image_size'      => 'medium',
104
+		];
105
+
106
+		$instance = wp_parse_args((array) $instance, $defaults);
107
+		// don't add HTML labels for EE_Form_Fields generated inputs
108
+		add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
109
+		$yes_no_values = [
110
+			EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]),
111
+			EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]),
112
+		];
113
+		$sort_values   = [
114
+			EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]),
115
+			EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]),
116
+		];
117
+
118
+		?>
119 119
 
120 120
         <!-- Widget Title: Text Input -->
121 121
 
@@ -152,32 +152,32 @@  discard block
 block discarded – undo
152 152
                 <?php esc_html_e('Show Expired Events:', 'event_espresso'); ?>
153 153
             </label>
154 154
             <?php
155
-            $show_expired_options   = $yes_no_values;
156
-            $show_expired_options[] = EE_Question_Option::new_instance(
157
-                ['QSO_value' => 2, 'QSO_desc' => esc_html__('Show Only Expired', 'event_espresso')]
158
-            );
159
-            echo EEH_Form_Fields::select(
160
-                esc_html__('Show Expired Events:', 'event_espresso'),
161
-                $instance['show_expired'],
162
-                $show_expired_options,
163
-                $this->fieldName('show_expired'),
164
-                $this->fieldID('show_expired')
165
-            );
166
-            ?>
155
+			$show_expired_options   = $yes_no_values;
156
+			$show_expired_options[] = EE_Question_Option::new_instance(
157
+				['QSO_value' => 2, 'QSO_desc' => esc_html__('Show Only Expired', 'event_espresso')]
158
+			);
159
+			echo EEH_Form_Fields::select(
160
+				esc_html__('Show Expired Events:', 'event_espresso'),
161
+				$instance['show_expired'],
162
+				$show_expired_options,
163
+				$this->fieldName('show_expired'),
164
+				$this->fieldID('show_expired')
165
+			);
166
+			?>
167 167
         </p>
168 168
         <p>
169 169
             <label for="<?php echo esc_attr($this->fieldID('sort')); ?>">
170 170
                 <?php esc_html_e('Sort Events:', 'event_espresso'); ?>
171 171
             </label>
172 172
             <?php
173
-            echo EEH_Form_Fields::select(
174
-                esc_html__('Sort Events:', 'event_espresso'),
175
-                $instance['sort'],
176
-                $sort_values,
177
-                $this->fieldName('sort'),
178
-                $this->fieldID('sort')
179
-            );
180
-            ?>
173
+			echo EEH_Form_Fields::select(
174
+				esc_html__('Sort Events:', 'event_espresso'),
175
+				$instance['sort'],
176
+				$sort_values,
177
+				$this->fieldName('sort'),
178
+				$this->fieldID('sort')
179
+			);
180
+			?>
181 181
         </p>
182 182
         <p>
183 183
             <label for="<?php echo esc_attr($this->fieldID('image_size')); ?>">
@@ -191,42 +191,42 @@  discard block
 block discarded – undo
191 191
                 <?php esc_html_e('Show Description:', 'event_espresso'); ?>
192 192
             </label>
193 193
             <?php
194
-            echo EEH_Form_Fields::select(
195
-                esc_html__('Show Description:', 'event_espresso'),
196
-                $instance['show_desc'],
197
-                $yes_no_values,
198
-                $this->fieldName('show_desc'),
199
-                $this->fieldID('show_desc')
200
-            );
201
-            ?>
194
+			echo EEH_Form_Fields::select(
195
+				esc_html__('Show Description:', 'event_espresso'),
196
+				$instance['show_desc'],
197
+				$yes_no_values,
198
+				$this->fieldName('show_desc'),
199
+				$this->fieldID('show_desc')
200
+			);
201
+			?>
202 202
         </p>
203 203
         <p>
204 204
             <label for="<?php echo esc_attr($this->fieldID('show_dates')); ?>">
205 205
                 <?php esc_html_e('Show Dates:', 'event_espresso'); ?>
206 206
             </label>
207 207
             <?php
208
-            echo EEH_Form_Fields::select(
209
-                esc_html__('Show Dates:', 'event_espresso'),
210
-                $instance['show_dates'],
211
-                $yes_no_values,
212
-                $this->fieldName('show_dates'),
213
-                $this->fieldID('show_dates')
214
-            );
215
-            ?>
208
+			echo EEH_Form_Fields::select(
209
+				esc_html__('Show Dates:', 'event_espresso'),
210
+				$instance['show_dates'],
211
+				$yes_no_values,
212
+				$this->fieldName('show_dates'),
213
+				$this->fieldID('show_dates')
214
+			);
215
+			?>
216 216
         </p>
217 217
         <p>
218 218
             <label for="<?php echo esc_attr($this->fieldID('show_everywhere')); ?>">
219 219
                 <?php esc_html_e('Show on all Pages:', 'event_espresso'); ?>
220 220
             </label>
221 221
             <?php
222
-            echo EEH_Form_Fields::select(
223
-                esc_html__('Show on all Pages:', 'event_espresso'),
224
-                $instance['show_everywhere'],
225
-                $yes_no_values,
226
-                $this->fieldName('show_everywhere'),
227
-                $this->fieldID('show_everywhere')
228
-            );
229
-            ?>
222
+			echo EEH_Form_Fields::select(
223
+				esc_html__('Show on all Pages:', 'event_espresso'),
224
+				$instance['show_everywhere'],
225
+				$yes_no_values,
226
+				$this->fieldName('show_everywhere'),
227
+				$this->fieldID('show_everywhere')
228
+			);
229
+			?>
230 230
         </p>
231 231
         <p>
232 232
             <label for="<?php echo esc_attr($this->fieldID('date_limit')); ?>">
@@ -244,278 +244,278 @@  discard block
 block discarded – undo
244 244
                 <?php esc_html_e('Show Date Range:', 'event_espresso'); ?>
245 245
             </label>
246 246
             <?php
247
-            echo EEH_Form_Fields::select(
248
-                esc_html__('Show Date Range:', 'event_espresso'),
249
-                $instance['date_range'],
250
-                $yes_no_values,
251
-                $this->fieldName('date_range'),
252
-                $this->fieldID('date_range')
253
-            );
254
-            ?>
247
+			echo EEH_Form_Fields::select(
248
+				esc_html__('Show Date Range:', 'event_espresso'),
249
+				$instance['date_range'],
250
+				$yes_no_values,
251
+				$this->fieldName('date_range'),
252
+				$this->fieldID('date_range')
253
+			);
254
+			?>
255 255
             <span class="description">
256 256
                 <br />
257 257
                 <?php esc_html_e(
258
-                    'This setting will replace the list of dates in the widget.',
259
-                    'event_espresso'
260
-                ); ?>
258
+					'This setting will replace the list of dates in the widget.',
259
+					'event_espresso'
260
+				); ?>
261 261
             </span>
262 262
         </p>
263 263
 
264 264
         <?php
265
-    }
266
-
267
-
268
-    /**
269
-     * Sanitize widget form values as they are saved.
270
-     *
271
-     * @param array $new_instance Values just sent to be saved.
272
-     * @param array $old_instance Previously saved values from database.
273
-     *
274
-     * @return array Updated safe values to be saved.
275
-     * @see WP_Widget::update()
276
-     *
277
-     */
278
-    public function update($new_instance, $old_instance)
279
-    {
280
-        $instance                    = $old_instance;
281
-        $instance['title']           = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : '';
282
-        $instance['category_name']   = $new_instance['category_name'];
283
-        $instance['show_expired']    = $new_instance['show_expired'];
284
-        $instance['limit']           = $new_instance['limit'];
285
-        $instance['sort']            = $new_instance['sort'];
286
-        $instance['image_size']      = $new_instance['image_size'];
287
-        $instance['show_desc']       = $new_instance['show_desc'];
288
-        $instance['show_dates']      = $new_instance['show_dates'];
289
-        $instance['show_everywhere'] = $new_instance['show_everywhere'];
290
-        $instance['date_limit']      = $new_instance['date_limit'];
291
-        $instance['date_range']      = $new_instance['date_range'];
292
-        return $instance;
293
-    }
294
-
295
-
296
-    /**
297
-     * Front-end display of widget.
298
-     *
299
-     * @param array $args     Widget arguments.
300
-     * @param array $instance Saved values from database.
301
-     * @throws EE_Error
302
-     * @throws ReflectionException
303
-     * @see WP_Widget::widget()
304
-     *
305
-     */
306
-    public function widget($args, $instance)
307
-    {
308
-
309
-        global $post;
310
-        // make sure there is some kinda post object
311
-        if ($post instanceof WP_Post) {
312
-            $before_widget = '';
313
-            $before_title  = '';
314
-            $after_title   = '';
315
-            $after_widget  = '';
316
-            // but NOT an events archives page, cuz that would be like two event lists on the same page
317
-            $show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']);
318
-            if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) {
319
-                // let's use some of the event helper functions'
320
-                // make separate vars out of attributes
321
-                extract($args);
322
-
323
-                // grab widget settings
324
-                $this->parseWidgetSettings($instance);
325
-                $title = $this->widgetTitle();
326
-
327
-                // Before widget (defined by themes).
328
-                echo wp_kses($before_widget, AllowedTags::getAllowedTags());
329
-                // Display the widget title if one was input (before and after defined by themes).
330
-                if (! empty($title)) {
331
-                    echo wp_kses($before_title . $title . $after_title, AllowedTags::getAllowedTags());
332
-                }
333
-                echo wp_kses($this->widgetContent($post), AllowedTags::getAllowedTags());
334
-                // After widget (defined by themes).
335
-                echo wp_kses($after_widget, AllowedTags::getAllowedTags());
336
-            }
337
-        }
338
-    }
339
-
340
-
341
-    /**
342
-     * make_the_title_a_link
343
-     * callback for widget_title filter
344
-     *
345
-     * @param $title
346
-     * @return string
347
-     */
348
-    public function make_the_title_a_link($title)
349
-    {
350
-        return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>';
351
-    }
352
-
353
-
354
-    /**
355
-     * @param string $field_name
356
-     * @return string
357
-     * @since   4.10.14.p
358
-     */
359
-    public function fieldID($field_name)
360
-    {
361
-        return parent::get_field_id($field_name);
362
-    }
363
-
364
-
365
-    /**
366
-     * @param string $field_name
367
-     * @return string
368
-     * @since   4.10.14.p
369
-     */
370
-    public function fieldName($field_name)
371
-    {
372
-        return parent::get_field_name($field_name);
373
-    }
374
-
375
-
376
-    /**
377
-     * @param array $instance
378
-     * @throws EE_Error
379
-     * @throws ReflectionException
380
-     * @since   4.10.14.p
381
-     */
382
-    private function eventCategoriesSelector(array $instance)
383
-    {
384
-        $event_categories = [];
385
-        $categories       = EEM_Term::instance()->get_all_ee_categories(true);
386
-        if ($categories) {
387
-            foreach ($categories as $category) {
388
-                if ($category instanceof EE_Term) {
389
-                    $event_categories[] =
390
-                        EE_Question_Option::new_instance(
391
-                            [
392
-                                'QSO_value' => $category->get('slug'),
393
-                                'QSO_desc'  => $category->get('name'),
394
-                            ]
395
-                        );
396
-                }
397
-            }
398
-        }
399
-        array_unshift(
400
-            $event_categories,
401
-            EE_Question_Option::new_instance(
402
-                [
403
-                    'QSO_value' => '',
404
-                    'QSO_desc'  => esc_html__(' - display all - ', 'event_espresso'),
405
-                ]
406
-            )
407
-        );
408
-        echo EEH_Form_Fields::select(
409
-            esc_html__('Event Category:', 'event_espresso'),
410
-            $instance['category_name'],
411
-            $event_categories,
412
-            $this->fieldName('category_name'),
413
-            $this->fieldID('category_name')
414
-        );
415
-    }
416
-
417
-
418
-    /**
419
-     * @param array $instance
420
-     * @since   4.10.14.p
421
-     */
422
-    private function imageSizeSelector(array $instance)
423
-    {
424
-        $image_sizes = [];
425
-        $sizes       = get_intermediate_image_sizes();
426
-        if ($sizes) {
427
-            // loop thru images and create option objects out of them
428
-            foreach ($sizes as $image_size) {
429
-                $image_size = trim($image_size);
430
-                // no big images plz
431
-                if (! in_array($image_size, ['large', 'post-thumbnail'])) {
432
-                    $image_sizes[] =
433
-                        EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]);
434
-                }
435
-            }
436
-            $image_sizes[] =
437
-                EE_Question_Option::new_instance(
438
-                    ['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')]
439
-                );
440
-        }
441
-        echo EEH_Form_Fields::select(
442
-            esc_html__('Image Size:', 'event_espresso'),
443
-            $instance['image_size'],
444
-            $image_sizes,
445
-            $this->fieldName('image_size'),
446
-            $this->fieldID('image_size')
447
-        );
448
-    }
449
-
450
-
451
-    /**
452
-     * @param array $instance
453
-     * @since   4.10.14.p
454
-     */
455
-    private function parseWidgetSettings(array $instance)
456
-    {
457
-        $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : '';
458
-        $this->events_category     = isset($instance['category_name']) && ! empty($instance['category_name'])
459
-            ? $instance['category_name']
460
-            : false;
461
-        $this->show_expired = isset($instance['show_expired'])
462
-            ? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN)
463
-            : 0;
464
-        $this->image_size   = isset($instance['image_size']) && ! empty($instance['image_size'])
465
-            ? $instance['image_size']
466
-            : 'medium';
467
-        $this->show_desc    = ! isset($instance['show_desc'])
468
-                              || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN);
469
-        $this->show_dates   = ! isset($instance['show_dates'])
470
-                              || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN);
471
-        $this->date_limit   = isset($instance['date_limit']) && ! empty($instance['date_limit'])
472
-            ? $instance['date_limit']
473
-            : null;
474
-        $this->date_range   = isset($instance['date_range']) && ! empty($instance['date_range'])
475
-            ? $instance['date_range']
476
-            : false;
477
-        $this->limit        = isset($instance['limit']) ? absint($instance['limit']) : 10;
478
-        $this->order        = isset($instance['sort']) && $instance['sort'] === 'DESC'
479
-            ? 'DESC'
480
-            : 'ASC';
481
-    }
482
-
483
-
484
-    /**
485
-     * @return mixed|void
486
-     * @since   4.10.14.p
487
-     */
488
-    private function widgetTitle()
489
-    {
490
-        // add function to make the title a link
491
-        add_filter('widget_title', [$this, 'make_the_title_a_link'], 15);
492
-        // filter the title
493
-        $title = apply_filters('widget_title', $this->title);
494
-        // remove the function from the filter, so it does not affect other widgets
495
-        remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15);
496
-        return $title;
497
-    }
498
-
499
-
500
-    /**
501
-     * @param WP_Post $post
502
-     * @return string
503
-     * @throws EE_Error
504
-     * @throws ReflectionException
505
-     * @since   4.10.14.p
506
-     */
507
-    private function widgetContent(WP_Post $post)
508
-    {
509
-        // run the query
510
-        $events = $this->getUpcomingEvents();
511
-        if (empty($events)) {
512
-            return '';
513
-        }
514
-        $list_items = '';
515
-        foreach ($events as $event) {
516
-            if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) {
517
-                $event_url = $this->eventUrl($event);
518
-                $list_items .= '
265
+	}
266
+
267
+
268
+	/**
269
+	 * Sanitize widget form values as they are saved.
270
+	 *
271
+	 * @param array $new_instance Values just sent to be saved.
272
+	 * @param array $old_instance Previously saved values from database.
273
+	 *
274
+	 * @return array Updated safe values to be saved.
275
+	 * @see WP_Widget::update()
276
+	 *
277
+	 */
278
+	public function update($new_instance, $old_instance)
279
+	{
280
+		$instance                    = $old_instance;
281
+		$instance['title']           = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : '';
282
+		$instance['category_name']   = $new_instance['category_name'];
283
+		$instance['show_expired']    = $new_instance['show_expired'];
284
+		$instance['limit']           = $new_instance['limit'];
285
+		$instance['sort']            = $new_instance['sort'];
286
+		$instance['image_size']      = $new_instance['image_size'];
287
+		$instance['show_desc']       = $new_instance['show_desc'];
288
+		$instance['show_dates']      = $new_instance['show_dates'];
289
+		$instance['show_everywhere'] = $new_instance['show_everywhere'];
290
+		$instance['date_limit']      = $new_instance['date_limit'];
291
+		$instance['date_range']      = $new_instance['date_range'];
292
+		return $instance;
293
+	}
294
+
295
+
296
+	/**
297
+	 * Front-end display of widget.
298
+	 *
299
+	 * @param array $args     Widget arguments.
300
+	 * @param array $instance Saved values from database.
301
+	 * @throws EE_Error
302
+	 * @throws ReflectionException
303
+	 * @see WP_Widget::widget()
304
+	 *
305
+	 */
306
+	public function widget($args, $instance)
307
+	{
308
+
309
+		global $post;
310
+		// make sure there is some kinda post object
311
+		if ($post instanceof WP_Post) {
312
+			$before_widget = '';
313
+			$before_title  = '';
314
+			$after_title   = '';
315
+			$after_widget  = '';
316
+			// but NOT an events archives page, cuz that would be like two event lists on the same page
317
+			$show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']);
318
+			if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) {
319
+				// let's use some of the event helper functions'
320
+				// make separate vars out of attributes
321
+				extract($args);
322
+
323
+				// grab widget settings
324
+				$this->parseWidgetSettings($instance);
325
+				$title = $this->widgetTitle();
326
+
327
+				// Before widget (defined by themes).
328
+				echo wp_kses($before_widget, AllowedTags::getAllowedTags());
329
+				// Display the widget title if one was input (before and after defined by themes).
330
+				if (! empty($title)) {
331
+					echo wp_kses($before_title . $title . $after_title, AllowedTags::getAllowedTags());
332
+				}
333
+				echo wp_kses($this->widgetContent($post), AllowedTags::getAllowedTags());
334
+				// After widget (defined by themes).
335
+				echo wp_kses($after_widget, AllowedTags::getAllowedTags());
336
+			}
337
+		}
338
+	}
339
+
340
+
341
+	/**
342
+	 * make_the_title_a_link
343
+	 * callback for widget_title filter
344
+	 *
345
+	 * @param $title
346
+	 * @return string
347
+	 */
348
+	public function make_the_title_a_link($title)
349
+	{
350
+		return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>';
351
+	}
352
+
353
+
354
+	/**
355
+	 * @param string $field_name
356
+	 * @return string
357
+	 * @since   4.10.14.p
358
+	 */
359
+	public function fieldID($field_name)
360
+	{
361
+		return parent::get_field_id($field_name);
362
+	}
363
+
364
+
365
+	/**
366
+	 * @param string $field_name
367
+	 * @return string
368
+	 * @since   4.10.14.p
369
+	 */
370
+	public function fieldName($field_name)
371
+	{
372
+		return parent::get_field_name($field_name);
373
+	}
374
+
375
+
376
+	/**
377
+	 * @param array $instance
378
+	 * @throws EE_Error
379
+	 * @throws ReflectionException
380
+	 * @since   4.10.14.p
381
+	 */
382
+	private function eventCategoriesSelector(array $instance)
383
+	{
384
+		$event_categories = [];
385
+		$categories       = EEM_Term::instance()->get_all_ee_categories(true);
386
+		if ($categories) {
387
+			foreach ($categories as $category) {
388
+				if ($category instanceof EE_Term) {
389
+					$event_categories[] =
390
+						EE_Question_Option::new_instance(
391
+							[
392
+								'QSO_value' => $category->get('slug'),
393
+								'QSO_desc'  => $category->get('name'),
394
+							]
395
+						);
396
+				}
397
+			}
398
+		}
399
+		array_unshift(
400
+			$event_categories,
401
+			EE_Question_Option::new_instance(
402
+				[
403
+					'QSO_value' => '',
404
+					'QSO_desc'  => esc_html__(' - display all - ', 'event_espresso'),
405
+				]
406
+			)
407
+		);
408
+		echo EEH_Form_Fields::select(
409
+			esc_html__('Event Category:', 'event_espresso'),
410
+			$instance['category_name'],
411
+			$event_categories,
412
+			$this->fieldName('category_name'),
413
+			$this->fieldID('category_name')
414
+		);
415
+	}
416
+
417
+
418
+	/**
419
+	 * @param array $instance
420
+	 * @since   4.10.14.p
421
+	 */
422
+	private function imageSizeSelector(array $instance)
423
+	{
424
+		$image_sizes = [];
425
+		$sizes       = get_intermediate_image_sizes();
426
+		if ($sizes) {
427
+			// loop thru images and create option objects out of them
428
+			foreach ($sizes as $image_size) {
429
+				$image_size = trim($image_size);
430
+				// no big images plz
431
+				if (! in_array($image_size, ['large', 'post-thumbnail'])) {
432
+					$image_sizes[] =
433
+						EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]);
434
+				}
435
+			}
436
+			$image_sizes[] =
437
+				EE_Question_Option::new_instance(
438
+					['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')]
439
+				);
440
+		}
441
+		echo EEH_Form_Fields::select(
442
+			esc_html__('Image Size:', 'event_espresso'),
443
+			$instance['image_size'],
444
+			$image_sizes,
445
+			$this->fieldName('image_size'),
446
+			$this->fieldID('image_size')
447
+		);
448
+	}
449
+
450
+
451
+	/**
452
+	 * @param array $instance
453
+	 * @since   4.10.14.p
454
+	 */
455
+	private function parseWidgetSettings(array $instance)
456
+	{
457
+		$this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : '';
458
+		$this->events_category     = isset($instance['category_name']) && ! empty($instance['category_name'])
459
+			? $instance['category_name']
460
+			: false;
461
+		$this->show_expired = isset($instance['show_expired'])
462
+			? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN)
463
+			: 0;
464
+		$this->image_size   = isset($instance['image_size']) && ! empty($instance['image_size'])
465
+			? $instance['image_size']
466
+			: 'medium';
467
+		$this->show_desc    = ! isset($instance['show_desc'])
468
+							  || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN);
469
+		$this->show_dates   = ! isset($instance['show_dates'])
470
+							  || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN);
471
+		$this->date_limit   = isset($instance['date_limit']) && ! empty($instance['date_limit'])
472
+			? $instance['date_limit']
473
+			: null;
474
+		$this->date_range   = isset($instance['date_range']) && ! empty($instance['date_range'])
475
+			? $instance['date_range']
476
+			: false;
477
+		$this->limit        = isset($instance['limit']) ? absint($instance['limit']) : 10;
478
+		$this->order        = isset($instance['sort']) && $instance['sort'] === 'DESC'
479
+			? 'DESC'
480
+			: 'ASC';
481
+	}
482
+
483
+
484
+	/**
485
+	 * @return mixed|void
486
+	 * @since   4.10.14.p
487
+	 */
488
+	private function widgetTitle()
489
+	{
490
+		// add function to make the title a link
491
+		add_filter('widget_title', [$this, 'make_the_title_a_link'], 15);
492
+		// filter the title
493
+		$title = apply_filters('widget_title', $this->title);
494
+		// remove the function from the filter, so it does not affect other widgets
495
+		remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15);
496
+		return $title;
497
+	}
498
+
499
+
500
+	/**
501
+	 * @param WP_Post $post
502
+	 * @return string
503
+	 * @throws EE_Error
504
+	 * @throws ReflectionException
505
+	 * @since   4.10.14.p
506
+	 */
507
+	private function widgetContent(WP_Post $post)
508
+	{
509
+		// run the query
510
+		$events = $this->getUpcomingEvents();
511
+		if (empty($events)) {
512
+			return '';
513
+		}
514
+		$list_items = '';
515
+		foreach ($events as $event) {
516
+			if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) {
517
+				$event_url = $this->eventUrl($event);
518
+				$list_items .= '
519 519
                 <li id="ee-upcoming-events-widget-li-' . absint($event->ID()) . '" 
520 520
                     class="ee-upcoming-events-widget-li"
521 521
                 >
@@ -526,194 +526,194 @@  discard block
 block discarded – undo
526 526
                     </h5>
527 527
                     ' . $this->eventWidgetContent($event, $event_url) . '
528 528
                 </li>';
529
-            }
530
-        }
531
-        return '
529
+			}
530
+		}
531
+		return '
532 532
             <ul class="ee-upcoming-events-widget-ul">
533 533
                 ' . $list_items . '
534 534
             </ul>';
535
-    }
536
-
537
-
538
-    /**
539
-     * @param EE_Event $event
540
-     * @return string|null
541
-     * @throws EE_Error
542
-     * @since   4.10.14.p
543
-     */
544
-    private function eventUrl(EE_Event $event)
545
-    {
546
-        return esc_url_raw(
547
-            apply_filters(
548
-                'FHEE_EEW_Upcoming_Events__widget__event_url',
549
-                $event->get_permalink(),
550
-                $event
551
-            )
552
-        );
553
-    }
554
-
555
-
556
-    /**
557
-     * @return EE_Base_Class[]
558
-     * @throws EE_Error
559
-     */
560
-    private function getUpcomingEvents()
561
-    {
562
-        return EEM_Event::instance()->get_all(
563
-            [
564
-                $this->queryWhereParams(),
565
-                'limit'    => '0,' . $this->limit,
566
-                'order_by' => 'Datetime.DTT_EVT_start',
567
-                'order'    => $this->order,
568
-                'group_by' => 'EVT_ID',
569
-            ]
570
-        );
571
-    }
572
-
573
-
574
-    /**
575
-     * @return mixed|void
576
-     * @throws EE_Error
577
-     * @since   4.10.14.p
578
-     */
579
-    private function queryWhereParams()
580
-    {
581
-        // start to build our where clause
582
-        $where = [
583
-            'status' => ['IN', ['publish', 'sold_out']],
584
-        ];
585
-        // add category
586
-        if ($this->events_category) {
587
-            $where['Term_Taxonomy.taxonomy']  = 'espresso_event_categories';
588
-            $where['Term_Taxonomy.Term.slug'] = $this->events_category;
589
-        }
590
-        // if NOT expired then we want events that start today or in the future
591
-        // if NOT show expired then we want events that start today or in the future
592
-        if ($this->show_expired == 0) {
593
-            $where['Datetime.DTT_EVT_end'] = [
594
-                '>=',
595
-                EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'),
596
-            ];
597
-        }
598
-        // if show ONLY expired we want events that ended prior to today
599
-        if ($this->show_expired == 2) {
600
-            $where['Datetime.DTT_EVT_end'] = [
601
-                '<=',
602
-                EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'),
603
-            ];
604
-        }
605
-        // allow $where to be filtered
606
-        return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired);
607
-    }
608
-
609
-
610
-    /**
611
-     * @param EE_Event $event
612
-     * @return string
613
-     * @throws EE_Error
614
-     * @throws ReflectionException
615
-     * @since   4.10.14.p
616
-     */
617
-    private function linkClass(EE_Event $event)
618
-    {
619
-        // how big is the event name ?
620
-        $name_length = strlen($event->name());
621
-        switch ($name_length) {
622
-            case $name_length > 70:
623
-                return ' three-line';
624
-            case $name_length > 35:
625
-                return ' two-line';
626
-        }
627
-        return ' one-line';
628
-    }
629
-
630
-
631
-    /**
632
-     * @param EE_Event $event
633
-     * @param string   $event_url
634
-     * @return mixed|string|void
635
-     * @throws EE_Error
636
-     * @throws ReflectionException
637
-     * @since   4.10.14.p
638
-     */
639
-    private function eventWidgetContent(EE_Event $event, $event_url = '')
640
-    {
641
-        if (post_password_required($event->ID())) {
642
-            return apply_filters(
643
-                'FHEE_EEW_Upcoming_Events__widget__password_form',
644
-                get_the_password_form($event->ID()),
645
-                $event
646
-            );
647
-        }
648
-
649
-        $content = '';
650
-        if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') {
651
-            $content .= '
535
+	}
536
+
537
+
538
+	/**
539
+	 * @param EE_Event $event
540
+	 * @return string|null
541
+	 * @throws EE_Error
542
+	 * @since   4.10.14.p
543
+	 */
544
+	private function eventUrl(EE_Event $event)
545
+	{
546
+		return esc_url_raw(
547
+			apply_filters(
548
+				'FHEE_EEW_Upcoming_Events__widget__event_url',
549
+				$event->get_permalink(),
550
+				$event
551
+			)
552
+		);
553
+	}
554
+
555
+
556
+	/**
557
+	 * @return EE_Base_Class[]
558
+	 * @throws EE_Error
559
+	 */
560
+	private function getUpcomingEvents()
561
+	{
562
+		return EEM_Event::instance()->get_all(
563
+			[
564
+				$this->queryWhereParams(),
565
+				'limit'    => '0,' . $this->limit,
566
+				'order_by' => 'Datetime.DTT_EVT_start',
567
+				'order'    => $this->order,
568
+				'group_by' => 'EVT_ID',
569
+			]
570
+		);
571
+	}
572
+
573
+
574
+	/**
575
+	 * @return mixed|void
576
+	 * @throws EE_Error
577
+	 * @since   4.10.14.p
578
+	 */
579
+	private function queryWhereParams()
580
+	{
581
+		// start to build our where clause
582
+		$where = [
583
+			'status' => ['IN', ['publish', 'sold_out']],
584
+		];
585
+		// add category
586
+		if ($this->events_category) {
587
+			$where['Term_Taxonomy.taxonomy']  = 'espresso_event_categories';
588
+			$where['Term_Taxonomy.Term.slug'] = $this->events_category;
589
+		}
590
+		// if NOT expired then we want events that start today or in the future
591
+		// if NOT show expired then we want events that start today or in the future
592
+		if ($this->show_expired == 0) {
593
+			$where['Datetime.DTT_EVT_end'] = [
594
+				'>=',
595
+				EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'),
596
+			];
597
+		}
598
+		// if show ONLY expired we want events that ended prior to today
599
+		if ($this->show_expired == 2) {
600
+			$where['Datetime.DTT_EVT_end'] = [
601
+				'<=',
602
+				EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'),
603
+			];
604
+		}
605
+		// allow $where to be filtered
606
+		return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired);
607
+	}
608
+
609
+
610
+	/**
611
+	 * @param EE_Event $event
612
+	 * @return string
613
+	 * @throws EE_Error
614
+	 * @throws ReflectionException
615
+	 * @since   4.10.14.p
616
+	 */
617
+	private function linkClass(EE_Event $event)
618
+	{
619
+		// how big is the event name ?
620
+		$name_length = strlen($event->name());
621
+		switch ($name_length) {
622
+			case $name_length > 70:
623
+				return ' three-line';
624
+			case $name_length > 35:
625
+				return ' two-line';
626
+		}
627
+		return ' one-line';
628
+	}
629
+
630
+
631
+	/**
632
+	 * @param EE_Event $event
633
+	 * @param string   $event_url
634
+	 * @return mixed|string|void
635
+	 * @throws EE_Error
636
+	 * @throws ReflectionException
637
+	 * @since   4.10.14.p
638
+	 */
639
+	private function eventWidgetContent(EE_Event $event, $event_url = '')
640
+	{
641
+		if (post_password_required($event->ID())) {
642
+			return apply_filters(
643
+				'FHEE_EEW_Upcoming_Events__widget__password_form',
644
+				get_the_password_form($event->ID()),
645
+				$event
646
+			);
647
+		}
648
+
649
+		$content = '';
650
+		if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') {
651
+			$content .= '
652 652
                 <div class="ee-upcoming-events-widget-img-dv">
653 653
                     <a class="ee-upcoming-events-widget-img" href="' . $event_url . '">
654 654
                         ' . get_the_post_thumbnail($event->ID(), $this->image_size) . '
655 655
                     </a>
656 656
                 </div>';
657
-        }
658
-
659
-        if ($this->show_dates) {
660
-            $content .= $this->eventDates($event);
661
-        }
662
-
663
-        if ($this->show_desc) {
664
-            $allowedtags = AllowedTags::getAllowedTags();
665
-            $desc    = $event->short_description(25);
666
-            $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : '';
667
-        }
668
-
669
-        return $content;
670
-    }
671
-
672
-
673
-    /**
674
-     * @param EE_Event $event
675
-     * @return string
676
-     * @throws EE_Error
677
-     * @throws ReflectionException
678
-     * @since   4.10.14.p
679
-     */
680
-    private function eventDates(EE_Event $event)
681
-    {
682
-        $date_format        = apply_filters(
683
-            'FHEE__espresso_event_date_range__date_format',
684
-            get_option('date_format')
685
-        );
686
-        $time_format        = apply_filters(
687
-            'FHEE__espresso_event_date_range__time_format',
688
-            get_option('time_format')
689
-        );
690
-        $single_date_format = apply_filters(
691
-            'FHEE__espresso_event_date_range__single_date_format',
692
-            get_option('date_format')
693
-        );
694
-        $single_time_format = apply_filters(
695
-            'FHEE__espresso_event_date_range__single_time_format',
696
-            get_option('time_format')
697
-        );
698
-        if ($this->date_range == true) {
699
-            return espresso_event_date_range(
700
-                $date_format,
701
-                $time_format,
702
-                $single_date_format,
703
-                $single_time_format,
704
-                $event->ID(),
705
-                false
706
-            );
707
-        }
708
-        return espresso_list_of_event_dates(
709
-            $event->ID(),
710
-            $date_format,
711
-            $time_format,
712
-            false,
713
-            null,
714
-            true,
715
-            true,
716
-            $this->date_limit
717
-        );
718
-    }
657
+		}
658
+
659
+		if ($this->show_dates) {
660
+			$content .= $this->eventDates($event);
661
+		}
662
+
663
+		if ($this->show_desc) {
664
+			$allowedtags = AllowedTags::getAllowedTags();
665
+			$desc    = $event->short_description(25);
666
+			$content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : '';
667
+		}
668
+
669
+		return $content;
670
+	}
671
+
672
+
673
+	/**
674
+	 * @param EE_Event $event
675
+	 * @return string
676
+	 * @throws EE_Error
677
+	 * @throws ReflectionException
678
+	 * @since   4.10.14.p
679
+	 */
680
+	private function eventDates(EE_Event $event)
681
+	{
682
+		$date_format        = apply_filters(
683
+			'FHEE__espresso_event_date_range__date_format',
684
+			get_option('date_format')
685
+		);
686
+		$time_format        = apply_filters(
687
+			'FHEE__espresso_event_date_range__time_format',
688
+			get_option('time_format')
689
+		);
690
+		$single_date_format = apply_filters(
691
+			'FHEE__espresso_event_date_range__single_date_format',
692
+			get_option('date_format')
693
+		);
694
+		$single_time_format = apply_filters(
695
+			'FHEE__espresso_event_date_range__single_time_format',
696
+			get_option('time_format')
697
+		);
698
+		if ($this->date_range == true) {
699
+			return espresso_event_date_range(
700
+				$date_format,
701
+				$time_format,
702
+				$single_date_format,
703
+				$single_time_format,
704
+				$event->ID(),
705
+				false
706
+			);
707
+		}
708
+		return espresso_list_of_event_dates(
709
+			$event->ID(),
710
+			$date_format,
711
+			$time_format,
712
+			false,
713
+			null,
714
+			true,
715
+			true,
716
+			$this->date_limit
717
+		);
718
+	}
719 719
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]),
111 111
             EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]),
112 112
         ];
113
-        $sort_values   = [
113
+        $sort_values = [
114 114
             EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]),
115 115
             EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]),
116 116
         ];
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
                 // Before widget (defined by themes).
328 328
                 echo wp_kses($before_widget, AllowedTags::getAllowedTags());
329 329
                 // Display the widget title if one was input (before and after defined by themes).
330
-                if (! empty($title)) {
331
-                    echo wp_kses($before_title . $title . $after_title, AllowedTags::getAllowedTags());
330
+                if ( ! empty($title)) {
331
+                    echo wp_kses($before_title.$title.$after_title, AllowedTags::getAllowedTags());
332 332
                 }
333 333
                 echo wp_kses($this->widgetContent($post), AllowedTags::getAllowedTags());
334 334
                 // After widget (defined by themes).
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      */
348 348
     public function make_the_title_a_link($title)
349 349
     {
350
-        return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>';
350
+        return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>';
351 351
     }
352 352
 
353 353
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
             foreach ($sizes as $image_size) {
429 429
                 $image_size = trim($image_size);
430 430
                 // no big images plz
431
-                if (! in_array($image_size, ['large', 'post-thumbnail'])) {
431
+                if ( ! in_array($image_size, ['large', 'post-thumbnail'])) {
432 432
                     $image_sizes[] =
433 433
                         EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]);
434 434
                 }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     private function parseWidgetSettings(array $instance)
456 456
     {
457 457
         $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : '';
458
-        $this->events_category     = isset($instance['category_name']) && ! empty($instance['category_name'])
458
+        $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name'])
459 459
             ? $instance['category_name']
460 460
             : false;
461 461
         $this->show_expired = isset($instance['show_expired'])
@@ -513,24 +513,24 @@  discard block
 block discarded – undo
513 513
         }
514 514
         $list_items = '';
515 515
         foreach ($events as $event) {
516
-            if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) {
516
+            if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) {
517 517
                 $event_url = $this->eventUrl($event);
518 518
                 $list_items .= '
519
-                <li id="ee-upcoming-events-widget-li-' . absint($event->ID()) . '" 
519
+                <li id="ee-upcoming-events-widget-li-' . absint($event->ID()).'" 
520 520
                     class="ee-upcoming-events-widget-li"
521 521
                 >
522 522
                     <h5 class="ee-upcoming-events-widget-title-h5">
523
-                        <a class="ee-widget-event-name-a' . $this->linkClass($event) . '" href="' . $event_url . '">
524
-                            ' . esc_html($event->name()) . '
523
+                        <a class="ee-widget-event-name-a' . $this->linkClass($event).'" href="'.$event_url.'">
524
+                            ' . esc_html($event->name()).'
525 525
                         </a>
526 526
                     </h5>
527
-                    ' . $this->eventWidgetContent($event, $event_url) . '
527
+                    ' . $this->eventWidgetContent($event, $event_url).'
528 528
                 </li>';
529 529
             }
530 530
         }
531 531
         return '
532 532
             <ul class="ee-upcoming-events-widget-ul">
533
-                ' . $list_items . '
533
+                ' . $list_items.'
534 534
             </ul>';
535 535
     }
536 536
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
         return EEM_Event::instance()->get_all(
563 563
             [
564 564
                 $this->queryWhereParams(),
565
-                'limit'    => '0,' . $this->limit,
565
+                'limit'    => '0,'.$this->limit,
566 566
                 'order_by' => 'Datetime.DTT_EVT_start',
567 567
                 'order'    => $this->order,
568 568
                 'group_by' => 'EVT_ID',
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
         if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') {
651 651
             $content .= '
652 652
                 <div class="ee-upcoming-events-widget-img-dv">
653
-                    <a class="ee-upcoming-events-widget-img" href="' . $event_url . '">
654
-                        ' . get_the_post_thumbnail($event->ID(), $this->image_size) . '
653
+                    <a class="ee-upcoming-events-widget-img" href="' . $event_url.'">
654
+                        ' . get_the_post_thumbnail($event->ID(), $this->image_size).'
655 655
                     </a>
656 656
                 </div>';
657 657
         }
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
 
663 663
         if ($this->show_desc) {
664 664
             $allowedtags = AllowedTags::getAllowedTags();
665
-            $desc    = $event->short_description(25);
666
-            $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : '';
665
+            $desc = $event->short_description(25);
666
+            $content .= $desc ? '<p style="margin-top: .5em">'.wp_kses($desc, $allowedtags).'</p>' : '';
667 667
         }
668 668
 
669 669
         return $content;
@@ -679,11 +679,11 @@  discard block
 block discarded – undo
679 679
      */
680 680
     private function eventDates(EE_Event $event)
681 681
     {
682
-        $date_format        = apply_filters(
682
+        $date_format = apply_filters(
683 683
             'FHEE__espresso_event_date_range__date_format',
684 684
             get_option('date_format')
685 685
         );
686
-        $time_format        = apply_filters(
686
+        $time_format = apply_filters(
687 687
             'FHEE__espresso_event_date_range__time_format',
688 688
             get_option('time_format')
689 689
         );
Please login to merge, or discard this patch.
admin_pages/general_settings/templates/countries_settings.template.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 
15 15
     <h2 class="ee-admin-settings-hdr">
16 16
         <?php
17
-        echo esc_html__('Countries and States/Provinces', 'event_espresso');
18
-        echo EEH_Template::get_help_tab_link('country_select_info'); // already escaped
19
-        ?>
17
+		echo esc_html__('Countries and States/Provinces', 'event_espresso');
18
+		echo EEH_Template::get_help_tab_link('country_select_info'); // already escaped
19
+		?>
20 20
     </h2>
21 21
     <table class="form-table">
22 22
         <tbody>
@@ -26,27 +26,27 @@  discard block
 block discarded – undo
26 26
     <br/>
27 27
     <p>
28 28
         <?php esc_html_e(
29
-            'The country that is selected above will populate the Country Details settings and the options for States/Provinces. This information will be used throughout Event Espresso including for registration purposes and how currency is displayed. If you make a change to the country on this page, it is important that you also update your Contact Information on the Your Organization tab.',
30
-            'event_espresso'
31
-        ); ?>
29
+			'The country that is selected above will populate the Country Details settings and the options for States/Provinces. This information will be used throughout Event Espresso including for registration purposes and how currency is displayed. If you make a change to the country on this page, it is important that you also update your Contact Information on the Your Organization tab.',
30
+			'event_espresso'
31
+		); ?>
32 32
     </p>
33 33
     <p id="country-currency-setting-disabled-pg" style="display: none;">
34 34
         <span class="reminder-spn">
35 35
             <?php printf(
36
-                esc_html__(
37
-                    'Currency setting inputs are currently only enabled for the country "%1$s" which is the selected country for the site. This can be changed in the "Contact Information" section under the "Your Organization" tab of the Event Espresso - General Settings.',
38
-                    'event_espresso'
39
-                ),
40
-                $CNT_name_for_site
41
-            ); ?>
36
+				esc_html__(
37
+					'Currency setting inputs are currently only enabled for the country "%1$s" which is the selected country for the site. This can be changed in the "Contact Information" section under the "Your Organization" tab of the Event Espresso - General Settings.',
38
+					'event_espresso'
39
+				),
40
+				$CNT_name_for_site
41
+			); ?>
42 42
         </span>
43 43
     </p>
44 44
     <div id="country-details-settings-dv">
45 45
         <h2 class="ee-admin-settings-hdr">
46 46
             <?php
47
-            echo esc_html__('Country Details', 'event_espresso');
48
-            echo EEH_Template::get_help_tab_link('country_details_info'); // already escaped
49
-            ?>
47
+			echo esc_html__('Country Details', 'event_espresso');
48
+			echo EEH_Template::get_help_tab_link('country_details_info'); // already escaped
49
+			?>
50 50
         </h2>
51 51
         <div id="country-details-dv"><?php echo wp_kses($country_details_settings, AllowedTags::getAllowedTags()); ?></div>
52 52
     </div>
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
     <div id="country-states-settings-dv">
55 55
         <h2 class="ee-admin-settings-hdr">
56 56
             <?php
57
-            echo esc_html__('States/Provinces', 'event_espresso');
58
-            echo EEH_Template::get_help_tab_link('country_states_info'); // already escaped
59
-            ?>
57
+			echo esc_html__('States/Provinces', 'event_espresso');
58
+			echo EEH_Template::get_help_tab_link('country_states_info'); // already escaped
59
+			?>
60 60
         </h2>
61 61
         <div id="country-states-dv"><?php echo wp_kses($country_states_settings, AllowedTags::getAllowedTags()); ?></div>
62 62
     </div>
Please login to merge, or discard this patch.
admin_pages/general_settings/General_Settings_Admin_Page.core.php 1 patch
Indentation   +1397 added lines, -1397 removed lines patch added patch discarded remove patch
@@ -18,1412 +18,1412 @@
 block discarded – undo
18 18
 class General_Settings_Admin_Page extends EE_Admin_Page
19 19
 {
20 20
 
21
-    /**
22
-     * _question_group
23
-     * holds the specific question group object for the question group details screen
24
-     *
25
-     * @var object
26
-     */
27
-    protected $_question_group;
28
-
29
-
30
-    /**
31
-     * Initialize basic properties.
32
-     */
33
-    protected function _init_page_props()
34
-    {
35
-        $this->page_slug        = GEN_SET_PG_SLUG;
36
-        $this->page_label       = GEN_SET_LABEL;
37
-        $this->_admin_base_url  = GEN_SET_ADMIN_URL;
38
-        $this->_admin_base_path = GEN_SET_ADMIN;
39
-    }
40
-
41
-
42
-    /**
43
-     * Set ajax hooks
44
-     */
45
-    protected function _ajax_hooks()
46
-    {
47
-        add_action('wp_ajax_espresso_display_country_settings', [$this, 'display_country_settings']);
48
-        add_action('wp_ajax_espresso_display_country_states', [$this, 'display_country_states']);
49
-        add_action('wp_ajax_espresso_delete_state', [$this, 'delete_state'], 10, 3);
50
-        add_action('wp_ajax_espresso_add_new_state', [$this, 'add_new_state']);
51
-    }
52
-
53
-
54
-    /**
55
-     * More page properties initialization.
56
-     */
57
-    protected function _define_page_props()
58
-    {
59
-        $this->_admin_page_title = GEN_SET_LABEL;
60
-        $this->_labels           = [
61
-            'publishbox' => esc_html__('Update Settings', 'event_espresso'),
62
-        ];
63
-    }
64
-
65
-
66
-    /**
67
-     * Set page routes property.
68
-     */
69
-    protected function _set_page_routes()
70
-    {
71
-        $this->_page_routes = [
72
-
73
-            'critical_pages'                => [
74
-                'func'       => '_espresso_page_settings',
75
-                'capability' => 'manage_options',
76
-            ],
77
-            'update_espresso_page_settings' => [
78
-                'func'       => '_update_espresso_page_settings',
79
-                'capability' => 'manage_options',
80
-                'noheader'   => true,
81
-            ],
82
-            'default'                       => [
83
-                'func'       => '_your_organization_settings',
84
-                'capability' => 'manage_options',
85
-            ],
86
-
87
-            'update_your_organization_settings' => [
88
-                'func'       => '_update_your_organization_settings',
89
-                'capability' => 'manage_options',
90
-                'noheader'   => true,
91
-            ],
92
-
93
-            'admin_option_settings' => [
94
-                'func'       => '_admin_option_settings',
95
-                'capability' => 'manage_options',
96
-            ],
97
-
98
-            'update_admin_option_settings' => [
99
-                'func'       => '_update_admin_option_settings',
100
-                'capability' => 'manage_options',
101
-                'noheader'   => true,
102
-            ],
103
-
104
-            'country_settings' => [
105
-                'func'       => '_country_settings',
106
-                'capability' => 'manage_options',
107
-            ],
108
-
109
-            'update_country_settings' => [
110
-                'func'       => '_update_country_settings',
111
-                'capability' => 'manage_options',
112
-                'noheader'   => true,
113
-            ],
114
-
115
-            'display_country_settings' => [
116
-                'func'       => 'display_country_settings',
117
-                'capability' => 'manage_options',
118
-                'noheader'   => true,
119
-            ],
120
-
121
-            'add_new_state' => [
122
-                'func'       => 'add_new_state',
123
-                'capability' => 'manage_options',
124
-                'noheader'   => true,
125
-            ],
126
-
127
-            'delete_state'            => [
128
-                'func'       => 'delete_state',
129
-                'capability' => 'manage_options',
130
-                'noheader'   => true,
131
-            ],
132
-            'privacy_settings'        => [
133
-                'func'       => 'privacySettings',
134
-                'capability' => 'manage_options',
135
-            ],
136
-            'update_privacy_settings' => [
137
-                'func'               => 'updatePrivacySettings',
138
-                'capability'         => 'manage_options',
139
-                'noheader'           => true,
140
-                'headers_sent_route' => 'privacy_settings',
141
-            ],
142
-        ];
143
-    }
144
-
145
-
146
-    /**
147
-     * Set page configuration property
148
-     */
149
-    protected function _set_page_config()
150
-    {
151
-        $this->_page_config = [
152
-            'critical_pages'        => [
153
-                'nav'           => [
154
-                    'label' => esc_html__('Critical Pages', 'event_espresso'),
155
-                    'order' => 50,
156
-                ],
157
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
158
-                'help_tabs'     => [
159
-                    'general_settings_critical_pages_help_tab' => [
160
-                        'title'    => esc_html__('Critical Pages', 'event_espresso'),
161
-                        'filename' => 'general_settings_critical_pages',
162
-                    ],
163
-                ],
164
-                'require_nonce' => false,
165
-            ],
166
-            'default'               => [
167
-                'nav'           => [
168
-                    'label' => esc_html__('Your Organization', 'event_espresso'),
169
-                    'order' => 20,
170
-                ],
171
-                'help_tabs'     => [
172
-                    'general_settings_your_organization_help_tab' => [
173
-                        'title'    => esc_html__('Your Organization', 'event_espresso'),
174
-                        'filename' => 'general_settings_your_organization',
175
-                    ],
176
-                ],
177
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
178
-                'require_nonce' => false,
179
-            ],
180
-            'admin_option_settings' => [
181
-                'nav'           => [
182
-                    'label' => esc_html__('Admin Options', 'event_espresso'),
183
-                    'order' => 60,
184
-                ],
185
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
186
-                'help_tabs'     => [
187
-                    'general_settings_admin_options_help_tab' => [
188
-                        'title'    => esc_html__('Admin Options', 'event_espresso'),
189
-                        'filename' => 'general_settings_admin_options',
190
-                    ],
191
-                ],
192
-                'require_nonce' => false,
193
-            ],
194
-            'country_settings'      => [
195
-                'nav'           => [
196
-                    'label' => esc_html__('Countries', 'event_espresso'),
197
-                    'order' => 70,
198
-                ],
199
-                'help_tabs'     => [
200
-                    'general_settings_countries_help_tab' => [
201
-                        'title'    => esc_html__('Countries', 'event_espresso'),
202
-                        'filename' => 'general_settings_countries',
203
-                    ],
204
-                ],
205
-                'require_nonce' => false,
206
-            ],
207
-            'privacy_settings'      => [
208
-                'nav'           => [
209
-                    'label' => esc_html__('Privacy', 'event_espresso'),
210
-                    'order' => 80,
211
-                ],
212
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
213
-                'require_nonce' => false,
214
-            ],
215
-        ];
216
-    }
217
-
218
-
219
-    protected function _add_screen_options()
220
-    {
221
-    }
222
-
223
-
224
-    protected function _add_feature_pointers()
225
-    {
226
-    }
227
-
228
-
229
-    /**
230
-     * Enqueue global scripts and styles for all routes in the General Settings Admin Pages.
231
-     */
232
-    public function load_scripts_styles()
233
-    {
234
-        // styles
235
-        wp_enqueue_style('espresso-ui-theme');
236
-        // scripts
237
-        wp_enqueue_script('ee_admin_js');
238
-    }
239
-
240
-
241
-    /**
242
-     * Execute logic running on `admin_init`
243
-     */
244
-    public function admin_init()
245
-    {
246
-        EE_Registry::$i18n_js_strings['invalid_server_response'] = wp_strip_all_tags(__(
247
-            'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.',
248
-            'event_espresso'
249
-        ));
250
-        EE_Registry::$i18n_js_strings['error_occurred']          = wp_strip_all_tags(__(
251
-            'An error occurred! Please refresh the page and try again.',
252
-            'event_espresso'
253
-        ));
254
-        EE_Registry::$i18n_js_strings['confirm_delete_state']    = wp_strip_all_tags(__(
255
-            'Are you sure you want to delete this State / Province?',
256
-            'event_espresso'
257
-        ));
258
-        $protocol                                                = is_ssl() ? 'https://' : 'http://';
259
-        EE_Registry::$i18n_js_strings['ajax_url']                = admin_url(
260
-            'admin-ajax.php?page=espresso_general_settings',
261
-            $protocol
262
-        );
263
-    }
264
-
265
-
266
-    public function admin_notices()
267
-    {
268
-    }
269
-
270
-
271
-    public function admin_footer_scripts()
272
-    {
273
-    }
274
-
275
-
276
-    /**
277
-     * Enqueue scripts and styles for the default route.
278
-     */
279
-    public function load_scripts_styles_default()
280
-    {
281
-        // styles
282
-        wp_enqueue_style('thickbox');
283
-        // scripts
284
-        wp_enqueue_script('media-upload');
285
-        wp_enqueue_script('thickbox');
286
-        wp_register_script(
287
-            'organization_settings',
288
-            GEN_SET_ASSETS_URL . 'your_organization_settings.js',
289
-            ['jquery', 'media-upload', 'thickbox'],
290
-            EVENT_ESPRESSO_VERSION,
291
-            true
292
-        );
293
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION);
294
-        wp_enqueue_script('organization_settings');
295
-        wp_enqueue_style('organization-css');
296
-        $confirm_image_delete = [
297
-            'text' => wp_strip_all_tags(
298
-                __(
299
-                    'Do you really want to delete this image? Please remember to save your settings to complete the removal.',
300
-                    'event_espresso'
301
-                )
302
-            ),
303
-        ];
304
-        wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
305
-    }
306
-
307
-
308
-    /**
309
-     * Enqueue scripts and styles for the country settings route.
310
-     */
311
-    public function load_scripts_styles_country_settings()
312
-    {
313
-        // scripts
314
-        wp_register_script(
315
-            'gen_settings_countries',
316
-            GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
317
-            ['ee_admin_js'],
318
-            EVENT_ESPRESSO_VERSION,
319
-            true
320
-        );
321
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION);
322
-        wp_enqueue_script('gen_settings_countries');
323
-        wp_enqueue_style('organization-css');
324
-    }
325
-
326
-
327
-    /*************        Espresso Pages        *************/
328
-    /**
329
-     * _espresso_page_settings
330
-     *
331
-     * @throws EE_Error
332
-     * @throws DomainException
333
-     * @throws DomainException
334
-     * @throws InvalidDataTypeException
335
-     * @throws InvalidArgumentException
336
-     */
337
-    protected function _espresso_page_settings()
338
-    {
339
-        // Check to make sure all of the main pages are set up properly,
340
-        // if not create the default pages and display an admin notice
341
-        EEH_Activation::verify_default_pages_exist();
342
-        $this->_transient_garbage_collection();
343
-        $this->_template_args['values']             = $this->_yes_no_values;
344
-        $this->_template_args['reg_page_id']        = isset(EE_Registry::instance()->CFG->core->reg_page_id)
345
-            ? EE_Registry::instance()->CFG->core->reg_page_id
346
-            : null;
347
-        $this->_template_args['reg_page_obj']       = isset(EE_Registry::instance()->CFG->core->reg_page_id)
348
-            ? get_post(EE_Registry::instance()->CFG->core->reg_page_id)
349
-            : false;
350
-        $this->_template_args['txn_page_id']        = isset(EE_Registry::instance()->CFG->core->txn_page_id)
351
-            ? EE_Registry::instance()->CFG->core->txn_page_id
352
-            : null;
353
-        $this->_template_args['txn_page_obj']       = isset(EE_Registry::instance()->CFG->core->txn_page_id)
354
-            ? get_post(EE_Registry::instance()->CFG->core->txn_page_id)
355
-            : false;
356
-        $this->_template_args['thank_you_page_id']  = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
357
-            ? EE_Registry::instance()->CFG->core->thank_you_page_id
358
-            : null;
359
-        $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
360
-            ? get_post(EE_Registry::instance()->CFG->core->thank_you_page_id)
361
-            : false;
362
-        $this->_template_args['cancel_page_id']     = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
363
-            ? EE_Registry::instance()->CFG->core->cancel_page_id
364
-            : null;
365
-        $this->_template_args['cancel_page_obj']    = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
366
-            ? get_post(EE_Registry::instance()->CFG->core->cancel_page_id)
367
-            : false;
368
-        $this->_set_add_edit_form_tags('update_espresso_page_settings');
369
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
370
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
371
-            GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
372
-            $this->_template_args,
373
-            true
374
-        );
375
-        $this->display_admin_page_with_sidebar();
376
-    }
377
-
378
-
379
-    /**
380
-     * Handler for updating espresso page settings.
381
-     *
382
-     * @throws EE_Error
383
-     */
384
-    protected function _update_espresso_page_settings()
385
-    {
386
-        // capture incoming request data && set page IDs
387
-        EE_Registry::instance()->CFG->core->reg_page_id       = isset($this->_req_data['reg_page_id'])
388
-            ? absint($this->_req_data['reg_page_id'])
389
-            : EE_Registry::instance()->CFG->core->reg_page_id;
390
-        EE_Registry::instance()->CFG->core->txn_page_id       = isset($this->_req_data['txn_page_id'])
391
-            ? absint($this->_req_data['txn_page_id'])
392
-            : EE_Registry::instance()->CFG->core->txn_page_id;
393
-        EE_Registry::instance()->CFG->core->thank_you_page_id = isset($this->_req_data['thank_you_page_id'])
394
-            ? absint($this->_req_data['thank_you_page_id'])
395
-            : EE_Registry::instance()->CFG->core->thank_you_page_id;
396
-        EE_Registry::instance()->CFG->core->cancel_page_id    = isset($this->_req_data['cancel_page_id'])
397
-            ? absint($this->_req_data['cancel_page_id'])
398
-            : EE_Registry::instance()->CFG->core->cancel_page_id;
399
-
400
-        EE_Registry::instance()->CFG->core = apply_filters(
401
-            'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core',
402
-            EE_Registry::instance()->CFG->core,
403
-            $this->_req_data
404
-        );
405
-        $what                              = esc_html__('Critical Pages & Shortcodes', 'event_espresso');
406
-        $this->_redirect_after_action(
407
-            $this->_update_espresso_configuration(
408
-                $what,
409
-                EE_Registry::instance()->CFG->core,
410
-                __FILE__,
411
-                __FUNCTION__,
412
-                __LINE__
413
-            ),
414
-            $what,
415
-            '',
416
-            [
417
-                'action' => 'critical_pages',
418
-            ],
419
-            true
420
-        );
421
-    }
422
-
423
-
424
-    /*************        Your Organization        *************/
425
-
426
-
427
-    /**
428
-     * @throws DomainException
429
-     * @throws EE_Error
430
-     * @throws InvalidArgumentException
431
-     * @throws InvalidDataTypeException
432
-     * @throws InvalidInterfaceException
433
-     */
434
-    protected function _your_organization_settings()
435
-    {
436
-        $this->_template_args['admin_page_content'] = '';
437
-        try {
438
-            /** @var EventEspresso\admin_pages\general_settings\OrganizationSettings $organization_settings_form */
439
-            $organization_settings_form                 = $this->loader->getShared(
440
-                'EventEspresso\admin_pages\general_settings\OrganizationSettings'
441
-            );
442
-            $this->_template_args['admin_page_content'] = $organization_settings_form->display();
443
-        } catch (Exception $e) {
444
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
445
-        }
446
-        $this->_set_add_edit_form_tags('update_your_organization_settings');
447
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
448
-        $this->display_admin_page_with_sidebar();
449
-    }
450
-
451
-
452
-    /**
453
-     * Handler for updating organization settings.
454
-     *
455
-     * @throws EE_Error
456
-     */
457
-    protected function _update_your_organization_settings()
458
-    {
459
-        try {
460
-            /** @var EventEspresso\admin_pages\general_settings\OrganizationSettings $organization_settings_form */
461
-            $organization_settings_form  = $this->loader->getShared(
462
-                'EventEspresso\admin_pages\general_settings\OrganizationSettings'
463
-            );
464
-            $success                     = $organization_settings_form->process($this->_req_data);
465
-            EE_Registry::instance()->CFG = apply_filters(
466
-                'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG',
467
-                EE_Registry::instance()->CFG
468
-            );
469
-        } catch (Exception $e) {
470
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
471
-            $success = false;
472
-        }
473
-
474
-        if ($success) {
475
-            $success = $this->_update_espresso_configuration(
476
-                esc_html__('Your Organization Settings', 'event_espresso'),
477
-                EE_Registry::instance()->CFG,
478
-                __FILE__,
479
-                __FUNCTION__,
480
-                __LINE__
481
-            );
482
-        }
483
-
484
-        $this->_redirect_after_action($success, '', '', ['action' => 'default'], true);
485
-    }
486
-
487
-
488
-
489
-    /*************        Admin Options        *************/
490
-
491
-
492
-    /**
493
-     * _admin_option_settings
494
-     *
495
-     * @throws EE_Error
496
-     * @throws LogicException
497
-     */
498
-    protected function _admin_option_settings()
499
-    {
500
-        $this->_template_args['admin_page_content'] = '';
501
-        try {
502
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
503
-            // still need this for the old school form in Extend_General_Settings_Admin_Page
504
-            $this->_template_args['values'] = $this->_yes_no_values;
505
-            // also need to account for the do_action that was in the old template
506
-            $admin_options_settings_form->setTemplateArgs($this->_template_args);
507
-            $this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
508
-        } catch (Exception $e) {
509
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
510
-        }
511
-        $this->_set_add_edit_form_tags('update_admin_option_settings');
512
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
513
-        $this->display_admin_page_with_sidebar();
514
-    }
515
-
516
-
517
-    /**
518
-     * _update_admin_option_settings
519
-     *
520
-     * @throws EE_Error
521
-     * @throws InvalidDataTypeException
522
-     * @throws InvalidFormSubmissionException
523
-     * @throws InvalidArgumentException
524
-     * @throws LogicException
525
-     */
526
-    protected function _update_admin_option_settings()
527
-    {
528
-        try {
529
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
530
-            $admin_options_settings_form->process($this->_req_data[ $admin_options_settings_form->slug() ]);
531
-            EE_Registry::instance()->CFG->admin = apply_filters(
532
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
533
-                EE_Registry::instance()->CFG->admin
534
-            );
535
-        } catch (Exception $e) {
536
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
537
-        }
538
-        $this->_redirect_after_action(
539
-            apply_filters(
540
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
541
-                $this->_update_espresso_configuration(
542
-                    'Admin Options',
543
-                    EE_Registry::instance()->CFG->admin,
544
-                    __FILE__,
545
-                    __FUNCTION__,
546
-                    __LINE__
547
-                )
548
-            ),
549
-            'Admin Options',
550
-            'updated',
551
-            ['action' => 'admin_option_settings']
552
-        );
553
-    }
554
-
555
-
556
-    /*************        Countries        *************/
557
-
558
-
559
-    /**
560
-     * @return string
561
-     */
562
-    protected function getCountryIsoForSite()
563
-    {
564
-        return ! empty(EE_Registry::instance()->CFG->organization->CNT_ISO)
565
-            ? EE_Registry::instance()->CFG->organization->CNT_ISO
566
-            : 'US';
567
-    }
568
-
569
-
570
-    /**
571
-     * @param string          $CNT_ISO
572
-     * @param EE_Country|null $country
573
-     * @return EE_Base_Class|EE_Country
574
-     * @throws EE_Error
575
-     * @throws InvalidArgumentException
576
-     * @throws InvalidDataTypeException
577
-     * @throws InvalidInterfaceException
578
-     * @throws ReflectionException
579
-     */
580
-    protected function verifyOrGetCountryFromIso($CNT_ISO, EE_Country $country = null)
581
-    {
582
-        /** @var EE_Country $country */
583
-        return $country instanceof EE_Country && $country->ID() === $CNT_ISO
584
-            ? $country
585
-            : EEM_Country::instance()->get_one_by_ID($CNT_ISO);
586
-    }
587
-
588
-
589
-    /**
590
-     * Output Country Settings view.
591
-     *
592
-     * @throws DomainException
593
-     * @throws EE_Error
594
-     * @throws InvalidArgumentException
595
-     * @throws InvalidDataTypeException
596
-     * @throws InvalidInterfaceException
597
-     * @throws ReflectionException
598
-     */
599
-    protected function _country_settings()
600
-    {
601
-        $CNT_ISO_for_site = $this->getCountryIsoForSite();
602
-        $CNT_ISO          = isset($this->_req_data['country'])
603
-            ? strtoupper(sanitize_text_field($this->_req_data['country']))
604
-            : $CNT_ISO_for_site;
605
-
606
-        // load field generator helper
607
-
608
-        $this->_template_args['values'] = $this->_yes_no_values;
609
-
610
-        $this->_template_args['countries'] = new EE_Question_Form_Input(
611
-            EE_Question::new_instance(
612
-                [
613
-                    'QST_ID'           => 0,
614
-                    'QST_display_text' => esc_html__('Select Country', 'event_espresso'),
615
-                    'QST_system'       => 'admin-country',
616
-                ]
617
-            ),
618
-            EE_Answer::new_instance(
619
-                [
620
-                    'ANS_ID'    => 0,
621
-                    'ANS_value' => $CNT_ISO,
622
-                ]
623
-            ),
624
-            [
625
-                'input_id'       => 'country',
626
-                'input_name'     => 'country',
627
-                'input_prefix'   => '',
628
-                'append_qstn_id' => false,
629
-            ]
630
-        );
631
-        $country                           = $this->verifyOrGetCountryFromIso($CNT_ISO_for_site);
632
-        add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10, 2);
633
-        add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10, 2);
634
-        $this->_template_args['country_details_settings'] = $this->display_country_settings(
635
-            $country->ID(),
636
-            $country
637
-        );
638
-        $this->_template_args['country_states_settings']  = $this->display_country_states(
639
-            $country->ID(),
640
-            $country
641
-        );
642
-        $this->_template_args['CNT_name_for_site']        = $country->name();
643
-
644
-        $this->_set_add_edit_form_tags('update_country_settings');
645
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
646
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
647
-            GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
648
-            $this->_template_args,
649
-            true
650
-        );
651
-        $this->display_admin_page_with_no_sidebar();
652
-    }
653
-
654
-
655
-    /**
656
-     * @param string          $CNT_ISO
657
-     * @param EE_Country|null $country
658
-     * @return string
659
-     * @throws DomainException
660
-     * @throws EE_Error
661
-     * @throws InvalidArgumentException
662
-     * @throws InvalidDataTypeException
663
-     * @throws InvalidInterfaceException
664
-     * @throws ReflectionException
665
-     */
666
-    public function display_country_settings($CNT_ISO = '', EE_Country $country = null)
667
-    {
668
-        $CNT_ISO_for_site = $this->getCountryIsoForSite();
669
-
670
-        $CNT_ISO = isset($this->_req_data['country'])
671
-            ? strtoupper(sanitize_text_field($this->_req_data['country']))
672
-            : $CNT_ISO;
673
-        if (! $CNT_ISO) {
674
-            return '';
675
-        }
676
-
677
-        // for ajax
678
-        remove_all_filters('FHEE__EEH_Form_Fields__label_html');
679
-        remove_all_filters('FHEE__EEH_Form_Fields__input_html');
680
-        add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10, 2);
681
-        add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10, 2);
682
-        $country                                  = $this->verifyOrGetCountryFromIso($CNT_ISO, $country);
683
-        $CNT_cur_disabled                         = $CNT_ISO !== $CNT_ISO_for_site;
684
-        $this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled;
685
-
686
-        $country_input_types            = [
687
-            'CNT_active'      => [
688
-                'type'             => 'RADIO_BTN',
689
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
690
-                'class'            => '',
691
-                'options'          => $this->_yes_no_values,
692
-                'use_desc_4_label' => true,
693
-            ],
694
-            'CNT_ISO'         => [
695
-                'type'       => 'TEXT',
696
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
697
-                'class'      => 'small-text',
698
-            ],
699
-            'CNT_ISO3'        => [
700
-                'type'       => 'TEXT',
701
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
702
-                'class'      => 'small-text',
703
-            ],
704
-            'RGN_ID'          => [
705
-                'type'       => 'TEXT',
706
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
707
-                'class'      => 'small-text',
708
-            ],
709
-            'CNT_name'        => [
710
-                'type'       => 'TEXT',
711
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
712
-                'class'      => 'regular-text',
713
-            ],
714
-            'CNT_cur_code'    => [
715
-                'type'       => 'TEXT',
716
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
717
-                'class'      => 'small-text',
718
-                'disabled'   => $CNT_cur_disabled,
719
-            ],
720
-            'CNT_cur_single'  => [
721
-                'type'       => 'TEXT',
722
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
723
-                'class'      => 'medium-text',
724
-                'disabled'   => $CNT_cur_disabled,
725
-            ],
726
-            'CNT_cur_plural'  => [
727
-                'type'       => 'TEXT',
728
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
729
-                'class'      => 'medium-text',
730
-                'disabled'   => $CNT_cur_disabled,
731
-            ],
732
-            'CNT_cur_sign'    => [
733
-                'type'         => 'TEXT',
734
-                'input_name'   => 'cntry[' . $CNT_ISO . ']',
735
-                'class'        => 'small-text',
736
-                'htmlentities' => false,
737
-                'disabled'     => $CNT_cur_disabled,
738
-            ],
739
-            'CNT_cur_sign_b4' => [
740
-                'type'             => 'RADIO_BTN',
741
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
742
-                'class'            => '',
743
-                'options'          => $this->_yes_no_values,
744
-                'use_desc_4_label' => true,
745
-                'disabled'         => $CNT_cur_disabled,
746
-            ],
747
-            'CNT_cur_dec_plc' => [
748
-                'type'       => 'RADIO_BTN',
749
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
750
-                'class'      => '',
751
-                'options'    => [
752
-                    ['id' => 0, 'text' => ''],
753
-                    ['id' => 1, 'text' => ''],
754
-                    ['id' => 2, 'text' => ''],
755
-                    ['id' => 3, 'text' => ''],
756
-                ],
757
-                'disabled'   => $CNT_cur_disabled,
758
-            ],
759
-            'CNT_cur_dec_mrk' => [
760
-                'type'             => 'RADIO_BTN',
761
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
762
-                'class'            => '',
763
-                'options'          => [
764
-                    [
765
-                        'id'   => ',',
766
-                        'text' => esc_html__(', (comma)', 'event_espresso'),
767
-                    ],
768
-                    ['id' => '.', 'text' => esc_html__('. (decimal)', 'event_espresso')],
769
-                ],
770
-                'use_desc_4_label' => true,
771
-                'disabled'         => $CNT_cur_disabled,
772
-            ],
773
-            'CNT_cur_thsnds'  => [
774
-                'type'             => 'RADIO_BTN',
775
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
776
-                'class'            => '',
777
-                'options'          => [
778
-                    [
779
-                        'id'   => ',',
780
-                        'text' => esc_html__(', (comma)', 'event_espresso'),
781
-                    ],
782
-                    [
783
-                        'id'   => '.',
784
-                        'text' => esc_html__('. (decimal)', 'event_espresso'),
785
-                    ],
786
-                    [
787
-                        'id'   => '&nbsp;',
788
-                        'text' => esc_html__('(space)', 'event_espresso'),
789
-                    ],
790
-                ],
791
-                'use_desc_4_label' => true,
792
-                'disabled'         => $CNT_cur_disabled,
793
-            ],
794
-            'CNT_tel_code'    => [
795
-                'type'       => 'TEXT',
796
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
797
-                'class'      => 'small-text',
798
-            ],
799
-            'CNT_is_EU'       => [
800
-                'type'             => 'RADIO_BTN',
801
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
802
-                'class'            => '',
803
-                'options'          => $this->_yes_no_values,
804
-                'use_desc_4_label' => true,
805
-            ],
806
-        ];
807
-        $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object(
808
-            $country,
809
-            $country_input_types
810
-        );
811
-        $country_details_settings       = EEH_Template::display_template(
812
-            GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
813
-            $this->_template_args,
814
-            true
815
-        );
816
-
817
-        if (defined('DOING_AJAX')) {
818
-            $notices = EE_Error::get_notices(false, false, false);
819
-            echo wp_json_encode(
820
-                [
821
-                    'return_data' => $country_details_settings,
822
-                    'success'     => $notices['success'],
823
-                    'errors'      => $notices['errors'],
824
-                ]
825
-            );
826
-            die();
827
-        } else {
828
-            return $country_details_settings;
829
-        }
830
-    }
831
-
832
-
833
-    /**
834
-     * @param string          $CNT_ISO
835
-     * @param EE_Country|null $country
836
-     * @return string
837
-     * @throws DomainException
838
-     * @throws EE_Error
839
-     * @throws InvalidArgumentException
840
-     * @throws InvalidDataTypeException
841
-     * @throws InvalidInterfaceException
842
-     * @throws ReflectionException
843
-     */
844
-    public function display_country_states($CNT_ISO = '', EE_Country $country = null)
845
-    {
846
-
847
-        $CNT_ISO = isset($this->_req_data['country'])
848
-            ? sanitize_text_field($this->_req_data['country'])
849
-            : $CNT_ISO;
850
-        if (! $CNT_ISO) {
851
-            return '';
852
-        }
853
-        // for ajax
854
-        remove_all_filters('FHEE__EEH_Form_Fields__label_html');
855
-        remove_all_filters('FHEE__EEH_Form_Fields__input_html');
856
-        add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'state_form_field_label_wrap'], 10, 2);
857
-        add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'state_form_field_input__wrap'], 10, 2);
858
-        $states = EEM_State::instance()->get_all_states_for_these_countries([$CNT_ISO => $CNT_ISO]);
859
-        if (empty($states)) {
860
-            /** @var EventEspresso\core\services\address\CountrySubRegionDao $countrySubRegionDao */
861
-            $countrySubRegionDao = $this->loader->getShared(
862
-                'EventEspresso\core\services\address\CountrySubRegionDao'
863
-            );
864
-            if ($countrySubRegionDao instanceof EventEspresso\core\services\address\CountrySubRegionDao) {
865
-                $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country);
866
-                if ($countrySubRegionDao->saveCountrySubRegions($country)) {
867
-                    $states = EEM_State::instance()->get_all_states_for_these_countries(
868
-                        [$CNT_ISO => $CNT_ISO]
869
-                    );
870
-                }
871
-            }
872
-        }
873
-        if (is_array($states)) {
874
-            foreach ($states as $STA_ID => $state) {
875
-                if ($state instanceof EE_State) {
876
-                    // STA_abbrev    STA_name    STA_active
877
-                    $state_input_types                                             = [
878
-                        'STA_abbrev' => [
879
-                            'type'       => 'TEXT',
880
-                            'input_name' => 'states[' . $STA_ID . ']',
881
-                            'class'      => 'small-text',
882
-                        ],
883
-                        'STA_name'   => [
884
-                            'type'       => 'TEXT',
885
-                            'input_name' => 'states[' . $STA_ID . ']',
886
-                            'class'      => 'regular-text',
887
-                        ],
888
-                        'STA_active' => [
889
-                            'type'             => 'RADIO_BTN',
890
-                            'input_name'       => 'states[' . $STA_ID . ']',
891
-                            'options'          => $this->_yes_no_values,
892
-                            'use_desc_4_label' => true,
893
-                        ],
894
-                    ];
895
-                    $this->_template_args['states'][ $STA_ID ]['inputs']           =
896
-                        EE_Question_Form_Input::generate_question_form_inputs_for_object(
897
-                            $state,
898
-                            $state_input_types
899
-                        );
900
-                    $query_args                                                    = [
901
-                        'action'     => 'delete_state',
902
-                        'STA_ID'     => $STA_ID,
903
-                        'CNT_ISO'    => $CNT_ISO,
904
-                        'STA_abbrev' => $state->abbrev(),
905
-                    ];
906
-                    $this->_template_args['states'][ $STA_ID ]['delete_state_url'] =
907
-                        EE_Admin_Page::add_query_args_and_nonce(
908
-                            $query_args,
909
-                            GEN_SET_ADMIN_URL
910
-                        );
911
-                }
912
-            }
913
-        } else {
914
-            $this->_template_args['states'] = false;
915
-        }
916
-
917
-        $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(
918
-            ['action' => 'add_new_state'],
919
-            GEN_SET_ADMIN_URL
920
-        );
921
-
922
-        $state_details_settings = EEH_Template::display_template(
923
-            GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
924
-            $this->_template_args,
925
-            true
926
-        );
927
-
928
-        if (defined('DOING_AJAX')) {
929
-            $notices = EE_Error::get_notices(false, false, false);
930
-            echo wp_json_encode(
931
-                [
932
-                    'return_data' => $state_details_settings,
933
-                    'success'     => $notices['success'],
934
-                    'errors'      => $notices['errors'],
935
-                ]
936
-            );
937
-            die();
938
-        } else {
939
-            return $state_details_settings;
940
-        }
941
-    }
942
-
943
-
944
-    /**
945
-     *        add_new_state
946
-     *
947
-     * @access    public
948
-     * @return void
949
-     * @throws EE_Error
950
-     * @throws InvalidArgumentException
951
-     * @throws InvalidDataTypeException
952
-     * @throws InvalidInterfaceException
953
-     */
954
-    public function add_new_state()
955
-    {
956
-
957
-        $success = true;
958
-
959
-        $CNT_ISO = isset($this->_req_data['CNT_ISO'])
960
-            ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
961
-            : false;
962
-        if (! $CNT_ISO) {
963
-            EE_Error::add_error(
964
-                esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
965
-                __FILE__,
966
-                __FUNCTION__,
967
-                __LINE__
968
-            );
969
-            $success = false;
970
-        }
971
-        $STA_abbrev = isset($this->_req_data['STA_abbrev'])
972
-            ? sanitize_text_field($this->_req_data['STA_abbrev'])
973
-            : false;
974
-        if (! $STA_abbrev) {
975
-            EE_Error::add_error(
976
-                esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
977
-                __FILE__,
978
-                __FUNCTION__,
979
-                __LINE__
980
-            );
981
-            $success = false;
982
-        }
983
-        $STA_name = isset($this->_req_data['STA_name'])
984
-            ? sanitize_text_field($this->_req_data['STA_name'])
985
-            : false;
986
-        if (! $STA_name) {
987
-            EE_Error::add_error(
988
-                esc_html__('No State name or an invalid State name was received.', 'event_espresso'),
989
-                __FILE__,
990
-                __FUNCTION__,
991
-                __LINE__
992
-            );
993
-            $success = false;
994
-        }
995
-
996
-        if ($success) {
997
-            $cols_n_values = [
998
-                'CNT_ISO'    => $CNT_ISO,
999
-                'STA_abbrev' => $STA_abbrev,
1000
-                'STA_name'   => $STA_name,
1001
-                'STA_active' => true,
1002
-            ];
1003
-            $success       = EEM_State::instance()->insert($cols_n_values);
1004
-            EE_Error::add_success(esc_html__('The State was added successfully.', 'event_espresso'));
1005
-        }
1006
-
1007
-        if (defined('DOING_AJAX')) {
1008
-            $notices = EE_Error::get_notices(false, false, false);
1009
-            echo wp_json_encode(array_merge($notices, ['return_data' => $CNT_ISO]));
1010
-            die();
1011
-        } else {
1012
-            $this->_redirect_after_action($success, 'State', 'added', ['action' => 'country_settings']);
1013
-        }
1014
-    }
1015
-
1016
-
1017
-    /**
1018
-     * @return void
1019
-     * @throws EE_Error
1020
-     * @throws InvalidArgumentException
1021
-     * @throws InvalidDataTypeException
1022
-     * @throws InvalidInterfaceException
1023
-     */
1024
-    public function delete_state()
1025
-    {
1026
-        $CNT_ISO    = isset($this->_req_data['CNT_ISO'])
1027
-            ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
1028
-            : false;
1029
-        $STA_ID     = isset($this->_req_data['STA_ID'])
1030
-            ? sanitize_text_field($this->_req_data['STA_ID'])
1031
-            : false;
1032
-        $STA_abbrev = isset($this->_req_data['STA_abbrev'])
1033
-            ? sanitize_text_field($this->_req_data['STA_abbrev'])
1034
-            : false;
1035
-        if (! $STA_ID) {
1036
-            EE_Error::add_error(
1037
-                esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'),
1038
-                __FILE__,
1039
-                __FUNCTION__,
1040
-                __LINE__
1041
-            );
1042
-            return;
1043
-        }
1044
-
1045
-        $success = EEM_State::instance()->delete_by_ID($STA_ID);
1046
-        if ($success !== false) {
1047
-            do_action(
1048
-                'AHEE__General_Settings_Admin_Page__delete_state__state_deleted',
1049
-                $CNT_ISO,
1050
-                $STA_ID,
1051
-                ['STA_abbrev' => $STA_abbrev]
1052
-            );
1053
-            EE_Error::add_success(esc_html__('The State was deleted successfully.', 'event_espresso'));
1054
-        }
1055
-        if (defined('DOING_AJAX')) {
1056
-            $notices                = EE_Error::get_notices(false);
1057
-            $notices['return_data'] = true;
1058
-            echo wp_json_encode($notices);
1059
-            die();
1060
-        } else {
1061
-            $this->_redirect_after_action(
1062
-                $success,
1063
-                'State',
1064
-                'deleted',
1065
-                ['action' => 'country_settings']
1066
-            );
1067
-        }
1068
-    }
1069
-
1070
-
1071
-    /**
1072
-     *        _update_country_settings
1073
-     *
1074
-     * @return void
1075
-     * @throws EE_Error
1076
-     * @throws InvalidArgumentException
1077
-     * @throws InvalidDataTypeException
1078
-     * @throws InvalidInterfaceException
1079
-     */
1080
-    protected function _update_country_settings()
1081
-    {
1082
-        // grab the country ISO code
1083
-        $CNT_ISO = isset($this->_req_data['country'])
1084
-            ? strtoupper(sanitize_text_field($this->_req_data['country']))
1085
-            : false;
1086
-        if (! $CNT_ISO) {
1087
-            EE_Error::add_error(
1088
-                esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
1089
-                __FILE__,
1090
-                __FUNCTION__,
1091
-                __LINE__
1092
-            );
1093
-
1094
-            return;
1095
-        }
1096
-        $cols_n_values             = [];
1097
-        $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3'])
1098
-            ? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3']))
1099
-            : false;
1100
-        $cols_n_values['RGN_ID']   = isset($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1101
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1102
-            : null;
1103
-        $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1104
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1105
-            : null;
1106
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])) {
1107
-            $cols_n_values['CNT_cur_code'] = strtoupper(
1108
-                sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])
1109
-            );
1110
-        }
1111
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])) {
1112
-            $cols_n_values['CNT_cur_single'] = sanitize_text_field(
1113
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single']
1114
-            );
1115
-        }
1116
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])) {
1117
-            $cols_n_values['CNT_cur_plural'] = sanitize_text_field(
1118
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural']
1119
-            );
1120
-        }
1121
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])) {
1122
-            $cols_n_values['CNT_cur_sign'] = sanitize_text_field(
1123
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign']
1124
-            );
1125
-        }
1126
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])) {
1127
-            $cols_n_values['CNT_cur_sign_b4'] = absint(
1128
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4']
1129
-            );
1130
-        }
1131
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])) {
1132
-            $cols_n_values['CNT_cur_dec_plc'] = absint(
1133
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc']
1134
-            );
1135
-        }
1136
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])) {
1137
-            $cols_n_values['CNT_cur_dec_mrk'] = sanitize_text_field(
1138
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk']
1139
-            );
1140
-        }
1141
-        if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])) {
1142
-            $cols_n_values['CNT_cur_thsnds'] = sanitize_text_field(
1143
-                $this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds']
1144
-            );
1145
-        }
1146
-        $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1147
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1148
-            : null;
1149
-        $cols_n_values['CNT_is_EU']    = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1150
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1151
-            : false;
1152
-        $cols_n_values['CNT_active']   = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1153
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1154
-            : false;
1155
-        // allow filtering of country data
1156
-        $cols_n_values = apply_filters(
1157
-            'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values',
1158
-            $cols_n_values
1159
-        );
1160
-
1161
-        // where values
1162
-        $where_cols_n_values = [['CNT_ISO' => $CNT_ISO]];
1163
-        // run the update
1164
-        $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
1165
-
1166
-        if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) {
1167
-            // allow filtering of states data
1168
-            $states = apply_filters(
1169
-                'FHEE__General_Settings_Admin_Page___update_country_settings__states',
1170
-                $this->_req_data['states']
1171
-            );
1172
-
1173
-            // loop thru state data ( looks like : states[75][STA_name] )
1174
-            foreach ($states as $STA_ID => $state) {
1175
-                $cols_n_values = [
1176
-                    'CNT_ISO'    => $CNT_ISO,
1177
-                    'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
1178
-                    'STA_name'   => sanitize_text_field($state['STA_name']),
1179
-                    'STA_active' => (bool) absint($state['STA_active']),
1180
-                ];
1181
-                // where values
1182
-                $where_cols_n_values = [['STA_ID' => $STA_ID]];
1183
-                // run the update
1184
-                $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
1185
-                if ($success !== false) {
1186
-                    do_action(
1187
-                        'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved',
1188
-                        $CNT_ISO,
1189
-                        $STA_ID,
1190
-                        $cols_n_values
1191
-                    );
1192
-                }
1193
-            }
1194
-        }
1195
-        // check if country being edited matches org option country, and if so, then  update EE_Config with new settings
1196
-        if (
1197
-            isset(EE_Registry::instance()->CFG->organization->CNT_ISO)
1198
-            && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO
1199
-        ) {
1200
-            EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
1201
-            EE_Registry::instance()->CFG->update_espresso_config();
1202
-        }
1203
-
1204
-        if ($success !== false) {
1205
-            EE_Error::add_success(
1206
-                esc_html__('Country Settings updated successfully.', 'event_espresso')
1207
-            );
1208
-        }
1209
-        $this->_redirect_after_action(
1210
-            $success,
1211
-            '',
1212
-            '',
1213
-            ['action' => 'country_settings', 'country' => $CNT_ISO],
1214
-            true
1215
-        );
1216
-    }
1217
-
1218
-
1219
-    /**
1220
-     *        form_form_field_label_wrap
1221
-     *
1222
-     * @param string $label
1223
-     * @return        string
1224
-     */
1225
-    public function country_form_field_label_wrap($label, $required_text)
1226
-    {
1227
-        return '
21
+	/**
22
+	 * _question_group
23
+	 * holds the specific question group object for the question group details screen
24
+	 *
25
+	 * @var object
26
+	 */
27
+	protected $_question_group;
28
+
29
+
30
+	/**
31
+	 * Initialize basic properties.
32
+	 */
33
+	protected function _init_page_props()
34
+	{
35
+		$this->page_slug        = GEN_SET_PG_SLUG;
36
+		$this->page_label       = GEN_SET_LABEL;
37
+		$this->_admin_base_url  = GEN_SET_ADMIN_URL;
38
+		$this->_admin_base_path = GEN_SET_ADMIN;
39
+	}
40
+
41
+
42
+	/**
43
+	 * Set ajax hooks
44
+	 */
45
+	protected function _ajax_hooks()
46
+	{
47
+		add_action('wp_ajax_espresso_display_country_settings', [$this, 'display_country_settings']);
48
+		add_action('wp_ajax_espresso_display_country_states', [$this, 'display_country_states']);
49
+		add_action('wp_ajax_espresso_delete_state', [$this, 'delete_state'], 10, 3);
50
+		add_action('wp_ajax_espresso_add_new_state', [$this, 'add_new_state']);
51
+	}
52
+
53
+
54
+	/**
55
+	 * More page properties initialization.
56
+	 */
57
+	protected function _define_page_props()
58
+	{
59
+		$this->_admin_page_title = GEN_SET_LABEL;
60
+		$this->_labels           = [
61
+			'publishbox' => esc_html__('Update Settings', 'event_espresso'),
62
+		];
63
+	}
64
+
65
+
66
+	/**
67
+	 * Set page routes property.
68
+	 */
69
+	protected function _set_page_routes()
70
+	{
71
+		$this->_page_routes = [
72
+
73
+			'critical_pages'                => [
74
+				'func'       => '_espresso_page_settings',
75
+				'capability' => 'manage_options',
76
+			],
77
+			'update_espresso_page_settings' => [
78
+				'func'       => '_update_espresso_page_settings',
79
+				'capability' => 'manage_options',
80
+				'noheader'   => true,
81
+			],
82
+			'default'                       => [
83
+				'func'       => '_your_organization_settings',
84
+				'capability' => 'manage_options',
85
+			],
86
+
87
+			'update_your_organization_settings' => [
88
+				'func'       => '_update_your_organization_settings',
89
+				'capability' => 'manage_options',
90
+				'noheader'   => true,
91
+			],
92
+
93
+			'admin_option_settings' => [
94
+				'func'       => '_admin_option_settings',
95
+				'capability' => 'manage_options',
96
+			],
97
+
98
+			'update_admin_option_settings' => [
99
+				'func'       => '_update_admin_option_settings',
100
+				'capability' => 'manage_options',
101
+				'noheader'   => true,
102
+			],
103
+
104
+			'country_settings' => [
105
+				'func'       => '_country_settings',
106
+				'capability' => 'manage_options',
107
+			],
108
+
109
+			'update_country_settings' => [
110
+				'func'       => '_update_country_settings',
111
+				'capability' => 'manage_options',
112
+				'noheader'   => true,
113
+			],
114
+
115
+			'display_country_settings' => [
116
+				'func'       => 'display_country_settings',
117
+				'capability' => 'manage_options',
118
+				'noheader'   => true,
119
+			],
120
+
121
+			'add_new_state' => [
122
+				'func'       => 'add_new_state',
123
+				'capability' => 'manage_options',
124
+				'noheader'   => true,
125
+			],
126
+
127
+			'delete_state'            => [
128
+				'func'       => 'delete_state',
129
+				'capability' => 'manage_options',
130
+				'noheader'   => true,
131
+			],
132
+			'privacy_settings'        => [
133
+				'func'       => 'privacySettings',
134
+				'capability' => 'manage_options',
135
+			],
136
+			'update_privacy_settings' => [
137
+				'func'               => 'updatePrivacySettings',
138
+				'capability'         => 'manage_options',
139
+				'noheader'           => true,
140
+				'headers_sent_route' => 'privacy_settings',
141
+			],
142
+		];
143
+	}
144
+
145
+
146
+	/**
147
+	 * Set page configuration property
148
+	 */
149
+	protected function _set_page_config()
150
+	{
151
+		$this->_page_config = [
152
+			'critical_pages'        => [
153
+				'nav'           => [
154
+					'label' => esc_html__('Critical Pages', 'event_espresso'),
155
+					'order' => 50,
156
+				],
157
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
158
+				'help_tabs'     => [
159
+					'general_settings_critical_pages_help_tab' => [
160
+						'title'    => esc_html__('Critical Pages', 'event_espresso'),
161
+						'filename' => 'general_settings_critical_pages',
162
+					],
163
+				],
164
+				'require_nonce' => false,
165
+			],
166
+			'default'               => [
167
+				'nav'           => [
168
+					'label' => esc_html__('Your Organization', 'event_espresso'),
169
+					'order' => 20,
170
+				],
171
+				'help_tabs'     => [
172
+					'general_settings_your_organization_help_tab' => [
173
+						'title'    => esc_html__('Your Organization', 'event_espresso'),
174
+						'filename' => 'general_settings_your_organization',
175
+					],
176
+				],
177
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
178
+				'require_nonce' => false,
179
+			],
180
+			'admin_option_settings' => [
181
+				'nav'           => [
182
+					'label' => esc_html__('Admin Options', 'event_espresso'),
183
+					'order' => 60,
184
+				],
185
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
186
+				'help_tabs'     => [
187
+					'general_settings_admin_options_help_tab' => [
188
+						'title'    => esc_html__('Admin Options', 'event_espresso'),
189
+						'filename' => 'general_settings_admin_options',
190
+					],
191
+				],
192
+				'require_nonce' => false,
193
+			],
194
+			'country_settings'      => [
195
+				'nav'           => [
196
+					'label' => esc_html__('Countries', 'event_espresso'),
197
+					'order' => 70,
198
+				],
199
+				'help_tabs'     => [
200
+					'general_settings_countries_help_tab' => [
201
+						'title'    => esc_html__('Countries', 'event_espresso'),
202
+						'filename' => 'general_settings_countries',
203
+					],
204
+				],
205
+				'require_nonce' => false,
206
+			],
207
+			'privacy_settings'      => [
208
+				'nav'           => [
209
+					'label' => esc_html__('Privacy', 'event_espresso'),
210
+					'order' => 80,
211
+				],
212
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
213
+				'require_nonce' => false,
214
+			],
215
+		];
216
+	}
217
+
218
+
219
+	protected function _add_screen_options()
220
+	{
221
+	}
222
+
223
+
224
+	protected function _add_feature_pointers()
225
+	{
226
+	}
227
+
228
+
229
+	/**
230
+	 * Enqueue global scripts and styles for all routes in the General Settings Admin Pages.
231
+	 */
232
+	public function load_scripts_styles()
233
+	{
234
+		// styles
235
+		wp_enqueue_style('espresso-ui-theme');
236
+		// scripts
237
+		wp_enqueue_script('ee_admin_js');
238
+	}
239
+
240
+
241
+	/**
242
+	 * Execute logic running on `admin_init`
243
+	 */
244
+	public function admin_init()
245
+	{
246
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = wp_strip_all_tags(__(
247
+			'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.',
248
+			'event_espresso'
249
+		));
250
+		EE_Registry::$i18n_js_strings['error_occurred']          = wp_strip_all_tags(__(
251
+			'An error occurred! Please refresh the page and try again.',
252
+			'event_espresso'
253
+		));
254
+		EE_Registry::$i18n_js_strings['confirm_delete_state']    = wp_strip_all_tags(__(
255
+			'Are you sure you want to delete this State / Province?',
256
+			'event_espresso'
257
+		));
258
+		$protocol                                                = is_ssl() ? 'https://' : 'http://';
259
+		EE_Registry::$i18n_js_strings['ajax_url']                = admin_url(
260
+			'admin-ajax.php?page=espresso_general_settings',
261
+			$protocol
262
+		);
263
+	}
264
+
265
+
266
+	public function admin_notices()
267
+	{
268
+	}
269
+
270
+
271
+	public function admin_footer_scripts()
272
+	{
273
+	}
274
+
275
+
276
+	/**
277
+	 * Enqueue scripts and styles for the default route.
278
+	 */
279
+	public function load_scripts_styles_default()
280
+	{
281
+		// styles
282
+		wp_enqueue_style('thickbox');
283
+		// scripts
284
+		wp_enqueue_script('media-upload');
285
+		wp_enqueue_script('thickbox');
286
+		wp_register_script(
287
+			'organization_settings',
288
+			GEN_SET_ASSETS_URL . 'your_organization_settings.js',
289
+			['jquery', 'media-upload', 'thickbox'],
290
+			EVENT_ESPRESSO_VERSION,
291
+			true
292
+		);
293
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION);
294
+		wp_enqueue_script('organization_settings');
295
+		wp_enqueue_style('organization-css');
296
+		$confirm_image_delete = [
297
+			'text' => wp_strip_all_tags(
298
+				__(
299
+					'Do you really want to delete this image? Please remember to save your settings to complete the removal.',
300
+					'event_espresso'
301
+				)
302
+			),
303
+		];
304
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
305
+	}
306
+
307
+
308
+	/**
309
+	 * Enqueue scripts and styles for the country settings route.
310
+	 */
311
+	public function load_scripts_styles_country_settings()
312
+	{
313
+		// scripts
314
+		wp_register_script(
315
+			'gen_settings_countries',
316
+			GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
317
+			['ee_admin_js'],
318
+			EVENT_ESPRESSO_VERSION,
319
+			true
320
+		);
321
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION);
322
+		wp_enqueue_script('gen_settings_countries');
323
+		wp_enqueue_style('organization-css');
324
+	}
325
+
326
+
327
+	/*************        Espresso Pages        *************/
328
+	/**
329
+	 * _espresso_page_settings
330
+	 *
331
+	 * @throws EE_Error
332
+	 * @throws DomainException
333
+	 * @throws DomainException
334
+	 * @throws InvalidDataTypeException
335
+	 * @throws InvalidArgumentException
336
+	 */
337
+	protected function _espresso_page_settings()
338
+	{
339
+		// Check to make sure all of the main pages are set up properly,
340
+		// if not create the default pages and display an admin notice
341
+		EEH_Activation::verify_default_pages_exist();
342
+		$this->_transient_garbage_collection();
343
+		$this->_template_args['values']             = $this->_yes_no_values;
344
+		$this->_template_args['reg_page_id']        = isset(EE_Registry::instance()->CFG->core->reg_page_id)
345
+			? EE_Registry::instance()->CFG->core->reg_page_id
346
+			: null;
347
+		$this->_template_args['reg_page_obj']       = isset(EE_Registry::instance()->CFG->core->reg_page_id)
348
+			? get_post(EE_Registry::instance()->CFG->core->reg_page_id)
349
+			: false;
350
+		$this->_template_args['txn_page_id']        = isset(EE_Registry::instance()->CFG->core->txn_page_id)
351
+			? EE_Registry::instance()->CFG->core->txn_page_id
352
+			: null;
353
+		$this->_template_args['txn_page_obj']       = isset(EE_Registry::instance()->CFG->core->txn_page_id)
354
+			? get_post(EE_Registry::instance()->CFG->core->txn_page_id)
355
+			: false;
356
+		$this->_template_args['thank_you_page_id']  = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
357
+			? EE_Registry::instance()->CFG->core->thank_you_page_id
358
+			: null;
359
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
360
+			? get_post(EE_Registry::instance()->CFG->core->thank_you_page_id)
361
+			: false;
362
+		$this->_template_args['cancel_page_id']     = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
363
+			? EE_Registry::instance()->CFG->core->cancel_page_id
364
+			: null;
365
+		$this->_template_args['cancel_page_obj']    = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
366
+			? get_post(EE_Registry::instance()->CFG->core->cancel_page_id)
367
+			: false;
368
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
369
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
370
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
371
+			GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
372
+			$this->_template_args,
373
+			true
374
+		);
375
+		$this->display_admin_page_with_sidebar();
376
+	}
377
+
378
+
379
+	/**
380
+	 * Handler for updating espresso page settings.
381
+	 *
382
+	 * @throws EE_Error
383
+	 */
384
+	protected function _update_espresso_page_settings()
385
+	{
386
+		// capture incoming request data && set page IDs
387
+		EE_Registry::instance()->CFG->core->reg_page_id       = isset($this->_req_data['reg_page_id'])
388
+			? absint($this->_req_data['reg_page_id'])
389
+			: EE_Registry::instance()->CFG->core->reg_page_id;
390
+		EE_Registry::instance()->CFG->core->txn_page_id       = isset($this->_req_data['txn_page_id'])
391
+			? absint($this->_req_data['txn_page_id'])
392
+			: EE_Registry::instance()->CFG->core->txn_page_id;
393
+		EE_Registry::instance()->CFG->core->thank_you_page_id = isset($this->_req_data['thank_you_page_id'])
394
+			? absint($this->_req_data['thank_you_page_id'])
395
+			: EE_Registry::instance()->CFG->core->thank_you_page_id;
396
+		EE_Registry::instance()->CFG->core->cancel_page_id    = isset($this->_req_data['cancel_page_id'])
397
+			? absint($this->_req_data['cancel_page_id'])
398
+			: EE_Registry::instance()->CFG->core->cancel_page_id;
399
+
400
+		EE_Registry::instance()->CFG->core = apply_filters(
401
+			'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core',
402
+			EE_Registry::instance()->CFG->core,
403
+			$this->_req_data
404
+		);
405
+		$what                              = esc_html__('Critical Pages & Shortcodes', 'event_espresso');
406
+		$this->_redirect_after_action(
407
+			$this->_update_espresso_configuration(
408
+				$what,
409
+				EE_Registry::instance()->CFG->core,
410
+				__FILE__,
411
+				__FUNCTION__,
412
+				__LINE__
413
+			),
414
+			$what,
415
+			'',
416
+			[
417
+				'action' => 'critical_pages',
418
+			],
419
+			true
420
+		);
421
+	}
422
+
423
+
424
+	/*************        Your Organization        *************/
425
+
426
+
427
+	/**
428
+	 * @throws DomainException
429
+	 * @throws EE_Error
430
+	 * @throws InvalidArgumentException
431
+	 * @throws InvalidDataTypeException
432
+	 * @throws InvalidInterfaceException
433
+	 */
434
+	protected function _your_organization_settings()
435
+	{
436
+		$this->_template_args['admin_page_content'] = '';
437
+		try {
438
+			/** @var EventEspresso\admin_pages\general_settings\OrganizationSettings $organization_settings_form */
439
+			$organization_settings_form                 = $this->loader->getShared(
440
+				'EventEspresso\admin_pages\general_settings\OrganizationSettings'
441
+			);
442
+			$this->_template_args['admin_page_content'] = $organization_settings_form->display();
443
+		} catch (Exception $e) {
444
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
445
+		}
446
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
447
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
448
+		$this->display_admin_page_with_sidebar();
449
+	}
450
+
451
+
452
+	/**
453
+	 * Handler for updating organization settings.
454
+	 *
455
+	 * @throws EE_Error
456
+	 */
457
+	protected function _update_your_organization_settings()
458
+	{
459
+		try {
460
+			/** @var EventEspresso\admin_pages\general_settings\OrganizationSettings $organization_settings_form */
461
+			$organization_settings_form  = $this->loader->getShared(
462
+				'EventEspresso\admin_pages\general_settings\OrganizationSettings'
463
+			);
464
+			$success                     = $organization_settings_form->process($this->_req_data);
465
+			EE_Registry::instance()->CFG = apply_filters(
466
+				'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG',
467
+				EE_Registry::instance()->CFG
468
+			);
469
+		} catch (Exception $e) {
470
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
471
+			$success = false;
472
+		}
473
+
474
+		if ($success) {
475
+			$success = $this->_update_espresso_configuration(
476
+				esc_html__('Your Organization Settings', 'event_espresso'),
477
+				EE_Registry::instance()->CFG,
478
+				__FILE__,
479
+				__FUNCTION__,
480
+				__LINE__
481
+			);
482
+		}
483
+
484
+		$this->_redirect_after_action($success, '', '', ['action' => 'default'], true);
485
+	}
486
+
487
+
488
+
489
+	/*************        Admin Options        *************/
490
+
491
+
492
+	/**
493
+	 * _admin_option_settings
494
+	 *
495
+	 * @throws EE_Error
496
+	 * @throws LogicException
497
+	 */
498
+	protected function _admin_option_settings()
499
+	{
500
+		$this->_template_args['admin_page_content'] = '';
501
+		try {
502
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
503
+			// still need this for the old school form in Extend_General_Settings_Admin_Page
504
+			$this->_template_args['values'] = $this->_yes_no_values;
505
+			// also need to account for the do_action that was in the old template
506
+			$admin_options_settings_form->setTemplateArgs($this->_template_args);
507
+			$this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
508
+		} catch (Exception $e) {
509
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
510
+		}
511
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
512
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
513
+		$this->display_admin_page_with_sidebar();
514
+	}
515
+
516
+
517
+	/**
518
+	 * _update_admin_option_settings
519
+	 *
520
+	 * @throws EE_Error
521
+	 * @throws InvalidDataTypeException
522
+	 * @throws InvalidFormSubmissionException
523
+	 * @throws InvalidArgumentException
524
+	 * @throws LogicException
525
+	 */
526
+	protected function _update_admin_option_settings()
527
+	{
528
+		try {
529
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
530
+			$admin_options_settings_form->process($this->_req_data[ $admin_options_settings_form->slug() ]);
531
+			EE_Registry::instance()->CFG->admin = apply_filters(
532
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
533
+				EE_Registry::instance()->CFG->admin
534
+			);
535
+		} catch (Exception $e) {
536
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
537
+		}
538
+		$this->_redirect_after_action(
539
+			apply_filters(
540
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
541
+				$this->_update_espresso_configuration(
542
+					'Admin Options',
543
+					EE_Registry::instance()->CFG->admin,
544
+					__FILE__,
545
+					__FUNCTION__,
546
+					__LINE__
547
+				)
548
+			),
549
+			'Admin Options',
550
+			'updated',
551
+			['action' => 'admin_option_settings']
552
+		);
553
+	}
554
+
555
+
556
+	/*************        Countries        *************/
557
+
558
+
559
+	/**
560
+	 * @return string
561
+	 */
562
+	protected function getCountryIsoForSite()
563
+	{
564
+		return ! empty(EE_Registry::instance()->CFG->organization->CNT_ISO)
565
+			? EE_Registry::instance()->CFG->organization->CNT_ISO
566
+			: 'US';
567
+	}
568
+
569
+
570
+	/**
571
+	 * @param string          $CNT_ISO
572
+	 * @param EE_Country|null $country
573
+	 * @return EE_Base_Class|EE_Country
574
+	 * @throws EE_Error
575
+	 * @throws InvalidArgumentException
576
+	 * @throws InvalidDataTypeException
577
+	 * @throws InvalidInterfaceException
578
+	 * @throws ReflectionException
579
+	 */
580
+	protected function verifyOrGetCountryFromIso($CNT_ISO, EE_Country $country = null)
581
+	{
582
+		/** @var EE_Country $country */
583
+		return $country instanceof EE_Country && $country->ID() === $CNT_ISO
584
+			? $country
585
+			: EEM_Country::instance()->get_one_by_ID($CNT_ISO);
586
+	}
587
+
588
+
589
+	/**
590
+	 * Output Country Settings view.
591
+	 *
592
+	 * @throws DomainException
593
+	 * @throws EE_Error
594
+	 * @throws InvalidArgumentException
595
+	 * @throws InvalidDataTypeException
596
+	 * @throws InvalidInterfaceException
597
+	 * @throws ReflectionException
598
+	 */
599
+	protected function _country_settings()
600
+	{
601
+		$CNT_ISO_for_site = $this->getCountryIsoForSite();
602
+		$CNT_ISO          = isset($this->_req_data['country'])
603
+			? strtoupper(sanitize_text_field($this->_req_data['country']))
604
+			: $CNT_ISO_for_site;
605
+
606
+		// load field generator helper
607
+
608
+		$this->_template_args['values'] = $this->_yes_no_values;
609
+
610
+		$this->_template_args['countries'] = new EE_Question_Form_Input(
611
+			EE_Question::new_instance(
612
+				[
613
+					'QST_ID'           => 0,
614
+					'QST_display_text' => esc_html__('Select Country', 'event_espresso'),
615
+					'QST_system'       => 'admin-country',
616
+				]
617
+			),
618
+			EE_Answer::new_instance(
619
+				[
620
+					'ANS_ID'    => 0,
621
+					'ANS_value' => $CNT_ISO,
622
+				]
623
+			),
624
+			[
625
+				'input_id'       => 'country',
626
+				'input_name'     => 'country',
627
+				'input_prefix'   => '',
628
+				'append_qstn_id' => false,
629
+			]
630
+		);
631
+		$country                           = $this->verifyOrGetCountryFromIso($CNT_ISO_for_site);
632
+		add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10, 2);
633
+		add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10, 2);
634
+		$this->_template_args['country_details_settings'] = $this->display_country_settings(
635
+			$country->ID(),
636
+			$country
637
+		);
638
+		$this->_template_args['country_states_settings']  = $this->display_country_states(
639
+			$country->ID(),
640
+			$country
641
+		);
642
+		$this->_template_args['CNT_name_for_site']        = $country->name();
643
+
644
+		$this->_set_add_edit_form_tags('update_country_settings');
645
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
646
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
647
+			GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
648
+			$this->_template_args,
649
+			true
650
+		);
651
+		$this->display_admin_page_with_no_sidebar();
652
+	}
653
+
654
+
655
+	/**
656
+	 * @param string          $CNT_ISO
657
+	 * @param EE_Country|null $country
658
+	 * @return string
659
+	 * @throws DomainException
660
+	 * @throws EE_Error
661
+	 * @throws InvalidArgumentException
662
+	 * @throws InvalidDataTypeException
663
+	 * @throws InvalidInterfaceException
664
+	 * @throws ReflectionException
665
+	 */
666
+	public function display_country_settings($CNT_ISO = '', EE_Country $country = null)
667
+	{
668
+		$CNT_ISO_for_site = $this->getCountryIsoForSite();
669
+
670
+		$CNT_ISO = isset($this->_req_data['country'])
671
+			? strtoupper(sanitize_text_field($this->_req_data['country']))
672
+			: $CNT_ISO;
673
+		if (! $CNT_ISO) {
674
+			return '';
675
+		}
676
+
677
+		// for ajax
678
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
679
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
680
+		add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10, 2);
681
+		add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10, 2);
682
+		$country                                  = $this->verifyOrGetCountryFromIso($CNT_ISO, $country);
683
+		$CNT_cur_disabled                         = $CNT_ISO !== $CNT_ISO_for_site;
684
+		$this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled;
685
+
686
+		$country_input_types            = [
687
+			'CNT_active'      => [
688
+				'type'             => 'RADIO_BTN',
689
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
690
+				'class'            => '',
691
+				'options'          => $this->_yes_no_values,
692
+				'use_desc_4_label' => true,
693
+			],
694
+			'CNT_ISO'         => [
695
+				'type'       => 'TEXT',
696
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
697
+				'class'      => 'small-text',
698
+			],
699
+			'CNT_ISO3'        => [
700
+				'type'       => 'TEXT',
701
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
702
+				'class'      => 'small-text',
703
+			],
704
+			'RGN_ID'          => [
705
+				'type'       => 'TEXT',
706
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
707
+				'class'      => 'small-text',
708
+			],
709
+			'CNT_name'        => [
710
+				'type'       => 'TEXT',
711
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
712
+				'class'      => 'regular-text',
713
+			],
714
+			'CNT_cur_code'    => [
715
+				'type'       => 'TEXT',
716
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
717
+				'class'      => 'small-text',
718
+				'disabled'   => $CNT_cur_disabled,
719
+			],
720
+			'CNT_cur_single'  => [
721
+				'type'       => 'TEXT',
722
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
723
+				'class'      => 'medium-text',
724
+				'disabled'   => $CNT_cur_disabled,
725
+			],
726
+			'CNT_cur_plural'  => [
727
+				'type'       => 'TEXT',
728
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
729
+				'class'      => 'medium-text',
730
+				'disabled'   => $CNT_cur_disabled,
731
+			],
732
+			'CNT_cur_sign'    => [
733
+				'type'         => 'TEXT',
734
+				'input_name'   => 'cntry[' . $CNT_ISO . ']',
735
+				'class'        => 'small-text',
736
+				'htmlentities' => false,
737
+				'disabled'     => $CNT_cur_disabled,
738
+			],
739
+			'CNT_cur_sign_b4' => [
740
+				'type'             => 'RADIO_BTN',
741
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
742
+				'class'            => '',
743
+				'options'          => $this->_yes_no_values,
744
+				'use_desc_4_label' => true,
745
+				'disabled'         => $CNT_cur_disabled,
746
+			],
747
+			'CNT_cur_dec_plc' => [
748
+				'type'       => 'RADIO_BTN',
749
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
750
+				'class'      => '',
751
+				'options'    => [
752
+					['id' => 0, 'text' => ''],
753
+					['id' => 1, 'text' => ''],
754
+					['id' => 2, 'text' => ''],
755
+					['id' => 3, 'text' => ''],
756
+				],
757
+				'disabled'   => $CNT_cur_disabled,
758
+			],
759
+			'CNT_cur_dec_mrk' => [
760
+				'type'             => 'RADIO_BTN',
761
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
762
+				'class'            => '',
763
+				'options'          => [
764
+					[
765
+						'id'   => ',',
766
+						'text' => esc_html__(', (comma)', 'event_espresso'),
767
+					],
768
+					['id' => '.', 'text' => esc_html__('. (decimal)', 'event_espresso')],
769
+				],
770
+				'use_desc_4_label' => true,
771
+				'disabled'         => $CNT_cur_disabled,
772
+			],
773
+			'CNT_cur_thsnds'  => [
774
+				'type'             => 'RADIO_BTN',
775
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
776
+				'class'            => '',
777
+				'options'          => [
778
+					[
779
+						'id'   => ',',
780
+						'text' => esc_html__(', (comma)', 'event_espresso'),
781
+					],
782
+					[
783
+						'id'   => '.',
784
+						'text' => esc_html__('. (decimal)', 'event_espresso'),
785
+					],
786
+					[
787
+						'id'   => '&nbsp;',
788
+						'text' => esc_html__('(space)', 'event_espresso'),
789
+					],
790
+				],
791
+				'use_desc_4_label' => true,
792
+				'disabled'         => $CNT_cur_disabled,
793
+			],
794
+			'CNT_tel_code'    => [
795
+				'type'       => 'TEXT',
796
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
797
+				'class'      => 'small-text',
798
+			],
799
+			'CNT_is_EU'       => [
800
+				'type'             => 'RADIO_BTN',
801
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
802
+				'class'            => '',
803
+				'options'          => $this->_yes_no_values,
804
+				'use_desc_4_label' => true,
805
+			],
806
+		];
807
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object(
808
+			$country,
809
+			$country_input_types
810
+		);
811
+		$country_details_settings       = EEH_Template::display_template(
812
+			GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
813
+			$this->_template_args,
814
+			true
815
+		);
816
+
817
+		if (defined('DOING_AJAX')) {
818
+			$notices = EE_Error::get_notices(false, false, false);
819
+			echo wp_json_encode(
820
+				[
821
+					'return_data' => $country_details_settings,
822
+					'success'     => $notices['success'],
823
+					'errors'      => $notices['errors'],
824
+				]
825
+			);
826
+			die();
827
+		} else {
828
+			return $country_details_settings;
829
+		}
830
+	}
831
+
832
+
833
+	/**
834
+	 * @param string          $CNT_ISO
835
+	 * @param EE_Country|null $country
836
+	 * @return string
837
+	 * @throws DomainException
838
+	 * @throws EE_Error
839
+	 * @throws InvalidArgumentException
840
+	 * @throws InvalidDataTypeException
841
+	 * @throws InvalidInterfaceException
842
+	 * @throws ReflectionException
843
+	 */
844
+	public function display_country_states($CNT_ISO = '', EE_Country $country = null)
845
+	{
846
+
847
+		$CNT_ISO = isset($this->_req_data['country'])
848
+			? sanitize_text_field($this->_req_data['country'])
849
+			: $CNT_ISO;
850
+		if (! $CNT_ISO) {
851
+			return '';
852
+		}
853
+		// for ajax
854
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
855
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
856
+		add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'state_form_field_label_wrap'], 10, 2);
857
+		add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'state_form_field_input__wrap'], 10, 2);
858
+		$states = EEM_State::instance()->get_all_states_for_these_countries([$CNT_ISO => $CNT_ISO]);
859
+		if (empty($states)) {
860
+			/** @var EventEspresso\core\services\address\CountrySubRegionDao $countrySubRegionDao */
861
+			$countrySubRegionDao = $this->loader->getShared(
862
+				'EventEspresso\core\services\address\CountrySubRegionDao'
863
+			);
864
+			if ($countrySubRegionDao instanceof EventEspresso\core\services\address\CountrySubRegionDao) {
865
+				$country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country);
866
+				if ($countrySubRegionDao->saveCountrySubRegions($country)) {
867
+					$states = EEM_State::instance()->get_all_states_for_these_countries(
868
+						[$CNT_ISO => $CNT_ISO]
869
+					);
870
+				}
871
+			}
872
+		}
873
+		if (is_array($states)) {
874
+			foreach ($states as $STA_ID => $state) {
875
+				if ($state instanceof EE_State) {
876
+					// STA_abbrev    STA_name    STA_active
877
+					$state_input_types                                             = [
878
+						'STA_abbrev' => [
879
+							'type'       => 'TEXT',
880
+							'input_name' => 'states[' . $STA_ID . ']',
881
+							'class'      => 'small-text',
882
+						],
883
+						'STA_name'   => [
884
+							'type'       => 'TEXT',
885
+							'input_name' => 'states[' . $STA_ID . ']',
886
+							'class'      => 'regular-text',
887
+						],
888
+						'STA_active' => [
889
+							'type'             => 'RADIO_BTN',
890
+							'input_name'       => 'states[' . $STA_ID . ']',
891
+							'options'          => $this->_yes_no_values,
892
+							'use_desc_4_label' => true,
893
+						],
894
+					];
895
+					$this->_template_args['states'][ $STA_ID ]['inputs']           =
896
+						EE_Question_Form_Input::generate_question_form_inputs_for_object(
897
+							$state,
898
+							$state_input_types
899
+						);
900
+					$query_args                                                    = [
901
+						'action'     => 'delete_state',
902
+						'STA_ID'     => $STA_ID,
903
+						'CNT_ISO'    => $CNT_ISO,
904
+						'STA_abbrev' => $state->abbrev(),
905
+					];
906
+					$this->_template_args['states'][ $STA_ID ]['delete_state_url'] =
907
+						EE_Admin_Page::add_query_args_and_nonce(
908
+							$query_args,
909
+							GEN_SET_ADMIN_URL
910
+						);
911
+				}
912
+			}
913
+		} else {
914
+			$this->_template_args['states'] = false;
915
+		}
916
+
917
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(
918
+			['action' => 'add_new_state'],
919
+			GEN_SET_ADMIN_URL
920
+		);
921
+
922
+		$state_details_settings = EEH_Template::display_template(
923
+			GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
924
+			$this->_template_args,
925
+			true
926
+		);
927
+
928
+		if (defined('DOING_AJAX')) {
929
+			$notices = EE_Error::get_notices(false, false, false);
930
+			echo wp_json_encode(
931
+				[
932
+					'return_data' => $state_details_settings,
933
+					'success'     => $notices['success'],
934
+					'errors'      => $notices['errors'],
935
+				]
936
+			);
937
+			die();
938
+		} else {
939
+			return $state_details_settings;
940
+		}
941
+	}
942
+
943
+
944
+	/**
945
+	 *        add_new_state
946
+	 *
947
+	 * @access    public
948
+	 * @return void
949
+	 * @throws EE_Error
950
+	 * @throws InvalidArgumentException
951
+	 * @throws InvalidDataTypeException
952
+	 * @throws InvalidInterfaceException
953
+	 */
954
+	public function add_new_state()
955
+	{
956
+
957
+		$success = true;
958
+
959
+		$CNT_ISO = isset($this->_req_data['CNT_ISO'])
960
+			? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
961
+			: false;
962
+		if (! $CNT_ISO) {
963
+			EE_Error::add_error(
964
+				esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
965
+				__FILE__,
966
+				__FUNCTION__,
967
+				__LINE__
968
+			);
969
+			$success = false;
970
+		}
971
+		$STA_abbrev = isset($this->_req_data['STA_abbrev'])
972
+			? sanitize_text_field($this->_req_data['STA_abbrev'])
973
+			: false;
974
+		if (! $STA_abbrev) {
975
+			EE_Error::add_error(
976
+				esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
977
+				__FILE__,
978
+				__FUNCTION__,
979
+				__LINE__
980
+			);
981
+			$success = false;
982
+		}
983
+		$STA_name = isset($this->_req_data['STA_name'])
984
+			? sanitize_text_field($this->_req_data['STA_name'])
985
+			: false;
986
+		if (! $STA_name) {
987
+			EE_Error::add_error(
988
+				esc_html__('No State name or an invalid State name was received.', 'event_espresso'),
989
+				__FILE__,
990
+				__FUNCTION__,
991
+				__LINE__
992
+			);
993
+			$success = false;
994
+		}
995
+
996
+		if ($success) {
997
+			$cols_n_values = [
998
+				'CNT_ISO'    => $CNT_ISO,
999
+				'STA_abbrev' => $STA_abbrev,
1000
+				'STA_name'   => $STA_name,
1001
+				'STA_active' => true,
1002
+			];
1003
+			$success       = EEM_State::instance()->insert($cols_n_values);
1004
+			EE_Error::add_success(esc_html__('The State was added successfully.', 'event_espresso'));
1005
+		}
1006
+
1007
+		if (defined('DOING_AJAX')) {
1008
+			$notices = EE_Error::get_notices(false, false, false);
1009
+			echo wp_json_encode(array_merge($notices, ['return_data' => $CNT_ISO]));
1010
+			die();
1011
+		} else {
1012
+			$this->_redirect_after_action($success, 'State', 'added', ['action' => 'country_settings']);
1013
+		}
1014
+	}
1015
+
1016
+
1017
+	/**
1018
+	 * @return void
1019
+	 * @throws EE_Error
1020
+	 * @throws InvalidArgumentException
1021
+	 * @throws InvalidDataTypeException
1022
+	 * @throws InvalidInterfaceException
1023
+	 */
1024
+	public function delete_state()
1025
+	{
1026
+		$CNT_ISO    = isset($this->_req_data['CNT_ISO'])
1027
+			? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
1028
+			: false;
1029
+		$STA_ID     = isset($this->_req_data['STA_ID'])
1030
+			? sanitize_text_field($this->_req_data['STA_ID'])
1031
+			: false;
1032
+		$STA_abbrev = isset($this->_req_data['STA_abbrev'])
1033
+			? sanitize_text_field($this->_req_data['STA_abbrev'])
1034
+			: false;
1035
+		if (! $STA_ID) {
1036
+			EE_Error::add_error(
1037
+				esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'),
1038
+				__FILE__,
1039
+				__FUNCTION__,
1040
+				__LINE__
1041
+			);
1042
+			return;
1043
+		}
1044
+
1045
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
1046
+		if ($success !== false) {
1047
+			do_action(
1048
+				'AHEE__General_Settings_Admin_Page__delete_state__state_deleted',
1049
+				$CNT_ISO,
1050
+				$STA_ID,
1051
+				['STA_abbrev' => $STA_abbrev]
1052
+			);
1053
+			EE_Error::add_success(esc_html__('The State was deleted successfully.', 'event_espresso'));
1054
+		}
1055
+		if (defined('DOING_AJAX')) {
1056
+			$notices                = EE_Error::get_notices(false);
1057
+			$notices['return_data'] = true;
1058
+			echo wp_json_encode($notices);
1059
+			die();
1060
+		} else {
1061
+			$this->_redirect_after_action(
1062
+				$success,
1063
+				'State',
1064
+				'deleted',
1065
+				['action' => 'country_settings']
1066
+			);
1067
+		}
1068
+	}
1069
+
1070
+
1071
+	/**
1072
+	 *        _update_country_settings
1073
+	 *
1074
+	 * @return void
1075
+	 * @throws EE_Error
1076
+	 * @throws InvalidArgumentException
1077
+	 * @throws InvalidDataTypeException
1078
+	 * @throws InvalidInterfaceException
1079
+	 */
1080
+	protected function _update_country_settings()
1081
+	{
1082
+		// grab the country ISO code
1083
+		$CNT_ISO = isset($this->_req_data['country'])
1084
+			? strtoupper(sanitize_text_field($this->_req_data['country']))
1085
+			: false;
1086
+		if (! $CNT_ISO) {
1087
+			EE_Error::add_error(
1088
+				esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
1089
+				__FILE__,
1090
+				__FUNCTION__,
1091
+				__LINE__
1092
+			);
1093
+
1094
+			return;
1095
+		}
1096
+		$cols_n_values             = [];
1097
+		$cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3'])
1098
+			? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3']))
1099
+			: false;
1100
+		$cols_n_values['RGN_ID']   = isset($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1101
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1102
+			: null;
1103
+		$cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1104
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1105
+			: null;
1106
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])) {
1107
+			$cols_n_values['CNT_cur_code'] = strtoupper(
1108
+				sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])
1109
+			);
1110
+		}
1111
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])) {
1112
+			$cols_n_values['CNT_cur_single'] = sanitize_text_field(
1113
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single']
1114
+			);
1115
+		}
1116
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])) {
1117
+			$cols_n_values['CNT_cur_plural'] = sanitize_text_field(
1118
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural']
1119
+			);
1120
+		}
1121
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])) {
1122
+			$cols_n_values['CNT_cur_sign'] = sanitize_text_field(
1123
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign']
1124
+			);
1125
+		}
1126
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])) {
1127
+			$cols_n_values['CNT_cur_sign_b4'] = absint(
1128
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4']
1129
+			);
1130
+		}
1131
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])) {
1132
+			$cols_n_values['CNT_cur_dec_plc'] = absint(
1133
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc']
1134
+			);
1135
+		}
1136
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])) {
1137
+			$cols_n_values['CNT_cur_dec_mrk'] = sanitize_text_field(
1138
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk']
1139
+			);
1140
+		}
1141
+		if (isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])) {
1142
+			$cols_n_values['CNT_cur_thsnds'] = sanitize_text_field(
1143
+				$this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds']
1144
+			);
1145
+		}
1146
+		$cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1147
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1148
+			: null;
1149
+		$cols_n_values['CNT_is_EU']    = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1150
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1151
+			: false;
1152
+		$cols_n_values['CNT_active']   = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1153
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1154
+			: false;
1155
+		// allow filtering of country data
1156
+		$cols_n_values = apply_filters(
1157
+			'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values',
1158
+			$cols_n_values
1159
+		);
1160
+
1161
+		// where values
1162
+		$where_cols_n_values = [['CNT_ISO' => $CNT_ISO]];
1163
+		// run the update
1164
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
1165
+
1166
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) {
1167
+			// allow filtering of states data
1168
+			$states = apply_filters(
1169
+				'FHEE__General_Settings_Admin_Page___update_country_settings__states',
1170
+				$this->_req_data['states']
1171
+			);
1172
+
1173
+			// loop thru state data ( looks like : states[75][STA_name] )
1174
+			foreach ($states as $STA_ID => $state) {
1175
+				$cols_n_values = [
1176
+					'CNT_ISO'    => $CNT_ISO,
1177
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
1178
+					'STA_name'   => sanitize_text_field($state['STA_name']),
1179
+					'STA_active' => (bool) absint($state['STA_active']),
1180
+				];
1181
+				// where values
1182
+				$where_cols_n_values = [['STA_ID' => $STA_ID]];
1183
+				// run the update
1184
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
1185
+				if ($success !== false) {
1186
+					do_action(
1187
+						'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved',
1188
+						$CNT_ISO,
1189
+						$STA_ID,
1190
+						$cols_n_values
1191
+					);
1192
+				}
1193
+			}
1194
+		}
1195
+		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
1196
+		if (
1197
+			isset(EE_Registry::instance()->CFG->organization->CNT_ISO)
1198
+			&& $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO
1199
+		) {
1200
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
1201
+			EE_Registry::instance()->CFG->update_espresso_config();
1202
+		}
1203
+
1204
+		if ($success !== false) {
1205
+			EE_Error::add_success(
1206
+				esc_html__('Country Settings updated successfully.', 'event_espresso')
1207
+			);
1208
+		}
1209
+		$this->_redirect_after_action(
1210
+			$success,
1211
+			'',
1212
+			'',
1213
+			['action' => 'country_settings', 'country' => $CNT_ISO],
1214
+			true
1215
+		);
1216
+	}
1217
+
1218
+
1219
+	/**
1220
+	 *        form_form_field_label_wrap
1221
+	 *
1222
+	 * @param string $label
1223
+	 * @return        string
1224
+	 */
1225
+	public function country_form_field_label_wrap($label, $required_text)
1226
+	{
1227
+		return '
1228 1228
 			<tr>
1229 1229
 				<th>
1230 1230
 					' . $label . '
1231 1231
 				</th>';
1232
-    }
1233
-
1234
-
1235
-    /**
1236
-     *        form_form_field_input__wrap
1237
-     *
1238
-     * @param string $label
1239
-     * @return        string
1240
-     */
1241
-    public function country_form_field_input__wrap($input, $label)
1242
-    {
1243
-        return '
1232
+	}
1233
+
1234
+
1235
+	/**
1236
+	 *        form_form_field_input__wrap
1237
+	 *
1238
+	 * @param string $label
1239
+	 * @return        string
1240
+	 */
1241
+	public function country_form_field_input__wrap($input, $label)
1242
+	{
1243
+		return '
1244 1244
 				<td class="general-settings-country-input-td">
1245 1245
 					' . $input . '
1246 1246
 				</td>
1247 1247
 			</tr>';
1248
-    }
1249
-
1250
-
1251
-    /**
1252
-     *        form_form_field_label_wrap
1253
-     *
1254
-     * @param string $label
1255
-     * @param string $required_text
1256
-     * @return        string
1257
-     */
1258
-    public function state_form_field_label_wrap($label, $required_text)
1259
-    {
1260
-        return $required_text;
1261
-    }
1262
-
1263
-
1264
-    /**
1265
-     *        form_form_field_input__wrap
1266
-     *
1267
-     * @param string $label
1268
-     * @return        string
1269
-     */
1270
-    public function state_form_field_input__wrap($input, $label)
1271
-    {
1272
-        return '
1248
+	}
1249
+
1250
+
1251
+	/**
1252
+	 *        form_form_field_label_wrap
1253
+	 *
1254
+	 * @param string $label
1255
+	 * @param string $required_text
1256
+	 * @return        string
1257
+	 */
1258
+	public function state_form_field_label_wrap($label, $required_text)
1259
+	{
1260
+		return $required_text;
1261
+	}
1262
+
1263
+
1264
+	/**
1265
+	 *        form_form_field_input__wrap
1266
+	 *
1267
+	 * @param string $label
1268
+	 * @return        string
1269
+	 */
1270
+	public function state_form_field_input__wrap($input, $label)
1271
+	{
1272
+		return '
1273 1273
 				<td class="general-settings-country-state-input-td">
1274 1274
 					' . $input . '
1275 1275
 				</td>';
1276
-    }
1277
-
1278
-
1279
-    /***********/
1280
-
1281
-
1282
-    /**
1283
-     * displays edit and view links for critical EE pages
1284
-     *
1285
-     * @param int $ee_page_id
1286
-     * @return string
1287
-     */
1288
-    public static function edit_view_links($ee_page_id)
1289
-    {
1290
-        $links = '<a href="'
1291
-                 . add_query_arg(
1292
-                     ['post' => $ee_page_id, 'action' => 'edit'],
1293
-                     admin_url('post.php')
1294
-                 )
1295
-                 . '" >'
1296
-                 . esc_html__('Edit', 'event_espresso')
1297
-                 . '</a>';
1298
-        $links .= ' &nbsp;|&nbsp; ';
1299
-        $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>';
1300
-
1301
-        return $links;
1302
-    }
1303
-
1304
-
1305
-    /**
1306
-     * displays page and shortcode status for critical EE pages
1307
-     *
1308
-     * @param WP page object $ee_page
1309
-     * @return string
1310
-     */
1311
-    public static function page_and_shortcode_status($ee_page, $shortcode)
1312
-    {
1313
-
1314
-        // page status
1315
-        if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
1316
-            $pg_colour = 'green';
1317
-            $pg_status = sprintf(esc_html__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
1318
-        } else {
1319
-            $pg_colour = 'red';
1320
-            $pg_status = sprintf(esc_html__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
1321
-        }
1322
-
1323
-        // shortcode status
1324
-        if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) {
1325
-            $sc_colour = 'green';
1326
-            $sc_status = sprintf(esc_html__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
1327
-        } else {
1328
-            $sc_colour = 'red';
1329
-            $sc_status = sprintf(esc_html__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1330
-        }
1331
-
1332
-        return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>'
1333
-               . $pg_status
1334
-               . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1335
-    }
1336
-
1337
-
1338
-    /**
1339
-     * generates a dropdown of all parent pages - copied from WP core
1340
-     *
1341
-     * @param int  $default
1342
-     * @param int  $parent
1343
-     * @param int  $level
1344
-     * @param bool $echo
1345
-     * @return string;
1346
-     */
1347
-    public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0, $echo = true)
1348
-    {
1349
-        global $wpdb;
1350
-        $items  = $wpdb->get_results(
1351
-            $wpdb->prepare(
1352
-                "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order",
1353
-                $parent
1354
-            )
1355
-        );
1356
-        $output = '';
1357
-
1358
-        if ($items) {
1359
-            $level = absint($level);
1360
-            foreach ($items as $item) {
1361
-                $ID = absint($item->ID);
1362
-                $post_title = wp_strip_all_tags($item->post_title);
1363
-                $pad    = str_repeat('&nbsp;', $level * 3);
1364
-                $option = "\n\t";
1365
-                $option .= '<option class="level-' . $level . '" ';
1366
-                $option .= 'value="' . $ID . '" ';
1367
-                $option .= $ID === absint($default) ? ' selected="selected"' : '';
1368
-                $option .= '>';
1369
-                $option .= "$pad {$post_title}";
1370
-                $option .= '</option>';
1371
-                $output .= $option;
1372
-                ob_start();
1373
-                parent_dropdown($default, $item->ID, $level + 1);
1374
-                $output .= ob_get_clean();
1375
-            }
1376
-        }
1377
-        if ($echo) {
1378
-            echo wp_kses($output, AllowedTags::getAllowedTags());
1379
-            return '';
1380
-        }
1381
-        return $output;
1382
-    }
1383
-
1384
-
1385
-    /**
1386
-     * Loads the scripts for the privacy settings form
1387
-     */
1388
-    public function load_scripts_styles_privacy_settings()
1389
-    {
1390
-        $form_handler =
1391
-            $this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1392
-        $form_handler->enqueueStylesAndScripts();
1393
-    }
1394
-
1395
-
1396
-    /**
1397
-     * display the privacy settings form
1398
-     *
1399
-     * @throws EE_Error
1400
-     */
1401
-    public function privacySettings()
1402
-    {
1403
-        $this->_set_add_edit_form_tags('update_privacy_settings');
1404
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
1405
-        $form_handler                               =
1406
-            $this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1407
-        $this->_template_args['admin_page_content'] = $form_handler->display();
1408
-        $this->display_admin_page_with_sidebar();
1409
-    }
1410
-
1411
-
1412
-    /**
1413
-     * Update the privacy settings from form data
1414
-     *
1415
-     * @throws EE_Error
1416
-     */
1417
-    public function updatePrivacySettings()
1418
-    {
1419
-        $form_handler =
1420
-            $this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1421
-        $success      = $form_handler->process($this->get_request_data());
1422
-        $this->_redirect_after_action(
1423
-            $success,
1424
-            esc_html__('Registration Form Options', 'event_espresso'),
1425
-            'updated',
1426
-            ['action' => 'privacy_settings']
1427
-        );
1428
-    }
1276
+	}
1277
+
1278
+
1279
+	/***********/
1280
+
1281
+
1282
+	/**
1283
+	 * displays edit and view links for critical EE pages
1284
+	 *
1285
+	 * @param int $ee_page_id
1286
+	 * @return string
1287
+	 */
1288
+	public static function edit_view_links($ee_page_id)
1289
+	{
1290
+		$links = '<a href="'
1291
+				 . add_query_arg(
1292
+					 ['post' => $ee_page_id, 'action' => 'edit'],
1293
+					 admin_url('post.php')
1294
+				 )
1295
+				 . '" >'
1296
+				 . esc_html__('Edit', 'event_espresso')
1297
+				 . '</a>';
1298
+		$links .= ' &nbsp;|&nbsp; ';
1299
+		$links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>';
1300
+
1301
+		return $links;
1302
+	}
1303
+
1304
+
1305
+	/**
1306
+	 * displays page and shortcode status for critical EE pages
1307
+	 *
1308
+	 * @param WP page object $ee_page
1309
+	 * @return string
1310
+	 */
1311
+	public static function page_and_shortcode_status($ee_page, $shortcode)
1312
+	{
1313
+
1314
+		// page status
1315
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
1316
+			$pg_colour = 'green';
1317
+			$pg_status = sprintf(esc_html__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
1318
+		} else {
1319
+			$pg_colour = 'red';
1320
+			$pg_status = sprintf(esc_html__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
1321
+		}
1322
+
1323
+		// shortcode status
1324
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) {
1325
+			$sc_colour = 'green';
1326
+			$sc_status = sprintf(esc_html__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
1327
+		} else {
1328
+			$sc_colour = 'red';
1329
+			$sc_status = sprintf(esc_html__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1330
+		}
1331
+
1332
+		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>'
1333
+			   . $pg_status
1334
+			   . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1335
+	}
1336
+
1337
+
1338
+	/**
1339
+	 * generates a dropdown of all parent pages - copied from WP core
1340
+	 *
1341
+	 * @param int  $default
1342
+	 * @param int  $parent
1343
+	 * @param int  $level
1344
+	 * @param bool $echo
1345
+	 * @return string;
1346
+	 */
1347
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0, $echo = true)
1348
+	{
1349
+		global $wpdb;
1350
+		$items  = $wpdb->get_results(
1351
+			$wpdb->prepare(
1352
+				"SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order",
1353
+				$parent
1354
+			)
1355
+		);
1356
+		$output = '';
1357
+
1358
+		if ($items) {
1359
+			$level = absint($level);
1360
+			foreach ($items as $item) {
1361
+				$ID = absint($item->ID);
1362
+				$post_title = wp_strip_all_tags($item->post_title);
1363
+				$pad    = str_repeat('&nbsp;', $level * 3);
1364
+				$option = "\n\t";
1365
+				$option .= '<option class="level-' . $level . '" ';
1366
+				$option .= 'value="' . $ID . '" ';
1367
+				$option .= $ID === absint($default) ? ' selected="selected"' : '';
1368
+				$option .= '>';
1369
+				$option .= "$pad {$post_title}";
1370
+				$option .= '</option>';
1371
+				$output .= $option;
1372
+				ob_start();
1373
+				parent_dropdown($default, $item->ID, $level + 1);
1374
+				$output .= ob_get_clean();
1375
+			}
1376
+		}
1377
+		if ($echo) {
1378
+			echo wp_kses($output, AllowedTags::getAllowedTags());
1379
+			return '';
1380
+		}
1381
+		return $output;
1382
+	}
1383
+
1384
+
1385
+	/**
1386
+	 * Loads the scripts for the privacy settings form
1387
+	 */
1388
+	public function load_scripts_styles_privacy_settings()
1389
+	{
1390
+		$form_handler =
1391
+			$this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1392
+		$form_handler->enqueueStylesAndScripts();
1393
+	}
1394
+
1395
+
1396
+	/**
1397
+	 * display the privacy settings form
1398
+	 *
1399
+	 * @throws EE_Error
1400
+	 */
1401
+	public function privacySettings()
1402
+	{
1403
+		$this->_set_add_edit_form_tags('update_privacy_settings');
1404
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
1405
+		$form_handler                               =
1406
+			$this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1407
+		$this->_template_args['admin_page_content'] = $form_handler->display();
1408
+		$this->display_admin_page_with_sidebar();
1409
+	}
1410
+
1411
+
1412
+	/**
1413
+	 * Update the privacy settings from form data
1414
+	 *
1415
+	 * @throws EE_Error
1416
+	 */
1417
+	public function updatePrivacySettings()
1418
+	{
1419
+		$form_handler =
1420
+			$this->loader->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1421
+		$success      = $form_handler->process($this->get_request_data());
1422
+		$this->_redirect_after_action(
1423
+			$success,
1424
+			esc_html__('Registration Form Options', 'event_espresso'),
1425
+			'updated',
1426
+			['action' => 'privacy_settings']
1427
+		);
1428
+	}
1429 1429
 }
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_data_reset_and_delete.template.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
     </h4>
36 36
     <p>
37 37
         <?php esc_html_e(
38
-            'Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities.  Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.',
39
-            'event_espresso'
40
-        ); ?>
38
+			'Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities.  Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.',
39
+			'event_espresso'
40
+		); ?>
41 41
     </p>
42 42
     <div class="float-right"><?php echo wp_kses($reset_capabilities_button, AllowedTags::getAllowedTags()); ?></div>
43 43
     <div class="clear"></div>
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
     </h4>
52 52
     <p>
53 53
         <?php esc_html_e(
54
-            ' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.',
55
-            'event_espresso'
56
-        ); ?>
54
+			' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.',
55
+			'event_espresso'
56
+		); ?>
57 57
     </p>
58 58
     <p>
59 59
         <?php esc_html_e(
60
-            'Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.',
61
-            'event_espresso'
62
-        ); ?>
60
+			'Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.',
61
+			'event_espresso'
62
+		); ?>
63 63
     </p>
64 64
     <div class="float-right">
65 65
         <a class="button button-primary ee-confirm" href="<?php echo esc_url_raw($reset_db_url); ?>">
@@ -78,61 +78,61 @@  discard block
 block discarded – undo
78 78
     </h4>
79 79
     <p>
80 80
         <?php esc_html_e(
81
-            ' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.',
82
-            'event_espresso'
83
-        ); ?>
81
+			' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.',
82
+			'event_espresso'
83
+		); ?>
84 84
     </p>
85 85
     <p>
86 86
         <?php esc_html_e(
87
-            'If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.',
88
-            'event_espresso'
89
-        ); ?>
87
+			'If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.',
88
+			'event_espresso'
89
+		); ?>
90 90
     </p>
91 91
     <p class="important-notice">
92 92
         <?php printf(
93
-            esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'),
94
-            '<em>',
95
-            '</em>'
96
-        ); ?>
93
+			esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'),
94
+			'<em>',
95
+			'</em>'
96
+		); ?>
97 97
         <br />
98 98
     </p>
99 99
     <ol>
100 100
         <li>
101 101
             <?php printf(
102
-                esc_html__(
103
-                    'First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.',
104
-                    'event_espresso'
105
-                ),
106
-                '<strong>',
107
-                '</strong>'
108
-            ); ?>
102
+				esc_html__(
103
+					'First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.',
104
+					'event_espresso'
105
+				),
106
+				'<strong>',
107
+				'</strong>'
108
+			); ?>
109 109
         </li>
110 110
         <li>
111 111
             <?php printf(
112
-                esc_html__(
113
-                    'Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s',
114
-                    'event_espresso'
115
-                ),
116
-                '<strong>',
117
-                '</strong>'
118
-            ); ?>
112
+				esc_html__(
113
+					'Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s',
114
+					'event_espresso'
115
+				),
116
+				'<strong>',
117
+				'</strong>'
118
+			); ?>
119 119
         </li>
120 120
         <li>
121 121
             <?php printf(
122
-                esc_html__(
123
-                    'Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s',
124
-                    'event_espresso'
125
-                ),
126
-                '<strong>',
127
-                '</strong>'
128
-            ); ?>
122
+				esc_html__(
123
+					'Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s',
124
+					'event_espresso'
125
+				),
126
+				'<strong>',
127
+				'</strong>'
128
+			); ?>
129 129
         </li>
130 130
         <li>
131 131
             <?php printf(
132
-                esc_html__('Note: Event Espresso 4 categories are %snot%s deleted by this script', 'event_espresso'),
133
-                '<strong>',
134
-                '</strong>'
135
-            ); ?>
132
+				esc_html__('Note: Event Espresso 4 categories are %snot%s deleted by this script', 'event_espresso'),
133
+				'<strong>',
134
+				'</strong>'
135
+			); ?>
136 136
             <br>
137 137
             <a href="<?php echo esc_url_raw(admin_url('edit-tags.php?taxonomy=espresso_event_categories')); ?>">
138 138
                 <?php esc_html_e('You can go here to delete Event Espresso categories', 'event_espresso'); ?>
Please login to merge, or discard this patch.