Completed
Branch BUG-9140-has-billing-form-igno... (f963e1)
by
unknown
219:56 queued 206:03
created
core/libraries/batch/Helpers/JobStepResponse.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
 	 * @param string $update_text
44 44
 	 * @param array $extra_data
45 45
 	 */
46
-	public function __construct(JobParameters $job_parameters, $update_text, $extra_data = array() ) {
47
-		$this->_job_parameters 	= $job_parameters;
46
+	public function __construct(JobParameters $job_parameters, $update_text, $extra_data = array()) {
47
+		$this->_job_parameters = $job_parameters;
48 48
 		$this->_update_text 	= $update_text;
49
-		$this->_extra_data 		= (array)$extra_data;
49
+		$this->_extra_data 		= (array) $extra_data;
50 50
 	}
51 51
 
52 52
 
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlerBaseClasses/JobHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 use EventEspressoBatchRequest\Helpers\JobParameters;
18 18
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
19 19
 
20
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
21
-	exit( 'No direct script access allowed' );
20
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
21
+	exit('No direct script access allowed');
22 22
 }
23 23
 
24 24
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @throws BatchRequestException
35 35
 	 * @return JobStepResponse
36 36
 	 */
37
-	abstract public function create_job( JobParameters $job_parameters );
37
+	abstract public function create_job(JobParameters $job_parameters);
38 38
 
39 39
 	/**
40 40
 	 * Performs another step of the job
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @return JobStepResponse
45 45
 	 * @throws BatchRequestException
46 46
 	 */
47
-	abstract public function continue_job( JobParameters $job_parameters, $batch_size = 50 );
47
+	abstract public function continue_job(JobParameters $job_parameters, $batch_size = 50);
48 48
 
49 49
 
50 50
 
@@ -55,6 +55,6 @@  discard block
 block discarded – undo
55 55
 	 * @return JobStepResponse
56 56
 	 * @throws BatchRequestException
57 57
 	 */
58
-	abstract public function cleanup_job( JobParameters $job_parameters );
58
+	abstract public function cleanup_job(JobParameters $job_parameters);
59 59
 }
60 60
 
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlerBaseClasses/JobHandlerFile.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
 use EventEspressoBatchRequest\Helpers\BatchRequestException;
18 18
 
19
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
20
-	exit( 'No direct script access allowed' );
19
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	protected $_file_helper = null;
31 31
 	const temp_folder_name = 'batch_temp_folder';
32
-	public function __construct( EEHI_File $file_helper = null ) {
33
-		if( ! $file_helper ) {
32
+	public function __construct(EEHI_File $file_helper = null) {
33
+		if ( ! $file_helper) {
34 34
 			$this->_file_helper = new \EEH_File();
35 35
 		}
36 36
 	}
@@ -45,30 +45,30 @@  discard block
 block discarded – undo
45 45
 	 * @return string
46 46
 	 * @throws BatchRequestException
47 47
 	 */
48
-	public function create_file_from_job_with_name( $job_id, $filename ) {
48
+	public function create_file_from_job_with_name($job_id, $filename) {
49 49
 		$filepath = '';
50
-		try{
50
+		try {
51 51
 			$success = $this->_file_helper->ensure_folder_exists_and_is_writable(
52
-				EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name
52
+				EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name
53 53
 			);
54
-			if ( $success ) {
54
+			if ($success) {
55 55
 				$success = $this->_file_helper->ensure_folder_exists_and_is_writable(
56
-					EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id
56
+					EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id
57 57
 				);
58 58
 			}
59
-			if( $success ) {
60
-				$filepath = EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename;
61
-				$success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath );
59
+			if ($success) {
60
+				$filepath = EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.$filename;
61
+				$success = $this->_file_helper->ensure_file_exists_and_is_writable($filepath);
62 62
 			}
63 63
 			//those methods normally fail with an exception, but if not, let's do it
64
-			if( ! $success ) {
65
-				throw new \EE_Error( 'could_not_create_temp_file',
66
-				__( 'An unknown error occurred', 'event_espresso' ));
64
+			if ( ! $success) {
65
+				throw new \EE_Error('could_not_create_temp_file',
66
+				__('An unknown error occurred', 'event_espresso'));
67 67
 			}
68
-		} catch( \EE_Error $e ) {
68
+		} catch (\EE_Error $e) {
69 69
 			throw new BatchRequestException(
70 70
 				sprintf(
71
-					__( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ),
71
+					__('Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso'),
72 72
 					$job_id,
73 73
 					$e->getMessage()
74 74
 				),
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @param string $filepath
85 85
 	 * @return string url to file
86 86
 	 */
87
-	public function get_url_to_file( $filepath ) {
88
-		return str_replace( EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath );
87
+	public function get_url_to_file($filepath) {
88
+		return str_replace(EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath);
89 89
 	}
90 90
 }
91 91
 
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlerBaseClasses/JobHandlerInterface.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 use EventEspressoBatchRequest\Helpers\JobParameters;
21 21
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
22 22
 
23
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
24
-	exit( 'No direct script access allowed' );
23
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
24
+	exit('No direct script access allowed');
25 25
 }
26 26
 
27 27
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @throws BatchRequestException
36 36
 	 * @return JobStepResponse
37 37
 	 */
38
-	public function create_job( JobParameters $job_parameters );
38
+	public function create_job(JobParameters $job_parameters);
39 39
 
40 40
 	/**
41 41
 	 * Performs another step of the job
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @return JobStepResponse
45 45
 	 * @throws BatchRequestException
46 46
 	 */
47
-	public function continue_job( JobParameters $job_parameters, $batch_size = 50 );
47
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50);
48 48
 
49 49
 	/**
50 50
 	 * Performs any clean-up logic when we know the job is completed
@@ -52,5 +52,5 @@  discard block
 block discarded – undo
52 52
 	 * @return JobStepResponse
53 53
 	 * @throws BatchRequestException
54 54
 	 */
55
-	public function cleanup_job( JobParameters $job_parameters );
55
+	public function cleanup_job(JobParameters $job_parameters);
56 56
 }
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/RegistrationsReport.php 3 patches
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			if( ! $event_slug ) {
76 76
 				$event_slug = __( 'unknown', 'event_espresso' );
77 77
 			}
78
-		}else{
78
+		} else{
79 79
 			$event_slug = __( 'all', 'event_espresso' );
80 80
 		}
81 81
 		return sprintf( "registrations-for-%s.csv", $event_slug );
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		);
163 163
 		if( $event_id ){
164 164
 			$query_params[0]['EVT_ID'] =  $event_id;
165
-		}else{
165
+		} else{
166 166
 			$query_params[ 'force_join' ][] = 'Event';
167 167
 		}
168 168
 		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 					$field = $reg_model->field_settings_for($field_name);
192 192
 					if($field_name == 'REG_final_price'){
193 193
 						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
194
-					}elseif( $field_name == 'REG_count' ){
194
+					} elseif( $field_name == 'REG_count' ){
195 195
 						$value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) );
196
-					}elseif( $field_name == 'REG_date' ) {
196
+					} elseif( $field_name == 'REG_date' ) {
197 197
 						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
198
-					}else{
198
+					} else{
199 199
 						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
200 200
 					}
201 201
 					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
 					if( $reg_row[ 'Attendee_CPT.ID' ]){
268 268
 						if($att_field_name == 'STA_ID'){
269 269
 							$value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
270
-						}elseif($att_field_name == 'CNT_ISO'){
270
+						} elseif($att_field_name == 'CNT_ISO'){
271 271
 							$value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
272
-						}else{
272
+						} else{
273 273
 							$value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
274 274
 						}
275
-					}else{
275
+					} else{
276 276
 						$value = '';
277 277
 					}
278 278
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * Gets the questions which are to be used for this report, so they
92 92
 	 * can be remembered for later
93 93
 	 * @param int|null $event_id
94
-	 * @return array of wpdb results for questions which are to be used for this report
94
+	 * @return \stdClass[] of wpdb results for questions which are to be used for this report
95 95
 	 */
96 96
 	protected function _get_questions_for_report( $event_id ) {
97 97
 		$question_query_params = array(
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * Performs any clean-up logic when we know the job is completed.
411 411
 	 * In this case, we delete the temporary file
412 412
 	 * @param JobParameters $job_parameters
413
-	 * @return boolean
413
+	 * @return JobStepResponse
414 414
 	 */
415 415
 	public function cleanup_job( JobParameters $job_parameters ){
416 416
 		$this->_file_helper->delete(
Please login to merge, or discard this patch.
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 use EventEspressoBatchRequest\Helpers\JobParameters;
20 20
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
21 21
 
22
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
23
-	exit( 'No direct script access allowed' );
22
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
23
+	exit('No direct script access allowed');
24 24
 }
25 25
 
26 26
 
@@ -35,36 +35,36 @@  discard block
 block discarded – undo
35 35
 	 * @throws BatchRequestException
36 36
 	 * @return JobStepResponse
37 37
 	 */
38
-	public function create_job( JobParameters $job_parameters ) {
39
-		$event_id = intval( $job_parameters->request_datum( 'EVT_ID', '0' ) );
40
-		if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_registrations', 'generating_report' ) ) {
38
+	public function create_job(JobParameters $job_parameters) {
39
+		$event_id = intval($job_parameters->request_datum('EVT_ID', '0'));
40
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) {
41 41
 			throw new BatchRequestException(
42
-				__( 'You do not have permission to view registrations', 'event_espresso')
42
+				__('You do not have permission to view registrations', 'event_espresso')
43 43
 			);
44 44
 		}
45 45
 		$filepath = $this->create_file_from_job_with_name(
46 46
 			$job_parameters->job_id(),
47
-			$this->get_filename_from_event( $event_id )
47
+			$this->get_filename_from_event($event_id)
48 48
 		);
49
-		$job_parameters->add_extra_data( 'filepath', $filepath );
50
-		$question_data_for_columns = $this->_get_questions_for_report( $event_id );
51
-		$job_parameters->add_extra_data( 'questions_data', $question_data_for_columns );
52
-		$job_parameters->set_job_size( $this->count_units_to_process( $event_id ) );
49
+		$job_parameters->add_extra_data('filepath', $filepath);
50
+		$question_data_for_columns = $this->_get_questions_for_report($event_id);
51
+		$job_parameters->add_extra_data('questions_data', $question_data_for_columns);
52
+		$job_parameters->set_job_size($this->count_units_to_process($event_id));
53 53
 		//we should also set the header columns
54 54
 		$csv_data_for_row = $this->get_csv_data_for(
55 55
 			$event_id,
56 56
 			0,
57 57
 			1,
58
-			$job_parameters->extra_datum( 'questions_data' ) );
59
-		\EE_Registry::instance()->load_helper( 'Export' );
60
-		\EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true );
58
+			$job_parameters->extra_datum('questions_data') );
59
+		\EE_Registry::instance()->load_helper('Export');
60
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
61 61
 		//if we actually processed a row there, record it
62
-		if( $job_parameters->job_size() ) {
63
-			$job_parameters->mark_processed( 1 );
62
+		if ($job_parameters->job_size()) {
63
+			$job_parameters->mark_processed(1);
64 64
 		}
65 65
 		return new JobStepResponse(
66 66
 			$job_parameters,
67
-			__( 'Registrations report started successfully...', 'event_espresso' )
67
+			__('Registrations report started successfully...', 'event_espresso')
68 68
 		);
69 69
 	}
70 70
 
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
 	 * @param int $event_id
76 76
 	 * @return string
77 77
 	 */
78
-	protected function get_filename_from_event( $event_id ) {
79
-		if( $event_id ){
80
-			$event_slug =  \EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' );
81
-			if( ! $event_slug ) {
82
-				$event_slug = __( 'unknown', 'event_espresso' );
78
+	protected function get_filename_from_event($event_id) {
79
+		if ($event_id) {
80
+			$event_slug = \EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug');
81
+			if ( ! $event_slug) {
82
+				$event_slug = __('unknown', 'event_espresso');
83 83
 			}
84
-		}else{
85
-			$event_slug = __( 'all', 'event_espresso' );
84
+		} else {
85
+			$event_slug = __('all', 'event_espresso');
86 86
 		}
87
-		return sprintf( "registrations-for-%s.csv", $event_slug );
87
+		return sprintf("registrations-for-%s.csv", $event_slug);
88 88
 	}
89 89
 
90 90
 	/**
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 	 * @param int|null $event_id
94 94
 	 * @return array of wpdb results for questions which are to be used for this report
95 95
 	 */
96
-	protected function _get_questions_for_report( $event_id ) {
96
+	protected function _get_questions_for_report($event_id) {
97 97
 		$question_query_params = array(
98 98
 			array(
99
-				'Answer.ANS_ID' => array( 'IS_NOT_NULL' ),
99
+				'Answer.ANS_ID' => array('IS_NOT_NULL'),
100 100
 			),
101
-			'group_by' => array( 'QST_ID' )
101
+			'group_by' => array('QST_ID')
102 102
 		);
103
-		if( $event_id ) {
103
+		if ($event_id) {
104 104
 			$question_query_params[0]['Answer.Registration.EVT_ID'] = $event_id;
105 105
 		}
106
-		return \EEM_Question::instance()->get_all_wpdb_results( $question_query_params );
106
+		return \EEM_Question::instance()->get_all_wpdb_results($question_query_params);
107 107
 	}
108 108
 
109 109
 
@@ -116,28 +116,28 @@  discard block
 block discarded – undo
116 116
 	 * @return JobStepResponse
117 117
 	 * @throws \EE_Error
118 118
 	 */
119
-	public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) {
119
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50) {
120 120
 		$csv_data = $this->get_csv_data_for(
121
-			$job_parameters->request_datum( 'EVT_ID', '0'),
121
+			$job_parameters->request_datum('EVT_ID', '0'),
122 122
 			$job_parameters->units_processed(),
123 123
 			$batch_size,
124
-			$job_parameters->extra_datum( 'questions_data' ) );
125
-		\EE_Registry::instance()->load_helper( 'Export' );
126
-		\EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false );
127
-		$units_processed = count( $csv_data );
128
-		$job_parameters->mark_processed( $units_processed );
124
+			$job_parameters->extra_datum('questions_data') );
125
+		\EE_Registry::instance()->load_helper('Export');
126
+		\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
127
+		$units_processed = count($csv_data);
128
+		$job_parameters->mark_processed($units_processed);
129 129
 		$extra_response_data = array(
130 130
 			'file_url' => ''
131 131
 		);
132
-		if( $units_processed < $batch_size ) {
133
-			$job_parameters->set_status( JobParameters::status_complete );
134
-			$extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) );
132
+		if ($units_processed < $batch_size) {
133
+			$job_parameters->set_status(JobParameters::status_complete);
134
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
135 135
 		}
136 136
 		return new JobStepResponse(
137 137
 				$job_parameters,
138 138
 				sprintf(
139
-					__( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ),
140
-					count( $csv_data ) ),
139
+					__('Wrote %1$s rows to report CSV file...', 'event_espresso'),
140
+					count($csv_data) ),
141 141
 				$extra_response_data );
142 142
 	}
143 143
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @return array top-level keys are numeric, next-level keys are column headers
151 151
 	 *
152 152
 	 */
153
-	function get_csv_data_for( $event_id, $offset, $limit, $questions_for_these_regs_rows ) {
154
-		\EE_Registry::instance()->load_helper( 'Export' );
153
+	function get_csv_data_for($event_id, $offset, $limit, $questions_for_these_regs_rows) {
154
+		\EE_Registry::instance()->load_helper('Export');
155 155
 		$reg_fields_to_include = array(
156 156
 			'TXN_ID',
157 157
 			'ATT_ID',
@@ -182,165 +182,165 @@  discard block
 block discarded – undo
182 182
 				array(
183 183
 					'OR' => array(
184 184
 						//don't include registrations from failed or abandoned transactions...
185
-						'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ),
185
+						'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)),
186 186
 						//unless the registration is approved, in which case include it regardless of transaction status
187 187
 						'STS_ID' => \EEM_Registration::status_id_approved
188 188
 						),
189
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
189
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
190 190
 					),
191
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
192
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ),
193
-				'limit' => array( $offset, $limit ),
191
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
192
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
193
+				'limit' => array($offset, $limit),
194 194
 			),
195 195
 			$event_id
196 196
 		);
197
-		if( $event_id ){
198
-			$query_params[0]['EVT_ID'] =  $event_id;
199
-		}else{
200
-			$query_params[ 'force_join' ][] = 'Event';
197
+		if ($event_id) {
198
+			$query_params[0]['EVT_ID'] = $event_id;
199
+		} else {
200
+			$query_params['force_join'][] = 'Event';
201 201
 		}
202
-		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
202
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
203 203
 		//get all questions which relate to someone in this group
204 204
 		$registration_ids = array();
205
-		foreach( $registration_rows as $reg_row ) {
206
-			$registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] );
205
+		foreach ($registration_rows as $reg_row) {
206
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
207 207
 		}
208 208
 
209
-		foreach($registration_rows as $reg_row){
210
-			if ( is_array( $reg_row ) ) {
209
+		foreach ($registration_rows as $reg_row) {
210
+			if (is_array($reg_row)) {
211 211
 				$reg_csv_array = array();
212
-				if( ! $event_id ){
212
+				if ( ! $event_id) {
213 213
 					//get the event's name and Id
214
-					$reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( \EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] );
214
+					$reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
215 215
 				}
216
-				$is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false;
216
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
217 217
 				/*@var $reg_row EE_Registration */
218
-				foreach($reg_fields_to_include as $field_name){
218
+				foreach ($reg_fields_to_include as $field_name) {
219 219
 					$field = $reg_model->field_settings_for($field_name);
220
-					if($field_name == 'REG_final_price'){
221
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
222
-					}elseif( $field_name == 'REG_count' ){
223
-						$value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) );
224
-					}elseif( $field_name == 'REG_date' ) {
225
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
226
-					}else{
227
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
220
+					if ($field_name == 'REG_final_price') {
221
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float');
222
+					}elseif ($field_name == 'REG_count') {
223
+						$value = sprintf(__('%s of %s', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size']));
224
+					}elseif ($field_name == 'REG_date') {
225
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html');
226
+					} else {
227
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]);
228 228
 					}
229 229
 					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
230
-					if($field_name == 'REG_final_price'){
230
+					if ($field_name == 'REG_final_price') {
231 231
 						//add a column named Currency after the final price
232 232
 						$reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code;
233 233
 					}
234 234
 				}
235 235
 				//get pretty status
236
-				$stati = \EEM_Status::instance()->localized_status( array(
237
-					$reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ),
238
-					$reg_row[ 'Transaction.STS_ID' ] => __( 'unknown', 'event_espresso' ) ),
236
+				$stati = \EEM_Status::instance()->localized_status(array(
237
+					$reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'),
238
+					$reg_row['Transaction.STS_ID'] => __('unknown', 'event_espresso') ),
239 239
 						FALSE,
240
-						'sentence' );
241
-				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ];
240
+						'sentence');
241
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
242 242
 				//get pretty transaction status
243
-				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'Transaction.STS_ID' ] ];
244
-				$reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'Transaction.TXN_total' ], 'localized_float' ) : '0.00';
245
-				$reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'Transaction.TXN_paid' ], 'localized_float' ) : '0.00';
243
+				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['Transaction.STS_ID']];
244
+				$reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', $reg_row['Transaction.TXN_total'], 'localized_float') : '0.00';
245
+				$reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', $reg_row['Transaction.TXN_paid'], 'localized_float') : '0.00';
246 246
 				$payment_methods = array();
