Completed
Branch BUG-7537 (42ca46)
by
unknown
1233:48 queued 1213:30
created
modules/events_archive/EED_Events_Archive.module.php 1 patch
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return EED_Events_Archive
44 44
 	 */
45 45
 	public static function instance() {
46
-		return parent::get_instance( __CLASS__ );
46
+		return parent::get_instance(__CLASS__);
47 47
 	}
48 48
 
49 49
 
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	 *  @return 	void
56 56
 	 */
57 57
 	public static function set_hooks() {
58
-		EE_Config::register_route( EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run' );
59
-		EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' );
60
-		add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 );
58
+		EE_Config::register_route(EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run');
59
+		EE_Config::register_route('event_list', 'Events_Archive', 'event_list');
60
+		add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2);
61 61
 	}
62 62
 
63 63
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 *  @return 	void
68 68
 	 */
69 69
 	public static function set_hooks_admin() {
70
-		add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 );
70
+		add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2);
71 71
 	}
72 72
 
73 73
 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 *  @return 	void
81 81
 	 */
82 82
 	public static function set_definitions() {
83
-		define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
84
-		define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
83
+		define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
84
+		define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
85 85
 	}
86 86
 
87 87
 
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return \EE_Events_Archive_Config
93 93
 	 */
94
-	protected function set_config(){
95
-		$this->set_config_section( 'template_settings' );
96
-		$this->set_config_class( 'EE_Events_Archive_Config' );
97
-		$this->set_config_name( 'EED_Events_Archive' );
94
+	protected function set_config() {
95
+		$this->set_config_section('template_settings');
96
+		$this->set_config_class('EE_Events_Archive_Config');
97
+		$this->set_config_name('EED_Events_Archive');
98 98
 	}
99 99
 
100 100
 
@@ -106,35 +106,35 @@  discard block
 block discarded – undo
106 106
 	 * @param \EE_Events_Archive_Config $config
107 107
 	 * @return \EE_Template_Part_Manager
108 108
 	 */
109
-	public function initialize_template_parts( EE_Events_Archive_Config $config = null ) {
109
+	public function initialize_template_parts(EE_Events_Archive_Config $config = null) {
110 110
 		$config = $config instanceof EE_Events_Archive_Config ? $config : $this->config();
111 111
 		EEH_Autoloader::instance()->register_template_part_autoloaders();
112 112
 		$template_parts = new EE_Template_Part_Manager();
113 113
 		$template_parts->add_template_part(
114 114
 			'tickets',
115
-			__( 'Ticket Selector', 'event_espresso' ),
115
+			__('Ticket Selector', 'event_espresso'),
116 116
 			'content-espresso_events-tickets.php',
117 117
 			$config->display_order_tickets
118 118
 		);
119 119
 		$template_parts->add_template_part(
120 120
 			'datetimes',
121
-			__( 'Dates and Times', 'event_espresso' ),
121
+			__('Dates and Times', 'event_espresso'),
122 122
 			'content-espresso_events-datetimes.php',
123 123
 			$config->display_order_datetimes
124 124
 		);
125 125
 		$template_parts->add_template_part(
126 126
 			'event',
127
-			__( 'Event Description', 'event_espresso' ),
127
+			__('Event Description', 'event_espresso'),
128 128
 			'content-espresso_events-details.php',
129 129
 			$config->display_order_event
130 130
 		);
131 131
 		$template_parts->add_template_part(
132 132
 			'venue',
133
-			__( 'Venue Information', 'event_espresso' ),
133
+			__('Venue Information', 'event_espresso'),
134 134
 			'content-espresso_events-venues.php',
135 135
 			$config->display_order_venue
136 136
 		);
137
-		do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts );
137
+		do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts);
138 138
 		return $template_parts;
139 139
 	}
140 140
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @param WP $WP
148 148
 	 * @return    void
149 149
 	 */
150
-	public function run( $WP ) {
151
-		do_action( 'AHEE__EED_Events_Archive__before_run' );
150
+	public function run($WP) {
151
+		do_action('AHEE__EED_Events_Archive__before_run');
152 152
 		// ensure valid EE_Events_Archive_Config() object exists
153 153
 		$this->set_config();
154 154
 		/** @type EE_Events_Archive_Config $config */
@@ -156,19 +156,19 @@  discard block
 block discarded – undo
156 156
 		// load other required components
157 157
 		$this->load_event_list_assets();
158 158
 		// filter the WP posts_join, posts_where, and posts_orderby SQL clauses
159
-		EE_Registry::instance()->load_helper( 'Event_Query' );
159
+		EE_Registry::instance()->load_helper('Event_Query');
160 160
 		//add query filters
161 161
 		EEH_Event_Query::add_query_filters();
162 162
 		// set params that will get used by the filters
163 163
 		EEH_Event_Query::set_query_params(
164
-			'', 	// month
165
-			'', 	// category
166
-			$config->display_expired_events, 	// show_expired
167
-			'start_date', 	// orderby
164
+			'', // month
165
+			'', // category
166
+			$config->display_expired_events, // show_expired
167
+			'start_date', // orderby
168 168
 			'ASC' 	// sort
169 169
 		);
170 170
 		// check what template is loaded
171
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
171
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
172 172
 	}
173 173
 
174 174
 
@@ -200,30 +200,30 @@  discard block
 block discarded – undo
200 200
 	 * @param string $template
201 201
 	 * @return    string
202 202
 	 */
203
-	public function template_include( $template = '' ) {
203
+	public function template_include($template = '') {
204 204
 		// don't add content filter for dedicated EE child themes or private posts
205
-		EE_Registry::instance()->load_helper( 'Template' );
206
-		if ( ! EEH_Template::is_espresso_theme() ) {
205
+		EE_Registry::instance()->load_helper('Template');
206
+		if ( ! EEH_Template::is_espresso_theme()) {
207 207
 			/** @type EE_Events_Archive_Config $config */
208 208
 			$config = $this->config();
209 209
 			// add status banner ?
210
-			if ( $config->display_status_banner ) {
211
-				add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 );
210
+			if ($config->display_status_banner) {
211
+				add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2);
212 212
 			}
213 213
 			// if NOT a custom template
214
-			if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) {
214
+			if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') {
215 215
 				// don't display entry meta because the existing theme will take care of that
216
-				add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' );
216
+				add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true');
217 217
 				// load functions.php file for the theme (loaded by WP if using child theme)
218 218
 				EEH_Template::load_espresso_theme_functions();
219 219
 				// because we don't know if the theme is using the_excerpt()
220
-				add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
220
+				add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1);
221 221
 				// or the_content
222
-				add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
222
+				add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1);
223 223
 				// and just in case they are running get_the_excerpt() which DESTROYS things
224
-				add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
224
+				add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
225 225
 				// don't display entry meta because the existing theme will take care of that
226
-				add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' );
226
+				add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
227 227
 			}
228 228
 		}
229 229
 		return $template;
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
 	 * 	@param		string 	$excerpt
239 239
 	 * 	@return 		string
240 240
 	 */
241
-	public static function get_the_excerpt( $excerpt = '' ) {
242
-		if ( post_password_required() ) {
241
+	public static function get_the_excerpt($excerpt = '') {
242
+		if (post_password_required()) {
243 243
 			return $excerpt;
244 244
 		}
245
-		if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) {
246
-			remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 );
247
-			remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 );
248
-			$excerpt = EED_Events_Archive::event_details( $excerpt );
245
+		if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) {
246
+			remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100);
247
+			remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100);
248
+			$excerpt = EED_Events_Archive::event_details($excerpt);
249 249
 		} else {
250 250
 			EED_Events_Archive::$using_get_the_excerpt = true;
251
-			add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 );
251
+			add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1);
252 252
 		}
253 253
 		return $excerpt;
254 254
 	}
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @param  string $text
263 263
 	 * @return string
264 264
 	 */
265
-	public static function end_get_the_excerpt( $text = '' ) {
265
+	public static function end_get_the_excerpt($text = '') {
266 266
 		EED_Events_Archive::$using_get_the_excerpt = false;
267 267
 		return $text;
268 268
 	}
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
 	 * @param 		string 		$id
278 278
 	 * @return 		string
279 279
 	 */
280
-	public static function the_title( $title = '', $id = '' ) {
280
+	public static function the_title($title = '', $id = '') {
281 281
 	global $post;
282
-	if ( $post instanceof WP_Post ) {
283
-		return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID  ) . $title :  $title;
282
+	if ($post instanceof WP_Post) {
283
+		return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title;
284 284
 	}
285 285
 	return $title;
286 286
 }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 * 	@param		string 	$content
295 295
 	 * 	@return 		string
296 296
 	 */
297
-	public static function event_details( $content ) {
297
+	public static function event_details($content) {
298 298
 		global $post;
299 299
 		static $current_post_ID = 0;
300 300
 		if (
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 			&& ! EED_Events_Archive::$using_get_the_excerpt
304 304
 			&& ! post_password_required()
305 305
 			&& (
306
-				apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false )
307
-				|| ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false )
306
+				apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false)
307
+				|| ! apply_filters('FHEE__content_espresso_events__template_loaded', false)
308 308
 			)
309 309
 		) {
310 310
 			// Set current post ID to prevent showing content twice, but only if headers have definitely been sent.
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 			// We want to allow those plugins to still do their thing and have access to our content, but depending on
314 314
 			// how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
315 315
 			// so the following allows this filter to be applied multiple times, but only once for real
316
-			$current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0;
317
-			if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) {
316
+			$current_post_ID = did_action('loop_start') ? $post->ID : 0;
317
+			if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) {
318 318
 				$content = \EED_Events_Archive::use_sortable_display_order();
319 319
 			} else {
320 320
 				$content = \EED_Events_Archive::use_filterable_display_order();
@@ -333,20 +333,20 @@  discard block
 block discarded – undo
333 333
 	 */
334 334
 	protected static function use_sortable_display_order() {
335 335
 		// no further password checks required atm
336
-		add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' );
336
+		add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true');
337 337
 		// we need to first remove this callback from being applied to the_content() or the_excerpt() (otherwise it will recurse and blow up the interweb)
338
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 );
339
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 );
340
-		remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
338
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100);
339
+		remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100);
340
+		remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1);
341 341
 		// now add additional content depending on whether event is using the_excerpt() or the_content()
342 342
 		EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts();
343
-		$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
344
-		$content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content );
343
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
344
+		$content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content);
345 345
 		// re-add our main filters (or else the next event won't have them)
346
-		add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
347
-		add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
348
-		add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
349
-		remove_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' );
346
+		add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1);
347
+		add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1);
348
+		add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
349
+		remove_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true');
350 350
 		return $content;
351 351
 	}
352 352
 
@@ -361,22 +361,22 @@  discard block
 block discarded – undo
361 361
 	protected static function use_filterable_display_order() {
362 362
 		// we need to first remove this callback from being applied to the_content()
363 363
 		// (otherwise it will recurse and blow up the interweb)
364
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 );
365
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 );
366
-		remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
364
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100);
365
+		remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100);
366
+		remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1);
367 367
 		//now add additional content depending on whether event is using the_excerpt() or the_content()
368 368
 		EED_Events_Archive::_add_additional_excerpt_filters();
369 369
 		EED_Events_Archive::_add_additional_content_filters();
370
-		do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' );
370
+		do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters');
371 371
 		// now load our template
372
-		$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
372
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
373 373
 		// re-add our main filters (or else the next event won't have them)
374
-		add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
375
-		add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
376
-		add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
374
+		add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1);
375
+		add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1);
376
+		add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
377 377
 		// but remove the other filters so that they don't get applied to the next post
378 378
 		EED_Events_Archive::_remove_additional_events_archive_filters();
379
-		do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' );
379
+		do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters');
380 380
 		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
381 381
 		//return ! empty( $template ) ? $template : $content;
382 382
 		return $content;
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 	 * 	@param		string 	$content
392 392
 	 *  	@return 		string
393 393
 	 */
394
-	public static function event_datetimes( $content ) {
395
-		if ( post_password_required() ) {
394
+	public static function event_datetimes($content) {
395
+		if (post_password_required()) {
396 396
 			return $content;
397 397
 		}
398
-		return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content;
398
+		return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content;
399 399
 	}
400 400
 
401 401
 	/**
@@ -405,11 +405,11 @@  discard block
 block discarded – undo
405 405
 	 * 	@param		string 	$content
406 406
 	 *  	@return 		string
407 407
 	 */
408
-	public static function event_tickets( $content ) {
409
-		if ( post_password_required() ) {
408
+	public static function event_tickets($content) {
409
+		if (post_password_required()) {
410 410
 			return $content;
411 411
 		}
412
-		return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content;
412
+		return EEH_Template::locate_template('content-espresso_events-tickets.php').$content;
413 413
 	}
414 414
 
415 415
 
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 	 * @param    string $content
422 422
 	 * @return    string
423 423
 	 */
424
-	public static function event_venue( $content ) {
425
-		return EED_Events_Archive::event_venues( $content );
424
+	public static function event_venue($content) {
425
+		return EED_Events_Archive::event_venues($content);
426 426
 	}
427 427
 
428 428
 	/**
@@ -432,11 +432,11 @@  discard block
 block discarded – undo
432 432
 	 * 	@param		string 	$content
433 433
 	 *  	@return 		string
434 434
 	 */
435
-	public static function event_venues( $content ) {
436
-		if ( post_password_required() ) {
435
+	public static function event_venues($content) {
436
+		if (post_password_required()) {
437 437
 			return $content;
438 438
 		}
439
-		return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' );
439
+		return $content.EEH_Template::locate_template('content-espresso_events-venues.php');
440 440
 	}
441 441
 
442 442
 
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
 	 * @return        void
449 449
 	 */
450 450
 	private static function _add_additional_excerpt_filters() {
451
-		add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 );
452
-		add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 );
453
-		add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 );
451
+		add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1);
452
+		add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1);
453
+		add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1);
454 454
 	}
455 455
 
456 456
 
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
 	 * @return        void
463 463
 	 */
464 464
 	private static function _add_additional_content_filters() {
465
-		add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 );
466
-		add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 );
467
-		add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 );
465
+		add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1);
466
+		add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1);
467
+		add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1);
468 468
 	}
