Completed
Branch BUG-10008-migration-stalling (f3f3da)
by
unknown
15:47
created
core/libraries/batch/Helpers/JobStepResponse.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
 	 * @param string $update_text
44 44
 	 * @param array $extra_data
45 45
 	 */
46
-	public function __construct(JobParameters $job_parameters, $update_text, $extra_data = array() ) {
47
-		$this->_job_parameters 	= $job_parameters;
46
+	public function __construct(JobParameters $job_parameters, $update_text, $extra_data = array()) {
47
+		$this->_job_parameters = $job_parameters;
48 48
 		$this->_update_text 	= $update_text;
49
-		$this->_extra_data 		= (array)$extra_data;
49
+		$this->_extra_data 		= (array) $extra_data;
50 50
 	}
51 51
 
52 52
 
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlerBaseClasses/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   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -410,7 +410,7 @@
 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   +136 added lines, -136 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,35 +35,35 @@  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
-		\EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true );
58
+			$job_parameters->extra_datum('questions_data') );
59
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
60 60
 		//if we actually processed a row there, record it
61
-		if( $job_parameters->job_size() ) {
62
-			$job_parameters->mark_processed( 1 );
61
+		if ($job_parameters->job_size()) {
62
+			$job_parameters->mark_processed(1);
63 63
 		}
64 64
 		return new JobStepResponse(
65 65
 			$job_parameters,
66
-			__( 'Registrations report started successfully...', 'event_espresso' )
66
+			__('Registrations report started successfully...', 'event_espresso')
67 67
 		);
68 68
 	}
69 69
 
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
 	 * @param int $event_id
75 75
 	 * @return string
76 76
 	 */
77
-	protected function get_filename_from_event( $event_id ) {
78
-		if( $event_id ){
79
-			$event_slug =  \EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' );
80
-			if( ! $event_slug ) {
81
-				$event_slug = __( 'unknown', 'event_espresso' );
77
+	protected function get_filename_from_event($event_id) {
78
+		if ($event_id) {
79
+			$event_slug = \EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug');
80
+			if ( ! $event_slug) {
81
+				$event_slug = __('unknown', 'event_espresso');
82 82
 			}
83
-		}else{
84
-			$event_slug = __( 'all', 'event_espresso' );
83
+		} else {
84
+			$event_slug = __('all', 'event_espresso');
85 85
 		}
86
-		return sprintf( "registrations-for-%s.csv", $event_slug );
86
+		return sprintf("registrations-for-%s.csv", $event_slug);
87 87
 	}
88 88
 
89 89
 	/**
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 	 * @param int|null $event_id
93 93
 	 * @return array of wpdb results for questions which are to be used for this report
94 94
 	 */
95
-	protected function _get_questions_for_report( $event_id ) {
95
+	protected function _get_questions_for_report($event_id) {
96 96
 		$question_query_params = array(
97 97
 			array(
98
-				'Answer.ANS_ID' => array( 'IS_NOT_NULL' ),
98
+				'Answer.ANS_ID' => array('IS_NOT_NULL'),
99 99
 			),
100
-			'group_by' => array( 'QST_ID' )
100
+			'group_by' => array('QST_ID')
101 101
 		);
102
-		if( $event_id ) {
102
+		if ($event_id) {
103 103
 			$question_query_params[0]['Answer.Registration.EVT_ID'] = $event_id;
104 104
 		}
105
-		return \EEM_Question::instance()->get_all_wpdb_results( $question_query_params );
105
+		return \EEM_Question::instance()->get_all_wpdb_results($question_query_params);
106 106
 	}
107 107
 
108 108
 
@@ -115,27 +115,27 @@  discard block
 block discarded – undo
115 115
 	 * @return JobStepResponse
116 116
 	 * @throws \EE_Error
117 117
 	 */
118
-	public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) {
118
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50) {
119 119
 		$csv_data = $this->get_csv_data_for(
120
-			$job_parameters->request_datum( 'EVT_ID', '0'),
120
+			$job_parameters->request_datum('EVT_ID', '0'),
121 121
 			$job_parameters->units_processed(),
122 122
 			$batch_size,
123
-			$job_parameters->extra_datum( 'questions_data' ) );
124
-		\EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false );
125
-		$units_processed = count( $csv_data );
126
-		$job_parameters->mark_processed( $units_processed );
123
+			$job_parameters->extra_datum('questions_data') );
124
+		\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
125
+		$units_processed = count($csv_data);
126
+		$job_parameters->mark_processed($units_processed);
127 127
 		$extra_response_data = array(
128 128
 			'file_url' => ''
129 129
 		);
130
-		if( $units_processed < $batch_size ) {
131
-			$job_parameters->set_status( JobParameters::status_complete );
132
-			$extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) );
130
+		if ($units_processed < $batch_size) {
131
+			$job_parameters->set_status(JobParameters::status_complete);
132
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
133 133
 		}
134 134
 		return new JobStepResponse(
135 135
 				$job_parameters,
136 136
 				sprintf(
137
-					__( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ),
138
-					count( $csv_data ) ),
137
+					__('Wrote %1$s rows to report CSV file...', 'event_espresso'),
138
+					count($csv_data) ),
139 139
 				$extra_response_data );
140 140
 	}
