Completed
Branch FET-7999-purchasing-agent (117637)
by
unknown
171:12 queued 161:16
created
core/data_migration_scripts/EE_Data_Migration_Script_Base.core.php 2 patches
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 					$records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated);
307 307
 					$num_records_actually_migrated += $records_migrated_during_stage;
308 308
 					$records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage;
309
-				}catch(Exception $e){
309
+				} catch(Exception $e){
310 310
 					//yes if we catch an exception here, we consider that migration stage borked.
311 311
 					$stage->set_status(EE_Data_Migration_Manager::status_fatal_error);
312 312
 					$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
@@ -332,14 +332,14 @@  discard block
 block discarded – undo
332 332
 			//this migration script apparently has NO stages... which is super weird, but whatever
333 333
 			$this->set_completed();
334 334
 			$this->_maybe_do_schema_changes(false);
335
-		}else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
335
+		} else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
336 336
 			//apparently we're done, because we couldn't migrate the number we intended to
337 337
 			$this->set_completed();
338 338
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
339 339
 			//do schema changes for after the migration now
340 340
 			//first double-check we haven't already done this
341 341
 			$this->_maybe_do_schema_changes(false);
342
-		}else{
342
+		} else{
343 343
 			//update feedback message, keeping in mind that we show them with the most recent at the top
344 344
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
345 345
 		}
@@ -378,12 +378,12 @@  discard block
 block discarded – undo
378 378
 				ob_start();
379 379
 				if($before){
380 380
 					$this->schema_changes_before_migration();
381
-				}else{
381
+				} else{
382 382
 					$this->schema_changes_after_migration();
383 383
 				}
384 384
 				$output = ob_get_contents();
385 385
 				ob_end_clean();
386
-			}catch(Exception $e){
386
+			} catch(Exception $e){
387 387
 				$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
388 388
 				throw $e;
389 389
 			}
@@ -511,13 +511,13 @@  discard block
 block discarded – undo
511 511
 		if( $table_is_new ) {
512 512
 			if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation  || $this->_currently_migrating() ){
513 513
 				return true;
514
-			}else{
514
+			} else{
515 515
 				return false;
516 516
 			}
517
-		}else{
517
+		} else{
518 518
 			if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){
519 519
 				return true;
520
-			}else{
520
+			} else{
521 521
 				return false;
522 522
 			}
523 523
 		}
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 		EE_Registry::instance()->load_helper('Activation');
535 535
 		try{
536 536
 			EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables);