247 247
 				$gateway_txn_ids_etc = array();
248 248
 				$payment_times = array();
249
-				if( $is_primary_reg && $reg_row[ 'Transaction.TXN_ID' ] ){
249
+				if ($is_primary_reg && $reg_row['Transaction.TXN_ID']) {
250 250
 					$payments_info = \EEM_Payment::instance()->get_all_wpdb_results(
251 251
 							array(
252 252
 								array(
253
-									'TXN_ID' => $reg_row[ 'Transaction.TXN_ID' ],
253
+									'TXN_ID' => $reg_row['Transaction.TXN_ID'],
254 254
 									'STS_ID' => \EEM_Payment::status_id_approved
255 255
 								),
256
-								'force_join' => array( 'Payment_Method' ),
256
+								'force_join' => array('Payment_Method'),
257 257
 
258 258
 							),
259 259
 							ARRAY_A,
260 260
 							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
261 261
 
262
-					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
263
-						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
264
-						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
265
-						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
262
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
263
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
264
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
265
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : '';
266 266
 					}
267 267
 
268 268
 				}
269
-				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
270
-				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
271
-				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );
269
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
270
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
271
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
272 272
 
273 273
 				//get whether or not the user has checked in
274
-				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' );
274
+				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
275 275
 				//get ticket of registration and its price
276 276
 				$ticket_model = \EE_Registry::instance()->load_model('Ticket');
277
-				if( $reg_row[ 'Ticket.TKT_ID'] ) {
278
-					$ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] );
277
+				if ($reg_row['Ticket.TKT_ID']) {
278
+					$ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']);
279 279
 					$datetimes_strings = array();
280
-					foreach( \EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){
281
-						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] );
280
+					foreach (\EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) {
281
+						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
282 282
 					}
283 283
 
284 284
 				} else {
285
-					$ticket_name = __( 'Unknown', 'event_espresso' );
286
-					$datetimes_strings = array( __( 'Unknown', 'event_espresso' ) );
285
+					$ticket_name = __('Unknown', 'event_espresso');
286
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
287 287
 				}
288 288
 				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
289 289
 				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
290 290
 				//get datetime(s) of registration
291 291
 
292 292
 				//add attendee columns
