Completed
Branch FET-9413-questions-refactor (bd7ded)
by
unknown
196:24 queued 185:12
created
core/data_migration_scripts/EE_DMS_Core_4_3_0.dms.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
 		if($version_string <= '4.3.0' && $version_string >= '4.2.0' ){
41 41
 //			echo "$version_string can be migrated fro";
42 42
 			return true;
43
-		}elseif( ! $version_string ){
43
+		} elseif( ! $version_string ){
44 44
 //			echo "no version string provided: $version_string";
45 45
 			//no version string provided... this must be pre 4.2
46 46
 			return false;//changed mind. dont want people thinking they should migrate yet because they cant
47
-		}else{
47
+		} else{
48 48
 //			echo "$version_string doesnt apply";
49 49
 			return false;
50 50
 		}
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * mostly just
5 5
  * -adds QSO_order to the Question_Option table;
6 6
  */
7
-class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base{
7
+class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base {
8 8
 
9 9
 
10 10
 
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 
30 30
 	public function can_migrate_from_version($version_array) {
31 31
 		$version_string = $version_array['Core'];
32
-		if($version_string <= '4.3.0' && $version_string >= '4.2.0' ){
32
+		if ($version_string <= '4.3.0' && $version_string >= '4.2.0') {
33 33
 //			echo "$version_string can be migrated fro";
34 34
 			return true;
35
-		}elseif( ! $version_string ){
35
+		}elseif ( ! $version_string) {
36 36
 //			echo "no version string provided: $version_string";
37 37
 			//no version string provided... this must be pre 4.2
38
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
39
-		}else{
38
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
39
+		} else {
40 40
 //			echo "$version_string doesnt apply";
41 41
 			return false;
42 42
 		}
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 	public function schema_changes_before_migration() {
48 48
 		//relies on 4.1's EEH_Activation::create_table
49
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
50
-		$table_name='esp_answer';
51
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
49
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
50
+		$table_name = 'esp_answer';
51
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
52 52
 					REG_ID INT UNSIGNED NOT NULL,
53 53
 					QST_ID INT UNSIGNED NOT NULL,
54 54
 					ANS_value TEXT NOT NULL,
55 55
 					PRIMARY KEY  (ANS_ID)";
56
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
56
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
57 57
 
58 58
 		$table_name = 'esp_attendee_meta';
59 59
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
93 93
 					  CNT_active TINYINT(1) DEFAULT '0',
94 94
 					  PRIMARY KEY  (CNT_ISO)";
95
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
95
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
96 96
 
97 97
 
98 98
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
 
117 117
 
118
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
118
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
119 119
 		$table_name = 'esp_event_meta';
120 120
 		$sql = "
121 121
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -132,41 +132,41 @@  discard block
 block discarded – undo
132 132
 			EVT_external_URL VARCHAR(200) NULL,
133 133
 			EVT_donations TINYINT(1) NULL,
134 134
 			PRIMARY KEY  (EVTM_ID)";
135
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
135
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
136 136
 
137 137
 
138 138
 
139
-		$table_name='esp_event_question_group';
140
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
139
+		$table_name = 'esp_event_question_group';
140
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
141 141
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
142 142
 					QSG_ID INT UNSIGNED NOT NULL,
143 143
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
144 144
 					PRIMARY KEY  (EQG_ID)";
145
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
145
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
146 146
 
147 147
 
148 148
 
149
-		$table_name='esp_event_venue';
150
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
149
+		$table_name = 'esp_event_venue';
150
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
151 151
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
152 152
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
153 153
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
154 154
 				PRIMARY KEY  (EVV_ID)";
155
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
155
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
156 156
 
157 157
 
158 158
 
159
-		$table_name='esp_extra_meta';
160
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
159
+		$table_name = 'esp_extra_meta';
160
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
161 161
 				OBJ_ID INT(11) DEFAULT NULL,
162 162
 				EXM_type VARCHAR(45) DEFAULT NULL,
163 163
 				EXM_key VARCHAR(45) DEFAULT NULL,
164 164
 				EXM_value TEXT,
165 165
 				PRIMARY KEY  (EXM_ID)";
166
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
166
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
167 167
 
168
-		$table_name='esp_line_item';
169
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
168
+		$table_name = 'esp_line_item';
169
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
170 170
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
171 171
 				TXN_ID INT(11) DEFAULT NULL,
172 172
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 				OBJ_ID INT(11) DEFAULT NULL,
183 183
 				OBJ_type VARCHAR(45)DEFAULT NULL,
184 184
 				PRIMARY KEY  (LIN_ID)";
185
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
185
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
186 186
 
187 187
 		$table_name = 'esp_message_template';
188 188
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 					KEY GRP_ID (GRP_ID)";
195 195
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
196 196
 
197
-		EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' );
197
+		EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID');
198 198
 
199 199
 		$table_name = 'esp_message_template_group';
200 200
 		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
210 210
 					PRIMARY KEY  (GRP_ID),
211 211
 					KEY MTP_user_id (MTP_user_id)";
212
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
212
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
213 213
 
214 214
 		$table_name = 'esp_event_message_template';
215 215
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 					PRIMARY KEY  (EMT_ID),
219 219
 					KEY EVT_ID (EVT_ID),
220 220
 					KEY GRP_ID (GRP_ID)";
221
-		$this->_table_is_new_in_this_version( $table_name, $sql, 'ENGINE=InnoDB');
221
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
222 222
 
223 223
 
224 224
 
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 
328 328
 
329 329
 
330
-		$table_name='esp_question';
331
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
330
+		$table_name = 'esp_question';
331
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
332 332
 					QST_display_text TEXT NOT NULL,
333 333
 					QST_admin_label VARCHAR(255) NOT NULL,
334 334
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
 					QST_wp_user BIGINT UNSIGNED NULL,
341 341
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
342 342
 					PRIMARY KEY  (QST_ID)';
343
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
343
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
344 344
 
345
-		EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' );
345
+		EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE');
346 346
 
347 347
 		$table_name = 'esp_question_group';
348
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
348
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
349 349
 					QSG_name VARCHAR(255) NOT NULL,
350 350
 					QSG_identifier VARCHAR(100) NOT NULL,
351 351
 					QSG_desc TEXT NULL,
@@ -356,29 +356,29 @@  discard block
 block discarded – undo
356 356
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
357 357
 					PRIMARY KEY  (QSG_ID),
358 358
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
359
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
359
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
360 360
 
361 361
 
362 362
 
363
-		$table_name='esp_question_group_question';
364
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
363
+		$table_name = 'esp_question_group_question';
364
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
365 365
 					QSG_ID INT UNSIGNED NOT NULL,
366 366
 					QST_ID INT UNSIGNED NOT NULL,
367 367
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
368 368
 					PRIMARY KEY  (QGQ_ID) ";
369
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
369
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
370 370
 
371 371
 
372 372
 
373
-		$table_name='esp_question_option';
374
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
373
+		$table_name = 'esp_question_option';
374
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
375 375
 					QSO_value VARCHAR(255) NOT NULL,
376 376
 					QSO_desc TEXT NOT NULL,
377 377
 					QST_ID INT UNSIGNED NOT NULL,
378 378
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
379 379
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
380 380
 					PRIMARY KEY  (QSO_ID)";
381
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
381
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
382 382
 
383 383
 
384 384
 
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
 
412 412
 
413 413
 
414
-		$table_name='esp_checkin';
415
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
414
+		$table_name = 'esp_checkin';
415
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
416 416
 					REG_ID INT(10) UNSIGNED NOT NULL,
417 417
 					DTT_ID INT(10) UNSIGNED NOT NULL,
418 418
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
487 487
 
488 488
 
489
-		$script_with_defaults = EE_Registry::instance()->load_dms( 'Core_4_1_0' );
489
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
490 490
 		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
491 491
 		//(because many need to convert old string states to foreign keys into the states table)
492 492
 		$script_with_defaults->insert_default_states();
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		return true;
509 509
 	}
510 510
 
511
-	public function migration_page_hooks(){
511
+	public function migration_page_hooks() {
512 512
 
513 513
 	}
514 514
 
@@ -524,34 +524,34 @@  discard block
 block discarded – undo
524 524
 
525 525
 		global $wpdb;
526 526
 		$ticket_table = $wpdb->prefix."esp_ticket";
527
-		if ( EEH_Activation::table_exists( $ticket_table ) ) {
527
+		if (EEH_Activation::table_exists($ticket_table)) {
528 528
 
529
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
529
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
530 530
 			$tickets_exist = $wpdb->get_var($SQL);
531 531
 
532
-			if ( ! $tickets_exist ) {
532
+			if ( ! $tickets_exist) {
533 533
 				$SQL = "INSERT INTO $ticket_table
534 534
 					( 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_deleted ) VALUES
535
-					( 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, 0);";
536
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL );
535
+					( 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, 0);";
536
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
537 537
 				$wpdb->query($SQL);
538 538
 			}
539 539
 		}
540 540
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
541 541
 
542
-		if ( EEH_Activation::table_exists( $ticket_price_table ) ) {
542
+		if (EEH_Activation::table_exists($ticket_price_table)) {
543 543
 
544
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
544
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
545 545
 			$ticket_prc_exist = $wpdb->get_var($SQL);
546 546
 
547
-			if ( ! $ticket_prc_exist ) {
547
+			if ( ! $ticket_prc_exist) {
548 548
 
549 549
 				$SQL = "INSERT INTO $ticket_price_table
550 550
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
551 551
 				( 1, 1, 1 )
552 552
 				";
553 553
 
554
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL );
554
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
555 555
 				$wpdb->query($SQL);
556 556
 			}
557 557
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_5_0.dms.php 2 patches
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.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * -adds DTT_name and DTT_description to the datetime table;
7 7
  * -adds users onto prices, price types, question groups, and tickets
8 8
  */
9
-class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base{
9
+class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base {
10 10
 
11 11
 
12 12
 
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function can_migrate_from_version($version_array) {
35 35
 		$version_string = $version_array['Core'];
36
-		if($version_string <= '4.5.0' && $version_string >= '4.3.0' ){
36
+		if ($version_string <= '4.5.0' && $version_string >= '4.3.0') {
37 37
 //			echo "$version_string can be migrated from";
38 38
 			return true;
39
-		}elseif( ! $version_string ){
39
+		}elseif ( ! $version_string) {
40 40
 //			echo "no version string provided: $version_string";
41 41
 			//no version string provided... this must be pre 4.3
42
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
43
-		}else{
42
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
43
+		} else {
44 44
 //			echo "$version_string doesnt apply";
45 45
 			return false;
46 46
 		}
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 	public function schema_changes_before_migration() {
52 52
 		//relies on 4.1's EEH_Activation::create_table
53
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
54
-		$table_name='esp_answer';
55
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
53
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
54
+		$table_name = 'esp_answer';
55
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
56 56
 					REG_ID INT UNSIGNED NOT NULL,
57 57
 					QST_ID INT UNSIGNED NOT NULL,
58 58
 					ANS_value TEXT NOT NULL,
59 59
 					PRIMARY KEY  (ANS_ID)";
60
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
60
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
61 61
 
62 62
 		$table_name = 'esp_attendee_meta';
63 63
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
97 97
 					  CNT_active TINYINT(1) DEFAULT '0',
98 98
 					  PRIMARY KEY  (CNT_ISO)";
99
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
99
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
100 100
 
101 101
 		$table_name = 'esp_datetime';
102 102
 		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 
119 119
 
120
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
120
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
121 121
 		$table_name = 'esp_event_meta';
122 122
 		$sql = "
123 123
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -134,41 +134,41 @@  discard block
 block discarded – undo
134 134
 			EVT_external_URL VARCHAR(200) NULL,
135 135
 			EVT_donations TINYINT(1) NULL,
136 136
 			PRIMARY KEY  (EVTM_ID)";
137
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
137
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138 138
 
139 139
 
140 140
 
141
-		$table_name='esp_event_question_group';
142
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
141
+		$table_name = 'esp_event_question_group';
142
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
143 143
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
144 144
 					QSG_ID INT UNSIGNED NOT NULL,
145 145
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
146 146
 					PRIMARY KEY  (EQG_ID)";
147
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
147
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
148 148
 
149 149
 
150 150
 
151
-		$table_name='esp_event_venue';
152
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
151
+		$table_name = 'esp_event_venue';
152
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
153 153
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
154 154
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
155 155
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
156 156
 				PRIMARY KEY  (EVV_ID)";
157
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
157
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
158 158
 
159 159
 
160 160
 
161
-		$table_name='esp_extra_meta';
162
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
161
+		$table_name = 'esp_extra_meta';
162
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
163 163
 				OBJ_ID INT(11) DEFAULT NULL,
164 164
 				EXM_type VARCHAR(45) DEFAULT NULL,
165 165
 				EXM_key VARCHAR(45) DEFAULT NULL,
166 166
 				EXM_value TEXT,
167 167
 				PRIMARY KEY  (EXM_ID)";
168
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
168
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169 169
 
170
-		$table_name='esp_line_item';
171
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
170
+		$table_name = 'esp_line_item';
171
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
172 172
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
173 173
 				TXN_ID INT(11) DEFAULT NULL,
174 174
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				OBJ_ID INT(11) DEFAULT NULL,
185 185
 				OBJ_type VARCHAR(45)DEFAULT NULL,
186 186
 				PRIMARY KEY  (LIN_ID)";
187
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
187
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
188 188
 
189 189
 		$table_name = 'esp_message_template';
190 190
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 					KEY GRP_ID (GRP_ID)";
197 197
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
198 198
 
199
-		EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' );
199
+		EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID');
200 200
 
201 201
 		$table_name = 'esp_message_template_group';
202 202
 		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
212 212
 					PRIMARY KEY  (GRP_ID),
213 213
 					KEY MTP_user_id (MTP_user_id)";
214
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
214
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
215 215
 
216 216
 		$table_name = 'esp_event_message_template';
217 217
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 					PRIMARY KEY  (EMT_ID),
221 221
 					KEY EVT_ID (EVT_ID),
222 222
 					KEY GRP_ID (GRP_ID)";
223
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
223
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
224 224
 
225 225
 
226 226
 		$table_name = 'esp_payment';
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 					  PRIMARY KEY  (TTM_ID)";
271 271
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
272 272
 
273
-		$table_name='esp_question';
274
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
273
+		$table_name = 'esp_question';
274
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
275 275
 					QST_display_text TEXT NOT NULL,
276 276
 					QST_admin_label VARCHAR(255) NOT NULL,
277 277
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -283,27 +283,27 @@  discard block
 block discarded – undo
283 283
 					QST_wp_user BIGINT UNSIGNED NULL,
284 284
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
285 285
 					PRIMARY KEY  (QST_ID)';
286
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
286
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
287 287
 
288
-		$table_name='esp_question_group_question';
289
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
288
+		$table_name = 'esp_question_group_question';
289
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
290 290
 					QSG_ID INT UNSIGNED NOT NULL,
291 291
 					QST_ID INT UNSIGNED NOT NULL,
292 292
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
293 293
 					PRIMARY KEY  (QGQ_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
 
298
-		$table_name='esp_question_option';
299
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
298
+		$table_name = 'esp_question_option';
299
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
300 300
 					QSO_value VARCHAR(255) NOT NULL,
301 301
 					QSO_desc TEXT NOT NULL,
302 302
 					QST_ID INT UNSIGNED NOT NULL,
303 303
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
304 304
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
305 305
 					PRIMARY KEY  (QSO_ID)";
306
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
306
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
307 307
 
308 308
 
309 309
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 
337 337
 
338 338
 
339
-		$table_name='esp_checkin';
340
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
339
+		$table_name = 'esp_checkin';
340
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
341 341
 					REG_ID INT(10) UNSIGNED NOT NULL,
342 342
 					DTT_ID INT(10) UNSIGNED NOT NULL,
343 343
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 					  PRC_wp_user BIGINT UNSIGNED NULL,
426 426
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
427 427
 					  PRIMARY KEY  (PRC_ID)";
428
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
428
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
429 429
 
430 430
 		$table_name = "esp_price_type";
431 431
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -462,12 +462,12 @@  discard block
 block discarded – undo
462 462
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
463 463
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
464 464
 					  PRIMARY KEY  (TKT_ID)";
465
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
465
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
466 466
 
467
-		EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' );
467
+		EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE');
468 468
 
469 469
 		$table_name = 'esp_question_group';
470
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
470
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
471 471
 					QSG_name VARCHAR(255) NOT NULL,
472 472
 					QSG_identifier VARCHAR(100) NOT NULL,
473 473
 					QSG_desc TEXT NULL,
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 					QSG_wp_user BIGINT UNSIGNED NULL,
480 480
 					PRIMARY KEY  (QSG_ID),
481 481
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
482
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
482
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
483 483
 
484 484
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
485 485
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		return true;
504 504
 	}
505 505
 
506
-	public function migration_page_hooks(){
506
+	public function migration_page_hooks() {
507 507
 
508 508
 	}
509 509
 
@@ -517,21 +517,21 @@  discard block
 block discarded – undo
517 517
 		global $wpdb;
518 518
 		$price_type_table = $wpdb->prefix."esp_price_type";
519 519
 
520
-		if ( EEH_Activation::table_exists( $price_type_table ) ) {
520
+		if (EEH_Activation::table_exists($price_type_table)) {
521 521
 
522
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
523
-			$price_types_exist = $wpdb->get_var( $SQL );
522
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
523
+			$price_types_exist = $wpdb->get_var($SQL);
524 524
 
525
-			if ( ! $price_types_exist ) {
525
+			if ( ! $price_types_exist) {
526 526
 				$user_id = EEH_Activation::get_default_creator_id();
527 527
 				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
528
-							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, $user_id, 0),
529
-							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, $user_id, 0),
530
-							(3, '" . __('Dollar Discount', 'event_espresso') . "', 2,  0, 30, $user_id, 0),
531
-							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, $user_id,  0),
532
-							(5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3,  0, 50, $user_id, 0);";
533
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL );
534
-				$wpdb->query( $SQL );
528
+							(1, '".__('Base Price', 'event_espresso')."', 1,  0, 0, $user_id, 0),
529
+							(2, '".__('Percent Discount', 'event_espresso')."', 2,  1, 20, $user_id, 0),
530
+							(3, '".__('Dollar Discount', 'event_espresso')."', 2,  0, 30, $user_id, 0),
531
+							(4, '".__('Percent Surcharge', 'event_espresso')."', 3,  1, 40, $user_id,  0),
532
+							(5, '".__('Dollar Surcharge', 'event_espresso')."', 3,  0, 50, $user_id, 0);";
533
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
534
+				$wpdb->query($SQL);
535 535
 			}
536 536
 		}
537 537
 	}
@@ -551,17 +551,17 @@  discard block
 block discarded – undo
551 551
 		global $wpdb;
552 552
 		$price_table = $wpdb->prefix."esp_price";
553 553
 
554
-		if ( EEH_Activation::table_exists( $price_table ) ) {
554
+		if (EEH_Activation::table_exists($price_table)) {
555 555
 
556
-			$SQL = 'SELECT COUNT(PRC_ID) FROM ' .$price_table;
557
-			$prices_exist = $wpdb->get_var( $SQL );
556
+			$SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
557
+			$prices_exist = $wpdb->get_var($SQL);
558 558
 
559
-			if ( ! $prices_exist ) {
559
+			if ( ! $prices_exist) {
560 560
 				$user_id = EEH_Activation::get_default_creator_id();
561 561
 				$SQL = "INSERT INTO $price_table
562 562
 							(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
563 563
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);";
564
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL );
564
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
565 565
 				$wpdb->query($SQL);
566 566
 			}
567 567
 		}
@@ -579,35 +579,35 @@  discard block
 block discarded – undo
579 579
 
580 580
 		global $wpdb;
581 581
 		$ticket_table = $wpdb->prefix."esp_ticket";
582
-		if ( EEH_Activation::table_exists( $ticket_table ) ) {
582
+		if (EEH_Activation::table_exists($ticket_table)) {
583 583
 
584
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
584
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
585 585
 			$tickets_exist = $wpdb->get_var($SQL);
586 586
 
587
-			if ( ! $tickets_exist ) {
587
+			if ( ! $tickets_exist) {
588 588
 				$user_id = EEH_Activation::get_default_creator_id();
589 589
 				$SQL = "INSERT INTO $ticket_table
590 590
 					( 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
591
-					( 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);";
592
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL );
591
+					( 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);";
592
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
593 593
 				$wpdb->query($SQL);
594 594
 			}
595 595
 		}
596 596
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
597 597
 
598
-		if ( EEH_Activation::table_exists( $ticket_price_table ) ) {
598
+		if (EEH_Activation::table_exists($ticket_price_table)) {
599 599
 
600
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
600
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
601 601
 			$ticket_prc_exist = $wpdb->get_var($SQL);
602 602
 
603
-			if ( ! $ticket_prc_exist ) {
603
+			if ( ! $ticket_prc_exist) {
604 604
 
605 605
 				$SQL = "INSERT INTO $ticket_price_table
606 606
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
607 607
 				( 1, 1, 1 )
608 608
 				";
609 609
 
610
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL );
610
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
611 611
 				$wpdb->query($SQL);
612 612
 			}
613 613
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_6_0.dms.php 2 patches
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.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @author        Mike Nelson
11 11
  * @since         4.6.0
12 12
  */
13
-class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base{
13
+class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base {
14 14
 
15 15
 	/**
16 16
 	 * return EE_DMS_Core_4_6_0
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function can_migrate_from_version($version_array) {
45 45
 		$version_string = $version_array['Core'];
46
-		if($version_string <= '4.6.0' && $version_string >= '4.5.0' ){
46
+		if ($version_string <= '4.6.0' && $version_string >= '4.5.0') {
47 47
 //			echo "$version_string can be migrated from";
48 48
 			return true;
49
-		}elseif( ! $version_string ){
49
+		}elseif ( ! $version_string) {
50 50
 //			echo "no version string provided: $version_string";
51 51
 			//no version string provided... this must be pre 4.3
52
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
53
-		}else{
52
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
53
+		} else {
54 54
 //			echo "$version_string doesnt apply";
55 55
 			return false;
56 56
 		}
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function schema_changes_before_migration() {
74 74
 		//relies on 4.1's EEH_Activation::create_table
75
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
76
-		$table_name='esp_answer';
77
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
75
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
76
+		$table_name = 'esp_answer';
77
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
78 78
 					REG_ID INT UNSIGNED NOT NULL,
79 79
 					QST_ID INT UNSIGNED NOT NULL,
80 80
 					ANS_value TEXT NOT NULL,
81 81
 					PRIMARY KEY  (ANS_ID)";
82
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
82
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
83 83
 
84 84
 		$table_name = 'esp_attendee_meta';
85 85
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
119 119
 					  CNT_active TINYINT(1) DEFAULT '0',
120 120
 					  PRIMARY KEY  (CNT_ISO)";
121
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
121
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
122 122
 
123 123
 		$table_name = 'esp_currency';
124 124
 		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
129 129
 				CUR_active TINYINT(1) DEFAULT '0',
130 130
 				PRIMARY KEY  (CUR_code)";
131
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
131
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
132 132
 
133 133
 
134 134
 		$table_name = 'esp_currency_payment_method';
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 
160 160
 
161
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
161
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
162 162
 		$table_name = 'esp_event_meta';
163 163
 		$sql = "
164 164
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -175,41 +175,41 @@  discard block
 block discarded – undo
175 175
 			EVT_external_URL VARCHAR(200) NULL,
176 176
 			EVT_donations TINYINT(1) NULL,
177 177
 			PRIMARY KEY  (EVTM_ID)";
178
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
178
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
179 179
 
180 180
 
181 181
 
182
-		$table_name='esp_event_question_group';
183
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
182
+		$table_name = 'esp_event_question_group';
183
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
184 184
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
185 185
 					QSG_ID INT UNSIGNED NOT NULL,
186 186
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
187 187
 					PRIMARY KEY  (EQG_ID)";
188
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
188
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
189 189
 
190 190
 
191 191
 
192
-		$table_name='esp_event_venue';
193
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
192
+		$table_name = 'esp_event_venue';
193
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
194 194
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
195 195
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
196 196
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
197 197
 				PRIMARY KEY  (EVV_ID)";
198
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
198
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
199 199
 
200 200
 
201 201
 
202
-		$table_name='esp_extra_meta';
203
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
202
+		$table_name = 'esp_extra_meta';
203
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
204 204
 				OBJ_ID INT(11) DEFAULT NULL,
205 205
 				EXM_type VARCHAR(45) DEFAULT NULL,
206 206
 				EXM_key VARCHAR(45) DEFAULT NULL,
207 207
 				EXM_value TEXT,
208 208
 				PRIMARY KEY  (EXM_ID)";
209
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
209
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
210 210
 
211
-		$table_name='esp_line_item';
212
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
211
+		$table_name = 'esp_line_item';
212
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
213 213
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
214 214
 				TXN_ID INT(11) DEFAULT NULL,
215 215
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 				OBJ_ID INT(11) DEFAULT NULL,
226 226
 				OBJ_type VARCHAR(45)DEFAULT NULL,
227 227
 				PRIMARY KEY  (LIN_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 230
 		$table_name = 'esp_log';
231 231
 		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 					KEY GRP_ID (GRP_ID)";
249 249
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
250 250
 
251
-		EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' );
251
+		EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID');
252 252
 
253 253
 		$table_name = 'esp_message_template_group';
254 254
 		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
264 264
 					PRIMARY KEY  (GRP_ID),
265 265
 					KEY MTP_user_id (MTP_user_id)";
266
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
266
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
267 267
 
268 268
 		$table_name = 'esp_event_message_template';
269 269
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 					PRIMARY KEY  (EMT_ID),
273 273
 					KEY EVT_ID (EVT_ID),
274 274
 					KEY GRP_ID (GRP_ID)";
275
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
275
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
276 276
 
277 277
 
278 278
 		$table_name = 'esp_payment';
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 					  PRIMARY KEY  (TTM_ID)";
341 341
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
342 342
 
343
-		$table_name='esp_question';
344
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
343
+		$table_name = 'esp_question';
344
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
345 345
 					QST_display_text TEXT NOT NULL,
346 346
 					QST_admin_label VARCHAR(255) NOT NULL,
347 347
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -353,27 +353,27 @@  discard block
 block discarded – undo
353 353
 					QST_wp_user BIGINT UNSIGNED NULL,
354 354
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
355 355
 					PRIMARY KEY  (QST_ID)';
356
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
356
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
357 357
 
358
-		$table_name='esp_question_group_question';
359
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
358
+		$table_name = 'esp_question_group_question';
359
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
360 360
 					QSG_ID INT UNSIGNED NOT NULL,
361 361
 					QST_ID INT UNSIGNED NOT NULL,
362 362
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
363 363
 					PRIMARY KEY  (QGQ_ID) ";
364
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
364
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
365 365
 
366 366
 
367 367
 
368
-		$table_name='esp_question_option';
369
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
368
+		$table_name = 'esp_question_option';
369
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
370 370
 					QSO_value VARCHAR(255) NOT NULL,
371 371
 					QSO_desc TEXT NOT NULL,
372 372
 					QST_ID INT UNSIGNED NOT NULL,
373 373
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
374 374
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
375 375
 					PRIMARY KEY  (QSO_ID)";
376
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
376
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
377 377
 
378 378
 
379 379
 
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 
407 407
 
408 408
 
409
-		$table_name='esp_checkin';
410
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
409
+		$table_name = 'esp_checkin';
410
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
411 411
 					REG_ID INT(10) UNSIGNED NOT NULL,
412 412
 					DTT_ID INT(10) UNSIGNED NOT NULL,
413 413
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 					  PRC_wp_user BIGINT UNSIGNED NULL,
497 497
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
498 498
 					  PRIMARY KEY  (PRC_ID)";
499
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
499
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
500 500
 
501 501
 		$table_name = "esp_price_type";
502 502
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -533,12 +533,12 @@  discard block
 block discarded – undo
533 533
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
534 534
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
535 535
 					  PRIMARY KEY  (TKT_ID)";
536
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
536
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
537 537
 
538
-		EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' );
538
+		EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE');
539 539
 
540 540
 		$table_name = 'esp_question_group';
541
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
541
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
542 542
 					QSG_name VARCHAR(255) NOT NULL,
543 543
 					QSG_identifier VARCHAR(100) NOT NULL,
544 544
 					QSG_desc TEXT NULL,
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 					QSG_wp_user BIGINT UNSIGNED NULL,
551 551
 					PRIMARY KEY  (QSG_ID),
552 552
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
553
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
553
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
554 554
 
555 555
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
556 556
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -578,15 +578,15 @@  discard block
 block discarded – undo
578 578
 		return true;
579 579
 	}
580 580
 
581
-	public function migration_page_hooks(){
581
+	public function migration_page_hooks() {
582 582
 
583 583
 	}
584 584
 
585
-	public function add_default_admin_only_payments(){
585
+	public function add_default_admin_only_payments() {
586 586
 		global $wpdb;
587 587
 		$table_name = $wpdb->prefix."esp_payment_method";
588 588
 		$user_id = EEH_Activation::get_default_creator_id();
589
-		if ( EEH_Activation::table_exists( $table_name ) ) {
589
+		if (EEH_Activation::table_exists($table_name)) {
590 590
 
591 591
 			$SQL = "SELECT COUNT( * ) FROM $table_name";
592 592
 			$existing_payment_methods = $wpdb->get_var($SQL);
@@ -607,11 +607,11 @@  discard block
 block discarded – undo
607 607
 			//so admins can record payments for them from the admin page
608 608
 
609 609
 
610
-			foreach($default_admin_only_payment_methods as $nicename => $description){
610
+			foreach ($default_admin_only_payment_methods as $nicename => $description) {
611 611
 				$slug = sanitize_key($nicename);
612 612
 			//check that such a payment method exists
613
-				$exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s",$slug));
614
-				if( ! $exists){
613
+				$exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
614
+				if ( ! $exists) {
615 615
 					$values = array(
616 616
 								'PMD_type'=>'Admin_Only',
617 617
 								'PMD_name'=>$nicename,
@@ -625,17 +625,17 @@  discard block
 block discarded – undo
625 625
 							$table_name,
626 626
 							$values,
627 627
 							array(
628
-								'%s',//PMD_type
629
-								'%s',//PMD_name
630
-								'%s',//PMD_admin_name
631
-								'%s',//PMD_admin_desc
632
-								'%s',//PMD_slug
633
-								'%d',//PMD_wp_user
634
-								'%s',//PMD_scope
628
+								'%s', //PMD_type
629
+								'%s', //PMD_name
630
+								'%s', //PMD_admin_name
631
+								'%s', //PMD_admin_desc
632
+								'%s', //PMD_slug
633
+								'%d', //PMD_wp_user
634
+								'%s', //PMD_scope
635 635
 							)
636 636
 							);
637
-					if( ! $success ){
638
-						$this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", "event_espresso"),$this->_json_encode($values)));
637
+					if ( ! $success) {
638
+						$this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration", "event_espresso"), $this->_json_encode($values)));
639 639
 					}
640 640
 				}
641 641
 			}
@@ -653,11 +653,11 @@  discard block
 block discarded – undo
653 653
 
654 654
 		global $wpdb;
655 655
 		$currency_table = $wpdb->prefix."esp_currency";
656
-		if ( EEH_Activation::table_exists( $currency_table ) ) {
656
+		if (EEH_Activation::table_exists($currency_table)) {
657 657
 
658 658
 			$SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
659 659
 			$countries = $wpdb->get_var($SQL);
660
-			if ( ! $countries ) {
660
+			if ( ! $countries) {
661 661
 				$SQL = "INSERT INTO $currency_table
662 662
 				( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES
663 663
 				( 'EUR',  'Euro',  'Euros',  '€',  2,1),
Please login to merge, or discard this patch.
admin_pages/registration_form/Registration_Form_Admin_Page.core.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
 
440 440
 	/**
441
-	 * @param            $per_page
441
+	 * @param            integer $per_page
442 442
 	 * @param int        $current_page
443 443
 	 * @param bool|false $count
444 444
 	 * @return \EE_Soft_Delete_Base_Class[]
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 
460 460
 
461 461
 	/**
462
-	 * @param      $per_page
462
+	 * @param      integer $per_page
463 463
 	 * @param int  $current_page
464 464
 	 * @param bool $count
465 465
 	 * @return \EE_Soft_Delete_Base_Class[]|int
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 
546 546
 
547 547
 	/**
548
-	 * @return array
548
+	 * @return EventEspresso\core\libraries\form_sections\inputs\EE_Form_Input_Base[]
549 549
 	 * @throws \EE_Error
550 550
 	 */
551 551
 	public function getAvailableFormInputs() {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 *_question_model EEM_Question model instance (for queries)
49 49
 	 *
50 50
 	 * @var EEM_Question $_question_model;
51
- */
51
+	 */
52 52
 	protected $_question_model;
53 53
 
54 54
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 				),
182 182
 				'list_table' => '\EventEspresso\admin_pages\registration_form\FormSectionListTable',
183 183
 				'metaboxes' => array(),
184
-                'help_tabs' => array(
184
+				'help_tabs' => array(
185 185
 					// 'registration_form_questions_overview_help_tab' => array(
186 186
 					// 	'title' => esc_html__('Questions Overview', 'event_espresso'),
187 187
 					// 	'filename' => 'registration_form_questions_overview'
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 				),
217 217
 				'metaboxes' => array_merge( array('_publish_post_box' ) ),
218 218
 				'help_tabs' => array(),
219
-                'help_tour' => array(),
219
+				'help_tour' => array(),
220 220
 				'require_nonce' => false
221 221
 			),
222 222
 		);
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 use EventEspresso\core\libraries\form_sections\inputs\FormInputsLoader;
8 8
 
9 9
 
10
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
11
-	exit( 'NO direct script access allowed' );
10
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
11
+	exit('NO direct script access allowed');
12 12
 }
13 13
 
14 14
 
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
67 67
 	 * 		@access public
68 68
 	 */
69
-	public function __construct( $routing = TRUE ) {
70
-		require_once( EE_MODELS . 'EEM_Question.model.php' );
71
-		require_once( EE_MODELS . 'EEM_Question_Group.model.php' );
72
-		$this->_question_model=  EEM_Question::instance();
73
-		$this->_question_group_model=EEM_Question_Group::instance();
74
-		parent::__construct( $routing );
69
+	public function __construct($routing = TRUE) {
70
+		require_once(EE_MODELS.'EEM_Question.model.php');
71
+		require_once(EE_MODELS.'EEM_Question_Group.model.php');
72
+		$this->_question_model = EEM_Question::instance();
73
+		$this->_question_group_model = EEM_Question_Group::instance();
74
+		parent::__construct($routing);
75 75
 	}
76 76
 
77 77
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		$this->_admin_page_title = esc_html__('Registration Form', 'event_espresso');
117 117
 		$this->_labels = array(
118 118
 			'buttons' => array(
119
-				'add_edit_form_section' => esc_html__( 'Add New Form Section', 'event_espresso' ),
119
+				'add_edit_form_section' => esc_html__('Add New Form Section', 'event_espresso'),
120 120
 				'edit_question' => esc_html__('Edit Question', 'event_espresso'),
121 121
 			)
122 122
 		);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 *_set_page_routes
129 129
 	 */
130 130
 	protected function _set_page_routes() {
131
-		$qsg_id = ! empty( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 1;
131
+		$qsg_id = ! empty($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 1;
132 132
 		$this->_page_routes = array(
133 133
 
134 134
 			'default' => array(
@@ -140,26 +140,26 @@  discard block
 block discarded – undo
140 140
 				'func' => 'add_edit_form_section',
141 141
 				'capability' => 'ee_edit_question_groups',
142 142
 				'obj_id' => $qsg_id,
143
-				'args' => array( 'edit' ),
143
+				'args' => array('edit'),
144 144
 			),
145 145
 
146 146
 			'form_section_preview' => array(
147 147
 				'func' => '_form_section_preview',
148 148
 				'capability' => 'ee_read_question_groups',
149 149
 				'obj_id' => $qsg_id,
150
-				'args' => array( 'edit' ),
150
+				'args' => array('edit'),
151 151
 			),
152 152
 
153 153
 			'insert_form_section' => array(
154 154
 				'func'       => '_insert_or_update_form_section',
155
-				'args'       => array( 'new_form_section' => true ),
155
+				'args'       => array('new_form_section' => true),
156 156
 				'capability' => 'ee_edit_question_groups',
157 157
 				'noheader'   => true,
158 158
 			),
159 159
 
160 160
 			'update_form_section' => array(
161 161
 				'func'       => '_insert_or_update_form_section',
162
-				'args'       => array( 'new_form_section' => false ),
162
+				'args'       => array('new_form_section' => false),
163 163
 				'capability' => 'ee_edit_question_group',
164 164
 				'obj_id'     => $qsg_id,
165 165
 				'noheader'   => true,
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
 					'label' => esc_html__('Add/Edit Form Section', 'event_espresso'),
208 208
 					'order' => 15,
209 209
 					'persistent' => false,
210
-					'url' => isset( $this->_req_data['QSG_ID'] )
210
+					'url' => isset($this->_req_data['QSG_ID'])
211 211
 						? add_query_arg(
212
-							array('QSG_ID' => $this->_req_data['QSG_ID'] ),
212
+							array('QSG_ID' => $this->_req_data['QSG_ID']),
213 213
 							$this->_current_page_view_url
214 214
 						)
215 215
 						: $this->_admin_base_url
216 216
 				),
217
-				'metaboxes' => array_merge( array('_publish_post_box' ) ),
217
+				'metaboxes' => array_merge(array('_publish_post_box')),
218 218
 				'help_tabs' => array(),
219 219
                 'help_tour' => array(),
220 220
 				'require_nonce' => false
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	public function load_scripts_styles() {
241 241
 		wp_register_style(
242 242
 			'espresso_registration',
243
-			REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css',
244
-			array( 'dashicons' ),
243
+			REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css',
244
+			array('dashicons'),
245 245
 			EVENT_ESPRESSO_VERSION
246 246
 		);
247 247
 		wp_enqueue_style('espresso_registration');
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
 		$this->load_scripts_styles_forms();
257 257
 		wp_register_script(
258 258
 			'espresso_registration_form_single',
259
-			REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js',
260
-			array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ),
261
-			EVENT_ESPRESSO_VERSION . time(),
259
+			REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js',
260
+			array('jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable'),
261
+			EVENT_ESPRESSO_VERSION.time(),
262 262
 			true
263 263
 		);
264
-		wp_enqueue_script( 'espresso_registration_form_single' );
264
+		wp_enqueue_script('espresso_registration_form_single');
265 265
 	}
266 266
 
267 267
 
@@ -271,19 +271,19 @@  discard block
 block discarded – undo
271 271
 		$this->load_scripts_styles_forms();
272 272
 		wp_register_script(
273 273
 			'espresso_registration_form_single',
274
-			REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js',
275
-			array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ),
276
-			EVENT_ESPRESSO_VERSION . time(),
274
+			REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js',
275
+			array('jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable'),
276
+			EVENT_ESPRESSO_VERSION.time(),
277 277
 			true
278 278
 		);
279
-		wp_enqueue_script( 'espresso_registration_form_single' );
279
+		wp_enqueue_script('espresso_registration_form_single');
280 280
 	}
281 281
 
282 282
 
283 283
 
284 284
 
285 285
 	public function recaptcha_info_help_tab() {
286
-		$template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php';
286
+		$template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php';
287 287
 		EEH_Template::display_template($template, array());
288 288
 	}
289 289
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 			)
314 314
 		);
315 315
 
316
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
316
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
317 317
 			$this->_views['trash'] = array(
318 318
 				'slug' => 'trash',
319 319
 				'label' => __('Trash', 'event_espresso'),
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 				)
340 340
 		);
341 341
 
342
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
342
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
343 343
 			$this->_views['trash'] = array(
344 344
 				'slug' => 'trash',
345 345
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 
355 355
 
356 356
 	protected function _form_sections_overview_list_table() {
357
-		$this->_search_btn_label = __( 'Form Sections', 'event_espresso' );
358
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
357
+		$this->_search_btn_label = __('Form Sections', 'event_espresso');
358
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
359 359
 				'add_edit_form_section',
360 360
 				'add_edit_form_section',
361 361
 				array(),
@@ -378,27 +378,27 @@  discard block
 block discarded – undo
378 378
 	 * @param int      $current_page
379 379
 	 * @return array lik EEM_Base::get_all's $query_params parameter
380 380
 	 */
381
-	protected function get_query_params( $model, $per_page = 10, $current_page = 10 ) {
381
+	protected function get_query_params($model, $per_page = 10, $current_page = 10) {
382 382
 		$query_params = array();
383
-		$offset = ( $current_page - 1 ) * $per_page;
384
-		$query_params['limit'] = array( $offset, $per_page );
385
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) )
383
+		$offset = ($current_page - 1) * $per_page;
384
+		$query_params['limit'] = array($offset, $per_page);
385
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order']))
386 386
 			? $this->_req_data['order'] : 'ASC';
387 387
 		$orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order';
388
-		$field_to_order_by = empty( $this->_req_data['orderby'] ) ? $orderby_field : $this->_req_data['orderby'];
389
-		$query_params['order_by'] = array( $field_to_order_by => $order );
390
-		$search_string = array_key_exists( 's', $this->_req_data ) ? $this->_req_data['s'] : null;
391
-		if ( ! empty( $search_string ) ) {
392
-			if ( $model instanceof EEM_Question_Group ) {
388
+		$field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby'];
389
+		$query_params['order_by'] = array($field_to_order_by => $order);
390
+		$search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null;
391
+		if ( ! empty($search_string)) {
392
+			if ($model instanceof EEM_Question_Group) {
393 393
 				$query_params[0] = array(
394 394
 					'OR' => array(
395
-						'QSG_name' => array( 'LIKE', "%$search_string%" ),
396
-						'QSG_desc' => array( 'LIKE', "%$search_string%" )
395
+						'QSG_name' => array('LIKE', "%$search_string%"),
396
+						'QSG_desc' => array('LIKE', "%$search_string%")
397 397
 					)
398 398
 				);
399 399
 			} else {
400 400
 				$query_params[0] = array(
401
-					'QST_display_text' => array( 'LIKE', "%$search_string%" )
401
+					'QST_display_text' => array('LIKE', "%$search_string%")
402 402
 				);
403 403
 			}
404 404
 		}
@@ -444,14 +444,14 @@  discard block
 block discarded – undo
444 444
 	 * @return \EE_Soft_Delete_Base_Class[]
445 445
 	 * @throws \EE_Error
446 446
 	 */
447
-	public function get_form_sections( $per_page, $current_page = 1, $count = false ) {
447
+	public function get_form_sections($per_page, $current_page = 1, $count = false) {
448 448
 		$questionGroupModel = EEM_Question_Group::instance();
449
-		$query_params = $this->get_query_params( $questionGroupModel, $per_page, $current_page );
450
-		if ( $count ) {
451
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
452
-			$results = $questionGroupModel->count( $where );
449
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
450
+		if ($count) {
451
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
452
+			$results = $questionGroupModel->count($where);
453 453
 		} else {
454
-			$results = $questionGroupModel->get_all( $query_params );
454
+			$results = $questionGroupModel->get_all($query_params);
455 455
 		}
456 456
 		return $results;
457 457
 	}
@@ -464,15 +464,15 @@  discard block
 block discarded – undo
464 464
 	 * @param bool $count
465 465
 	 * @return \EE_Soft_Delete_Base_Class[]|int
466 466
 	 */
467
-	public function get_trashed_form_sections( $per_page, $current_page = 1, $count = false ) {
467
+	public function get_trashed_form_sections($per_page, $current_page = 1, $count = false) {
468 468
 		$questionGroupModel = EEM_Question_Group::instance();
469
-		$query_params = $this->get_query_params( $questionGroupModel, $per_page, $current_page );
470
-		if ( $count ) {
471
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
469
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
470
+		if ($count) {
471
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
472 472
 			$query_params['limit'] = null;
473
-			$results = $questionGroupModel->count_deleted( $where );
473
+			$results = $questionGroupModel->count_deleted($where);
474 474
 		} else {
475
-			$results = $questionGroupModel->get_all_deleted( $query_params );
475
+			$results = $questionGroupModel->get_all_deleted($query_params);
476 476
 		}
477 477
 		return $results;
478 478
 	}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
490 490
 	 */
491 491
 	protected function add_edit_form_section() {
492
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
492
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
493 493
 		// are we editing an existing Question Group or creating a new one ?
494 494
 		$reg_form_editor = new RegistrationFormEditor(
495 495
 			$this,
@@ -507,9 +507,9 @@  discard block
 block discarded – undo
507 507
 			$reg_form_editor->getRoute(),
508 508
 			$reg_form_editor->getAdditionalHiddenFields()
509 509
 		);
510
-		$this->_set_publish_post_box_vars( 'id', $reg_form_editor->getQuestionGroupID() );
510
+		$this->_set_publish_post_box_vars('id', $reg_form_editor->getQuestionGroupID());
511 511
 		$reg_form_editor->addMetaBoxes();
512
-		$this->_template_args[ 'admin_page_content' ] = $reg_form_editor->getAdminPageContent();
512
+		$this->_template_args['admin_page_content'] = $reg_form_editor->getAdminPageContent();
513 513
 		// the details template wrapper
514 514
 		$this->display_admin_page_with_sidebar();
515 515
 	}
@@ -524,20 +524,20 @@  discard block
 block discarded – undo
524 524
 	public function getFormSection() {
525 525
 		// get copy of EE_Request
526 526
 		$request_data = $this->get_request_data();
527
-		$QSG_ID = isset( $request_data['QSG_ID'] ) && ! empty( $request_data['QSG_ID'] )
528
-			? absint( $request_data['QSG_ID'] )
527
+		$QSG_ID = isset($request_data['QSG_ID']) && ! empty($request_data['QSG_ID'])
528
+			? absint($request_data['QSG_ID'])
529 529
 			: 0;
530 530
 		// find question group if applicable
531
-		if ( $QSG_ID ) {
531
+		if ($QSG_ID) {
532 532
 			/** @var \EEM_Question_Group $question_group_model */
533 533
 			$question_group_model = $this->question_group_model();
534
-			$question_group = $question_group_model->get_one_by_ID( $QSG_ID );
534
+			$question_group = $question_group_model->get_one_by_ID($QSG_ID);
535 535
 		} else {
536 536
 			$question_group = \EE_Question_Group::new_instance();
537 537
 			$question_group->set_order_to_latest();
538 538
 		}
539
-		if ( ! $question_group instanceof \EE_Question_Group ) {
540
-			throw new InvalidEntityException( $question_group, 'EE_Question_Group' );
539
+		if ( ! $question_group instanceof \EE_Question_Group) {
540
+			throw new InvalidEntityException($question_group, 'EE_Question_Group');
541 541
 		}
542 542
 		return $question_group;
543 543
 	}
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 			'select_multi_model',
560 560
 			//'submit',
561 561
 		);
562
-		return FormInputsLoader::get( $exclude );
562
+		return FormInputsLoader::get($exclude);
563 563
 	}
564 564
 
565 565
 
@@ -569,49 +569,49 @@  discard block
 block discarded – undo
569 569
 	 * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
570 570
 	 * @throws \EE_Error
571 571
 	 */
572
-	protected function _insert_or_update_form_section( $new_question_group = true ) {
572
+	protected function _insert_or_update_form_section($new_question_group = true) {
573 573
 		$success = true;
574 574
 		// $reg_form_editor_form = new RegistrationFormEditorForm(
575 575
 		// 	$this->_question_model
576 576
 		// );
577 577
 		// $form = $reg_form_editor_form->rawForm( $this->getAvailableFormInputs() );
578
-		if ( ! ( isset( $_REQUEST['settings'] ) && is_array( $_REQUEST['settings'] ) ) ) {
578
+		if ( ! (isset($_REQUEST['settings']) && is_array($_REQUEST['settings']))) {
579 579
 			throw new InvalidFormSubmissionException(
580
-				__( 'Form Section settings are missing or invalid.', 'event_espresso' )
580
+				__('Form Section settings are missing or invalid.', 'event_espresso')
581 581
 			);
582 582
 		}
583 583
 		$field_settings = $this->_question_model->field_settings();
584 584
 		// \EEH_Debug_Tools::printr( $field_settings, '$field_settings', __FILE__, __LINE__ );
585
-		unset( $_REQUEST['reg_form']['clone'], $_REQUEST['settings']['clone'], $_REQUEST['input_options'] );
585
+		unset($_REQUEST['reg_form']['clone'], $_REQUEST['settings']['clone'], $_REQUEST['input_options']);
586 586
 		// \EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
587 587
 		// $reg_form_input_list = explode( ',', sanitize_text_field( $_REQUEST['reg_form_input_list'] ) );
588 588
 		// \EEH_Debug_Tools::printr( $reg_form_input_list, '$reg_form_input_list', __FILE__, __LINE__ );
589
-		foreach ( (array) $_REQUEST['settings'] as $identifier => $form_input_fields ) {
589
+		foreach ((array) $_REQUEST['settings'] as $identifier => $form_input_fields) {
590 590
 			// \EEH_Debug_Tools::printr( $identifier, '$identifier', __FILE__, __LINE__ );
591 591
 			// \EEH_Debug_Tools::printr( $form_input_fields, '$form_input_fields', __FILE__, __LINE__ );
592
-			if ( ! isset( $form_input_fields['identifier'] ) ) {
592
+			if ( ! isset($form_input_fields['identifier'])) {
593 593
 				throw new InvalidFormSubmissionException(
594
-					__( 'Form Section input identifier is missing or invalid.', 'event_espresso' )
594
+					__('Form Section input identifier is missing or invalid.', 'event_espresso')
595 595
 				);
596 596
 			}
597 597
 			$properties_and_values = array();
598
-			foreach ( (array) $form_input_fields as $field_name => $value ) {
599
-				$field_name = strpos( $field_name, 'QST_' ) !== 0 ? "QST_{$field_name}" : $field_name;
598
+			foreach ((array) $form_input_fields as $field_name => $value) {
599
+				$field_name = strpos($field_name, 'QST_') !== 0 ? "QST_{$field_name}" : $field_name;
600 600
 				// \EEH_Debug_Tools::printr( $field_name, '$field_name', __FILE__, __LINE__ );
601
-				if ( isset( $field_settings[ $field_name ] ) ) {
602
-					$properties_and_values[ $field_name ] = $value;
601
+				if (isset($field_settings[$field_name])) {
602
+					$properties_and_values[$field_name] = $value;
603 603
 				}
604 604
 			}
605 605
 			// \EEH_Debug_Tools::printr( $properties_and_values, '$properties_and_values', __FILE__, __LINE__ );
606
-			if ( $form_input_fields['identifier'] === $identifier ) {
606
+			if ($form_input_fields['identifier'] === $identifier) {
607 607
 				// update existing question
608 608
 				$result = EEM_Question::instance()->update(
609 609
 					$properties_and_values,
610
-					array( array( 'QST_identifier' => $identifier ) )
610
+					array(array('QST_identifier' => $identifier))
611 611
 				);
612 612
 			} else {
613 613
 				// insert new question
614
-				$question = \EE_Question::new_instance( $properties_and_values );
614
+				$question = \EE_Question::new_instance($properties_and_values);
615 615
 				$result = $question->save();
616 616
 			}
617 617
 			$success = $result ? $success : false;
@@ -632,18 +632,18 @@  discard block
 block discarded – undo
632 632
 		// \EEH_Debug_Tools::printr( $_REQUEST['settings'], '$_REQUEST[settings]', __FILE__, __LINE__ );
633 633
 		//\EEH_Debug_Tools::printr( $form, '$form', __FILE__, __LINE__ );
634 634
 		// die();
635
-		if ( $success !== FALSE ) {
635
+		if ($success !== FALSE) {
636 636
 			EE_Error::add_success(
637 637
 				$new_question_group
638
-					? esc_html__( 'The Form Section has been created', 'event_espresso' )
639
-					: esc_html__( 'The Form Section has been updated', 'event_espresso' )
638
+					? esc_html__('The Form Section has been created', 'event_espresso')
639
+					: esc_html__('The Form Section has been updated', 'event_espresso')
640 640
 			);
641 641
 		}
642 642
 		$this->_redirect_after_action(
643 643
 			$success,
644
-			esc_html__( 'Form Section', 'event_espresso' ),
645
-			$new_question_group ? esc_html__( 'created', 'event_espresso' ) : esc_html__( 'updated', 'event_espresso' ),
646
-			array( 'action' => 'default', /*'QSG_ID' => $ID*/ )
644
+			esc_html__('Form Section', 'event_espresso'),
645
+			$new_question_group ? esc_html__('created', 'event_espresso') : esc_html__('updated', 'event_espresso'),
646
+			array('action' => 'default', /*'QSG_ID' => $ID*/)
647 647
 		);
648 648
 	}
649 649
 
@@ -797,36 +797,36 @@  discard block
 block discarded – undo
797 797
 
798 798
 		$this->_template_args['values'] = $this->_yes_no_values;
799 799
 
800
-		$this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE;
801
-		$this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': '';
800
+		$this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE;
801
+		$this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : '';
802 802
 
803
-		$this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '';
804
-		$this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '';
805
-		$this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500;
803
+		$this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '';
804
+		$this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '';
805
+		$this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500;
806 806
 
807 807
 		$this->_template_args['recaptcha_theme_options'] = array(
808
-				array('id'  => 'red','text'=> __('Red', 'event_espresso')),
809
-				array('id'  => 'white','text'=> __('White', 'event_espresso')),
810
-				array('id'  => 'blackglass','text'=> __('Blackglass', 'event_espresso')),
811
-				array('id'  => 'clean','text'=> __('Clean', 'event_espresso'))
808
+				array('id'  => 'red', 'text'=> __('Red', 'event_espresso')),
809
+				array('id'  => 'white', 'text'=> __('White', 'event_espresso')),
810
+				array('id'  => 'blackglass', 'text'=> __('Blackglass', 'event_espresso')),
811
+				array('id'  => 'clean', 'text'=> __('Clean', 'event_espresso'))
812 812
 			);
813
-		$this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->get_pretty( 'recaptcha_theme' ) : 'clean';
813
+		$this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->get_pretty('recaptcha_theme') : 'clean';
814 814
 
815 815
 		$this->_template_args['recaptcha_language_options'] = array(
816
-				array('id'  => 'en','text'=> __('English', 'event_espresso')),
817
-				array('id'  => 'es','text'=> __('Spanish', 'event_espresso')),
818
-				array('id'  => 'nl','text'=> __('Dutch', 'event_espresso')),
819
-				array('id'  => 'fr','text'=> __('French', 'event_espresso')),
820
-				array('id'  => 'de','text'=> __('German', 'event_espresso')),
821
-				array('id'  => 'pt','text'=> __('Portuguese', 'event_espresso')),
822
-				array('id'  => 'ru','text'=> __('Russian', 'event_espresso')),
823
-				array('id'  => 'tr','text'=> __('Turkish', 'event_espresso'))
816
+				array('id'  => 'en', 'text'=> __('English', 'event_espresso')),
817
+				array('id'  => 'es', 'text'=> __('Spanish', 'event_espresso')),
818
+				array('id'  => 'nl', 'text'=> __('Dutch', 'event_espresso')),
819
+				array('id'  => 'fr', 'text'=> __('French', 'event_espresso')),
820
+				array('id'  => 'de', 'text'=> __('German', 'event_espresso')),
821
+				array('id'  => 'pt', 'text'=> __('Portuguese', 'event_espresso')),
822
+				array('id'  => 'ru', 'text'=> __('Russian', 'event_espresso')),
823
+				array('id'  => 'tr', 'text'=> __('Turkish', 'event_espresso'))
824 824
 			);
825
-		$this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en';
825
+		$this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en';
826 826
 
827
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
828
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
829
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE );
827
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
828
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
829
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE);
830 830
 		$this->display_admin_page_with_sidebar();
831 831
 	}
832 832
 
Please login to merge, or discard this patch.
core/db_classes/EE_Question_Group.class.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 	/**
17 17
 	 * @param array $props_n_values
18
-	 * @return EE_Question_Group|mixed
18
+	 * @return string
19 19
 	 */
20 20
 	public static function new_instance( $props_n_values = array() ) {
21 21
 		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	/**
238 238
 	 * Adds the question to this question group
239 239
 	 * @param EE_Question || int $question object or ID
240
-	 * @return boolean if successful
240
+	 * @return EE_Base_Class if successful
241 241
 	 */
242 242
 	public function add_question( $questionObjectOrID ) {
243 243
 		return $this->_add_relation_to( $questionObjectOrID, 'Question' );
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	/**
249 249
 	 * Removes the question from this question group
250 250
 	 * @param EE_Question || int $question object or ID
251
-	 * @return boolean of success
251
+	 * @return EE_Base_Class of success
252 252
 	 */
253 253
 	public function remove_question( $questionObjectOrID ) {
254 254
 		return $this->_remove_relation_to( $questionObjectOrID, 'Question' );
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 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
 /**
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 	 * @param array $props_n_values
18 18
 	 * @return EE_Question_Group|mixed
19 19
 	 */
20
-	public static function new_instance( $props_n_values = array() ) {
21
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
22
-		return $has_object ? $has_object : new self( $props_n_values );
20
+	public static function new_instance($props_n_values = array()) {
21
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
22
+		return $has_object ? $has_object : new self($props_n_values);
23 23
 	}
24 24
 
25 25
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	 * @param array $props_n_values
29 29
 	 * @return EE_Question_Group
30 30
 	 */
31
-	public static function new_instance_from_db( $props_n_values = array() ) {
32
-		return new self( $props_n_values, TRUE );
31
+	public static function new_instance_from_db($props_n_values = array()) {
32
+		return new self($props_n_values, TRUE);
33 33
 	}
34 34
 
35 35
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 * @param bool $pretty
41 41
 	 * @return string
42 42
 	 */
43
-	public function name( $pretty = FALSE ) {
44
-		return $pretty ? $this->get_pretty( 'QSG_name' ) : $this->get( 'QSG_name' );
43
+	public function name($pretty = FALSE) {
44
+		return $pretty ? $this->get_pretty('QSG_name') : $this->get('QSG_name');
45 45
 	}
46 46
 
47 47
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return string
54 54
 	 */
55 55
 	public function identifier() {
56
-		return $this->get( 'QSG_identifier' );
56
+		return $this->get('QSG_identifier');
57 57
 	}
58 58
 
59 59
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 	 * @param bool $pretty
65 65
 	 * @return string
66 66
 	 */
67
-	public function desc( $pretty = FALSE ) {
68
-		return $pretty ? $this->get_pretty( 'QSG_desc' ) : $this->get( 'QSG_desc' );
67
+	public function desc($pretty = FALSE) {
68
+		return $pretty ? $this->get_pretty('QSG_desc') : $this->get('QSG_desc');
69 69
 	}
70 70
 
71 71
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @return int
78 78
 	 */
79 79
 	public function order() {
80
-		return $this->get( 'QSG_order' );
80
+		return $this->get('QSG_order');
81 81
 	}
82 82
 
83 83
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @return boolean
91 91
 	 */
92 92
 	public function system_group() {
93
-		return $this->get( 'QSG_system' );
93
+		return $this->get('QSG_system');
94 94
 	}
95 95
 
96 96
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @return boolean
116 116
 	 */
117 117
 	public function deleted() {
118
-		return $this->get( 'QST_deleted' );
118
+		return $this->get('QST_deleted');
119 119
 	}
120 120
 
121 121
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return int|null
129 129
 	 */
130 130
 	public function parent() {
131
-		return $this->get( 'QSG_parent' );
131
+		return $this->get('QSG_parent');
132 132
 	}
133 133
 
134 134
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return string
142 142
 	 */
143 143
 	public function html_name() {
144
-		return $this->get( 'QSG_html_name' );
144
+		return $this->get('QSG_html_name');
145 145
 	}
146 146
 
147 147
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @return string
154 154
 	 */
155 155
 	public function html_id() {
156
-		return $this->get( 'QSG_html_id' );
156
+		return $this->get('QSG_html_id');
157 157
 	}
158 158
 
159 159
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @return string
166 166
 	 */
167 167
 	public function html_class() {
168
-		return $this->get( 'QSG_html_class' );
168
+		return $this->get('QSG_html_class');
169 169
 	}
170 170
 
171 171
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @return string
178 178
 	 */
179 179
 	public function html_content() {
180
-		return $this->get( 'QSG_html_content' );
180
+		return $this->get('QSG_html_content');
181 181
 	}
182 182
 
183 183
 
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	public function questions_in_and_not_in_group() {
190 190
 		$questions_in_group = $this->questions();
191
-		$exclude_question_ids = ! empty( $questions_in_group ) ? array_keys( $questions_in_group ) : array();
192
-		$questions_not_in_group = $this->questions_not_in_group( $exclude_question_ids );
191
+		$exclude_question_ids = ! empty($questions_in_group) ? array_keys($questions_in_group) : array();
192
+		$questions_not_in_group = $this->questions_not_in_group($exclude_question_ids);
193 193
 		return $questions_in_group + $questions_not_in_group;
194 194
 	}
195 195
 
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 * @param array $query_params
201 201
 	 * @return EE_Question[]
202 202
 	 */
203
-	public function questions( $query_params = array() ) {
203
+	public function questions($query_params = array()) {
204 204
 		// $query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' ) );
205
-		return $this->ID() ? $this->get_many_related( 'Question', $query_params ) : array();
205
+		return $this->ID() ? $this->get_many_related('Question', $query_params) : array();
206 206
 	}
207 207
 
208 208
 
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
 	 * @param  mixed $question_IDS_in_group if empty array then all questions returned.  if FALSE then we first get questions in this group and exclude them from questions get all. IF empty array then we just return all questions.
213 213
 	 * @return EE_Question[]
214 214
 	 */
215
-	public function questions_not_in_group( $question_IDS_in_group = FALSE ) {
216
-		if ( $question_IDS_in_group === FALSE ) {
215
+	public function questions_not_in_group($question_IDS_in_group = FALSE) {
216
+		if ($question_IDS_in_group === FALSE) {
217 217
 			$questions = $this->questions();
218
-			$question_IDS_in_group = ! empty( $questions ) ? array_keys( $questions ) : array();
218
+			$question_IDS_in_group = ! empty($questions) ? array_keys($questions) : array();
219 219
 		}
220
-		$_where = ! empty( $question_IDS_in_group ) ? array( 'QST_ID' => array( 'not_in', $question_IDS_in_group ) ) : array();
220
+		$_where = ! empty($question_IDS_in_group) ? array('QST_ID' => array('not_in', $question_IDS_in_group)) : array();
221 221
 
222
-		return EEM_Question::instance()->get_all( array( $_where, 'order_by' => array( 'QST_ID' => 'ASC' ) ) );
222
+		return EEM_Question::instance()->get_all(array($_where, 'order_by' => array('QST_ID' => 'ASC')));
223 223
 	}
224 224
 
225 225
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @return EE_Event[]
230 230
 	 */
231 231
 	public function events() {
232
-		return $this->get_many_related( 'Event' );
232
+		return $this->get_many_related('Event');
233 233
 	}
234 234
 
235 235
 
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 * @param EE_Question || int $question object or ID
240 240
 	 * @return boolean if successful
241 241
 	 */
242
-	public function add_question( $questionObjectOrID ) {
243
-		return $this->_add_relation_to( $questionObjectOrID, 'Question' );
242
+	public function add_question($questionObjectOrID) {
243
+		return $this->_add_relation_to($questionObjectOrID, 'Question');
244 244
 	}
245 245
 
246 246
 
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @param EE_Question || int $question object or ID
251 251
 	 * @return boolean of success
252 252
 	 */
253
-	public function remove_question( $questionObjectOrID ) {
254
-		return $this->_remove_relation_to( $questionObjectOrID, 'Question' );
253
+	public function remove_question($questionObjectOrID) {
254
+		return $this->_remove_relation_to($questionObjectOrID, 'Question');
255 255
 	}
256 256
 
257 257
 
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 	 * @param $qst_order
262 262
 	 * @return int
263 263
 	 */
264
-	public function update_question_order( $questionObjectOrID, $qst_order ) {
265
-		$qst_ID = $questionObjectOrID instanceof EE_Question ? $questionObjectOrID->ID() : (int)$questionObjectOrID;
266
-		return EEM_Question_Group_Question::instance()->update( array( 'QGQ_order' => $qst_order ), array( array( 'QST_ID' => $qst_ID, 'QSG_ID' => $this->ID() ) ) );
264
+	public function update_question_order($questionObjectOrID, $qst_order) {
265
+		$qst_ID = $questionObjectOrID instanceof EE_Question ? $questionObjectOrID->ID() : (int) $questionObjectOrID;
266
+		return EEM_Question_Group_Question::instance()->update(array('QGQ_order' => $qst_order), array(array('QST_ID' => $qst_ID, 'QSG_ID' => $this->ID())));
267 267
 	}
268 268
 
269 269
 
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 	 */
275 275
 	public function has_questions_with_answers() {
276 276
 		$has_answers = FALSE;
277
-		$questions = $this->get_many_related( 'Question' );
278
-		foreach ( $questions as $question ) {
279
-			if ( $question->count_related( 'Answer' ) > 0 )
277
+		$questions = $this->get_many_related('Question');
278
+		foreach ($questions as $question) {
279
+			if ($question->count_related('Answer') > 0)
280 280
 				$has_answers = TRUE;
281 281
 		}
282 282
 		return $has_answers;
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public function set_order_to_latest() {
295 295
 		$latest_order = $this->get_model()->get_latest_question_group_order();
296
-		$latest_order ++;
297
-		$this->set( 'QSG_order', $latest_order );
296
+		$latest_order++;
297
+		$this->set('QSG_order', $latest_order);
298 298
 	}
299 299
 
300 300
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_10_0.dms.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @author      Mike Nelson, Brent Christensen
11 11
  * @since       4.10.0
12 12
  */
13
-class EE_DMS_Core_4_10_0 extends EE_Data_Migration_Script_Base{
13
+class EE_DMS_Core_4_10_0 extends EE_Data_Migration_Script_Base {
14 14
 
15 15
 	/**
16 16
 	 * return EE_DMS_Core_4_10_0
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function can_migrate_from_version($version_array) {
42 42
 		$version_string = $version_array['Core'];
43
-		if ( $version_string <= '4.10.0' && $version_string >= '4.9.0' ) {
43
+		if ($version_string <= '4.10.0' && $version_string >= '4.9.0') {
44 44
 			return true;
45
-		} elseif ( ! $version_string ) {
45
+		} elseif ( ! $version_string) {
46 46
 			//no version string provided... this must be pre 4.3
47 47
 			return false;
48 48
 		} else {
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @return bool
67 67
 	 */
68 68
 	public function schema_changes_before_migration() {
69
-		$now_in_mysql = current_time( 'mysql', true );
69
+		$now_in_mysql = current_time('mysql', true);
70 70
 
71
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
71
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
72 72
 
73 73
 		// esp_answer
74 74
 		$this->_table_has_not_changed_since_previous(
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		return $script_4_7_defaults->schema_changes_after_migration();
676 676
 	}
677 677
 
678
-	public function migration_page_hooks(){
678
+	public function migration_page_hooks() {
679 679
 
680 680
 	}
681 681
 
@@ -689,19 +689,19 @@  discard block
 block discarded – undo
689 689
 		//CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active
690 690
 		//('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
691 691
 		$newer_countries = array(
692
-			array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ),
693
-			array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
694
-			array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ),
695
-			array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ),
696
-			array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2,  '+44', 0, 0  ),
697
-			array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ),
698
-			array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
699
-			array( 'MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1,  2, '+382', 0, 0 ),
700
-			array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ),
701
-			array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ),
702
-			array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ),
703
-			array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ),
704
-			array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ),
692
+			array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
693
+			array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
694
+			array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
695
+			array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
696
+			array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
697
+			array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
698
+			array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
699
+			array('MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
700
+			array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0),
701
+			array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
702
+			array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
703
+			array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0),
704
+			array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
705 705
 		);
706 706
 		global $wpdb;
707 707
 		$country_table = $wpdb->prefix."esp_country";
@@ -720,14 +720,14 @@  discard block
 block discarded – undo
720 720
 							"CNT_is_EU" => '%d',
721 721
 							"CNT_active" => '%d',
722 722
 						);
723
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $country_table . "'") == $country_table ) {
724
-			foreach( $newer_countries as $country ) {
725
-				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ;
723
+		if ($wpdb->get_var("SHOW TABLES LIKE '".$country_table."'") == $country_table) {
724
+			foreach ($newer_countries as $country) {
725
+				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
726 726
 				$countries = $wpdb->get_var($SQL);
727
-				if ( ! $countries ) {
727
+				if ( ! $countries) {
728 728
 
729
-					$wpdb->insert( $country_table,
730
-							array_combine( array_keys( $country_format), $country ),
729
+					$wpdb->insert($country_table,
730
+							array_combine(array_keys($country_format), $country),
731 731
 							$country_format
732 732
 							);
733 733
 				}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 		// CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
746 746
 		//( 'EUR',  'Euro',  'Euros',  '€',  2,1),
747 747
 		$newer_currencies = array(
748
-			array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ),
748
+			array('RSD', 'Dinar', 'Dinars', '', 3, 1),
749 749
 		);
750 750
 		global $wpdb;
751 751
 		$currency_table = $wpdb->prefix."esp_currency";
@@ -757,14 +757,14 @@  discard block
 block discarded – undo
757 757
 							"CUR_dec_plc" => '%d',
758 758
 							"CUR_active" => '%d',
759 759
 						);
760
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $currency_table . "'") == $currency_table ) {
761
-			foreach( $newer_currencies as $currency ) {
762
-				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ;
760
+		if ($wpdb->get_var("SHOW TABLES LIKE '".$currency_table."'") == $currency_table) {
761
+			foreach ($newer_currencies as $currency) {
762
+				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
763 763
 				$countries = $wpdb->get_var($SQL);
764
-				if ( ! $countries ) {
764
+				if ( ! $countries) {
765 765
 
766
-					$wpdb->insert( $currency_table,
767
-							array_combine( array_keys( $currency_format), $currency ),
766
+					$wpdb->insert($currency_table,
767
+							array_combine(array_keys($currency_format), $currency),
768 768
 							$currency_format
769 769
 							);
770 770
 				}
@@ -776,9 +776,9 @@  discard block
 block discarded – undo
776 776
 	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
777 777
 	 * we should be able to stop doing this in 4.9
778 778
 	 */
779
-	public function fix_non_default_taxes(){
779
+	public function fix_non_default_taxes() {
780 780
 		global $wpdb;
781
-		$query = $wpdb->prepare( "UPDATE
781
+		$query = $wpdb->prepare("UPDATE
782 782
 				{$wpdb->prefix}esp_price p INNER JOIN
783 783
 				{$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID
784 784
 			SET
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
 			WHERE
787 787
 				p.PRC_is_default = 0 AND
788 788
 				pt.PBT_ID = %d
789
-					", EEM_Price_Type::base_type_tax );
790
-		$wpdb->query( $query );
789
+					", EEM_Price_Type::base_type_tax);
790
+		$wpdb->query($query);
791 791
 	}
792 792
 }
793 793
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_2_0.dms.php 2 patches
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * -adds QGQ_order to the question-group_question table;
6 6
  * -adds DTT_name and DTT_description to the datetime table;
7 7
  */
8
-class EE_DMS_Core_4_2_0 extends EE_Data_Migration_Script_Base{
8
+class EE_DMS_Core_4_2_0 extends EE_Data_Migration_Script_Base {
9 9
 
10 10
 
11 11
 
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 
30 30
 	public function can_migrate_from_version($version_array) {
31 31
 		$version_string = $version_array['Core'];
32
-		if ( version_compare( $version_string, '4.2.0', '<=' ) && version_compare( $version_string, '4.1.0', '>=' ) ) {
32
+		if (version_compare($version_string, '4.2.0', '<=') && version_compare($version_string, '4.1.0', '>=')) {
33 33
 //			echo "$version_string can be migrated fro";
34 34
 			return true;
35
-		}elseif( ! $version_string ){
35
+		}elseif ( ! $version_string) {
36 36
 //			echo "no version string provided: $version_string";
37 37
 			//no version string provided... this must be pre 4.1
38 38
 			//because since 4.1 we're
39
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
40
-		}else{
39
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
40
+		} else {
41 41
 //			echo "$version_string doesnt apply";
42 42
 			return false;
43 43
 		}
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 	public function schema_changes_before_migration() {
49 49
 		//relies on 4.1's EEH_Activation::create_table
50
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
51
-		$table_name='esp_answer';
52
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
50
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
51
+		$table_name = 'esp_answer';
52
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
53 53
 					REG_ID INT UNSIGNED NOT NULL,
54 54
 					QST_ID INT UNSIGNED NOT NULL,
55 55
 					ANS_value TEXT NOT NULL,
56 56
 					PRIMARY KEY  (ANS_ID)";
57
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
57
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
58 58
 
59 59
 		$table_name = 'esp_attendee_meta';
60 60
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
95 95
 					  CNT_active TINYINT(1) DEFAULT '0',
96 96
 					  PRIMARY KEY  (CNT_ISO)";
97
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
97
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
98 98
 
99 99
 
100 100
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 
119 119
 
120
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
120
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
121 121
 		$table_name = 'esp_event_meta';
122 122
 		$sql = "
123 123
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -134,41 +134,41 @@  discard block
 block discarded – undo
134 134
 			EVT_external_URL VARCHAR(200) NULL,
135 135
 			EVT_donations TINYINT(1) NULL,
136 136
 			PRIMARY KEY  (EVTM_ID)";
137
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
137
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138 138
 
139 139
 
140 140
 
141
-		$table_name='esp_event_question_group';
142
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
141
+		$table_name = 'esp_event_question_group';
142
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
143 143
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
144 144
 					QSG_ID INT UNSIGNED NOT NULL,
145 145
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
146 146
 					PRIMARY KEY  (EQG_ID)";
147
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
147
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
148 148
 
149 149
 
150 150
 
151
-		$table_name='esp_event_venue';
152
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
151
+		$table_name = 'esp_event_venue';
152
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
153 153
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
154 154
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
155 155
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
156 156
 				PRIMARY KEY  (EVV_ID)";
157
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
157
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
158 158
 
159 159
 
160 160
 
161
-		$table_name='esp_extra_meta';
162
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
161
+		$table_name = 'esp_extra_meta';
162
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
163 163
 				OBJ_ID INT(11) DEFAULT NULL,
164 164
 				EXM_type VARCHAR(45) DEFAULT NULL,
165 165
 				EXM_key VARCHAR(45) DEFAULT NULL,
166 166
 				EXM_value TEXT,
167 167
 				PRIMARY KEY  (EXM_ID)";
168
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
168
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169 169
 
170
-		$table_name='esp_line_item';
171
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
170
+		$table_name = 'esp_line_item';
171
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
172 172
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
173 173
 				TXN_ID INT(11) DEFAULT NULL,
174 174
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				OBJ_ID INT(11) DEFAULT NULL,
185 185
 				OBJ_type VARCHAR(45)DEFAULT NULL,
186 186
 				PRIMARY KEY  (LIN_ID)";
187
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
187
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
188 188
 
189 189
 		$table_name = 'esp_message_template';
190 190
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 					PRIMARY KEY  (GRP_ID),
212 212
 					KEY EVT_ID (EVT_ID),
213 213
 					KEY MTP_user_id (MTP_user_id)";
214
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
214
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
215 215
 
216 216
 
217 217
 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 
320 320
 
321 321
 
322
-		$table_name='esp_question';
323
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
322
+		$table_name = 'esp_question';
323
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
324 324
 					QST_display_text TEXT NOT NULL,
325 325
 					QST_admin_label VARCHAR(255) NOT NULL,
326 326
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 					QST_wp_user BIGINT UNSIGNED NULL,
333 333
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
334 334
 					PRIMARY KEY  (QST_ID)';
335
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
335
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
336 336
 
337
-		EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' );
337
+		EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE');
338 338
 
339 339
 		$table_name = 'esp_question_group';
340
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
340
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
341 341
 					QSG_name VARCHAR(255) NOT NULL,
342 342
 					QSG_identifier VARCHAR(100) NOT NULL,
343 343
 					QSG_desc TEXT NULL,
@@ -348,28 +348,28 @@  discard block
 block discarded – undo
348 348
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
349 349
 					PRIMARY KEY  (QSG_ID),
350 350
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
351
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
351
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
352 352
 
353 353
 
354 354
 
355
-		$table_name='esp_question_group_question';
356
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
355
+		$table_name = 'esp_question_group_question';
356
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
357 357
 					QSG_ID INT UNSIGNED NOT NULL,
358 358
 					QST_ID INT UNSIGNED NOT NULL,
359 359
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
360 360
 					PRIMARY KEY  (QGQ_ID) ";
361
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
361
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
362 362
 
363 363
 
364 364
 
365
-		$table_name='esp_question_option';
366
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
365
+		$table_name = 'esp_question_option';
366
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
367 367
 					QSO_value VARCHAR(255) NOT NULL,
368 368
 					QSO_desc TEXT NOT NULL,
369 369
 					QST_ID INT UNSIGNED NOT NULL,
370 370
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
371 371
 					PRIMARY KEY  (QSO_ID)";
372
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
372
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
373 373
 
374 374
 
375 375
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 
403 403
 
404 404
 
405
-		$table_name='esp_checkin';
406
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
405
+		$table_name = 'esp_checkin';
406
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
407 407
 					REG_ID INT(10) UNSIGNED NOT NULL,
408 408
 					DTT_ID INT(10) UNSIGNED NOT NULL,
409 409
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
478 478
 
479 479
 
480
-		$script_with_defaults = EE_Registry::instance()->load_dms( 'Core_4_1_0' );
480
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
481 481
 		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
482 482
 		//(because many need to convert old string states to foreign keys into the states table)
483 483
 		$script_with_defaults->insert_default_states();
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 		return true;
500 500
 	}
501 501
 
502
-	public function migration_page_hooks(){
502
+	public function migration_page_hooks() {
503 503
 
504 504
 	}
505 505
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@
 block discarded – undo
32 32
 		if ( version_compare( $version_string, '4.2.0', '<=' ) && version_compare( $version_string, '4.1.0', '>=' ) ) {
33 33
 //			echo "$version_string can be migrated fro";
34 34
 			return true;
35
-		}elseif( ! $version_string ){
35
+		} elseif( ! $version_string ){
36 36
 //			echo "no version string provided: $version_string";
37 37
 			//no version string provided... this must be pre 4.1
38 38
 			//because since 4.1 we're
39 39
 			return false;//changed mind. dont want people thinking they should migrate yet because they cant
40
-		}else{
40
+		} else{
41 41
 //			echo "$version_string doesnt apply";
42 42
 			return false;
43 43
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Script_Base.core.php 2 patches
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 			'FHEE__'.get_class($this).'__construct__migration_stages',
125 125
 			$this->_migration_stages
126 126
 		);
127
-		foreach($this->_migration_stages as $migration_stage){
128
-			if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) {
127
+		foreach ($this->_migration_stages as $migration_stage) {
128
+			if ($migration_stage instanceof EE_Data_Migration_Script_Stage) {
129 129
 				$migration_stage->_construct_finalize($this);
130 130
 			}
131 131
 		}
@@ -142,16 +142,16 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function _load_script_stages() {
144 144
 		static $script_stages_loaded = array();
145
-		$stage = str_replace( 'EE_DMS_Core_', '', get_class( $this ) );
146
-		if ( isset( $script_stages_loaded[ $stage ] ) ) {
145
+		$stage = str_replace('EE_DMS_Core_', '', get_class($this));
146
+		if (isset($script_stages_loaded[$stage])) {
147 147
 			return;
148 148
 		}
149
-		$stages = glob( EE_CORE . "data_migration_scripts/{$stage}_stages/*.dmsstage.php" );
149
+		$stages = glob(EE_CORE."data_migration_scripts/{$stage}_stages/*.dmsstage.php");
150 150
 		$class_to_filepath = array();
151
-		foreach ( $stages as $filepath ) {
151
+		foreach ($stages as $filepath) {
152 152
 			$matches = array();
153
-			if ( preg_match( "~{$stage}_stages/(.*).dmsstage.php~", $filepath, $matches ) ) {
154
-				$class_to_filepath[ $matches[1] ] = $filepath;
153
+			if (preg_match("~{$stage}_stages/(.*).dmsstage.php~", $filepath, $matches)) {
154
+				$class_to_filepath[$matches[1]] = $filepath;
155 155
 			}
156 156
 		}
157 157
 		//give addons a chance to autoload their stages too
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 			"FHEE__EE_DMS_{$stage}__autoloaded_stages",
160 160
 			$class_to_filepath
161 161
 		);
162
-		EEH_Autoloader::register_autoloader( $class_to_filepath );
163
-		$script_stages_loaded[ $stage ] = true;
162
+		EEH_Autoloader::register_autoloader($class_to_filepath);
163
+		$script_stages_loaded[$stage] = true;
164 164
 
165 165
 	}
166 166
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * Place to add hooks and filters for tweaking the migrations page, in order
169 169
 	 * to customize it
170 170
 	 */
171
-	public function migration_page_hooks(){
171
+	public function migration_page_hooks() {
172 172
 		//by default none are added because we normally like the default look of the migration page
173 173
 	}
174 174
 
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	 * @param int|string $new_pk eg posts.ID
184 184
 	 * @return void
185 185
 	 */
186
-	public function set_mapping($old_table,$old_pk,$new_table,$new_pk){
186
+	public function set_mapping($old_table, $old_pk, $new_table, $new_pk) {
187 187
 		//make sure it has the needed keys
188
-		if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){
188
+		if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) {
189 189
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
190 190
 		}
191 191
 		$this->_mappings[$old_table][$new_table][$old_pk] = $new_pk;
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 	 * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts
202 202
 	 * @return mixed the primary key on the new table
203 203
 	 */
204
-	public function get_mapping_new_pk($old_table,$old_pk,$new_table){
205
-		if( ! isset($this->_mappings[$old_table]) ||
206
-			! isset($this->_mappings[$old_table][$new_table])){
204
+	public function get_mapping_new_pk($old_table, $old_pk, $new_table) {
205
+		if ( ! isset($this->_mappings[$old_table]) ||
206
+			! isset($this->_mappings[$old_table][$new_table])) {
207 207
 			//try fetching the option
208 208
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
209 209
 		}
@@ -220,15 +220,15 @@  discard block
 block discarded – undo
220 220
 	 * @param mixed $new_pk
221 221
 	 * @return mixed
222 222
 	 */
223
-	public function get_mapping_old_pk($old_table,$new_table,$new_pk){
224
-		if( ! isset($this->_mappings[$old_table]) ||
225
-			! isset($this->_mappings[$old_table][$new_table])){
223
+	public function get_mapping_old_pk($old_table, $new_table, $new_pk) {
224
+		if ( ! isset($this->_mappings[$old_table]) ||
225
+			! isset($this->_mappings[$old_table][$new_table])) {
226 226
 			//try fetching the option
227 227
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
228 228
 		}
229
-		if(isset($this->_mappings[$old_table][$new_table])){
229
+		if (isset($this->_mappings[$old_table][$new_table])) {
230 230
 			$new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]);
231
-			if(isset($new_pk_to_old_pk[$new_pk])){
231
+			if (isset($new_pk_to_old_pk[$new_pk])) {
232 232
 				return $new_pk_to_old_pk[$new_pk];
233 233
 			}
234 234
 		}
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 	 * @param string $new_table_name
244 244
 	 * @return array
245 245
 	 */
246
-	protected function _get_mapping_option($old_table_name,$new_table_name){
247
-		$option =  get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array());
246
+	protected function _get_mapping_option($old_table_name, $new_table_name) {
247
+		$option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array());
248 248
 		return $option;
249 249
 	}
250 250
 
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 	 * @param array $mapping_array
258 258
 	 * @return boolean success of updating option
259 259
 	 */
260
-	protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){
260
+	protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) {
261 261
 //		echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>";
262
-		$success =  update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array);
262
+		$success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array);
263 263
 		return $success;
264 264
 	}
265 265
 
@@ -271,12 +271,12 @@  discard block
 block discarded – undo
271 271
 	 * @param string $new_table_name
272 272
 	 * @return string
273 273
 	 */
274
-	protected function _get_mapping_option_name($old_table_name,$new_table_name){
274
+	protected function _get_mapping_option_name($old_table_name, $new_table_name) {
275 275
 		global $wpdb;
276
-		$old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name);
277
-		$new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name);
276
+		$old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name);
277
+		$new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name);
278 278
 		$migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
279
-		return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 );
279
+		return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64);
280 280
 	}
281 281
 
282 282
 
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete.
294 294
 	 * @return int
295 295
 	 */
296
-	protected function _count_records_to_migrate(){
296
+	protected function _count_records_to_migrate() {
297 297
 		$count = 0;
298
-		foreach($this->stages() as $stage){
299
-			$count+= $stage->count_records_to_migrate();
298
+		foreach ($this->stages() as $stage) {
299
+			$count += $stage->count_records_to_migrate();
300 300
 		}
301 301
 		return $count;
302 302
 	}
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 	 * by just setting a transient and updating it after each migration_step
309 309
 	 * @return int
310 310
 	 */
311
-	public function count_records_migrated(){
311
+	public function count_records_migrated() {
312 312
 		$count = 0;
313
-		foreach($this->stages() as $stage){
314
-			$count+= $stage->count_records_migrated();
313
+		foreach ($this->stages() as $stage) {
314
+			$count += $stage->count_records_migrated();
315 315
 		}
316 316
 		$this->_records_migrated = $count;
317 317
 		return $count;
@@ -325,24 +325,24 @@  discard block
 block discarded – undo
325 325
 	 * @throws EE_Error
326 326
 	 * @throws Exception
327 327
 	 */
328
-	public function migration_step($num_records_to_migrate_limit){
328
+	public function migration_step($num_records_to_migrate_limit) {
329 329
 		//reset the feedback message
330 330
 		$this->_feedback_message = '';
331 331
 		//if we haven't yet done the 1st schema changes, do them now. buffer any output
332 332
 		$this->_maybe_do_schema_changes(true);
333 333
 
334
-		$num_records_actually_migrated =0;
334
+		$num_records_actually_migrated = 0;
335 335
 		$records_migrated_per_stage = array();
336 336
 		//setup the 'stage' variable, which should hold the last run stage of the migration  (or none at all if nothing runs)
337 337
 		$stage = null;
338 338
 		//get the next stage that isn't complete
339
-		foreach($this->stages() as $stage){
340
-			if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){
341
-				try{
339
+		foreach ($this->stages() as $stage) {
340
+			if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) {
341
+				try {
342 342
 					$records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated);
343 343
 					$num_records_actually_migrated += $records_migrated_during_stage;
344 344
 					$records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage;
345
-				}catch(Exception $e){
345
+				} catch (Exception $e) {
346 346
 					//yes if we catch an exception here, we consider that migration stage borked.
347 347
 					$stage->set_status(EE_Data_Migration_Manager::status_fatal_error);
348 348
 					$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 					throw $e;
351 351
 				}
352 352
 				//check that the migration stage didn't mark itself as having a fatal error
353
-				if($stage->is_broken()){
353
+				if ($stage->is_broken()) {
354 354
 					$this->set_broken();
355 355
 					throw new EE_Error($stage->get_last_error());
356 356
 				}
@@ -358,24 +358,24 @@  discard block
 block discarded – undo
358 358
 			//once we've migrated all the number we intended to (possibly from different stages), stop migrating
359 359
 			//or if we had a fatal error
360 360
 			//or if the current script stopped early- its not done, but it's done all it thinks we should do on this step
361
-			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){
361
+			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) {
362 362
 				break;
363 363
 			}
364 364
 		}
365 365
 		//check if we're all done this data migration...
366 366
 		//which is indicated by being done early AND the last stage claims to be done
367
-		if($stage == NULL){
367
+		if ($stage == NULL) {
368 368
 			//this migration script apparently has NO stages... which is super weird, but whatever
369 369
 			$this->set_completed();
370 370
 			$this->_maybe_do_schema_changes(false);
371
-		}else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
371
+		} else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) {
372 372
 			//apparently we're done, because we couldn't migrate the number we intended to
373 373
 			$this->set_completed();
374 374
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
375 375
 			//do schema changes for after the migration now
376 376
 			//first double-check we haven't already done this
377 377
 			$this->_maybe_do_schema_changes(false);
378
-		}else{
378
+		} else {
379 379
 			//update feedback message, keeping in mind that we show them with the most recent at the top
380 380
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
381 381
 		}
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 	 * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage
390 390
 	 * @return void
391 391
 	 */
392
-	private function _update_feedback_message($records_migrated_per_stage){
392
+	private function _update_feedback_message($records_migrated_per_stage) {
393 393
 		$feedback_message_array = array();
394
-		foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){
395
-			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ;
394
+		foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) {
395
+			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name);
396 396
 		}
397
-		$this->_feedback_message .= implode("<br>",$feedback_message_array);
397
+		$this->_feedback_message .= implode("<br>", $feedback_message_array);
398 398
 	}
399 399
 
400 400
 
@@ -406,27 +406,27 @@  discard block
 block discarded – undo
406 406
 	 * @throws Exception
407 407
 	 * @return void
408 408
 	 */
409
-	private function _maybe_do_schema_changes($before = true){
409
+	private function _maybe_do_schema_changes($before = true) {
410 410
 		//so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran
411
-		$property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran';
412
-		if ( ! $this->{$property_name} ){
413
-			try{
411
+		$property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran';
412
+		if ( ! $this->{$property_name} ) {
413
+			try {
414 414
 				ob_start();
415
-				if($before){
415
+				if ($before) {
416 416
 					$this->schema_changes_before_migration();
417
-				}else{
417
+				} else {
418 418
 					$this->schema_changes_after_migration();
419 419
 				}
420 420
 				$output = ob_get_contents();
421 421
 				ob_end_clean();
422
-			}catch(Exception $e){
422
+			} catch (Exception $e) {
423 423
 				$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
424 424
 				throw $e;
425 425
 			}
426 426
 			//record that we've done these schema changes
427 427
 			$this->{$property_name} = true;
428 428
 			//if there were any warnings etc, record them as non-fatal errors
429
-			if( $output ){
429
+			if ($output) {
430 430
 				//there were some warnings
431 431
 				$this->_errors[] = $output;
432 432
 			}
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
 	 * @param string $table_definition_sql
454 454
 	 * @param string $engine_string
455 455
 	 */
456
-	protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){
456
+	protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') {
457 457
 //		EEH_Debug_Tools::instance()->start_timer( '_table_is_new_in_this_version_' . $table_name );
458
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  true ) );
458
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(true));
459 459
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_is_new_in_this_version_' . $table_name  );
460 460
 	}
461 461
 
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
 	 * @param string $table_definition_sql
470 470
 	 * @param string $engine_string
471 471
 	 */
472
-	protected function _table_is_changed_in_this_version($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
472
+	protected function _table_is_changed_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
473 473
 //		EEH_Debug_Tools::instance()->start_timer( '_table_is_changed_in_this_version' . $table_name );
474
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
474
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
475 475
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_is_changed_in_this_version' . $table_name  );
476 476
 	}
477 477
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	 * @param string $table_name
483 483
 	 * @return boolean
484 484
 	 */
485
-	protected function _old_table_exists( $table_name ) {
486
-		return EEH_Activation::table_exists( $table_name );
485
+	protected function _old_table_exists($table_name) {
486
+		return EEH_Activation::table_exists($table_name);
487 487
 	}
488 488
 
489 489
 
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 	 * @param string $table_name
494 494
 	 * @return boolean
495 495
 	 */
496
-	protected function _delete_table_if_empty( $table_name ) {
497
-		return EEH_Activation::delete_db_table_if_empty( $table_name );
496
+	protected function _delete_table_if_empty($table_name) {
497
+		return EEH_Activation::delete_db_table_if_empty($table_name);
498 498
 	}
499 499
 
500 500
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 * @param string $table_definition_sql
514 514
 	 * @param string $engine_string
515 515
 	 */
516
-	protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
516
+	protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
517 517
 //		EEH_Debug_Tools::instance()->start_timer( '_table_should_exist_previously' . $table_name );
518
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
518
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
519 519
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name );
520 520
 	}
521 521
 
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
 	 * @param string $table_definition_sql
531 531
 	 * @param string $engine_string
532 532
 	 */
533
-	protected function _table_has_not_changed_since_previous( $table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
534
-		if( $this->_currently_migrating() ) {
533
+	protected function _table_has_not_changed_since_previous($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
534
+		if ($this->_currently_migrating()) {
535 535
 			//if we're doing a migration, and this table apparently already exists, then we don't need do anything right?
536 536
 //			EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name );
537 537
 			return;
538 538
 		}
539
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
539
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
540 540
 	}
541 541
 
542 542
 	/**
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	protected function _currently_migrating() {
547 547
 		//we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM)
548 548
 		return $this->_migrating &&
549
-					$this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) &&
549
+					$this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) &&
550 550
 					EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance;
551 551
 	}
552 552
 
@@ -557,17 +557,17 @@  discard block
 block discarded – undo
557 557
 	 * @param boolean $table_is_new
558 558
 	 * @return boolean
559 559
 	 */
560
-	protected function _pre_existing_table_should_be_dropped( $table_is_new ) {
561
-		if( $table_is_new ) {
562
-			if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation  || $this->_currently_migrating() ){
560
+	protected function _pre_existing_table_should_be_dropped($table_is_new) {
561
+		if ($table_is_new) {
562
+			if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating()) {
563 563
 				return true;
564
-			}else{
564
+			} else {
565 565
 				return false;
566 566
 			}
567
-		}else{
568
-			if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){
567
+		} else {
568
+			if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) {
569 569
 				return true;
570
-			}else{
570
+			} else {
571 571
 				return false;
572 572
 			}
573 573
 		}
@@ -580,12 +580,12 @@  discard block
 block discarded – undo
580 580
 	 * @param string $engine_string
581 581
 	 * @param boolean $drop_pre_existing_tables
582 582
 	 */
583
-	private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){
584
-		try{
585
-			EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables);
586
-		}catch( EE_Error $e ) {
587
-			$message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString();
588
-			$this->add_error( $message  );
583
+	private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) {
584
+		try {
585
+			EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables);
586
+		} catch (EE_Error $e) {
587
+			$message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString();
588
+			$this->add_error($message);
589 589
 			$this->_feedback_message .= $message;
590 590
 		}
591 591
 	}
@@ -597,15 +597,15 @@  discard block
 block discarded – undo
597 597
 	 * @return int one of EE_System::_req_type_* constants
598 598
 	 * @throws EE_Error
599 599
 	 */
600
-	private function _get_req_type_for_plugin_corresponding_to_this_dms(){
601
-		if($this->slug() == 'Core'){
600
+	private function _get_req_type_for_plugin_corresponding_to_this_dms() {
601
+		if ($this->slug() == 'Core') {
602 602
 			return EE_System::instance()->detect_req_type();
603
-		}else{//it must be for an addon
603
+		} else {//it must be for an addon
604 604
 			$addon_name = $this->slug();
605
-			if( EE_Registry::instance()->get_addon_by_name($addon_name)){
605
+			if (EE_Registry::instance()->get_addon_by_name($addon_name)) {
606 606
 				return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type();
607
-			}else{
608
-				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ;
607
+			} else {
608
+				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name()))));
609 609
 			}
610 610
 		}
611 611
 	}
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 	 * returns an array of strings describing errors by all the script's stages
617 617
 	 * @return array
618 618
 	 */
619
-	public function get_errors(){
619
+	public function get_errors() {
620 620
 		$all_errors = $this->_errors;
621
-		if( ! is_array($all_errors)){
621
+		if ( ! is_array($all_errors)) {
622 622
 			$all_errors = array();
623 623
 		}
624
-		foreach($this->stages() as $stage){
625
-			$all_errors = array_merge($stage->get_errors(),$all_errors);
624
+		foreach ($this->stages() as $stage) {
625
+			$all_errors = array_merge($stage->get_errors(), $all_errors);
626 626
 		}
627 627
 		return $all_errors;
628 628
 	}
@@ -633,8 +633,8 @@  discard block
 block discarded – undo
633 633
 	 * Indicates whether or not this migration script should continue
634 634
 	 * @return boolean
635 635
 	 */
636
-	public function can_continue(){
637
-		return in_array($this->get_status(),  EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
636
+	public function can_continue() {
637
+		return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
638 638
 	}
639 639
 
640 640
 
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
 	 * get ordered by the indexes
647 647
 	 * @return EE_Data_Migration_Script_Stage[]
648 648
 	 */
649
-	protected function stages(){
650
-		$stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages );
649
+	protected function stages() {
650
+		$stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages);
651 651
 		ksort($stages);
652 652
 		return $stages;
653 653
 	}
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	 * can be displayed to the user
660 660
 	 * @return string
661 661
 	 */
662
-	public function get_feedback_message(){
662
+	public function get_feedback_message() {
663 663
 		return $this->_feedback_message;
664 664
 	}
665 665
 
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
 	 * possible that this class is defined when it goes to sleep, but NOT available when it
672 672
 	 * awakes (eg, this class is part of an addon that is deactivated at some point).
673 673
 	 */
674
-	public function properties_as_array(){
674
+	public function properties_as_array() {
675 675
 		$properties = parent::properties_as_array();
676 676
 		$properties['_migration_stages'] = array();
677
-		foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){
677
+		foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) {
678 678
 			$properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array();
679 679
 		}
680 680
 		unset($properties['_mappings']);
681 681
 
682
-		foreach($this->_mappings as $old_table_name => $mapping_to_new_table){
683
-			foreach($mapping_to_new_table as $new_table_name => $mapping){
682
+		foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) {
683
+			foreach ($mapping_to_new_table as $new_table_name => $mapping) {
684 684
 				$this->_set_mapping_option($old_table_name, $new_table_name, $mapping);
685 685
 			}
686 686
 		}
@@ -695,19 +695,19 @@  discard block
 block discarded – undo
695 695
 	 * @param array $array_of_properties like what's produced from properties_as_array() method
696 696
 	 * @return void
697 697
 	 */
698
-	public function instantiate_from_array_of_properties($array_of_properties){
698
+	public function instantiate_from_array_of_properties($array_of_properties) {
699 699
 		$stages_properties_arrays = $array_of_properties['_migration_stages'];
700 700
 		unset($array_of_properties['_migration_stages']);
701 701
 		unset($array_of_properties['class']);
702
-		foreach($array_of_properties as $property_name => $property_value){
702
+		foreach ($array_of_properties as $property_name => $property_value) {
703 703
 			$this->{$property_name} = $property_value;
704 704
 		}
705 705
 		//_migration_stages are already instantiated, but have only default data
706
-		foreach($this->_migration_stages as $stage){
707
-			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays);
706
+		foreach ($this->_migration_stages as $stage) {
707
+			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays);
708 708
 			//SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by
709 709
 			//an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet)
710
-			if($stage_data){
710
+			if ($stage_data) {
711 711
 				$stage->instantiate_from_array_of_properties($stage_data);
712 712
 			}
713 713
 		}
@@ -723,9 +723,9 @@  discard block
 block discarded – undo
723 723
 	 * @param array $migration_stage_data_arrays
724 724
 	 * @return null
725 725
 	 */
726
-	private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){
727
-		foreach($migration_stage_data_arrays as $migration_stage_data_array){
728
-			if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){
726
+	private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) {
727
+		foreach ($migration_stage_data_arrays as $migration_stage_data_array) {
728
+			if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) {
729 729
 				return $migration_stage_data_array;
730 730
 			}
731 731
 		}
@@ -741,8 +741,8 @@  discard block
 block discarded – undo
741 741
 	 * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin
742 742
 	 * that will be updated to. Eg array('Core','4.1.0')
743 743
 	 */
744
-	public final function migrates_to_version(){
745
-		return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) );
744
+	public final function migrates_to_version() {
745
+		return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
746 746
 	}
747 747
 
748 748
 
@@ -754,10 +754,10 @@  discard block
 block discarded – undo
754 754
 	 * Or 'Core' for core (non-addon).
755 755
 	 * @return string
756 756
 	 */
757
-	public function slug(){
757
+	public function slug() {
758 758
 		$migrates_to_version_info = $this->migrates_to_version();
759 759
 		//the slug is the first part of the array
760
-		return $migrates_to_version_info[ 'slug' ];
760
+		return $migrates_to_version_info['slug'];
761 761
 	}
762 762
 
763 763
 
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	 * the database up so it can run), then you can set "A" to priority 3 or something.
772 772
 	 * @return int
773 773
 	 */
774
-	public function priority(){
774
+	public function priority() {
775 775
 		return $this->_priority;
776 776
 	}
777 777
 
@@ -784,18 +784,18 @@  discard block
 block discarded – undo
784 784
 	 * @param boolean $migrating
785 785
 	 * @return void
786 786
 	 */
787
-	public function set_migrating( $migrating = TRUE ){
787
+	public function set_migrating($migrating = TRUE) {
788 788
 		$this->_migrating = $migrating;
789 789
 	}
790 790
 
791 791
 	/**
792 792
 	 * Marks that we think this migration class can continue to migrate
793 793
 	 */
794
-	public function reattempt(){
794
+	public function reattempt() {
795 795
 		parent::reattempt();
796 796
 		//also, we want to reattempt any stages that were marked as borked
797
-		foreach( $this->stages() as $stage ) {
798
-			if( $stage->is_broken() ) {
797
+		foreach ($this->stages() as $stage) {
798
+			if ($stage->is_broken()) {
799 799
 				$stage->reattempt();
800 800
 			}
801 801
 		}
Please login to merge, or discard this patch.
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 					$records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated);
315 315
 					$num_records_actually_migrated += $records_migrated_during_stage;
316 316
 					$records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage;
317
-				}catch(Exception $e){
317
+				} catch(Exception $e){
318 318
 					//yes if we catch an exception here, we consider that migration stage borked.
319 319
 					$stage->set_status(EE_Data_Migration_Manager::status_fatal_error);
320 320
 					$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
@@ -340,14 +340,14 @@  discard block
 block discarded – undo
340 340
 			//this migration script apparently has NO stages... which is super weird, but whatever
341 341
 			$this->set_completed();
342 342
 			$this->_maybe_do_schema_changes(false);
343
-		}else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
343
+		} else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
344 344
 			//apparently we're done, because we couldn't migrate the number we intended to
345 345
 			$this->set_completed();
346 346
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
347 347
 			//do schema changes for after the migration now
348 348
 			//first double-check we haven't already done this
349 349
 			$this->_maybe_do_schema_changes(false);
350
-		}else{
350
+		} else{
351 351
 			//update feedback message, keeping in mind that we show them with the most recent at the top
352 352
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
353 353
 		}
@@ -386,12 +386,12 @@  discard block
 block discarded – undo
386 386
 				ob_start();
387 387
 				if($before){
388 388
 					$this->schema_changes_before_migration();
389
-				}else{
389
+				} else{
390 390
 					$this->schema_changes_after_migration();
391 391
 				}
392 392
 				$output = ob_get_contents();
393 393
 				ob_end_clean();
394
-			}catch(Exception $e){
394
+			} catch(Exception $e){
395 395
 				$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
396 396
 				throw $e;
397 397
 			}
@@ -533,13 +533,13 @@  discard block
 block discarded – undo
533 533
 		if( $table_is_new ) {
534 534
 			if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation  || $this->_currently_migrating() ){
535 535
 				return true;
536
-			}else{
536
+			} else{
537 537
 				return false;
538 538
 			}
539
-		}else{
539
+		} else{
540 540
 			if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){
541 541
 				return true;
542
-			}else{
542
+			} else{
543 543
 				return false;
544 544
 			}
545 545
 		}
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 	private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){
556 556
 		try{
557 557
 			EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables);
558
-		}catch( EE_Error $e ) {
558
+		} catch( EE_Error $e ) {
559 559
 			$message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString();
560 560
 			$this->add_error( $message  );
561 561
 			$this->_feedback_message .= $message;
@@ -572,11 +572,11 @@  discard block
 block discarded – undo
572 572
 	private function _get_req_type_for_plugin_corresponding_to_this_dms(){
573 573
 		if($this->slug() == 'Core'){
574 574
 			return EE_System::instance()->detect_req_type();
575
-		}else{//it must be for an addon
575
+		} else{//it must be for an addon
576 576
 			$addon_name = $this->slug();
577 577
 			if( EE_Registry::instance()->get_addon_by_name($addon_name)){
578 578
 				return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type();
579
-			}else{
579
+			} else{
580 580
 				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ;
581 581
 			}
582 582
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @author 		Mike Nelson, Brent Christensen
14 14
  * @since       4.7.0
15 15
  */
16
-class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{
16
+class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base {
17 17
 
18 18
 	/**
19 19
 	 * return EE_DMS_Core_4_7_0
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 	public function can_migrate_from_version($version_array) {
41 41
 		$version_string = $version_array['Core'];
42 42
 		if (
43
-			( $version_string <= '4.7.0' && $version_string >= '4.6.0' )
43
+			($version_string <= '4.7.0' && $version_string >= '4.6.0')
44 44
 			||
45
-			( $version_string >= '4.7.0' &&
46
-					! EEH_Activation::table_exists( 'esp_registration_payment' ) &&
47
-					EEH_Activation::table_exists( 'esp_registration' ) ) ) {
45
+			($version_string >= '4.7.0' &&
46
+					! EEH_Activation::table_exists('esp_registration_payment') &&
47
+					EEH_Activation::table_exists('esp_registration')) ) {
48 48
 			return true;
49
-		} elseif ( ! $version_string ) {
49
+		} elseif ( ! $version_string) {
50 50
 			//no version string provided... this must be pre 4.3
51
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
51
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
52 52
 		} else {
53 53
 			return false;
54 54
 		}
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function schema_changes_before_migration() {
72 72
 		//relies on 4.1's EEH_Activation::create_table
73
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
74
-		$table_name='esp_answer';
75
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
73
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
74
+		$table_name = 'esp_answer';
75
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
76 76
 					REG_ID INT UNSIGNED NOT NULL,
77 77
 					QST_ID INT UNSIGNED NOT NULL,
78 78
 					ANS_value TEXT NOT NULL,
79 79
 					PRIMARY KEY  (ANS_ID),
80 80
 					KEY REG_ID (REG_ID),
81 81
 					KEY QST_ID (QST_ID)";
82
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
82
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
83 83
 
84 84
 		$table_name = 'esp_attendee_meta';
85 85
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
120 120
 					  CNT_active TINYINT(1) DEFAULT '0',
121 121
 					  PRIMARY KEY  (CNT_ISO)";
122
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
122
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
123 123
 
124 124
 		$table_name = 'esp_currency';
125 125
 		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
130 130
 				CUR_active TINYINT(1) DEFAULT '0',
131 131
 				PRIMARY KEY  (CUR_code)";
132
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
132
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
133 133
 
134 134
 
135 135
 		$table_name = 'esp_currency_payment_method';
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 						KEY EVT_ID (EVT_ID),
160 160
 						KEY DTT_is_primary (DTT_is_primary)";
161 161
 
162
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
162
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
163 163
 
164 164
 		$table_name = 'esp_event_meta';
165 165
 		$sql = "
@@ -178,44 +178,44 @@  discard block
 block discarded – undo
178 178
 			EVT_donations TINYINT(1) NULL,
179 179
 			PRIMARY KEY  (EVTM_ID),
180 180
 			KEY EVT_ID (EVT_ID)";
181
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
181
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
182 182
 
183 183
 
184 184
 
185
-		$table_name='esp_event_question_group';
186
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
185
+		$table_name = 'esp_event_question_group';
186
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
187 187
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
188 188
 					QSG_ID INT UNSIGNED NOT NULL,
189 189
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
190 190
 					PRIMARY KEY  (EQG_ID),
191 191
 					KEY EVT_ID (EVT_ID),
192 192
 					KEY QSG_ID (QSG_ID)";
193
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
193
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
194 194
 
195 195
 
196 196
 
197
-		$table_name='esp_event_venue';
198
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
197
+		$table_name = 'esp_event_venue';
198
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
199 199
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
200 200
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
201 201
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
202 202
 				PRIMARY KEY  (EVV_ID)";
203
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
203
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
204 204
 
205 205
 
206 206
 
207
-		$table_name='esp_extra_meta';
208
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
207
+		$table_name = 'esp_extra_meta';
208
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
209 209
 				OBJ_ID INT(11) DEFAULT NULL,
210 210
 				EXM_type VARCHAR(45) DEFAULT NULL,
211 211
 				EXM_key VARCHAR(45) DEFAULT NULL,
212 212
 				EXM_value TEXT,
213 213
 				PRIMARY KEY  (EXM_ID),
214 214
 				KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))";
215
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
215
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
216 216
 
217
-		$table_name='esp_line_item';
218
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
217
+		$table_name = 'esp_line_item';
218
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
219 219
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
220 220
 				TXN_ID INT(11) DEFAULT NULL,
221 221
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 				PRIMARY KEY  (LIN_ID),
234 234
 				KEY LIN_code (LIN_code(191)),
235 235
 				KEY TXN_ID (TXN_ID)";
236
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
236
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
237 237
 
238 238
 		$table_name = 'esp_log';
239 239
 		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
274 274
 					PRIMARY KEY  (GRP_ID),
275 275
 					KEY MTP_user_id (MTP_user_id)";
276
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
276
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
277 277
 
278 278
 		$table_name = 'esp_event_message_template';
279 279
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 					PRIMARY KEY  (EMT_ID),
283 283
 					KEY EVT_ID (EVT_ID),
284 284
 					KEY GRP_ID (GRP_ID)";
285
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
285
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
286 286
 
287 287
 
288 288
 		$table_name = 'esp_payment';
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 					  PRIMARY KEY  (TTM_ID)";
356 356
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
357 357
 
358
-		$table_name='esp_question';
359
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
358
+		$table_name = 'esp_question';
359
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
360 360
 					QST_display_text TEXT NOT NULL,
361 361
 					QST_admin_label VARCHAR(255) NOT NULL,
362 362
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -369,22 +369,22 @@  discard block
 block discarded – undo
369 369
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
370 370
 					PRIMARY KEY  (QST_ID),
371 371
 					KEY QST_order (QST_order)';
372
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
372
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
373 373
 
374
-		$table_name='esp_question_group_question';
375
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
374
+		$table_name = 'esp_question_group_question';
375
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
376 376
 					QSG_ID INT UNSIGNED NOT NULL,
377 377
 					QST_ID INT UNSIGNED NOT NULL,
378 378
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
379 379
 					PRIMARY KEY  (QGQ_ID),
380 380
 					KEY QST_ID (QST_ID),
381 381
 					KEY QSG_ID_order (QSG_ID, QGQ_order)";
382
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
382
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
383 383
 
384 384
 
385 385
 
386
-		$table_name='esp_question_option';
387
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
386
+		$table_name = 'esp_question_option';
387
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
388 388
 					QSO_value VARCHAR(255) NOT NULL,
389 389
 					QSO_desc TEXT NOT NULL,
390 390
 					QST_ID INT UNSIGNED NOT NULL,
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 					PRIMARY KEY  (QSO_ID),
394 394
 					KEY QST_ID (QST_ID),
395 395
 					KEY QSO_order (QSO_order)";
396
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
396
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
397 397
 
398 398
 
399 399
 
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 
440 440
 
441 441
 
442
-		$table_name='esp_checkin';
443
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
442
+		$table_name = 'esp_checkin';
443
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
444 444
 					REG_ID INT(10) UNSIGNED NOT NULL,
445 445
 					DTT_ID INT(10) UNSIGNED NOT NULL,
446 446
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
536 536
 					  PRIMARY KEY  (PRC_ID),
537 537
 					  KEY PRT_ID (PRT_ID)";
538
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
538
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
539 539
 
540 540
 		$table_name = "esp_price_type";
541 541
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -573,10 +573,10 @@  discard block
 block discarded – undo
573 573
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
574 574
 					  PRIMARY KEY  (TKT_ID),
575 575
 					  KEY TKT_start_date (TKT_start_date)";
576
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
576
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
577 577
 
578 578
 		$table_name = 'esp_question_group';
579
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
579
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
580 580
 					QSG_name VARCHAR(255) NOT NULL,
581 581
 					QSG_identifier VARCHAR(100) NOT NULL,
582 582
 					QSG_desc TEXT NULL,
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 					PRIMARY KEY  (QSG_ID),
590 590
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
591 591
 					KEY QSG_order (QSG_order)';
592
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
592
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
593 593
 
594 594
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
595 595
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 		return true;
622 622
 	}
623 623
 
624
-	public function migration_page_hooks(){
624
+	public function migration_page_hooks() {
625 625
 
626 626
 	}
627 627
 }
Please login to merge, or discard this patch.