537
-		}catch( EE_Error $e ) {
537
+		} catch( EE_Error $e ) {
538 538
 			$message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString();
539 539
 			$this->add_error( $message  );
540 540
 			$this->_feedback_message .= $message;
@@ -551,11 +551,11 @@  discard block
 block discarded – undo
551 551
 	private function _get_req_type_for_plugin_corresponding_to_this_dms(){
552 552
 		if($this->slug() == 'Core'){
553 553
 			return EE_System::instance()->detect_req_type();
554
-		}else{//it must be for an addon
554
+		} else{//it must be for an addon
555 555
 			$addon_name = $this->slug();
556 556
 			if( EE_Registry::instance()->get_addon_by_name($addon_name)){
557 557
 				return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type();
558
-			}else{
558
+			} else{
559 559
 				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ;
560 560
 			}
561 561
 		}
Please login to merge, or discard this patch.
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 	 * All children of this must call parent::__construct() at the end of their constructor or suffer the consequences!
118 118
 	 */
119 119
 	public function __construct() {
120
-		$this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages',$this->_migration_stages);
121
-		foreach($this->_migration_stages as $migration_stage){
122
-			if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) {
120
+		$this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages', $this->_migration_stages);
121
+		foreach ($this->_migration_stages as $migration_stage) {
122
+			if ($migration_stage instanceof EE_Data_Migration_Script_Stage) {
123 123
 				$migration_stage->_construct_finalize($this);
124 124
 			}
125 125
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * Place to add hooks and filters for tweaking the migrations page, in order
133 133
 	 * to customize it
134 134
 	 */
135
-	public function migration_page_hooks(){
135
+	public function migration_page_hooks() {
136 136
 		//by default none are added because we normally like the default look of the migration page
137 137
 	}
138 138
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * @param int|string $new_pk eg posts.ID
148 148
 	 * @return void
149 149
 	 */
150
-	public function set_mapping($old_table,$old_pk,$new_table,$new_pk){
150
+	public function set_mapping($old_table, $old_pk, $new_table, $new_pk) {
151 151
 		//make sure it has the needed keys
152
-		if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){
152
+		if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) {
153 153
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
154 154
 		}
155 155
 		$this->_mappings[$old_table][$new_table][$old_pk] = $new_pk;
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts
166 166
 	 * @return mixed the primary key on the new table
167 167
 	 */
168
-	public function get_mapping_new_pk($old_table,$old_pk,$new_table){
169
-		if( ! isset($this->_mappings[$old_table]) ||
170
-			! isset($this->_mappings[$old_table][$new_table])){
168
+	public function get_mapping_new_pk($old_table, $old_pk, $new_table) {
169
+		if ( ! isset($this->_mappings[$old_table]) ||
170
+			! isset($this->_mappings[$old_table][$new_table])) {
171 171
 			//try fetching the option
172 172
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
173 173
 		}
@@ -184,15 +184,15 @@  discard block
 block discarded – undo
184 184
 	 * @param mixed $new_pk
185 185
 	 * @return mixed
186 186
 	 */
187
-	public function get_mapping_old_pk($old_table,$new_table,$new_pk){
188
-		if( ! isset($this->_mappings[$old_table]) ||
189
-			! isset($this->_mappings[$old_table][$new_table])){
187
+	public function get_mapping_old_pk($old_table, $new_table, $new_pk) {
188
+		if ( ! isset($this->_mappings[$old_table]) ||
189
+			! isset($this->_mappings[$old_table][$new_table])) {
190 190
 			//try fetching the option
191 191
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
192 192
 		}
193
-		if(isset($this->_mappings[$old_table][$new_table])){
193
+		if (isset($this->_mappings[$old_table][$new_table])) {
194 194
 			$new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]);
195
-			if(isset($new_pk_to_old_pk[$new_pk])){
195
+			if (isset($new_pk_to_old_pk[$new_pk])) {
196 196
 				return $new_pk_to_old_pk[$new_pk];
197 197
 			}
198 198
 		}
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @param string $new_table_name
208 208
 	 * @return array
209 209
 	 */
210
-	protected function _get_mapping_option($old_table_name,$new_table_name){
211
-		$option =  get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array());
210
+	protected function _get_mapping_option($old_table_name, $new_table_name) {
211
+		$option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array());
212 212
 		return $option;
213 213
 	}
214 214
 
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 	 * @param array $mapping_array
222 222
 	 * @return boolean success of updating option
223 223
 	 */
224
-	protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){
224
+	protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) {
225 225
 //		echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>";
226
-		$success =  update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array);
226
+		$success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array);
227 227
 		return $success;
228 228
 	}
229 229
 
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 	 * @param string $new_table_name
236 236
 	 * @return string
237 237
 	 */
238
-	protected function _get_mapping_option_name($old_table_name,$new_table_name){
238
+	protected function _get_mapping_option_name($old_table_name, $new_table_name) {
239 239
 		global $wpdb;
240
-		$old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name);
241
-		$new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name);
240
+		$old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name);
241
+		$new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name);
242 242
 		$migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
243
-		return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 );
243
+		return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64);
244 244
 	}
245 245
 
246 246
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete.
258 258
 	 * @return int
259 259
 	 */
260
-	protected function _count_records_to_migrate(){
260
+	protected function _count_records_to_migrate() {
261 261
 		$count = 0;
262
-		foreach($this->stages() as $stage){
263
-			$count+= $stage->count_records_to_migrate();
262
+		foreach ($this->stages() as $stage) {
263
+			$count += $stage->count_records_to_migrate();
264 264
 		}
265 265
 		return $count;
266 266
 	}
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 	 * by just setting a transient and updating it after each migration_step
273 273
 	 * @return int
274 274
 	 */
275
-	public function count_records_migrated(){
275
+	public function count_records_migrated() {
276 276
 		$count = 0;
277
-		foreach($this->stages() as $stage){
278
-			$count+= $stage->count_records_migrated();
277
+		foreach ($this->stages() as $stage) {
278
+			$count += $stage->count_records_migrated();
279 279
 		}
280 280
 		$this->_records_migrated = $count;
281 281
 		return $count;
@@ -289,24 +289,24 @@  discard block
 block discarded – undo
289 289
 	 * @throws EE_Error
290 290
 	 * @throws Exception
291 291
 	 */
292
-	public function migration_step($num_records_to_migrate_limit){
292
+	public function migration_step($num_records_to_migrate_limit) {
293 293
 		//reset the feedback message
294 294
 		$this->_feedback_message = '';
295 295
 		//if we haven't yet done the 1st schema changes, do them now. buffer any output
296 296
 		$this->_maybe_do_schema_changes(true);
297 297
 
298
-		$num_records_actually_migrated =0;
298
+		$num_records_actually_migrated = 0;
299 299
 		$records_migrated_per_stage = array();
300 300
 		//setup the 'stage' variable, which should hold the last run stage of the migration  (or none at all if nothing runs)
301 301
 		$stage = null;
302 302
 		//get the next stage that isn't complete
303
-		foreach($this->stages() as $stage){
304
-			if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){
305
-				try{
303
+		foreach ($this->stages() as $stage) {
304
+			if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) {
305
+				try {
306 306
 					$records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated);
307 307
 					$num_records_actually_migrated += $records_migrated_during_stage;
308 308
 					$records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage;
309
-				}catch(Exception $e){
309
+				} catch (Exception $e) {
310 310
 					//yes if we catch an exception here, we consider that migration stage borked.
311 311
 					$stage->set_status(EE_Data_Migration_Manager::status_fatal_error);
312 312
 					$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 					throw $e;
315 315
 				}
316 316
 				//check that the migration stage didn't mark itself as having a fatal error
317
-				if($stage->is_broken()){
317
+				if ($stage->is_broken()) {
318 318
 					$this->set_broken();
319 319
 					throw new EE_Error($stage->get_last_error());
320 320
 				}
@@ -322,24 +322,24 @@  discard block
 block discarded – undo
322 322
 			//once we've migrated all the number we intended to (possibly from different stages), stop migrating
323 323
 			//or if we had a fatal error
324 324
 			//or if the current script stopped early- its not done, but it's done all it thinks we should do on this step
325
-			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){
325
+			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) {
326 326
 				break;
327 327
 			}
328 328
 		}
329 329
 		//check if we're all done this data migration...
330 330
 		//which is indicated by being done early AND the last stage claims to be done
331
-		if($stage == NULL){
331
+		if ($stage == NULL) {
332 332
 			//this migration script apparently has NO stages... which is super weird, but whatever
333 333
 			$this->set_completed();
334 334
 			$this->_maybe_do_schema_changes(false);
335
-		}else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
335
+		} else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) {
336 336
 			//apparently we're done, because we couldn't migrate the number we intended to
337 337
 			$this->set_completed();
338 338
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
339 339
 			//do schema changes for after the migration now
340 340
 			//first double-check we haven't already done this
341 341
 			$this->_maybe_do_schema_changes(false);
342
-		}else{
342
+		} else {
343 343
 			//update feedback message, keeping in mind that we show them with the most recent at the top
344 344
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
345 345
 		}
@@ -353,12 +353,12 @@  discard block
 block discarded – undo
353 353
 	 * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage
354 354
 	 * @return void
355 355
 	 */
356
-	private function _update_feedback_message($records_migrated_per_stage){
356
+	private function _update_feedback_message($records_migrated_per_stage) {
357 357
 		$feedback_message_array = array();
358
-		foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){
359
-			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ;
358
+		foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) {
359
+			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name);
360 360
 		}
361
-		$this->_feedback_message .= implode("<br>",$feedback_message_array);
361
+		$this->_feedback_message .= implode("<br>", $feedback_message_array);
362 362
 	}
363 363
 
364 364
 
@@ -370,27 +370,27 @@  discard block
 block discarded – undo
370 370
 	 * @throws Exception
371 371
 	 * @return void
372 372
 	 */
373
-	private function _maybe_do_schema_changes($before = true){
373
+	private function _maybe_do_schema_changes($before = true) {
374 374
 		//so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran
375
-		$property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran';
376
-		if ( ! $this->$property_name ){
377
-			try{
375
+		$property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran';
376
+		if ( ! $this->$property_name) {
377
+			try {
378 378
 				ob_start();
379
-				if($before){
379
+				if ($before) {
380 380
 					$this->schema_changes_before_migration();
381
-				}else{
381
+				} else {
382 382
 					$this->schema_changes_after_migration();
383 383
 				}
384 384
 				$output = ob_get_contents();
385 385
 				ob_end_clean();
386
-			}catch(Exception $e){
386
+			} catch (Exception $e) {
387 387
 				$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
388 388
 				throw $e;
389 389
 			}
390 390
 			//record that we've done these schema changes
391 391
 			$this->$property_name = true;
392 392
 			//if there were any warnings etc, record them as non-fatal errors
393
-			if( $output ){
393
+			if ($output) {
394 394
 				//there were some warnings
395 395
 				$this->_errors[] = $output;
396 396
 			}
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 	 * @param string $table_definition_sql
418 418
 	 * @param string $engine_string
419 419
 	 */
420
-	protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){
420
+	protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') {
421 421
 //		EEH_Debug_Tools::instance()->start_timer( '_table_is_new_in_this_version_' . $table_name );
422
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  true ) );
422
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(true));
423 423
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_is_new_in_this_version_' . $table_name  );
424 424
 	}
425 425
 
@@ -433,9 +433,9 @@  discard block
 block discarded – undo
433 433
 	 * @param string $table_definition_sql
434 434
 	 * @param string $engine_string
435 435
 	 */
436
-	protected function _table_is_changed_in_this_version($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
436
+	protected function _table_is_changed_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
437 437
 //		EEH_Debug_Tools::instance()->start_timer( '_table_is_changed_in_this_version' . $table_name );
438
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
438
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
439 439
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_is_changed_in_this_version' . $table_name  );
440 440
 	}
441 441
 
@@ -446,9 +446,9 @@  discard block
 block discarded – undo
446 446
 	 * @param string $table_name
447 447
 	 * @return boolean
448 448
 	 */
449
-	protected function _old_table_exists( $table_name ) {
450
-		EE_Registry::instance()->load_helper( 'Activation' );
451
-		return EEH_Activation::table_exists( $table_name );
449
+	protected function _old_table_exists($table_name) {
450
+		EE_Registry::instance()->load_helper('Activation');
451
+		return EEH_Activation::table_exists($table_name);
452 452
 	}
453 453
 
454 454
 
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
 	 * @param string $table_name
459 459
 	 * @return boolean
460 460
 	 */
461
-	protected function _delete_table_if_empty( $table_name ) {
462
-		EE_Registry::instance()->load_helper( 'Activation' );
463
-		return EEH_Activation::delete_db_table_if_empty( $table_name );
461
+	protected function _delete_table_if_empty($table_name) {
462
+		EE_Registry::instance()->load_helper('Activation');
463
+		return EEH_Activation::delete_db_table_if_empty($table_name);
464 464
 	}
465 465
 
466 466
 
@@ -479,9 +479,9 @@  discard block
 block discarded – undo
479 479
 	 * @param string $table_definition_sql
480 480
 	 * @param string $engine_string
481 481
 	 */
482
-	protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
482
+	protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
483 483
 //		EEH_Debug_Tools::instance()->start_timer( '_table_should_exist_previously' . $table_name );
484
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
484
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
485 485
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name );
486 486
 	}
487 487
 
@@ -496,13 +496,13 @@  discard block
 block discarded – undo
496 496
 	 * @param string $table_definition_sql
497 497
 	 * @param string $engine_string
498 498
 	 */
499
-	protected function _table_has_not_changed_since_previous( $table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
500
-		if( $this->_currently_migrating() ) {
499
+	protected function _table_has_not_changed_since_previous($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
500
+		if ($this->_currently_migrating()) {
501 501
 			//if we're doing a migration, and this table apparently already exists, then we don't need do anything right?
502 502
 //			EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name );
503 503
 			return;
504 504
 		}
505
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
505
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
506 506
 	}
507 507
 
508 508
 	/**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 	protected function _currently_migrating() {
513 513
 		//we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM)
514 514
 		return $this->_migrating &&
515
-					$this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) &&
515
+					$this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) &&
516 516
 					EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance;
517 517
 	}
518 518
 
@@ -523,17 +523,17 @@  discard block
 block discarded – undo
523 523
 	 * @param boolean $table_is_new
524 524
 	 * @return boolean
525 525
 	 */
526
-	protected function _pre_existing_table_should_be_dropped( $table_is_new ) {
527
-		if( $table_is_new ) {
528
-			if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation  || $this->_currently_migrating() ){
526
+	protected function _pre_existing_table_should_be_dropped($table_is_new) {
527
+		if ($table_is_new) {
528
+			if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating()) {
529 529
 				return true;
530
-			}else{
530
+			} else {
531 531
 				return false;
532 532
 			}
533
-		}else{
534
-			if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){
533
+		} else {
534
+			if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) {
535 535
 				return true;
536
-			}else{
536
+			} else {
537 537
 				return false;
538 538
 			}
539 539
 		}
@@ -546,13 +546,13 @@  discard block
 block discarded – undo
546 546
 	 * @param string $engine_string
547 547
 	 * @param boolean $drop_pre_existing_tables
548 548
 	 */
549
-	private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){
549
+	private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) {
550 550
 		EE_Registry::instance()->load_helper('Activation');
551
-		try{
552
-			EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables);
553
-		}catch( EE_Error $e ) {
554
-			$message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString();
555
-			$this->add_error( $message  );
551
+		try {
552
+			EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables);
553
+		} catch (EE_Error $e) {
554
+			$message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString();
555
+			$this->add_error($message);
556 556
 			$this->_feedback_message .= $message;
557 557
 		}
558 558
 	}
@@ -564,15 +564,15 @@  discard block
 block discarded – undo
564 564
 	 * @return int one of EE_System::_req_type_* constants
565 565
 	 * @throws EE_Error
566 566
 	 */
567
-	private function _get_req_type_for_plugin_corresponding_to_this_dms(){
568
-		if($this->slug() == 'Core'){
567
+	private function _get_req_type_for_plugin_corresponding_to_this_dms() {
568
+		if ($this->slug() == 'Core') {
569 569
 			return EE_System::instance()->detect_req_type();
570
-		}else{//it must be for an addon
570
+		} else {//it must be for an addon
571 571
 			$addon_name = $this->slug();
572
-			if( EE_Registry::instance()->get_addon_by_name($addon_name)){
572
+			if (EE_Registry::instance()->get_addon_by_name($addon_name)) {
573 573
 				return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type();
574
-			}else{
575
-				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ;
574
+			} else {
575
+				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name()))));
576 576
 			}
577 577
 		}
578 578
 	}
@@ -583,13 +583,13 @@  discard block
 block discarded – undo
583 583
 	 * returns an array of strings describing errors by all the script's stages
584 584
 	 * @return array
585 585
 	 */
586
-	public function get_errors(){
586
+	public function get_errors() {
587 587
 		$all_errors = $this->_errors;
588
-		if( ! is_array($all_errors)){
588
+		if ( ! is_array($all_errors)) {
589 589
 			$all_errors = array();
590 590
 		}
591
-		foreach($this->stages() as $stage){
592
-			$all_errors = array_merge($stage->get_errors(),$all_errors);
591
+		foreach ($this->stages() as $stage) {
592
+			$all_errors = array_merge($stage->get_errors(), $all_errors);
593 593
 		}
594 594
 		return $all_errors;
595 595
 	}
@@ -600,8 +600,8 @@  discard block
 block discarded – undo
600 600
 	 * Indicates whether or not this migration script should continue
601 601
 	 * @return boolean
602 602
 	 */
603
-	public function can_continue(){
604
-		return in_array($this->get_status(),  EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
603
+	public function can_continue() {
604
+		return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
605 605
 	}
606 606
 
607 607
 
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 	 * get ordered by the indexes
614 614
 	 * @return EE_Data_Migration_Script_Stage[]
615 615
 	 */
616
-	protected function stages(){
617
-		$stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages );
616
+	protected function stages() {
617
+		$stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages);
618 618
 		ksort($stages);
619 619
 		return $stages;
620 620
 	}
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 	 * can be displayed to the user
627 627
 	 * @return string
628 628
 	 */
629
-	public function get_feedback_message(){
629
+	public function get_feedback_message() {
630 630
 		return $this->_feedback_message;
631 631
 	}
632 632
 
@@ -638,16 +638,16 @@  discard block
 block discarded – undo
638 638
 	 * possible that this class is defined when it goes to sleep, but NOT available when it
639 639
 	 * awakes (eg, this class is part of an addon that is deactivated at some point).
640 640
 	 */
641
-	public function properties_as_array(){
641
+	public function properties_as_array() {
642 642
 		$properties = parent::properties_as_array();
643 643
 		$properties['_migration_stages'] = array();
644
-		foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){
644
+		foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) {
645 645
 			$properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array();
646 646
 		}
647 647
 		unset($properties['_mappings']);
648 648
 
649
-		foreach($this->_mappings as $old_table_name => $mapping_to_new_table){
650
-			foreach($mapping_to_new_table as $new_table_name => $mapping){
649
+		foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) {
650
+			foreach ($mapping_to_new_table as $new_table_name => $mapping) {
651 651
 				$this->_set_mapping_option($old_table_name, $new_table_name, $mapping);
652 652
 			}
653 653
 		}
@@ -662,19 +662,19 @@  discard block
 block discarded – undo
662 662
 	 * @param array $array_of_properties like what's produced from properties_as_array() method
663 663
 	 * @return void
664 664
 	 */
665
-	public function instantiate_from_array_of_properties($array_of_properties){
665
+	public function instantiate_from_array_of_properties($array_of_properties) {
666 666
 		$stages_properties_arrays = $array_of_properties['_migration_stages'];
667 667
 		unset($array_of_properties['_migration_stages']);
668 668
 		unset($array_of_properties['class']);
669
-		foreach($array_of_properties as $property_name => $property_value){
669
+		foreach ($array_of_properties as $property_name => $property_value) {
670 670
 			$this->$property_name = $property_value;
671 671
 		}
672 672
 		//_migration_stages are already instantiated, but have only default data
673
-		foreach($this->_migration_stages as $stage){
674
-			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays);
673
+		foreach ($this->_migration_stages as $stage) {
674
+			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays);
675 675
 			//SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by
676 676
 			//an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet)
677
-			if($stage_data){
677
+			if ($stage_data) {
678 678
 				$stage->instantiate_from_array_of_properties($stage_data);
679 679
 			}
680 680
 		}
@@ -690,9 +690,9 @@  discard block
 block discarded – undo
690 690
 	 * @param array $migration_stage_data_arrays
691 691
 	 * @return null
692 692
 	 */
693
-	private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){
694
-		foreach($migration_stage_data_arrays as $migration_stage_data_array){
695
-			if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){
693
+	private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) {
694
+		foreach ($migration_stage_data_arrays as $migration_stage_data_array) {
695
+			if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) {
696 696
 				return $migration_stage_data_array;
697 697
 			}
698 698
 		}
@@ -708,8 +708,8 @@  discard block
 block discarded – undo
708 708
 	 * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin
709 709
 	 * that will be updated to. Eg array('Core','4.1.0')
710 710
 	 */
711
-	public final function migrates_to_version(){
712
-		return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) );
711
+	public final function migrates_to_version() {
712
+		return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
713 713
 	}
714 714
 
715 715
 
@@ -721,10 +721,10 @@  discard block
 block discarded – undo
721 721
 	 * Or 'Core' for core (non-addon).
722 722
 	 * @return string
723 723
 	 */
724
-	public function slug(){
724
+	public function slug() {
725 725
 		$migrates_to_version_info = $this->migrates_to_version();
726 726
 		//the slug is the first part of the array
727
-		return $migrates_to_version_info[ 'slug' ];
727
+		return $migrates_to_version_info['slug'];
728 728
 	}
729 729
 
730 730
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 	 * the database up so it can run), then you can set "A" to priority 3 or something.
739 739
 	 * @return int
740 740
 	 */
741
-	public function priority(){
741
+	public function priority() {
742 742
 		return $this->_priority;
743 743
 	}
744 744
 
@@ -751,18 +751,18 @@  discard block
 block discarded – undo
751 751
 	 * @param boolean $migrating
752 752
 	 * @return void
753 753
 	 */
754
-	public function set_migrating( $migrating = TRUE ){
754
+	public function set_migrating($migrating = TRUE) {
755 755
 		$this->_migrating = $migrating;
756 756
 	}
757 757
 
758 758
 	/**
759 759
 	 * Marks that we think this migration class can continue to migrate
760 760
 	 */
761
-	public function reattempt(){
761
+	public function reattempt() {
762 762
 		parent::reattempt();
763 763
 		//also, we want to reattempt any stages that were marked as borked
764
-		foreach( $this->stages() as $stage ) {
765
-			if( $stage->is_broken() ) {
764
+		foreach ($this->stages() as $stage) {
765
+			if ($stage->is_broken()) {
766 766
 				$stage->reattempt();
767 767
 			}
768 768
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Script_Stage.core.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * _migration_step() (ie, it its a count of rows in the old attendees table in _count_records_to_migrate(), it should also be OLD attendee rows migrated
35 35
  * on each call to _migration_step().
36 36
  */
37
-abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base{
37
+abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base {
38 38
 	/**
39 39
 	 * The migration script this is a stage of
40 40
 	 * @var EE_Data_Migration_Script_Base
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * called by EE_Data_Migration_Script_Base's __construct() method so children don't have to
48 48
 	 * @param EE_Data_Migration_Script_Base $migration_script
49 49
 	 */
50
-	public function _construct_finalize($migration_script){
50
+	public function _construct_finalize($migration_script) {
51 51
 		$this->_migration_script = $migration_script;
52 52
 	}
53 53
 
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
 	 * @param int $num_items_to_migrate
59 59
 	 * @return int
60 60
 	 */
61
-	public function migration_step($num_items_to_migrate=50){
61
+	public function migration_step($num_items_to_migrate = 50) {
62 62
 		//before we run the migration step, we want ot take note of warnings that get outputted
63 63
 		ob_start();
64 64
 		$items_migrated = $this->_migration_step($num_items_to_migrate);
65 65
 		$output = ob_get_contents();
66 66
 		ob_end_clean();
67
-		if( $output ){
67
+		if ($output) {
68 68
 			$this->add_error($output);
69 69
 		}
70 70
 		$this->_records_migrated += $items_migrated;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @param int $num_items_to_migrate
83 83
 	 * @return int number of items ACTUALLY migrated
84 84
 	 */
85
-	abstract protected function _migration_step($num_items_to_migrate=50);
85
+	abstract protected function _migration_step($num_items_to_migrate = 50);
86 86
 
87 87
 	/**
88 88
 	 * Counts the records that have been migrated so far
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * returns an array of strings describing errors
97 97
 	 * @return array
98 98
 	 */
99
-	public function get_errors(){
99
+	public function get_errors() {
100 100
 		return $this->_errors;
101 101
 	}
102 102
 
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 	 * to have been made from the properties_as_array() function.
107 107
 	 * @param array $array_of_properties like what's produced from properties_as_array() method
108 108
 	 */
109
-	public function instantiate_from_array_of_properties($array_of_properties){
109
+	public function instantiate_from_array_of_properties($array_of_properties) {
110 110
 		unset($array_of_properties['class']);
111
-		foreach($array_of_properties as $property_name => $property_value){
111
+		foreach ($array_of_properties as $property_name => $property_value) {
112 112
 			$this->$property_name = $property_value;
113 113
 		}
114 114
 	}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * Gets the script this is a stage of
118 118
 	 * @return EE_Data_Migration_Script_Base
119 119
 	 */
120
-	protected function get_migration_script(){
120
+	protected function get_migration_script() {
121 121
 		return $this->_migration_script;
122 122
 	}
123 123
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Script_Stage_Table.core.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
 	protected $_old_table;
22 22
 
23 23
 /**
24
-	 * Set in the constructor to add this sql to both the counting query in
25
-	 * EE_Data_Migration_Script_Stage_Table::_count_records_to_migrate() and
26
-	 * EE_Data_Migration_Script_Stage_Table::_get_rows().
27
-	 * Eg "where column_name like '%some_value%'"
28
-	 * @var string
29
-	 */
24
+ * Set in the constructor to add this sql to both the counting query in
25
+ * EE_Data_Migration_Script_Stage_Table::_count_records_to_migrate() and
26
+ * EE_Data_Migration_Script_Stage_Table::_get_rows().
27
+ * Eg "where column_name like '%some_value%'"
28
+ * @var string
29
+ */
30 30
 	protected $_extra_where_sql;
31 31
 
32 32
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	 * @param int $num_items
42 42
 	 * @return int number of items ACTUALLY migrated
43 43
 	 */
44
-	function _migration_step($num_items=50){
45
-		$rows = $this->_get_rows( $num_items );
44
+	function _migration_step($num_items = 50) {
45
+		$rows = $this->_get_rows($num_items);
46 46
 		$items_actually_migrated = 0;
47
-		foreach($rows as $old_row){
47
+		foreach ($rows as $old_row) {
48 48
 			$this->_migrate_old_row($old_row);
49 49
 			$items_actually_migrated++;
50 50
 		}
51
-		if($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()){
51
+		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
52 52
 			$this->set_completed();
53 53
 		}
54 54
 		return $items_actually_migrated;
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 	 * @param int $limit
61 61
 	 * @return array of arrays like $wpdb->get_results($sql, ARRAY_A)
62 62
 	 */
63
-	protected function _get_rows( $limit ){
63
+	protected function _get_rows($limit) {
64 64
 		global $wpdb;
65 65
 		$start_at_record = $this->count_records_migrated();
66
-		$query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare("LIMIT %d, %d",$start_at_record,$limit);
67
-		return $wpdb->get_results($query,ARRAY_A);
66
+		$query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} ".$wpdb->prepare("LIMIT %d, %d", $start_at_record, $limit);
67
+		return $wpdb->get_results($query, ARRAY_A);
68 68
 	}
69 69
 
70 70
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	function _count_records_to_migrate() {
77 77
 		global $wpdb;
78
-		$query =  "SELECT COUNT(*) FROM {$this->_old_table} {$this->_extra_where_sql}";
79
-		$count = $wpdb->get_var( $query );
78
+		$query = "SELECT COUNT(*) FROM {$this->_old_table} {$this->_extra_where_sql}";
79
+		$count = $wpdb->get_var($query);
80 80
 		return $count;
81 81
 	}
82 82
 
Please login to merge, or discard this patch.
core/db_classes/EE_Event_Message_Template.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
  * Contains definition for EE_Event_Message_Template model object
4 6
  * @package 		Event Espresso
Please login to merge, or discard this patch.
core/db_classes/EE_Event_Question_Group.class.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Required  by EEM_Event_Question_Group in case someone queries for all its model objects
6 6
  */
7
-class EE_Event_Question_Group extends EE_Base_Class{
7
+class EE_Event_Question_Group extends EE_Base_Class {
8 8
 
9 9
 	/**
10 10
 	 * @param array $props_n_values
11 11
 	 * @return EE_Event_Question_Group|mixed
12 12
 	 */
13
-	public static function new_instance( $props_n_values = array() ) {
14
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
15
-		return $has_object ? $has_object : new self( $props_n_values);
13
+	public static function new_instance($props_n_values = array()) {
14
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
15
+		return $has_object ? $has_object : new self($props_n_values);
16 16
 	}
17 17
 
18 18
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @param array $props_n_values
22 22
 	 * @return EE_Event_Question_Group
23 23
 	 */
24
-	public static function new_instance_from_db ( $props_n_values = array() ) {
25
-		return new self( $props_n_values, TRUE );
24
+	public static function new_instance_from_db($props_n_values = array()) {
25
+		return new self($props_n_values, TRUE);
26 26
 	}
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_classes/EE_Event_Venue.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * Required  by EEM_Event_Question_Group in case someone queries for all its model objects
4 4
  */
5
-class EE_Event_Venue extends EE_Base_Class{
5
+class EE_Event_Venue extends EE_Base_Class {
6 6
 
7 7
 	/**
8 8
 	 * @param array $props_n_values
9 9
 	 * @return EE_Event_Venue|mixed
10 10
 	 */
11
-	public static function new_instance( $props_n_values = array() ) {
12
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
13
-		return $has_object ? $has_object : new self( $props_n_values);
11
+	public static function new_instance($props_n_values = array()) {
12
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
13
+		return $has_object ? $has_object : new self($props_n_values);
14 14
 	}
15 15
 
16 16
 
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 	 * @param array $props_n_values
20 20
 	 * @return EE_Event_Venue
21 21
 	 */
22
-	public static function new_instance_from_db ( $props_n_values = array() ) {
23
-		return new self( $props_n_values, TRUE );
22
+	public static function new_instance_from_db($props_n_values = array()) {
23
+		return new self($props_n_values, TRUE);
24 24
 	}
25 25
 
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_classes/EE_Question_Group_Question.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * Required  by EEM_Question_Group_Question in case someone queries for all its model objects
4 4
  */
5
-class EE_Question_Group_Question extends EE_Base_Class{
5
+class EE_Question_Group_Question extends EE_Base_Class {
6 6
 
7 7
 	/**
8 8
 	 * @param array $props_n_values
9 9
 	 * @return EE_Question_Group_Question|mixed
10 10
 	 */
11
-	public static function new_instance( $props_n_values = array() ) {
12
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
13
-		return $has_object ? $has_object : new self( $props_n_values );
11
+	public static function new_instance($props_n_values = array()) {
12
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
13
+		return $has_object ? $has_object : new self($props_n_values);
14 14
 	}
15 15
 
16 16
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @param array $props_n_values
20 20
 	 * @return EE_Question_Group_Question
21 21
 	 */
22
-	public static function new_instance_from_db ( $props_n_values = array() ) {
23
-		return new self( $props_n_values, TRUE );
22
+	public static function new_instance_from_db($props_n_values = array()) {
23
+		return new self($props_n_values, TRUE);
24 24
 	}
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_classes/EE_Registration.class.php 4 patches
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * EE_Registration class
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 *                             		    date_format and the second value is the time format
42 42
 	 * @return EE_Registration
43 43
 	 */
44
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
45
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
46
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
44
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
45
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
46
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
47 47
 	}
48 48
 
49 49
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 *                          		the website will be used.
55 55
 	 * @return EE_Registration
56 56
 	 */
57
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
58
-		return new self( $props_n_values, TRUE, $timezone );
57
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
58
+		return new self($props_n_values, TRUE, $timezone);
59 59
 	}
60 60
 
61 61
 
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @access        public
67 67
 	 * @param        int $EVT_ID Event ID
68 68
 	 */
69
-	public function set_event( $EVT_ID = 0 ) {
70
-		$this->set( 'EVT_ID', $EVT_ID );
69
+	public function set_event($EVT_ID = 0) {
70
+		$this->set('EVT_ID', $EVT_ID);
71 71
 	}
72 72
 
73 73
 
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
 	 * @param mixed  $field_value
79 79
 	 * @param bool   $use_default
80 80
 	 */
81
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
82
-		switch( $field_name ) {
81
+	public function set($field_name, $field_value, $use_default = FALSE) {
82
+		switch ($field_name) {
83 83
 			case 'REG_code' :
84
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
85
-					$this->set_reg_code( $field_value, $use_default );
84
+				if ( ! empty($field_value) && $this->reg_code() == '') {
85
+					$this->set_reg_code($field_value, $use_default);
86 86
 				}
87 87
 				break;
88 88
 			case 'STS_ID' :
89
-				$this->set_status( $field_value, $use_default );
89
+				$this->set_status($field_value, $use_default);
90 90
 				break;
91 91
 			default :
92
-				parent::set( $field_name, $field_value, $use_default );
92
+				parent::set($field_name, $field_value, $use_default);
93 93
 		}
94 94
 	}
95 95
 
@@ -106,30 +106,30 @@  discard block
 block discarded – undo
106 106
 	 * @param boolean $use_default
107 107
 	 * @return bool
108 108
 	 */
109
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
109
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
110 110
 		// get current REG_Status
111 111
 		$old_STS_ID = $this->status_ID();
112 112
 		// if status has changed
113
-		if ( $old_STS_ID != $new_STS_ID  ) {
113
+		if ($old_STS_ID != $new_STS_ID) {
114 114
 			// TO approved
115
-			if ( $new_STS_ID == EEM_Registration::status_id_approved ) {
115
+			if ($new_STS_ID == EEM_Registration::status_id_approved) {
116 116
 				// reserve a space by incrementing ticket and datetime sold values
117 117
 				$this->_reserve_registration_space();
118
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
118
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
119 119
 			// OR FROM  approved
120
-			} else if ( $old_STS_ID == EEM_Registration::status_id_approved ) {
120
+			} else if ($old_STS_ID == EEM_Registration::status_id_approved) {
121 121
 				// release a space by decrementing ticket and datetime sold values
122 122
 				$this->_release_registration_space();
123
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
123
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
124 124
 			}
125 125
 			// update status
126
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
127
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
126
+			parent::set('STS_ID', $new_STS_ID, $use_default);
127
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
128 128
 			return TRUE;
129
-		}else{
129
+		} else {
130 130
 			//even though the old value matches the new value, it's still good to
131 131
 			//allow the parent set method to have a say
132
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
132
+			parent::set('STS_ID', $new_STS_ID, $use_default);
133 133
 			return TRUE;
134 134
 		}
135 135
 	}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @access        public
142 142
 	 */
143 143
 	public function status_ID() {
144
-		return $this->get( 'STS_ID' );
144
+		return $this->get('STS_ID');
145 145
 	}
146 146
 
147 147
 
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 		$ticket->increase_sold();
156 156
 		$ticket->save();
157 157
 		$datetimes = $ticket->datetimes();
158
-		if ( is_array( $datetimes ) ) {
159
-			foreach ( $datetimes as $datetime ) {
160
-				if ( $datetime instanceof EE_Datetime ) {
158
+		if (is_array($datetimes)) {
159
+			foreach ($datetimes as $datetime) {
160
+				if ($datetime instanceof EE_Datetime) {
161 161
 					$datetime->increase_sold();
162 162
 					$datetime->save();
163 163
 				}
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
 	 * @param boolean $include_archived whether to include archived tickets or not.
176 176
 	 * @return EE_Ticket
177 177
 	 */
178
-	public function ticket( $include_archived = TRUE ) {
178
+	public function ticket($include_archived = TRUE) {
179 179
 		$query_params = array();
180
-		if ( $include_archived ) {
181
-			$query_params[ 'default_where_conditions' ] = 'none';
180
+		if ($include_archived) {
181
+			$query_params['default_where_conditions'] = 'none';
182 182
 		}
183
-		return $this->get_first_related( 'Ticket', $query_params );
183
+		return $this->get_first_related('Ticket', $query_params);
184 184
 	}
185 185
 
186 186
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 * @return EE_Event
191 191
 	 */
192 192
 	public function event() {
193
-		return $this->get_first_related( 'Event' );
193
+		return $this->get_first_related('Event');
194 194
 	}
195 195
 
196 196
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 */
205 205
 	public function wp_user() {
206 206
 		$event = $this->event();
207
-		if ( $event instanceof EE_Event ) {
207
+		if ($event instanceof EE_Event) {
208 208
 			return $event->wp_user();
209 209
 		}
210 210
 		return 0;
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 		$ticket->decrease_sold();
222 222
 		$ticket->save();
223 223
 		$datetimes = $ticket->datetimes();
224
-		if ( is_array( $datetimes ) ) {
225
-			foreach ( $datetimes as $datetime ) {
226
-				if ( $datetime instanceof EE_Datetime ) {
224
+		if (is_array($datetimes)) {
225
+			foreach ($datetimes as $datetime) {
226
+				if ($datetime instanceof EE_Datetime) {
227 227
 					$datetime->decrease_sold();
228 228
 					$datetime->save();
229 229
 				}
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 * @access        public
240 240
 	 * @param        int $ATT_ID Attendee ID
241 241
 	 */
242
-	public function set_attendee_id( $ATT_ID = 0 ) {
243
-		$this->set( 'ATT_ID', $ATT_ID );
242
+	public function set_attendee_id($ATT_ID = 0) {
243
+		$this->set('ATT_ID', $ATT_ID);
244 244
 	}
245 245
 
246 246
 
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
 	 * @access        public
252 252
 	 * @param        int $TXN_ID Transaction ID
253 253
 	 */
254
-	public function set_transaction_id( $TXN_ID = 0 ) {
255
-		$this->set( 'TXN_ID', $TXN_ID );
254
+	public function set_transaction_id($TXN_ID = 0) {
255
+		$this->set('TXN_ID', $TXN_ID);
256 256
 	}
257 257
 
258 258
 
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 	 * @access    public
264 264
 	 * @param    string $REG_session PHP Session ID
265 265
 	 */
266
-	public function set_session( $REG_session = '' ) {
267
-		$this->set( 'REG_session', $REG_session );
266
+	public function set_session($REG_session = '') {
267
+		$this->set('REG_session', $REG_session);
268 268
 	}
269 269
 
270 270
 
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
 	 * @access    public
276 276
 	 * @param    string $REG_url_link Registration URL Link
277 277
 	 */
278
-	public function set_reg_url_link( $REG_url_link = '' ) {
279
-		$this->set( 'REG_url_link', $REG_url_link );
278
+	public function set_reg_url_link($REG_url_link = '') {
279
+		$this->set('REG_url_link', $REG_url_link);
280 280
 	}
281 281
 
282 282
 
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	 * @access        public
288 288
 	 * @param        int $REG_count Primary Attendee
289 289
 	 */
290
-	public function set_count( $REG_count = 1 ) {
291
-		$this->set( 'REG_count', $REG_count );
290
+	public function set_count($REG_count = 1) {
291
+		$this->set('REG_count', $REG_count);
292 292
 	}
293 293
 
294 294
 
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	 * @access        public
300 300
 	 * @param        boolean $REG_group_size Group Registration
301 301
 	 */
302
-	public function set_group_size( $REG_group_size = FALSE ) {
303
-		$this->set( 'REG_group_size', $REG_group_size );
302
+	public function set_group_size($REG_group_size = FALSE) {
303
+		$this->set('REG_group_size', $REG_group_size);
304 304
 	}
305 305
 
306 306
 
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
 	 * @access        public
384 384
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
385 385
 	 */
386
-	public function set_reg_date( $REG_date = FALSE ) {
387
-		$this->set( 'REG_date', $REG_date );
386
+	public function set_reg_date($REG_date = FALSE) {
387
+		$this->set('REG_date', $REG_date);
388 388
 	}
389 389
 
390 390
 
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 	 * @access    public
396 396
 	 * @param    float $REG_final_price
397 397
 	 */
398
-	public function set_final_price( $REG_final_price = 0.00 ) {
399
-		$this->set( 'REG_final_price', $REG_final_price );
398
+	public function set_final_price($REG_final_price = 0.00) {
399
+		$this->set('REG_final_price', $REG_final_price);
400 400
 	}
401 401
 
402 402
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 	 * @access    public
408 408
 	 * @param    float $REG_paid
409 409
 	 */
410
-	public function set_paid( $REG_paid = 0.00 ) {
411
-		$this->set( 'REG_paid', $REG_paid );
410
+	public function set_paid($REG_paid = 0.00) {
411
+		$this->set('REG_paid', $REG_paid);
412 412
 	}
413 413
 
414 414
 
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 	 * @access        public
420 420
 	 * @param        boolean $REG_att_is_going Attendee Is Going
421 421
 	 */
422
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
423
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
422
+	public function set_att_is_going($REG_att_is_going = FALSE) {
423
+		$this->set('REG_att_is_going', $REG_att_is_going);
424 424
 	}
425 425
 
426 426
 
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 	 * @return EE_Attendee
431 431
 	 */
432 432
 	public function attendee() {
433
-		return $this->get_first_related( 'Attendee' );
433
+		return $this->get_first_related('Attendee');
434 434
 	}
435 435
 
436 436
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @access        public
441 441
 	 */
442 442
 	public function event_ID() {
443
-		return $this->get( 'EVT_ID' );
443
+		return $this->get('EVT_ID');
444 444
 	}
445 445
 
446 446
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	public function event_name() {
453 453
 		$event = $this->event_obj();
454
-		if ( $event ) {
454
+		if ($event) {
455 455
 			return $event->name();
456 456
 		} else {
457 457
 			return NULL;
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	 * @return EE_Event
466 466
 	 */
467 467
 	public function event_obj() {
468
-		return $this->get_first_related( 'Event' );
468
+		return $this->get_first_related('Event');
469 469
 	}
470 470
 
471 471
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	 * @access        public
476 476
 	 */
477 477
 	public function attendee_ID() {
478
-		return $this->get( 'ATT_ID' );
478
+		return $this->get('ATT_ID');
479 479
 	}
480 480
 
481 481
 
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 	 * @access        public
486 486
 	 */
487 487
 	public function session_ID() {
488
-		return $this->get( 'REG_session' );
488
+		return $this->get('REG_session');
489 489
 	}
490 490
 
491 491
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
496 496
 	 * @return string
497 497
 	 */
498
-	public function receipt_url( $messenger = 'html' ) {
498
+	public function receipt_url($messenger = 'html') {
499 499
 
500 500
 		/**
501 501
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -504,12 +504,12 @@  discard block
 block discarded – undo
504 504
 		 */
505 505
 		EE_Registry::instance()->load_helper('Template');
506 506
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
507
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
507
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
508 508
 
509
-		if ( $has_custom ) {
510
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
509
+		if ($has_custom) {
510
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
511 511
 		}
512
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
512
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
513 513
 	}
514 514
 
515 515
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
521 521
 	 * @return string
522 522
 	 */
523
-	public function invoice_url( $messenger = 'html' ) {
523
+	public function invoice_url($messenger = 'html') {
524 524
 		/**
525 525
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
526 526
 		 *
@@ -528,21 +528,21 @@  discard block
 block discarded – undo
528 528
 		 */
529 529
 		EE_Registry::instance()->load_helper('Template');
530 530
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
531
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
531
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
532 532
 
533
-		if ( $has_custom ) {
534
-			if ( $messenger == 'html' ) {
535
-				return $this->invoice_url( 'launch' );
533
+		if ($has_custom) {
534
+			if ($messenger == 'html') {
535
+				return $this->invoice_url('launch');
536 536
 			}
537 537
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
538 538
 
539
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
540
-			if ( $messenger == 'html' ) {
539
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
540
+			if ($messenger == 'html') {
541 541
 				$query_args['html'] = TRUE;
542 542
 			}
543
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
543
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
544 544
 		}
545
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
545
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
546 546
 	}
547 547
 
548 548
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	 * @access        public
553 553
 	 */
554 554
 	public function reg_url_link() {
555
-		return $this->get( 'REG_url_link' );
555
+		return $this->get('REG_url_link');
556 556
 	}
557 557
 
558 558
 
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
563 563
 	 * @return void
564 564
 	 */
565
-	public function e_invoice_url( $type = 'launch' ) {
566
-		echo $this->invoice_url( $type );
565
+	public function e_invoice_url($type = 'launch') {
566
+		echo $this->invoice_url($type);
567 567
 	}
568 568
 
569 569
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 	 * @return string
584 584
 	 */
585 585
 	public function payment_overview_url() {
586
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
586
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
587 587
 	}
588 588
 
589 589
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 	 * @return string
595 595
 	 */
596 596
 	public function edit_attendee_information_url() {
597
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
597
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
598 598
 	}
599 599
 
600 600
 
@@ -604,8 +604,8 @@  discard block
 block discarded – undo
604 604
 	 * @return string
605 605
 	 */
606 606
 	public function get_admin_edit_url() {
607
-		EE_Registry::instance()->load_helper( 'URL' );
608
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
607
+		EE_Registry::instance()->load_helper('URL');
608
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
609 609
 	}
610 610
 
611 611
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @access        public
616 616
 	 */
617 617
 	public function is_primary_registrant() {
618
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
618
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
619 619
 	}
620 620
 
621 621
 
@@ -624,12 +624,12 @@  discard block
 block discarded – undo
624 624
 	 * This returns the primary registration object for this registration group (which may be this object).
625 625
 	 * @return EE_Registration
626 626
 	 */
627
-	public function get_primary_registration()  {
628
-		if ( $this->is_primary_registrant() )
627
+	public function get_primary_registration() {
628
+		if ($this->is_primary_registrant())
629 629
 			return $this;
630 630
 
631 631
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
632
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
632
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
633 633
 		return $primary_registrant;
634 634
 	}
635 635
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	* 		@access		public
641 641
 	*/
642 642
 	public function count() {
643
-		return $this->get( 'REG_count' );
643
+		return $this->get('REG_count');
644 644
 	}
645 645
 
646 646
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 * @access        public
651 651
 	 */
652 652
 	public function group_size() {
653
-		return $this->get( 'REG_group_size' );
653
+		return $this->get('REG_group_size');
654 654
 	}
655 655
 
656 656
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	 * @access        public
661 661
 	 */
662 662
 	public function date() {
663
-		return $this->get( 'REG_date' );
663
+		return $this->get('REG_date');
664 664
 	}
665 665
 
666 666
 
@@ -671,8 +671,8 @@  discard block
 block discarded – undo
671 671
 	 * @param string $time_format
672 672
 	 * @return string
673 673
 	 */
674
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
675
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
674
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
675
+		return $this->get_datetime('REG_date', $date_format, $time_format);
676 676
 	}
677 677
 
678 678
 
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	 * @return    float
686 686
 	 */
687 687
 	public function final_price() {
688
-		return $this->get( 'REG_final_price' );
688
+		return $this->get('REG_final_price');
689 689
 	}
690 690
 
691 691
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 	 * @return string
697 697
 	 */
698 698
 	public function pretty_final_price() {
699
-		return $this->get_pretty( 'REG_final_price' );
699
+		return $this->get_pretty('REG_final_price');
700 700
 	}
701 701
 
702 702
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 * @return 	float
708 708
 	 */
709 709
 	public function paid() {
710
-		return $this->get( 'REG_paid' );
710
+		return $this->get('REG_paid');
711 711
 	}
712 712
 
713 713
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 	 * @return 	float
719 719
 	 */
720 720
 	public function pretty_paid() {
721
-		return $this->get_pretty( 'REG_paid' );
721
+		return $this->get_pretty('REG_paid');
722 722
 	}
723 723
 
724 724
 
@@ -730,11 +730,11 @@  discard block
 block discarded – undo
730 730
 	 * @param array $requires_payment
731 731
 	 * @return bool
732 732
 	 */
733
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
733
+	public function owes_monies_and_can_pay($requires_payment = array()) {
734 734
 		// these reg statuses require payment (if event is not free)
735
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
735
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
736 736
 		if (
737
-			in_array( $this->status_ID(), $requires_payment ) &&
737
+			in_array($this->status_ID(), $requires_payment) &&
738 738
 			$this->final_price() != 0 &&
739 739
 			$this->final_price() != $this->paid()
740 740
 		) {
@@ -751,8 +751,8 @@  discard block
 block discarded – undo
751 751
 	 * @param bool $show_icons
752 752
 	 * @return void
753 753
 	 */
754
-	public function e_pretty_status( $show_icons = FALSE ) {
755
-		echo $this->pretty_status( $show_icons );
754
+	public function e_pretty_status($show_icons = FALSE) {
755
+		echo $this->pretty_status($show_icons);
756 756
 	}
757 757
 
758 758
 
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
 	 * @param bool $show_icons
764 764
 	 * @return string
765 765
 	 */
766
-	public function pretty_status( $show_icons = FALSE ) {
767
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
766
+	public function pretty_status($show_icons = FALSE) {
767
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
768 768
 		$icon = '';
769
-		switch ( $this->status_ID() ) {
769
+		switch ($this->status_ID()) {
770 770
 			case EEM_Registration::status_id_approved:
771 771
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
772 772
 				break;
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 				$icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : '';
787 787
 				break;
788 788
 		}
789
-		return $icon . $status[ $this->status_ID() ];
789
+		return $icon.$status[$this->status_ID()];
790 790
 	}
791 791
 
792 792
 
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	 * @access        public
797 797
 	 */
798 798
 	public function att_is_going() {
799
-		return $this->get( 'REG_att_is_going' );
799
+		return $this->get('REG_att_is_going');
800 800
 	}
801 801
 
802 802
 
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
 	 * @param array $query_params like EEM_Base::get_all
807 807
 	 * @return EE_Answer[]
808 808
 	 */
809
-	public function answers( $query_params = NULL ) {
810
-		return $this->get_many_related( 'Answer', $query_params );
809
+	public function answers($query_params = NULL) {
810
+		return $this->get_many_related('Answer', $query_params);
811 811
 	}
812 812
 
813 813
 
@@ -821,9 +821,9 @@  discard block
 block discarded – undo
821 821
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
822 822
 	 * will convert it into some kind of string)
823 823
 	 */
824
-	public function answer_value_to_question( $question, $pretty_value=true ) {
824
+	public function answer_value_to_question($question, $pretty_value = true) {
825 825
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
826
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
826
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
827 827
 	}
828 828
 
829 829
 	/**
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 	 * @return string
833 833
 	 */
834 834
 	public function reg_date() {
835
-		return $this->get_datetime( 'REG_date' );
835
+		return $this->get_datetime('REG_date');
836 836
 	}
837 837
 
838 838
 
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 	 * @return EE_Datetime_Ticket
845 845
 	 */
846 846
 	public function datetime_ticket() {
847
-		return $this->get_first_related( 'Datetime_Ticket' );
847
+		return $this->get_first_related('Datetime_Ticket');
848 848
 	}
849 849
 
850 850
 
@@ -854,15 +854,15 @@  discard block
 block discarded – undo
854 854
 	 * @param EE_Datetime_Ticket $datetime_ticket
855 855
 	 * @return EE_Datetime_Ticket
856 856
 	 */
857
-	public function set_datetime_ticket( $datetime_ticket ) {
858
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
857
+	public function set_datetime_ticket($datetime_ticket) {
858
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
859 859
 	}
860 860
 	/**
861 861
 	 * Gets deleted
862 862
 	 * @return boolean
863 863
 	 */
864 864
 	public function deleted() {
865
-		return $this->get( 'REG_deleted' );
865
+		return $this->get('REG_deleted');
866 866
 	}
867 867
 
868 868
 	/**
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 	 * @return boolean
872 872
 	 */
873 873
 	public function set_deleted($deleted) {
874
-		$this->set( 'REG_deleted', $deleted );
874
+		$this->set('REG_deleted', $deleted);
875 875
 	}
876 876
 
877 877
 
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 	 * @return EE_Status
882 882
 	 */
883 883
 	public function status_obj() {
884
-		return $this->get_first_related( 'Status' );
884
+		return $this->get_first_related('Status');
885 885
 	}
886 886
 
887 887
 
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 	 * @return int
893 893
 	 */
894 894
 	public function count_checkins() {
895
-		return $this->get_model()->count_related( $this, 'Checkin' );
895
+		return $this->get_model()->count_related($this, 'Checkin');
896 896
 	}
897 897
 
898 898
 
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 	 * @return int
903 903
 	 */
904 904
 	public function count_checkins_not_checkedout() {
905
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
905
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
906 906
 	}
907 907
 
908 908
 
@@ -915,20 +915,20 @@  discard block
 block discarded – undo
915 915
 	 *
916 916
 	 * @return bool
917 917
 	 */
918
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
919
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
918
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
919
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
920 920
 
921 921
 		//first check registration status
922
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
922
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
923 923
 			return false;
924 924
 		}
925 925
 		//is there a datetime ticket that matches this dtt_ID?
926
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
926
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
927 927
 			return false;
928 928
 		}
929 929
 
930 930
 		//final check is against TKT_uses
931
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
931
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
932 932
 	}
933 933
 
934 934
 
@@ -941,10 +941,10 @@  discard block
 block discarded – undo
941 941
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
942 942
 	 * @return bool   true means can checkin.  false means cannot checkin.
943 943
 	 */
944
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
945
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
944
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
945
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
946 946
 
947
-		if ( ! $DTT_ID ) {
947
+		if ( ! $DTT_ID) {
948 948
 			return false;
949 949
 		}
950 950
 
@@ -952,23 +952,23 @@  discard block
 block discarded – undo
952 952
 
953 953
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
954 954
 		// or not.
955
-		if ( ! $max_uses || $max_uses === INF ) {
955
+		if ( ! $max_uses || $max_uses === INF) {
956 956
 			return true;
957 957
 		}
958 958
 
959 959
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
960 960
 		//go ahead and toggle.
961
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
961
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
962 962
 			return true;
963 963
 		}
964 964
 
965 965
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
966 966
 		//disallows further check-ins.
967
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
967
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
968 968
 		// checkins have already reached their max number of uses
969 969
 		// so registrant can NOT checkin
970
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
971
-			EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
970
+		if ($count_unique_dtt_checkins >= $max_uses) {
971
+			EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
972 972
 			return false;
973 973
 		}
974 974
 		return true;
@@ -989,15 +989,15 @@  discard block
 block discarded – undo
989 989
 	 * @param  bool $verify  If true then can_checkin() is used to verify whether the person can be checked in or not.  Otherwise this forces change in checkin status.
990 990
 	 * @return int|BOOL            the chk_in status toggled to OR false if nothing got changed.
991 991
 	 */
992
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
993
-		if ( empty( $DTT_ID ) ) {
992
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
993
+		if (empty($DTT_ID)) {
994 994
 			$datetime = $this->get_related_primary_datetime();
995 995
 			$DTT_ID = $datetime->ID();
996 996
 		// verify the registration can checkin for the given DTT_ID
997
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
997
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
998 998
 			EE_Error::add_error(
999 999
 					sprintf(
1000
-						__( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d),
1000
+						__('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d),
1001 1001
 						because the registration does not have access', 'event_espresso'),
1002 1002
 						$this->ID(),
1003 1003
 						$DTT_ID
@@ -1012,8 +1012,8 @@  discard block
 block discarded – undo
1012 1012
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1013 1013
 		);
1014 1014
 		//start by getting the current status so we know what status we'll be changing to.
1015
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1016
-		$status_to = $status_paths[ $cur_status ];
1015
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1016
+		$status_to = $status_paths[$cur_status];
1017 1017
 		// database only records true for checked IN or false for checked OUT
1018 1018
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1019 1019
 		$new_status = $status_to == EE_Registration::checkin_status_in ? true : false;
@@ -1021,24 +1021,24 @@  discard block
 block discarded – undo
1021 1021
 		// because we are keeping track of Check-ins over time.
1022 1022
 		// Eventually we'll probably want to show a list table
1023 1023
 		// for the individual Check-ins so that they can be managed.
1024
-		$checkin = EE_Checkin::new_instance( array(
1024
+		$checkin = EE_Checkin::new_instance(array(
1025 1025
 				'REG_ID' => $this->ID(),
1026 1026
 				'DTT_ID' => $DTT_ID,
1027 1027
 				'CHK_in' => $new_status
1028
-		) );
1028
+		));
1029 1029
 		// if the record could not be saved then return false
1030
-		if ( $checkin->save() === 0 ) {
1031
-			if ( WP_DEBUG ) {
1030
+		if ($checkin->save() === 0) {
1031
+			if (WP_DEBUG) {
1032 1032
 				global $wpdb;
1033 1033
 				$error = sprintf(
1034
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 	'event_espresso' ),
1034
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1035 1035
 					'<br />',
1036 1036
 					$wpdb->last_error
1037 1037
 				);
1038 1038
 			} else {
1039
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1039
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1040 1040
 			}
1041
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1041
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1042 1042
 			return false;
1043 1043
 		}
1044 1044
 		return $status_to;
@@ -1062,19 +1062,19 @@  discard block
 block discarded – undo
1062 1062
 	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1063 1063
 	 * @return int            Integer representing Check-in status.
1064 1064
 	 */
1065
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) {
1066
-		if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) {
1065
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) {
1066
+		if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) {
1067 1067
 			$datetime = $this->get_related_primary_datetime();
1068
-			if ( ! $datetime instanceof EE_Datetime ) {
1068
+			if ( ! $datetime instanceof EE_Datetime) {
1069 1069
 				return 0;
1070 1070
 			}
1071 1071
 			$DTT_ID = $datetime->ID();
1072 1072
 		//verify the registration can checkin for the given DTT_ID
1073 1073
 		}
1074 1074
 		//get checkin object (if exists)
1075
-		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) );
1076
-		if ( $checkin instanceof EE_Checkin ) {
1077
-			if ( $checkin->get( 'CHK_in' ) ) {
1075
+		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC')));
1076
+		if ($checkin instanceof EE_Checkin) {
1077
+			if ($checkin->get('CHK_in')) {
1078 1078
 				return EE_Registration::checkin_status_in; //checked in
1079 1079
 			} else {
1080 1080
 				return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1092,28 +1092,28 @@  discard block
 block discarded – undo
1092 1092
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
1093 1093
 	 * @return string         internationalized message
1094 1094
 	 */
1095
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1095
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1096 1096
 		//let's get the attendee first so we can include the name of the attendee
1097
-		$attendee = $this->get_first_related( 'Attendee' );
1098
-		if ( $attendee instanceof EE_Attendee ) {
1099
-			if ( $error ) {
1100
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1097
+		$attendee = $this->get_first_related('Attendee');
1098
+		if ($attendee instanceof EE_Attendee) {
1099
+			if ($error) {
1100
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1101 1101
 			}
1102
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1102
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1103 1103
 			//what is the status message going to be?
1104
-			switch ( $cur_status ) {
1104
+			switch ($cur_status) {
1105 1105
 				case EE_Registration::checkin_status_never :
1106
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1106
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1107 1107
 					break;
1108 1108
 				case EE_Registration::checkin_status_in :
1109
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1109
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1110 1110
 					break;
1111 1111
 				case EE_Registration::checkin_status_out :
1112
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1112
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1113 1113
 					break;
1114 1114
 			}
1115 1115
 		}
1116
-		return __( "The check-in status could not be determined.", "event_espresso" );
1116
+		return __("The check-in status could not be determined.", "event_espresso");
1117 1117
 	}
1118 1118
 
1119 1119
 
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
 	 * @return EE_Transaction
1124 1124
 	 */
1125 1125
 	public function transaction() {
1126
-		return $this->get_first_related( 'Transaction' );
1126
+		return $this->get_first_related('Transaction');
1127 1127
 	}
1128 1128
 
1129 1129
 
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 	 * @access        public
1135 1135
 	 */
1136 1136
 	public function reg_code() {
1137
-		return $this->get( 'REG_code' );
1137
+		return $this->get('REG_code');
1138 1138
 	}
1139 1139
 
1140 1140
 
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 	 * @access        public
1145 1145
 	 */
1146 1146
 	public function transaction_ID() {
1147
-		return $this->get( 'TXN_ID' );
1147
+		return $this->get('TXN_ID');
1148 1148
 	}
1149 1149
 
1150 1150
 
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 	 * @return int
1154 1154
 	 */
1155 1155
 	public function ticket_ID() {
1156
-		return $this->get( 'TKT_ID' );
1156
+		return $this->get('TKT_ID');
1157 1157
 	}
1158 1158
 
1159 1159
 
@@ -1165,17 +1165,17 @@  discard block
 block discarded – undo
1165 1165
 	 * @param    string $REG_code Registration Code
1166 1166
 	 * @param	boolean $use_default
1167 1167
 	 */
1168
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1169
-		if ( empty( $REG_code )) {
1170
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1168
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1169
+		if (empty($REG_code)) {
1170
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1171 1171
 			return;
1172 1172
 		}
1173
-		if ( ! $this->reg_code() ) {
1174
-			parent::set( 'REG_code', $REG_code, $use_default );
1173
+		if ( ! $this->reg_code()) {
1174
+			parent::set('REG_code', $REG_code, $use_default);
1175 1175
 		} else {
1176 1176
 			EE_Error::doing_it_wrong(
1177
-				__CLASS__ . '::' . __FUNCTION__,
1178
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1177
+				__CLASS__.'::'.__FUNCTION__,
1178
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1179 1179
 				'4.6.0'
1180 1180
 			);
1181 1181
 		}
@@ -1195,17 +1195,17 @@  discard block
 block discarded – undo
1195 1195
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1196 1196
 	 */
1197 1197
 	public function get_all_other_registrations_in_group() {
1198
-		if ( $this->group_size() < 2 ) {
1198
+		if ($this->group_size() < 2) {
1199 1199
 			return array();
1200 1200
 		}
1201 1201
 
1202 1202
 		$query[0] = array(
1203 1203
 			'TXN_ID' => $this->transaction_ID(),
1204
-			'REG_ID' => array( '!=', $this->ID() ),
1204
+			'REG_ID' => array('!=', $this->ID()),
1205 1205
 			'TKT_ID' => $this->ticket_ID()
1206 1206
 			);
1207 1207
 
1208
-		$registrations = $this->get_model()->get_all( $query );
1208
+		$registrations = $this->get_model()->get_all($query);
1209 1209
 		return $registrations;
1210 1210
 	}
1211 1211
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 	 * @access 	public
1218 1218
 	 */
1219 1219
 	public function price_paid() {
1220
-		EE_Error::doing_it_wrong( 'EE_Registration::price_paid()', __( 'This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso' ), '4.7.0' );
1220
+		EE_Error::doing_it_wrong('EE_Registration::price_paid()', __('This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso'), '4.7.0');
1221 1221
 		return $this->final_price();
1222 1222
 	}
1223 1223
 
@@ -1229,9 +1229,9 @@  discard block
 block discarded – undo
1229 1229
 	 * @access    public
1230 1230
 	 * @param    float $REG_final_price
1231 1231
 	 */
1232
-	public function set_price_paid( $REG_final_price = 0.00 ) {
1233
-		EE_Error::doing_it_wrong( 'EE_Registration::set_price_paid()', __( 'This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso' ), '4.7.0' );
1234
-		$this->set_final_price( $REG_final_price );
1232
+	public function set_price_paid($REG_final_price = 0.00) {
1233
+		EE_Error::doing_it_wrong('EE_Registration::set_price_paid()', __('This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso'), '4.7.0');
1234
+		$this->set_final_price($REG_final_price);
1235 1235
 	}
1236 1236
 
1237 1237
 
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 	 * @return string
1243 1243
 	 */
1244 1244
 	public function pretty_price_paid() {
1245
-		EE_Error::doing_it_wrong( 'EE_Registration::pretty_price_paid()', __( 'This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso' ), '4.7.0' );
1245
+		EE_Error::doing_it_wrong('EE_Registration::pretty_price_paid()', __('This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso'), '4.7.0');
1246 1246
 		return $this->pretty_final_price();
1247 1247
 	}
1248 1248
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			parent::set( 'STS_ID', $new_STS_ID, $use_default );
127 127
 			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
128 128
 			return TRUE;
129
-		}else{
129
+		} else{
130 130
 			//even though the old value matches the new value, it's still good to
131 131
 			//allow the parent set method to have a say
132 132
 			parent::set( 'STS_ID', $new_STS_ID, $use_default );
@@ -625,8 +625,9 @@  discard block
 block discarded – undo
625 625
 	 * @return EE_Registration
626 626
 	 */
627 627
 	public function get_primary_registration()  {
628
-		if ( $this->is_primary_registrant() )
629
-			return $this;
628
+		if ( $this->is_primary_registrant() ) {
629
+					return $this;
630
+		}
630 631
 
631 632
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
632 633
 		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -618,9 +618,9 @@
 block discarded – undo
618 618
 
619 619
 
620 620
 	/**
621
-	*		get  Attendee Number
622
-	* 		@access		public
623
-	*/
621
+	 *		get  Attendee Number
622
+	 * 		@access		public
623
+	 */
624 624
 	public function count() {
625 625
 		return $this->get( 'REG_count' );
626 626
 	}
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 	 * the registration's share of the transaction total, so that the
683 683
 	 * sum of all the transaction's REG_final_prices equal the transaction's total
684 684
 	 * @access        public
685
-	 * @return    float
685
+	 * @return    boolean
686 686
 	 */
687 687
 	public function final_price() {
688 688
 		return $this->get( 'REG_final_price' );
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 	/**
705 705
 	 * get paid (yeah)
706 706
 	 * @access        public
707
-	 * @return 	float
707
+	 * @return 	boolean
708 708
 	 */
709 709
 	public function paid() {
710 710
 		return $this->get( 'REG_paid' );
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
 	/**
869 869
 	 * Sets deleted
870 870
 	 * @param boolean $deleted
871
-	 * @return boolean
871
+	 * @return boolean|null
872 872
 	 */
873 873
 	public function set_deleted($deleted) {
874 874
 		$this->set( 'REG_deleted', $deleted );
@@ -912,6 +912,7 @@  discard block
 block discarded – undo
912 912
 	 *
913 913
 	 * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against
914 914
 	 * @param bool   $check_approved   This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access.
915
+	 * @param integer $DTT_OR_ID
915 916
 	 *
916 917
 	 * @return bool
917 918
 	 */
@@ -1150,7 +1151,7 @@  discard block
 block discarded – undo
1150 1151
 
1151 1152
 
1152 1153
 	/**
1153
-	 * @return int
1154
+	 * @return boolean
1154 1155
 	 */
1155 1156
 	public function ticket_ID() {
1156 1157
 		return $this->get( 'TKT_ID' );
Please login to merge, or discard this patch.
core/db_classes/EE_Soft_Delete_Base_Class.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @return boolean success
34 34
 	 */
35 35
 	public function delete() {
36
-		return $this->delete_or_restore( TRUE );
36
+		return $this->delete_or_restore(TRUE);
37 37
 	}
38 38
 
39 39
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return boolean success
44 44
 	 */
45 45
 	public function delete_permanently() {
46
-		return $this->get_model()->delete_permanently_by_ID( $this->ID() );
46
+		return $this->get_model()->delete_permanently_by_ID($this->ID());
47 47
 	}
48 48
 
49 49
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @param bool $delete true=>delete, false=>restore
54 54
 	 * @return bool
55 55
 	 */
56
-	public function delete_or_restore( $delete = TRUE ) {
56
+	public function delete_or_restore($delete = TRUE) {
57 57
 		$model = $this->get_model();
58
-		return $model->delete_or_restore_by_ID( $delete, $this->ID() );
58
+		return $model->delete_or_restore_by_ID($delete, $this->ID());
59 59
 	}
60 60
 
61 61
 
@@ -65,6 +65,6 @@  discard block
 block discarded – undo
65 65
 	 * @return boolean
66 66
 	 */
67 67
 	public function restore() {
68
-		return $this->delete_or_restore( FALSE );
68
+		return $this->delete_or_restore(FALSE);
69 69
 	}
70 70
 }
71 71
\ No newline at end of file
Please login to merge, or discard this patch.