293
-				foreach($att_fields_to_include as $att_field_name){
293
+				foreach ($att_fields_to_include as $att_field_name) {
294 294
 					$field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name);
295
-					if( $reg_row[ 'Attendee_CPT.ID' ]){
296
-						if($att_field_name == 'STA_ID'){
297
-							$value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
298
-						}elseif($att_field_name == 'CNT_ISO'){
299
-							$value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
300
-						}else{
301
-							$value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
295
+					if ($reg_row['Attendee_CPT.ID']) {
296
+						if ($att_field_name == 'STA_ID') {
297
+							$value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name');
298
+						}elseif ($att_field_name == 'CNT_ISO') {
299
+							$value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name');
300
+						} else {
301
+							$value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
302 302
 						}
303
-					}else{
303
+					} else {
304 304
 						$value = '';
305 305
 					}
306 306
 
307
-					$reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value;
307
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value;
308 308
 				}
309 309
 
310 310
 				//make sure each registration has the same questions in the same order
311
-				foreach($questions_for_these_regs_rows as $question_row){
312
-					if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){
313
-						$reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null;
311
+				foreach ($questions_for_these_regs_rows as $question_row) {
312
+					if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) {
313
+						$reg_csv_array[$question_row['Question.QST_admin_label']] = null;
314 314
 					}
315 315
 				}
316 316
 				$answers = \EEM_Answer::instance()->get_all_wpdb_results(
317 317
 					array(
318
-						array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ),
319
-						'force_join' => array( 'Question' )
318
+						array('REG_ID' => $reg_row['Registration.REG_ID']),
319
+						'force_join' => array('Question')
320 320
 					)
321 321
 				);
322 322
 				//now fill out the questions THEY answered
323
-				foreach( $answers as $answer_row ){
324
-					if( $answer_row[ 'Question.QST_ID' ] ){
323
+				foreach ($answers as $answer_row) {
324
+					if ($answer_row['Question.QST_ID']) {
325 325
 						$question_label = \EEH_Export::prepare_value_from_db_for_display(
326 326
 							\EEM_Question::instance(),
327 327
 							'QST_admin_label',
328
-							$answer_row[ 'Question.QST_admin_label' ]
328
+							$answer_row['Question.QST_admin_label']
329 329
 						);
330 330
 					} else {
331
-						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
331
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
332 332
 					}
333
-					if ( isset( $answer_row[ 'Question.QST_type' ] )
334
-						 && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state
333
+					if (isset($answer_row['Question.QST_type'])
334
+						 && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state
335 335
 					) {
336
-						$reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID(
337
-							$answer_row[ 'Answer.ANS_value' ]
336
+						$reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID(
337
+							$answer_row['Answer.ANS_value']
338 338
 						);
339 339
 					} else {
340
-						$reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display(
340
+						$reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display(
341 341
 							\EEM_Answer::instance(),
342 342
 							'ANS_value',
343
-							$answer_row[ 'Answer.ANS_value' ]
343
+							$answer_row['Answer.ANS_value']
344 344
 						);
345 345
 					}
346 346
 				}
@@ -351,17 +351,17 @@  discard block
 block discarded – undo
351 351
 			}
352 352
 		}
353 353
 		//if we couldn't export anything, we want to at least show the column headers
354
-		if ( empty( $registrations_csv_ready_array ) ) {
354
+		if (empty($registrations_csv_ready_array)) {
355 355
 			$reg_csv_array = array();
356 356
 			$model_and_fields_to_include = array(
357 357
 				'Registration' => $reg_fields_to_include,
358 358
 				'Attendee'     => $att_fields_to_include
359 359
 			);
360
-			foreach ( $model_and_fields_to_include as $model_name => $field_list ) {
361
-				$model = \EE_Registry::instance()->load_model( $model_name );
362
-				foreach ( $field_list as $field_name ) {
363
-					$field = $model->field_settings_for( $field_name );
364
-					$reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null;
360
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
361
+				$model = \EE_Registry::instance()->load_model($model_name);
362
+				foreach ($field_list as $field_name) {
363
+					$field = $model->field_settings_for($field_name);
364
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
365 365
 				}
366 366
 			}
367 367
 			$registrations_csv_ready_array[] = $reg_csv_array;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	 * @param int $event_id
378 378
 	 * @return int
379 379
 	 */
380
-	public function count_units_to_process( $event_id ) {
380
+	public function count_units_to_process($event_id) {
381 381
 		//use the legacy filter
382 382
 		$query_params = apply_filters(
383 383
 			'FHEE__EE_Export__report_registration_for_event',
@@ -385,23 +385,23 @@  discard block
 block discarded – undo
385 385
 				array(
386 386
 					'OR' => array(
387 387
 						//don't include registrations from failed or abandoned transactions...
388
-						'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ),
388
+						'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)),
389 389
 						//unless the registration is approved, in which case include it regardless of transaction status
390 390
 						'STS_ID' => \EEM_Registration::status_id_approved
391 391
 						),
392
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
392
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
393 393
 					),
394
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
395
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' )
394
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
395
+				'force_join' => array('Transaction', 'Ticket', 'Attendee')
396 396
 			),
397 397
 			$event_id
398 398
 		);
399
-		if( $event_id ){
400
-			$query_params[0]['EVT_ID'] =  $event_id;
399
+		if ($event_id) {
400
+			$query_params[0]['EVT_ID'] = $event_id;
401 401
 		} else {
402
-			$query_params[ 'force_join' ][] = 'Event';
402
+			$query_params['force_join'][] = 'Event';
403 403
 		}
404
-		return \EEM_Registration::instance()->count( $query_params );
404
+		return \EEM_Registration::instance()->count($query_params);
405 405
 	}
406 406
 
407 407
 
@@ -412,13 +412,13 @@  discard block
 block discarded – undo
412 412
 	 * @param JobParameters $job_parameters
413 413
 	 * @return boolean
414 414
 	 */
415
-	public function cleanup_job( JobParameters $job_parameters ){
415
+	public function cleanup_job(JobParameters $job_parameters) {
416 416
 		$this->_file_helper->delete(
417
-			\EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ),
417
+			\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
418 418
 			true,
419 419
 			'd'
420 420
 		);
421
-		return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) );
421
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
422 422
 	}
423 423
 }
424 424
 
Please login to merge, or discard this patch.
caffeinated/admin/extend/events/help_tabs/import_page.help_tab.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,18 +2,18 @@
 block discarded – undo
2 2
 <p>
3 3
 <?php _e('The importer can be used to import event information into Event Espresso using a CSV file.', 'event_espresso'); ?>
4 4
 </p>
5
-<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso');?></h3>
5
+<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso'); ?></h3>
6 6
 <p>
7 7
 <?php _e('To import Event Espresso data from another Event Espresso 4 install, export a CSV file from the admin Events overview page, or anywhere you can generate a CSV export file from. Then upload that file here (regardless of what type of information was exported).', 'event_espresso'); ?>
8 8
 </p>
9 9
 <p>
10 10
 <?php _e('Note: its possible that data from the other site have the same IDs as data in this site. The importer recognizes that this data is from a different database and inserts new items for each item in the CSV file, regardless of whether its ID matches that of an item in this site\'s database or not. However, the importer also remembers the mapping from the old site\'s database to this site\'s database, and on subsequent CSV importers from that site, the data in this database will be updated instead of re-inserting new items.', 'event_espresso'); ?>
11 11
 </p>
12
-<h3><?php _e("Importing from this Site", 'event_espresso');?></h3>
13
-<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso');?></p>
12
+<h3><?php _e("Importing from this Site", 'event_espresso'); ?></h3>
13
+<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso'); ?></p>
14 14
 
15
-	<h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso");?></h3>
16
-	<p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso");?></p>
17
-	<p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso");?></p>
18
-	<p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso");?></p>
19
-	<p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso");?></p>
20 15
\ No newline at end of file
16
+	<h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso"); ?></h3>
17
+	<p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso"); ?></p>
18
+	<p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso"); ?></p>
19
+	<p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso"); ?></p>
20
+	<p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso"); ?></p>
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
core/admin/EE_Admin_Hooks.core.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * constructor
210 210
 	 * @param EE_Admin_Page $admin_page the calling admin_page_object
211 211
 	 */
212
-	public function __construct( EE_Admin_Page $adminpage ) {
212
+	public function __construct(EE_Admin_Page $adminpage) {
213 213
 
214 214
 		$this->_adminpage_obj = $adminpage;
215 215
 		$this->_req_data = array_merge($_GET, $_POST);
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 		$this->_set_hooks_properties();
218 218
 
219 219
 		//first let's verify we're on the right page
220
-		if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) )
220
+		if ( ! isset($this->_req_data['page']) || (isset($this->_req_data['page']) && $this->_adminpage_obj->page_slug != $this->_req_data['page']))
221 221
 			return; //get out nothing more to be done here.
222 222
 
223 223
 		//allow for extends to modify properties
224
-		if ( method_exists( $this, '_extend_properties' ) )
224
+		if (method_exists($this, '_extend_properties'))
225 225
 			$this->_extend_properties();
226 226
 
227 227
 		$this->_set_page_object();
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 		$this->_load_custom_methods();
230 230
 		$this->_load_routed_hooks();
231 231
 
232
-		add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts_styles' ) );
233
-		add_action( 'admin_enqueue_scripts', array($this, 'add_metaboxes'), 20 );
234
-		add_action( 'admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15 );
232
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
233
+		add_action('admin_enqueue_scripts', array($this, 'add_metaboxes'), 20);
234
+		add_action('admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15);
235 235
 
236 236
 		$this->_ajax_hooks();
237 237
 
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function enqueue_scripts_styles() {
274 274
 
275
-		if ( !empty( $this->_scripts_styles ) ) {
275
+		if ( ! empty($this->_scripts_styles)) {
276 276
 			//first let's do all the registrations
277
-			if ( !isset($this->_scripts_styles['registers'] ) ) {
277
+			if ( ! isset($this->_scripts_styles['registers'])) {
278 278
 				$msg[] = __('There is no "registers" index in the <code>$this->_scripts_styles</code> property.', 'event_espresso');
279
-				$msg[] = sprintf ( __('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>' . $this->caller . '</strong>' );
280
-				throw new EE_Error( implode( '||', $msg ) );
279
+				$msg[] = sprintf(__('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>'.$this->caller.'</strong>');
280
+				throw new EE_Error(implode('||', $msg));
281 281
 			}
282 282
 
283
-			foreach( $this->_scripts_styles['registers'] as $ref => $details ) {
283
+			foreach ($this->_scripts_styles['registers'] as $ref => $details) {
284 284
 				$defaults = array(
285 285
 					'type' => 'js',
286 286
 					'url' => '',
@@ -289,48 +289,48 @@  discard block
 block discarded – undo
289 289
 					'footer' => TRUE
290 290
 					);
291 291
 				$details = wp_parse_args($details, $defaults);
292
-				extract( $details );
292
+				extract($details);
293 293
 
294 294
 				//let's make sure that we set the 'registers' type if it's not set! We need it later to determine whhich enqueu we do
295 295
 				$this->_scripts_styles['registers'][$ref]['type'] = $type;
296 296
 
297 297
 				//let's make sure we're not missing any REQUIRED parameters
298
-				if ( empty($url) ) {
299
-					$msg[] = sprintf( __('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet' );
300
-					$msg[] = sprintf( __('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>' . $this->caller . '</strong>', $ref );
301
-					throw new EE_Error( implode( '||', $msg ) );
298
+				if (empty($url)) {
299
+					$msg[] = sprintf(__('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet');
300
+					$msg[] = sprintf(__('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>'.$this->caller.'</strong>', $ref);
301
+					throw new EE_Error(implode('||', $msg));
302 302
 				}
303 303
 				//made it here so let's do the appropriate registration
304
-				$type == 'js' ? wp_register_script( $ref, $url, $depends, $version, $footer ) : wp_register_style( $ref, $url, $depends, $version );
304
+				$type == 'js' ? wp_register_script($ref, $url, $depends, $version, $footer) : wp_register_style($ref, $url, $depends, $version);
305 305
 			}
306 306
 
307 307
 			//k now lets do the enqueues
308
-			if( !isset( $this->_scripts_styles['enqueues'] ) )
309
-				return;  //not sure if we should throw an error here or not.
310
-			foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) {
308
+			if ( ! isset($this->_scripts_styles['enqueues']))
309
+				return; //not sure if we should throw an error here or not.
310
+			foreach ($this->_scripts_styles['enqueues'] as $ref => $routes) {
311 311
 				//make sure $routes is an array
312 312
 				$routes = (array) $routes;
313 313
 
314
-				if ( in_array($this->_current_route, $routes ) ) {
314
+				if (in_array($this->_current_route, $routes)) {
315 315
 					$this->_scripts_styles['registers'][$ref]['type'] == 'js' ? wp_enqueue_script($ref) : wp_enqueue_style($ref);
316 316
 					//if we have a localization for the script let's do that too.
317
-					if ( isset( $this->_scripts_styles['localize'][$ref] ) ) {
318
-						foreach ( $this->_scripts_styles['localize'][$ref] as $object_name => $indexes ) {
319
-							wp_localize_script($ref, $object_name , $this->_scripts_styles['localize'][$ref][$object_name] );
317
+					if (isset($this->_scripts_styles['localize'][$ref])) {
318
+						foreach ($this->_scripts_styles['localize'][$ref] as $object_name => $indexes) {
319
+							wp_localize_script($ref, $object_name, $this->_scripts_styles['localize'][$ref][$object_name]);
320 320
 						}
321 321
 					}
322 322
 				}
323 323
 			}
324 324
 
325 325
 			//let's do the deregisters
326
-			if ( !isset( $this->_scripts_styles['deregisters'] ) )
326
+			if ( ! isset($this->_scripts_styles['deregisters']))
327 327
 				return;
328
-			foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) {
328
+			foreach ($this->_scripts_styles['deregisters'] as $ref => $details) {
329 329
 				$defaults = array(
330 330
 					'type' => 'js'
331 331
 					);
332
-				$details = wp_parse_args( $details, $defaults );
333
-				extract( $details );
332
+				$details = wp_parse_args($details, $defaults);
333
+				extract($details);
334 334
 
335 335
 				$type == 'js' ? wp_deregister_script($ref) : wp_deregister_style($ref);
336 336
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	private function _set_defaults() {
351 351
 		$this->_ajax_func = $this->_init_func = $this->_metaboxes = $this->_scripts = $this->_styles = $this->_wp_action_filters_priority = array();
352
-		$this->_current_route = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default';
352
+		$this->_current_route = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default';
353 353
 		$this->caller = get_class($this);
354 354
 		$this->_extend = stripos($this->caller, 'Extend') ? TRUE : FALSE;
355 355
 	}
@@ -364,34 +364,34 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	protected function _set_page_object() {
366 366
 		//first make sure $this->_name is set
367
-		if ( empty( $this->_name ) ) {
367
+		if (empty($this->_name)) {
368 368
 			$msg[] = __('We can\'t load the page object', 'event_espresso');
369
-			$msg[] = sprintf( __("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller );
370
-			throw new EE_Error( implode( '||', $msg ) );
369
+			$msg[] = sprintf(__("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller);
370
+			throw new EE_Error(implode('||', $msg));
371 371
 		}
372 372
 
373
-		$ref = str_replace('_' , ' ', $this->_name); //take the_message -> the message
374
-		$ref = str_replace(' ', '_', ucwords($ref) ) . '_Admin_Page'; //take the message -> The_Message
373
+		$ref = str_replace('_', ' ', $this->_name); //take the_message -> the message
374
+		$ref = str_replace(' ', '_', ucwords($ref)).'_Admin_Page'; //take the message -> The_Message
375 375
 
376 376
 		//first default file (if exists)
377
-		$decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php';
378
-		if ( is_readable( $decaf_file ) )
379
-		require_once( $decaf_file );
377
+		$decaf_file = EE_ADMIN_PAGES.$this->_name.DS.$ref.'.core.php';
378
+		if (is_readable($decaf_file))
379
+		require_once($decaf_file);
380 380
 
381 381
 		//now we have to do require for extended file (if needed)
382
-		if ( $this->_extend ) {
383
-			require_once( EE_CORE_CAF_ADMIN_EXTEND . $this->_name . DS . 'Extend_' . $ref . '.core.php' );
382
+		if ($this->_extend) {
383
+			require_once(EE_CORE_CAF_ADMIN_EXTEND.$this->_name.DS.'Extend_'.$ref.'.core.php');
384 384
 		}
385 385
 
386 386
 
387 387
 		//if we've got an extended class we use that!
388
-		$ref = $this->_extend ? 'Extend_' . $ref : $ref;
388
+		$ref = $this->_extend ? 'Extend_'.$ref : $ref;
389 389
 
390 390
 		//let's make sure the class exists
391
-		if ( !class_exists( $ref ) ) {
391
+		if ( ! class_exists($ref)) {
392 392
 			$msg[] = __('We can\'t load the page object', 'event_espresso');
393
-			$msg[] = sprintf( __('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref );
394
-			throw new EE_Error( implode( '||', $msg ) );
393
+			$msg[] = sprintf(__('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref);
394
+			throw new EE_Error(implode('||', $msg));
395 395
 		}
396 396
 
397 397
 		$a = new ReflectionClass($ref);
@@ -416,27 +416,27 @@  discard block
 block discarded – undo
416 416
 		$method_callback = $this->_current_route == 'default' ? 'default_callback' : $this->_current_route;
417 417
 
418 418
 		//these run before the Admin_Page route executes.
419
-		if ( method_exists( $this, $method_callback ) ) {
420
-			call_user_func( array( $this, $method_callback) );
419
+		if (method_exists($this, $method_callback)) {
420
+			call_user_func(array($this, $method_callback));
421 421
 		}
422 422
 
423 423
 
424 424
 		//these run via the _redirect_after_action method in EE_Admin_Page which usually happens after non_UI methods in EE_Admin_Page classes.  There are two redirect actions, the first fires before $query_args might be manipulated by "save and close" actions and the seond fires right before the actual redirect happens.
425 425
 		//first the actions
426 426
 		//note that these action hooks will have the $query_args value available.
427
-		$admin_class_name = get_class( $this->_adminpage_obj );
427
+		$admin_class_name = get_class($this->_adminpage_obj);
428 428
 
429
-		if ( method_exists( $this, '_redirect_action_early_' . $this->_current_route ) ) {
430
-			add_action( 'AHEE__' . $admin_class_name . '___redirect_after_action__before_redirect_modification_' . $this->_current_route, array( $this, '_redirect_action_early_' . $this->_current_route ), 10 );
429
+		if (method_exists($this, '_redirect_action_early_'.$this->_current_route)) {
430
+			add_action('AHEE__'.$admin_class_name.'___redirect_after_action__before_redirect_modification_'.$this->_current_route, array($this, '_redirect_action_early_'.$this->_current_route), 10);
431 431
 		}
432 432
 
433
-		if ( method_exists( $this, '_redirect_action_' . $this->_current_route ) ) {
434
-			add_action( 'AHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_action_' . $this->_current_route ), 10 );
433
+		if (method_exists($this, '_redirect_action_'.$this->_current_route)) {
434
+			add_action('AHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_action_'.$this->_current_route), 10);
435 435
 		}
436 436
 
437 437
 		//let's hook into the _redirect itself and allow for changing where the user goes after redirect.  This will have $query_args and $redirect_url available.
438
-		if ( method_exists( $this, '_redirect_filter_' . $this->_current_route ) ) {
439
-			add_filter( 'FHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_filter_' . $this->_current_route ), 10, 2 );
438
+		if (method_exists($this, '_redirect_filter_'.$this->_current_route)) {
439
+			add_filter('FHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_filter_'.$this->_current_route), 10, 2);
440 440
 		}
441 441
 
442 442
 	}
@@ -459,12 +459,12 @@  discard block
 block discarded – undo
459 459
 				'argnum' => 1,
460 460
 				'priority' => 10
461 461
 				),
462
-			'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug . '_' . $this->_current_route => array(
462
+			'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug.'_'.$this->_current_route => array(
463 463
 				'type' => 'filter',
464 464
 				'argnum' => 1,
465 465
 				'priority' => 10
466 466
 				),
467
-			'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug => array(
467
+			'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug => array(
468 468
 				'type' => 'filter',
469 469
 				'argnum' => 1,
470 470
 				'priority' => 10
@@ -483,14 +483,14 @@  discard block
 block discarded – undo
483 483
 
484 484
 
485 485
 
486
-		foreach ( $hook_filter_array as $hook => $args ) {
487
-			if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) {
488
-				if ( isset( $this->_wp_action_filters_priority[$hook] ) )
486
+		foreach ($hook_filter_array as $hook => $args) {
487
+			if (method_exists($this, $this->_current_route.'_'.$hook)) {
488
+				if (isset($this->_wp_action_filters_priority[$hook]))
489 489
 					$args['priority'] = $this->_wp_action_filters_priority[$hook];
490
-				if ( $args['type'] == 'action' )
491
-					add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
490
+				if ($args['type'] == 'action')
491
+					add_action($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']);
492 492
 				else
493
-					add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
493
+					add_filter($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']);
494 494
 			}
495 495
 		}
496 496
 
@@ -503,18 +503,18 @@  discard block
 block discarded – undo
503 503
 	 */
504 504
 	private function _ajax_hooks() {
505 505
 
506
-		if ( empty( $this->_ajax_func) )
506
+		if (empty($this->_ajax_func))
507 507
 			return; //get out there's nothing to take care of.
508 508
 
509
-		foreach ( $this->_ajax_func as $action => $method ) {
509
+		foreach ($this->_ajax_func as $action => $method) {
510 510
 			//make sure method exists
511
-			if ( !method_exists($this, $method) ) {
512
-				$msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso') . '<br />';
513
-				$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller );
514
-				throw new EE_Error( implode('||', $msg ) );
511
+			if ( ! method_exists($this, $method)) {
512
+				$msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso').'<br />';
513
+				$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller);
514
+				throw new EE_Error(implode('||', $msg));
515 515
 			}
516 516
 
517
-			add_action('wp_ajax_' . $action, array( $this, $method ) );
517
+			add_action('wp_ajax_'.$action, array($this, $method));
518 518
 		}
519 519
 
520 520
 	}
@@ -527,21 +527,21 @@  discard block
 block discarded – undo
527 527
 	 * @return void
528 528
 	 */
529 529
 	protected function _init_hooks() {
530
-		if ( empty( $this->_init_func) )
530
+		if (empty($this->_init_func))
531 531
 			return; //get out there's nothing to take care of.
532 532
 
533 533
 		//We need to determine what page_route we are on!
534
-		$current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default';
534
+		$current_route = isset ($_REQUEST['action']) ? $_REQUEST['action'] : 'default';
535 535
 
536
-		foreach ( $this->_init_func as $route => $method ) {
536
+		foreach ($this->_init_func as $route => $method) {
537 537
 			//make sure method exists
538
-			if ( !method_exists($this, $method) ) {
539
-				$msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso') . '<br />';
540
-				$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller );
541
-				throw new EE_Error( implode('||', $msg ) );
538
+			if ( ! method_exists($this, $method)) {
539
+				$msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso').'<br />';
540
+				$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller);
541
+				throw new EE_Error(implode('||', $msg));
542 542
 			}
543
-			if ( $route == $this->_current_route )
544
-				add_action('admin_init', array( $this, $method ) );
543
+			if ($route == $this->_current_route)
544
+				add_action('admin_init', array($this, $method));
545 545
 		}
546 546
 
547 547
 	}
@@ -556,28 +556,28 @@  discard block
 block discarded – undo
556 556
 	 * @return void
557 557
 	 */
558 558
 	public function add_metaboxes() {
559
-		if ( empty( $this->_metaboxes ) )
559
+		if (empty($this->_metaboxes))
560 560
 			return; //get out we don't have any metaboxes to set for this connection
561 561
 
562
-		$this->_handle_metabox_array( $this->_metaboxes );
562
+		$this->_handle_metabox_array($this->_metaboxes);
563 563
 
564 564
 	}
565 565
 
566 566
 
567 567
 
568
-	private function _handle_metabox_array( $boxes, $add = TRUE ) {
568
+	private function _handle_metabox_array($boxes, $add = TRUE) {
569 569
 
570
-		foreach ( $boxes as $box ) {
571
-			if ( !isset($box['page_route']) )
570
+		foreach ($boxes as $box) {
571
+			if ( ! isset($box['page_route']))
572 572
 				continue; //we dont' have a valid array
573 573
 
574 574
 			//let's make sure $box['page_route'] is an array so the "foreach" will work.
575 575
 			$box['page_route'] = (array) $box['page_route'];
576 576
 
577
-			foreach ( $box['page_route'] as $route ) {
578
-				if ( $route != $this->_current_route )
577
+			foreach ($box['page_route'] as $route) {
578
+				if ($route != $this->_current_route)
579 579
 					continue; //get out we only add metaboxes for set route.
580
-				if ( $add )
580
+				if ($add)
581 581
 					$this->_add_metabox($box);
582 582
 				else
583 583
 					$this->_remove_metabox($box);
@@ -595,10 +595,10 @@  discard block
 block discarded – undo
595 595
 	 */
596 596
 	public function remove_metaboxes() {
597 597
 
598
-		if ( empty( $this->_remove_metaboxes ) )
598
+		if (empty($this->_remove_metaboxes))
599 599
 			return; //get out there are no metaboxes to remove
600 600
 
601
-		$this->_handle_metabox_array( $this->_remove_metaboxes, FALSE );
601
+		$this->_handle_metabox_array($this->_remove_metaboxes, FALSE);
602 602
 	}
603 603
 
604 604
 
@@ -608,53 +608,53 @@  discard block
 block discarded – undo
608 608
 	 * @access private
609 609
 	 * @param array $args an array of args that have been set for this metabox by the child class
610 610
 	 */
611
-	private function _add_metabox( $args ) {
611
+	private function _add_metabox($args) {
612 612
 		$current_screen = get_current_screen();
613
-		$screen_id = is_object( $current_screen ) ? $current_screen->id : NULL;
614
-		$func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback';
613
+		$screen_id = is_object($current_screen) ? $current_screen->id : NULL;
614
+		$func = isset($args['func']) ? $args['func'] : 'some_invalid_callback';
615 615
 
616 616
 		//set defaults
617 617
 		$defaults = array(
618 618
 			'func' => $func,
619
-			'id' => $this->caller . '_' . $func . '_metabox',
619
+			'id' => $this->caller.'_'.$func.'_metabox',
620 620
 			'priority' => 'default',
621 621
 			'label' => $this->caller,
622 622
 			'context' => 'advanced',
623 623
 			'callback_args' => array(),
624
-			'page' => isset( $args['page'] ) ? $args['page'] : $screen_id
624
+			'page' => isset($args['page']) ? $args['page'] : $screen_id
625 625
 			);
626 626
 
627
-		$args = wp_parse_args( $args, $defaults );
627
+		$args = wp_parse_args($args, $defaults);
628 628
 		extract($args);
629 629
 
630 630
 
631 631
 		//make sure method exists
632
-		if ( !method_exists($this, $func) ) {
633
-			$msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso') . '<br />';
634
-			$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $func, $this->caller );
635
-			throw new EE_Error( implode('||', $msg ) );
632
+		if ( ! method_exists($this, $func)) {
633
+			$msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso').'<br />';
634
+			$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $func, $this->caller);
635
+			throw new EE_Error(implode('||', $msg));
636 636
 		}
637 637
 
638 638
 		//everything checks out so lets add the metabox
639
-		add_meta_box( $id, $label, array( $this, $func ), $page, $context, $priority, $callback_args);
639
+		add_meta_box($id, $label, array($this, $func), $page, $context, $priority, $callback_args);
640 640
 	}
641 641
 
642 642
 
643 643
 
644
-	private function _remove_metabox( $args ) {
644
+	private function _remove_metabox($args) {
645 645
 		$current_screen = get_current_screen();
646
-		$screen_id = is_object( $current_screen ) ? $current_screen->id : NULL;
647
-		$func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback';
646
+		$screen_id = is_object($current_screen) ? $current_screen->id : NULL;
647
+		$func = isset($args['func']) ? $args['func'] : 'some_invalid_callback';
648 648
 
649 649
 		//set defaults
650 650
 		$defaults = array(
651
-			'id' => isset( $args['id'] ) ? $args['id'] : $this->_current_route . '_' . $this->caller . '_' . $func . '_metabox',
651
+			'id' => isset($args['id']) ? $args['id'] : $this->_current_route.'_'.$this->caller.'_'.$func.'_metabox',
652 652
 			'context' => 'default',
653
-			'screen' => isset( $args['screen'] ) ? $args['screen'] : $screen_id
653
+			'screen' => isset($args['screen']) ? $args['screen'] : $screen_id
654 654
 		);
655 655
 
656
-		$args = wp_parse_args( $args, $defaults );
657
-		extract( $args );
656
+		$args = wp_parse_args($args, $defaults);
657
+		extract($args);
658 658
 
659 659
 		//everything checks out so lets remove the box!
660 660
 		remove_meta_box($id, $screen, $context);
Please login to merge, or discard this patch.
core/business/EE_Transaction_Processor.class.php 1 patch
Spacing   +106 added lines, -106 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
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 
4 4
 /**
5 5
  * Class EE_Transaction_Processor
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 * @param array $registration_query_params
51 51
 	 *@return EE_Transaction_Processor instance
52 52
 	 */
53
-	public static function instance( $registration_query_params = array() ) {
53
+	public static function instance($registration_query_params = array()) {
54 54
 		// check if class object is instantiated
55
-		if ( ! self::$_instance instanceof EE_Transaction_Processor ) {
56
-			self::$_instance = new self( $registration_query_params );
55
+		if ( ! self::$_instance instanceof EE_Transaction_Processor) {
56
+			self::$_instance = new self($registration_query_params);
57 57
 		}
58 58
 		return self::$_instance;
59 59
 	}
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 * @param array $registration_query_params
65 65
 	 * @return EE_Transaction_Processor
66 66
 	 */
67
-	private function __construct( $registration_query_params = array() ) {
67
+	private function __construct($registration_query_params = array()) {
68 68
 		// make sure some query params are set for retrieving registrations
69
-		$this->_set_registration_query_params( $registration_query_params );
69
+		$this->_set_registration_query_params($registration_query_params);
70 70
 	}
71 71
 
72 72
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 * @access private
76 76
 	 * @param array $registration_query_params
77 77
 	 */
78
-	private function _set_registration_query_params( $registration_query_params ) {
79
-		$this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' ));
78
+	private function _set_registration_query_params($registration_query_params) {
79
+		$this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC'));
80 80
 	}
81 81
 
82 82
 
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 	/**
94 94
 	 * @param string $old_txn_status
95 95
 	 */
96
-	public function set_old_txn_status( $old_txn_status ) {
96
+	public function set_old_txn_status($old_txn_status) {
97 97
 		// only set the first time
98
-		if ( $this->_old_txn_status === null ) {
98
+		if ($this->_old_txn_status === null) {
99 99
 			$this->_old_txn_status = $old_txn_status;
100 100
 		}
101 101
 	}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * @param string $new_txn_status
116 116
 	 */
117
-	public function set_new_txn_status( $new_txn_status ) {
117
+	public function set_new_txn_status($new_txn_status) {
118 118
 		$this->_new_txn_status = $new_txn_status;
119 119
 	}
120 120
 
@@ -145,17 +145,17 @@  discard block
 block discarded – undo
145 145
 	 * @param bool   $check_all
146 146
 	 * @return boolean | int
147 147
 	 */
148
-	private function _reg_steps_completed( EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE ) {
148
+	private function _reg_steps_completed(EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE) {
149 149
 		$reg_steps = $transaction->reg_steps();
150
-		if ( ! is_array( $reg_steps ) || empty( $reg_steps )) {
150
+		if ( ! is_array($reg_steps) || empty($reg_steps)) {
151 151
 			return false;
152 152
 		}
153 153
 		// loop thru reg steps array)
154
-		foreach ( $reg_steps as $slug => $reg_step_completed ) {
154
+		foreach ($reg_steps as $slug => $reg_step_completed) {
155 155
 			// if NOT checking ALL steps (only checking one step)
156
-			if ( ! $check_all ) {
156
+			if ( ! $check_all) {
157 157
 				// and this is the one
158
-				if ( $slug == $reg_step_slug ) {
158
+				if ($slug == $reg_step_slug) {
159 159
 					return $reg_step_completed;
160 160
 				} else {
161 161
 					// skip to next reg step in loop
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 				}
164 164
 			}
165 165
 			// if any reg step is NOT completed (ignoring any specific steps), then just leave
166
-			if ( $reg_step_completed !== true && $slug != $reg_step_slug ) {
166
+			if ($reg_step_completed !== true && $slug != $reg_step_slug) {
167 167
 				return false;
168
-			} else if ( $slug == $reg_step_slug ) {
168
+			} else if ($slug == $reg_step_slug) {
169 169
 				// if we reach this point, then we are testing either:
170 170
 				// all_reg_steps_completed_except() or
171 171
 				// all_reg_steps_completed_except_final_step(),
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 	 * @param EE_Transaction $transaction
191 191
 	 * @return boolean
192 192
 	 */
193
-	public function all_reg_steps_completed( EE_Transaction $transaction ) {
194
-		return $this->_reg_steps_completed( $transaction );
193
+	public function all_reg_steps_completed(EE_Transaction $transaction) {
194
+		return $this->_reg_steps_completed($transaction);
195 195
 	}
196 196
 
197 197
 
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 * @param string $exception
209 209
 	 * @return boolean
210 210
 	 */
211
-	public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) {
212
-		return $this->_reg_steps_completed( $transaction, $exception );
211
+	public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') {
212
+		return $this->_reg_steps_completed($transaction, $exception);
213 213
 	}
214 214
 
215 215
 
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	 * @param EE_Transaction $transaction
226 226
 	 * @return boolean
227 227
 	 */
228
-	public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) {
229
-		return $this->_reg_steps_completed( $transaction, 'finalize_registration' );
228
+	public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) {
229
+		return $this->_reg_steps_completed($transaction, 'finalize_registration');
230 230
 	}
231 231
 
232 232
 
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 	 * @param string $reg_step_slug
244 244
 	 * @return boolean | int
245 245
 	 */
246
-	public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
247
-		return $this->_reg_steps_completed( $transaction, $reg_step_slug, FALSE );
246
+	public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
247
+		return $this->_reg_steps_completed($transaction, $reg_step_slug, FALSE);
248 248
 	}
249 249
 
250 250
 
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	 * @param EE_Transaction $transaction
261 261
 	 * @return boolean | int
262 262
 	 */
263
-	public function final_reg_step_completed( EE_Transaction $transaction ) {
264
-		return $this->_reg_steps_completed( $transaction, 'finalize_registration', FALSE );
263
+	public function final_reg_step_completed(EE_Transaction $transaction) {
264
+		return $this->_reg_steps_completed($transaction, 'finalize_registration', FALSE);
265 265
 	}
266 266
 
267 267
 
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 	 * @param string          $reg_step_slug
276 276
 	 * @return boolean
277 277
 	 */
278
-	public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) {
278
+	public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) {
279 279
 		$current_time = time();
280
-		return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, $current_time );
280
+		return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, $current_time);
281 281
 	}
282 282
 
283 283
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 	 * @param string          $reg_step_slug
292 292
 	 * @return boolean
293 293
 	 */
294
-	public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
295
-		return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, TRUE );
294
+	public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
295
+		return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, TRUE);
296 296
 	}
297 297
 
298 298
 
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
 	 * @param string          $reg_step_slug
307 307
 	 * @return boolean
308 308
 	 */
309
-	public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) {
310
-		return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, FALSE );
309
+	public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) {
310
+		return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, FALSE);
311 311
 	}
312 312
 
313 313
 
@@ -323,36 +323,36 @@  discard block
 block discarded – undo
323 323
 	 * @param boolean | int $status
324 324
 	 * @return boolean
325 325
 	 */
326
-	private function _set_reg_step_completed_status( EE_Transaction $transaction, $reg_step_slug, $status ) {
326
+	private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status) {
327 327
 		// validate status
328
-		$status = is_bool( $status ) || is_numeric( $status ) ? $status : false;
328
+		$status = is_bool($status) || is_numeric($status) ? $status : false;
329 329
 		// get reg steps array
330 330
 		$txn_reg_steps = $transaction->reg_steps();
331 331
 		// if reg step does NOT exist
332
-		if ( ! isset( $txn_reg_steps[ $reg_step_slug ] )) {
332
+		if ( ! isset($txn_reg_steps[$reg_step_slug])) {
333 333
 			return false;
334 334
 		}
335 335
 		// if  we're trying to complete a step that is already completed
336
-		if ( $txn_reg_steps[ $reg_step_slug ] === true ) {
336
+		if ($txn_reg_steps[$reg_step_slug] === true) {
337 337
 			return true;
338 338
 		}
339 339
 		// if  we're trying to complete a step that hasn't even started
340
-		if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) {
340
+		if ($status === true && $txn_reg_steps[$reg_step_slug] === false) {
341 341
 			return false;
342 342
 		}
343 343
 		// if current status value matches the incoming value (no change)
344
-		if ( $txn_reg_steps[ $reg_step_slug ] === $status ) {
344
+		if ($txn_reg_steps[$reg_step_slug] === $status) {
345 345
 			// this will happen in cases where multiple AJAX requests occur during the same step
346 346
 			return true;
347 347
 		}
348 348
 		// if we're trying to set a start time
349
-		if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] )) {
349
+		if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) {
350 350
 			// skip the update below, but don't return FALSE so that errors won't be displayed
351 351
 			return true;
352 352
 		}
353 353
 		// update completed status
354
-		$txn_reg_steps[ $reg_step_slug ] = $status;
355
-		$transaction->set_reg_steps( $txn_reg_steps );
354
+		$txn_reg_steps[$reg_step_slug] = $status;
355
+		$transaction->set_reg_steps($txn_reg_steps);
356 356
 		$transaction->save();
357 357
 		// DEBUG LOG
358 358
 		//$this->log(
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
378 378
 	 * @param string $reg_step_slug
379 379
 	 * @return void
380 380
 	 */
381
-	public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) {
381
+	public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) {
382 382
 		// get reg steps array
383 383
 		$txn_reg_steps = $transaction->reg_steps();
384
-		unset( $txn_reg_steps[ $reg_step_slug ] );
385
-		$transaction->set_reg_steps( $txn_reg_steps );
384
+		unset($txn_reg_steps[$reg_step_slug]);
385
+		$transaction->set_reg_steps($txn_reg_steps);
386 386
 	}
387 387
 
388 388
 
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
 	 * @param EE_Transaction $transaction
397 397
 	 * 	@return 	boolean
398 398
 	 */
399
-	public function toggle_failed_transaction_status( EE_Transaction $transaction ) {
399
+	public function toggle_failed_transaction_status(EE_Transaction $transaction) {
400 400
 		// set incoming TXN_Status
401
-		$this->set_old_txn_status( $transaction->status_ID() );
401
+		$this->set_old_txn_status($transaction->status_ID());
402 402
 		// if TXN status is still set as "failed"...
403
-		if ( $transaction->status_ID() == EEM_Transaction::failed_status_code ) {
403
+		if ($transaction->status_ID() == EEM_Transaction::failed_status_code) {
404 404
 			// set incoming TXN_Status
405
-			$this->set_new_txn_status( EEM_Transaction::abandoned_status_code );
406
-			$transaction->set_status( EEM_Transaction::abandoned_status_code );
405
+			$this->set_new_txn_status(EEM_Transaction::abandoned_status_code);
406
+			$transaction->set_status(EEM_Transaction::abandoned_status_code);
407 407
 			return TRUE;
408 408
 		}
409 409
 		return FALSE;
@@ -419,20 +419,20 @@  discard block
 block discarded – undo
419 419
 	 * @param EE_Transaction $transaction
420 420
 	 * 	@return 	boolean
421 421
 	 */
422
-	public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) {
422
+	public function toggle_abandoned_transaction_status(EE_Transaction $transaction) {
423 423
 		// set incoming TXN_Status
424
-		$this->set_old_txn_status( $transaction->status_ID() );
424
+		$this->set_old_txn_status($transaction->status_ID());
425 425
 		// if TXN status has not been updated already due to a payment, and is still set as "failed" or "abandoned"...
426
-		if ( $transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code ) {
427
-			$this->set_new_txn_status( EEM_Transaction::incomplete_status_code );
426
+		if ($transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code) {
427
+			$this->set_new_txn_status(EEM_Transaction::incomplete_status_code);
428 428
 			// if a contact record for the primary registrant has been created
429
-			if ( $transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee ) {
430
-				$transaction->set_status( EEM_Transaction::incomplete_status_code );
431
-				$this->set_new_txn_status( EEM_Transaction::incomplete_status_code );
429
+			if ($transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee) {
430
+				$transaction->set_status(EEM_Transaction::incomplete_status_code);
431
+				$this->set_new_txn_status(EEM_Transaction::incomplete_status_code);
432 432
 			} else {
433 433
 				// no contact record? yer abandoned!
434
-				$transaction->set_status( EEM_Transaction::abandoned_status_code );
435
-				$this->set_new_txn_status( EEM_Transaction::abandoned_status_code );
434
+				$transaction->set_status(EEM_Transaction::abandoned_status_code);
435
+				$this->set_new_txn_status(EEM_Transaction::abandoned_status_code);
436 436
 			}
437 437
 			return TRUE;
438 438
 		}
@@ -450,16 +450,16 @@  discard block
 block discarded – undo
450 450
 	 * @param array 	$registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction
451 451
 	 * 	@return 	boolean
452 452
 	 */
453
-	public function manually_update_registration_statuses( EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array() ) {
454
-		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status );
453
+	public function manually_update_registration_statuses(EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array()) {
454
+		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor('manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status);
455 455
 		// send messages
456 456
 		/** @type EE_Registration_Processor $registration_processor */
457
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
457
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
458 458
 		$registration_processor->trigger_registration_update_notifications(
459 459
 			$transaction->primary_registration(),
460
-			array( 'manually_updated' 	=> true )
460
+			array('manually_updated' 	=> true)
461 461
 		);
462
-		do_action( 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates );
462
+		do_action('AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates);
463 463
 		return $status_updates;
464 464
 	}
465 465
 
@@ -473,9 +473,9 @@  discard block
 block discarded – undo
473 473
 	 * @param array 	$registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction
474 474
 	 * 	@return 	boolean
475 475
 	 */
476
-	public function toggle_registration_statuses_for_default_approved_events( EE_Transaction $transaction, $registration_query_params = array() ) {
477
-		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params );
478
-		do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates );
476
+	public function toggle_registration_statuses_for_default_approved_events(EE_Transaction $transaction, $registration_query_params = array()) {
477
+		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params);
478
+		do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates);
479 479
 		return $status_updates;
480 480
 	}
481 481
 
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
 	 * @param array 	$registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction
490 490
 	 * 	@return 	boolean
491 491
 	 */
492
-	public function toggle_registration_statuses_if_no_monies_owing( EE_Transaction $transaction, $registration_query_params = array() ) {
493
-		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params );
494
-		do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates );
492
+	public function toggle_registration_statuses_if_no_monies_owing(EE_Transaction $transaction, $registration_query_params = array()) {
493
+		$status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params);
494
+		do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates);
495 495
 		return $status_updates;
496 496
 	}
497 497
 
@@ -507,17 +507,17 @@  discard block
 block discarded – undo
507 507
 	 * @throws \EE_Error
508 508
 	 * @return array
509 509
 	 */
510
-	public function update_transaction_and_registrations_after_checkout_or_payment( EE_Transaction $transaction, $payment = NULL, $registration_query_params = array() ) {
510
+	public function update_transaction_and_registrations_after_checkout_or_payment(EE_Transaction $transaction, $payment = NULL, $registration_query_params = array()) {
511 511
 		// set incoming TXN_Status, and consider it new since old status should have been set
512
-		$this->set_new_txn_status( $transaction->status_ID() );
513
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()' );
512
+		$this->set_new_txn_status($transaction->status_ID());
513
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()');
514 514
 		// make sure some query params are set for retrieving registrations
515
-		$this->_set_registration_query_params( $registration_query_params );
515
+		$this->_set_registration_query_params($registration_query_params);
516 516
 		// get final reg step status
517
-		$finalized = $this->final_reg_step_completed( $transaction );
517
+		$finalized = $this->final_reg_step_completed($transaction);
518 518
 		// if the 'finalize_registration' step has been initiated (has a timestamp) but has not yet been fully completed (TRUE)
519
-		if ( is_numeric( $finalized ) && $finalized !== true ) {
520
-			$this->set_reg_step_completed( $transaction, 'finalize_registration' );
519
+		if (is_numeric($finalized) && $finalized !== true) {
520
+			$this->set_reg_step_completed($transaction, 'finalize_registration');
521 521
 			$finalized = true;
522 522
 		}
523 523
 		$transaction->save();
@@ -540,13 +540,13 @@  discard block
 block discarded – undo
540 540
 
541 541
 		// send messages
542 542
 		/** @type EE_Registration_Processor $registration_processor */
543
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
543
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
544 544
 		$registration_processor->trigger_registration_update_notifications(
545 545
 			$transaction->primary_registration(),
546 546
 			$update_params
547 547
 		);
548 548
 
549
-		do_action( 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params );
549
+		do_action('AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params);
550 550
 		return $update_params;
551 551
 	}
552 552
 
@@ -564,23 +564,23 @@  discard block
 block discarded – undo
564 564
 	 * @throws \EE_Error
565 565
 	 * @return boolean
566 566
 	 */
567
-	private function _call_method_on_registrations_via_Registration_Processor( $method_name,  EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL ) {
567
+	private function _call_method_on_registrations_via_Registration_Processor($method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL) {
568 568
 		$response = FALSE;
569 569
 		/** @type EE_Registration_Processor $registration_processor */
570
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
570
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
571 571
 		// check that method exists
572
-		if ( ! method_exists( $registration_processor, $method_name )) {
573
-			throw new EE_Error( __( 'Method does not exist.', 'event_espresso' ));
572
+		if ( ! method_exists($registration_processor, $method_name)) {
573
+			throw new EE_Error(__('Method does not exist.', 'event_espresso'));
574 574
 		}
575 575
 		// make sure some query params are set for retrieving registrations
576
-		$this->_set_registration_query_params( $registration_query_params );
576
+		$this->_set_registration_query_params($registration_query_params);
577 577
 		// loop through cached registrations
578
-		foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) {
579
-			if ( $registration instanceof EE_Registration ) {
580
-				if ( $additional_param ) {
581
-					$response = $registration_processor->$method_name( $registration, $additional_param ) ? TRUE : $response;
578
+		foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
579
+			if ($registration instanceof EE_Registration) {
580
+				if ($additional_param) {
581
+					$response = $registration_processor->$method_name($registration, $additional_param) ? TRUE : $response;
582 582
 				} else {
583
-					$response = $registration_processor->$method_name( $registration ) ? TRUE : $response;
583
+					$response = $registration_processor->$method_name($registration) ? TRUE : $response;
584 584
 				}
585 585
 			}
586 586
 		}
@@ -605,46 +605,46 @@  discard block
 block discarded – undo
605 605
 	public function set_transaction_payment_method_based_on_registration_statuses(
606 606
 		EE_Registration $edited_registration
607 607
 	) {
608
-		if ( $edited_registration instanceof EE_Registration ) {
608
+		if ($edited_registration instanceof EE_Registration) {
609 609
 			$transaction = $edited_registration->transaction();
610
-			if ( $transaction instanceof EE_Transaction ) {
610
+			if ($transaction instanceof EE_Transaction) {
611 611
 				$all_not_approved = true;
612
-				foreach ( $transaction->registrations() as $registration ) {
613
-					if ( $registration instanceof EE_Registration ) {
612
+				foreach ($transaction->registrations() as $registration) {
613
+					if ($registration instanceof EE_Registration) {
614 614
 						// if any REG != "Not Approved" then toggle to false
615 615
 						$all_not_approved = $registration->is_not_approved() ? $all_not_approved : false;
616 616
 					}
617 617
 				}
618 618
 				// if ALL Registrations are "Not Approved"
619
-				if ( $all_not_approved ) {
620
-					$transaction->set_payment_method_ID( null );
619
+				if ($all_not_approved) {
620
+					$transaction->set_payment_method_ID(null);
621 621
 					$transaction->save();
622 622
 				} else {
623
-					$available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart );
624
-					if ( ! empty( $available_payment_methods ) ) {
623
+					$available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart);
624
+					if ( ! empty($available_payment_methods)) {
625 625
 						$PMD_ID = 0;
626
-						foreach ( $available_payment_methods as $available_payment_method ) {
627
-							if ( $available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default() ) {
626
+						foreach ($available_payment_methods as $available_payment_method) {
627
+							if ($available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default()) {
628 628
 								$PMD_ID = $available_payment_method->ID();
629 629
 								break;
630 630
 							}
631 631
 						}
632
-						if ( ! $PMD_ID ) {
633
-							$first_payment_method = reset( $available_payment_methods );
634
-							if ( $first_payment_method instanceof EE_Payment_Method ) {
632
+						if ( ! $PMD_ID) {
633
+							$first_payment_method = reset($available_payment_methods);
634
+							if ($first_payment_method instanceof EE_Payment_Method) {
635 635
 								$PMD_ID = $first_payment_method->ID();
636 636
 							} else {
637 637
 								EE_Error::add_error(
638
-									__( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ),
638
+									__('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'),
639 639
 									__FILE__, __LINE__, __FUNCTION__
640 640
 								);
641 641
 							}
642 642
 						}
643
-						$transaction->set_payment_method_ID( $PMD_ID );
643
+						$transaction->set_payment_method_ID($PMD_ID);
644 644
 						$transaction->save();
645 645
 					} else {
646 646
 						EE_Error::add_error(
647
-							__( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ),
647
+							__('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'),
648 648
 							__FILE__, __LINE__, __FUNCTION__
649 649
 						);
650 650
 					}
Please login to merge, or discard this patch.
modules/add_new_state/EED_Add_New_State.module.php 1 patch
Spacing   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	 * @return EED_Add_New_State
17 17
 	 */
18 18
 	public static function instance() {
19
-		return parent::get_instance( __CLASS__ );
19
+		return parent::get_instance(__CLASS__);
20 20
 	}
21 21
 
22 22
 
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 	 *  	@return 		void
28 28
 	 */
29 29
 	public static function set_hooks() {
30
-		add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 );
31
-		add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'translate_js_strings' ), 0 );
32
-		add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'wp_enqueue_scripts' ), 10 );
33
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
34
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
35
-		add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 );
36
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 );
37
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 );
38
-		add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 );
39
-		add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 );
30
+		add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2);
31
+		add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0);
32
+		add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10);
33
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
34
+		add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
35
+		add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1);
36
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5);
37
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5);
38
+		add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1);
39
+		add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1);
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
 	 *  	@return 		void
47 47
 	 */
48 48
 	public static function set_hooks_admin() {
49
-		add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 );
50
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
51
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
52
-		add_action( 'wp_ajax_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' ));
53
-		add_action( 'wp_ajax_nopriv_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' ));
54
-		add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 );
55
-		add_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 );
56
-		add_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 );
57
-		add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 );
58
-		add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 );
59
-		add_filter( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 );
60
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 );
61
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 );
49
+		add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2);
50
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
51
+		add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
52
+		add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state'));
53
+		add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state'));
54
+		add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1);
55
+		add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array('EED_Add_New_State', 'update_country_settings'), 10, 3);
56
+		add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array('EED_Add_New_State', 'update_country_settings'), 10, 3);
57
+		add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1);
58
+		add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1);
59
+		add_filter('FHEE__Single_Page_Checkout___check_form_submission__request_params', array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1);
60
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5);
61
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5);
62 62
 	}
63 63
 
64 64
 
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 *  	@return 		void
71 71
 	 */
72 72
 	public static function set_definitions() {
73
-		define( 'ANS_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
74
-		define( 'ANS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
73
+		define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
74
+		define('ANS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
75 75
 	}
76 76
 
77 77
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param \WP $WP
84 84
 	 * @return        void
85 85
 	 */
86
-	public function run( $WP ) {
86
+	public function run($WP) {
87 87
 	}
88 88
 
89 89
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * 	@return 		void
112 112
 	 */
113 113
 	public static function wp_enqueue_scripts() {
114
-		if ( apply_filters( 'EED_Single_Page_Checkout__SPCO_active', false ) ) {
115
-			wp_register_script( 'add_new_state', ANS_ASSETS_URL . 'add_new_state.js', array( 'espresso_core', 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, true );
116
-			wp_enqueue_script( 'add_new_state' );
114
+		if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) {
115
+			wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true);
116
+			wp_enqueue_script('add_new_state');
117 117
 		}
118 118
 	}
119 119
 
@@ -127,30 +127,30 @@  discard block
 block discarded – undo
127 127
 	 * @return 	string
128 128
 	 */
129 129
 //	public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){
130
-	public static function display_add_new_state_micro_form( EE_Form_Section_Proper $question_group_reg_form ){
130
+	public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) {
131 131
 		// only add the 'new_state_micro_form' when displaying reg forms,
132 132
 		// not during processing since we process the 'new_state_micro_form' in it's own AJAX request
133
-		$action = EE_Registry::instance()->REQ->get( 'action', '' );
134
-		if ( $action === 'process_reg_step' || $action === 'update_reg_step' ) {
133
+		$action = EE_Registry::instance()->REQ->get('action', '');
134
+		if ($action === 'process_reg_step' || $action === 'update_reg_step') {
135 135
 			return $question_group_reg_form;
136 136
 		}
137 137
 		// is the "state" question in this form section?
138
-		$input = $question_group_reg_form->get_subsection( 'state' );
138
+		$input = $question_group_reg_form->get_subsection('state');
139 139
 		// we're only doing this for state select inputs
140
-		if ( $input instanceof EE_State_Select_Input ) {
140
+		if ($input instanceof EE_State_Select_Input) {
141 141
 			// load helpers
142
-			EE_Registry::instance()->load_helper( 'HTML' );
142
+			EE_Registry::instance()->load_helper('HTML');
143 143
 			// grab any set values from the request
144
-			$country_name = str_replace( 'state', 'new_state_country', $input->html_name() );
145
-			$state_name = str_replace( 'state', 'new_state_name', $input->html_name() );
146
-			$abbrv_name = str_replace( 'state', 'new_state_abbrv', $input->html_name() );
147
-			$new_state_submit_id = str_replace( 'state', 'new_state', $input->html_id() );
144
+			$country_name = str_replace('state', 'new_state_country', $input->html_name());
145
+			$state_name = str_replace('state', 'new_state_name', $input->html_name());
146
+			$abbrv_name = str_replace('state', 'new_state_abbrv', $input->html_name());
147
+			$new_state_submit_id = str_replace('state', 'new_state', $input->html_id());
148 148
 			$country_options = array();
149 149
 			$countries = EEM_Country::instance()->get_all_countries();
150
-			if ( ! empty( $countries )) {
151
-				foreach( $countries as $country ){
152
-					if ( $country instanceof EE_Country ) {
153
-						$country_options[ $country->ID() ] = $country->name();
150
+			if ( ! empty($countries)) {
151
+				foreach ($countries as $country) {
152
+					if ($country instanceof EE_Country) {
153
+						$country_options[$country->ID()] = $country->name();
154 154
 					}
155 155
 				}
156 156
 			}
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 						// add hidden input to indicate that a new state is being added
164 164
 						'add_new_state' 	=> new EE_Hidden_Input(
165 165
 							array(
166
-								'html_name' 	=> str_replace( 'state', 'add_new_state', $input->html_name() ),
167
-								'html_id' 			=> str_replace( 'state', 'add_new_state', $input->html_id() ),
166
+								'html_name' 	=> str_replace('state', 'add_new_state', $input->html_name()),
167
+								'html_id' 			=> str_replace('state', 'add_new_state', $input->html_id()),
168 168
 								'default'			=> 0
169 169
 							)
170 170
 						),
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 									'',
177 177
 									__('click here to add a new state/province', 'event_espresso'),
178 178
 									'',
179
-									'display-' . $input->html_id(),
179
+									'display-'.$input->html_id(),
180 180
 									'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js',
181 181
 									'',
182
-									'rel="' . $input->html_id() . '"'
182
+									'rel="'.$input->html_id().'"'
183 183
 								)
184 184
 							)
185 185
 						),
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 						'add_new_state_micro_form' =>new EE_Form_Section_HTML(
188 188
 							apply_filters(
189 189
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form',
190
-								EEH_HTML::div( '', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', 'display: none;' ) .
191
-								EEH_HTML::h6( __('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')) .
192
-								EEH_HTML::ul() .
193
-								EEH_HTML::li( __('first select the Country that your State/Province belongs to', 'event_espresso') ) .
194
-								EEH_HTML::li( __('enter the name of your State/Province', 'event_espresso') ) .
195
-								EEH_HTML::li( __('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso') ) .
196
-								EEH_HTML::li( __('click the ADD button', 'event_espresso') ) .
190
+								EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', 'display: none;').
191
+								EEH_HTML::h6(__('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')).
192
+								EEH_HTML::ul().
193
+								EEH_HTML::li(__('first select the Country that your State/Province belongs to', 'event_espresso')).
194
+								EEH_HTML::li(__('enter the name of your State/Province', 'event_espresso')).
195
+								EEH_HTML::li(__('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso')).
196
+								EEH_HTML::li(__('click the ADD button', 'event_espresso')).
197 197
 								EEH_HTML::ulx()
198 198
 							)
199 199
 						),
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 							$country_options,
203 203
 							array(
204 204
 								'html_name' 			=> $country_name,
205
-								'html_id' 					=> str_replace( 'state', 'new_state_country', $input->html_id() ),
206
-								'html_class' 			=> $input->html_class() . ' new-state-country',
205
+								'html_id' 					=> str_replace('state', 'new_state_country', $input->html_id()),
206
+								'html_class' 			=> $input->html_class().' new-state-country',
207 207
 								'html_label_text'		=> __('New State/Province Country', 'event_espresso'),
208
-								'default'					=> EE_Registry::instance()->REQ->get( $country_name, '' ),
208
+								'default'					=> EE_Registry::instance()->REQ->get($country_name, ''),
209 209
 								'required' 				=> false
210 210
 							)
211 211
 						),
@@ -213,23 +213,23 @@  discard block
 block discarded – undo
213 213
 						'new_state_name' => new EE_Text_Input(
214 214
 							array(
215 215
 								'html_name' 			=> $state_name,
216
-								'html_id' 					=> str_replace( 'state', 'new_state_name', $input->html_id() ),
217
-								'html_class' 			=> $input->html_class() . ' new-state-state',
216
+								'html_id' 					=> str_replace('state', 'new_state_name', $input->html_id()),
217
+								'html_class' 			=> $input->html_class().' new-state-state',
218 218
 								'html_label_text'		=> __('New State/Province Name', 'event_espresso'),
219
-								'default'					=> EE_Registry::instance()->REQ->get( $state_name, '' ),
219
+								'default'					=> EE_Registry::instance()->REQ->get($state_name, ''),
220 220
 								'required' 				=> false
221 221
 							)
222 222
 						),
223
-						'spacer' => new EE_Form_Section_HTML( EEH_HTML::br() ),
223
+						'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()),
224 224
 						// NEW STATE NAME
225 225
 						'new_state_abbrv' => new EE_Text_Input(
226 226
 							array(
227 227
 								'html_name' 					=> $abbrv_name,
228
-								'html_id' 							=> str_replace( 'state', 'new_state_abbrv', $input->html_id() ),
229
-								'html_class' 					=> $input->html_class() . ' new-state-abbrv',
228
+								'html_id' 							=> str_replace('state', 'new_state_abbrv', $input->html_id()),
229
+								'html_class' 					=> $input->html_class().' new-state-abbrv',
230 230
 								'html_label_text'				=> __('New State/Province Abbreviation', 'event_espresso'),
231 231
 								'html_other_attributes'	=> 'size="24"',
232
-								'default'							=> EE_Registry::instance()->REQ->get( $abbrv_name, '' ),
232
+								'default'							=> EE_Registry::instance()->REQ->get($abbrv_name, ''),
233 233
 								'required' 						=> false
234 234
 							)
235 235
 						),
@@ -237,26 +237,26 @@  discard block
 block discarded – undo
237 237
 						'add_new_state_submit_button' => new EE_Form_Section_HTML(
238 238
 							apply_filters(
239 239
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button',
240
-								EEH_HTML::nbsp(3) .
241
-								EEH_HTML::link( '', __('ADD', 'event_espresso'), '', 'submit-' . $new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="' . $new_state_submit_id . '"' )
240
+								EEH_HTML::nbsp(3).
241
+								EEH_HTML::link('', __('ADD', 'event_espresso'), '', 'submit-'.$new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="'.$new_state_submit_id.'"')
242 242
 							)
243 243
 						),
244 244
 						// extra info
245 245
 						'add_new_state_extra' => new EE_Form_Section_HTML(
246 246
 							apply_filters(
247 247
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra',
248
-								EEH_HTML::br(2) .
249
-								EEH_HTML::div( '', '', 'small-text' ) .
250
-								EEH_HTML::strong( __('Don\'t know your State/Province Abbreviation?', 'event_espresso') ) .
251
-								EEH_HTML::br() .
248
+								EEH_HTML::br(2).
249
+								EEH_HTML::div('', '', 'small-text').
250
+								EEH_HTML::strong(__('Don\'t know your State/Province Abbreviation?', 'event_espresso')).
251
+								EEH_HTML::br().
252 252
 								sprintf(
253 253
 									__('You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', 'event_espresso'),
254
-									EEH_HTML::link( 'http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk' )
255
-								) .
256
-								EEH_HTML::divx() .
257
-								EEH_HTML::br() .
258
-								EEH_HTML::link( '', __('cancel new state/province', 'event_espresso'), '', 'hide-' . $input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="' . $input->html_id() . '"' ) .
259
-								EEH_HTML::divx() .
254
+									EEH_HTML::link('http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk')
255
+								).
256
+								EEH_HTML::divx().
257
+								EEH_HTML::br().
258
+								EEH_HTML::link('', __('cancel new state/province', 'event_espresso'), '', 'hide-'.$input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="'.$input->html_id().'"').
259
+								EEH_HTML::divx().
260 260
 								EEH_HTML::br()
261 261
 							)
262 262
 						)
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 					)
265 265
 				)
266 266
 			);
267
-			$question_group_reg_form->add_subsections( array( 'new_state_micro_form' => $new_state_micro_form ), 'state', false );
267
+			$question_group_reg_form->add_subsections(array('new_state_micro_form' => $new_state_micro_form), 'state', false);
268 268
 		}
269 269
 		return $question_group_reg_form;
270 270
 	}
@@ -281,41 +281,41 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public static function add_new_state() {
283 283
 		$REQ = EE_Registry::instance()->load_core('Request_Handler');
284
-		if ( $REQ->is_set( 'add_new_state' ) && $REQ->get( 'add_new_state' ) == 1 ) {
284
+		if ($REQ->is_set('add_new_state') && $REQ->get('add_new_state') == 1) {
285 285
 			EE_Registry::instance()->load_model('State');
286 286
 			// grab country ISO code, new state name, and new state abbreviation
287
-			$state_country = $REQ->is_set( 'new_state_country' ) ? sanitize_text_field( $REQ->get( 'new_state_country' )) : FALSE;
288
-			$state_name = $REQ->is_set( 'new_state_name' ) ? sanitize_text_field( $REQ->get( 'new_state_name' )) : FALSE;
289
-			$state_abbr = $REQ->is_set( 'new_state_abbrv' ) ? sanitize_text_field( $REQ->get( 'new_state_abbrv' )) : FALSE;
287
+			$state_country = $REQ->is_set('new_state_country') ? sanitize_text_field($REQ->get('new_state_country')) : FALSE;
288
+			$state_name = $REQ->is_set('new_state_name') ? sanitize_text_field($REQ->get('new_state_name')) : FALSE;
289
+			$state_abbr = $REQ->is_set('new_state_abbrv') ? sanitize_text_field($REQ->get('new_state_abbrv')) : FALSE;
290 290
 
291 291
 //echo '<h4>$state_country : ' . $state_country . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
292 292
 //echo '<h4>$state_name : ' . $state_name . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
293 293
 //echo '<h4>$state_abbr : ' . $state_abbr . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
294 294
 
295
-			if ( $state_country && $state_name && $state_abbr ) {
296
-				$new_state = EED_Add_New_State::save_new_state_to_db( array(
297
-					'CNT_ISO'=> strtoupper( $state_country ),
298
-					'STA_abbrev' => strtoupper( $state_abbr ),
299
-					'STA_name' => ucwords( $state_name ),
295
+			if ($state_country && $state_name && $state_abbr) {
296
+				$new_state = EED_Add_New_State::save_new_state_to_db(array(
297
+					'CNT_ISO'=> strtoupper($state_country),
298
+					'STA_abbrev' => strtoupper($state_abbr),
299
+					'STA_name' => ucwords($state_name),
300 300
 					'STA_active' => FALSE
301 301
 				));
302 302
 
303
-				if ( $new_state instanceof EE_State ) {
303
+				if ($new_state instanceof EE_State) {
304 304
 					// clean house
305
-					EE_Registry::instance()->REQ->un_set( 'add_new_state' );
306
-					EE_Registry::instance()->REQ->un_set( 'new_state_country' );
307
-					EE_Registry::instance()->REQ->un_set( 'new_state_name' );
308
-					EE_Registry::instance()->REQ->un_set( 'new_state_abbrv' );
305
+					EE_Registry::instance()->REQ->un_set('add_new_state');
306
+					EE_Registry::instance()->REQ->un_set('new_state_country');
307
+					EE_Registry::instance()->REQ->un_set('new_state_name');
308
+					EE_Registry::instance()->REQ->un_set('new_state_abbrv');
309 309
 
310 310
 					// get any existing new states
311 311
 					$new_states = EE_Registry::instance()->SSN->get_session_data(
312 312
 						'new_states'
313 313
 					);
314
-					$new_states[ $new_state->ID() ] = $new_state;
315
-					EE_Registry::instance()->SSN->set_session_data( array( 'new_states' => $new_states ));
314
+					$new_states[$new_state->ID()] = $new_state;
315
+					EE_Registry::instance()->SSN->set_session_data(array('new_states' => $new_states));
316 316
 
317
-					if ( EE_Registry::instance()->REQ->ajax ) {
318
-						echo json_encode( array(
317
+					if (EE_Registry::instance()->REQ->ajax) {
318
+						echo json_encode(array(
319 319
 							'success' => TRUE,
320 320
 							'id' => $new_state->ID(),
321 321
 							'name' => $new_state->name(),
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 				}
331 331
 
332 332
 			} else {
333
-				$error = __( 'A new State/Province could not be added because invalid or missing data was received.', 'event_espresso' );
334
-				if ( EE_Registry::instance()->REQ->ajax ) {
335
-					echo json_encode( array( 'error' => $error ));
333
+				$error = __('A new State/Province could not be added because invalid or missing data was received.', 'event_espresso');
334
+				if (EE_Registry::instance()->REQ->ajax) {
335
+					echo json_encode(array('error' => $error));
336 336
 					exit();
337 337
 				} else {
338
-					EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
338
+					EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
339 339
 				}
340 340
 			}
341 341
 		}
@@ -353,11 +353,11 @@  discard block
 block discarded – undo
353 353
 	 * @param array $request_params
354 354
 	 * @return array
355 355
 	 */
356
-	public static function filter_checkout_request_params ( $request_params ) {
357
-		foreach ( $request_params as $form_section ) {
358
-			if ( is_array( $form_section )) {
359
-				EED_Add_New_State::unset_new_state_request_params( $form_section );
360
-				EED_Add_New_State::filter_checkout_request_params( $form_section );
356
+	public static function filter_checkout_request_params($request_params) {
357
+		foreach ($request_params as $form_section) {
358
+			if (is_array($form_section)) {
359
+				EED_Add_New_State::unset_new_state_request_params($form_section);
360
+				EED_Add_New_State::filter_checkout_request_params($form_section);
361 361
 			}
362 362
 		}
363 363
 		return $request_params;
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
 	 * @param array $request_params
373 373
 	 * @return        boolean
374 374
 	 */
375
-	public static function unset_new_state_request_params ( $request_params ) {
376
-		unset( $request_params[ 'new_state_micro_form' ] );
377
-		unset( $request_params[ 'add_new_state' ] );
378
-		unset( $request_params[ 'new_state_country' ] );
379
-		unset( $request_params[ 'new_state_name' ] );
380
-		unset( $request_params[ 'new_state_abbrv' ] );
375
+	public static function unset_new_state_request_params($request_params) {
376
+		unset($request_params['new_state_micro_form']);
377
+		unset($request_params['add_new_state']);
378
+		unset($request_params['new_state_country']);
379
+		unset($request_params['new_state_name']);
380
+		unset($request_params['new_state_abbrv']);
381 381
 		return $request_params;
382 382
 	}
383 383
 
@@ -390,25 +390,25 @@  discard block
 block discarded – undo
390 390
 	 * @param array $props_n_values
391 391
 	 * @return        boolean
392 392
 	 */
393
-	public static function save_new_state_to_db ( $props_n_values = array() ) {
393
+	public static function save_new_state_to_db($props_n_values = array()) {
394 394
 //		EEH_Debug_Tools::printr( $props_n_values, '$props_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
395
-		$existing_state = EEM_State::instance()->get_all( array( $props_n_values, 'limit' => 1 ));
396
-		if ( ! empty( $existing_state )) {
397
-			return array_pop( $existing_state );
395
+		$existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1));
396
+		if ( ! empty($existing_state)) {
397
+			return array_pop($existing_state);
398 398
 		}
399
-		$new_state = EE_State::new_instance( $props_n_values );
400
-		if ( $new_state instanceof EE_State ) {
399
+		$new_state = EE_State::new_instance($props_n_values);
400
+		if ($new_state instanceof EE_State) {
401 401
 			// if not non-ajax admin
402
-			$new_state_key = $new_state->country_iso() . '-' . $new_state->abbrev();
402
+			$new_state_key = $new_state->country_iso().'-'.$new_state->abbrev();
403 403
 			$new_state_notice = sprintf(
404
-					__( 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso' ),
405
-					'<b>' . $new_state->name() . '</b>',
406
-					'<b>' . $new_state->abbrev() . '</b>',
407
-					'<b>' . $new_state->country()->name() . '</b>',
408
-					'<a href="' . add_query_arg( array( 'page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso() ), admin_url( 'admin.php' )) . '">' . __( 'Event Espresso - General Settings > Countries Tab', 'event_espresso' ) . '</a>',
404
+					__('A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso'),
405
+					'<b>'.$new_state->name().'</b>',
406
+					'<b>'.$new_state->abbrev().'</b>',
407
+					'<b>'.$new_state->country()->name().'</b>',
408
+					'<a href="'.add_query_arg(array('page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso()), admin_url('admin.php')).'">'.__('Event Espresso - General Settings > Countries Tab', 'event_espresso').'</a>',
409 409
 					'<br />'
410 410
 			);
411
-			EE_Error::add_persistent_admin_notice( $new_state_key, $new_state_notice );
411
+			EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice);
412 412
 			$new_state->save();
413 413
 			EEM_State::instance()->reset_cached_states();
414 414
 			return $new_state;
@@ -427,22 +427,22 @@  discard block
 block discarded – undo
427 427
 	 * @param array  $cols_n_values
428 428
 	 * @return        boolean
429 429
 	 */
430
-	public static function update_country_settings( $CNT_ISO = '', $STA_ID = '', $cols_n_values = array() ) {
431
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : FALSE;
432
-		if ( ! $CNT_ISO ) {
433
-			EE_Error::add_error( __( 'An invalid or missing Country ISO Code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
430
+	public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) {
431
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : FALSE;
432
+		if ( ! $CNT_ISO) {
433
+			EE_Error::add_error(__('An invalid or missing Country ISO Code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
434 434
 		}
435
-		$STA_abbrev = is_array( $cols_n_values ) && isset( $cols_n_values['STA_abbrev'] ) ? $cols_n_values['STA_abbrev'] : FALSE;
436
-		if (  ! $STA_abbrev && ! empty( $STA_ID )) {
437
-			$state = EEM_State::instance()->get_one_by_ID( $STA_ID );
438
-			if ( $state instanceof EE_State ) {
435
+		$STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] : FALSE;
436
+		if ( ! $STA_abbrev && ! empty($STA_ID)) {
437
+			$state = EEM_State::instance()->get_one_by_ID($STA_ID);
438
+			if ($state instanceof EE_State) {
439 439
 				$STA_abbrev = $state->abbrev();
440 440
 			}
441 441
 		}
442
-		if ( ! $STA_abbrev ) {
443
-			EE_Error::add_error( __( 'An invalid or missing State Abbreviation was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
442
+		if ( ! $STA_abbrev) {
443
+			EE_Error::add_error(__('An invalid or missing State Abbreviation was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
444 444
 		}
445
-		EE_Error::dismiss_persistent_admin_notice( $CNT_ISO . '-' . $STA_abbrev, TRUE, TRUE );
445
+		EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, TRUE, TRUE);
446 446
 	}
447 447
 
448 448
 
@@ -458,19 +458,19 @@  discard block
 block discarded – undo
458 458
 	 * @param $answer
459 459
 	 * @return bool
460 460
 	 */
461
-	public static function inject_new_reg_state_into_options( $state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) {
462
-		if ( $answer instanceof EE_Answer  && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state ) {
461
+	public static function inject_new_reg_state_into_options($state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) {
462
+		if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state) {
463 463
 			$STA_ID = $answer->value();
464
-			if ( ! empty( $STA_ID ) ) {
465
-				$state = EEM_State::instance()->get_one_by_ID( $STA_ID );
466
-				if ( $state instanceof EE_State ) {
464
+			if ( ! empty($STA_ID)) {
465
+				$state = EEM_State::instance()->get_one_by_ID($STA_ID);
466
+				if ($state instanceof EE_State) {
467 467
 					$country = $state->country();
468
-					if ( $country instanceof EE_Country ) {
469
-						if ( ! isset( $state_options[ $country->name() ] )) {
470
-							$state_options[ $country->name() ] = array();
468
+					if ($country instanceof EE_Country) {
469
+						if ( ! isset($state_options[$country->name()])) {
470
+							$state_options[$country->name()] = array();
471 471
 						}
472
-						if ( ! isset( $state_options[ $country->name() ][ $STA_ID ] )) {
473
-							$state_options[ $country->name() ][ $STA_ID ] = $state->name();
472
+						if ( ! isset($state_options[$country->name()][$STA_ID])) {
473
+							$state_options[$country->name()][$STA_ID] = $state->name();
474 474
 						}
475 475
 					}
476 476
 				}
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
 	 * @param $answer
493 493
 	 * @return bool
494 494
 	 */
495
-	public static function inject_new_reg_country_into_options( $country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) {
496
-		if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country ) {
495
+	public static function inject_new_reg_country_into_options($country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) {
496
+		if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country) {
497 497
 			$CNT_ISO = $answer->value();
498
-			if ( ! empty( $CNT_ISO ) ) {
499
-				$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
500
-				if ( $country instanceof EE_Country ) {
501
-					if ( ! isset( $country_options[ $CNT_ISO ] ) ) {
502
-						$country_options[ $CNT_ISO ] = $country->name();
498
+			if ( ! empty($CNT_ISO)) {
499
+				$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
500
+				if ($country instanceof EE_Country) {
501
+					if ( ! isset($country_options[$CNT_ISO])) {
502
+						$country_options[$CNT_ISO] = $country->name();
503 503
 					}
504 504
 				}
505 505
 			}
@@ -516,17 +516,17 @@  discard block
 block discarded – undo
516 516
 	 * @param EE_State[]  $state_options
517 517
 	 * @return        boolean
518 518
 	 */
519
-	public static function state_options( $state_options = array() ) {
519
+	public static function state_options($state_options = array()) {
520 520
 		$new_states = EE_Registry::instance()->SSN->get_session_data(
521 521
 			'new_states'
522 522
 		);
523
-		if ( is_array( $new_states ) && ! empty( $new_states )) {
524
-			foreach ( $new_states as $new_state ) {
523
+		if (is_array($new_states) && ! empty($new_states)) {
524
+			foreach ($new_states as $new_state) {
525 525
 				if (
526 526
 					$new_state instanceof EE_State
527 527
 					&& $new_state->country() instanceof EE_Country
528 528
 				) {
529
-					$state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name();
529
+					$state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name();
530 530
 				}
531 531
 			}
532 532
 		}
@@ -542,17 +542,17 @@  discard block
 block discarded – undo
542 542
 	 * @param EE_Country[]  $country_options
543 543
 	 * @return        boolean
544 544
 	 */
545
-	public static function country_options( $country_options = array() ) {
545
+	public static function country_options($country_options = array()) {
546 546
 		$new_states = EE_Registry::instance()->SSN->get_session_data(
547 547
 			'new_states'
548 548
 		);
549
-		if ( is_array( $new_states ) && ! empty( $new_states )) {
550
-			foreach ( $new_states as $new_state ) {
549
+		if (is_array($new_states) && ! empty($new_states)) {
550
+			foreach ($new_states as $new_state) {
551 551
 				if (
552 552
 					$new_state instanceof EE_State
553 553
 					&& $new_state->country() instanceof EE_Country
554 554
 				) {
555
-					$country_options[ $new_state->country()->ID() ] = $new_state->country()->name();
555
+					$country_options[$new_state->country()->ID()] = $new_state->country()->name();
556 556
 				}
557 557
 			}
558 558
 		}
Please login to merge, or discard this patch.