Completed
Branch BETA-4.9-message-activity (574755)
by
unknown
31:18 queued 14:02
created
core/db_models/EEM_Transaction.model.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * Transaction Model
@@ -68,36 +68,36 @@  discard block
 block discarded – undo
68 68
 	 * 		Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
69 69
 	 *	@return EEM_Transaction
70 70
 	 */
71
-	protected function __construct( $timezone ) {
72
-		$this->singular_item = __('Transaction','event_espresso');
73
-		$this->plural_item = __('Transactions','event_espresso');
71
+	protected function __construct($timezone) {
72
+		$this->singular_item = __('Transaction', 'event_espresso');
73
+		$this->plural_item = __('Transactions', 'event_espresso');
74 74
 
75 75
 		$this->_tables = array(
76
-			'Transaction'=>new EE_Primary_Table('esp_transaction','TXN_ID')
76
+			'Transaction'=>new EE_Primary_Table('esp_transaction', 'TXN_ID')
77 77
 		);
78 78
 		$this->_fields = array(
79 79
 			'Transaction'=>array(
80
-				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')),
81
-				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, time(), $timezone ),
82
-				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0),
83
-				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0),
84
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
85
-				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''),
86
-				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''),
80
+				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')),
81
+				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, time(), $timezone),
82
+				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0),
83
+				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0),
84
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
85
+				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''),
86
+				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''),
87 87
 				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'),
88
-				'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ),
88
+				'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()),
89 89
 			)
90 90
 		);
91 91
 		$this->_model_relations = array(
92 92
 			'Registration'=>new EE_Has_Many_Relation(),
93 93
 			'Payment'=>new EE_Has_Many_Relation(),
94 94
 			'Status'=>new EE_Belongs_To_Relation(),
95
-			'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items
95
+			'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items
96 96
 			'Payment_Method'=>new EE_Belongs_To_Relation(),
97 97
 			'Message' => new EE_Has_Many_Relation()
98 98
 		);
99 99
 		$this->_model_chain_to_wp_user = 'Registration.Event';
100
-		parent::__construct( $timezone );
100
+		parent::__construct($timezone);
101 101
 
102 102
 	}
103 103
 
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 	 * @param string $period
109 109
 	 * @return \stdClass[]
110 110
 	 */
111
-	public function get_revenue_per_day_report( $period = '-1 month' ) {
112
-		$sql_date = $this->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', strtotime( $period ) ), 'Y-m-d H:i:s', 'UTC' );
111
+	public function get_revenue_per_day_report($period = '-1 month') {
112
+		$sql_date = $this->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', strtotime($period)), 'Y-m-d H:i:s', 'UTC');
113 113
 
114
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
115
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'TXN_timestamp' );
114
+		EE_Registry::instance()->load_helper('DTT_Helper');
115
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp');
116 116
 
117 117
 		$results = $this->_get_all_wpdb_results(
118 118
 			array(
119 119
 				array(
120
-				'TXN_timestamp' => array( '>=', $sql_date ) ),
120
+				'TXN_timestamp' => array('>=', $sql_date) ),
121 121
 				'group_by' => 'txnDate',
122
-				'order_by' => array( 'TXN_timestamp' => 'ASC' )
122
+				'order_by' => array('TXN_timestamp' => 'ASC')
123 123
 			),
124 124
 			OBJECT,
125 125
 			array(
126
-				'txnDate' => array( 'DATE(' . $query_interval . ')', '%s' ),
127
-				'revenue' => array( 'SUM(Transaction.TXN_paid)', '%d' )
126
+				'txnDate' => array('DATE('.$query_interval.')', '%s'),
127
+				'revenue' => array('SUM(Transaction.TXN_paid)', '%d')
128 128
 			)
129 129
 		);
130 130
 		return $results;
@@ -140,17 +140,17 @@  discard block
 block discarded – undo
140 140
 	 * @throws \EE_Error
141 141
 	 * @return mixed
142 142
 	 */
143
-	public function get_revenue_per_event_report( $period = '-1 month' ) {
143
+	public function get_revenue_per_event_report($period = '-1 month') {
144 144
 		global $wpdb;
145
-		$transaction_table = $wpdb->prefix . 'esp_transaction';
146
-		$registration_table = $wpdb->prefix . 'esp_registration';
145
+		$transaction_table = $wpdb->prefix.'esp_transaction';
146
+		$registration_table = $wpdb->prefix.'esp_registration';
147 147
 		$event_table = $wpdb->posts;
148
-		$payment_table = $wpdb->prefix . 'esp_payment';
149
-		$sql_date = date( 'Y-m-d H:i:s', strtotime( $period ) );
148
+		$payment_table = $wpdb->prefix.'esp_payment';
149
+		$sql_date = date('Y-m-d H:i:s', strtotime($period));
150 150
 		$extra_event_on_join = '';
151 151
 		//exclude events not authored by user if permissions in effect
152
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
153
-			$extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id();
152
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
153
+			$extra_event_on_join = ' AND Event.post_author = '.get_current_user_id();
154 154
 		}
155 155
 
156 156
 		$approved_payment_status = EEM_Payment::status_id_approved;
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
 	 * @param string $reg_url_link
197 197
 	 * @return EE_Transaction
198 198
 	 */
199
-	public function get_transaction_from_reg_url_link( $reg_url_link = '' ){
200
-		return $this->get_one( array(
199
+	public function get_transaction_from_reg_url_link($reg_url_link = '') {
200
+		return $this->get_one(array(
201 201
 			array(
202
-				'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' )
202
+				'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '')
203 203
 			)
204 204
 		));
205 205
 	}
@@ -219,15 +219,15 @@  discard block
 block discarded – undo
219 219
 	 * @param boolean $save_txn whether or not to save the transaction during this function call
220 220
 	 * @return boolean
221 221
 	 */
222
-	public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){
222
+	public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) {
223 223
 		EE_Error::doing_it_wrong(
224
-			__CLASS__ . '::' . __FUNCTION__,
225
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
224
+			__CLASS__.'::'.__FUNCTION__,
225
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
226 226
 			'4.6.0'
227 227
 		);
228 228
 		/** @type EE_Transaction_Processor $transaction_processor */
229
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
230
-		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this->ensure_is_obj( $transaction_obj_or_id ));
229
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
230
+		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this->ensure_is_obj($transaction_obj_or_id));
231 231
 	}
232 232
 
233 233
 	/**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			array(
259 259
 				0 => array(
260 260
 					'STS_ID' => EEM_Transaction::failed_status_code,
261
-					'TXN_timestamp' => array( '<', time() - $time_to_leave_alone )
261
+					'TXN_timestamp' => array('<', time() - $time_to_leave_alone)
262 262
 				)
263 263
 			),
264 264
 			$time_to_leave_alone
@@ -271,26 +271,26 @@  discard block
 block discarded – undo
271 271
 		 */
272 272
 		$txn_ids = apply_filters(
273 273
 			'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete',
274
-			EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ),
274
+			EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'),
275 275
 			$time_to_leave_alone
276 276
 		);
277 277
 
278 278
 		//now that we have the ids to delete, let's get deletin'
279 279
 		//Why no wpdb->prepare?  Because the data is trusted.  We got the ids from the original query to get them FROM
280 280
 		//the db (which is sanitized) so no need to prepare them again.
281
-		if ( $txn_ids ) {
282
-			$query   = '
281
+		if ($txn_ids) {
282
+			$query = '
283 283
 				DELETE
284
-				FROM ' . $this->table() . '
284
+				FROM ' . $this->table().'
285 285
 				WHERE
286
-					TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')';
287
-			$deleted = $wpdb->query( $query );
286
+					TXN_ID IN ( ' . implode(",", $txn_ids).')';
287
+			$deleted = $wpdb->query($query);
288 288
 		}
289
-		if ( $deleted ) {
289
+		if ($deleted) {
290 290
 			/**
291 291
 			 * Allows code to do something after the transactions have been deleted.
292 292
 			 */
293
-			do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids );
293
+			do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids);
294 294
 		}
295 295
 		return $deleted;
296 296
 	}
Please login to merge, or discard this patch.
core/EE_System.core.php 1 patch
Spacing   +270 added lines, -270 removed lines patch added patch discarded remove patch
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 	 * @param  \EE_Registry        $Registry
89 89
 	 * @return \EE_System
90 90
 	 */
91
-	public static function instance( EE_Registry $Registry = null ) {
91
+	public static function instance(EE_Registry $Registry = null) {
92 92
 		// check if class object is instantiated
93
-		if ( ! self::$_instance instanceof EE_System ) {
94
-			self::$_instance = new self( $Registry );
93
+		if ( ! self::$_instance instanceof EE_System) {
94
+			self::$_instance = new self($Registry);
95 95
 		}
96 96
 		return self::$_instance;
97 97
 	}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	 * resets the instance and returns it
102 102
 	 * @return EE_System
103 103
 	 */
104
-	public static function reset(){
104
+	public static function reset() {
105 105
 		self::$_instance->_req_type = NULL;
106 106
 		//we need to reset the migration manager in order for it to detect DMSs properly
107 107
 		EE_Data_Migration_Manager::reset();
108 108
 		//make sure none of the old hooks are left hanging around
109
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
109
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
110 110
 		self::instance()->detect_activations_or_upgrades();
111 111
 		self::instance()->perform_activations_upgrades_and_migrations();
112 112
 		return self::instance();
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
 	 * @access private
123 123
 	 * @param  \EE_Registry        $Registry
124 124
 	 */
125
-	private function __construct( EE_Registry $Registry ) {
125
+	private function __construct(EE_Registry $Registry) {
126 126
 		$this->registry = $Registry;
127
-		do_action( 'AHEE__EE_System__construct__begin', $this );
127
+		do_action('AHEE__EE_System__construct__begin', $this);
128 128
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
129
-		add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) );
129
+		add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons'));
130 130
 		// when an ee addon is activated, we want to call the core hook(s) again
131 131
 		// because the newly-activated addon didn't get a chance to run at all
132
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
132
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
133 133
 		// detect whether install or upgrade
134
-		add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 );
134
+		add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3);
135 135
 		// load EE_Config, EE_Textdomain, etc
136
-		add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 );
136
+		add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5);
137 137
 		// load EE_Config, EE_Textdomain, etc
138
-		add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
138
+		add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7);
139 139
 		// you wanna get going? I wanna get going... let's get going!
140
-		add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 );
140
+		add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9);
141 141
 		//other housekeeping
142 142
 		//exclude EE critical pages from wp_list_pages
143
-		add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 );
143
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
144 144
 		// ALL EE Addons should use the following hook point to attach their initial setup too
145 145
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
146
-		do_action( 'AHEE__EE_System__construct__complete', $this );
146
+		do_action('AHEE__EE_System__construct__complete', $this);
147 147
 	}
148 148
 
149 149
 
@@ -163,30 +163,30 @@  discard block
 block discarded – undo
163 163
 	public function load_espresso_addons() {
164 164
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
165 165
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
166
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
166
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
167 167
 		//load and setup EE_Capabilities
168
-		$this->registry->load_core( 'Capabilities' );
168
+		$this->registry->load_core('Capabilities');
169 169
 		//caps need to be initialized on every request so that capability maps are set.
170 170
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
171 171
 		$this->registry->CAP->init_caps();
172
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
172
+		do_action('AHEE__EE_System__load_espresso_addons');
173 173
 		//if the WP API basic auth plugin isn't already loaded, load it now.
174 174
 		//We want it for mobile apps. Just include the entire plugin
175 175
 		//also, don't load the basic auth when a plugin is getting activated, because
176 176
 		//it could be the basic auth plugin, and it doesn't check if its methods are already defined
177 177
 		//and causes a fatal error
178
-		if( !function_exists( 'json_basic_auth_handler' )
179
-			&& ! function_exists( 'json_basic_auth_error' )
178
+		if ( ! function_exists('json_basic_auth_handler')
179
+			&& ! function_exists('json_basic_auth_error')
180 180
 			&& ! (
181
-				isset( $_GET[ 'action'] )
182
-				&& in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) )
181
+				isset($_GET['action'])
182
+				&& in_array($_GET['action'], array('activate', 'activate-selected'))
183 183
 			)
184 184
 			&& ! (
185
-				isset( $_GET['activate' ] )
186
-				&& $_GET['activate' ] === 'true'
185
+				isset($_GET['activate'])
186
+				&& $_GET['activate'] === 'true'
187 187
 			)
188 188
 		) {
189
-			include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
189
+			include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php';
190 190
 		}
191 191
 	}
192 192
 
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 * @access public
203 203
 	 * @return void
204 204
 	 */
