Completed
Branch BUG-9140-has-billing-form-igno... (f963e1)
by
unknown
853:47 queued 830:05
created
core/libraries/batch/Helpers/JobParameters.php 3 patches
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 	 * @param array $request_data
97 97
 	 * @param array $extra_data
98 98
 	 */
99
-	function __construct( $job_id, $classname, $request_data, $extra_data = array() ) {
100
-		$this->set_job_id( $job_id );
101
-		$this->set_classname( $classname );
102
-		$this->set_request_data( $request_data );
103
-		$this->set_extra_data( $extra_data );
104
-		$this->set_status( JobParameters::status_continue );
99
+	function __construct($job_id, $classname, $request_data, $extra_data = array()) {
100
+		$this->set_job_id($job_id);
101
+		$this->set_classname($classname);
102
+		$this->set_request_data($request_data);
103
+		$this->set_extra_data($extra_data);
104
+		$this->set_status(JobParameters::status_continue);
105 105
 	}
106 106
 
107 107
 
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	 * @param boolean $first
127 127
 	 * @return boolean success
128 128
 	 */
129
-	function save( $first = false ) {
130
-		$object_vars = wp_json_encode( get_object_vars( $this ) );
131
-		if( $first ) {
132
-			return add_option( $this->option_name(), $object_vars, null, 'no' );
133
-		} else{
134
-			return update_option( $this->option_name(), $object_vars );
129
+	function save($first = false) {
130
+		$object_vars = wp_json_encode(get_object_vars($this));
131
+		if ($first) {
132
+			return add_option($this->option_name(), $object_vars, null, 'no');
133
+		} else {
134
+			return update_option($this->option_name(), $object_vars);
135 135
 		}
136 136
 	}
137 137
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return boolean
144 144
 	 */
145 145
 	function delete() {
146
-		return delete_option( $this->option_name() );
146
+		return delete_option($this->option_name());
147 147
 	}
148 148
 
149 149
 
@@ -154,26 +154,26 @@  discard block
 block discarded – undo
154 154
 	 * @return JobParameters
155 155
 	 * @throws BatchRequestException
156 156
 	 */
157
-	static function load( $job_id ) {
158
-		$job_parameter_vars = json_decode( get_option( JobParameters::wp_option_prefix . $job_id ), true );
159
-		if(
160
-			! is_array( $job_parameter_vars ) ||
161
-			! isset( $job_parameter_vars[ '_classname' ] ) ||
162
-			! isset( $job_parameter_vars[ '_request_data' ] )
157
+	static function load($job_id) {
158
+		$job_parameter_vars = json_decode(get_option(JobParameters::wp_option_prefix.$job_id), true);
159
+		if (
160
+			! is_array($job_parameter_vars) ||
161
+			! isset($job_parameter_vars['_classname']) ||
162
+			! isset($job_parameter_vars['_request_data'])
163 163
 		) {
164 164
 			throw new BatchRequestException(
165 165
 				sprintf( 
166 166
 					__('Could not retrieve job %1$s from the Wordpress options table, and so the job could not continue. The wordpress option was %2$s', 'event_espresso'),
167 167
 					$job_id,
168
-					get_option( JobParameters::wp_option_prefix . $job_id )
168
+					get_option(JobParameters::wp_option_prefix.$job_id)
169 169
 				)
170 170
 			);
171 171
 		}
172 172
 		$job_parameters = new JobParameters( 
173 173
 				$job_id, 
174
-				$job_parameter_vars[ '_classname' ], 
175
-				$job_parameter_vars[ '_request_data'] );
176
-		foreach( $job_parameter_vars as $key => $value ) {
174
+				$job_parameter_vars['_classname'], 
175
+				$job_parameter_vars['_request_data'] );
176
+		foreach ($job_parameter_vars as $key => $value) {
177 177
 			$job_parameters->$key = $value;
178 178
 		}
179 179
 		return $job_parameters;
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 	 * @param string|array $default
218 218
 	 * @return string|array
219 219
 	 */
220
-	function request_datum( $key, $default = '' ) {
221
-		if( isset( $this->_request_data[ $key ] ) ) {
222
-			return $this->_request_data[ $key ];
220
+	function request_datum($key, $default = '') {
221
+		if (isset($this->_request_data[$key])) {
222
+			return $this->_request_data[$key];
223 223
 		} else {
224 224
 			return $default;
225 225
 		}
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 	 * @param string|array $default
234 234
 	 * @return string|array
235 235
 	 */
236
-	function extra_datum( $key, $default = '' ) {
237
-		if( isset( $this->_extra_data[ $key ] ) ) {
238
-			return $this->_extra_data[ $key ];
236
+	function extra_datum($key, $default = '') {
237
+		if (isset($this->_extra_data[$key])) {
238
+			return $this->_extra_data[$key];
239 239
 		} else {
240 240
 			return $default;
241 241
 		}
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	 * @param string $key
249 249
 	 * @param string|int|array|null $value almost any extra data you want to store
250 250
 	 */
251
-	function add_extra_data( $key, $value ) {
252
-		$this->_extra_data[ $key ] = $value;
251
+	function add_extra_data($key, $value) {
252
+		$this->_extra_data[$key] = $value;
253 253
 	}
254 254
 
255 255
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * Sets the job size. You decide what units to use
279 279
 	 * @param int $size
280 280
 	 */
281
-	function set_job_size( $size ) {
281
+	function set_job_size($size) {
282 282
 		$this->_job_size = $size;
283 283
 	}
284 284
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @param int $newly_processed
300 300
 	 * @return int updated units processed
301 301
 	 */
302
-	function mark_processed( $newly_processed ) {
302
+	function mark_processed($newly_processed) {
303 303
 		$this->_units_processed += $newly_processed;
304 304
 		return $this->_units_processed;
305 305
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * Sets the total count of units processed. You might prefer to use mark_processed
311 311
 	 * @param int $total_units_processed
312 312
 	 */
313
-	function set_units_processed( $total_units_processed ) {
313
+	function set_units_processed($total_units_processed) {
314 314
 		$this->_units_processed = $total_units_processed;
315 315
 	}
316 316
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * Sets the job's ID
321 321
 	 * @param string $job_id
322 322
 	 */
323
-	function set_job_id( $job_id ) {
323
+	function set_job_id($job_id) {
324 324
 		$this->_job_id = $job_id;
325 325
 	}
326 326
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 * sets the classname
331 331
 	 * @param string $classname
332 332
 	 */
333
-	function set_classname( $classname ) {
333
+	function set_classname($classname) {
334 334
 		$this->_classname = $classname;
335 335
 	}
336 336
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 * Sets the request data
341 341
 	 * @param array $request_data
342 342
 	 */
343
-	function set_request_data( $request_data ) {
343
+	function set_request_data($request_data) {
344 344
 		$this->_request_data = $request_data;
345 345
 	}
346 346
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * Sets the array of extra data we want to store on this request
351 351
 	 * @param array $extra_data
352 352
 	 */
353
-	function set_extra_data( $extra_data ) {
353
+	function set_extra_data($extra_data) {
354 354
 		$this->_extra_data = $extra_data;
355 355
 	}
356 356
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * @return string
362 362
 	 */
363 363
 	function option_name() {
364
-		return JobParameters::wp_option_prefix . $this->job_id();
364
+		return JobParameters::wp_option_prefix.$this->job_id();
365 365
 	}
366 366
 
367 367
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 *
381 381
 	 * @param string $status on eof JobParameters::valid_stati()
382 382
 	 */
383
-	public function set_status( $status ) {
383
+	public function set_status($status) {
384 384
 		$this->_status = $status;
385 385
 	}
386 386
 
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- *
4
- * Class JobParameters
5
- *
6
- * Class for storing information about a job. Takes care of serializing the
7
- * data for storing in a wordpress option
8
- *
9
- * @package         Event Espresso
10
- * @subpackage    batch
11
- * @author				Mike Nelson
12
- * @since		 	   4.8.26
13
- *
14
- */
3
+	 *
4
+	 * Class JobParameters
5
+	 *
6
+	 * Class for storing information about a job. Takes care of serializing the
7
+	 * data for storing in a wordpress option
8
+	 *
9
+	 * @package         Event Espresso
10
+	 * @subpackage    batch
11
+	 * @author				Mike Nelson
12
+	 * @since		 	   4.8.26
13
+	 *
14
+	 */
15 15
 namespace EventEspressoBatchRequest\Helpers;
16 16
 
17 17
 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@
 block discarded – undo
214 214
 	/**
215 215
 	 * Gets a single item from the request data
216 216
 	 * @param string $key
217
-	 * @param string|array $default
217
+	 * @param string $default
218 218
 	 * @return string|array
219 219
 	 */
220 220
 	function request_datum( $key, $default = '' ) {
Please login to merge, or discard this patch.
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 2 patches
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.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- *
4
- * Class JobHandlerFile
5
- *
6
- * Base class for common implementations of JobHandlerInterface, but ones
7
- * which write to a temporary file
8
- *
9
- * @package         Event Espresso
10
- * @subpackage    batch
11
- * @author				Mike Nelson
12
- * @since		 	   4.8.26
13
- *
14
- */
3
+	 *
4
+	 * Class JobHandlerFile
5
+	 *
6
+	 * Base class for common implementations of JobHandlerInterface, but ones
7
+	 * which write to a temporary file
8
+	 *
9
+	 * @package         Event Espresso
10
+	 * @subpackage    batch
11
+	 * @author				Mike Nelson
12
+	 * @since		 	   4.8.26
13
+	 *
14
+	 */
15 15
 namespace EventEspressoBatchRequest\JobHandlerBaseClasses;
16 16
 
17 17
 use EventEspressoBatchRequest\Helpers\BatchRequestException;
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.