Completed
Branch ENH-9001-hhvm-max-input-vars (e4c045)
by
unknown
472:43 queued 457:53
created
core/helpers/EEH_Activation.helper.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1092,14 +1092,14 @@  discard block
 block discarded – undo
1092 1092
 							$QSG_ID = reset( $id_col );
1093 1093
 						} else {
1094 1094
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1095
-                                                        EE_Log::instance()->log( 
1096
-                                                                __FILE__, 
1097
-                                                                __FUNCTION__, 
1098
-                                                                sprintf( 
1099
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1100
-                                                                        $QST_ID ), 
1101
-                                                                'error' );
1102
-                                                        continue;
1095
+														EE_Log::instance()->log( 
1096
+																__FILE__, 
1097
+																__FUNCTION__, 
1098
+																sprintf( 
1099
+																		__( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1100
+																		$QST_ID ), 
1101
+																'error' );
1102
+														continue;
1103 1103
 						}
1104 1104
 					}
1105 1105
                                         
@@ -1629,8 +1629,8 @@  discard block
 block discarded – undo
1629 1629
 				}
1630 1630
 			}
1631 1631
 		}
1632
-                //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1633
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1632
+				//also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1633
+				remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1634 1634
 
1635 1635
 		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1636 1636
 			$db_update_sans_ee4 = array();
Please login to merge, or discard this patch.
Spacing   +367 added lines, -367 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 	 * @param $table_name
58 58
 	 * @return string
59 59
 	 */
