Completed
Branch FEAT-7553-PayPal-Express-PM (0ca3c2)
by
unknown
71:02 queued 56:56
created
core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 // (all other times it gets resurrected from a wordpress option)
18 18
 $stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*');
19 19
 $class_to_filepath = array();
20
-foreach($stages as $filepath){
20
+foreach ($stages as $filepath) {
21 21
 	$matches = array();
22
-	preg_match('~4_7_0_stages/(.*).dmsstage.php~',$filepath,$matches);
22
+	preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches);
23 23
 	$class_to_filepath[$matches[1]] = $filepath;
24 24
 }
25 25
 //give addons a chance to autoload their stages too
26
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages',$class_to_filepath);
26
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath);
27 27
 EEH_Autoloader::register_autoloader($class_to_filepath);
28 28
 
29 29
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  * @since                4.7.0
40 40
  *
41 41
  */
42
-class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{
42
+class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base {
43 43
 
44 44
 	/**
45 45
 	 * return EE_DMS_Core_4_7_0
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 	 * @param TableManager  $table_manager
48 48
 	 * @param TableAnalysis $table_analysis
49 49
 	 */
50
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
50
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
51 51
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.7.0.p", "event_espresso");
52 52
 		$this->_priority = 10;
53 53
 		$this->_migration_stages = array(
54 54
 			new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(),
55 55
 			new EE_DMS_4_7_0_Registration_Payments(),
56 56
 		);
57
-		parent::__construct( $table_manager, $table_analysis );
57
+		parent::__construct($table_manager, $table_analysis);
58 58
 	}
59 59
 
60 60
 
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
 		$version_string = $version_array['Core'];
68 68
 		if (
69 69
 			(
70
-				version_compare( $version_string, '4.7.0', '<=' )
71
-				&& version_compare( $version_string, '4.6.0', '>=' )
70
+				version_compare($version_string, '4.7.0', '<=')
71
+				&& version_compare($version_string, '4.6.0', '>=')
72 72
 			) || (
73
-				version_compare( $version_string, '4.7.0', '>=' )
74
-				&& ! $this->_get_table_analysis()->tableExists( 'esp_registration_payment' )
75
-				&& $this->_get_table_analysis()->tableExists( 'esp_registration' )
73
+				version_compare($version_string, '4.7.0', '>=')
74
+				&& ! $this->_get_table_analysis()->tableExists('esp_registration_payment')
75
+				&& $this->_get_table_analysis()->tableExists('esp_registration')
76 76
 			)
77 77
 		) {
78 78
 			return true;
79
-		} elseif ( ! $version_string ) {
79
+		} elseif ( ! $version_string) {
80 80
 			//no version string provided... this must be pre 4.3
81
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
81
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
82 82
 		} else {
83 83
 			return false;
84 84
 		}
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function schema_changes_before_migration() {
102 102
 		//relies on 4.1's EEH_Activation::create_table
103
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
104
-		$table_name='esp_answer';
105
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
103
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
104
+		$table_name = 'esp_answer';
105
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
106 106
 					REG_ID INT UNSIGNED NOT NULL,
107 107
 					QST_ID INT UNSIGNED NOT NULL,
108 108
 					ANS_value TEXT NOT NULL,
109 109
 					PRIMARY KEY  (ANS_ID),
110 110
 					KEY REG_ID (REG_ID),
111 111
 					KEY QST_ID (QST_ID)";
112
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
112
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
113 113
 
114 114
 		$table_name = 'esp_attendee_meta';
115 115
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
150 150
 					  CNT_active TINYINT(1) DEFAULT '0',
151 151
 					  PRIMARY KEY  (CNT_ISO)";
152
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
152
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
153 153
 
154 154
 		$table_name = 'esp_currency';
155 155
 		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
160 160
 				CUR_active TINYINT(1) DEFAULT '0',
161 161
 				PRIMARY KEY  (CUR_code)";
162
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
162
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
163 163
 
164 164
 
165 165
 		$table_name = 'esp_currency_payment_method';
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 						KEY EVT_ID (EVT_ID),
190 190
 						KEY DTT_is_primary (DTT_is_primary)";
191 191
 
192
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
192
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
193 193
 
194 194
 		$table_name = 'esp_event_meta';
195 195
 		$sql = "
@@ -208,44 +208,44 @@  discard block
 block discarded – undo
208 208
 			EVT_donations TINYINT(1) NULL,
209 209
 			PRIMARY KEY  (EVTM_ID),
210 210
 			KEY EVT_ID (EVT_ID)";
211
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
211
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
212 212
 
213 213
 
214 214
 
215
-		$table_name='esp_event_question_group';
216
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
215
+		$table_name = 'esp_event_question_group';
216
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
217 217
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
218 218
 					QSG_ID INT UNSIGNED NOT NULL,
219 219
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
220 220
 					PRIMARY KEY  (EQG_ID),
221 221
 					KEY EVT_ID (EVT_ID),
222 222
 					KEY QSG_ID (QSG_ID)";
223
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
223
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
224 224
 
225 225
 
226 226
 
227
-		$table_name='esp_event_venue';
228
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
227
+		$table_name = 'esp_event_venue';
228
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
229 229
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
230 230
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
231 231
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
232 232
 				PRIMARY KEY  (EVV_ID)";
233
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
233
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
234 234
 
235 235
 
236 236
 
237
-		$table_name='esp_extra_meta';
238
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
237
+		$table_name = 'esp_extra_meta';
238
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
239 239
 				OBJ_ID INT(11) DEFAULT NULL,
240 240
 				EXM_type VARCHAR(45) DEFAULT NULL,
241 241
 				EXM_key VARCHAR(45) DEFAULT NULL,
242 242
 				EXM_value TEXT,
243 243
 				PRIMARY KEY  (EXM_ID),
244 244
 				KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))";
245
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
245
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
246 246
 
247
-		$table_name='esp_line_item';
248
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
247
+		$table_name = 'esp_line_item';
248
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
249 249
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
250 250
 				TXN_ID INT(11) DEFAULT NULL,
251 251
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 				PRIMARY KEY  (LIN_ID),
264 264
 				KEY LIN_code (LIN_code(191)),
265 265
 				KEY TXN_ID (TXN_ID)";
266
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
266
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
267 267
 
268 268
 		$table_name = 'esp_log';
269 269
 		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
304 304
 					PRIMARY KEY  (GRP_ID),
305 305
 					KEY MTP_user_id (MTP_user_id)";
306
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
306
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
307 307
 
308 308
 		$table_name = 'esp_event_message_template';
309 309
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 					PRIMARY KEY  (EMT_ID),
313 313
 					KEY EVT_ID (EVT_ID),
314 314
 					KEY GRP_ID (GRP_ID)";
315
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
315
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
316 316
 
317 317
 
318 318
 		$table_name = 'esp_payment';
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 					  PRIMARY KEY  (TTM_ID)";
386 386
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
387 387
 
388
-		$table_name='esp_question';
389
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
388
+		$table_name = 'esp_question';
389
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
390 390
 					QST_display_text TEXT NOT NULL,
391 391
 					QST_admin_label VARCHAR(255) NOT NULL,
392 392
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -399,22 +399,22 @@  discard block
 block discarded – undo
399 399
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
400 400
 					PRIMARY KEY  (QST_ID),
401 401
 					KEY QST_order (QST_order)';
402
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
402
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
403 403
 
404
-		$table_name='esp_question_group_question';
405
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
404
+		$table_name = 'esp_question_group_question';
405
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
406 406
 					QSG_ID INT UNSIGNED NOT NULL,
407 407
 					QST_ID INT UNSIGNED NOT NULL,
408 408
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
409 409
 					PRIMARY KEY  (QGQ_ID),
410 410
 					KEY QST_ID (QST_ID),
411 411
 					KEY QSG_ID_order (QSG_ID, QGQ_order)";
412
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
412
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
413 413
 
414 414
 
415 415
 
416
-		$table_name='esp_question_option';
417
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
416
+		$table_name = 'esp_question_option';
417
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
418 418
 					QSO_value VARCHAR(255) NOT NULL,
419 419
 					QSO_desc TEXT NOT NULL,
420 420
 					QST_ID INT UNSIGNED NOT NULL,
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 					PRIMARY KEY  (QSO_ID),
424 424
 					KEY QST_ID (QST_ID),
425 425
 					KEY QSO_order (QSO_order)";
426
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
426
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
427 427
 
428 428
 
429 429
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 
470 470
 
471 471
 
472
-		$table_name='esp_checkin';
473
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
472
+		$table_name = 'esp_checkin';
473
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
474 474
 					REG_ID INT(10) UNSIGNED NOT NULL,
475 475
 					DTT_ID INT(10) UNSIGNED NOT NULL,
476 476
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
566 566
 					  PRIMARY KEY  (PRC_ID),
567 567
 					  KEY PRT_ID (PRT_ID)";
568
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
568
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
569 569
 
570 570
 		$table_name = "esp_price_type";
571 571
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
604 604
 					  PRIMARY KEY  (TKT_ID),
605 605
 					  KEY TKT_start_date (TKT_start_date)";
606
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
606
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
607 607
 
608 608
 		$table_name = 'esp_question_group';
609
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
609
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
610 610
 					QSG_name VARCHAR(255) NOT NULL,
611 611
 					QSG_identifier VARCHAR(100) NOT NULL,
612 612
 					QSG_desc TEXT NULL,
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 					PRIMARY KEY  (QSG_ID),
620 620
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
621 621
 					KEY QSG_order (QSG_order)';
622
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
622
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
623 623
 
624 624
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
625 625
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 		return true;
652 652
 	}
653 653
 
654
-	public function migration_page_hooks(){
654
+	public function migration_page_hooks() {
655 655
 
656 656
 	}
657 657
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_8_0.dms.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 //(all other times it gets resurrected from a wordpress option)
17 17
 $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*');
18 18
 $class_to_filepath = array();
19
-foreach($stages as $filepath){
19
+foreach ($stages as $filepath) {
20 20
 	$matches = array();
21
-	preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches);
21
+	preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22 22
 	$class_to_filepath[$matches[1]] = $filepath;
23 23
 }
24 24
 //give addons a chance to autoload their stages too
25
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath);
25
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath);
26 26
 EEH_Autoloader::register_autoloader($class_to_filepath);
27 27
 
28 28
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @since                4.6.0
39 39
  *
40 40
  */
41
-class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{
41
+class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base {
42 42
 
43 43
 	/**
44 44
 	 * return EE_DMS_Core_4_8_0
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 	 * @param TableManager  $table_manager
47 47
 	 * @param TableAnalysis $table_analysis
48 48
 	 */
49
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
49
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
50 50
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.8.0.P (for promotions)", "event_espresso");
51 51
 		$this->_priority = 10;
52 52
 		$this->_migration_stages = array(
53 53
 			new EE_DMS_4_8_0_pretax_totals(),
54 54
 			new EE_DMS_4_8_0_event_subtotals(),
55 55
 		);
56
-		parent::__construct( $table_manager, $table_analysis );
56
+		parent::__construct($table_manager, $table_analysis);
57 57
 	}
58 58
 
59 59
 
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function can_migrate_from_version($version_array) {
70 70
 		$version_string = $version_array['Core'];
71
-		if ( version_compare( $version_string, '4.8.0', '<=' ) && version_compare( $version_string, '4.7.0', '>=' ) ) {
71
+		if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) {
72 72
 //			echo "$version_string can be migrated from";
73 73
 			return true;
74
-		}elseif( ! $version_string ){
74
+		}elseif ( ! $version_string) {
75 75
 //			echo "no version string provided: $version_string";
76 76
 			//no version string provided... this must be pre 4.3
77
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
78
-		}else{
77
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
78
+		} else {
79 79
 //			echo "$version_string doesnt apply";
80 80
 			return false;
81 81
 		}
@@ -96,19 +96,19 @@  discard block
 block discarded – undo
96 96
 	 * @return bool
97 97
 	 */
98 98
 	public function schema_changes_before_migration() {
99
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
100
-		$now_in_mysql = current_time( 'mysql', true );
99
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
100
+		$now_in_mysql = current_time('mysql', true);
101 101
 
102
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
103
-		$table_name='esp_answer';
104
-		$sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
102
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
103
+		$table_name = 'esp_answer';
104
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
105 105
 					REG_ID int(10) unsigned NOT NULL,
106 106
 					QST_ID int(10) unsigned NOT NULL,
107 107
 					ANS_value text NOT NULL,
108 108
 					PRIMARY KEY  (ANS_ID),
109 109
 					KEY REG_ID (REG_ID),
110 110
 					KEY QST_ID (QST_ID)";
111
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
111
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
112 112
 
113 113
 		$table_name = 'esp_attendee_meta';
114 114
 		$sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 					  CNT_is_EU tinyint(1) DEFAULT '0',
149 149
 					  CNT_active tinyint(1) DEFAULT '0',
150 150
 					  PRIMARY KEY  (CNT_ISO)";
151
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
151
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
152 152
 
153 153
 		$table_name = 'esp_currency';
154 154
 		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
159 159
 				CUR_active tinyint(1) DEFAULT '0',
160 160
 				PRIMARY KEY  (CUR_code)";
161
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
161
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
162 162
 
163 163
 
164 164
 		$table_name = 'esp_currency_payment_method';
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 						KEY EVT_ID (EVT_ID),
189 189
 						KEY DTT_is_primary (DTT_is_primary)";
190 190
 
191
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
191
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
192 192
 
193 193
 		$table_name = 'esp_event_meta';
194 194
 		$sql = "
@@ -207,41 +207,41 @@  discard block
 block discarded – undo
207 207
 			EVT_donations tinyint(1) NULL,
208 208
 			PRIMARY KEY  (EVTM_ID),
209 209
 			KEY EVT_ID (EVT_ID)";
210
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
210
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
211 211
 
212 212
 
213 213
 
214
-		$table_name='esp_event_question_group';
215
-		$sql="EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
214
+		$table_name = 'esp_event_question_group';
215
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
216 216
 					EVT_ID bigint(20) unsigned NOT NULL,
217 217
 					QSG_ID int(10) unsigned NOT NULL,
218 218
 					EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
219 219
 					PRIMARY KEY  (EQG_ID),
220 220
 					KEY EVT_ID (EVT_ID),
221 221
 					KEY QSG_ID (QSG_ID)";
222
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
222
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
223 223
 
224 224
 
225 225
 
226
-		$table_name='esp_event_venue';
227
-		$sql="EVV_ID int(11) NOT NULL AUTO_INCREMENT,
226
+		$table_name = 'esp_event_venue';
227
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
228 228
 				EVT_ID bigint(20) unsigned NOT NULL,
229 229
 				VNU_ID bigint(20) unsigned NOT NULL,
230 230
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
231 231
 				PRIMARY KEY  (EVV_ID)";
232
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
232
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
233 233
 
234 234
 
235 235
 
236
-		$table_name='esp_extra_meta';
237
-		$sql="EXM_ID int(11) NOT NULL AUTO_INCREMENT,
236
+		$table_name = 'esp_extra_meta';
237
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
238 238
 				OBJ_ID int(11) DEFAULT NULL,
239 239
 				EXM_type varchar(45) DEFAULT NULL,
240 240
 				EXM_key varchar(45) DEFAULT NULL,
241 241
 				EXM_value text,
242 242
 				PRIMARY KEY  (EXM_ID),
243 243
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
244
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
244
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
245 245
 
246 246
 		$table_name = 'esp_extra_join';
247 247
 		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
255 255
 		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
256 256
 
257
-		$table_name='esp_line_item';
258
-		$sql="LIN_ID int(11) NOT NULL AUTO_INCREMENT,
257
+		$table_name = 'esp_line_item';
258
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
259 259
 				LIN_code varchar(245) NOT NULL DEFAULT '',
260 260
 				TXN_ID int(11) DEFAULT NULL,
261 261
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				PRIMARY KEY  (LIN_ID),
275 275
 				KEY LIN_code (LIN_code(191)),
276 276
 				KEY TXN_ID (TXN_ID)";
277
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
277
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
278 278
 
279 279
 		$table_name = 'esp_log';
280 280
 		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 					MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
314 314
 					PRIMARY KEY  (GRP_ID),
315 315
 					KEY MTP_user_id (MTP_user_id)";
316
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
316
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
317 317
 
318 318
 		$table_name = 'esp_event_message_template';
319 319
 		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 					PRIMARY KEY  (EMT_ID),
323 323
 					KEY EVT_ID (EVT_ID),
324 324
 					KEY GRP_ID (GRP_ID)";
325
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
325
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
326 326
 
327 327
 
328 328
 		$table_name = 'esp_payment';
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 					  PRIMARY KEY  (TTM_ID)";
396 396
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
397 397
 
398
-		$table_name='esp_question';
399
-		$sql='QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
398
+		$table_name = 'esp_question';
399
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
400 400
 					QST_display_text text NOT NULL,
401 401
 					QST_admin_label varchar(255) NOT NULL,
402 402
 					QST_system varchar(25) NOT NULL DEFAULT "",
@@ -410,22 +410,22 @@  discard block
 block discarded – undo
410 410
 					QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
411 411
 					PRIMARY KEY  (QST_ID),
412 412
 					KEY QST_order (QST_order)';
413
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
413
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
414 414
 
415
-		$table_name='esp_question_group_question';
416
-		$sql="QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
415
+		$table_name = 'esp_question_group_question';
416
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
417 417
 					QSG_ID int(10) unsigned NOT NULL,
418 418
 					QST_ID int(10) unsigned NOT NULL,
419 419
 					QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
420 420
 					PRIMARY KEY  (QGQ_ID),
421 421
 					KEY QST_ID (QST_ID),
422 422
 					KEY QSG_ID_order (QSG_ID,QGQ_order)";
423
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
423
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
424 424
 
425 425
 
426 426
 
427
-		$table_name='esp_question_option';
428
-		$sql="QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
427
+		$table_name = 'esp_question_option';
428
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
429 429
 					QSO_value varchar(255) NOT NULL,
430 430
 					QSO_desc text NOT NULL,
431 431
 					QST_ID int(10) unsigned NOT NULL,
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 					PRIMARY KEY  (QSO_ID),
436 436
 					KEY QST_ID (QST_ID),
437 437
 					KEY QSO_order (QSO_order)";
438
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
438
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
439 439
 
440 440
 
441 441
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 
482 482
 
483 483
 
484
-		$table_name='esp_checkin';
485
-		$sql="CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
484
+		$table_name = 'esp_checkin';
485
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
486 486
 					REG_ID int(10) unsigned NOT NULL,
487 487
 					DTT_ID int(10) unsigned NOT NULL,
488 488
 					CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 					  PRC_parent int(10) unsigned DEFAULT 0,
578 578
 					  PRIMARY KEY  (PRC_ID),
579 579
 					  KEY PRT_ID (PRT_ID)";
580
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
580
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
581 581
 
582 582
 		$table_name = "esp_price_type";
583 583
 		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
@@ -615,10 +615,10 @@  discard block
 block discarded – undo
615 615
 					  TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
616 616
 					  PRIMARY KEY  (TKT_ID),
617 617
 					  KEY TKT_start_date (TKT_start_date)";
618
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
618
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
619 619
 
620 620
 		$table_name = 'esp_question_group';
621
-		$sql='QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
621
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
622 622
 					QSG_name varchar(255) NOT NULL,
623 623
 					QSG_identifier varchar(100) NOT NULL,
624 624
 					QSG_desc text NULL,
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 					PRIMARY KEY  (QSG_ID),
632 632
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
633 633
 					KEY QSG_order (QSG_order)';
634
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
634
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
635 635
 
636 636
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
637 637
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 		return $script_4_7_defaults->schema_changes_after_migration();
668 668
 	}
669 669
 
670
-	public function migration_page_hooks(){
670
+	public function migration_page_hooks() {
671 671
 
672 672
 	}
673 673
 
@@ -681,19 +681,19 @@  discard block
 block discarded – undo
681 681
 		//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
682 682
 		//('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
683 683
 		$newer_countries = array(
684
-			array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ),
685
-			array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
686
-			array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ),
687
-			array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ),
688
-			array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2,  '+44', 0, 0  ),
689
-			array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ),
690
-			array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
691
-			array( 'ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1,  2, '+382', 0, 0 ),
692
-			array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ),
693
-			array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ),
694
-			array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ),
695
-			array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ),
696
-			array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ),
684
+			array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
685
+			array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
686
+			array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
687
+			array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
688
+			array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
689
+			array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
690
+			array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
691
+			array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
692
+			array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0),
693
+			array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
694
+			array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
695
+			array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0),
696
+			array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
697 697
 		);
