Completed
Branch BUG-8957-add-countries (d46858)
by
unknown
31:05 queued 15:34
created
core/libraries/rest_api/Capabilities.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@
 block discarded – undo
111 111
 		//we only care to do this for frontend reads and when the user can't edit the item
112 112
 		if (
113 113
 			$request_type !== \EEM_Base::caps_read
114
-		     || $model->exists(
114
+			 || $model->exists(
115 115
 				$model->alter_query_params_to_restrict_by_ID(
116 116
 					$primary_key_string,
117 117
 					array(
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\rest_api;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @param string    $model_context one of the return values from EEM_Base::valid_cap_contexts()
24 24
 	 * @return boolean
25 25
 	 */
26
-	public static function current_user_has_partial_access_to( $model, $model_context = \EEM_Base::caps_read ) {
26
+	public static function current_user_has_partial_access_to($model, $model_context = \EEM_Base::caps_read) {
27 27
 		if (
28 28
 			apply_filters(
29 29
 				'FHEE__Capabilities__current_user_has_partial_access_to__override_begin',
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 		) {
35 35
 			return true;
36 36
 		}
37
-		foreach ( $model->caps_missing( $model_context ) as $capability_name => $restriction_obj ) {
38
-			if ( $restriction_obj instanceof \EE_Return_None_Where_Conditions ) {
37
+		foreach ($model->caps_missing($model_context) as $capability_name => $restriction_obj) {
38
+			if ($restriction_obj instanceof \EE_Return_None_Where_Conditions) {
39 39
 				return false;
40 40
 			}
41 41
 		}
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 * @param string    $request_type one of the constants on WP_JSON_Server
63 63
 	 * @return array
64 64
 	 */
65
-	public static function get_missing_permissions( $model, $request_type = \EEM_Base::caps_read ) {
66
-		return $model->caps_missing( $request_type );
65
+	public static function get_missing_permissions($model, $request_type = \EEM_Base::caps_read) {
66
+		return $model->caps_missing($request_type);
67 67
 	}
68 68
 
69 69
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @param string    $model_context one of the return values from EEM_Base::valid_cap_contexts()
77 77
 	 * @return string
78 78
 	 */
79
-	public static function get_missing_permissions_string( $model, $model_context = \EEM_Base::caps_read ) {
80
-		return implode( ',', array_keys( self::get_missing_permissions( $model, $model_context ) ) );
79
+	public static function get_missing_permissions_string($model, $model_context = \EEM_Base::caps_read) {
80
+		return implode(',', array_keys(self::get_missing_permissions($model, $model_context)));
81 81
 	}
82 82
 
83 83
 
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 		//if they didn't provide the primary key string, we'll just hope we can figure it out
104 104
 		//from the entity (although it's preferred client code does it, because the entity might be missing
105 105
 		//necessary fields for creating the primary key string, or they could be named differently)
106
-		if ( $primary_key_string === null ) {
106
+		if ($primary_key_string === null) {
107 107
 			$primary_key_string = $model->get_index_primary_key_string(
108
-				$model->deduce_fields_n_values_from_cols_n_values( $entity )
108
+				$model->deduce_fields_n_values_from_cols_n_values($entity)
109 109
 			);
110 110
 		}
111 111
 		//we only care to do this for frontend reads and when the user can't edit the item
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
 		) {
124 124
 			return $entity;
125 125
 		}
126
-		foreach ( $model->field_settings() as $field_name => $field_obj ) {
126
+		foreach ($model->field_settings() as $field_name => $field_obj) {
127 127
 			if (
128
-				$model_version_info->field_has_rendered_format( $field_obj )
129
-				&& isset( $entity[ $field_name ] )
130
-				&& is_array( $entity[ $field_name ] )
131
-				&& isset( $entity[ $field_name ]['raw'] )
128
+				$model_version_info->field_has_rendered_format($field_obj)
129
+				&& isset($entity[$field_name])
130
+				&& is_array($entity[$field_name])
131
+				&& isset($entity[$field_name]['raw'])
132 132
 			) {
133
-				unset( $entity[ $field_name ]['raw'] );
133
+				unset($entity[$field_name]['raw']);
134 134
 			}
135 135
 		}
136 136
 		//theoretically we may want to filter out specific fields for specific models
Please login to merge, or discard this patch.
core/helpers/EEH_Activation.helper.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 * @since  4.6.0
601 601
 	 * @global WPDB $wpdb
602 602
 	 *
603
-	 * @return mixed null|int WP_user ID or NULL
603
+	 * @return integer|null null|int WP_user ID or NULL
604 604
 	 */
605 605
 	public static function get_default_creator_id() {
606 606
 		global $wpdb;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 	 * @static
760 760
 	 * @deprecated instead use TableManager::dropTable()
761 761
 	 * @param string $table_name
762
-	 * @return bool | int
762
+	 * @return integer | int
763 763
 	 */
764 764
 	public static function delete_unused_db_table( $table_name ) {
765 765
 		return \EEH_Activation::getTableManager()->dropTable( $table_name );
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 	 * @deprecated instead use TableManager::dropIndex()
776 776
 	 * @param string $table_name
777 777
 	 * @param string $index_name
778
-	 * @return bool | int
778
+	 * @return integer | int
779 779
 	 */
780 780
 	public static function drop_index( $table_name, $index_name ) {
781 781
 		return \EEH_Activation::getTableManager()->dropIndex( $table_name, $index_name );
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			if ( is_array( $hooks_to_fire_at_time ) ) {
252 252
 				foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) {
253 253
 					if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] )
254
-					     && is_array( $ee_cron_tasks_to_remove[ $hook_name ] )
254
+						 && is_array( $ee_cron_tasks_to_remove[ $hook_name ] )
255 255
 					) {
256 256
 						unset( $crons[ $timestamp ][ $hook_name ] );
257 257
 					}
@@ -736,13 +736,13 @@  discard block
 block discarded – undo
736 736
 
737 737
 
738 738
 /**
739
-	 * delete_db_table_if_empty
740
-	 *
741
-	 * @access public
742
-	 * @static
743
-	 * @param string $table_name
744
-	 * @return bool | int
745
-	 */
739
+ * delete_db_table_if_empty
740
+ *
741
+ * @access public
742
+ * @static
743
+ * @param string $table_name
744
+ * @return bool | int
745
+ */
746 746
 	public static function delete_db_table_if_empty( $table_name ) {
747 747
 		if ( \EEH_Activation::getTableAnalysis()->tableIsEmpty( $table_name ) ) {
748 748
 			return \EEH_Activation::getTableManager()->dropTable( $table_name );
@@ -1103,14 +1103,14 @@  discard block
 block discarded – undo
1103 1103
 							$QSG_ID = reset( $id_col );
1104 1104
 						} else {
1105 1105
 							//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
1106
-                                                        EE_Log::instance()->log(
1107
-                                                                __FILE__,
1108
-                                                                __FUNCTION__,
1109
-                                                                sprintf(
1110
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'),
1111
-                                                                        $QST_ID ),
1112
-                                                                'error' );
1113
-                                                        continue;
1106
+														EE_Log::instance()->log(
1107
+																__FILE__,
1108
+																__FUNCTION__,
1109
+																sprintf(
1110
+																		__( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'),
1111
+																		$QST_ID ),
1112
+																'error' );
1113
+														continue;
1114 1114
 						}
1115 1115
 					}
1116 1116
 
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
 					$wpdb->insert(
1119 1119
 						\EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question_group_question' ),
1120 1120
 						array( 'QSG_ID'    => $QSG_ID,
1121
-						       'QST_ID'    => $QST_ID,
1122
-						       'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++
1121
+							   'QST_ID'    => $QST_ID,
1122
+							   'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++
1123 1123
 						),
1124 1124
 						array( '%d', '%d', '%d' )
1125 1125
 					);
@@ -1663,8 +1663,8 @@  discard block
 block discarded – undo
1663 1663
 				}
1664 1664
 			}
1665 1665
 		}
1666
-                //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1667
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1666
+				//also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1667
+				remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1668 1668
 
1669 1669
 		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1670 1670
 			$db_update_sans_ee4 = array();
Please login to merge, or discard this patch.
Spacing   +318 added lines, -318 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * EEH_Activation Helper
4 4
  *
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 * @return \EventEspresso\core\services\database\TableAnalysis
55 55
 	 */
56 56
 	public static function getTableAnalysis() {
57
-		if ( ! self::$table_analysis instanceof \EventEspresso\core\services\database\TableAnalysis ) {
58
-			self::$table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true );
57
+		if ( ! self::$table_analysis instanceof \EventEspresso\core\services\database\TableAnalysis) {
58
+			self::$table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true);
59 59
 		}
60 60
 		return self::$table_analysis;
61 61
 	}
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @return \EventEspresso\core\services\database\TableManager
67 67
 	 */
68 68
 	public static function getTableManager() {
69
-		if ( ! self::$table_manager instanceof \EventEspresso\core\services\database\TableManager ) {
70
-			self::$table_manager = EE_Registry::instance()->create( 'TableManager', array(), true );
69
+		if ( ! self::$table_manager instanceof \EventEspresso\core\services\database\TableManager) {
70
+			self::$table_manager = EE_Registry::instance()->create('TableManager', array(), true);
71 71
 		}
72 72
 		return self::$table_manager;
73 73
 	}
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * @param $table_name
83 83
 	 * @return string
84 84
 	 */
85
-	public static function ensure_table_name_has_prefix( $table_name ) {
86
-		return \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( $table_name );
85
+	public static function ensure_table_name_has_prefix($table_name) {
86
+		return \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix($table_name);
87 87
 	}
88 88
 
89 89
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return boolean success, whether the database and folders are setup properly
112 112
 	 * @throws \EE_Error
113 113
 	 */
114
-	public static function initialize_db_and_folders(){
114
+	public static function initialize_db_and_folders() {
115 115
 		$good_filesystem = EEH_Activation::create_upload_directories();
116 116
 		$good_db = EEH_Activation::create_database_tables();
117 117
 		return $good_filesystem && $good_db;
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @throws \EE_Error
129 129
 	 */
130
-	public static function initialize_db_content(){
130
+	public static function initialize_db_content() {
131 131
 		//let's avoid doing all this logic repeatedly, especially when addons are requesting it
132
-		if( EEH_Activation::$_initialized_db_content_already_in_this_request ) {
132
+		if (EEH_Activation::$_initialized_db_content_already_in_this_request) {
133 133
 			return;
134 134
 		}
135 135
 		EEH_Activation::$_initialized_db_content_already_in_this_request = true;
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 		EEH_Activation::remove_cron_tasks();
147 147
 		EEH_Activation::create_cron_tasks();
148 148
 		// remove all TXN locks since that is being done via extra meta now
149
-		delete_option( 'ee_locked_transactions' );
149
+		delete_option('ee_locked_transactions');
150 150
 		//also, check for CAF default db content
151
-		do_action( 'AHEE__EEH_Activation__initialize_db_content' );
151
+		do_action('AHEE__EEH_Activation__initialize_db_content');
152 152
 		//also: EEM_Gateways::load_all_gateways() outputs a lot of success messages
153 153
 		//which users really won't care about on initial activation
154 154
 		EE_Error::overwrite_success();
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return array
169 169
 	 * @throws \EE_Error
170 170
 	 */
171
-	public static function get_cron_tasks( $which_to_include ) {
171
+	public static function get_cron_tasks($which_to_include) {
172 172
 		$cron_tasks = apply_filters(
173 173
 			'FHEE__EEH_Activation__get_cron_tasks',
174 174
 			array(
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 				'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
178 178
 			)
179 179
 		);
180
-		if ( $which_to_include === 'old' ) {
180
+		if ($which_to_include === 'old') {
181 181
 			$cron_tasks = array_filter(
182 182
 				$cron_tasks,
183
-				function ( $value ) {
183
+				function($value) {
184 184
 					return $value === EEH_Activation::cron_task_no_longer_in_use;
185 185
 				}
186 186
 			);
187
-		} elseif ( $which_to_include === 'current' ) {
188
-			$cron_tasks = array_filter( $cron_tasks );
189
-		} elseif ( WP_DEBUG && $which_to_include !== 'all' ) {
187
+		} elseif ($which_to_include === 'current') {
188
+			$cron_tasks = array_filter($cron_tasks);
189
+		} elseif (WP_DEBUG && $which_to_include !== 'all') {
190 190
 			throw new EE_Error(
191 191
 				sprintf(
192 192
 					__(
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public static function create_cron_tasks() {
211 211
 
212
-		foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) {
213
-			if( ! wp_next_scheduled( $hook_name ) ) {
214
-				wp_schedule_event( time(), $frequency, $hook_name );
212
+		foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) {
213
+			if ( ! wp_next_scheduled($hook_name)) {
214
+				wp_schedule_event(time(), $frequency, $hook_name);
215 215
 			}
216 216
 		}
217 217
 
@@ -225,10 +225,10 @@  discard block
 block discarded – undo
225 225
 	 * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones
226 226
 	 * @throws \EE_Error
227 227
 	 */
228
-	public static function remove_cron_tasks( $remove_all = true ) {
228
+	public static function remove_cron_tasks($remove_all = true) {
229 229
 		$cron_tasks_to_remove = $remove_all ? 'all' : 'old';
230 230
 		$crons = _get_cron_array();
231
-		$crons = is_array( $crons ) ? $crons : array();
231
+		$crons = is_array($crons) ? $crons : array();
232 232
 		/* reminder of what $crons look like:
233 233
 		 * Top-level keys are timestamps, and their values are arrays.
234 234
 		 * The 2nd level arrays have keys with each of the cron task hook names to run at that time
@@ -246,23 +246,23 @@  discard block
 block discarded – undo
246 246
 		 *					...
247 247
 		 *      ...
248 248
 		 */
249
-		$ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks( $cron_tasks_to_remove );
250
-		foreach ( $crons as $timestamp => $hooks_to_fire_at_time ) {
251
-			if ( is_array( $hooks_to_fire_at_time ) ) {
252
-				foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) {
253
-					if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] )
254
-					     && is_array( $ee_cron_tasks_to_remove[ $hook_name ] )
249
+		$ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks($cron_tasks_to_remove);
250
+		foreach ($crons as $timestamp => $hooks_to_fire_at_time) {
251
+			if (is_array($hooks_to_fire_at_time)) {
252
+				foreach ($hooks_to_fire_at_time as $hook_name => $hook_actions) {
253
+					if (isset($ee_cron_tasks_to_remove[$hook_name])
254
+					     && is_array($ee_cron_tasks_to_remove[$hook_name])
255 255
 					) {
256
-						unset( $crons[ $timestamp ][ $hook_name ] );
256
+						unset($crons[$timestamp][$hook_name]);
257 257
 					}
258 258
 				}
259 259
 				//also take care of any empty cron timestamps.
260
-				if ( empty( $hooks_to_fire_at_time ) ) {
261
-					unset( $crons[ $timestamp ] );
260
+				if (empty($hooks_to_fire_at_time)) {
261
+					unset($crons[$timestamp]);
262 262
 				}
263 263
 			}
264 264
 		}
265
-		_set_cron_array( $crons );
265
+		_set_cron_array($crons);
266 266
 	}
267 267
 
268 268
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	public static function CPT_initialization() {
279 279
 		// register Custom Post Types
280
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
280
+		EE_Registry::instance()->load_core('Register_CPTs');
281 281
 		flush_rewrite_rules();
282 282
 	}
283 283
 
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 	 * 	@return void
296 296
 	 */
297 297
 	public static function reset_and_update_config() {
298
-		do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) );
299
-		add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 );
298
+		do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config'));
299
+		add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3);
300 300
 		//EE_Config::reset();
301 301
 	}
302 302
 
@@ -309,28 +309,28 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	public static function load_calendar_config() {
311 311
 		// grab array of all plugin folders and loop thru it
312
-		$plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR );
313
-		if ( empty( $plugins ) ) {
312
+		$plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR);
313
+		if (empty($plugins)) {
314 314
 			return;
315 315
 		}
316
-		foreach ( $plugins as $plugin_path ) {
316
+		foreach ($plugins as $plugin_path) {
317 317
 			// grab plugin folder name from path
318
-			$plugin = basename( $plugin_path );
318
+			$plugin = basename($plugin_path);
319 319
 			// drill down to Espresso plugins
320 320
 			// then to calendar related plugins
321 321
 			if (
322
-				strpos( $plugin, 'espresso' ) !== FALSE
323
-				|| strpos( $plugin, 'Espresso' ) !== FALSE
324
-				|| strpos( $plugin, 'ee4' ) !== FALSE
325
-				|| strpos( $plugin, 'EE4' ) !== FALSE
326
-				|| strpos( $plugin, 'calendar' ) !== false
322
+				strpos($plugin, 'espresso') !== FALSE
323
+				|| strpos($plugin, 'Espresso') !== FALSE
324
+				|| strpos($plugin, 'ee4') !== FALSE
325
+				|| strpos($plugin, 'EE4') !== FALSE
326
+				|| strpos($plugin, 'calendar') !== false
327 327
 			) {
328 328
 				// this is what we are looking for
329
-				$calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php';
329
+				$calendar_config = $plugin_path.DS.'EE_Calendar_Config.php';
330 330
 				// does it exist in this folder ?
331
-				if ( is_readable( $calendar_config )) {
331
+				if (is_readable($calendar_config)) {
332 332
 					// YEAH! let's load it
333
-					require_once( $calendar_config );
333
+					require_once($calendar_config);
334 334
 				}
335 335
 			}
336 336
 		}
@@ -346,21 +346,21 @@  discard block
 block discarded – undo
346 346
 	 * @param \EE_Config     $EE_Config
347 347
 	 * @return \stdClass
348 348
 	 */
349
-	public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) {
350
-		$convert_from_array = array( 'addons' );
349
+	public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) {
350
+		$convert_from_array = array('addons');
351 351
 		// in case old settings were saved as an array
352
-		if ( is_array( $settings ) && in_array( $config, $convert_from_array )) {
352
+		if (is_array($settings) && in_array($config, $convert_from_array)) {
353 353
 			// convert existing settings to an object
354 354
 			$config_array = $settings;
355 355
 			$settings = new stdClass();
356
-			foreach ( $config_array as $key => $value ){
357
-				if ( $key === 'calendar' && class_exists( 'EE_Calendar_Config' )) {
358
-					$EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value );
356
+			foreach ($config_array as $key => $value) {
357
+				if ($key === 'calendar' && class_exists('EE_Calendar_Config')) {
358
+					$EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value);
359 359
 				} else {
360 360
 					$settings->{$key} = $value;
361 361
 				}
362 362
 			}
363
-			add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' );
363
+			add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true');
364 364
 		}
365 365
 		return $settings;
366 366
 	}
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public static function deactivate_event_espresso() {
378 378
 		// check permissions
379
-		if ( current_user_can( 'activate_plugins' )) {
380
-			deactivate_plugins( EE_PLUGIN_BASENAME, TRUE );
379
+		if (current_user_can('activate_plugins')) {
380
+			deactivate_plugins(EE_PLUGIN_BASENAME, TRUE);
381 381
 		}
382 382
 	}
383 383
 
@@ -399,25 +399,25 @@  discard block
 block discarded – undo
399 399
 		$critical_pages = array(
400 400
 			array(
401 401
 				'id' =>'reg_page_id',
402
-				'name' => __( 'Registration Checkout', 'event_espresso' ),
402
+				'name' => __('Registration Checkout', 'event_espresso'),
403 403
 				'post' => NULL,
404 404
 				'code' => 'ESPRESSO_CHECKOUT'
405 405
 			),
406 406
 			array(
407 407
 				'id' => 'txn_page_id',
408
-				'name' => __( 'Transactions', 'event_espresso' ),
408
+				'name' => __('Transactions', 'event_espresso'),
409 409
 				'post' => NULL,
410 410
 				'code' => 'ESPRESSO_TXN_PAGE'
411 411
 			),
412 412
 			array(
413 413
 				'id' => 'thank_you_page_id',
414
-				'name' => __( 'Thank You', 'event_espresso' ),
414
+				'name' => __('Thank You', 'event_espresso'),
415 415
 				'post' => NULL,
416 416
 				'code' => 'ESPRESSO_THANK_YOU'
417 417
 			),
418 418
 			array(
419 419
 				'id' => 'cancel_page_id',
420
-				'name' => __( 'Registration Cancelled', 'event_espresso' ),
420
+				'name' => __('Registration Cancelled', 'event_espresso'),
421 421
 				'post' => NULL,
422 422
 				'code' => 'ESPRESSO_CANCELLED'
423 423
 			),
@@ -425,62 +425,62 @@  discard block
 block discarded – undo
425 425
 
426 426
 		$EE_Core_Config = EE_Registry::instance()->CFG->core;
427 427
 
428
-		foreach ( $critical_pages as $critical_page ) {
428
+		foreach ($critical_pages as $critical_page) {
429 429
 			// is critical page ID set in config ?
430
-			if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) {
430
+			if ($EE_Core_Config->{$critical_page['id']} !== FALSE) {
431 431
 				// attempt to find post by ID
432
-				$critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} );
432
+				$critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} );
433 433
 			}
434 434
 			// no dice?
435
-			if ( $critical_page['post'] === null ) {
435
+			if ($critical_page['post'] === null) {
436 436
 				// attempt to find post by title
437
-				$critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] );
437
+				$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
438 438
 				// still nothing?
439
-				if ( $critical_page['post'] === null ) {
440
-					$critical_page = EEH_Activation::create_critical_page( $critical_page );
439
+				if ($critical_page['post'] === null) {
440
+					$critical_page = EEH_Activation::create_critical_page($critical_page);
441 441
 					// REALLY? Still nothing ??!?!?
442
-					if ( $critical_page['post'] === null ) {
443
-						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
444
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
442
+					if ($critical_page['post'] === null) {
443
+						$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
444
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
445 445
 						break;
446 446
 					}
447 447
 				}
448 448
 			}
449 449
 			// track post_shortcodes
450
-			if ( $critical_page['post'] ) {
451
-				EEH_Activation::_track_critical_page_post_shortcodes( $critical_page );
450
+			if ($critical_page['post']) {
451
+				EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
452 452
 			}
453 453
 			// check that Post ID matches critical page ID in config
454 454
 			if (
455
-				isset( $critical_page['post']->ID )
456
-				&& $critical_page['post']->ID !== $EE_Core_Config->{$critical_page[ 'id' ]}
455
+				isset($critical_page['post']->ID)
456
+				&& $critical_page['post']->ID !== $EE_Core_Config->{$critical_page['id']}
457 457
 			) {
458 458
 				//update Config with post ID
459
-				$EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID;
460
-				if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) {
461
-					$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
462
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
459
+				$EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID;
460
+				if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
461
+					$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
462
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
463 463
 				}
464 464
 			}
465 465
 
466 466
 			$critical_page_problem =
467
-				! isset( $critical_page['post']->post_status )
467
+				! isset($critical_page['post']->post_status)
468 468
 				|| $critical_page['post']->post_status !== 'publish'
469
-				|| strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE
469
+				|| strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE
470 470
 					? TRUE
471 471
 					: $critical_page_problem;
472 472
 
473 473
 		}
474 474
 
475
-		if ( $critical_page_problem ) {
475
+		if ($critical_page_problem) {
476 476
 			$msg = sprintf(
477
-				__('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' ),
478
-				'<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>'
477
+				__('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'),
478
+				'<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>'
479 479
 			);
480
-			EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg );
480
+			EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
481 481
 		}
482
-		if ( EE_Error::has_notices() ) {
483
-			EE_Error::get_notices( FALSE, TRUE, TRUE );
482
+		if (EE_Error::has_notices()) {
483
+			EE_Error::get_notices(FALSE, TRUE, TRUE);
484 484
 		}
485 485
 	}
486 486
 
@@ -492,13 +492,13 @@  discard block
 block discarded – undo
492 492
 	 * parameter to the shortcode
493 493
 	 * @return WP_Post or NULl
494 494
 	 */
495
-	public static function get_page_by_ee_shortcode($ee_shortcode){
495
+	public static function get_page_by_ee_shortcode($ee_shortcode) {
496 496
 		global $wpdb;
497 497
 		$shortcode_and_opening_bracket = '['.$ee_shortcode;
498 498
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
499
-		if($post_id){
499
+		if ($post_id) {
500 500
 			return get_post($post_id);
501
-		}else{
501
+		} else {
502 502
 			return NULL;
503 503
 		}
504 504
 
@@ -515,32 +515,32 @@  discard block
 block discarded – undo
515 515
 	 * @param array $critical_page
516 516
 	 * @return array
517 517
 	 */
518
-	public static function create_critical_page( $critical_page ) {
518
+	public static function create_critical_page($critical_page) {
519 519
 
520 520
 		$post_args = array(
521 521
 			'post_title' => $critical_page['name'],
522 522
 			'post_status' => 'publish',
523 523
 			'post_type' => 'page',
524 524
 			'comment_status' => 'closed',
525
-			'post_content' => '[' . $critical_page['code'] . ']'
525
+			'post_content' => '['.$critical_page['code'].']'
526 526
 		);
527 527
 
528
-		$post_id = wp_insert_post( $post_args );
529
-		if ( ! $post_id ) {
528
+		$post_id = wp_insert_post($post_args);
529
+		if ( ! $post_id) {
530 530
 			$msg = sprintf(
531
-				__( 'The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso' ),
531
+				__('The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso'),
532 532
 				$critical_page['name']
533 533
 			);
534
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
534
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
535 535
 			return $critical_page;
536 536
 		}
537 537
 		// get newly created post's details
538
-		if ( ! $critical_page['post'] = get_post( $post_id )) {
538
+		if ( ! $critical_page['post'] = get_post($post_id)) {
539 539
 			$msg = sprintf(
540
-				__( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ),
540
+				__('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'),
541 541
 				$critical_page['name']
542 542
 			);
543
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
543
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
544 544
 		}
545 545
 
546 546
 		return $critical_page;
@@ -559,35 +559,35 @@  discard block
 block discarded – undo
559 559
 	 * @param array $critical_page
560 560
 	 * @return void
561 561
 	 */
562
-	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
562
+	private static function _track_critical_page_post_shortcodes($critical_page = array()) {
563 563
 		// check the goods
564
-		if ( ! $critical_page['post'] instanceof WP_Post ) {
564
+		if ( ! $critical_page['post'] instanceof WP_Post) {
565 565
 			$msg = sprintf(
566
-				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
566
+				__('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'),
567 567
 				$critical_page['name']
568 568
 			);
569
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
569
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
570 570
 			return;
571 571
 		}
572 572
 		$EE_Core_Config = EE_Registry::instance()->CFG->core;
573 573
 		// map shortcode to post
574
-		$EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
574
+		$EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID;
575 575
 		// and make sure it's NOT added to the WP "Posts Page"
576 576
 		// name of the WP Posts Page
577 577
 		$posts_page = EE_Config::get_page_for_posts();
578
-		if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) {
579
-			unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] );
578
+		if (isset($EE_Core_Config->post_shortcodes[$posts_page])) {
579
+			unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]);
580 580
 		}
581
-		if ( $posts_page !== 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) {
582
-			unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] );
581
+		if ($posts_page !== 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) {
582
+			unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]);
583 583
 		}
584 584
 		// update post_shortcode CFG
585
-		if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) {
585
+		if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
586 586
 			$msg = sprintf(
587
-				__( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ),
587
+				__('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'),
588 588
 				$critical_page['name']
589 589
 			);
590
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
590
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
591 591
 		}
592 592
 	}
593 593
 
@@ -605,24 +605,24 @@  discard block
 block discarded – undo
605 605
 	public static function get_default_creator_id() {
606 606
 		global $wpdb;
607 607
 
608
-		if ( ! empty( self::$_default_creator_id ) ) {
608
+		if ( ! empty(self::$_default_creator_id)) {
609 609
 			return self::$_default_creator_id;
610 610
 		}/**/
611 611
 
612
-		$role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' );
612
+		$role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator');
613 613
 
614 614
 		//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.
615
-		$pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check );
616
-		if ( $pre_filtered_id !== false ) {
615
+		$pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check);
616
+		if ($pre_filtered_id !== false) {
617 617
 			return (int) $pre_filtered_id;
618 618
 		}
619 619
 
620
-		$capabilities_key = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'capabilities' );
621
-		$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 . '%' );
622
-		$user_id = $wpdb->get_var( $query );
623
-		 $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id );
624
-		 if ( $user_id && (int)$user_id ) {
625
-		 	self::$_default_creator_id = (int)$user_id;
620
+		$capabilities_key = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('capabilities');
621
+		$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.'%');
622
+		$user_id = $wpdb->get_var($query);
623
+		 $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id);
624
+		 if ($user_id && (int) $user_id) {
625
+		 	self::$_default_creator_id = (int) $user_id;
626 626
 		 	return self::$_default_creator_id;
627 627
 		 } else {
628 628
 		 	return NULL;
@@ -651,28 +651,28 @@  discard block
 block discarded – undo
651 651
 	 * 	@return void
652 652
 	 * @throws EE_Error if there are database errors
653 653
 	 */
654
-	public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) {
655
-		if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){
654
+	public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) {
655
+		if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) {
656 656
 			return;
657 657
 		}
658
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
659
-		if ( ! function_exists( 'dbDelta' )) {
660
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
658
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
659
+		if ( ! function_exists('dbDelta')) {
660
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
661 661
 		}
662 662
 		$tableAnalysis = \EEH_Activation::getTableAnalysis();
663
-		$wp_table_name = $tableAnalysis->ensureTableNameHasPrefix( $table_name );
663
+		$wp_table_name = $tableAnalysis->ensureTableNameHasPrefix($table_name);
664 664
 		// do we need to first delete an existing version of this table ?
665
-		if ( $drop_pre_existing_table && $tableAnalysis->tableExists( $wp_table_name ) ){
665
+		if ($drop_pre_existing_table && $tableAnalysis->tableExists($wp_table_name)) {
666 666
 			// ok, delete the table... but ONLY if it's empty
667
-			$deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name );
667
+			$deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name);
668 668
 			// table is NOT empty, are you SURE you want to delete this table ???
669
-			if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
670
-				\EEH_Activation::getTableManager()->dropTable( $wp_table_name );
671
-			} else if ( ! $deleted_safely ) {
669
+			if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) {
670
+				\EEH_Activation::getTableManager()->dropTable($wp_table_name);
671
+			} else if ( ! $deleted_safely) {
672 672
 				// so we should be more cautious rather than just dropping tables so easily
673 673
 				EE_Error::add_persistent_admin_notice(
674
-						'bad_table_' . $wp_table_name . '_detected',
675
-						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' ),
674
+						'bad_table_'.$wp_table_name.'_detected',
675
+						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'),
676 676
 								$wp_table_name,
677 677
 								"<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>",
678 678
 								'<b>wp-config.php</b>',
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 								TRUE );
681 681
 			}
682 682
 		}
683
-		$engine = str_replace( 'ENGINE=', '', $engine );
684
-		\EEH_Activation::getTableManager()->createTable( $table_name, $sql, $engine );
683
+		$engine = str_replace('ENGINE=', '', $engine);
684
+		\EEH_Activation::getTableManager()->createTable($table_name, $sql, $engine);
685 685
 	}
686 686
 
687 687
 
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
 	 *                            'VARCHAR(10)'
700 700
 	 * @return bool|int
701 701
 	 */
702
-	public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){
703
-		return \EEH_Activation::getTableManager()->addColumn( $table_name, $column_name, $column_info );
702
+	public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') {
703
+		return \EEH_Activation::getTableManager()->addColumn($table_name, $column_name, $column_info);
704 704
 	}
705 705
 
706 706
 
@@ -716,8 +716,8 @@  discard block
 block discarded – undo
716 716
 	 * @param string $table_name, without prefixed $wpdb->prefix
717 717
 	 * @return array of database column names
718 718
 	 */
719
-	public static function get_fields_on_table( $table_name = NULL ) {
720
-		return \EEH_Activation::getTableManager()->getTableColumns( $table_name );
719
+	public static function get_fields_on_table($table_name = NULL) {
720
+		return \EEH_Activation::getTableManager()->getTableColumns($table_name);
721 721
 	}
722 722
 
723 723
 
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
 	 * @param string $table_name
732 732
 	 * @return bool
733 733
 	 */
734
-	public static function db_table_is_empty( $table_name ) {
735
-		return \EEH_Activation::getTableAnalysis()->tableIsEmpty( $table_name );
734
+	public static function db_table_is_empty($table_name) {
735
+		return \EEH_Activation::getTableAnalysis()->tableIsEmpty($table_name);
736 736
 }
737 737
 
738 738
 
@@ -745,9 +745,9 @@  discard block
 block discarded – undo
745 745
 	 * @param string $table_name
746 746
 	 * @return bool | int
747 747
 	 */
748
-	public static function delete_db_table_if_empty( $table_name ) {
749
-		if ( \EEH_Activation::getTableAnalysis()->tableIsEmpty( $table_name ) ) {
750
-			return \EEH_Activation::getTableManager()->dropTable( $table_name );
748
+	public static function delete_db_table_if_empty($table_name) {
749
+		if (\EEH_Activation::getTableAnalysis()->tableIsEmpty($table_name)) {
750
+			return \EEH_Activation::getTableManager()->dropTable($table_name);
751 751
 		}
752 752
 		return false;
753 753
 	}
@@ -763,8 +763,8 @@  discard block
 block discarded – undo
763 763
 	 * @param string $table_name
764 764
 	 * @return bool | int
765 765
 	 */
766
-	public static function delete_unused_db_table( $table_name ) {
767
-		return \EEH_Activation::getTableManager()->dropTable( $table_name );
766
+	public static function delete_unused_db_table($table_name) {
767
+		return \EEH_Activation::getTableManager()->dropTable($table_name);
768 768
 	}
769 769
 
770 770
 
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 	 * @param string $index_name
780 780
 	 * @return bool | int
781 781
 	 */
782
-	public static function drop_index( $table_name, $index_name ) {
783
-		return \EEH_Activation::getTableManager()->dropIndex( $table_name, $index_name );
782
+	public static function drop_index($table_name, $index_name) {
783
+		return \EEH_Activation::getTableManager()->dropIndex($table_name, $index_name);
784 784
 	}
785 785
 
786 786
 
@@ -794,27 +794,27 @@  discard block
 block discarded – undo
794 794
 	 * @return boolean success (whether database is setup properly or not)
795 795
 	 */
796 796
 	public static function create_database_tables() {
797
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
797
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
798 798
 		//find the migration script that sets the database to be compatible with the code
799 799
 		$dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms();
800
-		if( $dms_name ){
801
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name );
802
-			$current_data_migration_script->set_migrating( false );
800
+		if ($dms_name) {
801
+			$current_data_migration_script = EE_Registry::instance()->load_dms($dms_name);
802
+			$current_data_migration_script->set_migrating(false);
803 803
 			$current_data_migration_script->schema_changes_before_migration();
804 804
 			$current_data_migration_script->schema_changes_after_migration();
805
-			if( $current_data_migration_script->get_errors() ){
806
-				if( WP_DEBUG ){
807
-					foreach( $current_data_migration_script->get_errors() as $error ){
808
-						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
805
+			if ($current_data_migration_script->get_errors()) {
806
+				if (WP_DEBUG) {
807
+					foreach ($current_data_migration_script->get_errors() as $error) {
808
+						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
809 809
 					}
810
-				}else{
811
-					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' ) );
810
+				} else {
811
+					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'));
812 812
 				}
813 813
 				return false;
814 814
 			}
815 815
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
816
-		}else{
817
-			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__);
816
+		} else {
817
+			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__);
818 818
 			return false;
819 819
 		}
820 820
 		return true;
@@ -834,27 +834,27 @@  discard block
 block discarded – undo
834 834
 	public static function initialize_system_questions() {
835 835
 		// QUESTION GROUPS
836 836
 		global $wpdb;
837
-		$table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question_group' );
837
+		$table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question_group');
838 838
 		$SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0";
839 839
 		// what we have
840
-		$question_groups = $wpdb->get_col( $SQL );
840
+		$question_groups = $wpdb->get_col($SQL);
841 841
 		// check the response
842
-		$question_groups = is_array( $question_groups ) ? $question_groups : array();
842
+		$question_groups = is_array($question_groups) ? $question_groups : array();
843 843
 		// what we should have
844
-		$QSG_systems = array( 1, 2 );
844
+		$QSG_systems = array(1, 2);
845 845
 		// loop thru what we should have and compare to what we have
846
-		foreach ( $QSG_systems as $QSG_system ) {
846
+		foreach ($QSG_systems as $QSG_system) {
847 847
 			// reset values array
848 848
 			$QSG_values = array();
849 849
 			// 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)
850
-			if ( ! in_array( "$QSG_system", $question_groups )) {
850
+			if ( ! in_array("$QSG_system", $question_groups)) {
851 851
 				// add it
852
-				switch ( $QSG_system ) {
852
+				switch ($QSG_system) {
853 853
 
854 854
 					case 1:
855 855
 							$QSG_values = array(
856
-									'QSG_name' => __( 'Personal Information', 'event_espresso' ),
857
-									'QSG_identifier' => 'personal-information-' . time(),
856
+									'QSG_name' => __('Personal Information', 'event_espresso'),
857
+									'QSG_identifier' => 'personal-information-'.time(),
858 858
 									'QSG_desc' => '',
859 859
 									'QSG_order' => 1,
860 860
 									'QSG_show_group_name' => 1,
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
 
867 867
 					case 2:
868 868
 							$QSG_values = array(
869
-									'QSG_name' => __( 'Address Information','event_espresso' ),
870
-									'QSG_identifier' => 'address-information-' . time(),
869
+									'QSG_name' => __('Address Information', 'event_espresso'),
870
+									'QSG_identifier' => 'address-information-'.time(),
871 871
 									'QSG_desc' => '',
872 872
 									'QSG_order' => 2,
873 873
 									'QSG_show_group_name' => 1,
@@ -879,14 +879,14 @@  discard block
 block discarded – undo
879 879
 
880 880
 				}
881 881
 				// make sure we have some values before inserting them
882
-				if ( ! empty( $QSG_values )) {
882
+				if ( ! empty($QSG_values)) {
883 883
 					// insert system question
884 884
 					$wpdb->insert(
885 885
 						$table_name,
886 886
 						$QSG_values,
887
-						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' )
887
+						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d')
888 888
 					);
889
-					$QSG_IDs[ $QSG_system ] = $wpdb->insert_id;
889
+					$QSG_IDs[$QSG_system] = $wpdb->insert_id;
890 890
 				}
891 891
 			}
892 892
 		}
@@ -895,10 +895,10 @@  discard block
 block discarded – undo
895 895
 
896 896
 		// QUESTIONS
897 897
 		global $wpdb;
898
-		$table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question' );
898
+		$table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question');
899 899
 		$SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''";
900 900
 		// what we have
901
-		$questions = $wpdb->get_col( $SQL );
901
+		$questions = $wpdb->get_col($SQL);
902 902
 		// what we should have
903 903
 		$QST_systems = array(
904 904
 			'fname',
@@ -915,25 +915,25 @@  discard block
 block discarded – undo
915 915
 		$order_for_group_1 = 1;
916 916
 		$order_for_group_2 = 1;
917 917
 		// loop thru what we should have and compare to what we have
918
-		foreach ( $QST_systems as $QST_system ) {
918
+		foreach ($QST_systems as $QST_system) {
919 919
 			// reset values array
920 920
 			$QST_values = array();
921 921
 			// if we don't have what we should have
922
-			if ( ! in_array( $QST_system, $questions )) {
922
+			if ( ! in_array($QST_system, $questions)) {
923 923
 				// add it
924
-				switch ( $QST_system ) {
924
+				switch ($QST_system) {
925 925
 
926 926
 					case 'fname':
927 927
 							$QST_values = array(
928
-									'QST_display_text' => __( 'First Name', 'event_espresso' ),
929
-									'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ),
928
+									'QST_display_text' => __('First Name', 'event_espresso'),
929
+									'QST_admin_label' => __('First Name - System Question', 'event_espresso'),
930 930
 									'QST_system' => 'fname',
931 931
 									'QST_type' => 'TEXT',
932 932
 									'QST_required' => 1,
933
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
933
+									'QST_required_text' => __('This field is required', 'event_espresso'),
934 934
 									'QST_order' => 1,
935 935
 									'QST_admin_only' => 0,
936
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
936
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
937 937
 									'QST_wp_user' => self::get_default_creator_id(),
938 938
 									'QST_deleted' => 0
939 939
 								);
@@ -941,15 +941,15 @@  discard block
 block discarded – undo
941 941
 
942 942
 					case 'lname':
943 943
 							$QST_values = array(
944
-									'QST_display_text' => __( 'Last Name', 'event_espresso' ),
945
-									'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ),
944
+									'QST_display_text' => __('Last Name', 'event_espresso'),
945
+									'QST_admin_label' => __('Last Name - System Question', 'event_espresso'),
946 946
 									'QST_system' => 'lname',
947 947
 									'QST_type' => 'TEXT',
948 948
 									'QST_required' => 1,
949
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
949
+									'QST_required_text' => __('This field is required', 'event_espresso'),
950 950
 									'QST_order' => 2,
951 951
 									'QST_admin_only' => 0,
952
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
952
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
953 953
 									'QST_wp_user' => self::get_default_creator_id(),
954 954
 									'QST_deleted' => 0
955 955
 								);
@@ -957,15 +957,15 @@  discard block
 block discarded – undo
957 957
 
958 958
 					case 'email':
959 959
 							$QST_values = array(
960
-									'QST_display_text' => __( 'Email Address', 'event_espresso' ),
961
-									'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ),
960
+									'QST_display_text' => __('Email Address', 'event_espresso'),
961
+									'QST_admin_label' => __('Email Address - System Question', 'event_espresso'),
962 962
 									'QST_system' => 'email',
963 963
 									'QST_type' => 'EMAIL',
964 964
 									'QST_required' => 1,
965
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
965
+									'QST_required_text' => __('This field is required', 'event_espresso'),
966 966
 									'QST_order' => 3,
967 967
 									'QST_admin_only' => 0,
968
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
968
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
969 969
 									'QST_wp_user' => self::get_default_creator_id(),
970 970
 									'QST_deleted' => 0
971 971
 								);
@@ -973,15 +973,15 @@  discard block
 block discarded – undo
973 973
 
974 974
 					case 'address':
975 975
 							$QST_values = array(
976
-									'QST_display_text' => __( 'Address', 'event_espresso' ),
977
-									'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ),
976
+									'QST_display_text' => __('Address', 'event_espresso'),
977
+									'QST_admin_label' => __('Address - System Question', 'event_espresso'),
978 978
 									'QST_system' => 'address',
979 979
 									'QST_type' => 'TEXT',
980 980
 									'QST_required' => 0,
981
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
981
+									'QST_required_text' => __('This field is required', 'event_espresso'),
982 982
 									'QST_order' => 4,
983 983
 									'QST_admin_only' => 0,
984
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
984
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
985 985
 									'QST_wp_user' => self::get_default_creator_id(),
986 986
 									'QST_deleted' => 0
987 987
 								);
@@ -989,15 +989,15 @@  discard block
 block discarded – undo
989 989
 
990 990
 					case 'address2':
991 991
 							$QST_values = array(
992
-									'QST_display_text' => __( 'Address2', 'event_espresso' ),
993
-									'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ),
992
+									'QST_display_text' => __('Address2', 'event_espresso'),
993
+									'QST_admin_label' => __('Address2 - System Question', 'event_espresso'),
994 994
 									'QST_system' => 'address2',
995 995
 									'QST_type' => 'TEXT',
996 996
 									'QST_required' => 0,
997
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
997
+									'QST_required_text' => __('This field is required', 'event_espresso'),
998 998
 									'QST_order' => 5,
999 999
 									'QST_admin_only' => 0,
1000
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1000
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1001 1001
 									'QST_wp_user' => self::get_default_creator_id(),
1002 1002
 									'QST_deleted' => 0
1003 1003
 								);
@@ -1005,15 +1005,15 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 					case 'city':
1007 1007
 							$QST_values = array(
1008
-									'QST_display_text' => __( 'City', 'event_espresso' ),
1009
-									'QST_admin_label' => __( 'City - System Question', 'event_espresso' ),
1008
+									'QST_display_text' => __('City', 'event_espresso'),
1009
+									'QST_admin_label' => __('City - System Question', 'event_espresso'),
1010 1010
 									'QST_system' => 'city',
1011 1011
 									'QST_type' => 'TEXT',
1012 1012
 									'QST_required' => 0,
1013
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1013
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1014 1014
 									'QST_order' => 6,
1015 1015
 									'QST_admin_only' => 0,
1016
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1016
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1017 1017
 									'QST_wp_user' => self::get_default_creator_id(),
1018 1018
 									'QST_deleted' => 0
1019 1019
 								);
@@ -1021,12 +1021,12 @@  discard block
 block discarded – undo
1021 1021
 
1022 1022
 					case 'state':
1023 1023
 							$QST_values = array(
1024
-									'QST_display_text' => __( 'State/Province', 'event_espresso' ),
1025
-									'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ),
1024
+									'QST_display_text' => __('State/Province', 'event_espresso'),
1025
+									'QST_admin_label' => __('State/Province - System Question', 'event_espresso'),
1026 1026
 									'QST_system' => 'state',
1027 1027
 									'QST_type' => 'STATE',
1028 1028
 									'QST_required' => 0,
1029
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1029
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1030 1030
 									'QST_order' => 7,
1031 1031
 									'QST_admin_only' => 0,
1032 1032
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1036,12 +1036,12 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 					case 'country' :
1038 1038
 							$QST_values = array(
1039
-									'QST_display_text' => __( 'Country', 'event_espresso' ),
1040
-									'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ),
1039
+									'QST_display_text' => __('Country', 'event_espresso'),
1040
+									'QST_admin_label' => __('Country - System Question', 'event_espresso'),
1041 1041
 									'QST_system' => 'country',
1042 1042
 									'QST_type' => 'COUNTRY',
1043 1043
 									'QST_required' => 0,
1044
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1044
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1045 1045
 									'QST_order' => 8,
1046 1046
 									'QST_admin_only' => 0,
1047 1047
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1051,15 +1051,15 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
 					case 'zip':
1053 1053
 							$QST_values = array(
1054
-									'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ),
1055
-									'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ),
1054
+									'QST_display_text' => __('Zip/Postal Code', 'event_espresso'),
1055
+									'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'),
1056 1056
 									'QST_system' => 'zip',
1057 1057
 									'QST_type' => 'TEXT',
1058 1058
 									'QST_required' => 0,
1059
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1059
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1060 1060
 									'QST_order' => 9,
1061 1061
 									'QST_admin_only' => 0,
1062
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1062
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1063 1063
 									'QST_wp_user' => self::get_default_creator_id(),
1064 1064
 									'QST_deleted' => 0
1065 1065
 								);
@@ -1067,49 +1067,49 @@  discard block
 block discarded – undo
1067 1067
 
1068 1068
 					case 'phone':
1069 1069
 							$QST_values = array(
1070
-									'QST_display_text' => __( 'Phone Number', 'event_espresso' ),
1071
-									'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ),
1070
+									'QST_display_text' => __('Phone Number', 'event_espresso'),
1071
+									'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'),
1072 1072
 									'QST_system' => 'phone',
1073 1073
 									'QST_type' => 'TEXT',
1074 1074
 									'QST_required' => 0,
1075
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1075
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1076 1076
 									'QST_order' => 10,
1077 1077
 									'QST_admin_only' => 0,
1078
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1078
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1079 1079
 									'QST_wp_user' => self::get_default_creator_id(),
1080 1080
 									'QST_deleted' => 0
1081 1081
 								);
1082 1082
 						break;
1083 1083
 
1084 1084
 				}
1085
-				if ( ! empty( $QST_values )) {
1085
+				if ( ! empty($QST_values)) {
1086 1086
 					// insert system question
1087 1087
 					$wpdb->insert(
1088 1088
 						$table_name,
1089 1089
 						$QST_values,
1090
-						array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' )
1090
+						array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d')
1091 1091
 					);
1092 1092
 					$QST_ID = $wpdb->insert_id;
1093 1093
 
1094 1094
 					// QUESTION GROUP QUESTIONS
1095
-					if(  in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) {
1095
+					if (in_array($QST_system, array('fname', 'lname', 'email'))) {
1096 1096
 						$system_question_we_want = EEM_Question_Group::system_personal;
1097 1097
 					} else {
1098 1098
 						$system_question_we_want = EEM_Question_Group::system_address;
1099 1099
 					}
1100
-					if( isset( $QSG_IDs[ $system_question_we_want ] ) ) {
1101
-						$QSG_ID = $QSG_IDs[ $system_question_we_want ];
1100
+					if (isset($QSG_IDs[$system_question_we_want])) {
1101
+						$QSG_ID = $QSG_IDs[$system_question_we_want];
1102 1102
 					} else {
1103
-						$id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) );
1104
-						if( is_array( $id_col ) ) {
1105
-							$QSG_ID = reset( $id_col );
1103
+						$id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want)));
1104
+						if (is_array($id_col)) {
1105
+							$QSG_ID = reset($id_col);
1106 1106
 						} else {
1107 1107
 							//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
1108 1108
                                                         EE_Log::instance()->log(
1109 1109
                                                                 __FILE__,
1110 1110
                                                                 __FUNCTION__,
1111 1111
                                                                 sprintf(
1112
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'),
1112
+                                                                        __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'),
1113 1113
                                                                         $QST_ID ),
1114 1114
                                                                 'error' );
1115 1115
                                                         continue;
@@ -1118,12 +1118,12 @@  discard block
 block discarded – undo
1118 1118
 
1119 1119
 					// add system questions to groups
1120 1120
 					$wpdb->insert(
1121
-						\EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question_group_question' ),
1122
-						array( 'QSG_ID'    => $QSG_ID,
1121
+						\EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question_group_question'),
1122
+						array('QSG_ID'    => $QSG_ID,
1123 1123
 						       'QST_ID'    => $QST_ID,
1124
-						       'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++
1124
+						       'QGQ_order' => ($QSG_ID === 1) ? $order_for_group_1++ : $order_for_group_2++
1125 1125
 						),
1126
-						array( '%d', '%d', '%d' )
1126
+						array('%d', '%d', '%d')
1127 1127
 					);
1128 1128
 				}
1129 1129
 			}
@@ -1139,11 +1139,11 @@  discard block
 block discarded – undo
1139 1139
 	 *
1140 1140
 	 * @throws \EE_Error
1141 1141
 	 */
1142
-	public static function insert_default_payment_methods(){
1143
-		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1144
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1145
-			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1146
-		}else{
1142
+	public static function insert_default_payment_methods() {
1143
+		if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) {
1144
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
1145
+			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
1146
+		} else {
1147 1147
 			EEM_Payment_Method::instance()->verify_button_urls();
1148 1148
 		}
1149 1149
 	}
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 
1160 1160
 		global $wpdb;
1161 1161
 
1162
-		if ( \EEH_Activation::getTableAnalysis()->tableExists( EEM_Status::instance()->table() ) ) {
1162
+		if (\EEH_Activation::getTableAnalysis()->tableExists(EEM_Status::instance()->table())) {
1163 1163
 
1164 1164
 			$table_name = EEM_Status::instance()->table();
1165 1165
 
@@ -1235,33 +1235,33 @@  discard block
 block discarded – undo
1235 1235
 		$folders = array(
1236 1236
 				EVENT_ESPRESSO_TEMPLATE_DIR,
1237 1237
 				EVENT_ESPRESSO_GATEWAY_DIR,
1238
-				EVENT_ESPRESSO_UPLOAD_DIR . 'logs/',
1239
-				EVENT_ESPRESSO_UPLOAD_DIR . 'css/',
1240
-				EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/'
1238
+				EVENT_ESPRESSO_UPLOAD_DIR.'logs/',
1239
+				EVENT_ESPRESSO_UPLOAD_DIR.'css/',
1240
+				EVENT_ESPRESSO_UPLOAD_DIR.'tickets/'
1241 1241
 		);
1242
-		foreach ( $folders as $folder ) {
1242
+		foreach ($folders as $folder) {
1243 1243
 			try {
1244
-				EEH_File::ensure_folder_exists_and_is_writable( $folder );
1245
-				@ chmod( $folder, 0755 );
1246
-			} catch( EE_Error $e ){
1244
+				EEH_File::ensure_folder_exists_and_is_writable($folder);
1245
+				@ chmod($folder, 0755);
1246
+			} catch (EE_Error $e) {
1247 1247
 				EE_Error::add_error(
1248 1248
 					sprintf(
1249
-						__(  'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ),
1249
+						__('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'),
1250 1250
 						$folder,
1251
-						'<br />' . $e->getMessage()
1251
+						'<br />'.$e->getMessage()
1252 1252
 					),
1253 1253
 					__FILE__, __FUNCTION__, __LINE__
1254 1254
 				);
1255 1255
 				//indicate we'll need to fix this later
1256
-				update_option( EEH_Activation::upload_directories_incomplete_option_name, true );
1256
+				update_option(EEH_Activation::upload_directories_incomplete_option_name, true);
1257 1257
 				return FALSE;
1258 1258
 			}
1259 1259
 		}
1260 1260
 		//just add the .htaccess file to the logs directory to begin with. Even if logging
1261 1261
 		//is disabled, there might be activation errors recorded in there
1262
-		EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' );
1262
+		EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/');
1263 1263
 		//remember EE's folders are all good
1264
-		delete_option( EEH_Activation::upload_directories_incomplete_option_name );
1264
+		delete_option(EEH_Activation::upload_directories_incomplete_option_name);
1265 1265
 		return TRUE;
1266 1266
 	}
1267 1267
 
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
 	 * @return boolean
1275 1275
 	 */
1276 1276
 	public static function upload_directories_incomplete() {
1277
-		return get_option( EEH_Activation::upload_directories_incomplete_option_name, false );
1277
+		return get_option(EEH_Activation::upload_directories_incomplete_option_name, false);
1278 1278
 	}
1279 1279
 
1280 1280
 
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 	 */
1292 1292
 	public static function generate_default_message_templates() {
1293 1293
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
1294
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
1294
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
1295 1295
 		/*
1296 1296
 		 * This first method is taking care of ensuring any default messengers
1297 1297
 		 * that should be made active and have templates generated are done.
@@ -1327,22 +1327,22 @@  discard block
 block discarded – undo
1327 1327
 		$active_messengers = $message_resource_manager->active_messengers();
1328 1328
 		$installed_message_types = $message_resource_manager->installed_message_types();
1329 1329
 		$templates_created = false;
1330
-		foreach ( $active_messengers as $active_messenger ) {
1330
+		foreach ($active_messengers as $active_messenger) {
1331 1331
 			$default_message_type_names_for_messenger = $active_messenger->get_default_message_types();
1332 1332
 			$default_message_type_names_to_activate = array();
1333 1333
 			// looping through each default message type reported by the messenger
1334 1334
 			// and setup the actual message types to activate.
1335
-			foreach ( $default_message_type_names_for_messenger as $default_message_type_name_for_messenger ) {
1335
+			foreach ($default_message_type_names_for_messenger as $default_message_type_name_for_messenger) {
1336 1336
 				// if already active or has already been activated before we skip
1337 1337
 				// (otherwise we might reactivate something user's intentionally deactivated.)
1338 1338
 				// we also skip if the message type is not installed.
1339 1339
 				if (
1340
-					$message_resource_manager->has_message_type_been_activated_for_messenger( $default_message_type_name_for_messenger, $active_messenger->name )
1340
+					$message_resource_manager->has_message_type_been_activated_for_messenger($default_message_type_name_for_messenger, $active_messenger->name)
1341 1341
 					|| $message_resource_manager->is_message_type_active_for_messenger(
1342 1342
 						$active_messenger->name,
1343 1343
 						$default_message_type_name_for_messenger
1344 1344
 					)
1345
-					|| ! isset( $installed_message_types[ $default_message_type_name_for_messenger ] )
1345
+					|| ! isset($installed_message_types[$default_message_type_name_for_messenger])
1346 1346
 				) {
1347 1347
 					continue;
1348 1348
 				}
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
 				false
1356 1356
 			);
1357 1357
 			//activate the templates for these message types
1358
-			if ( ! empty( $default_message_type_names_to_activate ) ) {
1358
+			if ( ! empty($default_message_type_names_to_activate)) {
1359 1359
 				$templates_created = EEH_MSG_Template::generate_new_templates(
1360 1360
 					$active_messenger->name,
1361 1361
 					$default_message_type_names_for_messenger,
@@ -1382,18 +1382,18 @@  discard block
 block discarded – undo
1382 1382
 		EE_Message_Resource_Manager $message_resource_manager
1383 1383
 	) {
1384 1384
 		/** @type EE_messenger[] $messengers_to_generate */
1385
-		$messengers_to_generate = self::_get_default_messengers_to_generate_on_activation( $message_resource_manager );
1385
+		$messengers_to_generate = self::_get_default_messengers_to_generate_on_activation($message_resource_manager);
1386 1386
 		$installed_message_types = $message_resource_manager->installed_message_types();
1387 1387
 		$templates_generated = false;
1388
-		foreach ( $messengers_to_generate as $messenger_to_generate ) {
1388
+		foreach ($messengers_to_generate as $messenger_to_generate) {
1389 1389
 			$default_message_type_names_for_messenger = $messenger_to_generate->get_default_message_types();
1390 1390
 			//verify the default message types match an installed message type.
1391
-			foreach ( $default_message_type_names_for_messenger as $key => $name ) {
1391
+			foreach ($default_message_type_names_for_messenger as $key => $name) {
1392 1392
 				if (
1393
-					! isset( $installed_message_types[ $name ] )
1394
-					|| $message_resource_manager->has_message_type_been_activated_for_messenger( $name, $messenger_to_generate->name )
1393
+					! isset($installed_message_types[$name])
1394
+					|| $message_resource_manager->has_message_type_been_activated_for_messenger($name, $messenger_to_generate->name)
1395 1395
 				) {
1396
-					unset( $default_message_type_names_for_messenger[ $key ] );
1396
+					unset($default_message_type_names_for_messenger[$key]);
1397 1397
 				}
1398 1398
 			}
1399 1399
 			// in previous iterations, the active_messengers option in the db
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 				false
1408 1408
 			);
1409 1409
 			//create any templates needing created (or will reactivate templates already generated as necessary).
1410
-			if ( ! empty( $default_message_type_names_for_messenger ) ) {
1410
+			if ( ! empty($default_message_type_names_for_messenger)) {
1411 1411
 				$templates_generated = EEH_MSG_Template::generate_new_templates(
1412 1412
 					$messenger_to_generate->name,
1413 1413
 					$default_message_type_names_for_messenger,
@@ -1439,18 +1439,18 @@  discard block
 block discarded – undo
1439 1439
 		$has_activated = $message_resource_manager->get_has_activated_messengers_option();
1440 1440
 
1441 1441
 		$messengers_to_generate = array();
1442
-		foreach ( $installed_messengers as $installed_messenger ) {
1442
+		foreach ($installed_messengers as $installed_messenger) {
1443 1443
 			//if installed messenger is a messenger that should be activated on install
1444 1444
 			//and is not already active
1445 1445
 			//and has never been activated
1446 1446
 			if (
1447 1447
 				! $installed_messenger->activate_on_install
1448
-				|| isset( $active_messengers[ $installed_messenger->name ] )
1449
-				|| isset( $has_activated[ $installed_messenger->name ] )
1448
+				|| isset($active_messengers[$installed_messenger->name])
1449
+				|| isset($has_activated[$installed_messenger->name])
1450 1450
 			) {
1451 1451
 				continue;
1452 1452
 			}
1453
-			$messengers_to_generate[ $installed_messenger->name ] = $installed_messenger;
1453
+			$messengers_to_generate[$installed_messenger->name] = $installed_messenger;
1454 1454
 		}
1455 1455
 		return $messengers_to_generate;
1456 1456
 	}
@@ -1475,9 +1475,9 @@  discard block
 block discarded – undo
1475 1475
 	 */
1476 1476
 	public static function validate_messages_system() {
1477 1477
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
1478
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
1478
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
1479 1479
 		$message_resource_manager->validate_active_message_types_are_installed();
1480
-		do_action( 'AHEE__EEH_Activation__validate_messages_system' );
1480
+		do_action('AHEE__EEH_Activation__validate_messages_system');
1481 1481
 	}
1482 1482
 
1483 1483
 
@@ -1490,12 +1490,12 @@  discard block
 block discarded – undo
1490 1490
 	 * 	@static
1491 1491
 	 * 	@return void
1492 1492
 	 */
1493
-	public static function create_no_ticket_prices_array(){
1493
+	public static function create_no_ticket_prices_array() {
1494 1494
 		// this creates an array for tracking events that have no active ticket prices created
1495 1495
 		// this allows us to warn admins of the situation so that it can be corrected
1496
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE );
1497
-		if ( ! $espresso_no_ticket_prices ) {
1498
-			add_option( 'ee_no_ticket_prices', array(), '', FALSE );
1496
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE);
1497
+		if ( ! $espresso_no_ticket_prices) {
1498
+			add_option('ee_no_ticket_prices', array(), '', FALSE);
1499 1499
 		}
1500 1500
 	}
1501 1501
 
@@ -1520,24 +1520,24 @@  discard block
 block discarded – undo
1520 1520
 	 * @global wpdb $wpdb
1521 1521
 	 * @throws \EE_Error
1522 1522
 	 */
1523
-	public static function delete_all_espresso_cpt_data(){
1523
+	public static function delete_all_espresso_cpt_data() {
1524 1524
 		global $wpdb;
1525 1525
 		//get all the CPT post_types
1526 1526
 		$ee_post_types = array();
1527
-		foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){
1528
-			if ( method_exists( $model_name, 'instance' )) {
1529
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1530
-				if ( $model_obj instanceof EEM_CPT_Base ) {
1531
-					$ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type());
1527
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1528
+			if (method_exists($model_name, 'instance')) {
1529
+				$model_obj = call_user_func(array($model_name, 'instance'));
1530
+				if ($model_obj instanceof EEM_CPT_Base) {
1531
+					$ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type());
1532 1532
 				}
1533 1533
 			}
1534 1534
 		}
1535 1535
 		//get all our CPTs
1536
-		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")";
1536
+		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")";
1537 1537
 		$cpt_ids = $wpdb->get_col($query);
1538 1538
 		//delete each post meta and term relations too
1539
-		foreach($cpt_ids as $post_id){
1540
-			wp_delete_post($post_id,true);
1539
+		foreach ($cpt_ids as $post_id) {
1540
+			wp_delete_post($post_id, true);
1541 1541
 		}
1542 1542
 	}
1543 1543
 
@@ -1549,12 +1549,12 @@  discard block
 block discarded – undo
1549 1549
 	public static function drop_espresso_tables() {
1550 1550
 		$tables = array();
1551 1551
 		// load registry
1552
-		foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){
1553
-			if ( method_exists( $model_name, 'instance' )) {
1554
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1555
-				if ( $model_obj instanceof EEM_Base ) {
1556
-					foreach ( $model_obj->get_tables() as $table ) {
1557
-						if ( strpos( $table->get_table_name(), 'esp_' )
1552
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1553
+			if (method_exists($model_name, 'instance')) {
1554
+				$model_obj = call_user_func(array($model_name, 'instance'));
1555
+				if ($model_obj instanceof EEM_Base) {
1556
+					foreach ($model_obj->get_tables() as $table) {
1557
+						if (strpos($table->get_table_name(), 'esp_')
1558 1558
 							&& 
1559 1559
 							( 
1560 1560
 								is_main_site()//main site? nuke them all
@@ -1577,10 +1577,10 @@  discard block
 block discarded – undo
1577 1577
 			'esp_promotion_rule',
1578 1578
 			'esp_rule'
1579 1579
 		);
1580
-		foreach( $tables_without_models as $table ){
1580
+		foreach ($tables_without_models as $table) {
1581 1581
 			$tables[] = $table;
1582 1582
 		}
1583
-		return \EEH_Activation::getTableManager()->dropTables( $tables );
1583
+		return \EEH_Activation::getTableManager()->dropTables($tables);
1584 1584
 	}
1585 1585
 
1586 1586
 	/**
@@ -1592,8 +1592,8 @@  discard block
 block discarded – undo
1592 1592
 	 * @param array $table_names
1593 1593
 	 * @return array of table names which we deleted
1594 1594
 	 */
1595
-	public static function drop_tables( $table_names ) {
1596
-		return \EEH_Activation::getTableManager()->dropTables( $table_names );
1595
+	public static function drop_tables($table_names) {
1596
+		return \EEH_Activation::getTableManager()->dropTables($table_names);
1597 1597
 	}
1598 1598
 	/**
1599 1599
 	 * plugin_uninstall
@@ -1603,7 +1603,7 @@  discard block
 block discarded – undo
1603 1603
 	 * @param bool $remove_all
1604 1604
 	 * @return void
1605 1605
 	 */
1606
-	public static function delete_all_espresso_tables_and_data( $remove_all = true ) {
1606
+	public static function delete_all_espresso_tables_and_data($remove_all = true) {
1607 1607
 		global $wpdb;
1608 1608
 		self::drop_espresso_tables();
1609 1609
 
@@ -1641,50 +1641,50 @@  discard block
 block discarded – undo
1641 1641
 			'ee_job_parameters_' => false,
1642 1642
 			'ee_upload_directories_incomplete' => true,
1643 1643
 		);
1644
-		if( is_main_site() ) {
1645
-			$wp_options_to_delete[ 'ee_network_config' ] = true;
1644
+		if (is_main_site()) {
1645
+			$wp_options_to_delete['ee_network_config'] = true;
1646 1646
 		}
1647 1647
 
1648 1648
 		$undeleted_options = array();
1649
-		foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) {
1649
+		foreach ($wp_options_to_delete as $option_name => $no_wildcard) {
1650 1650
 
1651
-			if( $no_wildcard ){
1652
-				if( ! delete_option( $option_name ) ){
1651
+			if ($no_wildcard) {
1652
+				if ( ! delete_option($option_name)) {
1653 1653
 					$undeleted_options[] = $option_name;
1654 1654
 				}
1655
-			}else{
1656
-				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1657
-				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1658
-					if( ! delete_option( $option_name_from_wildcard ) ){
1655
+			} else {
1656
+				$option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'");
1657
+				foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) {
1658
+					if ( ! delete_option($option_name_from_wildcard)) {
1659 1659
 						$undeleted_options[] = $option_name_from_wildcard;
1660 1660
 					}
1661 1661
 				}
1662 1662
 			}
1663 1663
 		}
1664 1664
                 //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1665
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1665
+                remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10);
1666 1666
 
1667
-		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1667
+		if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) {
1668 1668
 			$db_update_sans_ee4 = array();
1669
-			foreach($espresso_db_update as $version => $times_activated){
1670
-				if( (string)$version[0] === '3'){//if its NON EE4
1669
+			foreach ($espresso_db_update as $version => $times_activated) {
1670
+				if ((string) $version[0] === '3') {//if its NON EE4
1671 1671
 					$db_update_sans_ee4[$version] = $times_activated;
1672 1672
 				}
1673 1673
 			}
1674
-			update_option( 'espresso_db_update', $db_update_sans_ee4 );
1674
+			update_option('espresso_db_update', $db_update_sans_ee4);
1675 1675
 		}
1676 1676
 
1677 1677
 		$errors = '';
1678
-		if ( ! empty( $undeleted_options )) {
1678
+		if ( ! empty($undeleted_options)) {
1679 1679
 			$errors .= sprintf(
1680
-				__( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ),
1680
+				__('The following wp-options could not be deleted: %s%s', 'event_espresso'),
1681 1681
 				'<br/>',
1682
-				implode( ',<br/>', $undeleted_options )
1682
+				implode(',<br/>', $undeleted_options)
1683 1683
 			);
1684 1684
 
1685 1685
 		}
1686
-		if ( ! empty( $errors ) ) {
1687
-			EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ );
1686
+		if ( ! empty($errors)) {
1687
+			EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__);
1688 1688
 		}
1689 1689
 	}
1690 1690
 
@@ -1694,10 +1694,10 @@  discard block
 block discarded – undo
1694 1694
 	 */
1695 1695
 	public static function last_wpdb_error_code() {
1696 1696
 		global $wpdb;
1697
-		if( $wpdb->use_mysqli ) {
1698
-			return mysqli_errno( $wpdb->dbh );
1697
+		if ($wpdb->use_mysqli) {
1698
+			return mysqli_errno($wpdb->dbh);
1699 1699
 		} else {
1700
-			return mysql_errno( $wpdb->dbh );
1700
+			return mysql_errno($wpdb->dbh);
1701 1701
 		}
1702 1702
 	}
1703 1703
 
@@ -1708,14 +1708,14 @@  discard block
 block discarded – undo
1708 1708
 	 * @param string $table_name with or without $wpdb->prefix
1709 1709
 	 * @return boolean
1710 1710
 	 */
1711
-	public static function table_exists( $table_name ){
1712
-		return \EEH_Activation::getTableAnalysis()->tableExists( $table_name );
1711
+	public static function table_exists($table_name) {
1712
+		return \EEH_Activation::getTableAnalysis()->tableExists($table_name);
1713 1713
 	}
1714 1714
 
1715 1715
 	/**
1716 1716
 	 * Resets the cache on EEH_Activation
1717 1717
 	 */
1718
-	public static function reset(){
1718
+	public static function reset() {
1719 1719
 		self::$_default_creator_id = NULL;
1720 1720
 		self::$_initialized_db_content_already_in_this_request = false;
1721 1721
 	}
Please login to merge, or discard this patch.
core/services/database/TableAnalysis.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 * @param string $table_name
25 25
 	 * @return string $tableName, having ensured it has the wpdb prefix on the front
26 26
 	 */
27
-	public function ensureTableNameHasPrefix( $table_name )
27
+	public function ensureTableNameHasPrefix($table_name)
28 28
 	{
29 29
 		global $wpdb;
30
-		return strpos( $table_name, $wpdb->base_prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name;
30
+		return strpos($table_name, $wpdb->base_prefix) === 0 ? $table_name : $wpdb->prefix.$table_name;
31 31
 	}
32 32
 
33 33
 
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	 * @param $table_name
37 37
 	 * @return bool
38 38
 	 */
39
-	public function tableIsEmpty( $table_name )
39
+	public function tableIsEmpty($table_name)
40 40
 	{
41 41
 		global $wpdb;
42
-		$table_name = $this->ensureTableNameHasPrefix( $table_name );
43
-		if ( $this->tableExists( $table_name ) ) {
44
-			$count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" );
45
-			return absint( $count ) === 0 ? true : false;
42
+		$table_name = $this->ensureTableNameHasPrefix($table_name);
43
+		if ($this->tableExists($table_name)) {
44
+			$count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
45
+			return absint($count) === 0 ? true : false;
46 46
 		}
47 47
 		return false;
48 48
 	}
@@ -53,24 +53,24 @@  discard block
 block discarded – undo
53 53
 	 * @param $table_name
54 54
 	 * @return bool
55 55
 	 */
56
-	public function tableExists( $table_name )
56
+	public function tableExists($table_name)
57 57
 	{
58 58
 		global $wpdb, $EZSQL_ERROR;
59
-		$table_name = $this->ensureTableNameHasPrefix( $table_name );
59
+		$table_name = $this->ensureTableNameHasPrefix($table_name);
60 60
 		//ignore if this causes an sql error
61 61
 		$old_error = $wpdb->last_error;
62 62
 		$old_suppress_errors = $wpdb->suppress_errors();
63
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
63
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
64 64
 		$ezsql_error_cache = $EZSQL_ERROR;
65
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
66
-		$wpdb->show_errors( $old_show_errors_value );
67
-		$wpdb->suppress_errors( $old_suppress_errors );
65
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
66
+		$wpdb->show_errors($old_show_errors_value);
67
+		$wpdb->suppress_errors($old_suppress_errors);
68 68
 		$new_error = $wpdb->last_error;
69 69
 		$wpdb->last_error = $old_error;
70 70
 		$EZSQL_ERROR = $ezsql_error_cache;
71 71
 		//if there was a table doesn't exist error
72
-		if( ! empty( $new_error ) ) {
73
-			if(
72
+		if ( ! empty($new_error)) {
73
+			if (
74 74
 				in_array(
75 75
 					\EEH_Activation::last_wpdb_error_code(),
76 76
 					array(
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 					)
81 81
 				)
82 82
 				||
83
-				preg_match( '~^Table .* doesn\'t exist~', $new_error ) //in case not using mysql and error codes aren't reliable, just check for this error string
83
+				preg_match('~^Table .* doesn\'t exist~', $new_error) //in case not using mysql and error codes aren't reliable, just check for this error string
84 84
 			) {
85 85
 				return false;
86 86
 			} else {
87 87
 				//log this because that's weird. Just use the normal PHP error log
88 88
 				error_log(
89 89
 					sprintf(
90
-						__( 'Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso' ),
90
+						__('Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso'),
91 91
 					$new_error
92 92
 					)
93 93
 				);
Please login to merge, or discard this patch.
core/libraries/messages/messenger/EE_Html_messenger.class.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'NO direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 	public function __construct() {
44 44
 		//set properties
45 45
 		$this->name = 'html';
46
-		$this->description = __( 'This messenger outputs a message to a browser for display.', 'event_espresso' );
46
+		$this->description = __('This messenger outputs a message to a browser for display.', 'event_espresso');
47 47
 		$this->label = array(
48
-			'singular' => __( 'html', 'event_espresso' ),
49
-			'plural'   => __( 'html', 'event_espresso' ),
48
+			'singular' => __('html', 'event_espresso'),
49
+			'plural'   => __('html', 'event_espresso'),
50 50
 		);
51 51
 		$this->activate_on_install = true;
52 52
 		// add the "powered by EE" credit link to the HTML receipt and invoice
53 53
 		add_filter(
54 54
 			'FHEE__EE_Html_messenger___send_message__main_body',
55
-			array( $this, 'add_powered_by_credit_link_to_receipt_and_invoice' ),
55
+			array($this, 'add_powered_by_credit_link_to_receipt_and_invoice'),
56 56
 			10,
57 57
 			3
58 58
 		);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @see abstract declaration in EE_messenger for details.
92 92
 	 */
93 93
 	protected function _set_admin_pages() {
94
-		$this->admin_registered_pages = array( 'events_edit' => true );
94
+		$this->admin_registered_pages = array('events_edit' => true);
95 95
 	}
96 96
 
97 97
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	protected function _set_validator_config() {
112 112
 		$this->_validator_config = array(
113 113
 			'subject'                       => array(
114
-				'shortcodes' => array( 'organization', 'primary_registration_details', 'email', 'transaction' ),
114
+				'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction'),
115 115
 			),
116 116
 			'content'                       => array(
117 117
 				'shortcodes' => array(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 					'primary_registration_list',
138 138
 					'event_author',
139 139
 				),
140
-				'required'   => array( '[EVENT_LIST]' ),
140
+				'required'   => array('[EVENT_LIST]'),
141 141
 			),
142 142
 			'ticket_list'                   => array(
143 143
 				'shortcodes' => array(
@@ -148,39 +148,39 @@  discard block
 block discarded – undo
148 148
 					'line_item_list',
149 149
 					'venue',
150 150
 				),
151
-				'required'   => array( '[TICKET_LIST]' ),
151
+				'required'   => array('[TICKET_LIST]'),
152 152
 			),
153 153
 			'ticket_line_item_no_pms'       => array(
154
-				'shortcodes' => array( 'line_item', 'ticket' ),
155
-				'required'   => array( '[TICKET_LINE_ITEM_LIST]' ),
154
+				'shortcodes' => array('line_item', 'ticket'),
155
+				'required'   => array('[TICKET_LINE_ITEM_LIST]'),
156 156
 			),
157 157
 			'ticket_line_item_pms'          => array(
158
-				'shortcodes' => array( 'line_item', 'ticket', 'line_item_list' ),
159
-				'required'   => array( '[TICKET_LINE_ITEM_LIST]' ),
158
+				'shortcodes' => array('line_item', 'ticket', 'line_item_list'),
159
+				'required'   => array('[TICKET_LINE_ITEM_LIST]'),
160 160
 			),
161 161
 			'price_modifier_line_item_list' => array(
162
-				'shortcodes' => array( 'line_item' ),
163
-				'required'   => array( '[PRICE_MODIFIER_LINE_ITEM_LIST]' ),
162
+				'shortcodes' => array('line_item'),
163
+				'required'   => array('[PRICE_MODIFIER_LINE_ITEM_LIST]'),
164 164
 			),
165 165
 			'datetime_list'                 => array(
166
-				'shortcodes' => array( 'datetime' ),
167
-				'required'   => array( '[DATETIME_LIST]' ),
166
+				'shortcodes' => array('datetime'),
167
+				'required'   => array('[DATETIME_LIST]'),
168 168
 			),
169 169
 			'attendee_list'                 => array(
170
-				'shortcodes' => array( 'attendee' ),
171
-				'required'   => array( '[ATTENDEE_LIST]' ),
170
+				'shortcodes' => array('attendee'),
171
+				'required'   => array('[ATTENDEE_LIST]'),
172 172
 			),
173 173
 			'tax_line_item_list'            => array(
174
-				'shortcodes' => array( 'line_item' ),
175
-				'required'   => array( '[TAX_LINE_ITEM_LIST]' ),
174
+				'shortcodes' => array('line_item'),
175
+				'required'   => array('[TAX_LINE_ITEM_LIST]'),
176 176
 			),
177 177
 			'additional_line_item_list'     => array(
178
-				'shortcodes' => array( 'line_item' ),
179
-				'required'   => array( '[ADDITIONAL_LINE_ITEM_LIST]' ),
178
+				'shortcodes' => array('line_item'),
179
+				'required'   => array('[ADDITIONAL_LINE_ITEM_LIST]'),
180 180
 			),
181 181
 			'payment_list'                  => array(
182
-				'shortcodes' => array( 'payment' ),
183
-				'required'   => array( '[PAYMENT_LIST_*]' ),
182
+				'shortcodes' => array('payment'),
183
+				'required'   => array('[PAYMENT_LIST_*]'),
184 184
 			),
185 185
 		);
186 186
 	}
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 	 * @param string $sending_messenger_name the name of the sending messenger so we only set the hooks needed.
197 197
 	 * @return void
198 198
 	 */
199
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
200
-		if ( $sending_messenger_name = 'pdf' ) {
201
-			add_filter( 'EE_messenger__get_variation__variation', array( $this, 'add_html_css' ), 10, 8 );
199
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
200
+		if ($sending_messenger_name = 'pdf') {
201
+			add_filter('EE_messenger__get_variation__variation', array($this, 'add_html_css'), 10, 8);
202 202
 		}
203 203
 	}
204 204
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public function enqueue_scripts_styles() {
249 249
 		parent::enqueue_scripts_styles();
250
-		do_action( 'AHEE__EE_Html_messenger__enqueue_scripts_styles' );
250
+		do_action('AHEE__EE_Html_messenger__enqueue_scripts_styles');
251 251
 	}
252 252
 
253 253
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		$this->_template_fields = array(
276 276
 			'subject' => array(
277 277
 				'input'      => 'text',
278
-				'label'      => __( 'Page Title', 'event_espresso' ),
278
+				'label'      => __('Page Title', 'event_espresso'),
279 279
 				'type'       => 'string',
280 280
 				'required'   => true,
281 281
 				'validation' => true,
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 				'content' => array(
289 289
 					'main'                          => array(
290 290
 						'input'      => 'wp_editor',
291
-						'label'      => __( 'Main Content', 'event_espresso' ),
291
+						'label'      => __('Main Content', 'event_espresso'),
292 292
 						'type'       => 'string',
293 293
 						'required'   => true,
294 294
 						'validation' => true,
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 						'validation'          => true,
304 304
 						'format'              => '%s',
305 305
 						'rows'                => '15',
306
-						'shortcodes_required' => array( '[EVENT_LIST]' ),
306
+						'shortcodes_required' => array('[EVENT_LIST]'),
307 307
 					),
308 308
 					'ticket_list'                   => array(
309 309
 						'input'               => 'textarea',
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 						'format'              => '%s',
315 315
 						'css_class'           => 'large-text',
316 316
 						'rows'                => '10',
317
-						'shortcodes_required' => array( '[TICKET_LIST]' ),
317
+						'shortcodes_required' => array('[TICKET_LIST]'),
318 318
 					),
319 319
 					'ticket_line_item_no_pms'       => array(
320 320
 						'input'               => 'textarea',
321
-						'label'               => '[TICKET_LINE_ITEM_LIST] <br>' . __(
321
+						'label'               => '[TICKET_LINE_ITEM_LIST] <br>'.__(
322 322
 								'Ticket Line Item List with no Price Modifiers',
323 323
 								'event_espresso'
324 324
 							),
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 						'format'              => '%s',
329 329
 						'css_class'           => 'large-text',
330 330
 						'rows'                => '5',
331
-						'shortcodes_required' => array( '[TICKET_LINE_ITEM_LIST]' ),
331
+						'shortcodes_required' => array('[TICKET_LINE_ITEM_LIST]'),
332 332
 					),
333 333
 					'ticket_line_item_pms'          => array(
334 334
 						'input'               => 'textarea',
335
-						'label'               => '[TICKET_LINE_ITEM_LIST] <br>' . __(
335
+						'label'               => '[TICKET_LINE_ITEM_LIST] <br>'.__(
336 336
 								'Ticket Line Item List with Price Modifiers',
337 337
 								'event_espresso'
338 338
 							),
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 						'format'              => '%s',
343 343
 						'css_class'           => 'large-text',
344 344
 						'rows'                => '5',
345
-						'shortcodes_required' => array( '[TICKET_LINE_ITEM_LIST]' ),
345
+						'shortcodes_required' => array('[TICKET_LINE_ITEM_LIST]'),
346 346
 					),
347 347
 					'price_modifier_line_item_list' => array(
348 348
 						'input'               => 'textarea',
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 						'format'              => '%s',
354 354
 						'css_class'           => 'large-text',
355 355
 						'rows'                => '5',
356
-						'shortcodes_required' => array( '[PRICE_MODIFIER_LINE_ITEM_LIST]' ),
356
+						'shortcodes_required' => array('[PRICE_MODIFIER_LINE_ITEM_LIST]'),
357 357
 					),
358 358
 					'datetime_list'                 => array(
359 359
 						'input'               => 'textarea',
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 						'format'              => '%s',
365 365
 						'css_class'           => 'large-text',
366 366
 						'rows'                => '5',
367
-						'shortcodes_required' => array( '[DATETIME_LIST]' ),
367
+						'shortcodes_required' => array('[DATETIME_LIST]'),
368 368
 					),
369 369
 					'attendee_list'                 => array(
370 370
 						'input'               => 'textarea',
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 						'format'              => '%s',
376 376
 						'css_class'           => 'large-text',
377 377
 						'rows'                => '5',
378
-						'shortcodes_required' => array( '[ATTENDEE_LIST]' ),
378
+						'shortcodes_required' => array('[ATTENDEE_LIST]'),
379 379
 					),
380 380
 					'tax_line_item_list'            => array(
381 381
 						'input'               => 'textarea',
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 						'format'              => '%s',
387 387
 						'css_class'           => 'large-text',
388 388
 						'rows'                => '5',
389
-						'shortcodes_required' => array( '[TAX_LINE_ITEM_LIST]' ),
389
+						'shortcodes_required' => array('[TAX_LINE_ITEM_LIST]'),
390 390
 					),
391 391
 					'additional_line_item_list'     => array(
392 392
 						'input'               => 'textarea',
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 						'format'              => '%s',
398 398
 						'css_class'           => 'large-text',
399 399
 						'rows'                => '5',
400
-						'shortcodes_required' => array( '[ADDITIONAL_LINE_ITEM_LIST]' ),
400
+						'shortcodes_required' => array('[ADDITIONAL_LINE_ITEM_LIST]'),
401 401
 					),
402 402
 					'payment_list'                  => array(
403 403
 						'input'               => 'textarea',
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 						'format'              => '%s',
409 409
 						'css_class'           => 'large-text',
410 410
 						'rows'                => '5',
411
-						'shortcodes_required' => array( '[PAYMENT_LIST_*]' ),
411
+						'shortcodes_required' => array('[PAYMENT_LIST_*]'),
412 412
 					),
413 413
 				),
414 414
 			),
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * @since 4.5.0
423 423
 	 */
424 424
 	protected function _set_default_message_types() {
425
-		$this->_default_message_types = array( 'receipt', 'invoice' );
425
+		$this->_default_message_types = array('receipt', 'invoice');
426 426
 	}
427 427
 
428 428
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	 * @since 4.5.0
433 433
 	 */
434 434
 	protected function _set_valid_message_types() {
435
-		$this->_valid_message_types = array( 'receipt', 'invoice' );
435
+		$this->_valid_message_types = array('receipt', 'invoice');
436 436
 	}
437 437
 
438 438
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	protected function _send_message() {
447 447
 		$this->_template_args = array(
448
-			'page_title' => html_entity_decode( stripslashes( $this->_subject ), ENT_QUOTES, "UTF-8" ),
448
+			'page_title' => html_entity_decode(stripslashes($this->_subject), ENT_QUOTES, "UTF-8"),
449 449
 			'base_css'   => $this->get_variation(
450 450
 				$this->_tmp_pack,
451 451
 				$this->_incoming_message_type->name,
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 			),
484 484
 		);
485 485
 		$this->_deregister_wp_hooks();
486
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) );
486
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
487 487
 		echo $this->_get_main_template();
488 488
 		exit();
489 489
 	}
@@ -499,16 +499,16 @@  discard block
 block discarded – undo
499 499
 	 * @return void
500 500
 	 */
501 501
 	protected function _deregister_wp_hooks() {
502
-		remove_all_actions( 'wp_head' );
503
-		remove_all_actions( 'wp_footer' );
504
-		remove_all_actions( 'wp_print_footer_scripts' );
505
-		remove_all_actions( 'wp_enqueue_scripts' );
502
+		remove_all_actions('wp_head');
503
+		remove_all_actions('wp_footer');
504
+		remove_all_actions('wp_print_footer_scripts');
505
+		remove_all_actions('wp_enqueue_scripts');
506 506
 		global $wp_scripts, $wp_styles;
507 507
 		$wp_scripts = $wp_styles = array();
508 508
 		//just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load.
509
-		add_action( 'wp_footer', 'wp_print_footer_scripts' );
510
-		add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
511
-		add_action( 'wp_head', 'wp_enqueue_scripts' );
509
+		add_action('wp_footer', 'wp_print_footer_scripts');
510
+		add_action('wp_print_footer_scripts', '_wp_footer_scripts');
511
+		add_action('wp_head', 'wp_enqueue_scripts');
512 512
 	}
513 513
 
514 514
 
@@ -520,11 +520,11 @@  discard block
 block discarded – undo
520 520
 	 * @param bool $preview
521 521
 	 * @return string
522 522
 	 */
523
-	protected function _get_main_template( $preview = false ) {
524
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, 'main' );
523
+	protected function _get_main_template($preview = false) {
524
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, 'main');
525 525
 		//include message type as a template arg
526 526
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
527
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, true );
527
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, true);
528 528
 	}
529 529
 
530 530
 
@@ -557,10 +557,10 @@  discard block
 block discarded – undo
557 557
 		EE_message_type $incoming_message_type
558 558
 	) {
559 559
 		if (
560
-			( $incoming_message_type->name === 'invoice' || $incoming_message_type->name === 'receipt' )
561
-			&& apply_filters( 'FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', true )
560
+			($incoming_message_type->name === 'invoice' || $incoming_message_type->name === 'receipt')
561
+			&& apply_filters('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', true)
562 562
 		) {
563
-			$content .= \EEH_Template::powered_by_event_espresso( 'aln-cntr' ) . EEH_HTML::div( EEH_HTML::p('&nbsp;') );
563
+			$content .= \EEH_Template::powered_by_event_espresso('aln-cntr').EEH_HTML::div(EEH_HTML::p('&nbsp;'));
564 564
 		}
565 565
 		return $content;
566 566
 	}
Please login to merge, or discard this patch.
modules/gateways/Invoice/lib/invoice_functions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
  * @param $class_file
9 9
  * @return array
10 10
  */
11
-function espresso_invoice_template_files( $class_file) {
11
+function espresso_invoice_template_files($class_file) {
12 12
 	// read our template dir and build an array of files
13
-	$dhandle = opendir(dirname($class_file) . '/lib/templates/css/'); //If the template files have been moved to the uploads folder
13
+	$dhandle = opendir(dirname($class_file).'/lib/templates/css/'); //If the template files have been moved to the uploads folder
14 14
 	//} else return FALSE;
15 15
 
16 16
 	$files = array();
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
  * @param string $selected
51 51
  * @return string
52 52
  */
53
-function espresso_invoice_is_selected( $input_item, $selected='') {
54
-	if ( $input_item === $selected ) {
53
+function espresso_invoice_is_selected($input_item, $selected = '') {
54
+	if ($input_item === $selected) {
55 55
 		return 'selected="selected"';
56 56
 	} else {
57 57
 		return '';
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Unknown_1_0_0.core.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 use EventEspresso\core\services\database\TableAnalysis;
3 3
 use EventEspresso\core\services\database\TableManager;
4 4
 
5
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {
5
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
6 6
 	exit('No direct script access allowed');
7 7
 }
8 8
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 /**
22 22
  */
23
-class EE_DMS_Unknown_1_0_0 extends EE_Data_Migration_Script_Base{
23
+class EE_DMS_Unknown_1_0_0 extends EE_Data_Migration_Script_Base {
24 24
 
25 25
 	/**
26 26
 	 * Returns whether or not this data migration script can operate on the given version of the database.
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	 * @param TableManager  $table_manager
48 48
 	 * @param TableAnalysis $table_analysis
49 49
 	 */
50
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
50
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
51 51
 		$this->_migration_stages = array();
52 52
 		$this->_pretty_name = __("Fatal Uncatchable Error Occurred", "event_espresso");
53 53
 //		dd($this);
54
-		parent::__construct( $table_manager, $table_analysis );
54
+		parent::__construct($table_manager, $table_analysis);
55 55
 	}
56 56
 	public function migration_page_hooks() {
57 57
 
Please login to merge, or discard this patch.
core/services/database/TableManager.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@
 block discarded – undo
35 35
 
36 36
 
37 37
 	/**
38
-     * @param string $table_name which can optionally start with $wpdb->prefix or not
39
-     * @param string $column_name
40
-     * @param string $column_info
41
-     * @return bool|false|int
42
-     */
43
-    public function addColumn( $table_name, $column_name, $column_info='INT UNSIGNED NOT NULL' )
38
+	 * @param string $table_name which can optionally start with $wpdb->prefix or not
39
+	 * @param string $column_name
40
+	 * @param string $column_info
41
+	 * @return bool|false|int
42
+	 */
43
+	public function addColumn( $table_name, $column_name, $column_info='INT UNSIGNED NOT NULL' )
44 44
 	{
45 45
 		if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){
46 46
 			return FALSE;
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\database;
3 3
 
4
-defined( 'EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed');
4
+defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed');
5 5
 /**
6 6
  *
7 7
  * Class TableManager
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param TableAnalysis $TableAnalysis
30 30
 	 */
31
-	public function __construct( TableAnalysis $TableAnalysis ) {
31
+	public function __construct(TableAnalysis $TableAnalysis) {
32 32
 		$this->table_analysis = $TableAnalysis;
33 33
 	}
34 34
 	
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
 	 * @throws \EE_Error
39 39
 	 */
40 40
 	protected function getTableAnalysis() {
41
-		if( $this->table_analysis instanceof TableAnalysis ) {
41
+		if ($this->table_analysis instanceof TableAnalysis) {
42 42
 			return $this->table_analysis;
43 43
 		} else {
44 44
 			throw new \EE_Error( 
45 45
 				sprintf( 
46
-					__( 'Table analysis class on class %1$s is not set properly.', 'event_espresso'), 
47
-					get_class( $this ) 
46
+					__('Table analysis class on class %1$s is not set properly.', 'event_espresso'), 
47
+					get_class($this) 
48 48
 				) 
49 49
 			);
50 50
 		}
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
      * @param string $column_info
59 59
      * @return bool|false|int
60 60
      */
61
-    public function addColumn( $table_name, $column_name, $column_info='INT UNSIGNED NOT NULL' )
61
+    public function addColumn($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL')
62 62
 	{
63
-		if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){
63
+		if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) {
64 64
 			return FALSE;
65 65
 		}
66 66
 		global $wpdb;
67
-		$full_table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix( $table_name );
67
+		$full_table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name);
68 68
 		$columns = $this->getTableColumns($table_name);
69
-		if( !in_array( $column_name, $columns)){
70
-			$alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info";
69
+		if ( ! in_array($column_name, $columns)) {
70
+			$alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info";
71 71
 			return $wpdb->query($alter_query);
72 72
 		}
73 73
 		return TRUE;
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	 * @param string $table_name
81 81
 	 * @return array
82 82
 	 */
83
-	public function getTableColumns( $table_name )
83
+	public function getTableColumns($table_name)
84 84
 	{
85 85
 		global $wpdb;
86
-		$table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix( $table_name );
86
+		$table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name);
87 87
 		$fieldArray = array();
88
-		if ( ! empty( $table_name )) {
88
+		if ( ! empty($table_name)) {
89 89
 			$columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name ");
90 90
 			if ($columns !== FALSE) {
91
-				foreach( $columns as $column ){
91
+				foreach ($columns as $column) {
92 92
 					$fieldArray[] = $column->Field;
93 93
 				}
94 94
 			}
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 	 * @param string $table_name
105 105
 	 * @return int
106 106
 	 */
107
-	public function dropTable( $table_name )
107
+	public function dropTable($table_name)
108 108
 	{
109 109
 		global $wpdb;
110
-		if (  $this->getTableAnalysis()->tableExists( $table_name ) ) {
111
-			$table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix( $table_name );
112
-			return $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
110
+		if ($this->getTableAnalysis()->tableExists($table_name)) {
111
+			$table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name);
112
+			return $wpdb->query("DROP TABLE IF EXISTS $table_name");
113 113
 		}
114 114
 		return 0;
115 115
 	}
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
 	 * @param array $table_names
123 123
 	 * @return array of table names which we deleted
124 124
 	 */
125
-	public function dropTables( $table_names )
125
+	public function dropTables($table_names)
126 126
 	{
127 127
 		$tables_to_delete = array();
128
-		foreach( $table_names as $table_name ) {
129
-			$table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix( $table_name );
130
-			if( $this->getTableAnalysis()->tableExists( $table_name ) ) {
128
+		foreach ($table_names as $table_name) {
129
+			$table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name);
130
+			if ($this->getTableAnalysis()->tableExists($table_name)) {
131 131
 				$tables_to_delete[] = $table_name;
132 132
 			}
133 133
 		}
134 134
 		global $wpdb;
135
-		$wpdb->query( 'DROP TABLE ' . implode( ', ', $tables_to_delete ) );
135
+		$wpdb->query('DROP TABLE '.implode(', ', $tables_to_delete));
136 136
 		return $tables_to_delete;
137 137
 	}
138 138
 
@@ -145,19 +145,19 @@  discard block
 block discarded – undo
145 145
 	 * @param string $indexName
146 146
 	 * @return int
147 147
 	 */
148
-	public function dropIndex( $table_name, $indexName )
148
+	public function dropIndex($table_name, $indexName)
149 149
 	{
150
-		if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){
150
+		if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) {
151 151
 			return FALSE;
152 152
 		}
153 153
 		global $wpdb;
154
-		$table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix( $table_name );
154
+		$table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name);
155 155
 		$index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$indexName'";
156 156
 		if (
157
-			$this->getTableAnalysis()->tableExists(  $table_name )
158
-			&& $wpdb->get_var( $index_exists_query ) === $table_name //using get_var with the $index_exists_query returns the table's name
157
+			$this->getTableAnalysis()->tableExists($table_name)
158
+			&& $wpdb->get_var($index_exists_query) === $table_name //using get_var with the $index_exists_query returns the table's name
159 159
 		) {
160
-			return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $indexName" );
160
+			return $wpdb->query("ALTER TABLE $table_name DROP INDEX $indexName");
161 161
 		}
162 162
 		return 0;
163 163
 	}
@@ -171,31 +171,31 @@  discard block
 block discarded – undo
171 171
 	 * @return void
172 172
 	 * @throws \EE_Error
173 173
 	 */
174
-	public function createTable( $table_name, $createSql, $engine = 'MyISAM' )
174
+	public function createTable($table_name, $createSql, $engine = 'MyISAM')
175 175
 	{
176 176
 		// does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns )
177
-		if ( preg_match( '((((.*?))(,\s))+)', $createSql, $valid_column_data ) ) {
178
-			$table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix( $table_name );
177
+		if (preg_match('((((.*?))(,\s))+)', $createSql, $valid_column_data)) {
178
+			$table_name = $this->getTableAnalysis()->ensureTableNameHasPrefix($table_name);
179 179
 			$SQL = "CREATE TABLE $table_name ( $createSql ) ENGINE=$engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
180 180
 			/** @var \wpdb $wpdb */
181 181
 			global $wpdb;
182 182
 			//get $wpdb to echo errors, but buffer them. This way at least WE know an error
183 183
 			//happened. And then we can choose to tell the end user
184
-			$old_show_errors_policy = $wpdb->show_errors( TRUE );
185
-			$old_error_suppression_policy = $wpdb->suppress_errors( FALSE );
184
+			$old_show_errors_policy = $wpdb->show_errors(TRUE);
185
+			$old_error_suppression_policy = $wpdb->suppress_errors(FALSE);
186 186
 			ob_start();
187
-			dbDelta( $SQL );
187
+			dbDelta($SQL);
188 188
 			$output = ob_get_contents();
189 189
 			ob_end_clean();
190
-			$wpdb->show_errors( $old_show_errors_policy );
191
-			$wpdb->suppress_errors( $old_error_suppression_policy );
192
-			if( ! empty( $output ) ){
193
-				throw new \EE_Error( $output	);
190
+			$wpdb->show_errors($old_show_errors_policy);
191
+			$wpdb->suppress_errors($old_error_suppression_policy);
192
+			if ( ! empty($output)) {
193
+				throw new \EE_Error($output);
194 194
 			}
195 195
 		} else {
196 196
 			throw new \EE_Error(
197 197
 				sprintf(
198
-					__( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ),
198
+					__('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'),
199 199
 					'<br />',
200 200
 					$createSql
201 201
 				)
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 1 patch
Spacing   +580 added lines, -580 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Registrations_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
61
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ));
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61
+		add_action('wp_loaded', array($this, 'wp_loaded'));
62 62
 	}
63 63
 
64 64
 
65 65
 
66 66
 	public function wp_loaded() {
67 67
 		// when adding a new registration...
68
-		if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) {
68
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') {
69 69
 			EE_System::do_not_cache();
70 70
 			if (
71
-				! isset( $this->_req_data[ 'processing_registration' ] )
72
-				|| absint( $this->_req_data[ 'processing_registration' ] ) !== 1
71
+				! isset($this->_req_data['processing_registration'])
72
+				|| absint($this->_req_data['processing_registration']) !== 1
73 73
 			) {
74 74
 				// and it's NOT the attendee information reg step
75 75
 				// force cookie expiration by setting time to last week
76
-				setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' );
76
+				setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
77 77
 				// and update the global
78
-				$_COOKIE[ 'ee_registration_added' ] = 0;
78
+				$_COOKIE['ee_registration_added'] = 0;
79 79
 			}
80 80
 		}
81 81
 	}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 				'trash' => 'post.php'
110 110
 			);
111 111
 
112
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
112
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
113 113
 		//add filters so that the comment urls don't take users to a confusing 404 page
114
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
114
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
115 115
 	}
116 116
 
117 117
 
118
-	public function clear_comment_link( $link, $comment, $args ) {
118
+	public function clear_comment_link($link, $comment, $args) {
119 119
 		//gotta make sure this only happens on this route
120
-		$post_type = get_post_type( $comment->comment_post_ID);
121
-		if ( $post_type == 'espresso_attendees' )
120
+		$post_type = get_post_type($comment->comment_post_ID);
121
+		if ($post_type == 'espresso_attendees')
122 122
 			return '#commentsdiv';
123 123
 		return $link;
124 124
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	protected function _ajax_hooks() {
128 128
 		//todo: all hooks for registrations ajax goes in here
129
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
129
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
130 130
 	}
131 131
 
132 132
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 				'add-attendee' => __('Add Contact', 'event_espresso'),
142 142
 				'edit' => __('Edit Contact', 'event_espresso'),
143 143
 				'report'=>  __("Event Registrations CSV Report", "event_espresso"),
144
-				'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
145
-				'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
144
+				'report_all' => __('All Registrations CSV Report', 'event_espresso'),
145
+				'contact_list_report' => __('Contact List Report', 'event_espresso'),
146 146
 				'contact_list_export'=>  __("Export Data", "event_espresso"),
147 147
 			),
148 148
 			'publishbox' => array(
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$this->_get_registration_status_array();
172 172
 
173
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
174
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
175
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
173
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
174
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
175
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
176 176
 
177 177
 		$this->_page_routes = array(
178 178
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 				'restore_registrations' => array(
207 207
 					'func' => '_trash_or_restore_registrations',
208
-					'args' => array( 'trash' => FALSE ),
208
+					'args' => array('trash' => FALSE),
209 209
 					'noheader' => TRUE,
210 210
 					'capability' => 'ee_delete_registrations'
211 211
 					),
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440 440
                 ),
441
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
441
+				'help_tour' => array('Registration_Overview_Help_Tour'),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
444 444
 				'require_nonce' => FALSE
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 					'order' => 15,
451 451
 					'url' => isset($this->_req_data['_REG_ID'])
452 452
 						? add_query_arg(
453
-							array('_REG_ID' => $this->_req_data['_REG_ID'] ),
453
+							array('_REG_ID' => $this->_req_data['_REG_ID']),
454 454
 							$this->_current_page_view_url
455 455
 						)
456 456
 						: $this->_admin_base_url,
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 						'filename' => 'registrations_details_registrant_details'
475 475
 					)
476 476
 				),
477
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
478
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
477
+				'help_tour' => array('Registration_Details_Help_Tour'),
478
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
479 479
 				'require_nonce' => FALSE
480 480
 			),
481 481
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 					'order' => 15,
500 500
 					'persistent' => FALSE
501 501
 				),
502
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
502
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
503 503
 				'require_nonce' => FALSE
504 504
 			),
505 505
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 					'label' => __('Edit Contact', 'event_espresso'),
509 509
 					'order' => 15,
510 510
 					'persistent' => FALSE,
511
-					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
511
+					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
512 512
 				),
513 513
 				'metaboxes' => array('attendee_editor_metaboxes'),
514 514
 				'require_nonce' => FALSE
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 						'filename' => 'registrations_contact_list_other'
539 539
 					)
540 540
                 ),
541
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
541
+				'help_tour' => array('Contact_List_Help_Tour'),
542 542
 				'metaboxes' => array(),
543 543
 				'require_nonce' => FALSE
544 544
 			),
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	protected function _add_screen_options() {}
558 558
 	protected function _add_feature_pointers() {}
559 559
 	public function admin_init() {
560
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
560
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
561 561
 	}
562 562
 	public function admin_notices() {}
563 563
 	public function admin_footer_scripts() {}
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	*		@return void
576 576
 	*/
577 577
 	private function _get_registration_status_array() {
578
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
578
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
579 579
 	}
580 580
 
581 581
 
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 	public function load_scripts_styles() {
599 599
 		//style
600 600
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
601
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
601
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
602 602
 		wp_enqueue_style('espresso_reg');
603 603
 
604 604
 		//script
605
-		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
605
+		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
606 606
 		wp_enqueue_script('espresso_reg');
607 607
 	}
608 608
 
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 	public function load_scripts_styles_edit_attendee() {
612 612
 		//stuff to only show up on our attendee edit details page.
613 613
 		$attendee_details_translations = array(
614
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
614
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
615 615
 			);
616
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
616
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
617 617
 		wp_enqueue_script('jquery-validate');
618 618
 	}
619 619
 
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
 		//styles
623 623
 		wp_enqueue_style('espresso-ui-theme');
624 624
 		//scripts
625
-		$this->_get_reg_custom_questions_form( $this->_registration->ID() );
626
-		$this->_reg_custom_questions_form->wp_enqueue_scripts( true );
625
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
626
+		$this->_reg_custom_questions_form->wp_enqueue_scripts(true);
627 627
 	}
628 628
 
629 629
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 	public function load_scripts_styles_contact_list() {
635 635
 		wp_deregister_style('espresso_reg');
636
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
636
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
637 637
 		wp_enqueue_style('espresso_att');
638 638
 	}
639 639
 
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
 
643 643
 
644 644
 	public function load_scripts_styles_new_registration() {
645
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
645
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
646 646
 		wp_enqueue_script('ee-spco-for-admin');
647
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
647
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
648 648
 		EE_Form_Section_Proper::wp_enqueue_scripts();
649 649
 		EED_Ticket_Selector::load_tckt_slctr_assets();
650 650
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		//for notification related bulk actions we need to make sure only active messengers have an option.
672 672
 		EED_Messages::set_autoloaders();
673 673
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
674
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
674
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
675 675
 		$active_mts = $message_resource_manager->list_of_active_message_types();
676 676
 		//key= bulk_action_slug, value= message type.
677 677
 		$match_array = array(
@@ -684,23 +684,23 @@  discard block
 block discarded – undo
684 684
 
685 685
 		/** setup reg status bulk actions **/
686 686
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
687
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
687
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
688 688
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
689 689
 		}
690 690
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
691
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
691
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
692 692
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
693 693
 		}
694 694
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
695
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
695
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
696 696
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
697 697
 		}
698 698
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
699
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
699
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
700 700
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
701 701
 		}
702 702
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
703
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
703
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
704 704
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
705 705
 		}
706 706
 
@@ -709,29 +709,29 @@  discard block
 block discarded – undo
709 709
 				'slug' => 'all',
710 710
 				'label' => __('View All Registrations', 'event_espresso'),
711 711
 				'count' => 0,
712
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
712
+				'bulk_action' => array_merge($def_reg_status_actions, array(
713 713
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
714
-					) )
714
+					))
715 715
 				),
716 716
 			'month' => array(
717 717
 				'slug' => 'month',
718 718
 				'label' => __('This Month', 'event_espresso'),
719 719
 				'count' => 0,
720
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
720
+				'bulk_action' => array_merge($def_reg_status_actions, array(
721 721
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
722 722
 					))
723 723
 				),
724 724
 			'today' => array(
725 725
 				'slug' => 'today',
726
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
726
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
727 727
 				'count' => 0,
728
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
728
+				'bulk_action' => array_merge($def_reg_status_actions, array(
729 729
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
730 730
 					))
731 731
 				)
732 732
 			);
733 733
 
734
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
734
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
735 735
 			$this->_views['incomplete'] = array(
736 736
 				'slug' => 'incomplete',
737 737
 				'label' => __('Incomplete', 'event_espresso'),
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 				)
768 768
 			);
769 769
 
770
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
770
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
771 771
 			$this->_views['trash'] = array(
772 772
 				'slug' => 'trash',
773 773
 				'label' => __('Trash', 'event_espresso'),
@@ -806,18 +806,18 @@  discard block
 block discarded – undo
806 806
 				'desc' => __('View Transaction Invoice', 'event_espresso')
807 807
 				),
808 808
  			);
809
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
809
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
810 810
 			$fc_items['resend_registration'] = array(
811 811
 				'class' => 'dashicons dashicons-email-alt',
812 812
 				'desc' => __('Resend Registration Details', 'event_espresso')
813 813
 				);
814 814
 		} else {
815
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
815
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
816 816
 		}
817 817
 
818
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
819
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
820
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
818
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
819
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
820
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
821 821
 				$fc_items['view_related_messages'] = array(
822 822
 					'class' => $related_for_icon['css_class'],
823 823
 					'desc' => $related_for_icon['label'],
@@ -827,35 +827,35 @@  discard block
 block discarded – undo
827 827
 
828 828
 		$sc_items = array(
829 829
 			'approved_status' => array(
830
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
831
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
830
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
831
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
832 832
 				),
833 833
 			'pending_status' => array(
834
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
835
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
834
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
835
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
836 836
 				),
837 837
 			'wait_list' => array(
838
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
839
-				'desc'  => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' )
838
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
839
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence')
840 840
 			),
841 841
 			'incomplete_status' => array(
842
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
843
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
842
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
843
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
844 844
 			),
845 845
 			'not_approved' => array(
846
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
847
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
846
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
847
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
848 848
 				),
849 849
 			'declined_status' => array(
850
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
851
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
850
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
851
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
852 852
 				),
853 853
 			'cancelled_status' => array(
854
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
855
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
854
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
855
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
856 856
 				)
857 857
 			);
858
-		return array_merge( $fc_items, $sc_items );
858
+		return array_merge($fc_items, $sc_items);
859 859
 	}
860 860
 
861 861
 
@@ -869,45 +869,45 @@  discard block
 block discarded – undo
869 869
 	 */
870 870
 	protected function _registrations_overview_list_table() {
871 871
 		$this->_template_args['admin_page_header'] = '';
872
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0;
873
-		if ( $EVT_ID ) {
874
-			if ( EE_Registry::instance()->CAP->current_user_can(
872
+		$EVT_ID = ! empty($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : 0;
873
+		if ($EVT_ID) {
874
+			if (EE_Registry::instance()->CAP->current_user_can(
875 875
 				'ee_edit_registrations',
876 876
 				'espresso_registrations_new_registration',
877 877
 				$EVT_ID
878 878
 				)
879 879
 			) {
880
-				$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
880
+				$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
881 881
 					'new_registration',
882 882
 					'add-registrant',
883
-					array( 'event_id' => $EVT_ID ),
883
+					array('event_id' => $EVT_ID),
884 884
 					'add-new-h2'
885 885
 				);
886 886
 			}
887
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
888
-			if ( $event instanceof EE_Event ) {
887
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
888
+			if ($event instanceof EE_Event) {
889 889
 				$this->_template_args['admin_page_header'] = sprintf(
890
-					__( '%s Viewing registrations for the event: %s%s', 'event_espresso' ),
890
+					__('%s Viewing registrations for the event: %s%s', 'event_espresso'),
891 891
 					'<h3 style="line-height:1.5em;">',
892
-					'<br /><a href="' . EE_Admin_Page::add_query_args_and_nonce(
893
-						array( 'action' => 'edit', 'post' => $event->ID() ),
892
+					'<br /><a href="'.EE_Admin_Page::add_query_args_and_nonce(
893
+						array('action' => 'edit', 'post' => $event->ID()),
894 894
 						EVENTS_ADMIN_URL
895
-					) . '">&nbsp;' . $event->get( 'EVT_name' ) . '&nbsp;</a>&nbsp;',
895
+					).'">&nbsp;'.$event->get('EVT_name').'&nbsp;</a>&nbsp;',
896 896
 					'</h3>'
897 897
 				);
898 898
 			}
899
-			$DTT_ID = ! empty( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : 0;
900
-			$datetime = EEM_Datetime::instance()->get_one_by_ID( $DTT_ID );
901
-			if ( $datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '' ) {
902
-				$this->_template_args['admin_page_header'] = substr( $this->_template_args['admin_page_header'], 0, -5 );
899
+			$DTT_ID = ! empty($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : 0;
900
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
901
+			if ($datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '') {
902
+				$this->_template_args['admin_page_header'] = substr($this->_template_args['admin_page_header'], 0, -5);
903 903
 				$this->_template_args['admin_page_header'] .= ' &nbsp;<span class="drk-grey-text">';
904 904
 				$this->_template_args['admin_page_header'] .= '<span class="dashicons dashicons-calendar"></span>';
905 905
 				$this->_template_args['admin_page_header'] .= $datetime->name();
906
-				$this->_template_args['admin_page_header'] .= ' ( ' . $datetime->start_date() . ' )';
906
+				$this->_template_args['admin_page_header'] .= ' ( '.$datetime->start_date().' )';
907 907
 				$this->_template_args['admin_page_header'] .= '</span></h3>';
908 908
 			}
909 909
 		}
910
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
910
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
911 911
 		$this->display_admin_list_table_page_with_no_sidebar();
912 912
 	}
913 913
 
@@ -922,19 +922,19 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	private function _set_registration_object() {
924 924
 		//get out if we've already set the object
925
-		if ( is_object( $this->_registration )) {
925
+		if (is_object($this->_registration)) {
926 926
 			return TRUE;
927 927
 		}
928 928
 
929 929
 	    $REG = EEM_Registration::instance();
930 930
 
931
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
931
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
932 932
 
933
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
933
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
934 934
 			return TRUE;
935 935
 		else {
936
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
937
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
936
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
937
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
938 938
 			$this->_registration = NULL;
939 939
 			return FALSE;
940 940
 		}
@@ -952,25 +952,25 @@  discard block
 block discarded – undo
952 952
 	 * @throws \EE_Error
953 953
 	 * @return mixed (int|array)  int = count || array of registration objects
954 954
 	 */
955
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
956
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
957
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
958
-		$DTT_ID = isset( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : null;
959
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
960
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
961
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
962
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
955
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
956
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
957
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
958
+		$DTT_ID = isset($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : null;
959
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
960
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
961
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
962
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE;
963 963
 		$start_date = FALSE;
964 964
 		$end_date = FALSE;
965 965
 		$_where = array();
966
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
967
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
966
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
967
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
968 968
 
969 969
 		//set orderby
970 970
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
971 971
 
972 972
 
973
-		switch ( $this->_req_data['orderby'] ) {
973
+		switch ($this->_req_data['orderby']) {
974 974
 			case '_REG_ID':
975 975
 				$orderby = 'REG_ID';
976 976
 				break;
@@ -990,30 +990,30 @@  discard block
 block discarded – undo
990 990
 				$orderby = 'REG_date';
991 991
 		}
992 992
 
993
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
994
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
995
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
993
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
994
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
995
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
996 996
 
997 997
 
998
-		$offset = ($current_page-1)*$per_page;
999
-		$limit = $count  ? NULL : array( $offset, $per_page );
998
+		$offset = ($current_page - 1) * $per_page;
999
+		$limit = $count ? NULL : array($offset, $per_page);
1000 1000
 
1001
-		if($EVT_ID){
1002
-			$_where['EVT_ID']=$EVT_ID;
1001
+		if ($EVT_ID) {
1002
+			$_where['EVT_ID'] = $EVT_ID;
1003 1003
 		}
1004
-		if($CAT_ID){
1004
+		if ($CAT_ID) {
1005 1005
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
1006 1006
 		}
1007 1007
 		//if DTT is included we filter by that datetime.
1008
-		if ( $DTT_ID ) {
1008
+		if ($DTT_ID) {
1009 1009
 			$_where['Ticket.Datetime.DTT_ID'] = $DTT_ID;
1010 1010
 		}
1011
-		if ( $incomplete ) {
1011
+		if ($incomplete) {
1012 1012
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
1013 1013
 		} else if ( ! $trash) {
1014
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
1014
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
1015 1015
 		}
1016
-		if($reg_status){
1016
+		if ($reg_status) {
1017 1017
 			$_where['STS_ID'] = $reg_status;
1018 1018
 		}
1019 1019
 
@@ -1025,103 +1025,103 @@  discard block
 block discarded – undo
1025 1025
 		$time_start = ' 00:00:00';
1026 1026
 		$time_end = ' 23:59:59';
1027 1027
 
1028
-		if($today_a || $today ){
1028
+		if ($today_a || $today) {
1029 1029
 			$curdate = date('Y-m-d', current_time('timestamp'));
1030
-			$_where['REG_date']= array('BETWEEN',
1030
+			$_where['REG_date'] = array('BETWEEN',
1031 1031
 				array(
1032
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
1033
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
1032
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
1033
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
1034 1034
 			));
1035
-		}elseif($this_month_a || $this_month){
1035
+		}elseif ($this_month_a || $this_month) {
1036 1036
 			$this_month_r = date('m', current_time('timestamp'));
1037
-			$days_this_month = date( 't', current_time('timestamp') );
1038
-			$_where['REG_date']= array('BETWEEN',
1037
+			$days_this_month = date('t', current_time('timestamp'));
1038
+			$_where['REG_date'] = array('BETWEEN',
1039 1039
 				array(
1040
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
1041
-					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' )
1040
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
1041
+					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')
1042 1042
 			));
1043
-		}elseif($month_range){
1043
+		}elseif ($month_range) {
1044 1044
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1045
-			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1046
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1047
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1048
-			$_where['REG_date']= array('BETWEEN',
1049
-				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
1050
-		}elseif($start_date && $end_date){
1045
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : '';
1046
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1047
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
1048
+			$_where['REG_date'] = array('BETWEEN',
1049
+				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s')));
1050
+		}elseif ($start_date && $end_date) {
1051 1051
 			throw new EE_Error("not yet supported");
1052
-		}elseif($start_date){
1052
+		}elseif ($start_date) {
1053 1053
 			throw new EE_Error("not yet supported");
1054
-		}elseif($end_date){
1054
+		}elseif ($end_date) {
1055 1055
 			throw new EE_Error("not yet supported");
1056 1056
 		}
1057 1057
 
1058
-		if ( ! empty( $this->_req_data['s'] ) ) {
1059
-			$sstr = '%' . $this->_req_data['s'] . '%';
1058
+		if ( ! empty($this->_req_data['s'])) {
1059
+			$sstr = '%'.$this->_req_data['s'].'%';
1060 1060
 			$_where['OR'] = array(
1061
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1062
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1063
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1064
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
1065
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1066
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1067
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1068
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1069
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1070
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1071
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1072
-				'REG_final_price' => array( 'LIKE', $sstr ),
1073
-				'REG_code' => array( 'LIKE', $sstr ),
1074
-				'REG_count' => array( 'LIKE' , $sstr ),
1075
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1076
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1077
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
1078
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
1061
+				'Event.EVT_name' => array('LIKE', $sstr),
1062
+				'Event.EVT_desc' => array('LIKE', $sstr),
1063
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1064
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
1065
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1066
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1067
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1068
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1069
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1070
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1071
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1072
+				'REG_final_price' => array('LIKE', $sstr),
1073
+				'REG_code' => array('LIKE', $sstr),
1074
+				'REG_count' => array('LIKE', $sstr),
1075
+				'REG_group_size' => array('LIKE', $sstr),
1076
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1077
+				'Ticket.TKT_description' => array('LIKE', $sstr),
1078
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
1079 1079
 			);
1080 1080
 		}
1081 1081
 
1082 1082
 		//capability checks
1083
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
1083
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
1084 1084
 			$_where['AND'] = array(
1085 1085
 				'Event.EVT_wp_user' => get_current_user_id()
1086 1086
 				);
1087 1087
 		}
1088 1088
 
1089
-		if( $count ){
1090
-			if ( $trash ) {
1091
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1092
-			} else if ( $incomplete ) {
1093
-				return EEM_Registration::instance()->count( array( $_where ));
1089
+		if ($count) {
1090
+			if ($trash) {
1091
+				return EEM_Registration::instance()->count_deleted(array($_where));
1092
+			} else if ($incomplete) {
1093
+				return EEM_Registration::instance()->count(array($_where));
1094 1094
 			} else {
1095
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1095
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1096 1096
 			}
1097 1097
 		} else {
1098 1098
 			//make sure we remove default where conditions cause all registrations matching query are returned
1099
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1100
-			if ( $per_page !== -1 ) {
1099
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1100
+			if ($per_page !== -1) {
1101 1101
 				$query_params['limit'] = $limit;
1102 1102
 			}
1103
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1103
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1104 1104
 
1105
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1105
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1106 1106
 				$first_registration = $registrations[0];
1107 1107
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1108 1108
 				$event_name = $first_registration->event_obj()->name();
1109
-				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1109
+				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1110 1110
 				// edit event link
1111
-				if ( $event_name != '' ) {
1112
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1113
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1114
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1111
+				if ($event_name != '') {
1112
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1113
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1114
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1115 1115
 				}
1116 1116
 
1117
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1118
-				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1117
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1118
+				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1119 1119
 
1120 1120
 				$this->_template_args['before_admin_page_content'] = '
1121 1121
 			<div id="admin-page-header">
1122
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1123
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1124
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1122
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1123
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1124
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1125 1125
 			</div>
1126 1126
 			';
1127 1127
 
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 
1160 1160
 		$this->_set_registration_object();
1161 1161
 
1162
-		if ( is_object( $this->_registration )) {
1162
+		if (is_object($this->_registration)) {
1163 1163
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1164 1164
 			$this->_session = $transaction->session_data();
1165 1165
 
@@ -1167,10 +1167,10 @@  discard block
 block discarded – undo
1167 1167
 
1168 1168
 
1169 1169
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1170
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1170
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1171 1171
 
1172
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->get_i18n_datetime( 'REG_date' );
1173
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1172
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1173
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1174 1174
 
1175 1175
 			$this->_template_args['grand_total'] = $transaction->total();
1176 1176
 
@@ -1178,20 +1178,20 @@  discard block
 block discarded – undo
1178 1178
 			// link back to overview
1179 1179
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1180 1180
 			$this->_template_args['registration'] = $this->_registration;
1181
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1182
-			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );
1183
-			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );
1181
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1182
+			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php'));
1183
+			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php'));
1184 1184
 
1185 1185
 			//next and previous links
1186
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1187
-			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
1188
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1189
-			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
1186
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1187
+			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
1188
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1189
+			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
1190 1190
 
1191 1191
 			// grab header
1192
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1192
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1193 1193
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1194
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1194
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1195 1195
 
1196 1196
 		} else {
1197 1197
 
@@ -1210,17 +1210,17 @@  discard block
 block discarded – undo
1210 1210
 
1211 1211
 
1212 1212
 	protected function _registration_details_metaboxes() {
1213
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1213
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1214 1214
 		$this->_set_registration_object();
1215 1215
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1216
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1217
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1218
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1219
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1216
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1217
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1218
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1219
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1220 1220
 		}
1221
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1222
-		if ( $this->_registration->group_size() > 1 ) {
1223
-			add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1221
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1222
+		if ($this->_registration->group_size() > 1) {
1223
+			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high');
1224 1224
 		}
1225 1225
 	}
1226 1226
 
@@ -1262,25 +1262,25 @@  discard block
 block discarded – undo
1262 1262
 				'html_id'         => 'reg-status-change-form',
1263 1263
 				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1264 1264
 				'subsections'     => array(
1265
-					'return' => new EE_Hidden_Input( array(
1265
+					'return' => new EE_Hidden_Input(array(
1266 1266
 						'name'    => 'return',
1267 1267
 						'default' => 'view_registration'
1268
-					) ),
1269
-					'REG_ID' => new EE_Hidden_Input( array(
1268
+					)),
1269
+					'REG_ID' => new EE_Hidden_Input(array(
1270 1270
 						'name'    => 'REG_ID',
1271 1271
 						'default' => $this->_registration->ID()
1272
-					) ),
1272
+					)),
1273 1273
 					'current_status' => new EE_Form_Section_HTML(
1274 1274
 						EEH_HTML::tr(
1275 1275
 							EEH_HTML::th(
1276 1276
 								EEH_HTML::label(
1277
-									EEH_HTML::strong( __( 'Current Registration Status', 'event_espresso' ) )
1277
+									EEH_HTML::strong(__('Current Registration Status', 'event_espresso'))
1278 1278
 								)
1279
-							) .
1279
+							).
1280 1280
 							EEH_HTML::td(
1281 1281
 								EEH_HTML::strong(
1282 1282
 									$this->_registration->pretty_status(),
1283
-									'', 'status-' . $this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;'
1283
+									'', 'status-'.$this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;'
1284 1284
 								)
1285 1285
 							)
1286 1286
 						)
@@ -1288,22 +1288,22 @@  discard block
 block discarded – undo
1288 1288
 					'reg_status' => new EE_Select_Input(
1289 1289
 						$this->_get_reg_statuses(),
1290 1290
 						array(
1291
-							'html_label_text' => __( 'Change Registration Status to', 'event_espresso' ),
1291
+							'html_label_text' => __('Change Registration Status to', 'event_espresso'),
1292 1292
 							'default'         => $this->_registration->status_ID(),
1293 1293
 						)
1294 1294
 					),
1295 1295
 					'send_notifications' => new EE_Yes_No_Input(
1296 1296
 						array(
1297
-							'html_label_text' => __( 'Send Related Messages', 'event_espresso' ),
1297
+							'html_label_text' => __('Send Related Messages', 'event_espresso'),
1298 1298
 							'default'         => false,
1299
-							'html_help_text'  => __( 'If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso' ),
1299
+							'html_help_text'  => __('If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso'),
1300 1300
 						)
1301 1301
 					),
1302
-					'submit' => new EE_Submit_Input( array(
1302
+					'submit' => new EE_Submit_Input(array(
1303 1303
 						'html_class'      => 'button-primary',
1304 1304
 						'html_label_text' => '&nbsp;',
1305
-						'default'         => __( 'Update Registration Status', 'event_espresso' )
1306
-					) ),
1305
+						'default'         => __('Update Registration Status', 'event_espresso')
1306
+					)),
1307 1307
 				),
1308 1308
 			)
1309 1309
 		);
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 	 * Returns an array of all the buttons for the various statuses and switch status actions
1317 1317
 	 * @return string
1318 1318
 	 */
1319
-	protected function _get_current_reg_status_help_text( $STS_ID = '' ) {
1319
+	protected function _get_current_reg_status_help_text($STS_ID = '') {
1320 1320
 		//$reg_status_help_text = array(
1321 1321
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
1322 1322
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
@@ -1349,14 +1349,14 @@  discard block
 block discarded – undo
1349 1349
 	 */
1350 1350
 	protected function _get_reg_statuses() {
1351 1351
 		$reg_status_array = EEM_Registration::instance()->reg_status_array();
1352
-		unset ( $reg_status_array[ EEM_Registration::status_id_incomplete ] );
1352
+		unset ($reg_status_array[EEM_Registration::status_id_incomplete]);
1353 1353
 		// get current reg status
1354 1354
 		$current_status = $this->_registration->status_ID();
1355 1355
 		// is registration for free event? This will determine whether to display the pending payment option
1356
-		if ( $current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free() ) {
1357
-			unset( $reg_status_array[ EEM_Registration::status_id_pending_payment ] );
1356
+		if ($current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free()) {
1357
+			unset($reg_status_array[EEM_Registration::status_id_pending_payment]);
1358 1358
 		}
1359
-		return EEM_Status::instance()->localized_status( $reg_status_array, false, 'sentence' );
1359
+		return EEM_Status::instance()->localized_status($reg_status_array, false, 'sentence');
1360 1360
 	}
1361 1361
 
1362 1362
 
@@ -1369,15 +1369,15 @@  discard block
 block discarded – undo
1369 1369
 	 *
1370 1370
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1371 1371
 	 */
1372
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1373
-		if ( isset( $this->_req_data[ 'reg_status_change_form' ] ) ) {
1374
-			$REG_IDs = isset( $this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ] )
1375
-				? (array)$this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ]
1372
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1373
+		if (isset($this->_req_data['reg_status_change_form'])) {
1374
+			$REG_IDs = isset($this->_req_data['reg_status_change_form']['REG_ID'])
1375
+				? (array) $this->_req_data['reg_status_change_form']['REG_ID']
1376 1376
 				: array();
1377 1377
 		} else {
1378
-			$REG_IDs = isset( $this->_req_data[ '_REG_ID' ] ) ? (array)$this->_req_data[ '_REG_ID' ] : array();
1378
+			$REG_IDs = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1379 1379
 		}
1380
-		$success = $this->_set_registration_status( $REG_IDs, $status );
1380
+		$success = $this->_set_registration_status($REG_IDs, $status);
1381 1381
 		//notify?
1382 1382
 		if (
1383 1383
 			$success
@@ -1404,21 +1404,21 @@  discard block
 block discarded – undo
1404 1404
 	 * @param bool $status
1405 1405
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1406 1406
 	 */
1407
-	protected function _set_registration_status( $REG_IDs = array(), $status = false ) {
1407
+	protected function _set_registration_status($REG_IDs = array(), $status = false) {
1408 1408
 		$success = false;
1409 1409
 		// typecast $REG_IDs
1410
-		$REG_IDs = (array)$REG_IDs;
1411
-		if ( ! empty( $REG_IDs ) ) {
1410
+		$REG_IDs = (array) $REG_IDs;
1411
+		if ( ! empty($REG_IDs)) {
1412 1412
 			$success = true;
1413 1413
 			// set default status if none is passed
1414 1414
 			$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1415 1415
 			// sanitize $REG_IDs
1416
-			$REG_IDs = array_filter( $REG_IDs, 'absint' );
1416
+			$REG_IDs = array_filter($REG_IDs, 'absint');
1417 1417
 			//loop through REG_ID's and change status
1418
-			foreach ( $REG_IDs as $REG_ID ) {
1419
-				$registration = EEM_Registration::instance()->get_one_by_ID( $REG_ID );
1420
-				if ( $registration instanceof EE_Registration ) {
1421
-					$registration->set_status( $status );
1418
+			foreach ($REG_IDs as $REG_ID) {
1419
+				$registration = EEM_Registration::instance()->get_one_by_ID($REG_ID);
1420
+				if ($registration instanceof EE_Registration) {
1421
+					$registration->set_status($status);
1422 1422
 					$result = $registration->save();
1423 1423
 					// verifying explicit fails because update *may* just return 0 for 0 rows affected
1424 1424
 					$success = $result !== false ? $success : false;
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 		//reset _req_data['_REG_ID'] for any potential future messages notifications
1429 1429
 		$this->_req_data['_REG_ID'] = $REG_IDs;
1430 1430
 		//return $success and processed registrations
1431
-		return array( 'REG_ID' => $REG_IDs, 'success' => $success );
1431
+		return array('REG_ID' => $REG_IDs, 'success' => $success);
1432 1432
 	}
1433 1433
 
1434 1434
 
@@ -1440,49 +1440,49 @@  discard block
 block discarded – undo
1440 1440
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1441 1441
 	 * @return void
1442 1442
 	 */
1443
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1444
-		$result = ! empty( $STS_ID )
1445
-            ? $this->_set_registration_status_from_request( $STS_ID, $notify )
1446
-            : array( 'success' => false );
1447
-		$success = isset( $result['success'] ) && $result['success'];
1443
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1444
+		$result = ! empty($STS_ID)
1445
+            ? $this->_set_registration_status_from_request($STS_ID, $notify)
1446
+            : array('success' => false);
1447
+		$success = isset($result['success']) && $result['success'];
1448 1448
 		//setup success message
1449
-		if ( $success ) {
1450
-			if ( is_array( $result[ 'REG_ID' ] ) && count( $result[ 'REG_ID' ] ) === 1 ) {
1449
+		if ($success) {
1450
+			if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) {
1451 1451
 				$msg = sprintf(
1452
-					__( 'Registration status has been set to %s', 'event_espresso' ),
1453
-					EEH_Template::pretty_status( $STS_ID, false, 'lower' )
1452
+					__('Registration status has been set to %s', 'event_espresso'),
1453
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1454 1454
 				);
1455 1455
 			} else {
1456 1456
 				$msg = sprintf(
1457
-					__( 'Registrations have been set to %s.', 'event_espresso' ),
1458
-					EEH_Template::pretty_status( $STS_ID, false, 'lower' )
1457
+					__('Registrations have been set to %s.', 'event_espresso'),
1458
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1459 1459
 				);
1460 1460
 			}
1461
-			EE_Error::add_success( $msg );
1461
+			EE_Error::add_success($msg);
1462 1462
 		} else {
1463 1463
 			EE_Error::add_error(
1464
-				__( 'Something went wrong, and the status was not changed', 'event_espresso' ),
1464
+				__('Something went wrong, and the status was not changed', 'event_espresso'),
1465 1465
 				__FILE__, __LINE__, __FUNCTION__
1466 1466
 			);
1467 1467
 		}
1468
-		if ( isset( $this->_req_data[ 'return' ] ) && $this->_req_data[ 'return' ] == 'view_registration' ) {
1469
-			$route = array( 'action' => 'view_registration', '_REG_ID' => reset( $result[ 'REG_ID' ] ) );
1468
+		if (isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration') {
1469
+			$route = array('action' => 'view_registration', '_REG_ID' => reset($result['REG_ID']));
1470 1470
 		} else {
1471
-			$route = array( 'action' => 'default' );
1471
+			$route = array('action' => 'default');
1472 1472
 		}
1473 1473
 		//unset nonces
1474
-		foreach ( $this->_req_data as $ref => $value ) {
1475
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1476
-				unset( $this->_req_data[$ref] );
1474
+		foreach ($this->_req_data as $ref => $value) {
1475
+			if (strpos($ref, 'nonce') !== false) {
1476
+				unset($this->_req_data[$ref]);
1477 1477
 				continue;
1478 1478
 			}
1479 1479
 
1480
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1480
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1481 1481
 			$this->_req_data[$ref] = $value;
1482 1482
 		}
1483 1483
 		//merge request vars so that the reloaded list table contains any existing filter query params
1484
-		$route = array_merge( $this->_req_data, $route );
1485
-		$this->_redirect_after_action( $success, '', '', $route, true );
1484
+		$route = array_merge($this->_req_data, $route);
1485
+		$this->_redirect_after_action($success, '', '', $route, true);
1486 1486
 	}
1487 1487
 
1488 1488
 
@@ -1493,51 +1493,51 @@  discard block
 block discarded – undo
1493 1493
 	protected function _change_reg_status() {
1494 1494
 		$this->_req_data['return'] = 'view_registration';
1495 1495
 		//set notify based on whether the send notifications toggle is set or not
1496
-		$notify = ! empty( $this->_req_data['reg_status_change_form']['send_notifications'] );
1496
+		$notify = ! empty($this->_req_data['reg_status_change_form']['send_notifications']);
1497 1497
 		//$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1498
-		$this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] = isset(
1499
-			$this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ]
1498
+		$this->_req_data['reg_status_change_form']['reg_status'] = isset(
1499
+			$this->_req_data['reg_status_change_form']['reg_status']
1500 1500
 		)
1501
-			? $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ]
1501
+			? $this->_req_data['reg_status_change_form']['reg_status']
1502 1502
 			: '';
1503 1503
 
1504
-		switch ( $this->_req_data[ 'reg_status_change_form' ]['reg_status'] ) {
1504
+		switch ($this->_req_data['reg_status_change_form']['reg_status']) {
1505 1505
 
1506 1506
 			case EEM_Registration::status_id_approved :
1507
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1508
-				$this->approve_registration( $notify );
1507
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1508
+				$this->approve_registration($notify);
1509 1509
 				break;
1510 1510
 
1511 1511
 			case EEM_Registration::status_id_pending_payment :
1512
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1513
-				$this->pending_registration( $notify );
1512
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1513
+				$this->pending_registration($notify);
1514 1514
 				break;
1515 1515
 
1516 1516
 			case EEM_Registration::status_id_not_approved :
1517
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1518
-				$this->not_approve_registration( $notify );
1517
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1518
+				$this->not_approve_registration($notify);
1519 1519
 				break;
1520 1520
 
1521 1521
 			case EEM_Registration::status_id_declined :
1522
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1523
-				$this->decline_registration( $notify );
1522
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1523
+				$this->decline_registration($notify);
1524 1524
 				break;
1525 1525
 
1526 1526
 			case EEM_Registration::status_id_cancelled :
1527
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1528
-				$this->cancel_registration( $notify );
1527
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1528
+				$this->cancel_registration($notify);
1529 1529
 				break;
1530 1530
 
1531 1531
 			case EEM_Registration::status_id_wait_list :
1532
-			case EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ) :
1533
-				$this->waitlist_registration( $notify );
1532
+			case EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence') :
1533
+				$this->waitlist_registration($notify);
1534 1534
 				break;
1535 1535
 
1536 1536
 			case EEM_Registration::status_id_incomplete :
1537 1537
 			default :
1538 1538
 				$result['success'] = false;
1539
-				unset( $this->_req_data['return'] );
1540
-				$this->_reg_status_change_return( '', false );
1539
+				unset($this->_req_data['return']);
1540
+				$this->_reg_status_change_return('', false);
1541 1541
 				break;
1542 1542
 		}
1543 1543
 	}
@@ -1551,8 +1551,8 @@  discard block
 block discarded – undo
1551 1551
 	 * @param bool $notify whether or not to notify the registrant about their approval.
1552 1552
 	 * @return void
1553 1553
 	 */
1554
-	protected function approve_registration( $notify = false ) {
1555
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1554
+	protected function approve_registration($notify = false) {
1555
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1556 1556
 	}
1557 1557
 
1558 1558
 
@@ -1564,8 +1564,8 @@  discard block
 block discarded – undo
1564 1564
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1565 1565
 	 * @return void
1566 1566
 	 */
1567
-	protected function decline_registration( $notify = false ) {
1568
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1567
+	protected function decline_registration($notify = false) {
1568
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1569 1569
 	}
1570 1570
 
1571 1571
 
@@ -1577,8 +1577,8 @@  discard block
 block discarded – undo
1577 1577
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1578 1578
 	 * @return void
1579 1579
 	 */
1580
-	protected function cancel_registration( $notify = false ) {
1581
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1580
+	protected function cancel_registration($notify = false) {
1581
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1582 1582
 	}
1583 1583
 
1584 1584
 
@@ -1590,8 +1590,8 @@  discard block
 block discarded – undo
1590 1590
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1591 1591
 	 * @return void
1592 1592
 	 */
1593
-	protected function not_approve_registration( $notify = false ) {
1594
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1593
+	protected function not_approve_registration($notify = false) {
1594
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1595 1595
 	}
1596 1596
 
1597 1597
 
@@ -1603,8 +1603,8 @@  discard block
 block discarded – undo
1603 1603
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1604 1604
 	 * @return void
1605 1605
 	 */
1606
-	protected function pending_registration( $notify = false ) {
1607
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1606
+	protected function pending_registration($notify = false) {
1607
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1608 1608
 	}
1609 1609
 
1610 1610
 
@@ -1616,8 +1616,8 @@  discard block
 block discarded – undo
1616 1616
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1617 1617
 	 * @return void
1618 1618
 	 */
1619
-	protected function waitlist_registration( $notify = false ) {
1620
-		$this->_reg_status_change_return( EEM_Registration::status_id_wait_list, $notify );
1619
+	protected function waitlist_registration($notify = false) {
1620
+		$this->_reg_status_change_return(EEM_Registration::status_id_wait_list, $notify);
1621 1621
 	}
1622 1622
 
1623 1623
 
@@ -1631,14 +1631,14 @@  discard block
 block discarded – undo
1631 1631
 	public function _reg_details_meta_box() {
1632 1632
 		EEH_Autoloader::register_line_item_display_autoloaders();
1633 1633
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1634
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1634
+		EE_Registry::instance()->load_helper('Line_Item');
1635 1635
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1636 1636
 		$this->_session = $transaction->session_data();
1637 1637
 
1638 1638
 		$filters = new EE_Line_Item_Filter_Collection();
1639 1639
 		//$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1640
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1641
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1640
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1641
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1642 1642
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1643 1643
 		$line_item_display = new EE_Line_Item_Display(
1644 1644
 			'reg_admin_table',
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
 		);
1647 1647
 		$this->_template_args['line_item_table'] = $line_item_display->display_line_item(
1648 1648
 			$filtered_line_item_tree,
1649
-			array( 'EE_Registration' => $this->_registration )
1649
+			array('EE_Registration' => $this->_registration)
1650 1650
 		);
1651 1651
 		$attendee = $this->_registration->attendee();
1652 1652
 
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 				'espresso_transactions_view_transaction'
1657 1657
 			)
1658 1658
 		) {
1659
-			$this->_template_args[ 'view_transaction_button' ] =  EEH_Template::get_button_or_link(
1659
+			$this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link(
1660 1660
 				EE_Admin_Page::add_query_args_and_nonce(
1661 1661
 					array(
1662 1662
 						'action' => 'view_transaction',
@@ -1664,12 +1664,12 @@  discard block
 block discarded – undo
1664 1664
 					),
1665 1665
 					TXN_ADMIN_URL
1666 1666
 				),
1667
-				esc_html__( ' View Transaction' ),
1667
+				esc_html__(' View Transaction'),
1668 1668
 				'button secondary-button right',
1669 1669
 				'dashicons dashicons-cart'
1670 1670
 			);
1671 1671
 		} else {
1672
-			$this->_template_args[ 'view_transaction_button' ] = '';
1672
+			$this->_template_args['view_transaction_button'] = '';
1673 1673
 		}
1674 1674
 
1675 1675
 		if (
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 				'espresso_registrations_resend_registration'
1680 1680
 			)
1681 1681
 		) {
1682
-			$this->_template_args[ 'resend_registration_button' ] = EEH_Template::get_button_or_link(
1682
+			$this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link(
1683 1683
 				EE_Admin_Page::add_query_args_and_nonce(
1684 1684
 					array(
1685 1685
 						'action' 		=> 'resend_registration',
@@ -1688,55 +1688,55 @@  discard block
 block discarded – undo
1688 1688
 					),
1689 1689
 					REG_ADMIN_URL
1690 1690
 				),
1691
-				esc_html__( ' Resend Registration' ),
1691
+				esc_html__(' Resend Registration'),
1692 1692
 				'button secondary-button right',
1693 1693
 				'dashicons dashicons-email-alt'
1694 1694
 			);
1695 1695
 		} else {
1696
-			$this->_template_args[ 'resend_registration_button' ] = '';
1696
+			$this->_template_args['resend_registration_button'] = '';
1697 1697
 		}
1698 1698
 
1699 1699
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1700
-		$payment = $transaction->get_first_related( 'Payment' );
1700
+		$payment = $transaction->get_first_related('Payment');
1701 1701
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1702
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1702
+		$payment_method = $payment->get_first_related('Payment_Method');
1703 1703
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1704 1704
 
1705 1705
 		$reg_details = array(
1706 1706
 			'payment_method' => $payment_method->name(),
1707 1707
 			'response_msg' => $payment->gateway_response(),
1708
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1708
+			'registration_id' => $this->_registration->get('REG_code'),
1709 1709
 			'registration_session' => $this->_registration->session_ID(),
1710
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1711
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1710
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1711
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1712 1712
 		);
1713 1713
 
1714 1714
 
1715
-		if ( isset( $reg_details['registration_id'] )) {
1715
+		if (isset($reg_details['registration_id'])) {
1716 1716
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1717
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1717
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1718 1718
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1719 1719
 		}
1720 1720
 
1721
-		if ( isset( $reg_details['payment_method'] ) ) {
1721
+		if (isset($reg_details['payment_method'])) {
1722 1722
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1723
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1723
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1724 1724
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1725 1725
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1726
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1726
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1727 1727
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1728 1728
 		}
1729 1729
 
1730 1730
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1731
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1731
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1732 1732
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1733 1733
 
1734 1734
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1735
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1735
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1736 1736
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1737 1737
 
1738 1738
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1739
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1739
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1740 1740
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1741 1741
 
1742 1742
 		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(
@@ -1749,8 +1749,8 @@  discard block
 block discarded – undo
1749 1749
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1750 1750
 		$this->_template_args['event_id'] = $this->_registration->event_ID();
1751 1751
 
1752
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1753
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1752
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1753
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1754 1754
 
1755 1755
 	}
1756 1756
 
@@ -1764,14 +1764,14 @@  discard block
 block discarded – undo
1764 1764
 	*/
1765 1765
 	public function _reg_questions_meta_box() {
1766 1766
 		//allow someone to override this method entirely
1767
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1768
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1769
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1767
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1768
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1769
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1770 1770
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1771 1771
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1772 1772
 
1773
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1774
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1773
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1774
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1775 1775
 		}
1776 1776
 	}
1777 1777
 
@@ -1785,12 +1785,12 @@  discard block
 block discarded – undo
1785 1785
 	 * @param        string $output
1786 1786
 	 * @return        string
1787 1787
 	 */
1788
-	public function form_before_question_group( $output ) {
1788
+	public function form_before_question_group($output) {
1789 1789
 		EE_Error::doing_it_wrong(
1790
-			__CLASS__ . '::' . __FUNCTION__,
1791
-			__( 'This method would have been protected but was used on a filter callback'
1790
+			__CLASS__.'::'.__FUNCTION__,
1791
+			__('This method would have been protected but was used on a filter callback'
1792 1792
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1793
-				'event_espresso' ),
1793
+				'event_espresso'),
1794 1794
 			'4.8.32.rc.000'
1795 1795
 		);
1796 1796
 		return '
@@ -1809,20 +1809,20 @@  discard block
 block discarded – undo
1809 1809
 	 * @param        string $output
1810 1810
 	 * @return        string
1811 1811
 	 */
1812
-	public function form_after_question_group( $output ) {
1812
+	public function form_after_question_group($output) {
1813 1813
 		EE_Error::doing_it_wrong(
1814
-			__CLASS__ . '::' . __FUNCTION__,
1815
-			__( 'This method would have been protected but was used on a filter callback'
1814
+			__CLASS__.'::'.__FUNCTION__,
1815
+			__('This method would have been protected but was used on a filter callback'
1816 1816
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1817
-				'event_espresso' ),
1817
+				'event_espresso'),
1818 1818
 			'4.8.32.rc.000'
1819 1819
 		);
1820 1820
 		return  '
1821 1821
 			<tr class="hide-if-no-js">
1822 1822
 				<th> </th>
1823 1823
 				<td class="reg-admin-edit-attendee-question-td">
1824
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1825
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1824
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1825
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1826 1826
 						<div class="dashicons dashicons-edit"></div>
1827 1827
 					</a>
1828 1828
 				</td>
@@ -1842,18 +1842,18 @@  discard block
 block discarded – undo
1842 1842
 	 * @param        string $label
1843 1843
 	 * @return        string
1844 1844
 	 */
1845
-	public function form_form_field_label_wrap( $label ) {
1845
+	public function form_form_field_label_wrap($label) {
1846 1846
 		EE_Error::doing_it_wrong(
1847
-			__CLASS__ . '::' . __FUNCTION__,
1848
-			__( 'This method would have been protected but was used on a filter callback'
1847
+			__CLASS__.'::'.__FUNCTION__,
1848
+			__('This method would have been protected but was used on a filter callback'
1849 1849
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1850
-				'event_espresso' ),
1850
+				'event_espresso'),
1851 1851
 			'4.8.32.rc.000'
1852 1852
 		);
1853 1853
 		return '
1854 1854
 			<tr>
1855 1855
 				<th>
1856
-					' . $label  . '
1856
+					' . $label.'
1857 1857
 				</th>';
1858 1858
 	}
1859 1859
 
@@ -1867,17 +1867,17 @@  discard block
 block discarded – undo
1867 1867
 	 * @param        string $input
1868 1868
 	 * @return        string
1869 1869
 	 */
1870
-	public function form_form_field_input__wrap( $input ) {
1870
+	public function form_form_field_input__wrap($input) {
1871 1871
 		EE_Error::doing_it_wrong(
1872
-			__CLASS__ . '::' . __FUNCTION__,
1873
-			__( 'This method would have been protected but was used on a filter callback'
1872
+			__CLASS__.'::'.__FUNCTION__,
1873
+			__('This method would have been protected but was used on a filter callback'
1874 1874
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1875
-				'event_espresso' ),
1875
+				'event_espresso'),
1876 1876
 			'4.8.32.rc.000'
1877 1877
 		);
1878 1878
 		return '
1879 1879
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1880
-					' . $input . '
1880
+					' . $input.'
1881 1881
 				</td>
1882 1882
 			</tr>';
1883 1883
 	}
@@ -1891,14 +1891,14 @@  discard block
 block discarded – undo
1891 1891
 	 * @return void
1892 1892
 	 */
1893 1893
 	protected function _update_attendee_registration_form() {
1894
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1895
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1896
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1897
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1898
-			if( $success ) {
1894
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1895
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1896
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1897
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1898
+			if ($success) {
1899 1899
 				$what = __('Registration Form', 'event_espresso');
1900
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1901
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1900
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1901
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1902 1902
 			}
1903 1903
 		}
1904 1904
 	}
@@ -1909,11 +1909,11 @@  discard block
 block discarded – undo
1909 1909
 	 * @param int $REG_ID
1910 1910
 	 * @return EE_Registration_Custom_Questions_Form
1911 1911
 	 */
1912
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1913
-		if( ! $this->_reg_custom_questions_form ) {
1914
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1915
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1916
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1912
+	protected function _get_reg_custom_questions_form($REG_ID) {
1913
+		if ( ! $this->_reg_custom_questions_form) {
1914
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1915
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1916
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1917 1917
 		}
1918 1918
 		return $this->_reg_custom_questions_form;
1919 1919
 	}
@@ -1926,17 +1926,17 @@  discard block
 block discarded – undo
1926 1926
 	 * @param bool $REG_ID
1927 1927
 	 * @return bool
1928 1928
 	 */
1929
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1929
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1930 1930
 
1931 1931
 		if ( ! $REG_ID) {
1932
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1932
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1933 1933
 		}
1934
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1935
-		$form->receive_form_submission( $this->_req_data );
1934
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1935
+		$form->receive_form_submission($this->_req_data);
1936 1936
 		$success = false;
1937
-		if( $form->is_valid() ) {
1938
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1939
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1937
+		if ($form->is_valid()) {
1938
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1939
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1940 1940
 					$where_conditions = array(
1941 1941
 							'QST_ID' => $question_id,
1942 1942
 							'REG_ID' => $REG_ID
@@ -1944,19 +1944,19 @@  discard block
 block discarded – undo
1944 1944
 					$possibly_new_values = array(
1945 1945
 							'ANS_value' => $input->normalized_value()
1946 1946
 						);
1947
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1948
-					if( $answer instanceof EE_Answer ) {
1949
-						$success = $answer->save( $possibly_new_values );
1947
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1948
+					if ($answer instanceof EE_Answer) {
1949
+						$success = $answer->save($possibly_new_values);
1950 1950
 					} else {
1951 1951
 						//insert it then
1952
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1953
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1952
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1953
+						$answer = EE_Answer::new_instance($cols_n_vals);
1954 1954
 						$success = $answer->save();
1955 1955
 					}
1956 1956
 				}
1957 1957
 			}
1958 1958
 		} else {
1959
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1959
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1960 1960
 		}
1961 1961
 		return $success;
1962 1962
 	}
@@ -1974,31 +1974,31 @@  discard block
 block discarded – undo
1974 1974
 		$registrations = $REG->get_all(array(
1975 1975
 			array(
1976 1976
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1977
-				'REG_ID'=>array('!=',$this->_registration->ID())
1977
+				'REG_ID'=>array('!=', $this->_registration->ID())
1978 1978
 			),
1979 1979
 			'force_join'=>array('Attendee')));
1980 1980
 
1981 1981
 		$this->_template_args['attendees'] = array();
1982 1982
 		$this->_template_args['attendee_notice'] = '';
1983
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1984
-			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1983
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1984
+			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1985 1985
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1986 1986
 		} else {
1987 1987
 
1988 1988
 			$att_nmbr = 1;
1989
-			foreach ( $registrations as $registration ) {
1989
+			foreach ($registrations as $registration) {
1990 1990
 				/* @var $registration EE_Registration */
1991 1991
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1992
-				$this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID();
1993
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1994
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1995
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1996
-				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1992
+				$this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID();
1993
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1994
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1995
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1996
+				$this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1997 1997
 
1998
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1998
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1999 1999
 
2000
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
2001
-				$this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name();
2000
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
2001
+				$this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name();
2002 2002
 
2003 2003
 				$att_nmbr++;
2004 2004
 			}
@@ -2008,8 +2008,8 @@  discard block
 block discarded – undo
2008 2008
 
2009 2009
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
2010 2010
 		}
2011
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
2012
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2011
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
2012
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2013 2013
 
2014 2014
 	}
2015 2015
 
@@ -2030,14 +2030,14 @@  discard block
 block discarded – undo
2030 2030
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
2031 2031
 
2032 2032
 		//now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show create button or not)
2033
-		if ( ! $this->_registration->is_primary_registrant() ) {
2033
+		if ( ! $this->_registration->is_primary_registrant()) {
2034 2034
 
2035 2035
 			$primary_registration = $this->_registration->get_primary_registration();
2036 2036
 			$primary_attendee = $primary_registration instanceof EE_Registration
2037 2037
 				? $primary_registration->attendee()
2038 2038
 				: null;
2039 2039
 
2040
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
2040
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
2041 2041
 				//in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
2042 2042
 				$primary_registration = NULL;
2043 2043
 			}
@@ -2046,27 +2046,27 @@  discard block
 block discarded – undo
2046 2046
 		}
2047 2047
 
2048 2048
 		$this->_template_args['ATT_ID'] = $attendee->ID();
2049
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
2050
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
2051
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
2049
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
2050
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
2051
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
2052 2052
 		$this->_template_args['phone'] = $attendee->phone();
2053 2053
 
2054
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
2054
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
2055 2055
 
2056 2056
 
2057 2057
 		//edit link
2058
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
2058
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
2059 2059
 		$this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso');
2060 2060
 
2061 2061
 		//create link
2062
-		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee',  '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';
2062
+		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
2063 2063
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
2064 2064
 
2065 2065
 		$this->_template_args['att_check'] = $att_check;
2066 2066
 
2067 2067
 
2068
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
2069
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2068
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
2069
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2070 2070
 	}
2071 2071
 
2072 2072
 
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
 	 * @access protected
2080 2080
 	 * @return void
2081 2081
 	 */
2082
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
2082
+	protected function _trash_or_restore_registrations($trash = TRUE) {
2083 2083
 		$REGM = EEM_Registration::instance();
2084 2084
 
2085 2085
 		$success = 1;
@@ -2089,26 +2089,26 @@  discard block
 block discarded – undo
2089 2089
 		$dtts = array();
2090 2090
 
2091 2091
 		//if empty _REG_ID then get out because there's nothing to do
2092
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
2092
+		if (empty($this->_req_data['_REG_ID'])) {
2093 2093
 			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso');
2094
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
2095
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
2094
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
2095
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
2096 2096
 		}
2097 2097
 
2098 2098
 		//Checkboxes
2099
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2099
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2100 2100
 			// if array has more than one element than success message should be plural
2101
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2101
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2102 2102
 			// cycle thru checkboxes
2103
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2103
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2104 2104
 				/** @var EE_Registration $REG */
2105
-				$REG = $REGM->get_one_by_ID( $REG_ID);
2105
+				$REG = $REGM->get_one_by_ID($REG_ID);
2106 2106
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
2107
-				if ( $payment_count > 0 ) {
2108
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
2107
+				if ($payment_count > 0) {
2108
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
2109 2109
 					$error = 1;
2110 2110
 					$success = 0;
2111
-					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ );
2111
+					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__);
2112 2112
 					continue; //can't trash this registration because it has payments.
2113 2113
 				}
2114 2114
 				$ticket = $REG->get_first_related('Ticket');
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
 				$dtts = array_merge($dtts, $dtt);
2118 2118
 
2119 2119
 				$updated = $trash ? $REG->delete() : $REG->restore();
2120
-				if ( !$updated ) {
2120
+				if ( ! $updated) {
2121 2121
 					$success = 0;
2122 2122
 				} else {
2123 2123
 					$success = 2;
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
 			$tickets[$ticket->ID()] = $ticket;
2133 2133
 			$dtts = $ticket->get_many_related('Datetime');
2134 2134
 			$updated = $trash ? $REG->delete() : $REG->restore();
2135
-			if ( ! $updated ) {
2135
+			if ( ! $updated) {
2136 2136
 				$success = 0;
2137 2137
 			}
2138 2138
 
@@ -2142,10 +2142,10 @@  discard block
 block discarded – undo
2142 2142
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
2143 2143
 		EEM_Datetime::instance()->update_sold($dtts);
2144 2144
 
2145
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2146
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2145
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2146
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2147 2147
 		$overwrite_msgs = $error ? TRUE : FALSE;
2148
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
2148
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
2149 2149
 	}
2150 2150
 
2151 2151
 
@@ -2169,16 +2169,16 @@  discard block
 block discarded – undo
2169 2169
 		$success = 1;
2170 2170
 
2171 2171
 		//Checkboxes
2172
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2172
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2173 2173
 			// if array has more than one element than success message should be plural
2174
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2174
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2175 2175
 			// cycle thru checkboxes
2176
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2176
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2177 2177
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
2178
-				if ( ! $REG instanceof EE_Registration )
2178
+				if ( ! $REG instanceof EE_Registration)
2179 2179
 					continue;
2180 2180
 				$deleted = $this->_delete_registration($REG);
2181
-				if ( !$deleted ) {
2181
+				if ( ! $deleted) {
2182 2182
 					$success = 0;
2183 2183
 				}
2184 2184
 			}
@@ -2188,15 +2188,15 @@  discard block
 block discarded – undo
2188 2188
 			$REG_ID = $this->_req_data['_REG_ID'];
2189 2189
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
2190 2190
 			$deleted = $this->_delete_registration($REG);
2191
-			if ( ! $deleted ) {
2191
+			if ( ! $deleted) {
2192 2192
 				$success = 0;
2193 2193
 			}
2194 2194
 
2195 2195
 		}
2196 2196
 
2197
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2198
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
2199
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
2197
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2198
+		$action_desc = __('permanently deleted.', 'event_espresso');
2199
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
2200 2200
 	}
2201 2201
 
2202 2202
 
@@ -2208,31 +2208,31 @@  discard block
 block discarded – undo
2208 2208
 	 * @param  EE_Registration $REG registration to be deleted permenantly
2209 2209
 	 * @return boolean              true = successful deletion, false = fail.
2210 2210
 	 */
2211
-	protected function _delete_registration( EE_Registration $REG ) {
2211
+	protected function _delete_registration(EE_Registration $REG) {
2212 2212
 		//first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.
2213 2213
 		$TXN = $REG->get_first_related('Transaction');
2214 2214
 		$REGS = $TXN->get_many_related('Registration');
2215 2215
 
2216 2216
 		$all_trashed = TRUE;
2217
-		foreach ( $REGS as $registration ) {
2218
-			if ( ! $registration->get('REG_deleted') )
2217
+		foreach ($REGS as $registration) {
2218
+			if ( ! $registration->get('REG_deleted'))
2219 2219
 				$all_trashed = FALSE;
2220 2220
 		}
2221 2221
 
2222
-		if ( ! $all_trashed ) {
2223
-			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2222
+		if ( ! $all_trashed) {
2223
+			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2224 2224
 			return false;
2225 2225
 		}
2226 2226
 
2227 2227
 		//k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).
2228
-		foreach ( $REGS as $registration ) {
2228
+		foreach ($REGS as $registration) {
2229 2229
 
2230 2230
 			//delete related answers
2231 2231
 			$registration->delete_related_permanently('Answer');
2232 2232
 
2233 2233
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
2234 2234
 			$attendee = $registration->get_first_related('Attendee');
2235
-			if ( $attendee instanceof EE_Attendee ) {
2235
+			if ($attendee instanceof EE_Attendee) {
2236 2236
 				$registration->_remove_relation_to($attendee, 'Attendee');
2237 2237
 			}
2238 2238
 
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
 			//now delete permanently the checkins related to this registration.
2243 2243
 			$registration->delete_related_permanently('Checkin');
2244 2244
 
2245
-			if ( $registration->ID() === $REG->ID() )
2245
+			if ($registration->ID() === $REG->ID())
2246 2246
 				continue; //we don't want to delete permanently the existing registration just yet.
2247 2247
 
2248 2248
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2279,35 +2279,35 @@  discard block
 block discarded – undo
2279 2279
 	 * @return void
2280 2280
 	 */
2281 2281
 	public function new_registration() {
2282
-		if ( ! $this->_set_reg_event() ) {
2283
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2282
+		if ( ! $this->_set_reg_event()) {
2283
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2284 2284
 		}
2285
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2285
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2286 2286
 		// gotta start with a clean slate if we're not coming here via ajax
2287 2287
 		if (
2288
-			! defined('DOING_AJAX' )
2289
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2288
+			! defined('DOING_AJAX')
2289
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2290 2290
 		) {
2291
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2291
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2292 2292
 		}
2293 2293
 
2294
-		$this->_template_args['event_name'] = '' ;
2294
+		$this->_template_args['event_name'] = '';
2295 2295
 		// event name
2296
-		if ( $this->_reg_event ) {
2296
+		if ($this->_reg_event) {
2297 2297
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2298
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2299
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2300
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2298
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2299
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2300
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2301 2301
 		}
2302 2302
 
2303 2303
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2304 2304
 
2305
-		if ( defined('DOING_AJAX' ) ) {
2305
+		if (defined('DOING_AJAX')) {
2306 2306
 			$this->_return_json();
2307 2307
 		}
2308 2308
 		// grab header
2309
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2310
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2309
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2310
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2311 2311
 
2312 2312
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2313 2313
 		// the details template wrapper
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
 	 * @return string html
2325 2325
 	 */
2326 2326
 	protected function _get_registration_step_content() {
2327
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2327
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2328 2328
 			$warning_msg = sprintf(
2329 2329
 				__(
2330 2330
 					'%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
@@ -2340,7 +2340,7 @@  discard block
 block discarded – undo
2340 2340
 				'</b>'
2341 2341
 			);
2342 2342
 			return '
2343
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2343
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2344 2344
 	<script >
2345 2345
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2346 2346
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2375,16 +2375,16 @@  discard block
 block discarded – undo
2375 2375
 		$cart = EE_Registry::instance()->SSN->cart();
2376 2376
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2377 2377
 
2378
-		switch ( $step ) {
2378
+		switch ($step) {
2379 2379
 			case 'ticket' :
2380 2380
 				$hidden_fields['processing_registration']['value'] = 1;
2381 2381
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2382
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2382
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2383 2383
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2384 2384
 				$template_args['show_notification_toggle'] = FALSE;
2385 2385
 				break;
2386 2386
 			case 'questions' :
2387
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2387
+				$hidden_fields['processing_registration']['value'] = 2;
2388 2388
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2389 2389
 				//in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run.
2390 2390
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2393,10 +2393,10 @@  discard block
 block discarded – undo
2393 2393
 				break;
2394 2394
 		}
2395 2395
 
2396
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2396
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2397 2397
 
2398 2398
 		return EEH_Template::display_template(
2399
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2399
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2400 2400
 		);
2401 2401
 	}
2402 2402
 
@@ -2411,11 +2411,11 @@  discard block
 block discarded – undo
2411 2411
 	*		@return boolean
2412 2412
 	*/
2413 2413
 	private function _set_reg_event() {
2414
-		if ( is_object( $this->_reg_event )) {
2414
+		if (is_object($this->_reg_event)) {
2415 2415
 			return TRUE;
2416 2416
 		}
2417
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2418
-		if ( ! $EVT_ID ) {
2417
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2418
+		if ( ! $EVT_ID) {
2419 2419
 			return FALSE;
2420 2420
 		}
2421 2421
 
@@ -2436,80 +2436,80 @@  discard block
 block discarded – undo
2436 2436
 	public function process_reg_step() {
2437 2437
 		EE_System::do_not_cache();
2438 2438
 		$this->_set_reg_event();
2439
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2439
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2440 2440
 
2441 2441
 		//what step are we on?
2442 2442
 		$cart = EE_Registry::instance()->SSN->cart();
2443 2443
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2444 2444
 
2445 2445
 		//if doing ajax then we need to verify the nonce
2446
-		if ( defined( 'DOING_AJAX' ) ) {
2447
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2448
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2446
+		if (defined('DOING_AJAX')) {
2447
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2448
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2449 2449
 		}
2450 2450
 
2451
-		switch ( $step ) {
2451
+		switch ($step) {
2452 2452
 
2453 2453
 			case 'ticket' :
2454 2454
 				//process ticket selection
2455 2455
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2456
-				if ( $success ) {
2457
-					EE_Error::add_success( esc_html__( 'Tickets Selected. Now complete the registration.', 'event_espresso' ) );
2456
+				if ($success) {
2457
+					EE_Error::add_success(esc_html__('Tickets Selected. Now complete the registration.', 'event_espresso'));
2458 2458
 				} else {
2459 2459
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2460 2460
 				}
2461
-				if ( defined('DOING_AJAX') ) {
2461
+				if (defined('DOING_AJAX')) {
2462 2462
 					$this->new_registration(); //display next step
2463 2463
 				} else {
2464 2464
 					$query_args['action'] = 'new_registration';
2465 2465
 					$query_args['processing_registration'] = 1;
2466 2466
 					$query_args['event_id'] = $this->_reg_event->ID();
2467
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2467
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2468 2468
 				}
2469 2469
 				break;
2470 2470
 
2471 2471
 			case 'questions' :
2472
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2473
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2472
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2473
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2474 2474
 				}
2475 2475
 				//process registration
2476 2476
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2477
-				if ( $cart instanceof EE_Cart ) {
2477
+				if ($cart instanceof EE_Cart) {
2478 2478
 					$grand_total = $cart->get_cart_grand_total();
2479
-					if ( $grand_total instanceof EE_Line_Item ) {
2479
+					if ($grand_total instanceof EE_Line_Item) {
2480 2480
 						$grand_total->save_this_and_descendants_to_txn();
2481 2481
 					}
2482 2482
 				}
2483
-				if ( ! $transaction instanceof EE_Transaction ) {
2483
+				if ( ! $transaction instanceof EE_Transaction) {
2484 2484
 					$query_args = array(
2485 2485
 						'action' => 'new_registration',
2486 2486
 						'processing_registration' => 2,
2487 2487
 						'event_id' => $this->_reg_event->ID()
2488 2488
 					);
2489 2489
 
2490
-					if ( defined('DOING_AJAX' )) {
2490
+					if (defined('DOING_AJAX')) {
2491 2491
 						//display registration form again because there are errors (maybe validation?)
2492 2492
 						$this->new_registration();
2493 2493
 						return;
2494 2494
 					} else {
2495
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2495
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2496 2496
 						return;
2497 2497
 					}
2498 2498
 				}
2499 2499
 				// maybe update status, and make sure to save transaction if not done already
2500
-				if ( ! $transaction->update_status_based_on_total_paid() ) {
2500
+				if ( ! $transaction->update_status_based_on_total_paid()) {
2501 2501
 					$transaction->save();
2502 2502
 				}
2503
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2503
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2504 2504
 				$this->_req_data = array();
2505 2505
 				$query_args = array(
2506 2506
 					'action'        => 'redirect_to_txn',
2507 2507
 					'TXN_ID'        => $transaction->ID(),
2508 2508
 					'EVT_ID'        => $this->_reg_event->ID(),
2509
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2509
+					'event_name'    => urlencode($this->_reg_event->name()),
2510 2510
 					'redirect_from' => 'new_registration'
2511 2511
 				);
2512
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2512
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2513 2513
 				break;
2514 2514
 		}
2515 2515
 
@@ -2526,21 +2526,21 @@  discard block
 block discarded – undo
2526 2526
 	 */
2527 2527
 	public function redirect_to_txn() {
2528 2528
 		EE_System::do_not_cache();
2529
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2529
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2530 2530
 		$query_args = array(
2531 2531
 			'action' => 'view_transaction',
2532
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2532
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2533 2533
 			'page'   => 'espresso_transactions'
2534 2534
 		);
2535
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2536
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2537
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2538
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2535
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2536
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2537
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2538
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2539 2539
 		}
2540 2540
 		EE_Error::add_success(
2541
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2541
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2542 2542
 		);
2543
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2543
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2544 2544
 	}
2545 2545
 
2546 2546
 
@@ -2551,7 +2551,7 @@  discard block
 block discarded – undo
2551 2551
 	*		@return void
2552 2552
 	*/
2553 2553
 	protected function _attendee_contact_list_table() {
2554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2555 2555
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2556 2556
 		$this->display_admin_list_table_page_with_no_sidebar();
2557 2557
 	}
@@ -2566,10 +2566,10 @@  discard block
 block discarded – undo
2566 2566
 	*		@access public
2567 2567
 	*		@return array
2568 2568
 	*/
2569
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2569
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2570 2570
 
2571
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2572
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2571
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2572
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2573 2573
 		$ATT_MDL = EEM_Attendee::instance();
2574 2574
 
2575 2575
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2597,47 +2597,47 @@  discard block
 block discarded – undo
2597 2597
 				$orderby = 'ATT_lname';
2598 2598
 		}
2599 2599
 
2600
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2600
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2601 2601
 
2602
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2603
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2604
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2602
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2603
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2604
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2605 2605
 
2606 2606
 		$_where = array();
2607 2607
 
2608
-		if ( ! empty( $this->_req_data['s'] ) ) {
2609
-			$sstr = '%' . $this->_req_data['s'] . '%';
2608
+		if ( ! empty($this->_req_data['s'])) {
2609
+			$sstr = '%'.$this->_req_data['s'].'%';
2610 2610
 			$_where['OR'] = array(
2611
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2612
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2613
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2614
-				'ATT_fname' => array( 'LIKE', $sstr ),
2615
-				'ATT_lname' => array( 'LIKE', $sstr ),
2616
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2617
-				'ATT_email' => array('LIKE', $sstr ),
2618
-				'ATT_address' => array( 'LIKE', $sstr ),
2619
-				'ATT_address2' => array( 'LIKE', $sstr ),
2620
-				'ATT_city' => array( 'LIKE', $sstr ),
2621
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2622
-				'State.STA_name' => array('LIKE', $sstr ),
2623
-				'ATT_phone' => array( 'LIKE', $sstr ),
2624
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2625
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2626
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2627
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2611
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2612
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2613
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2614
+				'ATT_fname' => array('LIKE', $sstr),
2615
+				'ATT_lname' => array('LIKE', $sstr),
2616
+				'ATT_short_bio' => array('LIKE', $sstr),
2617
+				'ATT_email' => array('LIKE', $sstr),
2618
+				'ATT_address' => array('LIKE', $sstr),
2619
+				'ATT_address2' => array('LIKE', $sstr),
2620
+				'ATT_city' => array('LIKE', $sstr),
2621
+				'Country.CNT_name' => array('LIKE', $sstr),
2622
+				'State.STA_name' => array('LIKE', $sstr),
2623
+				'ATT_phone' => array('LIKE', $sstr),
2624
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2625
+				'Registration.REG_code' => array('LIKE', $sstr),
2626
+				'Registration.REG_count' => array('LIKE', $sstr),
2627
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2628 2628
 				);
2629 2629
 		}
2630 2630
 
2631 2631
 
2632
-		$offset = ($current_page-1)*$per_page;
2633
-		$limit = $count ? NULL : array( $offset, $per_page );
2632
+		$offset = ($current_page - 1) * $per_page;
2633
+		$limit = $count ? NULL : array($offset, $per_page);
2634 2634
 
2635
-		if ( $trash ) {
2636
-			$_where['status'] = array( '!=', 'publish' );
2637
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true ): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2635
+		if ($trash) {
2636
+			$_where['status'] = array('!=', 'publish');
2637
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2638 2638
 		} else {
2639
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2640
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit ), 'ATT_ID' , true ) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2639
+			$_where['status'] = array('IN', array('publish'));
2640
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2641 2641
 		}
2642 2642
 
2643 2643
 		return $all_attendees;
@@ -2654,10 +2654,10 @@  discard block
 block discarded – undo
2654 2654
 	 */
2655 2655
 	protected function _resend_registration() {
2656 2656
 		$this->_process_resend_registration();
2657
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2657
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2658 2658
 			'action' => 'default'
2659 2659
 		);
2660
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2660
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2661 2661
 	}
2662 2662
 
2663 2663
 
@@ -2665,26 +2665,26 @@  discard block
 block discarded – undo
2665 2665
 
2666 2666
 
2667 2667
 
2668
-	public function _registrations_report(){
2669
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2670
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2668
+	public function _registrations_report() {
2669
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2670
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2671 2671
 				array(
2672 2672
 					'page' => 'espresso_batch',
2673 2673
 					'batch' => 'file',
2674
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2675
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2676
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2677
-				)) );
2674
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2675
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2676
+					'return_url' => urlencode($this->_req_data['return_url']),
2677
+				)));
2678 2678
 		} else {
2679 2679
 			$new_request_args = array(
2680 2680
 				'export' => 'report',
2681 2681
 				'action' => 'registrations_report_for_event',
2682
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2682
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2683 2683
 			);
2684 2684
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2685 2685
 
2686
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2687
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2686
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2687
+				require_once(EE_CLASSES.'EE_Export.class.php');
2688 2688
 				$EE_Export = EE_Export::instance($this->_req_data);
2689 2689
 				$EE_Export->export();
2690 2690
 			}
@@ -2693,26 +2693,26 @@  discard block
 block discarded – undo
2693 2693
 
2694 2694
 
2695 2695
 
2696
-	public function _contact_list_export(){
2697
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2698
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2696
+	public function _contact_list_export() {
2697
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2698
+			require_once(EE_CLASSES.'EE_Export.class.php');
2699 2699
 			$EE_Export = EE_Export::instance($this->_req_data);
2700 2700
 			$EE_Export->export_attendees();
2701 2701
 		}
2702 2702
 	}
2703 2703
 
2704
-	public function _contact_list_report(){
2705
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2706
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2704
+	public function _contact_list_report() {
2705
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2706
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2707 2707
 				array(
2708 2708
 					'page' => 'espresso_batch',
2709 2709
 					'batch' => 'file',
2710
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2711
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2712
-				)) );
2710
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2711
+					'return_url' => urlencode($this->_req_data['return_url']),
2712
+				)));
2713 2713
 		} else {
2714
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2715
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2714
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2715
+				require_once(EE_CLASSES.'EE_Export.class.php');
2716 2716
 				$EE_Export = EE_Export::instance($this->_req_data);
2717 2717
 				$EE_Export->report_attendees();
2718 2718
 			}
@@ -2731,73 +2731,73 @@  discard block
 block discarded – undo
2731 2731
 	 * @return void
2732 2732
 	 */
2733 2733
 	protected function _duplicate_attendee() {
2734
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2734
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2735 2735
 		//verify we have necessary info
2736
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2737
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2738
-			$query_args = array( 'action' => $action );
2736
+		if (empty($this->_req_data['_REG_ID'])) {
2737
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2738
+			$query_args = array('action' => $action);
2739 2739
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2740 2740
 		}
2741 2741
 
2742 2742
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2743
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2743
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2744 2744
 		$attendee = $registration->attendee();
2745 2745
 
2746 2746
 		//remove relation of existing attendee on registration
2747
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2747
+		$registration->_remove_relation_to($attendee, 'Attendee');
2748 2748
 		//new attendee
2749 2749
 		$new_attendee = clone $attendee;
2750
-		$new_attendee->set( 'ATT_ID', 0 );
2750
+		$new_attendee->set('ATT_ID', 0);
2751 2751
 		$new_attendee->save();
2752 2752
 
2753 2753
 		//add new attendee to reg
2754
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2754
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2755 2755
 
2756
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2756
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2757 2757
 
2758 2758
 		//redirect to edit page for attendee
2759
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2759
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2760 2760
 
2761
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2761
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2762 2762
 	}
2763 2763
 
2764 2764
 
2765 2765
 	//related to cpt routes
2766 2766
 	protected function _insert_update_cpt_item($post_id, $post) {
2767 2767
 		$success = true;
2768
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2768
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2769 2769
 		//for attendee updates
2770
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2770
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2771 2771
 			//note we should only be UPDATING attendees at this point.
2772 2772
 			$updated_fields = array(
2773 2773
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2774 2774
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2775
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2775
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2776 2776
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2777 2777
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2778
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2779
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2780
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2781
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2782
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2783
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2778
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2779
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2780
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2781
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2782
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2783
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2784 2784
 				);
2785
-			foreach ( $updated_fields as $field => $value ) {
2785
+			foreach ($updated_fields as $field => $value) {
2786 2786
 				$attendee->set($field, $value);
2787 2787
 			}
2788 2788
 
2789 2789
 			$success = $attendee->save();
2790 2790
 
2791
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2792
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2793
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2794
-					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) );
2791
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2792
+			foreach ($attendee_update_callbacks as $a_callback) {
2793
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2794
+					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback));
2795 2795
 				}
2796 2796
 			}
2797 2797
 		}
2798 2798
 
2799
-		if ( $success === FALSE )
2800
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2799
+		if ($success === FALSE)
2800
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2801 2801
 
2802 2802
 	}
2803 2803
 
@@ -2817,17 +2817,17 @@  discard block
 block discarded – undo
2817 2817
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2818 2818
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2819 2819
 
2820
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2821
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2820
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2821
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2822 2822
 		}
2823 2823
 
2824
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2824
+		if (post_type_supports('espresso_attendees', 'comments')) {
2825 2825
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2826 2826
 		}
2827 2827
 
2828
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2829
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2830
-		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2828
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2829
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2830
+		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2831 2831
 	}
2832 2832
 
2833 2833
 
@@ -2836,10 +2836,10 @@  discard block
 block discarded – undo
2836 2836
 	 * @param  WP_Post $post wp post object
2837 2837
 	 * @return string        attendee contact info ( and form )
2838 2838
 	 */
2839
-	public function attendee_contact_info( $post ) {
2839
+	public function attendee_contact_info($post) {
2840 2840
 		//get attendee object ( should already have it )
2841 2841
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2842
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2842
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2843 2843
 		EEH_Template::display_template($template, $this->_template_args);
2844 2844
 	}
2845 2845
 
@@ -2855,12 +2855,12 @@  discard block
 block discarded – undo
2855 2855
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2856 2856
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2857 2857
 				new EE_Question_Form_Input(
2858
-				EE_Question::new_instance( array(
2858
+				EE_Question::new_instance(array(
2859 2859
 					'QST_ID' => 0,
2860 2860
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2861 2861
 					'QST_system' => 'admin-state'
2862 2862
 					)),
2863
-				EE_Answer::new_instance( array(
2863
+				EE_Answer::new_instance(array(
2864 2864
 					'ANS_ID' => 0,
2865 2865
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2866 2866
 					)),
@@ -2873,12 +2873,12 @@  discard block
 block discarded – undo
2873 2873
 			));
2874 2874
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2875 2875
 				new EE_Question_Form_Input(
2876
-				EE_Question::new_instance( array(
2876
+				EE_Question::new_instance(array(
2877 2877
 					'QST_ID' => 0,
2878 2878
 					'QST_display_text' => __('Country', 'event_espresso'),
2879 2879
 					'QST_system' => 'admin-country'
2880 2880
 					)),
2881
-				EE_Answer::new_instance( array(
2881
+				EE_Answer::new_instance(array(
2882 2882
 					'ANS_ID' => 0,
2883 2883
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2884 2884
 					)),
@@ -2889,8 +2889,8 @@  discard block
 block discarded – undo
2889 2889
 					'append_qstn_id' => FALSE
2890 2890
 					)
2891 2891
 				));
2892
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2893
-		EEH_Template::display_template($template, $this->_template_args );
2892
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2893
+		EEH_Template::display_template($template, $this->_template_args);
2894 2894
 
2895 2895
 	}
2896 2896
 
@@ -2900,11 +2900,11 @@  discard block
 block discarded – undo
2900 2900
 	*		@access protected
2901 2901
 	*		@return void
2902 2902
 	*/
2903
-	public function attendee_registrations_meta_box( $post ) {
2903
+	public function attendee_registrations_meta_box($post) {
2904 2904
 
2905 2905
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2906 2906
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2907
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2907
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2908 2908
 		EEH_Template::display_template($template, $this->_template_args);
2909 2909
 
2910 2910
 	}
@@ -2918,8 +2918,8 @@  discard block
 block discarded – undo
2918 2918
 	 * @return string        html for new form.
2919 2919
 	 */
2920 2920
 	public function after_title_form_fields($post) {
2921
-		if ( $post->post_type == 'espresso_attendees' ) {
2922
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2921
+		if ($post->post_type == 'espresso_attendees') {
2922
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2923 2923
 			$template_args['attendee'] = $this->_cpt_model_obj;
2924 2924
 			EEH_Template::display_template($template, $template_args);
2925 2925
 		}
@@ -2936,21 +2936,21 @@  discard block
 block discarded – undo
2936 2936
 	*		@access protected
2937 2937
 	*		@return void
2938 2938
 	*/
2939
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2939
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2940 2940
 
2941
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2941
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2942 2942
 
2943 2943
 		$ATT_MDL = EEM_Attendee::instance();
2944 2944
 
2945 2945
 		$success = 1;
2946 2946
 		//Checkboxes
2947
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2947
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2948 2948
 			// if array has more than one element than success message should be plural
2949
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2949
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2950 2950
 			// cycle thru checkboxes
2951
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2952
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2953
-				if ( !$updated ) {
2951
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2952
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2953
+				if ( ! $updated) {
2954 2954
 					$success = 0;
2955 2955
 				}
2956 2956
 			}
@@ -2959,18 +2959,18 @@  discard block
 block discarded – undo
2959 2959
 			// grab single id and delete
2960 2960
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2961 2961
 			//get attendee
2962
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2962
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2963 2963
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2964 2964
 			$updated = $att->save();
2965
-			if ( ! $updated ) {
2965
+			if ( ! $updated) {
2966 2966
 				$success = 0;
2967 2967
 			}
2968 2968
 
2969 2969
 		}
2970 2970
 
2971
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2972
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2973
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2971
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2972
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2973
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2974 2974
 
2975 2975
 	}
2976 2976
 
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Proper.form.php 1 patch
Spacing   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8 8
  * However, you may output the form (usually by calling get_html) anywhere you like.
9 9
  */
10
-class EE_Form_Section_Proper extends EE_Form_Section_Validatable{
10
+class EE_Form_Section_Proper extends EE_Form_Section_Validatable {
11 11
 
12 12
 	const SUBMITTED_FORM_DATA_SSN_KEY = 'submitted_form_data';
13 13
 
@@ -71,52 +71,52 @@  discard block
 block discarded – undo
71 71
 	 *                               } @see EE_Form_Section_Validatable::__construct()
72 72
 	 * @throws \EE_Error
73 73
 	 */
74
-	public function __construct( $options_array = array() ){
75
-		$options_array = (array) apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this );
74
+	public function __construct($options_array = array()) {
75
+		$options_array = (array) apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this);
76 76
 		//call parent first, as it may be setting the name
77 77
 		parent::__construct($options_array);
78 78
 		//if they've included subsections in the constructor, add them now
79
-		if( isset( $options_array['include'] )){
79
+		if (isset($options_array['include'])) {
80 80
 			//we are going to make sure we ONLY have those subsections to include
81 81
 			//AND we are going to make sure they're in that specified order
82 82
 			$reordered_subsections = array();
83
-			foreach($options_array['include'] as $input_name){
84
-				if(isset($this->_subsections[$input_name])){
83
+			foreach ($options_array['include'] as $input_name) {
84
+				if (isset($this->_subsections[$input_name])) {
85 85
 					$reordered_subsections[$input_name] = $this->_subsections[$input_name];
86 86
 				}
87 87
 			}
88 88
 			$this->_subsections = $reordered_subsections;
89 89
 		}
90
-		if(isset($options_array['exclude'])){
90
+		if (isset($options_array['exclude'])) {
91 91
 			$exclude = $options_array['exclude'];
92 92
 			$this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
93 93
 		}
94
-		if(isset($options_array['layout_strategy'])){
94
+		if (isset($options_array['layout_strategy'])) {
95 95
 			$this->_layout_strategy = $options_array['layout_strategy'];
96 96
 		}
97
-		if( ! $this->_layout_strategy){
97
+		if ( ! $this->_layout_strategy) {
98 98
 			$this->_layout_strategy = is_admin() ? new EE_Admin_Two_Column_Layout() : new EE_Two_Column_Layout();
99 99
 		}
100 100
 		$this->_layout_strategy->_construct_finalize($this);
101 101
 
102 102
 		//ok so we are definitely going to want the forms JS,
103 103
 		//so enqueue it or remember to enqueue it during wp_enqueue_scripts
104
-		if( did_action( 'wp_enqueue_scripts' )
105
-			|| did_action( 'admin_enqueue_scripts' ) ) {
104
+		if (did_action('wp_enqueue_scripts')
105
+			|| did_action('admin_enqueue_scripts')) {
106 106
 			//ok so they've constructed this object after when they should have.
107 107
 			//just enqueue the generic form scripts and initialize the form immediately in the JS
108
-			\EE_Form_Section_Proper::wp_enqueue_scripts( true );
108
+			\EE_Form_Section_Proper::wp_enqueue_scripts(true);
109 109
 			\EE_Form_Section_Proper::wp_deregister_conflicting_scripts();
110 110
 		} else {
111
-			add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
112
-			add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
113
-			add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_deregister_conflicting_scripts' ), 100 );
114
-			add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_deregister_conflicting_scripts' ), 100 );
111
+			add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
112
+			add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
113
+			add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_deregister_conflicting_scripts'), 100);
114
+			add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_deregister_conflicting_scripts'), 100);
115 115
 		}
116
-		add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 );
116
+		add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
117 117
 
118
-		if( isset( $options_array[ 'name' ] ) ) {
119
-			$this->_construct_finalize( null, $options_array[ 'name' ] );
118
+		if (isset($options_array['name'])) {
119
+			$this->_construct_finalize(null, $options_array['name']);
120 120
 		}
121 121
 	}
122 122
 
@@ -129,25 +129,25 @@  discard block
 block discarded – undo
129 129
 	 * @param string                 $name
130 130
 	 * @throws \EE_Error
131 131
 	 */
132
-	public function _construct_finalize( $parent_form_section, $name ) {
132
+	public function _construct_finalize($parent_form_section, $name) {
133 133
 		parent::_construct_finalize($parent_form_section, $name);
134 134
 		$this->_set_default_name_if_empty();
135 135
 		$this->_set_default_html_id_if_empty();
136
-		foreach( $this->_subsections as $subsection_name => $subsection ){
137
-			if ( $subsection instanceof EE_Form_Section_Base ) {
138
-				$subsection->_construct_finalize( $this, $subsection_name );
136
+		foreach ($this->_subsections as $subsection_name => $subsection) {
137
+			if ($subsection instanceof EE_Form_Section_Base) {
138
+				$subsection->_construct_finalize($this, $subsection_name);
139 139
 			} else {
140 140
 				throw new EE_Error(
141 141
 					sprintf(
142
-						__( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ),
142
+						__('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'),
143 143
 						$subsection_name,
144 144
 						get_class($this),
145
-						$subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' )
145
+						$subsection ? get_class($subsection) : __('NULL', 'event_espresso')
146 146
 					)
147 147
 				);
148 148
 			}
149 149
 		}
150
-		do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name );
150
+		do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name);
151 151
 	}
152 152
 
153 153
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * Gets the layout strategy for this form section
157 157
 	 * @return EE_Form_Section_Layout_Base
158 158
 	 */
159
-	public function get_layout_strategy(){
159
+	public function get_layout_strategy() {
160 160
 		return $this->_layout_strategy;
161 161
 	}
162 162
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @param EE_Form_Input_Base $input
169 169
 	 * @return string
170 170
 	 */
171
-	public function get_html_for_input($input){
171
+	public function get_html_for_input($input) {
172 172
 		return $this->_layout_strategy->layout_input($input);
173 173
 	}
174 174
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param null $form_data
182 182
 	 * @return boolean
183 183
 	 */
184
-	public function was_submitted($form_data = NULL){
184
+	public function was_submitted($form_data = NULL) {
185 185
 		return $this->form_data_present_in($form_data);
186 186
 	}
187 187
 
@@ -206,21 +206,21 @@  discard block
 block discarded – undo
206 206
 	 *                             (eg you validated the data then stored it in the DB)
207 207
 	 *                             you may want to skip this step.
208 208
 	 */
209
-	public function receive_form_submission( $req_data = null, $validate = true ){
210
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate );
211
-		if( $req_data === null ){
212
-			$req_data = array_merge( $_GET, $_POST );
209
+	public function receive_form_submission($req_data = null, $validate = true) {
210
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate);
211
+		if ($req_data === null) {
212
+			$req_data = array_merge($_GET, $_POST);
213 213
 		}
214
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this );
215
-		$this->_normalize( $req_data );
216
-		if( $validate ){
214
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this);
215
+		$this->_normalize($req_data);
216
+		if ($validate) {
217 217
 			$this->_validate();
218 218
 			//if it's invalid, we're going to want to re-display so remember what they submitted
219
-			if ( ! $this->is_valid() ) {
219
+			if ( ! $this->is_valid()) {
220 220
 				$this->store_submitted_form_data_in_session();
221 221
 			}
222 222
 		}
223
-		do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate );
223
+		do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate);
224 224
 	}
225 225
 
226 226
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	protected function store_submitted_form_data_in_session() {
235 235
 		return EE_Registry::instance()->SSN->set_session_data(
236 236
 			array(
237
-				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY => $this->submitted_values( true )
237
+				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY => $this->submitted_values(true)
238 238
 			)
239 239
 		);
240 240
 	}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	protected function get_submitted_form_data_from_session() {
251 251
 		$session = EE_Registry::instance()->SSN;
252
-		if( $session instanceof EE_Session ) {
252
+		if ($session instanceof EE_Session) {
253 253
 			return $session->get_session_data(
254 254
 				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY
255 255
 			);
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	protected function flush_submitted_form_data_from_session() {
269 269
 		return EE_Registry::instance()->SSN->reset_data(
270
-			array( \EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY )
270
+			array(\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY)
271 271
 		);
272 272
 	}
273 273
 
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
 	 */
284 284
 	public function populate_from_session() {
285 285
 		$form_data_in_session = $this->get_submitted_form_data_from_session();
286
-		if ( empty( $form_data_in_session ) ) {
286
+		if (empty($form_data_in_session)) {
287 287
 			return false;
288 288
 		}
289
-		$this->receive_form_submission( $form_data_in_session );
289
+		$this->receive_form_submission($form_data_in_session);
290 290
 		$this->flush_submitted_form_data_from_session();
291
-		if ( $this->form_data_present_in( $form_data_in_session ) ) {
291
+		if ($this->form_data_present_in($form_data_in_session)) {
292 292
 			return true;
293 293
 		} else {
294 294
 			return false;
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 	 * the value being an array formatted in teh same way
306 306
 	 * @param array $default_data
307 307
 	 */
308
-	public function populate_defaults($default_data){
309
-		foreach($this->subsections() as $subsection_name => $subsection){
310
-			if(isset($default_data[$subsection_name])){
311
-				if($subsection instanceof EE_Form_Input_Base){
308
+	public function populate_defaults($default_data) {
309
+		foreach ($this->subsections() as $subsection_name => $subsection) {
310
+			if (isset($default_data[$subsection_name])) {
311
+				if ($subsection instanceof EE_Form_Input_Base) {
312 312
 					$subsection->set_default($default_data[$subsection_name]);
313
-				}elseif($subsection instanceof EE_Form_Section_Proper){
313
+				}elseif ($subsection instanceof EE_Form_Section_Proper) {
314 314
 					$subsection->populate_defaults($default_data[$subsection_name]);
315 315
 				}
316 316
 			}
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 	 * @param string $name
326 326
 	 * @return boolean
327 327
 	 */
328
-	public function subsection_exists( $name ){
329
-		return isset( $this->_subsections[ $name ] ) ? true : false;
328
+	public function subsection_exists($name) {
329
+		return isset($this->_subsections[$name]) ? true : false;
330 330
 	}
331 331
 
332 332
 
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 	 * @return EE_Form_Section_Base
345 345
 	 * @throws \EE_Error
346 346
 	 */
347
-	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
348
-		if( $require_construction_to_be_finalized ){
347
+	public function get_subsection($name, $require_construction_to_be_finalized = TRUE) {
348
+		if ($require_construction_to_be_finalized) {
349 349
 			$this->ensure_construct_finalized_called();
350 350
 		}
351
-		return $this->subsection_exists( $name ) ? $this->_subsections[$name] : NULL;
351
+		return $this->subsection_exists($name) ? $this->_subsections[$name] : NULL;
352 352
 	}
353 353
 
354 354
 
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 	 * Gets all the validatable subsections of this form section
358 358
 	 * @return EE_Form_Section_Validatable[]
359 359
 	 */
360
-	public function get_validatable_subsections(){
360
+	public function get_validatable_subsections() {
361 361
 		$validatable_subsections = array();
362
-		foreach($this->subsections() as $name=>$obj){
363
-			if($obj instanceof EE_Form_Section_Validatable){
362
+		foreach ($this->subsections() as $name=>$obj) {
363
+			if ($obj instanceof EE_Form_Section_Validatable) {
364 364
 				$validatable_subsections[$name] = $obj;
365 365
 			}
366 366
 		}
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
 	 * @return EE_Form_Input_Base
381 381
 	 * @throws EE_Error
382 382
 	 */
383
-	public function get_input($name, $require_construction_to_be_finalized = TRUE ){
383
+	public function get_input($name, $require_construction_to_be_finalized = TRUE) {
384 384
 		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
385
-		if( ! $subsection instanceof EE_Form_Input_Base){
385
+		if ( ! $subsection instanceof EE_Form_Input_Base) {
386 386
 			throw new EE_Error(
387 387
 				sprintf(
388 388
 					__(
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 						'event_espresso'
391 391
 					),
392 392
 					$name,
393
-					get_class( $this ),
394
-					$subsection ? get_class( $subsection ) : __( "NULL", 'event_espresso' )
393
+					get_class($this),
394
+					$subsection ? get_class($subsection) : __("NULL", 'event_espresso')
395 395
 				)
396 396
 			);
397 397
 		}
@@ -411,14 +411,14 @@  discard block
 block discarded – undo
411 411
 	 * @return EE_Form_Section_Proper
412 412
 	 * @throws EE_Error
413 413
 	 */
414
-	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){
415
-		$subsection = $this->get_subsection( $name, $require_construction_to_be_finalized );
416
-		if( ! $subsection instanceof EE_Form_Section_Proper){
414
+	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) {
415
+		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
416
+		if ( ! $subsection instanceof EE_Form_Section_Proper) {
417 417
 			throw new EE_Error(
418 418
 				sprintf(
419
-					__( "Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso' ),
419
+					__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),
420 420
 					$name,
421
-					get_class( $this )
421
+					get_class($this)
422 422
 				)
423 423
 			);
424 424
 		}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 * @return mixed depending on the input's type and its normalization strategy
436 436
 	 * @throws \EE_Error
437 437
 	 */
438
-	public function get_input_value($name){
438
+	public function get_input_value($name) {
439 439
 		$input = $this->get_input($name);
440 440
 		return $input->normalized_value();
441 441
 	}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 * @return boolean
449 449
 	 */
450 450
 	public function is_valid() {
451
-		if( ! $this->has_received_submission()){
451
+		if ( ! $this->has_received_submission()) {
452 452
 			throw new EE_Error(
453 453
 				sprintf(
454 454
 					__(
@@ -458,16 +458,16 @@  discard block
 block discarded – undo
458 458
 				)
459 459
 			);
460 460
 		}
461
-		if( ! parent::is_valid() ) {
461
+		if ( ! parent::is_valid()) {
462 462
 			return false;
463 463
 		}
464 464
 		// ok so no general errors to this entire form section.
465 465
 		// so let's check the subsections, but only set errors if that hasn't been done yet
466 466
 		$set_submission_errors = $this->submission_error_message() === '' ? true : false;
467
-		foreach( $this->get_validatable_subsections() as $subsection ){
468
-			if( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '' ){
469
-				if ( $set_submission_errors ) {
470
-					$this->set_submission_error_message( $subsection->get_validation_error_string() );
467
+		foreach ($this->get_validatable_subsections() as $subsection) {
468
+			if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '') {
469
+				if ($set_submission_errors) {
470
+					$this->set_submission_error_message($subsection->get_validation_error_string());
471 471
 				}
472 472
 				return false;
473 473
 			}
@@ -481,11 +481,11 @@  discard block
 block discarded – undo
481 481
 	 * gets teh default name of this form section if none is specified
482 482
 	 * @return string
483 483
 	 */
484
-	protected function _set_default_name_if_empty(){
485
-		if( ! $this->_name ){
484
+	protected function _set_default_name_if_empty() {
485
+		if ( ! $this->_name) {
486 486
 			$classname = get_class($this);
487 487
 			$default_name = str_replace("EE_", "", $classname);
488
-			$this->_name =  $default_name;
488
+			$this->_name = $default_name;
489 489
 		}
490 490
 	}
491 491
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	 *             and get_html when you are about to display the form.
502 502
 	 * @throws \EE_Error
503 503
 	 */
504
-	public function get_html_and_js(){
504
+	public function get_html_and_js() {
505 505
 		//no doing_it_wrong yet because we ourselves are still doing it wrong...
506 506
 		//and theoretically this CAN be used properly, provided its used during "wp_enqueue_scripts"
507 507
 		$this->enqueue_js();
@@ -516,9 +516,9 @@  discard block
 block discarded – undo
516 516
 	 * @param bool $display_previously_submitted_data
517 517
 	 * @return string
518 518
 	 */
519
-	public function get_html( $display_previously_submitted_data = true ){
519
+	public function get_html($display_previously_submitted_data = true) {
520 520
 		$this->ensure_construct_finalized_called();
521
-		if ( $display_previously_submitted_data ) {
521
+		if ($display_previously_submitted_data) {
522 522
 			$this->populate_from_session();
523 523
 		}
524 524
 		return $this->_layout_strategy->layout_form();
@@ -532,9 +532,9 @@  discard block
 block discarded – undo
532 532
 	 * @return string
533 533
 	 * @throws \EE_Error
534 534
 	 */
535
-	public function enqueue_js(){
535
+	public function enqueue_js() {
536 536
 		$this->_enqueue_and_localize_form_js();
537
-		foreach( $this->subsections() as $subsection ) {
537
+		foreach ($this->subsections() as $subsection) {
538 538
 			$subsection->enqueue_js();
539 539
 		}
540 540
 	}
@@ -553,19 +553,19 @@  discard block
 block discarded – undo
553 553
 	 *                                                    to be triggered automatically or not
554 554
 	 * @return void
555 555
 	 */
556
-	public static function wp_enqueue_scripts( $init_form_validation_automatically = true ){
557
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
556
+	public static function wp_enqueue_scripts($init_form_validation_automatically = true) {
557
+		add_filter('FHEE_load_jquery_validate', '__return_true');
558 558
 		wp_register_script(
559 559
 			'ee_form_section_validation',
560
-			EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js',
561
-			array( 'jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods' ),
560
+			EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js',
561
+			array('jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods'),
562 562
 			EVENT_ESPRESSO_VERSION,
563 563
 			true
564 564
 		);
565 565
 		wp_localize_script(
566 566
 			'ee_form_section_validation',
567 567
 			'ee_form_section_validation_init',
568
-			array( 'init' => $init_form_validation_automatically ? true : false )
568
+			array('init' => $init_form_validation_automatically ? true : false)
569 569
 		);
570 570
 	}
571 571
 	
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	public static function wp_deregister_conflicting_scripts() {
577 577
 		//jquery-form (included in WP core, but deprecated) also declares some of the same methods 
578 578
 		//as jquery validate
579
-		wp_deregister_script( 'jquery-form' );
579
+		wp_deregister_script('jquery-form');
580 580
 	}
581 581
 
582 582
 
@@ -588,14 +588,14 @@  discard block
 block discarded – undo
588 588
 	 *
589 589
 	 * @throws \EE_Error
590 590
 	 */
591
-	public function _enqueue_and_localize_form_js(){
591
+	public function _enqueue_and_localize_form_js() {
592 592
 		$this->ensure_construct_finalized_called();
593 593
 		//actually, we don't want to localize just yet. There may be other forms on the page.
594 594
 		//so we need to add our form section data to a static variable accessible by all form sections
595 595
 		//and localize it just before the footer
596 596
 		$this->localize_validation_rules();
597
-		add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 );
598
-		add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) );
597
+		add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2);
598
+		add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'));
599 599
 	}
600 600
 
601 601
 
@@ -607,12 +607,12 @@  discard block
 block discarded – undo
607 607
 	 * @return void
608 608
 	 * @throws \EE_Error
609 609
 	 */
610
-	public function localize_validation_rules( $return_for_subsection = FALSE ){
610
+	public function localize_validation_rules($return_for_subsection = FALSE) {
611 611
 		// we only want to localize vars ONCE for the entire form,
612 612
 		// so if the form section doesn't have a parent, then it must be the top dog
613
-		if ( $return_for_subsection || ! $this->parent_section() ) {
614
-			EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array(
615
-				'form_section_id'=> $this->html_id( TRUE ),
613
+		if ($return_for_subsection || ! $this->parent_section()) {
614
+			EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array(
615
+				'form_section_id'=> $this->html_id(TRUE),
616 616
 				'validation_rules'=> $this->get_jquery_validation_rules(),
617 617
 				'other_data' => $this->get_other_js_data(),
618 618
 				'errors'=> $this->subsection_validation_errors_by_html_name()
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
 	 * @param array $form_other_js_data
629 629
 	 * @return array
630 630
 	 */
631
-	public function get_other_js_data( $form_other_js_data = array() ) {
632
-		foreach( $this->subsections() as $subsection ) {
633
-			$form_other_js_data = $subsection->get_other_js_data( $form_other_js_data );
631
+	public function get_other_js_data($form_other_js_data = array()) {
632
+		foreach ($this->subsections() as $subsection) {
633
+			$form_other_js_data = $subsection->get_other_js_data($form_other_js_data);
634 634
 		}
635 635
 		return $form_other_js_data;
636 636
 	}
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
 	 * Keys are their form names, and values are the inputs themselves
642 642
 	 * @return EE_Form_Input_Base
643 643
 	 */
644
-	public function inputs_in_subsections(){
644
+	public function inputs_in_subsections() {
645 645
 		$inputs = array();
646
-		foreach($this->subsections() as $subsection){
647
-			if( $subsection instanceof EE_Form_Input_Base ){
648
-				$inputs[ $subsection->html_name() ] = $subsection;
649
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
646
+		foreach ($this->subsections() as $subsection) {
647
+			if ($subsection instanceof EE_Form_Input_Base) {
648
+				$inputs[$subsection->html_name()] = $subsection;
649
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
650 650
 				$inputs += $subsection->inputs_in_subsections();
651 651
 			}
652 652
 		}
@@ -659,12 +659,12 @@  discard block
 block discarded – undo
659 659
 	 * and values are a string of all their validation errors
660 660
 	 * @return string[]
661 661
 	 */
662
-	public function subsection_validation_errors_by_html_name(){
662
+	public function subsection_validation_errors_by_html_name() {
663 663
 		$inputs = $this->inputs();
664 664
 		$errors = array();
665
-		foreach( $inputs as $form_input ){
666
-			if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){
667
-				$errors[ $form_input->html_name() ] = $form_input->get_validation_error_string();
665
+		foreach ($inputs as $form_input) {
666
+			if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) {
667
+				$errors[$form_input->html_name()] = $form_input->get_validation_error_string();
668 668
 			}
669 669
 		}
670 670
 		return $errors;
@@ -676,15 +676,15 @@  discard block
 block discarded – undo
676 676
 	 * passes all the form data required by the JS to the JS, and enqueues the few required JS files.
677 677
 	 * Should be setup by each form during the _enqueues_and_localize_form_js
678 678
 	 */
679
-	public static function localize_script_for_all_forms(){
679
+	public static function localize_script_for_all_forms() {
680 680
 		//allow inputs and stuff to hook in their JS and stuff here
681
-		do_action( 'AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin' );
681
+		do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin');
682 682
 		EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages();
683
-		$email_validation_level = isset( EE_Registry::instance()->CFG->registration->email_validation_level )
683
+		$email_validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level)
684 684
 			? EE_Registry::instance()->CFG->registration->email_validation_level
685 685
 			: 'wp_default';
686 686
 		EE_Form_Section_Proper::$_js_localization['email_validation_level'] = $email_validation_level;
687
-		wp_enqueue_script( 'ee_form_section_validation' );
687
+		wp_enqueue_script('ee_form_section_validation');
688 688
 		wp_localize_script(
689 689
 			'ee_form_section_validation',
690 690
 			'ee_form_section_vars',
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
 	/**
698 698
 	 * ensure_scripts_localized
699 699
 	 */
700
-	public function ensure_scripts_localized(){
701
-		if ( ! EE_Form_Section_Proper::$_scripts_localized ) {
700
+	public function ensure_scripts_localized() {
701
+		if ( ! EE_Form_Section_Proper::$_scripts_localized) {
702 702
 			$this->_enqueue_and_localize_form_js();
703 703
 		}
704 704
 	}
@@ -710,10 +710,10 @@  discard block
 block discarded – undo
710 710
 	 * is that the key here should be the same as the custom validation rule put in the JS file
711 711
 	 * @return array keys are custom validation rules, and values are internationalized strings
712 712
 	 */
713
-	private static function _get_localized_error_messages(){
713
+	private static function _get_localized_error_messages() {
714 714
 		return array(
715 715
 			'validUrl'=>  __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"),
716
-			'regex' => __( 'Please check your input', 'event_espresso' ),
716
+			'regex' => __('Please check your input', 'event_espresso'),
717 717
 		);
718 718
 	}
719 719
 
@@ -743,9 +743,9 @@  discard block
 block discarded – undo
743 743
 	 *
744 744
 	 * @return array
745 745
 	 */
746
-	public function get_jquery_validation_rules(){
746
+	public function get_jquery_validation_rules() {
747 747
 		$jquery_validation_rules = array();
748
-		foreach($this->get_validatable_subsections() as $subsection){
748
+		foreach ($this->get_validatable_subsections() as $subsection) {
749 749
 			$jquery_validation_rules = array_merge(
750 750
 				$jquery_validation_rules,
751 751
 				$subsection->get_jquery_validation_rules()
@@ -762,14 +762,14 @@  discard block
 block discarded – undo
762 762
 	 * @param array $req_data like $_POST
763 763
 	 * @return void
764 764
 	 */
765
-	protected function _normalize( $req_data ) {
765
+	protected function _normalize($req_data) {
766 766
 		$this->_received_submission = true;
767 767
 		$this->_validation_errors = array();
768
-		foreach ( $this->get_validatable_subsections() as $subsection ) {
768
+		foreach ($this->get_validatable_subsections() as $subsection) {
769 769
 			try {
770
-				$subsection->_normalize( $req_data );
771
-			} catch ( EE_Validation_Error $e ) {
772
-				$subsection->add_validation_error( $e );
770
+				$subsection->_normalize($req_data);
771
+			} catch (EE_Validation_Error $e) {
772
+				$subsection->add_validation_error($e);
773 773
 			}
774 774
 		}
775 775
 	}
@@ -786,9 +786,9 @@  discard block
 block discarded – undo
786 786
 	 * calling parent::_validate() first.
787 787
 	 */
788 788
 	protected function _validate() {
789
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
790
-			if(method_exists($this,'_validate_'.$subsection_name)){
791
-				call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
789
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
790
+			if (method_exists($this, '_validate_'.$subsection_name)) {
791
+				call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
792 792
 			}
793 793
 			$subsection->_validate();
794 794
 		}
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
 	 * Gets all the validated inputs for the form section
801 801
 	 * @return array
802 802
 	 */
803
-	public function valid_data(){
803
+	public function valid_data() {
804 804
 		$inputs = array();
805
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
806
-			if ( $subsection instanceof EE_Form_Section_Proper ) {
807
-				$inputs[ $subsection_name ] = $subsection->valid_data();
808
-			} else if ( $subsection instanceof EE_Form_Input_Base ){
809
-				$inputs[ $subsection_name ] = $subsection->normalized_value();
805
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
806
+			if ($subsection instanceof EE_Form_Section_Proper) {
807
+				$inputs[$subsection_name] = $subsection->valid_data();
808
+			} else if ($subsection instanceof EE_Form_Input_Base) {
809
+				$inputs[$subsection_name] = $subsection->normalized_value();
810 810
 			}
811 811
 		}
812 812
 		return $inputs;
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
 	 * Gets all the inputs on this form section
819 819
 	 * @return EE_Form_Input_Base[]
820 820
 	 */
821
-	public function inputs(){
821
+	public function inputs() {
822 822
 		$inputs = array();
823
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
824
-			if ( $subsection instanceof EE_Form_Input_Base ){
825
-				$inputs[ $subsection_name ] = $subsection;
823
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
824
+			if ($subsection instanceof EE_Form_Input_Base) {
825
+				$inputs[$subsection_name] = $subsection;
826 826
 			}
827 827
 		}
828 828
 		return $inputs;
@@ -834,10 +834,10 @@  discard block
 block discarded – undo
834 834
 	 * Gets all the subsections which are a proper form
835 835
 	 * @return EE_Form_Section_Proper[]
836 836
 	 */
837
-	public function subforms(){
837
+	public function subforms() {
838 838
 		$form_sections = array();
839
-		foreach($this->subsections() as $name=>$obj){
840
-			if($obj instanceof EE_Form_Section_Proper){
839
+		foreach ($this->subsections() as $name=>$obj) {
840
+			if ($obj instanceof EE_Form_Section_Proper) {
841 841
 				$form_sections[$name] = $obj;
842 842
 			}
843 843
 		}
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 	 * if you only want form inputs or proper form sections.
853 853
 	 * @return EE_Form_Section_Proper[]
854 854
 	 */
855
-	public function subsections(){
855
+	public function subsections() {
856 856
 		$this->ensure_construct_finalized_called();
857 857
 		return $this->_subsections;
858 858
 	}
@@ -874,8 +874,8 @@  discard block
 block discarded – undo
874 874
 	 *                                        where keys are always subsection names and values are either
875 875
 	 *                                        the input's normalized value, or an array like the top-level array
876 876
 	 */
877
-	public function input_values( $include_subform_inputs = false, $flatten = false ){
878
-		return $this->_input_values( false, $include_subform_inputs, $flatten );
877
+	public function input_values($include_subform_inputs = false, $flatten = false) {
878
+		return $this->_input_values(false, $include_subform_inputs, $flatten);
879 879
 	}
880 880
 
881 881
 	/**
@@ -895,8 +895,8 @@  discard block
 block discarded – undo
895 895
 	 *                                        where keys are always subsection names and values are either
896 896
 	 *                                        the input's normalized value, or an array like the top-level array
897 897
 	 */
898
-	public function input_pretty_values(  $include_subform_inputs = false, $flatten = false ){
899
-		return $this->_input_values( true, $include_subform_inputs, $flatten );
898
+	public function input_pretty_values($include_subform_inputs = false, $flatten = false) {
899
+		return $this->_input_values(true, $include_subform_inputs, $flatten);
900 900
 	}
901 901
 
902 902
 	/**
@@ -914,19 +914,19 @@  discard block
 block discarded – undo
914 914
 	 *                                        where keys are always subsection names and values are either
915 915
 	 *                                        the input's normalized value, or an array like the top-level array
916 916
 	 */
917
-	public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) {
917
+	public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) {
918 918
 		$input_values = array();
919
-		foreach( $this->subsections() as $subsection_name => $subsection ) {
920
-			if( $subsection instanceof EE_Form_Input_Base ) {
921
-				$input_values[ $subsection_name ] = $pretty
919
+		foreach ($this->subsections() as $subsection_name => $subsection) {
920
+			if ($subsection instanceof EE_Form_Input_Base) {
921
+				$input_values[$subsection_name] = $pretty
922 922
 					? $subsection->pretty_value()
923 923
 					: $subsection->normalized_value();
924
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) {
925
-				$subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten );
926
-				if( $flatten ) {
927
-					$input_values = array_merge( $input_values, $subform_input_values );
924
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) {
925
+				$subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten);
926
+				if ($flatten) {
927
+					$input_values = array_merge($input_values, $subform_input_values);
928 928
 				} else {
929
-					$input_values[ $subsection_name ] = $subform_input_values;
929
+					$input_values[$subsection_name] = $subform_input_values;
930 930
 				}
931 931
 			}
932 932
 		}
@@ -947,23 +947,23 @@  discard block
 block discarded – undo
947 947
 	 *                                   where keys are always subsection names and values are either
948 948
 	 *                                   the input's normalized value, or an array like the top-level array
949 949
 	 */
950
-	public function submitted_values( $include_subforms = false ) {
950
+	public function submitted_values($include_subforms = false) {
951 951
 		$submitted_values = array();
952
-		foreach( $this->subsections() as $subsection ) {
953
-			if( $subsection instanceof EE_Form_Input_Base ) {
952
+		foreach ($this->subsections() as $subsection) {
953
+			if ($subsection instanceof EE_Form_Input_Base) {
954 954
 				// is this input part of an array of inputs?
955
-				if ( strpos( $subsection->html_name(), '[' ) !== false ) {
955
+				if (strpos($subsection->html_name(), '[') !== false) {
956 956
 					$full_input_name = \EEH_Array::convert_array_values_to_keys(
957
-						explode( '[', str_replace( ']', '', $subsection->html_name() ) ),
957
+						explode('[', str_replace(']', '', $subsection->html_name())),
958 958
 						$subsection->raw_value()
959 959
 					);
960
-					$submitted_values = array_replace_recursive( $submitted_values, $full_input_name );
960
+					$submitted_values = array_replace_recursive($submitted_values, $full_input_name);
961 961
 				} else {
962
-					$submitted_values[ $subsection->html_name() ] = $subsection->raw_value();
962
+					$submitted_values[$subsection->html_name()] = $subsection->raw_value();
963 963
 				}
964
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subforms ) {
965
-				$subform_input_values = $subsection->submitted_values( $include_subforms );
966
-				$submitted_values = array_replace_recursive( $submitted_values, $subform_input_values );
964
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subforms) {
965
+				$subform_input_values = $subsection->submitted_values($include_subforms);
966
+				$submitted_values = array_replace_recursive($submitted_values, $subform_input_values);
967 967
 			}
968 968
 		}
969 969
 		return $submitted_values;
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 	 * @return boolean
979 979
 	 * @throws \EE_Error
980 980
 	 */
981
-	public function has_received_submission(){
981
+	public function has_received_submission() {
982 982
 		$this->ensure_construct_finalized_called();
983 983
 		return $this->_received_submission;
984 984
 	}
@@ -991,8 +991,8 @@  discard block
 block discarded – undo
991 991
 	 * @param array $inputs_to_exclude values are the input names
992 992
 	 * @return void
993 993
 	 */
994
-	public function exclude($inputs_to_exclude = array()){
995
-		foreach($inputs_to_exclude as $input_to_exclude_name){
994
+	public function exclude($inputs_to_exclude = array()) {
995
+		foreach ($inputs_to_exclude as $input_to_exclude_name) {
996 996
 			unset($this->_subsections[$input_to_exclude_name]);
997 997
 		}
998 998
 	}
@@ -1003,8 +1003,8 @@  discard block
 block discarded – undo
1003 1003
 	 * @param array $inputs_to_hide
1004 1004
 	 * @throws \EE_Error
1005 1005
 	 */
1006
-	public function hide($inputs_to_hide= array()){
1007
-		foreach($inputs_to_hide as $input_to_hide){
1006
+	public function hide($inputs_to_hide = array()) {
1007
+		foreach ($inputs_to_hide as $input_to_hide) {
1008 1008
 			$input = $this->get_input($input_to_hide);
1009 1009
 
1010 1010
 			$input->set_display_strategy(new EE_Hidden_Display_Strategy());
@@ -1034,21 +1034,21 @@  discard block
 block discarded – undo
1034 1034
 	 * @return void
1035 1035
 	 * @throws \EE_Error
1036 1036
 	 */
1037
-	public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){
1038
-		foreach( $new_subsections as $subsection_name => $subsection ){
1039
-			if( ! $subsection instanceof EE_Form_Section_Base ){
1037
+	public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) {
1038
+		foreach ($new_subsections as $subsection_name => $subsection) {
1039
+			if ( ! $subsection instanceof EE_Form_Section_Base) {
1040 1040
 				EE_Error::add_error(
1041 1041
 					sprintf(
1042 1042
 						__(
1043 1043
 							"Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.",
1044 1044
 							"event_espresso"
1045 1045
 						),
1046
-						get_class( $subsection ),
1046
+						get_class($subsection),
1047 1047
 						$subsection_name,
1048 1048
 						$this->name()
1049 1049
 					)
1050 1050
 				);
1051
-				unset( $new_subsections[ $subsection_name ] );
1051
+				unset($new_subsections[$subsection_name]);
1052 1052
 			}
1053 1053
 		}
1054 1054
 		$this->_subsections = EEH_Array::insert_into_array(
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 		);
1060 1060
 
1061 1061
 
1062
-		if( $this->_construction_finalized ){
1063
-			foreach($this->_subsections as $name => $subsection){
1062
+		if ($this->_construction_finalized) {
1063
+			foreach ($this->_subsections as $name => $subsection) {
1064 1064
 				$subsection->_construct_finalize($this, $name);
1065 1065
 			}
1066 1066
 		}
@@ -1071,8 +1071,8 @@  discard block
 block discarded – undo
1071 1071
 	/**
1072 1072
 	 * Just gets all validatable subsections to clean their sensitive data
1073 1073
 	 */
1074
-	public function clean_sensitive_data(){
1075
-		foreach($this->get_validatable_subsections() as $subsection){
1074
+	public function clean_sensitive_data() {
1075
+		foreach ($this->get_validatable_subsections() as $subsection) {
1076 1076
 			$subsection->clean_sensitive_data();
1077 1077
 		}
1078 1078
 	}
@@ -1082,10 +1082,10 @@  discard block
 block discarded – undo
1082 1082
 	/**
1083 1083
 	 * @param string $form_submission_error_message
1084 1084
 	 */
1085
-	public function set_submission_error_message( $form_submission_error_message = '' ) {
1086
-		$this->_form_submission_error_message .= ! empty( $form_submission_error_message )
1085
+	public function set_submission_error_message($form_submission_error_message = '') {
1086
+		$this->_form_submission_error_message .= ! empty($form_submission_error_message)
1087 1087
 			? $form_submission_error_message
1088
-			: __( 'Form submission failed due to errors', 'event_espresso' );
1088
+			: __('Form submission failed due to errors', 'event_espresso');
1089 1089
 	}
1090 1090
 
1091 1091
 
@@ -1102,10 +1102,10 @@  discard block
 block discarded – undo
1102 1102
 	/**
1103 1103
 	 * @param string $form_submission_success_message
1104 1104
 	 */
1105
-	public function set_submission_success_message( $form_submission_success_message ) {
1106
-		$this->_form_submission_success_message .= ! empty( $form_submission_success_message )
1105
+	public function set_submission_success_message($form_submission_success_message) {
1106
+		$this->_form_submission_success_message .= ! empty($form_submission_success_message)
1107 1107
 			? $form_submission_success_message
1108
-			: __( 'Form submitted successfully', 'event_espresso' );
1108
+			: __('Form submitted successfully', 'event_espresso');
1109 1109
 	}
1110 1110
 
1111 1111
 
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
 	 * @return string
1129 1129
 	 * @throws \EE_Error
1130 1130
 	 */
1131
-	public function html_name_prefix(){
1132
-		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
1133
-			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
1134
-		}else{
1131
+	public function html_name_prefix() {
1132
+		if ($this->parent_section() instanceof EE_Form_Section_Proper) {
1133
+			return $this->parent_section()->html_name_prefix().'['.$this->name().']';
1134
+		} else {
1135 1135
 			return $this->name();
1136 1136
 		}
1137 1137
 	}
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 	 * @return string
1147 1147
 	 * @throws \EE_Error
1148 1148
 	 */
1149
-	public function name(){
1149
+	public function name() {
1150 1150
 		$this->ensure_construct_finalized_called();
1151 1151
 		return parent::name();
1152 1152
 	}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 	 * @return EE_Form_Section_Proper
1158 1158
 	 * @throws \EE_Error
1159 1159
 	 */
1160
-	public function parent_section(){
1160
+	public function parent_section() {
1161 1161
 		$this->ensure_construct_finalized_called();
1162 1162
 		return parent::parent_section();
1163 1163
 	}
@@ -1170,9 +1170,9 @@  discard block
 block discarded – undo
1170 1170
 	 * @return void
1171 1171
 	 * @throws \EE_Error
1172 1172
 	 */
1173
-	public function ensure_construct_finalized_called(){
1174
-		if( ! $this->_construction_finalized ){
1175
-			$this->_construct_finalize($this->_parent_section, $this->_name );
1173
+	public function ensure_construct_finalized_called() {
1174
+		if ( ! $this->_construction_finalized) {
1175
+			$this->_construct_finalize($this->_parent_section, $this->_name);
1176 1176
 		}
1177 1177
 	}
1178 1178
 
@@ -1184,17 +1184,17 @@  discard block
 block discarded – undo
1184 1184
 	 * @param array $req_data
1185 1185
 	 * @return boolean
1186 1186
 	 */
1187
-	public function form_data_present_in( $req_data = NULL ) {
1188
-		if( $req_data === NULL){
1187
+	public function form_data_present_in($req_data = NULL) {
1188
+		if ($req_data === NULL) {
1189 1189
 			$req_data = $_POST;
1190 1190
 		}
1191
-		foreach( $this->subsections() as $subsection ) {
1192
-			if($subsection instanceof EE_Form_Input_Base ) {
1193
-				if( $subsection->form_data_present_in( $req_data ) ) {
1191
+		foreach ($this->subsections() as $subsection) {
1192
+			if ($subsection instanceof EE_Form_Input_Base) {
1193
+				if ($subsection->form_data_present_in($req_data)) {
1194 1194
 					return TRUE;
1195 1195
 				}
1196
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
1197
-				if( $subsection->form_data_present_in( $req_data ) ) {
1196
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
1197
+				if ($subsection->form_data_present_in($req_data)) {
1198 1198
 					return TRUE;
1199 1199
 				}
1200 1200
 			}
@@ -1211,14 +1211,14 @@  discard block
 block discarded – undo
1211 1211
 	 */
1212 1212
 	public function get_validation_errors_accumulated() {
1213 1213
 		$validation_errors = $this->get_validation_errors();
1214
-		foreach($this->get_validatable_subsections() as $subsection ) {
1215
-			if( $subsection instanceof EE_Form_Section_Proper ) {
1214
+		foreach ($this->get_validatable_subsections() as $subsection) {
1215
+			if ($subsection instanceof EE_Form_Section_Proper) {
1216 1216
 				$validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated();
1217 1217
 			} else {
1218
-				$validation_errors_on_this_subsection =  $subsection->get_validation_errors();
1218
+				$validation_errors_on_this_subsection = $subsection->get_validation_errors();
1219 1219
 			}
1220
-			if( $validation_errors_on_this_subsection ){
1221
-				$validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection );
1220
+			if ($validation_errors_on_this_subsection) {
1221
+				$validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection);
1222 1222
 			}
1223 1223
 		}
1224 1224
 		return $validation_errors;
@@ -1240,24 +1240,24 @@  discard block
 block discarded – undo
1240 1240
 	 * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false
1241 1241
 	 * @return EE_Form_Section_Base
1242 1242
 	 */
1243
-	public function find_section_from_path( $form_section_path ) {
1243
+	public function find_section_from_path($form_section_path) {
1244 1244
 		//check if we can find the input from purely going straight up the tree
1245
-		$input = parent::find_section_from_path( $form_section_path );
1246
-		if( $input instanceof EE_Form_Section_Base ) {
1245
+		$input = parent::find_section_from_path($form_section_path);
1246
+		if ($input instanceof EE_Form_Section_Base) {
1247 1247
 			return $input;
1248 1248
 		}
1249 1249
 
1250
-		$next_slash_pos = strpos( $form_section_path, '/' );
1251
-		if( $next_slash_pos !== false ) {
1252
-			$child_section_name = substr( $form_section_path, 0, $next_slash_pos );
1253
-			$subpath = substr( $form_section_path, $next_slash_pos + 1 );
1250
+		$next_slash_pos = strpos($form_section_path, '/');
1251
+		if ($next_slash_pos !== false) {
1252
+			$child_section_name = substr($form_section_path, 0, $next_slash_pos);
1253
+			$subpath = substr($form_section_path, $next_slash_pos + 1);
1254 1254
 		} else {
1255 1255
 			$child_section_name = $form_section_path;
1256 1256
 			$subpath = '';
1257 1257
 		}
1258
-		$child_section =  $this->get_subsection( $child_section_name );
1259
-		if ( $child_section instanceof EE_Form_Section_Base ) {
1260
-			return $child_section->find_section_from_path( $subpath );
1258
+		$child_section = $this->get_subsection($child_section_name);
1259
+		if ($child_section instanceof EE_Form_Section_Base) {
1260
+			return $child_section->find_section_from_path($subpath);
1261 1261
 		} else {
1262 1262
 			return null;
1263 1263
 		}
Please login to merge, or discard this patch.