Completed
Branch old/BUG-7514-7935-7936-price-o... (518ae6)
by
unknown
13:33 queued 11:14
created
core/data_migration_scripts/EE_DMS_Core_4_5_0.dms.php 2 patches
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@  discard block
 block discarded – undo
12 12
 //(all other times it gets resurrected from a wordpress option)
13 13
 $stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*');
14 14
 $class_to_filepath = array();
15
-foreach($stages as $filepath){
15
+foreach ($stages as $filepath) {
16 16
 	$matches = array();
17
-	preg_match('~4_5_0_stages/(.*).dmsstage.php~',$filepath,$matches);
17
+	preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches);
18 18
 	$class_to_filepath[$matches[1]] = $filepath;
19 19
 }
20 20
 //give addons a chance to autoload their stages too
21
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages',$class_to_filepath);
21
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath);
22 22
 EEH_Autoloader::register_autoloader($class_to_filepath);
23 23
 
24
-class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base{
24
+class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base {
25 25
 
26 26
 
27 27
 
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 	}
40 40
 	public function can_migrate_from_version($version_array) {
41 41
 		$version_string = $version_array['Core'];
42
-		if($version_string <= '4.5.0' && $version_string >= '4.3.0' ){
42
+		if ($version_string <= '4.5.0' && $version_string >= '4.3.0') {
43 43
 //			echo "$version_string can be migrated from";
44 44
 			return true;
45
-		}elseif( ! $version_string ){
45
+		}elseif ( ! $version_string) {
46 46
 //			echo "no version string provided: $version_string";
47 47
 			//no version string provided... this must be pre 4.3
48
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
49
-		}else{
48
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
49
+		} else {
50 50
 //			echo "$version_string doesnt apply";
51 51
 			return false;
52 52
 		}
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 	public function schema_changes_before_migration() {
58 58
 		//relies on 4.1's EEH_Activation::create_table
59
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
60
-		$table_name='esp_answer';
61
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
59
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
60
+		$table_name = 'esp_answer';
61
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
62 62
 					REG_ID INT UNSIGNED NOT NULL,
63 63
 					QST_ID INT UNSIGNED NOT NULL,
64 64
 					ANS_value TEXT NOT NULL,
65 65
 					PRIMARY KEY  (ANS_ID)";
66
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
66
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
67 67
 
68 68
 		$table_name = 'esp_attendee_meta';
69 69
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
103 103
 					  CNT_active TINYINT(1) DEFAULT '0',
104 104
 					  PRIMARY KEY  (CNT_ISO)";
105
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
105
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
106 106
 
107 107
 		$table_name = 'esp_datetime';
108 108
 		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 
125 125
 
126
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
126
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
127 127
 		$table_name = 'esp_event_meta';
128 128
 		$sql = "
129 129
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -140,41 +140,41 @@  discard block
 block discarded – undo
140 140
 			EVT_external_URL VARCHAR(200) NULL,
141 141
 			EVT_donations TINYINT(1) NULL,
142 142
 			PRIMARY KEY  (EVTM_ID)";
143
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
143
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
144 144
 
145 145
 
146 146
 
147
-		$table_name='esp_event_question_group';
148
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
147
+		$table_name = 'esp_event_question_group';
148
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
149 149
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
150 150
 					QSG_ID INT UNSIGNED NOT NULL,
151 151
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
152 152
 					PRIMARY KEY  (EQG_ID)";
153
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
153
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
154 154
 
155 155
 
156 156
 
157
-		$table_name='esp_event_venue';
158
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
157
+		$table_name = 'esp_event_venue';
158
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
159 159
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
160 160
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
161 161
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
162 162
 				PRIMARY KEY  (EVV_ID)";
163
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
163
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
164 164
 
165 165
 
166 166
 
167
-		$table_name='esp_extra_meta';
168
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
167
+		$table_name = 'esp_extra_meta';
168
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
169 169
 				OBJ_ID INT(11) DEFAULT NULL,
170 170
 				EXM_type VARCHAR(45) DEFAULT NULL,
171 171
 				EXM_key VARCHAR(45) DEFAULT NULL,
172 172
 				EXM_value TEXT,
173 173
 				PRIMARY KEY  (EXM_ID)";
174
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
174
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
175 175
 
176
-		$table_name='esp_line_item';
177
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
176
+		$table_name = 'esp_line_item';
177
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
178 178
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
179 179
 				TXN_ID INT(11) DEFAULT NULL,
180 180
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				OBJ_ID INT(11) DEFAULT NULL,
191 191
 				OBJ_type VARCHAR(45)DEFAULT NULL,
192 192
 				PRIMARY KEY  (LIN_ID)";
193
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
193
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
194 194
 
195 195
 		$table_name = 'esp_message_template';
196 196
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 					KEY GRP_ID (GRP_ID)";
203 203
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
204 204
 
205
-		EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' );
205
+		EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID');
206 206
 
207 207
 		$table_name = 'esp_message_template_group';
208 208
 		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
218 218
 					PRIMARY KEY  (GRP_ID),
219 219
 					KEY MTP_user_id (MTP_user_id)";
220
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
220
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
221 221
 
222 222
 		$table_name = 'esp_event_message_template';
223 223
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 					PRIMARY KEY  (EMT_ID),
227 227
 					KEY EVT_ID (EVT_ID),
228 228
 					KEY GRP_ID (GRP_ID)";
229
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
229
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
230 230
 
231 231
 
232 232
 		$table_name = 'esp_payment';
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 					  PRIMARY KEY  (TTM_ID)";
277 277
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
278 278
 
279
-		$table_name='esp_question';
280
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
279
+		$table_name = 'esp_question';
280
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
281 281
 					QST_display_text TEXT NOT NULL,
282 282
 					QST_admin_label VARCHAR(255) NOT NULL,
283 283
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -289,27 +289,27 @@  discard block
 block discarded – undo
289 289
 					QST_wp_user BIGINT UNSIGNED NULL,
290 290
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
291 291
 					PRIMARY KEY  (QST_ID)';
292
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
292
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
293 293
 
294
-		$table_name='esp_question_group_question';
295
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
294
+		$table_name = 'esp_question_group_question';
295
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
296 296
 					QSG_ID INT UNSIGNED NOT NULL,
297 297
 					QST_ID INT UNSIGNED NOT NULL,
298 298
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
299 299
 					PRIMARY KEY  (QGQ_ID) ";
300
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
300
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
301 301
 
302 302
 
303 303
 
304
-		$table_name='esp_question_option';
305
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
304
+		$table_name = 'esp_question_option';
305
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
306 306
 					QSO_value VARCHAR(255) NOT NULL,
307 307
 					QSO_desc TEXT NOT NULL,
308 308
 					QST_ID INT UNSIGNED NOT NULL,
309 309
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
310 310
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
311 311
 					PRIMARY KEY  (QSO_ID)";
312
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
312
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
313 313
 
314 314
 
315 315
 
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
 
343 343
 
344 344
 
345
-		$table_name='esp_checkin';
346
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
345
+		$table_name = 'esp_checkin';
346
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
347 347
 					REG_ID INT(10) UNSIGNED NOT NULL,
348 348
 					DTT_ID INT(10) UNSIGNED NOT NULL,
349 349
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 					  PRC_wp_user BIGINT UNSIGNED NULL,
432 432
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
433 433
 					  PRIMARY KEY  (PRC_ID)";
434
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
434
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
435 435
 
436 436
 		$table_name = "esp_price_type";
437 437
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -468,12 +468,12 @@  discard block
 block discarded – undo
468 468
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
469 469
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
470 470
 					  PRIMARY KEY  (TKT_ID)";
471
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
471
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
472 472
 
473
-		EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' );
473
+		EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE');
474 474
 
475 475
 		$table_name = 'esp_question_group';
476
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
476
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
477 477
 					QSG_name VARCHAR(255) NOT NULL,
478 478
 					QSG_identifier VARCHAR(100) NOT NULL,
479 479
 					QSG_desc TEXT NULL,
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 					QSG_wp_user BIGINT UNSIGNED NULL,
486 486
 					PRIMARY KEY  (QSG_ID),
487 487
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
488
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
488
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
489 489
 
490 490
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
491 491
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 		return true;
510 510
 	}
511 511
 
512
-	public function migration_page_hooks(){
512
+	public function migration_page_hooks() {
513 513
 
514 514
 	}
515 515
 
@@ -525,19 +525,19 @@  discard block
 block discarded – undo
525 525
 
526 526
 		if ($wpdb->get_var("SHOW TABLES LIKE '$price_type_table'") == $price_type_table) {
527 527
 
528
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
529
-			$price_types_exist = $wpdb->get_var( $SQL );
528
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
529
+			$price_types_exist = $wpdb->get_var($SQL);
530 530
 
531
-			if ( ! $price_types_exist ) {
531
+			if ( ! $price_types_exist) {
532 532
 				$user_id = EEH_Activation::get_default_creator_id();
533 533
 				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
534
-							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, $user_id, 0),
535
-							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, $user_id, 0),
536
-							(3, '" . __('Dollar Discount', 'event_espresso') . "', 2,  0, 30, $user_id, 0),
537
-							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, $user_id,  0),
538
-							(5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3,  0, 50, $user_id, 0);";
539
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL );
540
-				$wpdb->query( $SQL );
534
+							(1, '".__('Base Price', 'event_espresso')."', 1,  0, 0, $user_id, 0),
535
+							(2, '".__('Percent Discount', 'event_espresso')."', 2,  1, 20, $user_id, 0),
536
+							(3, '".__('Dollar Discount', 'event_espresso')."', 2,  0, 30, $user_id, 0),
537
+							(4, '".__('Percent Surcharge', 'event_espresso')."', 3,  1, 40, $user_id,  0),
538
+							(5, '".__('Dollar Surcharge', 'event_espresso')."', 3,  0, 50, $user_id, 0);";
539
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
540
+				$wpdb->query($SQL);
541 541
 			}
542 542
 		}
543 543
 	}