698 698
 		global $wpdb;
699 699
 		$country_table = $wpdb->prefix."esp_country";
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
 							"CNT_is_EU" => '%d',
713 713
 							"CNT_active" => '%d',
714 714
 						);
715
-		if ( $this->_get_table_analysis()->tableExists( $country_table ) ) {
716
-			foreach( $newer_countries as $country ) {
717
-				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ;
715
+		if ($this->_get_table_analysis()->tableExists($country_table)) {
716
+			foreach ($newer_countries as $country) {
717
+				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
718 718
 				$countries = $wpdb->get_var($SQL);
719
-				if ( ! $countries ) {
719
+				if ( ! $countries) {
720 720
 
721
-					$wpdb->insert( $country_table,
722
-							array_combine( array_keys( $country_format), $country ),
721
+					$wpdb->insert($country_table,
722
+							array_combine(array_keys($country_format), $country),
723 723
 							$country_format
724 724
 							);
725 725
 				}
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 		// CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
738 738
 		//( 'EUR',  'Euro',  'Euros',  '€',  2,1),
739 739
 		$newer_currencies = array(
740
-			array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ),
740
+			array('RSD', 'Dinar', 'Dinars', '', 3, 1),
741 741
 		);
742 742
 		global $wpdb;
743 743
 		$currency_table = $wpdb->prefix."esp_currency";
@@ -749,14 +749,14 @@  discard block
 block discarded – undo
749 749
 							"CUR_dec_plc" => '%d',
750 750
 							"CUR_active" => '%d',
751 751
 						);
752
-		if ( $this->_get_table_analysis()->tableExists( $currency_table ) ) {
753
-			foreach( $newer_currencies as $currency ) {
754
-				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ;
752
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
753
+			foreach ($newer_currencies as $currency) {
754
+				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
755 755
 				$countries = $wpdb->get_var($SQL);
756
-				if ( ! $countries ) {
756
+				if ( ! $countries) {
757 757
 
758
-					$wpdb->insert( $currency_table,
759
-							array_combine( array_keys( $currency_format), $currency ),
758
+					$wpdb->insert($currency_table,
759
+							array_combine(array_keys($currency_format), $currency),
760 760
 							$currency_format
761 761
 							);
762 762
 				}
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
 	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
769 769
 	 * we should be able to stop doing this in 4.9
770 770
 	 */
771
-	public function fix_non_default_taxes(){
771
+	public function fix_non_default_taxes() {
772 772
 		global $wpdb;
773
-		$query = $wpdb->prepare( "UPDATE
773
+		$query = $wpdb->prepare("UPDATE
774 774
 				{$wpdb->prefix}esp_price p INNER JOIN
775 775
 				{$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID
776 776
 			SET
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 			WHERE
779 779
 				p.PRC_is_default = 0 AND
780 780
 				pt.PBT_ID = %d
781
-					", EEM_Price_Type::base_type_tax );
782
-		$wpdb->query( $query );
781
+					", EEM_Price_Type::base_type_tax);
782
+		$wpdb->query($query);
783 783
 	}
784 784
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_2_0.dms.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
 //(all other times it gets resurrected from a wordpress option)
15 15
 $stages = glob(EE_CORE.'data_migration_scripts/4_2_0_stages/*');
16 16
 $class_to_filepath = array();
17
-if ( ! empty( $stages ) ) {
18
-	foreach($stages as $filepath){
17
+if ( ! empty($stages)) {
18
+	foreach ($stages as $filepath) {
19 19
 		$matches = array();
20
-		preg_match('~4_2_0_stages/(.*).dmsstage.php~',$filepath,$matches);
20
+		preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21 21
 		$class_to_filepath[$matches[1]] = $filepath;
22 22
 	}
23 23
 }
24 24
 //give addons a chance to autoload their stages too
25
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_2_0__autoloaded_stages',$class_to_filepath);
25
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_2_0__autoloaded_stages', $class_to_filepath);
26 26
 EEH_Autoloader::register_autoloader($class_to_filepath);
27 27
 
28
-class EE_DMS_Core_4_2_0 extends EE_Data_Migration_Script_Base{
28
+class EE_DMS_Core_4_2_0 extends EE_Data_Migration_Script_Base {
29 29
 
30 30
 
31 31
 
@@ -35,26 +35,26 @@  discard block
 block discarded – undo
35 35
 	 * @param TableManager  $table_manager
36 36
 	 * @param TableAnalysis $table_analysis
37 37
 	 */
38
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
38
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
39 39
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.2.0.P", "event_espresso");
40 40
 		$this->_priority = 10;
41 41
 		$this->_migration_stages = array(
42 42
 			new EE_DMS_4_2_0_question_group_questions(),
43 43
 			new EE_DMS_4_2_0_datetime_fields(),
44 44
 		);
45
-		parent::__construct( $table_manager, $table_analysis );
45
+		parent::__construct($table_manager, $table_analysis);
46 46
 	}
47 47
 	public function can_migrate_from_version($version_array) {
48 48
 		$version_string = $version_array['Core'];
49
-		if ( version_compare( $version_string, '4.2.0', '<=' ) && version_compare( $version_string, '4.1.0', '>=' ) ) {
49
+		if (version_compare($version_string, '4.2.0', '<=') && version_compare($version_string, '4.1.0', '>=')) {
50 50
 //			echo "$version_string can be migrated fro";
51 51
 			return true;
52
-		}elseif( ! $version_string ){
52
+		}elseif ( ! $version_string) {
53 53
 //			echo "no version string provided: $version_string";
54 54
 			//no version string provided... this must be pre 4.1
55 55
 			//because since 4.1 we're
56
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
57
-		}else{
56
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
57
+		} else {
58 58
 //			echo "$version_string doesnt apply";
59 59
 			return false;
60 60
 		}
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	}
65 65
 	public function schema_changes_before_migration() {
66 66
 		//relies on 4.1's EEH_Activation::create_table
67
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
68
-		$table_name='esp_answer';
69
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
67
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
68
+		$table_name = 'esp_answer';
69
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
70 70
 					REG_ID INT UNSIGNED NOT NULL,
71 71
 					QST_ID INT UNSIGNED NOT NULL,
72 72
 					ANS_value TEXT NOT NULL,
73 73
 					PRIMARY KEY  (ANS_ID)";
74
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
74
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
75 75
 
76 76
 		$table_name = 'esp_attendee_meta';
77 77
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
112 112
 					  CNT_active TINYINT(1) DEFAULT '0',
113 113
 					  PRIMARY KEY  (CNT_ISO)";
114
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
114
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
115 115
 
116 116
 
117 117
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 
136 136
 
137
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
137
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138 138
 		$table_name = 'esp_event_meta';
139 139
 		$sql = "
140 140
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -151,41 +151,41 @@  discard block
 block discarded – undo
151 151
 			EVT_external_URL VARCHAR(200) NULL,
152 152
 			EVT_donations TINYINT(1) NULL,
153 153
 			PRIMARY KEY  (EVTM_ID)";
154
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
154
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
155 155
 
156 156
 
157 157
 
158
-		$table_name='esp_event_question_group';
159
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
158
+		$table_name = 'esp_event_question_group';
159
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
160 160
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
161 161
 					QSG_ID INT UNSIGNED NOT NULL,
162 162
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
163 163
 					PRIMARY KEY  (EQG_ID)";
164
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
164
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
165 165
 
166 166
 
167 167
 
168
-		$table_name='esp_event_venue';
169
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
168
+		$table_name = 'esp_event_venue';
169
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
170 170
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
171 171
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
172 172
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
173 173
 				PRIMARY KEY  (EVV_ID)";
174
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
174
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
175 175
 
176 176
 
177 177
 
178
-		$table_name='esp_extra_meta';
179
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
178
+		$table_name = 'esp_extra_meta';
179
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
180 180
 				OBJ_ID INT(11) DEFAULT NULL,
181 181
 				EXM_type VARCHAR(45) DEFAULT NULL,
182 182
 				EXM_key VARCHAR(45) DEFAULT NULL,
183 183
 				EXM_value TEXT,
184 184
 				PRIMARY KEY  (EXM_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
-		$table_name='esp_line_item';
188
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
187
+		$table_name = 'esp_line_item';
188
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
189 189
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
190 190
 				TXN_ID INT(11) DEFAULT NULL,
191 191
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 				OBJ_ID INT(11) DEFAULT NULL,
202 202
 				OBJ_type VARCHAR(45)DEFAULT NULL,
203 203
 				PRIMARY KEY  (LIN_ID)";
204
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
204
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
205 205
 
206 206
 		$table_name = 'esp_message_template';
207 207
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 					PRIMARY KEY  (GRP_ID),
229 229
 					KEY EVT_ID (EVT_ID),
230 230
 					KEY MTP_user_id (MTP_user_id)";
231
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
231
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
232 232
 
233 233
 
234 234
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 
337 337
 
338 338
 
339
-		$table_name='esp_question';
340
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
339
+		$table_name = 'esp_question';
340
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
341 341
 					QST_display_text TEXT NOT NULL,
342 342
 					QST_admin_label VARCHAR(255) NOT NULL,
343 343
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -349,12 +349,12 @@  discard block
 block discarded – undo
349 349
 					QST_wp_user BIGINT UNSIGNED NULL,
350 350
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
351 351
 					PRIMARY KEY  (QST_ID)';
352
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
352
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
353 353
 
354
-		$this->_get_table_manager()->dropIndex( 'esp_question_group', 'QSG_identifier_UNIQUE' );
354
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
355 355
 
356 356
 		$table_name = 'esp_question_group';
357
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
357
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
358 358
 					QSG_name VARCHAR(255) NOT NULL,
359 359
 					QSG_identifier VARCHAR(100) NOT NULL,
360 360
 					QSG_desc TEXT NULL,
@@ -365,28 +365,28 @@  discard block
 block discarded – undo
365 365
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
366 366
 					PRIMARY KEY  (QSG_ID),
367 367
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
368
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
368
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
369 369
 
370 370
 
371 371
 
372
-		$table_name='esp_question_group_question';
373
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
372
+		$table_name = 'esp_question_group_question';
373
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
374 374
 					QSG_ID INT UNSIGNED NOT NULL,
375 375
 					QST_ID INT UNSIGNED NOT NULL,
376 376
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
377 377
 					PRIMARY KEY  (QGQ_ID) ";
378
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
378
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
379 379
 
380 380
 
381 381
 
382
-		$table_name='esp_question_option';
383
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
382
+		$table_name = 'esp_question_option';
383
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
384 384
 					QSO_value VARCHAR(255) NOT NULL,
385 385
 					QSO_desc TEXT NOT NULL,
386 386
 					QST_ID INT UNSIGNED NOT NULL,
387 387
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
388 388
 					PRIMARY KEY  (QSO_ID)";
389
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
389
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
390 390
 
391 391
 
392 392
 
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 
420 420
 
421 421
 
422
-		$table_name='esp_checkin';
423
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
422
+		$table_name = 'esp_checkin';
423
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
424 424
 					REG_ID INT(10) UNSIGNED NOT NULL,
425 425
 					DTT_ID INT(10) UNSIGNED NOT NULL,
426 426
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
495 495
 
496 496
 
497
-		$script_with_defaults = EE_Registry::instance()->load_dms( 'Core_4_1_0' );
497
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
498 498
 		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
499 499
 		//(because many need to convert old string states to foreign keys into the states table)
500 500
 		$script_with_defaults->insert_default_states();
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 		return true;
517 517
 	}
518 518
 
519
-	public function migration_page_hooks(){
519
+	public function migration_page_hooks() {
520 520
 
521 521
 	}
522 522
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_9_0.dms.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 //(all other times it gets resurrected from a wordpress option)
12 12
 $stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*');
13 13
 $class_to_filepath = array();
14
-foreach($stages as $filepath){
14
+foreach ($stages as $filepath) {
15 15
 	$matches = array();
16
-	preg_match('~4_9_0_stages/(.*).dmsstage.php~',$filepath,$matches);
16
+	preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17 17
 	$class_to_filepath[$matches[1]] = $filepath;
18 18
 }
19 19
 //give addons a chance to autoload their stages too
20
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages',$class_to_filepath);
20
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath);
21 21
 EEH_Autoloader::register_autoloader($class_to_filepath);
22 22
 
23 23
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  * @since                4.6.0
34 34
  *
35 35
  */
36
-class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base{
36
+class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base {
37 37
 
38 38
 	/**
39 39
 	 * return EE_DMS_Core_4_9_0
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	 * @param TableManager  $table_manager
42 42
 	 * @param TableAnalysis $table_analysis
43 43
 	 */
44
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
44
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
45 45
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.9.0.P", "event_espresso");
46 46
 		$this->_priority = 10;
47 47
 		$this->_migration_stages = array(
48 48
 			new EE_DMS_4_9_0_Email_System_Question(),
49 49
 			new EE_DMS_4_9_0_Answers_With_No_Registration(),
50 50
 		);
51
-		parent::__construct( $table_manager, $table_analysis );
51
+		parent::__construct($table_manager, $table_analysis);
52 52
 	}
53 53
 
54 54
 
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function can_migrate_from_version($version_array) {
62 62
 		$version_string = $version_array['Core'];
63
-		if ( version_compare( $version_string, '4.9.0', '<=' ) && version_compare( $version_string, '4.8.0', '>=' ) ) {
63
+		if (version_compare($version_string, '4.9.0', '<=') && version_compare($version_string, '4.8.0', '>=')) {
64 64
 //			echo "$version_string can be migrated from";
65 65
 			return true;
66
-		} elseif( ! $version_string ){
66
+		} elseif ( ! $version_string) {
67 67
 //			echo "no version string provided: $version_string";
68 68
 			//no version string provided... this must be pre 4.3
69
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
70
-		}else{
69
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
70
+		} else {
71 71
 //			echo "$version_string doesnt apply";
72 72
 			return false;
73 73
 		}
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 	 * @return bool
89 89
 	 */
90 90
 	public function schema_changes_before_migration() {
91
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
92
-		$now_in_mysql = current_time( 'mysql', true );
91
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
92
+		$now_in_mysql = current_time('mysql', true);
93 93
 
94
-		$table_name='esp_answer';
95
-		$sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
94
+		$table_name = 'esp_answer';
95
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
96 96
 					REG_ID int(10) unsigned NOT NULL,
97 97
 					QST_ID int(10) unsigned NOT NULL,
98 98
 					ANS_value text NOT NULL,
99 99
 					PRIMARY KEY  (ANS_ID),
100 100
 					KEY REG_ID (REG_ID),
101 101
 					KEY QST_ID (QST_ID)";
102
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
102
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
103 103
 
104 104
 		$table_name = 'esp_attendee_meta';
105 105
 		$sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				KEY ATT_fname (ATT_fname)";
122 122
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
123 123
 
124
-		$table_name='esp_checkin';
124
+		$table_name = 'esp_checkin';
125 125
 		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
126 126
 				REG_ID int(10) unsigned NOT NULL,
127 127
 				DTT_ID int(10) unsigned NOT NULL,
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 				CNT_is_EU tinyint(1) DEFAULT '0',
150 150
 				CNT_active tinyint(1) DEFAULT '0',
151 151
 				PRIMARY KEY  (CNT_ISO)";
152
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
152
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
153 153
 
154 154
 		$table_name = 'esp_currency';
155 155
 		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
160 160
 				CUR_active tinyint(1) DEFAULT '0',
161 161
 				PRIMARY KEY  (CUR_code)";
162
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
162
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
163 163
 
164 164
 
165 165
 		$table_name = 'esp_currency_payment_method';
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				KEY DTT_EVT_start (DTT_EVT_start),
188 188
 				KEY EVT_ID (EVT_ID),
189 189
 				KEY DTT_is_primary (DTT_is_primary)";
190
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
190
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
191 191
 
192 192
 		$table_name = "esp_datetime_ticket";
193 193
 		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				PRIMARY KEY  (EMT_ID),
206 206
 				KEY EVT_ID (EVT_ID),
207 207
 				KEY GRP_ID (GRP_ID)";
208
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
208
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209 209
 
210 210
 		$table_name = 'esp_event_meta';
211 211
 		$sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 				EVT_donations tinyint(1) NULL,
224 224
 				PRIMARY KEY  (EVTM_ID),
225 225
 				KEY EVT_ID (EVT_ID)";
226
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
226
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
227 227
 
228
-		$table_name='esp_event_question_group';
228
+		$table_name = 'esp_event_question_group';
229 229
 		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
230 230
 				EVT_ID bigint(20) unsigned NOT NULL,
231 231
 				QSG_ID int(10) unsigned NOT NULL,
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
 				PRIMARY KEY  (EQG_ID),
234 234
 				KEY EVT_ID (EVT_ID),
235 235
 				KEY QSG_ID (QSG_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
-		$table_name='esp_event_venue';
238
+		$table_name = 'esp_event_venue';
239 239
 		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
240 240
 				EVT_ID bigint(20) unsigned NOT NULL,
241 241
 				VNU_ID bigint(20) unsigned NOT NULL,
242 242
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
243 243
 				PRIMARY KEY  (EVV_ID)";
244
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
244
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
245 245
 
246
-		$table_name='esp_extra_meta';
246
+		$table_name = 'esp_extra_meta';
247 247
 		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
248 248
 				OBJ_ID int(11) DEFAULT NULL,
249 249
 				EXM_type varchar(45) DEFAULT NULL,
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 				EXM_value text,
252 252
 				PRIMARY KEY  (EXM_ID),
253 253
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
254
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
254
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
255 255
 
256 256
 		$table_name = 'esp_extra_join';
257 257
 		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
265 265
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
266 266
 
267
-		$table_name='esp_line_item';
267
+		$table_name = 'esp_line_item';
268 268
 		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
269 269
 				LIN_code varchar(245) NOT NULL DEFAULT '',
270 270
 				TXN_ID int(11) DEFAULT NULL,
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				PRIMARY KEY  (LIN_ID),
285 285
 				KEY LIN_code (LIN_code(191)),
286 286
 				KEY TXN_ID (TXN_ID)";
287
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB' );
287
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
288 288
 
289 289
 		$table_name = 'esp_log';
290 290
 		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 				KEY STS_ID (STS_ID),
334 334
 				KEY MSG_created (MSG_created),
335 335
 				KEY MSG_modified (MSG_modified)";
336
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
336
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
337 337
 
338 338
 		$table_name = 'esp_message_template';
339 339
 		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 				MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
359 359
 				PRIMARY KEY  (GRP_ID),
360 360
 				KEY MTP_user_id (MTP_user_id)";
361
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
361
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
362 362
 
363 363
 		$table_name = 'esp_payment';
364 364
 		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 				PRIMARY KEY  (TTM_ID)";
417 417
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
418 418
 
419
-		$table_name='esp_question';
419
+		$table_name = 'esp_question';
420 420
 		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
421 421
 				QST_display_text text NOT NULL,
422 422
 				QST_admin_label varchar(255) NOT NULL,
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
 				QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
432 432
 				PRIMARY KEY  (QST_ID),
433 433
 				KEY QST_order (QST_order)';
434
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
434
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
435 435
 
436
-		$table_name='esp_question_group_question';
436
+		$table_name = 'esp_question_group_question';
437 437
 		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
438 438
 				QSG_ID int(10) unsigned NOT NULL,
439 439
 				QST_ID int(10) unsigned NOT NULL,
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 				PRIMARY KEY  (QGQ_ID),
442 442
 				KEY QST_ID (QST_ID),
443 443
 				KEY QSG_ID_order (QSG_ID,QGQ_order)";
444
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
444
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
445 445
 
446
-		$table_name='esp_question_option';
446
+		$table_name = 'esp_question_option';
447 447
 		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
448 448
 				QSO_value varchar(255) NOT NULL,
449 449
 				QSO_desc text NOT NULL,
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 				PRIMARY KEY  (QSO_ID),
455 455
 				KEY QST_ID (QST_ID),
456 456
 				KEY QSO_order (QSO_order)";
457
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
457
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
458 458
 
459 459
 		$table_name = 'esp_registration';
460 460
 		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 				PRC_parent int(10) unsigned DEFAULT 0,
568 568
 				PRIMARY KEY  (PRC_ID),
569 569
 				KEY PRT_ID (PRT_ID)";
570
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
570
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
571 571
 
572 572
 		$table_name = "esp_price_type";
573 573
 		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 				TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
605 605
 				PRIMARY KEY  (TKT_ID),
606 606
 				KEY TKT_start_date (TKT_start_date)";
607
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
607
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
608 608
 
609 609
 		$table_name = 'esp_question_group';
610 610
 		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 				PRIMARY KEY  (QSG_ID),
621 621
 				UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
622 622
 				KEY QSG_order (QSG_order)';
623
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
623
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
624 624
 
625 625
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
626 626
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -654,5 +654,5 @@  discard block
 block discarded – undo
654 654
 		return true;
655 655
 	}
656 656
 
657
-	public function migration_page_hooks(){}
657
+	public function migration_page_hooks() {}
658 658
 }
659 659
\ No newline at end of file
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_3_0.dms.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@  discard block
 block discarded – undo
13 13
 //(all other times it gets resurrected from a wordpress option)
14 14
 $stages = glob(EE_CORE.'data_migration_scripts/4_3_0_stages/*');
15 15
 $class_to_filepath = array();
16
-if ( ! empty( $stages ) ) {
17
-	foreach($stages as $filepath){
16
+if ( ! empty($stages)) {
17
+	foreach ($stages as $filepath) {
18 18
 		$matches = array();
19
-		preg_match('~4_3_0_stages/(.*).dmsstage.php~',$filepath,$matches);
19
+		preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20 20
 		$class_to_filepath[$matches[1]] = $filepath;
21 21
 	}
22 22
 }
23 23
 //give addons a chance to autoload their stages too
24
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages',$class_to_filepath);
24
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages', $class_to_filepath);
25 25
 EEH_Autoloader::register_autoloader($class_to_filepath);
26 26
 
27
-class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base{
27
+class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base {
28 28
 
29 29
 
30 30
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param TableManager  $table_manager
35 35
 	 * @param TableAnalysis $table_analysis
36 36
 	 */
37
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
37
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
38 38
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.3.0.P", "event_espresso");
39 39
 		$this->_priority = 10;
40 40
 		$this->_migration_stages = array(
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 			new EE_DMS_4_3_0_event_message_templates(),
43 43
 			new EE_DMS_4_3_0_critical_page_shortcode_tracking()
44 44
 		);
45
-		parent::__construct( $table_manager, $table_analysis );
45
+		parent::__construct($table_manager, $table_analysis);
46 46
 	}
47 47
 	public function can_migrate_from_version($version_array) {
48 48
 		$version_string = $version_array['Core'];
49
-		if ( version_compare( $version_string, '4.3.0', '<=' ) && version_compare( $version_string, '4.2.0', '>=' ) ) {
49
+		if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) {
50 50
 //			echo "$version_string can be migrated fro";
51 51
 			return true;
52
-		}elseif( ! $version_string ){
52
+		}elseif ( ! $version_string) {
53 53
 //			echo "no version string provided: $version_string";
54 54
 			//no version string provided... this must be pre 4.2
55
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
56
-		}else{
55
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
56
+		} else {
57 57
 //			echo "$version_string doesnt apply";
58 58
 			return false;
59 59
 		}
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 	public function schema_changes_before_migration() {
65 65
 		//relies on 4.1's EEH_Activation::create_table
66
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
67
-		$table_name='esp_answer';
68
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
66
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
67
+		$table_name = 'esp_answer';
68
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
69 69
 					REG_ID INT UNSIGNED NOT NULL,
70 70
 					QST_ID INT UNSIGNED NOT NULL,
71 71
 					ANS_value TEXT NOT NULL,
72 72
 					PRIMARY KEY  (ANS_ID)";
73
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
73
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
74 74
 
75 75
 		$table_name = 'esp_attendee_meta';
76 76
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
110 110
 					  CNT_active TINYINT(1) DEFAULT '0',
111 111
 					  PRIMARY KEY  (CNT_ISO)";
112
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
112
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
113 113
 
114 114
 
115 115
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 
134 134
 
135
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
135
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
136 136
 		$table_name = 'esp_event_meta';
137 137
 		$sql = "
138 138
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -149,41 +149,41 @@  discard block
 block discarded – undo
149 149
 			EVT_external_URL VARCHAR(200) NULL,
150 150
 			EVT_donations TINYINT(1) NULL,
151 151
 			PRIMARY KEY  (EVTM_ID)";
152
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
152
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
153 153
 
154 154
 
155 155
 
156
-		$table_name='esp_event_question_group';
157
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
156
+		$table_name = 'esp_event_question_group';
157
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
158 158
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
159 159
 					QSG_ID INT UNSIGNED NOT NULL,
160 160
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
161 161
 					PRIMARY KEY  (EQG_ID)";
162
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
162
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
163 163
 
164 164
 
165 165
 
166
-		$table_name='esp_event_venue';
167
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
166
+		$table_name = 'esp_event_venue';
167
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
168 168
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
169 169
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
170 170
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
171 171
 				PRIMARY KEY  (EVV_ID)";
172
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
172
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
173 173
 
174 174
 
175 175
 
176
-		$table_name='esp_extra_meta';
177
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
176
+		$table_name = 'esp_extra_meta';
177
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
178 178
 				OBJ_ID INT(11) DEFAULT NULL,
179 179
 				EXM_type VARCHAR(45) DEFAULT NULL,
180 180
 				EXM_key VARCHAR(45) DEFAULT NULL,
181 181
 				EXM_value TEXT,
182 182
 				PRIMARY KEY  (EXM_ID)";
183
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
183
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
184 184
 
185
-		$table_name='esp_line_item';
186
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
185
+		$table_name = 'esp_line_item';
186
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
187 187
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
188 188
 				TXN_ID INT(11) DEFAULT NULL,
189 189
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				OBJ_ID INT(11) DEFAULT NULL,
200 200
 				OBJ_type VARCHAR(45)DEFAULT NULL,
201 201
 				PRIMARY KEY  (LIN_ID)";
202
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
202
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
203 203
 
204 204
 		$table_name = 'esp_message_template';
205 205
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 					KEY GRP_ID (GRP_ID)";
212 212
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
213 213
 
214
-		$this->_get_table_manager()->dropIndex( 'esp_message_template_group', 'EVT_ID' );
214
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
215 215
 
216 216
 		$table_name = 'esp_message_template_group';
217 217
 		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
227 227
 					PRIMARY KEY  (GRP_ID),
228 228
 					KEY MTP_user_id (MTP_user_id)";
229
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
229
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
230 230
 
231 231
 		$table_name = 'esp_event_message_template';
232 232
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 					PRIMARY KEY  (EMT_ID),
236 236
 					KEY EVT_ID (EVT_ID),
237 237
 					KEY GRP_ID (GRP_ID)";
238
-		$this->_table_is_new_in_this_version( $table_name, $sql, 'ENGINE=InnoDB');
238
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
239 239
 
240 240
 
241 241
 
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 
345 345
 
346 346
 
347
-		$table_name='esp_question';
348
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
347
+		$table_name = 'esp_question';
348
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
349 349
 					QST_display_text TEXT NOT NULL,
350 350
 					QST_admin_label VARCHAR(255) NOT NULL,
351 351
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -357,12 +357,12 @@  discard block
 block discarded – undo
357 357
 					QST_wp_user BIGINT UNSIGNED NULL,
358 358
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
359 359
 					PRIMARY KEY  (QST_ID)';
360
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
360
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
361 361
 
362
-		$this->_get_table_manager()->dropIndex( 'esp_question_group', 'QSG_identifier_UNIQUE' );
362
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
363 363
 
364 364
 		$table_name = 'esp_question_group';
365
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
365
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
366 366
 					QSG_name VARCHAR(255) NOT NULL,
367 367
 					QSG_identifier VARCHAR(100) NOT NULL,
368 368
 					QSG_desc TEXT NULL,
@@ -373,29 +373,29 @@  discard block
 block discarded – undo
373 373
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
374 374
 					PRIMARY KEY  (QSG_ID),
375 375
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
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
 
380
-		$table_name='esp_question_group_question';
381
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
380
+		$table_name = 'esp_question_group_question';
381
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
382 382
 					QSG_ID INT UNSIGNED NOT NULL,
383 383
 					QST_ID INT UNSIGNED NOT NULL,
384 384
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
385 385
 					PRIMARY KEY  (QGQ_ID) ";
386
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
386
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
387 387
 
388 388
 
389 389
 
390
-		$table_name='esp_question_option';
391
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
390
+		$table_name = 'esp_question_option';
391
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
392 392
 					QSO_value VARCHAR(255) NOT NULL,
393 393
 					QSO_desc TEXT NOT NULL,
394 394
 					QST_ID INT UNSIGNED NOT NULL,
395 395
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
396 396
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
397 397
 					PRIMARY KEY  (QSO_ID)";
398
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
398
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
399 399
 
400 400
 
401 401
 
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 
429 429
 
430 430
 
431
-		$table_name='esp_checkin';
432
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
431
+		$table_name = 'esp_checkin';
432
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
433 433
 					REG_ID INT(10) UNSIGNED NOT NULL,
434 434
 					DTT_ID INT(10) UNSIGNED NOT NULL,
435 435
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
504 504
 
505 505
 
506
-		$script_with_defaults = EE_Registry::instance()->load_dms( 'Core_4_1_0' );
506
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
507 507
 		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
508 508
 		//(because many need to convert old string states to foreign keys into the states table)
509 509
 		$script_with_defaults->insert_default_states();
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		return true;
526 526
 	}
527 527
 
528
-	public function migration_page_hooks(){
528
+	public function migration_page_hooks() {
529 529
 
530 530
 	}
531 531
 
@@ -541,34 +541,34 @@  discard block
 block discarded – undo
541 541
 
542 542
 		global $wpdb;
543 543
 		$ticket_table = $wpdb->prefix."esp_ticket";
544
-		if ( $this->_get_table_analysis()->tableExists( $ticket_table ) ) {
544
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
545 545
 
546
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
546
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
547 547
 			$tickets_exist = $wpdb->get_var($SQL);
548 548
 
549
-			if ( ! $tickets_exist ) {
549
+			if ( ! $tickets_exist) {
550 550
 				$SQL = "INSERT INTO $ticket_table
551 551
 					( 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
552
-					( 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);";
553
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL );
552
+					( 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);";
553
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
554 554
 				$wpdb->query($SQL);
555 555
 			}
556 556
 		}
557 557
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
558 558
 
559
-		if ( $this->_get_table_analysis()->tableExists( $ticket_price_table ) ) {
559
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
560 560
 
561
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
561
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
562 562
 			$ticket_prc_exist = $wpdb->get_var($SQL);
563 563
 
564
-			if ( ! $ticket_prc_exist ) {
564
+			if ( ! $ticket_prc_exist) {
565 565
 
566 566
 				$SQL = "INSERT INTO $ticket_price_table
567 567
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
568 568
 				( 1, 1, 1 )
569 569
 				";
570 570
 
571
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL );
571
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
572 572
 				$wpdb->query($SQL);
573 573
 			}
574 574
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_5_0.dms.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
 //(all other times it gets resurrected from a wordpress option)
16 16
 $stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*');
17 17
 $class_to_filepath = array();
18
-foreach($stages as $filepath){
18
+foreach ($stages as $filepath) {
19 19
 	$matches = array();
20
-	preg_match('~4_5_0_stages/(.*).dmsstage.php~',$filepath,$matches);
20
+	preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21 21
 	$class_to_filepath[$matches[1]] = $filepath;
22 22
 }
23 23
 //give addons a chance to autoload their stages too
24
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages',$class_to_filepath);
24
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath);
25 25
 EEH_Autoloader::register_autoloader($class_to_filepath);
26 26
 
27
-class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base{
27
+class EE_DMS_Core_4_5_0 extends EE_Data_Migration_Script_Base {
28 28
 
29 29
 
30 30
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param TableManager  $table_manager
35 35
 	 * @param TableAnalysis $table_analysis
36 36
 	 */
37
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
37
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
38 38
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.5.0.P", "event_espresso");
39 39
 		$this->_priority = 10;
40 40
 		$this->_migration_stages = array(
@@ -44,21 +44,21 @@  discard block
 block discarded – undo
44 44
 			new EE_DMS_4_5_0_update_wp_user_for_question_groups(),
45 45
 			new EE_DMS_4_5_0_invoice_settings(),
46 46
 			);
47
-		parent::__construct( $table_manager, $table_analysis );
47
+		parent::__construct($table_manager, $table_analysis);
48 48
 	}
49 49
 
50 50
 
51 51
 
52 52
 	public function can_migrate_from_version($version_array) {
53 53
 		$version_string = $version_array['Core'];
54
-		if ( version_compare( $version_string, '4.5.0', '<=' ) && version_compare( $version_string, '4.3.0', '>=' ) ) {
54
+		if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) {
55 55
 //			echo "$version_string can be migrated from";
56 56
 			return true;
57
-		}elseif( ! $version_string ){
57
+		}elseif ( ! $version_string) {
58 58
 //			echo "no version string provided: $version_string";
59 59
 			//no version string provided... this must be pre 4.3
60
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
61
-		}else{
60
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
61
+		} else {
62 62
 //			echo "$version_string doesnt apply";
63 63
 			return false;
64 64
 		}
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	}
69 69
 	public function schema_changes_before_migration() {
70 70
 		//relies on 4.1's EEH_Activation::create_table
71
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
72
-		$table_name='esp_answer';
73
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
71
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
72
+		$table_name = 'esp_answer';
73
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
74 74
 					REG_ID INT UNSIGNED NOT NULL,
75 75
 					QST_ID INT UNSIGNED NOT NULL,
76 76
 					ANS_value TEXT NOT NULL,
77 77
 					PRIMARY KEY  (ANS_ID)";
78
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
78
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
79 79
 
80 80
 		$table_name = 'esp_attendee_meta';
81 81
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
115 115
 					  CNT_active TINYINT(1) DEFAULT '0',
116 116
 					  PRIMARY KEY  (CNT_ISO)";
117
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
117
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
118 118
 
119 119
 		$table_name = 'esp_datetime';
120 120
 		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
 
137 137
 
138
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
138
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
139 139
 		$table_name = 'esp_event_meta';
140 140
 		$sql = "
141 141
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -152,41 +152,41 @@  discard block
 block discarded – undo
152 152
 			EVT_external_URL VARCHAR(200) NULL,
153 153
 			EVT_donations TINYINT(1) NULL,
154 154
 			PRIMARY KEY  (EVTM_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_event_question_group';
160
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
159
+		$table_name = 'esp_event_question_group';
160
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
161 161
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
162 162
 					QSG_ID INT UNSIGNED NOT NULL,
163 163
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
164 164
 					PRIMARY KEY  (EQG_ID)";
165
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
165
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
166 166
 
167 167
 
168 168
 
169
-		$table_name='esp_event_venue';
170
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
169
+		$table_name = 'esp_event_venue';
170
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
171 171
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
172 172
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
173 173
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
174 174
 				PRIMARY KEY  (EVV_ID)";
175
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
175
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
176 176
 
177 177
 
178 178
 
179
-		$table_name='esp_extra_meta';
180
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
179
+		$table_name = 'esp_extra_meta';
180
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
181 181
 				OBJ_ID INT(11) DEFAULT NULL,
182 182
 				EXM_type VARCHAR(45) DEFAULT NULL,
183 183
 				EXM_key VARCHAR(45) DEFAULT NULL,
184 184
 				EXM_value TEXT,
185 185
 				PRIMARY KEY  (EXM_ID)";
186
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
186
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
187 187
 
188
-		$table_name='esp_line_item';
189
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
188
+		$table_name = 'esp_line_item';
189
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
190 190
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
191 191
 				TXN_ID INT(11) DEFAULT NULL,
192 192
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 				OBJ_ID INT(11) DEFAULT NULL,
203 203
 				OBJ_type VARCHAR(45)DEFAULT NULL,
204 204
 				PRIMARY KEY  (LIN_ID)";
205
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
205
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
206 206
 
207 207
 		$table_name = 'esp_message_template';
208 208
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 					KEY GRP_ID (GRP_ID)";
215 215
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
216 216
 
217
-		$this->_get_table_manager()->dropIndex( 'esp_message_template_group', 'EVT_ID' );
217
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
218 218
 
219 219
 		$table_name = 'esp_message_template_group';
220 220
 		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
230 230
 					PRIMARY KEY  (GRP_ID),
231 231
 					KEY MTP_user_id (MTP_user_id)";
232
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
232
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
233 233
 
234 234
 		$table_name = 'esp_event_message_template';
235 235
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 					PRIMARY KEY  (EMT_ID),
239 239
 					KEY EVT_ID (EVT_ID),
240 240
 					KEY GRP_ID (GRP_ID)";
241
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
241
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
242 242
 
243 243
 
244 244
 		$table_name = 'esp_payment';
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 					  PRIMARY KEY  (TTM_ID)";
289 289
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
290 290
 
291
-		$table_name='esp_question';
292
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
291
+		$table_name = 'esp_question';
292
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
293 293
 					QST_display_text TEXT NOT NULL,
294 294
 					QST_admin_label VARCHAR(255) NOT NULL,
295 295
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -301,27 +301,27 @@  discard block
 block discarded – undo
301 301
 					QST_wp_user BIGINT UNSIGNED NULL,
302 302
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
303 303
 					PRIMARY KEY  (QST_ID)';
304
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
304
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
305 305
 
306
-		$table_name='esp_question_group_question';
307
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
306
+		$table_name = 'esp_question_group_question';
307
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
308 308
 					QSG_ID INT UNSIGNED NOT NULL,
309 309
 					QST_ID INT UNSIGNED NOT NULL,
310 310
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
311 311
 					PRIMARY KEY  (QGQ_ID) ";
312
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
312
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
313 313
 
314 314
 
315 315
 
316
-		$table_name='esp_question_option';
317
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
316
+		$table_name = 'esp_question_option';
317
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
318 318
 					QSO_value VARCHAR(255) NOT NULL,
319 319
 					QSO_desc TEXT NOT NULL,
320 320
 					QST_ID INT UNSIGNED NOT NULL,
321 321
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
322 322
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
323 323
 					PRIMARY KEY  (QSO_ID)";
324
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
324
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
325 325
 
326 326
 
327 327
 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 
355 355
 
356 356
 
357
-		$table_name='esp_checkin';
358
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
357
+		$table_name = 'esp_checkin';
358
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
359 359
 					REG_ID INT(10) UNSIGNED NOT NULL,
360 360
 					DTT_ID INT(10) UNSIGNED NOT NULL,
361 361
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 					  PRC_wp_user BIGINT UNSIGNED NULL,
444 444
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
445 445
 					  PRIMARY KEY  (PRC_ID)";
446
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
446
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
447 447
 
448 448
 		$table_name = "esp_price_type";
449 449
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -480,12 +480,12 @@  discard block
 block discarded – undo
480 480
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
481 481
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
482 482
 					  PRIMARY KEY  (TKT_ID)";
483
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
483
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
484 484
 
485
-		$this->_get_table_manager()->dropIndex( 'esp_question_group', 'QSG_identifier_UNIQUE' );
485
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
486 486
 
487 487
 		$table_name = 'esp_question_group';
488
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
488
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
489 489
 					QSG_name VARCHAR(255) NOT NULL,
490 490
 					QSG_identifier VARCHAR(100) NOT NULL,
491 491
 					QSG_desc TEXT NULL,
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 					QSG_wp_user BIGINT UNSIGNED NULL,
498 498
 					PRIMARY KEY  (QSG_ID),
499 499
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
500
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
500
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
501 501
 
502 502
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
503 503
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 		return true;
522 522
 	}
523 523
 
524
-	public function migration_page_hooks(){
524
+	public function migration_page_hooks() {
525 525
 
526 526
 	}
527 527
 
@@ -535,21 +535,21 @@  discard block
 block discarded – undo
535 535
 		global $wpdb;
536 536
 		$price_type_table = $wpdb->prefix."esp_price_type";
537 537
 
538
-		if ( $this->_get_table_analysis()->tableExists( $price_type_table ) ) {
538
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
539 539
 
540
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
541
-			$price_types_exist = $wpdb->get_var( $SQL );
540
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
541
+			$price_types_exist = $wpdb->get_var($SQL);
542 542
 
543
-			if ( ! $price_types_exist ) {
543
+			if ( ! $price_types_exist) {
544 544
 				$user_id = EEH_Activation::get_default_creator_id();
545 545
 				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
546
-							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, $user_id, 0),
547
-							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, $user_id, 0),
548
-							(3, '" . __('Dollar Discount', 'event_espresso') . "', 2,  0, 30, $user_id, 0),
549
-							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, $user_id,  0),
550
-							(5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3,  0, 50, $user_id, 0);";
551
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL );
552
-				$wpdb->query( $SQL );
546
+							(1, '".__('Base Price', 'event_espresso')."', 1,  0, 0, $user_id, 0),
547
+							(2, '".__('Percent Discount', 'event_espresso')."', 2,  1, 20, $user_id, 0),
548
+							(3, '".__('Dollar Discount', 'event_espresso')."', 2,  0, 30, $user_id, 0),
549
+							(4, '".__('Percent Surcharge', 'event_espresso')."', 3,  1, 40, $user_id,  0),
550
+							(5, '".__('Dollar Surcharge', 'event_espresso')."', 3,  0, 50, $user_id, 0);";
551
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
552
+				$wpdb->query($SQL);
553 553
 			}
554 554
 		}
555 555
 	}
@@ -569,17 +569,17 @@  discard block
 block discarded – undo
569 569
 		global $wpdb;
570 570
 		$price_table = $wpdb->prefix."esp_price";
571 571
 
572
-		if ( $this->_get_table_analysis()->tableExists( $price_table ) ) {
572
+		if ($this->_get_table_analysis()->tableExists($price_table)) {
573 573
 
574
-			$SQL = 'SELECT COUNT(PRC_ID) FROM ' .$price_table;
575
-			$prices_exist = $wpdb->get_var( $SQL );
574
+			$SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
575
+			$prices_exist = $wpdb->get_var($SQL);
576 576
 
577
-			if ( ! $prices_exist ) {
577
+			if ( ! $prices_exist) {
578 578
 				$user_id = EEH_Activation::get_default_creator_id();
579 579
 				$SQL = "INSERT INTO $price_table
580 580
 							(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
581 581
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);";
582
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL );
582
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
583 583
 				$wpdb->query($SQL);
584 584
 			}
585 585
 		}
@@ -597,35 +597,35 @@  discard block
 block discarded – undo
597 597
 
598 598
 		global $wpdb;
599 599
 		$ticket_table = $wpdb->prefix."esp_ticket";
600
-		if ( $this->_get_table_analysis()->tableExists( $ticket_table ) ) {
600
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
601 601
 
602
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
602
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
603 603
 			$tickets_exist = $wpdb->get_var($SQL);
604 604
 
605
-			if ( ! $tickets_exist ) {
605
+			if ( ! $tickets_exist) {
606 606
 				$user_id = EEH_Activation::get_default_creator_id();
607 607
 				$SQL = "INSERT INTO $ticket_table
608 608
 					( 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
609
-					( 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);";
610
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL );
609
+					( 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);";
610
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
611 611
 				$wpdb->query($SQL);
612 612
 			}
613 613
 		}
614 614
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
615 615
 
616
-		if ( $this->_get_table_analysis()->tableExists( $ticket_price_table ) ) {
616
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
617 617
 
618
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
618
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
619 619
 			$ticket_prc_exist = $wpdb->get_var($SQL);
620 620
 
621
-			if ( ! $ticket_prc_exist ) {
621
+			if ( ! $ticket_prc_exist) {
622 622
 
623 623
 				$SQL = "INSERT INTO $ticket_price_table
624 624
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
625 625
 				( 1, 1, 1 )
626 626
 				";
627 627
 
628
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL );
628
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
629 629
 				$wpdb->query($SQL);
630 630
 			}
631 631
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_1_0.dms.php 1 patch
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 //(all other times it gets resurrected from a wordpress option)
12 12
 $stages = glob(EE_CORE.'data_migration_scripts/4_1_0_stages/*');
13 13
 $class_to_filepath = array();
14
-if ( ! empty( $stages ) ) {
15
-	foreach($stages as $filepath){
14
+if ( ! empty($stages)) {
15
+	foreach ($stages as $filepath) {
16 16
 		$matches = array();
17
-		preg_match('~4_1_0_stages/(.*).dmsstage.php~',$filepath,$matches);
17
+		preg_match('~4_1_0_stages/(.*).dmsstage.php~', $filepath, $matches);
18 18
 		$class_to_filepath[$matches[1]] = $filepath;
19 19
 	}
20 20
 }
21 21
 //give addons a chance to autoload their stages too
22
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_1_0__autoloaded_stages',$class_to_filepath);
22
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_1_0__autoloaded_stages', $class_to_filepath);
23 23
 EEH_Autoloader::register_autoloader($class_to_filepath);
24 24
 
25 25
 /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  * --a function named update_espresso_config() which saves the EE_Config object to the database
38 38
  * --...and all its subclasses... really, you're best off copying the whole thing when 4.1 is released into this file and wrapping its declaration in if( ! class_exists()){...}
39 39
  */
40
-class EE_DMS_Core_4_1_0 extends EE_Data_Migration_Script_Base{
40
+class EE_DMS_Core_4_1_0 extends EE_Data_Migration_Script_Base {
41 41
 
42 42
 
43 43
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param TableManager  $table_manager
48 48
 	 * @param TableAnalysis $table_analysis
49 49
 	 */
50
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
50
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
51 51
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.1.0P", "event_espresso");
52 52
 		$this->_priority = 10;
53 53
 		$this->_migration_stages = array(
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			new EE_DMS_4_1_0_answers(),
70 70
 			new EE_DMS_4_1_0_checkins(),
71 71
 		);
72
-		parent::__construct( $table_manager, $table_analysis );
72
+		parent::__construct($table_manager, $table_analysis);
73 73
 	}
74 74
 	/**
75 75
 	 * Checks if this 3.1 Check-in table exists. If it doesn't we can't migrate Check-ins
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
 	 * @global wpdb $wpdb
78 78
 	 * @return boolean
79 79
 	 */
80
-	private function _checkin_table_exists(){
80
+	private function _checkin_table_exists() {
81 81
 		global $wpdb;
82 82
 		$results = $wpdb->get_results("SHOW TABLES LIKE '".$wpdb->prefix."events_attendee_checkin"."'");
83
-		if($results){
83
+		if ($results) {
84 84
 			return true;
85
-		}else{
85
+		} else {
86 86
 			return false;
87 87
 		}
88 88
 	}
89 89
 
90 90
 	public function can_migrate_from_version($version_array) {
91 91
 		$version_string = $version_array['Core'];
92
-		if ( version_compare( $version_string, '4.0.0', '<=' ) && version_compare( $version_string, '3.1.26', '>=' ) ) {
92
+		if (version_compare($version_string, '4.0.0', '<=') && version_compare($version_string, '3.1.26', '>=')) {
93 93
 //			echo "$version_string can be migrated fro";
94 94
 			return true;
95
-		}elseif( ! $version_string ){
95
+		}elseif ( ! $version_string) {
96 96
 //			echo "no version string provided: $version_string";
97 97
 			//no version string provided... this must be pre 4.1
98 98
 			//because since 4.1 we're
99
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
100
-		}else{
99
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
100
+		} else {
101 101
 //			echo "$version_string doesnt apply";
102 102
 			return false;
103 103
 		}
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
 	}
108 108
 	public function schema_changes_before_migration() {
109 109
 		//relies on 4.1's EEH_Activation::create_table
110
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
110
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
111 111
 
112
-		$table_name='esp_answer';
113
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
112
+		$table_name = 'esp_answer';
113
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
114 114
 					REG_ID INT UNSIGNED NOT NULL,
115 115
 					QST_ID INT UNSIGNED NOT NULL,
116 116
 					ANS_value TEXT NOT NULL,
117 117
 					PRIMARY KEY  (ANS_ID)";
118
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
118
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
119 119
 
120 120
 		$table_name = 'esp_attendee_meta';
121 121
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
156 156
 					  CNT_active TINYINT(1) DEFAULT '0',
157 157
 					  PRIMARY KEY  (CNT_ISO)";
158
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
158
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
159 159
 
160 160
 
161 161
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
 
178 178
 
179
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
179
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
180 180
 		$table_name = 'esp_event_meta';
181 181
 		$sql = "
182 182
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -193,41 +193,41 @@  discard block
 block discarded – undo
193 193
 			EVT_external_URL VARCHAR(200) NULL,
194 194
 			EVT_donations TINYINT(1) NULL,
195 195
 			PRIMARY KEY  (EVTM_ID)";
196
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
196
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
197 197
 
198 198
 
199 199
 
200
-		$table_name='esp_event_question_group';
201
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
200
+		$table_name = 'esp_event_question_group';
201
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
202 202
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
203 203
 					QSG_ID INT UNSIGNED NOT NULL,
204 204
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
205 205
 					PRIMARY KEY  (EQG_ID)";
206
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
206
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
207 207
 
208 208
 
209 209
 
210
-		$table_name='esp_event_venue';
211
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
210
+		$table_name = 'esp_event_venue';
211
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
212 212
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
213 213
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
214 214
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
215 215
 				PRIMARY KEY  (EVV_ID)";
216
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
216
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
217 217
 
218 218
 
219 219
 
220
-		$table_name='esp_extra_meta';
221
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
220
+		$table_name = 'esp_extra_meta';
221
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
222 222
 				OBJ_ID INT(11) DEFAULT NULL,
223 223
 				EXM_type VARCHAR(45) DEFAULT NULL,
224 224
 				EXM_key VARCHAR(45) DEFAULT NULL,
225 225
 				EXM_value TEXT,
226 226
 				PRIMARY KEY  (EXM_ID)";
227
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
227
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
228 228
 
229
-		$table_name='esp_line_item';
230
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
229
+		$table_name = 'esp_line_item';
230
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
231 231
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
232 232
 				TXN_ID INT(11) DEFAULT NULL,
233 233
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 				OBJ_ID INT(11) DEFAULT NULL,
244 244
 				OBJ_type VARCHAR(45)DEFAULT NULL,
245 245
 				PRIMARY KEY  (LIN_ID)";
246
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
246
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
247 247
 
248 248
 		$table_name = 'esp_message_template';
249 249
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 					PRIMARY KEY  (GRP_ID),
271 271
 					KEY EVT_ID (EVT_ID),
272 272
 					KEY MTP_user_id (MTP_user_id)";
273
-		$this->_table_is_new_in_this_version( $table_name, $sql, 'ENGINE=InnoDB');
273
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
274 274
 
275 275
 
276 276
 
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
 
379 379
 
380 380
 
381
-		$table_name='esp_question';
382
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
381
+		$table_name = 'esp_question';
382
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
383 383
 					QST_display_text TEXT NOT NULL,
384 384
 					QST_admin_label VARCHAR(255) NOT NULL,
385 385
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -391,12 +391,12 @@  discard block
 block discarded – undo
391 391
 					QST_wp_user BIGINT UNSIGNED NULL,
392 392
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
393 393
 					PRIMARY KEY  (QST_ID)';
394
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
394
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
395 395
 
396
-		$this->_get_table_manager()->dropIndex( 'esp_question_group', 'QSG_identifier_UNIQUE' );
396
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
397 397
 
398 398
 		$table_name = 'esp_question_group';
399
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
399
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
400 400
 					QSG_name VARCHAR(255) NOT NULL,
401 401
 					QSG_identifier VARCHAR(100) NOT NULL,
402 402
 					QSG_desc TEXT NULL,
@@ -407,27 +407,27 @@  discard block
 block discarded – undo
407 407
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
408 408
 					PRIMARY KEY  (QSG_ID),
409 409
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
410
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
410
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
411 411
 
412 412
 
413 413
 
414
-		$table_name='esp_question_group_question';
415
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
414
+		$table_name = 'esp_question_group_question';
415
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
416 416
 					QSG_ID INT UNSIGNED NOT NULL,
417 417
 					QST_ID INT UNSIGNED NOT NULL,
418 418
 					PRIMARY KEY  (QGQ_ID) ";
419
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
419
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
420 420
 
421 421
 
422 422
 
423
-		$table_name='esp_question_option';
424
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
423
+		$table_name = 'esp_question_option';
424
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
425 425
 					QSO_value VARCHAR(255) NOT NULL,
426 426
 					QSO_desc TEXT NOT NULL,
427 427
 					QST_ID INT UNSIGNED NOT NULL,
428 428
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
429 429
 					PRIMARY KEY  (QSO_ID)";
430
-		$this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
430
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
431 431
 
432 432
 
433 433
 
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 
461 461
 
462 462
 
463
-		$table_name='esp_checkin';
464
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
463
+		$table_name = 'esp_checkin';
464
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
465 465
 					REG_ID INT(10) UNSIGNED NOT NULL,
466 466
 					DTT_ID INT(10) UNSIGNED NOT NULL,
467 467
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -568,12 +568,12 @@  discard block
 block discarded – undo
568 568
 
569 569
 		global $wpdb;
570 570
 		$state_table = $wpdb->prefix."esp_state";
571
-		if ( $this->_get_table_analysis()->tableExists( $state_table ) ) {
571
+		if ($this->_get_table_analysis()->tableExists($state_table)) {
572 572
 
573
-			$SQL = "SELECT COUNT('STA_ID') FROM " . $state_table;
573
+			$SQL = "SELECT COUNT('STA_ID') FROM ".$state_table;
574 574
 			$states = $wpdb->get_var($SQL);
575
-			if ( ! $states ) {
576
-				$SQL = "INSERT INTO " . $state_table . "
575
+			if ( ! $states) {
576
+				$SQL = "INSERT INTO ".$state_table."
577 577
 				(STA_ID, CNT_ISO, STA_abbrev, STA_name, STA_active) VALUES
578 578
 				(1, 'US', 'AK', 'Alaska', 1),
579 579
 				(2, 'US', 'AL', 'Alabama', 1),
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
 
661 661
 		global $wpdb;
662 662
 		$country_table = $wpdb->prefix."esp_country";
663
-		if ( $this->_get_table_analysis()->tableExists( $country_table ) ) {
663
+		if ($this->_get_table_analysis()->tableExists($country_table)) {
664 664
 
665
-			$SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table;
665
+			$SQL = "SELECT COUNT('CNT_ISO') FROM ".$country_table;
666 666
 			$countries = $wpdb->get_var($SQL);
667
-			if ( ! $countries ) {
668
-				$SQL = "INSERT INTO " . $country_table . "
667
+			if ( ! $countries) {
668
+				$SQL = "INSERT INTO ".$country_table."
669 669
 				(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) VALUES
670 670
 				('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
671 671
 				('AE', 'ARE', 0, 'United Arab Emirates', 'AED', 'Dirham', 'Dirhams', 'د.إ', 1, 2, '+971', 0, 0),
@@ -912,20 +912,20 @@  discard block
 block discarded – undo
912 912
 		global $wpdb;
913 913
 		$price_type_table = $wpdb->prefix."esp_price_type";
914 914
 
915
-		if ( $this->_get_table_analysis()->tableExists( $price_type_table ) ) {
915
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
916 916
 
917
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
918
-			$price_types_exist = $wpdb->get_var( $SQL );
917
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
918
+			$price_types_exist = $wpdb->get_var($SQL);
919 919
 
920
-			if ( ! $price_types_exist ) {
920
+			if ( ! $price_types_exist) {
921 921
 				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES
922
-							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, 0),
923
-							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, 0),
924
-							(3, '" . __('Fixed Discount', 'event_espresso') . "', 2,  0, 30, 0),
925
-							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, 0),
926
-							(5, '" . __('Fixed Surcharge', 'event_espresso') . "', 3,  0, 50, 0);";
927
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL );
928
-				$wpdb->query( $SQL );
922
+							(1, '".__('Base Price', 'event_espresso')."', 1,  0, 0, 0),
923
+							(2, '" . __('Percent Discount', 'event_espresso')."', 2,  1, 20, 0),
924
+							(3, '" . __('Fixed Discount', 'event_espresso')."', 2,  0, 30, 0),
925
+							(4, '" . __('Percent Surcharge', 'event_espresso')."', 3,  1, 40, 0),
926
+							(5, '" . __('Fixed Surcharge', 'event_espresso')."', 3,  0, 50, 0);";
927
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL);
928
+				$wpdb->query($SQL);
929 929
 			}
930 930
 		}
931 931
 	}
@@ -945,16 +945,16 @@  discard block
 block discarded – undo
945 945
 		global $wpdb;
946 946
 		$price_table = $wpdb->prefix."esp_price";
947 947
 
948
-		if ( $this->_get_table_analysis()->tableExists(  $price_table ) ) {
948
+		if ($this->_get_table_analysis()->tableExists($price_table)) {
949 949
 
950
-			$SQL = 'SELECT COUNT(PRC_ID) FROM ' .$price_table;
951
-			$prices_exist = $wpdb->get_var( $SQL );
950
+			$SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
951
+			$prices_exist = $wpdb->get_var($SQL);
952 952
 
953
-			if ( ! $prices_exist ) {
953
+			if ( ! $prices_exist) {
954 954
 				$SQL = "INSERT INTO $price_table
955 955
 							(PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc,  PRC_is_default, PRC_overrides, PRC_order, PRC_deleted, PRC_parent ) VALUES
956 956
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, 0, 0, 0);";
957
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL );
957
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL);
958 958
 				$wpdb->query($SQL);
959 959
 			}
960 960
 		}
@@ -971,34 +971,34 @@  discard block
 block discarded – undo
971 971
 
972 972
 		global $wpdb;
973 973
 		$ticket_table = $wpdb->prefix."esp_ticket";
974
-		if ( $this->_get_table_analysis()->tableExists( $ticket_table ) ) {
974
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
975 975
 
976
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
976
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
977 977
 			$tickets_exist = $wpdb->get_var($SQL);
978 978
 
979
-			if ( ! $tickets_exist ) {
979
+			if ( ! $tickets_exist) {
980 980
 				$SQL = "INSERT INTO $ticket_table
981 981
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, 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
982
-					( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
983
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL );
982
+					( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
983
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
984 984
 				$wpdb->query($SQL);
985 985
 			}
986 986
 		}
987 987
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
988 988
 
989
-		if ( $this->_get_table_analysis()->tableExists( $ticket_price_table ) ) {
989
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
990 990
 
991
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
991
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
992 992
 			$ticket_prc_exist = $wpdb->get_var($SQL);
993 993
 
994
-			if ( ! $ticket_prc_exist ) {
994
+			if ( ! $ticket_prc_exist) {
995 995
 
996 996
 				$SQL = "INSERT INTO $ticket_price_table
997 997
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
998 998
 				( 1, 1, 1 )
999 999
 				";
1000 1000
 
1001
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL );
1001
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
1002 1002
 				$wpdb->query($SQL);
1003 1003
 			}
1004 1004
 		}
@@ -1011,20 +1011,20 @@  discard block
 block discarded – undo
1011 1011
 	 * @param string $country_name
1012 1012
 	 * @return array where keys are columns, values are column values
1013 1013
 	 */
1014
-	public function get_or_create_country($country_name){
1015
-		if( ! $country_name ){
1014
+	public function get_or_create_country($country_name) {
1015
+		if ( ! $country_name) {
1016 1016
 			throw new EE_Error(__("Could not get a country because country name is blank", "event_espresso"));
1017 1017
 		}
1018 1018
 		global $wpdb;
1019 1019
 		$country_table = $wpdb->prefix."esp_country";
1020
-		if(is_int($country_name)){
1020
+		if (is_int($country_name)) {
1021 1021
 			$country_name = $this->get_iso_from_3_1_country_id($country_name);
1022 1022
 		}
1023 1023
 		$country = $wpdb->get_row($wpdb->prepare("SELECT * FROM $country_table WHERE
1024 1024
 			CNT_ISO LIKE %s OR
1025 1025
 			CNT_ISO3 LIKE %s OR
1026
-			CNT_name LIKE %s LIMIT 1",$country_name,$country_name,$country_name),ARRAY_A);
1027
-		if( ! $country ){
1026
+			CNT_name LIKE %s LIMIT 1", $country_name, $country_name, $country_name), ARRAY_A);
1027
+		if ( ! $country) {
1028 1028
 			//insert a new one then
1029 1029
 			$cols_n_values = array(
1030 1030
 				'CNT_ISO'=> $this->_find_available_country_iso(2),
@@ -1044,26 +1044,26 @@  discard block
 block discarded – undo
1044 1044
 				'CNT_active'=>true
1045 1045
 			);
1046 1046
 			$data_types = array(
1047
-				'%s',//CNT_ISO
1048
-				'%s',//CNT_ISO3
1049
-				'%d',//RGN_ID
1050
-				'%s',//CNT_name
1051
-				'%s',//CNT_cur_code
1052
-				'%s',//CNT_cur_single
1053
-				'%s',//CNT_cur_plural
1054
-				'%s',//CNT_cur_sign
1055
-				'%d',//CNT_cur_sign_b4
1056
-				'%d',//CNT_cur_dec_plc
1057
-				'%s',//CNT_cur_dec_mrk
1058
-				'%s',//CNT_cur_thsnds
1059
-				'%s',//CNT_tel_code
1060
-				'%d',//CNT_is_EU
1061
-				'%d',//CNT_active
1047
+				'%s', //CNT_ISO
1048
+				'%s', //CNT_ISO3
1049
+				'%d', //RGN_ID
1050
+				'%s', //CNT_name
1051
+				'%s', //CNT_cur_code
1052
+				'%s', //CNT_cur_single
1053
+				'%s', //CNT_cur_plural
1054
+				'%s', //CNT_cur_sign
1055
+				'%d', //CNT_cur_sign_b4
1056
+				'%d', //CNT_cur_dec_plc
1057
+				'%s', //CNT_cur_dec_mrk
1058
+				'%s', //CNT_cur_thsnds
1059
+				'%s', //CNT_tel_code
1060
+				'%d', //CNT_is_EU
1061
+				'%d', //CNT_active
1062 1062
 			);
1063 1063
 			$success = $wpdb->insert($country_table,
1064 1064
 					$cols_n_values,
1065 1065
 					$data_types);
1066
-			if( ! $success){
1066
+			if ( ! $success) {
1067 1067
 				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('country_id'=>$country_name), $country_table, $cols_n_values, $data_types));
1068 1068
 			}
1069 1069
 			$country = $cols_n_values;
@@ -1075,13 +1075,13 @@  discard block
 block discarded – undo
1075 1075
 	 * @global type $wpdb
1076 1076
 	 * @return string
1077 1077
 	 */
1078
-	private function _find_available_country_iso($num_letters = 2){
1078
+	private function _find_available_country_iso($num_letters = 2) {
1079 1079
 		global $wpdb;
1080 1080
 		$country_table = $wpdb->prefix."esp_country";
1081
-		do{
1081
+		do {
1082 1082
 			$current_iso = strtoupper(wp_generate_password($num_letters, false));
1083
-			$country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM ".$country_table." WHERE CNT_ISO=%s",$current_iso));
1084
-		}while(intval($country_with_that_iso));
1083
+			$country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM ".$country_table." WHERE CNT_ISO=%s", $current_iso));
1084
+		}while (intval($country_with_that_iso));
1085 1085
 		return $current_iso;
1086 1086
 	}
1087 1087
 
@@ -1092,14 +1092,14 @@  discard block
 block discarded – undo
1092 1092
 	 * @param string $state_name
1093 1093
 	 * @return array where keys are columns, values are column values
1094 1094
 	 */
1095
-	public function get_or_create_state($state_name,$country_name = ''){
1096
-		if( ! $state_name ){
1095
+	public function get_or_create_state($state_name, $country_name = '') {
1096
+		if ( ! $state_name) {
1097 1097
 			throw new EE_Error(__("Could not get-or-create state because no state name was provided", "event_espresso"));
1098 1098
 		}
1099
-		try{
1099
+		try {
1100 1100
 			$country = $this->get_or_create_country($country_name);
1101 1101
 			$country_iso = $country['CNT_ISO'];
1102
-		}catch(EE_Error $e){
1102
+		} catch (EE_Error $e) {
1103 1103
 			$country_iso = $this->get_default_country_iso();
1104 1104
 		}
1105 1105
 		global $wpdb;
@@ -1107,24 +1107,24 @@  discard block
 block discarded – undo
1107 1107
 		$state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE
1108 1108
 			(STA_abbrev LIKE %s OR
1109 1109
 			STA_name LIKE %s) AND
1110
-			CNT_ISO LIKE %s LIMIT 1",$state_name,$state_name,$country_iso),ARRAY_A);
1111
-		if ( ! $state){
1110
+			CNT_ISO LIKE %s LIMIT 1", $state_name, $state_name, $country_iso), ARRAY_A);
1111
+		if ( ! $state) {
1112 1112
 			//insert a new one then
1113 1113
 			$cols_n_values = array(
1114 1114
 				'CNT_ISO'=>$country_iso,
1115
-				'STA_abbrev'=>substr($state_name,0,6),
1115
+				'STA_abbrev'=>substr($state_name, 0, 6),
1116 1116
 				'STA_name'=>$state_name,
1117 1117
 				'STA_active'=>true
1118 1118
 			);
1119 1119
 			$data_types = array(
1120
-				'%s',//CNT_ISO
1121
-				'%s',//STA_abbrev
1122
-				'%s',//STA_name
1123
-				'%d',//STA_active
1120
+				'%s', //CNT_ISO
1121
+				'%s', //STA_abbrev
1122
+				'%s', //STA_name
1123
+				'%d', //STA_active
1124 1124
 			);
1125
-			$success = $wpdb->insert($state_table,$cols_n_values,$data_types);
1126
-			if ( ! $success ){
1127
-				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('state'=>$state_name,'country_id'=>$country_name), $state_table, $cols_n_values, $data_types));
1125
+			$success = $wpdb->insert($state_table, $cols_n_values, $data_types);
1126
+			if ( ! $success) {
1127
+				throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('state'=>$state_name, 'country_id'=>$country_name), $state_table, $cols_n_values, $data_types));
1128 1128
 			}
1129 1129
 			$state = $cols_n_values;
1130 1130
 			$state['STA_ID'] = $wpdb->insert_id;
@@ -1137,21 +1137,21 @@  discard block
 block discarded – undo
1137 1137
 	 * @param type $timeString
1138 1138
 	 * @return string in the php DATETIME format: "G:i" (24-hour format hour with leading zeros, a colon, and minutes with leading zeros)
1139 1139
 	 */
1140
-	public function convertTimeFromAMPM($timeString){
1140
+	public function convertTimeFromAMPM($timeString) {
1141 1141
 		$matches = array();
1142
-		preg_match("~(\\d*):(\\d*)~",$timeString,$matches);
1143
-		if( ! $matches || count($matches)<3){
1142
+		preg_match("~(\\d*):(\\d*)~", $timeString, $matches);
1143
+		if ( ! $matches || count($matches) < 3) {
1144 1144
 			$hour = '00';
1145 1145
 			$minutes = '00';
1146
-		}else{
1146
+		} else {
1147 1147
 			$hour = intval($matches[1]);
1148 1148
 			$minutes = $matches[2];
1149 1149
 		}
1150
-		if(strpos($timeString, 'PM') || strpos($timeString, 'pm')){
1150
+		if (strpos($timeString, 'PM') || strpos($timeString, 'pm')) {
1151 1151
 			$hour = intval($hour) + 12;
1152 1152
 		}
1153
-		$hour = str_pad( "$hour", 2, '0',STR_PAD_LEFT);
1154
-		$minutes = str_pad( "$minutes", 2, '0',STR_PAD_LEFT);
1153
+		$hour = str_pad("$hour", 2, '0', STR_PAD_LEFT);
1154
+		$minutes = str_pad("$minutes", 2, '0', STR_PAD_LEFT);
1155 1155
 		return "$hour:$minutes";
1156 1156
 	}
1157 1157
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 	 * @param int $country_id
1161 1161
 	 * @return string the country's ISO3 code
1162 1162
 	 */
1163
-	public function get_iso_from_3_1_country_id($country_id){
1163
+	public function get_iso_from_3_1_country_id($country_id) {
1164 1164
 		$old_countries = array(
1165 1165
 			array(64, 'United States', 'US', 'USA', 1),
1166 1166
 			array(15, 'Australia', 'AU', 'AUS', 1),
@@ -1386,9 +1386,9 @@  discard block
 block discarded – undo
1386 1386
 			array(226, 'Zimbabwe', 'ZW', 'ZWE', 1));
1387 1387
 
1388 1388
 		$country_iso = 'US';
1389
-		foreach($old_countries as $country_array){
1389
+		foreach ($old_countries as $country_array) {
1390 1390
 			//note: index 0 is the 3.1 country ID
1391
-			if($country_array[0] == $country_id){
1391
+			if ($country_array[0] == $country_id) {
1392 1392
 				//note: index 2 is the ISO
1393 1393
 				$country_iso = $country_array[2];
1394 1394
 				break;
@@ -1401,8 +1401,8 @@  discard block
 block discarded – undo
1401 1401
 	 * Gets the ISO3 for the
1402 1402
 	 * @return string
1403 1403
 	 */
1404
-	public function get_default_country_iso(){
1405
-		$old_org_options= get_option('events_organization_settings');
1404
+	public function get_default_country_iso() {
1405
+		$old_org_options = get_option('events_organization_settings');
1406 1406
 		$iso = $this->get_iso_from_3_1_country_id($old_org_options['organization_country']);
1407 1407
 		return $iso;
1408 1408
 	}
@@ -1414,13 +1414,13 @@  discard block
 block discarded – undo
1414 1414
 	 * the event's DEFAULT payment status, or the attendee's payment status) required pre-approval.
1415 1415
 	 * @return string STS_ID for use in 4.1
1416 1416
 	 */
1417
-	public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false){
1417
+	public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false) {
1418 1418
 
1419 1419
 		//EE team can read the related discussion: https://app.asana.com/0/2400967562914/9418495544455
1420
-		if($this_thing_required_pre_approval){
1420
+		if ($this_thing_required_pre_approval) {
1421 1421
 				return 'RNA';
1422
-		}else{
1423
-				$mapping = $default_reg_stati_conversions=array(
1422
+		} else {
1423
+				$mapping = $default_reg_stati_conversions = array(
1424 1424
 			'Completed'=>'RAP',
1425 1425
 			''=>'RPP',
1426 1426
 			'Incomplete'=>'RPP',
@@ -1450,22 +1450,22 @@  discard block
 block discarded – undo
1450 1450
 	 * @param  EE_Data_Migration_Script_Stage $migration_stage the stage which called this, where errors should be added
1451 1451
 	 * @return boolean whether or not we had to do the big job of creating an image attachment
1452 1452
 	 */
1453
-	public function convert_image_url_to_attachment_and_attach_to_post($guid,$new_cpt_id,  EE_Data_Migration_Script_Stage $migration_stage){
1453
+	public function convert_image_url_to_attachment_and_attach_to_post($guid, $new_cpt_id, EE_Data_Migration_Script_Stage $migration_stage) {
1454 1454
 		$created_attachment_post = false;
1455 1455
 		$guid = $this->_get_original_guid($guid);
1456
-		if($guid){
1456
+		if ($guid) {
1457 1457
 			//check for an existing attachment post with this guid
1458 1458
 			$attachment_post_id = $this->_get_image_attachment_id_by_GUID($guid);
1459
-			if( ! $attachment_post_id){
1459
+			if ( ! $attachment_post_id) {
1460 1460
 				//post thumbnail with that GUID doesn't exist, we should create one
1461 1461
 				$attachment_post_id = $this->_create_image_attachment_from_GUID($guid, $migration_stage);
1462 1462
 				$created_attachment_post = true;
1463 1463
 			}
1464 1464
 			//double-check we actually have an attachment post
1465
-			if( $attachment_post_id){
1466
-				update_post_meta($new_cpt_id,'_thumbnail_id',$attachment_post_id);
1467
-			}else{
1468
-				$migration_stage->add_error(sprintf(__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d", "event_espresso"),$guid,$new_cpt_id,$attachment_post_id));
1465
+			if ($attachment_post_id) {
1466
+				update_post_meta($new_cpt_id, '_thumbnail_id', $attachment_post_id);
1467
+			} else {
1468
+				$migration_stage->add_error(sprintf(__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d", "event_espresso"), $guid, $new_cpt_id, $attachment_post_id));
1469 1469
 			}
1470 1470
 		}
1471 1471
 		return $created_attachment_post;
@@ -1479,13 +1479,13 @@  discard block
 block discarded – undo
1479 1479
 	 * @param string $guid_in_old_event
1480 1480
 	 * @return string either the original guid, or $guid_in_old_event if we couldn't figure out what the original was
1481 1481
 	 */
1482
-	private function _get_original_guid($guid_in_old_event){
1483
-		$original_guid = preg_replace('~-\d*x\d*\.~','.',$guid_in_old_event,1);
1482
+	private function _get_original_guid($guid_in_old_event) {
1483
+		$original_guid = preg_replace('~-\d*x\d*\.~', '.', $guid_in_old_event, 1);
1484 1484
 		//do a head request to verify the file exists
1485 1485
 		$head_response = wp_remote_head($original_guid);
1486
-		if( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK'){
1486
+		if ( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK') {
1487 1487
 			return $original_guid;
1488
-		}else{
1488
+		} else {
1489 1489
 			return $guid_in_old_event;
1490 1490
 		}
1491 1491
 	}
@@ -1497,32 +1497,32 @@  discard block
 block discarded – undo
1497 1497
 	 * @param EE_Data_Migration_Script_Stage $migration_stage
1498 1498
 	 * @return int
1499 1499
 	 */
1500
-	private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage){
1501
-		if ( ! $guid){
1500
+	private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage) {
1501
+		if ( ! $guid) {
1502 1502
 			$migration_stage->add_error(sprintf(__("Cannot create image attachment for a blank GUID!", "event_espresso")));
1503 1503
 			return 0;
1504 1504
 		}
1505
-		$wp_filetype = wp_check_filetype(basename($guid), null );
1505
+		$wp_filetype = wp_check_filetype(basename($guid), null);
1506 1506
 		$wp_upload_dir = wp_upload_dir();
1507 1507
 		//if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local
1508
-		if(strpos($guid,$wp_upload_dir['url']) === FALSE){
1508
+		if (strpos($guid, $wp_upload_dir['url']) === FALSE) {
1509 1509
 			//image is located remotely. download it and place it in the uploads directory
1510
-			if( ! is_readable($guid)){
1511
-				$migration_stage->add_error(sprintf(__("Could not create image attachment from non-existent file: %s", "event_espresso"),$guid));
1510
+			if ( ! is_readable($guid)) {
1511
+				$migration_stage->add_error(sprintf(__("Could not create image attachment from non-existent file: %s", "event_espresso"), $guid));
1512 1512
 				return 0;
1513 1513
 			}
1514
-			$contents= file_get_contents($guid);
1515
-			if($contents === FALSE){
1516
-				$migration_stage->add_error(sprintf(__("Could not read image at %s, and therefore couldnt create an attachment post for it.", "event_espresso"),$guid));
1514
+			$contents = file_get_contents($guid);
1515
+			if ($contents === FALSE) {
1516
+				$migration_stage->add_error(sprintf(__("Could not read image at %s, and therefore couldnt create an attachment post for it.", "event_espresso"), $guid));
1517 1517
 				return false;
1518 1518
 			}
1519
-			$local_filepath  = $wp_upload_dir['path'].DS.basename($guid);
1519
+			$local_filepath = $wp_upload_dir['path'].DS.basename($guid);
1520 1520
 			$savefile = fopen($local_filepath, 'w');
1521 1521
 			fwrite($savefile, $contents);
1522 1522
 			fclose($savefile);
1523
-			$guid = str_replace($wp_upload_dir['path'],$wp_upload_dir['url'],$local_filepath);
1524
-		}else{
1525
-			$local_filepath = str_replace($wp_upload_dir['url'],$wp_upload_dir['path'],$guid);
1523
+			$guid = str_replace($wp_upload_dir['path'], $wp_upload_dir['url'], $local_filepath);
1524
+		} else {
1525
+			$local_filepath = str_replace($wp_upload_dir['url'], $wp_upload_dir['path'], $guid);
1526 1526
 		}
1527 1527
 
1528 1528
 		$attachment = array(
@@ -1532,24 +1532,24 @@  discard block
 block discarded – undo
1532 1532
 		   'post_content' => '',
1533 1533
 		   'post_status' => 'inherit'
1534 1534
 		);
1535
-		$attach_id = wp_insert_attachment( $attachment, $guid );
1536
-		if( ! $attach_id ){
1537
-			$migration_stage->add_error(sprintf(__("Could not create image attachment post from image '%s'. Attachment data was %s.", "event_espresso"),$guid,$this->_json_encode($attachment)));
1535
+		$attach_id = wp_insert_attachment($attachment, $guid);
1536
+		if ( ! $attach_id) {
1537
+			$migration_stage->add_error(sprintf(__("Could not create image attachment post from image '%s'. Attachment data was %s.", "event_espresso"), $guid, $this->_json_encode($attachment)));
1538 1538
 			return $attach_id;
1539 1539
 		}
1540 1540
 
1541 1541
 		// you must first include the image.php file
1542 1542
 		// for the function wp_generate_attachment_metadata() to work
1543
-		require_once(ABSPATH . 'wp-admin/includes/image.php');
1543
+		require_once(ABSPATH.'wp-admin/includes/image.php');
1544 1544
 
1545
-		$attach_data = wp_generate_attachment_metadata( $attach_id, $local_filepath );
1546
-		if( ! $attach_data){
1547
-			$migration_stage->add_error(sprintf(__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.", "event_espresso"),$attach_id,$local_filepath,$guid));
1545
+		$attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath);
1546
+		if ( ! $attach_data) {
1547
+			$migration_stage->add_error(sprintf(__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.", "event_espresso"), $attach_id, $local_filepath, $guid));
1548 1548
 			return $attach_id;
1549 1549
 		}
1550
-		$metadata_save_result = wp_update_attachment_metadata( $attach_id, $attach_data );
1551
-		if( ! $metadata_save_result ){
1552
-			$migration_stage->add_error(sprintf(__("Could not update attachment metadata for attachment %d with data %s", "event_espresso"),$attach_id,$this->_json_encode($attach_data)));
1550
+		$metadata_save_result = wp_update_attachment_metadata($attach_id, $attach_data);
1551
+		if ( ! $metadata_save_result) {
1552
+			$migration_stage->add_error(sprintf(__("Could not update attachment metadata for attachment %d with data %s", "event_espresso"), $attach_id, $this->_json_encode($attach_data)));
1553 1553
 		}
1554 1554
 		return $attach_id;
1555 1555
 	}
@@ -1561,9 +1561,9 @@  discard block
 block discarded – undo
1561 1561
 	 * @param string $guid
1562 1562
 	 * @return int
1563 1563
 	 */
1564
-	private function _get_image_attachment_id_by_GUID($guid){
1564
+	private function _get_image_attachment_id_by_GUID($guid) {
1565 1565
 		global $wpdb;
1566
-		$attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1",$guid));
1566
+		$attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1", $guid));
1567 1567
 		return $attachment_id;
1568 1568
 	}
1569 1569
 	/**
@@ -1575,20 +1575,20 @@  discard block
 block discarded – undo
1575 1575
 	 * @param string $timezone
1576 1576
 	 * @return string
1577 1577
 	 */
1578
-	public function convert_date_string_to_utc(EE_Data_Migration_Script_Stage $stage, $row_of_data, $DATETIME_string,$timezone = null){
1578
+	public function convert_date_string_to_utc(EE_Data_Migration_Script_Stage $stage, $row_of_data, $DATETIME_string, $timezone = null) {
1579 1579
 		$original_tz = $timezone;
1580
-		if( ! $timezone){
1580
+		if ( ! $timezone) {
1581 1581
 			$timezone = $this->_get_wp_timezone();
1582 1582
 		}
1583
-		if( ! $timezone){
1584
-			$stage->add_error(sprintf(__("Could not find timezone given %s for %s", "event_espresso"),$original_tz,$row_of_data));
1583
+		if ( ! $timezone) {
1584
+			$stage->add_error(sprintf(__("Could not find timezone given %s for %s", "event_espresso"), $original_tz, $row_of_data));
1585 1585
 			$timezone = 'UTC';
1586 1586
 		}
1587
-		try{
1588
-			$date_obj = new DateTime( $DATETIME_string, new DateTimeZone( $timezone ) );
1587
+		try {
1588
+			$date_obj = new DateTime($DATETIME_string, new DateTimeZone($timezone));
1589 1589
 			$date_obj->setTimezone(new DateTimeZone('UTC'));
1590
-		}catch(Exception $e){
1591
-			$stage->add_error(sprintf(__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.", "event_espresso"),$DATETIME_string,$timezone));
1590
+		} catch (Exception $e) {
1591
+			$stage->add_error(sprintf(__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.", "event_espresso"), $DATETIME_string, $timezone));
1592 1592
 			$date_obj = new DateTime();
1593 1593
 		}
1594 1594
 
@@ -1599,14 +1599,14 @@  discard block
 block discarded – undo
1599 1599
 	 * Gets the DEFAULT timezone string from wordpress (even if they set a gmt offset)
1600 1600
 	 * @return string
1601 1601
 	 */
1602
-	private function _get_wp_timezone(){
1603
-		$timezone = empty( $timezone ) ? get_option('timezone_string') : $timezone;
1602
+	private function _get_wp_timezone() {
1603
+		$timezone = empty($timezone) ? get_option('timezone_string') : $timezone;
1604 1604
 
1605 1605
 		//if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter
1606
-		if ( empty( $timezone ) ) {
1606
+		if (empty($timezone)) {
1607 1607
 			//let's get a the WordPress UTC offset
1608 1608
 			$offset = get_option('gmt_offset');
1609
-			$timezone = $this->timezone_convert_to_string_from_offset( $offset );
1609
+			$timezone = $this->timezone_convert_to_string_from_offset($offset);
1610 1610
 		}
1611 1611
 		return $timezone;
1612 1612
 	}
@@ -1615,11 +1615,11 @@  discard block
 block discarded – undo
1615 1615
 	 * @param int $offset
1616 1616
 	 * @return boolean
1617 1617
 	 */
1618
-	private function timezone_convert_to_string_from_offset($offset){
1618
+	private function timezone_convert_to_string_from_offset($offset) {
1619 1619
 		//shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable
1620 1620
 		$offset *= 3600; // convert hour offset to seconds
1621 1621
         $abbrarray = timezone_abbreviations_list();
1622
-        foreach ($abbrarray as $abbr){
1622
+        foreach ($abbrarray as $abbr) {
1623 1623
                 foreach ($abbr as $city)
1624 1624
                 {
1625 1625
                         if ($city['offset'] == $offset)
@@ -1633,32 +1633,32 @@  discard block
 block discarded – undo
1633 1633
         return FALSE;
1634 1634
 	}
1635 1635
 
1636
-	public function migration_page_hooks(){
1637
-		add_filter('FHEE__ee_migration_page__header',array($this,'_migrate_page_hook_simplify_version_strings'),10,3);
1638
-		add_filter('FHEE__ee_migration_page__p_after_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1639
-		add_filter('FHEE__ee_migration_page__option_1_main',array($this,'_migrate_page_hook_simplify_version_strings'),10,3);
1640
-		add_filter('FHEE__ee_migration_page__option_1_button_text',array($this,'_migrate_page_hook_simplify_version_strings'),10,3);
1641
-		add_action('AHEE__ee_migration_page__option_1_extra_details',array($this,'_migration_page_hook_option_1_extra_details'),10,3);
1642
-		add_filter('FHEE__ee_migration_page__option_2_main',array($this,'_migrate_page_hook_simplify_version_strings'),10,4);
1643
-		add_filter('FHEE__ee_migration_page__option_2_button_text',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1644
-		add_filter('FHEE__ee_migration_page__option_2_details',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1645
-		add_action('AHEE__ee_migration_page__after_migration_options_table',array($this,'_migration_page_hook_after_migration_options_table'));
1646
-		add_filter('FHEE__ee_migration_page__done_migration_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1647
-		add_filter('FHEE__ee_migration_page__p_after_done_migration_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2);
1636
+	public function migration_page_hooks() {
1637
+		add_filter('FHEE__ee_migration_page__header', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3);
1638
+		add_filter('FHEE__ee_migration_page__p_after_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1639
+		add_filter('FHEE__ee_migration_page__option_1_main', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3);
1640
+		add_filter('FHEE__ee_migration_page__option_1_button_text', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3);
1641
+		add_action('AHEE__ee_migration_page__option_1_extra_details', array($this, '_migration_page_hook_option_1_extra_details'), 10, 3);
1642
+		add_filter('FHEE__ee_migration_page__option_2_main', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 4);
1643
+		add_filter('FHEE__ee_migration_page__option_2_button_text', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1644
+		add_filter('FHEE__ee_migration_page__option_2_details', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1645
+		add_action('AHEE__ee_migration_page__after_migration_options_table', array($this, '_migration_page_hook_after_migration_options_table'));
1646
+		add_filter('FHEE__ee_migration_page__done_migration_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1647
+		add_filter('FHEE__ee_migration_page__p_after_done_migration_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2);
1648 1648
 	}
1649 1649
 
1650
-	public function _migrate_page_hook_simplify_version_strings($old_content,$current_db_state,$next_db_state,$ultimate_db_state = NULL){
1651
-		return str_replace(array($current_db_state,$next_db_state,$ultimate_db_state),array(__('EE3','event_espresso'),__('EE4','event_espresso'),  __("EE4", 'event_espresso')),$old_content);
1650
+	public function _migrate_page_hook_simplify_version_strings($old_content, $current_db_state, $next_db_state, $ultimate_db_state = NULL) {
1651
+		return str_replace(array($current_db_state, $next_db_state, $ultimate_db_state), array(__('EE3', 'event_espresso'), __('EE4', 'event_espresso'), __("EE4", 'event_espresso')), $old_content);
1652 1652
 	}
1653
-	public function _migration_page_hook_simplify_next_db_state($old_content,$next_db_state){
1654
-		return str_replace($next_db_state,  __("EE4", 'event_espresso'),$old_content);
1653
+	public function _migration_page_hook_simplify_next_db_state($old_content, $next_db_state) {
1654
+		return str_replace($next_db_state, __("EE4", 'event_espresso'), $old_content);
1655 1655
 	}
1656
-	public function _migration_page_hook_option_1_extra_details(){
1657
-		?><p><?php	printf(__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents", "event_espresso"));?></p><?php
1656
+	public function _migration_page_hook_option_1_extra_details() {
1657
+		?><p><?php	printf(__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents", "event_espresso")); ?></p><?php
1658 1658
 	}
1659
-	public function _migration_page_hook_after_migration_options_table(){
1659
+	public function _migration_page_hook_after_migration_options_table() {
1660 1660
 		?><p class="ee-attention">
1661
-				<strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ", "event_espresso");?></span></strong><br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.", "event_espresso");	?>
1661
+				<strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ", "event_espresso"); ?></span></strong><br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.", "event_espresso"); ?>
1662 1662
 			</p><?php
1663 1663
 	}
1664 1664
 }
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 *    finds and sets the EE_Event object for use throughout class
224 224
 	 *
225 225
 	 * @access 	public
226
-	 * @param 	mixed $event
226
+	 * @param 	EE_Event|null $event
227 227
 	 * @return 	bool
228 228
 	 */
229 229
 	protected static function set_event( $event = null ) {
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	 * 	process_ticket_selections
585 585
 	 *
586 586
 	 *	@access public
587
-	 * 	@return array|boolean
587
+	 * 	@return boolean|null
588 588
 	 */
589 589
 	public function process_ticket_selections() {
590 590
         do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 *
746 746
 	 * @access        private
747 747
 	 * @param int $id
748
-	 * @return array|FALSE
748
+	 * @return string
749 749
 	 */
750 750
 	private static function _validate_post_data( $id = 0 ) {
751 751
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	 * @access   private
865 865
 	 * @param EE_Ticket $ticket
866 866
 	 * @param int       $qty
867
-	 * @return TRUE on success, FALSE on fail
867
+	 * @return boolean on success, FALSE on fail
868 868
 	 * @throws \EE_Error
869 869
 	 */
870 870
 	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@  discard block
 block discarded – undo
17 17
 	protected static $_event;
18 18
 
19 19
 	/**
20
-	* array of datetimes and the spaces available for them
21
-	*
22
-	* @access private
23
-	* @var array
24
-	*/
20
+	 * array of datetimes and the spaces available for them
21
+	 *
22
+	 * @access private
23
+	 * @var array
24
+	 */
25 25
 	private static $_available_spaces = array();
26 26
 
27 27
 	/**
28
-	* max attendees that can register for event at one time
29
-	*
30
-	* @access private
31
-	* @var int
32
-	*/
28
+	 * max attendees that can register for event at one time
29
+	 *
30
+	 * @access private
31
+	 * @var int
32
+	 */
33 33
 	private static $_max_atndz = EE_INF;
34 34
 
35 35
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 				return $permalink_string;
198 198
 			}
199 199
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
200
-			                     . __( 'Embed', 'event_espresso' )
201
-			                     . '</a> ';
200
+								 . __( 'Embed', 'event_espresso' )
201
+								 . '</a> ';
202 202
 			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
203 203
 			$iframe_string = esc_html(
204 204
 				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	 * @throws \EE_Error
425 425
 	 */
426 426
 	public static function display_ticket_selector_submit() {
427
-        $html = '';
427
+		$html = '';
428 428
 		if ( ! is_admin() ) {
429 429
 			// standard TS displayed with submit button, ie: "Register Now"
430 430
 			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
@@ -482,17 +482,17 @@  discard block
 block discarded – undo
482 482
 				$html .= \EED_Ticket_Selector::ticket_selector_form_close();
483 483
 			} else if ( apply_filters( 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', false ) ) {
484 484
 				// NOT a DWMTS event, TS displayed, BUT no tickets are available, so NO submit button
485
-                $html = \EED_Ticket_Selector::clear_tkt_slctr() . \EED_Ticket_Selector::ticket_selector_form_close();
485
+				$html = \EED_Ticket_Selector::clear_tkt_slctr() . \EED_Ticket_Selector::ticket_selector_form_close();
486 486
 			} else {
487 487
 				// DWMTS event, no TS, no submit or view details button, and no additional content
488
-                $html = \EED_Ticket_Selector::no_tkt_slctr_end_dv() . \EED_Ticket_Selector::ticket_selector_form_close();
488
+				$html = \EED_Ticket_Selector::no_tkt_slctr_end_dv() . \EED_Ticket_Selector::ticket_selector_form_close();
489
+			}
490
+			if ( ! is_archive()) {
491
+				$html .= \EEH_Template::powered_by_event_espresso();
489 492
 			}
490
-            if ( ! is_archive()) {
491
-                $html .= \EEH_Template::powered_by_event_espresso();
492
-            }
493
-        }
494
-        return $html;
495
-    }
493
+		}
494
+		return $html;
495
+	}
496 496
 
497 497
 
498 498
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 	 * 	@return array|boolean
587 587
 	 */
588 588
 	public function process_ticket_selections() {
589
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
589
+		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
590 590
 		// do we have an event id?
591 591
 		if ( ! EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
592 592
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
@@ -1009,11 +1009,11 @@  discard block
 block discarded – undo
1009 1009
 
1010 1010
 
1011 1011
 	/**
1012
-	* 	load js
1013
-	*
1014
-	* 	@access 		public
1015
-	* 	@return 		void
1016
-	*/
1012
+	 * 	load js
1013
+	 *
1014
+	 * 	@access 		public
1015
+	 * 	@return 		void
1016
+	 */
1017 1017
 	public static function load_tckt_slctr_assets() {
1018 1018
 		// add some style
1019 1019
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.
Spacing   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')){ exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  * Ticket Selector  class
4 4
  *
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 	 * @return EED_Ticket_Selector
48 48
 	 */
49 49
 	public static function instance() {
50
-		return parent::get_instance( __CLASS__ );
50
+		return parent::get_instance(__CLASS__);
51 51
 	}
52 52
 
53 53
 
54 54
 
55
-	protected function set_config(){
56
-		$this->set_config_section( 'template_settings' );
57
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
58
-		$this->set_config_name( 'EED_Ticket_Selector' );
55
+	protected function set_config() {
56
+		$this->set_config_section('template_settings');
57
+		$this->set_config_class('EE_Ticket_Selector_Config');
58
+		$this->set_config_name('EED_Ticket_Selector');
59 59
 	}
60 60
 
61 61
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public static function set_hooks() {
72 72
 		// routing
73
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
74
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
75
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
76
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
77
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
73
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
74
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
75
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
76
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
77
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
78 78
 	}
79 79
 
80 80
 
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 	 *  @return 	void
87 87
 	 */
88 88
 	public static function set_hooks_admin() {
89
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
89
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
90 90
 		//add button for iframe code to event editor.
91
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
92
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
91
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
92
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
93 93
 	}
94 94
 
95 95
 
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 	 *  @return 	void
102 102
 	 */
103 103
 	public static function set_definitions() {
104
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
105
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
104
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
105
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
106 106
 
107 107
 		//if config is not set, initialize
108 108
 		//If config is not set, set it.
109
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
109
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
110 110
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
111 111
 		}
112
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
112
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
113 113
 	}
114 114
 
115 115
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 * 	@param	WP $WP
121 121
 	 * 	@return void
122 122
 	 */
123
-	public function run( $WP ) {}
123
+	public function run($WP) {}
124 124
 
125 125
 
126 126
 
@@ -134,23 +134,23 @@  discard block
 block discarded – undo
134 134
 	public function ticket_selector_iframe() {
135 135
 		self::$_in_iframe = true;
136 136
 		/** @type EEM_Event $EEM_Event */
137
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
137
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
138 138
 		$event = $EEM_Event->get_one_by_ID(
139
-			EE_Registry::instance()->REQ->get( 'event', 0 )
139
+			EE_Registry::instance()->REQ->get('event', 0)
140 140
 		);
141
-		EE_Registry::instance()->REQ->set_espresso_page( true );
142
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
141
+		EE_Registry::instance()->REQ->set_espresso_page(true);
142
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
143 143
 		$template_args['css'] = apply_filters(
144 144
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
145 145
 			array(
146
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
147
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
148
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
149
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
146
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
147
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
148
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
149
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
150 150
 			)
151 151
 		);
152
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
153
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = esc_html__( 'Please choose at least one ticket before continuing.', 'event_espresso' );
152
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
153
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = esc_html__('Please choose at least one ticket before continuing.', 'event_espresso');
154 154
 		$template_args['eei18n'] = apply_filters(
155 155
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
156 156
 			EE_Registry::localize_i18n_js_strings()
@@ -158,18 +158,18 @@  discard block
 block discarded – undo
158 158
 		$template_args['js'] = apply_filters(
159 159
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
160 160
 			array(
161
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
162
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
163
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
161
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
162
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
163
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
164 164
 			)
165 165
 		);
166
-		$template_args[ 'notices' ] = EEH_Template::display_template(
167
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
166
+		$template_args['notices'] = EEH_Template::display_template(
167
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
168 168
 			array(),
169 169
 			true
170 170
 		);
171 171
 		EEH_Template::display_template(
172
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
172
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
173 173
 			$template_args
174 174
 		);
175 175
 		exit;
@@ -188,25 +188,25 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return string The new html string for the permalink area.
190 190
 	 */
191
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
191
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
192 192
 		//make sure this is ONLY when editing and the event id has been set.
193
-		if ( ! empty( $id ) ) {
194
-			$post = get_post( $id );
193
+		if ( ! empty($id)) {
194
+			$post = get_post($id);
195 195
 			//if NOT event then let's get out.
196
-			if ( $post->post_type !== 'espresso_events' ) {
196
+			if ($post->post_type !== 'espresso_events') {
197 197
 				return $permalink_string;
198 198
 			}
199 199
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
200
-			                     . __( 'Embed', 'event_espresso' )
200
+			                     . __('Embed', 'event_espresso')
201 201
 			                     . '</a> ';
202
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
202
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
203 203
 			$iframe_string = esc_html(
204
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
204
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
205 205
 			);
206 206
 			$permalink_string .= '
207 207
 <div id="js-ts-iframe" style="display:none">
208 208
 	<div style="width:100%; height: 500px;">
209
-		' . $iframe_string . '
209
+		' . $iframe_string.'
210 210
 	</div>
211 211
 </div>';
212 212
 		}
@@ -225,22 +225,22 @@  discard block
 block discarded – undo
225 225
 	 * @param 	mixed $event
226 226
 	 * @return 	bool
227 227
 	 */
228
-	protected static function set_event( $event = null ) {
229
-		if( $event === null ) {
228
+	protected static function set_event($event = null) {
229
+		if ($event === null) {
230 230
 			global $post;
231 231
 			$event = $post;
232 232
 		}
233
-		if ( $event instanceof EE_Event ) {
233
+		if ($event instanceof EE_Event) {
234 234
 			self::$_event = $event;
235
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
235
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
236 236
 			self::$_event = $event->EE_Event;
237
-		} else if ( $event instanceof WP_Post && $event->post_type === 'espresso_events' ) {
238
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
237
+		} else if ($event instanceof WP_Post && $event->post_type === 'espresso_events') {
238
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
239 239
 			self::$_event = $event->EE_Event;
240 240
 		} else {
241
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
242
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
243
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
241
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
242
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
243
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
244 244
 			return false;
245 245
 		}
246 246
 		return true;
@@ -257,11 +257,11 @@  discard block
 block discarded – undo
257 257
 	 * @return string
258 258
 	 * @throws \EE_Error
259 259
 	 */
260
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
260
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
261 261
 		// reset filter for displaying submit button
262
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
262
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
263 263
 		// poke and prod incoming event till it tells us what it is
264
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
264
+		if ( ! EED_Ticket_Selector::set_event($event)) {
265 265
 			return false;
266 266
 		}
267 267
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			&& (
273 273
 				! self::$_event->display_ticket_selector()
274 274
 				|| $view_details
275
-				|| post_password_required( $event_post )
275
+				|| post_password_required($event_post)
276 276
 				|| (
277 277
 					$_event_active_status !== EE_Datetime::active
278 278
 					&& $_event_active_status !== EE_Datetime::upcoming
@@ -290,34 +290,34 @@  discard block
 block discarded – undo
290 290
 		$template_args = array();
291 291
 		$template_args['event_status'] = $_event_active_status;
292 292
 
293
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
294
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
293
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
294
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
295 295
 
296 296
 		$template_args['EVT_ID'] = self::$_event->ID();
297 297
 		$template_args['event'] = self::$_event;
298 298
 
299 299
 		// is the event expired ?
300 300
 		$template_args['event_is_expired'] = self::$_event->is_expired();
301
-		if ( $template_args['event_is_expired'] ) {
302
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
301
+		if ($template_args['event_is_expired']) {
302
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
303 303
 		}
304 304
 
305 305
 		$ticket_query_args = array(
306
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
307
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
306
+			array('Datetime.EVT_ID' => self::$_event->ID()),
307
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
308 308
 		);
309 309
 
310
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
310
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
311 311
 			//use the correct applicable time query depending on what version of core is being run.
312
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
313
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
312
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
313
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
314 314
 		}
315 315
 
316 316
 		// get all tickets for this event ordered by the datetime
317
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
317
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
318 318
 
319
-		if ( count( $template_args['tickets'] ) < 1 ) {
320
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
319
+		if (count($template_args['tickets']) < 1) {
320
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
321 321
 		}
322 322
 
323 323
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
@@ -326,41 +326,41 @@  discard block
 block discarded – undo
326 326
 			self::$_event->additional_limit()
327 327
 		);
328 328
 		$template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz;
329
-		if ( $template_args['max_atndz'] < 1 ) {
330
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
331
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
332
-				$sales_closed_msg .=  sprintf(
333
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
329
+		if ($template_args['max_atndz'] < 1) {
330
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
331
+			if (current_user_can('edit_post', self::$_event->ID())) {
332
+				$sales_closed_msg .= sprintf(
333
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
334 334
 					'<div class="ee-attention" style="text-align: left;"><b>',
335 335
 					'</b><br />',
336
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
336
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
337 337
 					'</a></span></div>'
338 338
 				);
339 339
 			}
340
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
340
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
341 341
 		}
342 342
 
343
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
344
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
343
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
344
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
345 345
 
346 346
 		// redirecting to another site for registration ??
347 347
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
348 348
 		// if not redirecting to another site for registration
349
-		if ( ! $external_url ) {
349
+		if ( ! $external_url) {
350 350
 			// then display the ticket selector
351
-			$ticket_selector = EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
351
+			$ticket_selector = EEH_Template::locate_template($templates['ticket_selector'], $template_args);
352 352
 		} else {
353 353
 			// if not we still need to trigger the display of the submit button
354
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
354
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
355 355
 			//display notice to admin that registration is external
356
-			$ticket_selector = ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
356
+			$ticket_selector = ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
357 357
 		}
358 358
 		// now set up the form (but not for the admin)
359 359
 		$ticket_selector = ! is_admin()
360 360
 			? EED_Ticket_Selector::ticket_selector_form_open(
361 361
 				self::$_event->ID(),
362 362
 				$external_url
363
-			) . $ticket_selector
363
+			).$ticket_selector
364 364
 			: $ticket_selector;
365 365
 		// submit button and form close tag
366 366
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
 	 * @param 		string $external_url
381 381
 	 * @return 		string
382 382
 	 */
383
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
383
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
384 384
 		// if redirecting, we don't need any anything else
385
-		if ( $external_url ) {
386
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
387
-			$query_args = (array) EEH_URL::get_query_string( $external_url );
388
-			foreach ( $query_args as $query_arg => $value ) {
385
+		if ($external_url) {
386
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
387
+			$query_args = (array) EEH_URL::get_query_string($external_url);
388
+			foreach ($query_args as $query_arg => $value) {
389 389
 				$html .= '
390
-				<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
390
+				<input type="hidden" name="' . $query_arg.'" value="'.$value.'">';
391 391
 			}
392 392
 			return $html;
393 393
 		}
@@ -397,19 +397,19 @@  discard block
 block discarded – undo
397 397
 		if (
398 398
 			EED_Ticket_Selector::$_max_atndz === 1
399 399
 			&& is_archive()
400
-			&& ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false )
400
+			&& ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)
401 401
 		) {
402 402
 			return '';
403 403
 		}
404
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
405
-		if ( ! $checkout_url ) {
406
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
404
+		$checkout_url = EEH_Event_View::event_link_url($ID);
405
+		if ( ! $checkout_url) {
406
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
407 407
 		}
408 408
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
409
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
410
-		$html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce_' . $ID, TRUE, FALSE );
409
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
410
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce_'.$ID, TRUE, FALSE);
411 411
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
412
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
412
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
413 413
 		return $html;
414 414
 	}
415 415
 
@@ -425,19 +425,19 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	public static function display_ticket_selector_submit() {
427 427
         $html = '';
428
-		if ( ! is_admin() ) {
428
+		if ( ! is_admin()) {
429 429
 			// standard TS displayed with submit button, ie: "Register Now"
430
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
430
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
431 431
 				$btn_text = apply_filters(
432 432
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
433
-					__('Register Now', 'event_espresso' ),
433
+					__('Register Now', 'event_espresso'),
434 434
 					EED_Ticket_Selector::$_event
435 435
 				);
436 436
 				$external_url = EED_Ticket_Selector::$_event->external_url();
437
-				$html = '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"';
437
+				$html = '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"';
438 438
 				$html .= ' class="ticket-selector-submit-btn ';
439
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
440
-				$html .= ' type="submit" value="' . $btn_text . '" />';
439
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
440
+				$html .= ' type="submit" value="'.$btn_text.'" />';
441 441
 				$html .= apply_filters(
442 442
 					'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
443 443
 					'',
@@ -446,15 +446,15 @@  discard block
 block discarded – undo
446 446
 				$html .= EED_Ticket_Selector::$_max_atndz === 1
447 447
 					? \EED_Ticket_Selector::no_tkt_slctr_end_dv()
448 448
 					: \EED_Ticket_Selector::clear_tkt_slctr();
449
-				$html .= '<br/>' . \EED_Ticket_Selector::ticket_selector_form_close();
449
+				$html .= '<br/>'.\EED_Ticket_Selector::ticket_selector_form_close();
450 450
 			} else if (
451 451
 				is_archive()
452 452
 				&& EED_Ticket_Selector::$_max_atndz === 1
453 453
 			) {
454 454
 				// event list, no tickets available so display event's "View Details" button,
455 455
 				// but this is a "Dude Where's my Ticket Selector?" (DWMTS) type event
456
-				$html = EED_Ticket_Selector::display_view_details_btn( true );
457
-			} else if ( is_archive() ) {
456
+				$html = EED_Ticket_Selector::display_view_details_btn(true);
457
+			} else if (is_archive()) {
458 458
 				// event list, no tickets available so display event's "View Details" button
459 459
 				$html = \EED_Ticket_Selector::ticket_selector_form_close();
460 460
 				$html .= EED_Ticket_Selector::display_view_details_btn();
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 				$html = apply_filters(
470 470
 					'FHEE__EE_Ticket_Selector__no_ticket_selector_submit',
471 471
 					sprintf(
472
-						__( '%1$s"%2$s" is currently sold out.%4$sPlease check back again later, as spots may become available.%3$s', 'event_espresso' ),
472
+						__('%1$s"%2$s" is currently sold out.%4$sPlease check back again later, as spots may become available.%3$s', 'event_espresso'),
473 473
 						'<p class="no-ticket-selector-msg clear-float">',
474 474
 						EED_Ticket_Selector::$_event->name(),
475 475
 						'</p>',
@@ -480,12 +480,12 @@  discard block
 block discarded – undo
480 480
 				// sold out DWMTS event, no TS, no submit or view details button, but has additional content
481 481
 				$html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
482 482
 				$html .= \EED_Ticket_Selector::ticket_selector_form_close();
483
-			} else if ( apply_filters( 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', false ) ) {
483
+			} else if (apply_filters('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', false)) {
484 484
 				// NOT a DWMTS event, TS displayed, BUT no tickets are available, so NO submit button
485
-                $html = \EED_Ticket_Selector::clear_tkt_slctr() . \EED_Ticket_Selector::ticket_selector_form_close();
485
+                $html = \EED_Ticket_Selector::clear_tkt_slctr().\EED_Ticket_Selector::ticket_selector_form_close();
486 486
 			} else {
487 487
 				// DWMTS event, no TS, no submit or view details button, and no additional content
488
-                $html = \EED_Ticket_Selector::no_tkt_slctr_end_dv() . \EED_Ticket_Selector::ticket_selector_form_close();
488
+                $html = \EED_Ticket_Selector::no_tkt_slctr_end_dv().\EED_Ticket_Selector::ticket_selector_form_close();
489 489
 			}
490 490
             if ( ! is_archive()) {
491 491
                 $html .= \EEH_Template::powered_by_event_espresso();
@@ -550,19 +550,19 @@  discard block
 block discarded – undo
550 550
 	 * @return string
551 551
 	 * @throws \EE_Error
552 552
 	 */
553
-	public static function display_view_details_btn( $DWMTS = false) {
554
-		if ( ! self::$_event->get_permalink() ) {
555
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
553
+	public static function display_view_details_btn($DWMTS = false) {
554
+		if ( ! self::$_event->get_permalink()) {
555
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
556 556
 		}
557
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
557
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
558 558
 		$btn_text = apply_filters(
559 559
 			'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
560
-			__( 'View Details', 'event_espresso' ),
560
+			__('View Details', 'event_espresso'),
561 561
 			self::$_event
562 562
 		);
563
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
564
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
565
-		if ( $DWMTS ) {
563
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
564
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
565
+		if ($DWMTS) {
566 566
 			$view_details_btn .= \EED_Ticket_Selector::ticket_selector_form_close();
567 567
 			$view_details_btn .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
568 568
 			$view_details_btn .= '<br/>';
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
 	 * 	@return array|boolean
587 587
 	 */
588 588
 	public function process_ticket_selections() {
589
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
589
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
590 590
 		// do we have an event id?
591
-		if ( ! EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
591
+		if ( ! EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
592 592
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
593 593
 			EE_Error::add_error(
594 594
 				sprintf(
@@ -604,17 +604,17 @@  discard block
 block discarded – undo
604 604
 			);
605 605
 		}
606 606
 		//if event id is valid
607
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ) );
607
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
608 608
 		// check nonce
609 609
 		if (
610 610
 			! is_admin()
611 611
 			&& (
612
-				! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce_' . $id )
613
-				|| ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce_' . $id ), 'process_ticket_selections' )
612
+				! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce_'.$id)
613
+				|| ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce_'.$id), 'process_ticket_selections')
614 614
 			)
615 615
 		) {
616 616
 			EE_Error::add_error(
617
-				sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
617
+				sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
618 618
 				__FILE__, __FUNCTION__, __LINE__
619 619
 			);
620 620
 			return FALSE;
@@ -628,16 +628,16 @@  discard block
 block discarded – undo
628 628
 
629 629
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
630 630
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
631
-		EE_Registry::instance()->load_core( 'Session' );
631
+		EE_Registry::instance()->load_core('Session');
632 632
 		// unless otherwise requested, clear the session
633
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
634
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
633
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
634
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
635 635
 		}
636 636
 		//d( EE_Registry::instance()->SSN );
637 637
 
638
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
638
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
639 639
 		// validate/sanitize data
640
-		$valid = self::_validate_post_data( $id );
640
+		$valid = self::_validate_post_data($id);
641 641
 
642 642
 		//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
643 643
 		//EEH_Debug_Tools::printr( $valid, '$valid', __FILE__, __LINE__ );
@@ -645,41 +645,41 @@  discard block
 block discarded – undo
645 645
 		//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
646 646
 
647 647
 		//check total tickets ordered vs max number of attendees that can register
648
-		if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
648
+		if ($valid['total_tickets'] > $valid['max_atndz']) {
649 649
 
650 650
 			// ordering too many tickets !!!
651 651
 			$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
652
-			$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
652
+			$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
653 653
 			// dev only message
654 654
 			$max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso');
655
-			$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
656
-			EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
655
+			$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
656
+			EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
657 657
 		} else {
658 658
 
659 659
 			// all data appears to be valid
660 660
 			$tckts_slctd = FALSE;
661 661
 			$success = TRUE;
662 662
 			// load cart
663
-			EE_Registry::instance()->load_core( 'Cart' );
663
+			EE_Registry::instance()->load_core('Cart');
664 664
 
665 665
 			// cycle thru the number of data rows sent from the event listing
666
-			for ( $x = 0; $x < $valid['rows']; $x++ ) {
666
+			for ($x = 0; $x < $valid['rows']; $x++) {
667 667
 				// does this row actually contain a ticket quantity?
668
-				if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
668
+				if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
669 669
 					// YES we have a ticket quantity
670 670
 					$tckts_slctd = TRUE;
671 671
 					//						d( $valid['ticket_obj'][$x] );
672
-					if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
672
+					if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
673 673
 						// then add ticket to cart
674
-						$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
674
+						$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
675 675
 						$success = ! $ticket_added ? FALSE : $success;
676
-						if ( EE_Error::has_error() ) {
676
+						if (EE_Error::has_error()) {
677 677
 							break;
678 678
 						}
679 679
 					} else {
680 680
 						// nothing added to cart retrieved
681 681
 						EE_Error::add_error(
682
-							sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
682
+							sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
683 683
 							__FILE__, __FUNCTION__, __LINE__
684 684
 						);
685 685
 					}
@@ -688,45 +688,45 @@  discard block
 block discarded – undo
688 688
 			//d( EE_Registry::instance()->CART );
689 689
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
690 690
 
691
-			if ( $tckts_slctd ) {
692
-				if ( $success ) {
693
-					do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
691
+			if ($tckts_slctd) {
692
+				if ($success) {
693
+					do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
694 694
 					EE_Registry::instance()->CART->recalculate_all_cart_totals();
695
-					EE_Registry::instance()->CART->save_cart( FALSE );
695
+					EE_Registry::instance()->CART->save_cart(FALSE);
696 696
 					EE_Registry::instance()->SSN->update();
697 697
 					//d( EE_Registry::instance()->CART );
698 698
 					//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
699 699
 					// just return TRUE for registrations being made from admin
700
-					if ( is_admin() ) {
700
+					if (is_admin()) {
701 701
 						return TRUE;
702 702
 					}
703
-					wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
703
+					wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
704 704
 					exit();
705 705
 
706 706
 				} else {
707
-					if ( ! EE_Error::has_error() ) {
707
+					if ( ! EE_Error::has_error()) {
708 708
 						// nothing added to cart
709
-						EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
709
+						EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
710 710
 					}
711 711
 				}
712 712
 
713 713
 			} else {
714 714
 				// no ticket quantities were selected
715
-				EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
715
+				EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
716 716
 			}
717 717
 		}
718 718
 		//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
719 719
 		// at this point, just return if registration is being made from admin
720
-		if ( is_admin() ) {
720
+		if (is_admin()) {
721 721
 			return FALSE;
722 722
 		}
723
-		if ( $valid['return_url'] ) {
724
-			EE_Error::get_notices( FALSE, TRUE );
725
-			wp_safe_redirect( $valid['return_url'] );
723
+		if ($valid['return_url']) {
724
+			EE_Error::get_notices(FALSE, TRUE);
725
+			wp_safe_redirect($valid['return_url']);
726 726
 			exit();
727
-		} elseif ( isset( $event_to_add['id'] )) {
728
-			EE_Error::get_notices( FALSE, TRUE );
729
-			wp_safe_redirect( get_permalink( $event_to_add['id'] ));
727
+		} elseif (isset($event_to_add['id'])) {
728
+			EE_Error::get_notices(FALSE, TRUE);
729
+			wp_safe_redirect(get_permalink($event_to_add['id']));
730 730
 			exit();
731 731
 		} else {
732 732
 			echo EE_Error::get_notices();
@@ -746,13 +746,13 @@  discard block
 block discarded – undo
746 746
 	 * @param int $id
747 747
 	 * @return array|FALSE
748 748
 	 */
749
-	private static function _validate_post_data( $id = 0 ) {
750
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
749
+	private static function _validate_post_data($id = 0) {
750
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
751 751
 
752 752
 		//		d( $_POST );
753
-		if ( ! $id ) {
753
+		if ( ! $id) {
754 754
 			EE_Error::add_error(
755
-				__( 'The event id provided was not valid.', 'event_espresso' ),
755
+				__('The event id provided was not valid.', 'event_espresso'),
756 756
 				__FILE__,
757 757
 				__FUNCTION__,
758 758
 				__LINE__
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 		// grab valid id
765 765
 		$valid_data['id'] = $id;
766 766
 		// grab and sanitize return-url
767
-		$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
767
+		$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
768 768
 		// array of other form names
769 769
 		$inputs_to_clean = array(
770 770
 			'event_id' => 'tkt-slctr-event-id',
@@ -777,22 +777,22 @@  discard block
 block discarded – undo
777 777
 		// let's track the total number of tickets ordered.'
778 778
 		$valid_data['total_tickets'] = 0;
779 779
 		// cycle through $inputs_to_clean array
780
-		foreach ( $inputs_to_clean as $what => $input_to_clean ) {
780
+		foreach ($inputs_to_clean as $what => $input_to_clean) {
781 781
 			// check for POST data
782
-			if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
782
+			if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
783 783
 				// grab value
784
-				$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
784
+				$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
785 785
 				switch ($what) {
786 786
 
787 787
 					// integers
788 788
 					case 'event_id':
789
-						$valid_data[$what] = absint( $input_value );
789
+						$valid_data[$what] = absint($input_value);
790 790
 						// get event via the event id we put in the form
791
-						$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
791
+						$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
792 792
 						break;
793 793
 					case 'rows':
794 794
 					case 'max_atndz':
795
-						$valid_data[$what] = absint( $input_value );
795
+						$valid_data[$what] = absint($input_value);
796 796
 						break;
797 797
 
798 798
 					// arrays of integers
@@ -800,27 +800,27 @@  discard block
 block discarded – undo
800 800
 						/** @var array $row_qty */
801 801
 						$row_qty = $input_value;
802 802
 						// if qty is coming from a radio button input, then we need to assemble an array of rows
803
-						if( ! is_array( $row_qty )) {
803
+						if ( ! is_array($row_qty)) {
804 804
 							// get number of rows
805
-							$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
805
+							$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
806 806
 							//								d( $rows );
807 807
 							// explode ints by the dash
808
-							$row_qty = explode( '-', $row_qty );
809
-							$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
810
-							$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
811
-							$row_qty = array( $row => $qty );
808
+							$row_qty = explode('-', $row_qty);
809
+							$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
810
+							$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
811
+							$row_qty = array($row => $qty);
812 812
 							//								 d( $row_qty );
813
-							for( $x = 1; $x <= $rows; $x++ ) {
814
-								if ( ! isset( $row_qty[$x] )) {
813
+							for ($x = 1; $x <= $rows; $x++) {
814
+								if ( ! isset($row_qty[$x])) {
815 815
 									$row_qty[$x] = 0;
816 816
 								}
817 817
 							}
818 818
 						}
819
-						ksort( $row_qty );
819
+						ksort($row_qty);
820 820
 						//							 d( $row_qty );
821 821
 						// cycle thru values
822
-						foreach ( $row_qty as $qty ) {
823
-							$qty = absint( $qty );
822
+						foreach ($row_qty as $qty) {
823
+							$qty = absint($qty);
824 824
 							// sanitize as integers
825 825
 							$valid_data[$what][] = $qty;
826 826
 							$valid_data['total_tickets'] += $qty;
@@ -831,19 +831,19 @@  discard block
 block discarded – undo
831 831
 					case 'ticket_id':
832 832
 						$value_array = array();
833 833
 						// cycle thru values
834
-						foreach ( (array) $input_value as $key => $value ) {
834
+						foreach ((array) $input_value as $key => $value) {
835 835
 							// allow only numbers, letters,  spaces, commas and dashes
836
-							$value_array[ $key ] = wp_strip_all_tags( $value );
836
+							$value_array[$key] = wp_strip_all_tags($value);
837 837
 							// get ticket via the ticket id we put in the form
838
-							$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
839
-							$valid_data['ticket_obj'][ $key ] = $ticket_obj;
838
+							$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
839
+							$valid_data['ticket_obj'][$key] = $ticket_obj;
840 840
 						}
841
-						$valid_data[ $what ] = $value_array;
841
+						$valid_data[$what] = $value_array;
842 842
 						break;
843 843
 
844 844
 					case 'return_url' :
845 845
 						// grab and sanitize return-url
846
-						$valid_data[$what] = esc_url_raw( $input_value );
846
+						$valid_data[$what] = esc_url_raw($input_value);
847 847
 						break;
848 848
 
849 849
 				} 	// end switch $what
@@ -866,28 +866,28 @@  discard block
 block discarded – undo
866 866
 	 * @return TRUE on success, FALSE on fail
867 867
 	 * @throws \EE_Error
868 868
 	 */
869
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
870
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
869
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
870
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
871 871
 		// get the number of spaces left for this datetime ticket
872
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
872
+		$available_spaces = self::_ticket_datetime_availability($ticket);
873 873
 		// compare available spaces against the number of tickets being purchased
874
-		if ( $available_spaces >= $qty ) {
874
+		if ($available_spaces >= $qty) {
875 875
 			// allow addons to prevent a ticket from being added to cart
876
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
876
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
877 877
 				return false;
878 878
 			}
879 879
 			// add event to cart
880
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
881
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
880
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
881
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
882 882
 				return true;
883 883
 			} else {
884 884
 				return false;
885 885
 			}
886 886
 		} else {
887 887
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
888
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
888
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
889 889
 			// greedy greedy greedy eh?
890
-			if ( $available_spaces > 0 ) {
890
+			if ($available_spaces > 0) {
891 891
 				// add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
892 892
 				EE_Error::add_error(
893 893
 					sprintf(
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 					__FILE__, __FUNCTION__, __LINE__
904 904
 				);
905 905
 			} else {
906
-				EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
906
+				EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
907 907
 			}
908 908
 			return false;
909 909
 		}
@@ -922,22 +922,22 @@  discard block
 block discarded – undo
922 922
 	 * @return int
923 923
 	 * @throws \EE_Error
924 924
 	 */
925
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
925
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
926 926
 		// if the $_available_spaces array has not been set up yet...
927
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
928
-				self::_set_initial_ticket_datetime_availability( $ticket );
927
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
928
+				self::_set_initial_ticket_datetime_availability($ticket);
929 929
 		}
930 930
 		$available_spaces = $ticket->qty() - $ticket->sold();
931
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
931
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
932 932
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
933
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
933
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
934 934
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
935
-				if ( $get_original_ticket_spaces ) {
935
+				if ($get_original_ticket_spaces) {
936 936
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
937
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
937
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
938 938
 				} else {
939 939
 					// we want the updated ticket availability as stored in the "datetimes" array
940
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
940
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
941 941
 				}
942 942
 			}
943 943
 		}
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 	 * @return void
955 955
 	 * @throws \EE_Error
956 956
 	 */
957
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
957
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
958 958
 		// first, get all of the datetimes that are available to this ticket
959 959
 		$datetimes = $ticket->get_many_related(
960 960
 			'Datetime',
@@ -962,23 +962,23 @@  discard block
 block discarded – undo
962 962
 				array(
963 963
 					'DTT_EVT_end' => array(
964 964
 						'>=',
965
-						EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ),
965
+						EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'),
966 966
 					),
967 967
 				),
968
-				'order_by' => array( 'DTT_EVT_start' => 'ASC' ),
968
+				'order_by' => array('DTT_EVT_start' => 'ASC'),
969 969
 			)
970 970
 		);
971
-		if ( ! empty( $datetimes )) {
971
+		if ( ! empty($datetimes)) {
972 972
 			// now loop thru all of the datetimes
973
-			foreach ( $datetimes as $datetime  ) {
974
-				if ( $datetime instanceof EE_Datetime ) {
973
+			foreach ($datetimes as $datetime) {
974
+				if ($datetime instanceof EE_Datetime) {
975 975
 					// the number of spaces available for the datetime without considering individual ticket quantities
976 976
 					$spaces_remaining = $datetime->spaces_remaining();
977 977
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
978
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
978
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
979 979
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
980 980
 					// else just take the datetime spaces remaining, and assign to the datetimes array
981
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
981
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
982 982
 				}
983 983
 			}
984 984
 		}
@@ -994,12 +994,12 @@  discard block
 block discarded – undo
994 994
 	 * @param 	int   $qty
995 995
 	 * @return 	void
996 996
 	 */
997
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
998
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
997
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
998
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
999 999
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
1000
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
1000
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
1001 1001
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
1002
-				self::$_available_spaces['datetimes'][ $DTD_ID ] -= $qty;
1002
+				self::$_available_spaces['datetimes'][$DTD_ID] -= $qty;
1003 1003
 			}
1004 1004
 		}
1005 1005
 	}
@@ -1016,8 +1016,8 @@  discard block
 block discarded – undo
1016 1016
 	*/
1017 1017
 	public static function load_tckt_slctr_assets() {
1018 1018
 		// add some style
1019
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
1020
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
1019
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
1020
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
1021 1021
 			wp_enqueue_style('ticket_selector');
1022 1022
 			// make it dance
1023 1023
 			// wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -1031,9 +1031,9 @@  discard block
 block discarded – undo
1031 1031
 
1032 1032
 	public static function load_tckt_slctr_assets_admin() {
1033 1033
 		//iframe button js on admin event editor page
1034
-		if ( EE_Registry::instance()->REQ->get('page') === 'espresso_events' && EE_Registry::instance()->REQ->get('action') === 'edit' ) {
1035
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
1036
-			wp_enqueue_script( 'ticket_selector_embed' );
1034
+		if (EE_Registry::instance()->REQ->get('page') === 'espresso_events' && EE_Registry::instance()->REQ->get('action') === 'edit') {
1035
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1036
+			wp_enqueue_script('ticket_selector_embed');
1037 1037
 		}
1038 1038
 	}
1039 1039
 
Please login to merge, or discard this patch.
modules/bot_trap/EED_Bot_Trap.module.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @return EED_Bot_Trap
19 19
 	 */
20 20
 	public static function instance() {
21
-		return parent::get_instance( __CLASS__ );
21
+		return parent::get_instance(__CLASS__);
22 22
 	}
23 23
 
24 24
 
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public static function set_hooks() {
33 33
         if (
34
-			apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) &&
34
+			apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
35 35
 			\EE_Registry::instance()->CFG->registration->use_bot_trap
36 36
 		) {
37 37
             \EED_Bot_Trap::set_trap();
38 38
 			// redirect bots to bogus success page
39
-			\EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' );
39
+			\EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success');
40 40
 		}
41 41
 	}
42 42
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 *  @return 	void
50 50
 	 */
51 51
 	public static function set_trap() {
52
-        define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
52
+        define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS);
53 53
         add_action(
54 54
             'AHEE__ticket_selector_chart__template__after_ticket_selector',
55 55
             array('EED_Bot_Trap', 'generate_bot_trap'),
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
         }
82 82
         add_action(
83 83
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
84
-			array( 'EED_Bot_Trap', 'bot_trap_settings_form' ),
84
+			array('EED_Bot_Trap', 'bot_trap_settings_form'),
85 85
 			10
86 86
 		);
87 87
 		add_filter(
88 88
 			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
89
-			array( 'EED_Bot_Trap', 'update_bot_trap_settings_form' ),
89
+			array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
90 90
 			10, 1
91 91
 		);
92 92
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @param    WP $WP
101 101
 	 * @return    void
102 102
 	 */
103
-	public function run( $WP ) {}
103
+	public function run($WP) {}
104 104
 
105 105
 
106 106
 
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
 	 * @return    void
112 112
 	 */
113 113
 	public static function generate_bot_trap() {
114
-		$do_not_enter = esc_html__( 'please do not enter anything in this input', 'event_espresso' );
114
+		$do_not_enter = esc_html__('please do not enter anything in this input', 'event_espresso');
115 115
 		$time = microtime(true);
116 116
 		$html = '<div class="tkt-slctr-request-processor-dv" style="float:left; margin:0 0 0 -999em; height: 0;">';
117
-		$html .= '<label for="tkt-slctr-request-processor-email-' . $time . '">' . $do_not_enter  . '</label>';
118
-		$html .= '<input type="email" id="tkt-slctr-request-processor-email-' . $time  .'" name="tkt-slctr-request-processor-email" value=""/>';
117
+		$html .= '<label for="tkt-slctr-request-processor-email-'.$time.'">'.$do_not_enter.'</label>';
118
+		$html .= '<input type="email" id="tkt-slctr-request-processor-email-'.$time.'" name="tkt-slctr-request-processor-email" value=""/>';
119 119
 		$html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="';
120
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
121
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
122
-			$html .= EE_Encryption::instance()->encrypt( $time );
120
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
121
+			EE_Registry::instance()->load_core('EE_Encryption');
122
+			$html .= EE_Encryption::instance()->encrypt($time);
123 123
 		} else {
124 124
 			$html .= $time;
125 125
 		}
@@ -137,38 +137,38 @@  discard block
 block discarded – undo
137 137
      *                                              It should receive one argument: a boolean indicating
138 138
      *                                              whether the trap was triggered by suspicious timing or not.
139 139
 	 */
140
-	public static function process_bot_trap( $triggered_trap_callback = array() ) {
140
+	public static function process_bot_trap($triggered_trap_callback = array()) {
141 141
         // what's your email address Mr. Bot ?
142
-		$empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] )
143
-                      && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === ''
142
+		$empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email'])
143
+                      && $_REQUEST['tkt-slctr-request-processor-email'] === ''
144 144
             ? true
145 145
             : false;
146 146
 		// get encrypted timestamp for when the form was originally displayed
147
-		$bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] )
148
-            ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] )
147
+		$bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token'])
148
+            ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token'])
149 149
             : '';
150 150
 		// decrypt and convert to absolute  integer
151
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
152
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
153
-			$bot_trap_timestamp = absint( EE_Encryption::instance()->decrypt( $bot_trap_timestamp ) );
151
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
152
+			EE_Registry::instance()->load_core('EE_Encryption');
153
+			$bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp));
154 154
 		} else {
155
-			$bot_trap_timestamp = absint( $bot_trap_timestamp );
155
+			$bot_trap_timestamp = absint($bot_trap_timestamp);
156 156
 		}
157 157
 		// ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
158
-		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS )
158
+		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS)
159 159
             ? true
160 160
             : false;
161 161
 		// are we human ?
162
-		if ( $empty_trap && ! $suspicious_timing ) {
162
+		if ($empty_trap && ! $suspicious_timing) {
163 163
 		    do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered');
164 164
 			return;
165 165
 		}
166 166
 		// check the given callback is valid first before executing
167
-		if ( ! is_callable($triggered_trap_callback ) ) {
167
+		if ( ! is_callable($triggered_trap_callback)) {
168 168
 			// invalid callback so lets just sub in our default.
169
-            $triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' );
169
+            $triggered_trap_callback = array('EED_Bot_Trap', 'triggered_trap_response');
170 170
 		}
171
-		call_user_func_array($triggered_trap_callback, array( $suspicious_timing ) );
171
+		call_user_func_array($triggered_trap_callback, array($suspicious_timing));
172 172
 	}
173 173
 
174 174
 
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @param bool  $suspicious_timing  If true, then the bot trap was triggered due to the suspicious timing test.
181 181
 	 */
182
-	public static function triggered_trap_response( $suspicious_timing ) {
182
+	public static function triggered_trap_response($suspicious_timing) {
183 183
 		// UH OH...
184 184
 		$redirect_url = add_query_arg(
185
-			array( 'ee' => 'ticket_selection_received' ),
185
+			array('ee' => 'ticket_selection_received'),
186 186
 			EE_Registry::instance()->CFG->core->reg_page_url()
187 187
 		);
188
-		if ( $suspicious_timing ) {
188
+		if ($suspicious_timing) {
189 189
 			$redirect_url = add_query_arg(
190
-				array( 'ee-notice' => urlencode( esc_html__( 'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso' ) ) ),
190
+				array('ee-notice' => urlencode(esc_html__('We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso'))),
191 191
 				$redirect_url
192 192
 			);
193 193
 		}
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	 * @return    void
219 219
 	 */
220 220
 	public static function display_bot_trap_success() {
221
-		add_filter( 'FHEE__EED_Single_Page_Checkout__run', '__return_false' );
222
-		$bot_notice = esc_html__( 'Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso' );
223
-		$bot_notice = isset( $_REQUEST[ 'ee-notice' ] ) && $_REQUEST[ 'ee-notice' ] !== '' ? sanitize_text_field( stripslashes( $_REQUEST[ 'ee-notice' ] ) ) : $bot_notice;
224
-		EE_Registry::instance()->REQ->add_output( EEH_HTML::div( $bot_notice, '', 'ee-attention' ) );
221
+		add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
222
+		$bot_notice = esc_html__('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso');
223
+		$bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice;
224
+		EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
225 225
 	}
226 226
 
227 227
 
@@ -256,20 +256,20 @@  discard block
 block discarded – undo
256 256
 				'html_id'         			=> 'bot_trap_settings',
257 257
 				'layout_strategy' 	=> new EE_Admin_Two_Column_Layout(),
258 258
 				'subsections'     		=> array(
259
-					'bot_trap_hdr' 		=> new EE_Form_Section_HTML( EEH_HTML::h2( esc_html__( 'Bot Trap Settings', 'event_espresso' ) ) ),
259
+					'bot_trap_hdr' 		=> new EE_Form_Section_HTML(EEH_HTML::h2(esc_html__('Bot Trap Settings', 'event_espresso'))),
260 260
 					'use_bot_trap' 		=> new EE_Yes_No_Input(
261 261
 						array(
262
-							'html_label_text' 	=> esc_html__( 'Enable Bot Trap', 'event_espresso' ),
263
-							'html_help_text' 		=>  esc_html__( 'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso' ),
264
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_bot_trap ) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
262
+							'html_label_text' 	=> esc_html__('Enable Bot Trap', 'event_espresso'),
263
+							'html_help_text' 		=>  esc_html__('The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso'),
264
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_bot_trap) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
265 265
 							'required'        		=> false
266 266
 						)
267 267
 					),
268 268
 					'use_encryption' 		=> new EE_Yes_No_Input(
269 269
 						array(
270
-							'html_label_text' 	=> esc_html__( 'Encrypt Bot Trap Data', 'event_espresso' ),
271
-							'html_help_text' 		=>  esc_html__( 'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso' ),
272
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_encryption ) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
270
+							'html_label_text' 	=> esc_html__('Encrypt Bot Trap Data', 'event_espresso'),
271
+							'html_help_text' 		=>  esc_html__('One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso'),
272
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_encryption) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
273 273
 							'required'        		=> false
274 274
 						)
275 275
 					),
@@ -287,30 +287,30 @@  discard block
 block discarded – undo
287 287
 	 * @param \EE_Registration_Config $EE_Registration_Config
288 288
 	 * @return \EE_Registration_Config
289 289
 	 */
290
-	public static function update_bot_trap_settings_form( EE_Registration_Config $EE_Registration_Config ) {
290
+	public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config) {
291 291
 		try {
292 292
 			$bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
293 293
 			// if not displaying a form, then check for form submission
294
-			if ( $bot_trap_settings_form->was_submitted() ) {
294
+			if ($bot_trap_settings_form->was_submitted()) {
295 295
 				// capture form data
296 296
 				$bot_trap_settings_form->receive_form_submission();
297 297
 				// validate form data
298
-				if ( $bot_trap_settings_form->is_valid() ) {
298
+				if ($bot_trap_settings_form->is_valid()) {
299 299
 					// grab validated data from form
300 300
 					$valid_data = $bot_trap_settings_form->valid_data();
301
-					if ( isset( $valid_data[ 'use_bot_trap' ], $valid_data[ 'use_encryption' ] ) ) {
302
-						$EE_Registration_Config->use_bot_trap = $valid_data[ 'use_bot_trap' ];
303
-						$EE_Registration_Config->use_encryption = $valid_data[ 'use_encryption' ];
301
+					if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
302
+						$EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
303
+						$EE_Registration_Config->use_encryption = $valid_data['use_encryption'];
304 304
 					} else {
305
-						EE_Error::add_error( esc_html__( 'Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
305
+						EE_Error::add_error(esc_html__('Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
306 306
 					}
307 307
 				} else {
308
-					if ( $bot_trap_settings_form->submission_error_message() != '' ) {
309
-						EE_Error::add_error( $bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
308
+					if ($bot_trap_settings_form->submission_error_message() != '') {
309
+						EE_Error::add_error($bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
310 310
 					}
311 311
 				}
312 312
 			}
313
-		} catch ( EE_Error $e ) {
313
+		} catch (EE_Error $e) {
314 314
 			$e->get_error();
315 315
 		}
316 316
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.