469 469
 
470 470
 
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
 	 * @return        void
477 477
 	 */
478 478
 	private static function _remove_additional_events_archive_filters() {
479
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 );
480
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 );
481
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 );
482
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 );
483
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 );
484
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 );
479
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110);
480
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120);
481
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130);
482
+		remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110);
483
+		remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120);
484
+		remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130);
485 485
 	}
486 486
 
487 487
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 	 */
495 495
 	public static function remove_all_events_archive_filters() {
496 496
 		//remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
497
-		remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100 );
498
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 );
499
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 );
500
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 );
501
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 );
502
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 );
503
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 );
504
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 );
505
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 );
497
+		remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100);
498
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100);
499
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110);
500
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120);
501
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130);
502
+		remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100);
503
+		remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110);
504
+		remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120);
505
+		remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130);
506 506
 		// don't display entry meta because the existing theme will take care of that
507
-		remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' );
507
+		remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
508 508
 	}
509 509
 
510 510
 
@@ -519,15 +519,15 @@  discard block
 block discarded – undo
519 519
 	 *  @return 	void
520 520
 	 */
521 521
 	public function load_event_list_assets() {
522
-		do_action( 'AHEE__EED_Events_Archive__before_load_assets' );
523
-		add_filter( 'FHEE_load_EE_Session', '__return_true' );
524
-		add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
525
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
526
-		if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
527
-			EE_Registry::instance()->load_helper( 'Maps' );
528
-			add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 );
522
+		do_action('AHEE__EED_Events_Archive__before_load_assets');
523
+		add_filter('FHEE_load_EE_Session', '__return_true');
524
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
525
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
526
+		if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
527
+			EE_Registry::instance()->load_helper('Maps');
528
+			add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
529 529
 		}
530
-		EE_Registry::instance()->load_helper( 'Event_View' );
530
+		EE_Registry::instance()->load_helper('Event_View');
531 531
 	}
532 532
 
533 533
 
@@ -543,14 +543,14 @@  discard block
 block discarded – undo
543 543
 	 */
544 544
 	public function wp_enqueue_scripts() {
545 545
 		// get some style
546
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) {
546
+		if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) {
547 547
 			// first check uploads folder
548
-			EE_Registry::instance()->load_helper( 'File' );
549
-			if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
550
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ));
548
+			EE_Registry::instance()->load_helper('File');
549
+			if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
550
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
551 551
 			} else {
552 552
 		}
553
-		wp_enqueue_style( $this->theme );
553
+		wp_enqueue_style($this->theme);
554 554
 
555 555
 	}
556 556
 }
@@ -568,8 +568,8 @@  discard block
 block discarded – undo
568 568
 	 */
569 569
 	public static function template_settings_form() {
570 570
 	$template_settings = EE_Registry::instance()->CFG->template_settings;
571
-	$template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
572
-	$template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive );
571
+	$template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
572
+	$template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive);
573 573
 	$events_archive_settings = array(
574 574
 		'display_status_banner' => 0,
575 575
 		'display_description' => 1,
@@ -578,8 +578,8 @@  discard block
 block discarded – undo
578 578
 		'display_venue' => 0,
579 579
 		'display_expired_events' => 0
580 580
 	);
581
-	$events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive );
582
-	EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings );
581
+	$events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive);
582
+	EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings);
583 583
 }
584 584
 
585 585
 
@@ -595,16 +595,16 @@  discard block
 block discarded – undo
595 595
 	 *  @param 	EE_Request_Handler $REQ
596 596
 	 *  @return 	EE_Template_Config
597 597
 	 */
598
-	public static function update_template_settings( $CFG, $REQ ) {
598
+	public static function update_template_settings($CFG, $REQ) {
599 599
 		$CFG->EED_Events_Archive = new EE_Events_Archive_Config();
600 600
 		// unless we are resetting the config...
601
-		if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) {
602
-			$CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0;
603
-			$CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1;
604
-			$CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0;
605
-			$CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1;
606
-			$CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0;
607
-			$CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0;			}
601
+		if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) {
602
+			$CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0;
603
+			$CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1;
604
+			$CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0;
605
+			$CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1;
606
+			$CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0;
607
+			$CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; }
608 608
 		return $CFG;
609 609
 	}
610 610
 
@@ -617,10 +617,10 @@  discard block
 block discarded – undo
617 617
 	 * @param string $extra_class
618 618
 	 * @return    string
619 619
 	 */
620
-	public static function event_list_css( $extra_class = '' ) {
621
-		$event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array();
620
+	public static function event_list_css($extra_class = '') {
621
+		$event_list_css = ! empty($extra_class) ? array($extra_class) : array();
622 622
 		$event_list_css[] = 'espresso-event-list-event';
623
-		return implode( ' ', $event_list_css );
623
+		return implode(' ', $event_list_css);
624 624
 	}
625 625
 
626 626
 
@@ -647,9 +647,9 @@  discard block
 block discarded – undo
647 647
 	 * @param $value
648 648
 	 * @return    bool
649 649
 	 */
650
-	public static function display_description( $value ) {
650
+	public static function display_description($value) {
651 651
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
652
-		$display_description= isset( $config->display_description ) ? $config->display_description : 1;
652
+		$display_description = isset($config->display_description) ? $config->display_description : 1;
653 653
 		return $display_description === $value ? TRUE : FALSE;
654 654
 	}
655 655
 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	 */
663 663
 	public static function display_ticket_selector() {
664 664
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
665
-		return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE;
665
+		return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE;
666 666
 	}
667 667
 
668 668
 
@@ -674,9 +674,9 @@  discard block
 block discarded – undo
674 674
 	 *  @return 	bool
675 675
 	 */
676 676
 	public static function display_venue() {
677
-		EE_Registry::instance()->load_helper( 'Venue_View' );
677
+		EE_Registry::instance()->load_helper('Venue_View');
678 678
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
679
-		return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE;
679
+		return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE;
680 680
 	}
681 681
 
682 682
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 */
689 689
 	public static function display_datetimes() {
690 690
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
691
-		return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE;
691
+		return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE;
692 692
 }
693 693
 
694 694
 
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	 *  @return 	string
704 704
 	 */
705 705
 	public static function event_list_title() {
706
-		return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' ));
706
+		return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso'));
707 707
 	}
708 708
 
709 709
 
@@ -712,11 +712,11 @@  discard block
 block discarded – undo
712 712
 	/**
713 713
 	 * 	@since 4.4.0
714 714
 	 */
715
-	public static function _doing_it_wrong_notice( $function = '' ) {
715
+	public static function _doing_it_wrong_notice($function = '') {
716 716
 		EE_Error::doing_it_wrong(
717 717
 			__FUNCTION__,
718 718
 			sprintf(
719
-				__( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ),
719
+				__('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'),
720 720
 				$function,
721 721
 				'<br />',
722 722
 				'4.6.0'
@@ -732,107 +732,107 @@  discard block
 block discarded – undo
732 732
 	 * 	@since 4.4.0
733 733
 	 */
734 734
 	public function get_post_data() {
735
-		EE_Registry::instance()->load_helper( 'Event_Query' );
735
+		EE_Registry::instance()->load_helper('Event_Query');
736 736
 		EEH_Event_Query::set_query_params();
737 737
 	}
738 738
 	/**
739 739
 	 * 	@deprecated
740 740
 	 * 	@since 4.4.0
741 741
 	 */
742
-	public function posts_fields( $SQL, WP_Query $wp_query ) {
743
-		EE_Registry::instance()->load_helper( 'Event_Query' );
744
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
745
-		return EEH_Event_Query::posts_fields( $SQL, $wp_query );
742
+	public function posts_fields($SQL, WP_Query $wp_query) {
743
+		EE_Registry::instance()->load_helper('Event_Query');
744
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
745
+		return EEH_Event_Query::posts_fields($SQL, $wp_query);
746 746
 	}
747 747
 	/**
748 748
 	 * 	@deprecated
749 749
 	 * 	@since 4.4.0
750 750
 	 */
751
-	public static function posts_fields_sql_for_orderby( $orderby_params = array() ) {
752
-		EE_Registry::instance()->load_helper( 'Event_Query' );
753
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
754
-		return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params );
751
+	public static function posts_fields_sql_for_orderby($orderby_params = array()) {
752
+		EE_Registry::instance()->load_helper('Event_Query');
753
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
754
+		return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params);
755 755
 	}
756 756
 	/**
757 757
 	 * 	@deprecated
758 758
 	 * 	@since 4.4.0
759 759
 	 */
760
-	public function posts_join( $SQL, WP_Query $wp_query ) {
761
-		EE_Registry::instance()->load_helper( 'Event_Query' );
762
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
763
-		return EEH_Event_Query::posts_join( $SQL, $wp_query );
760
+	public function posts_join($SQL, WP_Query $wp_query) {
761
+		EE_Registry::instance()->load_helper('Event_Query');
762
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
763
+		return EEH_Event_Query::posts_join($SQL, $wp_query);
764 764
 	}
765 765
 	/**
766 766
 	 * 	@deprecated
767 767
 	 * 	@since 4.4.0
768 768
 	 */
769
-	public static function posts_join_sql_for_terms( $join_terms = NULL ) {
770
-		EE_Registry::instance()->load_helper( 'Event_Query' );
771
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
772
-		return EEH_Event_Query::posts_join_sql_for_terms( $join_terms );
769
+	public static function posts_join_sql_for_terms($join_terms = NULL) {
770
+		EE_Registry::instance()->load_helper('Event_Query');
771
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
772
+		return EEH_Event_Query::posts_join_sql_for_terms($join_terms);
773 773
 	}
774 774
 	/**
775 775
 	 * 	@deprecated
776 776
 	 * 	@since 4.4.0
777 777
 	 */
778
-	public static function posts_join_for_orderby( $orderby_params = array() ) {
779
-		EE_Registry::instance()->load_helper( 'Event_Query' );
780
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
781
-		return EEH_Event_Query::posts_join_for_orderby( $orderby_params );
778
+	public static function posts_join_for_orderby($orderby_params = array()) {
779
+		EE_Registry::instance()->load_helper('Event_Query');
780
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
781
+		return EEH_Event_Query::posts_join_for_orderby($orderby_params);
782 782
 	}
783 783
 	/**
784 784
 	 * 	@deprecated
785 785
 	 * 	@since 4.4.0
786 786
 	 */
787
-	public function posts_where( $SQL, WP_Query $wp_query ) {
788
-		EE_Registry::instance()->load_helper( 'Event_Query' );
789
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
790
-		return EEH_Event_Query::posts_where( $SQL, $wp_query );
787
+	public function posts_where($SQL, WP_Query $wp_query) {
788
+		EE_Registry::instance()->load_helper('Event_Query');
789
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
790
+		return EEH_Event_Query::posts_where($SQL, $wp_query);
791 791
 	}
792 792
 	/**
793 793
 	 * 	@deprecated
794 794
 	 * 	@since 4.4.0
795 795
 	 */
796
-	public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) {
797
-		EE_Registry::instance()->load_helper( 'Event_Query' );
798
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
799
-		return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired );
796
+	public static function posts_where_sql_for_show_expired($show_expired = FALSE) {
797
+		EE_Registry::instance()->load_helper('Event_Query');
798
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
799
+		return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired);
800 800
 	}
801 801
 	/**
802 802
 	 * 	@deprecated
803 803
 	 * 	@since 4.4.0
804 804
 	 */
805
-	public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) {
806
-		EE_Registry::instance()->load_helper( 'Event_Query' );
807
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
808
-		return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug );
805
+	public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) {
806
+		EE_Registry::instance()->load_helper('Event_Query');
807
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
808
+		return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug);
809 809
 	}
810 810
 	/**
811 811
 	 * 	@deprecated
812 812
 	 * 	@since 4.4.0
813 813
 	 */
814
-	public static function posts_where_sql_for_event_list_month( $month = NULL ) {
815
-		EE_Registry::instance()->load_helper( 'Event_Query' );
816
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
817
-		return EEH_Event_Query::posts_where_sql_for_event_list_month( $month );
814
+	public static function posts_where_sql_for_event_list_month($month = NULL) {
815
+		EE_Registry::instance()->load_helper('Event_Query');
816
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
817
+		return EEH_Event_Query::posts_where_sql_for_event_list_month($month);
818 818
 	}
819 819
 	/**
820 820
 	 * 	@deprecated
821 821
 	 * 	@since 4.4.0
822 822
 	 */
823
-	public function posts_orderby( $SQL, WP_Query $wp_query ) {
824
-		EE_Registry::instance()->load_helper( 'Event_Query' );
825
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
826
-		return EEH_Event_Query::posts_orderby( $SQL, $wp_query );
823
+	public function posts_orderby($SQL, WP_Query $wp_query) {
824
+		EE_Registry::instance()->load_helper('Event_Query');
825
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
826
+		return EEH_Event_Query::posts_orderby($SQL, $wp_query);
827 827
 	}
828 828
 	/**
829 829
 	 * 	@deprecated
830 830
 	 * 	@since 4.4.0
831 831
 	 */
832
-	public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) {
833
-		EE_Registry::instance()->load_helper( 'Event_Query' );
834
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
835
-		return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort );
832
+	public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') {
833
+		EE_Registry::instance()->load_helper('Event_Query');
834
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
835
+		return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort);
836 836
 	}
837 837
 
838 838
 
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
  * @param string $extra_class
864 864
  * @return string
865 865
  */
866
-function espresso_event_list_css( $extra_class = '' ) {
867
-	return EED_Events_Archive::event_list_css( $extra_class );
866
+function espresso_event_list_css($extra_class = '') {
867
+	return EED_Events_Archive::event_list_css($extra_class);
868 868
 }
869 869
 
870 870
 /**
@@ -878,14 +878,14 @@  discard block
 block discarded – undo
878 878
  * @return bool
879 879
  */
880 880
 function espresso_display_full_description_in_event_list() {
881
-	return EED_Events_Archive::display_description( 2 );
881
+	return EED_Events_Archive::display_description(2);
882 882
 }
883 883
 
884 884
 /**
885 885
  * @return bool
886 886
  */
887 887
 function espresso_display_excerpt_in_event_list() {
888
-	return EED_Events_Archive::display_description( 1 );
888
+	return EED_Events_Archive::display_description(1);
889 889
 }
890 890
 
891 891
 /**
Please login to merge, or discard this patch.
core/db_models/EEM_Transaction.model.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * Transaction Model
@@ -68,36 +68,36 @@  discard block
 block discarded – undo
68 68
 	 * 		Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
69 69
 	 *	@return EEM_Transaction
70 70
 	 */
71
-	protected function __construct( $timezone ) {
72
-		$this->singular_item = __('Transaction','event_espresso');
73
-		$this->plural_item = __('Transactions','event_espresso');
71
+	protected function __construct($timezone) {
72
+		$this->singular_item = __('Transaction', 'event_espresso');
73
+		$this->plural_item = __('Transactions', 'event_espresso');
74 74
 
75 75
 		$this->_tables = array(
76
-			'Transaction'=>new EE_Primary_Table('esp_transaction','TXN_ID')
76
+			'Transaction'=>new EE_Primary_Table('esp_transaction', 'TXN_ID')
77 77
 		);
78 78
 		$this->_fields = array(
79 79
 			'Transaction'=>array(
80
-				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')),
81
-				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, time(), $timezone ),
82
-				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0),
83
-				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0),
84
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
85
-				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''),
86
-				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''),
80
+				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')),
81
+				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, time(), $timezone),
82
+				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0),
83
+				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0),
84
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
85
+				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''),
86
+				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''),
87 87
 				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'),