141 141
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @return array top-level keys are numeric, next-level keys are column headers
149 149
 	 *
150 150
 	 */
151
-	function get_csv_data_for( $event_id, $offset, $limit, $questions_for_these_regs_rows ) {
151
+	function get_csv_data_for($event_id, $offset, $limit, $questions_for_these_regs_rows) {
152 152
 		$reg_fields_to_include = array(
153 153
 			'TXN_ID',
154 154
 			'ATT_ID',
@@ -179,166 +179,166 @@  discard block
 block discarded – undo
179 179
 				array(
180 180
 					'OR' => array(
181 181
 						//don't include registrations from failed or abandoned transactions...
182
-						'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ),
182
+						'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)),
183 183
 						//unless the registration is approved, in which case include it regardless of transaction status
184 184
 						'STS_ID' => \EEM_Registration::status_id_approved
185 185
 						),
186
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
186
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
187 187
 					),
188
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
189
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ),
190
-				'limit' => array( $offset, $limit ),
188
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
189
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
190
+				'limit' => array($offset, $limit),
191 191
 				'caps' => \EEM_Base::caps_read_admin
192 192
 			),
193 193
 			$event_id
194 194
 		);
195
-		if( $event_id ){
196
-			$query_params[0]['EVT_ID'] =  $event_id;
197
-		}else{
198
-			$query_params[ 'force_join' ][] = 'Event';
195
+		if ($event_id) {
196
+			$query_params[0]['EVT_ID'] = $event_id;
197
+		} else {
198
+			$query_params['force_join'][] = 'Event';
199 199
 		}
200
-		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
200
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
201 201
 		//get all questions which relate to someone in this group
202 202
 		$registration_ids = array();
203
-		foreach( $registration_rows as $reg_row ) {
204
-			$registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] );
203
+		foreach ($registration_rows as $reg_row) {
204
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
205 205
 		}
206 206
 