60
-	public static function ensure_table_name_has_prefix( $table_name ) {
60
+	public static function ensure_table_name_has_prefix($table_name) {
61 61
 		global $wpdb;
62
-		return strpos( $table_name, $wpdb->prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name;
62
+		return strpos($table_name, $wpdb->prefix) === 0 ? $table_name : $wpdb->prefix.$table_name;
63 63
 	}
64 64
 
65 65
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * be called on plugin activation and reactivation
86 86
 	 * @return boolean success, whether the database and folders are setup properly
87 87
 	 */
88
-	public static function initialize_db_and_folders(){
88
+	public static function initialize_db_and_folders() {
89 89
 		$good_filesystem = EEH_Activation::create_upload_directories();
90 90
 		$good_db = EEH_Activation::create_database_tables();
91 91
 		return $good_filesystem && $good_db;
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * upon activation of a new plugin, reactivation, and at the end
100 100
 	 * of running migration scripts
101 101
 	 */
102
-	public static function initialize_db_content(){
102
+	public static function initialize_db_content() {
103 103
 		//let's avoid doing all this logic repeatedly, especially when addons are requesting it
104
-		if( EEH_Activation::$_initialized_db_content_already_in_this_request ) {
104
+		if (EEH_Activation::$_initialized_db_content_already_in_this_request) {
105 105
 			return;
106 106
 		}
107 107
 		EEH_Activation::$_initialized_db_content_already_in_this_request = true;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		EEH_Activation::remove_cron_tasks();
119 119
 		EEH_Activation::create_cron_tasks();
120 120
 		//also, check for CAF default db content
121
-		do_action( 'AHEE__EEH_Activation__initialize_db_content' );
121
+		do_action('AHEE__EEH_Activation__initialize_db_content');
122 122
 		//also: EEM_Gateways::load_all_gateways() outputs a lot of success messages
123 123
 		//which users really won't care about on initial activation
124 124
 		EE_Error::overwrite_success();
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @return array
138 138
 	 * @throws \EE_Error
139 139
 	 */
140
-	public static function get_cron_tasks( $which_to_include ) {
140
+	public static function get_cron_tasks($which_to_include) {
141 141
 		$cron_tasks = apply_filters(
142 142
 			'FHEE__EEH_Activation__get_cron_tasks',
143 143
 			array(
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
 				'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates
147 147
 			)
148 148
 		);
149
-		if( $which_to_include === 'all' ) {
149
+		if ($which_to_include === 'all') {
150 150
 			//leave as-is
151
-		}elseif( $which_to_include === 'old' ) {
152
-			$cron_tasks = array_filter( $cron_tasks, function ( $value ) {
151
+		}elseif ($which_to_include === 'old') {
152
+			$cron_tasks = array_filter($cron_tasks, function($value) {
153 153
 				return $value === EEH_Activation::cron_task_no_longer_in_use;
154 154
 			});
155
-		}elseif( $which_to_include === 'current' ) {
156
-			$cron_tasks = array_filter( $cron_tasks );
157
-		}elseif( WP_DEBUG ) {
158
-			throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) );
159
-		}else{
155
+		}elseif ($which_to_include === 'current') {
156
+			$cron_tasks = array_filter($cron_tasks);
157
+		}elseif (WP_DEBUG) {
158
+			throw new EE_Error(sprintf(__('Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso'), $which_to_include));
159
+		} else {
160 160
 			//leave as-is
161 161
 		}
162 162
 		return $cron_tasks;
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public static function create_cron_tasks() {
169 169
 
170
-		foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) {
171
-			if( ! wp_next_scheduled( $hook_name ) ) {
172
-				wp_schedule_event( time(), $frequency, $hook_name );
170
+		foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) {
171
+			if ( ! wp_next_scheduled($hook_name)) {
172
+				wp_schedule_event(time(), $frequency, $hook_name);
173 173
 			}
174 174
 		}
175 175
 
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 * Remove the currently-existing and now-removed cron tasks.
180 180
 	 * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones
181 181
 	 */
182
-	public static function remove_cron_tasks( $remove_all = true ) {
182
+	public static function remove_cron_tasks($remove_all = true) {
183 183
 		$cron_tasks_to_remove = $remove_all ? 'all' : 'old';
184 184
 		$crons = _get_cron_array();
185
-		$crons = is_array( $crons ) ? $crons : array();
185
+		$crons = is_array($crons) ? $crons : array();
186 186
 		/* reminder that $crons looks like: top-level keys are timestamps,
187 187
 		 * and their values are arrays.
188 188
 		 * The 2nd level arrays have keys with each of the cron task hooknames to run at that time
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 		 *					...
201 201
 		 *      ...
202 202
 		 */
203
-		foreach( EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ) as $hook_name => $frequency ) {
204
-			foreach( $crons as $timestamp => $hooks_to_fire_at_time ) {
205
-				if ( array_key_exists( $hook_name, $hooks_to_fire_at_time ) )  {
206
-					unset( $crons[ $timestamp ][ $hook_name ] );
203
+		foreach (EEH_Activation::get_cron_tasks($cron_tasks_to_remove) as $hook_name => $frequency) {
204
+			foreach ($crons as $timestamp => $hooks_to_fire_at_time) {
205
+				if (array_key_exists($hook_name, $hooks_to_fire_at_time)) {
206
+					unset($crons[$timestamp][$hook_name]);
207 207
 				}
208 208
 			}
209 209
 		}
210
-		_set_cron_array( $crons );
210
+		_set_cron_array($crons);
211 211
 	}
212 212
 
213 213
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public static function CPT_initialization() {
224 224
 		// register Custom Post Types
225
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
225
+		EE_Registry::instance()->load_core('Register_CPTs');
226 226
 		flush_rewrite_rules();
227 227
 	}
228 228
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 * 	@return void
241 241
 	 */
242 242
 	public static function reset_and_update_config() {
243
-		do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) );
244
-		add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 );
243
+		do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config'));
244
+		add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3);
245 245
 		//EE_Config::reset();
246 246
 	}
247 247
 
@@ -254,23 +254,23 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public static function load_calendar_config() {
256 256
 		// grab array of all plugin folders and loop thru it
257
-		$plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR );
258
-		if ( empty( $plugins ) ) {
257
+		$plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR);
258
+		if (empty($plugins)) {
259 259
 			return;
260 260
 		}
261
-		foreach ( $plugins as $plugin_path ) {
261
+		foreach ($plugins as $plugin_path) {
262 262
 			// grab plugin folder name from path
263
-			$plugin = basename( $plugin_path );
263
+			$plugin = basename($plugin_path);
264 264
 			// drill down to Espresso plugins
265
-			if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) {
265
+			if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) {
266 266
 				// then to calendar related plugins
267
-				if ( strpos( $plugin, 'calendar' ) !== FALSE ) {
267
+				if (strpos($plugin, 'calendar') !== FALSE) {
268 268
 					// this is what we are looking for
269
-					$calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php';
269
+					$calendar_config = $plugin_path.DS.'EE_Calendar_Config.php';
270 270
 					// does it exist in this folder ?
271
-					if ( is_readable( $calendar_config )) {
271
+					if (is_readable($calendar_config)) {
272 272
 						// YEAH! let's load it
273
-						require_once( $calendar_config );
273
+						require_once($calendar_config);
274 274
 					}
275 275
 				}
276 276
 			}
@@ -287,21 +287,21 @@  discard block
 block discarded – undo
287 287
 	 * @param \EE_Config $EE_Config
288 288
 	 * @return \stdClass
289 289
 	 */
290
-	public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) {
291
-		$convert_from_array = array( 'addons' );
290
+	public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) {
291
+		$convert_from_array = array('addons');
292 292
 		// in case old settings were saved as an array
293
-		if ( is_array( $settings ) && in_array( $config, $convert_from_array )) {
293
+		if (is_array($settings) && in_array($config, $convert_from_array)) {
294 294
 			// convert existing settings to an object
295 295
 			$config_array = $settings;
296 296
 			$settings = new stdClass();
297
-			foreach ( $config_array as $key => $value ){
298
-				if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) {
299
-					$EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value );
297
+			foreach ($config_array as $key => $value) {
298
+				if ($key == 'calendar' && class_exists('EE_Calendar_Config')) {
299
+					$EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value);
300 300
 				} else {
301 301
 					$settings->$key = $value;
302 302
 				}
303 303
 			}
304
-			add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' );
304
+			add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true');
305 305
 		}
306 306
 		return $settings;
307 307
 	}
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public static function deactivate_event_espresso() {
319 319
 		// check permissions
320
-		if ( current_user_can( 'activate_plugins' )) {
321
-			deactivate_plugins( EE_PLUGIN_BASENAME, TRUE );
320
+		if (current_user_can('activate_plugins')) {
321
+			deactivate_plugins(EE_PLUGIN_BASENAME, TRUE);
322 322
 		}
323 323
 	}
324 324
 
@@ -340,79 +340,79 @@  discard block
 block discarded – undo
340 340
 		$critical_pages = array(
341 341
 			array(
342 342
 				'id' =>'reg_page_id',
343
-				'name' => __( 'Registration Checkout', 'event_espresso' ),
343
+				'name' => __('Registration Checkout', 'event_espresso'),
344 344
 				'post' => NULL,
345 345
 				'code' => 'ESPRESSO_CHECKOUT'
346 346
 			),
347 347
 			array(
348 348
 				'id' => 'txn_page_id',
349
-				'name' => __( 'Transactions', 'event_espresso' ),
349
+				'name' => __('Transactions', 'event_espresso'),
350 350
 				'post' => NULL,
351 351
 				'code' => 'ESPRESSO_TXN_PAGE'
352 352
 			),
353 353
 			array(
354 354
 				'id' => 'thank_you_page_id',
355
-				'name' => __( 'Thank You', 'event_espresso' ),
355
+				'name' => __('Thank You', 'event_espresso'),
356 356
 				'post' => NULL,
357 357
 				'code' => 'ESPRESSO_THANK_YOU'
358 358
 			),
359 359
 			array(
360 360
 				'id' => 'cancel_page_id',
361
-				'name' => __( 'Registration Cancelled', 'event_espresso' ),
361
+				'name' => __('Registration Cancelled', 'event_espresso'),
362 362
 				'post' => NULL,
363 363
 				'code' => 'ESPRESSO_CANCELLED'
364 364
 			),
365 365
 		);
366 366
 
367
-		foreach ( $critical_pages as $critical_page ) {
367
+		foreach ($critical_pages as $critical_page) {
368 368
 			// is critical page ID set in config ?
369
-			if ( EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE ) {
369
+			if (EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE) {
370 370
 				// attempt to find post by ID
371
-				$critical_page['post'] = get_post( EE_Registry::instance()->CFG->core->$critical_page['id'] );
371
+				$critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->$critical_page['id']);
372 372
 			}
373 373
 			// no dice?
374
-			if ( $critical_page['post'] == NULL ) {
374
+			if ($critical_page['post'] == NULL) {
375 375
 				// attempt to find post by title
376
-				$critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] );
376
+				$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
377 377
 				// still nothing?
378
-				if ( $critical_page['post'] == NULL ) {
379
-					$critical_page = EEH_Activation::create_critical_page( $critical_page );
378
+				if ($critical_page['post'] == NULL) {
379
+					$critical_page = EEH_Activation::create_critical_page($critical_page);
380 380
 					// REALLY? Still nothing ??!?!?
381
-					if ( $critical_page['post'] == NULL ) {
382
-						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
383
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
381
+					if ($critical_page['post'] == NULL) {
382
+						$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
383
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
384 384
 						break;
385 385
 					}
386 386
 				}
387 387
 			}
388 388
 			// track post_shortcodes
389
-			if ( $critical_page['post'] ) {
390
-				EEH_Activation::_track_critical_page_post_shortcodes( $critical_page );
389
+			if ($critical_page['post']) {
390
+				EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
391 391
 			}
392 392
 			// check that Post ID matches critical page ID in config
393
-			if ( isset( $critical_page['post']->ID ) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id'] ) {
393
+			if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id']) {
394 394
 				//update Config with post ID
395 395
 				EE_Registry::instance()->CFG->core->$critical_page['id'] = $critical_page['post']->ID;
396
-				if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) {
397
-					$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
398
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
396
+				if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
397
+					$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
398
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
399 399
 				}
400 400
 			}
401 401
 
402
-			$critical_page_problem =  ! isset( $critical_page['post']->post_status ) || $critical_page['post']->post_status != 'publish' || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE ? TRUE : $critical_page_problem;
402
+			$critical_page_problem = ! isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem;
403 403
 
404 404
 		}
405 405
 
406
-		if ( $critical_page_problem ) {
406
+		if ($critical_page_problem) {
407 407
 			$msg = sprintf(
408
-				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ),
409
-				'<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>'
408
+				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'),
409
+				'<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>'
410 410
 			);
411
-			EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg );
411
+			EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
412 412
 		}
413 413
 
414
-		if ( EE_Error::has_notices() ) {
415
-			EE_Error::get_notices( FALSE, TRUE, TRUE );
414
+		if (EE_Error::has_notices()) {
415
+			EE_Error::get_notices(FALSE, TRUE, TRUE);
416 416
 		}
417 417
 
418 418
 	}
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
 	 * parameter to the shortcode
426 426
 	 * @return WP_Post or NULl
427 427
 	 */
428
-	public static function get_page_by_ee_shortcode($ee_shortcode){
428
+	public static function get_page_by_ee_shortcode($ee_shortcode) {
429 429
 		global $wpdb;
430 430
 		$shortcode_and_opening_bracket = '['.$ee_shortcode;
431 431
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
432
-		if($post_id){
432
+		if ($post_id) {
433 433
 			return get_post($post_id);
434
-		}else{
434
+		} else {
435 435
 			return NULL;
436 436
 		}
437 437
 
@@ -448,32 +448,32 @@  discard block
 block discarded – undo
448 448
 	 * @param array $critical_page
449 449
 	 * @return array
450 450
 	 */
451
-	public static function create_critical_page( $critical_page ) {
451
+	public static function create_critical_page($critical_page) {
452 452
 
453 453
 		$post_args = array(
454 454
 			'post_title' => $critical_page['name'],
455 455
 			'post_status' => 'publish',
456 456
 			'post_type' => 'page',
457 457
 			'comment_status' => 'closed',
458
-			'post_content' => '[' . $critical_page['code'] . ']'
458
+			'post_content' => '['.$critical_page['code'].']'
459 459
 		);
460 460
 
461
-		$post_id = wp_insert_post( $post_args );
462
-		if ( ! $post_id ) {
461
+		$post_id = wp_insert_post($post_args);
462
+		if ( ! $post_id) {
463 463
 			$msg = sprintf(
464
-				__( 'The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso' ),
464
+				__('The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso'),
465 465
 				$critical_page['name']
466 466
 			);
467
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
467
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
468 468
 			return $critical_page;
469 469
 		}
470 470
 		// get newly created post's details
471
-		if ( ! $critical_page['post'] = get_post( $post_id )) {
471
+		if ( ! $critical_page['post'] = get_post($post_id)) {
472 472
 			$msg = sprintf(
473
-				__( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ),
473
+				__('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'),
474 474
 				$critical_page['name']
475 475
 			);
476
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
476
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
477 477
 		}
478 478
 
479 479
 		return $critical_page;
@@ -492,34 +492,34 @@  discard block
 block discarded – undo
492 492
 	 * @param array $critical_page
493 493
 	 * @return void
494 494
 	 */
495
-	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
495
+	private static function _track_critical_page_post_shortcodes($critical_page = array()) {
496 496
 		// check the goods
497
-		if ( ! $critical_page['post'] instanceof WP_Post ) {
497
+		if ( ! $critical_page['post'] instanceof WP_Post) {
498 498
 			$msg = sprintf(
499
-				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
499
+				__('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'),
500 500
 				$critical_page['name']
501 501
 			);
502
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
502
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
503 503
 			return;
504 504
 		}
505 505
 		// map shortcode to post
506
-		EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
506
+		EE_Registry::instance()->CFG->core->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID;
507 507
 		// and make sure it's NOT added to the WP "Posts Page"
508 508
 		// name of the WP Posts Page
509 509
 		$posts_page = EE_Registry::instance()->CFG->get_page_for_posts();
510
-		if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ] )) {
511
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ][ $critical_page['code'] ] );
510
+		if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page])) {
511
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page][$critical_page['code']]);
512 512
 		}
513
-		if ( $posts_page != 'posts' && isset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'] )) {
514
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'][ $critical_page['code'] ] );
513
+		if ($posts_page != 'posts' && isset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'])) {
514
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'][$critical_page['code']]);
515 515
 		}
516 516
 		// update post_shortcode CFG
517
-		if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) {
517
+		if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
518 518
 			$msg = sprintf(
519
-				__( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ),
519
+				__('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'),
520 520
 				$critical_page['name']
521 521
 			);
522
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
522
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
523 523
 		}
524 524
 	}
525 525
 
@@ -537,24 +537,24 @@  discard block
 block discarded – undo
537 537
 	public static function get_default_creator_id() {
538 538
 		global $wpdb;
539 539
 
540
-		if ( ! empty( self::$_default_creator_id ) ) {
540
+		if ( ! empty(self::$_default_creator_id)) {
541 541
 			return self::$_default_creator_id;
542 542
 		}/**/
543 543
 
544
-		$role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' );
544
+		$role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator');
545 545
 
546 546
 		//let's allow pre_filtering for early exits by alternative methods for getting id.  We check for truthy result and if so then exit early.
547
-		$pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check );
548
-		if ( $pre_filtered_id !== false ) {
547
+		$pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check);
548
+		if ($pre_filtered_id !== false) {
549 549
 			return (int) $pre_filtered_id;
550 550
 		}
551 551
 
552
-		$capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' );
553
-		$query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' );
554
-		$user_id = $wpdb->get_var( $query );
555
-		 $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id );
556
-		 if ( $user_id && intval( $user_id ) ) {
557
-		 	self::$_default_creator_id =  intval( $user_id );
552
+		$capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities');
553
+		$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%');
554
+		$user_id = $wpdb->get_var($query);
555
+		 $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id);
556
+		 if ($user_id && intval($user_id)) {
557
+		 	self::$_default_creator_id = intval($user_id);
558 558
 		 	return self::$_default_creator_id;
559 559
 		 } else {
560 560
 		 	return NULL;
@@ -581,29 +581,29 @@  discard block
 block discarded – undo
581 581
 	 * 	@return void
582 582
 	 * @throws EE_Error if there are database errors
583 583
 	 */
584
-	public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) {
585
-		if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){
584
+	public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) {
585
+		if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) {
586 586
 			return;
587 587
 		}
588
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
589
-		if ( ! function_exists( 'dbDelta' )) {
590
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
588
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
589
+		if ( ! function_exists('dbDelta')) {
590
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
591 591
 		}
592 592
 		/** @var WPDB $wpdb */
593 593
 		global $wpdb;
594
-		$wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
594
+		$wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
595 595
 		// do we need to first delete an existing version of this table ?
596
-		if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){
596
+		if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) {
597 597
 			// ok, delete the table... but ONLY if it's empty
598
-			$deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name );
598
+			$deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name);
599 599
 			// table is NOT empty, are you SURE you want to delete this table ???
600
-			if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
601
-				EEH_Activation::delete_unused_db_table( $wp_table_name );
602
-			} else if ( ! $deleted_safely ) {
600
+			if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) {
601
+				EEH_Activation::delete_unused_db_table($wp_table_name);
602
+			} else if ( ! $deleted_safely) {
603 603
 				// so we should be more cautious rather than just dropping tables so easily
604 604
 				EE_Error::add_persistent_admin_notice(
605
-						'bad_table_' . $wp_table_name . '_detected',
606
-						sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ),
605
+						'bad_table_'.$wp_table_name.'_detected',
606
+						sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'),
607 607
 								$wp_table_name,
608 608
 								"<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>",
609 609
 								'<b>wp-config.php</b>',
@@ -612,25 +612,25 @@  discard block
 block discarded – undo
612 612
 			}
613 613
 		}
614 614
 		// does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns )
615
-		if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) {
615
+		if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) {
616 616
 			$SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
617 617
 			//get $wpdb to echo errors, but buffer them. This way at least WE know an error
618 618
 			//happened. And then we can choose to tell the end user
619
-			$old_show_errors_policy = $wpdb->show_errors( TRUE );
620
-			$old_error_suppression_policy = $wpdb->suppress_errors( FALSE );
619
+			$old_show_errors_policy = $wpdb->show_errors(TRUE);
620
+			$old_error_suppression_policy = $wpdb->suppress_errors(FALSE);
621 621
 			ob_start();
622
-			dbDelta( $SQL );
622
+			dbDelta($SQL);
623 623
 			$output = ob_get_contents();
624 624
 			ob_end_clean();
625
-			$wpdb->show_errors( $old_show_errors_policy );
626
-			$wpdb->suppress_errors( $old_error_suppression_policy );
627
-			if( ! empty( $output ) ){
628
-				throw new EE_Error( $output	);
625
+			$wpdb->show_errors($old_show_errors_policy);
626
+			$wpdb->suppress_errors($old_error_suppression_policy);
627
+			if ( ! empty($output)) {
628
+				throw new EE_Error($output);
629 629
 			}
630 630
 		} else {
631 631
 			throw new EE_Error(
632 632
 				sprintf(
633
-					__( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ),
633
+					__('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'),
634 634
 					'<br />',
635 635
 					$sql
636 636
 				)
@@ -652,15 +652,15 @@  discard block
 block discarded – undo
652 652
 	 * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)'
653 653
 	 * @return bool|int
654 654
 	 */
655
-	public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){
656
-		if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){
655
+	public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') {
656
+		if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) {
657 657
 			return FALSE;
658 658
 		}
659 659
 		global $wpdb;
660
-		$full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name );
660
+		$full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
661 661
 		$fields = self::get_fields_on_table($table_name);
662
-		if (!in_array($column_name, $fields)){
663
-			$alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info";
662
+		if ( ! in_array($column_name, $fields)) {
663
+			$alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info";
664 664
 			//echo "alter query:$alter_query";
665 665
 			return $wpdb->query($alter_query);
666 666
 		}
@@ -679,15 +679,15 @@  discard block
 block discarded – undo
679 679
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
680 680
 	 * 	@return array of database column names
681 681
 	 */
682
-	public static function get_fields_on_table( $table_name = NULL ) {
682
+	public static function get_fields_on_table($table_name = NULL) {
683 683
 		global $wpdb;
684
-		$table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name );
685
-		if ( ! empty( $table_name )) {
684
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
685
+		if ( ! empty($table_name)) {
686 686
 			$columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name ");
687 687
 			if ($columns !== FALSE) {
688 688
 				$field_array = array();
689
-				foreach($columns as $column ){
690
-					$field_array[] = $column->Field;;
689
+				foreach ($columns as $column) {
690
+					$field_array[] = $column->Field; ;
691 691
 				}
692 692
 				return $field_array;
693 693
 			}
@@ -705,12 +705,12 @@  discard block
 block discarded – undo
705 705
 	 * @param string $table_name
706 706
 	 * @return bool
707 707
 	 */
708
-	public static function db_table_is_empty( $table_name ) {
708
+	public static function db_table_is_empty($table_name) {
709 709
 		global $wpdb;
710
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
711
-		if ( EEH_Activation::table_exists( $table_name ) ) {
712
-			$count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" );
713
-			return absint( $count ) === 0 ? true : false;
710
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
711
+		if (EEH_Activation::table_exists($table_name)) {
712
+			$count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
713
+			return absint($count) === 0 ? true : false;
714 714
 		}
715 715
 		return false;
716 716
 	}
@@ -725,9 +725,9 @@  discard block
 block discarded – undo
725 725
 	 * @param string $table_name
726 726
 	 * @return bool | int
727 727
 	 */
728
-	public static function delete_db_table_if_empty( $table_name ) {
729
-		if ( EEH_Activation::db_table_is_empty( $table_name ) ) {
730
-			return EEH_Activation::delete_unused_db_table( $table_name );
728
+	public static function delete_db_table_if_empty($table_name) {
729
+		if (EEH_Activation::db_table_is_empty($table_name)) {
730
+			return EEH_Activation::delete_unused_db_table($table_name);
731 731
 		}
732 732
 		return false;
733 733
 	}
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 	 * @param string $table_name
743 743
 	 * @return bool | int
744 744
 	 */
745
-	public static function delete_unused_db_table( $table_name ) {
745
+	public static function delete_unused_db_table($table_name) {
746 746
 		global $wpdb;
747
-		if ( EEH_Activation::table_exists( $table_name ) ) {
748
-			$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
749
-			return $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
747
+		if (EEH_Activation::table_exists($table_name)) {
748
+			$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
749
+			return $wpdb->query("DROP TABLE IF EXISTS $table_name");
750 750
 		}
751 751
 		return false;
752 752
 	}
@@ -762,18 +762,18 @@  discard block
 block discarded – undo
762 762
 	 * @param string $index_name
763 763
 	 * @return bool | int
764 764
 	 */
765
-	public static function drop_index( $table_name, $index_name ) {
766
-		if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){
765
+	public static function drop_index($table_name, $index_name) {
766
+		if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) {
767 767
 			return FALSE;
768 768
 		}
769 769
 		global $wpdb;
770
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
770
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
771 771
 		$index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'";
772 772
 		if (
773
-			$wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) == $table_name
774
-			&& $wpdb->get_var( $index_exists_query ) == $table_name //using get_var with the $index_exists_query returns the table's name
773
+			$wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name
774
+			&& $wpdb->get_var($index_exists_query) == $table_name //using get_var with the $index_exists_query returns the table's name
775 775
 		) {
776
-			return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" );
776
+			return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name");
777 777
 		}
778 778
 		return TRUE;
779 779
 	}
@@ -789,27 +789,27 @@  discard block
 block discarded – undo
789 789
 	 * @return boolean success (whether database is setup properly or not)
790 790
 	 */
791 791
 	public static function create_database_tables() {
792
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
792
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
793 793
 		//find the migration script that sets the database to be compatible with the code
794 794
 		$dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms();
795
-		if( $dms_name ){
796
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name );
797
-			$current_data_migration_script->set_migrating( false );
795
+		if ($dms_name) {
796
+			$current_data_migration_script = EE_Registry::instance()->load_dms($dms_name);
797
+			$current_data_migration_script->set_migrating(false);
798 798
 			$current_data_migration_script->schema_changes_before_migration();
799 799
 			$current_data_migration_script->schema_changes_after_migration();
800
-			if( $current_data_migration_script->get_errors() ){
801
-				if( WP_DEBUG ){
802
-					foreach( $current_data_migration_script->get_errors() as $error ){
803
-						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
800
+			if ($current_data_migration_script->get_errors()) {
801
+				if (WP_DEBUG) {
802
+					foreach ($current_data_migration_script->get_errors() as $error) {
803
+						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
804 804
 					}
805
-				}else{
806
-					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
805
+				} else {
806
+					EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso'));
807 807
 				}
808 808
 				return false;
809 809
 			}
810 810
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
811
-		}else{
812
-			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
811
+		} else {
812
+			EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
813 813
 			return false;
814 814
 		}
815 815
 		return true;
@@ -829,27 +829,27 @@  discard block
 block discarded – undo
829 829
 	public static function initialize_system_questions() {
830 830
 		// QUESTION GROUPS
831 831
 		global $wpdb;
832
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' );
832
+		$table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group');
833 833
 		$SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0";
834 834
 		// what we have
835
-		$question_groups = $wpdb->get_col( $SQL );
835
+		$question_groups = $wpdb->get_col($SQL);
836 836
 		// check the response
837
-		$question_groups = is_array( $question_groups ) ? $question_groups : array();
837
+		$question_groups = is_array($question_groups) ? $question_groups : array();
838 838
 		// what we should have
839
-		$QSG_systems = array( 1, 2 );
839
+		$QSG_systems = array(1, 2);
840 840
 		// loop thru what we should have and compare to what we have
841
-		foreach ( $QSG_systems as $QSG_system ) {
841
+		foreach ($QSG_systems as $QSG_system) {
842 842
 			// reset values array
843 843
 			$QSG_values = array();
844 844
 			// if we don't have what we should have (but use $QST_system as as string because that's what we got from the db)
845
-			if ( ! in_array( "$QSG_system", $question_groups )) {
845
+			if ( ! in_array("$QSG_system", $question_groups)) {
846 846
 				// add it
847
-				switch ( $QSG_system ) {
847
+				switch ($QSG_system) {
848 848
 
849 849
 					case 1:
850 850
 							$QSG_values = array(
851
-									'QSG_name' => __( 'Personal Information', 'event_espresso' ),
852
-									'QSG_identifier' => 'personal-information-' . time(),
851
+									'QSG_name' => __('Personal Information', 'event_espresso'),
852
+									'QSG_identifier' => 'personal-information-'.time(),
853 853
 									'QSG_desc' => '',
854 854
 									'QSG_order' => 1,
855 855
 									'QSG_show_group_name' => 1,
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 
862 862
 					case 2:
863 863
 							$QSG_values = array(
864
-									'QSG_name' => __( 'Address Information','event_espresso' ),
865
-									'QSG_identifier' => 'address-information-' . time(),
864
+									'QSG_name' => __('Address Information', 'event_espresso'),
865
+									'QSG_identifier' => 'address-information-'.time(),
866 866
 									'QSG_desc' => '',
867 867
 									'QSG_order' => 2,
868 868
 									'QSG_show_group_name' => 1,
@@ -874,14 +874,14 @@  discard block
 block discarded – undo
874 874
 
875 875
 				}
876 876
 				// make sure we have some values before inserting them
877
-				if ( ! empty( $QSG_values )) {
877
+				if ( ! empty($QSG_values)) {
878 878
 					// insert system question
879 879
 					$wpdb->insert(
880 880
 						$table_name,
881 881
 						$QSG_values,
882
-						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' )
882
+						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d')
883 883
 					);
884
-					$QSG_IDs[ $QSG_system ] = $wpdb->insert_id;
884
+					$QSG_IDs[$QSG_system] = $wpdb->insert_id;
885 885
 				}
886 886
 			}
887 887
 		}
@@ -890,10 +890,10 @@  discard block
 block discarded – undo
890 890
 
891 891
 		// QUESTIONS
892 892
 		global $wpdb;
893
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' );
893
+		$table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question');
894 894
 		$SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''";
895 895
 		// what we have
896
-		$questions = $wpdb->get_col( $SQL );
896
+		$questions = $wpdb->get_col($SQL);
897 897
 		// what we should have
898 898
 		$QST_systems = array(
899 899
 			'fname',
@@ -910,25 +910,25 @@  discard block
 block discarded – undo
910 910
 		$order_for_group_1 = 1;
911 911
 		$order_for_group_2 = 1;
912 912
 		// loop thru what we should have and compare to what we have
913
-		foreach ( $QST_systems as $QST_system ) {
913
+		foreach ($QST_systems as $QST_system) {
914 914
 			// reset values array
915 915
 			$QST_values = array();
916 916
 			// if we don't have what we should have
917
-			if ( ! in_array( $QST_system, $questions )) {
917
+			if ( ! in_array($QST_system, $questions)) {
918 918
 				// add it
919
-				switch ( $QST_system ) {
919
+				switch ($QST_system) {
920 920
 
921 921
 					case 'fname':
922 922
 							$QST_values = array(
923
-									'QST_display_text' => __( 'First Name', 'event_espresso' ),
924
-									'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ),
923
+									'QST_display_text' => __('First Name', 'event_espresso'),
924
+									'QST_admin_label' => __('First Name - System Question', 'event_espresso'),
925 925
 									'QST_system' => 'fname',
926 926
 									'QST_type' => 'TEXT',
927 927
 									'QST_required' => 1,
928
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
928
+									'QST_required_text' => __('This field is required', 'event_espresso'),
929 929
 									'QST_order' => 1,
930 930
 									'QST_admin_only' => 0,
931
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
931
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
932 932
 									'QST_wp_user' => self::get_default_creator_id(),
933 933
 									'QST_deleted' => 0
934 934
 								);
@@ -936,15 +936,15 @@  discard block
 block discarded – undo
936 936
 
937 937
 					case 'lname':
938 938
 							$QST_values = array(
939
-									'QST_display_text' => __( 'Last Name', 'event_espresso' ),
940
-									'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ),
939
+									'QST_display_text' => __('Last Name', 'event_espresso'),
940
+									'QST_admin_label' => __('Last Name - System Question', 'event_espresso'),
941 941
 									'QST_system' => 'lname',
942 942
 									'QST_type' => 'TEXT',
943 943
 									'QST_required' => 1,
944
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
944
+									'QST_required_text' => __('This field is required', 'event_espresso'),
945 945
 									'QST_order' => 2,
946 946
 									'QST_admin_only' => 0,
947
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
947
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
948 948
 									'QST_wp_user' => self::get_default_creator_id(),
949 949
 									'QST_deleted' => 0
950 950
 								);
@@ -952,15 +952,15 @@  discard block
 block discarded – undo
952 952
 
953 953
 					case 'email':
954 954
 							$QST_values = array(
955
-									'QST_display_text' => __( 'Email Address', 'event_espresso' ),
956
-									'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ),
955
+									'QST_display_text' => __('Email Address', 'event_espresso'),
956
+									'QST_admin_label' => __('Email Address - System Question', 'event_espresso'),
957 957
 									'QST_system' => 'email',
958 958
 									'QST_type' => 'TEXT',
959 959
 									'QST_required' => 1,
960
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
960
+									'QST_required_text' => __('This field is required', 'event_espresso'),
961 961
 									'QST_order' => 3,
962 962
 									'QST_admin_only' => 0,
963
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
963
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
964 964
 									'QST_wp_user' => self::get_default_creator_id(),
965 965
 									'QST_deleted' => 0
966 966
 								);
@@ -968,15 +968,15 @@  discard block
 block discarded – undo
968 968
 
969 969
 					case 'address':
970 970
 							$QST_values = array(
971
-									'QST_display_text' => __( 'Address', 'event_espresso' ),
972
-									'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ),
971
+									'QST_display_text' => __('Address', 'event_espresso'),
972
+									'QST_admin_label' => __('Address - System Question', 'event_espresso'),
973 973
 									'QST_system' => 'address',
974 974
 									'QST_type' => 'TEXT',
975 975
 									'QST_required' => 0,
976
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
976
+									'QST_required_text' => __('This field is required', 'event_espresso'),
977 977
 									'QST_order' => 4,
978 978
 									'QST_admin_only' => 0,
979
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
979
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
980 980
 									'QST_wp_user' => self::get_default_creator_id(),
981 981
 									'QST_deleted' => 0
982 982
 								);
@@ -984,15 +984,15 @@  discard block
 block discarded – undo
984 984
 
985 985
 					case 'address2':
986 986
 							$QST_values = array(
987
-									'QST_display_text' => __( 'Address2', 'event_espresso' ),
988
-									'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ),
987
+									'QST_display_text' => __('Address2', 'event_espresso'),
988
+									'QST_admin_label' => __('Address2 - System Question', 'event_espresso'),
989 989
 									'QST_system' => 'address2',
990 990
 									'QST_type' => 'TEXT',
991 991
 									'QST_required' => 0,
992
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
992
+									'QST_required_text' => __('This field is required', 'event_espresso'),
993 993
 									'QST_order' => 5,
994 994
 									'QST_admin_only' => 0,
995
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
995
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
996 996
 									'QST_wp_user' => self::get_default_creator_id(),
997 997
 									'QST_deleted' => 0
998 998
 								);
@@ -1000,15 +1000,15 @@  discard block
 block discarded – undo
1000 1000
 
1001 1001
 					case 'city':
1002 1002
 							$QST_values = array(
1003
-									'QST_display_text' => __( 'City', 'event_espresso' ),
1004
-									'QST_admin_label' => __( 'City - System Question', 'event_espresso' ),
1003
+									'QST_display_text' => __('City', 'event_espresso'),
1004
+									'QST_admin_label' => __('City - System Question', 'event_espresso'),
1005 1005
 									'QST_system' => 'city',
1006 1006
 									'QST_type' => 'TEXT',
1007 1007
 									'QST_required' => 0,
1008
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1008
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1009 1009
 									'QST_order' => 6,
1010 1010
 									'QST_admin_only' => 0,
1011
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1011
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1012 1012
 									'QST_wp_user' => self::get_default_creator_id(),
1013 1013
 									'QST_deleted' => 0
1014 1014
 								);
@@ -1016,12 +1016,12 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
 					case 'state':
1018 1018
 							$QST_values = array(
1019
-									'QST_display_text' => __( 'State/Province', 'event_espresso' ),
1020
-									'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ),
1019
+									'QST_display_text' => __('State/Province', 'event_espresso'),
1020
+									'QST_admin_label' => __('State/Province - System Question', 'event_espresso'),
1021 1021
 									'QST_system' => 'state',
1022 1022
 									'QST_type' => 'STATE',
1023 1023
 									'QST_required' => 0,
1024
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1024
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1025 1025
 									'QST_order' => 7,
1026 1026
 									'QST_admin_only' => 0,
1027 1027
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1031,12 +1031,12 @@  discard block
 block discarded – undo
1031 1031
 
1032 1032
 					case 'country' :
1033 1033
 							$QST_values = array(
1034
-									'QST_display_text' => __( 'Country', 'event_espresso' ),
1035
-									'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ),
1034
+									'QST_display_text' => __('Country', 'event_espresso'),
1035
+									'QST_admin_label' => __('Country - System Question', 'event_espresso'),
1036 1036
 									'QST_system' => 'country',
1037 1037
 									'QST_type' => 'COUNTRY',
1038 1038
 									'QST_required' => 0,
1039
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1039
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1040 1040
 									'QST_order' => 8,
1041 1041
 									'QST_admin_only' => 0,
1042 1042
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1046,15 +1046,15 @@  discard block
 block discarded – undo
1046 1046
 
1047 1047
 					case 'zip':
1048 1048
 							$QST_values = array(
1049
-									'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ),
1050
-									'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ),
1049
+									'QST_display_text' => __('Zip/Postal Code', 'event_espresso'),
1050
+									'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'),
1051 1051
 									'QST_system' => 'zip',
1052 1052
 									'QST_type' => 'TEXT',
1053 1053
 									'QST_required' => 0,
1054
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1054
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1055 1055
 									'QST_order' => 9,
1056 1056
 									'QST_admin_only' => 0,
1057
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1057
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1058 1058
 									'QST_wp_user' => self::get_default_creator_id(),
1059 1059
 									'QST_deleted' => 0
1060 1060
 								);
@@ -1062,49 +1062,49 @@  discard block
 block discarded – undo
1062 1062
 
1063 1063
 					case 'phone':
1064 1064
 							$QST_values = array(
1065
-									'QST_display_text' => __( 'Phone Number', 'event_espresso' ),
1066
-									'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ),
1065
+									'QST_display_text' => __('Phone Number', 'event_espresso'),
1066
+									'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'),
1067 1067
 									'QST_system' => 'phone',
1068 1068
 									'QST_type' => 'TEXT',
1069 1069
 									'QST_required' => 0,
1070
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1070
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1071 1071
 									'QST_order' => 10,
1072 1072
 									'QST_admin_only' => 0,
1073
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1073
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1074 1074
 									'QST_wp_user' => self::get_default_creator_id(),
1075 1075
 									'QST_deleted' => 0
1076 1076
 								);
1077 1077
 						break;
1078 1078
 
1079 1079
 				}
1080
-				if ( ! empty( $QST_values )) {
1080
+				if ( ! empty($QST_values)) {
1081 1081
 					// insert system question
1082 1082
 					$wpdb->insert(
1083 1083
 						$table_name,
1084 1084
 						$QST_values,
1085
-						array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' )
1085
+						array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d')
1086 1086
 					);
1087 1087
 					$QST_ID = $wpdb->insert_id;
1088 1088
 
1089 1089
 					// QUESTION GROUP QUESTIONS
1090
-					if(  in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) {
1090
+					if (in_array($QST_system, array('fname', 'lname', 'email'))) {
1091 1091
 						$system_question_we_want = EEM_Question_Group::system_personal;
1092 1092
 					} else {
1093 1093
 						$system_question_we_want = EEM_Question_Group::system_address;
1094 1094
 					}
1095
-					if( isset( $QSG_IDs[ $system_question_we_want ] ) ) {
1096
-						$QSG_ID = $QSG_IDs[ $system_question_we_want ];
1095
+					if (isset($QSG_IDs[$system_question_we_want])) {
1096
+						$QSG_ID = $QSG_IDs[$system_question_we_want];
1097 1097
 					} else {
1098
-						$id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) );
1099
-						if( is_array( $id_col ) ) {
1100
-							$QSG_ID = reset( $id_col );
1098
+						$id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want)));
1099
+						if (is_array($id_col)) {
1100
+							$QSG_ID = reset($id_col);
1101 1101
 						} else {
1102 1102
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1103 1103
                                                         EE_Log::instance()->log( 
1104 1104
                                                                 __FILE__, 
1105 1105
                                                                 __FUNCTION__, 
1106 1106
                                                                 sprintf( 
1107
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1107
+                                                                        __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), 
1108 1108
                                                                         $QST_ID ), 
1109 1109
                                                                 'error' );
1110 1110
                                                         continue;
@@ -1113,9 +1113,9 @@  discard block
 block discarded – undo
1113 1113
                                         
1114 1114
 					// add system questions to groups
1115 1115
 					$wpdb->insert(
1116
-						EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ),
1117
-						array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ),
1118
-						array( '%d', '%d','%d' )
1116
+						EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'),
1117
+						array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++),
1118
+						array('%d', '%d', '%d')
1119 1119
 					);
1120 1120
 				}
1121 1121
 			}
@@ -1127,11 +1127,11 @@  discard block
 block discarded – undo
1127 1127
 	 * Makes sure the default payment method (Invoice) is active.
1128 1128
 	 * This used to be done automatically as part of constructing the old gateways config
1129 1129
 	 */
1130
-	public static function insert_default_payment_methods(){
1131
-		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1132
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1133
-			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1134
-		}else{
1130
+	public static function insert_default_payment_methods() {
1131
+		if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) {
1132
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
1133
+			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
1134
+		} else {
1135 1135
 			EEM_Payment_Method::instance()->verify_button_urls();
1136 1136
 		}
1137 1137
 	}
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 
1148 1148
 		global $wpdb;
1149 1149
 
1150
-		if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) {
1150
+		if (EEH_Activation::table_exists(EEM_Status::instance()->table())) {
1151 1151
 
1152 1152
 			$table_name = EEM_Status::instance()->table();
1153 1153
 
@@ -1213,38 +1213,38 @@  discard block
 block discarded – undo
1213 1213
 	 * 	@return boolean success of verifying upload directories exist
1214 1214
 	 */
1215 1215
 	public static function create_upload_directories() {
1216
-		EE_Registry::instance()->load_helper( 'File' );
1216
+		EE_Registry::instance()->load_helper('File');
1217 1217
 		// Create the required folders
1218 1218
 		$folders = array(
1219 1219
 				EVENT_ESPRESSO_TEMPLATE_DIR,
1220 1220
 				EVENT_ESPRESSO_GATEWAY_DIR,
1221
-				EVENT_ESPRESSO_UPLOAD_DIR . 'logs/',
1222
-				EVENT_ESPRESSO_UPLOAD_DIR . 'css/',
1223
-				EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/'
1221
+				EVENT_ESPRESSO_UPLOAD_DIR.'logs/',
1222
+				EVENT_ESPRESSO_UPLOAD_DIR.'css/',
1223
+				EVENT_ESPRESSO_UPLOAD_DIR.'tickets/'
1224 1224
 		);
1225
-		foreach ( $folders as $folder ) {
1225
+		foreach ($folders as $folder) {
1226 1226
 			try {
1227
-				EEH_File::ensure_folder_exists_and_is_writable( $folder );
1228
-				@ chmod( $folder, 0755 );
1229
-			} catch( EE_Error $e ){
1227
+				EEH_File::ensure_folder_exists_and_is_writable($folder);
1228
+				@ chmod($folder, 0755);
1229
+			} catch (EE_Error $e) {
1230 1230
 				EE_Error::add_error(
1231 1231
 					sprintf(
1232
-						__(  'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ),
1232
+						__('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'),
1233 1233
 						$folder,
1234
-						'<br />' . $e->getMessage()
1234
+						'<br />'.$e->getMessage()
1235 1235
 					),
1236 1236
 					__FILE__, __FUNCTION__, __LINE__
1237 1237
 				);
1238 1238
 				//indicate we'll need to fix this later
1239
-				update_option( EEH_Activation::upload_directories_incomplete_option_name, true );
1239
+				update_option(EEH_Activation::upload_directories_incomplete_option_name, true);
1240 1240
 				return FALSE;
1241 1241
 			}
1242 1242
 		}
1243 1243
 		//just add the .htaccess file to the logs directory to begin with. Even if logging
1244 1244
 		//is disabled, there might be activation errors recorded in there
1245
-		EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' );
1245
+		EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/');
1246 1246
 		//remember EE's folders are all good
1247
-		delete_option( EEH_Activation::upload_directories_incomplete_option_name );
1247
+		delete_option(EEH_Activation::upload_directories_incomplete_option_name);
1248 1248
 		return TRUE;
1249 1249
 	}
1250 1250
 	
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 	 * @return boolean
1258 1258
 	 */
1259 1259
 	public static function upload_directories_incomplete() {
1260
-		return get_option( EEH_Activation::upload_directories_incomplete_option_name, false );
1260
+		return get_option(EEH_Activation::upload_directories_incomplete_option_name, false);
1261 1261
 	}
1262 1262
 
1263 1263
 
@@ -1276,16 +1276,16 @@  discard block
 block discarded – undo
1276 1276
 		$installed_messengers = $default_messengers = array();
1277 1277
 
1278 1278
 		//include our helper
1279
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1279
+		EE_Registry::instance()->load_helper('MSG_Template');
1280 1280
 
1281 1281
 		//get all installed messenger objects
1282 1282
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1283 1283
 
1284 1284
 		//let's setup the $installed messengers in an array AND the messengers that are set to be activated on install.
1285
-		foreach ( $installed['messengers'] as $msgr ) {
1286
-			if ( $msgr instanceof EE_messenger ) {
1285
+		foreach ($installed['messengers'] as $msgr) {
1286
+			if ($msgr instanceof EE_messenger) {
1287 1287
 				$installed_messengers[$msgr->name] = $msgr;
1288
-				if ( $msgr->activate_on_install ) {
1288
+				if ($msgr->activate_on_install) {
1289 1289
 					$default_messengers[] = $msgr->name;
1290 1290
 				}
1291 1291
 			}
@@ -1295,36 +1295,36 @@  discard block
 block discarded – undo
1295 1295
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1296 1296
 
1297 1297
 		//things that have already been activated before
1298
-		$has_activated = get_option( 'ee_has_activated_messenger' );
1298
+		$has_activated = get_option('ee_has_activated_messenger');
1299 1299
 
1300 1300
 		//do an initial loop to determine if we need to continue
1301 1301
 		$def_ms = array();
1302
-		foreach ( $default_messengers as $msgr ) {
1303
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
1302
+		foreach ($default_messengers as $msgr) {
1303
+			if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue;
1304 1304
 			$def_ms[] = $msgr;
1305 1305
 		}
1306 1306
 
1307 1307
 		//setup the $installed_mts in an array
1308
-		foreach ( $installed['message_types'] as $imt ) {
1309
-			if ( $imt instanceof EE_message_type ) {
1308
+		foreach ($installed['message_types'] as $imt) {
1309
+			if ($imt instanceof EE_message_type) {
1310 1310
 				$installed_mts[$imt->name] = $imt;
1311 1311
 			}
1312 1312
 		}
1313 1313
 
1314 1314
 		//loop through default array for default messengers (if present)
1315
-		if ( ! empty( $def_ms ) ) {
1316
-			foreach ( $def_ms as $messenger ) {
1315
+		if ( ! empty($def_ms)) {
1316
+			foreach ($def_ms as $messenger) {
1317 1317
 				//all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger.
1318
-				if ( ! isset( $installed_messengers[$messenger] )) {
1318
+				if ( ! isset($installed_messengers[$messenger])) {
1319 1319
 					continue;
1320 1320
 				}
1321 1321
 				/** @var EE_messenger[] $installed_messengers  */
1322 1322
 				$default_mts = $installed_messengers[$messenger]->get_default_message_types();
1323 1323
 				$active_messengers[$messenger]['obj'] = $installed_messengers[$messenger];
1324
-				foreach ( $default_mts as $index => $mt ) {
1324
+				foreach ($default_mts as $index => $mt) {
1325 1325
 					//is there an installed_mt matching the default string?  If not then nothing to do here.
1326
-					if ( ! isset( $installed_mts[$mt] ) ) {
1327
-						unset( $default_mts[$index] );
1326
+					if ( ! isset($installed_mts[$mt])) {
1327
+						unset($default_mts[$index]);
1328 1328
 						continue;
1329 1329
 					}
1330 1330
 
@@ -1333,41 +1333,41 @@  discard block
 block discarded – undo
1333 1333
 					/** @var EE_message_type[] $installed_mts */
1334 1334
 					$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1335 1335
 					$settings = array();
1336
-					if ( is_array( $settings_fields ) ) {
1337
-						foreach ( $settings_fields as $field => $values ) {
1338
-							if ( isset( $values['default'] ) ) {
1336
+					if (is_array($settings_fields)) {
1337
+						foreach ($settings_fields as $field => $values) {
1338
+							if (isset($values['default'])) {
1339 1339
 								$settings[$field] = $values['default'];
1340 1340
 							}
1341 1341
 						}
1342 1342
 					}
1343 1343
 
1344
-					$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1344
+					$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1345 1345
 					$has_activated[$messenger][] = $mt;
1346 1346
 				}
1347 1347
 
1348 1348
 				//setup any initial settings for the messenger
1349 1349
 				$msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields();
1350 1350
 
1351
-				if ( !empty( $msgr_settings ) ) {
1352
-					foreach ( $msgr_settings as $field => $value ) {
1351
+				if ( ! empty($msgr_settings)) {
1352
+					foreach ($msgr_settings as $field => $value) {
1353 1353
 						$active_messengers[$messenger]['settings'][$field] = $value;
1354 1354
 					}
1355 1355
 				}
1356 1356
 
1357 1357
 				//now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate.
1358
-				EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1358
+				EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1359 1359
 
1360 1360
 				//let's generate all the templates but only if the messenger has default_mts (otherwise its just activated).
1361
-				if ( !empty( $default_mts ) ) {
1362
-					$success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE );
1361
+				if ( ! empty($default_mts)) {
1362
+					$success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE);
1363 1363
 				}
1364 1364
 			}
1365 1365
 		} //end check for empty( $def_ms )
1366 1366
 
1367 1367
 		//still need to see if there are any message types to activate for active messengers
1368
-		foreach ( $active_messengers as $messenger => $settings ) {
1368
+		foreach ($active_messengers as $messenger => $settings) {
1369 1369
 			$msg_obj = $settings['obj'];
1370
-			if ( ! $msg_obj instanceof EE_messenger ) {
1370
+			if ( ! $msg_obj instanceof EE_messenger) {
1371 1371
 				continue;
1372 1372
 			}
1373 1373
 
@@ -1375,45 +1375,45 @@  discard block
 block discarded – undo
1375 1375
 			$new_default_mts = array();
1376 1376
 
1377 1377
 			//loop through each default mt reported by the messenger and make sure its set in its active db entry.
1378
-			foreach( $all_default_mts as $index => $mt ) {
1378
+			foreach ($all_default_mts as $index => $mt) {
1379 1379
 				//already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated).
1380
-				if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ||  EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) {
1380
+				if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) {
1381 1381
 					continue;
1382 1382
 				}
1383 1383
 
1384 1384
 				//is there an installed_mt matching the default string?  If not then nothing to do here.
1385
-				if ( ! isset( $installed_mts[$mt] ) ) {
1386
-					unset( $all_default_mts[$mt] );
1385
+				if ( ! isset($installed_mts[$mt])) {
1386
+					unset($all_default_mts[$mt]);
1387 1387
 					continue;
1388 1388
 				}
1389 1389
 
1390 1390
 				$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1391 1391
 				$settings = array();
1392
-				if ( is_array( $settings_fields ) ) {
1393
-					foreach ( $settings_fields as $field => $values ) {
1394
-						if ( isset( $values['default'] ) ) {
1392
+				if (is_array($settings_fields)) {
1393
+					foreach ($settings_fields as $field => $values) {
1394
+						if (isset($values['default'])) {
1395 1395
 							$settings[$field] = $values['default'];
1396 1396
 						}
1397 1397
 					}
1398 1398
 				}
1399 1399
 
1400
-				$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1400
+				$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1401 1401
 				$new_default_mts[] = $mt;
1402 1402
 				$has_activated[$messenger][] = $mt;
1403 1403
 			}
1404 1404
 
1405 1405
 
1406
-			if ( ! empty( $new_default_mts ) ) {
1407
-				$success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE );
1406
+			if ( ! empty($new_default_mts)) {
1407
+				$success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE);
1408 1408
 			}
1409 1409
 
1410 1410
 		}
1411 1411
 
1412 1412
 		//now let's save the settings for this messenger!
1413
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1413
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1414 1414
 
1415 1415
 		//update $has_activated record
1416
-		update_option( 'ee_has_activated_messenger', $has_activated );
1416
+		update_option('ee_has_activated_messenger', $has_activated);
1417 1417
 
1418 1418
 		//that's it!
1419 1419
 		return $success;
@@ -1433,47 +1433,47 @@  discard block
 block discarded – undo
1433 1433
 	 */
1434 1434
 	public static function validate_messages_system() {
1435 1435
 		//include our helper
1436
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1436
+		EE_Registry::instance()->load_helper('MSG_Template');
1437 1437
 
1438 1438
 		//get active and installed  messengers/message types.
1439 1439
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1440 1440
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1441 1441
 		$installed_messengers = $installed_mts = array();
1442 1442
 		//set up the arrays so they can be handled easier.
1443
-		foreach( $installed['messengers'] as $im ) {
1444
-			if ( $im instanceof EE_messenger ) {
1443
+		foreach ($installed['messengers'] as $im) {
1444
+			if ($im instanceof EE_messenger) {
1445 1445
 				$installed_messengers[$im->name] = $im;
1446 1446
 			}
1447 1447
 		}
1448
-		foreach( $installed['message_types'] as $imt ) {
1449
-			if ( $imt instanceof EE_message_type ) {
1448
+		foreach ($installed['message_types'] as $imt) {
1449
+			if ($imt instanceof EE_message_type) {
1450 1450
 				$installed_mts[$imt->name] = $imt;
1451 1451
 			}
1452 1452
 		}
1453 1453
 
1454 1454
 		//now let's loop through the active array and validate
1455
-		foreach( $active_messengers as $messenger => $active_details ) {
1455
+		foreach ($active_messengers as $messenger => $active_details) {
1456 1456
 			//first let's see if this messenger is installed.
1457
-			if ( ! isset( $installed_messengers[$messenger] ) ) {
1457
+			if ( ! isset($installed_messengers[$messenger])) {
1458 1458
 				//not set so let's just remove from actives and make sure templates are inactive.
1459
-				unset( $active_messengers[$messenger] );
1460
-				EEH_MSG_Template::update_to_inactive( $messenger );
1459
+				unset($active_messengers[$messenger]);
1460
+				EEH_MSG_Template::update_to_inactive($messenger);
1461 1461
 				continue;
1462 1462
 			}
1463 1463
 
1464 1464
 			//messenger is active, so let's just make sure that any active message types not installed are deactivated.
1465
-			$mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array();
1466
-			foreach ( $mts as $mt_name => $mt ) {
1467
-				if ( ! isset( $installed_mts[$mt_name] )  ) {
1468
-					unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] );
1469
-					EEH_MSG_Template::update_to_inactive( $messenger, $mt_name );
1465
+			$mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array();
1466
+			foreach ($mts as $mt_name => $mt) {
1467
+				if ( ! isset($installed_mts[$mt_name])) {
1468
+					unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]);
1469
+					EEH_MSG_Template::update_to_inactive($messenger, $mt_name);
1470 1470
 				}
1471 1471
 			}
1472 1472
 		}
1473 1473
 
1474 1474
 		//all done! let's update the active_messengers.
1475
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1476
-		do_action( 'AHEE__EEH_Activation__validate_messages_system' );
1475
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1476
+		do_action('AHEE__EEH_Activation__validate_messages_system');
1477 1477
 		return;
1478 1478
 	}
1479 1479
 
@@ -1487,12 +1487,12 @@  discard block
 block discarded – undo
1487 1487
 	 * 	@static
1488 1488
 	 * 	@return void
1489 1489
 	 */
1490
-	public static function create_no_ticket_prices_array(){
1490
+	public static function create_no_ticket_prices_array() {
1491 1491
 		// this creates an array for tracking events that have no active ticket prices created
1492 1492
 		// this allows us to warn admins of the situation so that it can be corrected
1493
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE );
1494
-		if ( ! $espresso_no_ticket_prices ) {
1495
-			add_option( 'ee_no_ticket_prices', array(), '', FALSE );
1493
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE);
1494
+		if ( ! $espresso_no_ticket_prices) {
1495
+			add_option('ee_no_ticket_prices', array(), '', FALSE);
1496 1496
 		}
1497 1497
 	}
1498 1498
 
@@ -1514,24 +1514,24 @@  discard block
 block discarded – undo
1514 1514
 	 * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/
1515 1515
 	 * @global wpdb $wpdb
1516 1516
 	 */
1517
-	public static function delete_all_espresso_cpt_data(){
1517
+	public static function delete_all_espresso_cpt_data() {
1518 1518
 		global $wpdb;
1519 1519
 		//get all the CPT post_types
1520 1520
 		$ee_post_types = array();
1521
-		foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){
1522
-			if ( method_exists( $model_name, 'instance' )) {
1523
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1524
-				if ( $model_obj instanceof EEM_CPT_Base ) {
1525
-					$ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type());
1521
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1522
+			if (method_exists($model_name, 'instance')) {
1523
+				$model_obj = call_user_func(array($model_name, 'instance'));
1524
+				if ($model_obj instanceof EEM_CPT_Base) {
1525
+					$ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type());
1526 1526
 				}
1527 1527
 			}
1528 1528
 		}
1529 1529
 		//get all our CPTs
1530
-		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")";
1530
+		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")";
1531 1531
 		$cpt_ids = $wpdb->get_col($query);
1532 1532
 		//delete each post meta and term relations too
1533
-		foreach($cpt_ids as $post_id){
1534
-			wp_delete_post($post_id,true);
1533
+		foreach ($cpt_ids as $post_id) {
1534
+			wp_delete_post($post_id, true);
1535 1535
 		}
1536 1536
 	}
1537 1537
 
@@ -1545,18 +1545,18 @@  discard block
 block discarded – undo
1545 1545
 	 * @param bool $remove_all
1546 1546
 	 * @return void
1547 1547
 	 */
1548
-	public static function delete_all_espresso_tables_and_data( $remove_all = true ) {
1548
+	public static function delete_all_espresso_tables_and_data($remove_all = true) {
1549 1549
 		global $wpdb;
1550 1550
 		$undeleted_tables = array();
1551 1551
 
1552 1552
 		// load registry
1553
-		foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){
1554
-			if ( method_exists( $model_name, 'instance' )) {
1555
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1556
-				if ( $model_obj instanceof EEM_Base ) {
1557
-					foreach ( $model_obj->get_tables() as $table ) {
1558
-						if ( strpos( $table->get_table_name(), 'esp_' )) {
1559
-							switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) {
1553
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1554
+			if (method_exists($model_name, 'instance')) {
1555
+				$model_obj = call_user_func(array($model_name, 'instance'));
1556
+				if ($model_obj instanceof EEM_Base) {
1557
+					foreach ($model_obj->get_tables() as $table) {
1558
+						if (strpos($table->get_table_name(), 'esp_')) {
1559
+							switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) {
1560 1560
 								case false :
1561 1561
 									$undeleted_tables[] = $table->get_table_name();
1562 1562
 								break;
@@ -1581,8 +1581,8 @@  discard block
 block discarded – undo
1581 1581
 			'esp_promotion_rule',
1582 1582
 			'esp_rule'
1583 1583
 		);
1584
-		foreach( $tables_without_models as $table ){
1585
-			EEH_Activation::delete_db_table_if_empty( $table );
1584
+		foreach ($tables_without_models as $table) {
1585
+			EEH_Activation::delete_db_table_if_empty($table);
1586 1586
 		}
1587 1587
 
1588 1588
 
@@ -1619,58 +1619,58 @@  discard block
 block discarded – undo
1619 1619
 			'ee_pers_admin_notices' => true,
1620 1620
 			'ee_upload_directories_incomplete' => true,
1621 1621
 		);
1622
-		if( is_main_site() ) {
1623
-			$wp_options_to_delete[ 'ee_network_config' ] = true;
1622
+		if (is_main_site()) {
1623
+			$wp_options_to_delete['ee_network_config'] = true;
1624 1624
 		}
1625 1625
 
1626 1626
 		$undeleted_options = array();
1627
-		foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) {
1627
+		foreach ($wp_options_to_delete as $option_name => $no_wildcard) {
1628 1628
 
1629
-			if( $no_wildcard ){
1630
-				if( ! delete_option( $option_name ) ){
1629
+			if ($no_wildcard) {
1630
+				if ( ! delete_option($option_name)) {
1631 1631
 					$undeleted_options[] = $option_name;
1632 1632
 				}
1633
-			}else{
1634
-				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1635
-				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1636
-					if( ! delete_option( $option_name_from_wildcard ) ){
1633
+			} else {
1634
+				$option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'");
1635
+				foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) {
1636
+					if ( ! delete_option($option_name_from_wildcard)) {
1637 1637
 						$undeleted_options[] = $option_name_from_wildcard;
1638 1638
 					}
1639 1639
 				}
1640 1640
 			}
1641 1641
 		}
1642 1642
                 //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1643
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1643
+                remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10);
1644 1644
 
1645
-		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1645
+		if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) {
1646 1646
 			$db_update_sans_ee4 = array();
1647
-			foreach($espresso_db_update as $version => $times_activated){
1648
-				if( $version[0] =='3'){//if its NON EE4
1647
+			foreach ($espresso_db_update as $version => $times_activated) {
1648
+				if ($version[0] == '3') {//if its NON EE4
1649 1649
 					$db_update_sans_ee4[$version] = $times_activated;
1650 1650
 				}
1651 1651
 			}
1652
-			update_option( 'espresso_db_update', $db_update_sans_ee4 );
1652
+			update_option('espresso_db_update', $db_update_sans_ee4);
1653 1653
 		}
1654 1654
 
1655 1655
 		$errors = '';
1656
-		if ( ! empty( $undeleted_tables )) {
1656
+		if ( ! empty($undeleted_tables)) {
1657 1657
 			$errors .= sprintf(
1658
-				__( 'The following tables could not be deleted: %s%s', 'event_espresso' ),
1658
+				__('The following tables could not be deleted: %s%s', 'event_espresso'),
1659 1659
 				'<br/>',
1660
-				implode( ',<br/>', $undeleted_tables )
1660
+				implode(',<br/>', $undeleted_tables)
1661 1661
 			);
1662 1662
 		}
1663
-		if ( ! empty( $undeleted_options )) {
1664
-			$errors .= ! empty( $undeleted_tables ) ? '<br/>' : '';
1663
+		if ( ! empty($undeleted_options)) {
1664
+			$errors .= ! empty($undeleted_tables) ? '<br/>' : '';
1665 1665
 			$errors .= sprintf(
1666
-				__( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ),
1666
+				__('The following wp-options could not be deleted: %s%s', 'event_espresso'),
1667 1667
 				'<br/>',
1668
-				implode( ',<br/>', $undeleted_options )
1668
+				implode(',<br/>', $undeleted_options)
1669 1669
 			);
1670 1670
 
1671 1671
 		}
1672
-		if ( $errors != '' ) {
1673
-			EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ );
1672
+		if ($errors != '') {
1673
+			EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__);
1674 1674
 		}
1675 1675
 	}
1676 1676
 
@@ -1680,23 +1680,23 @@  discard block
 block discarded – undo
1680 1680
 	 * @param string $table_name with or without $wpdb->prefix
1681 1681
 	 * @return boolean
1682 1682
 	 */
1683
-	public static function table_exists( $table_name ){
1683
+	public static function table_exists($table_name) {
1684 1684
 		global $wpdb, $EZSQL_ERROR;
1685
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
1685
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
1686 1686
 		//ignore if this causes an sql error
1687 1687
 		$old_error = $wpdb->last_error;
1688 1688
 		$old_suppress_errors = $wpdb->suppress_errors();
1689
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
1689
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
1690 1690
 		$ezsql_error_cache = $EZSQL_ERROR;
1691
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
1692
-		$wpdb->show_errors( $old_show_errors_value );
1693
-		$wpdb->suppress_errors( $old_suppress_errors );
1691
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
1692
+		$wpdb->show_errors($old_show_errors_value);
1693
+		$wpdb->suppress_errors($old_suppress_errors);
1694 1694
 		$new_error = $wpdb->last_error;
1695 1695
 		$wpdb->last_error = $old_error;
1696 1696
 		$EZSQL_ERROR = $ezsql_error_cache;
1697
-		if( empty( $new_error ) ){
1697
+		if (empty($new_error)) {
1698 1698
 			return TRUE;
1699
-		}else{
1699
+		} else {
1700 1700
 			return FALSE;
1701 1701
 		}
1702 1702
 	}
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 	/**
1705 1705
 	 * Resets the cache on EEH_Activation
1706 1706
 	 */
1707
-	public static function reset(){
1707
+	public static function reset() {
1708 1708
 		self::$_default_creator_id = NULL;
1709 1709
 		self::$_initialized_db_content_already_in_this_request = false;
1710 1710
 	}
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Config.lib.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -42,24 +42,24 @@  discard block
 block discarded – undo
42 42
 	 *                       		}
43 43
 	 * @return void
44 44
 	 */
45
-	public static function register( $config_class = NULL, $setup_args = array() ) {
45
+	public static function register($config_class = NULL, $setup_args = array()) {
46 46
 
47
-		$setup_args['config_name'] = isset( $setup_args['config_name'] ) && ! empty( $setup_args['config_name'] ) ? $setup_args['config_name'] : $config_class;
48
-		$setup_args['config_section'] = isset( $setup_args['config_section'] ) && ! empty( $setup_args['config_section'] ) ? $setup_args['config_section'] : 'addons';
47
+		$setup_args['config_name'] = isset($setup_args['config_name']) && ! empty($setup_args['config_name']) ? $setup_args['config_name'] : $config_class;
48
+		$setup_args['config_section'] = isset($setup_args['config_section']) && ! empty($setup_args['config_section']) ? $setup_args['config_section'] : 'addons';
49 49
 
50 50
 		//required fields MUST be present, so let's make sure they are.
51
-		if ( empty( $config_class ) || ! is_array( $setup_args ) || empty( $setup_args['config_name'] )) {
52
-			throw new EE_Error( __( 'In order to register a Config Class with EE_Register_Config::register(), you must include a "config_class" (the actual class name for this config class). As well, you can supply an array containing the following keys: "config_section" the main section of the config object the settings will be saved under (by default the new config will be registered under EE_Config::instance()->modules or EE_Config::instance()->addons depending on what type of class is calling this), "config_name" (by default the new config will be registered to EE_Config::instance()->{config_section}->{config_class}, but supplying a "config_name" will set the property name that this variable is accessible by. ie: EE_Config::instance()->{config_section}->{config_name})', 'event_espresso' ));
51
+		if (empty($config_class) || ! is_array($setup_args) || empty($setup_args['config_name'])) {
52
+			throw new EE_Error(__('In order to register a Config Class with EE_Register_Config::register(), you must include a "config_class" (the actual class name for this config class). As well, you can supply an array containing the following keys: "config_section" the main section of the config object the settings will be saved under (by default the new config will be registered under EE_Config::instance()->modules or EE_Config::instance()->addons depending on what type of class is calling this), "config_name" (by default the new config will be registered to EE_Config::instance()->{config_section}->{config_class}, but supplying a "config_name" will set the property name that this variable is accessible by. ie: EE_Config::instance()->{config_section}->{config_name})', 'event_espresso'));
53 53
 		}
54 54
 
55 55
 		//make sure we don't register twice
56
-		if( isset( self::$_ee_config_registry[ $config_class ] ) ){
56
+		if (isset(self::$_ee_config_registry[$config_class])) {
57 57
 			return;
58 58
 		}
59 59
 
60 60
 
61 61
 		//first find out if this happened too late.
62
-		if ( did_action( 'AHEE__EE_System__load_core_configuration__begin' ) ) {
62
+		if (did_action('AHEE__EE_System__load_core_configuration__begin')) {
63 63
 			EE_Error::doing_it_wrong(
64 64
 				__METHOD__,
65 65
 				sprintf(
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 				);
71 71
 		}
72 72
 		//add incoming stuff to our registry property
73
-		self::$_ee_config_registry[ $config_class ] = array(
73
+		self::$_ee_config_registry[$config_class] = array(
74 74
 			'section' => $setup_args['config_section'],
75 75
 			'name' => $setup_args['config_name']
76 76
 		);
77 77
 
78
-		add_action( 'AHEE__EE_Config___load_core_config__end', array( 'EE_Register_Config', 'set_config' ), 15, 1 );
79
-		add_action( 'AHEE__EE_Config__update_espresso_config__end', array( 'EE_Register_Config', 'set_config' ), 15, 1 );
78
+		add_action('AHEE__EE_Config___load_core_config__end', array('EE_Register_Config', 'set_config'), 15, 1);
79
+		add_action('AHEE__EE_Config__update_espresso_config__end', array('EE_Register_Config', 'set_config'), 15, 1);
80 80
 	}
81 81
 
82 82
 
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
 	 * @param \EE_Config $EE_Config
91 91
 	 * @return \StdClass
92 92
 	 */
93
-	public static function set_config( EE_Config $EE_Config ) {
94
-		foreach ( self::$_ee_config_registry as $config_class => $settings ) {
93
+	public static function set_config(EE_Config $EE_Config) {
94
+		foreach (self::$_ee_config_registry as $config_class => $settings) {
95 95
 			//first some validation of our incoming class_name.  We'll throw an error early if its' not registered correctly
96
-			if ( ! class_exists( $config_class )) {
96
+			if ( ! class_exists($config_class)) {
97 97
 				throw new EE_Error(
98 98
 					sprintf(
99
-						__( 'The "%s" config class can not be registered with EE_Config because it does not exist.  Verify that an autoloader has been set for this class', 'event_espresso' ),
99
+						__('The "%s" config class can not be registered with EE_Config because it does not exist.  Verify that an autoloader has been set for this class', 'event_espresso'),
100 100
 						$config_class
101 101
 					)
102 102
 				 );
103 103
 			}
104
-			$EE_Config->get_config( $settings['section'], $settings['name'], $config_class );
104
+			$EE_Config->get_config($settings['section'], $settings['name'], $config_class);
105 105
 		}
106 106
 	}
107 107
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	/**
112 112
 	 * @param mixed $config_class_name
113 113
 	 */
114
-	public static function deregister( $config_class_name = NULL ) {
115
-		if ( ! empty( self::$_ee_config_registry[ $config_class_name ] ))
116
-    			unset( self::$_ee_config_registry[ $config_class_name ] );
114
+	public static function deregister($config_class_name = NULL) {
115
+		if ( ! empty(self::$_ee_config_registry[$config_class_name]))
116
+    			unset(self::$_ee_config_registry[$config_class_name]);
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,6 +113,6 @@
 block discarded – undo
113 113
 	 */
114 114
 	public static function deregister( $config_class_name = NULL ) {
115 115
 		if ( ! empty( self::$_ee_config_registry[ $config_class_name ] ))
116
-    			unset( self::$_ee_config_registry[ $config_class_name ] );
116
+				unset( self::$_ee_config_registry[ $config_class_name ] );
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 2 patches
Doc Comments   +13 added lines, -11 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 
105 105
 	/**
106
-	 * @return null
106
+	 * @return EE_Line_Item_Display
107 107
 	 */
108 108
 	public function line_item_display() {
109 109
 		return $this->line_item_display;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 
114 114
 	/**
115
-	 * @param null $line_item_display
115
+	 * @param EE_Line_Item_Display $line_item_display
116 116
 	 */
117 117
 	public function set_line_item_display( $line_item_display ) {
118 118
 		$this->line_item_display = $line_item_display;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
 
182 182
 	/**
183
-	 * @return bool
183
+	 * @return EE_Form_Section_Proper
184 184
 	 */
185 185
 	public function generate_reg_form() {
186 186
 		EE_Registry::instance()->load_helper( 'HTML' );
@@ -537,6 +537,7 @@  discard block
 block discarded – undo
537 537
 	 *    _apply_registration_payments_to_amount_owing
538 538
 	 *
539 539
 	 * @access    protected
540
+	 * @param EE_Base_Class[] $registrations
540 541
 	 * @return    void
541 542
 	 */
542 543
 	protected function _apply_registration_payments_to_amount_owing( $registrations ) {
@@ -754,7 +755,7 @@  discard block
 block discarded – undo
754 755
 	 * get_billing_form_html_for_payment_method
755 756
 	 *
756 757
 	 * @access public
757
-	 * @return string
758
+	 * @return boolean
758 759
 	 */
759 760
 	public function get_billing_form_html_for_payment_method() {
760 761
 		// how have they chosen to pay?
@@ -874,7 +875,7 @@  discard block
 block discarded – undo
874 875
 	 * switch_payment_method
875 876
 	 *
876 877
 	 * @access public
877
-	 * @return string
878
+	 * @return boolean
878 879
 	 */
879 880
 	public function switch_payment_method() {
880 881
 		if ( ! $this->_verify_payment_method_is_set() ) {
@@ -1041,7 +1042,7 @@  discard block
 block discarded – undo
1041 1042
 
1042 1043
 	/**
1043 1044
 	 * process_reg_step
1044
-	 * @return boolean
1045
+	 * @return null|boolean
1045 1046
 	 */
1046 1047
 	public function process_reg_step() {
1047 1048
 		// how have they chosen to pay?
@@ -1117,7 +1118,7 @@  discard block
 block discarded – undo
1117 1118
 	 *    update_reg_step
1118 1119
 	 *    this is the final step after a user  revisits the site to retry a payment
1119 1120
 	 *
1120
-	 * @return boolean
1121
+	 * @return null|boolean
1121 1122
 	 */
1122 1123
 	public function update_reg_step() {
1123 1124
 		$success = TRUE;
@@ -1399,7 +1400,7 @@  discard block
 block discarded – undo
1399 1400
 	 *
1400 1401
 	 * 	@access 	private
1401 1402
 	 * 	@type 	EE_Payment_Method $payment_method
1402
-	 * 	@return 	mixed	EE_Payment | boolean
1403
+	 * 	@return 	EE_Payment|null	EE_Payment | boolean
1403 1404
 	 */
1404 1405
 	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1405 1406
 		$payment =NULL;
@@ -1602,6 +1603,7 @@  discard block
 block discarded – undo
1602 1603
 	 * @access private
1603 1604
 	 * @type    EE_Payment $payment
1604 1605
 	 * @param string $payment_occurs
1606
+	 * @param EE_Payment|null $payment
1605 1607
 	 * @return bool
1606 1608
 	 * @throws \EE_Error
1607 1609
 	 */
@@ -1708,7 +1710,7 @@  discard block
 block discarded – undo
1708 1710
 	 * 		or present the payment options again
1709 1711
 	 *
1710 1712
 	 * @access private
1711
-	 * @return EE_Payment | FALSE
1713
+	 * @return boolean | FALSE
1712 1714
 	 */
1713 1715
 	public function process_gateway_response() {
1714 1716
 		$payment = null;
@@ -1769,7 +1771,7 @@  discard block
 block discarded – undo
1769 1771
 	 * _validate_return
1770 1772
 	 *
1771 1773
 	 * @access private
1772
-	 * @return bool
1774
+	 * @return boolean|null
1773 1775
 	 */
1774 1776
 	private function _validate_offsite_return() {
1775 1777
 		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
@@ -1836,7 +1838,7 @@  discard block
 block discarded – undo
1836 1838
 	 *
1837 1839
 	 * @access private
1838 1840
 	 * @param \EE_Registration $primary_registrant
1839
-	 * @return bool
1841
+	 * @return false|null
1840 1842
 	 */
1841 1843
 	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1842 1844
 		if ( ! $primary_registrant instanceof EE_Registration ) {
Please login to merge, or discard this patch.
Spacing   +370 added lines, -370 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 *  @return 	void
29 29
 	 */
30 30
 	public static function set_hooks() {
31
-		add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) );
32
-		add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
33
-		add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
34
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
35
-		add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
36
-		add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) );
37
-		add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
31
+		add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters'));
32
+		add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
33
+		add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
34
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
35
+		add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
36
+		add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details'));
37
+		add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
38 38
 		);
39
-		add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 );
39
+		add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1);
40 40
 	}
41 41
 
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * 	ajax switch_spco_billing_form
46 46
 	 */
47 47
 	public static function switch_spco_billing_form() {
48
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
48
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
49 49
 	}
50 50
 
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * 	ajax save_payer_details
55 55
 	 */
56 56
 	public static function save_payer_details() {
57
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
57
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
58 58
 	}
59 59
 
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * 	ajax get_transaction_details
64 64
 	 */
65 65
 	public static function get_transaction_details() {
66
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
66
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
67 67
 	}
68 68
 
69 69
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 * @param    EE_Checkout $checkout
92 92
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
93 93
 	 */
94
-	public function __construct( EE_Checkout $checkout ) {
94
+	public function __construct(EE_Checkout $checkout) {
95 95
 		$this->_slug = 'payment_options';
96 96
 		$this->_name = __('Payment Options', 'event_espresso');
97
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
97
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
98 98
 		$this->checkout = $checkout;
99 99
 		$this->_reset_success_message();
100
-		$this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
100
+		$this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
101 101
 	}
102 102
 
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * @param null $line_item_display
116 116
 	 */
117
-	public function set_line_item_display( $line_item_display ) {
117
+	public function set_line_item_display($line_item_display) {
118 118
 		$this->line_item_display = $line_item_display;
119 119
 	}
120 120
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @return void
126 126
 	 */
127 127
 	public function translate_js_strings() {
128
-		EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' );
129
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' );
130
-		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' );
128
+		EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso');
129
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso');
130
+		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso');
131 131
 	}
132 132
 
133 133
 
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 			// 	$ 0.00 transactions (no payment required)
157 157
 			! $this->checkout->payment_required()
158 158
 			// but do NOT remove if current action being called belongs to this reg step
159
-			&& ! is_callable( array( $this, $this->checkout->action ) )
159
+			&& ! is_callable(array($this, $this->checkout->action))
160 160
 			&& ! $this->completed()
161 161
 		) {
162 162
 			// and if so, then we no longer need the Payment Options step
163
-			if ( $this->is_current_step() ) {
163
+			if ($this->is_current_step()) {
164 164
 				$this->checkout->generate_reg_form = false;
165 165
 			}
166
-			$this->checkout->remove_reg_step( $this->_slug );
166
+			$this->checkout->remove_reg_step($this->_slug);
167 167
 			// DEBUG LOG
168 168
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
169 169
 			return false;
170 170
 		}
171 171
 		// load EEM_Payment_Method
172
-		EE_Registry::instance()->load_model( 'Payment_Method' );
172
+		EE_Registry::instance()->load_model('Payment_Method');
173 173
 		// get all active payment methods
174 174
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
175 175
 			$this->checkout->transaction, EEM_Payment_Method::scope_cart
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return bool
184 184
 	 */
185 185
 	public function generate_reg_form() {
186
-		EE_Registry::instance()->load_helper( 'HTML' );
186
+		EE_Registry::instance()->load_helper('HTML');
187 187
 		// reset in case someone changes their mind
188 188
 		$this->_reset_selected_method_of_payment();
189 189
 		// set some defaults
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
 		$sold_out_events = array();
195 195
 		$reg_count = 0;
196 196
 		// loop thru registrations to gather info
197
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
198
-		foreach ( $registrations as $registration ) {
197
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
198
+		foreach ($registrations as $registration) {
199 199
 			/** @var $registration EE_Registration */
200 200
 			$reg_count++;
201 201
 			// if returning registrant is Approved then do NOT do this
202
-			if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) {
203
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) {
202
+			if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) {
203
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
204 204
 					// add event to list of events that are sold out
205
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
205
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
206 206
 					do_action(
207 207
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
208 208
 						$registration->event(),
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 					);
211 211
 				}
212 212
 				// event requires admin approval
213
-				if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) {
213
+				if ($registration->status_ID() == EEM_Registration::status_id_not_approved) {
214 214
 					// add event to list of events with pre-approval reg status
215
-					$registrations_requiring_pre_approval[ $registration->ID() ] = $registration;
215
+					$registrations_requiring_pre_approval[$registration->ID()] = $registration;
216 216
 					do_action(
217 217
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
218 218
 						$registration->event(),
@@ -221,29 +221,29 @@  discard block
 block discarded – undo
221 221
 				}
222 222
 			}
223 223
 			// are they allowed to pay now and is there monies owing?
224
-			if ( $registration->owes_monies_and_can_pay() ) {
225
-				$registrations_requiring_payment[ $registration->ID() ] = $registration;
224
+			if ($registration->owes_monies_and_can_pay()) {
225
+				$registrations_requiring_payment[$registration->ID()] = $registration;
226 226
 				do_action(
227 227
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
228 228
 					$registration->event(),
229 229
 					$this
230 230
 				);
231
-			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()  ) {
232
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
231
+			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) {
232
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
233 233
 			}
234 234
 		}
235 235
 		$subsections = array();
236 236
 		// now decide which template to load
237
-		if ( ! empty( $sold_out_events )) {
238
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
237
+		if ( ! empty($sold_out_events)) {
238
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
239 239
 		}
240
-		if ( ! empty( $registrations_requiring_pre_approval )) {
241
-			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval );
240
+		if ( ! empty($registrations_requiring_pre_approval)) {
241
+			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval);
242 242
 		}
243
-		if ( ! empty( $registrations_for_free_events ) ) {
244
-			$subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events );
243
+		if ( ! empty($registrations_for_free_events)) {
244
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
245 245
 		}
246
-		if ( ! empty( $registrations_requiring_payment ) ) {
246
+		if ( ! empty($registrations_requiring_payment)) {
247 247
 			// autoload Line_Item_Display classes
248 248
 			EEH_Autoloader::register_line_item_filter_autoloaders();
249 249
 			$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 				$this->checkout->cart->get_grand_total()
255 255
 			);
256 256
 			$filtered_line_item_tree = $line_item_filter_processor->process();
257
-			if ( $this->checkout->amount_owing > 0 ) {
257
+			if ($this->checkout->amount_owing > 0) {
258 258
 				EEH_Autoloader::register_line_item_display_autoloaders();
259
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
260
-				$subsections[ 'payment_options' ] = $this->_display_payment_options(
259
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
260
+				$subsections['payment_options'] = $this->_display_payment_options(
261 261
 					$this->line_item_display->display_line_item(
262 262
 						$filtered_line_item_tree,
263
-						array( 'registrations' => $registrations )
263
+						array('registrations' => $registrations)
264 264
 					)
265 265
 				);
266 266
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
267
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
267
+				$this->_apply_registration_payments_to_amount_owing($registrations);
268 268
 			}
269 269
 		} else {
270 270
 			$this->_hide_reg_step_submit_button_if_revisit();
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection
298 298
 	 * @return \EE_Line_Item_Filter_Collection
299 299
 	 */
300
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
300
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
301 301
 		$line_item_filter_collection->add(
302 302
 			new EE_Billable_Line_Item_Filter(
303 303
 				EE_Registry::instance()->SSN->checkout()->transaction->registrations(
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 				)
306 306
 			)
307 307
 		);
308
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
308
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
309 309
 		return $line_item_filter_collection;
310 310
 	}
311 311
 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 	 * @return void
320 320
 	 */
321 321
 	protected function _hide_reg_step_submit_button_if_revisit() {
322
-		if ( $this->checkout->revisit ) {
323
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
322
+		if ($this->checkout->revisit) {
323
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
324 324
 		}
325 325
 	}
326 326
 
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 	 * @param \EE_Event[] $sold_out_events_array
332 332
 	 * @return \EE_Form_Section_Proper
333 333
 	 */
334
-	private function _sold_out_events( $sold_out_events_array = array() ) {
334
+	private function _sold_out_events($sold_out_events_array = array()) {
335 335
 		// set some defaults
336 336
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
337 337
 		$sold_out_events = '';
338
-		foreach ( $sold_out_events_array as $sold_out_event ) {
339
-			$sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ));
338
+		foreach ($sold_out_events_array as $sold_out_event) {
339
+			$sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text'));
340 340
 		}
341 341
 		return new EE_Form_Section_Proper(
342 342
 			array(
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 				),
349 349
 				'layout_strategy'		=> new EE_Template_Layout(
350 350
 					array(
351
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template
351
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template
352 352
 						'template_args'  				=> apply_filters(
353 353
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
354 354
 							array(
355 355
 								'sold_out_events' 			=> $sold_out_events,
356 356
 								'sold_out_events_msg' 	=> apply_filters(
357 357
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg',
358
-									__( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' )
358
+									__('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso')
359 359
 								)
360 360
 							)
361 361
 						)
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 	 * @param array $registrations_requiring_pre_approval
373 373
 	 * @return \EE_Form_Section_Proper
374 374
 	 */
375
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) {
375
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
376 376
 		$events_requiring_pre_approval = '';
377
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
378
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
379
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
380
-					EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
377
+		foreach ($registrations_requiring_pre_approval as $registration) {
378
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
379
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
380
+					EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
381 381
 					)
382
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
382
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
383 383
 				);
384 384
 			}
385 385
 		}
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 				),
392 392
 				'layout_strategy'		=> new EE_Template_Layout(
393 393
 					array(
394
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template
394
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template
395 395
 						'template_args'  				=> apply_filters(
396 396
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
397 397
 							array(
398
-								'events_requiring_pre_approval' 			=> implode( '', $events_requiring_pre_approval ),
398
+								'events_requiring_pre_approval' 			=> implode('', $events_requiring_pre_approval),
399 399
 								'events_requiring_pre_approval_msg' 	=> apply_filters(
400 400
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
401
-									__( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' )
401
+									__('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso')
402 402
 								)
403 403
 							)
404 404
 						),
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 * @param \EE_Event[] $registrations_for_free_events
417 417
 	 * @return \EE_Form_Section_Proper
418 418
 	 */
419
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
419
+	private function _no_payment_required($registrations_for_free_events = array()) {
420 420
 		// set some defaults
421 421
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
422 422
 		// generate no_payment_required form
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 				),
429 429
 				'layout_strategy' 	=> new EE_Template_Layout(
430 430
 					array(
431
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template
431
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template
432 432
 						'template_args'  				=> apply_filters(
433 433
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
434 434
 							array(
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 								'registrations' => array(),
437 437
 								'ticket_count' 	=> array(),
438 438
 								'registrations_for_free_events' 	=> $registrations_for_free_events,
439
-								'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' ))
439
+								'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso'))
440 440
 							)
441 441
 						),
442 442
 					)
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 * @param string $transaction_details
454 454
 	 * @return \EE_Form_Section_Proper
455 455
 	 */
456
-	private function _display_payment_options( $transaction_details = '' ) {
456
+	private function _display_payment_options($transaction_details = '') {
457 457
 		// has method_of_payment been set by no-js user?
458 458
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
459 459
 		// build payment options form
@@ -465,20 +465,20 @@  discard block
 block discarded – undo
465 465
 						'before_payment_options' => apply_filters(
466 466
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
467 467
 							new EE_Form_Section_Proper(
468
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
468
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
469 469
 							)
470 470
 						),
471 471
 						'payment_options' => $this->_setup_payment_options(),
472 472
 						'after_payment_options' => apply_filters(
473 473
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
474 474
 							new EE_Form_Section_Proper(
475
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
475
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
476 476
 							)
477 477
 						),
478 478
 						'default_hidden_inputs' => $this->reg_step_hidden_inputs(),
479
-						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs( FALSE )
479
+						'extra_hidden_inputs' 	=> $this->_extra_hidden_inputs(FALSE)
480 480
 					),
481
-					'layout_strategy'	=> new EE_Template_Layout( array(
481
+					'layout_strategy'	=> new EE_Template_Layout(array(
482 482
 							'layout_template_file' 	=> $this->_template,
483 483
 							'template_args'  				=> apply_filters(
484 484
 								'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args',
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 	 * @param bool $no_payment_required
503 503
 	 * @return \EE_Form_Section_Proper
504 504
 	 */
505
-	private function _extra_hidden_inputs( $no_payment_required = TRUE ) {
505
+	private function _extra_hidden_inputs($no_payment_required = TRUE) {
506 506
 
507 507
 		return new EE_Form_Section_Proper(
508 508
 			array(
509
-				'html_id' 				=> 'ee-' . $this->slug() . '-extra-hidden-inputs',
509
+				'html_id' 				=> 'ee-'.$this->slug().'-extra-hidden-inputs',
510 510
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
511 511
 				'subsections' 		=> array(
512 512
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -539,16 +539,16 @@  discard block
 block discarded – undo
539 539
 	 * @access    protected
540 540
 	 * @return    void
541 541
 	 */
542
-	protected function _apply_registration_payments_to_amount_owing( $registrations ) {
542
+	protected function _apply_registration_payments_to_amount_owing($registrations) {
543 543
 		$payments = array();
544
-		foreach ( $registrations as $registration ) {
545
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
544
+		foreach ($registrations as $registration) {
545
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
546 546
 				$payments = $payments + $registration->registration_payments();
547 547
 			}
548 548
 		}
549
-		if ( ! empty( $payments ) ) {
550
-			foreach ( $payments as $payment ) {
551
-				if ( $payment instanceof EE_Registration_Payment ) {
549
+		if ( ! empty($payments)) {
550
+			foreach ($payments as $payment) {
551
+				if ($payment instanceof EE_Registration_Payment) {
552 552
 					$this->checkout->amount_owing -= $payment->amount();
553 553
 				}
554 554
 			}
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 	 * @param 	bool $force_reset
564 564
 	 * @return 	void
565 565
 	 */
566
-	private function _reset_selected_method_of_payment( $force_reset = FALSE ) {
567
-		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE ));
568
-		if ( $reset_payment_method ) {
566
+	private function _reset_selected_method_of_payment($force_reset = FALSE) {
567
+		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE));
568
+		if ($reset_payment_method) {
569 569
 			$this->checkout->selected_method_of_payment = NULL;
570 570
 			$this->checkout->payment_method = NULL;
571 571
 			$this->checkout->billing_form = NULL;
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 	 * @param string $selected_method_of_payment
585 585
 	 * 	@return 		EE_Billing_Info_Form
586 586
 	 */
587
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
588
-		$selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
589
-		EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment ));
587
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
588
+		$selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
589
+		EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment));
590 590
 	}
591 591
 
592 592
 
@@ -599,40 +599,40 @@  discard block
 block discarded – undo
599 599
 		// load payment method classes
600 600
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
601 601
 		// switch up header depending on number of available payment methods
602
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
603
-			? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' ))
604
-			: apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' ));
602
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
603
+			? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso'))
604
+			: apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso'));
605 605
 		$available_payment_methods = array(
606 606
 			// display the "Payment Method" header
607 607
 			'payment_method_header' => new EE_Form_Section_HTML(
608
-				EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' )
608
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
609 609
 			)
610 610
 		);
611 611
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
612 612
 		$available_payment_method_options = array();
613 613
 		$default_payment_method_option = array();
614 614
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
615
-		$payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' )));
615
+		$payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;')));
616 616
 		// loop through payment methods
617
-		foreach( $this->checkout->available_payment_methods as $payment_method ) {
618
-			if ( $payment_method instanceof EE_Payment_Method ) {
619
-				$payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' );
617
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
618
+			if ($payment_method instanceof EE_Payment_Method) {
619
+				$payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img');
620 620
 				// check if any payment methods are set as default
621 621
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
622
-				if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) {
622
+				if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) {
623 623
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
624 624
 					$this->_save_selected_method_of_payment();
625
-					$default_payment_method_option[ $payment_method->slug() ] =  $payment_method_button;
625
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
626 626
 				} else {
627
-					$available_payment_method_options[ $payment_method->slug() ] =  $payment_method_button;
627
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
628 628
 				}
629
-				$payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method );
629
+				$payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method);
630 630
 			}
631 631
 		}
632 632
 		// prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs
633 633
 		$available_payment_method_options = $default_payment_method_option + $available_payment_method_options;
634 634
 		// now generate the actual form  inputs
635
-		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options );
635
+		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options);
636 636
 		$available_payment_methods = $available_payment_methods + $payment_methods_billing_info;
637 637
 
638 638
 		// build the available payment methods form
@@ -652,19 +652,19 @@  discard block
 block discarded – undo
652 652
 	 * @return EE_Payment_Method[]
653 653
 	 */
654 654
 	protected function _get_available_payment_methods() {
655
-		if ( ! empty( $this->checkout->available_payment_methods )) {
655
+		if ( ! empty($this->checkout->available_payment_methods)) {
656 656
 			return $this->checkout->available_payment_methods;
657 657
 		}
658 658
 		$available_payment_methods = array();
659 659
 		// load EEM_Payment_Method
660
-		EE_Registry::instance()->load_model( 'Payment_Method' );
660
+		EE_Registry::instance()->load_model('Payment_Method');
661 661
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
662 662
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
663 663
 		// get all active payment methods
664
-		$payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart );
665
-		foreach ( $payment_methods as $payment_method ) {
666
-			if ( $payment_method instanceof EE_Payment_Method ) {
667
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
664
+		$payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart);
665
+		foreach ($payment_methods as $payment_method) {
666
+			if ($payment_method instanceof EE_Payment_Method) {
667
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
668 668
 			}
669 669
 		}
670 670
 		return $available_payment_methods;
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
 	 * @param 	array $available_payment_method_options
681 681
 	 * @return 	\EE_Form_Section_Proper
682 682
 	 */
683
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
683
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
684 684
 		// generate inputs
685 685
 		return new EE_Form_Section_Proper(
686 686
 			array(
687 687
 				'html_id' 				=> 'ee-available-payment-method-inputs',
688 688
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
689 689
 				'subsections' 		=> array(
690
-					'' => new EE_Radio_Button_Input (
690
+					'' => new EE_Radio_Button_Input(
691 691
 						$available_payment_method_options,
692 692
 						array(
693 693
 							'html_name' 				=> 'selected_method_of_payment',
@@ -711,36 +711,36 @@  discard block
 block discarded – undo
711 711
 	 * @param 	EE_Payment_Method $payment_method
712 712
 	 * @return 	\EE_Form_Section_Proper
713 713
 	 */
714
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
714
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
715 715
 		$currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE;
716 716
 		// generate the billing form for payment method
717
-		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML();
717
+		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML();
718 718
 		$this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form;
719 719
 		// it's all in the details
720
-		$info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' );
720
+		$info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr');
721 721
 		// add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not
722
-		if ( $payment_method->description() ) {
722
+		if ($payment_method->description()) {
723 723
 			$payment_method_info = $payment_method->description();
724
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
725
-			$payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
724
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
725
+			$payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
726 726
 		} else {
727
-			$payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
727
+			$payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
728 728
 		}
729
-		$info_html .= EEH_HTML::p (
730
-			apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ),
729
+		$info_html .= EEH_HTML::p(
730
+			apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info),
731 731
 			'',
732 732
 			'spco-payment-method-desc ee-attention'
733 733
 		);
734 734
 
735 735
 		return new EE_Form_Section_Proper(
736 736
 			array(
737
-				'html_id' 					=> 'spco-payment-method-info-' . $payment_method->slug(),
737
+				'html_id' 					=> 'spco-payment-method-info-'.$payment_method->slug(),
738 738
 				'html_class' 			=> 'spco-payment-method-info-dv',
739 739
 				// only display the selected or default PM
740 740
 				'html_style' 			=> $currently_selected ? '' : 'display:none;',
741 741
 				'layout_strategy'		=> new EE_Div_Per_Section_Layout(),
742 742
 				'subsections' 			=> array(
743
-					'info' 					=> new EE_Form_Section_HTML( $info_html ),
743
+					'info' 					=> new EE_Form_Section_HTML($info_html),
744 744
 					'billing_form' 		=> $currently_selected ? $billing_form : new EE_Form_Section_HTML()
745 745
 				)
746 746
 			)
@@ -758,12 +758,12 @@  discard block
 block discarded – undo
758 758
 	 */
759 759
 	public function get_billing_form_html_for_payment_method() {
760 760
 		// how have they chosen to pay?
761
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
761
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
762 762
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
763
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
763
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
764 764
 			return FALSE;
765 765
 		}
766
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
766
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
767 767
             EE_Error::add_success(
768 768
                 apply_filters(
769 769
                     'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -772,20 +772,20 @@  discard block
 block discarded – undo
772 772
             );
773 773
         }
774 774
 		// now generate billing form for selected method of payment
775
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
775
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
776 776
 		// fill form with attendee info if applicable
777
-		if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
778
-			$payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
777
+		if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
778
+			$payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
779 779
 		}
780 780
 		// and debug content
781
-		if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
782
-			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form );
781
+		if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
782
+			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form);
783 783
 		}
784 784
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : '';
785
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ));
785
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
786 786
 		// localize validation rules for main form
787 787
 		$this->checkout->current_step->reg_form->localize_validation_rules();
788
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
788
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
789 789
 		return TRUE;
790 790
 	}
791 791
 
@@ -798,15 +798,15 @@  discard block
 block discarded – undo
798 798
 	 * @param EE_Payment_Method $payment_method
799 799
 	 * @return \EE_Billing_Info_Form
800 800
 	 */
801
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
802
-		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
803
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
804
-			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
805
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
801
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
802
+		$billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing));
803
+		if ($billing_form instanceof EE_Billing_Info_Form) {
804
+			if (EE_Registry::instance()->REQ->is_set('payment_method')) {
805
+                if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
806 806
                     EE_Error::add_success(
807 807
                         apply_filters(
808 808
                             'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
809
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
809
+                            sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name())
810 810
                         )
811 811
                     );
812 812
                 }
@@ -831,27 +831,27 @@  discard block
 block discarded – undo
831 831
 	 * @param string 		$request_param
832 832
 	 * @return NULL|string
833 833
 	 */
834
-	private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) {
834
+	private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') {
835 835
 		// is selected_method_of_payment set in the request ?
836
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE );
837
-		if ( $selected_method_of_payment ) {
836
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE);
837
+		if ($selected_method_of_payment) {
838 838
 			// sanitize it
839
-			$selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment;
840
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
839
+			$selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment;
840
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
841 841
 			// store it in the session so that it's available for all subsequent requests including AJAX
842
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
842
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
843 843
 		} else {
844 844
 			// or is is set in the session ?
845
-			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' );
845
+			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment');
846 846
 		}
847 847
 		// do ya really really gotta have it?
848
-		if ( empty( $selected_method_of_payment ) && $required ) {
848
+		if (empty($selected_method_of_payment) && $required) {
849 849
 			EE_Error::add_error(
850 850
 				sprintf(
851
-					__( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ),
851
+					__('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'),
852 852
 					'<br/>',
853 853
 					'<br/>',
854
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
854
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
855 855
 				),
856 856
 				__FILE__, __FUNCTION__, __LINE__
857 857
 			);
@@ -877,37 +877,37 @@  discard block
 block discarded – undo
877 877
 	 * @return string
878 878
 	 */
879 879
 	public function switch_payment_method() {
880
-		if ( ! $this->_verify_payment_method_is_set() ) {
880
+		if ( ! $this->_verify_payment_method_is_set()) {
881 881
 			return FALSE;
882 882
 		}
883
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
883
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
884 884
 			EE_Error::add_success(
885 885
 				apply_filters(
886 886
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
887
-					sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() )
887
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
888 888
 				)
889 889
 			);
890 890
 		}
891 891
 		// generate billing form for selected method of payment if it hasn't been done already
892
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
893
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
892
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
893
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
894 894
 		}
895 895
 		// fill form with attendee info if applicable
896
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
897
-			$this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
896
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
897
+			$this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
898 898
 		}
899 899
 		// and debug content
900
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
901
-			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form );
900
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
901
+			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form);
902 902
 		}
903 903
 		// get html and validation rules for form
904
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
905
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() ));
904
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
905
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html()));
906 906
 			// localize validation rules for main form
907
-			$this->checkout->billing_form->localize_validation_rules( TRUE );
908
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
907
+			$this->checkout->billing_form->localize_validation_rules(TRUE);
908
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
909 909
 		} else {
910
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ));
910
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
911 911
 		}
912 912
 		//prevents advancement to next step
913 913
 		$this->checkout->continue_reg = FALSE;
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	protected function _verify_payment_method_is_set() {
924 924
 		// generate billing form for selected method of payment if it hasn't been done already
925
-		if ( empty( $this->checkout->selected_method_of_payment )) {
925
+		if (empty($this->checkout->selected_method_of_payment)) {
926 926
 			// how have they chosen to pay?
927
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
927
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
928 928
 		}
929 929
 		// verify payment method
930
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
930
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
931 931
 			// get payment method for selected method of payment
932 932
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
933 933
 		}
@@ -947,23 +947,23 @@  discard block
 block discarded – undo
947 947
 	 * @return void
948 948
 	 */
949 949
 	public function save_payer_details_via_ajax() {
950
-		if ( ! $this->_verify_payment_method_is_set() ) {
950
+		if ( ! $this->_verify_payment_method_is_set()) {
951 951
 			return;
952 952
 		}
953 953
 		// generate billing form for selected method of payment if it hasn't been done already
954
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
955
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
954
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
955
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
956 956
 		}
957 957
 		// generate primary attendee from payer info if applicable
958 958
 		if ( ! $this->checkout->transaction_has_primary_registrant()) {
959 959
 			$attendee = $this->_create_attendee_from_request_data();
960
-			if ( $attendee instanceof EE_Attendee ) {
961
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
962
-					if ( $registration->is_primary_registrant() ) {
960
+			if ($attendee instanceof EE_Attendee) {
961
+				foreach ($this->checkout->transaction->registrations() as $registration) {
962
+					if ($registration->is_primary_registrant()) {
963 963
 						$this->checkout->primary_attendee_obj = $attendee;
964
-						$registration->_add_relation_to( $attendee, 'Attendee' );
965
-						$registration->set_attendee_id( $attendee->ID() );
966
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
964
+						$registration->_add_relation_to($attendee, 'Attendee');
965
+						$registration->set_attendee_id($attendee->ID());
966
+						$registration->update_cache_after_object_save('Attendee', $attendee);
967 967
 					}
968 968
 				}
969 969
 			}
@@ -976,56 +976,56 @@  discard block
 block discarded – undo
976 976
 	 * uses info from alternate GET or POST data (such as AJAX) to create a new attendee
977 977
 	 * @return \EE_Attendee
978 978
 	 */
979
-	protected function _create_attendee_from_request_data(){
979
+	protected function _create_attendee_from_request_data() {
980 980
 		// get State ID
981
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
982
-		if ( ! empty( $STA_ID )) {
981
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
982
+		if ( ! empty($STA_ID)) {
983 983
 			// can we get state object from name ?
984
-			EE_Registry::instance()->load_model( 'State' );
985
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' );
986
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
984
+			EE_Registry::instance()->load_model('State');
985
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
986
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
987 987
 		}
988 988
 		// get Country ISO
989
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
990
-		if ( ! empty( $CNT_ISO )) {
989
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
990
+		if ( ! empty($CNT_ISO)) {
991 991
 			// can we get country object from name ?
992
-			EE_Registry::instance()->load_model( 'Country' );
993
-			$country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' );
994
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
992
+			EE_Registry::instance()->load_model('Country');
993
+			$country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO');
994
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
995 995
 		}
996 996
 		// grab attendee data
997 997
 		$attendee_data = array(
998
-			'ATT_fname' 		=> ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
999
-			'ATT_lname' 		=> ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1000
-			'ATT_email' 		=> ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1001
-			'ATT_address' 		=> ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1002
-			'ATT_address2' 	=> ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1003
-			'ATT_city' 			=> ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
998
+			'ATT_fname' 		=> ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
999
+			'ATT_lname' 		=> ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1000
+			'ATT_email' 		=> ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1001
+			'ATT_address' 		=> ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1002
+			'ATT_address2' 	=> ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1003
+			'ATT_city' 			=> ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1004 1004
 			'STA_ID' 				=> $STA_ID,
1005 1005
 			'CNT_ISO' 			=> $CNT_ISO,
1006
-			'ATT_zip' 				=> ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1007
-			'ATT_phone' 		=> ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1006
+			'ATT_zip' 				=> ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1007
+			'ATT_phone' 		=> ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1008 1008
 		);
1009 1009
 		// validate the email address since it is the most important piece of info
1010
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) {
1011
-			EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1010
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) {
1011
+			EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1012 1012
 		}
1013 1013
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1014
-		if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) {
1015
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1014
+		if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) {
1015
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1016 1016
 				'ATT_fname' => $attendee_data['ATT_fname'],
1017 1017
 				'ATT_lname' => $attendee_data['ATT_lname'],
1018 1018
 				'ATT_email' => $attendee_data['ATT_email']
1019 1019
 			));
1020
-			if ( $existing_attendee instanceof EE_Attendee ) {
1020
+			if ($existing_attendee instanceof EE_Attendee) {
1021 1021
 				return $existing_attendee;
1022 1022
 			}
1023 1023
 		}
1024 1024
 		// no existing attendee? kk let's create a new one
1025 1025
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1026
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1027
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1028
-		return EE_Attendee::new_instance( $attendee_data );
1026
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1027
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1028
+		return EE_Attendee::new_instance($attendee_data);
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1045,22 +1045,22 @@  discard block
 block discarded – undo
1045 1045
 	 */
1046 1046
 	public function process_reg_step() {
1047 1047
 		// how have they chosen to pay?
1048
-		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE );
1048
+		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE);
1049 1049
 		// choose your own adventure based on method_of_payment
1050
-		switch(  $this->checkout->selected_method_of_payment ) {
1050
+		switch ($this->checkout->selected_method_of_payment) {
1051 1051
 
1052 1052
 			case 'events_sold_out' :
1053 1053
 				$this->checkout->redirect = TRUE;
1054 1054
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1055
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1055
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1056 1056
 				// mark this reg step as completed
1057 1057
 				$this->set_completed();
1058 1058
 				return FALSE;
1059 1059
 				break;
1060 1060
 
1061 1061
 			case 'payments_closed' :
1062
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) {
1063
-					EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1062
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) {
1063
+					EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1064 1064
 				}
1065 1065
 				// mark this reg step as completed
1066 1066
 				$this->set_completed();
@@ -1068,8 +1068,8 @@  discard block
 block discarded – undo
1068 1068
 				break;
1069 1069
 
1070 1070
 			case 'no_payment_required' :
1071
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) {
1072
-					EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1071
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) {
1072
+					EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1073 1073
 				}
1074 1074
 				// mark this reg step as completed
1075 1075
 				$this->set_completed();
@@ -1078,9 +1078,9 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
 			default:
1080 1080
 				$payment_successful = $this->_process_payment();
1081
-				if ( $payment_successful ) {
1081
+				if ($payment_successful) {
1082 1082
 					$this->checkout->continue_reg = true;
1083
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1083
+					$this->_maybe_set_completed($this->checkout->payment_method);
1084 1084
 				} else {
1085 1085
 					$this->checkout->continue_reg = false;
1086 1086
 				}
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
 	 * @param \EE_Payment_Method $payment_method
1099 1099
 	 * @return void
1100 1100
 	 */
1101
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1102
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1101
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1102
+		switch ($payment_method->type_obj()->payment_occurs()) {
1103 1103
 			case EE_PMT_Base::offsite :
1104 1104
 				break;
1105 1105
 			case EE_PMT_Base::onsite :
@@ -1122,15 +1122,15 @@  discard block
 block discarded – undo
1122 1122
 	public function update_reg_step() {
1123 1123
 		$success = TRUE;
1124 1124
 		// if payment required
1125
-		if ( $this->checkout->transaction->total() > 0 ) {
1126
-			do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction );
1125
+		if ($this->checkout->transaction->total() > 0) {
1126
+			do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction);
1127 1127
 			// attempt payment via payment method
1128 1128
 			$success = $this->process_reg_step();
1129 1129
 		}
1130
-		if ( $success && ! $this->checkout->redirect ) {
1131
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
1130
+		if ($success && ! $this->checkout->redirect) {
1131
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
1132 1132
 			 // set return URL
1133
-			$this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url );
1133
+			$this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url);
1134 1134
 		}
1135 1135
 		return $success;
1136 1136
 	}
@@ -1150,24 +1150,24 @@  discard block
 block discarded – undo
1150 1150
 		// clear any previous errors related to not selecting a payment method
1151 1151
 //		EE_Error::overwrite_errors();
1152 1152
 		// ya gotta make a choice man
1153
-		if ( empty( $this->checkout->selected_method_of_payment )) {
1154
-			$this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' ));
1153
+		if (empty($this->checkout->selected_method_of_payment)) {
1154
+			$this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso'));
1155 1155
 			return FALSE;
1156 1156
 		}
1157 1157
 		// get EE_Payment_Method object
1158
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1158
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1159 1159
 			return FALSE;
1160 1160
 		}
1161 1161
 		// setup billing form
1162
-		if ( $this->checkout->payment_method->is_on_site() ) {
1163
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1162
+		if ($this->checkout->payment_method->is_on_site()) {
1163
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1164 1164
 			// bad billing form ?
1165
-			if ( ! $this->_billing_form_is_valid() ) {
1165
+			if ( ! $this->_billing_form_is_valid()) {
1166 1166
 				return FALSE;
1167 1167
 			}
1168 1168
 		}
1169 1169
 		// ensure primary registrant has been fully processed
1170
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1170
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1171 1171
 			return FALSE;
1172 1172
 		}
1173 1173
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1175,24 +1175,24 @@  discard block
 block discarded – undo
1175 1175
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1176 1176
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1177 1177
 		// attempt payment
1178
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1178
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1179 1179
 		// process results
1180
-		$payment = $this->_validate_payment( $payment );
1181
-		$payment = $this->_post_payment_processing( $payment );
1180
+		$payment = $this->_validate_payment($payment);
1181
+		$payment = $this->_post_payment_processing($payment);
1182 1182
 		// verify payment
1183
-		if ( $payment instanceof EE_Payment ) {
1183
+		if ($payment instanceof EE_Payment) {
1184 1184
 			// store that for later
1185 1185
 			$this->checkout->payment = $payment;
1186 1186
 			/** @type EE_Transaction_Processor $transaction_processor */
1187
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1187
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1188 1188
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1189
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1190
-			if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) {
1189
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1190
+			if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) {
1191 1191
 				return true;
1192 1192
 			} else {
1193 1193
 				return false;
1194 1194
 			}
1195
-		} else if ( $payment === true ) {
1195
+		} else if ($payment === true) {
1196 1196
 			// please note that offline payment methods will NOT make a payment,
1197 1197
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1198 1198
 			$this->checkout->payment = $payment;
@@ -1211,10 +1211,10 @@  discard block
 block discarded – undo
1211 1211
 	 * @return bool
1212 1212
 	 */
1213 1213
 	public function redirect_form() {
1214
-		$payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() );
1214
+		$payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment());
1215 1215
 		$html = $payment_method_billing_info->get_html_and_js();
1216 1216
 		$html .= $this->checkout->redirect_form;
1217
-		EE_Registry::instance()->REQ->add_output( $html );
1217
+		EE_Registry::instance()->REQ->add_output($html);
1218 1218
 		return TRUE;
1219 1219
 	}
1220 1220
 
@@ -1227,36 +1227,36 @@  discard block
 block discarded – undo
1227 1227
 	 * @return bool
1228 1228
 	 */
1229 1229
 	private function _billing_form_is_valid() {
1230
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1230
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1231 1231
 			return TRUE;
1232 1232
 		}
1233
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1234
-			if ( $this->checkout->billing_form->was_submitted() ) {
1233
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1234
+			if ($this->checkout->billing_form->was_submitted()) {
1235 1235
 				$this->checkout->billing_form->receive_form_submission();
1236
-				if ( $this->checkout->billing_form->is_valid() ) {
1236
+				if ($this->checkout->billing_form->is_valid()) {
1237 1237
 					return TRUE;
1238 1238
 				}
1239 1239
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1240 1240
 				$error_strings = array();
1241
-				foreach( $validation_errors as $validation_error ){
1242
-					if( $validation_error instanceof EE_Validation_Error ){
1241
+				foreach ($validation_errors as $validation_error) {
1242
+					if ($validation_error instanceof EE_Validation_Error) {
1243 1243
 						$form_section = $validation_error->get_form_section();
1244
-						if( $form_section instanceof EE_Form_Input_Base ){
1244
+						if ($form_section instanceof EE_Form_Input_Base) {
1245 1245
 							$label = $form_section->html_label_text();
1246
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1246
+						}elseif ($form_section instanceof EE_Form_Section_Base) {
1247 1247
 							$label = $form_section->name();
1248
-						}else{
1249
-							$label = __( 'Validation Error', 'event_espresso' );
1248
+						} else {
1249
+							$label = __('Validation Error', 'event_espresso');
1250 1250
 						}
1251
-						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
1251
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1252 1252
 					}
1253 1253
 				}
1254
-				EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings )  ), __FILE__, __FUNCTION__, __LINE__ );
1254
+				EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__);
1255 1255
 			} else {
1256
-				EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1256
+				EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1257 1257
 			}
1258 1258
 		} else {
1259
-			EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1259
+			EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1260 1260
 		}
1261 1261
 		return FALSE;
1262 1262
 	}
@@ -1274,9 +1274,9 @@  discard block
 block discarded – undo
1274 1274
 	 */
1275 1275
 		private function _setup_primary_registrant_prior_to_payment() {
1276 1276
 			// check if transaction has a primary registrant and that it has a related Attendee object
1277
-			if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1277
+			if ( ! $this->checkout->transaction_has_primary_registrant()) {
1278 1278
 				// need to at least gather some primary registrant data before attempting payment
1279
-				if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) {
1279
+				if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) {
1280 1280
 					return FALSE;
1281 1281
 				}
1282 1282
 			}
@@ -1284,13 +1284,13 @@  discard block
 block discarded – undo
1284 1284
 			// grab the primary_registration object
1285 1285
 			$primary_registration = $this->checkout->transaction->primary_registration();
1286 1286
 			/** @type EE_Transaction_Processor $transaction_processor */
1287
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1287
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1288 1288
 			// at this point we'll consider a TXN to not have been failed
1289
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1289
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1290 1290
 			// save the TXN ( which clears cached copy of primary_registration)
1291 1291
 			$this->checkout->transaction->save();
1292 1292
 			// grab TXN ID and save it to the primary_registration
1293
-			$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1293
+			$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1294 1294
 			// save what we have so far
1295 1295
 			$primary_registration->save();
1296 1296
 			return TRUE;
@@ -1307,41 +1307,41 @@  discard block
 block discarded – undo
1307 1307
 		private function _capture_primary_registration_data_from_billing_form() {
1308 1308
 			// convert billing form data into an attendee
1309 1309
 			$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1310
-			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1310
+			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1311 1311
 				EE_Error::add_error(
1312 1312
 					sprintf(
1313
-						__( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1313
+						__('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1314 1314
 						'<br/>',
1315
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1315
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1316 1316
 					), __FILE__, __FUNCTION__, __LINE__
1317 1317
 				);
1318 1318
 				return FALSE;
1319 1319
 			}
1320 1320
 			$primary_registration = $this->checkout->transaction->primary_registration();
1321
-			if ( ! $primary_registration instanceof EE_Registration ) {
1321
+			if ( ! $primary_registration instanceof EE_Registration) {
1322 1322
 				EE_Error::add_error(
1323 1323
 					sprintf(
1324
-						__( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1324
+						__('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1325 1325
 						'<br/>',
1326
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1326
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1327 1327
 					), __FILE__, __FUNCTION__, __LINE__
1328 1328
 				);
1329 1329
 				return FALSE;
1330 1330
 			}
1331
-			if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) {
1331
+			if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) {
1332 1332
 				EE_Error::add_error(
1333 1333
 					sprintf(
1334
-						__( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1334
+						__('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1335 1335
 						'<br/>',
1336
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1336
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1337 1337
 					), __FILE__, __FUNCTION__, __LINE__
1338 1338
 				);
1339 1339
 				return FALSE;
1340 1340
 			}
1341 1341
 			/** @type EE_Registration_Processor $registration_processor */
1342
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1342
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1343 1343
 			// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1344
-			$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1344
+			$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1345 1345
 
1346 1346
 			return TRUE;
1347 1347
 		}
@@ -1357,35 +1357,35 @@  discard block
 block discarded – undo
1357 1357
 	 */
1358 1358
 		private function _get_payment_method_for_selected_method_of_payment() {
1359 1359
 			// get EE_Payment_Method object
1360
-			if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) {
1361
-				$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1360
+			if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1361
+				$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1362 1362
 			} else {
1363 1363
 				// load EEM_Payment_Method
1364
-				EE_Registry::instance()->load_model( 'Payment_Method' );
1364
+				EE_Registry::instance()->load_model('Payment_Method');
1365 1365
 				/** @type EEM_Payment_Method $EEM_Payment_Method */
1366 1366
 				$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1367
-				$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1367
+				$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1368 1368
 			}
1369 1369
 			// verify $payment_method
1370
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
1370
+			if ( ! $payment_method instanceof EE_Payment_Method) {
1371 1371
 				// not a payment
1372 1372
 				EE_Error::add_error(
1373 1373
 					sprintf(
1374
-						__( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1374
+						__('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1375 1375
 						'<br/>',
1376
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1376
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1377 1377
 					), __FILE__, __FUNCTION__, __LINE__
1378 1378
 				);
1379 1379
 				return NULL;
1380 1380
 			}
1381 1381
 			// and verify it has a valid Payment_Method Type object
1382
-			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1382
+			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1383 1383
 				// not a payment
1384 1384
 				EE_Error::add_error(
1385 1385
 					sprintf(
1386
-						__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1386
+						__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1387 1387
 						'<br/>',
1388
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1388
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1389 1389
 					), __FILE__, __FUNCTION__, __LINE__
1390 1390
 				);
1391 1391
 				return NULL;
@@ -1404,30 +1404,30 @@  discard block
 block discarded – undo
1404 1404
 	 * 	@type 	EE_Payment_Method $payment_method
1405 1405
 	 * 	@return 	mixed	EE_Payment | boolean
1406 1406
 	 */
1407
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1408
-		$payment =NULL;
1407
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1408
+		$payment = NULL;
1409 1409
 		$this->checkout->transaction->save();
1410
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1411
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1410
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1411
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1412 1412
 			return FALSE;
1413 1413
 		}
1414 1414
 		try {
1415
-			$payment_processor->set_revisit( $this->checkout->revisit );
1415
+			$payment_processor->set_revisit($this->checkout->revisit);
1416 1416
 			// generate payment object
1417 1417
 			$payment = $payment_processor->process_payment(
1418 1418
 				$payment_method,
1419 1419
 				$this->checkout->transaction,
1420 1420
 				$this->checkout->amount_owing,
1421 1421
 				$this->checkout->billing_form,
1422
-				$this->_get_return_url( $payment_method ),
1422
+				$this->_get_return_url($payment_method),
1423 1423
 				'CART',
1424 1424
 				$this->checkout->admin_request,
1425 1425
 				TRUE,
1426 1426
 				$this->reg_step_url()
1427 1427
 			);
1428 1428
 
1429
-		} catch( Exception $e ) {
1430
-			$this->_handle_payment_processor_exception( $e );
1429
+		} catch (Exception $e) {
1430
+			$this->_handle_payment_processor_exception($e);
1431 1431
 		}
1432 1432
 		return $payment;
1433 1433
 	}
@@ -1441,12 +1441,12 @@  discard block
 block discarded – undo
1441 1441
 	 * @param \Exception $e
1442 1442
 	 * @return void
1443 1443
 	 */
1444
-	protected function _handle_payment_processor_exception( Exception $e ) {
1444
+	protected function _handle_payment_processor_exception(Exception $e) {
1445 1445
 		EE_Error::add_error(
1446 1446
 			sprintf(
1447
-				__( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ),
1447
+				__('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'),
1448 1448
 				'<br/>',
1449
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
1449
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
1450 1450
 				$e->getMessage(),
1451 1451
 				$e->getFile(),
1452 1452
 				$e->getLine()
@@ -1463,9 +1463,9 @@  discard block
 block discarded – undo
1463 1463
 	 * @param \EE_Payment_Method $payment_method
1464 1464
 	 * @return string
1465 1465
 	 */
1466
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
1466
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
1467 1467
 		$return_url = '';
1468
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1468
+		switch ($payment_method->type_obj()->payment_occurs()) {
1469 1469
 
1470 1470
 			case EE_PMT_Base::offsite :
1471 1471
 				$return_url = add_query_arg(
@@ -1496,27 +1496,27 @@  discard block
 block discarded – undo
1496 1496
 	 * @param EE_Payment $payment
1497 1497
 	 * @return EE_Payment | FALSE
1498 1498
 	 */
1499
-	private function _validate_payment( $payment = NULL ) {
1500
-		if (  $this->checkout->payment_method->is_off_line() ) {
1499
+	private function _validate_payment($payment = NULL) {
1500
+		if ($this->checkout->payment_method->is_off_line()) {
1501 1501
 			return TRUE;
1502 1502
 		}
1503 1503
 		// verify payment object
1504
-		if ( $payment instanceof EE_Payment ) {
1504
+		if ($payment instanceof EE_Payment) {
1505 1505
 			if (
1506 1506
 				$payment->status() != EEM_Payment::status_id_approved
1507 1507
 				&& $payment->status() != EEM_Payment::status_id_pending
1508 1508
 				&& $payment->status() != EEM_Payment::status_id_cancelled
1509 1509
 				&& $payment->gateway_response() != ''
1510 1510
 			) {
1511
-				EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ );
1511
+				EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__);
1512 1512
 			}
1513 1513
 		} else {
1514 1514
 			// not a payment
1515 1515
 			EE_Error::add_error(
1516 1516
 				sprintf(
1517
-					__( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1517
+					__('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1518 1518
 					'<br/>',
1519
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1519
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1520 1520
 				), __FILE__, __FUNCTION__, __LINE__
1521 1521
 			);
1522 1522
 			return FALSE;
@@ -1533,23 +1533,23 @@  discard block
 block discarded – undo
1533 1533
 	 * @param EE_Payment $payment
1534 1534
 	 * @return bool
1535 1535
 	 */
1536
-	private function _post_payment_processing( $payment = NULL ) {
1536
+	private function _post_payment_processing($payment = NULL) {
1537 1537
 		// On-Site payment?
1538
-		if ( $this->checkout->payment_method->is_on_site() ) {
1539
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) {
1538
+		if ($this->checkout->payment_method->is_on_site()) {
1539
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
1540 1540
 				//$this->_setup_redirect_for_next_step();
1541 1541
 				$this->checkout->continue_reg = false;
1542 1542
 			}
1543 1543
 			// Off-Site payment?
1544
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
1544
+		} else if ($this->checkout->payment_method->is_off_site()) {
1545 1545
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
1546
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ){
1547
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
1546
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
1547
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
1548 1548
 				$this->checkout->redirect = TRUE;
1549 1549
 				$this->checkout->redirect_form = $payment->redirect_form();
1550
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
1550
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
1551 1551
 				// set JSON response
1552
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
1552
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
1553 1553
 				// set cron job for finalizing the TXN
1554 1554
 				// in case the user does not return from the off-site gateway
1555 1555
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -1557,21 +1557,21 @@  discard block
 block discarded – undo
1557 1557
 					$this->checkout->transaction->ID()
1558 1558
 				);
1559 1559
 				// and lastly, let's bump the payment status to pending
1560
-				$payment->set_status( EEM_Payment::status_id_pending );
1560
+				$payment->set_status(EEM_Payment::status_id_pending);
1561 1561
 				$payment->save();
1562 1562
 			} else {
1563 1563
 				// not a payment
1564 1564
 				$this->checkout->continue_reg = false;
1565 1565
 				EE_Error::add_error(
1566 1566
 					sprintf(
1567
-						__( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1567
+						__('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1568 1568
 						'<br/>',
1569
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1569
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1570 1570
 					), __FILE__, __FUNCTION__, __LINE__
1571 1571
 				);
1572 1572
 			}
1573 1573
 			// Off-Line payment?
1574
-		} else if ( $payment === TRUE ) {
1574
+		} else if ($payment === TRUE) {
1575 1575
 			//$this->_setup_redirect_for_next_step();
1576 1576
 			return TRUE;
1577 1577
 		} else {
@@ -1607,65 +1607,65 @@  discard block
 block discarded – undo
1607 1607
 	 * @return bool
1608 1608
 	 * @throws \EE_Error
1609 1609
 	 */
1610
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
1610
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
1611 1611
 		// off-line payment? carry on
1612
-		if ( $payment_occurs == EE_PMT_Base::offline ) {
1612
+		if ($payment_occurs == EE_PMT_Base::offline) {
1613 1613
 			return true;
1614 1614
 		}
1615 1615
 		// verify payment validity
1616
-		if ( $payment instanceof EE_Payment ) {
1617
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
1616
+		if ($payment instanceof EE_Payment) {
1617
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
1618 1618
 			$msg = $payment->gateway_response();
1619 1619
 			// check results
1620
-			switch ( $payment->status() ) {
1620
+			switch ($payment->status()) {
1621 1621
 
1622 1622
 				// good payment
1623 1623
 				case EEM_Payment::status_id_approved :
1624
-					EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1624
+					EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1625 1625
 					return TRUE;
1626 1626
 					break;
1627 1627
 
1628 1628
 				// slow payment
1629 1629
 				case EEM_Payment::status_id_pending :
1630
-					if ( empty( $msg )) {
1631
-						$msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' );
1630
+					if (empty($msg)) {
1631
+						$msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso');
1632 1632
 					}
1633
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
1633
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
1634 1634
 					return TRUE;
1635 1635
 					break;
1636 1636
 
1637 1637
 				// don't wanna payment
1638 1638
 				case EEM_Payment::status_id_cancelled :
1639
-					if ( empty( $msg )) {
1639
+					if (empty($msg)) {
1640 1640
 						$msg = _n(
1641 1641
 							'Payment cancelled. Please try again.',
1642 1642
 							'Payment cancelled. Please try again or select another method of payment.',
1643
-							count( $this->checkout->available_payment_methods ),
1643
+							count($this->checkout->available_payment_methods),
1644 1644
 							'event_espresso'
1645 1645
 						);
1646 1646
 					}
1647
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1647
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1648 1648
 					return FALSE;
1649 1649
 					break;
1650 1650
 
1651 1651
 				// not enough payment
1652 1652
 				case EEM_Payment::status_id_declined :
1653
-					if ( empty( $msg )) {
1653
+					if (empty($msg)) {
1654 1654
 						$msg = _n(
1655 1655
 							'We\'re sorry but your payment was declined. Please try again.',
1656 1656
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
1657
-							count( $this->checkout->available_payment_methods ),
1657
+							count($this->checkout->available_payment_methods),
1658 1658
 							'event_espresso'
1659 1659
 						);
1660 1660
 					}
1661
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1661
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1662 1662
 					return FALSE;
1663 1663
 					break;
1664 1664
 
1665 1665
 				// bad payment
1666 1666
 				case EEM_Payment::status_id_failed :
1667
-					if ( ! empty( $msg ) ) {
1668
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1667
+					if ( ! empty($msg)) {
1668
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1669 1669
 						return false;
1670 1670
 					}
1671 1671
 					// default to error below
@@ -1675,14 +1675,14 @@  discard block
 block discarded – undo
1675 1675
 		}
1676 1676
 		// off-site payment gateway responses are too unreliable, so let's just assume that
1677 1677
 		// the payment processing is just running slower than the registrant's request
1678
-		if ( $payment_occurs == EE_PMT_Base::offsite ) {
1678
+		if ($payment_occurs == EE_PMT_Base::offsite) {
1679 1679
 			return true;
1680 1680
 		}
1681 1681
 		EE_Error::add_error(
1682 1682
 				sprintf(
1683
-					__( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1683
+					__('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1684 1684
 					'<br/>',
1685
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1685
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1686 1686
 				),
1687 1687
 				__FILE__, __FUNCTION__, __LINE__
1688 1688
 			);
@@ -1715,13 +1715,13 @@  discard block
 block discarded – undo
1715 1715
 	public function process_gateway_response() {
1716 1716
 		$payment = null;
1717 1717
 		// how have they chosen to pay?
1718
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1718
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1719 1719
 		// get EE_Payment_Method object
1720
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1720
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1721 1721
 			$this->checkout->continue_reg = false;
1722 1722
 			return false;
1723 1723
 		}
1724
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
1724
+		if ( ! $this->checkout->payment_method->is_off_site()) {
1725 1725
 			return false;
1726 1726
 		}
1727 1727
 		$this->_validate_offsite_return();
@@ -1735,23 +1735,23 @@  discard block
 block discarded – undo
1735 1735
 		//	true
1736 1736
 		//);
1737 1737
 		// verify TXN
1738
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1738
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1739 1739
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
1740
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
1740
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
1741 1741
 				$this->checkout->continue_reg = false;
1742 1742
 				return false;
1743 1743
 			}
1744
-			$payment = $this->_process_off_site_payment( $gateway );
1745
-			$payment = $this->_process_cancelled_payments( $payment );
1746
-			$payment = $this->_validate_payment( $payment );
1744
+			$payment = $this->_process_off_site_payment($gateway);
1745
+			$payment = $this->_process_cancelled_payments($payment);
1746
+			$payment = $this->_validate_payment($payment);
1747 1747
 			// if payment was not declined by the payment gateway or cancelled by the registrant
1748
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
1748
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
1749 1749
 				//$this->_setup_redirect_for_next_step();
1750 1750
 				// store that for later
1751 1751
 				$this->checkout->payment = $payment;
1752 1752
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
1753 1753
 				// because we will complete this step during the IPN processing then
1754
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) {
1754
+				if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) {
1755 1755
 					$this->set_completed();
1756 1756
 				}
1757 1757
 				return true;
@@ -1774,19 +1774,19 @@  discard block
 block discarded – undo
1774 1774
 	 * @return bool
1775 1775
 	 */
1776 1776
 	private function _validate_offsite_return() {
1777
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
1778
-		if ( $TXN_ID != $this->checkout->transaction->ID() ) {
1777
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
1778
+		if ($TXN_ID != $this->checkout->transaction->ID()) {
1779 1779
 			// Houston... we might have a problem
1780 1780
 			$invalid_TXN = false;
1781 1781
 			// first gather some info
1782
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1782
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1783 1783
 			$primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null;
1784 1784
 			// let's start by retrieving the cart for this TXN
1785
-			$cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction );
1786
-			if ( $cart instanceof EE_Cart ) {
1785
+			$cart = EE_Cart::get_cart_from_txn($this->checkout->transaction);
1786
+			if ($cart instanceof EE_Cart) {
1787 1787
 				// verify that the current cart has tickets
1788 1788
 				$tickets = $cart->get_tickets();
1789
-				if ( empty( $tickets ) ) {
1789
+				if (empty($tickets)) {
1790 1790
 					$invalid_TXN = true;
1791 1791
 				}
1792 1792
 			} else {
@@ -1794,39 +1794,39 @@  discard block
 block discarded – undo
1794 1794
 			}
1795 1795
 			$valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null;
1796 1796
 			// validate current Session ID and compare against valid TXN session ID
1797
-			if ( EE_Session::instance()->id() === null ) {
1797
+			if (EE_Session::instance()->id() === null) {
1798 1798
 				$invalid_TXN = true;
1799
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
1799
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
1800 1800
 				// WARNING !!!
1801 1801
 				// this could be PayPal sending back duplicate requests (ya they do that)
1802 1802
 				// or it **could** mean someone is simply registering AGAIN after having just done so
1803 1803
 				// so now we need to determine if this current TXN looks valid or not
1804 1804
 				/** @type EE_Transaction_Processor $transaction_processor */
1805
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1805
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1806 1806
 				// has this step even been started ?
1807
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
1807
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
1808 1808
 				) {
1809 1809
 					// really? you're half way through this reg step, but you never started it ?
1810 1810
 					$invalid_TXN = true;
1811 1811
 				}
1812 1812
 			}
1813
-			if ( $invalid_TXN ) {
1813
+			if ($invalid_TXN) {
1814 1814
 				// is the valid TXN completed ?
1815
-				if ( $valid_TXN instanceof EE_Transaction ) {
1815
+				if ($valid_TXN instanceof EE_Transaction) {
1816 1816
 					/** @type EE_Transaction_Processor $transaction_processor */
1817
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1817
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1818 1818
 					// has this step even been started ?
1819
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
1820
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
1819
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
1820
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
1821 1821
 						// so it **looks** like this is a double request from PayPal
1822 1822
 						// so let's try to pick up where we left off
1823 1823
 						$this->checkout->transaction = $valid_TXN;
1824
-						$this->checkout->refresh_all_entities( true );
1824
+						$this->checkout->refresh_all_entities(true);
1825 1825
 						return;
1826 1826
 					}
1827 1827
 				}
1828 1828
 				// you appear to be lost?
1829
-				$this->_redirect_wayward_request( $primary_registrant );
1829
+				$this->_redirect_wayward_request($primary_registrant);
1830 1830
 			}
1831 1831
 		}
1832 1832
 	}
@@ -1840,16 +1840,16 @@  discard block
 block discarded – undo
1840 1840
 	 * @param \EE_Registration $primary_registrant
1841 1841
 	 * @return bool
1842 1842
 	 */
1843
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1844
-		if ( ! $primary_registrant instanceof EE_Registration ) {
1843
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
1844
+		if ( ! $primary_registrant instanceof EE_Registration) {
1845 1845
 			// try redirecting based on the current TXN
1846 1846
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null;
1847
-			if ( ! $primary_registrant instanceof EE_Registration ) {
1847
+			if ( ! $primary_registrant instanceof EE_Registration) {
1848 1848
 				EE_Error::add_error(
1849 1849
 					sprintf(
1850
-						__( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1850
+						__('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1851 1851
 						'<br/>',
1852
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1852
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1853 1853
 					),
1854 1854
 					__FILE__, __FUNCTION__, __LINE__
1855 1855
 				);
@@ -1877,16 +1877,16 @@  discard block
 block discarded – undo
1877 1877
 	 * @param \EE_Offsite_Gateway $gateway
1878 1878
 	 * @return \EE_Payment
1879 1879
 	 */
1880
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
1880
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
1881 1881
 		try {
1882 1882
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
1883
-			if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
1883
+			if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
1884 1884
 				$payment = $this->checkout->transaction->last_payment();
1885 1885
 				//$payment_source = 'last_payment';
1886 1886
 			} else {
1887 1887
 				// get payment details and process results
1888 1888
 				/** @type EE_Payment_Processor $payment_processor */
1889
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1889
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1890 1890
 				$payment = $payment_processor->process_ipn(
1891 1891
 					$_REQUEST,
1892 1892
 					$this->checkout->transaction,
@@ -1896,14 +1896,14 @@  discard block
 block discarded – undo
1896 1896
 				);
1897 1897
 				//$payment_source = 'process_ipn';
1898 1898
 			}
1899
-		} catch ( Exception $e ) {
1899
+		} catch (Exception $e) {
1900 1900
 			// let's just eat the exception and try to move on using any previously set payment info
1901 1901
 			$payment = $this->checkout->transaction->last_payment();
1902 1902
 			//$payment_source = 'last_payment after Exception';
1903 1903
 			// but if we STILL don't have a payment object
1904
-			if ( ! $payment instanceof EE_Payment ) {
1904
+			if ( ! $payment instanceof EE_Payment) {
1905 1905
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
1906
-				$this->_handle_payment_processor_exception( $e );
1906
+				$this->_handle_payment_processor_exception($e);
1907 1907
 			}
1908 1908
 		}
1909 1909
 		// DEBUG LOG
@@ -1927,13 +1927,13 @@  discard block
 block discarded – undo
1927 1927
 	 * @param EE_Payment $payment
1928 1928
 	 * @return EE_Payment | FALSE
1929 1929
 	 */
1930
-	private function _process_cancelled_payments( $payment = NULL ) {
1930
+	private function _process_cancelled_payments($payment = NULL) {
1931 1931
 		if (
1932
-			isset( $_REQUEST[ 'ee_cancel_payment' ] )
1932
+			isset($_REQUEST['ee_cancel_payment'])
1933 1933
 			&& $payment instanceof EE_Payment
1934 1934
 			&& $payment->status() == EEM_Payment::status_id_failed
1935 1935
 		) {
1936
-			$payment->set_status( EEM_Payment::status_id_cancelled );
1936
+			$payment->set_status(EEM_Payment::status_id_cancelled);
1937 1937
 		}
1938 1938
 		return $payment;
1939 1939
 	}
@@ -1950,23 +1950,23 @@  discard block
 block discarded – undo
1950 1950
 	public function get_transaction_details_for_gateways() {
1951 1951
 		$txn_details = array();
1952 1952
 		// ya gotta make a choice man
1953
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1953
+		if (empty($this->checkout->selected_method_of_payment)) {
1954 1954
 			$txn_details = array(
1955
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
1955
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
1956 1956
 			);
1957 1957
 		}
1958 1958
 		// get EE_Payment_Method object
1959 1959
 		if (
1960
-			empty( $txn_details ) &&
1960
+			empty($txn_details) &&
1961 1961
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
1962 1962
 		) {
1963 1963
 			$txn_details = array(
1964 1964
 				'selected_method_of_payment' => $this->checkout->selected_method_of_payment,
1965
-				'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' )
1965
+				'error' => __('A valid Payment Method could not be determined.', 'event_espresso')
1966 1966
 			);
1967 1967
 		}
1968
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
1969
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
1968
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
1969
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
1970 1970
 			$txn_details = array(
1971 1971
 				'TXN_ID'        			=> $this->checkout->transaction->ID(),
1972 1972
 				'TXN_timestamp' 	=> $this->checkout->transaction->datetime(),
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 				'PMD_ID'        			=> $this->checkout->transaction->payment_method_ID(),
1978 1978
 				'payment_amount' => $this->checkout->amount_owing,
1979 1979
 				'return_url' 				=> $return_url,
1980
-				'cancel_url' 				=> add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
1980
+				'cancel_url' 				=> add_query_arg(array('ee_cancel_payment' => true), $return_url),
1981 1981
 				'notify_url' 				=> EE_Config::instance()->core->txn_page_url(
1982 1982
 					array(
1983 1983
 						'e_reg_url_link'    			=> $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
 				)
1987 1987
 			);
1988 1988
 		}
1989
-		echo json_encode( $txn_details );
1989
+		echo json_encode($txn_details);
1990 1990
 		exit();
1991 1991
 	}
1992 1992
 
Please login to merge, or discard this patch.
core/db_classes/EE_CPT_Base.class.php 2 patches
Doc Comments   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * The main purpose of this method is to return the parent for the model object
99 99
 	 *
100 100
 	 * @access public
101
-	 * @return int
101
+	 * @return boolean
102 102
 	 */
103 103
 	public function parent() {
104 104
 		return $this->get( 'parent' );
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
 	/**
110 110
 	 * return the _status property
111
-	 * @return string
111
+	 * @return boolean
112 112
 	 */
113 113
 	public function status() {
114 114
 		return $this->get( 'status' );
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @link   http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
132 132
 	 * @access protected
133
-	 * @param string|array $size (optional) Image size. Defaults to 'post-thumbnail' but can also be a 2-item array representing width and height in pixels (i.e. array(32,32) ).
133
+	 * @param string $size (optional) Image size. Defaults to 'post-thumbnail' but can also be a 2-item array representing width and height in pixels (i.e. array(32,32) ).
134 134
 	 * @param string|array $attr Optional. Query string or array of attributes.
135 135
 	 * @return string HTML image element
136 136
 	 */
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 	/**
160 160
 	 * This uses the wp "wp_get_attachment_image_src()" function to return the feature image for the current class using the given size params.
161
-	 * @param  string|array $size can either be a string: 'thumbnail', 'medium', 'large', 'full' OR 2-item array representing width and height in pixels eg. array(32,32).
161
+	 * @param  integer[] $size can either be a string: 'thumbnail', 'medium', 'large', 'full' OR 2-item array representing width and height in pixels eg. array(32,32).
162 162
 	 * @return string|boolean          the url of the image or false if not found
163 163
 	 */
164 164
 	public function feature_image_url( $size = 'thumbnail' ) {
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * This is a method for restoring this_obj using details from the given $revision_id
173 173
 	 *
174 174
 	 * @param int $revision_id 		ID of the revision we're getting data from
175
-	 * @param array $related_obj_names if included this will be used to restore for related obj
175
+	 * @param string[] $related_obj_names if included this will be used to restore for related obj
176 176
 	 *                                 if not included then we just do restore on the meta.
177 177
 	 *                                 We will accept an array of related_obj_names for restoration here.
178 178
 	 * @param array $where_query       You can optionally include an array of key=>value pairs
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * Wrapper for get_post_meta, http://codex.wordpress.org/Function_Reference/get_post_meta
228 228
 	 * @param string  $meta_key
229 229
 	 * @param boolean $single
230
-	 * @return mixed <ul><li>If only $id is set it will return all meta values in an associative array.</li>
230
+	 * @return string|null <ul><li>If only $id is set it will return all meta values in an associative array.</li>
231 231
 	 * <li>If $single is set to false, or left blank, the function returns an array containing all values of the specified key.</li>
232 232
 	 * <li>If $single is set to true, the function returns the first value of the specified key (not in an array</li></ul>
233 233
 	 */
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 
257 257
 	/**
258 258
 	 * Wrapper for add_post_meta, http://codex.wordpress.org/Function_Reference/add_post_meta
259
-	 * @param mixed $meta_key
260
-	 * @param mixed $meta_value
259
+	 * @param string $meta_key
260
+	 * @param boolean $meta_value
261 261
 	 * @param bool  $unique . If postmeta for this $meta_key already exists, whether to add an additional item or not
262 262
 	 * @throws EE_Error
263 263
 	 * @return boolean Boolean true, except if the $unique argument was set to true and a custom field with the given key already exists, in which case false is returned.
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	/**
275 275
 	 * Wrapper for delete_post_meta, http://codex.wordpress.org/Function_Reference/delete_post_meta
276 276
 	 *
277
-	 * @param mixed $meta_key
277
+	 * @param string $meta_key
278 278
 	 * @param mixed $meta_value
279 279
 	 * @throws EE_Error
280 280
 	 * @return boolean False for failure. True for success.
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	/**
302 302
 	 * Gets all the term-taxonomies for this CPT
303 303
 	 * @param array $query_params
304
-	 * @return EE_Term_Taxonomy
304
+	 * @return EE_Base_Class[]
305 305
 	 */
306 306
 	public function term_taxonomies( $query_params = array() ) {
307 307
 		return $this->get_many_related( 'Term_Taxonomy', $query_params );
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 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
  * Event Espresso
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 * @param int    $parent_term_taxonomy_id optional
48 48
 	 * @return EE_Term_Taxonomy
49 49
 	 */
50
-	function add_event_category( $category_name, $category_description = NULL, $parent_term_taxonomy_id = NULL ) {
51
-		return $this->get_model()->add_event_category( $this, $category_name, $category_description, $parent_term_taxonomy_id );
50
+	function add_event_category($category_name, $category_description = NULL, $parent_term_taxonomy_id = NULL) {
51
+		return $this->get_model()->add_event_category($this, $category_name, $category_description, $parent_term_taxonomy_id);
52 52
 	}
53 53
 
54 54
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 * @param string $category_name
59 59
 	 * @return bool
60 60
 	 */
61
-	function remove_event_category( $category_name ) {
62
-		return $this->get_model()->remove_event_category( $this, $category_name );
61
+	function remove_event_category($category_name) {
62
+		return $this->get_model()->remove_event_category($this, $category_name);
63 63
 	}
64 64
 
65 65
 
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 	 * @param EE_Term_Taxonomy $term_taxonomy
71 71
 	 * @return EE_Base_Class the relation was removed from
72 72
 	 */
73
-	function remove_relation_to_term_taxonomy( $term_taxonomy ) {
74
-		if ( !$term_taxonomy ) {
75
-			EE_Error::add_error( sprintf( __( "No Term_Taxonomy provided which to remove from model object of type %s and id %d", "event_espresso" ), get_class( $this ), $this->ID() ), __FILE__, __FUNCTION__, __LINE__ );
73
+	function remove_relation_to_term_taxonomy($term_taxonomy) {
74
+		if ( ! $term_taxonomy) {
75
+			EE_Error::add_error(sprintf(__("No Term_Taxonomy provided which to remove from model object of type %s and id %d", "event_espresso"), get_class($this), $this->ID()), __FILE__, __FUNCTION__, __LINE__);
76 76
 			return NULL;
77 77
 		}
78
-		$term_taxonomy->set_count( $term_taxonomy->count() - 1 );
78
+		$term_taxonomy->set_count($term_taxonomy->count() - 1);
79 79
 		$term_taxonomy->save();
80
-		return $this->_remove_relation_to( $term_taxonomy, 'Term_Taxonomy' );
80
+		return $this->_remove_relation_to($term_taxonomy, 'Term_Taxonomy');
81 81
 	}
82 82
 
83 83
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @return int
102 102
 	 */
103 103
 	public function parent() {
104
-		return $this->get( 'parent' );
104
+		return $this->get('parent');
105 105
 	}
106 106
 
107 107
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return string
112 112
 	 */
113 113
 	public function status() {
114
-		return $this->get( 'status' );
114
+		return $this->get('status');
115 115
 	}
116 116
 
117 117
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	/**
120 120
 	 * @param string $status
121 121
 	 */
122
-	public function set_status( $status ) {
123
-		$this->set( 'status', $status );
122
+	public function set_status($status) {
123
+		$this->set('status', $status);
124 124
 	}
125 125
 
126 126
 
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 	 * @param string|array $attr Optional. Query string or array of attributes.
135 135
 	 * @return string HTML image element
136 136
 	 */
137
-	protected function _get_feature_image( $size, $attr ) {
137
+	protected function _get_feature_image($size, $attr) {
138 138
 		//first let's see if we already have the _feature_image property set AND if it has a cached element on it FOR the given size
139
-		$attr_key = is_array( $attr ) ? implode( '_', $attr ) : $attr;
140
-		$cache_key = is_array( $size ) ? implode( '_', $size ) . $attr_key : $size . $attr_key;
141
-		$this->_feature_image[ $cache_key ] = isset( $this->_feature_image[ $cache_key ] ) ? $this->_feature_image[ $cache_key ] : $this->get_model()->get_feature_image( $this->ID(), $size, $attr );
142
-		return $this->_feature_image[ $cache_key ];
139
+		$attr_key = is_array($attr) ? implode('_', $attr) : $attr;
140
+		$cache_key = is_array($size) ? implode('_', $size).$attr_key : $size.$attr_key;
141
+		$this->_feature_image[$cache_key] = isset($this->_feature_image[$cache_key]) ? $this->_feature_image[$cache_key] : $this->get_model()->get_feature_image($this->ID(), $size, $attr);
142
+		return $this->_feature_image[$cache_key];
143 143
 	}
144 144
 
145 145
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @param string|array $attr
151 151
 	 * @return string of html
152 152
 	 */
153
-	public function feature_image( $size = 'thumbnail', $attr = '' ) {
154
-		return $this->_get_feature_image( $size, $attr );
153
+	public function feature_image($size = 'thumbnail', $attr = '') {
154
+		return $this->_get_feature_image($size, $attr);
155 155
 	}
156 156
 
157 157
 
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 	 * @param  string|array $size can either be a string: 'thumbnail', 'medium', 'large', 'full' OR 2-item array representing width and height in pixels eg. array(32,32).
162 162
 	 * @return string|boolean          the url of the image or false if not found
163 163
 	 */
164
-	public function feature_image_url( $size = 'thumbnail' ) {
165
-		$attachment = wp_get_attachment_image_src( get_post_thumbnail_id( $this->ID() ), $size );
166
-		return !empty( $attachment ) ? $attachment[ 0 ] : FALSE;
164
+	public function feature_image_url($size = 'thumbnail') {
165
+		$attachment = wp_get_attachment_image_src(get_post_thumbnail_id($this->ID()), $size);
166
+		return ! empty($attachment) ? $attachment[0] : FALSE;
167 167
 	}
168 168
 
169 169
 
@@ -185,37 +185,37 @@  discard block
 block discarded – undo
185 185
 	 *                                 This array is INDEXED by RELATED OBJ NAME (so it corresponds with the obj_names sent);
186 186
 	 * @return void
187 187
 	 */
188
-	public function restore_revision( $revision_id, $related_obj_names = array(), $where_query = array() ) {
188
+	public function restore_revision($revision_id, $related_obj_names = array(), $where_query = array()) {
189 189
 		//get revision object
190
-		$revision_obj = $this->get_model()->get_one_by_ID( $revision_id );
191
-		if ( $revision_obj instanceof EE_CPT_Base ) {
190
+		$revision_obj = $this->get_model()->get_one_by_ID($revision_id);
191
+		if ($revision_obj instanceof EE_CPT_Base) {
192 192
 			//no related_obj_name so we assume we're saving a revision on this object.
193
-			if ( empty( $related_obj_names ) ) {
193
+			if (empty($related_obj_names)) {
194 194
 				$fields = $this->get_model()->get_meta_table_fields();
195
-				foreach ( $fields as $field ) {
196
-					$this->set( $field, $revision_obj->get( $field ) );
195
+				foreach ($fields as $field) {
196
+					$this->set($field, $revision_obj->get($field));
197 197
 				}
198 198
 				$this->save();
199 199
 			}
200
-			$related_obj_names = (array)$related_obj_names;
201
-			foreach ( $related_obj_names as $related_name ) {
200
+			$related_obj_names = (array) $related_obj_names;
201
+			foreach ($related_obj_names as $related_name) {
202 202
 				//related_obj_name so we're saving a revision on an object related to this object
203 203
 				//do we have $where_query params for this related object?  If we do then we include that.
204
-				$cols_n_values = isset( $where_query[ $related_name ] ) ? $where_query[ $related_name ] : array();
205
-				$where_params = !empty( $cols_n_values ) ? array( $cols_n_values ) : array();
206
-				$related_objs = $this->get_many_related( $related_name, $where_params );
207
-				$revision_related_objs = $revision_obj->get_many_related( $related_name, $where_params );
204
+				$cols_n_values = isset($where_query[$related_name]) ? $where_query[$related_name] : array();
205
+				$where_params = ! empty($cols_n_values) ? array($cols_n_values) : array();
206
+				$related_objs = $this->get_many_related($related_name, $where_params);
207
+				$revision_related_objs = $revision_obj->get_many_related($related_name, $where_params);
208 208
 				//load helper
209
-				EE_Registry::instance()->load_helper( 'Array' );
209
+				EE_Registry::instance()->load_helper('Array');
210 210
 				//remove related objs from this object that are not in revision
211 211
 				//array_diff *should* work cause I think objects are indexed by ID?
212
-				$related_to_remove = EEH_Array::object_array_diff( $related_objs, $revision_related_objs );
213
-				foreach ( $related_to_remove as $rr ) {
214
-					$this->_remove_relation_to( $rr, $related_name, $cols_n_values );
212
+				$related_to_remove = EEH_Array::object_array_diff($related_objs, $revision_related_objs);
213
+				foreach ($related_to_remove as $rr) {
214
+					$this->_remove_relation_to($rr, $related_name, $cols_n_values);
215 215
 				}
216 216
 				//add all related objs attached to revision to this object
217
-				foreach ( $revision_related_objs as $r_obj ) {
218
-					$this->_add_relation_to( $r_obj, $related_name, $cols_n_values );
217
+				foreach ($revision_related_objs as $r_obj) {
218
+					$this->_add_relation_to($r_obj, $related_name, $cols_n_values);
219 219
 				}
220 220
 			}
221 221
 		}
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 	 * <li>If $single is set to false, or left blank, the function returns an array containing all values of the specified key.</li>
232 232
 	 * <li>If $single is set to true, the function returns the first value of the specified key (not in an array</li></ul>
233 233
 	 */
234
-	public function get_post_meta( $meta_key = NULL, $single = FALSE ) {
235
-		return get_post_meta( $this->ID(), $meta_key, $single );
234
+	public function get_post_meta($meta_key = NULL, $single = FALSE) {
235
+		return get_post_meta($this->ID(), $meta_key, $single);
236 236
 	}
237 237
 
238 238
 
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	 * @throws EE_Error
246 246
 	 * @return mixed Returns meta_id if the meta doesn't exist, otherwise returns true on success and false on failure. NOTE: If the meta_value passed to this function is the same as the value that is already in the database, this function returns false.
247 247
 	 */
248
-	public function update_post_meta( $meta_key, $meta_value, $prev_value = NULL ) {
249
-		if ( !$this->ID() ) {
250
-			throw new EE_Error( sprintf( __( "You must save this custom post type before adding or updating a post meta field", "event_espresso" ) ) );
248
+	public function update_post_meta($meta_key, $meta_value, $prev_value = NULL) {
249
+		if ( ! $this->ID()) {
250
+			throw new EE_Error(sprintf(__("You must save this custom post type before adding or updating a post meta field", "event_espresso")));
251 251
 		}
252
-		return update_post_meta( $this->ID(), $meta_key, $meta_value, $prev_value );
252
+		return update_post_meta($this->ID(), $meta_key, $meta_value, $prev_value);
253 253
 	}
254 254
 
255 255
 
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	 * @throws EE_Error
263 263
 	 * @return boolean Boolean true, except if the $unique argument was set to true and a custom field with the given key already exists, in which case false is returned.
264 264
 	 */
265
-	public function add_post_meta( $meta_key, $meta_value, $unique = FALSE ) {
266
-		if ( !$this->ID() ) {
267
-			throw new EE_Error( sprintf( __( "You must save this custom post type before adding or updating a post meta field", "event_espresso" ) ) );
265
+	public function add_post_meta($meta_key, $meta_value, $unique = FALSE) {
266
+		if ( ! $this->ID()) {
267
+			throw new EE_Error(sprintf(__("You must save this custom post type before adding or updating a post meta field", "event_espresso")));
268 268
 		}
269
-		return add_post_meta( $this->ID(), $meta_key, $meta_value, $unique );
269
+		return add_post_meta($this->ID(), $meta_key, $meta_value, $unique);
270 270
 	}
271 271
 
272 272
 
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
 	 * @throws EE_Error
280 280
 	 * @return boolean False for failure. True for success.
281 281
 	 */
282
-	public function delete_post_meta( $meta_key, $meta_value = '' ) {
283
-		if ( ! $this->ID() ) {
284
-			throw new EE_Error( sprintf( __( "Can not delete post meta field for a post that has never been saved.", "event_espresso" ) ) );
282
+	public function delete_post_meta($meta_key, $meta_value = '') {
283
+		if ( ! $this->ID()) {
284
+			throw new EE_Error(sprintf(__("Can not delete post meta field for a post that has never been saved.", "event_espresso")));
285 285
 		}
286
-		return delete_post_meta( $this->ID(), $meta_key, $meta_value );
286
+		return delete_post_meta($this->ID(), $meta_key, $meta_value);
287 287
 	}
288 288
 
289 289
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 * @return string
294 294
 	 */
295 295
 	public function get_permalink() {
296
-		return get_permalink( $this->ID() );
296
+		return get_permalink($this->ID());
297 297
 	}
298 298
 
299 299
 
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 	 * @param array $query_params
304 304
 	 * @return EE_Term_Taxonomy
305 305
 	 */
306
-	public function term_taxonomies( $query_params = array() ) {
307
-		return $this->get_many_related( 'Term_Taxonomy', $query_params );
306
+	public function term_taxonomies($query_params = array()) {
307
+		return $this->get_many_related('Term_Taxonomy', $query_params);
308 308
 	}
309 309
 
310 310
 
Please login to merge, or discard this patch.
core/db_classes/EE_Event.class.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @access public
84 84
 	 * @param string $new_status
85 85
 	 * @param bool   $use_default
86
-	 * @return bool|void
86
+	 * @return boolean
87 87
 	 * @throws \EE_Error
88 88
 	 */
89 89
 	public function set_status( $new_status = null, $use_default = false ) {
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 	 *
1064 1064
 	 * @access public
1065 1065
 	 * @param boolean $echo     whether to return (FALSE), or echo out the result (TRUE)
1066
-	 * @return mixed void|string
1066
+	 * @return string void|string
1067 1067
 	 */
1068 1068
 	public function pretty_active_status( $echo = TRUE ) {
1069 1069
 		$active_status = $this->get_active_status();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -352,8 +352,7 @@  discard block
 block discarded – undo
352 352
 		$short_desc = $this->get( 'EVT_short_desc' );
353 353
 		if ( !empty( $short_desc ) || $not_full_desc ) {
354 354
 			return $short_desc;
355
-		}
356
-		else {
355
+		} else {
357 356
 			$full_desc = $this->get( 'EVT_desc' );
358 357
 			return wp_trim_words( $full_desc, $num_words, $more );
359 358
 		}
@@ -965,8 +964,7 @@  discard block
 block discarded – undo
965 964
 	public function is_sold_out( $actual = FALSE ) {
966 965
 		if ( ! $actual ) {
967 966
 			return $this->status() == EEM_Event::sold_out;
968
-		}
969
-		else {
967
+		} else {
970 968
 			return $this->perform_sold_out_status_check();
971 969
 		}
972 970
 	}
@@ -1158,8 +1156,7 @@  discard block
 block discarded – undo
1158 1156
 	public function get_permalink() {
1159 1157
 		if ( $this->external_url() ) {
1160 1158
 			return $this->external_url();
1161
-		}
1162
-		else {
1159
+		} else {
1163 1160
 			return parent::get_permalink();
1164 1161
 		}
1165 1162
 	}
Please login to merge, or discard this patch.
Spacing   +216 added lines, -216 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
 /**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 *                             		    date_format and the second value is the time format
36 36
 	 * @return EE_Event
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
39
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
40
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
38
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
39
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
40
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
41 41
 	}
42 42
 
43 43
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *                          		the website will be used.
49 49
 	 * @return EE_Event
50 50
 	 */
51
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
52
-		return new self( $props_n_values, TRUE, $timezone );
51
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
52
+		return new self($props_n_values, TRUE, $timezone);
53 53
 	}
54 54
 
55 55
 
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 	 * @param mixed  $field_value
62 62
 	 * @param bool   $use_default
63 63
 	 */
64
-	public function set( $field_name, $field_value, $use_default = false ) {
65
-		switch ( $field_name ) {
64
+	public function set($field_name, $field_value, $use_default = false) {
65
+		switch ($field_name) {
66 66
 			case 'status' :
67
-				$this->set_status( $field_value, $use_default );
67
+				$this->set_status($field_value, $use_default);
68 68
 				break;
69 69
 			default :
70
-				parent::set( $field_name, $field_value, $use_default );
70
+				parent::set($field_name, $field_value, $use_default);
71 71
 		}
72 72
 	}
73 73
 
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
 	 * @return bool|void
87 87
 	 * @throws \EE_Error
88 88
 	 */
89
-	public function set_status( $new_status = null, $use_default = false ) {
89
+	public function set_status($new_status = null, $use_default = false) {
90 90
 		// get current Event status
91 91
 		$old_status = $this->status();
92 92
 		// if status has changed
93
-		if ( $old_status != $new_status ) {
93
+		if ($old_status != $new_status) {
94 94
 			// TO sold_out
95
-			if ( $new_status == EEM_Event::sold_out ) {
95
+			if ($new_status == EEM_Event::sold_out) {
96 96
 				// save the previous event status so that we can revert if the event is no longer sold out
97
-				$this->add_post_meta( '_previous_event_status', $old_status );
98
-				do_action( 'AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status );
97
+				$this->add_post_meta('_previous_event_status', $old_status);
98
+				do_action('AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status);
99 99
 				// OR FROM  sold_out
100
-			} else if ( $old_status == EEM_Event::sold_out ) {
101
-				$this->delete_post_meta( '_previous_event_status' );
102
-				do_action( 'AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status );
100
+			} else if ($old_status == EEM_Event::sold_out) {
101
+				$this->delete_post_meta('_previous_event_status');
102
+				do_action('AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status);
103 103
 			}
104 104
 			// update status
105
-			parent::set( 'status', $new_status, $use_default );
106
-			do_action( 'AHEE__EE_Event__set_status__after_update', $this );
105
+			parent::set('status', $new_status, $use_default);
106
+			do_action('AHEE__EE_Event__set_status__after_update', $this);
107 107
 			return true;
108 108
 		} else {
109 109
 			// even though the old value matches the new value, it's still good to
110 110
 			// allow the parent set method to have a say
111
-			parent::set( 'status', $new_status, $use_default );
111
+			parent::set('status', $new_status, $use_default);
112 112
 			return true;
113 113
 		}
114 114
 	}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param array $query_params like EEM_Base::get_all
122 122
 	 * @return EE_Datetime[]
123 123
 	 */
124
-	public function datetimes( $query_params = array() ) {
125
-		return $this->get_many_related( 'Datetime', $query_params );
124
+	public function datetimes($query_params = array()) {
125
+		return $this->get_many_related('Datetime', $query_params);
126 126
 	}
127 127
 
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return EE_Datetime[]
134 134
 	 */
135 135
 	public function datetimes_in_chronological_order() {
136
-		return $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) );
136
+		return $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC')));
137 137
 	}
138 138
 
139 139
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param null $limit
150 150
 	 * @return \EE_Datetime[]
151 151
 	 */
152
-	public function datetimes_ordered( $show_expired = true, $show_deleted = false, $limit = null ) {
153
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_event_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted, $limit );
152
+	public function datetimes_ordered($show_expired = true, $show_deleted = false, $limit = null) {
153
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_event_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted, $limit);
154 154
 	}
155 155
 
156 156
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return EE_Datetime
161 161
 	 */
162 162
 	public function first_datetime() {
163
-		return $this->get_first_related( 'Datetime' );
163
+		return $this->get_first_related('Datetime');
164 164
 	}
165 165
 
166 166
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 * @param bool $try_to_exclude_deleted
172 172
 	 * @return EE_Datetime
173 173
 	 */
174
-	public function primary_datetime( $try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE ) {
175
-		if ( !empty ( $this->_Primary_Datetime ) ) {
174
+	public function primary_datetime($try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE) {
175
+		if ( ! empty ($this->_Primary_Datetime)) {
176 176
 			return $this->_Primary_Datetime;
177 177
 		}
178
-		$this->_Primary_Datetime = EEM_Datetime::instance( $this->_timezone )->get_primary_datetime_for_event( $this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted );
178
+		$this->_Primary_Datetime = EEM_Datetime::instance($this->_timezone)->get_primary_datetime_for_event($this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted);
179 179
 		return $this->_Primary_Datetime;
180 180
 	}
181 181
 
@@ -186,30 +186,30 @@  discard block
 block discarded – undo
186 186
 	 * @param array $query_params like EEM_Base::get_all
187 187
 	 * @return EE_Ticket[]
188 188
 	 */
189
-	public function tickets( $query_params = array() ) {
189
+	public function tickets($query_params = array()) {
190 190
 		//first get all datetimes
191 191
 		$datetimes = $this->datetimes_ordered();
192
-		if ( ! $datetimes ) {
192
+		if ( ! $datetimes) {
193 193
 			return array();
194 194
 		}
195 195
 
196 196
 		$datetime_ids = array();
197
-		foreach ( $datetimes as $datetime ) {
197
+		foreach ($datetimes as $datetime) {
198 198
 			$datetime_ids[] = $datetime->ID();
199 199
 		}
200 200
 
201
-		$where_params = array( 'Datetime.DTT_ID' => array( 'IN', $datetime_ids ) );
201
+		$where_params = array('Datetime.DTT_ID' => array('IN', $datetime_ids));
202 202
 
203 203
 		//if incoming $query_params has where conditions let's merge but not override existing.
204
-		if ( is_array( $query_params ) && isset( $query_params[0]) ) {
205
-			$where_params = array_merge( $query_params[0], $where_params );
206
-			unset( $query_params[0] );
204
+		if (is_array($query_params) && isset($query_params[0])) {
205
+			$where_params = array_merge($query_params[0], $where_params);
206
+			unset($query_params[0]);
207 207
 		}
208 208
 
209 209
 		//now add $where_params to $query_params
210 210
 		$query_params[0] = $where_params;
211 211
 
212
-		return EEM_Ticket::instance()->get_all( $query_params );
212
+		return EEM_Ticket::instance()->get_all($query_params);
213 213
 	}
214 214
 
215 215
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return bool
219 219
 	 */
220 220
 	function additional_limit() {
221
-		return $this->get( 'EVT_additional_limit' );
221
+		return $this->get('EVT_additional_limit');
222 222
 	}
223 223
 
224 224
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * @return bool
228 228
 	 */
229 229
 	function allow_overflow() {
230
-		return $this->get( 'EVT_allow_overflow' );
230
+		return $this->get('EVT_allow_overflow');
231 231
 	}
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @return bool
237 237
 	 */
238 238
 	function created() {
239
-		return $this->get( 'EVT_created' );
239
+		return $this->get('EVT_created');
240 240
 	}
241 241
 
242 242
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return bool
246 246
 	 */
247 247
 	function description() {
248
-		return $this->get( 'EVT_desc' );
248
+		return $this->get('EVT_desc');
249 249
 	}
250 250
 
251 251
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 * @return string of html
256 256
 	 */
257 257
 	function description_filtered() {
258
-		return $this->get_pretty( 'EVT_desc' );
258
+		return $this->get_pretty('EVT_desc');
259 259
 	}
260 260
 
261 261
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @return bool
265 265
 	 */
266 266
 	function display_description() {
267
-		return $this->get( 'EVT_display_desc' );
267
+		return $this->get('EVT_display_desc');
268 268
 	}
269 269
 
270 270
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return bool
274 274
 	 */
275 275
 	function display_ticket_selector() {
276
-		return (bool)$this->get( 'EVT_display_ticket_selector' );
276
+		return (bool) $this->get('EVT_display_ticket_selector');
277 277
 	}
278 278
 
279 279
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 * @return bool
283 283
 	 */
284 284
 	function external_url() {
285
-		return $this->get( 'EVT_external_URL' );
285
+		return $this->get('EVT_external_URL');
286 286
 	}
287 287
 
288 288
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @return bool
292 292
 	 */
293 293
 	function member_only() {
294
-		return $this->get( 'EVT_member_only' );
294
+		return $this->get('EVT_member_only');
295 295
 	}
296 296
 
297 297
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @return bool
301 301
 	 */
302 302
 	function phone() {
303
-		return $this->get( 'EVT_phone' );
303
+		return $this->get('EVT_phone');
304 304
 	}
305 305
 
306 306
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @return bool
310 310
 	 */
311 311
 	function modified() {
312
-		return $this->get( 'EVT_modified' );
312
+		return $this->get('EVT_modified');
313 313
 	}
314 314
 
315 315
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @return bool
319 319
 	 */
320 320
 	function name() {
321
-		return $this->get( 'EVT_name' );
321
+		return $this->get('EVT_name');
322 322
 	}
323 323
 
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @return bool
328 328
 	 */
329 329
 	function order() {
330
-		return $this->get( 'EVT_order' );
330
+		return $this->get('EVT_order');
331 331
 	}
332 332
 
333 333
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @return bool|string
337 337
 	 */
338 338
 	function default_registration_status() {
339
-		$event_default_registration_status = $this->get( 'EVT_default_registration_status' );
340
-		return !empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID;
339
+		$event_default_registration_status = $this->get('EVT_default_registration_status');
340
+		return ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID;
341 341
 	}
342 342
 
343 343
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 * @param bool $not_full_desc
349 349
 	 * @return bool|string
350 350
 	 */
351
-	function short_description( $num_words = 55, $more = NULL, $not_full_desc = FALSE ) {
352
-		$short_desc = $this->get( 'EVT_short_desc' );
353
-		if ( !empty( $short_desc ) || $not_full_desc ) {
351
+	function short_description($num_words = 55, $more = NULL, $not_full_desc = FALSE) {
352
+		$short_desc = $this->get('EVT_short_desc');
353
+		if ( ! empty($short_desc) || $not_full_desc) {
354 354
 			return $short_desc;
355 355
 		}
356 356
 		else {
357
-			$full_desc = $this->get( 'EVT_desc' );
358
-			return wp_trim_words( $full_desc, $num_words, $more );
357
+			$full_desc = $this->get('EVT_desc');
358
+			return wp_trim_words($full_desc, $num_words, $more);
359 359
 		}
360 360
 	}
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @return bool
366 366
 	 */
367 367
 	function slug() {
368
-		return $this->get( 'EVT_slug' );
368
+		return $this->get('EVT_slug');
369 369
 	}
370 370
 
371 371
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 * @return bool
375 375
 	 */
376 376
 	function timezone_string() {
377
-		return $this->get( 'EVT_timezone_string' );
377
+		return $this->get('EVT_timezone_string');
378 378
 	}
379 379
 
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @return bool
384 384
 	 */
385 385
 	function visible_on() {
386
-		return $this->get( 'EVT_visible_on' );
386
+		return $this->get('EVT_visible_on');
387 387
 	}
388 388
 
389 389
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 * @return bool
393 393
 	 */
394 394
 	function wp_user() {
395
-		return $this->get( 'EVT_wp_user' );
395
+		return $this->get('EVT_wp_user');
396 396
 	}
397 397
 
398 398
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * @return bool
402 402
 	 */
403 403
 	function donations() {
404
-		return $this->get( 'EVT_donations' );
404
+		return $this->get('EVT_donations');
405 405
 	}
406 406
 
407 407
 
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
 	/**
410 410
 	 * @param $limit
411 411
 	 */
412
-	function set_additional_limit( $limit ) {
413
-		$this->set( 'EVT_additional_limit', $limit );
412
+	function set_additional_limit($limit) {
413
+		$this->set('EVT_additional_limit', $limit);
414 414
 	}
415 415
 
416 416
 
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	/**
419 419
 	 * @param $created
420 420
 	 */
421
-	function set_created( $created ) {
422
-		$this->set( 'EVT_created', $created );
421
+	function set_created($created) {
422
+		$this->set('EVT_created', $created);
423 423
 	}
424 424
 
425 425
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 	/**
428 428
 	 * @param $desc
429 429
 	 */
430
-	function set_description( $desc ) {
431
-		$this->set( 'EVT_desc', $desc );
430
+	function set_description($desc) {
431
+		$this->set('EVT_desc', $desc);
432 432
 	}
433 433
 
434 434
 
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 	/**
437 437
 	 * @param $display_desc
438 438
 	 */
439
-	function set_display_description( $display_desc ) {
440
-		$this->set( 'EVT_display_desc', $display_desc );
439
+	function set_display_description($display_desc) {
440
+		$this->set('EVT_display_desc', $display_desc);
441 441
 	}
442 442
 
443 443
 
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 	/**
446 446
 	 * @param $display_ticket_selector
447 447
 	 */
448
-	function set_display_ticket_selector( $display_ticket_selector ) {
449
-		$this->set( 'EVT_display_ticket_selector', $display_ticket_selector );
448
+	function set_display_ticket_selector($display_ticket_selector) {
449
+		$this->set('EVT_display_ticket_selector', $display_ticket_selector);
450 450
 	}
451 451
 
452 452
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	/**
455 455
 	 * @param $external_url
456 456
 	 */
457
-	function set_external_url( $external_url ) {
458
-		$this->set( 'EVT_external_URL', $external_url );
457
+	function set_external_url($external_url) {
458
+		$this->set('EVT_external_URL', $external_url);
459 459
 	}
460 460
 
461 461
 
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	/**
464 464
 	 * @param $member_only
465 465
 	 */
466
-	function set_member_only( $member_only ) {
467
-		$this->set( 'EVT_member_only', $member_only );
466
+	function set_member_only($member_only) {
467
+		$this->set('EVT_member_only', $member_only);
468 468
 	}
469 469
 
470 470
 
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 	/**
473 473
 	 * @param $event_phone
474 474
 	 */
475
-	function set_event_phone( $event_phone ) {
476
-		$this->set( 'EVT_phone', $event_phone );
475
+	function set_event_phone($event_phone) {
476
+		$this->set('EVT_phone', $event_phone);
477 477
 	}
478 478
 
479 479
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 	/**
482 482
 	 * @param $modified
483 483
 	 */
484
-	function set_modified( $modified ) {
485
-		$this->set( 'EVT_modified', $modified );
484
+	function set_modified($modified) {
485
+		$this->set('EVT_modified', $modified);
486 486
 	}
487 487
 
488 488
 
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	/**
491 491
 	 * @param $name
492 492
 	 */
493
-	function set_name( $name ) {
494
-		$this->set( 'EVT_name', $name );
493
+	function set_name($name) {
494
+		$this->set('EVT_name', $name);
495 495
 	}
496 496
 
497 497
 
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 	/**
500 500
 	 * @param $order
501 501
 	 */
502
-	function set_order( $order ) {
503
-		$this->set( 'EVT_order', $order );
502
+	function set_order($order) {
503
+		$this->set('EVT_order', $order);
504 504
 	}
505 505
 
506 506
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	/**
509 509
 	 * @param $short_desc
510 510
 	 */
511
-	function set_short_description( $short_desc ) {
512
-		$this->set( 'EVT_short_desc', $short_desc );
511
+	function set_short_description($short_desc) {
512
+		$this->set('EVT_short_desc', $short_desc);
513 513
 	}
514 514
 
515 515
 
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	/**
518 518
 	 * @param $slug
519 519
 	 */
520
-	function set_slug( $slug ) {
521
-		$this->set( 'EVT_slug', $slug );
520
+	function set_slug($slug) {
521
+		$this->set('EVT_slug', $slug);
522 522
 	}
523 523
 
524 524
 
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 	/**
527 527
 	 * @param $timezone_string
528 528
 	 */
529
-	function set_timezone_string( $timezone_string ) {
530
-		$this->set( 'EVT_timezone_string', $timezone_string );
529
+	function set_timezone_string($timezone_string) {
530
+		$this->set('EVT_timezone_string', $timezone_string);
531 531
 	}
532 532
 
533 533
 
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * @param $visible_on
537 537
 	 */
538
-	function set_visible_on( $visible_on ) {
539
-		$this->set( 'EVT_visible_on', $visible_on );
538
+	function set_visible_on($visible_on) {
539
+		$this->set('EVT_visible_on', $visible_on);
540 540
 	}
541 541
 
542 542
 
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	/**
545 545
 	 * @param $wp_user
546 546
 	 */
547
-	function set_wp_user( $wp_user ) {
548
-		$this->set( 'EVT_wp_user', $wp_user );
547
+	function set_wp_user($wp_user) {
548
+		$this->set('EVT_wp_user', $wp_user);
549 549
 	}
550 550
 
551 551
 
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 	/**
554 554
 	 * @param $default_registration_status
555 555
 	 */
556
-	function set_default_registration_status( $default_registration_status ) {
557
-		$this->set( 'EVT_default_registration_status', $default_registration_status );
556
+	function set_default_registration_status($default_registration_status) {
557
+		$this->set('EVT_default_registration_status', $default_registration_status);
558 558
 	}
559 559
 
560 560
 
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 	/**
563 563
 	 * @param $donations
564 564
 	 */
565
-	function set_donations( $donations ) {
566
-		$this->set( 'EVT_donations', $donations );
565
+	function set_donations($donations) {
566
+		$this->set('EVT_donations', $donations);
567 567
 	}
568 568
 
569 569
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 	 * @param EE_Venue /int $venue_id_or_obj
574 574
 	 * @return EE_Venue
575 575
 	 */
576
-	function add_venue( $venue_id_or_obj ) {
577
-		return $this->_add_relation_to( $venue_id_or_obj, 'Venue' );
576
+	function add_venue($venue_id_or_obj) {
577
+		return $this->_add_relation_to($venue_id_or_obj, 'Venue');
578 578
 	}
579 579
 
580 580
 
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @param EE_Venue /int $venue_id_or_obj
585 585
 	 * @return EE_Venue
586 586
 	 */
587
-	function remove_venue( $venue_id_or_obj ) {
588
-		return $this->_remove_relation_to( $venue_id_or_obj, 'Venue' );
587
+	function remove_venue($venue_id_or_obj) {
588
+		return $this->_remove_relation_to($venue_id_or_obj, 'Venue');
589 589
 	}
590 590
 
591 591
 
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 	 * @param array $query_params like EEM_Base::get_all's $query_params
596 596
 	 * @return EE_Venue[]
597 597
 	 */
598
-	function venues( $query_params = array() ) {
599
-		return $this->get_many_related( 'Venue', $query_params );
598
+	function venues($query_params = array()) {
599
+		return $this->get_many_related('Venue', $query_params);
600 600
 	}
601 601
 
602 602
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 */
609 609
 	private function _has_ID_and_is_published() {
610 610
 		// first check if event id is present and not NULL, then check if this event is published (or any of the equivalent "published" statuses)
611
-		return ( $this->ID() && $this->ID() !== NULL && ( $this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled ) ) ? TRUE : FALSE;
611
+		return ($this->ID() && $this->ID() !== NULL && ($this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled)) ? TRUE : FALSE;
612 612
 	}
613 613
 
614 614
 
@@ -620,21 +620,21 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	public function is_upcoming() {
622 622
 		// check if event id is present and if this event is published
623
-		if ( $this->is_inactive() ) {
623
+		if ($this->is_inactive()) {
624 624
 			return FALSE;
625 625
 		}
626 626
 		// set initial value
627 627
 		$upcoming = FALSE;
628 628
 		//next let's get all datetimes and loop through them
629 629
 		$datetimes = $this->datetimes_in_chronological_order();
630
-		foreach ( $datetimes as $datetime ) {
631
-			if ( $datetime instanceof EE_Datetime ) {
630
+		foreach ($datetimes as $datetime) {
631
+			if ($datetime instanceof EE_Datetime) {
632 632
 				//if this dtt is expired then we continue cause one of the other datetimes might be upcoming.
633
-				if ( $datetime->is_expired() ) {
633
+				if ($datetime->is_expired()) {
634 634
 					continue;
635 635
 				}
636 636
 				//if this dtt is active then we return false.
637
-				if ( $datetime->is_active() ) {
637
+				if ($datetime->is_active()) {
638 638
 					return FALSE;
639 639
 				}
640 640
 				//otherwise let's check upcoming status
@@ -651,21 +651,21 @@  discard block
 block discarded – undo
651 651
 	 */
652 652
 	public function is_active() {
653 653
 		// check if event id is present and if this event is published
654
-		if ( $this->is_inactive() ) {
654
+		if ($this->is_inactive()) {
655 655
 			return FALSE;
656 656
 		}
657 657
 		// set initial value
658 658
 		$active = FALSE;
659 659
 		//next let's get all datetimes and loop through them
660 660
 		$datetimes = $this->datetimes_in_chronological_order();
661
-		foreach ( $datetimes as $datetime ) {
662
-			if ( $datetime instanceof EE_Datetime ) {
661
+		foreach ($datetimes as $datetime) {
662
+			if ($datetime instanceof EE_Datetime) {
663 663
 				//if this dtt is expired then we continue cause one of the other datetimes might be active.
664
-				if ( $datetime->is_expired() ) {
664
+				if ($datetime->is_expired()) {
665 665
 					continue;
666 666
 				}
667 667
 				//if this dtt is upcoming then we return false.
668
-				if ( $datetime->is_upcoming() ) {
668
+				if ($datetime->is_upcoming()) {
669 669
 					return FALSE;
670 670
 				}
671 671
 				//otherwise let's check active status
@@ -682,17 +682,17 @@  discard block
 block discarded – undo
682 682
 	 */
683 683
 	public function is_expired() {
684 684
 		// check if event id is present and if this event is published
685
-		if ( $this->is_inactive() ) {
685
+		if ($this->is_inactive()) {
686 686
 			return FALSE;
687 687
 		}
688 688
 		// set initial value
689 689
 		$expired = FALSE;
690 690
 		//first let's get all datetimes and loop through them
691 691
 		$datetimes = $this->datetimes_in_chronological_order();
692
-		foreach ( $datetimes as $datetime ) {
693
-			if ( $datetime instanceof EE_Datetime ) {
692
+		foreach ($datetimes as $datetime) {
693
+			if ($datetime instanceof EE_Datetime) {
694 694
 				//if this dtt is upcoming or active then we return false.
695
-				if ( $datetime->is_upcoming() || $datetime->is_active() ) {
695
+				if ($datetime->is_upcoming() || $datetime->is_active()) {
696 696
 					return FALSE;
697 697
 				}
698 698
 				//otherwise let's check active status
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 */
710 710
 	public function is_inactive() {
711 711
 		// check if event id is present and if this event is published
712
-		if ( $this->_has_ID_and_is_published() ) {
712
+		if ($this->_has_ID_and_is_published()) {
713 713
 			return FALSE;
714 714
 		}
715 715
 		return TRUE;
@@ -727,37 +727,37 @@  discard block
 block discarded – undo
727 727
 	 */
728 728
 	public function perform_sold_out_status_check() {
729 729
 		// get all unexpired untrashed tickets
730
-		$tickets = $this->tickets( array(
730
+		$tickets = $this->tickets(array(
731 731
 			array(
732
-				'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
732
+				'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
733 733
 				'TKT_deleted'    => false
734 734
 			)
735 735
 		));
736 736
 		// if all the tickets are just expired, then don't update the event status to sold out
737
-		if ( empty( $tickets )) {
737
+		if (empty($tickets)) {
738 738
 			return true;
739 739
 		}
740 740
 		// set initial value
741 741
 		$spaces_remaining = 0;
742
-		foreach( $tickets as $ticket ) {
743
-			if ( $ticket instanceof EE_Ticket ) {
744
-				$spaces_remaining += $ticket->qty( 'saleable' );
742
+		foreach ($tickets as $ticket) {
743
+			if ($ticket instanceof EE_Ticket) {
744
+				$spaces_remaining += $ticket->qty('saleable');
745 745
 			}
746 746
 		}
747
-		if ( $spaces_remaining === 0 ) {
748
-			$this->set_status( EEM_Event::sold_out );
749
-			if ( !is_admin() || ( is_admin() && defined( 'DOING_AJAX' ) ) ) {
747
+		if ($spaces_remaining === 0) {
748
+			$this->set_status(EEM_Event::sold_out);
749
+			if ( ! is_admin() || (is_admin() && defined('DOING_AJAX'))) {
750 750
 				$this->save();
751 751
 			}
752 752
 			$sold_out = TRUE;
753 753
 		} else {
754 754
 			$sold_out = FALSE;
755 755
 			// was event previously marked as sold out ?
756
-			if ( $this->status() == EEM_Event::sold_out ) {
756
+			if ($this->status() == EEM_Event::sold_out) {
757 757
 				// revert status to previous value, if it was set
758
-				$previous_event_status = $this->get_post_meta( '_previous_event_status', true );
759
-				if ( $previous_event_status ) {
760
-					$this->set_status( $previous_event_status );
758
+				$previous_event_status = $this->get_post_meta('_previous_event_status', true);
759
+				if ($previous_event_status) {
760
+					$this->set_status($previous_event_status);
761 761
 				}
762 762
 			}
763 763
 		}
@@ -781,15 +781,15 @@  discard block
 block discarded – undo
781 781
 	 */
782 782
 	public function spaces_remaining_for_sale() {
783 783
 		//first get total available spaces including consideration for tickets that have already sold.
784
-		$spaces_available = $this->total_available_spaces( true );
784
+		$spaces_available = $this->total_available_spaces(true);
785 785
 
786 786
 		//if total available = 0, then exit right away because that means everything is expired.
787
-		if ( $spaces_available === 0 ) {
787
+		if ($spaces_available === 0) {
788 788
 			return 0;
789 789
 		}
790 790
 
791 791
 		//subtract total approved registrations from spaces available to get how many are remaining.
792
-		$spots_taken = EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true );
792
+		$spots_taken = EEM_Registration::instance()->count(array(array('EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true);
793 793
 		$spaces_remaining = $spaces_available - $spots_taken;
794 794
 
795 795
 		return $spaces_remaining > 0 ? $spaces_remaining : 0;
@@ -822,29 +822,29 @@  discard block
 block discarded – undo
822 822
 	 *
823 823
 	 * @return  int|float  (Note: if EE_INF is returned its considered a float by PHP)
824 824
 	 */
825
-	public function total_available_spaces( $current_total_available = false ) {
825
+	public function total_available_spaces($current_total_available = false) {
826 826
 		$spaces_available = 0;
827 827
 
828 828
 		//first get all tickets on the event and include expired tickets
829
-		$tickets = $this->tickets( array( 'default_where_conditions' => 'none' ) );
829
+		$tickets = $this->tickets(array('default_where_conditions' => 'none'));
830 830
 		$ticket_sums = array();
831 831
 		$datetime_limits = array();
832 832
 
833 833
 		//loop through tickets and normalize them
834
-		foreach ( $tickets as $ticket ) {
835
-			$datetimes = $ticket->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) );
834
+		foreach ($tickets as $ticket) {
835
+			$datetimes = $ticket->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC')));
836 836
 
837
-			if ( empty( $datetimes ) ) {
837
+			if (empty($datetimes)) {
838 838
 				continue;
839 839
 			}
840 840
 
841 841
 			//first datetime should be the lowest datetime
842
-			$least_datetime = reset( $datetimes );
842
+			$least_datetime = reset($datetimes);
843 843
 
844 844
 			//lets reset the ticket quantity to be the lower of either the lowest datetime reg limit or the ticket quantity
845 845
 			//IF datetimes sold (and we're not doing current live total available, then use spaces remaining for datetime, not reg_limit.
846
-			if ( $current_total_available ) {
847
-				if ( $ticket->is_remaining() ) {
846
+			if ($current_total_available) {
847
+				if ($ticket->is_remaining()) {
848 848
 					$remaining = $ticket->remaining();
849 849
 				} else {
850 850
 					$spaces_available += $ticket->sold();
@@ -852,23 +852,23 @@  discard block
 block discarded – undo
852 852
 					continue;
853 853
 				}
854 854
 			} else {
855
-				$remaining = min( $ticket->qty(), $least_datetime->reg_limit() );
855
+				$remaining = min($ticket->qty(), $least_datetime->reg_limit());
856 856
 			}
857 857
 
858 858
 			//if $ticket_limit == infinity then let's drop out right away and just return that because any infinity amount trumps all other "available" amounts.
859
-			if ( $remaining == EE_INF ) {
859
+			if ($remaining == EE_INF) {
860 860
 				return EE_INF;
861 861
 			}
862 862
 
863 863
 			//multiply normalized $tkt quantity by the number of datetimes on the ticket as the "sum"
864 864
 			//also include the sum of all the datetime reg limits on the ticket for breaking ties.
865
-			$ticket_sums[$ticket->ID()]['sum'] = $remaining * count( $datetimes );
865
+			$ticket_sums[$ticket->ID()]['sum'] = $remaining * count($datetimes);
866 866
 			$ticket_sums[$ticket->ID()]['datetime_sums'] = 0;
867
-			foreach ( $datetimes as $datetime ) {
868
-				if ( $datetime->reg_limit() === EE_INF ) {
867
+			foreach ($datetimes as $datetime) {
868
+				if ($datetime->reg_limit() === EE_INF) {
869 869
 					$ticket_sums[$ticket->ID()]['datetime_sums'] = EE_INF;
870 870
 				} else {
871
-					$ticket_sums[ $ticket->ID() ]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
871
+					$ticket_sums[$ticket->ID()]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
872 872
 				}
873 873
 				$datetime_limits[$datetime->ID()] = $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
874 874
 			}
@@ -879,74 +879,74 @@  discard block
 block discarded – undo
879 879
 		//ticket quantity by the number of datetimes on the ticket).  For tie-breakers, then the next sort is based on the
880 880
 		//ticket with the greatest sum of all remaining datetime->spaces_remaining() ( or $datetime->reg_limit() if not
881 881
 		//$current_total_available ) for the datetimes on the ticket.
882
-		usort( $ticket_sums, function( $a, $b ) {
883
-			if ( $a['sum'] == $b['sum'] ) {
884
-				if ( $a['datetime_sums'] == $b['datetime_sums'] ) {
882
+		usort($ticket_sums, function($a, $b) {
883
+			if ($a['sum'] == $b['sum']) {
884
+				if ($a['datetime_sums'] == $b['datetime_sums']) {
885 885
 					return 0;
886 886
 				}
887 887
 
888 888
 				return $a['datetime_sums'] < $b['datetime_sums'] ? 1 : -1;
889 889
 			}
890
-			return ( $a['sum'] < $b['sum'] ) ? -1 : 1;
890
+			return ($a['sum'] < $b['sum']) ? -1 : 1;
891 891
 		});
892 892
 
893 893
 		//now let's loop through the sorted tickets and simulate sellouts
894
-		foreach ( $ticket_sums as $ticket_info ) {
895
-			if ( $ticket_info['ticket'] instanceof EE_Ticket ) {
894
+		foreach ($ticket_sums as $ticket_info) {
895
+			if ($ticket_info['ticket'] instanceof EE_Ticket) {
896 896
 
897
-				$datetimes = $ticket_info['ticket']->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) );
897
+				$datetimes = $ticket_info['ticket']->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC')));
898 898
 				//need to sort these $datetimes by remaining (only if $current_total_available)
899 899
 				//setup datetimes for simulation
900 900
 				$ticket_datetimes_remaining = array();
901
-				foreach( $datetimes as $datetime ) {
901
+				foreach ($datetimes as $datetime) {
902 902
 					$ticket_datetimes_remaining[$datetime->ID()]['rem'] = $datetime_limits[$datetime->ID()];
903 903
 					$ticket_datetimes_remaining[$datetime->ID()]['datetime'] = $datetime;
904 904
 				}
905
-				usort( $ticket_datetimes_remaining, function( $a, $b ) {
906
-					if ( $a['rem'] == $b['rem'] ) {
905
+				usort($ticket_datetimes_remaining, function($a, $b) {
906
+					if ($a['rem'] == $b['rem']) {
907 907
 						return 0;
908 908
 					}
909
-					return ( $a['rem'] < $b['rem'] ) ? -1 : 1;
909
+					return ($a['rem'] < $b['rem']) ? -1 : 1;
910 910
 				});
911 911
 
912 912
 
913 913
 				//get the remaining on the first datetime (which should be the one with the least remaining) and that is
914 914
 				//what we add to the spaces_available running total.  Then we need to decrease the remaining on our datetime tracker.
915
-				$lowest_datetime = reset( $ticket_datetimes_remaining );
915
+				$lowest_datetime = reset($ticket_datetimes_remaining);
916 916
 
917 917
 				//need to get the lower of; what the remaining is on the lowest datetime, and the remaining on the ticket.
918 918
 				// If this ends up being 0 (because of previous tickets in our simulation selling out), then it has already
919 919
 				// been tracked on $spaces available and this ticket is now sold out for the simulation, so we can continue
920 920
 				// to the next ticket.
921
-				if ( $current_total_available ) {
922
-					$remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->remaining() );
921
+				if ($current_total_available) {
922
+					$remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->remaining());
923 923
 				} else {
924
-					$remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->qty() );
924
+					$remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->qty());
925 925
 				}
926 926
 
927 927
 				//if $remaining is infinite that means that all datetimes on this ticket are infinite but we've made it here because all
928 928
 				//tickets have a quantity.  So we don't have to track datetimes, we can just use ticket quantities for total
929 929
 				//available.
930
-				if ( $remaining === EE_INF ) {
930
+				if ($remaining === EE_INF) {
931 931
 					$spaces_available += $ticket_info['ticket']->qty();
932 932
 					continue;
933 933
 				}
934 934
 
935 935
 				//if ticket has sold amounts then we also need to add that (but only if doing live counts)
936
-				if ( $current_total_available ) {
936
+				if ($current_total_available) {
937 937
 					$spaces_available += $ticket_info['ticket']->sold();
938 938
 				}
939 939
 
940
-				if ( $remaining <= 0 ) {
940
+				if ($remaining <= 0) {
941 941
 					continue;
942 942
 				} else {
943 943
 					$spaces_available += $remaining;
944 944
 				}
945 945
 
946 946
 				//loop through the datetimes and sell them out!
947
-				foreach ( $ticket_datetimes_remaining as $datetime_info ) {
948
-					if ( $datetime_info['datetime'] instanceof EE_Datetime ) {
949
-						$datetime_limits[ $datetime_info['datetime']->ID() ] += - $remaining;
947
+				foreach ($ticket_datetimes_remaining as $datetime_info) {
948
+					if ($datetime_info['datetime'] instanceof EE_Datetime) {
949
+						$datetime_limits[$datetime_info['datetime']->ID()] += - $remaining;
950 950
 					}
951 951
 				}
952 952
 			}
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 	 * @param  bool $actual whether or not to perform calculations to not only figure the actual status but also to flip the status if necessary to sold out If false, we just check the existing status of the event
963 963
 	 * @return boolean
964 964
 	 */
965
-	public function is_sold_out( $actual = FALSE ) {
966
-		if ( ! $actual ) {
965
+	public function is_sold_out($actual = FALSE) {
966
+		if ( ! $actual) {
967 967
 			return $this->status() == EEM_Event::sold_out;
968 968
 		}
969 969
 		else {
@@ -1008,30 +1008,30 @@  discard block
 block discarded – undo
1008 1008
 	 *
1009 1009
 	 * @return bool | string - based on EE_Datetime active constants or FALSE if error.
1010 1010
 	 */
1011
-	public function get_active_status( $reset = false ) {
1011
+	public function get_active_status($reset = false) {
1012 1012
 		// if the active status has already been set, then just use that value (unless we are resetting it)
1013
-		if ( ! empty( $this->_active_status ) && ! $reset ) {
1013
+		if ( ! empty($this->_active_status) && ! $reset) {
1014 1014
 			return $this->_active_status;
1015 1015
 		}
1016 1016
 		//first check if event id is present on this object
1017
-		if ( ! $this->ID() ) {
1017
+		if ( ! $this->ID()) {
1018 1018
 			return false;
1019 1019
 		}
1020 1020
 
1021
-		$where_params_for_event  = array( array( 'EVT_ID' => $this->ID() ) );
1021
+		$where_params_for_event = array(array('EVT_ID' => $this->ID()));
1022 1022
 
1023 1023
 		//if event is published:
1024
-		if ( $this->status() === 'publish' ) {
1024
+		if ($this->status() === 'publish') {
1025 1025
 			//active?
1026
-			if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::active, $where_params_for_event ) > 0 ) {
1026
+			if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::active, $where_params_for_event) > 0) {
1027 1027
 				$this->_active_status = EE_Datetime::active;
1028 1028
 			} else {
1029 1029
 				//upcoming?
1030
-				if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::upcoming, $where_params_for_event  ) > 0 ) {
1030
+				if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::upcoming, $where_params_for_event) > 0) {
1031 1031
 					$this->_active_status = EE_Datetime::upcoming;
1032 1032
 				} else {
1033 1033
 					//expired?
1034
-					if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::expired, $where_params_for_event  ) > 0 ) {
1034
+					if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::expired, $where_params_for_event) > 0) {
1035 1035
 						$this->_active_status = EE_Datetime::expired;
1036 1036
 					} else {
1037 1037
 						//it would be odd if things make it this far because it basically means there are no datetime's
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 			}
1043 1043
 		} else {
1044 1044
 			//the event is not published, so let's just set it's active status according to its' post status
1045
-			switch ( $this->status() ) {
1045
+			switch ($this->status()) {
1046 1046
 				case EEM_Event::sold_out :
1047 1047
 					$this->_active_status = EE_Datetime::sold_out;
1048 1048
 					break;
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 	 * @param boolean $echo     whether to return (FALSE), or echo out the result (TRUE)
1069 1069
 	 * @return mixed void|string
1070 1070
 	 */
1071
-	public function pretty_active_status( $echo = TRUE ) {
1071
+	public function pretty_active_status($echo = TRUE) {
1072 1072
 		$active_status = $this->get_active_status();
1073
-		$status = '<span class="ee-status event-active-status-' . $active_status . '">' . EEH_Template::pretty_status( $active_status, FALSE, 'sentence' ) . '</span>';
1074
-		if ( $echo ) {
1073
+		$status = '<span class="ee-status event-active-status-'.$active_status.'">'.EEH_Template::pretty_status($active_status, FALSE, 'sentence').'</span>';
1074
+		if ($echo) {
1075 1075
 			echo $status;
1076 1076
 			return '';
1077 1077
 		}
@@ -1085,12 +1085,12 @@  discard block
 block discarded – undo
1085 1085
 	 */
1086 1086
 	public function get_number_of_tickets_sold() {
1087 1087
 		$tkt_sold = 0;
1088
-		if ( !$this->ID() ) {
1088
+		if ( ! $this->ID()) {
1089 1089
 			return 0;
1090 1090
 		}
1091 1091
 		$datetimes = $this->datetimes();
1092
-		foreach ( $datetimes as $datetime ) {
1093
-			if ( $datetime instanceof EE_Datetime ) {
1092
+		foreach ($datetimes as $datetime) {
1093
+			if ($datetime instanceof EE_Datetime) {
1094 1094
 				$tkt_sold += $datetime->sold();
1095 1095
 			}
1096 1096
 		}
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 * @return int
1106 1106
 	 */
1107 1107
 	public function get_count_of_all_registrations() {
1108
-		return EEM_Event::instance()->count_related( $this, 'Registration' );
1108
+		return EEM_Event::instance()->count_related($this, 'Registration');
1109 1109
 	}
1110 1110
 
1111 1111
 
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
 	 * @return EE_Ticket
1116 1116
 	 */
1117 1117
 	public function get_ticket_with_earliest_start_time() {
1118
-		$where[ 'Datetime.EVT_ID' ] = $this->ID();
1119
-		$query_params = array( $where, 'order_by' => array( 'TKT_start_date' => 'ASC' ) );
1120
-		return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params );
1118
+		$where['Datetime.EVT_ID'] = $this->ID();
1119
+		$query_params = array($where, 'order_by' => array('TKT_start_date' => 'ASC'));
1120
+		return EE_Registry::instance()->load_model('Ticket')->get_one($query_params);
1121 1121
 	}
1122 1122
 
1123 1123
 
@@ -1127,9 +1127,9 @@  discard block
 block discarded – undo
1127 1127
 	 * @return EE_Ticket
1128 1128
 	 */
1129 1129
 	public function get_ticket_with_latest_end_time() {
1130
-		$where[ 'Datetime.EVT_ID' ] = $this->ID();
1131
-		$query_params = array( $where, 'order_by' => array( 'TKT_end_date' => 'DESC' ) );
1132
-		return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params );
1130
+		$where['Datetime.EVT_ID'] = $this->ID();
1131
+		$query_params = array($where, 'order_by' => array('TKT_end_date' => 'DESC'));
1132
+		return EE_Registry::instance()->load_model('Ticket')->get_one($query_params);
1133 1133
 	}
1134 1134
 
1135 1135
 
@@ -1141,11 +1141,11 @@  discard block
 block discarded – undo
1141 1141
 	public function tickets_on_sale() {
1142 1142
 		$earliest_ticket = $this->get_ticket_with_earliest_start_time();
1143 1143
 		$latest_ticket = $this->get_ticket_with_latest_end_time();
1144
-		if ( !$latest_ticket instanceof EE_Ticket && !$earliest_ticket instanceof EE_Ticket ) {
1144
+		if ( ! $latest_ticket instanceof EE_Ticket && ! $earliest_ticket instanceof EE_Ticket) {
1145 1145
 			return FALSE;
1146 1146
 		}
1147 1147
 		//check on sale for these two tickets.
1148
-		if ( $latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale() ) {
1148
+		if ($latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale()) {
1149 1149
 			return TRUE;
1150 1150
 		}
1151 1151
 		return FALSE;
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 * @return string
1160 1160
 	 */
1161 1161
 	public function get_permalink() {
1162
-		if ( $this->external_url() ) {
1162
+		if ($this->external_url()) {
1163 1163
 			return $this->external_url();
1164 1164
 		}
1165 1165
 		else {
@@ -1174,10 +1174,10 @@  discard block
 block discarded – undo
1174 1174
 	 * @param array $query_params like EEM_Base::get_all
1175 1175
 	 * @return EE_Term
1176 1176
 	 */
1177
-	public function first_event_category( $query_params = array() ) {
1178
-		$query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories';
1179
-		$query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID();
1180
-		return EEM_Term::instance()->get_one( $query_params );
1177
+	public function first_event_category($query_params = array()) {
1178
+		$query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1179
+		$query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID();
1180
+		return EEM_Term::instance()->get_one($query_params);
1181 1181
 	}
1182 1182
 
1183 1183
 
@@ -1187,10 +1187,10 @@  discard block
 block discarded – undo
1187 1187
 	 * @param array $query_params
1188 1188
 	 * @return EE_Term[]
1189 1189
 	 */
1190
-	public function get_all_event_categories( $query_params = array() ) {
1191
-		$query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories';
1192
-		$query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID();
1193
-		return EEM_Term::instance()->get_all( $query_params );
1190
+	public function get_all_event_categories($query_params = array()) {
1191
+		$query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1192
+		$query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID();
1193
+		return EEM_Term::instance()->get_all($query_params);
1194 1194
 	}
1195 1195
 
1196 1196
 	/**
@@ -1198,8 +1198,8 @@  discard block
 block discarded – undo
1198 1198
 	 * @param array $query_params @see EEM_Base::get_all
1199 1199
 	 * @return EE_Question_Group[]
1200 1200
 	 */
1201
-	public function question_groups($query_params = array()){
1202
-		$query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'QSG_order' => 'ASC' ));
1201
+	public function question_groups($query_params = array()) {
1202
+		$query_params = ! empty($query_params) ? $query_params : array('order_by' => array('QSG_order' => 'ASC'));
1203 1203
 		return $this->get_many_related('Question_Group', $query_params);
1204 1204
 	}
1205 1205
 
@@ -1239,12 +1239,12 @@  discard block
 block discarded – undo
1239 1239
 	 */
1240 1240
 	public function get_admin_edit_link() {
1241 1241
 		EE_Registry::instance()->load_helper('URL');
1242
-		return EEH_URL::add_query_args_and_nonce( array(
1242
+		return EEH_URL::add_query_args_and_nonce(array(
1243 1243
 			'page' => 'espresso_events',
1244 1244
 			'action' => 'edit',
1245 1245
 			'post' => $this->ID()
1246 1246
 			),
1247
-			admin_url( 'admin.php' )
1247
+			admin_url('admin.php')
1248 1248
 		);
1249 1249
 	}
1250 1250
 
@@ -1257,11 +1257,11 @@  discard block
 block discarded – undo
1257 1257
 	 */
1258 1258
 	public function get_admin_settings_link() {
1259 1259
 		EE_Registry::instance()->load_helper('URL');
1260
-		return EEH_URL::add_query_args_and_nonce( array(
1260
+		return EEH_URL::add_query_args_and_nonce(array(
1261 1261
 			'page' => 'espresso_events',
1262 1262
 			'action' => 'default_event_settings'
1263 1263
 			),
1264
-			admin_url( 'admin.php' )
1264
+			admin_url('admin.php')
1265 1265
 		);
1266 1266
 	}
1267 1267
 
@@ -1277,11 +1277,11 @@  discard block
 block discarded – undo
1277 1277
 	public function get_admin_overview_link() {
1278 1278
 
1279 1279
 		EE_Registry::instance()->load_helper('URL');
1280
-		return EEH_URL::add_query_args_and_nonce( array(
1280
+		return EEH_URL::add_query_args_and_nonce(array(
1281 1281
 			'page' => 'espresso_events',
1282 1282
 			'action' => 'default'
1283 1283
 		),
1284
-			admin_url( 'admin.php' )
1284
+			admin_url('admin.php')
1285 1285
 		);
1286 1286
 	}
1287 1287
 
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/AttendeesReport.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -87,6 +87,11 @@
 block discarded – undo
87 87
 	public function count_units_to_process() {
88 88
 		return \EEM_Attendee::instance()->count();
89 89
 	}
90
+
91
+	/**
92
+	 * @param integer $offset
93
+	 * @param integer $limit
94
+	 */
90 95
 	public function get_csv_data( $offset, $limit ) {
91 96
 		$attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( 
92 97
 				array( 
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use EventEspressoBatchRequest\Helpers\JobParameters;
19 19
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
20 20
 
21
-if (!defined('EVENT_ESPRESSO_VERSION')) {
21
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
22 22
 	exit('No direct script access allowed');
23 23
 }
24 24
 
@@ -27,83 +27,83 @@  discard block
 block discarded – undo
27 27
 	
28 28
 	
29 29
 	public function create_job(JobParameters $job_parameters) {
30
-		if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_contacts', 'generating_report' ) ) {
30
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_contacts', 'generating_report')) {
31 31
 			throw new BatchRequestException(
32
-				__( 'You do not have permission to view contacts', 'event_espresso')
32
+				__('You do not have permission to view contacts', 'event_espresso')
33 33
 			);
34 34
 		}
35 35
 		$filepath = $this->create_file_from_job_with_name(
36 36
 			$job_parameters->job_id(),
37 37
 			__('contact-list-report.csv', 'event_espresso')
38 38
 		);
39
-		$job_parameters->add_extra_data( 'filepath', $filepath );
40
-		$job_parameters->set_job_size( $this->count_units_to_process() );
39
+		$job_parameters->add_extra_data('filepath', $filepath);
40
+		$job_parameters->set_job_size($this->count_units_to_process());
41 41
 		//we should also set the header columns
42
-		$csv_data_for_row = $this->get_csv_data( 0, 1 );
43
-		\EE_Registry::instance()->load_helper( 'Export' );
44
-		\EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true );
42
+		$csv_data_for_row = $this->get_csv_data(0, 1);
43
+		\EE_Registry::instance()->load_helper('Export');
44
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
45 45
 		//if we actually processed a row there, record it
46
-		if( $job_parameters->job_size() ) {
47
-			$job_parameters->mark_processed( 1 );
46
+		if ($job_parameters->job_size()) {
47
+			$job_parameters->mark_processed(1);
48 48
 		}
49 49
 		return new JobStepResponse(
50 50
 			$job_parameters,
51
-			__( 'Contacts report started successfully...', 'event_espresso' )
51
+			__('Contacts report started successfully...', 'event_espresso')
52 52
 		);
53 53
 	}
54 54
 	
55 55
 
56 56
 	public function continue_job(JobParameters $job_parameters, $batch_size = 50) {
57
-		$csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size );
58
-		\EE_Registry::instance()->load_helper( 'Export' );
59
-		\EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false );
60
-		$units_processed = count( $csv_data );
61
-		$job_parameters->mark_processed( $units_processed );
57
+		$csv_data = $this->get_csv_data($job_parameters->units_processed(), $batch_size);
58
+		\EE_Registry::instance()->load_helper('Export');
59
+		\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
60
+		$units_processed = count($csv_data);
61
+		$job_parameters->mark_processed($units_processed);
62 62
 		$extra_response_data = array(
63 63
 			'file_url' => ''
64 64
 		);
65
-		if( $units_processed < $batch_size ) {
66
-			$job_parameters->set_status( JobParameters::status_complete );
67
-			$extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) );
65
+		if ($units_processed < $batch_size) {
66
+			$job_parameters->set_status(JobParameters::status_complete);
67
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
68 68
 		}
69 69
 		return new JobStepResponse(
70 70
 				$job_parameters,
71 71
 				sprintf(
72
-					__( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ),
73
-					count( $csv_data ) ),
72
+					__('Wrote %1$s rows to report CSV file...', 'event_espresso'),
73
+					count($csv_data) ),
74 74
 				$extra_response_data );
75 75
 	}
76 76
 
77 77
 	
78 78
 	public function cleanup_job(JobParameters $job_parameters) {
79 79
 		$this->_file_helper->delete(
80
-			\EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ),
80
+			\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
81 81
 			true,
82 82
 			'd'
83 83
 		);
84
-		return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) );
84
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
85 85
 	}
86 86
 	
87 87
 	public function count_units_to_process() {
88 88
 		return \EEM_Attendee::instance()->count();
89 89
 	}
90
-	public function get_csv_data( $offset, $limit ) {
90
+	public function get_csv_data($offset, $limit) {
91 91
 		$attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( 
92 92
 				array( 
93
-					'limit' => array( $offset, $limit ),
94
-					'force_join' => array( 'State', 'Country' ) ) );
93
+					'limit' => array($offset, $limit),
94
+					'force_join' => array('State', 'Country') ) );
95 95
 		$csv_data = array();
96
-		foreach( $attendee_rows as $attendee_row ){
96
+		foreach ($attendee_rows as $attendee_row) {
97 97
 			$csv_row = array();
98
-			foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
99
-				if( $field_name == 'STA_ID' ){
100
-					$state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' );
101
-					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
102
-				}elseif( $field_name == 'CNT_ISO' ){
103
-					$country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' );
104
-					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
105
-				}else{
106
-					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
98
+			foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) {
99
+				if ($field_name == 'STA_ID') {
100
+					$state_name_field = \EEM_State::instance()->field_settings_for('STA_name');
101
+					$csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()];
102
+				}elseif ($field_name == 'CNT_ISO') {
103
+					$country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name');
104
+					$csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()];
105
+				} else {
106
+					$csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()];
107 107
 				}
108 108
 			}
109 109
 			$csv_data[] = $csv_row;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,10 +99,10 @@
 block discarded – undo
99 99
 				if( $field_name == 'STA_ID' ){
100 100
 					$state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' );
101 101
 					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
102
-				}elseif( $field_name == 'CNT_ISO' ){
102
+				} elseif( $field_name == 'CNT_ISO' ){
103 103
 					$country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' );
104 104
 					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
105
-				}else{
105
+				} else{
106 106
 					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
107 107
 				}
108 108
 			}
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 1 patch
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -57,20 +57,20 @@  discard block
 block discarded – undo
57 57
 	 * @param \EE_Admin_Page $admin_page
58 58
 	 * @return EE_Registrations_List_Table
59 59
 	 */
60
-	function __construct( $admin_page ){
60
+	function __construct($admin_page) {
61 61
 
62
-		if ( ! empty( $_GET['event_id'] ) ) {
62
+		if ( ! empty($_GET['event_id'])) {
63 63
 			$extra_query_args = array();
64
-			foreach ( $admin_page->get_views() as $key => $view_details ) {
65
-				$extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] );
64
+			foreach ($admin_page->get_views() as $key => $view_details) {
65
+				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
66 66
 			}
67
-			$this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args );
67
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
68 68
 		}
69 69
 
70 70
 		parent::__construct($admin_page);
71 71
 		$this->_status = $this->_admin_page->get_registration_status_array();
72 72
 
73
-		EE_Registry::instance()->load_helper( 'Template' );
73
+		EE_Registry::instance()->load_helper('Template');
74 74
 	}
75 75
 
76 76
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 * @return void
82 82
 	 */
83 83
 	protected function _setup_data() {
84
-		$this->_data = $this->_admin_page->get_registrations( $this->_per_page );
85
-		$this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE );
84
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
85
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE);
86 86
 	}
87 87
 
88 88
 
@@ -101,45 +101,45 @@  discard block
 block discarded – undo
101 101
 			);
102 102
 
103 103
 
104
-		if ( isset( $_GET['event_id'] )) {
104
+		if (isset($_GET['event_id'])) {
105 105
 			$this->_columns = array(
106 106
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
107
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
108
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
107
+				'_REG_ID' => __('ID', 'event_espresso'),
108
+				'ATT_fname' => __('Name', 'event_espresso'),
109 109
 				'ATT_email' =>  __('Email', 'event_espresso'),
110
-				'_REG_date' => __( 'Reg Date', 'event_espresso' ),
111
-				'PRC_amount' => __( 'TKT Price', 'event_espresso' ),
112
-				'_REG_final_price' => __( 'Final Price', 'event_espresso' ),
113
-				'TXN_total' => __( 'Total Txn', 'event_espresso' ),
110
+				'_REG_date' => __('Reg Date', 'event_espresso'),
111
+				'PRC_amount' => __('TKT Price', 'event_espresso'),
112
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
113
+				'TXN_total' => __('Total Txn', 'event_espresso'),
114 114
 				'TXN_paid' => __('Paid', 'event_espresso'),
115
-				'actions' => __( 'Actions', 'event_espresso' )
115
+				'actions' => __('Actions', 'event_espresso')
116 116
 				);
117 117
 			$this->_bottom_buttons = array(
118 118
 					'report'=> array(
119 119
 					'route' => 'registrations_report',
120 120
 					'extra_request' =>  
121 121
 						array( 
122
-							'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, 
123
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) 
122
+							'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, 
123
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) 
124 124
 				),
125 125
 			);
126 126
 		} else {
127 127
 			$this->_columns = array(
128 128
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
129
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
130
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
131
-				'_REG_date' => __( 'TXN Date', 'event_espresso' ),
132
-				'event_name' => __( 'Event', 'event_espresso' ),
133
-					'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ),
134
-				'_REG_final_price' => __( 'Price', 'event_espresso' ),
135
-				'_REG_paid' => __( 'Paid', 'event_espresso' ),
136
-				'actions' => __( 'Actions', 'event_espresso' )
129
+				'_REG_ID' => __('ID', 'event_espresso'),
130
+				'ATT_fname' => __('Name', 'event_espresso'),
131
+				'_REG_date' => __('TXN Date', 'event_espresso'),
132
+				'event_name' => __('Event', 'event_espresso'),
133
+					'DTT_EVT_start' => __('Event Date', 'event_espresso'),
134
+				'_REG_final_price' => __('Price', 'event_espresso'),
135
+				'_REG_paid' => __('Paid', 'event_espresso'),
136
+				'actions' => __('Actions', 'event_espresso')
137 137
 			);
138 138
 			$this->_bottom_buttons = array(
139 139
 				'report_all'=> array(
140 140
 				'route' => 'registrations_report',
141 141
 				'extra_request' => array( 
142
-					'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) )
142
+					'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
143 143
 				),
144 144
 			);
145 145
 		}
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 		$this->_primary_column = '_REG_ID';
148 148
 
149 149
 		$this->_sortable_columns = array(
150
-			'_REG_date' => array( '_REG_date' => TRUE ),   //true means its already sorted
151
-			'ATT_fname' => array( 'ATT_fname' => FALSE ),
152
-			'event_name' => array( 'event_name' => FALSE ),
153
-			'DTT_EVT_start'	=> array( 'DTT_EVT_start' => FALSE ),
154
-			'_REG_ID' => array( '_REG_ID' => FALSE ),
150
+			'_REG_date' => array('_REG_date' => TRUE), //true means its already sorted
151
+			'ATT_fname' => array('ATT_fname' => FALSE),
152
+			'event_name' => array('event_name' => FALSE),
153
+			'DTT_EVT_start'	=> array('DTT_EVT_start' => FALSE),
154
+			'_REG_ID' => array('_REG_ID' => FALSE),
155 155
 		);
156 156
 
157 157
 		$this->_hidden_columns = array();
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 
161 161
 
162 162
 
163
-	protected function _get_row_class( $item ) {
164
-		$class = parent::_get_row_class( $item );
163
+	protected function _get_row_class($item) {
164
+		$class = parent::_get_row_class($item);
165 165
 		//add status class
166
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
167
-		if ( $this->_has_checkbox_column ) {
166
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
167
+		if ($this->_has_checkbox_column) {
168 168
 			$class .= ' has-checkbox-column';
169 169
 		}
170 170
 		return $class;
@@ -177,15 +177,15 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * @param EE_Registration $registration
179 179
 	 */
180
-	protected function _set_related_details( EE_Registration $registration ) {
180
+	protected function _set_related_details(EE_Registration $registration) {
181 181
 
182
-		$transaction = $registration->get_first_related( 'Transaction' );
182
+		$transaction = $registration->get_first_related('Transaction');
183 183
 		$status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code;
184 184
 		$this->_transaction_details = array(
185 185
 			'transaction' => $transaction,
186 186
 			'status' => $status,
187 187
 			'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
188
-			'title_attr' => sprintf( __('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
188
+			'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
189 189
 			);
190 190
 
191 191
 		$event = $registration->event();
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 			'event' => $event,
195 195
 			'status' => $status,
196 196
 			'id' => $event instanceof EE_Event ? $event->ID() : 0,
197
-			'title_attr' => sprintf( __('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
197
+			'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
198 198
 			);
199 199
 	}
200 200
 
@@ -209,26 +209,26 @@  discard block
 block discarded – undo
209 209
 		$filters = array();
210 210
 
211 211
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
212
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
212
+		EE_Registry::instance()->load_helper('Form_Fields');
213 213
 
214
-		$cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';
215
-		$cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
216
-		$reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : '';
214
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
215
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
216
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
217 217
 
218
-		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category );
219
-		$filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category );
218
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
219
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
220 220
 
221 221
 		$status = array();
222
-		$status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') );
223
-		foreach ( $this->_status as $key => $value ) {
224
-			$status[] = array( 'id' => $key, 'text' => $value );
222
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
223
+		foreach ($this->_status as $key => $value) {
224
+			$status[] = array('id' => $key, 'text' => $value);
225 225
 		}
226
-		if ( $this->_view != 'incomplete' ) {
227
-			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset( $this->_req_data['_reg_status'] ) ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) : '' );
226
+		if ($this->_view != 'incomplete') {
227
+			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) : '');
228 228
 		}
229 229
 
230
-		if ( isset( $this->_req_data['event_id'] ) ) {
231
-			$filters[] = EEH_Form_Fields::hidden_input( 'event_id',  $this->_req_data['event_id'], 'reg_event_id' );
230
+		if (isset($this->_req_data['event_id'])) {
231
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
232 232
 		}
233 233
 
234 234
 		return $filters;
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 		$this->_views['all']['count'] = $this->_total_registrations();
246 246
 		$this->_views['month']['count'] = $this->_total_registrations_this_month();
247 247
 		$this->_views['today']['count'] = $this->_total_registrations_today();
248
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) {
249
-			$this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' );
250
-			$this->_views['trash']['count'] = $this->_total_registrations( 'trash' );
248
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) {
249
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
250
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
251 251
 		}
252 252
 	}
253 253
 
@@ -259,23 +259,23 @@  discard block
 block discarded – undo
259 259
 	 * @param string $view
260 260
 	 * @return int
261 261
 	 */
262
-	protected function _total_registrations( $view = '' ){
262
+	protected function _total_registrations($view = '') {
263 263
 		$_where = array();
264
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
265
-		if( $EVT_ID ) {
264
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
265
+		if ($EVT_ID) {
266 266
 			$_where['EVT_ID'] = $EVT_ID;
267 267
 		}
268
-		switch ( $view ) {
268
+		switch ($view) {
269 269
 			case 'trash' :
270
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
270
+				return EEM_Registration::instance()->count_deleted(array($_where));
271 271
 				break;
272 272
 			case 'incomplete' :
273 273
 				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
274 274
 				break;
275 275
 			default :
276
-				$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
276
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
277 277
 		}
278
-		return EEM_Registration::instance()->count( array( $_where ));
278
+		return EEM_Registration::instance()->count(array($_where));
279 279
 	}
280 280
 
281 281
 
@@ -285,24 +285,24 @@  discard block
 block discarded – undo
285 285
 	 * @access protected
286 286
 	 * @return int
287 287
 	 */
288
-	protected function _total_registrations_this_month(){
289
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
290
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
288
+	protected function _total_registrations_this_month() {
289
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
290
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
291 291
 		$this_year_r = date('Y', current_time('timestamp'));
292 292
 		$time_start = ' 00:00:00';
293 293
 		$time_end = ' 23:59:59';
294 294
 		$this_month_r = date('m', current_time('timestamp'));
295
-		$days_this_month = date( 't', current_time('timestamp') );
295
+		$days_this_month = date('t', current_time('timestamp'));
296 296
 		//setup date query.
297
-		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' );
298
-		$end_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' );
299
-		$_where['REG_date']= array('BETWEEN',
297
+		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s');
298
+		$end_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s');
299
+		$_where['REG_date'] = array('BETWEEN',
300 300
 			array(
301 301
 				$beginning_string,
302 302
 				$end_string
303 303
 		));
304
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
305
-		return EEM_Registration::instance()->count(array( $_where ) );
304
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
305
+		return EEM_Registration::instance()->count(array($_where));
306 306
 	}
307 307
 
308 308
 
@@ -312,20 +312,20 @@  discard block
 block discarded – undo
312 312
 	 * @access protected
313 313
 	 * @return int
314 314
 	 */
315
-	protected function _total_registrations_today(){
315
+	protected function _total_registrations_today() {
316 316
 
317
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
318
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
317
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
318
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
319 319
 		$current_date = date('Y-m-d', current_time('timestamp'));
320 320
 		$time_start = ' 00:00:00';
321 321
 		$time_end = ' 23:59:59';
322
-		$_where['REG_date']= array('BETWEEN',
322
+		$_where['REG_date'] = array('BETWEEN',
323 323
 			array(
324
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ),
325
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' )
324
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'),
325
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s')
326 326
 		));
327
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
328
-		return EEM_Registration::instance()->count(array( $_where ) );
327
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
328
+		return EEM_Registration::instance()->count(array($_where));
329 329
 	}
330 330
 
331 331
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @param \EE_Registration $item
338 338
 	 * @return string
339 339
 	 */
340
-    function column_cb($item){
340
+    function column_cb($item) {
341 341
 	/** checkbox/lock **/
342
-	$transaction = $item->get_first_related( 'Transaction' );
343
-	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
344
-	return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() );
342
+	$transaction = $item->get_first_related('Transaction');
343
+	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
344
+	return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()).'<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID());
345 345
     }
346 346
 
347 347
 
@@ -353,14 +353,14 @@  discard block
 block discarded – undo
353 353
 	 * @param \EE_Registration $item
354 354
 	 * @return string
355 355
 	 */
356
-	function column__REG_ID(EE_Registration $item){
356
+	function column__REG_ID(EE_Registration $item) {
357 357
 		$attendee = $item->attendee();
358 358
 		$content = $item->ID();
359 359
 		$content .= '<div class="show-on-mobile-view-only">';
360 360
 		$content .= '<br>';
361 361
 		$content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
362
-		$content .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
363
-		$content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
362
+		$content .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
363
+		$content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
364 364
 		$content .= '</div>';
365 365
 		return $content;
366 366
 	}
@@ -374,12 +374,12 @@  discard block
 block discarded – undo
374 374
 	 * @param \EE_Registration $item
375 375
 	 * @return string
376 376
 	 */
377
-	function column__REG_date(EE_Registration $item){
377
+	function column__REG_date(EE_Registration $item) {
378 378
 		$this->_set_related_details($item);
379 379
        		 //Build row actions
380
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
381
-		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
382
-		$view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>';
380
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL);
381
+		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date');
382
+		$view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>';
383 383
 		return $view_link;
384 384
 	}
385 385
 
@@ -392,18 +392,18 @@  discard block
 block discarded – undo
392 392
 	 * @param \EE_Registration $item
393 393
 	 * @return string
394 394
 	 */
395
-	function column_event_name(EE_Registration $item){
396
-		$this->_set_related_details( $item );
395
+	function column_event_name(EE_Registration $item) {
396
+		$this->_set_related_details($item);
397 397
 		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
398
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL );
398
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL);
399 399
 		$event_name = $item->event_name();
400 400
 		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
401
-		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ;
401
+		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...');
402 402
 
403
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL );
404
-		$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' .  __( 'View Registrations', 'event_espresso' ) . '</a>';
403
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL);
404
+		$actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>';
405 405
 
406
-		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) );
406
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
407 407
 	}
408 408
 
409 409
 
@@ -415,18 +415,18 @@  discard block
 block discarded – undo
415 415
 	 * @param \EE_Registration $item
416 416
 	 * @return string
417 417
 	 */
418
-   	function column_DTT_EVT_start(EE_Registration $item){
418
+   	function column_DTT_EVT_start(EE_Registration $item) {
419 419
 		$datetime_strings = array();
420
-		$ticket = $item->ticket( TRUE );
421
-		if ( $ticket instanceof EE_Ticket ) {
420
+		$ticket = $item->ticket(TRUE);
421
+		if ($ticket instanceof EE_Ticket) {
422 422
 			$remove_defaults = array('default_where_conditions' => 'none');
423 423
 			$datetimes = $ticket->datetimes($remove_defaults);
424
-			foreach($datetimes as $datetime){
425
-				$datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' );
424
+			foreach ($datetimes as $datetime) {
425
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
426 426
 			}
427
-			return implode("<br />",$datetime_strings);
427
+			return implode("<br />", $datetime_strings);
428 428
 		} else {
429
-			return __( 'There is no ticket on this registration', 'event_espresso' );
429
+			return __('There is no ticket on this registration', 'event_espresso');
430 430
 		}
431 431
     }
432 432
 
@@ -439,45 +439,45 @@  discard block
 block discarded – undo
439 439
 	 * @param \EE_Registration $item
440 440
 	 * @return string
441 441
 	 */
442
-   	function column_ATT_fname(EE_Registration $item){
442
+   	function column_ATT_fname(EE_Registration $item) {
443 443
    		$attendee = $item->attendee();
444 444
 
445
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
445
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
446 446
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
447
-		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name;
447
+		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name;
448 448
 		$link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
449 449
 
450 450
 		$t = $item->get_first_related('Transaction');
451 451
 		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
452 452
 
453 453
 	    //append group count to name
454
-	    $link .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
454
+	    $link .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
455 455
 
456 456
 	    //append reg_code
457
-	    $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
457
+	    $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
458 458
 
459 459
 	    //reg status text for accessibility
460
-	    $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
460
+	    $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
461 461
 
462 462
 		//trash/restore/delete actions
463 463
 		$actions = array();
464
-		if ( $this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) {
465
-			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
466
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>';
467
-		} elseif ( $this->_view == 'trash' ) {
464
+		if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) {
465
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
466
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
467
+		} elseif ($this->_view == 'trash') {
468 468
 			// restore registration link
469
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) {
470
-				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
471
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
469
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) {
470
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
471
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
472 472
 			}
473
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) {
474
-				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
473
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) {
474
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
475 475
 
476
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>';
476
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>';
477 477
 			}
478 478
 		}
479 479
 
480
-		return sprintf('%1$s %2$s', $link, $this->row_actions($actions) );
480
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
481 481
 	}
482 482
 
483 483
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 * @param \EE_Registration $item
490 490
 	 * @return string
491 491
 	 */
492
-	function column_ATT_email( EE_Registration $item ) {
492
+	function column_ATT_email(EE_Registration $item) {
493 493
 		$attendee = $item->get_first_related('Attendee');
494 494
 		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email();
495 495
 	}
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 	 * @param \EE_Registration $item
504 504
 	 * @return string
505 505
 	 */
506
-	function column__REG_count(EE_Registration $item){
507
-		return  sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size());
506
+	function column__REG_count(EE_Registration $item) {
507
+		return  sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
508 508
 	}
509 509
 
510 510
 
@@ -516,16 +516,16 @@  discard block
 block discarded – undo
516 516
 	 * @param \EE_Registration $item
517 517
 	 * @return string
518 518
 	 */
519
-	function column_PRC_amount(EE_Registration $item){
519
+	function column_PRC_amount(EE_Registration $item) {
520 520
 		$ticket = $item->ticket();
521 521
 
522
-		$content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : '';
522
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : '';
523 523
 
524
-		if ( $item->final_price() > 0 ) {
525
-			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
524
+		if ($item->final_price() > 0) {
525
+			$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
526 526
 		} else {
527 527
 			// free event
528
-			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>';
528
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>';
529 529
 		}
530 530
 
531 531
 		return $content;
@@ -541,11 +541,11 @@  discard block
 block discarded – undo
541 541
 	 * @param \EE_Registration $item
542 542
 	 * @return string
543 543
 	 */
544
-	function column__REG_final_price(EE_Registration $item){
544
+	function column__REG_final_price(EE_Registration $item) {
545 545
 		$ticket = $item->ticket();
546
-		$content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />';
546
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />';
547 547
 
548
-		$content .= '<span class="reg-pad-rght">' .  $item->pretty_final_price() . '</span>';
548
+		$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
549 549
 		return $content;
550 550
 
551 551
 	}
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 	 * @param \EE_Registration $item
560 560
 	 * @return string
561 561
 	 */
562
-	function column__REG_paid(EE_Registration $item){
563
-		return '<span class="reg-pad-rght">' .  $item->pretty_paid() . '</span>';
562
+	function column__REG_paid(EE_Registration $item) {
563
+		return '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';
564 564
 	}
565 565
 
566 566
 
@@ -572,11 +572,11 @@  discard block
 block discarded – undo
572 572
 	 * @param \EE_Registration $item
573 573
 	 * @return string
574 574
 	 */
575
-	function column_TXN_total(EE_Registration $item){
576
-		if($item->transaction()){
577
-			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
578
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">'  . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
579
-		}else{
575
+	function column_TXN_total(EE_Registration $item) {
576
+		if ($item->transaction()) {
577
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
578
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>';
579
+		} else {
580 580
 			return __("None", "event_espresso");
581 581
 		}
582 582
 	}
@@ -590,15 +590,15 @@  discard block
 block discarded – undo
590 590
 	 * @param \EE_Registration $item
591 591
 	 * @return string
592 592
 	 */
593
-	function column_TXN_paid(EE_Registration $item){
593
+	function column_TXN_paid(EE_Registration $item) {
594 594
 
595
-		if ( $item->count() == 1 ) {
595
+		if ($item->count() == 1) {
596 596
 			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
597
-			if ( $transaction->paid() >= $transaction->total() ) {
597
+			if ($transaction->paid() >= $transaction->total()) {
598 598
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
599 599
 			} else {
600
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
601
-				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
600
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
601
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
602 602
 			}
603 603
 		}
604 604
 
@@ -619,44 +619,44 @@  discard block
 block discarded – undo
619 619
 		EE_Registry::instance()->load_helper('MSG_Template');
620 620
 		$attendee = $item->attendee();
621 621
 		$ticket = $item->ticket();
622
-		$this->_set_related_details( $item );
622
+		$this->_set_related_details($item);
623 623
 
624 624
 		//Build row actions
625
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
626
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL );
625
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
626
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL);
627 627
 
628 628
 		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
629 629
 		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
630
-		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true );
630
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true);
631 631
 
632 632
 
633 633
 		//Build row actions
634
-		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '
634
+		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '
635 635
 			<li>
636
-			<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
636
+			<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
637 637
 				<div class="dashicons dashicons-clipboard"></div>
638 638
 			</a>
639 639
 			</li>' : '';
640 640
 
641
-		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) &&  $attendee instanceof EE_Attendee ?'
641
+		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? '
642 642
 			<li>
643
-			<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text">
643
+			<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text">
644 644
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
645 645
 			</a>
646 646
 			</li>' : '';
647 647
 
648
-		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? '
648
+		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? '
649 649
 			<li>
650
-			<a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text">
650
+			<a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text">
651 651
 				<div class="dashicons dashicons-email-alt"></div>
652 652
 			</a>
653 653
 			</li>' : '';
654 654
 
655 655
 		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
656
-		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL );
657
-		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? '
656
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL);
657
+		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
658 658
 			<li>
659
-			<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_txn_lnk_url.'"  title="' . $this->_transaction_details['title_attr'] . '" class="tiny-text">
659
+			<a class="ee-status-color-' . $this->_transaction_details['status'].'" href="'.$view_txn_lnk_url.'"  title="'.$this->_transaction_details['title_attr'].'" class="tiny-text">
660 660
 				<div class="dashicons dashicons-cart"></div>
661 661
 			</a>
662 662
 			</li>' : '';
@@ -664,10 +664,10 @@  discard block
 block discarded – undo
664 664
 		//invoice link
665 665
 		$dl_invoice_lnk_url = $item->invoice_url();
666 666
 		//only show invoice link if message type is active.
667
-		if ( $item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
667
+		if ($item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
668 668
 			$dl_invoice_lnk = '
669 669
 		<li>
670
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
670
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
671 671
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
672 672
 			</a>
673 673
 		</li>';
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 			$dl_invoice_lnk = '';
676 676
 		}
677 677
 
678
-			return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul' );
678
+			return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul');
679 679
 	}
680 680
 
681 681
 }
Please login to merge, or discard this patch.
admin_pages/support/Support_Admin_Page_Init.core.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public function __construct() {
34 34
 		//define some help/support page related constants
35
-		define( 'EE_SUPPORT_PG_SLUG', 'espresso_support' );
36
-		define( 'EE_SUPPORT_ADMIN_URL', admin_url('admin.php?page=' . EE_SUPPORT_PG_SLUG ));
37
-		define( 'EE_SUPPORT_ADMIN_TEMPLATE_PATH', EE_ADMIN_PAGES . 'support/templates/');
38
-		define( 'EE_SUPPORT_ADMIN', EE_ADMIN_PAGES . 'support/' );
39
-		define( 'EE_SUPPORT_ASSETS_URL', EE_ADMIN_PAGES_URL . 'support/assets/' );
35
+		define('EE_SUPPORT_PG_SLUG', 'espresso_support');
36
+		define('EE_SUPPORT_ADMIN_URL', admin_url('admin.php?page='.EE_SUPPORT_PG_SLUG));
37
+		define('EE_SUPPORT_ADMIN_TEMPLATE_PATH', EE_ADMIN_PAGES.'support/templates/');
38
+		define('EE_SUPPORT_ADMIN', EE_ADMIN_PAGES.'support/');
39
+		define('EE_SUPPORT_ASSETS_URL', EE_ADMIN_PAGES_URL.'support/assets/');
40 40
 		parent::__construct();
41 41
 	}
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	protected function _set_menu_map() {
48
-		$this->_menu_map = new EE_Admin_Page_Sub_Menu( array(
48
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(array(
49 49
 			'menu_group' => 'extras',
50 50
 			'menu_order' => 30,
51 51
 			'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 
18 18
 
19
-	public function __construct( $admin_page ) {
19
+	public function __construct($admin_page) {
20 20
 		parent::__construct($admin_page);
21 21
 		$this->_status = $this->_admin_page->get_registration_status_array();
22 22
 	}
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 	protected function _setup_data() {
28
-		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE );
29
-		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE, TRUE);
28
+		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE);
29
+		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE);
30 30
 	}
31 31
 
32 32
 
33 33
 
34 34
 
35 35
 	protected function _set_properties() {
36
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
36
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
37 37
 
38 38
 		$this->_wp_list_args = array(
39 39
 			'singular' => __('registrant', 'event_espresso'),
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$columns = array();
46 46
 		//$columns['_Reg_Status'] = '';
47
-		if ( !empty( $evt_id ) ) {
47
+		if ( ! empty($evt_id)) {
48 48
 			$columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text
49 49
 			$this->_has_checkbox_column = true;
50 50
 		}
@@ -60,43 +60,43 @@  discard block
 block discarded – undo
60 60
 				'TXN_total' => __('Total', 'event_espresso')
61 61
 			);
62 62
 
63
-		$this->_columns = array_merge( $columns, $this->_columns);
63
+		$this->_columns = array_merge($columns, $this->_columns);
64 64
 
65 65
 		$this->_primary_column = '_REG_att_checked_in';
66 66
 
67
-		if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id )  ) {
67
+		if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) {
68 68
 			$this->_bottom_buttons = array(
69 69
 				'report'=> array(
70 70
 					'route' => 'registrations_report',
71 71
 					'extra_request' => 
72 72
 						array( 
73 73
 							'EVT_ID'=> $evt_id, 
74
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
74
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
75 75
 				)
76 76
 			);
77 77
 		}
78 78
 
79 79
 		$this->_sortable_columns = array(
80 80
 			 //true means its already sorted
81
-			'ATT_name' => array( 'ATT_name' => TRUE ),
82
-			'Event' => array( 'Event.EVT.Name' => FALSE )
81
+			'ATT_name' => array('ATT_name' => TRUE),
82
+			'Event' => array('Event.EVT.Name' => FALSE)
83 83
 		);
84 84
 
85 85
 		$this->_hidden_columns = array();
86 86
 
87 87
 		$this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
88
-		$this->_dtts_for_event = !empty($evt_id) ? $this->_evt->datetimes_ordered() : array();
88
+		$this->_dtts_for_event = ! empty($evt_id) ? $this->_evt->datetimes_ordered() : array();
89 89
 
90 90
 	}
91 91
 
92 92
 
93 93
 
94 94
 
95
-	protected function _get_row_class( $item ) {
96
-		$class = parent::_get_row_class( $item );
95
+	protected function _get_row_class($item) {
96
+		$class = parent::_get_row_class($item);
97 97
 		//add status class
98
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
99
-		if ( $this->_has_checkbox_column ) {
98
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
99
+		if ($this->_has_checkbox_column) {
100 100
 			$class .= ' has-checkbox-column';
101 101
 		}
102 102
 		return $class;
@@ -107,44 +107,44 @@  discard block
 block discarded – undo
107 107
 	protected function _get_table_filters() {
108 108
 		$filters = $where = array();
109 109
 
110
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
110
+		EE_Registry::instance()->load_helper('Form_Fields');
111 111
 
112
-		if ( empty( $this->_dtts_for_event ) ) {
112
+		if (empty($this->_dtts_for_event)) {
113 113
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
114 114
 			//note possible capability restrictions
115
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) {
116
-				$where['status**'] =  array( '!=', 'private' );
115
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
116
+				$where['status**'] = array('!=', 'private');
117 117
 			}
118 118
 
119
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
120
-				$where['EVT_wp_user'] =  get_current_user_id();
119
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
120
+				$where['EVT_wp_user'] = get_current_user_id();
121 121
 			}
122 122
 
123
-			$events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) );
124
-			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
125
-			foreach ( $events as $evt ) {
123
+			$events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC')));
124
+			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso'));
125
+			foreach ($events as $evt) {
126 126
 				//any registrations for this event?
127
-				if ( ! $evt->get_count_of_all_registrations() )
127
+				if ( ! $evt->get_count_of_all_registrations())
128 128
 					continue;
129 129
 				$evts[] = array(
130 130
 					'id' => $evt->ID(),
131
-					'text' => $evt->get( 'EVT_name' ),
131
+					'text' => $evt->get('EVT_name'),
132 132
 					'class' => $evt->is_expired() ? 'ee-expired-event' : ''
133 133
 				);
134 134
 			}
135 135
 			$event_filter = '<div class="ee-event-filter">';
136
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts );
137
-			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>';
136
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts);
137
+			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>';
138 138
 			$event_filter .= '</div>';
139 139
 			$filters[] = $event_filter;
140 140
 
141 141
 		} else {
142 142
 			//DTT datetimes filter
143
-			$cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
143
+			$cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
144 144
 			$dtts = array();
145
-			foreach ( $this->_dtts_for_event as $dtt ) {
146
-				$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time();
147
-				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string );
145
+			foreach ($this->_dtts_for_event as $dtt) {
146
+				$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time();
147
+				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string);
148 148
 			}
149 149
 			$filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt);
150 150
 		}
@@ -165,19 +165,19 @@  discard block
 block discarded – undo
165 165
 
166 166
 
167 167
 	protected function _get_total_event_attendees() {
168
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
169
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
168
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
169
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
170 170
 		$query_params = array();
171
-		if ($EVT_ID){
172
-			$query_params[0]['EVT_ID']=$EVT_ID;
171
+		if ($EVT_ID) {
172
+			$query_params[0]['EVT_ID'] = $EVT_ID;
173 173
 		}
174 174
 		//if DTT is included we do multiple datetimes.  Otherwise we just do primary datetime
175
-		if ( $DTT_ID ) {
175
+		if ($DTT_ID) {
176 176
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
177 177
 		}
178
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
178
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
179 179
 
180
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
180
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
181 181
 
182 182
 		return EEM_Registration::instance()->count($query_params);
183 183
 	}
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 
189 189
 
190 190
 
191
-	function column__Reg_Status( EE_Registration $item ) {
192
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
191
+	function column__Reg_Status(EE_Registration $item) {
192
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
193 193
 	}
194 194
 
195 195
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 	function column_cb($item) {
200
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
200
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
201 201
 	}
202 202
 
203 203
 
@@ -210,18 +210,18 @@  discard block
 block discarded – undo
210 210
 	/**
211 211
 	 * 		column_REG_att_checked_in
212 212
 	*/
213
-	function column__REG_att_checked_in(EE_Registration $item){
213
+	function column__REG_att_checked_in(EE_Registration $item) {
214 214
 		$attendee = $item->attendee();
215 215
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
216
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
216
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
217 217
 		$checkinstatus = $item->check_in_status_for_datetime($DTT_ID);
218 218
 		$nonce = wp_create_nonce('checkin_nonce');
219
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
220
-		$toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : '';
219
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
220
+		$toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : '';
221 221
 
222
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
222
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
223 223
 
224
-		 return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content;
224
+		 return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content;
225 225
 	}
226 226
 
227 227
 
@@ -230,43 +230,43 @@  discard block
 block discarded – undo
230 230
 
231 231
 	function column_ATT_name(EE_Registration $item) {
232 232
 		$attendee = $item->attendee();
233
-		if ( ! $attendee instanceof EE_Attendee ) {
233
+		if ( ! $attendee instanceof EE_Attendee) {
234 234
 			return __('No contact record for this registration.', 'event_espresso');
235 235
 		}
236 236
 
237 237
 		// edit attendee link
238
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
239
-		$name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ?  '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name();
238
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
239
+		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name();
240 240
 		$name_link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	' : '';
241 241
 
242 242
 		//add group details
243
-		$name_link .= '&nbsp;' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size());
243
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
244 244
 
245 245
 		//add regcode
246
-		$link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL );
246
+		$link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL);
247 247
 		$name_link .= '<br>';
248
-		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() )
249
-			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>'
248
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID())
249
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>'
250 250
 			: $item->reg_code();
251 251
 
252 252
 		//status
253
-		$name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
253
+		$name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
254 254
 
255 255
 		$actions = array();
256
-		$DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
257
-		$DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID;
256
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
257
+		$DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID;
258 258
 
259
-		if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) {
260
-			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
261
-			$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>';
259
+		if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) {
260
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
261
+			$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>';
262 262
 		}
263 263
 
264
-		return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link;
264
+		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link;
265 265
 	}
266 266
 
267 267
 
268 268
 
269
-	function column_ATT_email( EE_Registration $item ) {
269
+	function column_ATT_email(EE_Registration $item) {
270 270
 		$attendee = $item->attendee();
271 271
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
272 272
 		return $item->get_first_related('Attendee')->email();
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 
279 279
 	function column_Event(EE_Registration $item) {
280 280
 		$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
281
-		$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL );
282
-		$event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ?  '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name();
281
+		$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL);
282
+		$event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name();
283 283
 		return $event_label;
284 284
 	}
285 285
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 
288 288
 
289 289
 
290
-	function column_PRC_name(EE_Registration $item){
290
+	function column_PRC_name(EE_Registration $item) {
291 291
 		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
292 292
 	}
293 293
 
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	/**
300 300
 	 * 		column_REG_final_price
301 301
 	*/
302
-	function column__REG_final_price(EE_Registration $item){
303
-		return '<span class="reg-pad-rght">' .  ' ' . $item->pretty_final_price() . '</span>';
302
+	function column__REG_final_price(EE_Registration $item) {
303
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
304 304
 	}
305 305
 
306 306
 
@@ -310,20 +310,20 @@  discard block
 block discarded – undo
310 310
 	/**
311 311
 	 * 		column_TXN_paid
312 312
 	*/
313
-	function column_TXN_paid(EE_Registration $item){
313
+	function column_TXN_paid(EE_Registration $item) {
314 314
 
315
-		if ( $item->count() == 1 ) {
315
+		if ($item->count() == 1) {
316 316
 
317
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
317
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
318 318
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
319 319
 			} else {
320
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
321
-				return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '
320
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
321
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
322 322
 				<span class="reg-pad-rght">
323
-					<a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">
324
-						' . $item->transaction()->pretty_paid(). '
323
+					<a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">
324
+						' . $item->transaction()->pretty_paid().'
325 325
 					</a>
326
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
326
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
327 327
 			}
328 328
 		} else {
329 329
 			return '<span class="reg-pad-rght"></span>';
@@ -337,13 +337,13 @@  discard block
 block discarded – undo
337 337
 	/**
338 338
 	 * 		column_TXN_total
339 339
 	*/
340
-	function column_TXN_total(EE_Registration $item){
340
+	function column_TXN_total(EE_Registration $item) {
341 341
 		$txn = $item->transaction();
342
-		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
343
-		if ( $item->get('REG_count') == 1 ) {
342
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
343
+		if ($item->get('REG_count') == 1) {
344 344
 			$line_total_obj = $txn->total_line_item();
345 345
 			$txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso');
346
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total  .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
346
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
347 347
 		} else {
348 348
 			return '<span class="reg-pad-rght"></span>';
349 349
 		}
Please login to merge, or discard this patch.