88
-				'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ),
88
+				'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()),
89 89
 			)
90 90
 		);
91 91
 		$this->_model_relations = array(
92 92
 			'Registration'=>new EE_Has_Many_Relation(),
93 93
 			'Payment'=>new EE_Has_Many_Relation(),
94 94
 			'Status'=>new EE_Belongs_To_Relation(),
95
-			'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items
95
+			'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items
96 96
 			'Payment_Method'=>new EE_Belongs_To_Relation(),
97 97
 			'Message' => new EE_Has_Many_Relation()
98 98
 		);
99 99
 		$this->_model_chain_to_wp_user = 'Registration.Event';
100
-		parent::__construct( $timezone );
100
+		parent::__construct($timezone);
101 101
 
102 102
 	}
103 103
 
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 	 * @param string $period
109 109
 	 * @return \stdClass[]
110 110
 	 */
111
-	public function get_revenue_per_day_report( $period = '-1 month' ) {
111
+	public function get_revenue_per_day_report($period = '-1 month') {
112 112
 
113
-		$sql_date = $this->convert_datetime_for_query( 'TXN_timestamp', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' );
113
+		$sql_date = $this->convert_datetime_for_query('TXN_timestamp', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC');
114 114
 		$results = $this->_get_all_wpdb_results(
115 115
 			array(
116 116
 				array(
117 117
 					'TXN_timestamp' => array('>=', $sql_date)),
118 118
 				'group_by' => 'txnDate',
119
-				'order_by' => array('TXN_timestamp' => 'DESC' )
119
+				'order_by' => array('TXN_timestamp' => 'DESC')
120 120
 			),
121 121
 			OBJECT,
122 122
 			array(
123
-				'txnDate' => array('DATE(Transaction.TXN_timestamp)','%s'),
123
+				'txnDate' => array('DATE(Transaction.TXN_timestamp)', '%s'),
124 124
 				'revenue' => array('SUM(Transaction.TXN_paid)', '%d')
125 125
 			));
126 126
 		return $results;
@@ -136,22 +136,22 @@  discard block
 block discarded – undo
136 136
 	 * @throws \EE_Error
137 137
 	 * @return mixed
138 138
 	 */
139
-	public function get_revenue_per_event_report( $period = 'month' ) {
139
+	public function get_revenue_per_event_report($period = 'month') {
140 140
 		/** @type WPDB $wpdb */
141 141
 		global $wpdb;
142
-		$date_mod = strtotime( '-1 ' . $period );
142
+		$date_mod = strtotime('-1 '.$period);
143 143
 
144 144
 		$SQL = 'SELECT post_title as event_name, SUM(TXN_paid) AS revenue';
145
-		$SQL .= ' FROM ' . $this->_get_main_table()->get_table_name() . ' txn';
146
-		$SQL .= ' LEFT JOIN ' . $wpdb->prefix . 'esp_registration reg ON reg.TXN_ID = txn.TXN_ID';
147
-		$SQL .= ' LEFT JOIN ' . $wpdb->posts . ' evt ON evt.ID = reg.EVT_ID';
145
+		$SQL .= ' FROM '.$this->_get_main_table()->get_table_name().' txn';
146
+		$SQL .= ' LEFT JOIN '.$wpdb->prefix.'esp_registration reg ON reg.TXN_ID = txn.TXN_ID';
147
+		$SQL .= ' LEFT JOIN '.$wpdb->posts.' evt ON evt.ID = reg.EVT_ID';
148 148
 		$SQL .= ' WHERE REG_count = 1';
149 149
 		$SQL .= ' AND REG_date >= %d';
150 150
 		$SQL .= ' GROUP BY event_name';
151 151
 		$SQL .= ' ORDER BY event_name';
152 152
 		$SQL .= ' LIMIT 0, 24';
153 153
 
154
-		return $this->_do_wpdb_query( 'get_results', array(  $wpdb->prepare( $SQL, $date_mod ) ) );
154
+		return $this->_do_wpdb_query('get_results', array($wpdb->prepare($SQL, $date_mod)));
155 155
 
156 156
 	}
157 157
 
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 	 * @param string $reg_url_link
168 168
 	 * @return EE_Transaction
169 169
 	 */
170
-	public function get_transaction_from_reg_url_link( $reg_url_link = '' ){
171
-		return $this->get_one( array(
170
+	public function get_transaction_from_reg_url_link($reg_url_link = '') {
171
+		return $this->get_one(array(
172 172
 			array(
173
-				'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' )
173
+				'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '')
174 174
 			)
175 175
 		));
176 176
 	}
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
 	 * @param boolean $save_txn whether or not to save the transaction during this function call
191 191
 	 * @return boolean
192 192
 	 */
193
-	public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){
193
+	public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) {
194 194
 		EE_Error::doing_it_wrong(
195
-			__CLASS__ . '::' . __FUNCTION__,
196
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
195
+			__CLASS__.'::'.__FUNCTION__,
196
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
197 197
 			'4.6.0'
198 198
 		);
199 199
 		/** @type EE_Transaction_Processor $transaction_processor */
200
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
201
-		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this->ensure_is_obj( $transaction_obj_or_id ));
200
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
201
+		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this->ensure_is_obj($transaction_obj_or_id));
202 202
 	}
203 203
 
204 204
 	/**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			array(
230 230
 				0 => array(
231 231
 					'STS_ID' => EEM_Transaction::failed_status_code,
232
-					'TXN_timestamp' => array( '<', time() - $time_to_leave_alone )
232
+					'TXN_timestamp' => array('<', time() - $time_to_leave_alone)
233 233
 				)
234 234
 			),
235 235
 			$time_to_leave_alone
@@ -242,26 +242,26 @@  discard block
 block discarded – undo
242 242
 		 */
243 243
 		$txn_ids = apply_filters(
244 244
 			'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete',
245
-			EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ),
245
+			EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'),
246 246
 			$time_to_leave_alone
247 247
 		);
248 248
 
249 249
 		//now that we have the ids to delete, let's get deletin'
250 250
 		//Why no wpdb->prepare?  Because the data is trusted.  We got the ids from the original query to get them FROM
251 251
 		//the db (which is sanitized) so no need to prepare them again.
252
-		if ( $txn_ids ) {
253
-			$query   = '
252
+		if ($txn_ids) {
253
+			$query = '
254 254
 				DELETE
255
-				FROM ' . $this->table() . '
255
+				FROM ' . $this->table().'
256 256
 				WHERE
257
-					TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')';
258
-			$deleted = $wpdb->query( $query );
257
+					TXN_ID IN ( ' . implode(",", $txn_ids).')';
258
+			$deleted = $wpdb->query($query);
259 259
 		}
260
-		if ( $deleted ) {
260
+		if ($deleted) {
261 261
 			/**
262 262
 			 * Allows code to do something after the transactions have been deleted.
263 263
 			 */
264
-			do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids );
264
+			do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids);
265 265
 		}
266 266
 		return $deleted;
267 267
 	}
Please login to merge, or discard this patch.
core/db_models/fields/EE_Post_Content_Field.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 block discarded – undo
3 3
  * Field to only allow tags that are normally allowed on post_content:
4 4
  * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var
5 5
  */
6
-class EE_Post_Content_Field extends EE_Full_HTML_Field{
6
+class EE_Post_Content_Field extends EE_Full_HTML_Field {
7 7
 	/**
8 8
 	 * removes all tags which a WP Post wouldn't allow in its content normally
9 9
 	 * @param string $value_inputted_for_field_on_model_object
10 10
 	 * @return string
11 11
 	 */
12 12
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
13
-		$value_with_select_tags =  wp_kses("$value_inputted_for_field_on_model_object",wp_kses_allowed_html( 'post' ));
13
+		$value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object", wp_kses_allowed_html('post'));
14 14
 		return parent::prepare_for_set($value_with_select_tags);
15 15
 	}
16 16
 	
17
-	function prepare_for_set_from_db($value_found_in_db_for_model_object){
17
+	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
18 18
 		return $value_found_in_db_for_model_object;
19 19
 	}
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlerBaseClasses/JobHandler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Class EE_Line_Item_Filter_Collection
Please login to merge, or discard this patch.
core/EE_Capabilities.core.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * @package Event Espresso
8 8
  * @subpackage core, capabilities
9 9
  */
10
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
11
-	exit( 'No direct script access allowed' );
10
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
11
+	exit('No direct script access allowed');
12 12
 }
13 13
 
14 14
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function instance() {
71 71
 		//check if instantiated, and if not do so.
72
-		if ( ! self::$_instance instanceof EE_Capabilities ) {
72
+		if ( ! self::$_instance instanceof EE_Capabilities) {
73 73
 			self::$_instance = new self();
74 74
 		}
75 75
 		return self::$_instance;
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 	 * @since 4.5.0
99 99
 	 * @return void
100 100
 	 */
101
-	public function init_caps( $reset = false ) {
102
-		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
101
+	public function init_caps($reset = false) {
102
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
103 103
 			$this->_caps_map = $this->_init_caps_map();
104
-			$this->init_role_caps( $reset );
104
+			$this->init_role_caps($reset);
105 105
 			$this->_set_meta_caps();
106 106
 		}
107 107
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 		//make sure we're only ever initializing the default _meta_caps array once if it's empty.
121 121
 		$this->_meta_caps = $this->_get_default_meta_caps_array();
122 122
 
123
-		$this->_meta_caps = apply_filters( 'FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps );
123
+		$this->_meta_caps = apply_filters('FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps);
124 124
 
125 125
 		//add filter for map_meta_caps but only if models can query.
126
-		if ( EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ) ) ) {
127
-			add_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10, 4 );
126
+		if (EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter('map_meta_cap', array($this, 'map_meta_caps'))) {
127
+			add_filter('map_meta_cap', array($this, 'map_meta_caps'), 10, 4);
128 128
 		}
129 129
 	}
130 130
 
@@ -137,37 +137,37 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	private function _get_default_meta_caps_array() {
139 139
 		static $default_meta_caps = array();
140
-		if ( empty( $default_meta_caps ) ) {
140
+		if (empty($default_meta_caps)) {
141 141
 			$default_meta_caps = array(
142 142
 				//edits
143
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_event', array( 'Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events' ) ),
144
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_venue', array( 'Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues' ) ),
145
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_registration', array( 'Registration', '', 'ee_edit_others_registrations', '' ) ),
146
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_checkin', array( 'Registration', '', 'ee_edit_others_checkins', '' ) ),
147
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_edit_message', array( 'Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages' ) ),
148
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_default_ticket', array( 'Ticket', '', 'ee_edit_others_default_tickets', '' ) ),
149
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question', array( 'Question', '', '', 'ee_edit_system_questions' ) ),
150
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question_group', array( 'Question_Group', '', '', 'ee_edit_system_question_groups' ) ),
151
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_payment_method', array( 'Payment_Method', '', 'ee_edit_others_payment_methods', '' ) ),
143
+				new EE_Meta_Capability_Map_Edit('ee_edit_event', array('Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events')),
144
+				new EE_Meta_Capability_Map_Edit('ee_edit_venue', array('Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues')),
145
+				new EE_Meta_Capability_Map_Edit('ee_edit_registration', array('Registration', '', 'ee_edit_others_registrations', '')),
146
+				new EE_Meta_Capability_Map_Edit('ee_edit_checkin', array('Registration', '', 'ee_edit_others_checkins', '')),
147
+				new EE_Meta_Capability_Map_Messages_Cap('ee_edit_message', array('Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages')),
148
+				new EE_Meta_Capability_Map_Edit('ee_edit_default_ticket', array('Ticket', '', 'ee_edit_others_default_tickets', '')),
149
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question', array('Question', '', '', 'ee_edit_system_questions')),
150
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question_group', array('Question_Group', '', '', 'ee_edit_system_question_groups')),
151
+				new EE_Meta_Capability_Map_Edit('ee_edit_payment_method', array('Payment_Method', '', 'ee_edit_others_payment_methods', '')),
152 152
 				//reads
153
-				new EE_Meta_Capability_Map_Read( 'ee_read_event', array( 'Event', '', 'ee_read_others_events', 'ee_read_private_events' ) ),
154
-				new EE_Meta_Capability_Map_Read( 'ee_read_venue', array( 'Venue', '', 'ee_read_others_venues', 'ee_read_private_venues' ) ),
155
-				new EE_Meta_Capability_Map_Read( 'ee_read_registration', array( 'Registration', '', '', 'ee_edit_others_registrations' ) ),
156
-				new EE_Meta_Capability_Map_Read( 'ee_read_checkin', array( 'Registration', '', '', 'ee_read_others_checkins' ) ),
157
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_read_message', array( 'Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages' ) ),
158
-				new EE_Meta_Capability_Map_Read( 'ee_read_default_ticket', array( 'Ticket', '', '', 'ee_read_others_default_tickets' ) ),
159
-				new EE_Meta_Capability_Map_Read( 'ee_read_payment_method', array( 'Payment_Method', '', '', 'ee_read_others_payment_methods' ) ),
153
+				new EE_Meta_Capability_Map_Read('ee_read_event', array('Event', '', 'ee_read_others_events', 'ee_read_private_events')),
154
+				new EE_Meta_Capability_Map_Read('ee_read_venue', array('Venue', '', 'ee_read_others_venues', 'ee_read_private_venues')),
155
+				new EE_Meta_Capability_Map_Read('ee_read_registration', array('Registration', '', '', 'ee_edit_others_registrations')),
156
+				new EE_Meta_Capability_Map_Read('ee_read_checkin', array('Registration', '', '', 'ee_read_others_checkins')),
157
+				new EE_Meta_Capability_Map_Messages_Cap('ee_read_message', array('Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages')),
158
+				new EE_Meta_Capability_Map_Read('ee_read_default_ticket', array('Ticket', '', '', 'ee_read_others_default_tickets')),
159
+				new EE_Meta_Capability_Map_Read('ee_read_payment_method', array('Payment_Method', '', '', 'ee_read_others_payment_methods')),
160 160
 
161 161
 				//deletes
162
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_event', array( 'Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events' ) ),
163
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_venue', array( 'Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues' ) ),
164
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_registration', array( 'Registration', '', 'ee_delete_others_registrations', '' ) ),
165
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_checkin', array( 'Registration', '', 'ee_delete_others_checkins', '' ) ),
166
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_delete_message', array( 'Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages' ) ),
167
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_default_ticket', array( 'Ticket', '', 'ee_delete_others_default_tickets', '' ) ),
168
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question', array( 'Question', '', '', 'delete_system_questions' ) ),
169
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question_group', array( 'Question_Group', '', '', 'delete_system_question_groups' ) ),
170
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_payment_method', array( 'Payment_Method', '', 'ee_delete_others_payment_methods', '' ) ),
162
+				new EE_Meta_Capability_Map_Delete('ee_delete_event', array('Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events')),
163
+				new EE_Meta_Capability_Map_Delete('ee_delete_venue', array('Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues')),
164
+				new EE_Meta_Capability_Map_Delete('ee_delete_registration', array('Registration', '', 'ee_delete_others_registrations', '')),
165
+				new EE_Meta_Capability_Map_Delete('ee_delete_checkin', array('Registration', '', 'ee_delete_others_checkins', '')),
166
+				new EE_Meta_Capability_Map_Messages_Cap('ee_delete_message', array('Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages')),
167
+				new EE_Meta_Capability_Map_Delete('ee_delete_default_ticket', array('Ticket', '', 'ee_delete_others_default_tickets', '')),
168
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question', array('Question', '', '', 'delete_system_questions')),
169
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question_group', array('Question_Group', '', '', 'delete_system_question_groups')),
170
+				new EE_Meta_Capability_Map_Delete('ee_delete_payment_method', array('Payment_Method', '', 'ee_delete_others_payment_methods', '')),
171 171
 			);
172 172
 		}
173 173
 		return $default_meta_caps;
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return array   actual users capabilities
193 193
 	 */
194
-	public function map_meta_caps( $caps, $cap, $user_id, $args ) {
194
+	public function map_meta_caps($caps, $cap, $user_id, $args) {
195 195
 		//loop through our _meta_caps array
196
-		foreach ( $this->_meta_caps as $meta_map ) {
197
-			if ( ! $meta_map instanceof EE_Meta_Capability_Map ) {
196
+		foreach ($this->_meta_caps as $meta_map) {
197
+			if ( ! $meta_map instanceof EE_Meta_Capability_Map) {
198 198
 				continue;
199 199
 			}
200 200
 			$meta_map->ensure_is_model();
201 201
 
202
-			$caps = $meta_map->map_meta_caps( $caps, $cap, $user_id, $args );
202
+			$caps = $meta_map->map_meta_caps($caps, $cap, $user_id, $args);
203 203
 		}
204 204
 		return $caps;
205 205
 	}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 				)
365 365
 			);
366 366
 
367
-		$caps = apply_filters( 'FHEE__EE_Capabilities__init_caps_map__caps', $caps );
367
+		$caps = apply_filters('FHEE__EE_Capabilities__init_caps_map__caps', $caps);
368 368
 		return $caps;
369 369
 	}
370 370
 
@@ -381,26 +381,26 @@  discard block
 block discarded – undo
381 381
 	 *
382 382
 	 * @return void
383 383
 	 */
384
-	public function init_role_caps( $reset = false, $custom_map = array() ) {
384
+	public function init_role_caps($reset = false, $custom_map = array()) {
385 385
 
386
-		$caps_map = empty( $custom_map ) ? $this->_caps_map : $custom_map;
386
+		$caps_map = empty($custom_map) ? $this->_caps_map : $custom_map;
387 387
 
388 388
 		//first let's determine if these caps have already been set.
389
-		$caps_set_before = get_option( self::option_name, array() );
389
+		$caps_set_before = get_option(self::option_name, array());
390 390
 		//if not reset, see what caps are new for each role. if they're new, add them.
391
-		foreach ( $caps_map as $role => $caps_for_role ) {
392
-			foreach ( $caps_for_role as $cap ) {
391
+		foreach ($caps_map as $role => $caps_for_role) {
392
+			foreach ($caps_for_role as $cap) {
393 393
 				//first check we haven't already added this cap before, or it's a reset
394
-				if ( $reset || ! isset( $caps_set_before[ $role ] ) || ! in_array( $cap, $caps_set_before[ $role ] ) ) {
395
-					$this->add_cap_to_role( $role, $cap );
396
-					$caps_set_before[ $role ][] = $cap;
394
+				if ($reset || ! isset($caps_set_before[$role]) || ! in_array($cap, $caps_set_before[$role])) {
395
+					$this->add_cap_to_role($role, $cap);
396
+					$caps_set_before[$role][] = $cap;
397 397
 				}
398 398
 			}
399 399
 		}
400 400
 
401 401
 		//now let's just save the cap that has been set.
402
-		update_option( self::option_name, $caps_set_before );
403
-		do_action( 'AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before );
402
+		update_option(self::option_name, $caps_set_before);
403
+		do_action('AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before);
404 404
 	}
405 405
 
406 406
 
@@ -419,10 +419,10 @@  discard block
 block discarded – undo
419 419
 	 * @param bool $grant  Whether to grant access to this cap on this role.
420 420
 	 * @return void
421 421
 	 */
422
-	public function add_cap_to_role( $role, $cap, $grant = true ) {
423
-		$role = get_role( $role );
424
-		if ( $role instanceof WP_Role ) {
425
-			$role->add_cap( $cap, $grant );
422
+	public function add_cap_to_role($role, $cap, $grant = true) {
423
+		$role = get_role($role);
424
+		if ($role instanceof WP_Role) {
425
+			$role->add_cap($cap, $grant);
426 426
 		}
427 427
 	}
428 428
 
@@ -442,10 +442,10 @@  discard block
 block discarded – undo
442 442
 	 *
443 443
 	 * @return void
444 444
 	 */
445
-	public function remove_cap_from_role( $role, $cap ) {
446
-		$role = get_role( $role );
447
-		if ( $role instanceof WP_Role ) {
448
-			$role->remove_cap( $cap );
445
+	public function remove_cap_from_role($role, $cap) {
446
+		$role = get_role($role);
447
+		if ($role instanceof WP_Role) {
448
+			$role->remove_cap($cap);
449 449
 		}
450 450
 	}
451 451
 
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @return bool  Whether user can or not.
468 468
 	 */
469
-	public function current_user_can( $cap, $context, $id = 0 ) {
469
+	public function current_user_can($cap, $context, $id = 0) {
470 470
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
471
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap__' . $context,  $cap, $id );
472
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id );
473
-		return ! empty( $id ) ? current_user_can( $filtered_cap, $id ) : current_user_can( $filtered_cap );
471
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap__'.$context, $cap, $id);
472
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id);
473
+		return ! empty($id) ? current_user_can($filtered_cap, $id) : current_user_can($filtered_cap);
474 474
 	}
475 475
 
476 476
 
@@ -487,11 +487,11 @@  discard block
 block discarded – undo
487 487
 	 *
488 488
 	 * @return bool Whether user can or not.
489 489
 	 */
490
-	public function user_can( $user, $cap, $context, $id = 0 ) {
490
+	public function user_can($user, $cap, $context, $id = 0) {
491 491
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
492
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap__' . $context, $cap, $user, $id );
493
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user,  $id );
494
-		return ! empty( $id ) ? user_can( $user, $filtered_cap, $id ) : user_can( $user, $filtered_cap );
492
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap__'.$context, $cap, $user, $id);
493
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user, $id);
494
+		return ! empty($id) ? user_can($user, $filtered_cap, $id) : user_can($user, $filtered_cap);
495 495
 	}
496 496
 
497 497
 
@@ -511,12 +511,12 @@  discard block
 block discarded – undo
511 511
 	 *
512 512
 	 * @return bool  Whether user can or not.
513 513
 	 */
514
-	public function current_user_can_for_blog( $blog_id, $cap, $context, $id = 0 ) {
515
-		$user_can = ! empty( $id ) ? current_user_can_for_blog( $blog_id, $cap, $id ) : current_user_can( $blog_id, $cap );
514
+	public function current_user_can_for_blog($blog_id, $cap, $context, $id = 0) {
515
+		$user_can = ! empty($id) ? current_user_can_for_blog($blog_id, $cap, $id) : current_user_can($blog_id, $cap);
516 516
 
517 517
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
518
-		$user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can__' . $context, $user_can, $blog_id, $cap, $id );
519
-		$user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id );
518
+		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can__'.$context, $user_can, $blog_id, $cap, $id);
519
+		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id);
520 520
 		return $user_can;
521 521
 	}
522 522
 
@@ -532,12 +532,12 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return array
534 534
 	 */
535
-	public function get_ee_capabilities( $role = 'administrator' ) {
535
+	public function get_ee_capabilities($role = 'administrator') {
536 536
 		$capabilities = $this->_init_caps_map();
537
-		if ( empty( $role ) ) {
537
+		if (empty($role)) {
538 538
 			return $capabilities;
539 539
 		}
540
-		return isset( $capabilities[ $role ] ) ? $capabilities[ $role ] : array();
540
+		return isset($capabilities[$role]) ? $capabilities[$role] : array();
541 541
 	}
542 542
 }
543 543
 
@@ -585,11 +585,11 @@  discard block
 block discarded – undo
585 585
 	 * 	}
586 586
 	 * @throws EE_Error
587 587
 	 */
588
-	public function __construct( $meta_cap, $map_values ) {
588
+	public function __construct($meta_cap, $map_values) {
589 589
 		$this->meta_cap = $meta_cap;
590 590
 		//verify there are four args in the $map_values array;
591
-		if ( count( $map_values ) !== 4 ) {
592
-			throw new EE_Error( sprintf( __( 'Incoming $map_values array should have a count of four values in it.  This is what was given: %s', 'event_espresso' ), '<br>' . print_r( $map_values, true ) ) );
591
+		if (count($map_values) !== 4) {
592
+			throw new EE_Error(sprintf(__('Incoming $map_values array should have a count of four values in it.  This is what was given: %s', 'event_espresso'), '<br>'.print_r($map_values, true)));
593 593
 		}
594 594
 
595 595
 		//set properties
@@ -603,8 +603,8 @@  discard block
 block discarded – undo
603 603
 	/**
604 604
 	 * Makes it so this object stops filtering caps
605 605
 	 */
606
-	public function remove_filters(){
607
-		remove_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10 );
606
+	public function remove_filters() {
607
+		remove_filter('map_meta_cap', array($this, 'map_meta_caps'), 10);
608 608
 	}
609 609
 
610 610
 
@@ -619,19 +619,19 @@  discard block
 block discarded – undo
619 619
 	 */
620 620
 	public function ensure_is_model() {
621 621
 		//is it already instantiated?
622
-		if ( $this->_model instanceof EEM_Base ) {
622
+		if ($this->_model instanceof EEM_Base) {
623 623
 			return;
624 624
 		}
625 625
 
626 626
 		//ensure model name is string
627 627
 		$this->_model_name = (string) $this->_model_name;
628 628
 		//error proof if the name has EEM in it
629
-		$this->_model_name = str_replace( 'EEM', '', $this->_model_name );
629
+		$this->_model_name = str_replace('EEM', '', $this->_model_name);
630 630
 
631
-		$this->_model = EE_Registry::instance()->load_model( $this->_model_name );
631
+		$this->_model = EE_Registry::instance()->load_model($this->_model_name);
632 632
 
633
-		if ( ! $this->_model instanceof EEM_Base ) {
634
-			throw new EE_Error( sprintf( __( 'This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class.   Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso' ), get_class( $this ), $this->_model ) );
633
+		if ( ! $this->_model instanceof EEM_Base) {
634
+			throw new EE_Error(sprintf(__('This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class.   Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso'), get_class($this), $this->_model));
635 635
 		}
636 636
 	}
637 637
 
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
 	 *
648 648
 	 * @return array
649 649
 	 */
650
-	public function map_meta_caps( $caps, $cap, $user_id, $args ) {
651
-		return $this->_map_meta_caps( $caps, $cap, $user_id, $args );
650
+	public function map_meta_caps($caps, $cap, $user_id, $args) {
651
+		return $this->_map_meta_caps($caps, $cap, $user_id, $args);
652 652
 	}
653 653
 
654 654
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	 *
667 667
 	 * @return array   actual users capabilities
668 668
 	 */
669
-	abstract protected function _map_meta_caps( $caps, $cap, $user_id, $args );
669
+	abstract protected function _map_meta_caps($caps, $cap, $user_id, $args);
670 670
 }
671 671
 
672 672
 
@@ -698,28 +698,28 @@  discard block
 block discarded – undo
698 698
 	 *
699 699
 	 * @return array   actual users capabilities
700 700
 	 */
701
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
701
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
702 702
 		//only process if we're checking our mapped_cap
703
-		if ( $cap !== $this->meta_cap ) {
703
+		if ($cap !== $this->meta_cap) {
704 704
 			return $caps;
705 705
 		}
706 706
 
707
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
707
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
708 708
 
709 709
 		//if no obj then let's just do cap
710
-		if ( ! $obj instanceof EE_Base_Class ) {
710
+		if ( ! $obj instanceof EE_Base_Class) {
711 711
 			$caps[] = $cap;
712 712
 			return $caps;
713 713
 		}
714 714
 
715
-		if ( $obj instanceof EE_CPT_Base ) {
715
+		if ($obj instanceof EE_CPT_Base) {
716 716
 			//if the item author is set and the user is the author...
717
-			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
718
-				if ( empty( $this->published_cap ) ) {
717
+			if ($obj->wp_user() && $user_id == $obj->wp_user()) {
718
+				if (empty($this->published_cap)) {
719 719
 					$caps[] = $cap;
720 720
 				} else {
721 721
 					//if obj is published...
722
-					if ( $obj->status() == 'publish' ) {
722
+					if ($obj->status() == 'publish') {
723 723
 						$caps[] = $this->published_cap;
724 724
 					} else {
725 725
 						$caps[] = $cap;
@@ -727,21 +727,21 @@  discard block
 block discarded – undo
727 727
 				}
728 728
 			} else {
729 729
 				//the user is trying to edit someone else's obj
730
-				if ( ! empty( $this->others_cap ) ) {
730
+				if ( ! empty($this->others_cap)) {
731 731
 					$caps[] = $this->others_cap;
732 732
 				}
733
-				if ( ! empty( $this->published_cap ) && $obj->status() == 'publish' ) {
733
+				if ( ! empty($this->published_cap) && $obj->status() == 'publish') {
734 734
 					$caps[] = $this->published_cap;
735
-				} elseif ( ! empty( $this->private_cap ) && $obj->status() == 'private' ) {
735
+				} elseif ( ! empty($this->private_cap) && $obj->status() == 'private') {
736 736
 					$caps[] = $this->private_cap;
737 737
 				}
738 738
 			}
739 739
 		} else {
740 740
 			//not a cpt object so handled differently
741
-			if ( method_exists( $obj, 'wp_user' ) && $obj->wp_user() && $user_id == $obj->wp_user() ) {
741
+			if (method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user()) {
742 742
 				$caps[] = $cap;
743 743
 			} else {
744
-				if ( ! empty( $this->others_cap ) ) {
744
+				if ( ! empty($this->others_cap)) {
745 745
 					$caps[] = $this->others_cap;
746 746
 				}
747 747
 			}
@@ -778,8 +778,8 @@  discard block
 block discarded – undo
778 778
 	 *
779 779
 	 * @return array   actual users capabilities
780 780
 	 */
781
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
782
-		return parent::_map_meta_caps( $caps, $cap, $user_id, $args );
781
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
782
+		return parent::_map_meta_caps($caps, $cap, $user_id, $args);
783 783
 	}
784 784
 }
785 785
 
@@ -811,45 +811,45 @@  discard block
 block discarded – undo
811 811
 	 *
812 812
 	 * @return array   actual users capabilities
813 813
 	 */
814
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
814
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
815 815
 		//only process if we're checking our mapped cap;
816
-		if ( $cap !== $this->meta_cap ) {
816
+		if ($cap !== $this->meta_cap) {
817 817
 			return $caps;
818 818
 		}
819 819
 
820
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
820
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
821 821
 
822 822
 		//if no obj then let's just do cap
823
-		if ( ! $obj instanceof EE_Base_Class ) {
823
+		if ( ! $obj instanceof EE_Base_Class) {
824 824
 			$caps[] = $cap;
825 825
 			return $caps;
826 826
 		}
827 827
 
828
-		if ( $obj instanceof EE_CPT_Base ) {
829
-			$status_obj = get_post_status_object( $obj->status() );
830
-			if ( $status_obj->public ) {
828
+		if ($obj instanceof EE_CPT_Base) {
829
+			$status_obj = get_post_status_object($obj->status());
830
+			if ($status_obj->public) {
831 831
 				$caps[] = $cap;
832 832
 				return $caps;
833 833
 			}
834 834
 
835 835
 			//if the item author is set and the user is the author...
836
-			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
836
+			if ($obj->wp_user() && $user_id == $obj->wp_user()) {
837 837
 				$caps[] = $cap;
838
-			} elseif ( $status_obj->private && ! empty( $this->private_cap ) ) {
838
+			} elseif ($status_obj->private && ! empty($this->private_cap)) {
839 839
 				//the user is trying to view someone else's obj
840 840
 				$caps[] = $this->private_cap;
841
-			} elseif ( ! empty( $this->others_cap ) ) {
841
+			} elseif ( ! empty($this->others_cap)) {
842 842
 				$caps[] = $this->others_cap;
843 843
 			} else {
844 844
 				$caps[] = $cap;
845 845
 			}
846 846
 		} else {
847 847
 			//not a cpt object so handled differently
848
-			if ( method_exists( $obj, 'wp_user' ) && $obj->wp_user() && $user_id == $obj->wp_user() ) {
848
+			if (method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user()) {
849 849
 				$caps[] = $cap;
850
-			} elseif ( ! empty( $this->private_cap ) ) {
850
+			} elseif ( ! empty($this->private_cap)) {
851 851
 				$caps[] = $this->private_cap;
852
-			} elseif ( ! empty( $this->others_cap ) ) {
852
+			} elseif ( ! empty($this->others_cap)) {
853 853
 				$caps[] = $this->others_cap;
854 854
 			} else {
855 855
 				$caps[] = $cap;
@@ -886,30 +886,30 @@  discard block
 block discarded – undo
886 886
 	 *
887 887
 	 * @return array   actual users capabilities
888 888
 	 */
889
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
889
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
890 890
 		//only process if we're checking our mapped_cap
891
-		if ( $cap !== $this->meta_cap ) {
891
+		if ($cap !== $this->meta_cap) {
892 892
 			return $caps;
893 893
 		}
894 894
 
895
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
895
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
896 896
 
897 897
 		//if no obj then let's just do cap
898
-		if ( ! $obj instanceof EE_Message_Template_Group ) {
898
+		if ( ! $obj instanceof EE_Message_Template_Group) {
899 899
 			$caps[] = $cap;
900 900
 			return $caps;
901 901
 		}
902 902
 
903 903
 		$is_global = $obj->is_global();
904 904
 
905
-		if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
906
-			if ( $is_global ) {
907
-				$caps[]  = $this->private_cap;
905
+		if ($obj->wp_user() && $user_id == $obj->wp_user()) {
906
+			if ($is_global) {
907
+				$caps[] = $this->private_cap;
908 908
 			} else {
909 909
 				$caps[] = $cap;
910 910
 			}
911 911
 		} else {
912
-			if ( $is_global ) {
912
+			if ($is_global) {
913 913
 				$caps[] = $this->private_cap;
914 914
 			} else {
915 915
 				$caps[] = $this->others_cap;
@@ -947,16 +947,16 @@  discard block
 block discarded – undo
947 947
 	 *
948 948
 	 * @return array   actual users capabilities
949 949
 	 */
950
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
950
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
951 951
 		//only process if we're checking our mapped_cap
952
-		if ( $cap !== $this->meta_cap ) {
952
+		if ($cap !== $this->meta_cap) {
953 953
 			return $caps;
954 954
 		}
955 955
 
956
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
956
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
957 957
 
958 958
 		//if no obj then let's just do cap
959
-		if ( ! $obj instanceof EE_Base_Class ) {
959
+		if ( ! $obj instanceof EE_Base_Class) {
960 960
 			$caps[] = $cap;
961 961
 			return $caps;
962 962
 		}
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 		$is_system = $obj instanceof EE_Question_Group ? $obj->system_group() : false;
965 965
 		$is_system = $obj instanceof EE_Question ? $obj->is_system_question() : $is_system;
966 966
 
967
-		if ( $is_system ) {
967
+		if ($is_system) {
968 968
 			$caps[] = $this->private_cap;
969 969
 		} else {
970 970
 			$caps[] = $cap;
Please login to merge, or discard this patch.
core/db_classes/EE_Export.class.php 1 patch
Spacing   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3 3
 /**
4 4
  * EE_Export class
5 5
  * 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	  * @access private
40 40
 	  * @param array $request_data
41 41
 	  */
42
- 	private function __construct( $request_data = array() ) {
42
+ 	private function __construct($request_data = array()) {
43 43
 		$this->_req_data = $request_data;
44
-		$this->today = date("Y-m-d",time());
45
-		require_once( EE_CLASSES . 'EE_CSV.class.php' );
46
-		$this->EE_CSV= EE_CSV::instance();
44
+		$this->today = date("Y-m-d", time());
45
+		require_once(EE_CLASSES.'EE_CSV.class.php');
46
+		$this->EE_CSV = EE_CSV::instance();
47 47
 	}
48 48
 
49 49
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	  * @param array $request_data
56 56
 	  * @return \EE_Export
57 57
 	  */
58
-	public static function instance( $request_data = array() ) {
58
+	public static function instance($request_data = array()) {
59 59
 		// check if class object is instantiated
60
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Export )) {
61
-			self::$_instance = new self( $request_data );
60
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Export)) {
61
+			self::$_instance = new self($request_data);
62 62
 		}
63 63
 		return self::$_instance;
64 64
 	}
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 	public function export() {
73 73
 
74 74
 		// in case of bulk exports, the "actual" action will be in action2, but first check regular action for "export" keyword
75
-		if ( isset( $this->_req_data['action'] ) && strpos( $this->_req_data['action'], 'export' ) === FALSE ) {
75
+		if (isset($this->_req_data['action']) && strpos($this->_req_data['action'], 'export') === FALSE) {
76 76
 			// check if action2 has export action
77
-			if ( isset( $this->_req_data['action2'] ) && strpos( $this->_req_data['action2'], 'export' ) !== FALSE ) {
77
+			if (isset($this->_req_data['action2']) && strpos($this->_req_data['action2'], 'export') !== FALSE) {
78 78
 				// whoop! there it is!
79 79
 				$this->_req_data['action'] = $this->_req_data['action2'];
80 80
 			}
81 81
 		}
82 82
 
83
-		$this->_req_data['export'] = isset( $this->_req_data['export'] ) ? $this->_req_data['export'] : '';
83
+		$this->_req_data['export'] = isset($this->_req_data['export']) ? $this->_req_data['export'] : '';
84 84
 
85 85
 		switch ($this->_req_data['export']) {
86 86
 			case 'report':
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 					break;
95 95
 
96 96
 					case 'registrations_report_for_event':
97
-						$this->report_registrations_for_event( $this->_req_data['EVT_ID'] );
97
+						$this->report_registrations_for_event($this->_req_data['EVT_ID']);
98 98
 					break;
99 99
 
100 100
 					case 'attendees':
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 					break;
107 107
 
108 108
 					default:
109
-						EE_Error::add_error(__('An error occurred! The requested export report could not be found.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ ) ;
109
+						EE_Error::add_error(__('An error occurred! The requested export report could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
110 110
 						return FALSE;
111 111
 					break;
112 112
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * Downloads a CSV file with all the columns, but no data. This should be used for importing
125 125
 	 * @return null kills execution
126 126
 	 */
127
-	function export_sample(){
127
+	function export_sample() {
128 128
 		$event = EEM_Event::instance()->get_one();
129 129
 		$this->_req_data['EVT_ID'] = $event->ID();
130 130
 		$this->export_all_event_data();
@@ -151,23 +151,23 @@  discard block
 block discarded – undo
151 151
 		$question_group_query_params = array();
152 152
 		$question_query_params = array();
153 153
 		$related_through_mtg_params = array();
154
-		if ( isset( $this->_req_data['EVT_ID'] )) {
154
+		if (isset($this->_req_data['EVT_ID'])) {
155 155
 			// do we have an array of IDs ?
156 156
 
157
-			if ( is_array( $this->_req_data['EVT_ID'] )) {
158
-				$EVT_IDs =  array_map( 'sanitize_text_field', $this->_req_data['EVT_ID'] );
159
-				$value_to_equal = array('IN',$EVT_IDs);
157
+			if (is_array($this->_req_data['EVT_ID'])) {
158
+				$EVT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_ID']);
159
+				$value_to_equal = array('IN', $EVT_IDs);
160 160
 				$filename = 'events';
161 161
 			} else {
162 162
 				// generate regular where = clause
163
-				$EVT_ID = absint( $this->_req_data['EVT_ID'] );
163
+				$EVT_ID = absint($this->_req_data['EVT_ID']);
164 164
 				$value_to_equal = $EVT_ID;
165 165
 				$event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($EVT_ID);
166 166
 
167
-				$filename = 'event-' . ( $event instanceof EE_Event ? $event->slug() : __( 'unknown', 'event_espresso' ) );
167
+				$filename = 'event-'.($event instanceof EE_Event ? $event->slug() : __('unknown', 'event_espresso'));
168 168
 
169 169
 			}
170
-			$event_query_params[0]['EVT_ID'] =$value_to_equal;
170
+			$event_query_params[0]['EVT_ID'] = $value_to_equal;
171 171
 			$related_models_query_params[0]['Event.EVT_ID'] = $value_to_equal;
172 172
 			$related_through_reg_query_params[0]['Registration.EVT_ID'] = $value_to_equal;
173 173
 			$datetime_ticket_query_params[0]['Datetime.EVT_ID'] = $value_to_equal;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			$state_country_query_params[0]['Venue.Event.EVT_ID'] = $value_to_equal;
178 178
 			$question_group_query_params[0]['Event.EVT_ID'] = $value_to_equal;
179 179
 			$question_query_params[0]['Question_Group.Event.EVT_ID'] = $value_to_equal;
180
-			$related_through_mtg_params[0]['Message_Template_Group.Event.EVT_ID' ] = $value_to_equal;
180
+			$related_through_mtg_params[0]['Message_Template_Group.Event.EVT_ID'] = $value_to_equal;
181 181
 
182 182
 		} else {
183 183
 			$filename = 'all-events';
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
 		//and we want to specify what things we want to update (because some of that data we'd rather
219 219
 		//not update, just insert if it doesn't exist
220 220
 		$models_to_update = $models_to_export;
221
-		unset( $models_to_update['Ticket_Template'] );
222
-		unset( $models_to_update['Price_Type'] );
223
-		unset( $models_to_update['Term'] );
224
-		unset( $models_to_update['Country'] );
225
-		unset( $models_to_update['State'] );
226
-		unset( $models_to_update['Question_Group'] );
227
-		unset( $models_to_update['Event_Question_Group'] );
228
-		unset( $models_to_update['Question'] );
229
-		unset( $models_to_update['Question_Group_Question'] );
230
-		unset( $models_to_update['Message_Template_Group'] );
231
-		unset( $models_to_update['Message_Template'] );
232
-		$models_to_update = array_keys( $models_to_update );
221
+		unset($models_to_update['Ticket_Template']);
222
+		unset($models_to_update['Price_Type']);
223
+		unset($models_to_update['Term']);
224
+		unset($models_to_update['Country']);
225
+		unset($models_to_update['State']);
226
+		unset($models_to_update['Question_Group']);
227
+		unset($models_to_update['Event_Question_Group']);
228
+		unset($models_to_update['Question']);
229
+		unset($models_to_update['Question_Group_Question']);
230
+		unset($models_to_update['Message_Template_Group']);
231
+		unset($models_to_update['Message_Template']);
232
+		$models_to_update = array_keys($models_to_update);
233 233
 
234 234
 
235 235
 
@@ -238,37 +238,37 @@  discard block
 block discarded – undo
238 238
 		//and won't get any non-events; also
239 239
 		//we can forego the default query params
240 240
 
241
-		$model_data = $this->_get_export_data_for_models( $models_to_export );
241
+		$model_data = $this->_get_export_data_for_models($models_to_export);
242 242
 
243
-		$filename = $this->generate_filename ( $filename );
243
+		$filename = $this->generate_filename($filename);
244 244
 
245
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data, $models_to_update )) {
246
-			EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
245
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data, $models_to_update)) {
246
+			EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
247 247
 		}
248 248
 	}
249 249
 
250
-	function report_attendees(){
251
-		$attendee_rows = EEM_Attendee::instance()->get_all_wpdb_results( array( 'force_join' => array( 'State', 'Country' ) ) );
250
+	function report_attendees() {
251
+		$attendee_rows = EEM_Attendee::instance()->get_all_wpdb_results(array('force_join' => array('State', 'Country')));
252 252
 		$csv_data = array();
253
-		foreach( $attendee_rows as $attendee_row ){
253
+		foreach ($attendee_rows as $attendee_row) {
254 254
 			$csv_row = array();
255
-			foreach( EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
256
-				if( $field_name == 'STA_ID' ){
257
-					$state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' );
258
-					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
259
-				}elseif( $field_name == 'CNT_ISO' ){
260
-					$country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' );
261
-					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
262
-				}else{
263
-					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
255
+			foreach (EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) {
256
+				if ($field_name == 'STA_ID') {
257
+					$state_name_field = EEM_State::instance()->field_settings_for('STA_name');
258
+					$csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()];
259
+				}elseif ($field_name == 'CNT_ISO') {
260
+					$country_name_field = EEM_Country::instance()->field_settings_for('CNT_name');
261
+					$csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()];
262
+				} else {
263
+					$csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()];
264 264
 				}
265 265
 			}
266 266
 			$csv_data[] = $csv_row;
267 267
 		}
268 268
 
269
-		$filename = $this->generate_filename ( 'contact-list-report' );
269
+		$filename = $this->generate_filename('contact-list-report');
270 270
 
271
-		$handle = $this->EE_CSV->begin_sending_csv( $filename);
271
+		$handle = $this->EE_CSV->begin_sending_csv($filename);
272 272
 		$this->EE_CSV->write_data_array_to_csv($handle, $csv_data);
273 273
 		$this->EE_CSV->end_sending_csv($handle);
274 274
 	}
@@ -285,19 +285,19 @@  discard block
 block discarded – undo
285 285
 		$countries_that_have_an_attendee = EEM_Country::instance()->get_all(array(0=>array('Attendee.ATT_ID'=>array('IS NOT NULL'))));
286 286
 //		$states_to_export_query_params
287 287
 		$models_to_export = array(
288
-			'Country'=>array(array('CNT_ISO'=>array('IN',array_keys($countries_that_have_an_attendee)))),
289
-			'State'=>array(array('STA_ID'=>array('IN',array_keys($states_that_have_an_attendee)))),
288
+			'Country'=>array(array('CNT_ISO'=>array('IN', array_keys($countries_that_have_an_attendee)))),
289
+			'State'=>array(array('STA_ID'=>array('IN', array_keys($states_that_have_an_attendee)))),
290 290
 			'Attendee'=>array(),
291 291
 		);
292
-		$models_to_update = array( 'Attendee' );
292
+		$models_to_update = array('Attendee');
293 293
 
294 294
 
295 295
 
296
-		$model_data = $this->_get_export_data_for_models( $models_to_export );
297
-		$filename = $this->generate_filename ( 'all-attendees' );
296
+		$model_data = $this->_get_export_data_for_models($models_to_export);
297
+		$filename = $this->generate_filename('all-attendees');
298 298
 
299
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data, $models_to_update )) {
300
-			EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
299
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data, $models_to_update)) {
300
+			EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
301 301
 		}
302 302
 	}
303 303
 
@@ -309,19 +309,19 @@  discard block
 block discarded – undo
309 309
 	 * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
310 310
 	 * @return string
311 311
 	 */
312
-	protected function _prepare_value_from_db_for_display( $model, $field_name,  $raw_db_value, $pretty_schema = true ) {
313
-		$field_obj = $model->field_settings_for( $field_name );
314
-		$value_on_model_obj = $field_obj->prepare_for_set_from_db( $raw_db_value );
315
-		if( $field_obj instanceof EE_Datetime_Field ) {
316
-			$field_obj->set_date_format( EE_CSV::instance()->get_date_format_for_csv( $field_obj->get_date_format( $pretty_schema ) ), $pretty_schema );
317
-			$field_obj->set_time_format( EE_CSV::instance()->get_time_format_for_csv( $field_obj->get_time_format( $pretty_schema ) ), $pretty_schema );
312
+	protected function _prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true) {
313
+		$field_obj = $model->field_settings_for($field_name);
314
+		$value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value);
315
+		if ($field_obj instanceof EE_Datetime_Field) {
316
+			$field_obj->set_date_format(EE_CSV::instance()->get_date_format_for_csv($field_obj->get_date_format($pretty_schema)), $pretty_schema);
317
+			$field_obj->set_time_format(EE_CSV::instance()->get_time_format_for_csv($field_obj->get_time_format($pretty_schema)), $pretty_schema);
318 318
 		}
319
-		if( $pretty_schema === true){
320
-			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
321
-		}elseif( is_string( $pretty_schema ) ) {
322
-			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
323
-		}else{
324
-			return $field_obj->prepare_for_get( $value_on_model_obj );
319
+		if ($pretty_schema === true) {
320
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj);
321
+		}elseif (is_string($pretty_schema)) {
322
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema);
323
+		} else {
324
+			return $field_obj->prepare_for_get($value_on_model_obj);
325 325
 		}
326 326
 	}
327 327
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 * and the questions associated with the registrations
331 331
 	 * @param int $event_id
332 332
 	 */
333
-	function report_registrations_for_event( $event_id = NULL ){
333
+	function report_registrations_for_event($event_id = NULL) {
334 334
 		$reg_fields_to_include = array(
335 335
 				'TXN_ID',
336 336
 				'ATT_ID',
@@ -362,125 +362,125 @@  discard block
 block discarded – undo
362 362
 				array(
363 363
 					'OR' => array(
364 364
 						//don't include registrations from failed or abandoned transactions...
365
-						'Transaction.STS_ID' => array( 'NOT IN', array( EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code ) ),
365
+						'Transaction.STS_ID' => array('NOT IN', array(EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code)),
366 366
 						//unless the registration is approved, in which case include it regardless of transaction status
367 367
 						'STS_ID' => EEM_Registration::status_id_approved
368 368
 						),
369
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
369
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
370 370
 					),
371
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
372
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' )
371
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
372
+				'force_join' => array('Transaction', 'Ticket', 'Attendee')
373 373
 			),
374 374
 			$event_id
375 375
 		);
376
-		if( $event_id ){
377
-			$query_params[0]['EVT_ID'] =  $event_id;
378
-		}else{
379
-			$query_params[ 'force_join' ][] = 'Event';
376
+		if ($event_id) {
377
+			$query_params[0]['EVT_ID'] = $event_id;
378
+		} else {
379
+			$query_params['force_join'][] = 'Event';
380 380
 		}
381
-		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
381
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
382 382
 		//get all questions which relate to someone in this group
383 383
 		$registration_ids = array();
384
-		foreach( $registration_rows as $reg_row ) {
385
-			$registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] );
384
+		foreach ($registration_rows as $reg_row) {
385
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
386 386
 		}
387 387
 //		EEM_Question::instance()->show_next_x_db_queries();
388
-		$questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN',$registration_ids))));
389
-		foreach($registration_rows as $reg_row){
390
-			if ( is_array( $reg_row ) ) {
388
+		$questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN', $registration_ids))));
389
+		foreach ($registration_rows as $reg_row) {
390
+			if (is_array($reg_row)) {
391 391
 				$reg_csv_array = array();
392
-				if( ! $event_id ){
392
+				if ( ! $event_id) {
393 393
 					//get the event's name and Id
394
-					$reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), $this->_prepare_value_from_db_for_display( EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] );
394
+					$reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), $this->_prepare_value_from_db_for_display(EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
395 395
 				}
396
-				$is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false;
396
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
397 397
 				/*@var $reg_row EE_Registration */
398
-				foreach($reg_fields_to_include as $field_name){
398
+				foreach ($reg_fields_to_include as $field_name) {
399 399
 					$field = $reg_model->field_settings_for($field_name);
400
-					if($field_name == 'REG_final_price'){
401
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
402
-					}elseif( $field_name == 'REG_count' ){
403
-						$value = sprintf( __( '%s of %s', 'event_espresso' ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) );
404
-					}elseif( $field_name == 'REG_date' ) {
405
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
406
-					}else{
407
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
400
+					if ($field_name == 'REG_final_price') {
401
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float');
402
+					}elseif ($field_name == 'REG_count') {
403
+						$value = sprintf(__('%s of %s', 'event_espresso'), $this->_prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), $this->_prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size']));
404
+					}elseif ($field_name == 'REG_date') {
405
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html');
406
+					} else {
407
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]);
408 408
 					}
409 409
 					$reg_csv_array[$this->_get_column_name_for_field($field)] = $value;
410
-					if($field_name == 'REG_final_price'){
410
+					if ($field_name == 'REG_final_price') {
411 411
 						//add a column named Currency after the final price
412 412
 						$reg_csv_array[__("Currency", "event_espresso")] = EE_Config::instance()->currency->code;
413 413
 					}
414 414
 				}
415 415
 				//get pretty status
416
-				$stati = EEM_Status::instance()->localized_status( array(
417
-					$reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ),
418
-					$reg_row[ 'Transaction.STS_ID' ] => __( 'unknown', 'event_espresso' ) ),
416
+				$stati = EEM_Status::instance()->localized_status(array(
417
+					$reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'),
418
+					$reg_row['Transaction.STS_ID'] => __('unknown', 'event_espresso') ),
419 419
 						FALSE,
420
-						'sentence' );
421
-				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ];
420
+						'sentence');
421
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
422 422
 				//get pretty trnasaction status
423
-				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'Transaction.STS_ID' ] ];
424
-				$reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? $this->_prepare_value_from_db_for_display( EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'Transaction.TXN_total' ], 'localized_float' ) : '0.00';
425
-				$reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? $this->_prepare_value_from_db_for_display( EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'Transaction.TXN_paid' ], 'localized_float' ) : '0.00';
423
+				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['Transaction.STS_ID']];
424
+				$reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? $this->_prepare_value_from_db_for_display(EEM_Transaction::instance(), 'TXN_total', $reg_row['Transaction.TXN_total'], 'localized_float') : '0.00';
425
+				$reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? $this->_prepare_value_from_db_for_display(EEM_Transaction::instance(), 'TXN_paid', $reg_row['Transaction.TXN_paid'], 'localized_float') : '0.00';
426 426
 				$payment_methods = array();
427 427
 				$gateway_txn_ids_etc = array();
428 428
 				$payment_times = array();
429
-				if( $is_primary_reg && $reg_row[ 'Transaction.TXN_ID' ] ){
429
+				if ($is_primary_reg && $reg_row['Transaction.TXN_ID']) {
430 430
 					$payments_info = EEM_Payment::instance()->get_all_wpdb_results(
431 431
 							array(
432 432
 								array(
433
-									'TXN_ID' => $reg_row[ 'Transaction.TXN_ID' ],
433
+									'TXN_ID' => $reg_row['Transaction.TXN_ID'],
434 434
 									'STS_ID' => EEM_Payment::status_id_approved
435 435
 								),
436
-								'force_join' => array( 'Payment_Method' ),
436
+								'force_join' => array('Payment_Method'),
437 437
 
438 438
 							),
439 439
 							ARRAY_A,
440 440
 							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
441 441
 
442
-					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
443
-						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
444
-						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
445
-						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
442
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
443
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
444
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
445
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : '';
446 446
 					}
447 447
 
448 448
 				}
449
-				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
450
-				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
451
-				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );
449
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
450
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
451
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
452 452
 
453 453
 				//get whether or not the user has checked in
454
-				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' );
454
+				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
455 455
 				//get ticket of registration and its price
456 456
 				$ticket_model = EE_Registry::instance()->load_model('Ticket');
457
-				if( $reg_row[ 'Ticket.TKT_ID'] ) {
458
-					$ticket_name = $this->_prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] );
457
+				if ($reg_row['Ticket.TKT_ID']) {
458
+					$ticket_name = $this->_prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']);
459 459
 					$datetimes_strings = array();
460
-					foreach( EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){
461
-						$datetimes_strings[] = $this->_prepare_value_from_db_for_display( EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] );
460
+					foreach (EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) {
461
+						$datetimes_strings[] = $this->_prepare_value_from_db_for_display(EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
462 462
 					}
463 463
 
464 464
 				} else {
465
-					$ticket_name = __( 'Unknown', 'event_espresso' );
466
-					$datetimes_strings = array( __( 'Unknown', 'event_espresso' ) );
465
+					$ticket_name = __('Unknown', 'event_espresso');
466
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
467 467
 				}
468 468
 				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
469 469
 				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
470 470
 				//get datetime(s) of registration
471 471
 
472 472
 				//add attendee columns
473
-				foreach($att_fields_to_include as $att_field_name){
473
+				foreach ($att_fields_to_include as $att_field_name) {
474 474
 					$field_obj = EEM_Attendee::instance()->field_settings_for($att_field_name);
475
-					if( $reg_row[ 'Attendee_CPT.ID' ]){
476
-						if($att_field_name == 'STA_ID'){
477
-							$value = EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
478
-						}elseif($att_field_name == 'CNT_ISO'){
479
-							$value = EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
480
-						}else{
481
-							$value = $this->_prepare_value_from_db_for_display( EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
475
+					if ($reg_row['Attendee_CPT.ID']) {
476
+						if ($att_field_name == 'STA_ID') {
477
+							$value = EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name');
478
+						}elseif ($att_field_name == 'CNT_ISO') {
479
+							$value = EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name');
480
+						} else {
481
+							$value = $this->_prepare_value_from_db_for_display(EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
482 482
 						}
483
-					}else{
483
+					} else {
484 484
 						$value = '';
485 485
 					}
486 486
 
@@ -488,56 +488,56 @@  discard block
 block discarded – undo
488 488
 				}
489 489
 
490 490
 				//make sure each registration has the same questions in the same order
491
-				foreach($questions_for_these_regs_rows as $question_row){
492
-					if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){
493
-						$reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null;
491
+				foreach ($questions_for_these_regs_rows as $question_row) {
492
+					if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) {
493
+						$reg_csv_array[$question_row['Question.QST_admin_label']] = null;
494 494
 					}
495 495
 				}
496 496
 				//now fill out the questions THEY answered
497
-				foreach( EEM_Answer::instance()->get_all_wpdb_results( array( array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), 'force_join' => array( 'Question' ) ) ) as $answer_row){
497
+				foreach (EEM_Answer::instance()->get_all_wpdb_results(array(array('REG_ID' => $reg_row['Registration.REG_ID']), 'force_join' => array('Question'))) as $answer_row) {
498 498
 					/* @var $answer EE_Answer */
499
-					if( $answer_row[ 'Question.QST_ID' ] ){
500
-						$question_label = $this->_prepare_value_from_db_for_display( EEM_Question::instance(), 'QST_admin_label', $answer_row[ 'Question.QST_admin_label' ] );
501
-					}else{
502
-						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
499
+					if ($answer_row['Question.QST_ID']) {
500
+						$question_label = $this->_prepare_value_from_db_for_display(EEM_Question::instance(), 'QST_admin_label', $answer_row['Question.QST_admin_label']);
501
+					} else {
502
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
503 503
 					}
504
-                                        if( isset( $answer_row[ 'Question.QST_type'] ) && $answer_row[ 'Question.QST_type' ] == EEM_Question::QST_type_state ) {
505
-                                            $reg_csv_array[ $question_label ] = EEM_State::instance()->get_state_name_by_ID( $answer_row[ 'Answer.ANS_value' ] );
504
+                                        if (isset($answer_row['Question.QST_type']) && $answer_row['Question.QST_type'] == EEM_Question::QST_type_state) {
505
+                                            $reg_csv_array[$question_label] = EEM_State::instance()->get_state_name_by_ID($answer_row['Answer.ANS_value']);
506 506
                                         } else {
507
-                                            $reg_csv_array[ $question_label ] = $this->_prepare_value_from_db_for_display( EEM_Answer::instance(), 'ANS_value', $answer_row[ 'Answer.ANS_value' ] );
507
+                                            $reg_csv_array[$question_label] = $this->_prepare_value_from_db_for_display(EEM_Answer::instance(), 'ANS_value', $answer_row['Answer.ANS_value']);
508 508
                                         }
509 509
 				}
510
-				$registrations_csv_ready_array[] = apply_filters( 'FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row );
510
+				$registrations_csv_ready_array[] = apply_filters('FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row);
511 511
 			}
512 512
 		}
513 513
 
514 514
 		//if we couldn't export anything, we want to at least show the column headers
515
-		if(empty($registrations_csv_ready_array)){
515
+		if (empty($registrations_csv_ready_array)) {
516 516
 			$reg_csv_array = array();
517 517
 			$model_and_fields_to_include = array(
518 518
 				'Registration' => $reg_fields_to_include,
519 519
 				'Attendee' => $att_fields_to_include
520 520
 			);
521
-			foreach($model_and_fields_to_include as $model_name => $field_list){
521
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
522 522
 				$model = EE_Registry::instance()->load_model($model_name);
523
-				foreach($field_list as $field_name){
523
+				foreach ($field_list as $field_name) {
524 524
 					$field = $model->field_settings_for($field_name);
525
-					$reg_csv_array[$this->_get_column_name_for_field($field)] = null;//$registration->get($field->get_name());
525
+					$reg_csv_array[$this->_get_column_name_for_field($field)] = null; //$registration->get($field->get_name());
526 526
 				}
527 527
 			}
528 528
 			$registrations_csv_ready_array [] = $reg_csv_array;
529 529
 		}
530
-		if( $event_id ){
531
-			$event_slug =  EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' );
532
-			if( ! $event_slug ) {
533
-				$event_slug = __( 'unknown', 'event_espresso' );
530
+		if ($event_id) {
531
+			$event_slug = EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug');
532
+			if ( ! $event_slug) {
533
+				$event_slug = __('unknown', 'event_espresso');
534 534
 			}
535
-		}else{
536
-			$event_slug = __( 'all', 'event_espresso' );
535
+		} else {
536
+			$event_slug = __('all', 'event_espresso');
537 537
 		}
538
-		$filename = sprintf( "registrations-for-%s", $event_slug );
538
+		$filename = sprintf("registrations-for-%s", $event_slug);
539 539
 
540
-		$handle = $this->EE_CSV->begin_sending_csv( $filename);
540
+		$handle = $this->EE_CSV->begin_sending_csv($filename);
541 541
 		$this->EE_CSV->write_data_array_to_csv($handle, $registrations_csv_ready_array);
542 542
 		$this->EE_CSV->end_sending_csv($handle);
543 543
 	}
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	 * @param EE_Model_Field_Base $field
548 548
 	 * @return string
549 549
 	 */
550
-	protected function _get_column_name_for_field(EE_Model_Field_Base $field){
550
+	protected function _get_column_name_for_field(EE_Model_Field_Base $field) {
551 551
 		return $field->get_nicename()."[".$field->get_name()."]";
552 552
 	}
553 553
 
@@ -560,17 +560,17 @@  discard block
 block discarded – undo
560 560
 	function export_categories() {
561 561
 		// are any Event IDs set?
562 562
 		$query_params = array();
563
-		if ( isset( $this->_req_data['EVT_CAT_ID'] )) {
563
+		if (isset($this->_req_data['EVT_CAT_ID'])) {
564 564
 			// do we have an array of IDs ?
565
-			if ( is_array( $this->_req_data['EVT_CAT_ID'] )) {
565
+			if (is_array($this->_req_data['EVT_CAT_ID'])) {
566 566
 				// generate an "IN (CSV)" where clause
567
-				$EVT_CAT_IDs = array_map( 'sanitize_text_field', $this->_req_data['EVT_CAT_ID'] );
567
+				$EVT_CAT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_CAT_ID']);
568 568
 				$filename = 'event-categories';
569
-				$query_params[0]['term_taxonomy_id'] = array('IN',$EVT_CAT_IDs);
569
+				$query_params[0]['term_taxonomy_id'] = array('IN', $EVT_CAT_IDs);
570 570
 			} else {
571 571
 				// generate regular where = clause
572
-				$EVT_CAT_ID = absint( $this->_req_data['EVT_CAT_ID'] );
573
-				$filename = 'event-category#' . $EVT_CAT_ID;
572
+				$EVT_CAT_ID = absint($this->_req_data['EVT_CAT_ID']);
573
+				$filename = 'event-category#'.$EVT_CAT_ID;
574 574
 				$query_params[0]['term_taxonomy_id'] = $EVT_CAT_ID;
575 575
 			}
576 576
 		} else {
@@ -582,11 +582,11 @@  discard block
 block discarded – undo
582 582
 				'Term_Taxonomy' => $query_params
583 583
 			);
584 584
 
585
-		$table_data = $this->_get_export_data_for_models( $tables_to_export );
586
-		$filename = $this->generate_filename ( $filename );
585
+		$table_data = $this->_get_export_data_for_models($tables_to_export);
586
+		$filename = $this->generate_filename($filename);
587 587
 
588
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $table_data )) {
589
-			EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
588
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $table_data)) {
589
+			EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
590 590
 		}
591 591
 	}
592 592
 
@@ -597,13 +597,13 @@  discard block
 block discarded – undo
597 597
 	 *		  @param string - export_name
598 598
 	 *			@return string on success, FALSE on fail
599 599
 	 */
600
-	private function generate_filename ( $export_name = '' ) {
601
-		if ( $export_name != '' ) {
602
-			$filename = get_bloginfo('name') . '-' . $export_name;
603
-			$filename = sanitize_key( $filename ) . '-' . $this->today;
600
+	private function generate_filename($export_name = '') {
601
+		if ($export_name != '') {
602
+			$filename = get_bloginfo('name').'-'.$export_name;
603
+			$filename = sanitize_key($filename).'-'.$this->today;
604 604
 			return $filename;
605
-		}	 else {
606
-			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
605
+		} else {
606
+			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
607 607
 		}
608 608
 		return false;
609 609
 	}
@@ -616,37 +616,37 @@  discard block
 block discarded – undo
616 616
 	 *	@param array $models_to_export keys are model names (eg 'Event', 'Attendee', etc.) and values are arrays of query params like on EEM_Base::get_all
617 617
 	 *	@return array on success, FALSE on fail
618 618
 	 */
619
-	private function _get_export_data_for_models( $models_to_export = array() ) {
619
+	private function _get_export_data_for_models($models_to_export = array()) {
620 620
 		$table_data = FALSE;
621
-		if ( is_array( $models_to_export ) ) {
622
-			foreach ( $models_to_export as $model_name => $query_params ) {
621
+		if (is_array($models_to_export)) {
622
+			foreach ($models_to_export as $model_name => $query_params) {
623 623
 				//check for a numerically-indexed array. in that case, $model_name is the value!!
624
-				if(is_int($model_name)){
624
+				if (is_int($model_name)) {
625 625
 					$model_name = $query_params;
626 626
 					$query_params = array();
627 627
 				}
628
-				if( ! isset( $query_params[ 'default_where_conditions'] ) ) {
629
-					$query_params[ 'default_where_conditions' ] = 'minimum';
628
+				if ( ! isset($query_params['default_where_conditions'])) {
629
+					$query_params['default_where_conditions'] = 'minimum';
630 630
 				}
631 631
 				$model = EE_Registry::instance()->load_model($model_name);
632 632
 				$model_objects = $model->get_all($query_params);
633 633
 
634 634
 
635 635
 				$table_data[$model_name] = array();
636
-				foreach($model_objects as $model_object){
636
+				foreach ($model_objects as $model_object) {
637 637
 					$model_data_array = array();
638 638
 					$fields = $model->field_settings();
639
-					foreach($fields as $field){
639
+					foreach ($fields as $field) {
640 640
 						$column_name = $field->get_nicename()."[".$field->get_name()."]";
641
-						if($field instanceof EE_Datetime_Field){
641
+						if ($field instanceof EE_Datetime_Field) {
642 642
 //							$field->set_date_format('Y-m-d');
643 643
 //							$field->set_time_format('H:i:s');
644
-							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(),'Y-m-d','H:i:s');
645
-						} elseif( $field instanceof EE_Infinite_Integer_Field &&
646
-								$model_object->get( $field->get_name() ) === EE_INF ) {
644
+							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(), 'Y-m-d', 'H:i:s');
645
+						} elseif ($field instanceof EE_Infinite_Integer_Field &&
646
+								$model_object->get($field->get_name()) === EE_INF) {
647 647
 							$model_data_array[$column_name] = "";
648 648
 						}
649
-						else{
649
+						else {
650 650
 							$model_data_array[$column_name] = $model_object->get($field->get_name());
651 651
 						}
652 652
 					}
Please login to merge, or discard this patch.
core/db_models/EEM_Post_Meta.model.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * ------------------------------------------------------------------------
33 33
  */
34
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
34
+require_once (EE_MODELS.'EEM_Base.model.php');
35 35
 
36 36
 class EEM_Post_Meta extends EEM_Base {
37 37
 
38 38
   	// private instance of the EE_Post_Meta object
39 39
 	protected static $_instance = NULL;
40 40
 
41
-	protected function __construct( $timezone = NULL ) {
42
-		$this->singular_item = __('Post Meta','event_espresso');
43
-		$this->plural_item = __('Post Metas','event_espresso');
41
+	protected function __construct($timezone = NULL) {
42
+		$this->singular_item = __('Post Meta', 'event_espresso');
43
+		$this->plural_item = __('Post Metas', 'event_espresso');
44 44
 		$this->_tables = array(
45 45
 			'Post_Meta'=> new EE_Primary_Table('postmeta', 'meta_id')
46 46
 		);
47
-		$models_this_can_attach_to = apply_filters( 'FHEE__EEM_Post_Meta__construct__models_this_can_attach_to', array_keys( EE_Registry::instance()->cpt_models() ) );
47
+		$models_this_can_attach_to = apply_filters('FHEE__EEM_Post_Meta__construct__models_this_can_attach_to', array_keys(EE_Registry::instance()->cpt_models()));
48 48
 		$this->_fields = array(
49 49
 			'Post_Meta'=>array(
50 50
 				'meta_id'=>new EE_Primary_Key_Int_Field('meta_id', __("Meta ID", "event_espresso")),
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 				'meta_value'=>new EE_Maybe_Serialized_Text_Field('meta_value', __("Meta Value", "event_espresso"), true)
54 54
 			));
55 55
 		$this->_model_relations = array();
56
-		foreach($models_this_can_attach_to as $model){
56
+		foreach ($models_this_can_attach_to as $model) {
57 57
 			$this->_model_relations[$model] = new EE_Belongs_To_Relation();
58 58
 		}
59
-		foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) {
60
-			$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'meta_key', 'meta_value' );
59
+		foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
60
+			$this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('meta_key', 'meta_value');
61 61
 		}
62
-		parent::__construct( $timezone );
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 
65 65
 
Please login to merge, or discard this patch.
core/db_models/EEM_Question.model.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once( EE_CLASSES . 'EE_Question.class.php');
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once(EE_CLASSES.'EE_Question.class.php');
26 26
 
27 27
 class EEM_Question extends EEM_Soft_Delete_Base {
28 28
 
@@ -69,21 +69,21 @@  discard block
 block discarded – undo
69 69
 	// private instance of the Attendee object
70 70
 	protected static $_instance = NULL;
71 71
 
72
-	protected function __construct( $timezone = NULL ) {
73
-		$this->singular_item = __('Question','event_espresso');
74
-		$this->plural_item = __('Questions','event_espresso');
75
-		$this->_allowed_question_types=apply_filters(
72
+	protected function __construct($timezone = NULL) {
73
+		$this->singular_item = __('Question', 'event_espresso');
74
+		$this->plural_item = __('Questions', 'event_espresso');
75
+		$this->_allowed_question_types = apply_filters(
76 76
 			'FHEE__EEM_Question__construct__allowed_question_types',
77 77
 			array(
78
-				EEM_Question::QST_type_text =>__('Text','event_espresso'),
79
-				EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'),
80
-				EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'),
81
-				EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'),
82
-				EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'),
83
-				EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'),
84
-				EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'),
85
-				EEM_Question::QST_type_date =>__('Date Picker','event_espresso'),
86
-				EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ),
78
+				EEM_Question::QST_type_text =>__('Text', 'event_espresso'),
79
+				EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'),
80
+				EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'),
81
+				EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'),
82
+				EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'),
83
+				EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'),
84
+				EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'),
85
+				EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'),
86
+				EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'),
87 87
 			)
88 88
 		);
89 89
 		$this->_question_type_categories = apply_filters(
@@ -102,22 +102,22 @@  discard block
 block discarded – undo
102 102
 		);
103 103
 
104 104
 		$this->_tables = array(
105
-			'Question'=>new EE_Primary_Table('esp_question','QST_ID')
105
+			'Question'=>new EE_Primary_Table('esp_question', 'QST_ID')
106 106
 		);
107 107
 		$this->_fields = array(
108 108
 			'Question'=>array(
109
-				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')),
110
-				'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''),
111
-				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''),
112
-				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), TRUE, NULL ),
113
-				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types),
114
-				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false),
115
-				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''),
116
-				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0),
117
-				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false),
118
-				'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso'	), false, EE_INF ),
119
-				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ),
120
-				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false)
109
+				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')),
110
+				'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''),
111
+				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''),
112
+				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL),
113
+				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types),
114
+				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false),
115
+				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''),
116
+				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0),
117
+				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false),
118
+				'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF),
119
+				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false),
120
+				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false)
121 121
 			)
122 122
 		);
123 123
 		$this->_model_relations = array(
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 			'Question_Group_Question'=>new EE_Has_Many_Relation()
130 130
 		);
131 131
 		$this->_indexes = array(
132
-			'admin_label' => new EE_Unique_Index( array( 'QST_admin_label') )
132
+			'admin_label' => new EE_Unique_Index(array('QST_admin_label'))
133 133
 		);
134 134
 
135 135
 		//this model is generally available for reading
136
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
137
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system');
138
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system');
139
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system');
140
-		parent::__construct( $timezone );
136
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
137
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system');
138
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system');
139
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system');
140
+		parent::__construct($timezone);
141 141
 	}
142 142
 
143 143
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * but they can be extended
146 146
 	 * @return string[]
147 147
 	 */
148
-	public function allowed_question_types(){
148
+	public function allowed_question_types() {
149 149
 		return $this->_allowed_question_types;
150 150
 	}
151 151
 	/**
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 	 * @param string $question_type one of EEM_Question::allowed_question_types(
154 154
 	 * @return string[] like EEM_Question::allowed_question_types()
155 155
 	 */
156
-	public function question_types_in_same_category( $question_type ) {
157
-		$question_types = array( $question_type );
158
-		foreach( $this->_question_type_categories as $category => $question_types_in_category ) {
159
-			if( in_array( $question_type, $question_types_in_category ) ) {
156
+	public function question_types_in_same_category($question_type) {
157
+		$question_types = array($question_type);
158
+		foreach ($this->_question_type_categories as $category => $question_types_in_category) {
159
+			if (in_array($question_type, $question_types_in_category)) {
160 160
 				$question_types = $question_types_in_category;
161 161
 				break;
162 162
 			}
163 163
 		}
164 164
 
165
-		return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) );
165
+		return array_intersect_key($this->allowed_question_types(), array_flip($question_types));
166 166
 	}
167 167
 
168 168
 	/**
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 * @param string $category one of the top-level keys of EEM_Question::question_type_categories()
172 172
 	 * @return boolean
173 173
 	 */
174
-	public function question_type_is_in_category( $question_type, $category ) {
175
-		if( ! isset( $this->_question_type_categories[ $category ] ) ) {
174
+	public function question_type_is_in_category($question_type, $category) {
175
+		if ( ! isset($this->_question_type_categories[$category])) {
176 176
 			return false;
177 177
 		}
178
-		return in_array( $question_type, $this->_question_type_categories[ $category ] );
178
+		return in_array($question_type, $this->_question_type_categories[$category]);
179 179
 	}
180 180
 
181 181
 	/**
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	 * @param string $system_question_group_id QSG_system
193 193
 	 * @return array of system question names (QST_system)
194 194
 	 */
195
-	public function allowed_system_questions_in_system_question_group( $system_question_group_id ) {
195
+	public function allowed_system_questions_in_system_question_group($system_question_group_id) {
196 196
 		$question_system_ids = array();
197
-		switch( $system_question_group_id ) {
197
+		switch ($system_question_group_id) {
198 198
 			case EEM_Question_Group::system_personal:
199 199
 				$question_system_ids = array(
200 200
 					EEM_Attendee::system_question_fname,
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				);
216 216
 				break;
217 217
 		}
218
-		return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id );
218
+		return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id);
219 219
 	}
220 220
 
221 221
 	/**
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	 * @param string $system_question_group_id QSG_system
225 225
 	 * @return array of system question names (QST_system)
226 226
 	 */
227
-	public function required_system_questions_in_system_question_group( $system_question_group_id ) {
227
+	public function required_system_questions_in_system_question_group($system_question_group_id) {
228 228
 		$question_system_ids = null;
229
-		switch( $system_question_group_id ) {
229
+		switch ($system_question_group_id) {
230 230
 			case EEM_Question_Group::system_personal:
231
-				$question_system_ids =  array(
231
+				$question_system_ids = array(
232 232
 					EEM_Attendee::system_question_fname,
233 233
 					EEM_Attendee::system_question_email,
234 234
 				);
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 			default:
237 237
 				$question_system_ids = array();
238 238
 		}
239
-		return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id );
239
+		return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id);
240 240
 	}
241 241
 
242 242
 
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
 	 * @param string $QST_system
248 248
 	 * @return int of QST_ID for the question that corresponds to that QST_system
249 249
 	 */
250
-	public function get_Question_ID_from_system_string( $QST_system ){
251
-		 return $this->get_var( array( array( 'QST_system' => $QST_system ) ) );
250
+	public function get_Question_ID_from_system_string($QST_system) {
251
+		 return $this->get_var(array(array('QST_system' => $QST_system)));
252 252
 	}
253 253
 
254 254
 
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function get_latest_question_order() {
262 262
 		$columns_to_select = array(
263
-			'max_order' => array("MAX(QST_order)","%d")
263
+			'max_order' => array("MAX(QST_order)", "%d")
264 264
 		);
265
-		$max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select );
265
+		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
266 266
 		return $max[0]['max_order'];
267 267
 	}
268 268
 
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 	 * @param string $system_question_value
293 293
 	 * @return int|float
294 294
 	 */
295
-	public function absolute_max_for_system_question( $system_question_value ) {
295
+	public function absolute_max_for_system_question($system_question_value) {
296 296
 		$maxes = $this->system_question_maxes();
297
-		if( isset( $maxes[ $system_question_value ] ) ) {
298
-			return $maxes[ $system_question_value ];
297
+		if (isset($maxes[$system_question_value])) {
298
+			return $maxes[$system_question_value];
299 299
 		} else {
300 300
 			return EE_INF;
301 301
 		}
Please login to merge, or discard this patch.
core/db_models/strategies/EE_CPT_Where_Conditions.strategy.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /*
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @subpackage		core/db_models/strategies/
12 12
  * @author				Michael Nelson
13 13
  */
14
-class EE_CPT_Where_Conditions extends EE_Default_Where_Conditions{
14
+class EE_CPT_Where_Conditions extends EE_Default_Where_Conditions {
15 15
 
16 16
 	protected $_post_type;
17 17
 	protected $_meta_field;
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 * @param string $meta_field_to_chk
24 24
 	 * @param array $custom_where_conditions
25 25
 	 */
26
-	function __construct( $post_type, $meta_field_to_chk = '', $custom_where_conditions = array() ){
26
+	function __construct($post_type, $meta_field_to_chk = '', $custom_where_conditions = array()) {
27 27
 		$this->_post_type = $post_type;
28 28
 		$this->_meta_field = $meta_field_to_chk;
29
-		parent::__construct( $custom_where_conditions );
29
+		parent::__construct($custom_where_conditions);
30 30
 	}
31 31
 
32 32
 
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 	 * @return \EE_Model_Field_Base
40 40
 	 * @throws \EE_Error
41 41
 	 */
42
-	protected function _get_field_on_column( $column ){
43
-		$all_fields = $this->_model->field_settings( true );
44
-		foreach ( $all_fields as $field_obj ) {
45
-			if ( $column == $field_obj->get_table_column() ) {
42
+	protected function _get_field_on_column($column) {
43
+		$all_fields = $this->_model->field_settings(true);
44
+		foreach ($all_fields as $field_obj) {
45
+			if ($column == $field_obj->get_table_column()) {
46 46
 				return $field_obj;
47 47
 			}
48 48
 		}
49 49
 		throw new EE_Error(
50 50
 			sprintf(
51
-				__( 'Model EE_CPT_Where_Conditions misconfigured. Looking for a field with column %1$s on model %2$s but none found.', 'event_espresso'),
51
+				__('Model EE_CPT_Where_Conditions misconfigured. Looking for a field with column %1$s on model %2$s but none found.', 'event_espresso'),
52 52
 				$column,
53 53
 				$this->_model->get_this_model_name()
54 54
 			)
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * CPT models, otherwise we could get rows which aren't of this post type
63 63
 	 * @return array
64 64
 	 */
65
-	function _get_minimum_where_conditions(){
65
+	function _get_minimum_where_conditions() {
66 66
 		return array(
67 67
 			$this->_get_field_on_column('post_type')->get_name() => $this->_post_type
68 68
 		);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		$status_field = $this->_get_field_on_column('post_status');
80 80
 		return  array_replace_recursive(
81 81
 			$this->_get_minimum_where_conditions(),
82
-			array( $status_field->get_name() => array('NOT IN',array('auto-draft','trash')))
82
+			array($status_field->get_name() => array('NOT IN', array('auto-draft', 'trash')))
83 83
 		);
84 84
 	}
85 85
 }
Please login to merge, or discard this patch.