207
-		foreach($registration_rows as $reg_row){
208
-			if ( is_array( $reg_row ) ) {
207
+		foreach ($registration_rows as $reg_row) {
208
+			if (is_array($reg_row)) {
209 209
 				$reg_csv_array = array();
210
-				if( ! $event_id ){
210
+				if ( ! $event_id) {
211 211
 					//get the event's name and Id
212
-					$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' ] );
212
+					$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']);
213 213
 				}
214
-				$is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false;
214
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
215 215
 				/*@var $reg_row EE_Registration */
216
-				foreach($reg_fields_to_include as $field_name){
216
+				foreach ($reg_fields_to_include as $field_name) {
217 217
 					$field = $reg_model->field_settings_for($field_name);
218
-					if($field_name == 'REG_final_price'){
219
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
220
-					}elseif( $field_name == 'REG_count' ){
221
-						$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' ] ) );
222
-					}elseif( $field_name == 'REG_date' ) {
223
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
224
-					}else{
225
-						$value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
218
+					if ($field_name == 'REG_final_price') {
219
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float');
220
+					}elseif ($field_name == 'REG_count') {
221
+						$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']));
222
+					}elseif ($field_name == 'REG_date') {
223
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html');
224
+					} else {
225
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]);
226 226
 					}
227 227
 					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
228
-					if($field_name == 'REG_final_price'){
228
+					if ($field_name == 'REG_final_price') {
229 229
 						//add a column named Currency after the final price
230 230
 						$reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code;
231 231
 					}
232 232
 				}
233 233
 				//get pretty status
234
-				$stati = \EEM_Status::instance()->localized_status( array(
235
-					$reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ),
236
-					$reg_row[ 'TransactionTable.STS_ID' ] => __( 'unknown', 'event_espresso' ) ),
234
+				$stati = \EEM_Status::instance()->localized_status(array(
235
+					$reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'),
236
+					$reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso') ),
237 237
 						FALSE,
238
-						'sentence' );
239
-				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ];
238
+						'sentence');
239
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
240 240
 				//get pretty transaction status
241
-				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'TransactionTable.STS_ID' ] ];
242
-				$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[ 'TransactionTable.TXN_total' ], 'localized_float' ) : '0.00';
243
-				$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[ 'TransactionTable.TXN_paid' ], 'localized_float' ) : '0.00';
241
+				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
242
+				$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['TransactionTable.TXN_total'], 'localized_float') : '0.00';
243
+				$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['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
244 244
 				$payment_methods = array();
245 245
 				$gateway_txn_ids_etc = array();
246 246
 				$payment_times = array();
247
-				if( $is_primary_reg && $reg_row[ 'TransactionTable.TXN_ID' ] ){
247
+				if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
248 248
 					$payments_info = \EEM_Payment::instance()->get_all_wpdb_results(
249 249
 							array(
250 250
 								array(
251
-									'TXN_ID' => $reg_row[ 'TransactionTable.TXN_ID' ],
251
+									'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
252 252
 									'STS_ID' => \EEM_Payment::status_id_approved
253 253
 								),
254
-								'force_join' => array( 'Payment_Method' ),
254
+								'force_join' => array('Payment_Method'),
255 255
 
256 256
 							),
257 257
 							ARRAY_A,
258 258
 							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
259 259
 
260
-					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
261
-						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
262
-						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
263
-						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
260
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
261
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
262
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
263
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : '';
264 264
 					}
265 265
 
266 266
 				}
267
-				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
268
-				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
269
-				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );
267
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
268
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
269
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
270 270
 
271 271
 				//get whether or not the user has checked in
272
-				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' );
272
+				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
273 273
 				//get ticket of registration and its price
274 274
 				$ticket_model = \EE_Registry::instance()->load_model('Ticket');
275
-				if( $reg_row[ 'Ticket.TKT_ID'] ) {
276
-					$ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] );
275
+				if ($reg_row['Ticket.TKT_ID']) {
276
+					$ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']);
277 277
 					$datetimes_strings = array();
278
-					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){
279
-						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] );
278
+					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) {
279
+						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
280 280
 					}
281 281
 
282 282
 				} else {
283
-					$ticket_name = __( 'Unknown', 'event_espresso' );
284
-					$datetimes_strings = array( __( 'Unknown', 'event_espresso' ) );
283
+					$ticket_name = __('Unknown', 'event_espresso');
284
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
285 285
 				}
286 286
 				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
287 287
 				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
288 288
 				//get datetime(s) of registration
289 289
 
290 290
 				//add attendee columns
