Completed
Branch BUG-10236-FIX-RESET-CAPABILITI... (cbd980)
by
unknown
26:22 queued 14:04
created
modules/ticket_selector/EED_Ticket_Selector.module.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * process_ticket_selections
199 199
 	 *
200 200
 	 * @access        public
201
-	 * @return        array  or FALSE
201
+	 * @return        boolean|null  or FALSE
202 202
 	 * @throws \EE_Error
203 203
 	 */
204 204
 	public function process_ticket_selections() {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      * cancel_ticket_selections
213 213
      *
214 214
      * @access        public
215
-     * @return        string
215
+     * @return        false|null
216 216
      */
217 217
     public static function cancel_ticket_selections()
218 218
     {
Please login to merge, or discard this patch.
Indentation   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class EED_Ticket_Selector extends  EED_Module {
24 24
 
25
-    /**
26
-     * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector
27
-     */
28
-    private static $ticket_selector;
25
+	/**
26
+	 * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector
27
+	 */
28
+	private static $ticket_selector;
29 29
 
30
-    /**
31
-     * @var EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton $iframe_embed_button
32
-     */
33
-    private static $iframe_embed_button;
30
+	/**
31
+	 * @var EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton $iframe_embed_button
32
+	 */
33
+	private static $iframe_embed_button;
34 34
 
35 35
 
36 36
 
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 		// routing
62 62
 		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
63 63
 		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
64
-        EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections');
65
-        add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
64
+		EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections');
65
+		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
66 66
 		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
67
-        add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'translate_js_strings' ), 0 );
68
-        add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
69
-        EED_Ticket_Selector::loadIframeAssets();
70
-    }
67
+		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'translate_js_strings' ), 0 );
68
+		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
69
+		EED_Ticket_Selector::loadIframeAssets();
70
+	}
71 71
 
72 72
 
73 73
 
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 			10
87 87
 		);
88 88
 
89
-        /**
90
-         * Make sure assets for the ticket selector are loaded on the espresso registrations route so  admin side
91
-         * registrations work.
92
-         */
89
+		/**
90
+		 * Make sure assets for the ticket selector are loaded on the espresso registrations route so  admin side
91
+		 * registrations work.
92
+		 */
93 93
 		add_action(
94
-		    'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_registrations__new_registration',
95
-            array('EED_Ticket_Selector', 'set_definitions'),
96
-            10
97
-        );
98
-    }
94
+			'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_registrations__new_registration',
95
+			array('EED_Ticket_Selector', 'set_definitions'),
96
+			10
97
+		);
98
+	}
99 99
 
100 100
 
101 101
 
@@ -111,23 +111,23 @@  discard block
 block discarded – undo
111 111
 
112 112
 		//if config is not set, initialize
113 113
 		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) {
114
-            \EED_Ticket_Selector::instance()->set_config();
115
-            \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
114
+			\EED_Ticket_Selector::instance()->set_config();
115
+			\EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
116 116
 		}
117 117
 	}
118 118
 
119 119
 
120 120
 
121 121
 	/**
122
-     * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector
123
-     */
124
-    public static function ticketSelector()
125
-    {
126
-        if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) {
127
-            EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector();
128
-        }
129
-        return EED_Ticket_Selector::$ticket_selector;
130
-    }
122
+	 * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector
123
+	 */
124
+	public static function ticketSelector()
125
+	{
126
+		if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) {
127
+			EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector();
128
+		}
129
+		return EED_Ticket_Selector::$ticket_selector;
130
+	}
131 131
 
132 132
 
133 133
 	/**
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
 
181 181
 
182 182
 
183
-    /**
184
-     *    creates buttons for selecting number of attendees for an event
185
-     *
186
-     * @access    public
187
-     * @param    WP_Post|int $event
188
-     * @param    bool        $view_details
189
-     * @return    string
190
-     * @throws \EE_Error
191
-     */
183
+	/**
184
+	 *    creates buttons for selecting number of attendees for an event
185
+	 *
186
+	 * @access    public
187
+	 * @param    WP_Post|int $event
188
+	 * @param    bool        $view_details
189
+	 * @return    string
190
+	 * @throws \EE_Error
191
+	 */
192 192
 	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
193 193
 		return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details );
194 194
 	}
@@ -209,244 +209,244 @@  discard block
 block discarded – undo
209 209
 
210 210
 
211 211
 
212
-    /**
213
-     * cancel_ticket_selections
214
-     *
215
-     * @access        public
216
-     * @return        string
217
-     */
218
-    public static function cancel_ticket_selections()
219
-    {
220
-        $form = new ProcessTicketSelector();
221
-        return $form->cancelTicketSelections();
222
-    }
212
+	/**
213
+	 * cancel_ticket_selections
214
+	 *
215
+	 * @access        public
216
+	 * @return        string
217
+	 */
218
+	public static function cancel_ticket_selections()
219
+	{
220
+		$form = new ProcessTicketSelector();
221
+		return $form->cancelTicketSelections();
222
+	}
223 223
 
224 224
 
225 225
 
226 226
 	/**
227
-	* @return void
228
-	*/
227
+	 * @return void
228
+	 */
229 229
 	public static function translate_js_strings() {
230
-        EE_Registry::$i18n_js_strings['please_select_date_filter_notice'] = esc_html__(
231
-            'please select a datetime', 'event_espresso'
232
-        );
233
-    }
230
+		EE_Registry::$i18n_js_strings['please_select_date_filter_notice'] = esc_html__(
231
+			'please select a datetime', 'event_espresso'
232
+		);
233
+	}
234 234
 
235 235
 
236 236
 
237 237
 	/**
238
-	* 	load js
239
-	*
240
-	* 	@access 		public
241
-	* 	@return 		void
242
-	*/
238
+	 * 	load js
239
+	 *
240
+	 * 	@access 		public
241
+	 * 	@return 		void
242
+	 */
243 243
 	public static function load_tckt_slctr_assets() {
244 244
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
245
-            // add some style
246
-            wp_register_style(
247
-                'ticket_selector', 
248
-                TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css',
249
-                array(),
250
-                EVENT_ESPRESSO_VERSION
251
-            );
252
-            wp_enqueue_style('ticket_selector');
253
-            // make it dance
254
-            wp_register_script(
255
-                'ticket_selector', 
256
-                TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', 
257
-                array('espresso_core'), 
258
-                EVENT_ESPRESSO_VERSION, 
259
-                TRUE
260
-            );
245
+			// add some style
246
+			wp_register_style(
247
+				'ticket_selector', 
248
+				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css',
249
+				array(),
250
+				EVENT_ESPRESSO_VERSION
251
+			);
252
+			wp_enqueue_style('ticket_selector');
253
+			// make it dance
254
+			wp_register_script(
255
+				'ticket_selector', 
256
+				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', 
257
+				array('espresso_core'), 
258
+				EVENT_ESPRESSO_VERSION, 
259
+				TRUE
260
+			);
261 261
 			wp_enqueue_script('ticket_selector');
262
-            require_once( EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php');
263
-            \EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts();
264
-        }
262
+			require_once( EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php');
263
+			\EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts();
264
+		}
265
+	}
266
+
267
+
268
+
269
+	/**
270
+	 * @return void
271
+	 */
272
+	public static function loadIframeAssets()
273
+	{
274
+		// for event lists
275
+		add_filter(
276
+			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
277
+			array('EED_Ticket_Selector', 'iframeCss')
278
+		);
279
+		add_filter(
280
+			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
281
+			array('EED_Ticket_Selector', 'iframeJs')
282
+		);
283
+		// for ticket selectors
284
+		add_filter(
285
+			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
286
+			array('EED_Ticket_Selector', 'iframeCss')
287
+		);
288
+		add_filter(
289
+			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
290
+			array('EED_Ticket_Selector', 'iframeJs')
291
+		);
292
+	}
293
+
294
+
295
+
296
+	/**
297
+	 * Informs the rest of the forms system what CSS and JS is needed to display the input
298
+	 *
299
+	 * @param array $iframe_css
300
+	 * @return array
301
+	 */
302
+	public static function iframeCss(array $iframe_css)
303
+	{
304
+		$iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css';
305
+		return $iframe_css;
265 306
 	}
266 307
 
267 308
 
268 309
 
269
-    /**
270
-     * @return void
271
-     */
272
-    public static function loadIframeAssets()
273
-    {
274
-        // for event lists
275
-        add_filter(
276
-            'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
277
-            array('EED_Ticket_Selector', 'iframeCss')
278
-        );
279
-        add_filter(
280
-            'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
281
-            array('EED_Ticket_Selector', 'iframeJs')
282
-        );
283
-        // for ticket selectors
284
-        add_filter(
285
-            'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
286
-            array('EED_Ticket_Selector', 'iframeCss')
287
-        );
288
-        add_filter(
289
-            'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
290
-            array('EED_Ticket_Selector', 'iframeJs')
291
-        );
292
-    }
293
-
294
-
295
-
296
-    /**
297
-     * Informs the rest of the forms system what CSS and JS is needed to display the input
298
-     *
299
-     * @param array $iframe_css
300
-     * @return array
301
-     */
302
-    public static function iframeCss(array $iframe_css)
303
-    {
304
-        $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css';
305
-        return $iframe_css;
306
-    }
307
-
308
-
309
-
310
-    /**
311
-     * Informs the rest of the forms system what CSS and JS is needed to display the input
312
-     *
313
-     * @param array $iframe_js
314
-     * @return array
315
-     */
316
-    public static function iframeJs(array $iframe_js)
317
-    {
318
-        $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js';
319
-        return $iframe_js;
320
-    }
310
+	/**
311
+	 * Informs the rest of the forms system what CSS and JS is needed to display the input
312
+	 *
313
+	 * @param array $iframe_js
314
+	 * @return array
315
+	 */
316
+	public static function iframeJs(array $iframe_js)
317
+	{
318
+		$iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js';
319
+		return $iframe_js;
320
+	}
321 321
 
322 322
 
323 323
 	/****************************** DEPRECATED ******************************/
324 324
 
325 325
 
326 326
 
327
-    /**
328
-     * @deprecated
329
-     * @return string
330
-     * @throws \EE_Error
331
-     */
332
-    public static function display_view_details_btn()
333
-    {
334
-        // todo add doing_it_wrong() notice during next major version
335
-        return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton();
336
-    }
337
-
338
-
339
-
340
-    /**
341
-     * @deprecated
342
-     * @return string
343
-     * @throws \EE_Error
344
-     */
345
-    public static function display_ticket_selector_submit()
346
-    {
347
-        // todo add doing_it_wrong() notice during next major version
348
-        return EED_Ticket_Selector::ticketSelector()->displaySubmitButton();
349
-    }
350
-
351
-
352
-
353
-    /**
354
-     * @deprecated
355
-     * @param string $permalink_string
356
-     * @param int    $id
357
-     * @param string $new_title
358
-     * @param string $new_slug
359
-     * @return string
360
-     */
361
-    public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '')
362
-    {
363
-        // todo add doing_it_wrong() notice during next major version
364
-        if (
365
-        	\EE_Registry::instance()->REQ->get('page') === 'espresso_events'
366
-        	&& \EE_Registry::instance()->REQ->get('action') === 'edit'
367
-        ) {
368
-            $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton();
369
-            $iframe_embed_button->addEventEditorIframeEmbedButton();
370
-        }
371
-        return '';
372
-    }
373
-
374
-
375
-
376
-    /**
377
-     * @deprecated
378
-     * @param int    $ID
379
-     * @param string $external_url
380
-     * @return string
381
-     */
382
-    public static function ticket_selector_form_open($ID = 0, $external_url = '')
383
-    {
384
-        // todo add doing_it_wrong() notice during next major version
385
-        return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url);
386
-    }
387
-
388
-
389
-
390
-    /**
391
-     * @deprecated
392
-     * @return string
393
-     */
394
-    public static function ticket_selector_form_close()
395
-    {
396
-        // todo add doing_it_wrong() notice during next major version
397
-        return EED_Ticket_Selector::ticketSelector()->formClose();
398
-    }
399
-
400
-
401
-
402
-    /**
403
-     * @deprecated
404
-     * @return string
405
-     */
406
-    public static function no_tkt_slctr_end_dv()
407
-    {
408
-        // todo add doing_it_wrong() notice during next major version
409
-        return EED_Ticket_Selector::ticketSelector()->ticketSelectorEndDiv();
410
-    }
411
-
412
-
413
-
414
-    /**
415
-     * @deprecated 4.9.13
416
-     * @return string
417
-     */
418
-    public static function tkt_slctr_end_dv()
419
-    {
420
-        return EED_Ticket_Selector::ticketSelector()->clearTicketSelector();
421
-    }
422
-
423
-
424
-
425
-    /**
426
-     * @deprecated
427
-     * @return string
428
-     */
429
-    public static function clear_tkt_slctr()
430
-    {
431
-        return EED_Ticket_Selector::ticketSelector()->clearTicketSelector();
432
-    }
433
-
434
-
435
-
436
-    /**
437
-     * @deprecated
438
-     */
439
-    public static function load_tckt_slctr_assets_admin()
440
-    {
441
-        // todo add doing_it_wrong() notice during next major version
442
-	    if (
443
-		    \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events'
444
-		    && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit'
445
-	    ) {
446
-		    $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton();
447
-            $iframe_embed_button->embedButtonAssets();
448
-        }
449
-    }
327
+	/**
328
+	 * @deprecated
329
+	 * @return string
330
+	 * @throws \EE_Error
331
+	 */
332
+	public static function display_view_details_btn()
333
+	{
334
+		// todo add doing_it_wrong() notice during next major version
335
+		return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton();
336
+	}
337
+
338
+
339
+
340
+	/**
341
+	 * @deprecated
342
+	 * @return string
343
+	 * @throws \EE_Error
344
+	 */
345
+	public static function display_ticket_selector_submit()
346
+	{
347
+		// todo add doing_it_wrong() notice during next major version
348
+		return EED_Ticket_Selector::ticketSelector()->displaySubmitButton();
349
+	}
350
+
351
+
352
+
353
+	/**
354
+	 * @deprecated
355
+	 * @param string $permalink_string
356
+	 * @param int    $id
357
+	 * @param string $new_title
358
+	 * @param string $new_slug
359
+	 * @return string
360
+	 */
361
+	public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '')
362
+	{
363
+		// todo add doing_it_wrong() notice during next major version
364
+		if (
365
+			\EE_Registry::instance()->REQ->get('page') === 'espresso_events'
366
+			&& \EE_Registry::instance()->REQ->get('action') === 'edit'
367
+		) {
368
+			$iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton();
369
+			$iframe_embed_button->addEventEditorIframeEmbedButton();
370
+		}
371
+		return '';
372
+	}
373
+
374
+
375
+
376
+	/**
377
+	 * @deprecated
378
+	 * @param int    $ID
379
+	 * @param string $external_url
380
+	 * @return string
381
+	 */
382
+	public static function ticket_selector_form_open($ID = 0, $external_url = '')
383
+	{
384
+		// todo add doing_it_wrong() notice during next major version
385
+		return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url);
386
+	}
387
+
388
+
389
+
390
+	/**
391
+	 * @deprecated
392
+	 * @return string
393
+	 */
394
+	public static function ticket_selector_form_close()
395
+	{
396
+		// todo add doing_it_wrong() notice during next major version
397
+		return EED_Ticket_Selector::ticketSelector()->formClose();
398
+	}
399
+
400
+
401
+
402
+	/**
403
+	 * @deprecated
404
+	 * @return string
405
+	 */
406
+	public static function no_tkt_slctr_end_dv()
407
+	{
408
+		// todo add doing_it_wrong() notice during next major version
409
+		return EED_Ticket_Selector::ticketSelector()->ticketSelectorEndDiv();
410
+	}
411
+
412
+
413
+
414
+	/**
415
+	 * @deprecated 4.9.13
416
+	 * @return string
417
+	 */
418
+	public static function tkt_slctr_end_dv()
419
+	{
420
+		return EED_Ticket_Selector::ticketSelector()->clearTicketSelector();
421
+	}
422
+
423
+
424
+
425
+	/**
426
+	 * @deprecated
427
+	 * @return string
428
+	 */
429
+	public static function clear_tkt_slctr()
430
+	{
431
+		return EED_Ticket_Selector::ticketSelector()->clearTicketSelector();
432
+	}
433
+
434
+
435
+
436
+	/**
437
+	 * @deprecated
438
+	 */
439
+	public static function load_tckt_slctr_assets_admin()
440
+	{
441
+		// todo add doing_it_wrong() notice during next major version
442
+		if (
443
+			\EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events'
444
+			&& \EE_Registry::instance()->REQ->get( 'action' ) === 'edit'
445
+		) {
446
+			$iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton();
447
+			$iframe_embed_button->embedButtonAssets();
448
+		}
449
+	}
450 450
 
451 451
 
452 452
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 use EventEspresso\modules\ticket_selector\TicketSelectorIframe;
4 4
 use EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton;
5 5
 
6
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
 	 * @return EED_Ticket_Selector
39 39
 	 */
40 40
 	public static function instance() {
41
-		return parent::get_instance( __CLASS__ );
41
+		return parent::get_instance(__CLASS__);
42 42
 	}
43 43
 
44 44
 
45 45
 
46
-	protected function set_config(){
47
-		$this->set_config_section( 'template_settings' );
48
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
49
-		$this->set_config_name( 'EED_Ticket_Selector' );
46
+	protected function set_config() {
47
+		$this->set_config_section('template_settings');
48
+		$this->set_config_class('EE_Ticket_Selector_Config');
49
+		$this->set_config_name('EED_Ticket_Selector');
50 50
 	}
51 51
 
52 52
 
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public static function set_hooks() {
61 61
 		// routing
62
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
63
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
62
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
63
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
64 64
         EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections');
65
-        add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
66
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
67
-        add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'translate_js_strings' ), 0 );
68
-        add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
65
+        add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
66
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
67
+        add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'translate_js_strings'), 0);
68
+        add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
69 69
         EED_Ticket_Selector::loadIframeAssets();
70 70
     }
71 71
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		// to load assets for "espresso_events" page on the "edit" route (action)
83 83
 		add_action(
84 84
 			'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__edit',
85
-			array( 'EED_Ticket_Selector', 'ticket_selector_iframe_embed_button' ),
85
+			array('EED_Ticket_Selector', 'ticket_selector_iframe_embed_button'),
86 86
 			10
87 87
 		);
88 88
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	 *  @return 	void
107 107
 	 */
108 108
 	public static function set_definitions() {
109
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
110
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
109
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
110
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
111 111
 
112 112
 		//if config is not set, initialize
113
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) {
113
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config) {
114 114
             \EED_Ticket_Selector::instance()->set_config();
115 115
             \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
116 116
 		}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * 	@param	WP $WP
138 138
 	 * 	@return void
139 139
 	 */
140
-	public function run( $WP ) {}
140
+	public function run($WP) {}
141 141
 
142 142
 
143 143
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return \EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton
146 146
 	 */
147 147
 	public static function getIframeEmbedButton() {
148
-		if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton ) {
148
+		if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton) {
149 149
 			self::$iframe_embed_button = new TicketSelectorIframeEmbedButton();
150 150
 		}
151 151
 		return self::$iframe_embed_button;
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
      * @return    string
190 190
      * @throws \EE_Error
191 191
      */
192
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
193
-		return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details );
192
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
193
+		return EED_Ticket_Selector::ticketSelector()->display($event, $view_details);
194 194
 	}
195 195
 
196 196
 
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	* 	@return 		void
242 242
 	*/