205
-	public function detect_activations_or_upgrades(){
205
+	public function detect_activations_or_upgrades() {
206 206
 		//first off: let's make sure to handle core
207 207
 		$this->detect_if_activation_or_upgrade();
208
-		foreach($this->registry->addons as $addon){
208
+		foreach ($this->registry->addons as $addon) {
209 209
 			//detect teh request type for that addon
210 210
 			$addon->detect_activation_or_upgrade();
211 211
 		}
@@ -226,44 +226,44 @@  discard block
 block discarded – undo
226 226
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
227 227
 
228 228
 		// load M-Mode class
229
-		$this->registry->load_core( 'Maintenance_Mode' );
229
+		$this->registry->load_core('Maintenance_Mode');
230 230
 		// check if db has been updated, or if its a brand-new installation
231 231
 
232 232
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
233
-		$request_type =  $this->detect_req_type($espresso_db_update);
233
+		$request_type = $this->detect_req_type($espresso_db_update);
234 234
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
235
-		if( $request_type != EE_System::req_type_normal){
235
+		if ($request_type != EE_System::req_type_normal) {
236 236
 			$this->registry->load_helper('Activation');
237 237
 		}
238 238
 
239
-		switch($request_type){
239
+		switch ($request_type) {
240 240
 			case EE_System::req_type_new_activation:
241
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
242
-				$this->_handle_core_version_change( $espresso_db_update );
241
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
242
+				$this->_handle_core_version_change($espresso_db_update);
243 243
 				break;
244 244
 			case EE_System::req_type_reactivation:
245
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
246
-				$this->_handle_core_version_change( $espresso_db_update );
245
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
246
+				$this->_handle_core_version_change($espresso_db_update);
247 247
 				break;
248 248
 			case EE_System::req_type_upgrade:
249
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
249
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
250 250
 				//migrations may be required now that we've upgraded
251 251
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
252
-				$this->_handle_core_version_change( $espresso_db_update );
252
+				$this->_handle_core_version_change($espresso_db_update);
253 253
 //				echo "done upgrade";die;
254 254
 				break;
255 255
 			case EE_System::req_type_downgrade:
256
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
256
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
257 257
 				//its possible migrations are no longer required
258 258
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
259
-				$this->_handle_core_version_change( $espresso_db_update );
259
+				$this->_handle_core_version_change($espresso_db_update);
260 260
 				break;
261 261
 			case EE_System::req_type_normal:
262 262
 			default:
263 263
 //				$this->_maybe_redirect_to_ee_about();
264 264
 				break;
265 265
 		}
266
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
266
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
267 267
 	}
268 268
 
269 269
 	/**
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 	 * initializing the database later during the request
272 272
 	 * @param array $espresso_db_update
273 273
 	 */
274
-	protected function _handle_core_version_change( $espresso_db_update ){
275
-		$this->update_list_of_installed_versions( $espresso_db_update );
274
+	protected function _handle_core_version_change($espresso_db_update) {
275
+		$this->update_list_of_installed_versions($espresso_db_update);
276 276
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
277
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
277
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
278 278
 	}
279 279
 
280 280
 
@@ -289,44 +289,44 @@  discard block
 block discarded – undo
289 289
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
290 290
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
291 291
 	 */
292
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
293
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
294
-		if( ! $espresso_db_update){
295
-			$espresso_db_update = get_option( 'espresso_db_update' );
292
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
293
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
294
+		if ( ! $espresso_db_update) {
295
+			$espresso_db_update = get_option('espresso_db_update');
296 296
 		}
297 297
 		// check that option is an array
298
-		if( ! is_array( $espresso_db_update )) {
298
+		if ( ! is_array($espresso_db_update)) {
299 299
 			// if option is FALSE, then it never existed
300
-			if ( $espresso_db_update === FALSE ) {
300
+			if ($espresso_db_update === FALSE) {
301 301
 				// make $espresso_db_update an array and save option with autoload OFF
302
-				$espresso_db_update =  array();
303
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
302
+				$espresso_db_update = array();
303
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
304 304
 			} else {
305 305
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
306
-				$espresso_db_update =  array( $espresso_db_update=>array() );
307
-				update_option( 'espresso_db_update', $espresso_db_update );
306
+				$espresso_db_update = array($espresso_db_update=>array());
307
+				update_option('espresso_db_update', $espresso_db_update);
308 308
 			}
309
-		}else{
309
+		} else {
310 310
 			$corrected_db_update = array();
311 311
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
312
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
313
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
312
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
313
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
314 314
 					//the key is an int, and the value IS NOT an array
315 315
 					//so it must be numerically-indexed, where values are versions installed...
316 316
 					//fix it!
317 317
 					$version_string = $should_be_array;
318 318
 					$corrected_db_update[$version_string] = array('unknown-date');
319
-				}else{
319
+				} else {
320 320
 					//ok it checks out
321 321
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
322 322
 				}
323 323
 			}
324 324
 			$espresso_db_update = $corrected_db_update;
325
-			update_option( 'espresso_db_update', $espresso_db_update );
325
+			update_option('espresso_db_update', $espresso_db_update);
326 326
 
327 327
 		}
328 328
 
329
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
329
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
330 330
 		return $espresso_db_update;
331 331
 	}
332 332
 
@@ -346,34 +346,34 @@  discard block
 block discarded – undo
346 346
 	 * so we prefer to only do it when necessary
347 347
 	 * @return void
348 348
 	 */
349
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
349
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
350 350
 		$request_type = $this->detect_req_type();
351 351
 		//only initialize system if we're not in maintenance mode.
352
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
353
-			update_option( 'ee_flush_rewrite_rules', TRUE );
352
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
353
+			update_option('ee_flush_rewrite_rules', TRUE);
354 354
 
355
-			if( $verify_schema ) {
355
+			if ($verify_schema) {
356 356
 				EEH_Activation::initialize_db_and_folders();
357 357
 			}
358 358
 			EEH_Activation::initialize_db_content();
359 359
 			EEH_Activation::system_initialization();
360
-			if( $initialize_addons_too ) {
360
+			if ($initialize_addons_too) {
361 361
 				$this->initialize_addons();
362 362
 			}
363
-		}else{
364
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
363
+		} else {
364
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
365 365
 		}
366
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
367
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
366
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
367
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
368 368
 		}
369 369
 	}
370 370
 
371 371
 	/**
372 372
 	 * Initializes the db for all registered addons
373 373
 	 */
374
-	public function initialize_addons(){
374
+	public function initialize_addons() {
375 375
 		//foreach registered addon, make sure its db is up-to-date too
376
-		foreach($this->registry->addons as $addon){
376
+		foreach ($this->registry->addons as $addon) {
377 377
 			$addon->initialize_db_if_no_migrations_required();
378 378
 		}
379 379
 	}
@@ -385,16 +385,16 @@  discard block
 block discarded – undo
385 385
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
386 386
 	 * @return 	boolean success as to whether or not this option was changed
387 387
 	 */
388
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
389
-		if( ! $version_history ) {
388
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
389
+		if ( ! $version_history) {
390 390
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
391 391
 		}
392
-		if( $current_version_to_add == NULL){
392
+		if ($current_version_to_add == NULL) {
393 393
 			$current_version_to_add = espresso_version();
394 394
 		}
395
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
395
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
396 396
 		// re-save
397
-		return update_option( 'espresso_db_update', $version_history );
397
+		return update_option('espresso_db_update', $version_history);
398 398
 	}
399 399
 
400 400
 
@@ -411,10 +411,10 @@  discard block
 block discarded – undo
411 411
 	 *                            but still know if this is a new install or not
412 412
 	 * @return int one of the constants on EE_System::req_type_
413 413
 	 */
414
-	public function detect_req_type( $espresso_db_update = NULL ){
415
-		if ( $this->_req_type === NULL ){
416
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
417
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
414
+	public function detect_req_type($espresso_db_update = NULL) {
415
+		if ($this->_req_type === NULL) {
416
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
417
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
418 418
 		}
419 419
 		return $this->_req_type;
420 420
 	}
@@ -430,39 +430,39 @@  discard block
 block discarded – undo
430 430
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
431 431
 	 * @return int one of the constants on EE_System::req_type_*
432 432
 	 */
433
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
434
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
435
-		if( $activation_history_for_addon ){
433
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
434
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
435
+		if ($activation_history_for_addon) {
436 436
 			//it exists, so this isn't a completely new install
437 437
 			//check if this version already in that list of previously installed versions
438
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
438
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
439 439
 				//it a version we haven't seen before
440
-				if( $version_is_higher === 1 ){
440
+				if ($version_is_higher === 1) {
441 441
 					$req_type = EE_System::req_type_upgrade;
442
-				}else{
442
+				} else {
443 443
 					$req_type = EE_System::req_type_downgrade;
444 444
 				}
445
-				delete_option( $activation_indicator_option_name );
445
+				delete_option($activation_indicator_option_name);
446 446
 			} else {
447 447
 				// its not an update. maybe a reactivation?
448
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
449
-					if ( $version_is_higher === -1 ){
448
+				if (get_option($activation_indicator_option_name, FALSE)) {
449
+					if ($version_is_higher === -1) {
450 450
 						$req_type = EE_System::req_type_downgrade;
451
-					}elseif( $version_is_higher === 0 ){
451
+					}elseif ($version_is_higher === 0) {
452 452
 						//we've seen this version before, but it's an activation. must be a reactivation
453 453
 						$req_type = EE_System::req_type_reactivation;
454
-					}else{//$version_is_higher === 1
454
+					} else {//$version_is_higher === 1
455 455
 						$req_type = EE_System::req_type_upgrade;
456 456
 					}
457
-					delete_option( $activation_indicator_option_name );
457
+					delete_option($activation_indicator_option_name);
458 458
 				} else {
459 459
 					//we've seen this version before and the activation indicate doesn't show it was just activated
460
-					if ( $version_is_higher === -1 ){
460
+					if ($version_is_higher === -1) {
461 461
 						$req_type = EE_System::req_type_downgrade;
462
-					}elseif( $version_is_higher === 0 ){
462
+					}elseif ($version_is_higher === 0) {
463 463
 						//we've seen this version before and it's not an activation. its normal request
464 464
 						$req_type = EE_System::req_type_normal;
465
-					}else{//$version_is_higher === 1
465
+					} else {//$version_is_higher === 1
466 466
 						$req_type = EE_System::req_type_upgrade;
467 467
 					}
468 468
 				}
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 		} else {
471 471
 			//brand new install
472 472
 			$req_type = EE_System::req_type_new_activation;
473
-			delete_option( $activation_indicator_option_name );
473
+			delete_option($activation_indicator_option_name);
474 474
 		}
475 475
 		return $req_type;
476 476
 	}
@@ -488,30 +488,30 @@  discard block
 block discarded – undo
488 488
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
489 489
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
490 490
 	 */
491
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
491
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
492 492
 		//find the most recently-activated version
493 493
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
494 494
 		$most_recently_active_version = '0.0.0.dev.000';
495
-		if( is_array( $activation_history_for_addon ) ){
496
-			foreach( $activation_history_for_addon as $version => $times_activated ){
495
+		if (is_array($activation_history_for_addon)) {
496
+			foreach ($activation_history_for_addon as $version => $times_activated) {
497 497
 				//check there is a record of when this version was activated. Otherwise,
498 498
 				//mark it as unknown
499
-				if( ! $times_activated ){
500
-					$times_activated = array( 'unknown-date');
499
+				if ( ! $times_activated) {
500
+					$times_activated = array('unknown-date');
501 501
 				}
502
-				if( is_string( $times_activated ) ){
503
-					$times_activated = array( $times_activated );
502
+				if (is_string($times_activated)) {
503
+					$times_activated = array($times_activated);
504 504
 				}
505
-				foreach( $times_activated as $an_activation ){
506
-					if( $an_activation != 'unknown-date' &&
507
-							$an_activation > $most_recently_active_version_activation  ){
505
+				foreach ($times_activated as $an_activation) {
506
+					if ($an_activation != 'unknown-date' &&
507
+							$an_activation > $most_recently_active_version_activation) {
508 508
 						$most_recently_active_version = $version;
509 509
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
510 510
 					}
511 511
 				}
512 512
 			}
513 513
 		}
514
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
514
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
515 515
 	}
516 516
 
517 517
 
@@ -521,24 +521,24 @@  discard block
 block discarded – undo
521 521
 	 * @return void
522 522
 	 */
523 523
 	public function redirect_to_about_ee() {
524
-		$notices = EE_Error::get_notices( FALSE );
524
+		$notices = EE_Error::get_notices(FALSE);
525 525
 		//if current user is an admin and it's not an ajax request
526 526
 		if (
527
-			$this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' )
528
-			&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
529
-			&& ! isset( $notices[ 'errors' ] )
527
+			$this->registry->CAP->current_user_can('manage_options', 'espresso_about_default')
528
+			&& ! (defined('DOING_AJAX') && DOING_AJAX)
529
+			&& ! isset($notices['errors'])
530 530
 		) {
531
-			$query_params =  array( 'page' => 'espresso_about' );
531
+			$query_params = array('page' => 'espresso_about');
532 532
 
533
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
533
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
534 534
 			    $query_params['new_activation'] = TRUE;
535 535
 			}
536 536
 
537
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
537
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
538 538
 			    $query_params['reactivation'] = TRUE;
539 539
 			}
540
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
541
-			wp_safe_redirect( $url );
540
+			$url = add_query_arg($query_params, admin_url('admin.php'));
541
+			wp_safe_redirect($url);
542 542
 			exit();
543 543
 		}
544 544
 	}
@@ -552,31 +552,31 @@  discard block
 block discarded – undo
552 552
 	 *
553 553
 	 * @return void
554 554
 	 */
555
-	public function load_core_configuration(){
556
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
557
-		$this->registry->load_core( 'EE_Load_Textdomain' );
555
+	public function load_core_configuration() {
556
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
557
+		$this->registry->load_core('EE_Load_Textdomain');
558 558
 		//load textdomain
559 559
 		EE_Load_Textdomain::load_textdomain();
560 560
 		// load and setup EE_Config and EE_Network_Config
561
-		$this->registry->load_core( 'Config' );
562
-		$this->registry->load_core( 'Network_Config' );
561
+		$this->registry->load_core('Config');
562
+		$this->registry->load_core('Network_Config');
563 563
 		// setup autoloaders
564 564
 		// enable logging?
565
-		if ( $this->registry->CFG->admin->use_full_logging ) {
566
-			$this->registry->load_core( 'Log' );
565
+		if ($this->registry->CFG->admin->use_full_logging) {
566
+			$this->registry->load_core('Log');
567 567
 		}
568 568
 		// check for activation errors
569
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
570
-		if ( $activation_errors ) {
571
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
572
-			update_option( 'ee_plugin_activation_errors', FALSE );
569
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
570
+		if ($activation_errors) {
571
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
572
+			update_option('ee_plugin_activation_errors', FALSE);
573 573
 		}
574 574
 		// get model names
575 575
 		$this->_parse_model_names();
576 576
 
577 577
 		//load caf stuff a chance to play during the activation process too.
578 578
 		$this->_maybe_brew_regular();
579
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
579
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
580 580
 	}
581 581
 
582 582
 
@@ -585,23 +585,23 @@  discard block
 block discarded – undo
585 585
 	 *
586 586
 	 * @return void
587 587
 	 */
588
-	private function _parse_model_names(){
588
+	private function _parse_model_names() {
589 589
 		//get all the files in the EE_MODELS folder that end in .model.php
590
-		$models = glob( EE_MODELS.'*.model.php');
590
+		$models = glob(EE_MODELS.'*.model.php');
591 591
 		$model_names = array();
592 592
 		$non_abstract_db_models = array();
593
-		foreach( $models as $model ){
593
+		foreach ($models as $model) {
594 594
 			// get model classname
595
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
596
-			$short_name = str_replace( 'EEM_', '', $classname );
595
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
596
+			$short_name = str_replace('EEM_', '', $classname);
597 597
 			$reflectionClass = new ReflectionClass($classname);
598
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
599
-				$non_abstract_db_models[ $short_name ] = $classname;
598
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
599
+				$non_abstract_db_models[$short_name] = $classname;
600 600
 			}
601
-			$model_names[ $short_name ] = $classname;
601
+			$model_names[$short_name] = $classname;
602 602
 		}
603
-		$this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
604
-		$this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
603
+		$this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
604
+		$this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
605 605
 	}
606 606
 
607 607
 
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 	 * @return void
612 612
 	 */
613 613
 	private function _maybe_brew_regular() {
614
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
615
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
614
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
615
+			require_once EE_CAFF_PATH.'brewing_regular.php';
616 616
 		}
617 617
 	}
618 618
 
@@ -629,9 +629,9 @@  discard block
 block discarded – undo
629 629
 	 * @return void
630 630
 	 */
631 631
 	public function register_shortcodes_modules_and_widgets() {
632
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
632
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
633 633
 		// check for addons using old hookpoint
634
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
634
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
635 635
 			$this->_incompatible_addon_error();
636 636
 		}
637 637
 	}
@@ -645,19 +645,19 @@  discard block
 block discarded – undo
645 645
 	*/
646 646
 	private function _incompatible_addon_error() {
647 647
 		// get array of classes hooking into here
648
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
649
-		if ( ! empty( $class_names )) {
650
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
648
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
649
+		if ( ! empty($class_names)) {
650
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
651 651
 			$msg .= '<ul>';
652
-			foreach ( $class_names as $class_name ) {
653
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
652
+			foreach ($class_names as $class_name) {
653
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
654 654
 			}
655 655
 			$msg .= '</ul>';
656
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
656
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
657 657
 			// save list of incompatible addons to wp-options for later use
658
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
659
-			if ( is_admin() ) {
660
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
658
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
659
+			if (is_admin()) {
660
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
661 661
 			}
662 662
 		}
663 663
 	}
@@ -674,25 +674,25 @@  discard block
 block discarded – undo
674 674
 	 *
675 675
 	 * @return void
676 676
 	 */
677
-	public function brew_espresso(){
678
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
677
+	public function brew_espresso() {
678
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
679 679
 		// load some final core systems
680
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
681
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
682
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
683
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
684
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
685
-		add_action( 'init', array( $this, 'initialize' ), 10 );
686
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
687
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
688
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
689
-
690
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
680
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
681
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
682
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
683
+		add_action('init', array($this, 'load_controllers'), 7);
684
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
685
+		add_action('init', array($this, 'initialize'), 10);
686
+		add_action('init', array($this, 'initialize_last'), 100);
687
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
688
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
689
+
690
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
691 691
 			// pew pew pew
692
-			$this->registry->load_core( 'PUE' );
693
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
692
+			$this->registry->load_core('PUE');
693
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
694 694
 		}
695
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
695
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
696 696
 	}
697 697
 
698 698
 
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 	 */
707 707
 	public function set_hooks_for_core() {
708 708
 		$this->_deactivate_incompatible_addons();
709
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
709
+		do_action('AHEE__EE_System__set_hooks_for_core');
710 710
 	}
711 711
 
712 712
 
@@ -715,15 +715,15 @@  discard block
 block discarded – undo
715 715
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
716 716
 	 * deactivates any addons considered incompatible with the current version of EE
717 717
 	 */
718
-	private function _deactivate_incompatible_addons(){
719
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
720
-		if ( ! empty( $incompatible_addons )) {
721
-			$active_plugins = get_option( 'active_plugins', array() );
722
-			foreach ( $active_plugins as $active_plugin ) {
723
-				foreach ( $incompatible_addons as $incompatible_addon ) {
724
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
725
-						unset( $_GET['activate'] );
726
-						espresso_deactivate_plugin( $active_plugin );
718
+	private function _deactivate_incompatible_addons() {
719
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
720
+		if ( ! empty($incompatible_addons)) {
721
+			$active_plugins = get_option('active_plugins', array());
722
+			foreach ($active_plugins as $active_plugin) {
723
+				foreach ($incompatible_addons as $incompatible_addon) {
724
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
725
+						unset($_GET['activate']);
726
+						espresso_deactivate_plugin($active_plugin);
727 727
 					}
728 728
 				}
729 729
 			}
@@ -740,10 +740,10 @@  discard block
 block discarded – undo
740 740
 	 */
741 741
 	public function perform_activations_upgrades_and_migrations() {
742 742
 		//first check if we had previously attempted to setup EE's directories but failed
743
-		if( EEH_Activation::upload_directories_incomplete() ) {
743
+		if (EEH_Activation::upload_directories_incomplete()) {
744 744
 			EEH_Activation::create_upload_directories();
745 745
 		}
746
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
746
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
747 747
 	}
748 748
 
749 749
 
@@ -755,10 +755,10 @@  discard block
 block discarded – undo
755 755
 	 *  	@return 	void
756 756
 	 */
757 757
 	public function load_CPTs_and_session() {
758
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
758
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
759 759
 		// register Custom Post Types
760
-		$this->registry->load_core( 'Register_CPTs' );
761
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
760
+		$this->registry->load_core('Register_CPTs');
761
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
762 762
 	}
763 763
 
764 764
 
@@ -773,19 +773,19 @@  discard block
 block discarded – undo
773 773
 	* @return void
774 774
 	*/
775 775
 	public function load_controllers() {
776
-		do_action( 'AHEE__EE_System__load_controllers__start' );
776
+		do_action('AHEE__EE_System__load_controllers__start');
777 777
 		// let's get it started
778
-		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) {
779
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
780
-			$this->registry->load_core( 'Front_Controller', array(), false, true );
781
-		} else if ( ! EE_FRONT_AJAX ) {
782
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
783
-			EE_Registry::instance()->load_core( 'Admin' );
784
-		} else if ( EE_Maintenance_Mode::instance()->level() ) {
778
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
779
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
780
+			$this->registry->load_core('Front_Controller', array(), false, true);
781
+		} else if ( ! EE_FRONT_AJAX) {
782
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
783
+			EE_Registry::instance()->load_core('Admin');
784
+		} else if (EE_Maintenance_Mode::instance()->level()) {
785 785
 			// still need to make sure template helper functions are loaded in M-Mode
786
-			$this->registry->load_helper( 'Template' );
786
+			$this->registry->load_helper('Template');
787 787
 		}
788
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
788
+		do_action('AHEE__EE_System__load_controllers__complete');
789 789
 	}
790 790
 
791 791
 
@@ -799,9 +799,9 @@  discard block
 block discarded – undo
799 799
 	* @return void
800 800
 	*/
801 801
 	public function core_loaded_and_ready() {
802
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
803
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
804
-		$this->registry->load_core( 'Session' );
802
+		do_action('AHEE__EE_System__core_loaded_and_ready');
803
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
804
+		$this->registry->load_core('Session');
805 805
 		//		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
806 806
 	}
807 807
 
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 	* @return void
817 817
 	*/
818 818
 	public function initialize() {
819
-		do_action( 'AHEE__EE_System__initialize' );
819
+		do_action('AHEE__EE_System__initialize');
820 820
 	}
821 821
 
822 822
 
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	* @return void
831 831
 	*/
832 832
 	public function initialize_last() {
833
-		do_action( 'AHEE__EE_System__initialize_last' );
833
+		do_action('AHEE__EE_System__initialize_last');
834 834
 	}
835 835
 
836 836
 
@@ -862,21 +862,21 @@  discard block
 block discarded – undo
862 862
 	*/
863 863
 	public static function do_not_cache() {
864 864
 		// set no cache constants
865
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
866
-			define( 'DONOTCACHEPAGE', true );
865
+		if ( ! defined('DONOTCACHEPAGE')) {
866
+			define('DONOTCACHEPAGE', true);
867 867
 		}
868
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
869
-			define( 'DONOTCACHCEOBJECT', true );
868
+		if ( ! defined('DONOTCACHCEOBJECT')) {
869
+			define('DONOTCACHCEOBJECT', true);
870 870
 		}
871
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
872
-			define( 'DONOTCACHEDB', true );
871
+		if ( ! defined('DONOTCACHEDB')) {
872
+			define('DONOTCACHEDB', true);
873 873
 		}
874 874
 		// add no cache headers
875
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
875
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
876 876
 		// plus a little extra for nginx and Google Chrome
877
-		add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 );
877
+		add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
878 878
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
879
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
879
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
880 880
 	}
881 881
 
882 882
 
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 	 * @param $headers
889 889
 	 * @return    array
890 890
 	 */
891
-	public static function extra_nocache_headers ( $headers ) {
891
+	public static function extra_nocache_headers($headers) {
892 892
 		// for NGINX
893 893
 		$headers['X-Accel-Expires'] = 0;
894 894
 		// plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
@@ -917,15 +917,15 @@  discard block
 block discarded – undo
917 917
 	 * @param  WP_Admin_Bar $admin_bar
918 918
 	 * @return void
919 919
 	 */
920
-	public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) {
920
+	public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) {
921 921
 
922 922
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
923
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
923
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
924 924
 			return;
925 925
 		}
926 926
 
927
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
928
-		$this->registry->load_helper( 'URL' );
927
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
928
+		$this->registry->load_helper('URL');
929 929
 		$menu_class = 'espresso_menu_item_class';
930 930
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
931 931
 		//because they're only defined in each of their respective constructors
@@ -937,20 +937,20 @@  discard block
 block discarded – undo
937 937
 		//Top Level
938 938
 		$admin_bar->add_menu(array(
939 939
 				'id' => 'espresso-toolbar',
940
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
940
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
941 941
 				'href' => $events_admin_url,
942 942
 				'meta' => array(
943 943
 						'title' => __('Event Espresso', 'event_espresso'),
944
-						'class' => $menu_class . 'first'
944
+						'class' => $menu_class.'first'
945 945
 				),
946 946
 		));
947 947
 
948 948
 		//Events
949
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
949
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
950 950
 			$admin_bar->add_menu(array(
951 951
 					'id' => 'espresso-toolbar-events',
952 952
 					'parent' => 'espresso-toolbar',
953
-					'title' => __( 'Events', 'event_espresso' ),
953
+					'title' => __('Events', 'event_espresso'),
954 954
 					'href' => $events_admin_url,
955 955
 					'meta' => array(
956 956
 							'title' => __('Events', 'event_espresso'),
@@ -961,13 +961,13 @@  discard block
 block discarded – undo
961 961
 		}
962 962
 
963 963
 
964
-		if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
964
+		if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
965 965
 			//Events Add New
966 966
 			$admin_bar->add_menu(array(
967 967
 					'id' => 'espresso-toolbar-events-new',
968 968
 					'parent' => 'espresso-toolbar-events',
969 969
 					'title' => __('Add New', 'event_espresso'),
970
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
970
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
971 971
 					'meta' => array(
972 972
 							'title' => __('Add New', 'event_espresso'),
973 973
 							'target' => '',
@@ -976,18 +976,18 @@  discard block
 block discarded – undo
976 976
 			));
977 977
 		}
978 978
 
979
-		if ( is_single() && ( get_post_type() == 'espresso_events' ) ) {
979
+		if (is_single() && (get_post_type() == 'espresso_events')) {
980 980
 
981 981
 			//Current post
982 982
 			global $post;
983 983
 
984
-	    	if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
984
+	    	if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) {
985 985
 				//Events Edit Current Event
986 986
 				$admin_bar->add_menu(array(
987 987
 						'id' => 'espresso-toolbar-events-edit',
988 988
 						'parent' => 'espresso-toolbar-events',
989 989
 						'title' => __('Edit Event', 'event_espresso'),
990
-						'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ),
990
+						'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url),
991 991
 						'meta' => array(
992 992
 								'title' => __('Edit Event', 'event_espresso'),
993 993
 								'target' => '',
@@ -999,11 +999,11 @@  discard block
 block discarded – undo
999 999
 		}
1000 1000
 
1001 1001
 		//Events View
1002
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
1002
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
1003 1003
 			$admin_bar->add_menu(array(
1004 1004
 					'id' => 'espresso-toolbar-events-view',
1005 1005
 					'parent' => 'espresso-toolbar-events',
1006
-					'title' => __( 'View', 'event_espresso' ),
1006
+					'title' => __('View', 'event_espresso'),
1007 1007
 					'href' => $events_admin_url,
1008 1008
 					'meta' => array(
1009 1009
 							'title' => __('View', 'event_espresso'),
@@ -1013,12 +1013,12 @@  discard block
 block discarded – undo
1013 1013
 			));
1014 1014
 		}
1015 1015
 
1016
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1016
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1017 1017
 			//Events View All
1018 1018
 			$admin_bar->add_menu(array(
1019 1019
 					'id' => 'espresso-toolbar-events-all',
1020 1020
 					'parent' => 'espresso-toolbar-events-view',
1021
-					'title' => __( 'All', 'event_espresso' ),
1021
+					'title' => __('All', 'event_espresso'),
1022 1022
 					'href' => $events_admin_url,
1023 1023
 					'meta' => array(
1024 1024
 							'title' => __('All', 'event_espresso'),
@@ -1029,13 +1029,13 @@  discard block
 block discarded – undo
1029 1029
 		}
1030 1030
 
1031 1031
 
1032
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1032
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1033 1033
 			//Events View Today
1034 1034
 			$admin_bar->add_menu(array(
1035 1035
 					'id' => 'espresso-toolbar-events-today',
1036 1036
 					'parent' => 'espresso-toolbar-events-view',
1037 1037
 					'title' => __('Today', 'event_espresso'),
1038
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1038
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1039 1039
 					'meta' => array(
1040 1040
 							'title' => __('Today', 'event_espresso'),
1041 1041
 							'target' => '',
@@ -1045,13 +1045,13 @@  discard block
 block discarded – undo
1045 1045
 		}
1046 1046
 
1047 1047
 
1048
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1048
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1049 1049
 			//Events View This Month
1050 1050
 			$admin_bar->add_menu(array(
1051 1051
 					'id' => 'espresso-toolbar-events-month',
1052 1052
 					'parent' => 'espresso-toolbar-events-view',
1053
-					'title' => __( 'This Month', 'event_espresso'),
1054
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1053
+					'title' => __('This Month', 'event_espresso'),
1054
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1055 1055
 					'meta' => array(
1056 1056
 							'title' => __('This Month', 'event_espresso'),
1057 1057
 							'target' => '',
@@ -1061,11 +1061,11 @@  discard block
 block discarded – undo
1061 1061
 		}
1062 1062
 
1063 1063
 		//Registration Overview
1064
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1064
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1065 1065
 			$admin_bar->add_menu(array(
1066 1066
 					'id' => 'espresso-toolbar-registrations',
1067 1067
 					'parent' => 'espresso-toolbar',
1068
-					'title' => __( 'Registrations', 'event_espresso' ),
1068
+					'title' => __('Registrations', 'event_espresso'),
1069 1069
 					'href' => $reg_admin_url,
1070 1070
 					'meta' => array(
1071 1071
 							'title' => __('Registrations', 'event_espresso'),
@@ -1076,12 +1076,12 @@  discard block
 block discarded – undo
1076 1076
 		}
1077 1077
 
1078 1078
 		//Registration Overview Today
1079
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1079
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1080 1080
 			$admin_bar->add_menu(array(
1081 1081
 					'id' => 'espresso-toolbar-registrations-today',
1082 1082
 					'parent' => 'espresso-toolbar-registrations',
1083
-					'title' => __( 'Today', 'event_espresso'),
1084
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1083
+					'title' => __('Today', 'event_espresso'),
1084
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1085 1085
 					'meta' => array(
1086 1086
 							'title' => __('Today', 'event_espresso'),
1087 1087
 							'target' => '',
@@ -1091,14 +1091,14 @@  discard block
 block discarded – undo
1091 1091
 		}
1092 1092
 
1093 1093
 		//Registration Overview Today Completed
1094
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1094
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1095 1095
 			$admin_bar->add_menu(array(
1096 1096
 					'id' => 'espresso-toolbar-registrations-today-approved',
1097 1097
 					'parent' => 'espresso-toolbar-registrations-today',
1098
-					'title' => __( 'Approved', 'event_espresso' ),
1099
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1098
+					'title' => __('Approved', 'event_espresso'),
1099
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1100 1100
 					'meta' => array(
1101
-							'title' => __('Approved', 'event_espresso' ),
1101
+							'title' => __('Approved', 'event_espresso'),
1102 1102
 							'target' => '',
1103 1103
 							'class' => $menu_class
1104 1104
 					),
@@ -1106,14 +1106,14 @@  discard block
 block discarded – undo
1106 1106
 		}
1107 1107
 
1108 1108
 		//Registration Overview Today Pending\
1109
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1109
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1110 1110
 			$admin_bar->add_menu(array(
1111 1111
 					'id' => 'espresso-toolbar-registrations-today-pending',
1112 1112
 					'parent' => 'espresso-toolbar-registrations-today',
1113
-					'title' => __( 'Pending', 'event_espresso' ),
1114
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1113
+					'title' => __('Pending', 'event_espresso'),
1114
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1115 1115
 					'meta' => array(
1116
-							'title' => __('Pending Payment', 'event_espresso' ),
1116
+							'title' => __('Pending Payment', 'event_espresso'),
1117 1117
 							'target' => '',
1118 1118
 							'class' => $menu_class
1119 1119
 					),
@@ -1121,14 +1121,14 @@  discard block
 block discarded – undo
1121 1121
 		}
1122 1122
 
1123 1123
 		//Registration Overview Today Incomplete
1124
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1124
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1125 1125
 			$admin_bar->add_menu(array(
1126 1126
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1127 1127
 					'parent' => 'espresso-toolbar-registrations-today',
1128
-					'title' => __( 'Not Approved', 'event_espresso' ),
1129
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1128
+					'title' => __('Not Approved', 'event_espresso'),
1129
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1130 1130
 					'meta' => array(
1131
-							'title' => __('Not Approved', 'event_espresso' ),
1131
+							'title' => __('Not Approved', 'event_espresso'),
1132 1132
 							'target' => '',
1133 1133
 							'class' => $menu_class
1134 1134
 					),
@@ -1136,12 +1136,12 @@  discard block
 block discarded – undo
1136 1136
 		}
1137 1137
 
1138 1138
 		//Registration Overview Today Incomplete
1139
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1139
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1140 1140
 			$admin_bar->add_menu(array(
1141 1141
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1142 1142
 					'parent' => 'espresso-toolbar-registrations-today',
1143
-					'title' => __( 'Cancelled', 'event_espresso'),
1144
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1143
+					'title' => __('Cancelled', 'event_espresso'),
1144
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1145 1145
 					'meta' => array(
1146 1146
 							'title' => __('Cancelled', 'event_espresso'),
1147 1147
 							'target' => '',
@@ -1151,12 +1151,12 @@  discard block
 block discarded – undo
1151 1151
 		}
1152 1152
 
1153 1153
 		//Registration Overview This Month
1154
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1154
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1155 1155
 			$admin_bar->add_menu(array(
1156 1156
 					'id' => 'espresso-toolbar-registrations-month',
1157 1157
 					'parent' => 'espresso-toolbar-registrations',
1158
-					'title' => __( 'This Month', 'event_espresso' ),
1159
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1158
+					'title' => __('This Month', 'event_espresso'),
1159
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1160 1160
 					'meta' => array(
1161 1161
 							'title' => __('This Month', 'event_espresso'),
1162 1162
 							'target' => '',
@@ -1166,12 +1166,12 @@  discard block
 block discarded – undo
1166 1166
 		}
1167 1167
 
1168 1168
 		//Registration Overview This Month Approved
1169
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1169
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1170 1170
 			$admin_bar->add_menu(array(
1171 1171
 					'id' => 'espresso-toolbar-registrations-month-approved',
1172 1172
 					'parent' => 'espresso-toolbar-registrations-month',
1173
-					'title' => __( 'Approved', 'event_espresso' ),
1174
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1173
+					'title' => __('Approved', 'event_espresso'),
1174
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1175 1175
 					'meta' => array(
1176 1176
 							'title' => __('Approved', 'event_espresso'),
1177 1177
 							'target' => '',
@@ -1181,12 +1181,12 @@  discard block
 block discarded – undo
1181 1181
 		}
1182 1182
 
1183 1183
 		//Registration Overview This Month Pending
1184
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1184
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1185 1185
 			$admin_bar->add_menu(array(
1186 1186
 					'id' => 'espresso-toolbar-registrations-month-pending',
1187 1187
 					'parent' => 'espresso-toolbar-registrations-month',
1188
-					'title' => __( 'Pending', 'event_espresso'),
1189
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1188
+					'title' => __('Pending', 'event_espresso'),
1189
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1190 1190
 					'meta' => array(
1191 1191
 							'title' => __('Pending', 'event_espresso'),
1192 1192
 							'target' => '',
@@ -1196,14 +1196,14 @@  discard block
 block discarded – undo
1196 1196
 		}
1197 1197
 
1198 1198
 		//Registration Overview This Month Not Approved
1199
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1199
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1200 1200
 			$admin_bar->add_menu(array(
1201 1201
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1202 1202
 					'parent' => 'espresso-toolbar-registrations-month',
1203
-					'title' => __( 'Not Approved', 'event_espresso'),
1204
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1203
+					'title' => __('Not Approved', 'event_espresso'),
1204
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1205 1205
 					'meta' => array(
1206
-							'title' => __('Not Approved', 'event_espresso' ),
1206
+							'title' => __('Not Approved', 'event_espresso'),
1207 1207
 							'target' => '',
1208 1208
 							'class' => $menu_class
1209 1209
 					),
@@ -1212,12 +1212,12 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
 
1214 1214
 		//Registration Overview This Month Cancelled
1215
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1215
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1216 1216
 			$admin_bar->add_menu(array(
1217 1217
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1218 1218
 					'parent' => 'espresso-toolbar-registrations-month',
1219 1219
 					'title' => __('Cancelled', 'event_espresso'),
1220
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1220
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1221 1221
 					'meta' => array(
1222 1222
 							'title' => __('Cancelled', 'event_espresso'),
1223 1223
 							'target' => '',
@@ -1227,11 +1227,11 @@  discard block
 block discarded – undo
1227 1227
 		}
1228 1228
 
1229 1229
 		//Extensions & Services
1230
-		if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) {
1230
+		if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) {
1231 1231
 			$admin_bar->add_menu(array(
1232 1232
 					'id' => 'espresso-toolbar-extensions-and-services',
1233 1233
 					'parent' => 'espresso-toolbar',
1234
-					'title' => __( 'Extensions & Services', 'event_espresso' ),
1234
+					'title' => __('Extensions & Services', 'event_espresso'),
1235 1235
 					'href' => $extensions_admin_url,
1236 1236
 					'meta' => array(
1237 1237
 							'title' => __('Extensions & Services', 'event_espresso'),
@@ -1253,8 +1253,8 @@  discard block
 block discarded – undo
1253 1253
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1254 1254
 	 * @return array
1255 1255
 	 */
1256
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1257
-		return  array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() );
1256
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1257
+		return  array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array());
1258 1258
 	}
1259 1259
 
1260 1260
 
@@ -1274,11 +1274,11 @@  discard block
 block discarded – undo
1274 1274
 	 */
1275 1275
 	public function wp_enqueue_scripts() {
1276 1276
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1277
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1277
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1278 1278
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1279
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1279
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1280 1280
 				// register jQuery Validate
1281
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE );
1281
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
1282 1282
 			}
1283 1283
 		}
1284 1284
 	}
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Form_Input_Base.input.php 1 patch
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
11
+abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable {
12 12
 
13 13
 	/**
14 14
 	 * the input's name attribute
@@ -141,66 +141,66 @@  discard block
 block discarded – undo
141 141
 	 *		@type EE_Validation_Strategy_Base[] $validation_strategies
142 142
 	 * }
143 143
 	 */
144
-	public function __construct( $input_args = array() ){
145
-		$input_args = apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this );
144
+	public function __construct($input_args = array()) {
145
+		$input_args = apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this);
146 146
 		// the following properties must be cast as arrays
147 147
 		$set_as_array = array(
148 148
 			'validation_strategies' => true
149 149
 		);
150 150
 		// loop thru incoming options
151
-		foreach( $input_args as $key => $value ) {
151
+		foreach ($input_args as $key => $value) {
152 152
 			// add underscore to $key to match property names
153
-			$_key = '_' . $key;
154
-			if ( property_exists( $this, $_key )) {
153
+			$_key = '_'.$key;
154
+			if (property_exists($this, $_key)) {
155 155
 				// first check if this property needs to be set as an array
156
-				if ( isset( $set_as_array[ $key ] ) ) {
156
+				if (isset($set_as_array[$key])) {
157 157
 					// ensure value is an array
158
-					$value = is_array( $value ) ? $value : array( get_class() => $value );
158
+					$value = is_array($value) ? $value : array(get_class() => $value);
159 159
 					// and merge with existing values
160
-					$this->{$_key} = array_merge( $this->{$_key}, $value );
160
+					$this->{$_key} = array_merge($this->{$_key}, $value);
161 161
 				} else {
162 162
 					$this->{$_key} = $value;
163 163
 				}
164 164
 			}
165 165
 		}
166 166
 		// ensure that "required" is set correctly
167
-		$this->set_required( $this->_required, isset( $input_args[ 'required_validation_error_message' ] ) ? $input_args[ 'required_validation_error_message' ] : NULL );
167
+		$this->set_required($this->_required, isset($input_args['required_validation_error_message']) ? $input_args['required_validation_error_message'] : NULL);
168 168
 
169 169
 		//$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE;
170 170
 
171 171
 		$this->_display_strategy->_construct_finalize($this);
172
-		if ( $this->_validation_strategies ){
173
-			foreach( $this->_validation_strategies as $validation_strategy ){
172
+		if ($this->_validation_strategies) {
173
+			foreach ($this->_validation_strategies as $validation_strategy) {
174 174
 				$validation_strategy->_construct_finalize($this);
175 175
 			}
176 176
 		}
177 177
 
178
-		if( ! $this->_normalization_strategy){
178
+		if ( ! $this->_normalization_strategy) {
179 179
 			$this->_normalization_strategy = new EE_Text_Normalization();
180 180
 		}
181 181
 		$this->_normalization_strategy->_construct_finalize($this);
182 182
 
183 183
 		//at least we can use the normalization strategy to populate the default
184
-		if( isset( $input_args[ 'default' ] ) ) {
185
-			$this->set_default( $input_args[ 'default' ] );
184
+		if (isset($input_args['default'])) {
185
+			$this->set_default($input_args['default']);
186 186
 		}
187 187
 
188
-		if( ! $this->_sensitive_data_removal_strategy){
188
+		if ( ! $this->_sensitive_data_removal_strategy) {
189 189
 			$this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal();
190 190
 		}
191 191
 		$this->_sensitive_data_removal_strategy->_construct_finalize($this);
192
-		parent::__construct( $input_args );
192
+		parent::__construct($input_args);
193 193
 	}
194 194
 
195 195
 	/**
196 196
 	 * Sets the html_name to its default value, if none was specified in teh constructor.
197 197
 	 * Calculation involves using the name and the parent's html_name
198 198
 	 */
199
-	protected function _set_default_html_name_if_empty(){
200
-		if( ! $this->_html_name){
201
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
202
-				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
203
-			}else{
199
+	protected function _set_default_html_name_if_empty() {
200
+		if ( ! $this->_html_name) {
201
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
202
+				$this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]";
203
+			} else {
204 204
 				$this->_html_name = $this->name();
205 205
 			}
206 206
 		}
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 	function _construct_finalize($parent_form_section, $name) {
216 216
 		parent::_construct_finalize($parent_form_section, $name);
217 217
 		$this->_set_default_html_name_if_empty();
218
-		if( ! $this->_html_label ){
219
-			if( ! $this->_html_label_text){
220
-				$this->_html_label_text = ucwords( str_replace("_"," ",$name));
218
+		if ( ! $this->_html_label) {
219
+			if ( ! $this->_html_label_text) {
220
+				$this->_html_label_text = ucwords(str_replace("_", " ", $name));
221 221
 			}
222 222
 		}
223
-		do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name );
223
+		do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name);
224 224
 	}
225 225
 
226 226
 	 /**
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 	  * @return EE_Display_Strategy_Base
229 229
 	  * @throws EE_Error
230 230
 	  */
231
-	protected function _get_display_strategy(){
232
-		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
233
-			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"),$this->html_name(),$this->html_id()));
234
-		}else{
231
+	protected function _get_display_strategy() {
232
+		if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) {
233
+			throw new EE_Error(sprintf(__("Cannot get display strategy for form input with name %s and id %s, because it has not been set in the constructor", "event_espresso"), $this->html_name(), $this->html_id()));
234
+		} else {
235 235
 			return $this->_display_strategy;
236 236
 		}
237 237
 	}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * Sets the display strategy.
240 240
 	 * @param EE_Display_Strategy_Base $strategy
241 241
 	 */
242
-	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){
242
+	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) {
243 243
 		$this->_display_strategy = $strategy;
244 244
 	}
245 245
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 * Sets the sanitization strategy
248 248
 	 * @param EE_Normalization_Strategy_Base $strategy
249 249
 	 */
250
-	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){
250
+	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) {
251 251
 		$this->_normalization_strategy = $strategy;
252 252
 	}
253 253
 
@@ -273,14 +273,14 @@  discard block
 block discarded – undo
273 273
 	 * Gets the display strategy for this input
274 274
 	 * @return EE_Display_Strategy_Base
275 275
 	 */
276
-	public function get_display_strategy(){
276
+	public function get_display_strategy() {
277 277
 		return $this->_display_strategy;
278 278
 	}
279 279
 	/**
280 280
 	 * Overwrites the display strategy
281 281
 	 * @param EE_Display_Strategy_Base $display_strategy
282 282
 	 */
283
-	public function set_display_strategy($display_strategy){
283
+	public function set_display_strategy($display_strategy) {
284 284
 		$this->_display_strategy = $display_strategy;
285 285
 		$this->_display_strategy->_construct_finalize($this);
286 286
 	}
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
 	 * Gets the normalization strategy set on this input
289 289
 	 * @return EE_Normalization_Strategy_Base
290 290
 	 */
291
-	public function get_normalization_strategy(){
291
+	public function get_normalization_strategy() {
292 292
 		return $this->_normalization_strategy;
293 293
 	}
294 294
 	/**
295 295
 	 * Overwrites the normalization strategy
296 296
 	 * @param EE_Normalization_Strategy_Base $normalization_strategy
297 297
 	 */
298
-	public function set_normalization_strategy($normalization_strategy){
298
+	public function set_normalization_strategy($normalization_strategy) {
299 299
 		$this->_normalization_strategy = $normalization_strategy;
300 300
 		$this->_normalization_strategy->_construct_finalize($this);
301 301
 	}
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 	 * Returns all teh validation strategies which apply to this field, numerically indexed
305 305
 	 * @return EE_Validation_Strategy_Base[]
306 306
 	 */
307
-	public function get_validation_strategies(){
308
-		if(is_array($this->_validation_strategies)){
307
+	public function get_validation_strategies() {
308
+		if (is_array($this->_validation_strategies)) {
309 309
 			return $this->_validation_strategies;
310
-		}else{
310
+		} else {
311 311
 			return array();
312 312
 		}
313 313
 
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 * @param EE_Validation_Strategy_Base $validation_strategy
318 318
 	 * @return void
319 319
 	 */
320
-	protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){
321
-		$validation_strategy->_construct_finalize( $this );
320
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
321
+		$validation_strategy->_construct_finalize($this);
322 322
 		$this->_validation_strategies[] = $validation_strategy;
323 323
 	}
324 324
 
@@ -327,18 +327,18 @@  discard block
 block discarded – undo
327 327
 	 * @param EE_Validation_Strategy_Base $validation_strategy
328 328
 	 * @return void
329 329
 	 */
330
-	public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) {
331
-		$this->_add_validation_strategy( $validation_strategy );
330
+	public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
331
+		$this->_add_validation_strategy($validation_strategy);
332 332
 	}
333 333
 
334 334
 	/**
335 335
 	 * The classname of the validation strategy to remove
336 336
 	 * @param string $validation_strategy_classname
337 337
 	 */
338
-	public function remove_validation_strategy( $validation_strategy_classname ) {
339
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
340
-			if( is_subclass_of( $validation_strategy, $validation_strategy_classname ) ){
341
-				unset( $this->_validation_strategies[ $key ] );
338
+	public function remove_validation_strategy($validation_strategy_classname) {
339
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
340
+			if (is_subclass_of($validation_strategy, $validation_strategy_classname)) {
341
+				unset($this->_validation_strategies[$key]);
342 342
 			}
343 343
 		}
344 344
 	}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 * to the parent form's layout strategy
348 348
 	 * @return string
349 349
 	 */
350
-	public function get_html_and_js(){
350
+	public function get_html_and_js() {
351 351
 		return $this->_parent_section->get_html_for_input($this);
352 352
 	}
353 353
 	/**
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 * Makes sure the JS and CSS are enqueued for it
357 357
 	 * @return string
358 358
 	 */
359
-	public function get_html_for_input(){
359
+	public function get_html_for_input() {
360 360
 		return  $this->_get_display_strategy()->display();
361 361
 	}
362 362
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 * @return string
367 367
 	 */
368 368
 	public function html_other_attributes() {
369
-		return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : '';
369
+		return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : '';
370 370
 	}
371 371
 
372 372
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	/**
375 375
 	 * @param string $html_other_attributes
376 376
 	 */
377
-	public function set_html_other_attributes( $html_other_attributes ) {
377
+	public function set_html_other_attributes($html_other_attributes) {
378 378
 		$this->_html_other_attributes = $html_other_attributes;
379 379
 	}
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * according to the form section's layout strategy
384 384
 	 * @return string
385 385
 	 */
386
-	public function get_html_for_label(){
386
+	public function get_html_for_label() {
387 387
 		return $this->_parent_section->get_layout_strategy()->display_label($this);
388 388
 	}
389 389
 	/**
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 * according to the form section's layout strategy
392 392
 	 * @return string
393 393
 	 */
394
-	public function get_html_for_errors(){
394
+	public function get_html_for_errors() {
395 395
 		return $this->_parent_section->get_layout_strategy()->display_errors($this);
396 396
 	}
397 397
 	/**
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	 * according to the form section's layout strategy
400 400
 	 * @return string
401 401
 	 */
402
-	public function get_html_for_help(){
402
+	public function get_html_for_help() {
403 403
 		return $this->_parent_section->get_layout_strategy()->display_help_text($this);
404 404
 	}
405 405
 	/**
@@ -408,20 +408,20 @@  discard block
 block discarded – undo
408 408
 	 * @return boolean
409 409
 	 */
410 410
 	protected function _validate() {
411
-		if(is_array($this->_validation_strategies)){
412
-			foreach($this->_validation_strategies as $validation_strategy){
413
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
414
-					try{
411
+		if (is_array($this->_validation_strategies)) {
412
+			foreach ($this->_validation_strategies as $validation_strategy) {
413
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
414
+					try {
415 415
 						$validation_strategy->validate($this->normalized_value());
416
-					}catch(EE_Validation_Error $e){
416
+					} catch (EE_Validation_Error $e) {
417 417
 						$this->add_validation_error($e);
418 418
 					}
419 419
 				}
420 420
 			}
421 421
 		}
422
-		if( $this->get_validation_errors()){
422
+		if ($this->get_validation_errors()) {
423 423
 			return false;
424
-		}else{
424
+		} else {
425 425
 			return true;
426 426
 		}
427 427
 	}
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	 * @param string $value
435 435
 	 * @return null|string
436 436
 	 */
437
-	private function _sanitize($value){
438
-		return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field
437
+	private function _sanitize($value) {
438
+		return $value !== NULL ? stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field
439 439
 	}
440 440
 
441 441
 
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
 	 * @param array $req_data like $_POST
448 448
 	 * @return boolean whether or not there was an error
449 449
 	 */
450
-	protected function _normalize( $req_data ) {
450
+	protected function _normalize($req_data) {
451 451
 		//any existing validation errors don't apply so clear them
452 452
 		$this->_validation_errors = array();
453 453
 		try {
454
-			$raw_input = $this->find_form_data_for_this_section( $req_data );
454
+			$raw_input = $this->find_form_data_for_this_section($req_data);
455 455
 			//super simple sanitization for now
456
-			if ( is_array( $raw_input )) {
456
+			if (is_array($raw_input)) {
457 457
 				$this->_raw_value = array();
458
-				foreach( $raw_input as $key => $value ) {
459
-					$this->_raw_value[ $key ] = $this->_sanitize( $value );
458
+				foreach ($raw_input as $key => $value) {
459
+					$this->_raw_value[$key] = $this->_sanitize($value);
460 460
 				}
461 461
 			} else {
462
-				$this->_raw_value = $this->_sanitize( $raw_input );
462
+				$this->_raw_value = $this->_sanitize($raw_input);
463 463
 			}
464 464
 			//we want ot mostly leave the input alone in case we need to re-display it to the user
465
-			$this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() );
466
-		} catch ( EE_Validation_Error $e ) {
467
-			$this->add_validation_error( $e );
465
+			$this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value());
466
+		} catch (EE_Validation_Error $e) {
467
+			$this->add_validation_error($e);
468 468
 		}
469 469
 	}
470 470
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 	/**
474 474
 	 * @return string
475 475
 	 */
476
-	public function html_name(){
476
+	public function html_name() {
477 477
 		return $this->_html_name;
478 478
 	}
479 479
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	/**
483 483
 	 * @return string
484 484
 	 */
485
-	function html_label_id(){
486
-		return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl';
485
+	function html_label_id() {
486
+		return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl';
487 487
 	}
488 488
 
489 489
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	/**
492 492
 	 * @return string
493 493
 	 */
494
-	function html_label_class(){
494
+	function html_label_class() {
495 495
 		return $this->_html_label_class;
496 496
 	}
497 497
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 	/**
501 501
 	 * @return string
502 502
 	 */
503
-	function html_label_style(){
503
+	function html_label_style() {
504 504
 		return $this->_html_label_style;
505 505
 	}
506 506
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 	/**
510 510
 	 * @return string
511 511
 	 */
512
-	function html_label_text(){
512
+	function html_label_text() {
513 513
 		return $this->_html_label_text;
514 514
 	}
515 515
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	/**
519 519
 	 * @return string
520 520
 	 */
521
-	function html_help_text(){
521
+	function html_help_text() {
522 522
 		return $this->_html_help_text;
523 523
 	}
524 524
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	/**
528 528
 	 * @return string
529 529
 	 */
530
-	function html_help_class(){
530
+	function html_help_class() {
531 531
 		return $this->_html_help_class;
532 532
 	}
533 533
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	/**
537 537
 	 * @return string
538 538
 	 */
539
-	function html_help_style(){
539
+	function html_help_style() {
540 540
 		return $this->_html_style;
541 541
 	}
542 542
 	/**
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 	 * in which case, we would have stored the malicious content to our database.
550 550
 	 * @return string
551 551
 	 */
552
-	function raw_value(){
552
+	function raw_value() {
553 553
 		return $this->_raw_value;
554 554
 	}
555 555
 	/**
@@ -557,15 +557,15 @@  discard block
 block discarded – undo
557 557
 	 * it escapes all html entities
558 558
 	 * @return string
559 559
 	 */
560
-	function raw_value_in_form(){
561
-		return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8');
560
+	function raw_value_in_form() {
561
+		return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8');
562 562
 	}
563 563
 	/**
564 564
 	 * returns the value after it's been sanitized, and then converted into it's proper type
565 565
 	 * in PHP. Eg, a string, an int, an array,
566 566
 	 * @return mixed
567 567
 	 */
568
-	function normalized_value(){
568
+	function normalized_value() {
569 569
 		return $this->_normalized_value;
570 570
 	}
571 571
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	 * the best thing to display
576 576
 	 * @return string
577 577
 	 */
578
-	function pretty_value(){
578
+	function pretty_value() {
579 579
 		return $this->_normalized_value;
580 580
 	}
581 581
 	/**
@@ -594,19 +594,19 @@  discard block
 block discarded – undo
594 594
 		  }</code>
595 595
 	 * @return array
596 596
 	 */
597
-	function get_jquery_validation_rules(){
597
+	function get_jquery_validation_rules() {
598 598
 
599 599
 		$jquery_validation_rules = array();
600
-		foreach($this->get_validation_strategies() as $validation_strategy){
600
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
601 601
 			$jquery_validation_rules = array_replace_recursive(
602 602
 				$jquery_validation_rules,
603 603
 				$validation_strategy->get_jquery_validation_rule_array()
604 604
 			);
605 605
 		}
606 606
 
607
-		if(! empty($jquery_validation_rules)){
608
-			$jquery_validation_js[ $this->html_id( TRUE ) ] = $jquery_validation_rules;
609
-		}else{
607
+		if ( ! empty($jquery_validation_rules)) {
608
+			$jquery_validation_js[$this->html_id(TRUE)] = $jquery_validation_rules;
609
+		} else {
610 610
 			return array();
611 611
 		}
612 612
 		return $jquery_validation_js;
@@ -618,9 +618,9 @@  discard block
 block discarded – undo
618 618
 	 * @param mixed $value
619 619
 	 * @return void
620 620
 	 */
621
-	function set_default($value){
621
+	function set_default($value) {
622 622
 		$this->_normalized_value = $value;
623
-		$this->_raw_value = $this->_normalization_strategy->unnormalize( $value );
623
+		$this->_raw_value = $this->_normalization_strategy->unnormalize($value);
624 624
 	}
625 625
 
626 626
 	/**
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	 * @param string $label
629 629
 	 * @return void
630 630
 	 */
631
-	function set_html_label_text($label){
631
+	function set_html_label_text($label) {
632 632
 		$this->_html_label_text = $label;
633 633
 	}
634 634
 
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
 	 * @param boolean $required
641 641
 	 * @param null    $required_text
642 642
 	 */
643
-	function set_required($required = true, $required_text = NULL ){
644
-		$required = filter_var( $required, FILTER_VALIDATE_BOOLEAN );
645
-		if ( $required ) {
646
-			$this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) );
643
+	function set_required($required = true, $required_text = NULL) {
644
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN);
645
+		if ($required) {
646
+			$this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text));
647 647
 		} else {
648
-			unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] );
648
+			unset($this->_validation_strategies['EE_Required_Validation_Strategy']);
649 649
 		}
650 650
 		$this->_required = $required;
651 651
 	}
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * Returns whether or not this field is required
654 654
 	 * @return boolean
655 655
 	 */
656
-	public function required(){
656
+	public function required() {
657 657
 		return $this->_required;
658 658
 	}
659 659
 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	/**
663 663
 	 * @param string $required_css_class
664 664
 	 */
665
-	public function set_required_css_class( $required_css_class ) {
665
+	public function set_required_css_class($required_css_class) {
666 666
 		$this->_required_css_class = $required_css_class;
667 667
 	}
668 668
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 * Sets the help text, in case
682 682
 	 * @param string $text
683 683
 	 */
684
-	public function set_html_help_text($text){
684
+	public function set_html_help_text($text) {
685 685
 		$this->_html_help_text = $text;
686 686
 	}
687 687
 	/**
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
 	public function clean_sensitive_data() {
694 694
 		//if we do ANY kind of sensitive data removal on this, then just clear out the raw value
695 695
 		//if we need more logic than this we'll make a strategy for it
696
-		if( $this->_sensitive_data_removal_strategy &&
697
-				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){
696
+		if ($this->_sensitive_data_removal_strategy &&
697
+				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) {
698 698
 			$this->_raw_value = NULL;
699 699
 		}
700 700
 		//and clean the normalized value according to the appropriate strategy
@@ -708,10 +708,10 @@  discard block
 block discarded – undo
708 708
 	 * @param string $button_size
709 709
 	 * @param string $other_attributes
710 710
 	 */
711
-	public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) {
711
+	public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') {
712 712
 		$button_css_attributes = 'button';
713 713
 		$button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary';
714
-		switch ( $button_size ) {
714
+		switch ($button_size) {
715 715
 			case 'xs' :
716 716
 			case 'extra-small' :
717 717
 				$button_css_attributes .= ' button-xs';
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 			default :
733 733
 				$button_css_attributes .= '';
734 734
 		}
735
-		$this->_button_css_attributes .= ! empty( $other_attributes ) ? $button_css_attributes . ' ' . $other_attributes : $button_css_attributes;
735
+		$this->_button_css_attributes .= ! empty($other_attributes) ? $button_css_attributes.' '.$other_attributes : $button_css_attributes;
736 736
 	}
737 737
 
738 738
 
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	 * @return string
742 742
 	 */
743 743
 	public function button_css_attributes() {
744
-		if ( empty( $this->_button_css_attributes )) {
744
+		if (empty($this->_button_css_attributes)) {
745 745
 			$this->set_button_css_attributes();
746 746
 		}
747 747
 		return $this->_button_css_attributes;
@@ -761,27 +761,27 @@  discard block
 block discarded – undo
761 761
 	 * @param array $req_data
762 762
 	 * @return mixed whatever the raw value of this form section is in the request data
763 763
 	 */
764
-	public function find_form_data_for_this_section( $req_data ){
764
+	public function find_form_data_for_this_section($req_data) {
765 765
 		// break up the html name by "[]"
766
-		if ( strpos( $this->html_name(), '[' ) !== FALSE ) {
767
-			$before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') );
766
+		if (strpos($this->html_name(), '[') !== FALSE) {
767
+			$before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '['));
768 768
 		} else {
769 769
 			$before_any_brackets = $this->html_name();
770 770
 		}
771 771
 		// grab all of the segments
772
-		preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches);
773
-		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
774
-			$name_parts = $matches[ 1 ];
772
+		preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches);
773
+		if (isset($matches[1]) && is_array($matches[1])) {
774
+			$name_parts = $matches[1];
775 775
 			array_unshift($name_parts, $before_any_brackets);
776
-		}else{
777
-			$name_parts = array( $before_any_brackets );
776
+		} else {
777
+			$name_parts = array($before_any_brackets);
778 778
 		}
779 779
 		// now get the value for the input
780 780
 		$value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data);
781
-		if( $value === NULL ){
781
+		if ($value === NULL) {
782 782
 			//check if this thing's name is at the TOP level of the request data
783
-			if( isset( $req_data[ $this->name() ] ) ){
784
-				$value = $req_data[ $this->name() ];
783
+			if (isset($req_data[$this->name()])) {
784
+				$value = $req_data[$this->name()];
785 785
 			}
786 786
 		}
787 787
 		return $value;
@@ -795,15 +795,15 @@  discard block
 block discarded – undo
795 795
 	 * @param array $req_data
796 796
 	 * @return array | NULL
797 797
 	 */
798
-	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){
799
-		$first_part_to_consider = array_shift( $html_name_parts );
800
-		if( isset( $req_data[ $first_part_to_consider ] ) ){
801
-			if( empty($html_name_parts ) ){
802
-				return $req_data[ $first_part_to_consider ];
803
-			}else{
804
-				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[ $first_part_to_consider ] );
798
+	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) {
799
+		$first_part_to_consider = array_shift($html_name_parts);
800
+		if (isset($req_data[$first_part_to_consider])) {
801
+			if (empty($html_name_parts)) {
802
+				return $req_data[$first_part_to_consider];
803
+			} else {
804
+				return $this->_find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data[$first_part_to_consider]);
805 805
 			}
806
-		}else{
806
+		} else {
807 807
 			return NULL;
808 808
 		}
809 809
 	}
@@ -815,14 +815,14 @@  discard block
 block discarded – undo
815 815
 	 * @param array $req_data like $_POST
816 816
 	 * @return boolean
817 817
 	 */
818
-	public function form_data_present_in($req_data = NULL){
819
-		if( $req_data === NULL ){
818
+	public function form_data_present_in($req_data = NULL) {
819
+		if ($req_data === NULL) {
820 820
 			$req_data = $_POST;
821 821
 		}
822
-		$checked_value = $this->find_form_data_for_this_section( $req_data );
823
-		if( $checked_value !== null ){
822
+		$checked_value = $this->find_form_data_for_this_section($req_data);
823
+		if ($checked_value !== null) {
824 824
 			return TRUE;
825
-		}else{
825
+		} else {
826 826
 			return FALSE;
827 827
 		}
828 828
 	}
Please login to merge, or discard this patch.
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 1 patch
Spacing   +245 added lines, -246 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	 * @param    EE_Checkout $checkout
38 38
 	 * @return    \EE_SPCO_Reg_Step_Attendee_Information
39 39
 	 */
40
-	public function __construct( EE_Checkout $checkout ) {
40
+	public function __construct(EE_Checkout $checkout) {
41 41
 		$this->_slug = 'attendee_information';
42 42
 		$this->_name = __('Attendee Information', 'event_espresso');
43
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
43
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
44 44
 		$this->checkout = $checkout;
45 45
 		$this->_reset_success_message();
46
-		$this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso'));
46
+		$this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso'));
47 47
 	}
48 48
 
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
53 53
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso');
54 54
 		EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso');
55
-		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' );
55
+		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>');
56 56
 		EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso');
57 57
 		EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso');
58 58
 		EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso');
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		EEH_Autoloader::register_line_item_display_autoloaders();
86 86
 		$Line_Item_Display = new EE_Line_Item_Display();
87 87
 		// calculate taxes
88
-		$Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) );
88
+		$Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true));
89 89
 		EE_Registry::instance()->load_helper('Line_Item');
90 90
 		/** @var $subsections EE_Form_Section_Proper[] */
91 91
 		$subsections = array(
@@ -97,33 +97,33 @@  discard block
 block discarded – undo
97 97
 			'ticket_count' 	=> array()
98 98
 		);
99 99
 		// grab the saved registrations from the transaction
100
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
101
-		if ( $registrations ) {
102
-			foreach ( $registrations as $registration ) {
103
-				if ( $registration instanceof EE_Registration ) {
100
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
101
+		if ($registrations) {
102
+			foreach ($registrations as $registration) {
103
+				if ($registration instanceof EE_Registration) {
104 104
 					// can this registration be processed during this visit ?
105
-					if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
106
-						$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
107
-						if ( ! $this->checkout->admin_request ) {
108
-							$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
109
-							$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1;
110
-							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) );
111
-							$ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item;
112
-							$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item );
105
+					if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
106
+						$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
107
+						if ( ! $this->checkout->admin_request) {
108
+							$template_args['registrations'][$registration->reg_url_link()] = $registration;
109
+							$template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1;
110
+							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID()));
111
+							$ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item;
112
+							$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item);
113 113
 						}
114
-						if ( $registration->is_primary_registrant() ) {
114
+						if ($registration->is_primary_registrant()) {
115 115
 							$primary_registrant = $registration->reg_url_link();
116 116
 						}
117 117
 					}
118 118
 				}
119 119
 			}
120 120
 			// print_copy_info ?
121
-			if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) {
121
+			if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) {
122 122
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
123 123
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info();
124 124
 				// generate hidden input
125
-				if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) {
126
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
125
+				if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) {
126
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
127 127
 				}
128 128
 			}
129 129
 
@@ -135,8 +135,7 @@  discard block
 block discarded – undo
135 135
 				'html_id' 					=> $this->reg_form_name(),
136 136
 				'subsections' 			=> $subsections,
137 137
 				'layout_strategy'		=> $this->checkout->admin_request ?
138
-					new EE_Div_Per_Section_Layout() :
139
-					new EE_Template_Layout(
138
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
140 139
 						array(
141 140
 							'layout_template_file' 	=> $this->_template, // layout_template
142 141
 							'template_args' 				=> $template_args
@@ -153,61 +152,61 @@  discard block
 block discarded – undo
153 152
 	 * @param EE_Registration $registration
154 153
 	 * @return EE_Form_Section_Proper
155 154
 	 */
156
-	private function _registrations_reg_form( EE_Registration $registration ) {
157
-		EE_Registry::instance()->load_helper( 'Template' );
155
+	private function _registrations_reg_form(EE_Registration $registration) {
156
+		EE_Registry::instance()->load_helper('Template');
158 157
 		static $attendee_nmbr = 1;
159 158
 		// array of params to pass to parent constructor
160 159
 		$form_args = array(
161
-			'html_id' 				=> 'ee-registration-' . $registration->reg_url_link(),
160
+			'html_id' 				=> 'ee-registration-'.$registration->reg_url_link(),
162 161
 			'html_class' 		=> 'ee-reg-form-attendee-dv',
163 162
 			'html_style' 		=> $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '',
164 163
 			'subsections' 		=> array(),
165 164
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
166 165
 				array(
167 166
 					'legend_class' 	=> 'spco-attendee-lgnd smaller-text lt-grey-text',
168
-					'legend_text' 	=> sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
167
+					'legend_text' 	=> sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
169 168
 				)
170 169
 			)
171 170
 		);
172 171
 		// verify that registration has valid event
173
-		if ( $registration->event() instanceof EE_Event ) {
172
+		if ($registration->event() instanceof EE_Event) {
174 173
 			$query_params = array(
175 174
 				array(
176 175
 					'Event.EVT_ID' => $registration->event()->ID(),
177 176
 					'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE
178 177
 				),
179
-				'order_by'=>array( 'QSG_order'=>'ASC' )
178
+				'order_by'=>array('QSG_order'=>'ASC')
180 179
 			);
181
-			$question_groups = $registration->event()->question_groups( $query_params );
182
-			if ( $question_groups ) {
183
-				foreach ( $question_groups as $question_group ) {
184
-					if ( $question_group instanceof EE_Question_Group ) {
185
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group );
180
+			$question_groups = $registration->event()->question_groups($query_params);
181
+			if ($question_groups) {
182
+				foreach ($question_groups as $question_group) {
183
+					if ($question_group instanceof EE_Question_Group) {
184
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group);
186 185
 						// add hidden input
187
-						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration );
186
+						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration);
188 187
 					}
189 188
 				}
190 189
 				// if we have question groups for additional attendees, then display the copy options
191 190
 				$this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info;
192 191
 			} else {
193
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML(
192
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML(
194 193
 					EEH_Template::locate_template(
195
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
196
-						apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
194
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
195
+						apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
197 196
 						TRUE,
198 197
 						TRUE
199 198
 					)
200 199
 				);
201 200
 				// add hidden input
202
-				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE );
201
+				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE);
203 202
 			}
204 203
 		}
205
-		if ( $registration->is_primary_registrant() ) {
204
+		if ($registration->is_primary_registrant()) {
206 205
 			// generate hidden input
207
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
206
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
208 207
 		}
209 208
 		$attendee_nmbr++;
210
-		return new EE_Form_Section_Proper( $form_args );
209
+		return new EE_Form_Section_Proper($form_args);
211 210
 	}
212 211
 
213 212
 
@@ -220,11 +219,11 @@  discard block
 block discarded – undo
220 219
 	 * @param bool  $additional_attendee_reg_info
221 220
 	 * @return    EE_Form_Input_Base
222 221
 	 */
223
-	private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){
222
+	private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) {
224 223
 		// generate hidden input
225 224
 		return new EE_Hidden_Input(
226 225
 			array(
227
-				'html_id' 				=> 'additional-attendee-reg-info-' . $registration->reg_url_link(),
226
+				'html_id' 				=> 'additional-attendee-reg-info-'.$registration->reg_url_link(),
228 227
 				'default'				=> $additional_attendee_reg_info
229 228
 			)
230 229
 		);
@@ -237,22 +236,22 @@  discard block
 block discarded – undo
237 236
 	 * @param EE_Question_Group $question_group
238 237
 	 * @return EE_Form_Section_Proper
239 238
 	 */
240
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
239
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
241 240
 		// array of params to pass to parent constructor
242 241
 		$form_args = array(
243
-			'html_id' 					=> 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
242
+			'html_id' 					=> 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
244 243
 			'html_class' 			=> $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv',
245
-			'html_label_id' 		=> 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
244
+			'html_label_id' 		=> 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
246 245
 			'subsections' 			=> array(
247
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
246
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
248 247
 			),
249 248
 			'layout_strategy' 	=> $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout()
250 249
 		);
251 250
 		// where params
252
-		$query_params = array( 'QST_deleted' => 0 );
251
+		$query_params = array('QST_deleted' => 0);
253 252
 		// don't load admin only questions on the frontend
254
-		if ( ! $this->checkout->admin_request ) {
255
-			$query_params['QST_admin_only'] = array( '!=', TRUE );
253
+		if ( ! $this->checkout->admin_request) {
254
+			$query_params['QST_admin_only'] = array('!=', TRUE);
256 255
 		}
257 256
 		$questions = $question_group->get_many_related(
258 257
 			'Question',
@@ -264,21 +263,21 @@  discard block
 block discarded – undo
264 263
 			)
265 264
 		);
266 265
 		// filter for additional content before questions
267
-		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this ));
266
+		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this));
268 267
 		// loop thru questions
269
-		foreach ( $questions as $question ) {
270
-			if( $question instanceof EE_Question ){
268
+		foreach ($questions as $question) {
269
+			if ($question instanceof EE_Question) {
271 270
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
272
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
271
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
273 272
 			}
274 273
 		}
275
-		$form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this );
274
+		$form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this);
276 275
 
277 276
 		// filter for additional content after questions
278
-		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this ));
277
+		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this));
279 278
 //		d( $form_args );
280
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
281
-		return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this );
279
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
280
+		return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this);
282 281
 	}
283 282
 
284 283
 
@@ -288,12 +287,12 @@  discard block
 block discarded – undo
288 287
 	 * @param EE_Question_Group $question_group
289 288
 	 * @return 	EE_Form_Section_HTML
290 289
 	 */
291
-	private function _question_group_header( EE_Question_Group $question_group ){
290
+	private function _question_group_header(EE_Question_Group $question_group) {
292 291
 		$html = '';
293 292
 		// group_name
294
-		if ( $question_group->show_group_name() && $question_group->name() != '' ) {
293
+		if ($question_group->show_group_name() && $question_group->name() != '') {
295 294
 			EE_Registry::instance()->load_helper('HTML');
296
-			if ( $this->checkout->admin_request ) {
295
+			if ($this->checkout->admin_request) {
297 296
 				$html .= EEH_HTML::br();
298 297
 				$html .= EEH_HTML::h3(
299 298
 					$question_group->name(),
@@ -307,7 +306,7 @@  discard block
 block discarded – undo
307 306
 			}
308 307
 		}
309 308
 		// group_desc
310
-		if ( $question_group->show_group_desc() && $question_group->desc() != '' ) {
309
+		if ($question_group->show_group_desc() && $question_group->desc() != '') {
311 310
 			$html .= EEH_HTML::p(
312 311
 				$question_group->desc(),
313 312
 				'',
@@ -315,7 +314,7 @@  discard block
 block discarded – undo
315 314
 			);
316 315
 
317 316
 		}
318
-		return new EE_Form_Section_HTML( $html );
317
+		return new EE_Form_Section_HTML($html);
319 318
 	}
320 319
 
321 320
 
@@ -324,14 +323,14 @@  discard block
 block discarded – undo
324 323
 	 * @access public
325 324
 	 * @return 	EE_Form_Section_Proper
326 325
 	 */
327
-	private function _copy_attendee_info_form(){
326
+	private function _copy_attendee_info_form() {
328 327
 		// array of params to pass to parent constructor
329 328
 		return new EE_Form_Section_Proper(
330 329
 			array(
331 330
 				'subsections' 			=> $this->_copy_attendee_info_inputs(),
332 331
 				'layout_strategy' 	=> new EE_Template_Layout(
333 332
 					array(
334
-						'layout_template_file' 			=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template
333
+						'layout_template_file' 			=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template
335 334
 						'begin_template_file' 			=> NULL,
336 335
 						'input_template_file' 				=> NULL,
337 336
 						'subsection_template_file' 	=> NULL,
@@ -353,8 +352,8 @@  discard block
 block discarded – undo
353 352
 	private function _auto_copy_attendee_info() {
354 353
 		return new EE_Form_Section_HTML(
355 354
 			EEH_Template::locate_template(
356
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
357
-				apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
355
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
356
+				apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
358 357
 				TRUE,
359 358
 				TRUE
360 359
 			)
@@ -373,25 +372,25 @@  discard block
 block discarded – undo
373 372
 		$copy_attendee_info_inputs = array();
374 373
 		$prev_ticket = NULL;
375 374
 		// grab the saved registrations from the transaction
376
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
377
-		foreach ( $registrations as $registration ) {
375
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
376
+		foreach ($registrations as $registration) {
378 377
 			// for all  attendees other than the primary attendee
379
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
378
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
380 379
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
381
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
380
+				if ($registration->ticket()->ID() !== $prev_ticket) {
382 381
 					$item_name = $registration->ticket()->name();
383
-					$item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : '';
384
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
385
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
382
+					$item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : '';
383
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
384
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
386 385
 					);
387 386
 					$prev_ticket = $registration->ticket()->ID();
388 387
 				}
389 388
 
390
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
389
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
391 390
 				EE_Checkbox_Multi_Input(
392
-					array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )),
391
+					array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())),
393 392
 					array(
394
-						'html_id' 								=> 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
393
+						'html_id' 								=> 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
395 394
 						'html_class' 						=> 'spco-copy-attendee-chk ee-do-not-validate',
396 395
 						'display_html_label_text' 	=> FALSE
397 396
 					)
@@ -410,7 +409,7 @@  discard block
 block discarded – undo
410 409
 	 * @param EE_Registration $registration
411 410
 	 * @return    EE_Form_Input_Base
412 411
 	 */
413
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
412
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
414 413
 		// generate hidden input
415 414
 		return new EE_Hidden_Input(
416 415
 			array(
@@ -428,31 +427,31 @@  discard block
 block discarded – undo
428 427
 	 * @param EE_Question     $question
429 428
 	 * @return 	EE_Form_Input_Base
430 429
 	 */
431
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
430
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
432 431
 
433 432
 		// if this question was for an attendee detail, then check for that answer
434
-		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() );
433
+		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID());
435 434
 		$answer = $answer_value === null
436
-				? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() )	) )
435
+				? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())))
437 436
 				: null;
438 437
 		// if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object
439
-		if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) {
438
+		if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) {
440 439
 			// create an EE_Answer object for storing everything in
441
-			$answer = EE_Answer::new_instance ( array(
440
+			$answer = EE_Answer::new_instance(array(
442 441
 				'QST_ID'=> $question->ID(),
443 442
 				'REG_ID'=> $registration->ID()
444 443
 			));
445 444
 		}
446 445
 		// verify instance
447
-		if( $answer instanceof EE_Answer ){
448
-			if ( ! empty( $answer_value )) {
449
-				$answer->set( 'ANS_value', $answer_value );
446
+		if ($answer instanceof EE_Answer) {
447
+			if ( ! empty($answer_value)) {
448
+				$answer->set('ANS_value', $answer_value);
450 449
 			}
451
-			$answer->cache( 'Question', $question );
452
-			$answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link();
453
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
450
+			$answer->cache('Question', $question);
451
+			$answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link();
452
+			$registration->cache('Answer', $answer, $answer_cache_id);
454 453
 		}
455
-		return $this->_generate_question_input( $registration, $question, $answer );
454
+		return $this->_generate_question_input($registration, $question, $answer);
456 455
 
457 456
 	}
458 457
 
@@ -464,31 +463,31 @@  discard block
 block discarded – undo
464 463
 	 * @param mixed EE_Answer|NULL      $answer
465 464
 	 * @return EE_Form_Input_Base
466 465
 	 */
467
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
466
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
468 467
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
469
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
470
-		add_filter( 'FHEE__EE_Question__generate_form_input__country_options', array( $this, 'use_cached_countries_for_form_input' ), 10, 4 );
471
-		add_filter( 'FHEE__EE_Question__generate_form_input__state_options', array( $this, 'use_cached_states_for_form_input' ), 10, 4 );
468
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
469
+		add_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input'), 10, 4);
470
+		add_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input'), 10, 4);
472 471
 		$input_constructor_args = array(
473
-			'html_name'     => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
474
-			'html_id'       => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
475
-			'html_class'    => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
476
-			'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
472
+			'html_name'     => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
473
+			'html_id'       => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
474
+			'html_class'    => 'ee-reg-qstn ee-reg-qstn-'.$identifier,
475
+			'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
477 476
 			'html_label_class'	=> 'ee-reg-qstn',
478 477
 		);
479
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
480
-		if ( $answer instanceof EE_Answer && $answer->ID() ) {
481
-			$input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']';
482
-			$input_constructor_args[ 'html_id' ] .= '-' . $answer->ID();
483
-			$input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID();
478
+		$input_constructor_args['html_label_id'] .= '-lbl';
479
+		if ($answer instanceof EE_Answer && $answer->ID()) {
480
+			$input_constructor_args['html_name'] .= '['.$answer->ID().']';
481
+			$input_constructor_args['html_id'] .= '-'.$answer->ID();
482
+			$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
484 483
 		}
485
-		$form_input =  $question->generate_form_input(
484
+		$form_input = $question->generate_form_input(
486 485
 			$registration,
487 486
 			$answer,
488 487
 			$input_constructor_args
489 488
 		);
490
-		remove_filter( 'FHEE__EE_Question__generate_form_input__country_options', array( $this, 'use_cached_countries_for_form_input' ) );
491
-		remove_filter( 'FHEE__EE_Question__generate_form_input__state_options', array( $this, 'use_cached_states_for_form_input' ) );
489
+		remove_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input'));
490
+		remove_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input'));
492 491
 		return $form_input;
493 492
 	}
494 493
 
@@ -500,20 +499,20 @@  discard block
 block discarded – undo
500 499
 	 * @param EE_Registration $registration
501 500
 	 * @return array 2d keys are country IDs, values are their names
502 501
 	 */
503
-	public function use_cached_countries_for_form_input( $countries_list, $question, $registration, $answer ) {
504
-		$country_options = array( '' => '' );
502
+	public function use_cached_countries_for_form_input($countries_list, $question, $registration, $answer) {
503
+		$country_options = array('' => '');
505 504
 		// get possibly cached list of countries
506 505
 		$countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
507
-		if ( ! empty( $countries )) {
508
-			foreach( $countries as $country ){
509
-				if ( $country instanceof EE_Country ) {
510
-					$country_options[ $country->ID() ] = $country->name();
506
+		if ( ! empty($countries)) {
507
+			foreach ($countries as $country) {
508
+				if ($country instanceof EE_Country) {
509
+					$country_options[$country->ID()] = $country->name();
511 510
 				}
512 511
 			}
513 512
 		}
514
-		if( $question instanceof EE_Question
515
-			&& $registration instanceof EE_Registration ) {
516
-			$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) );
513
+		if ($question instanceof EE_Question
514
+			&& $registration instanceof EE_Registration) {
515
+			$answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())));
517 516
 		} else {
518 517
 			$answer = EE_Answer::new_instance();
519 518
 		}
@@ -538,13 +537,13 @@  discard block
 block discarded – undo
538 537
 	 * @param EE_Registration $registration
539 538
 	 * @return array 2d keys are state IDs, values are their names
540 539
 	 */
541
-	public function use_cached_states_for_form_input( $states_list, $question, $registration, $answer ) {
542
-		$state_options = array( '' => array( '' => ''));
540
+	public function use_cached_states_for_form_input($states_list, $question, $registration, $answer) {
541
+		$state_options = array('' => array('' => ''));
543 542
 		$states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states();
544
-		if ( ! empty( $states )) {
545
-			foreach( $states as $state ){
546
-				if ( $state instanceof EE_State ) {
547
-					$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
543
+		if ( ! empty($states)) {
544
+			foreach ($states as $state) {
545
+				if ($state instanceof EE_State) {
546
+					$state_options[$state->country()->name()][$state->ID()] = $state->name();
548 547
 				}
549 548
 			}
550 549
 		}
@@ -578,65 +577,65 @@  discard block
 block discarded – undo
578 577
 	 */
579 578
 	public function process_reg_step() {
580 579
 
581
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
580
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
582 581
 		// grab validated data from form
583 582
 		$valid_data = $this->checkout->current_step->valid_data();
584 583
 		//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
585 584
 		//EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
586 585
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
587
-		if ( empty( $valid_data ))  {
588
-			EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
586
+		if (empty($valid_data)) {
587
+			EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
589 588
 			return FALSE;
590 589
 		}
591 590
 		//EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ );
592
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
593
-			EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
591
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
592
+			EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
594 593
 			return FALSE;
595 594
 		}
596 595
 		// get cached registrations
597
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
596
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
598 597
 		// verify we got the goods
599
-		if ( empty( $registrations )) {
600
-			EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
598
+		if (empty($registrations)) {
599
+			EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
601 600
 			return FALSE;
602 601
 		}
603 602
 		// extract attendee info from form data and save to model objects
604
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
603
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
605 604
 		// if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart
606
-		if ( $registrations_processed === FALSE ) {
605
+		if ($registrations_processed === FALSE) {
607 606
 			// but return immediately if the previous step exited early due to errors
608 607
 			return FALSE;
609
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
608
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
610 609
 			// generate a correctly translated string for all possible singular/plural combinations
611
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
610
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
612 611
 				$error_msg = sprintf(
613
-					__( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
612
+					__('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
614 613
 					$this->checkout->total_ticket_count,
615 614
 					$registrations_processed
616 615
 				);
617
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
616
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
618 617
 				$error_msg = sprintf(
619
-					__( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ),
618
+					__('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'),
620 619
 					$this->checkout->total_ticket_count,
621 620
 					$registrations_processed
622 621
 				);
623 622
 			} else {
624 623
 				$error_msg = sprintf(
625
-					__( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
624
+					__('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
626 625
 					$this->checkout->total_ticket_count,
627 626
 					$registrations_processed
628 627
 				);
629 628
 
630 629
 			}
631
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
630
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
632 631
 			return FALSE;
633 632
 		}
634 633
 		// mark this reg step as completed
635 634
 		$this->set_completed();
636
-		$this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' ));
635
+		$this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso'));
637 636
 		//do action in case a plugin wants to do something with the data submitted in step 1.
638 637
 		//passes EE_Single_Page_Checkout, and it's posted data
639
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
638
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
640 639
 		return TRUE;
641 640
 
642 641
 	}
@@ -650,9 +649,9 @@  discard block
 block discarded – undo
650 649
 	 * @param array             $valid_data
651 650
 	 * @return boolean | int
652 651
 	 */
653
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
652
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
654 653
 		// load resources and set some defaults
655
-		EE_Registry::instance()->load_model( 'Attendee' );
654
+		EE_Registry::instance()->load_model('Attendee');
656 655
 		// holder for primary registrant attendee object
657 656
 		$this->checkout->primary_attendee_obj = NULL;
658 657
 		// array for tracking reg form data for the primary registrant
@@ -669,19 +668,19 @@  discard block
 block discarded – undo
669 668
 		// attendee counter
670 669
 		$att_nmbr = 0;
671 670
 		// grab the saved registrations from the transaction
672
-		foreach ( $registrations  as $registration ) {
671
+		foreach ($registrations  as $registration) {
673 672
 			// verify EE_Registration object
674
-			if ( ! $registration instanceof EE_Registration ) {
675
-				EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
673
+			if ( ! $registration instanceof EE_Registration) {
674
+				EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
676 675
 				return FALSE;
677 676
 			}
678 677
 			$reg_url_link = $registration->reg_url_link();
679 678
 			// reg_url_link exists ?
680
-			if ( $reg_url_link ) {
679
+			if ($reg_url_link) {
681 680
 				// should this registration be processed during this visit ?
682
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
681
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
683 682
 					// if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects
684
-					if ( ! $this->checkout->revisit ) {
683
+					if ( ! $this->checkout->revisit) {
685 684
 						$registration->save();
686 685
 					}
687 686
 
@@ -692,41 +691,41 @@  discard block
 block discarded – undo
692 691
 					 * @var bool   if TRUE is returned by the plugin then the
693 692
 					 *      		registration processing is halted.
694 693
 					 */
695
-					if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) {
694
+					if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) {
696 695
 						return FALSE;
697 696
 					}
698 697
 
699 698
 					// Houston, we have a registration!
700 699
 					$att_nmbr++;
701
-					$this->_attendee_data[ $reg_url_link ] = array();
700
+					$this->_attendee_data[$reg_url_link] = array();
702 701
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
703
-					if ( isset( $valid_data[ $reg_url_link ] )) {
702
+					if (isset($valid_data[$reg_url_link])) {
704 703
 						// do we need to copy basic info from primary attendee ?
705
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE;
704
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE;
706 705
 						// filter form input data for this registration
707
-						$valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] );
706
+						$valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]);
708 707
 						//EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
709
-						if ( isset( $valid_data['primary_attendee'] )) {
710
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE;
711
-							unset( $valid_data['primary_attendee'] );
708
+						if (isset($valid_data['primary_attendee'])) {
709
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE;
710
+							unset($valid_data['primary_attendee']);
712 711
 						}
713 712
 						// now loop through our array of valid post data && process attendee reg forms
714
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
715
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
716
-								foreach ( $form_inputs as $form_input => $input_value ) {
713
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
714
+							if ( ! in_array($form_section, $non_input_form_sections)) {
715
+								foreach ($form_inputs as $form_input => $input_value) {
717 716
 									// check for critical inputs
718
-									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) {
717
+									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) {
719 718
 										return FALSE;
720 719
 									}
721 720
 									// store a bit of data about the primary attendee
722
-									if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) {
723
-										$primary_registrant[ $form_input ] = $input_value;
724
-									} else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) {
725
-										$input_value = $primary_registrant[ $form_input ];
721
+									if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) {
722
+										$primary_registrant[$form_input] = $input_value;
723
+									} else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) {
724
+										$input_value = $primary_registrant[$form_input];
726 725
 									}
727 726
 									// now attempt to save the input data
728
-									if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value ))  {
729
-										EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ );
727
+									if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) {
728
+										EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__);
730 729
 										return FALSE;
731 730
 									}
732 731
 								}
@@ -735,51 +734,51 @@  discard block
 block discarded – undo
735 734
 					}
736 735
 					//EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ );
737 736
 					// this registration does not require additional attendee information ?
738
-					if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
737
+					if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
739 738
 						// just copy the primary registrant
740 739
 						$attendee = $this->checkout->primary_attendee_obj;
741 740
 					} else {
742 741
 						// have we met before?
743
-						$attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
742
+						$attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]);
744 743
 						// did we find an already existing record for this attendee ?
745
-						if ( $attendee instanceof EE_Attendee ) {
746
-							$attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] );
744
+						if ($attendee instanceof EE_Attendee) {
745
+							$attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]);
747 746
 						} else {
748 747
 							// ensure critical details are set for additional attendees
749
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ];
750
-							$attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
748
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link];
749
+							$attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]);
751 750
 						}
752 751
 						// who's #1 ?
753
-						if ( $att_nmbr == 1 ) {
752
+						if ($att_nmbr == 1) {
754 753
 							$this->checkout->primary_attendee_obj = $attendee;
755 754
 						}
756 755
 					}
757 756
 					//EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
758 757
 					// add relation to registration, set attendee ID, and cache attendee
759
-					$this->_associate_attendee_with_registration( $registration, $attendee );
760
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
761
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
758
+					$this->_associate_attendee_with_registration($registration, $attendee);
759
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
760
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
762 761
 						return FALSE;
763 762
 					}
764 763
 					/** @type EE_Registration_Processor $registration_processor */
765
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
764
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
766 765
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
767
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE );
766
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE);
768 767
 					/** @type EE_Transaction_Processor $transaction_processor */
769
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
768
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
770 769
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
771
-					$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
770
+					$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
772 771
 					// if we've gotten this far, then let's save what we have
773 772
 					$registration->save();
774 773
 					// add relation between TXN and registration
775
-					$this->_associate_registration_with_transaction( $registration );
774
+					$this->_associate_registration_with_transaction($registration);
776 775
 
777 776
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
778 777
 
779
-			}  else {
780
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
778
+			} else {
779
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
781 780
 				// remove malformed data
782
-				unset( $valid_data[ $reg_url_link ] );
781
+				unset($valid_data[$reg_url_link]);
783 782
 				return FALSE;
784 783
 			}
785 784
 
@@ -797,22 +796,22 @@  discard block
 block discarded – undo
797 796
 	 * @param string           	$input_value
798 797
 	 * @return boolean
799 798
 	 */
800
-	private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) {
799
+	private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') {
801 800
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
802 801
 		//EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ );
803 802
 		// allow for plugins to hook in and do their own processing of the form input.
804 803
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
805
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) {
804
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) {
806 805
 			return TRUE;
807 806
 		}
808 807
 
809 808
 		// grab related answer objects
810 809
 		$answers = $registration->answers();
811 810
 		// $answer_cache_id is the key used to find the EE_Answer we want
812
-		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link();
813
-		$answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE;
811
+		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link();
812
+		$answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE;
814 813
 		//rename form_inputs if they are EE_Attendee properties
815
-		switch( (string)$form_input ) {
814
+		switch ((string) $form_input) {
816 815
 
817 816
 			case 'state' :
818 817
 			case 'STA_ID' :
@@ -827,33 +826,33 @@  discard block
 block discarded – undo
827 826
 				break;
828 827
 
829 828
 			default :
830
-				$ATT_input = 'ATT_' . $form_input;
829
+				$ATT_input = 'ATT_'.$form_input;
831 830
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
832
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE;
833
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
831
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE;
832
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
834 833
 		}
835 834
 		//EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
836 835
 		//EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
837 836
 		//EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
838 837
 		//EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
839 838
 		// if this form input has a corresponding attendee property
840
-		if ( $attendee_property ) {
841
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
842
-			if (  $answer_is_obj ) {
839
+		if ($attendee_property) {
840
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
841
+			if ($answer_is_obj) {
843 842
 				// and delete the corresponding answer since we won't be storing this data in that object
844
-				$registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' );
845
-				$answers[ $answer_cache_id ]->delete_permanently();
843
+				$registration->_remove_relation_to($answers[$answer_cache_id], 'Answer');
844
+				$answers[$answer_cache_id]->delete_permanently();
846 845
 			}
847 846
 			return TRUE;
848
-		} elseif ( $answer_is_obj ) {
847
+		} elseif ($answer_is_obj) {
849 848
 			// save this data to the answer object
850
-			$answers[ $answer_cache_id ]->set_value( $input_value );
851
-			$result = $answers[ $answer_cache_id ]->save();
849
+			$answers[$answer_cache_id]->set_value($input_value);
850
+			$result = $answers[$answer_cache_id]->save();
852 851
 			return $result !== false ? true : false;
853 852
 		} else {
854
-			foreach ( $answers as $answer ) {
855
-				if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) {
856
-					$answer->set_value( $input_value );
853
+			foreach ($answers as $answer) {
854
+				if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) {
855
+					$answer->set_value($input_value);
857 856
 					$result = $answer->save();
858 857
 					return $result !== false ? true : false;
859 858
 				}
@@ -871,31 +870,31 @@  discard block
 block discarded – undo
871 870
 	 * @param string $input_value
872 871
 	 * @return boolean
873 872
 	 */
874
-	private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) {
875
-		if ( empty( $input_value )) {
873
+	private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') {
874
+		if (empty($input_value)) {
876 875
 			// if the form input isn't marked as being required, then just return
877
-			if ( ! isset( $this->_required_questions[ $form_input ]  ) || ! $this->_required_questions[ $form_input ] ) {
876
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
878 877
 				return true;
879 878
 			}
880
-			switch( $form_input ) {
879
+			switch ($form_input) {
881 880
 				case 'fname' :
882
-					EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
881
+					EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
883 882
 					return FALSE;
884 883
 					break;
885 884
 				case 'lname' :
886
-					EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
885
+					EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
887 886
 					return FALSE;
888 887
 					break;
889 888
 				case 'email' :
890
-					EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
889
+					EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
891 890
 					return FALSE;
892 891
 					break;
893 892
 			}
894
-		} else if ( $form_input === 'email' ) {
893
+		} else if ($form_input === 'email') {
895 894
 			// check that an email was entered
896
-			if ( empty( $input_value ) ) {
895
+			if (empty($input_value)) {
897 896
 				// whoops!!!
898
-				EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
897
+				EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
899 898
 				return FALSE;
900 899
 			}
901 900
 		}
@@ -923,14 +922,14 @@  discard block
 block discarded – undo
923 922
 	 * @param array           $attendee_data
924 923
 	 * @return boolean
925 924
 	 */
926
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
925
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
927 926
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
928
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : '';
929
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : '';
930
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : '';
927
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : '';
928
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : '';
929
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : '';
931 930
 		// but only if those have values
932
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
933
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
931
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
932
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
934 933
 				'ATT_fname' => $ATT_fname,
935 934
 				'ATT_lname' => $ATT_lname,
936 935
 				'ATT_email' => $ATT_email
@@ -938,7 +937,7 @@  discard block
 block discarded – undo
938 937
 		} else {
939 938
 			$existing_attendee = NULL;
940 939
 		}
941
-		return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data );
940
+		return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data);
942 941
 	}
943 942
 
944 943
 
@@ -950,13 +949,13 @@  discard block
 block discarded – undo
950 949
 	 * @param array           $attendee_data
951 950
 	 * @return \EE_Attendee
952 951
 	 */
953
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
952
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
954 953
 		// first remove fname, lname, and email from attendee data
955
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
954
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
956 955
 		// now loop thru what's left and add to attendee CPT
957
-		foreach ( $attendee_data as $property_name => $property_value ) {
958
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
959
-				$existing_attendee->set( $property_name, $property_value );
956
+		foreach ($attendee_data as $property_name => $property_value) {
957
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
958
+				$existing_attendee->set($property_name, $property_value);
960 959
 			}
961 960
 		}
962 961
 		// better save that now
@@ -973,11 +972,11 @@  discard block
 block discarded – undo
973 972
 	 * @param EE_Attendee     $attendee
974 973
 	 * @return void
975 974
 	 */
976
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
975
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
977 976
 		// add relation to attendee
978
-		$registration->_add_relation_to( $attendee, 'Attendee' );
979
-		$registration->set_attendee_id( $attendee->ID() );
980
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
977
+		$registration->_add_relation_to($attendee, 'Attendee');
978
+		$registration->set_attendee_id($attendee->ID());
979
+		$registration->update_cache_after_object_save('Attendee', $attendee);
981 980
 	}
982 981
 
983 982
 
@@ -988,10 +987,10 @@  discard block
 block discarded – undo
988 987
 	 * @param EE_Registration $registration
989 988
 	 * @return void
990 989
 	 */
991
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
990
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
992 991
 		// add relation to attendee
993
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
994
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
992
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
993
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
995 994
 	}
996 995
 
997 996
 
@@ -1003,17 +1002,17 @@  discard block
 block discarded – undo
1003 1002
 	 * @param array $attendee_data
1004 1003
 	 * @return array
1005 1004
 	 */
1006
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1005
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1007 1006
 		// bare minimum critical details include first name, last name, email address
1008
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1007
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1009 1008
 		// add address info to critical details?
1010
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) {
1011
-			$address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' );
1012
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1009
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) {
1010
+			$address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone');
1011
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1013 1012
 		}
1014
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1015
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) {
1016
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail );
1013
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1014
+			if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) {
1015
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail);
1017 1016
 			}
1018 1017
 		}
1019 1018
 		return $attendee_data;
@@ -1028,11 +1027,11 @@  discard block
 block discarded – undo
1028 1027
 	 * @param array           $attendee_data
1029 1028
 	 * @return \EE_Attendee
1030 1029
 	 */
1031
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1030
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1032 1031
 		// create new attendee object
1033
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1032
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1034 1033
 		// set author to event creator
1035
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1034
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1036 1035
 		$new_attendee->save();
1037 1036
 		return $new_attendee;
1038 1037
 	}
@@ -1048,7 +1047,7 @@  discard block
 block discarded – undo
1048 1047
 	 */
1049 1048
 	public function update_reg_step() {
1050 1049
 		// save everything
1051
-		if ( $this->process_reg_step() ) {
1050
+		if ($this->process_reg_step()) {
1052 1051
 			$this->checkout->redirect = TRUE;
1053 1052
 			$this->checkout->redirect_url = add_query_arg(
1054 1053
 				array(
@@ -1057,7 +1056,7 @@  discard block
 block discarded – undo
1057 1056
 				),
1058 1057
 				$this->checkout->thank_you_page_url
1059 1058
 			);
1060
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1059
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1061 1060
 			return TRUE;
1062 1061
 		}
1063 1062
 		return FALSE;
Please login to merge, or discard this patch.