291
-				foreach($att_fields_to_include as $att_field_name){
291
+				foreach ($att_fields_to_include as $att_field_name) {
292 292
 					$field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name);
293
-					if( $reg_row[ 'Attendee_CPT.ID' ]){
294
-						if($att_field_name == 'STA_ID'){
295
-							$value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
296
-						}elseif($att_field_name == 'CNT_ISO'){
297
-							$value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
298
-						}else{
299
-							$value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
293
+					if ($reg_row['Attendee_CPT.ID']) {
294
+						if ($att_field_name == 'STA_ID') {
295
+							$value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name');
296
+						}elseif ($att_field_name == 'CNT_ISO') {
297
+							$value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name');
298
+						} else {
299
+							$value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
300 300
 						}
301
-					}else{
301
+					} else {
302 302
 						$value = '';
303 303
 					}
304 304
 
305
-					$reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value;
305
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value;
306 306
 				}
307 307
 
308 308
 				//make sure each registration has the same questions in the same order
309
-				foreach($questions_for_these_regs_rows as $question_row){
310
-					if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){
311
-						$reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null;
309
+				foreach ($questions_for_these_regs_rows as $question_row) {
310
+					if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) {
311
+						$reg_csv_array[$question_row['Question.QST_admin_label']] = null;
312 312
 					}
313 313
 				}
314 314
 				$answers = \EEM_Answer::instance()->get_all_wpdb_results(
315 315
 					array(
316
-						array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ),
317
-						'force_join' => array( 'Question' )
316
+						array('REG_ID' => $reg_row['Registration.REG_ID']),
317
+						'force_join' => array('Question')
318 318
 					)
319 319
 				);
320 320
 				//now fill out the questions THEY answered
321
-				foreach( $answers as $answer_row ){
322
-					if( $answer_row[ 'Question.QST_ID' ] ){
321
+				foreach ($answers as $answer_row) {
322
+					if ($answer_row['Question.QST_ID']) {
323 323
 						$question_label = \EEH_Export::prepare_value_from_db_for_display(
324 324
 							\EEM_Question::instance(),
325 325
 							'QST_admin_label',
326
-							$answer_row[ 'Question.QST_admin_label' ]
326
+							$answer_row['Question.QST_admin_label']
327 327
 						);
328 328
 					} else {
329
-						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
329
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
330 330
 					}
331
-					if ( isset( $answer_row[ 'Question.QST_type' ] )
332
-						 && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state
331
+					if (isset($answer_row['Question.QST_type'])
332
+						 && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state
333 333
 					) {
334
-						$reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID(
335
-							$answer_row[ 'Answer.ANS_value' ]
334
+						$reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID(
335
+							$answer_row['Answer.ANS_value']
336 336
 						);
337 337
 					} else {
338
-						$reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display(
338
+						$reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display(
339 339
 							\EEM_Answer::instance(),
340 340
 							'ANS_value',
341
-							$answer_row[ 'Answer.ANS_value' ]
341
+							$answer_row['Answer.ANS_value']
342 342
 						);
343 343
 					}
344 344
 				}
@@ -349,17 +349,17 @@  discard block
 block discarded – undo
349 349
 			}
350 350
 		}
351 351
 		//if we couldn't export anything, we want to at least show the column headers
352
-		if ( empty( $registrations_csv_ready_array ) ) {
352
+		if (empty($registrations_csv_ready_array)) {
353 353
 			$reg_csv_array = array();
354 354
 			$model_and_fields_to_include = array(
355 355
 				'Registration' => $reg_fields_to_include,
356 356
 				'Attendee'     => $att_fields_to_include
357 357
 			);
358
-			foreach ( $model_and_fields_to_include as $model_name => $field_list ) {
359
-				$model = \EE_Registry::instance()->load_model( $model_name );
360
-				foreach ( $field_list as $field_name ) {
361
-					$field = $model->field_settings_for( $field_name );
362
-					$reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null;
358
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
359
+				$model = \EE_Registry::instance()->load_model($model_name);
360
+				foreach ($field_list as $field_name) {
361
+					$field = $model->field_settings_for($field_name);
362
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
363 363
 				}
364 364
 			}
365 365
 			$registrations_csv_ready_array[] = $reg_csv_array;
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @param int $event_id
376 376
 	 * @return int
377 377
 	 */
378
-	public function count_units_to_process( $event_id ) {
378
+	public function count_units_to_process($event_id) {
379 379
 		//use the legacy filter
380 380
 		$query_params = apply_filters(
381 381
 			'FHEE__EE_Export__report_registration_for_event',
@@ -383,24 +383,24 @@  discard block
 block discarded – undo
383 383
 				array(
384 384
 					'OR' => array(
385 385
 						//don't include registrations from failed or abandoned transactions...
386
-						'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ),
386
+						'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)),
387 387
 						//unless the registration is approved, in which case include it regardless of transaction status
388 388
 						'STS_ID' => \EEM_Registration::status_id_approved
389 389
 						),
390
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
390
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
391 391
 					),
392
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
393
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ),
392
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
393
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
394 394
 				'caps' => \EEM_Base::caps_read_admin
395 395
 			),
396 396
 			$event_id
397 397
 		);
398
-		if( $event_id ){
399
-			$query_params[0]['EVT_ID'] =  $event_id;
398
+		if ($event_id) {
399
+			$query_params[0]['EVT_ID'] = $event_id;
400 400
 		} else {
401
-			$query_params[ 'force_join' ][] = 'Event';
401
+			$query_params['force_join'][] = 'Event';
402 402
 		}
403
-		return \EEM_Registration::instance()->count( $query_params );
403
+		return \EEM_Registration::instance()->count($query_params);
404 404
 	}
405 405
 
406 406
 
@@ -411,13 +411,13 @@  discard block
 block discarded – undo
411 411
 	 * @param JobParameters $job_parameters
412 412
 	 * @return boolean
413 413
 	 */
414
-	public function cleanup_job( JobParameters $job_parameters ){
414
+	public function cleanup_job(JobParameters $job_parameters) {
415 415
 		$this->_file_helper->delete(
416
-			\EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ),
416
+			\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
417 417
 			true,
418 418
 			'd'
419 419
 		);
420
-		return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) );
420
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
421 421
 	}
422 422
 }
423 423
 
Please login to merge, or discard this patch.
caffeinated/modules/recaptcha/ReCaptcha/RequestMethod/Post.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -34,37 +34,37 @@
 block discarded – undo
34 34
  */
35 35
 class Post implements RequestMethod
36 36
 {
37
-    /**
38
-     * URL to which requests are POSTed.
39
-     * @const string
40
-     */
41
-    const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
37
+	/**
38
+	 * URL to which requests are POSTed.
39
+	 * @const string
40
+	 */
41
+	const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
42 42
 
43
-    /**
44
-     * Submit the POST request with the specified parameters.
45
-     *
46
-     * @param RequestParameters $params Request parameters
47
-     * @return string Body of the reCAPTCHA response
48
-     */
49
-    public function submit(RequestParameters $params)
50
-    {
51
-        /**
52
-         * PHP 5.6.0 changed the way you specify the peer name for SSL context options.
53
-         * Using "CN_name" will still work, but it will raise deprecated errors.
54
-         */
55
-        $peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name';
56
-        $options = array(
57
-            'http' => array(
58
-                'header' => "Content-type: application/x-www-form-urlencoded\r\n",
59
-                'method' => 'POST',
60
-                'content' => $params->toQueryString(),
61
-                // Force the peer to validate (not needed in 5.6.0+, but still works
62
-                'verify_peer' => true,
63
-                // Force the peer validation to use www.google.com
64
-                $peer_key => 'www.google.com',
65
-            ),
66
-        );
67
-        $context = stream_context_create($options);
68
-        return file_get_contents(self::SITE_VERIFY_URL, false, $context);
69
-    }
43
+	/**
44
+	 * Submit the POST request with the specified parameters.
45
+	 *
46
+	 * @param RequestParameters $params Request parameters
47
+	 * @return string Body of the reCAPTCHA response
48
+	 */
49
+	public function submit(RequestParameters $params)
50
+	{
51
+		/**
52
+		 * PHP 5.6.0 changed the way you specify the peer name for SSL context options.
53
+		 * Using "CN_name" will still work, but it will raise deprecated errors.
54
+		 */
55
+		$peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name';
56
+		$options = array(
57
+			'http' => array(
58
+				'header' => "Content-type: application/x-www-form-urlencoded\r\n",
59
+				'method' => 'POST',
60
+				'content' => $params->toQueryString(),
61
+				// Force the peer to validate (not needed in 5.6.0+, but still works
62
+				'verify_peer' => true,
63
+				// Force the peer validation to use www.google.com
64
+				$peer_key => 'www.google.com',
65
+			),
66
+		);
67
+		$context = stream_context_create($options);
68
+		return file_get_contents(self::SITE_VERIFY_URL, false, $context);
69
+	}
70 70
 }
Please login to merge, or discard this patch.
registrations/templates/attendee_registrations_main_meta_box.template.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,42 +5,42 @@
 block discarded – undo
5 5
 		<table class="admin-primary-mbox-tbl">
6 6
 			<thead>
7 7
 				<tr>
8
-					<th class="jst-left"><?php esc_html_e( 'Event Name', 'event_espresso' );?></th>
9
-					<th class="jst-left"><?php esc_html_e( 'REG ID', 'event_espresso' );?></th>
10
-					<th class="jst-left"><?php esc_html_e( 'TXN ID', 'event_espresso' );?></th>
11
-					<th class="jst-left"><?php esc_html_e( 'Reg Code', 'event_espresso' );?></th>
12
-					<th class="jst-rght"><?php esc_html_e( 'Ticket Price', 'event_espresso' );?></th>
8
+					<th class="jst-left"><?php esc_html_e('Event Name', 'event_espresso'); ?></th>
9
+					<th class="jst-left"><?php esc_html_e('REG ID', 'event_espresso'); ?></th>
10
+					<th class="jst-left"><?php esc_html_e('TXN ID', 'event_espresso'); ?></th>
11
+					<th class="jst-left"><?php esc_html_e('Reg Code', 'event_espresso'); ?></th>
12
+					<th class="jst-rght"><?php esc_html_e('Ticket Price', 'event_espresso'); ?></th>
13 13
 				</tr>
14 14
 			</thead>
15 15
 			<tbody>
16
-			<?php foreach( $registrations as $registration ) : ?>
16
+			<?php foreach ($registrations as $registration) : ?>
17 17
 				<tr>
18 18
 					<td class="jst-left">
19 19
 					<?php
20
-						$event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' ));
21
-						echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ?  '<a href="'. $event_url .'"  title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name();
20
+						$event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events'));
21
+						echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'"  title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name();
22 22
 					?>
23 23
 					</td>
24 24
 					<td class="jst-left">
25 25
 					<?php
26
-							$reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
27
-							echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
28
-							<a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . 
29
-								esc_html__( 'View Registration', 'event_espresso' ) .
26
+							$reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
27
+							echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
28
+							<a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. 
29
+								esc_html__('View Registration', 'event_espresso').
30 30
 							'</a>' : $registration->ID();
31 31
 					?>
32 32
 					</td>
33 33
 					<td class="jst-left">
34 34
 					<?php
35
-						$txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL );
36
-						echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '
37
-						<a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' .
38
-							sprintf( esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID() ) .
35
+						$txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL);
36
+						echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
37
+						<a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'.
38
+							sprintf(esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID()).
39 39
 						'</a>' : $registration->transaction_ID();
40 40
 					?>
41 41
 					</td>
42
-					<td class="jst-left"><?php echo $registration->reg_code();?></td>
43
-					<td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td>
42
+					<td class="jst-left"><?php echo $registration->reg_code(); ?></td>
43
+					<td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td>
44 44
 				</tr>
45 45
 			<?php endforeach; ?>
46 46
 			</tbody>
Please login to merge, or discard this patch.
core/db_classes/EE_Extra_Join.class.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	 * @param null  $timezone
23 23
 	 * @return EE_Event_Message_Template|mixed
24 24
 	 */
25
-	public static function new_instance( $props_n_values = array(), $timezone = NULL ) {
26
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone );
27
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
25
+	public static function new_instance($props_n_values = array(), $timezone = NULL) {
26
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
27
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
28 28
 	}
29 29
 
30 30
 
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @param null  $timezone
35 35
 	 * @return EE_Event_Message_Template
36 36
 	 */
37
-	public static function new_instance_from_db ( $props_n_values = array(), $timezone = NULL ) {
38
-		return new self( $props_n_values, TRUE, $timezone );
37
+	public static function new_instance_from_db($props_n_values = array(), $timezone = NULL) {
38
+		return new self($props_n_values, TRUE, $timezone);
39 39
 	}
40 40
 
41 41
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
strategies/validation/EE_Max_Length_Validation_Strategy.strategy.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,36 +8,36 @@
 block discarded – undo
8 8
  * @subpackage	Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php.
9 9
  * @author				Mike Nelson
10 10
  */
11
-class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base{
11
+class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base {
12 12
 
13 13
 	protected $_max_length;
14 14
 
15
-	public function __construct( $validation_error_message = NULL, $max_length = EE_INF ) {
15
+	public function __construct($validation_error_message = NULL, $max_length = EE_INF) {
16 16
 		$this->_max_length = $max_length;
17
-		if( $validation_error_message === null ) {
18
-			$validation_error_message = sprintf( __( 'Input is too long. Maximum number of characters is %1$s', 'event_espresso' ), $max_length );
17
+		if ($validation_error_message === null) {
18
+			$validation_error_message = sprintf(__('Input is too long. Maximum number of characters is %1$s', 'event_espresso'), $max_length);
19 19
 		}
20
-		parent::__construct( $validation_error_message );
20
+		parent::__construct($validation_error_message);
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @param $normalized_value
25 25
 	 */
26 26
 	public function validate($normalized_value) {
27
-		if( $this->_max_length !== EE_INF &&
27
+		if ($this->_max_length !== EE_INF &&
28 28
 				$normalized_value &&
29
-				is_string( $normalized_value ) &&
30
-				 strlen( $normalized_value ) > $this->_max_length){
31
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'maxlength' );
29
+				is_string($normalized_value) &&
30
+				 strlen($normalized_value) > $this->_max_length) {
31
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'maxlength');
32 32
 		}
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	 * @return array
37 37
 	 */
38
-	function get_jquery_validation_rule_array(){
39
-		if( $this->_max_length !== EE_INF ) {
40
-			return array( 'maxlength'=> $this->_max_length, 'messages' => array( 'maxlength' => $this->get_validation_error_message() ) );
38
+	function get_jquery_validation_rule_array() {
39
+		if ($this->_max_length !== EE_INF) {
40
+			return array('maxlength'=> $this->_max_length, 'messages' => array('maxlength' => $this->get_validation_error_message()));
41 41
 		} else {
42 42
 			return array();
43 43
 		}
Please login to merge, or discard this patch.
core/db_models/EEM_Extra_Join.model.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,26 +21,26 @@
 block discarded – undo
21 21
  * @since		 	   $VID:$
22 22
  *
23 23
  */
24
-if (!defined('EVENT_ESPRESSO_VERSION')) {
24
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
25 25
 	exit('No direct script access allowed');
26 26
 }
27 27
 
28
-class EEM_Extra_Join extends EEM_Base{
28
+class EEM_Extra_Join extends EEM_Base {
29 29
 	// private instance of the Extra Join object
30 30
 	protected static $_instance = NULL;
31 31
 	
32 32
 	public function __construct($timezone = NULL) {
33
-		$models_this_can_join = array_keys( EE_Registry::instance()->non_abstract_db_models );
33
+		$models_this_can_join = array_keys(EE_Registry::instance()->non_abstract_db_models);
34 34
 		$this->_tables = array(
35
-			'Extra_Join' => new EE_Primary_Table( 'esp_extra_join', 'EXJ_ID' ),
35
+			'Extra_Join' => new EE_Primary_Table('esp_extra_join', 'EXJ_ID'),
36 36
 		);
37 37
 		$this->_fields = array(
38 38
 			'Extra_Join' => array(
39
-				'EXJ_ID' => new EE_Primary_Key_Int_Field( 'EXJ_ID', __( 'Extra Join ID', 'event_espresso' ) ),
40
-				'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_first_model_ID', __( 'First Model ID', 'event_espresso' ), true, 0, $models_this_can_join ),
41
-				'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_first_model_name', __( 'First Model Name', 'event_espresso'), true, '', $models_this_can_join ),
42
-				'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_second_model_ID', __( 'Second Model ID', 'event_espresso' ), true, 0, $models_this_can_join ),
43
-				'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_second_model_name', __( 'Second Model Name', 'event_espresso'), true, '', $models_this_can_join ),
39
+				'EXJ_ID' => new EE_Primary_Key_Int_Field('EXJ_ID', __('Extra Join ID', 'event_espresso')),
40
+				'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field('EXJ_first_model_ID', __('First Model ID', 'event_espresso'), true, 0, $models_this_can_join),
41
+				'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_first_model_name', __('First Model Name', 'event_espresso'), true, '', $models_this_can_join),
42
+				'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field('EXJ_second_model_ID', __('Second Model ID', 'event_espresso'), true, 0, $models_this_can_join),
43
+				'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_second_model_name', __('Second Model Name', 'event_espresso'), true, '', $models_this_can_join),
44 44
 				
45 45
 			)
46 46
 		);
Please login to merge, or discard this patch.
core/libraries/batch/Helpers/JobParameters.php 2 patches
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.
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.