243 243
 	public static function load_tckt_slctr_assets() {
244
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
244
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
245 245
             // add some style
246 246
             wp_register_style(
247 247
                 'ticket_selector', 
248
-                TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css',
248
+                TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css',
249 249
                 array(),
250 250
                 EVENT_ESPRESSO_VERSION
251 251
             );
@@ -253,13 +253,13 @@  discard block
 block discarded – undo
253 253
             // make it dance
254 254
             wp_register_script(
255 255
                 'ticket_selector', 
256
-                TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', 
256
+                TICKET_SELECTOR_ASSETS_URL.'ticket_selector.js', 
257 257
                 array('espresso_core'), 
258 258
                 EVENT_ESPRESSO_VERSION, 
259 259
                 TRUE
260 260
             );
261 261
 			wp_enqueue_script('ticket_selector');
262
-            require_once( EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php');
262
+            require_once(EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php');
263 263
             \EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts();
264 264
         }
265 265
 	}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
      */
302 302
     public static function iframeCss(array $iframe_css)
303 303
     {
304
-        $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css';
304
+        $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css';
305 305
         return $iframe_css;
306 306
     }
307 307
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      */
316 316
     public static function iframeJs(array $iframe_js)
317 317
     {
318
-        $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js';
318
+        $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL.'ticket_selector.js';
319 319
         return $iframe_js;
320 320
     }
321 321
 
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
     {
441 441
         // todo add doing_it_wrong() notice during next major version
442 442
 	    if (
443
-		    \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events'
444
-		    && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit'
443
+		    \EE_Registry::instance()->REQ->get('page') === 'espresso_events'
444
+		    && \EE_Registry::instance()->REQ->get('action') === 'edit'
445 445
 	    ) {
446 446
 		    $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton();
447 447
             $iframe_embed_button->embedButtonAssets();
Please login to merge, or discard this patch.
public/template_tags.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
  * can_use_espresso_conditionals
144 144
  * tests whether the Espresso Conditional tags like is_espresso_event_single() can be called
145 145
  *
146
- * @param $conditional_tag
146
+ * @param string $conditional_tag
147 147
  * @return bool
148 148
  */
149 149
 function can_use_espresso_conditionals( $conditional_tag ) {
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 	/**
856 856
 	 * espresso_event_venues
857 857
 	 *
858
-	 * @return array  all venues related to an event
858
+	 * @return EE_Venue[]  all venues related to an event
859 859
 	 */
860 860
 	function espresso_event_venues() {
861 861
 		return EEH_Venue_View::get_event_venues();
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 	 *
889 889
 	 * @param int     $VNU_ID optional, the venue id to check.
890 890
 	 *
891
-	 * @return bool | null
891
+	 * @return null|boolean | null
892 892
 	 */
893 893
 	function espresso_is_venue_private( $VNU_ID = 0 ) {
894 894
 		return EEH_Venue_View::is_venue_private( $VNU_ID );
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 	 * returns true or false if a venue is password protected or not
903 903
 	 *
904 904
 	 * @param int     $VNU_ID optional, the venue id to check.
905
-	 * @return string
905
+	 * @return boolean
906 906
 	 */
907 907
 	function espresso_venue_is_password_protected( $VNU_ID = 0 ) {
908 908
 		EE_Registry::instance()->load_helper( 'Venue_View' );
Please login to merge, or discard this patch.
Spacing   +276 added lines, -276 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
14 14
  * @param int | \EE_Event $event
15 15
  * @return bool
16 16
  */
17
-function is_espresso_event( $event = NULL ) {
18
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
17
+function is_espresso_event($event = NULL) {
18
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
19 19
 		// extract EE_Event object from passed param regardless of what it is (within reason of course)
20
-		$event = EEH_Event_View::get_event( $event );
20
+		$event = EEH_Event_View::get_event($event);
21 21
 		// do we have a valid event ?
22
-		return $event instanceof EE_Event  ? TRUE : FALSE;
22
+		return $event instanceof EE_Event ? TRUE : FALSE;
23 23
 	}
24 24
 	return FALSE;
25 25
 }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @return bool
32 32
  */
33 33
 function is_espresso_event_single() {
34
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
34
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
35 35
 		global $wp_query;
36 36
 		// return conditionals set by CPTs
37 37
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : FALSE;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  * @return bool
47 47
  */
48 48
 function is_espresso_event_archive() {
49
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
49
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
50 50
 		global $wp_query;
51 51
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : FALSE;
52 52
 	}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
  * @return bool
61 61
  */
62 62
 function is_espresso_event_taxonomy() {
63
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
63
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
64 64
 		global $wp_query;
65 65
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : FALSE;
66 66
 	}
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
  * @param int | \EE_Venue $venue
75 75
  * @return bool
76 76
  */
77
-function is_espresso_venue( $venue = NULL ) {
78
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
77
+function is_espresso_venue($venue = NULL) {
78
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
79 79
 		// extract EE_Venue object from passed param regardless of what it is (within reason of course)
80
-		$venue = EEH_Venue_View::get_venue( $venue, FALSE );
80
+		$venue = EEH_Venue_View::get_venue($venue, FALSE);
81 81
 		// do we have a valid event ?
82 82
 		return $venue instanceof EE_Venue ? TRUE : FALSE;
83 83
 	}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
  * @return bool
92 92
  */
93 93
 function is_espresso_venue_single() {
94
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
94
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
95 95
 		global $wp_query;
96 96
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : FALSE;
97 97
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
  * @return bool
106 106
  */
107 107
 function is_espresso_venue_archive() {
108
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
108
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
109 109
 		global $wp_query;
110 110
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : FALSE;
111 111
 	}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
  * @return bool
120 120
  */
121 121
 function is_espresso_venue_taxonomy() {
122
-	if ( can_use_espresso_conditionals( __FUNCTION__ )) {
122
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
123 123
 		global $wp_query;
124 124
 		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : FALSE;
125 125
 	}
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
  * @param $conditional_tag
134 134
  * @return bool
135 135
  */
136
-function can_use_espresso_conditionals( $conditional_tag ) {
137
-	if ( ! did_action( 'AHEE__EE_System__initialize' )) {
136
+function can_use_espresso_conditionals($conditional_tag) {
137
+	if ( ! did_action('AHEE__EE_System__initialize')) {
138 138
 		EE_Error::doing_it_wrong(
139 139
 			__FUNCTION__,
140 140
 			sprintf(
141
-				__( '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.','event_espresso'),
141
+				__('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.', 'event_espresso'),
142 142
 				$conditional_tag
143 143
 			),
144 144
 			'4.4.0'
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 
154 154
 /*************************** Event Queries ***************************/
155 155
 
156
-if ( ! function_exists( 'espresso_get_events' )) {
156
+if ( ! function_exists('espresso_get_events')) {
157 157
 	/**
158 158
 	 * 	espresso_get_events
159 159
 	 * @param array $params
160 160
 	 * @return array
161 161
 	 */
162
-	function espresso_get_events( $params = array() ) {
162
+	function espresso_get_events($params = array()) {
163 163
 		//set default params
164 164
 		$default_espresso_events_params = array(
165 165
 			'limit' => 10,
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
 			'sort' => 'ASC'
171 171
 		);
172 172
 		// allow the defaults to be filtered
173
-		$default_espresso_events_params = apply_filters( 'espresso_get_events__default_espresso_events_params', $default_espresso_events_params );
173
+		$default_espresso_events_params = apply_filters('espresso_get_events__default_espresso_events_params', $default_espresso_events_params);
174 174
 		// grab params and merge with defaults, then extract
175
-		$params = array_merge( $default_espresso_events_params, $params );
175
+		$params = array_merge($default_espresso_events_params, $params);
176 176
 		// run the query
177
-		$events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery( $params );
177
+		$events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params);
178 178
 		// assign results to a variable so we can return it
179 179
 		$events = $events_query->have_posts() ? $events_query->posts : array();
180 180
 		// but first reset the query and postdata
181 181
 		wp_reset_query();
182 182
 		wp_reset_postdata();
183 183
 		EED_Events_Archive::remove_all_events_archive_filters();
184
-		unset( $events_query );
184
+		unset($events_query);
185 185
 		return $events;
186 186
 	}
187 187
 }
@@ -195,32 +195,32 @@  discard block
 block discarded – undo
195 195
  * espresso_load_ticket_selector
196 196
  */
197 197
 function espresso_load_ticket_selector() {
198
-	EE_Registry::instance()->load_file( EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module' );
198
+	EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module');
199 199
 }
200 200
 
201
-if ( ! function_exists( 'espresso_ticket_selector' )) {
201
+if ( ! function_exists('espresso_ticket_selector')) {
202 202
 	/**
203 203
 	 * espresso_ticket_selector
204 204
 	 * @param null $event
205 205
 	 */
206
-	function espresso_ticket_selector( $event = NULL ) {
207
-		if (  ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) {
206
+	function espresso_ticket_selector($event = NULL) {
207
+		if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', FALSE)) {
208 208
 			espresso_load_ticket_selector();
209
-			echo EED_Ticket_Selector::display_ticket_selector( $event );
209
+			echo EED_Ticket_Selector::display_ticket_selector($event);
210 210
 		}
211 211
 	}
212 212
 }
213 213
 
214 214
 
215
-	if ( ! function_exists( 'espresso_view_details_btn' )) {
215
+	if ( ! function_exists('espresso_view_details_btn')) {
216 216
 	/**
217 217
 	 * espresso_view_details_btn
218 218
 	 * @param null $event
219 219
 	 */
220
-	function espresso_view_details_btn( $event = NULL ) {
221
-		if (  ! apply_filters( 'FHEE_disable_espresso_view_details_btn', FALSE ) ) {
220
+	function espresso_view_details_btn($event = NULL) {
221
+		if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', FALSE)) {
222 222
 			espresso_load_ticket_selector();
223
-			echo EED_Ticket_Selector::display_ticket_selector( $event, TRUE );
223
+			echo EED_Ticket_Selector::display_ticket_selector($event, TRUE);
224 224
 		}
225 225
 	}
226 226
 }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
 /*************************** EEH_Event_View ***************************/
232 232
 
233
-if ( ! function_exists( 'espresso_load_event_list_assets' )) {
233
+if ( ! function_exists('espresso_load_event_list_assets')) {
234 234
 	/**
235 235
 	 * espresso_load_event_list_assets
236 236
 	 * ensures that event list styles and scripts are loaded
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	function espresso_load_event_list_assets() {
241 241
 		$event_list = EED_Events_Archive::instance();
242
-		add_action( 'AHEE__EE_System__initialize_last', array( $event_list, 'load_event_list_assets' ), 10 );
243
-		add_filter( 'FHEE_enable_default_espresso_css', '__return_true' );
242
+		add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10);
243
+		add_filter('FHEE_enable_default_espresso_css', '__return_true');
244 244
 	}
245 245
 }
246 246
 
247 247
 
248
-if ( ! function_exists( 'espresso_event_reg_button' )) {
248
+if ( ! function_exists('espresso_event_reg_button')) {
249 249
 	/**
250 250
 	 * espresso_event_reg_button
251 251
 	 * returns the "Register Now" button if event is active,
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 	 * @param bool $EVT_ID
258 258
 	 * @return string
259 259
 	 */
260
-	function espresso_event_reg_button( $btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE ) {
261
-		$event_status = EEH_Event_View::event_active_status( $EVT_ID );
262
-		switch ( $event_status ) {
260
+	function espresso_event_reg_button($btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE) {
261
+		$event_status = EEH_Event_View::event_active_status($EVT_ID);
262
+		switch ($event_status) {
263 263
 			case EE_Datetime::sold_out :
264 264
 				$btn_text = __('Sold Out', 'event_espresso');
265 265
 				$class = 'ee-pink';
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 			case EE_Datetime::upcoming :
276 276
 			case EE_Datetime::active :
277 277
 			default :
278
-				$btn_text =! empty( $btn_text_if_active ) ? $btn_text_if_active : __( 'Register Now', 'event_espresso' );
278
+				$btn_text = ! empty($btn_text_if_active) ? $btn_text_if_active : __('Register Now', 'event_espresso');
279 279
 				$class = 'ee-green';
280 280
 		}
281
-		if ( $event_status < 1 && ! empty( $btn_text_if_inactive )) {
281
+		if ($event_status < 1 && ! empty($btn_text_if_inactive)) {
282 282
 			$btn_text = $btn_text_if_inactive;
283 283
 			$class = 'ee-grey';
284 284
 		}
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
 
294 294
 
295
-if ( ! function_exists( 'espresso_display_ticket_selector' )) {
295
+if ( ! function_exists('espresso_display_ticket_selector')) {
296 296
 	/**
297 297
 	 * espresso_display_ticket_selector
298 298
 	 * whether or not to display the Ticket Selector for an event
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 	 * @param bool $EVT_ID
301 301
 	 * @return boolean
302 302
 	 */
303
-	function espresso_display_ticket_selector( $EVT_ID = FALSE ) {
304
-		return EEH_Event_View::display_ticket_selector( $EVT_ID );
303
+	function espresso_display_ticket_selector($EVT_ID = FALSE) {
304
+		return EEH_Event_View::display_ticket_selector($EVT_ID);
305 305
 	}
306 306
 }
307 307
 
308 308
 
309 309
 
310
-if ( ! function_exists( 'espresso_event_status_banner' )) {
310
+if ( ! function_exists('espresso_event_status_banner')) {
311 311
 	/**
312 312
 	 * espresso_event_status
313 313
 	 * returns a banner showing the event status if it is sold out, expired, or inactive
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 	 * @param bool $EVT_ID
316 316
 	 * @return string
317 317
 	 */
318
-	function espresso_event_status_banner( $EVT_ID = FALSE ) {
319
-		return EEH_Event_View::event_status( $EVT_ID );
318
+	function espresso_event_status_banner($EVT_ID = FALSE) {
319
+		return EEH_Event_View::event_status($EVT_ID);
320 320
 	}
321 321
 }
322 322
 
323 323
 
324
-if ( ! function_exists( 'espresso_event_status' )) {
324
+if ( ! function_exists('espresso_event_status')) {
325 325
 	/**
326 326
 	 * espresso_event_status
327 327
 	 * returns the event status if it is sold out, expired, or inactive
@@ -330,17 +330,17 @@  discard block
 block discarded – undo
330 330
 	 * @param bool $echo
331 331
 	 * @return string
332 332
 	 */
333
-	function espresso_event_status( $EVT_ID = 0, $echo = TRUE ) {
334
-		if ( $echo ) {
335
-			echo EEH_Event_View::event_active_status( $EVT_ID );
333
+	function espresso_event_status($EVT_ID = 0, $echo = TRUE) {
334
+		if ($echo) {
335
+			echo EEH_Event_View::event_active_status($EVT_ID);
336 336
 			return '';
337 337
 		}
338
-		return EEH_Event_View::event_active_status( $EVT_ID );
338
+		return EEH_Event_View::event_active_status($EVT_ID);
339 339
 	}
340 340
 }
341 341
 
342 342
 
343
-if ( ! function_exists( 'espresso_event_categories' )) {
343
+if ( ! function_exists('espresso_event_categories')) {
344 344
 	/**
345 345
 	 * espresso_event_categories
346 346
 	 * returns the terms associated with an event
@@ -350,17 +350,17 @@  discard block
 block discarded – undo
350 350
 	 * @param bool $echo
351 351
 	 * @return string
352 352
 	 */
353
-	function espresso_event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) {
354
-		if ( $echo ) {
355
-			echo EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized );
353
+	function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) {
354
+		if ($echo) {
355
+			echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized);
356 356
 			return '';
357 357
 		}
358
-		return EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized );
358
+		return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized);
359 359
 	}
360 360
 }
361 361
 
362 362
 
363
-if ( ! function_exists( 'espresso_event_tickets_available' )) {
363
+if ( ! function_exists('espresso_event_tickets_available')) {
364 364
 	/**
365 365
 	 * espresso_event_tickets_available
366 366
 	 * returns the ticket types available for purchase for an event
@@ -370,26 +370,26 @@  discard block
 block discarded – undo
370 370
 	 * @param bool $format
371 371
 	 * @return string
372 372
 	 */
373
-	function espresso_event_tickets_available( $EVT_ID = 0, $echo = TRUE, $format = TRUE ) {
374
-		$tickets = EEH_Event_View::event_tickets_available( $EVT_ID );
375
-		if ( is_array( $tickets ) && ! empty( $tickets )) {
373
+	function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) {
374
+		$tickets = EEH_Event_View::event_tickets_available($EVT_ID);
375
+		if (is_array($tickets) && ! empty($tickets)) {
376 376
 			// if formatting then $html will be a string, else it will be an array of ticket objects
377
-			$html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array();
378
-			foreach ( $tickets as $ticket ) {
379
-				if ( $ticket instanceof EE_Ticket ) {
380
-					if ( $format ) {
381
-						$html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">';
382
-						$html .= $ticket->name() . ' ' . EEH_Template::format_currency( $ticket->get_ticket_total_with_taxes() );
377
+			$html = $format ? '<ul id="ee-event-tickets-ul-'.$EVT_ID.'" class="ee-event-tickets-ul">' : array();
378
+			foreach ($tickets as $ticket) {
379
+				if ($ticket instanceof EE_Ticket) {
380
+					if ($format) {
381
+						$html .= '<li id="ee-event-tickets-li-'.$ticket->ID().'" class="ee-event-tickets-li">';
382
+						$html .= $ticket->name().' '.EEH_Template::format_currency($ticket->get_ticket_total_with_taxes());
383 383
 						$html .= '</li>';
384 384
 					} else {
385 385
 						$html[] = $ticket;
386 386
 					}
387 387
 				}
388 388
 			}
389
-			if ( $format ) {
389
+			if ($format) {
390 390
 				$html .= '</ul>';
391 391
 			}
392
-			if ( $echo && ! $format ) {
392
+			if ($echo && ! $format) {
393 393
 				echo $html;
394 394
 				return '';
395 395
 			}
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	}
400 400
 }
401 401
 
402
-if ( ! function_exists( 'espresso_event_date_obj' )) {
402
+if ( ! function_exists('espresso_event_date_obj')) {
403 403
 	/**
404 404
 	 * espresso_event_date_obj
405 405
 	 * returns the primary date object for an event
@@ -407,13 +407,13 @@  discard block
 block discarded – undo
407 407
 	 * @param bool $EVT_ID
408 408
 	 * @return object
409 409
 	 */
410
-	function espresso_event_date_obj( $EVT_ID = FALSE ) {
411
-		return EEH_Event_View::get_primary_date_obj( $EVT_ID );
410
+	function espresso_event_date_obj($EVT_ID = FALSE) {
411
+		return EEH_Event_View::get_primary_date_obj($EVT_ID);
412 412
 	}
413 413
 }
414 414
 
415 415
 
416
-if ( ! function_exists( 'espresso_event_date' )) {
416
+if ( ! function_exists('espresso_event_date')) {
417 417
 	/**
418 418
 	 * espresso_event_date
419 419
 	 * returns the primary date for an event
@@ -424,22 +424,22 @@  discard block
 block discarded – undo
424 424
 	 * @param bool $echo
425 425
 	 * @return string
426 426
 	 */
427
-	function espresso_event_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) {
428
-		$date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' );
429
-		$time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' );
430
-		$date_format = apply_filters( 'FHEE__espresso_event_date__date_format', $date_format );
431
-		$time_format = apply_filters( 'FHEE__espresso_event_date__time_format', $time_format );
432
-		if($echo){
433
-			echo EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID );
427
+	function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) {
428
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
429
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
430
+		$date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format);
431
+		$time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format);
432
+		if ($echo) {
433
+			echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID);
434 434
 			return '';
435 435
 		}
436
-		return EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID );
436
+		return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID);
437 437
 
438 438
 	}
439 439
 }
440 440
 
441 441
 
442
-if ( ! function_exists( 'espresso_list_of_event_dates' )) {
442
+if ( ! function_exists('espresso_list_of_event_dates')) {
443 443
 	/**
444 444
 	 * espresso_list_of_event_dates
445 445
 	 * returns a unordered list of dates for an event
@@ -454,40 +454,40 @@  discard block
 block discarded – undo
454 454
 	 * @param null   $limit
455 455
 	 * @return string
456 456
 	 */
457
-	function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL ) {
458
-		$date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' );
459
-		$time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' );
460
-		$date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format );
461
-		$time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format );
462
-		$datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired, FALSE, $limit );
463
-		if ( ! $format ) {
464
-			return apply_filters( 'FHEE__espresso_list_of_event_dates__datetimes', $datetimes );
457
+	function espresso_list_of_event_dates($EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL) {
458
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
459
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
460
+		$date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format);
461
+		$time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format);
462
+		$datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, FALSE, $limit);
463
+		if ( ! $format) {
464
+			return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes);
465 465
 		}
466 466
 		//d( $datetimes );
467
-		if ( is_array( $datetimes ) && ! empty( $datetimes )) {
467
+		if (is_array($datetimes) && ! empty($datetimes)) {
468 468
 			global $post;
469
-			$html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul ee-clearfix">' : '';
470
-			foreach ( $datetimes as $datetime ) {
471
-				if ( $datetime instanceof EE_Datetime ) {
472
-					$html .= '<li id="ee-event-datetimes-li-' . $datetime->ID();
473
-					$html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-' . $datetime->get_active_status() . '">';
469
+			$html = $format ? '<ul id="ee-event-datetimes-ul-'.$post->ID.'" class="ee-event-datetimes-ul ee-clearfix">' : '';
470
+			foreach ($datetimes as $datetime) {
471
+				if ($datetime instanceof EE_Datetime) {
472
+					$html .= '<li id="ee-event-datetimes-li-'.$datetime->ID();
473
+					$html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-'.$datetime->get_active_status().'">';
474 474
 					$datetime_name = $datetime->name();
475
-					$html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : '';
476
-					$html .= ! empty( $datetime_name )  && $add_breaks ? '<br />' : '';
477
-					$html .= '<span class="dashicons dashicons-calendar"></span><span class="ee-event-datetimes-li-daterange">' . $datetime->date_range( $date_format ) . '</span><br/>';
478
-					$html .= '<span class="dashicons dashicons-clock"></span><span class="ee-event-datetimes-li-timerange">' . $datetime->time_range( $time_format ) . '</span>';
475
+					$html .= ! empty($datetime_name) ? '<strong>'.$datetime_name.'</strong>' : '';
476
+					$html .= ! empty($datetime_name) && $add_breaks ? '<br />' : '';
477
+					$html .= '<span class="dashicons dashicons-calendar"></span><span class="ee-event-datetimes-li-daterange">'.$datetime->date_range($date_format).'</span><br/>';
478
+					$html .= '<span class="dashicons dashicons-clock"></span><span class="ee-event-datetimes-li-timerange">'.$datetime->time_range($time_format).'</span>';
479 479
 					$datetime_description = $datetime->description();
480
-					$html .= ! empty( $datetime_description )  && $add_breaks ? '<br />' : '';
481
-					$html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : '';
482
-					$html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime );
480
+					$html .= ! empty($datetime_description) && $add_breaks ? '<br />' : '';
481
+					$html .= ! empty($datetime_description) ? ' - '.$datetime_description : '';
482
+					$html = apply_filters('FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime);
483 483
 					$html .= '</li>';
484 484
 				}
485 485
 			}
486 486
 			$html .= $format ? '</ul>' : '';
487 487
 		} else {
488
-			$html = $format ?  '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : '';
488
+			$html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>'.__('There are no upcoming dates for this event.', 'event_espresso').'</p><br/>' : '';
489 489
 		}
490
-		if ( $echo ) {
490
+		if ($echo) {
491 491
 			echo $html;
492 492
 			return '';
493 493
 		}
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 }
497 497
 
498 498
 
499
-if ( ! function_exists( 'espresso_event_end_date' )) {
499
+if ( ! function_exists('espresso_event_end_date')) {
500 500
 	/**
501 501
 	 * espresso_event_end_date
502 502
 	 * returns the last date for an event
@@ -507,20 +507,20 @@  discard block
 block discarded – undo
507 507
 	 * @param bool   $echo
508 508
 	 * @return string
509 509
 	 */
510
-	function espresso_event_end_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) {
511
-		$date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' );
512
-		$time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' );
513
-		$date_format = apply_filters( 'FHEE__espresso_event_end_date__date_format', $date_format );
514
-		$time_format = apply_filters( 'FHEE__espresso_event_end_date__time_format', $time_format );
515
-		if($echo){
516
-			echo EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID );
510
+	function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) {
511
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
512
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
513
+		$date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format);
514
+		$time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format);
515
+		if ($echo) {
516
+			echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID);
517 517
 			return '';
518 518
 		}
519
-		return EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID );
519
+		return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID);
520 520
 	}
521 521
 }
522 522
 
523
-if ( ! function_exists( 'espresso_event_date_range' )) {
523
+if ( ! function_exists('espresso_event_date_range')) {
524 524
 	/**
525 525
 	 * espresso_event_date_range
526 526
 	 * returns the first and last chronologically ordered dates for an event (if different)
@@ -533,31 +533,31 @@  discard block
 block discarded – undo
533 533
 	 * @param bool   $echo
534 534
 	 * @return string
535 535
 	 */
536
-	function espresso_event_date_range( $date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE ) {
536
+	function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE) {
537 537
 		// set and filter date and time formats when a range is returned
538
-		$date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' );
539
-		$date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', $date_format );
538
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
539
+		$date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format);
540 540
 		// get the start and end date with NO time portion
541
-		$the_event_date = EEH_Event_View::the_earliest_event_date( $date_format, '', $EVT_ID );
542
-		$the_event_end_date = EEH_Event_View::the_latest_event_date( $date_format, '', $EVT_ID );
541
+		$the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID);
542
+		$the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID);
543 543
 		// now we can determine if date range spans more than one day
544
-		if ( $the_event_date != $the_event_end_date ) {
545
-			$time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' );
546
-			$time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', $time_format );
544
+		if ($the_event_date != $the_event_end_date) {
545
+			$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
546
+			$time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format);
547 547
 			$html = sprintf(
548
-				__( '%1$s - %2$s', 'event_espresso' ),
549
-				EEH_Event_View::the_earliest_event_date( $date_format, $time_format, $EVT_ID ),
550
-				EEH_Event_View::the_latest_event_date( $date_format, $time_format, $EVT_ID )
548
+				__('%1$s - %2$s', 'event_espresso'),
549
+				EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID),
550
+				EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID)
551 551
 			);
552 552
 		} else {
553 553
 			// set and filter date and time formats when only a single datetime is returned
554
-			$single_date_format = ! empty( $single_date_format ) ? $single_date_format : get_option( 'date_format' );
555
-			$single_time_format = ! empty( $single_time_format ) ? $single_time_format : get_option( 'time_format' );
556
-			$single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', $single_date_format );
557
-			$single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', $single_time_format );
558
-			$html = EEH_Event_View::the_earliest_event_date( $single_date_format, $single_time_format, $EVT_ID );
554
+			$single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format');
555
+			$single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format');
556
+			$single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format);
557
+			$single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format);
558
+			$html = EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID);
559 559
 		}
560
-		if ( $echo ) {
560
+		if ($echo) {
561 561
 			echo $html;
562 562
 			return '';
563 563
 		}
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 }
567 567
 
568 568
 
569
-if ( ! function_exists( 'espresso_event_date_as_calendar_page' )) {
569
+if ( ! function_exists('espresso_event_date_as_calendar_page')) {
570 570
 	/**
571 571
 	 * espresso_event_date_as_calendar_page
572 572
 	 * returns the primary date for an event, stylized to appear as the page of a calendar
@@ -574,15 +574,15 @@  discard block
 block discarded – undo
574 574
 	 * @param bool $EVT_ID
575 575
 	 * @return string
576 576
 	 */
577
-	function espresso_event_date_as_calendar_page( $EVT_ID = FALSE ) {
578
-		EEH_Event_View::event_date_as_calendar_page( $EVT_ID );
577
+	function espresso_event_date_as_calendar_page($EVT_ID = FALSE) {
578
+		EEH_Event_View::event_date_as_calendar_page($EVT_ID);
579 579
 	}
580 580
 }
581 581
 
582 582
 
583 583
 
584 584
 
585
-if ( ! function_exists( 'espresso_event_link_url' )) {
585
+if ( ! function_exists('espresso_event_link_url')) {
586 586
 	/**
587 587
 	 * espresso_event_link_url
588 588
 	 *
@@ -590,18 +590,18 @@  discard block
 block discarded – undo
590 590
 	 * @param bool $echo
591 591
 	 * @return string
592 592
 	 */
593
-	function espresso_event_link_url( $EVT_ID = 0, $echo = TRUE ) {
594
-		if ( $echo ) {
595
-			echo EEH_Event_View::event_link_url( $EVT_ID );
593
+	function espresso_event_link_url($EVT_ID = 0, $echo = TRUE) {
594
+		if ($echo) {
595
+			echo EEH_Event_View::event_link_url($EVT_ID);
596 596
 			return '';
597 597
 		}
598
-		return EEH_Event_View::event_link_url( $EVT_ID );
598
+		return EEH_Event_View::event_link_url($EVT_ID);
599 599
 	}
600 600
 }
601 601
 
602 602
 
603 603
 
604
-if ( ! function_exists( 'espresso_event_has_content_or_excerpt' )) {
604
+if ( ! function_exists('espresso_event_has_content_or_excerpt')) {
605 605
 	/**
606 606
 	 *    espresso_event_has_content_or_excerpt
607 607
 	 *
@@ -609,15 +609,15 @@  discard block
 block discarded – undo
609 609
 	 * @param bool $EVT_ID
610 610
 	 * @return    boolean
611 611
 	 */
612
-	function espresso_event_has_content_or_excerpt( $EVT_ID = FALSE ) {
613
-		return EEH_Event_View::event_has_content_or_excerpt( $EVT_ID );
612
+	function espresso_event_has_content_or_excerpt($EVT_ID = FALSE) {
613
+		return EEH_Event_View::event_has_content_or_excerpt($EVT_ID);
614 614
 	}
615 615
 }
616 616
 
617 617
 
618 618
 
619 619
 
620
-if ( ! function_exists( 'espresso_event_content_or_excerpt' )) {
620
+if ( ! function_exists('espresso_event_content_or_excerpt')) {
621 621
 	/**
622 622
 	 * espresso_event_content_or_excerpt
623 623
 	 *
@@ -626,18 +626,18 @@  discard block
 block discarded – undo
626 626
 	 * @param bool $echo
627 627
 	 * @return string
628 628
 	 */
629
-	function espresso_event_content_or_excerpt( $num_words = 55, $more = NULL, $echo = TRUE ) {
630
-		if ( $echo ) {
631
-			echo EEH_Event_View::event_content_or_excerpt( $num_words, $more );
629
+	function espresso_event_content_or_excerpt($num_words = 55, $more = NULL, $echo = TRUE) {
630
+		if ($echo) {
631
+			echo EEH_Event_View::event_content_or_excerpt($num_words, $more);
632 632
 			return '';
633 633
 		}
634
-		return EEH_Event_View::event_content_or_excerpt( $num_words, $more );
634
+		return EEH_Event_View::event_content_or_excerpt($num_words, $more);
635 635
 	}
636 636
 }
637 637
 
638 638
 
639 639
 
640
-if ( ! function_exists( 'espresso_event_phone' )) {
640
+if ( ! function_exists('espresso_event_phone')) {
641 641
 	/**
642 642
 	 * espresso_event_phone
643 643
 	 *
@@ -645,18 +645,18 @@  discard block
 block discarded – undo
645 645
 	 * @param bool $echo
646 646
 	 * @return string
647 647
 	 */
648
-	function espresso_event_phone( $EVT_ID = 0, $echo = TRUE ) {
649
-		if ( $echo ) {
650
-			echo EEH_Event_View::event_phone( $EVT_ID );
648
+	function espresso_event_phone($EVT_ID = 0, $echo = TRUE) {
649
+		if ($echo) {
650
+			echo EEH_Event_View::event_phone($EVT_ID);
651 651
 			return '';
652 652
 		}
653
-		return EEH_Event_View::event_phone( $EVT_ID );
653
+		return EEH_Event_View::event_phone($EVT_ID);
654 654
 	}
655 655
 }
656 656
 
657 657
 
658 658
 
659
-if ( ! function_exists( 'espresso_edit_event_link' )) {
659
+if ( ! function_exists('espresso_edit_event_link')) {
660 660
 	/**
661 661
 	 * espresso_edit_event_link
662 662
 	 * returns a link to edit an event
@@ -665,39 +665,39 @@  discard block
 block discarded – undo
665 665
 	 * @param bool $echo
666 666
 	 * @return string
667 667
 	 */
668
-	function espresso_edit_event_link( $EVT_ID = 0, $echo = TRUE ) {
669
-		if ( $echo ) {
670
-			echo EEH_Event_View::edit_event_link( $EVT_ID );
668
+	function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) {
669
+		if ($echo) {
670
+			echo EEH_Event_View::edit_event_link($EVT_ID);
671 671
 			return '';
672 672
 		}
673
-		return EEH_Event_View::edit_event_link( $EVT_ID );
673
+		return EEH_Event_View::edit_event_link($EVT_ID);
674 674
 	}
675 675
 }
676 676
 
677 677
 
678
-if ( ! function_exists( 'espresso_organization_name' )) {
678
+if ( ! function_exists('espresso_organization_name')) {
679 679
 	/**
680 680
 	 * espresso_organization_name
681 681
 	 * @param bool $echo
682 682
 	 * @return string
683 683
 	 */
684 684
 	function espresso_organization_name($echo = TRUE) {
685
-		if($echo){
686
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'name' );
685
+		if ($echo) {
686
+			echo EE_Registry::instance()->CFG->organization->get_pretty('name');
687 687
 			return '';
688 688
 		}
689
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'name' );
689
+		return EE_Registry::instance()->CFG->organization->get_pretty('name');
690 690
 	}
691 691
 }
692 692
 
693
-if ( ! function_exists( 'espresso_organization_address' )) {
693
+if ( ! function_exists('espresso_organization_address')) {
694 694
 	/**
695 695
 	 * espresso_organization_address
696 696
 	 * @param string $type
697 697
 	 * @return string
698 698
 	 */
699
-	function espresso_organization_address( $type = 'inline' ) {
700
-		if ( EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ) {
699
+	function espresso_organization_address($type = 'inline') {
700
+		if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) {
701 701
 			$address = new EventEspresso\core\domain\entities\GenericAddress(
702 702
 				EE_Registry::instance()->CFG->organization->address_1,
703 703
 				EE_Registry::instance()->CFG->organization->address_2,
@@ -706,129 +706,129 @@  discard block
 block discarded – undo
706 706
 				EE_Registry::instance()->CFG->organization->zip,
707 707
 				EE_Registry::instance()->CFG->organization->CNT_ISO
708 708
 			);
709
-			return EEH_Address::format( $address, $type );
709
+			return EEH_Address::format($address, $type);
710 710
 		}
711 711
 		return '';
712 712
 	}
713 713
 }
714 714
 
715
-if ( ! function_exists( 'espresso_organization_email' )) {
715
+if ( ! function_exists('espresso_organization_email')) {
716 716
 	/**
717 717
 	 * espresso_organization_email
718 718
 	 * @param bool $echo
719 719
 	 * @return string
720 720
 	 */
721
-	function espresso_organization_email( $echo = TRUE ) {
722
-		if($echo){
723
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
721
+	function espresso_organization_email($echo = TRUE) {
722
+		if ($echo) {
723
+			echo EE_Registry::instance()->CFG->organization->get_pretty('email');
724 724
 			return '';
725 725
 		}
726
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
726
+		return EE_Registry::instance()->CFG->organization->get_pretty('email');
727 727
 	}
728 728
 }
729 729
 
730
-if ( ! function_exists( 'espresso_organization_logo_url' )) {
730
+if ( ! function_exists('espresso_organization_logo_url')) {
731 731
 	/**
732 732
 	 * espresso_organization_logo_url
733 733
 	 * @param bool $echo
734 734
 	 * @return string
735 735
 	 */
736
-	function espresso_organization_logo_url( $echo = TRUE ) {
737
-		if($echo){
738
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' );
736
+	function espresso_organization_logo_url($echo = TRUE) {
737
+		if ($echo) {
738
+			echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
739 739
 			return '';
740 740
 		}
741
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' );
741
+		return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
742 742
 	}
743 743
 }
744 744
 
745
-if ( ! function_exists( 'espresso_organization_facebook' )) {
745
+if ( ! function_exists('espresso_organization_facebook')) {
746 746
 	/**
747 747
 	 * espresso_organization_facebook
748 748
 	 * @param bool $echo
749 749
 	 * @return string
750 750
 	 */
751
-	function espresso_organization_facebook( $echo = TRUE ) {
752
-		if($echo){
753
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' );
751
+	function espresso_organization_facebook($echo = TRUE) {
752
+		if ($echo) {
753
+			echo EE_Registry::instance()->CFG->organization->get_pretty('facebook');
754 754
 			return '';
755 755
 		}
756
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' );
756
+		return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
757 757
 	}
758 758
 }
759 759
 
760
-if ( ! function_exists( 'espresso_organization_twitter' )) {
760
+if ( ! function_exists('espresso_organization_twitter')) {
761 761
 	/**
762 762
 	 * espresso_organization_twitter
763 763
 	 * @param bool $echo
764 764
 	 * @return string
765 765
 	 */
766
-	function espresso_organization_twitter( $echo = TRUE ) {
767
-		if($echo){
768
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' );
766
+	function espresso_organization_twitter($echo = TRUE) {
767
+		if ($echo) {
768
+			echo EE_Registry::instance()->CFG->organization->get_pretty('twitter');
769 769
 			return '';
770 770
 		}
771
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' );
771
+		return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
772 772
 	}
773 773
 }
774 774
 
775
-if ( ! function_exists( 'espresso_organization_linkedin' )) {
775
+if ( ! function_exists('espresso_organization_linkedin')) {
776 776
 	/**
777 777
 	 * espresso_organization_linkedin
778 778
 	 * @param bool $echo
779 779
 	 * @return string
780 780
 	 */
781
-	function espresso_organization_linkedin( $echo = TRUE ) {
782
-		if($echo){
783
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' );
781
+	function espresso_organization_linkedin($echo = TRUE) {
782
+		if ($echo) {
783
+			echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
784 784
 			return '';
785 785
 		}
786
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' );
786
+		return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
787 787
 	}
788 788
 }
789 789
 
790
-if ( ! function_exists( 'espresso_organization_pinterest' )) {
790
+if ( ! function_exists('espresso_organization_pinterest')) {
791 791
 	/**
792 792
 	 * espresso_organization_pinterest
793 793
 	 * @param bool $echo
794 794
 	 * @return string
795 795
 	 */
796
-	function espresso_organization_pinterest( $echo = TRUE ) {
797
-		if($echo){
798
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' );
796
+	function espresso_organization_pinterest($echo = TRUE) {
797
+		if ($echo) {
798
+			echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
799 799
 			return '';
800 800
 		}
801
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' );
801
+		return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
802 802
 	}
803 803
 }
804 804
 
805
-if ( ! function_exists( 'espresso_organization_google' )) {
805
+if ( ! function_exists('espresso_organization_google')) {
806 806
 	/**
807 807
 	 * espresso_organization_google
808 808
 	 * @param bool $echo
809 809
 	 * @return string
810 810
 	 */
811
-	function espresso_organization_google( $echo = TRUE ) {
812
-		if($echo){
813
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'google' );
811
+	function espresso_organization_google($echo = TRUE) {
812
+		if ($echo) {
813
+			echo EE_Registry::instance()->CFG->organization->get_pretty('google');
814 814
 			return '';
815 815
 		}
816
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'google' );
816
+		return EE_Registry::instance()->CFG->organization->get_pretty('google');
817 817
 	}
818 818
 }
819 819
 
820
-if ( ! function_exists( 'espresso_organization_instagram' )) {
820
+if ( ! function_exists('espresso_organization_instagram')) {
821 821
 	/**
822 822
 	 * espresso_organization_instagram
823 823
 	 * @param bool $echo
824 824
 	 * @return string
825 825
 	 */
826
-	function espresso_organization_instagram( $echo = TRUE ) {
827
-		if($echo){
828
-			echo EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' );
826
+	function espresso_organization_instagram($echo = TRUE) {
827
+		if ($echo) {
828
+			echo EE_Registry::instance()->CFG->organization->get_pretty('instagram');
829 829
 			return '';
830 830
 		}
831
-		return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' );
831
+		return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
832 832
 	}
833 833
 }
834 834
 
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 
839 839
 
840 840
 
841
-if ( ! function_exists( 'espresso_event_venues' )) {
841
+if ( ! function_exists('espresso_event_venues')) {
842 842
 	/**
843 843
 	 * espresso_event_venues
844 844
 	 *
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 
853 853
 
854 854
 
855
-if ( ! function_exists( 'espresso_venue_id' )) {
855
+if ( ! function_exists('espresso_venue_id')) {
856 856
 	/**
857 857
 	 *    espresso_venue_name
858 858
 	 *
@@ -860,15 +860,15 @@  discard block
 block discarded – undo
860 860
 	 * @param     int $EVT_ID
861 861
 	 * @return    string
862 862
 	 */
863
-	function espresso_venue_id( $EVT_ID = 0 ) {
864
-		$venue = EEH_Venue_View::get_venue( $EVT_ID );
863
+	function espresso_venue_id($EVT_ID = 0) {
864
+		$venue = EEH_Venue_View::get_venue($EVT_ID);
865 865
 		return $venue instanceof EE_Venue ? $venue->ID() : 0;
866 866
 	}
867 867
 }
868 868
 
869 869
 
870 870
 
871
-if ( ! function_exists( 'espresso_is_venue_private' ) ) {
871
+if ( ! function_exists('espresso_is_venue_private')) {
872 872
 	/**
873 873
 	 * Return whether a venue is private or not.
874 874
 	 * @see EEH_Venue_View::get_venue() for more info on expected return results.
@@ -877,45 +877,45 @@  discard block
 block discarded – undo
877 877
 	 *
878 878
 	 * @return bool | null
879 879
 	 */
880
-	function espresso_is_venue_private( $VNU_ID = 0 ) {
881
-		return EEH_Venue_View::is_venue_private( $VNU_ID );
880
+	function espresso_is_venue_private($VNU_ID = 0) {
881
+		return EEH_Venue_View::is_venue_private($VNU_ID);
882 882
 	}
883 883
 }
884 884
 
885 885
 
886 886
 
887
-if ( ! function_exists( 'espresso_venue_is_password_protected' ) ) {
887
+if ( ! function_exists('espresso_venue_is_password_protected')) {
888 888
 	/**
889 889
 	 * returns true or false if a venue is password protected or not
890 890
 	 *
891 891
 	 * @param int     $VNU_ID optional, the venue id to check.
892 892
 	 * @return string
893 893
 	 */
894
-	function espresso_venue_is_password_protected( $VNU_ID = 0 ) {
895
-		EE_Registry::instance()->load_helper( 'Venue_View' );
896
-		return EEH_Venue_View::is_venue_password_protected( $VNU_ID );
894
+	function espresso_venue_is_password_protected($VNU_ID = 0) {
895
+		EE_Registry::instance()->load_helper('Venue_View');
896
+		return EEH_Venue_View::is_venue_password_protected($VNU_ID);
897 897
 	}
898 898
 }
899 899
 
900 900
 
901 901
 
902
-if ( ! function_exists( 'espresso_password_protected_venue_form' ) ) {
902
+if ( ! function_exists('espresso_password_protected_venue_form')) {
903 903
 	/**
904 904
 	 * Returns a password form if venue is password protected.
905 905
 	 *
906 906
 	 * @param int     $VNU_ID optional, the venue id to check.
907 907
 	 * @return string
908 908
 	 */
909
-	function espresso_password_protected_venue_form( $VNU_ID = 0 ) {
910
-		EE_Registry::instance()->load_helper( 'Venue_View' );
911
-		return EEH_Venue_View::password_protected_venue_form( $VNU_ID );
909
+	function espresso_password_protected_venue_form($VNU_ID = 0) {
910
+		EE_Registry::instance()->load_helper('Venue_View');
911
+		return EEH_Venue_View::password_protected_venue_form($VNU_ID);
912 912
 	}
913 913
 }
914 914
 
915 915
 
916 916
 
917 917
 
918
-if ( ! function_exists( 'espresso_venue_name' )) {
918
+if ( ! function_exists('espresso_venue_name')) {
919 919
 	/**
920 920
 	 *    espresso_venue_name
921 921
 	 *
@@ -925,19 +925,19 @@  discard block
 block discarded – undo
925 925
 	 * @param bool   $echo
926 926
 	 * @return    string
927 927
 	 */
928
-	function espresso_venue_name( $VNU_ID = 0, $link_to = 'details', $echo = TRUE ) {
929
-		if($echo){
930
-			echo EEH_Venue_View::venue_name( $link_to, $VNU_ID );
928
+	function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = TRUE) {
929
+		if ($echo) {
930
+			echo EEH_Venue_View::venue_name($link_to, $VNU_ID);
931 931
 			return '';
932 932
 		}
933
-		return EEH_Venue_View::venue_name( $link_to, $VNU_ID );
933
+		return EEH_Venue_View::venue_name($link_to, $VNU_ID);
934 934
 	}
935 935
 }
936 936
 
937 937
 
938 938
 
939 939
 
940
-if ( ! function_exists( 'espresso_venue_link' )) {
940
+if ( ! function_exists('espresso_venue_link')) {
941 941
 	/**
942 942
 	 * 	espresso_venue_link
943 943
 	 *
@@ -946,14 +946,14 @@  discard block
 block discarded – undo
946 946
 	 *  @param 	string 	$text
947 947
 	 *  @return 	string
948 948
 	 */
949
-	function espresso_venue_link( $VNU_ID = 0, $text = '' ) {
950
-		return EEH_Venue_View::venue_details_link( $VNU_ID, $text );
949
+	function espresso_venue_link($VNU_ID = 0, $text = '') {
950
+		return EEH_Venue_View::venue_details_link($VNU_ID, $text);
951 951
 	}
952 952
 }
953 953
 
954 954
 
955 955
 
956
-if ( ! function_exists( 'espresso_venue_description' )) {
956
+if ( ! function_exists('espresso_venue_description')) {
957 957
 	/**
958 958
 	 *    espresso_venue_description
959 959
 	 *
@@ -962,17 +962,17 @@  discard block
 block discarded – undo
962 962
 	 * @param bool $echo
963 963
 	 * @return    string
964 964
 	 */
965
-	function espresso_venue_description( $VNU_ID = FALSE, $echo = TRUE ) {
966
-		if($echo){
967
-			echo EEH_Venue_View::venue_description( $VNU_ID );
965
+	function espresso_venue_description($VNU_ID = FALSE, $echo = TRUE) {
966
+		if ($echo) {
967
+			echo EEH_Venue_View::venue_description($VNU_ID);
968 968
 			return '';
969 969
 		}
970
-		return EEH_Venue_View::venue_description( $VNU_ID );
970
+		return EEH_Venue_View::venue_description($VNU_ID);
971 971
 	}
972 972
 }
973 973
 
974 974
 
975
-if ( ! function_exists( 'espresso_venue_excerpt' )) {
975
+if ( ! function_exists('espresso_venue_excerpt')) {
976 976
 	/**
977 977
 	 *    espresso_venue_excerpt
978 978
 	 *
@@ -981,18 +981,18 @@  discard block
 block discarded – undo
981 981
 	 * @param bool $echo
982 982
 	 * @return    string
983 983
 	 */
984
-	function espresso_venue_excerpt( $VNU_ID = 0,  $echo = TRUE ) {
985
-		if ( $echo ) {
986
-			echo EEH_Venue_View::venue_excerpt( $VNU_ID );
984
+	function espresso_venue_excerpt($VNU_ID = 0, $echo = TRUE) {
985
+		if ($echo) {
986
+			echo EEH_Venue_View::venue_excerpt($VNU_ID);
987 987
 			return '';
988 988
 		}
989
-		return EEH_Venue_View::venue_excerpt( $VNU_ID );
989
+		return EEH_Venue_View::venue_excerpt($VNU_ID);
990 990
 	}
991 991
 }
992 992
 
993 993
 
994 994
 
995
-if ( ! function_exists( 'espresso_venue_categories' )) {
995
+if ( ! function_exists('espresso_venue_categories')) {
996 996
 	/**
997 997
 	 * espresso_venue_categories
998 998
 	 * returns the terms associated with a venue
@@ -1002,17 +1002,17 @@  discard block
 block discarded – undo
1002 1002
 	 * @param bool $echo
1003 1003
 	 * @return string
1004 1004
 	 */
1005
-	function espresso_venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE,  $echo = TRUE ) {
1006
-		if ( $echo ) {
1007
-			echo EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized );
1005
+	function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) {
1006
+		if ($echo) {
1007
+			echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized);
1008 1008
 			return '';
1009 1009
 		}
1010
-		return EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized );
1010
+		return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized);
1011 1011
 	}
1012 1012
 }
1013 1013
 
1014 1014
 
1015
-if ( ! function_exists( 'espresso_venue_address' )) {
1015
+if ( ! function_exists('espresso_venue_address')) {
1016 1016
 	/**
1017 1017
 	 * espresso_venue_address
1018 1018
 	 * returns a formatted block of html  for displaying a venue's address
@@ -1022,17 +1022,17 @@  discard block
 block discarded – undo
1022 1022
 	 * @param bool   $echo
1023 1023
 	 * @return string
1024 1024
 	 */
1025
-	function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) {
1026
-		if ( $echo ) {
1027
-			echo EEH_Venue_View::venue_address( $type, $VNU_ID );
1025
+	function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) {
1026
+		if ($echo) {
1027
+			echo EEH_Venue_View::venue_address($type, $VNU_ID);
1028 1028
 			return '';
1029 1029
 		}
1030
-		return EEH_Venue_View::venue_address( $type, $VNU_ID );
1030
+		return EEH_Venue_View::venue_address($type, $VNU_ID);
1031 1031
 	}
1032 1032
 }
1033 1033
 
1034 1034
 
1035
-if ( ! function_exists( 'espresso_venue_raw_address' )) {
1035
+if ( ! function_exists('espresso_venue_raw_address')) {
1036 1036
 	/**
1037 1037
 	 * espresso_venue_address
1038 1038
 	 * returns an UN-formatted string containing a venue's address
@@ -1042,17 +1042,17 @@  discard block
 block discarded – undo
1042 1042
 	 * @param bool     $echo
1043 1043
 	 * @return string
1044 1044
 	 */
1045
-	function espresso_venue_raw_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) {
1046
-		if ( $echo ) {
1047
-			echo EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE );
1045
+	function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) {
1046
+		if ($echo) {
1047
+			echo EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE);
1048 1048
 			return '';
1049 1049
 		}
1050
-		return EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE );
1050
+		return EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE);
1051 1051
 	}
1052 1052
 }
1053 1053
 
1054 1054
 
1055
-if ( ! function_exists( 'espresso_venue_has_address' )) {
1055
+if ( ! function_exists('espresso_venue_has_address')) {
1056 1056
 	/**
1057 1057
 	 * espresso_venue_has_address
1058 1058
 	 * returns TRUE or FALSE if a Venue has address information
@@ -1060,13 +1060,13 @@  discard block
 block discarded – undo
1060 1060
 	 * @param int $VNU_ID
1061 1061
 	 * @return bool
1062 1062
 	 */
1063
-	function espresso_venue_has_address( $VNU_ID = 0 ) {
1064
-		return EEH_Venue_View::venue_has_address( $VNU_ID );
1063
+	function espresso_venue_has_address($VNU_ID = 0) {
1064
+		return EEH_Venue_View::venue_has_address($VNU_ID);
1065 1065
 	}
1066 1066
 }
1067 1067
 
1068 1068
 
1069
-if ( ! function_exists( 'espresso_venue_gmap' )) {
1069
+if ( ! function_exists('espresso_venue_gmap')) {
1070 1070
 	/**
1071 1071
 	 * espresso_venue_gmap
1072 1072
 	 * returns a google map for the venue address
@@ -1077,17 +1077,17 @@  discard block
 block discarded – undo
1077 1077
 	 * @param bool     $echo
1078 1078
 	 * @return string
1079 1079
 	 */
1080
-	function espresso_venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE  ) {
1081
-		if ( $echo ) {
1082
-			echo EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap );
1080
+	function espresso_venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE) {
1081
+		if ($echo) {
1082
+			echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap);
1083 1083
 			return '';
1084 1084
 		}
1085
-		return EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap );
1085
+		return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap);
1086 1086
 	}
1087 1087
 }
1088 1088
 
1089 1089
 
1090
-if ( ! function_exists( 'espresso_venue_phone' )) {
1090
+if ( ! function_exists('espresso_venue_phone')) {
1091 1091
 	/**
1092 1092
 	 * espresso_venue_phone
1093 1093
 	 *
@@ -1095,18 +1095,18 @@  discard block
 block discarded – undo
1095 1095
 	 * @param bool $echo
1096 1096
 	 * @return string
1097 1097
 	 */
1098
-	function espresso_venue_phone( $VNU_ID = 0, $echo = TRUE ) {
1099
-		if ( $echo ) {
1100
-			echo EEH_Venue_View::venue_phone( $VNU_ID );
1098
+	function espresso_venue_phone($VNU_ID = 0, $echo = TRUE) {
1099
+		if ($echo) {
1100
+			echo EEH_Venue_View::venue_phone($VNU_ID);
1101 1101
 			return '';
1102 1102
 		}
1103
-		return EEH_Venue_View::venue_phone( $VNU_ID );
1103
+		return EEH_Venue_View::venue_phone($VNU_ID);
1104 1104
 	}
1105 1105
 }
1106 1106
 
1107 1107
 
1108 1108
 
1109
-if ( ! function_exists( 'espresso_venue_website' )) {
1109
+if ( ! function_exists('espresso_venue_website')) {
1110 1110
 	/**
1111 1111
 	 * espresso_venue_website
1112 1112
 	 *
@@ -1114,18 +1114,18 @@  discard block
 block discarded – undo
1114 1114
 	 * @param bool $echo
1115 1115
 	 * @return string
1116 1116
 	 */
1117
-	function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) {
1118
-		if ( $echo ) {
1119
-			echo EEH_Venue_View::venue_website_link( $VNU_ID );
1117
+	function espresso_venue_website($VNU_ID = 0, $echo = TRUE) {
1118
+		if ($echo) {
1119
+			echo EEH_Venue_View::venue_website_link($VNU_ID);
1120 1120
 			return '';
1121 1121
 		}
1122
-		return EEH_Venue_View::venue_website_link( $VNU_ID );
1122
+		return EEH_Venue_View::venue_website_link($VNU_ID);
1123 1123
 	}
1124 1124
 }
1125 1125
 
1126 1126
 
1127 1127
 
1128
-if ( ! function_exists( 'espresso_edit_venue_link' )) {
1128
+if ( ! function_exists('espresso_edit_venue_link')) {
1129 1129
 	/**
1130 1130
 	 * espresso_edit_venue_link
1131 1131
 	 *
@@ -1133,12 +1133,12 @@  discard block
 block discarded – undo
1133 1133
 	 * @param bool $echo
1134 1134
 	 * @return string
1135 1135
 	 */
1136
-	function espresso_edit_venue_link( $VNU_ID = 0, $echo = TRUE ) {
1137
-		if($echo){
1138
-			echo EEH_Venue_View::edit_venue_link( $VNU_ID );
1136
+	function espresso_edit_venue_link($VNU_ID = 0, $echo = TRUE) {
1137
+		if ($echo) {
1138
+			echo EEH_Venue_View::edit_venue_link($VNU_ID);
1139 1139
 			return '';
1140 1140
 		}
1141
-		return EEH_Venue_View::edit_venue_link( $VNU_ID );
1141
+		return EEH_Venue_View::edit_venue_link($VNU_ID);
1142 1142
 	}
1143 1143
 }
1144 1144
 
Please login to merge, or discard this patch.
reg_steps/payment_options/no_payment_required.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@
 block discarded – undo
1 1
 <?php
2 2
 /** @type array $registrations_for_free_events */
3 3
 
4
-if( is_array( $registrations_for_free_events ) && ! empty( $registrations_for_free_events ) ) {
4
+if (is_array($registrations_for_free_events) && ! empty($registrations_for_free_events)) {
5 5
 	echo apply_filters(
6 6
 		'FHEE__registration_page_payment_options__no_payment_required_hdr',
7 7
 		sprintf(
8
-			__( '%1$sNo Payment Required%2$s', 'event_espresso' ),
8
+			__('%1$sNo Payment Required%2$s', 'event_espresso'),
9 9
 			'<h6>',
10 10
 			'</h6>'
11 11
 		)
12 12
 	);
13
-	foreach ( $registrations_for_free_events as $registration_for_free_event ) {
14
-		if ( $registration_for_free_event instanceof EE_Registration && $registration_for_free_event->ticket()->is_free() ) {
15
-			if ( $registration_for_free_event->event() instanceof EE_Event ) {
13
+	foreach ($registrations_for_free_events as $registration_for_free_event) {
14
+		if ($registration_for_free_event instanceof EE_Registration && $registration_for_free_event->ticket()->is_free()) {
15
+			if ($registration_for_free_event->event() instanceof EE_Event) {
16 16
 				?>
17 17
 				<p>
18 18
 					<?php echo apply_filters(
19 19
 						'FHEE__registration_page_payment_options__no_payment_required_pg',
20 20
 						sprintf(
21
-							__( '"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.', 'event_espresso' ),
21
+							__('"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.', 'event_espresso'),
22 22
 							$registration_for_free_event->ticket()->name(),
23 23
 							$registration_for_free_event->event()->name()
24 24
 						)
Please login to merge, or discard this patch.
modules/gateways/Invoice/lib/Invoice.class.php 2 patches
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
 			'4.9.12',
44 44
 			'5.0.0'
45 45
 		);
46
-		if ( $this->registration = EE_Registry::instance()->load_model( 'Registration' )->get_registration_for_reg_url_link( $url_link)) {
46
+		if ($this->registration = EE_Registry::instance()->load_model('Registration')->get_registration_for_reg_url_link($url_link)) {
47 47
 			$this->transaction = $this->registration->transaction();
48 48
 
49
-			$payment_settings = EE_Config::instance()->gateway->payment_settings;//get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE);
50
-			$this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type( 'Invoice' );
49
+			$payment_settings = EE_Config::instance()->gateway->payment_settings; //get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE);
50
+			$this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type('Invoice');
51 51
 		} else {
52
-			EE_Error::add_error( __( 'Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
52
+			EE_Error::add_error(__('Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
53 53
 		}
54 54
 
55 55
 	}
56 56
 
57
-	public function send_invoice( $download = FALSE ) {
57
+	public function send_invoice($download = FALSE) {
58 58
 		$template_args = array();
59 59
 		$EE = EE_Registry::instance();
60 60
 
61 61
 		//allow the request to override the default theme defined in the invoice settings
62
-		$theme_requested = ( isset( $_REQUEST['theme'] ) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8 ) ? absint( $_REQUEST['theme'] ) : null;
62
+		$theme_requested = (isset($_REQUEST['theme']) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8) ? absint($_REQUEST['theme']) : null;
63 63
 		$themes = array(
64 64
 										1 => "simple.css",
65 65
 										2 => "bauhaus.css",
@@ -70,26 +70,26 @@  discard block
 block discarded – undo
70 70
 										7 => "union.css"
71 71
 									);
72 72
 		//Get the CSS file
73
-		if( isset( $themes[ $theme_requested ] ) ) {
74
-			$template_args['invoice_css'] = $themes[ $theme_requested ];
75
-		}else{
76
-			$template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta( 'legacy_invoice_css', TRUE, 'simple.css' );
73
+		if (isset($themes[$theme_requested])) {
74
+			$template_args['invoice_css'] = $themes[$theme_requested];
75
+		} else {
76
+			$template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta('legacy_invoice_css', TRUE, 'simple.css');
77 77
 		}
78 78
 
79
-		if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) {
80
-			$template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/';
79
+		if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR.'/invoice')) {
80
+			$template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL.'Invoice/lib/templates/';
81 81
 		} else {
82
-			$template_args['base_url'] = EE_GATEWAYS . '/Invoice/lib/templates/';
82
+			$template_args['base_url'] = EE_GATEWAYS.'/Invoice/lib/templates/';
83 83
 		}
84 84
 		$primary_attendee = $this->transaction->primary_registration()->attendee();
85 85
 
86
-		$template_args['organization'] = $EE->CFG->organization->get_pretty( 'name' );
87
-		$template_args['street'] = empty( $EE->CFG->organization->address_2 ) ? $EE->CFG->organization->get_pretty( 'address_1' ) : $EE->CFG->organization->get_pretty( 'address_1' ) . '<br>' . $EE->CFG->organization->get_pretty( 'address_2' );
88
-		$template_args['city'] = $EE->CFG->organization->get_pretty( 'city' );
89
-		$template_args['state'] = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID );
90
-		$template_args['country'] = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $EE->CFG->organization->CNT_ISO );
91
-		$template_args['zip'] = $EE->CFG->organization->get_pretty( 'zip' );
92
-		$template_args['email'] = $EE->CFG->organization->get_pretty( 'email' );
86
+		$template_args['organization'] = $EE->CFG->organization->get_pretty('name');
87
+		$template_args['street'] = empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1').'<br>'.$EE->CFG->organization->get_pretty('address_2');
88
+		$template_args['city'] = $EE->CFG->organization->get_pretty('city');
89
+		$template_args['state'] = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID);
90
+		$template_args['country'] = EE_Registry::instance()->load_model('Country')->get_one_by_ID($EE->CFG->organization->CNT_ISO);
91
+		$template_args['zip'] = $EE->CFG->organization->get_pretty('zip');
92
+		$template_args['email'] = $EE->CFG->organization->get_pretty('email');
93 93
 
94 94
 		$template_args['registration_code'] = $this->registration->reg_code();
95 95
 		$template_args['registration_date'] = $this->registration->date();
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 		$template_args['attendee_address2'] = $primary_attendee->address2();
99 99
 		$template_args['attendee_city'] = $primary_attendee->city();
100 100
 		$attendee_state = $primary_attendee->state_obj();
101
-		if($attendee_state){
101
+		if ($attendee_state) {
102 102
 			$attendee_state_name = $attendee_state->name();
103
-		}else{
103
+		} else {
104 104
 			$attendee_state_name = '';
105 105
 		}
106 106
 		$template_args['attendee_state'] = $attendee_state_name;
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		if ($template_args['amount_pd'] != $template_args['total_cost']) {
125 125
 			//$template_args['net_total'] = $this->espressoInvoiceTotals( __('SubTotal', 'event_espresso'), $this->transaction->total());//$this->session_data['cart']['REG']['sub_total']);
126 126
 			$tax_items = $this->transaction->tax_items();
127
-			if(!empty($tax_items) ){
127
+			if ( ! empty($tax_items)) {
128 128
 				foreach ($tax_items as $tax) {
129
-					$template_args['net_total'] .= $this->espressoInvoiceTotals( $tax->name(), $tax->total());
129
+					$template_args['net_total'] .= $this->espressoInvoiceTotals($tax->name(), $tax->total());
130 130
 				}
131 131
 			}
132 132
 
@@ -136,30 +136,30 @@  discard block
 block discarded – undo
136 136
 			} else {
137 137
 				$text = __('Extra', 'event_espresso');
138 138
 			}
139
-			$template_args['discount'] = $this->espressoInvoiceTotals( $text, $difference );
139
+			$template_args['discount'] = $this->espressoInvoiceTotals($text, $difference);
140 140
 		}
141 141
 
142 142
 		$template_args['currency_symbol'] = $EE->CFG->currency->sign;
143
-		$template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta( 'pdf_instructions', TRUE ), ENT_QUOTES)));
144
-		$template_args['shameless_plug'] = apply_filters( 'FHEE_Invoice__send_invoice__shameless_plug',true );
145
-		if(isset($_GET['receipt'])){
143
+		$template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE), ENT_QUOTES)));
144
+		$template_args['shameless_plug'] = apply_filters('FHEE_Invoice__send_invoice__shameless_plug', true);
145
+		if (isset($_GET['receipt'])) {
146 146
 			//receipt-specific stuff
147 147
 			$events_for_txn = EEM_Event::instance()->get_all(array(array('Registration.TXN_ID'=>$this->transaction->ID())));
148 148
 			$ticket_line_items_per_event = array();
149 149
 			$registrations_per_line_item = array();
150 150
 			$venues_for_events = array();
151
-			foreach($events_for_txn as $event_id => $event){
152
-				$line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID'=>$event_id,'TXN_ID'=>$this->transaction->ID())));
151
+			foreach ($events_for_txn as $event_id => $event) {
152
+				$line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID'=>$event_id, 'TXN_ID'=>$this->transaction->ID())));
153 153
 				$ticket_line_items_per_event[$event_id] = $line_items_for_this_event;
154
-				foreach($line_items_for_this_event as $line_item_id => $line_item){
154
+				foreach ($line_items_for_this_event as $line_item_id => $line_item) {
155 155
 					$ticket = $line_item->ticket();
156
-					$registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID'=>$ticket->ID(),'TXN_ID'=>$this->transaction->ID())));
156
+					$registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID'=>$ticket->ID(), 'TXN_ID'=>$this->transaction->ID())));
157 157
 					$registrations_per_line_item[$line_item_id] = $registrations_for_this_ticket;
158 158
 				}
159 159
 				$venues_for_events = array_merge($venues_for_events, $event->venues());
160 160
 			}
161
-			$tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID'=>$this->transaction->ID(),'LIN_type'=>  EEM_Line_Item::type_tax_sub_total)));
162
-			$questions_to_skip = array(EEM_Attendee::system_question_fname,EEM_Attendee::system_question_lname,  EEM_Attendee::system_question_email);
161
+			$tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID'=>$this->transaction->ID(), 'LIN_type'=>  EEM_Line_Item::type_tax_sub_total)));
162
+			$questions_to_skip = array(EEM_Attendee::system_question_fname, EEM_Attendee::system_question_lname, EEM_Attendee::system_question_email);
163 163
 
164 164
 
165 165
 			$template_args['events_for_txn'] = $events_for_txn;
@@ -170,53 +170,53 @@  discard block
 block discarded – undo
170 170
 			$template_args['questions_to_skip'] = $questions_to_skip;
171 171
 //			d($template_args);
172 172
 			$template_args['download_link'] = $this->registration->receipt_url('download');
173
-		}else{
173
+		} else {
174 174
 			//it's just an invoice we're accessing
175 175
 			$template_args['download_link'] = $this->registration->invoice_url('download');
176 176
 		}
177 177
 
178 178
 		//Get the HTML as an object
179 179
 		$templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
180
-		$template_header = EEH_Template::locate_template( $templates_relative_path . 'invoice_header.template.php', $template_args, TRUE, TRUE );
181
-		if(isset($_GET['receipt'])){
182
-			$template_body = EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', $template_args, TRUE, TRUE );
183
-		}else{
184
-			$template_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', $template_args, TRUE, TRUE );
180
+		$template_header = EEH_Template::locate_template($templates_relative_path.'invoice_header.template.php', $template_args, TRUE, TRUE);
181
+		if (isset($_GET['receipt'])) {
182
+			$template_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', $template_args, TRUE, TRUE);
183
+		} else {
184
+			$template_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', $template_args, TRUE, TRUE);
185 185
 		}
186 186
 
187 187
 
188
-		$template_footer = EEH_Template::locate_template( $templates_relative_path . 'invoice_footer.template.php', $template_args, TRUE, TRUE );
188
+		$template_footer = EEH_Template::locate_template($templates_relative_path.'invoice_footer.template.php', $template_args, TRUE, TRUE);
189 189
 
190
-		$copies =  ! empty( $_REQUEST['copies'] ) ? $_REQUEST['copies'] : 1;
190
+		$copies = ! empty($_REQUEST['copies']) ? $_REQUEST['copies'] : 1;
191 191
 
192 192
 		$content = $this->espresso_replace_invoice_shortcodes($template_header);
193
-		for( $x = 1; $x <= $copies; $x++ ) {
193
+		for ($x = 1; $x <= $copies; $x++) {
194 194
 			$content .= $this->espresso_replace_invoice_shortcodes($template_body);
195 195
 		}
196 196
 		$content .= $this->espresso_replace_invoice_shortcodes($template_footer);
197 197
 
198 198
 		//Check if debugging or mobile is set
199
-		if (!empty($_REQUEST['html'])) {
199
+		if ( ! empty($_REQUEST['html'])) {
200 200
 			echo $content;
201 201
 			exit(0);
202 202
 		}
203
-		$invoice_name = $template_args['organization'] . ' ' . __('Invoice #', 'event_espresso') . $template_args['registration_code'] . __(' for ', 'event_espresso') . $template_args['name'];
204
-		$invoice_name = str_replace( ' ', '_', $invoice_name );
203
+		$invoice_name = $template_args['organization'].' '.__('Invoice #', 'event_espresso').$template_args['registration_code'].__(' for ', 'event_espresso').$template_args['name'];
204
+		$invoice_name = str_replace(' ', '_', $invoice_name);
205 205
 		//Create the PDF
206
-		if(array_key_exists('html',$_GET)){
206
+		if (array_key_exists('html', $_GET)) {
207 207
 			echo $content;
208
-		}else{
208
+		} else {
209 209
 			//only load dompdf if nobody else has yet...
210
-			if( ! defined('DOMPDF_DIR')){
210
+			if ( ! defined('DOMPDF_DIR')) {
211 211
 				define('DOMPDF_ENABLE_REMOTE', TRUE);
212 212
 				define('DOMPDF_ENABLE_JAVASCRIPT', FALSE);
213 213
 				define('DOMPDF_ENABLE_CSS_FLOAT', TRUE);
214
-				require_once(EE_THIRD_PARTY . 'dompdf/dompdf_config.inc.php');
214
+				require_once(EE_THIRD_PARTY.'dompdf/dompdf_config.inc.php');
215 215
 			}
216 216
 			$dompdf = new DOMPDF();
217 217
 			$dompdf->load_html($content);
218 218
 			$dompdf->render();
219
-			$dompdf->stream($invoice_name . ".pdf", array( 'Attachment' => $download ));
219
+			$dompdf->stream($invoice_name.".pdf", array('Attachment' => $download));
220 220
 		}
221 221
 		exit(0);
222 222
 	}
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
 	 * @param EE_Line_Item $line_item
227 227
 	 * @return boolean
228 228
 	 */
229
-	function check_if_any_line_items_have_a_description(EE_Line_Item $line_item){
230
-		if($line_item->desc()){
229
+	function check_if_any_line_items_have_a_description(EE_Line_Item $line_item) {
230
+		if ($line_item->desc()) {
231 231
 			return true;
232
-		}else{
233
-			foreach($line_item->children() as $child_line_item){
234
-				if($this->check_if_any_line_items_have_a_description($child_line_item)){
232
+		} else {
233
+			foreach ($line_item->children() as $child_line_item) {
234
+				if ($this->check_if_any_line_items_have_a_description($child_line_item)) {
235 235
 					return true;
236 236
 				}
237 237
 			}
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
 	}
242 242
 
243 243
 //Perform the shortcode replacement
244
-	function espresso_replace_invoice_shortcodes( $content ) {
244
+	function espresso_replace_invoice_shortcodes($content) {
245 245
 
246 246
 		$EE = EE_Registry::instance();
247 247
 		//Create the logo
248
-		$invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE,  $EE->CFG->organization->logo_url );
249
-		if (!empty($invoice_logo_url)) {
248
+		$invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE, $EE->CFG->organization->logo_url);
249
+		if ( ! empty($invoice_logo_url)) {
250 250
 			$image_size = getimagesize($invoice_logo_url);
251
-			$invoice_logo_image = '<img class="logo screen" src="' . $invoice_logo_url . '" ' . $image_size[3] . ' alt="logo" /> ';
251
+			$invoice_logo_image = '<img class="logo screen" src="'.$invoice_logo_url.'" '.$image_size[3].' alt="logo" /> ';
252 252
 		} else {
253 253
 			$invoice_logo_image = '';
254 254
 		}
@@ -270,28 +270,28 @@  discard block
 block discarded – undo
270 270
 				"[instructions]",
271 271
 		);
272 272
 		$primary_attendee = $this->transaction->primary_registration()->attendee();
273
-		$org_state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID );
274
-		if($org_state){
273
+		$org_state = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID);
274
+		if ($org_state) {
275 275
 			$org_state_name = $org_state->name();
276
-		}else{
276
+		} else {
277 277
 			$org_state_name = '';
278 278
 		}
279 279
 		$ReplaceValues = array(
280
-				$EE->CFG->organization->get_pretty( 'name' ),
280
+				$EE->CFG->organization->get_pretty('name'),
281 281
 				$this->registration->reg_code(),
282 282
 				$this->transaction->ID(),
283 283
 				$primary_attendee->full_name(),
284
-				(is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) ? EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/' : EE_GATEWAYS_URL . 'Invoice/lib/templates/',
285
-				$this->registration->invoice_url(),//home_url() . '/?download_invoice=true&amp;id=' . $this->registration->reg_url_link(),
284
+				(is_dir(EVENT_ESPRESSO_GATEWAY_DIR.'/invoice')) ? EVENT_ESPRESSO_GATEWAY_URL.'Invoice/lib/templates/' : EE_GATEWAYS_URL.'Invoice/lib/templates/',
285
+				$this->registration->invoice_url(), //home_url() . '/?download_invoice=true&amp;id=' . $this->registration->reg_url_link(),
286 286
 				$invoice_logo_image,
287
-				empty( $EE->CFG->organization->address_2 ) ? $EE->CFG->organization->get_pretty( 'address_1' ) : $EE->CFG->organization->get_pretty( 'address_1' ) . '<br>' . $EE->CFG->organization->get_pretty( 'address_2' ),
288
-				$EE->CFG->organization->get_pretty( 'city' ),
287
+				empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1').'<br>'.$EE->CFG->organization->get_pretty('address_2'),
288
+				$EE->CFG->organization->get_pretty('city'),
289 289
 				$org_state_name,
290
-				$EE->CFG->organization->get_pretty( 'zip' ),
291
-				$EE->CFG->organization->get_pretty( 'email' ),
290
+				$EE->CFG->organization->get_pretty('zip'),
291
+				$EE->CFG->organization->get_pretty('email'),
292 292
 				$EE->CFG->organization->vat,
293
-				$this->registration->get_i18n_datetime( 'REG_date', get_option( 'date_format' ) ),
294
-				$this->invoice_payment_method->get_extra_meta( 'pdf_instructions', TRUE ),
293
+				$this->registration->get_i18n_datetime('REG_date', get_option('date_format')),
294
+				$this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE),
295 295
 		);
296 296
 
297 297
 		return str_replace($SearchValues, $ReplaceValues, $content);
@@ -314,12 +314,12 @@  discard block
 block discarded – undo
314 314
 		if ($total_cost < 0) {
315 315
 			$total_cost = (-1) * $total_cost;
316 316
 		}
317
-		$find = array( ' ' );
318
-		$replace = array( '-' );
319
-		$row_id = strtolower( str_replace( $find, $replace, $text ));
317
+		$find = array(' ');
318
+		$replace = array('-');
319
+		$row_id = strtolower(str_replace($find, $replace, $text));
320 320
 		$html .= '<tr id="'.$row_id.'-tr"><td colspan="4">&nbsp;</td>';
321
-		$html .= '<td class="item_r">' . $text . '</td>';
322
-		$html .= '<td class="item_r">' . $total_cost . '</td>';
321
+		$html .= '<td class="item_r">'.$text.'</td>';
322
+		$html .= '<td class="item_r">'.$total_cost.'</td>';
323 323
 		$html .= '</tr>';
324 324
 		return $html;
325 325
 	}
Please login to merge, or discard this patch.
Braces   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		//Get the CSS file
73 73
 		if( isset( $themes[ $theme_requested ] ) ) {
74 74
 			$template_args['invoice_css'] = $themes[ $theme_requested ];
75
-		}else{
75
+		} else{
76 76
 			$template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta( 'legacy_invoice_css', TRUE, 'simple.css' );
77 77
 		}
78 78
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$attendee_state = $primary_attendee->state_obj();
101 101
 		if($attendee_state){
102 102
 			$attendee_state_name = $attendee_state->name();
103
-		}else{
103
+		} else{
104 104
 			$attendee_state_name = '';
105 105
 		}
106 106
 		$template_args['attendee_state'] = $attendee_state_name;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 			$template_args['questions_to_skip'] = $questions_to_skip;
171 171
 //			d($template_args);
172 172
 			$template_args['download_link'] = $this->registration->receipt_url('download');
173
-		}else{
173
+		} else{
174 174
 			//it's just an invoice we're accessing
175 175
 			$template_args['download_link'] = $this->registration->invoice_url('download');
176 176
 		}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 		$template_header = EEH_Template::locate_template( $templates_relative_path . 'invoice_header.template.php', $template_args, TRUE, TRUE );
181 181
 		if(isset($_GET['receipt'])){
182 182
 			$template_body = EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', $template_args, TRUE, TRUE );
183
-		}else{
183
+		} else{
184 184
 			$template_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', $template_args, TRUE, TRUE );
185 185
 		}
186 186
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		//Create the PDF
206 206
 		if(array_key_exists('html',$_GET)){
207 207
 			echo $content;
208
-		}else{
208
+		} else{
209 209
 			//only load dompdf if nobody else has yet...
210 210
 			if( ! defined('DOMPDF_DIR')){
211 211
 				define('DOMPDF_ENABLE_REMOTE', TRUE);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	function check_if_any_line_items_have_a_description(EE_Line_Item $line_item){
230 230
 		if($line_item->desc()){
231 231
 			return true;
232
-		}else{
232
+		} else{
233 233
 			foreach($line_item->children() as $child_line_item){
234 234
 				if($this->check_if_any_line_items_have_a_description($child_line_item)){
235 235
 					return true;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$org_state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID );
274 274
 		if($org_state){
275 275
 			$org_state_name = $org_state->name();
276
-		}else{
276
+		} else{
277 277
 			$org_state_name = '';
278 278
 		}
279 279
 		$ReplaceValues = array(
@@ -300,8 +300,9 @@  discard block
 block discarded – undo
300 300
 	public function espressoLoadData($items) {
301 301
 		$lines = $items;
302 302
 		$data = array();
303
-		foreach ($lines as $line)
304
-			$data[] = explode(';', chop($line));
303
+		foreach ($lines as $line) {
304
+					$data[] = explode(';', chop($line));
305
+		}
305 306
 
306 307
 		return $data;
307 308
 	}
Please login to merge, or discard this patch.
modules/core_rest_api/EED_Core_Rest_Api.module.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
      */
159 159
     protected static function _set_hooks_for_changes()
160 160
     {
161
-        $folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES . 'rest_api' . DS . 'changes'), false);
161
+        $folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false);
162 162
         foreach ($folder_contents as $classname_in_namespace => $filepath) {
163 163
             //ignore the base parent class
164 164
             if ($classname_in_namespace === 'Changes_In_Base') {
165 165
                 continue;
166 166
             }
167
-            $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;
167
+            $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace;
168 168
             if (class_exists($full_classname)) {
169 169
                 $instance_of_class = new $full_classname;
170 170
                 if ($instance_of_class instanceof Changes_In_Base) {
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
                         $model_name = isset($route['schema_callback'][0])
197 197
                             ? $route['schema_callback'][0]
198 198
                             : '';
199
-                        $version = isset( $route['schema_callback'][1])
199
+                        $version = isset($route['schema_callback'][1])
200 200
                             ? $route['schema_callback'][1]
201 201
                             : '';
202
-                        if (! empty($model_name) && ! empty($version)) {
203
-                            $route_args['schema'] = function () use ($model_name, $version) {
202
+                        if ( ! empty($model_name) && ! empty($version)) {
203
+                            $route_args['schema'] = function() use ($model_name, $version) {
204 204
                                 return ModelRead::handle_schema_request(
205 205
                                     $model_name,
206 206
                                     $version
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
     {
247 247
         //delete the saved EE REST API routes
248 248
         foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden) {
249
-            delete_option(EED_Core_Rest_Api::saved_routes_option_names . $version);
249
+            delete_option(EED_Core_Rest_Api::saved_routes_option_names.$version);
250 250
         }
251 251
     }
252 252
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     {
266 266
         $ee_routes = array();
267 267
         foreach (self::versions_served() as $version => $hidden_endpoints) {
268
-            $ee_routes[self::ee_api_namespace . $version] = self::_get_ee_route_data_for_version($version,
268
+            $ee_routes[self::ee_api_namespace.$version] = self::_get_ee_route_data_for_version($version,
269 269
                 $hidden_endpoints);
270 270
         }
271 271
         return $ee_routes;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      */
284 284
     protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false)
285 285
     {
286
-        $ee_routes = get_option(self::saved_routes_option_names . $version, null);
286
+        $ee_routes = get_option(self::saved_routes_option_names.$version, null);
287 287
         if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) {
288 288
             $ee_routes = self::_save_ee_route_data_for_version($version, $hidden_endpoints);
289 289
         }
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
                 $instance->_get_rpc_route_data_for_version($version, $hidden_endpoints)
312 312
             )
313 313
         );
314
-        $option_name = self::saved_routes_option_names . $version;
314
+        $option_name = self::saved_routes_option_names.$version;
315 315
         if (get_option($option_name)) {
316 316
             update_option($option_name, $routes, true);
317 317
         } else {
@@ -388,13 +388,13 @@  discard block
 block discarded – undo
388 388
             $model = \EE_Registry::instance()->load_model($model_name);
389 389
 
390 390
             //if this isn't a valid model then let's skip iterate to the next item in the loop.
391
-            if (! $model instanceof EEM_Base) {
391
+            if ( ! $model instanceof EEM_Base) {
392 392
                 continue;
393 393
             }
394 394
 
395 395
             //yes we could just register one route for ALL models, but then they wouldn't show up in the index
396 396
             $plural_model_route = EEH_Inflector::pluralize_and_lower($model_name);
397
-            $singular_model_route = $plural_model_route . '/(?P<id>\d+)';
397
+            $singular_model_route = $plural_model_route.'/(?P<id>\d+)';
398 398
             $model_routes[$plural_model_route] = array(
399 399
                 array(
400 400
                     'callback'        => array(
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                     'hidden_endpoint' => $hidden_endpoint,
406 406
                     'args'            => $this->_get_read_query_params($model, $version),
407 407
                     '_links'          => array(
408
-                        'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route),
408
+                        'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace.$version.$singular_model_route),
409 409
                     ),
410 410
                     'schema_callback' => array($model_name, $version)
411 411
                 ),
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                     $relation_name,
442 442
                     $relation_obj
443 443
                 );
444
-                $model_routes[$singular_model_route . '/' . $related_model_name_endpoint_part] = array(
444
+                $model_routes[$singular_model_route.'/'.$related_model_name_endpoint_part] = array(
445 445
                     array(
446 446
                         'callback'        => array(
447 447
                             'EventEspresso\core\libraries\rest_api\controllers\model\Read',
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
     {
478 478
         $routes = array();
479 479
         foreach (self::versions_served() as $version => $hidden_endpoint) {
480
-            $routes[self::ee_api_namespace . $version] = $this->_get_rpc_route_data_for_version($version,
480
+            $routes[self::ee_api_namespace.$version] = $this->_get_rpc_route_data_for_version($version,
481 481
                 $hidden_endpoint);
482 482
         }
483 483
         return $routes;
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
     {
609 609
         $config_routes = array();
610 610
         foreach (self::versions_served() as $version => $hidden_endpoint) {
611
-            $config_routes[self::ee_api_namespace . $version] = $this->_get_config_route_data_for_version($version,
611
+            $config_routes[self::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version,
612 612
                 $hidden_endpoint);
613 613
         }
614 614
         return $config_routes;
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
     {
662 662
         $meta_routes = array();
663 663
         foreach (self::versions_served() as $version => $hidden_endpoint) {
664
-            $meta_routes[self::ee_api_namespace . $version] = $this->_get_meta_route_data_for_version($version,
664
+            $meta_routes[self::ee_api_namespace.$version] = $this->_get_meta_route_data_for_version($version,
665 665
                 $hidden_endpoint);
666 666
         }
667 667
         return $meta_routes;
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
                     if (($route['hidden_endpoint'] && $force_show_ee_namespace === '')
717 717
                         || ($force_show_ee_namespace !== '' && $force_show_ee_namespace !== $namespace)
718 718
                     ) {
719
-                        $full_route = '/' . ltrim($namespace, '/') . '/' . ltrim($endpoint, '/');
719
+                        $full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/');
720 720
                         unset($route_data[$full_route]);
721 721
                     }
722 722
                 }
Please login to merge, or discard this patch.
Indentation   +791 added lines, -791 removed lines patch added patch discarded remove patch
@@ -18,807 +18,807 @@
 block discarded – undo
18 18
 class EED_Core_Rest_Api extends \EED_Module
19 19
 {
20 20
 
21
-    const ee_api_namespace           = 'ee/v';
21
+	const ee_api_namespace           = 'ee/v';
22 22
 
23
-    const ee_api_namespace_for_regex = 'ee\/v([^/]*)\/';
23
+	const ee_api_namespace_for_regex = 'ee\/v([^/]*)\/';
24 24
 
25
-    const saved_routes_option_names  = 'ee_core_routes';
25
+	const saved_routes_option_names  = 'ee_core_routes';
26 26
 
27
-    /**
28
-     * string used in _links response bodies to make them globally unique.
29
-     *
30
-     * @see http://v2.wp-api.org/extending/linking/
31
-     */
32
-    const ee_api_link_namespace = 'https://api.eventespresso.com/';
27
+	/**
28
+	 * string used in _links response bodies to make them globally unique.
29
+	 *
30
+	 * @see http://v2.wp-api.org/extending/linking/
31
+	 */
32
+	const ee_api_link_namespace = 'https://api.eventespresso.com/';
33 33
 
34
-    /**
35
-     * @var Calculated_Model_Fields
36
-     */
37
-    protected static $_field_calculator = null;
34
+	/**
35
+	 * @var Calculated_Model_Fields
36
+	 */
37
+	protected static $_field_calculator = null;
38 38
 
39 39
 
40 40
 
41
-    /**
42
-     * @return EED_Core_Rest_Api
43
-     */
44
-    public static function instance()
45
-    {
46
-        self::$_field_calculator = new Calculated_Model_Fields();
47
-        return parent::get_instance(__CLASS__);
48
-    }
41
+	/**
42
+	 * @return EED_Core_Rest_Api
43
+	 */
44
+	public static function instance()
45
+	{
46
+		self::$_field_calculator = new Calculated_Model_Fields();
47
+		return parent::get_instance(__CLASS__);
48
+	}
49 49
 
50 50
 
51 51
 
52
-    /**
53
-     *    set_hooks - for hooking into EE Core, other modules, etc
54
-     *
55
-     * @access    public
56
-     * @return    void
57
-     */
58
-    public static function set_hooks()
59
-    {
60
-        self::set_hooks_both();
61
-    }
62
-
63
-
64
-
65
-    /**
66
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
67
-     *
68
-     * @access    public
69
-     * @return    void
70
-     */
71
-    public static function set_hooks_admin()
72
-    {
73
-        self::set_hooks_both();
74
-    }
75
-
76
-
77
-
78
-    public static function set_hooks_both()
79
-    {
80
-        add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10);
81
-        add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5);
82
-        add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2);
83
-        add_filter('rest_index',
84
-            array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index'));
85
-        EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change();
86
-    }
87
-
88
-
89
-
90
-    /**
91
-     * sets up hooks which only need to be included as part of REST API requests;
92
-     * other requests like to the frontend or admin etc don't need them
93
-     */
94
-    public static function set_hooks_rest_api()
95
-    {
96
-        //set hooks which account for changes made to the API
97
-        EED_Core_Rest_Api::_set_hooks_for_changes();
98
-    }
99
-
100
-
101
-
102
-    /**
103
-     * public wrapper of _set_hooks_for_changes.
104
-     * Loads all the hooks which make requests to old versions of the API
105
-     * appear the same as they always did
106
-     */
107
-    public static function set_hooks_for_changes()
108
-    {
109
-        self::_set_hooks_for_changes();
110
-    }
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-    /**
119
-     * Loads all the hooks which make requests to old versions of the API
120
-     * appear the same as they always did
121
-     */
122
-    protected static function _set_hooks_for_changes()
123
-    {
124
-        $folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES . 'rest_api' . DS . 'changes'), false);
125
-        foreach ($folder_contents as $classname_in_namespace => $filepath) {
126
-            //ignore the base parent class
127
-            if ($classname_in_namespace === 'Changes_In_Base') {
128
-                continue;
129
-            }
130
-            $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;
131
-            if (class_exists($full_classname)) {
132
-                $instance_of_class = new $full_classname;
133
-                if ($instance_of_class instanceof Changes_In_Base) {
134
-                    $instance_of_class->set_hooks();
135
-                }
136
-            }
137
-        }
138
-    }
139
-
140
-
141
-
142
-    /**
143
-     * Filters the WP routes to add our EE-related ones. This takes a bit of time
144
-     * so we actually prefer to only do it when an EE plugin is activated or upgraded
145
-     */
146
-    public static function register_routes()
147
-    {
148
-        foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
149
-            foreach ($relative_urls as $endpoint => $routes) {
150
-                foreach ($routes as $route) {
151
-                    $route_args = array(
152
-                        array(
153
-                            'callback' => $route['callback'],
154
-                            'methods'  => $route['methods'],
155
-                            'args'     => isset($route['args']) ? $route['args'] : array(),
156
-                        )
157
-                    );
158
-                    if (isset($route['schema_callback'])) {
159
-                        $model_name = isset($route['schema_callback'][0])
160
-                            ? $route['schema_callback'][0]
161
-                            : '';
162
-                        $version = isset( $route['schema_callback'][1])
163
-                            ? $route['schema_callback'][1]
164
-                            : '';
165
-                        if (! empty($model_name) && ! empty($version)) {
166
-                            $route_args['schema'] = function () use ($model_name, $version) {
167
-                                return ModelRead::handle_schema_request(
168
-                                    $model_name,
169
-                                    $version
170
-                                );
171
-                            };
172
-                        }
173
-                    }
174
-                    register_rest_route(
175
-                        $namespace,
176
-                        $endpoint,
177
-                        $route_args
178
-                    );
179
-                }
180
-            }
181
-        }
182
-    }
183
-
184
-
185
-
186
-    /**
187
-     * Checks if there was a version change or something that merits invalidating the cached
188
-     * route data. If so, invalidates the cached route data so that it gets refreshed
189
-     * next time the WP API is used
190
-     */
191
-    public static function invalidate_cached_route_data_on_version_change()
192
-    {
193
-        if (EE_System::instance()->detect_req_type() != EE_System::req_type_normal) {
194
-            EED_Core_Rest_Api::invalidate_cached_route_data();
195
-        }
196
-        foreach (EE_Registry::instance()->addons as $addon) {
197
-            if ($addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal) {
198
-                EED_Core_Rest_Api::invalidate_cached_route_data();
199
-            }
200
-        }
201
-    }
202
-
203
-
204
-
205
-    /**
206
-     * Removes the cached route data so it will get refreshed next time the WP API is used
207
-     */
208
-    public static function invalidate_cached_route_data()
209
-    {
210
-        //delete the saved EE REST API routes
211
-        foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden) {
212
-            delete_option(EED_Core_Rest_Api::saved_routes_option_names . $version);
213
-        }
214
-    }
215
-
216
-
217
-
218
-    /**
219
-     * Gets the EE route data
220
-     *
221
-     * @return array top-level key is the namespace, next-level key is the route and its value is array{
222
-     * @type string|array $callback
223
-     * @type string       $methods
224
-     * @type boolean      $hidden_endpoint
225
-     * }
226
-     */
227
-    public static function get_ee_route_data()
228
-    {
229
-        $ee_routes = array();
230
-        foreach (self::versions_served() as $version => $hidden_endpoints) {
231
-            $ee_routes[self::ee_api_namespace . $version] = self::_get_ee_route_data_for_version($version,
232
-                $hidden_endpoints);
233
-        }
234
-        return $ee_routes;
235
-    }
236
-
237
-
238
-
239
-    /**
240
-     * Gets the EE route data from the wp options if it exists already,
241
-     * otherwise re-generates it and saves it to the option
242
-     *
243
-     * @param string  $version
244
-     * @param boolean $hidden_endpoints
245
-     * @return array
246
-     */
247
-    protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false)
248
-    {
249
-        $ee_routes = get_option(self::saved_routes_option_names . $version, null);
250
-        if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) {
251
-            $ee_routes = self::_save_ee_route_data_for_version($version, $hidden_endpoints);
252
-        }
253
-        return $ee_routes;
254
-    }
255
-
256
-
257
-
258
-    /**
259
-     * Saves the EE REST API route data to a wp option and returns it
260
-     *
261
-     * @param string  $version
262
-     * @param boolean $hidden_endpoints
263
-     * @return mixed|null|void
264
-     */
265
-    protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false)
266
-    {
267
-        $instance = self::instance();
268
-        $routes = apply_filters(
269
-            'EED_Core_Rest_Api__save_ee_route_data_for_version__routes',
270
-            array_replace_recursive(
271
-                $instance->_get_config_route_data_for_version($version, $hidden_endpoints),
272
-                $instance->_get_meta_route_data_for_version($version, $hidden_endpoints),
273
-                $instance->_get_model_route_data_for_version($version, $hidden_endpoints),
274
-                $instance->_get_rpc_route_data_for_version($version, $hidden_endpoints)
275
-            )
276
-        );
277
-        $option_name = self::saved_routes_option_names . $version;
278
-        if (get_option($option_name)) {
279
-            update_option($option_name, $routes, true);
280
-        } else {
281
-            add_option($option_name, $routes, null, 'no');
282
-        }
283
-        return $routes;
284
-    }
285
-
286
-
287
-
288
-    /**
289
-     * Calculates all the EE routes and saves it to a wordpress option so we don't
290
-     * need to calculate it on every request
291
-     *
292
-     * @deprecated since version 4.9.1
293
-     * @return void
294
-     */
295
-    public static function save_ee_routes()
296
-    {
297
-        if (EE_Maintenance_Mode::instance()->models_can_query()) {
298
-            $instance = self::instance();
299
-            $routes = apply_filters(
300
-                'EED_Core_Rest_Api__save_ee_routes__routes',
301
-                array_replace_recursive(
302
-                    $instance->_register_config_routes(),
303
-                    $instance->_register_meta_routes(),
304
-                    $instance->_register_model_routes(),
305
-                    $instance->_register_rpc_routes()
306
-                )
307
-            );
308
-            update_option(self::saved_routes_option_names, $routes, true);
309
-        }
310
-    }
311
-
312
-
313
-
314
-    /**
315
-     * Gets all the route information relating to EE models
316
-     *
317
-     * @return array @see get_ee_route_data
318
-     * @deprecated since version 4.9.1
319
-     */
320
-    protected function _register_model_routes()
321
-    {
322
-        $model_routes = array();
323
-        foreach (self::versions_served() as $version => $hidden_endpoint) {
324
-            $model_routes[EED_Core_Rest_Api::ee_api_namespace
325
-                          . $version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);
326
-        }
327
-        return $model_routes;
328
-    }
329
-
330
-
331
-
332
-    /**
333
-     * Gets the route data for EE models in the specified version
334
-     *
335
-     * @param string  $version
336
-     * @param boolean $hidden_endpoint
337
-     * @return array
338
-     */
339
-    protected function _get_model_route_data_for_version($version, $hidden_endpoint = false)
340
-    {
341
-        $model_version_info = new Model_Version_Info($version);
342
-        $models_to_register = apply_filters(
343
-            'FHEE__EED_Core_REST_API___register_model_routes',
344
-            $model_version_info->models_for_requested_version()
345
-        );
346
-        //let's not bother having endpoints for extra metas
347
-        unset($models_to_register['Extra_Meta']);
348
-        unset($models_to_register['Extra_Join']);
349
-        $model_routes = array();
350
-        foreach ($models_to_register as $model_name => $model_classname) {
351
-            $model = \EE_Registry::instance()->load_model($model_name);
352
-
353
-            //if this isn't a valid model then let's skip iterate to the next item in the loop.
354
-            if (! $model instanceof EEM_Base) {
355
-                continue;
356
-            }
357
-
358
-            //yes we could just register one route for ALL models, but then they wouldn't show up in the index
359
-            $plural_model_route = EEH_Inflector::pluralize_and_lower($model_name);
360
-            $singular_model_route = $plural_model_route . '/(?P<id>\d+)';
361
-            $model_routes[$plural_model_route] = array(
362
-                array(
363
-                    'callback'        => array(
364
-                        'EventEspresso\core\libraries\rest_api\controllers\model\Read',
365
-                        'handle_request_get_all',
366
-                    ),
367
-                    'methods'         => WP_REST_Server::READABLE,
368
-                    'hidden_endpoint' => $hidden_endpoint,
369
-                    'args'            => $this->_get_read_query_params($model, $version),
370
-                    '_links'          => array(
371
-                        'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route),
372
-                    ),
373
-                    'schema_callback' => array($model_name, $version)
374
-                ),
375
-                //						array(
376
-                //							'callback' => array(
377
-                //								'EventEspresso\core\libraries\rest_api\controllers\model\Write',
378
-                //								'handle_request_create_one' ),
379
-                //							'methods' => WP_REST_Server::CREATABLE,
380
-                //							'hidden_endpoint' => $hidden_endpoint
381
-                //						)
382
-            );
383
-            $model_routes[$singular_model_route] = array(
384
-                array(
385
-                    'callback'        => array(
386
-                        'EventEspresso\core\libraries\rest_api\controllers\model\Read',
387
-                        'handle_request_get_one',
388
-                    ),
389
-                    'methods'         => WP_REST_Server::READABLE,
390
-                    'hidden_endpoint' => $hidden_endpoint,
391
-                    'args'            => $this->_get_response_selection_query_params($model, $version),
392
-                ),
393
-                //						array(
394
-                //							'callback' => array(
395
-                //								'EventEspresso\core\libraries\rest_api\controllers\model\Write',
396
-                //								'handle_request_edit_one' ),
397
-                //							'methods' => WP_REST_Server::EDITABLE,
398
-                //							'hidden_endpoint' => $hidden_endpoint
399
-                //							),
400
-            );
401
-            //@todo: also handle  DELETE for a single item
402
-            foreach ($model_version_info->relation_settings($model) as $relation_name => $relation_obj) {
403
-                $related_model_name_endpoint_part = ModelRead::get_related_entity_name(
404
-                    $relation_name,
405
-                    $relation_obj
406
-                );
407
-                $model_routes[$singular_model_route . '/' . $related_model_name_endpoint_part] = array(
408
-                    array(
409
-                        'callback'        => array(
410
-                            'EventEspresso\core\libraries\rest_api\controllers\model\Read',
411
-                            'handle_request_get_related',
412
-                        ),
413
-                        'methods'         => WP_REST_Server::READABLE,
414
-                        'hidden_endpoint' => $hidden_endpoint,
415
-                        'args'            => $this->_get_read_query_params($relation_obj->get_other_model(), $version),
416
-                    ),
417
-                    //							array(
418
-                    //								'callback' => array(
419
-                    //									'EventEspresso\core\libraries\rest_api\controllers\model\Write',
420
-                    //									'handle_request_create_or_update_related' ),
421
-                    //								'methods' => WP_REST_Server::EDITABLE,
422
-                    //								'hidden_endpoint' => $hidden_endpoint
423
-                    //							)
424
-                );
425
-                //@todo: handle delete related and possibly remove relation (not sure hwo to distinguish)
426
-            }
427
-        }
428
-        return $model_routes;
429
-    }
430
-
431
-
432
-
433
-    /**
434
-     * Adds all the RPC-style routes (remote procedure call-like routes, ie
435
-     * routes that don't conform to the traditional REST CRUD-style).
436
-     *
437
-     * @deprecated since 4.9.1
438
-     */
439
-    protected function _register_rpc_routes()
440
-    {
441
-        $routes = array();
442
-        foreach (self::versions_served() as $version => $hidden_endpoint) {
443
-            $routes[self::ee_api_namespace . $version] = $this->_get_rpc_route_data_for_version($version,
444
-                $hidden_endpoint);
445
-        }
446
-        return $routes;
447
-    }
448
-
449
-
450
-
451
-    /**
452
-     * @param string  $version
453
-     * @param boolean $hidden_endpoint
454
-     * @return array
455
-     */
456
-    protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false)
457
-    {
458
-        $this_versions_routes = array();
459
-        //checkin endpoint
460
-        $this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array(
461
-            array(
462
-                'callback'        => array(
463
-                    'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin',
464
-                    'handle_request_toggle_checkin',
465
-                ),
466
-                'methods'         => WP_REST_Server::CREATABLE,
467
-                'hidden_endpoint' => $hidden_endpoint,
468
-                'args'            => array(
469
-                    'force' => array(
470
-                        'required'    => false,
471
-                        'default'     => false,
472
-                        'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses',
473
-                            'event_espresso'),
474
-                    ),
475
-                ),
476
-            ),
477
-        );
478
-        return apply_filters(
479
-            'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes',
480
-            $this_versions_routes,
481
-            $version,
482
-            $hidden_endpoint
483
-        );
484
-    }
485
-
486
-
487
-
488
-    /**
489
-     * Gets the query params that can be used when request one or many
490
-     *
491
-     * @param EEM_Base $model
492
-     * @param string   $version
493
-     * @return array
494
-     */
495
-    protected function _get_response_selection_query_params(\EEM_Base $model, $version)
496
-    {
497
-        return apply_filters(
498
-            'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',
499
-            array(
500
-                'include'   => array(
501
-                    'required' => false,
502
-                    'default'  => '*',
503
-                ),
504
-                'calculate' => array(
505
-                    'required' => false,
506
-                    'default'  => '',
507
-                    'enum'     => self::$_field_calculator->retrieve_calculated_fields_for_model($model),
508
-                ),
509
-            ),
510
-            $model,
511
-            $version
512
-        );
513
-    }
514
-
515
-
516
-
517
-    /**
518
-     * Gets info about reading query params that are acceptable
519
-     *
520
-     * @param \EEM_Base $model eg 'Event' or 'Venue'
521
-     * @param  string   $version
522
-     * @return array    describing the args acceptable when querying this model
523
-     * @throws \EE_Error
524
-     */
525
-    protected function _get_read_query_params(\EEM_Base $model, $version)
526
-    {
527
-        $default_orderby = array();
528
-        foreach ($model->get_combined_primary_key_fields() as $key_field) {
529
-            $default_orderby[$key_field->get_name()] = 'ASC';
530
-        }
531
-        return array_merge(
532
-            $this->_get_response_selection_query_params($model, $version),
533
-            array(
534
-                'where'    => array(
535
-                    'required' => false,
536
-                    'default'  => array(),
537
-                ),
538
-                'limit'    => array(
539
-                    'required' => false,
540
-                    'default'  => EED_Core_Rest_Api::get_default_query_limit(),
541
-                ),
542
-                'order_by' => array(
543
-                    'required' => false,
544
-                    'default'  => $default_orderby,
545
-                ),
546
-                'group_by' => array(
547
-                    'required' => false,
548
-                    'default'  => null,
549
-                ),
550
-                'having'   => array(
551
-                    'required' => false,
552
-                    'default'  => null,
553
-                ),
554
-                'caps'     => array(
555
-                    'required' => false,
556
-                    'default'  => EEM_Base::caps_read,
557
-                ),
558
-            )
559
-        );
560
-    }
561
-
562
-
563
-
564
-    /**
565
-     * Gets routes for the config
566
-     *
567
-     * @return array @see _register_model_routes
568
-     * @deprecated since version 4.9.1
569
-     */
570
-    protected function _register_config_routes()
571
-    {
572
-        $config_routes = array();
573
-        foreach (self::versions_served() as $version => $hidden_endpoint) {
574
-            $config_routes[self::ee_api_namespace . $version] = $this->_get_config_route_data_for_version($version,
575
-                $hidden_endpoint);
576
-        }
577
-        return $config_routes;
578
-    }
579
-
580
-
581
-
582
-    /**
583
-     * Gets routes for the config for the specified version
584
-     *
585
-     * @param string  $version
586
-     * @param boolean $hidden_endpoint
587
-     * @return array
588
-     */
589
-    protected function _get_config_route_data_for_version($version, $hidden_endpoint)
590
-    {
591
-        return array(
592
-            'config'    => array(
593
-                array(
594
-                    'callback'        => array(
595
-                        'EventEspresso\core\libraries\rest_api\controllers\config\Read',
596
-                        'handle_request',
597
-                    ),
598
-                    'methods'         => WP_REST_Server::READABLE,
599
-                    'hidden_endpoint' => $hidden_endpoint,
600
-                ),
601
-            ),
602
-            'site_info' => array(
603
-                array(
604
-                    'callback'        => array(
605
-                        'EventEspresso\core\libraries\rest_api\controllers\config\Read',
606
-                        'handle_request_site_info',
607
-                    ),
608
-                    'methods'         => WP_REST_Server::READABLE,
609
-                    'hidden_endpoint' => $hidden_endpoint,
610
-                ),
611
-            ),
612
-        );
613
-    }
614
-
615
-
616
-
617
-    /**
618
-     * Gets the meta info routes
619
-     *
620
-     * @return array @see _register_model_routes
621
-     * @deprecated since version 4.9.1
622
-     */
623
-    protected function _register_meta_routes()
624
-    {
625
-        $meta_routes = array();
626
-        foreach (self::versions_served() as $version => $hidden_endpoint) {
627
-            $meta_routes[self::ee_api_namespace . $version] = $this->_get_meta_route_data_for_version($version,
628
-                $hidden_endpoint);
629
-        }
630
-        return $meta_routes;
631
-    }
632
-
633
-
634
-
635
-    /**
636
-     * @param string  $version
637
-     * @param boolean $hidden_endpoint
638
-     * @return array
639
-     */
640
-    protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false)
641
-    {
642
-        return array(
643
-            'resources' => array(
644
-                array(
645
-                    'callback'        => array(
646
-                        'EventEspresso\core\libraries\rest_api\controllers\model\Meta',
647
-                        'handle_request_models_meta',
648
-                    ),
649
-                    'methods'         => WP_REST_Server::READABLE,
650
-                    'hidden_endpoint' => $hidden_endpoint,
651
-                ),
652
-            ),
653
-        );
654
-    }
655
-
656
-
657
-
658
-    /**
659
-     * Tries to hide old 4.6 endpoints from the
660
-     *
661
-     * @param array $route_data
662
-     * @return array
663
-     */
664
-    public static function hide_old_endpoints($route_data)
665
-    {
666
-        //allow API clients to override which endpoints get hidden, in case
667
-        //they want to discover particular endpoints
668
-        //also, we don't have access to the request so we have to just grab it from the superglobal
669
-        $force_show_ee_namespace = ltrim(
670
-            EEH_Array::is_set($_REQUEST, 'force_show_ee_namespace', ''),
671
-            '/'
672
-        );
673
-        foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
674
-            foreach ($relative_urls as $endpoint => $routes) {
675
-                foreach ($routes as $route) {
676
-                    //by default, hide "hidden_endpoint"s, unless the request indicates
677
-                    //to $force_show_ee_namespace, in which case only show that one
678
-                    //namespace's endpoints (and hide all others)
679
-                    if (($route['hidden_endpoint'] && $force_show_ee_namespace === '')
680
-                        || ($force_show_ee_namespace !== '' && $force_show_ee_namespace !== $namespace)
681
-                    ) {
682
-                        $full_route = '/' . ltrim($namespace, '/') . '/' . ltrim($endpoint, '/');
683
-                        unset($route_data[$full_route]);
684
-                    }
685
-                }
686
-            }
687
-        }
688
-        return $route_data;
689
-    }
690
-
691
-
692
-
693
-    /**
694
-     * Returns an array describing which versions of core support serving requests for.
695
-     * Keys are core versions' major and minor version, and values are the
696
-     * LOWEST requested version they can serve. Eg, 4.7 can serve requests for 4.6-like
697
-     * data by just removing a few models and fields from the responses. However, 4.15 might remove
698
-     * the answers table entirely, in which case it would be very difficult for
699
-     * it to serve 4.6-style responses.
700
-     * Versions of core that are missing from this array are unknowns.
701
-     * previous ver
702
-     *
703
-     * @return array
704
-     */
705
-    public static function version_compatibilities()
706
-    {
707
-        return apply_filters(
708
-            'FHEE__EED_Core_REST_API__version_compatibilities',
709
-            array(
710
-                '4.8.29' => '4.8.29',
711
-                '4.8.33' => '4.8.29',
712
-                '4.8.34' => '4.8.29',
713
-                '4.8.36' => '4.8.29',
714
-            )
715
-        );
716
-    }
717
-
718
-
719
-
720
-    /**
721
-     * Gets the latest API version served. Eg if there
722
-     * are two versions served of the API, 4.8.29 and 4.8.32, and
723
-     * we are on core version 4.8.34, it will return the string "4.8.32"
724
-     *
725
-     * @return string
726
-     */
727
-    public static function latest_rest_api_version()
728
-    {
729
-        $versions_served = \EED_Core_Rest_Api::versions_served();
730
-        $versions_served_keys = array_keys($versions_served);
731
-        return end($versions_served_keys);
732
-    }
733
-
734
-
735
-
736
-    /**
737
-     * Using EED_Core_Rest_Api::version_compatibilities(), determines what version of
738
-     * EE the API can serve requests for. Eg, if we are on 4.15 of core, and
739
-     * we can serve requests from 4.12 or later, this will return array( '4.12', '4.13', '4.14', '4.15' ).
740
-     * We also indicate whether or not this version should be put in the index or not
741
-     *
742
-     * @return array keys are API version numbers (just major and minor numbers), and values
743
-     * are whether or not they should be hidden
744
-     */
745
-    public static function versions_served()
746
-    {
747
-        $versions_served = array();
748
-        $possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();
749
-        $lowest_compatible_version = end($possibly_served_versions);
750
-        reset($possibly_served_versions);
751
-        $versions_served_historically = array_keys($possibly_served_versions);
752
-        $latest_version = end($versions_served_historically);
753
-        reset($versions_served_historically);
754
-        //for each version of core we have ever served:
755
-        foreach ($versions_served_historically as $key_versioned_endpoint) {
756
-            //if it's not above the current core version, and it's compatible with the current version of core
757
-            if ($key_versioned_endpoint == $latest_version) {
758
-                //don't hide the latest version in the index
759
-                $versions_served[$key_versioned_endpoint] = false;
760
-            } else if (
761
-                $key_versioned_endpoint < EED_Core_Rest_Api::core_version()
762
-                && $key_versioned_endpoint >= $lowest_compatible_version
763
-            ) {
764
-                //include, but hide, previous versions which are still supported
765
-                $versions_served[$key_versioned_endpoint] = true;
766
-            } elseif (
767
-            apply_filters(
768
-                'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions',
769
-                false,
770
-                $possibly_served_versions
771
-            )
772
-            ) {
773
-                //if a version is no longer supported, don't include it in index or list of versions served
774
-                $versions_served[$key_versioned_endpoint] = true;
775
-            }
776
-        }
777
-        return $versions_served;
778
-    }
779
-
780
-
781
-
782
-    /**
783
-     * Gets the major and minor version of EE core's version string
784
-     *
785
-     * @return string
786
-     */
787
-    public static function core_version()
788
-    {
789
-        return apply_filters('FHEE__EED_Core_REST_API__core_version',
790
-            implode('.', array_slice(explode('.', espresso_version()), 0, 3)));
791
-    }
792
-
793
-
794
-
795
-    /**
796
-     * Gets the default limit that should be used when querying for resources
797
-     *
798
-     * @return int
799
-     */
800
-    public static function get_default_query_limit()
801
-    {
802
-        //we actually don't use a const because we want folks to always use
803
-        //this method, not the const directly
804
-        return apply_filters(
805
-            'FHEE__EED_Core_Rest_Api__get_default_query_limit',
806
-            50
807
-        );
808
-    }
809
-
810
-
811
-
812
-    /**
813
-     *    run - initial module setup
814
-     *
815
-     * @access    public
816
-     * @param  WP $WP
817
-     * @return    void
818
-     */
819
-    public function run($WP)
820
-    {
821
-    }
52
+	/**
53
+	 *    set_hooks - for hooking into EE Core, other modules, etc
54
+	 *
55
+	 * @access    public
56
+	 * @return    void
57
+	 */
58
+	public static function set_hooks()
59
+	{
60
+		self::set_hooks_both();
61
+	}
62
+
63
+
64
+
65
+	/**
66
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
67
+	 *
68
+	 * @access    public
69
+	 * @return    void
70
+	 */
71
+	public static function set_hooks_admin()
72
+	{
73
+		self::set_hooks_both();
74
+	}
75
+
76
+
77
+
78
+	public static function set_hooks_both()
79
+	{
80
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10);
81
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5);
82
+		add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2);
83
+		add_filter('rest_index',
84
+			array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index'));
85
+		EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change();
86
+	}
87
+
88
+
89
+
90
+	/**
91
+	 * sets up hooks which only need to be included as part of REST API requests;
92
+	 * other requests like to the frontend or admin etc don't need them
93
+	 */
94
+	public static function set_hooks_rest_api()
95
+	{
96
+		//set hooks which account for changes made to the API
97
+		EED_Core_Rest_Api::_set_hooks_for_changes();
98
+	}
99
+
100
+
101
+
102
+	/**
103
+	 * public wrapper of _set_hooks_for_changes.
104
+	 * Loads all the hooks which make requests to old versions of the API
105
+	 * appear the same as they always did
106
+	 */
107
+	public static function set_hooks_for_changes()
108
+	{
109
+		self::_set_hooks_for_changes();
110
+	}
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+	/**
119
+	 * Loads all the hooks which make requests to old versions of the API
120
+	 * appear the same as they always did
121
+	 */
122
+	protected static function _set_hooks_for_changes()
123
+	{
124
+		$folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES . 'rest_api' . DS . 'changes'), false);
125
+		foreach ($folder_contents as $classname_in_namespace => $filepath) {
126
+			//ignore the base parent class
127
+			if ($classname_in_namespace === 'Changes_In_Base') {
128
+				continue;
129
+			}
130
+			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;
131
+			if (class_exists($full_classname)) {
132
+				$instance_of_class = new $full_classname;
133
+				if ($instance_of_class instanceof Changes_In_Base) {
134
+					$instance_of_class->set_hooks();
135
+				}
136
+			}
137
+		}
138
+	}
139
+
140
+
141
+
142
+	/**
143
+	 * Filters the WP routes to add our EE-related ones. This takes a bit of time
144
+	 * so we actually prefer to only do it when an EE plugin is activated or upgraded
145
+	 */
146
+	public static function register_routes()
147
+	{
148
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
149
+			foreach ($relative_urls as $endpoint => $routes) {
150
+				foreach ($routes as $route) {
151
+					$route_args = array(
152
+						array(
153
+							'callback' => $route['callback'],
154
+							'methods'  => $route['methods'],
155
+							'args'     => isset($route['args']) ? $route['args'] : array(),
156
+						)
157
+					);
158
+					if (isset($route['schema_callback'])) {
159
+						$model_name = isset($route['schema_callback'][0])
160
+							? $route['schema_callback'][0]
161
+							: '';
162
+						$version = isset( $route['schema_callback'][1])
163
+							? $route['schema_callback'][1]
164
+							: '';
165
+						if (! empty($model_name) && ! empty($version)) {
166
+							$route_args['schema'] = function () use ($model_name, $version) {
167
+								return ModelRead::handle_schema_request(
168
+									$model_name,
169
+									$version
170
+								);
171
+							};
172
+						}
173
+					}
174
+					register_rest_route(
175
+						$namespace,
176
+						$endpoint,
177
+						$route_args
178
+					);
179
+				}
180
+			}
181
+		}
182
+	}
183
+
184
+
185
+
186
+	/**
187
+	 * Checks if there was a version change or something that merits invalidating the cached
188
+	 * route data. If so, invalidates the cached route data so that it gets refreshed
189
+	 * next time the WP API is used
190
+	 */
191
+	public static function invalidate_cached_route_data_on_version_change()
192
+	{
193
+		if (EE_System::instance()->detect_req_type() != EE_System::req_type_normal) {
194
+			EED_Core_Rest_Api::invalidate_cached_route_data();
195
+		}
196
+		foreach (EE_Registry::instance()->addons as $addon) {
197
+			if ($addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal) {
198
+				EED_Core_Rest_Api::invalidate_cached_route_data();
199
+			}
200
+		}
201
+	}
202
+
203
+
204
+
205
+	/**
206
+	 * Removes the cached route data so it will get refreshed next time the WP API is used
207
+	 */
208
+	public static function invalidate_cached_route_data()
209
+	{
210
+		//delete the saved EE REST API routes
211
+		foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden) {
212
+			delete_option(EED_Core_Rest_Api::saved_routes_option_names . $version);
213
+		}
214
+	}
215
+
216
+
217
+
218
+	/**
219
+	 * Gets the EE route data
220
+	 *
221
+	 * @return array top-level key is the namespace, next-level key is the route and its value is array{
222
+	 * @type string|array $callback
223
+	 * @type string       $methods
224
+	 * @type boolean      $hidden_endpoint
225
+	 * }
226
+	 */
227
+	public static function get_ee_route_data()
228
+	{
229
+		$ee_routes = array();
230
+		foreach (self::versions_served() as $version => $hidden_endpoints) {
231
+			$ee_routes[self::ee_api_namespace . $version] = self::_get_ee_route_data_for_version($version,
232
+				$hidden_endpoints);
233
+		}
234
+		return $ee_routes;
235
+	}
236
+
237
+
238
+
239
+	/**
240
+	 * Gets the EE route data from the wp options if it exists already,
241
+	 * otherwise re-generates it and saves it to the option
242
+	 *
243
+	 * @param string  $version
244
+	 * @param boolean $hidden_endpoints
245
+	 * @return array
246
+	 */
247
+	protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false)
248
+	{
249
+		$ee_routes = get_option(self::saved_routes_option_names . $version, null);
250
+		if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) {
251
+			$ee_routes = self::_save_ee_route_data_for_version($version, $hidden_endpoints);
252
+		}
253
+		return $ee_routes;
254
+	}
255
+
256
+
257
+
258
+	/**
259
+	 * Saves the EE REST API route data to a wp option and returns it
260
+	 *
261
+	 * @param string  $version
262
+	 * @param boolean $hidden_endpoints
263
+	 * @return mixed|null|void
264
+	 */
265
+	protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false)
266
+	{
267
+		$instance = self::instance();
268
+		$routes = apply_filters(
269
+			'EED_Core_Rest_Api__save_ee_route_data_for_version__routes',
270
+			array_replace_recursive(
271
+				$instance->_get_config_route_data_for_version($version, $hidden_endpoints),
272
+				$instance->_get_meta_route_data_for_version($version, $hidden_endpoints),
273
+				$instance->_get_model_route_data_for_version($version, $hidden_endpoints),
274
+				$instance->_get_rpc_route_data_for_version($version, $hidden_endpoints)
275
+			)
276
+		);
277
+		$option_name = self::saved_routes_option_names . $version;
278
+		if (get_option($option_name)) {
279
+			update_option($option_name, $routes, true);
280
+		} else {
281
+			add_option($option_name, $routes, null, 'no');
282
+		}
283
+		return $routes;
284
+	}
285
+
286
+
287
+
288
+	/**
289
+	 * Calculates all the EE routes and saves it to a wordpress option so we don't
290
+	 * need to calculate it on every request
291
+	 *
292
+	 * @deprecated since version 4.9.1
293
+	 * @return void
294
+	 */
295
+	public static function save_ee_routes()
296
+	{
297
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
298
+			$instance = self::instance();
299
+			$routes = apply_filters(
300
+				'EED_Core_Rest_Api__save_ee_routes__routes',
301
+				array_replace_recursive(
302
+					$instance->_register_config_routes(),
303
+					$instance->_register_meta_routes(),
304
+					$instance->_register_model_routes(),
305
+					$instance->_register_rpc_routes()
306
+				)
307
+			);
308
+			update_option(self::saved_routes_option_names, $routes, true);
309
+		}
310
+	}
311
+
312
+
313
+
314
+	/**
315
+	 * Gets all the route information relating to EE models
316
+	 *
317
+	 * @return array @see get_ee_route_data
318
+	 * @deprecated since version 4.9.1
319
+	 */
320
+	protected function _register_model_routes()
321
+	{
322
+		$model_routes = array();
323
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
324
+			$model_routes[EED_Core_Rest_Api::ee_api_namespace
325
+						  . $version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);
326
+		}
327
+		return $model_routes;
328
+	}
329
+
330
+
331
+
332
+	/**
333
+	 * Gets the route data for EE models in the specified version
334
+	 *
335
+	 * @param string  $version
336
+	 * @param boolean $hidden_endpoint
337
+	 * @return array
338
+	 */
339
+	protected function _get_model_route_data_for_version($version, $hidden_endpoint = false)
340
+	{
341
+		$model_version_info = new Model_Version_Info($version);
342
+		$models_to_register = apply_filters(
343
+			'FHEE__EED_Core_REST_API___register_model_routes',
344
+			$model_version_info->models_for_requested_version()
345
+		);
346
+		//let's not bother having endpoints for extra metas
347
+		unset($models_to_register['Extra_Meta']);
348
+		unset($models_to_register['Extra_Join']);
349
+		$model_routes = array();
350
+		foreach ($models_to_register as $model_name => $model_classname) {
351
+			$model = \EE_Registry::instance()->load_model($model_name);
352
+
353
+			//if this isn't a valid model then let's skip iterate to the next item in the loop.
354
+			if (! $model instanceof EEM_Base) {
355
+				continue;
356
+			}
357
+
358
+			//yes we could just register one route for ALL models, but then they wouldn't show up in the index
359
+			$plural_model_route = EEH_Inflector::pluralize_and_lower($model_name);
360
+			$singular_model_route = $plural_model_route . '/(?P<id>\d+)';
361
+			$model_routes[$plural_model_route] = array(
362
+				array(
363
+					'callback'        => array(
364
+						'EventEspresso\core\libraries\rest_api\controllers\model\Read',
365
+						'handle_request_get_all',
366
+					),
367
+					'methods'         => WP_REST_Server::READABLE,
368
+					'hidden_endpoint' => $hidden_endpoint,
369
+					'args'            => $this->_get_read_query_params($model, $version),
370
+					'_links'          => array(
371
+						'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route),
372
+					),
373
+					'schema_callback' => array($model_name, $version)
374
+				),
375
+				//						array(
376
+				//							'callback' => array(
377
+				//								'EventEspresso\core\libraries\rest_api\controllers\model\Write',
378
+				//								'handle_request_create_one' ),
379
+				//							'methods' => WP_REST_Server::CREATABLE,
380
+				//							'hidden_endpoint' => $hidden_endpoint
381
+				//						)
382
+			);
383
+			$model_routes[$singular_model_route] = array(
384
+				array(
385
+					'callback'        => array(
386
+						'EventEspresso\core\libraries\rest_api\controllers\model\Read',
387
+						'handle_request_get_one',
388
+					),
389
+					'methods'         => WP_REST_Server::READABLE,
390
+					'hidden_endpoint' => $hidden_endpoint,
391
+					'args'            => $this->_get_response_selection_query_params($model, $version),
392
+				),
393
+				//						array(
394
+				//							'callback' => array(
395
+				//								'EventEspresso\core\libraries\rest_api\controllers\model\Write',
396
+				//								'handle_request_edit_one' ),
397
+				//							'methods' => WP_REST_Server::EDITABLE,
398
+				//							'hidden_endpoint' => $hidden_endpoint
399
+				//							),
400
+			);
401
+			//@todo: also handle  DELETE for a single item
402
+			foreach ($model_version_info->relation_settings($model) as $relation_name => $relation_obj) {
403
+				$related_model_name_endpoint_part = ModelRead::get_related_entity_name(
404
+					$relation_name,
405
+					$relation_obj
406
+				);
407
+				$model_routes[$singular_model_route . '/' . $related_model_name_endpoint_part] = array(
408
+					array(
409
+						'callback'        => array(
410
+							'EventEspresso\core\libraries\rest_api\controllers\model\Read',
411
+							'handle_request_get_related',
412
+						),
413
+						'methods'         => WP_REST_Server::READABLE,
414
+						'hidden_endpoint' => $hidden_endpoint,
415
+						'args'            => $this->_get_read_query_params($relation_obj->get_other_model(), $version),
416
+					),
417
+					//							array(
418
+					//								'callback' => array(
419
+					//									'EventEspresso\core\libraries\rest_api\controllers\model\Write',
420
+					//									'handle_request_create_or_update_related' ),
421
+					//								'methods' => WP_REST_Server::EDITABLE,
422
+					//								'hidden_endpoint' => $hidden_endpoint
423
+					//							)
424
+				);
425
+				//@todo: handle delete related and possibly remove relation (not sure hwo to distinguish)
426
+			}
427
+		}
428
+		return $model_routes;
429
+	}
430
+
431
+
432
+
433
+	/**
434
+	 * Adds all the RPC-style routes (remote procedure call-like routes, ie
435
+	 * routes that don't conform to the traditional REST CRUD-style).
436
+	 *
437
+	 * @deprecated since 4.9.1
438
+	 */
439
+	protected function _register_rpc_routes()
440
+	{
441
+		$routes = array();
442
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
443
+			$routes[self::ee_api_namespace . $version] = $this->_get_rpc_route_data_for_version($version,
444
+				$hidden_endpoint);
445
+		}
446
+		return $routes;
447
+	}
448
+
449
+
450
+
451
+	/**
452
+	 * @param string  $version
453
+	 * @param boolean $hidden_endpoint
454
+	 * @return array
455
+	 */
456
+	protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false)
457
+	{
458
+		$this_versions_routes = array();
459
+		//checkin endpoint
460
+		$this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array(
461
+			array(
462
+				'callback'        => array(
463
+					'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin',
464
+					'handle_request_toggle_checkin',
465
+				),
466
+				'methods'         => WP_REST_Server::CREATABLE,
467
+				'hidden_endpoint' => $hidden_endpoint,
468
+				'args'            => array(
469
+					'force' => array(
470
+						'required'    => false,
471
+						'default'     => false,
472
+						'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses',
473
+							'event_espresso'),
474
+					),
475
+				),
476
+			),
477
+		);
478
+		return apply_filters(
479
+			'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes',
480
+			$this_versions_routes,
481
+			$version,
482
+			$hidden_endpoint
483
+		);
484
+	}
485
+
486
+
487
+
488
+	/**
489
+	 * Gets the query params that can be used when request one or many
490
+	 *
491
+	 * @param EEM_Base $model
492
+	 * @param string   $version
493
+	 * @return array
494
+	 */
495
+	protected function _get_response_selection_query_params(\EEM_Base $model, $version)
496
+	{
497
+		return apply_filters(
498
+			'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',
499
+			array(
500
+				'include'   => array(
501
+					'required' => false,
502
+					'default'  => '*',
503
+				),
504
+				'calculate' => array(
505
+					'required' => false,
506
+					'default'  => '',
507
+					'enum'     => self::$_field_calculator->retrieve_calculated_fields_for_model($model),
508
+				),
509
+			),
510
+			$model,
511
+			$version
512
+		);
513
+	}
514
+
515
+
516
+
517
+	/**
518
+	 * Gets info about reading query params that are acceptable
519
+	 *
520
+	 * @param \EEM_Base $model eg 'Event' or 'Venue'
521
+	 * @param  string   $version
522
+	 * @return array    describing the args acceptable when querying this model
523
+	 * @throws \EE_Error
524
+	 */
525
+	protected function _get_read_query_params(\EEM_Base $model, $version)
526
+	{
527
+		$default_orderby = array();
528
+		foreach ($model->get_combined_primary_key_fields() as $key_field) {
529
+			$default_orderby[$key_field->get_name()] = 'ASC';
530
+		}
531
+		return array_merge(
532
+			$this->_get_response_selection_query_params($model, $version),
533
+			array(
534
+				'where'    => array(
535
+					'required' => false,
536
+					'default'  => array(),
537
+				),
538
+				'limit'    => array(
539
+					'required' => false,
540
+					'default'  => EED_Core_Rest_Api::get_default_query_limit(),
541
+				),
542
+				'order_by' => array(
543
+					'required' => false,
544
+					'default'  => $default_orderby,
545
+				),
546
+				'group_by' => array(
547
+					'required' => false,
548
+					'default'  => null,
549
+				),
550
+				'having'   => array(
551
+					'required' => false,
552
+					'default'  => null,
553
+				),
554
+				'caps'     => array(
555
+					'required' => false,
556
+					'default'  => EEM_Base::caps_read,
557
+				),
558
+			)
559
+		);
560
+	}
561
+
562
+
563
+
564
+	/**
565
+	 * Gets routes for the config
566
+	 *
567
+	 * @return array @see _register_model_routes
568
+	 * @deprecated since version 4.9.1
569
+	 */
570
+	protected function _register_config_routes()
571
+	{
572
+		$config_routes = array();
573
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
574
+			$config_routes[self::ee_api_namespace . $version] = $this->_get_config_route_data_for_version($version,
575
+				$hidden_endpoint);
576
+		}
577
+		return $config_routes;
578
+	}
579
+
580
+
581
+
582
+	/**
583
+	 * Gets routes for the config for the specified version
584
+	 *
585
+	 * @param string  $version
586
+	 * @param boolean $hidden_endpoint
587
+	 * @return array
588
+	 */
589
+	protected function _get_config_route_data_for_version($version, $hidden_endpoint)
590
+	{
591
+		return array(
592
+			'config'    => array(
593
+				array(
594
+					'callback'        => array(
595
+						'EventEspresso\core\libraries\rest_api\controllers\config\Read',
596
+						'handle_request',
597
+					),
598
+					'methods'         => WP_REST_Server::READABLE,
599
+					'hidden_endpoint' => $hidden_endpoint,
600
+				),
601
+			),
602
+			'site_info' => array(
603
+				array(
604
+					'callback'        => array(
605
+						'EventEspresso\core\libraries\rest_api\controllers\config\Read',
606
+						'handle_request_site_info',
607
+					),
608
+					'methods'         => WP_REST_Server::READABLE,
609
+					'hidden_endpoint' => $hidden_endpoint,
610
+				),
611
+			),
612
+		);
613
+	}
614
+
615
+
616
+
617
+	/**
618
+	 * Gets the meta info routes
619
+	 *
620
+	 * @return array @see _register_model_routes
621
+	 * @deprecated since version 4.9.1
622
+	 */
623
+	protected function _register_meta_routes()
624
+	{
625
+		$meta_routes = array();
626
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
627
+			$meta_routes[self::ee_api_namespace . $version] = $this->_get_meta_route_data_for_version($version,
628
+				$hidden_endpoint);
629
+		}
630
+		return $meta_routes;
631
+	}
632
+
633
+
634
+
635
+	/**
636
+	 * @param string  $version
637
+	 * @param boolean $hidden_endpoint
638
+	 * @return array
639
+	 */
640
+	protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false)
641
+	{
642
+		return array(
643
+			'resources' => array(
644
+				array(
645
+					'callback'        => array(
646
+						'EventEspresso\core\libraries\rest_api\controllers\model\Meta',
647
+						'handle_request_models_meta',
648
+					),
649
+					'methods'         => WP_REST_Server::READABLE,
650
+					'hidden_endpoint' => $hidden_endpoint,
651
+				),
652
+			),
653
+		);
654
+	}
655
+
656
+
657
+
658
+	/**
659
+	 * Tries to hide old 4.6 endpoints from the
660
+	 *
661
+	 * @param array $route_data
662
+	 * @return array
663
+	 */
664
+	public static function hide_old_endpoints($route_data)
665
+	{
666
+		//allow API clients to override which endpoints get hidden, in case
667
+		//they want to discover particular endpoints
668
+		//also, we don't have access to the request so we have to just grab it from the superglobal
669
+		$force_show_ee_namespace = ltrim(
670
+			EEH_Array::is_set($_REQUEST, 'force_show_ee_namespace', ''),
671
+			'/'
672
+		);
673
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
674
+			foreach ($relative_urls as $endpoint => $routes) {
675
+				foreach ($routes as $route) {
676
+					//by default, hide "hidden_endpoint"s, unless the request indicates
677
+					//to $force_show_ee_namespace, in which case only show that one
678
+					//namespace's endpoints (and hide all others)
679
+					if (($route['hidden_endpoint'] && $force_show_ee_namespace === '')
680
+						|| ($force_show_ee_namespace !== '' && $force_show_ee_namespace !== $namespace)
681
+					) {
682
+						$full_route = '/' . ltrim($namespace, '/') . '/' . ltrim($endpoint, '/');
683
+						unset($route_data[$full_route]);
684
+					}
685
+				}
686
+			}
687
+		}
688
+		return $route_data;
689
+	}
690
+
691
+
692
+
693
+	/**
694
+	 * Returns an array describing which versions of core support serving requests for.
695
+	 * Keys are core versions' major and minor version, and values are the
696
+	 * LOWEST requested version they can serve. Eg, 4.7 can serve requests for 4.6-like
697
+	 * data by just removing a few models and fields from the responses. However, 4.15 might remove
698
+	 * the answers table entirely, in which case it would be very difficult for
699
+	 * it to serve 4.6-style responses.
700
+	 * Versions of core that are missing from this array are unknowns.
701
+	 * previous ver
702
+	 *
703
+	 * @return array
704
+	 */
705
+	public static function version_compatibilities()
706
+	{
707
+		return apply_filters(
708
+			'FHEE__EED_Core_REST_API__version_compatibilities',
709
+			array(
710
+				'4.8.29' => '4.8.29',
711
+				'4.8.33' => '4.8.29',
712
+				'4.8.34' => '4.8.29',
713
+				'4.8.36' => '4.8.29',
714
+			)
715
+		);
716
+	}
717
+
718
+
719
+
720
+	/**
721
+	 * Gets the latest API version served. Eg if there
722
+	 * are two versions served of the API, 4.8.29 and 4.8.32, and
723
+	 * we are on core version 4.8.34, it will return the string "4.8.32"
724
+	 *
725
+	 * @return string
726
+	 */
727
+	public static function latest_rest_api_version()
728
+	{
729
+		$versions_served = \EED_Core_Rest_Api::versions_served();
730
+		$versions_served_keys = array_keys($versions_served);
731
+		return end($versions_served_keys);
732
+	}
733
+
734
+
735
+
736
+	/**
737
+	 * Using EED_Core_Rest_Api::version_compatibilities(), determines what version of
738
+	 * EE the API can serve requests for. Eg, if we are on 4.15 of core, and
739
+	 * we can serve requests from 4.12 or later, this will return array( '4.12', '4.13', '4.14', '4.15' ).
740
+	 * We also indicate whether or not this version should be put in the index or not
741
+	 *
742
+	 * @return array keys are API version numbers (just major and minor numbers), and values
743
+	 * are whether or not they should be hidden
744
+	 */
745
+	public static function versions_served()
746
+	{
747
+		$versions_served = array();
748
+		$possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();
749
+		$lowest_compatible_version = end($possibly_served_versions);
750
+		reset($possibly_served_versions);
751
+		$versions_served_historically = array_keys($possibly_served_versions);
752
+		$latest_version = end($versions_served_historically);
753
+		reset($versions_served_historically);
754
+		//for each version of core we have ever served:
755
+		foreach ($versions_served_historically as $key_versioned_endpoint) {
756
+			//if it's not above the current core version, and it's compatible with the current version of core
757
+			if ($key_versioned_endpoint == $latest_version) {
758
+				//don't hide the latest version in the index
759
+				$versions_served[$key_versioned_endpoint] = false;
760
+			} else if (
761
+				$key_versioned_endpoint < EED_Core_Rest_Api::core_version()
762
+				&& $key_versioned_endpoint >= $lowest_compatible_version
763
+			) {
764
+				//include, but hide, previous versions which are still supported
765
+				$versions_served[$key_versioned_endpoint] = true;
766
+			} elseif (
767
+			apply_filters(
768
+				'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions',
769
+				false,
770
+				$possibly_served_versions
771
+			)
772
+			) {
773
+				//if a version is no longer supported, don't include it in index or list of versions served
774
+				$versions_served[$key_versioned_endpoint] = true;
775
+			}
776
+		}
777
+		return $versions_served;
778
+	}
779
+
780
+
781
+
782
+	/**
783
+	 * Gets the major and minor version of EE core's version string
784
+	 *
785
+	 * @return string
786
+	 */
787
+	public static function core_version()
788
+	{
789
+		return apply_filters('FHEE__EED_Core_REST_API__core_version',
790
+			implode('.', array_slice(explode('.', espresso_version()), 0, 3)));
791
+	}
792
+
793
+
794
+
795
+	/**
796
+	 * Gets the default limit that should be used when querying for resources
797
+	 *
798
+	 * @return int
799
+	 */
800
+	public static function get_default_query_limit()
801
+	{
802
+		//we actually don't use a const because we want folks to always use
803
+		//this method, not the const directly
804
+		return apply_filters(
805
+			'FHEE__EED_Core_Rest_Api__get_default_query_limit',
806
+			50
807
+		);
808
+	}
809
+
810
+
811
+
812
+	/**
813
+	 *    run - initial module setup
814
+	 *
815
+	 * @access    public
816
+	 * @param  WP $WP
817
+	 * @return    void
818
+	 */
819
+	public function run($WP)
820
+	{
821
+	}
822 822
 }
823 823
 
824 824
 // End of file EED_Core_Rest_Api.module.php
Please login to merge, or discard this patch.
caffeinated/modules/event_single_caff/EED_Event_Single_Caff.module.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -118,37 +118,37 @@
 block discarded – undo
118 118
 	 * @return EE_Template_Config
119 119
 	 */
120 120
 	public static function update_template_settings( $CFG, $REQ ) {
121
-        $display_order_event = $CFG->EED_Event_Single->display_order_event !== null
122
-            ? $CFG->EED_Event_Single->display_order_event
123
-            : EED_Event_Single::EVENT_DETAILS_PRIORITY;
121
+		$display_order_event = $CFG->EED_Event_Single->display_order_event !== null
122
+			? $CFG->EED_Event_Single->display_order_event
123
+			: EED_Event_Single::EVENT_DETAILS_PRIORITY;
124 124
 		$display_order_datetimes = $CFG->EED_Event_Single->display_order_datetimes !== null
125
-            ? $CFG->EED_Event_Single->display_order_datetimes
126
-            : EED_Event_Single::EVENT_DATETIMES_PRIORITY;
127
-        $display_order_tickets = $CFG->EED_Event_Single->display_order_tickets !== null
128
-            ? $CFG->EED_Event_Single->display_order_tickets
129
-            : EED_Event_Single::EVENT_TICKETS_PRIORITY;
125
+			? $CFG->EED_Event_Single->display_order_datetimes
126
+			: EED_Event_Single::EVENT_DATETIMES_PRIORITY;
127
+		$display_order_tickets = $CFG->EED_Event_Single->display_order_tickets !== null
128
+			? $CFG->EED_Event_Single->display_order_tickets
129
+			: EED_Event_Single::EVENT_TICKETS_PRIORITY;
130 130
 		$display_order_venue = $CFG->EED_Event_Single->display_order_venue !== null
131
-            ? $CFG->EED_Event_Single->display_order_venue
132
-            : EED_Event_Single::EVENT_VENUES_PRIORITY;
131
+			? $CFG->EED_Event_Single->display_order_venue
132
+			: EED_Event_Single::EVENT_VENUES_PRIORITY;
133 133
 		$CFG->EED_Event_Single = new EE_Event_Single_Config();
134 134
 		$CFG->EED_Event_Single->display_status_banner_single = ! empty( $REQ['display_status_banner_single'] )
135
-            && $REQ['display_status_banner_single'];
135
+			&& $REQ['display_status_banner_single'];
136 136
 		$CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue'];
137 137
 		$CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] )
138
-            ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] )
139
-            : 0;
138
+			? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] )
139
+			: 0;
140 140
 		$CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order
141
-            ? $display_order_event
142
-            : EED_Event_Single::EVENT_DETAILS_PRIORITY;
141
+			? $display_order_event
142
+			: EED_Event_Single::EVENT_DETAILS_PRIORITY;
143 143
 		$CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order
144
-            ? $display_order_datetimes
145
-            : EED_Event_Single::EVENT_DATETIMES_PRIORITY;
144
+			? $display_order_datetimes
145
+			: EED_Event_Single::EVENT_DATETIMES_PRIORITY;
146 146
 		$CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order
147
-            ? $display_order_tickets
148
-            : EED_Event_Single::EVENT_TICKETS_PRIORITY;
147
+			? $display_order_tickets
148
+			: EED_Event_Single::EVENT_TICKETS_PRIORITY;
149 149
 		$CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order
150
-            ? $display_order_venue
151
-            : EED_Event_Single::EVENT_VENUES_PRIORITY;
150
+			? $display_order_venue
151
+			: EED_Event_Single::EVENT_VENUES_PRIORITY;
152 152
 		do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ );
153 153
 		return $CFG;
154 154
 	}
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return EED_Event_Single_Caff
30 30
 	 */
31 31
 	public static function instance() {
32
-		return parent::get_instance( __CLASS__ );
32
+		return parent::get_instance(__CLASS__);
33 33
 	}
34 34
 
35 35
 
@@ -50,34 +50,34 @@  discard block
 block discarded – undo
50 50
 	 *  @return 	void
51 51
 	 */
52 52
 	public static function set_hooks_admin() {
53
-		define( 'EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS );
54
-		define( 'EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
53
+		define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS);
54
+		define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
55 55
 		add_action(
56 56
 			'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings',
57
-			array( 'EED_Event_Single_Caff', 'load_scripts_styles' ),
57
+			array('EED_Event_Single_Caff', 'load_scripts_styles'),
58 58
 			10
59 59
 		);
60
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Event_Single_Caff', 'template_settings_form' ), 10 );
61
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Event_Single_Caff', 'update_template_settings' ), 10, 2 );
60
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Event_Single_Caff', 'template_settings_form'), 10);
61
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Event_Single_Caff', 'update_template_settings'), 10, 2);
62 62
 		// AJAX
63
-		add_action( 'wp_ajax_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) );
64
-		add_action( 'wp_ajax_nopriv_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) );
63
+		add_action('wp_ajax_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order'));
64
+		add_action('wp_ajax_nopriv_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order'));
65 65
 
66 66
 	}
67 67
 
68 68
 
69 69
 
70 70
 	public static function load_scripts_styles() {
71
-		add_action( 'admin_enqueue_scripts', array( 'EED_Event_Single_Caff', 'enqueue_scripts_styles' ), 10 );
71
+		add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10);
72 72
 	}
73 73
 
74 74
 
75 75
 
76 76
 	public static function enqueue_scripts_styles() {
77
-		wp_register_style( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION );
78
-		wp_enqueue_style( 'eed-event-single-sortable' );
79
-		wp_register_script( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', array( 'jquery-ui-sortable' ), EVENT_ESPRESSO_VERSION, true );
80
-		wp_enqueue_script( 'eed-event-single-sortable' );
77
+		wp_register_style('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION);
78
+		wp_enqueue_style('eed-event-single-sortable');
79
+		wp_register_script('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
80
+		wp_enqueue_script('eed-event-single-sortable');
81 81
 	}
82 82
 
83 83
 
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public static function template_settings_form() {
93 93
 		$config = EE_Registry::instance()->CFG->template_settings;
94
-		$config = isset( $config->EED_Event_Single ) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config();
95
-		$config->use_sortable_display_order = isset( $config->use_sortable_display_order ) ? $config->use_sortable_display_order : false;
96
-		$config = apply_filters( 'FHEE__EED_Event_Single__template_settings_form__event_list_config', $config );
94
+		$config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config();
95
+		$config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false;
96
+		$config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config);
97 97
 
98 98
 		$event_single_order_array = array();
99
-		$event_single_order_array[ $config->display_order_tickets ] = 'tickets';
100
-		$event_single_order_array[ $config->display_order_datetimes ] = 'datetimes';
101
-		$event_single_order_array[ $config->display_order_event ] = 'event';
102
-		$event_single_order_array[ $config->display_order_venue ] = 'venue';
99
+		$event_single_order_array[$config->display_order_tickets] = 'tickets';
100
+		$event_single_order_array[$config->display_order_datetimes] = 'datetimes';
101
+		$event_single_order_array[$config->display_order_event] = 'event';
102
+		$event_single_order_array[$config->display_order_venue] = 'venue';
103 103
 		// get template parts
104
-		$template_parts = EED_Event_Single::instance()->initialize_template_parts( $config );
104
+		$template_parts = EED_Event_Single::instance()->initialize_template_parts($config);
105 105
 		// convert to array so that we can add more properties
106
-		$config = get_object_vars( $config );
107
-		$config[ 'event_single_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-single-sortable-js', '', 'single-sortable-li single-sortable-js' );
108
-		EEH_Template::display_template( EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $config );
106
+		$config = get_object_vars($config);
107
+		$config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-single-sortable-js', '', 'single-sortable-li single-sortable-js');
108
+		EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', $config);
109 109
 	}
110 110
 
111 111
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @param array $REQ
118 118
 	 * @return EE_Template_Config
119 119
 	 */
120
-	public static function update_template_settings( $CFG, $REQ ) {
120
+	public static function update_template_settings($CFG, $REQ) {
121 121
         $display_order_event = $CFG->EED_Event_Single->display_order_event !== null
122 122
             ? $CFG->EED_Event_Single->display_order_event
123 123
             : EED_Event_Single::EVENT_DETAILS_PRIORITY;
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
             ? $CFG->EED_Event_Single->display_order_venue
132 132
             : EED_Event_Single::EVENT_VENUES_PRIORITY;
133 133
 		$CFG->EED_Event_Single = new EE_Event_Single_Config();
134
-		$CFG->EED_Event_Single->display_status_banner_single = ! empty( $REQ['display_status_banner_single'] )
134
+		$CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single'])
135 135
             && $REQ['display_status_banner_single'];
136
-		$CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue'];
137
-		$CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] )
138
-            ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] )
136
+		$CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue'];
137
+		$CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order'])
138
+            ? absint($REQ['EED_Events_Single_use_sortable_display_order'])
139 139
             : 0;
140 140
 		$CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order
141 141
             ? $display_order_event
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		$CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order
150 150
             ? $display_order_venue
151 151
             : EED_Event_Single::EVENT_VENUES_PRIORITY;
152
-		do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ );
152
+		do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ);
153 153
 		return $CFG;
154 154
 	}
155 155
 
@@ -163,23 +163,23 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	public static function update_event_single_order() {
165 165
 		$config_saved = false;
166
-		$template_parts = sanitize_text_field( $_POST[ 'elements' ] );
167
-		if ( ! empty( $template_parts ) ) {
168
-			$template_parts = explode( ',', trim( $template_parts, ',' ) );
169
-			foreach ( $template_parts as $key => $template_part ) {
166
+		$template_parts = sanitize_text_field($_POST['elements']);
167
+		if ( ! empty($template_parts)) {
168
+			$template_parts = explode(',', trim($template_parts, ','));
169
+			foreach ($template_parts as $key => $template_part) {
170 170
 				$template_part = "display_order_$template_part";
171
-				$priority = ( $key * 10 ) + EED_Event_Single::EVENT_DETAILS_PRIORITY;
171
+				$priority = ($key * 10) + EED_Event_Single::EVENT_DETAILS_PRIORITY;
172 172
 				EE_Registry::instance()->CFG->template_settings->EED_Event_Single->{$template_part} = $priority;
173
-				do_action( "AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority );
173
+				do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority);
174 174
 			}
175
-			$config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false );
175
+			$config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false);
176 176
 		}
177
-		if ( $config_saved ) {
178
-			EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) );
177
+		if ($config_saved) {
178
+			EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso'));
179 179
 		} else {
180
-			EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
180
+			EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
181 181
 		}
182
-		echo wp_json_encode( EE_Error::get_notices( false ));
182
+		echo wp_json_encode(EE_Error::get_notices(false));
183 183
 		exit();
184 184
 	}
185 185
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param WP $WP
193 193
 	 * @return    void
194 194
 	 */
195
-	public function run( $WP ) {
195
+	public function run($WP) {
196 196
 	}
197 197
 
198 198
 
Please login to merge, or discard this patch.
admin/extend/general_settings/templates/debug_log_settings.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
                 </label>
19 19
             </th>
20 20
 			<td>
21
-				<?php echo EEH_Form_Fields::select_input('use_full_logging', $values, $use_full_logging ); ?>
21
+				<?php echo EEH_Form_Fields::select_input('use_full_logging', $values, $use_full_logging); ?>
22 22
 				<p class="description">
23 23
 					<span class="reminder-spn">
24 24
 						<?php _e('Please use caution when using this feature. These files may be publicly available.', 'event_espresso'); ?>
25 25
 					</span><br/>
26
-					<?php echo sprintf( __('Once saved, this file will be available at: %s', 'event_espresso'), '<br /><b>/wp-content/uploads/espresso/logs/' . EE_Registry::instance()->CFG->admin->log_file_name() . '</b>' ); ?>
26
+					<?php echo sprintf(__('Once saved, this file will be available at: %s', 'event_espresso'), '<br /><b>/wp-content/uploads/espresso/logs/'.EE_Registry::instance()->CFG->admin->log_file_name().'</b>'); ?>
27 27
 				</p>
28 28
 
29 29
 			</td>
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
                 </label>
38 38
             </th>
39 39
 			<td>
40
-				<?php echo EEH_Form_Fields::select_input('use_remote_logging', $values, $use_remote_logging ); ?>
40
+				<?php echo EEH_Form_Fields::select_input('use_remote_logging', $values, $use_remote_logging); ?>
41 41
 				<p class="description">
42 42
 					<?php _e('Send debugging data to the remote URL below.', 'event_espresso'); ?>
43 43
 				</p>
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                 </label>
53 53
             </th>
54 54
 			<td>
55
-				<input name="remote_logging_url" id="remote_logging_url" size="20" class="regular-text" type="text" value="<?php echo $remote_logging_url;?>" />
55
+				<input name="remote_logging_url" id="remote_logging_url" size="20" class="regular-text" type="text" value="<?php echo $remote_logging_url; ?>" />
56 56
 				<p class="description">
57 57
 					<?php _e('Example: http://requestb.in/MY_UNIQUE_ID', 'event_espresso'); ?>
58 58
 
Please login to merge, or discard this patch.
message_type/payment_reminder/EE_Payment_Reminder_message_type.class.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
declined_registration/EE_Declined_Registration_message_type.class.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.