@@ -559,15 +559,15 @@  discard block
 block discarded – undo
559 559
 
560 560
 		if ($wpdb->get_var("SHOW TABLES LIKE '$price_table'") == $price_table) {
561 561
 
562
-			$SQL = 'SELECT COUNT(PRC_ID) FROM ' .$price_table;
563
-			$prices_exist = $wpdb->get_var( $SQL );
562
+			$SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
563
+			$prices_exist = $wpdb->get_var($SQL);
564 564
 
565
-			if ( ! $prices_exist ) {
565
+			if ( ! $prices_exist) {
566 566
 				$user_id = EEH_Activation::get_default_creator_id();
567 567
 				$SQL = "INSERT INTO $price_table
568 568
 							(PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc,  PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES
569 569
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);";
570
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL );
570
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
571 571
 				$wpdb->query($SQL);
572 572
 			}
573 573
 		}
@@ -585,35 +585,35 @@  discard block
 block discarded – undo
585 585
 
586 586
 		global $wpdb;
587 587
 		$ticket_table = $wpdb->prefix."esp_ticket";
588
-		if ( $wpdb->get_var("SHOW TABLES LIKE'$ticket_table'") == $ticket_table ) {
588
+		if ($wpdb->get_var("SHOW TABLES LIKE'$ticket_table'") == $ticket_table) {
589 589
 
590
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
590
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
591 591
 			$tickets_exist = $wpdb->get_var($SQL);
592 592
 
593
-			if ( ! $tickets_exist ) {
593
+			if ( ! $tickets_exist) {
594 594
 				$user_id = EEH_Activation::get_default_creator_id();
595 595
 				$SQL = "INSERT INTO $ticket_table
596 596
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES
597
-					( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);";
598
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL );
597
+					( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);";
598
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
599 599
 				$wpdb->query($SQL);
600 600
 			}
601 601
 		}
602 602
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
603 603
 
604
-		if ( $wpdb->get_var("SHOW TABLES LIKE'$ticket_price_table'") == $ticket_price_table ) {
604
+		if ($wpdb->get_var("SHOW TABLES LIKE'$ticket_price_table'") == $ticket_price_table) {
605 605
 
606
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
606
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
607 607
 			$ticket_prc_exist = $wpdb->get_var($SQL);
608 608
 
609
-			if ( ! $ticket_prc_exist ) {
609
+			if ( ! $ticket_prc_exist) {
610 610
 
611 611
 				$SQL = "INSERT INTO $ticket_price_table
612 612
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
613 613
 				( 1, 1, 1 )
614 614
 				";
615 615
 
616
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL );
616
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
617 617
 				$wpdb->query($SQL);
618 618
 			}
619 619
 		}
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@
 block discarded – undo
42 42
 		if($version_string <= '4.5.0' && $version_string >= '4.3.0' ){
43 43
 //			echo "$version_string can be migrated from";
44 44
 			return true;
45
-		}elseif( ! $version_string ){
45
+		} elseif( ! $version_string ){
46 46
 //			echo "no version string provided: $version_string";
47 47
 			//no version string provided... this must be pre 4.3
48 48
 			return false;//changed mind. dont want people thinking they should migrate yet because they cant
49
-		}else{
49
+		} else{
50 50
 //			echo "$version_string doesnt apply";
51 51
 			return false;
52 52
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_6_0.dms.php 2 patches
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
 //(all other times it gets resurrected from a wordpress option)
11 11
 $stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*');
12 12
 $class_to_filepath = array();
13
-foreach($stages as $filepath){
13
+foreach ($stages as $filepath) {
14 14
 	$matches = array();
15
-	preg_match('~4_6_0_stages/(.*).dmsstage.php~',$filepath,$matches);
15
+	preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
16 16
 	$class_to_filepath[$matches[1]] = $filepath;
17 17
 }
18 18
 //give addons a chance to autoload their stages too
19
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages',$class_to_filepath);
19
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath);
20 20
 EEH_Autoloader::register_autoloader($class_to_filepath);
21 21
 
22 22
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  * @since                4.6.0
33 33
  *
34 34
  */
35
-class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base{
35
+class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base {
36 36
 
37 37
 	/**
38 38
 	 * return EE_DMS_Core_4_6_0
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function can_migrate_from_version($version_array) {
64 64
 		$version_string = $version_array['Core'];
65
-		if($version_string <= '4.6.0' && $version_string >= '4.5.0' ){
65
+		if ($version_string <= '4.6.0' && $version_string >= '4.5.0') {
66 66
 //			echo "$version_string can be migrated from";
67 67
 			return true;
68
-		}elseif( ! $version_string ){
68
+		}elseif ( ! $version_string) {
69 69
 //			echo "no version string provided: $version_string";
70 70
 			//no version string provided... this must be pre 4.3
71
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
72
-		}else{
71
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
72
+		} else {
73 73
 //			echo "$version_string doesnt apply";
74 74
 			return false;
75 75
 		}
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function schema_changes_before_migration() {
93 93
 		//relies on 4.1's EEH_Activation::create_table
94
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
95
-		$table_name='esp_answer';
96
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
94
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
95
+		$table_name = 'esp_answer';
96
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
97 97
 					REG_ID INT UNSIGNED NOT NULL,
98 98
 					QST_ID INT UNSIGNED NOT NULL,
99 99
 					ANS_value TEXT NOT NULL,
100 100
 					PRIMARY KEY  (ANS_ID)";
101
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
101
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
102 102
 
103 103
 		$table_name = 'esp_attendee_meta';
104 104
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
138 138
 					  CNT_active TINYINT(1) DEFAULT '0',
139 139
 					  PRIMARY KEY  (CNT_ISO)";
140
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
140
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
141 141
 
142 142
 		$table_name = 'esp_currency';
143 143
 		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
148 148
 				CUR_active TINYINT(1) DEFAULT '0',
149 149
 				PRIMARY KEY  (CUR_code)";
150
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
150
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
151 151
 
152 152
 
153 153
 		$table_name = 'esp_currency_payment_method';
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
 
179 179
 
180
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
180
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
181 181
 		$table_name = 'esp_event_meta';
182 182
 		$sql = "
183 183
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -194,41 +194,41 @@  discard block
 block discarded – undo
194 194
 			EVT_external_URL VARCHAR(200) NULL,
195 195
 			EVT_donations TINYINT(1) NULL,
196 196
 			PRIMARY KEY  (EVTM_ID)";
197
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
197
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
198 198
 
199 199
 
200 200
 
201
-		$table_name='esp_event_question_group';
202
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
201
+		$table_name = 'esp_event_question_group';
202
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
203 203
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
204 204
 					QSG_ID INT UNSIGNED NOT NULL,
205 205
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
206 206
 					PRIMARY KEY  (EQG_ID)";
207
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
207
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
208 208
 
209 209
 
210 210
 
211
-		$table_name='esp_event_venue';
212
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
211
+		$table_name = 'esp_event_venue';
212
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
213 213
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
214 214
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
215 215
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
216 216
 				PRIMARY KEY  (EVV_ID)";
217
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
217
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
218 218
 
219 219
 
220 220
 
221
-		$table_name='esp_extra_meta';
222
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
221
+		$table_name = 'esp_extra_meta';
222
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
223 223
 				OBJ_ID INT(11) DEFAULT NULL,
224 224
 				EXM_type VARCHAR(45) DEFAULT NULL,
225 225
 				EXM_key VARCHAR(45) DEFAULT NULL,
226 226
 				EXM_value TEXT,
227 227
 				PRIMARY KEY  (EXM_ID)";
228
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
228
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
229 229
 
230
-		$table_name='esp_line_item';
231
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
230
+		$table_name = 'esp_line_item';
231
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
232 232
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
233 233
 				TXN_ID INT(11) DEFAULT NULL,
234 234
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 				OBJ_ID INT(11) DEFAULT NULL,
245 245
 				OBJ_type VARCHAR(45)DEFAULT NULL,
246 246
 				PRIMARY KEY  (LIN_ID)";
247
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
247
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
248 248
 
249 249
 		$table_name = 'esp_log';
250 250
 		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 					KEY GRP_ID (GRP_ID)";
268 268
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
269 269
 
270
-		EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' );
270
+		EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID');
271 271
 
272 272
 		$table_name = 'esp_message_template_group';
273 273
 		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
283 283
 					PRIMARY KEY  (GRP_ID),
284 284
 					KEY MTP_user_id (MTP_user_id)";
285
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
285
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
286 286
 
287 287
 		$table_name = 'esp_event_message_template';
288 288
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 					PRIMARY KEY  (EMT_ID),
292 292
 					KEY EVT_ID (EVT_ID),
293 293
 					KEY GRP_ID (GRP_ID)";
294
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
294
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
295 295
 
296 296
 
297 297
 		$table_name = 'esp_payment';
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
 					  PRIMARY KEY  (TTM_ID)";
360 360
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
361 361
 
362
-		$table_name='esp_question';
363
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
362
+		$table_name = 'esp_question';
363
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
364 364
 					QST_display_text TEXT NOT NULL,
365 365
 					QST_admin_label VARCHAR(255) NOT NULL,
366 366
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -372,27 +372,27 @@  discard block
 block discarded – undo
372 372
 					QST_wp_user BIGINT UNSIGNED NULL,
373 373
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
374 374
 					PRIMARY KEY  (QST_ID)';
375
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
375
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
376 376
 
377
-		$table_name='esp_question_group_question';
378
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
377
+		$table_name = 'esp_question_group_question';
378
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
379 379
 					QSG_ID INT UNSIGNED NOT NULL,
380 380
 					QST_ID INT UNSIGNED NOT NULL,
381 381
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
382 382
 					PRIMARY KEY  (QGQ_ID) ";
383
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
383
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
384 384
 
385 385
 
386 386
 
387
-		$table_name='esp_question_option';
388
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
387
+		$table_name = 'esp_question_option';
388
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
389 389
 					QSO_value VARCHAR(255) NOT NULL,
390 390
 					QSO_desc TEXT NOT NULL,
391 391
 					QST_ID INT UNSIGNED NOT NULL,
392 392
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
393 393
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
394 394
 					PRIMARY KEY  (QSO_ID)";
395
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
395
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
396 396
 
397 397
 
398 398
 
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 
426 426
 
427 427
 
428
-		$table_name='esp_checkin';
429
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
428
+		$table_name = 'esp_checkin';
429
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
430 430
 					REG_ID INT(10) UNSIGNED NOT NULL,
431 431
 					DTT_ID INT(10) UNSIGNED NOT NULL,
432 432
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 					  PRC_wp_user BIGINT UNSIGNED NULL,
516 516
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
517 517
 					  PRIMARY KEY  (PRC_ID)";
518
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
518
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
519 519
 
520 520
 		$table_name = "esp_price_type";
521 521
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -552,12 +552,12 @@  discard block
 block discarded – undo
552 552
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
553 553
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
554 554
 					  PRIMARY KEY  (TKT_ID)";
555
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
555
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
556 556
 
557
-		EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' );
557
+		EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE');
558 558
 
559 559
 		$table_name = 'esp_question_group';
560
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
560
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
561 561
 					QSG_name VARCHAR(255) NOT NULL,
562 562
 					QSG_identifier VARCHAR(100) NOT NULL,
563 563
 					QSG_desc TEXT NULL,
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 					QSG_wp_user BIGINT UNSIGNED NULL,
570 570
 					PRIMARY KEY  (QSG_ID),
571 571
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
572
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
572
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
573 573
 
574 574
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
575 575
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -597,19 +597,19 @@  discard block
 block discarded – undo
597 597
 		return true;
598 598
 	}
599 599
 
600
-	public function migration_page_hooks(){
600
+	public function migration_page_hooks() {
601 601
 
602 602
 	}
603 603
 
604
-	public function add_default_admin_only_payments(){
604
+	public function add_default_admin_only_payments() {
605 605
 		global $wpdb;
606 606
 		$table_name = $wpdb->prefix."esp_payment_method";
607 607
 		$user_id = EEH_Activation::get_default_creator_id();
608
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $table_name . "'") == $table_name ) {
608
+		if ($wpdb->get_var("SHOW TABLES LIKE '".$table_name."'") == $table_name) {
609 609
 
610 610
 			$SQL = "SELECT COUNT( * ) FROM $table_name";
611 611
 			$existing_payment_methods = $wpdb->get_var($SQL);
612
-			if ( ! $existing_payment_methods ) {
612
+			if ( ! $existing_payment_methods) {
613 613
 				//make sure we hae payment method records for the following
614 614
 				//so admins can record payments for them from the admin page
615 615
 				$default_admin_only_payment_methods = array(
@@ -623,11 +623,11 @@  discard block
 block discarded – undo
623 623
 					__("Paypal", 'event_espresso')=>  __("Paypal eCheck, Invoice, etc", 'event_espresso'),
624 624
 				);
625 625
 
626
-				foreach($default_admin_only_payment_methods as $nicename => $description){
626
+				foreach ($default_admin_only_payment_methods as $nicename => $description) {
627 627
 					$slug = sanitize_key($nicename);
628 628
 				//check that such a payment method exists
629
-					$exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s",$slug));
630
-					if( ! $exists){
629
+					$exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
630
+					if ( ! $exists) {
631 631
 						$values = array(
632 632
 									'PMD_type'=>'Admin_Only',
633 633
 									'PMD_name'=>$nicename,
@@ -641,17 +641,17 @@  discard block
 block discarded – undo
641 641
 								$table_name,
642 642
 								$values,
643 643
 								array(
644
-									'%s',//PMD_type
645
-									'%s',//PMD_name
646
-									'%s',//PMD_admin_name
647
-									'%s',//PMD_admin_desc
648
-									'%s',//PMD_slug
649
-									'%d',//PMD_wp_user
650
-									'%s',//PMD_scope
644
+									'%s', //PMD_type
645
+									'%s', //PMD_name
646
+									'%s', //PMD_admin_name
647
+									'%s', //PMD_admin_desc
648
+									'%s', //PMD_slug
649
+									'%d', //PMD_wp_user
650
+									'%s', //PMD_scope
651 651
 								)
652 652
 								);
653
-						if( ! $success ){
654
-							$this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", "event_espresso"),$this->_json_encode($values)));
653
+						if ( ! $success) {
654
+							$this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", "event_espresso"), $this->_json_encode($values)));
655 655
 						}
656 656
 					}
657 657
 				}
@@ -670,11 +670,11 @@  discard block
 block discarded – undo
670 670
 
671 671
 		global $wpdb;
672 672
 		$currency_table = $wpdb->prefix."esp_currency";
673
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $currency_table . "'") == $currency_table ) {
673
+		if ($wpdb->get_var("SHOW TABLES LIKE '".$currency_table."'") == $currency_table) {
674 674
 
675 675
 			$SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
676 676
 			$countries = $wpdb->get_var($SQL);
677
-			if ( ! $countries ) {
677
+			if ( ! $countries) {
678 678
 				$SQL = "INSERT INTO $currency_table
679 679
 				( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES
680 680
 				( 'EUR',  'Euro',  'Euros',  '€',  2,1),
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@
 block discarded – undo
65 65
 		if($version_string <= '4.6.0' && $version_string >= '4.5.0' ){
66 66
 //			echo "$version_string can be migrated from";
67 67
 			return true;
68
-		}elseif( ! $version_string ){
68
+		} elseif( ! $version_string ){
69 69
 //			echo "no version string provided: $version_string";
70 70
 			//no version string provided... this must be pre 4.3
71 71
 			return false;//changed mind. dont want people thinking they should migrate yet because they cant
72
-		}else{
72
+		} else{
73 73
 //			echo "$version_string doesnt apply";
74 74
 			return false;
75 75
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Unknown_1_0_0.core.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
  */
18 18
 /**
19 19
  */
20
-class EE_DMS_Unknown_1_0_0 extends EE_Data_Migration_Script_Base{
20
+class EE_DMS_Unknown_1_0_0 extends EE_Data_Migration_Script_Base {
21 21
 
22 22
 	/**
23 23
 	 * Returns whether or not this data migration script can operate on the given version of the database.
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Class_Base.core.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -264,9 +264,9 @@
 block discarded – undo
264 264
 	/**
265 265
 	 * Same as json_encode, just avoids putting
266 266
 	 * serialized arrays into the http build query, as that would
267
-	* @param array $array_of_data
268
-	* @return string
269
-	*/
267
+	 * @param array $array_of_data
268
+	 * @return string
269
+	 */
270 270
 	protected function _json_encode($array_of_data){
271 271
 		//we'd rather NOT serialize the transaction details
272 272
 		$fields_to_include = array();
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 
19 19
 
20
-abstract class EE_Data_Migration_Class_Base{
20
+abstract class EE_Data_Migration_Class_Base {
21 21
 	/**
22 22
 	 * @var $records_to_migrate int count of all that have been migrated
23 23
 	 */
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * Just initializes the status of the migration
51 51
 	 * @throws EE_Error
52 52
 	 */
53
-	public function __construct(){
53
+	public function __construct() {
54 54
 		$this->set_status(EE_Data_Migration_Manager::status_continue);
55 55
 	}
56 56
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 * @throws EE_Error
62 62
 	 * @return string
63 63
 	 */
64
-	public function pretty_name(){
65
-		if($this->_pretty_name === null){
66
-			throw new EE_Error(sprintf(__("Please give a pretty name to the migration script stage %s by assigning the property _pretty_name in the constructor", "event_espresso"),get_class($this)));
64
+	public function pretty_name() {
65
+		if ($this->_pretty_name === null) {
66
+			throw new EE_Error(sprintf(__("Please give a pretty name to the migration script stage %s by assigning the property _pretty_name in the constructor", "event_espresso"), get_class($this)));
67 67
 		}
68 68
 		return $this->_pretty_name;
69 69
 	}
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return int
73 73
 	 */
74
-	public function count_records_to_migrate(){
75
-		if( $this->_records_to_migrate == null){
74
+	public function count_records_to_migrate() {
75
+		if ($this->_records_to_migrate == null) {
76 76
 			$this->_records_to_migrate = $this->_count_records_to_migrate();
77 77
 		}
78 78
 		return $this->_records_to_migrate;
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 	 * @return string one of EE_Data_Migration_Manager::status_* constants
93 93
 	 * @throws EE_Error
94 94
 	 */
95
-	public function get_status(){
96
-		if($this->_status === null){
97
-			throw new EE_Error(sprintf(__("Trying to get status of Migration class %s, but it has not been initialized yet. It should be set in the constructor.", "event_espresso"),get_class($this)));
95
+	public function get_status() {
96
+		if ($this->_status === null) {
97
+			throw new EE_Error(sprintf(__("Trying to get status of Migration class %s, but it has not been initialized yet. It should be set in the constructor.", "event_espresso"), get_class($this)));
98 98
 		}
99 99
 		return $this->_status;
100 100
 	}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @param string $status
104 104
 	 * @return void
105 105
 	 */
106
-	protected function set_status($status){
106
+	protected function set_status($status) {
107 107
 		$this->_status = $status;
108 108
 	}
109 109
 	/**
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 	 * Returns the last error that occurred. If none occurred, returns null
116 116
 	 * @return string
117 117
 	 */
118
-	public function get_last_error(){
118
+	public function get_last_error() {
119 119
 		$errors = $this->get_errors();
120
-		if($errors){
120
+		if ($errors) {
121 121
 			return end($errors);
122
-		}else{
122
+		} else {
123 123
 			return null;
124 124
 		}
125 125
 	}
@@ -128,22 +128,22 @@  discard block
 block discarded – undo
128 128
 	 * @param string $error a string describing the error that will be useful for debugging. Consider including all the data that led to the error, and a stack trace etc.
129 129
 	 * @param boolean $force force the error to be added (because otherwise we have a limit). If forcing and errors are already at their limit, we will purposefully forget the first half
130 130
 	 */
131
-	public function add_error($error, $force = FALSE ){
132
-		if( ! defined( 'EE_DMS_ERROR_LIMIT' ) ){
131
+	public function add_error($error, $force = FALSE) {
132
+		if ( ! defined('EE_DMS_ERROR_LIMIT')) {
133 133
 			$limit = 50;
134
-		}else{
134
+		} else {
135 135
 			$limit = EE_DMS_ERROR_LIMIT;
136 136
 		}
137
-		if(count($this->_errors) >= $limit ){
138
-			if( $force ){
137
+		if (count($this->_errors) >= $limit) {
138
+			if ($force) {
139 139
 				//get rid of the first half of the errors and any above the limit
140
-				$this->_errors = array_slice( $this->_errors, $limit / 2, $limit / 2 );
140
+				$this->_errors = array_slice($this->_errors, $limit / 2, $limit / 2);
141 141
 				$this->_errors[] = "Limit reached; removed first half of errors to save space";
142 142
 				$this->_errors[] = $error;
143
-			}else{
144
-				$this->_errors[ $limit ] = 'More, but limit reached...';
143
+			} else {
144
+				$this->_errors[$limit] = 'More, but limit reached...';
145 145
 			}
146
-		}else{
146
+		} else {
147 147
 			$this->_errors[] = $error;
148 148
 		}
149 149
 	}
@@ -152,57 +152,57 @@  discard block
 block discarded – undo
152 152
 	 * Indicates there was a fatal error and the migration cannot possibly continue
153 153
 	 * @return boolean
154 154
 	 */
155
-	public function is_broken(){
155
+	public function is_broken() {
156 156
 		return $this->get_status() == EE_Data_Migration_Manager::status_fatal_error;
157 157
 	}
158 158
 	/**
159 159
 	 * @deprecated since 4.6.12
160 160
 	 */
161
-	public function is_borked(){
162
-		EE_Error::doing_it_wrong('is_borked', __( 'The cheeky "is_borked" method had been replaced with the more proper "is_broken"', 'event_espresso' ), '4.6.12');
161
+	public function is_borked() {
162
+		EE_Error::doing_it_wrong('is_borked', __('The cheeky "is_borked" method had been replaced with the more proper "is_broken"', 'event_espresso'), '4.6.12');
163 163
 		return $this->is_broken();
164 164
 	}
165 165
 	/**
166 166
 	 * Sets the status to as having a fatal error
167 167
 	 */
168
-	public function set_broken(){
168
+	public function set_broken() {
169 169
 		$this->_status = EE_Data_Migration_Manager::status_fatal_error;
170 170
 	}
171 171
 	/**
172 172
 	 *
173 173
 	 * @deprecated since 4.6.12
174 174
 	 */
175
-	public function set_borked(){
176
-		EE_Error::doing_it_wrong('is_borked', __( 'The cheeky "is_borked" method had been replaced with the more proper "is_broken"', 'event_espresso' ), '4.6.12');
175
+	public function set_borked() {
176
+		EE_Error::doing_it_wrong('is_borked', __('The cheeky "is_borked" method had been replaced with the more proper "is_broken"', 'event_espresso'), '4.6.12');
177 177
 		return $this->set_broken();
178 178
 	}
179 179
 	/**
180 180
 	 * Checks if this thing believes it is completed
181 181
 	 * @return boolean
182 182
 	 */
183
-	public function is_completed(){
183
+	public function is_completed() {
184 184
 		return $this->get_status() == EE_Data_Migration_Manager::status_completed;
185 185
 	}
186 186
 	/**
187 187
 	 * Checks if the current script has more to do or not (ie, if it's status is CONTINUE)
188 188
 	 * @return boolean
189 189
 	 */
190
-	public function has_more_to_do(){
190
+	public function has_more_to_do() {
191 191
 		return $this->get_status() == EE_Data_Migration_Manager::status_continue;
192 192
 	}
193 193
 	/**
194 194
 	 * Marks that we believe this migration thing is completed
195 195
 	 */
196
-	public function set_completed(){
196
+	public function set_completed() {
197 197
 		$this->_status = EE_Data_Migration_Manager::status_completed;
198 198
 	}
199 199
 
200 200
 	/**
201 201
 	 * Marks that we think this migration class can continue to migrate
202 202
 	 */
203
-	public function reattempt(){
203
+	public function reattempt() {
204 204
 		$this->_status = EE_Data_Migration_Manager::status_continue;
205
-		$this->add_error( __( 'Reattempt migration', 'event_espresso' ), TRUE );
205
+		$this->add_error(__('Reattempt migration', 'event_espresso'), TRUE);
206 206
 	}
207 207
 
208 208
 	/**
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 	 * possible that this class is defined when it goes to sleep, but NOT available when it
212 212
 	 * awakes (eg, this class is part of an addon that is deactivated at some point).
213 213
 	 */
214
-	public function properties_as_array(){
215
-		$properties =  get_object_vars($this);
214
+	public function properties_as_array() {
215
+		$properties = get_object_vars($this);
216 216
 		$properties['class'] = get_class($this);
217 217
 		unset($properties['_migration_script']);
218 218
 		return $properties;
@@ -233,22 +233,22 @@  discard block
 block discarded – undo
233 233
 	 * @param array $data_types numerically indexed
234 234
 	 * @return string
235 235
 	 */
236
-	protected function _create_error_message_for_db_insertion($old_table, $old_row_as_array, $new_table, $new_row_as_array, $data_types){
236
+	protected function _create_error_message_for_db_insertion($old_table, $old_row_as_array, $new_table, $new_row_as_array, $data_types) {
237 237
 		global $wpdb;
238 238
 		$old_columns_and_values_for_string = array();
239
-		foreach($old_row_as_array as $column => $value){
239
+		foreach ($old_row_as_array as $column => $value) {
240 240
 			$old_columns_and_values_for_string[] = "$column => $value";
241 241
 		}
242 242
 		$new_columns_and_values_for_string = array();
243 243
 		$count = 0;
244
-		foreach($new_row_as_array as $column => $value){
244
+		foreach ($new_row_as_array as $column => $value) {
245 245
 			$new_columns_and_values_for_string[] = " $column => $value (".$data_types[$count++].")";
246 246
 		}
247 247
 		return sprintf(
248 248
 			__('Received error "%6$s" inserting row %5$s %1$s %5$s into table %2$s.%5$s Data used was %5$s %3$s %5$s from table %4%s.', "event_espresso"),
249
-			implode(", ",$new_columns_and_values_for_string),
249
+			implode(", ", $new_columns_and_values_for_string),
250 250
 			$new_table,
251
-			implode(", ",$old_columns_and_values_for_string),
251
+			implode(", ", $old_columns_and_values_for_string),
252 252
 			$old_table,
253 253
 			'<br/>',
254 254
 			$wpdb->last_error
@@ -263,12 +263,12 @@  discard block
 block discarded – undo
263 263
 	* @param array $array_of_data
264 264
 	* @return string
265 265
 	*/
266
-	protected function _json_encode($array_of_data){
266
+	protected function _json_encode($array_of_data) {
267 267
 		//we'd rather NOT serialize the transaction details
268 268
 		$fields_to_include = array();
269
-		foreach($array_of_data as $name => $value){
269
+		foreach ($array_of_data as $name => $value) {
270 270
 			$unserialized_data = @unserialize($value);
271
-			if($unserialized_data === FALSE){
271
+			if ($unserialized_data === FALSE) {
272 272
 				$fields_to_include[$name] = $value;
273 273
 			}
274 274
 		}
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		$errors = $this->get_errors();
120 120
 		if($errors){
121 121
 			return end($errors);
122
-		}else{
122
+		} else{
123 123
 			return null;
124 124
 		}
125 125
 	}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	public function add_error($error, $force = FALSE ){
132 132
 		if( ! defined( 'EE_DMS_ERROR_LIMIT' ) ){
133 133
 			$limit = 50;
134
-		}else{
134
+		} else{
135 135
 			$limit = EE_DMS_ERROR_LIMIT;
136 136
 		}
137 137
 		if(count($this->_errors) >= $limit ){
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 				$this->_errors = array_slice( $this->_errors, $limit / 2, $limit / 2 );
141 141
 				$this->_errors[] = "Limit reached; removed first half of errors to save space";
142 142
 				$this->_errors[] = $error;
143
-			}else{
143
+			} else{
144 144
 				$this->_errors[ $limit ] = 'More, but limit reached...';
145 145
 			}
146
-		}else{
146
+		} else{
147 147
 			$this->_errors[] = $error;
148 148
 		}
149 149
 	}
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_Answer.class.php 1 patch
Spacing   +22 added lines, -22 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
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 	 * @param array $props_n_values
32 32
 	 * @return EE_Answer
33 33
 	 */
34
-	public static function new_instance( $props_n_values = array() ) {
35
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
36
-		return $has_object ? $has_object : new self( $props_n_values );
34
+	public static function new_instance($props_n_values = array()) {
35
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
36
+		return $has_object ? $has_object : new self($props_n_values);
37 37
 	}
38 38
 
39 39
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @param array $props_n_values
44 44
 	 * @return EE_Answer
45 45
 	 */
46
-	public static function new_instance_from_db( $props_n_values = array() ) {
47
-		return new self( $props_n_values, TRUE );
46
+	public static function new_instance_from_db($props_n_values = array()) {
47
+		return new self($props_n_values, TRUE);
48 48
 	}
49 49
 
50 50
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 * @access        public
56 56
 	 * @param int $QST_ID
57 57
 	 */
58
-	public function set_question( $QST_ID = 0 ) {
59
-		$this->set( 'QST_ID', $QST_ID );
58
+	public function set_question($QST_ID = 0) {
59
+		$this->set('QST_ID', $QST_ID);
60 60
 	}
61 61
 
62 62
 
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 * @access        public
68 68
 	 * @param int $REG_ID
69 69
 	 */
70
-	public function set_registration( $REG_ID = 0 ) {
71
-		$this->set( 'REG_ID', $REG_ID );
70
+	public function set_registration($REG_ID = 0) {
71
+		$this->set('REG_ID', $REG_ID);
72 72
 	}
73 73
 
74 74
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 * @access        public
80 80
 	 * @param mixed $ANS_value
81 81
 	 */
82
-	public function set_value( $ANS_value = '' ) {
83
-		$this->set( 'ANS_value', $ANS_value );
82
+	public function set_value($ANS_value = '') {
83
+		$this->set('ANS_value', $ANS_value);
84 84
 	}
85 85
 
86 86
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 * @return        int
93 93
 	 */
94 94
 	public function registration_ID() {
95
-		return $this->get( 'REG_ID' );
95
+		return $this->get('REG_ID');
96 96
 	}
97 97
 
98 98
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @return        int
105 105
 	 */
106 106
 	public function question_ID() {
107
-		return $this->get( 'QST_ID' );
107
+		return $this->get('QST_ID');
108 108
 	}
109 109
 
110 110
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @return        string
117 117
 	 */
118 118
 	public function value() {
119
-		return $this->get( 'ANS_value' );
119
+		return $this->get('ANS_value');
120 120
 	}
121 121
 
122 122
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @param null $schema
127 127
 	 * @return string
128 128
 	 */
129
-	public function pretty_value( $schema = NULL ) {
130
-		return $this->get_pretty( 'ANS_value', $schema );
129
+	public function pretty_value($schema = NULL) {
130
+		return $this->get_pretty('ANS_value', $schema);
131 131
 	}
132 132
 
133 133
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 	 * Echoes out a pretty value (even for multi-choice options)
137 137
 	 * @param string $schema
138 138
 	 */
139
-	public function e_value( $schema = NULL ) {
140
-		$this->e( 'ANS_value', $schema );
139
+	public function e_value($schema = NULL) {
140
+		$this->e('ANS_value', $schema);
141 141
 	}
142 142
 
143 143
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @return EE_Question
148 148
 	 */
149 149
 	public function question() {
150
-		return $this->get_first_related( 'Question' );
150
+		return $this->get_first_related('Question');
151 151
 	}
152 152
 
153 153
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return EE_Registration
158 158
 	 */
159 159
 	public function registration() {
160
-		return $this->get_first_related( 'Registration' );
160
+		return $this->get_first_related('Registration');
161 161
 	}
162 162
 }
163 163
 
Please login to merge, or discard this patch.
core/db_classes/EE_Attendee.class.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	public function state_name(){
368 368
 		if( $this->state_obj() ){
369 369
 			return $this->state_obj()->name();
370
-		}else{
370
+		} else{
371 371
 			return __( 'Unknown', 'event_espresso' );
372 372
 		}
373 373
 	}
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	public function country_name(){
416 416
 		if( $this->country_obj() ){
417 417
 			return $this->country_obj()->name();
418
-		}else{
418
+		} else{
419 419
 			return __( 'Unknown', 'event_espresso' );
420 420
 		}
421 421
 	}
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	public function get_billing_info_postmeta_name($payment_method){
548 548
 		if( $payment_method->type_obj() instanceof EE_PMT_Base ){
549 549
 			return 'billing_info_' . $payment_method->type_obj()->system_name();
550
-		}else{
550
+		} else{
551 551
 			return NULL;
552 552
 		}
553 553
 	}
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 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
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 	 * @param bool   $bydb
33 33
 	 * @param string $timezone
34 34
 	 */
35
-	protected function __construct( $fieldValues = NULL, $bydb = FALSE, $timezone = NULL ) {
36
-		if ( !isset( $fieldValues[ 'ATT_full_name' ] ) ) {
37
-			$fname = isset( $fieldValues[ 'ATT_fname' ] ) ? $fieldValues[ 'ATT_fname' ] . ' ' : '';
38
-			$lname = isset( $fieldValues[ 'ATT_lname' ] ) ? $fieldValues[ 'ATT_lname' ] : '';
39
-			$fieldValues[ 'ATT_full_name' ] = $fname . $lname;
35
+	protected function __construct($fieldValues = NULL, $bydb = FALSE, $timezone = NULL) {
36
+		if ( ! isset($fieldValues['ATT_full_name'])) {
37
+			$fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'].' ' : '';
38
+			$lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : '';
39
+			$fieldValues['ATT_full_name'] = $fname.$lname;
40 40
 		}
41
-		if ( !isset( $fieldValues[ 'ATT_slug' ] ) ) {
41
+		if ( ! isset($fieldValues['ATT_slug'])) {
42 42
 			//			$fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20));
43
-			$fieldValues[ 'ATT_slug' ] = sanitize_title( $fieldValues[ 'ATT_full_name' ] );
43
+			$fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']);
44 44
 		}
45
-		if ( !isset( $fieldValues[ 'ATT_short_bio' ] ) && isset( $fieldValues[ 'ATT_bio' ] ) ) {
46
-			$fieldValues[ 'ATT_short_bio' ] = substr( $fieldValues[ 'ATT_bio' ], 0, 50 );
45
+		if ( ! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) {
46
+			$fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50);
47 47
 		}
48
-		parent::__construct( $fieldValues, $bydb, $timezone );
48
+		parent::__construct($fieldValues, $bydb, $timezone);
49 49
 	}
50 50
 
51 51
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 * @param array $props_n_values
56 56
 	 * @return EE_Attendee
57 57
 	 */
58
-	public static function new_instance( $props_n_values = array() ) {
58
+	public static function new_instance($props_n_values = array()) {
59 59
 		$classname = __CLASS__;
60
-		$has_object = parent::_check_for_object( $props_n_values, $classname );
61
-		return $has_object ? $has_object : new self( $props_n_values );
60
+		$has_object = parent::_check_for_object($props_n_values, $classname);
61
+		return $has_object ? $has_object : new self($props_n_values);
62 62
 	}
63 63
 
64 64
 
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 * @param array $props_n_values
68 68
 	 * @return EE_Attendee
69 69
 	 */
70
-	public static function new_instance_from_db( $props_n_values = array() ) {
71
-		return new self( $props_n_values, TRUE );
70
+	public static function new_instance_from_db($props_n_values = array()) {
71
+		return new self($props_n_values, TRUE);
72 72
 	}
73 73
 
74 74
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 * @access        public
80 80
 	 * @param string $fname
81 81
 	 */
82
-	public function set_fname( $fname = '' ) {
83
-		$this->set( 'ATT_fname', $fname );
82
+	public function set_fname($fname = '') {
83
+		$this->set('ATT_fname', $fname);
84 84
 	}
85 85
 
86 86
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 	 * @access        public
92 92
 	 * @param string $lname
93 93
 	 */
94
-	public function set_lname( $lname = '' ) {
95
-		$this->set( 'ATT_lname', $lname );
94
+	public function set_lname($lname = '') {
95
+		$this->set('ATT_lname', $lname);
96 96
 	}
97 97
 
98 98
 
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 * @access        public
104 104
 	 * @param string $address
105 105
 	 */
106
-	public function set_address( $address = '' ) {
107
-		$this->set( 'ATT_address', $address );
106
+	public function set_address($address = '') {
107
+		$this->set('ATT_address', $address);
108 108
 	}
109 109
 
110 110
 
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 * @access        public
116 116
 	 * @param        string $address2
117 117
 	 */
118
-	public function set_address2( $address2 = '' ) {
119
-		$this->set( 'ATT_address2', $address2 );
118
+	public function set_address2($address2 = '') {
119
+		$this->set('ATT_address2', $address2);
120 120
 	}
121 121
 
122 122
 
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 	 * @access        public
128 128
 	 * @param        string $city
129 129
 	 */
130
-	public function set_city( $city = '' ) {
131
-		$this->set( 'ATT_city', $city );
130
+	public function set_city($city = '') {
131
+		$this->set('ATT_city', $city);
132 132
 	}
133 133
 
134 134
 
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 	 * @access        public
140 140
 	 * @param        int $STA_ID
141 141
 	 */
142
-	public function set_state( $STA_ID = 0 ) {
143
-		$this->set( 'STA_ID', $STA_ID );
142
+	public function set_state($STA_ID = 0) {
143
+		$this->set('STA_ID', $STA_ID);
144 144
 	}
145 145
 
146 146
 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 * @access        public
152 152
 	 * @param        string $CNT_ISO
153 153
 	 */
154
-	public function set_country( $CNT_ISO = '' ) {
155
-		$this->set( 'CNT_ISO', $CNT_ISO );
154
+	public function set_country($CNT_ISO = '') {
155
+		$this->set('CNT_ISO', $CNT_ISO);
156 156
 	}
157 157
 
158 158
 
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 	 * @access        public
164 164
 	 * @param        string $zip
165 165
 	 */
166
-	public function set_zip( $zip = '' ) {
167
-		$this->set( 'ATT_zip', $zip );
166
+	public function set_zip($zip = '') {
167
+		$this->set('ATT_zip', $zip);
168 168
 	}
169 169
 
170 170
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @access        public
176 176
 	 * @param        string $email
177 177
 	 */
178
-	public function set_email( $email = '' ) {
179
-		$this->set( 'ATT_email', $email );
178
+	public function set_email($email = '') {
179
+		$this->set('ATT_email', $email);
180 180
 	}
181 181
 
182 182
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 * @access        public
188 188
 	 * @param        string $phone
189 189
 	 */
190
-	public function set_phone( $phone = '' ) {
191
-		$this->set( 'ATT_phone', $phone );
190
+	public function set_phone($phone = '') {
191
+		$this->set('ATT_phone', $phone);
192 192
 	}
193 193
 
194 194
 
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
 	 * @access        public
200 200
 	 * @param        bool $ATT_deleted
201 201
 	 */
202
-	public function set_deleted( $ATT_deleted = FALSE ) {
203
-		$this->set( 'ATT_deleted', $ATT_deleted );
202
+	public function set_deleted($ATT_deleted = FALSE) {
203
+		$this->set('ATT_deleted', $ATT_deleted);
204 204
 	}
205 205
 
206 206
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return int
214 214
 	 */
215 215
 	public function wp_user() {
216
-		return $this->get( 'ATT_author' );
216
+		return $this->get('ATT_author');
217 217
 	}
218 218
 
219 219
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 * @return string
225 225
 	 */
226 226
 	public function fname() {
227
-		return $this->get( 'ATT_fname' );
227
+		return $this->get('ATT_fname');
228 228
 	}
229 229
 
230 230
 
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
 	 * @param bool $apply_html_entities
245 245
 	 * @return string
246 246
 	 */
247
-	public function full_name( $apply_html_entities = FALSE ) {
248
-		$full_name = $this->fname() . ' ' . $this->lname();
249
-		return $apply_html_entities ? htmlentities( $full_name, ENT_QUOTES, 'UTF-8' ) : $full_name;
247
+	public function full_name($apply_html_entities = FALSE) {
248
+		$full_name = $this->fname().' '.$this->lname();
249
+		return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name;
250 250
 	}
251 251
 
252 252
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 * @return string
258 258
 	 */
259 259
 	public function lname() {
260
-		return $this->get( 'ATT_lname' );
260
+		return $this->get('ATT_lname');
261 261
 	}
262 262
 
263 263
 
@@ -271,26 +271,26 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	public function full_address_as_array() {
273 273
 		$full_address_array = array();
274
-		$initial_address_fields = array( 'ATT_address', 'ATT_address2', 'ATT_city', );
275
-		foreach ( $initial_address_fields as $address_field_name ) {
276
-			$address_fields_value = $this->get( $address_field_name );
277
-			if ( !empty( $address_fields_value ) ) {
278
-				$full_address_array[ ] = $address_fields_value;
274
+		$initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',);
275
+		foreach ($initial_address_fields as $address_field_name) {
276
+			$address_fields_value = $this->get($address_field_name);
277
+			if ( ! empty($address_fields_value)) {
278
+				$full_address_array[] = $address_fields_value;
279 279
 			}
280 280
 		}
281 281
 		//now handle state and country
282 282
 		$state_obj = $this->state_obj();
283
-		if ( !empty( $state_obj ) ) {
284
-			$full_address_array[ ] = $state_obj->name();
283
+		if ( ! empty($state_obj)) {
284
+			$full_address_array[] = $state_obj->name();
285 285
 		}
286 286
 		$country_obj = $this->country_obj();
287
-		if ( !empty( $country_obj ) ) {
288
-			$full_address_array[ ] = $country_obj->name();
287
+		if ( ! empty($country_obj)) {
288
+			$full_address_array[] = $country_obj->name();
289 289
 		}
290 290
 		//lastly get the xip
291 291
 		$zip_value = $this->zip();
292
-		if ( !empty( $zip_value ) ) {
293
-			$full_address_array[ ] = $zip_value;
292
+		if ( ! empty($zip_value)) {
293
+			$full_address_array[] = $zip_value;
294 294
 		}
295 295
 		return $full_address_array;
296 296
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @return string
303 303
 	 */
304 304
 	public function address() {
305
-		return $this->get( 'ATT_address' );
305
+		return $this->get('ATT_address');
306 306
 	}
307 307
 
308 308
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 * @return string
313 313
 	 */
314 314
 	public function address2() {
315
-		return $this->get( 'ATT_address2' );
315
+		return $this->get('ATT_address2');
316 316
 	}
317 317
 
318 318
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @return string
323 323
 	 */
324 324
 	public function city() {
325
-		return $this->get( 'ATT_city' );
325
+		return $this->get('ATT_city');
326 326
 	}
327 327
 
328 328
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @return string
333 333
 	 */
334 334
 	public function state_ID() {
335
-		return $this->get( 'STA_ID' );
335
+		return $this->get('STA_ID');
336 336
 	}
337 337
 
338 338
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 * @return string
342 342
 	 */
343 343
 	public function state_abbrev() {
344
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' );
344
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso');
345 345
 	}
346 346
 
347 347
 
@@ -351,18 +351,18 @@  discard block
 block discarded – undo
351 351
 	 * @return EE_State
352 352
 	 */
353 353
 	public function state_obj() {
354
-		return $this->get_first_related( 'State' );
354
+		return $this->get_first_related('State');
355 355
 	}
356 356
 
357 357
 	/**
358 358
 	 * Returns the state's name, otherwise 'Unknown'
359 359
 	 * @return string
360 360
 	 */
361
-	public function state_name(){
362
-		if( $this->state_obj() ){
361
+	public function state_name() {
362
+		if ($this->state_obj()) {
363 363
 			return $this->state_obj()->name();
364
-		}else{
365
-			return __( 'Unknown', 'event_espresso' );
364
+		} else {
365
+			return __('Unknown', 'event_espresso');
366 366
 		}
367 367
 	}
368 368
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @return string
376 376
 	 */
377 377
 	public function state() {
378
-		if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) {
378
+		if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) {
379 379
 			return $this->state_abbrev();
380 380
 		} else {
381 381
 			return $this->state_name();
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 * @return string
390 390
 	 */
391 391
 	public function country_ID() {
392
-		return $this->get( 'CNT_ISO' );
392
+		return $this->get('CNT_ISO');
393 393
 	}
394 394
 
395 395
 
@@ -399,18 +399,18 @@  discard block
 block discarded – undo
399 399
 	 * @return EE_Country
400 400
 	 */
401 401
 	public function country_obj() {
402
-		return $this->get_first_related( 'Country' );
402
+		return $this->get_first_related('Country');
403 403
 	}
404 404
 
405 405
 	/**
406 406
 	 * Returns the country's name if known, otherwise 'Unknown'
407 407
 	 * @return string
408 408
 	 */
409
-	public function country_name(){
410
-		if( $this->country_obj() ){
409
+	public function country_name() {
410
+		if ($this->country_obj()) {
411 411
 			return $this->country_obj()->name();
412
-		}else{
413
-			return __( 'Unknown', 'event_espresso' );
412
+		} else {
413
+			return __('Unknown', 'event_espresso');
414 414
 		}
415 415
 	}
416 416
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 	 * @return string
424 424
 	 */
425 425
 	public function country() {
426
-		if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) {
426
+		if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) {
427 427
 			return $this->country_ID();
428 428
 		} else {
429 429
 			return $this->country_name();
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	 * @return string
438 438
 	 */
439 439
 	public function zip() {
440
-		return $this->get( 'ATT_zip' );
440
+		return $this->get('ATT_zip');
441 441
 	}
442 442
 
443 443
 
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 * @return string
448 448
 	 */
449 449
 	public function email() {
450
-		return $this->get( 'ATT_email' );
450
+		return $this->get('ATT_email');
451 451
 	}
452 452
 
453 453
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * @return string
458 458
 	 */
459 459
 	public function phone() {
460
-		return $this->get( 'ATT_phone' );
460
+		return $this->get('ATT_phone');
461 461
 	}
462 462
 
463 463
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 	 * @return        bool
468 468
 	 */
469 469
 	public function deleted() {
470
-		return $this->get( 'ATT_deleted' );
470
+		return $this->get('ATT_deleted');
471 471
 	}
472 472
 
473 473
 
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 	 * @param array $query_params
478 478
 	 * @return EE_Registration[]
479 479
 	 */
480
-	public function get_registrations( $query_params = array() ) {
481
-		return $this->get_many_related( 'Registration', $query_params );
480
+	public function get_registrations($query_params = array()) {
481
+		return $this->get_many_related('Registration', $query_params);
482 482
 	}
483 483
 
484 484
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 	 * @return EE_Registration
489 489
 	 */
490 490
 	public function get_most_recent_registration() {
491
-		return $this->get_first_related( 'Registration', array( 'order_by' => array( 'REG_date' => 'DESC' ) ) ); //null, 'REG_date', 'DESC', '=', 'OBJECT_K');
491
+		return $this->get_first_related('Registration', array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K');
492 492
 	}
493 493
 
494 494
 
@@ -498,8 +498,8 @@  discard block
 block discarded – undo
498 498
 	 * @param int $event_id
499 499
 	 * @return EE_Registration
500 500
 	 */
501
-	public function get_most_recent_registration_for_event( $event_id ) {
502
-		return $this->get_first_related( 'Registrations', array( 'EVT_ID' => $event_id ), 'REG_date', 'DESC', '=', 'OBJECT_K' );
501
+	public function get_most_recent_registration_for_event($event_id) {
502
+		return $this->get_first_related('Registrations', array('EVT_ID' => $event_id), 'REG_date', 'DESC', '=', 'OBJECT_K');
503 503
 	}
504 504
 
505 505
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 	 * @return array
510 510
 	 */
511 511
 	public function events() {
512
-		return $this->get_many_related( 'Event' );
512
+		return $this->get_many_related('Event');
513 513
 	}
514 514
 
515 515
 	/**
@@ -518,17 +518,17 @@  discard block
 block discarded – undo
518 518
 	 * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class
519 519
 	 * @return EE_Form_Section_Proper
520 520
 	 */
521
-	public function billing_info_for_payment_method($payment_method){
521
+	public function billing_info_for_payment_method($payment_method) {
522 522
 		$pm_type = $payment_method->type_obj();
523
-		if( ! $pm_type instanceof EE_PMT_Base ){
523
+		if ( ! $pm_type instanceof EE_PMT_Base) {
524 524
 			return NULL;
525 525
 		}
526
-		$billing_info =  $this->get_post_meta( $this->get_billing_info_postmeta_name( $payment_method ), true );
527
-		if ( ! $billing_info){
526
+		$billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true);
527
+		if ( ! $billing_info) {
528 528
 			return NULL;
529 529
 		}
530 530
 		$billing_form = $pm_type->billing_form();
531
-		$billing_form->receive_form_submission( $billing_info, FALSE );
531
+		$billing_form->receive_form_submission($billing_info, FALSE);
532 532
 		return $billing_form;
533 533
 	}
534 534
 
@@ -538,10 +538,10 @@  discard block
 block discarded – undo
538 538
 	 * @param EE_Payment_Method $payment_method
539 539
 	 * @return string
540 540
 	 */
541
-	public function get_billing_info_postmeta_name($payment_method){
542
-		if( $payment_method->type_obj() instanceof EE_PMT_Base ){
543
-			return 'billing_info_' . $payment_method->type_obj()->system_name();
544
-		}else{
541
+	public function get_billing_info_postmeta_name($payment_method) {
542
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
543
+			return 'billing_info_'.$payment_method->type_obj()->system_name();
544
+		} else {
545 545
 			return NULL;
546 546
 		}
547 547
 	}
@@ -552,13 +552,13 @@  discard block
 block discarded – undo
552 552
 	 * @param EE_Payment_Method $payment_method
553 553
 	 * @return boolean
554 554
 	 */
555
-	public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method){
556
-		if( ! $billing_form instanceof EE_Billing_Attendee_Info_Form ){
557
-			EE_Error::add_error( __( 'Cannot save billing info because there is none.', 'event_espresso' ) );
555
+	public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method) {
556
+		if ( ! $billing_form instanceof EE_Billing_Attendee_Info_Form) {
557
+			EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso'));
558 558
 			return false;
559 559
 		}
560 560
 		$billing_form->clean_sensitive_data();
561
-		return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name( $payment_method ), $billing_form->input_values() );
561
+		return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method), $billing_form->input_values());
562 562
 	}
563 563
 
564 564
 }
Please login to merge, or discard this patch.
core/db_classes/EE_CPT_Base.class.php 1 patch
Spacing   +56 added lines, -56 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
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 * @param int    $parent_term_taxonomy_id optional
48 48
 	 * @return EE_Term_Taxonomy
49 49
 	 */
50
-	function add_event_category( $category_name, $category_description = NULL, $parent_term_taxonomy_id = NULL ) {
51
-		return $this->get_model()->add_event_category( $this, $category_name, $category_description, $parent_term_taxonomy_id );
50
+	function add_event_category($category_name, $category_description = NULL, $parent_term_taxonomy_id = NULL) {
51
+		return $this->get_model()->add_event_category($this, $category_name, $category_description, $parent_term_taxonomy_id);
52 52
 	}
53 53
 
54 54
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 * @param string $category_name
59 59
 	 * @return bool
60 60
 	 */
61
-	function remove_event_category( $category_name ) {
62
-		return $this->get_model()->remove_event_category( $this, $category_name );
61
+	function remove_event_category($category_name) {
62
+		return $this->get_model()->remove_event_category($this, $category_name);
63 63
 	}
64 64
 
65 65
 
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 	 * @param EE_Term_Taxonomy $term_taxonomy
71 71
 	 * @return EE_Base_Class the relation was removed from
72 72
 	 */
73
-	function remove_relation_to_term_taxonomy( $term_taxonomy ) {
74
-		if ( !$term_taxonomy ) {
75
-			EE_Error::add_error( sprintf( __( "No Term_Taxonomy provided which to remove from model object of type %s and id %d", "event_espresso" ), get_class( $this ), $this->ID() ), __FILE__, __FUNCTION__, __LINE__ );
73
+	function remove_relation_to_term_taxonomy($term_taxonomy) {
74
+		if ( ! $term_taxonomy) {
75
+			EE_Error::add_error(sprintf(__("No Term_Taxonomy provided which to remove from model object of type %s and id %d", "event_espresso"), get_class($this), $this->ID()), __FILE__, __FUNCTION__, __LINE__);
76 76
 			return NULL;
77 77
 		}
78
-		$term_taxonomy->set_count( $term_taxonomy->count() - 1 );
78
+		$term_taxonomy->set_count($term_taxonomy->count() - 1);
79 79
 		$term_taxonomy->save();
80
-		return $this->_remove_relation_to( $term_taxonomy, 'Term_Taxonomy' );
80
+		return $this->_remove_relation_to($term_taxonomy, 'Term_Taxonomy');
81 81
 	}
82 82
 
83 83
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @return int
102 102
 	 */
103 103
 	public function parent() {
104
-		return $this->get( 'parent' );
104
+		return $this->get('parent');
105 105
 	}
106 106
 
107 107
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return string
112 112
 	 */
113 113
 	public function status() {
114
-		return $this->get( 'status' );
114
+		return $this->get('status');
115 115
 	}
116 116
 
117 117
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	/**
120 120
 	 * @param string $status
121 121
 	 */
122
-	public function set_status( $status ) {
123
-		$this->set( 'status', $status );
122
+	public function set_status($status) {
123
+		$this->set('status', $status);
124 124
 	}
125 125
 
126 126
 
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 	 * @param string|array $attr Optional. Query string or array of attributes.
135 135
 	 * @return string HTML image element
136 136
 	 */
137
-	protected function _get_feature_image( $size, $attr ) {
137
+	protected function _get_feature_image($size, $attr) {
138 138
 		//first let's see if we already have the _feature_image property set AND if it has a cached element on it FOR the given size
139
-		$attr_key = is_array( $attr ) ? implode( '_', $attr ) : $attr;
140
-		$cache_key = is_array( $size ) ? implode( '_', $size ) . $attr_key : $size . $attr_key;
141
-		$this->_feature_image[ $cache_key ] = isset( $this->_feature_image[ $cache_key ] ) ? $this->_feature_image[ $cache_key ] : $this->get_model()->get_feature_image( $this->ID(), $size, $attr );
142
-		return $this->_feature_image[ $cache_key ];
139
+		$attr_key = is_array($attr) ? implode('_', $attr) : $attr;
140
+		$cache_key = is_array($size) ? implode('_', $size).$attr_key : $size.$attr_key;
141
+		$this->_feature_image[$cache_key] = isset($this->_feature_image[$cache_key]) ? $this->_feature_image[$cache_key] : $this->get_model()->get_feature_image($this->ID(), $size, $attr);
142
+		return $this->_feature_image[$cache_key];
143 143
 	}
144 144
 
145 145
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @param string|array $attr
151 151
 	 * @return string of html
152 152
 	 */
153
-	public function feature_image( $size = 'thumbnail', $attr = '' ) {
154
-		return $this->_get_feature_image( $size, $attr );
153
+	public function feature_image($size = 'thumbnail', $attr = '') {
154
+		return $this->_get_feature_image($size, $attr);
155 155
 	}
156 156
 
157 157
 
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 	 * @param  string|array $size can either be a string: 'thumbnail', 'medium', 'large', 'full' OR 2-item array representing width and height in pixels eg. array(32,32).
162 162
 	 * @return string|boolean          the url of the image or false if not found
163 163
 	 */
164
-	public function feature_image_url( $size = 'thumbnail' ) {
165
-		$attachment = wp_get_attachment_image_src( get_post_thumbnail_id( $this->ID() ), $size );
166
-		return !empty( $attachment ) ? $attachment[ 0 ] : FALSE;
164
+	public function feature_image_url($size = 'thumbnail') {
165
+		$attachment = wp_get_attachment_image_src(get_post_thumbnail_id($this->ID()), $size);
166
+		return ! empty($attachment) ? $attachment[0] : FALSE;
167 167
 	}
168 168
 
169 169
 
@@ -176,37 +176,37 @@  discard block
 block discarded – undo
176 176
 	 * @internal param array|string $related_obj_names if included this will be used to restore for related obj if not included then we just do restore on the meta.  We will accept an array of related_obj_names for restoration here.
177 177
 	 * @return void
178 178
 	 */
179
-	public function restore_revision( $revision_id, $related_obj_names = array(), $where_query = array() ) {
179
+	public function restore_revision($revision_id, $related_obj_names = array(), $where_query = array()) {
180 180
 		//get revision object
181
-		$revision_obj = $this->get_model()->get_one_by_ID( $revision_id );
182
-		if ( $revision_obj instanceof EE_CPT_Base ) {
181
+		$revision_obj = $this->get_model()->get_one_by_ID($revision_id);
182
+		if ($revision_obj instanceof EE_CPT_Base) {
183 183
 			//no related_obj_name so we assume we're saving a revision on this object.
184
-			if ( empty( $related_obj_names ) ) {
184
+			if (empty($related_obj_names)) {
185 185
 				$fields = $this->get_model()->get_meta_table_fields();
186
-				foreach ( $fields as $field ) {
187
-					$this->set( $field, $revision_obj->get( $field ) );
186
+				foreach ($fields as $field) {
187
+					$this->set($field, $revision_obj->get($field));
188 188
 				}
189 189
 				$this->save();
190 190
 			}
191
-			$related_obj_names = (array)$related_obj_names;
192
-			foreach ( $related_obj_names as $related_name ) {
191
+			$related_obj_names = (array) $related_obj_names;
192
+			foreach ($related_obj_names as $related_name) {
193 193
 				//related_obj_name so we're saving a revision on an object related to this object
194 194
 				//do we have $where_query params for this related object?  If we do then we include that.
195
-				$cols_n_values = isset( $where_query[ $related_name ] ) ? $where_query[ $related_name ] : array();
196
-				$where_params = !empty( $cols_n_values ) ? array( $cols_n_values ) : array();
197
-				$related_objs = $this->get_many_related( $related_name, $where_params );
198
-				$revision_related_objs = $revision_obj->get_many_related( $related_name, $where_params );
195
+				$cols_n_values = isset($where_query[$related_name]) ? $where_query[$related_name] : array();
196
+				$where_params = ! empty($cols_n_values) ? array($cols_n_values) : array();
197
+				$related_objs = $this->get_many_related($related_name, $where_params);
198
+				$revision_related_objs = $revision_obj->get_many_related($related_name, $where_params);
199 199
 				//load helper
200
-				EE_Registry::instance()->load_helper( 'Array' );
200
+				EE_Registry::instance()->load_helper('Array');
201 201
 				//remove related objs from this object that are not in revision
202 202
 				//array_diff *should* work cause I think objects are indexed by ID?
203
-				$related_to_remove = EEH_Array::object_array_diff( $related_objs, $revision_related_objs );
204
-				foreach ( $related_to_remove as $rr ) {
205
-					$this->_remove_relation_to( $rr, $related_name, $cols_n_values );
203
+				$related_to_remove = EEH_Array::object_array_diff($related_objs, $revision_related_objs);
204
+				foreach ($related_to_remove as $rr) {
205
+					$this->_remove_relation_to($rr, $related_name, $cols_n_values);
206 206
 				}
207 207
 				//add all related objs attached to revision to this object
208
-				foreach ( $revision_related_objs as $r_obj ) {
209
-					$this->_add_relation_to( $r_obj, $related_name, $cols_n_values );
208
+				foreach ($revision_related_objs as $r_obj) {
209
+					$this->_add_relation_to($r_obj, $related_name, $cols_n_values);
210 210
 				}
211 211
 			}
212 212
 		}
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 	 * <li>If $single is set to false, or left blank, the function returns an array containing all values of the specified key.</li>
223 223
 	 * <li>If $single is set to true, the function returns the first value of the specified key (not in an array</li></ul>
224 224
 	 */
225
-	public function get_post_meta( $meta_key = NULL, $single = FALSE ) {
226
-		return get_post_meta( $this->ID(), $meta_key, $single );
225
+	public function get_post_meta($meta_key = NULL, $single = FALSE) {
226
+		return get_post_meta($this->ID(), $meta_key, $single);
227 227
 	}
228 228
 
229 229
 
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
 	 * @throws EE_Error
237 237
 	 * @return mixed Returns meta_id if the meta doesn't exist, otherwise returns true on success and false on failure. NOTE: If the meta_value passed to this function is the same as the value that is already in the database, this function returns false.
238 238
 	 */
239
-	public function update_post_meta( $meta_key, $meta_value, $prev_value = NULL ) {
240
-		if ( !$this->ID() ) {
241
-			throw new EE_Error( sprintf( __( "You must save this custom post type before adding or updating a post meta field", "event_espresso" ) ) );
239
+	public function update_post_meta($meta_key, $meta_value, $prev_value = NULL) {
240
+		if ( ! $this->ID()) {
241
+			throw new EE_Error(sprintf(__("You must save this custom post type before adding or updating a post meta field", "event_espresso")));
242 242
 		}
243
-		return update_post_meta( $this->ID(), $meta_key, $meta_value, $prev_value );
243
+		return update_post_meta($this->ID(), $meta_key, $meta_value, $prev_value);
244 244
 	}
245 245
 
246 246
 
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
 	 * @throws EE_Error
254 254
 	 * @return boolean Boolean true, except if the $unique argument was set to true and a custom field with the given key already exists, in which case false is returned.
255 255
 	 */
256
-	public function add_post_meta( $meta_key, $meta_value, $unique = FALSE ) {
257
-		if ( !$this->ID() ) {
258
-			throw new EE_Error( sprintf( __( "You must save this custom post type before adding or updating a post meta field", "event_espresso" ) ) );
256
+	public function add_post_meta($meta_key, $meta_value, $unique = FALSE) {
257
+		if ( ! $this->ID()) {
258
+			throw new EE_Error(sprintf(__("You must save this custom post type before adding or updating a post meta field", "event_espresso")));
259 259
 		}
260
-		return add_post_meta( $this->ID(), $meta_key, $meta_value, $unique );
260
+		return add_post_meta($this->ID(), $meta_key, $meta_value, $unique);
261 261
 	}
262 262
 
263 263
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 * @return string
268 268
 	 */
269 269
 	public function get_permalink() {
270
-		return get_permalink( $this->ID() );
270
+		return get_permalink($this->ID());
271 271
 	}
272 272
 
273 273
 
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	 * @param array $query_params
278 278
 	 * @return EE_Term_Taxonomy
279 279
 	 */
280
-	public function term_taxonomies( $query_params = array() ) {
281
-		return $this->get_many_related( 'Term_Taxonomy', $query_params );
280
+	public function term_taxonomies($query_params = array()) {
281
+		return $this->get_many_related('Term_Taxonomy', $query_params);
282 282
 	}
283 283
 
284 284
 
Please login to merge, or discard this patch.