Completed
Branch FET-9856-direct-instantiation (c003ac)
by
unknown
37:36 queued 20:39
created
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   +26 added lines, -26 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>'
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 * @throws \EE_Error
420 420
 	 */
421 421
 	public static function display_ticket_selector_submit() {
422
-        $html = '';
422
+		$html = '';
423 423
 		if ( ! is_admin() ) {
424 424
 			// standard TS displayed with submit button, ie: "Register Now"
425 425
 			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
@@ -478,14 +478,14 @@  discard block
 block discarded – undo
478 478
 				$html .= EED_Ticket_Selector::display_view_details_btn();
479 479
 			} else {
480 480
 				// no submit or view details button, and no additional content
481
-                $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
481
+				$html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
482 482
 			}
483
-            if ( ! is_archive()) {
484
-	            $html .= \EEH_Template::powered_by_event_espresso();
485
-            }
486
-        }
487
-        return $html;
488
-    }
483
+			if ( ! is_archive()) {
484
+				$html .= \EEH_Template::powered_by_event_espresso();
485
+			}
486
+		}
487
+		return $html;
488
+	}
489 489
 
490 490
 
491 491
 
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	 * 	@return array|boolean
583 583
 	 */
584 584
 	public function process_ticket_selections() {
585
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
585
+		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
586 586
 		// do we have an event id?
587 587
 		if ( ! EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
588 588
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
@@ -1005,11 +1005,11 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 
1007 1007
 	/**
1008
-	* 	load js
1009
-	*
1010
-	* 	@access 		public
1011
-	* 	@return 		void
1012
-	*/
1008
+	 * 	load js
1009
+	 *
1010
+	 * 	@access 		public
1011
+	 * 	@return 		void
1012
+	 */
1013 1013
 	public static function load_tckt_slctr_assets() {
1014 1014
 		// add some style
1015 1015
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.
Spacing   +214 added lines, -214 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,31 +380,31 @@  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
 		}
394 394
 		// if there is no submit button, then don't start building a form
395 395
 		// because the "View Details" button will build its own form
396
-		if ( ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
396
+		if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
397 397
 			return '';
398 398
 		}
399
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
400
-		if ( ! $checkout_url ) {
401
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
399
+		$checkout_url = EEH_Event_View::event_link_url($ID);
400
+		if ( ! $checkout_url) {
401
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
402 402
 		}
403 403
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
404
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
405
-		$html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce_' . $ID, TRUE, FALSE );
404
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
405
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce_'.$ID, TRUE, FALSE);
406 406
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
407
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
407
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
408 408
 		return $html;
409 409
 	}
410 410
 
@@ -420,26 +420,26 @@  discard block
 block discarded – undo
420 420
 	 */
421 421
 	public static function display_ticket_selector_submit() {
422 422
         $html = '';
423
-		if ( ! is_admin() ) {
423
+		if ( ! is_admin()) {
424 424
 			// standard TS displayed with submit button, ie: "Register Now"
425
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
425
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
426 426
 				$btn_text = apply_filters(
427 427
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
428
-					__('Register Now', 'event_espresso' ),
428
+					__('Register Now', 'event_espresso'),
429 429
 					EED_Ticket_Selector::$_event
430 430
 				);
431 431
 				$external_url = EED_Ticket_Selector::$_event->external_url();
432
-				$html .= '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"';
432
+				$html .= '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"';
433 433
 				$html .= ' class="ticket-selector-submit-btn ';
434
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
435
-				$html .= ' type="submit" value="' . $btn_text . '" />';
434
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
435
+				$html .= ' type="submit" value="'.$btn_text.'" />';
436 436
 				$html .= apply_filters(
437 437
 					'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
438 438
 					'',
439 439
 					EED_Ticket_Selector::$_event
440 440
 				);
441 441
 				$html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
442
-				$html .= '<br/>' . \EED_Ticket_Selector::ticket_selector_form_close();
442
+				$html .= '<br/>'.\EED_Ticket_Selector::ticket_selector_form_close();
443 443
 			} else if (
444 444
 				// a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1)
445 445
 				EED_Ticket_Selector::$_max_atndz === 1
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
 				$html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
466 466
 			} else if (
467 467
 				EED_Ticket_Selector::$_max_atndz === 1
468
-				&& apply_filters( 'FHEE__EE_Ticket_Selector__hide_ticket_selector', false )
468
+				&& apply_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector', false)
469 469
 				&& ! is_single()
470 470
 			) {
471 471
 				// this is a "Dude Where's my Ticket Selector?" (DWMTS) type event,
472 472
 				// but no tickets are available, so display event's "View Details" button.
473 473
 				// it is being viewed via somewhere other than a single post
474
-				$html .= EED_Ticket_Selector::display_view_details_btn( true );
475
-			} else if ( is_archive() ) {
474
+				$html .= EED_Ticket_Selector::display_view_details_btn(true);
475
+			} else if (is_archive()) {
476 476
 				// event list, no tickets available so display event's "View Details" button
477 477
 				$html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
478 478
 				$html .= EED_Ticket_Selector::display_view_details_btn();
@@ -543,22 +543,22 @@  discard block
 block discarded – undo
543 543
 	 * @return string
544 544
 	 * @throws \EE_Error
545 545
 	 */
546
-	public static function display_view_details_btn( $DWMTS = false) {
547
-		if ( ! self::$_event->get_permalink() ) {
546
+	public static function display_view_details_btn($DWMTS = false) {
547
+		if ( ! self::$_event->get_permalink()) {
548 548
 			EE_Error::add_error(
549
-				__('The URL for the Event Details page could not be retrieved.', 'event_espresso' ),
549
+				__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
550 550
 				__FILE__, __FUNCTION__, __LINE__
551 551
 			);
552 552
 		}
553
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
553
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
554 554
 		$btn_text = apply_filters(
555 555
 			'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
556
-			__( 'View Details', 'event_espresso' ),
556
+			__('View Details', 'event_espresso'),
557 557
 			self::$_event
558 558
 		);
559
-		$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 . '" />';
560
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
561
-		if ( $DWMTS ) {
559
+		$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.'" />';
560
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
561
+		if ($DWMTS) {
562 562
 			$view_details_btn .= \EED_Ticket_Selector::ticket_selector_form_close();
563 563
 			$view_details_btn .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
564 564
 			$view_details_btn .= '<br/>';
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
 	 * 	@return array|boolean
583 583
 	 */
584 584
 	public function process_ticket_selections() {
585
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
585
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
586 586
 		// do we have an event id?
587
-		if ( ! EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
587
+		if ( ! EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
588 588
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
589 589
 			EE_Error::add_error(
590 590
 				sprintf(
@@ -600,17 +600,17 @@  discard block
 block discarded – undo
600 600
 			);
601 601
 		}
602 602
 		//if event id is valid
603
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ) );
603
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
604 604
 		// check nonce
605 605
 		if (
606 606
 			! is_admin()
607 607
 			&& (
608
-				! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce_' . $id )
609
-				|| ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce_' . $id ), 'process_ticket_selections' )
608
+				! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce_'.$id)
609
+				|| ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce_'.$id), 'process_ticket_selections')
610 610
 			)
611 611
 		) {
612 612
 			EE_Error::add_error(
613
-				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/>' ),
613
+				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/>'),
614 614
 				__FILE__, __FUNCTION__, __LINE__
615 615
 			);
616 616
 			return FALSE;
@@ -624,16 +624,16 @@  discard block
 block discarded – undo
624 624
 
625 625
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
626 626
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
627
-		EE_Registry::instance()->load_core( 'Session' );
627
+		EE_Registry::instance()->load_core('Session');
628 628
 		// unless otherwise requested, clear the session
629
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
630
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
629
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
630
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
631 631
 		}
632 632
 		//d( EE_Registry::instance()->SSN );
633 633
 
634
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
634
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
635 635
 		// validate/sanitize data
636
-		$valid = self::_validate_post_data( $id );
636
+		$valid = self::_validate_post_data($id);
637 637
 
638 638
 		//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
639 639
 		//EEH_Debug_Tools::printr( $valid, '$valid', __FILE__, __LINE__ );
@@ -641,41 +641,41 @@  discard block
 block discarded – undo
641 641
 		//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
642 642
 
643 643
 		//check total tickets ordered vs max number of attendees that can register
644
-		if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
644
+		if ($valid['total_tickets'] > $valid['max_atndz']) {
645 645
 
646 646
 			// ordering too many tickets !!!
647 647
 			$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
648
-			$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
648
+			$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
649 649
 			// dev only message
650 650
 			$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');
651
-			$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
652
-			EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
651
+			$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
652
+			EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
653 653
 		} else {
654 654
 
655 655
 			// all data appears to be valid
656 656
 			$tckts_slctd = FALSE;
657 657
 			$success = TRUE;
658 658
 			// load cart
659
-			EE_Registry::instance()->load_core( 'Cart' );
659
+			EE_Registry::instance()->load_core('Cart');
660 660
 
661 661
 			// cycle thru the number of data rows sent from the event listing
662
-			for ( $x = 0; $x < $valid['rows']; $x++ ) {
662
+			for ($x = 0; $x < $valid['rows']; $x++) {
663 663
 				// does this row actually contain a ticket quantity?
664
-				if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
664
+				if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
665 665
 					// YES we have a ticket quantity
666 666
 					$tckts_slctd = TRUE;
667 667
 					//						d( $valid['ticket_obj'][$x] );
668
-					if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
668
+					if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
669 669
 						// then add ticket to cart
670
-						$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
670
+						$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
671 671
 						$success = ! $ticket_added ? FALSE : $success;
672
-						if ( EE_Error::has_error() ) {
672
+						if (EE_Error::has_error()) {
673 673
 							break;
674 674
 						}
675 675
 					} else {
676 676
 						// nothing added to cart retrieved
677 677
 						EE_Error::add_error(
678
-							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/>' ),
678
+							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/>'),
679 679
 							__FILE__, __FUNCTION__, __LINE__
680 680
 						);
681 681
 					}
@@ -684,45 +684,45 @@  discard block
 block discarded – undo
684 684
 			//d( EE_Registry::instance()->CART );
685 685
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
686 686
 
687
-			if ( $tckts_slctd ) {
688
-				if ( $success ) {
689
-					do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
687
+			if ($tckts_slctd) {
688
+				if ($success) {
689
+					do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
690 690
 					EE_Registry::instance()->CART->recalculate_all_cart_totals();
691
-					EE_Registry::instance()->CART->save_cart( FALSE );
691
+					EE_Registry::instance()->CART->save_cart(FALSE);
692 692
 					EE_Registry::instance()->SSN->update();
693 693
 					//d( EE_Registry::instance()->CART );
694 694
 					//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
695 695
 					// just return TRUE for registrations being made from admin
696
-					if ( is_admin() ) {
696
+					if (is_admin()) {
697 697
 						return TRUE;
698 698
 					}
699
-					wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
699
+					wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
700 700
 					exit();
701 701
 
702 702
 				} else {
703
-					if ( ! EE_Error::has_error() ) {
703
+					if ( ! EE_Error::has_error()) {
704 704
 						// nothing added to cart
705
-						EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
705
+						EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
706 706
 					}
707 707
 				}
708 708
 
709 709
 			} else {
710 710
 				// no ticket quantities were selected
711
-				EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
711
+				EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
712 712
 			}
713 713
 		}
714 714
 		//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
715 715
 		// at this point, just return if registration is being made from admin
716
-		if ( is_admin() ) {
716
+		if (is_admin()) {
717 717
 			return FALSE;
718 718
 		}
719
-		if ( $valid['return_url'] ) {
720
-			EE_Error::get_notices( FALSE, TRUE );
721
-			wp_safe_redirect( $valid['return_url'] );
719
+		if ($valid['return_url']) {
720
+			EE_Error::get_notices(FALSE, TRUE);
721
+			wp_safe_redirect($valid['return_url']);
722 722
 			exit();
723
-		} elseif ( isset( $event_to_add['id'] )) {
724
-			EE_Error::get_notices( FALSE, TRUE );
725
-			wp_safe_redirect( get_permalink( $event_to_add['id'] ));
723
+		} elseif (isset($event_to_add['id'])) {
724
+			EE_Error::get_notices(FALSE, TRUE);
725
+			wp_safe_redirect(get_permalink($event_to_add['id']));
726 726
 			exit();
727 727
 		} else {
728 728
 			echo EE_Error::get_notices();
@@ -742,13 +742,13 @@  discard block
 block discarded – undo
742 742
 	 * @param int $id
743 743
 	 * @return array|FALSE
744 744
 	 */
745
-	private static function _validate_post_data( $id = 0 ) {
746
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
745
+	private static function _validate_post_data($id = 0) {
746
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
747 747
 
748 748
 		//		d( $_POST );
749
-		if ( ! $id ) {
749
+		if ( ! $id) {
750 750
 			EE_Error::add_error(
751
-				__( 'The event id provided was not valid.', 'event_espresso' ),
751
+				__('The event id provided was not valid.', 'event_espresso'),
752 752
 				__FILE__,
753 753
 				__FUNCTION__,
754 754
 				__LINE__
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		// grab valid id
761 761
 		$valid_data['id'] = $id;
762 762
 		// grab and sanitize return-url
763
-		$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
763
+		$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
764 764
 		// array of other form names
765 765
 		$inputs_to_clean = array(
766 766
 			'event_id' => 'tkt-slctr-event-id',
@@ -773,22 +773,22 @@  discard block
 block discarded – undo
773 773
 		// let's track the total number of tickets ordered.'
774 774
 		$valid_data['total_tickets'] = 0;
775 775
 		// cycle through $inputs_to_clean array
776
-		foreach ( $inputs_to_clean as $what => $input_to_clean ) {
776
+		foreach ($inputs_to_clean as $what => $input_to_clean) {
777 777
 			// check for POST data
778
-			if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
778
+			if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
779 779
 				// grab value
780
-				$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
780
+				$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
781 781
 				switch ($what) {
782 782
 
783 783
 					// integers
784 784
 					case 'event_id':
785
-						$valid_data[$what] = absint( $input_value );
785
+						$valid_data[$what] = absint($input_value);
786 786
 						// get event via the event id we put in the form
787
-						$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
787
+						$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
788 788
 						break;
789 789
 					case 'rows':
790 790
 					case 'max_atndz':
791
-						$valid_data[$what] = absint( $input_value );
791
+						$valid_data[$what] = absint($input_value);
792 792
 						break;
793 793
 
794 794
 					// arrays of integers
@@ -796,27 +796,27 @@  discard block
 block discarded – undo
796 796
 						/** @var array $row_qty */
797 797
 						$row_qty = $input_value;
798 798
 						// if qty is coming from a radio button input, then we need to assemble an array of rows
799
-						if( ! is_array( $row_qty )) {
799
+						if ( ! is_array($row_qty)) {
800 800
 							// get number of rows
801
-							$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
801
+							$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
802 802
 							//								d( $rows );
803 803
 							// explode ints by the dash
804
-							$row_qty = explode( '-', $row_qty );
805
-							$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
806
-							$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
807
-							$row_qty = array( $row => $qty );
804
+							$row_qty = explode('-', $row_qty);
805
+							$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
806
+							$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
807
+							$row_qty = array($row => $qty);
808 808
 							//								 d( $row_qty );
809
-							for( $x = 1; $x <= $rows; $x++ ) {
810
-								if ( ! isset( $row_qty[$x] )) {
809
+							for ($x = 1; $x <= $rows; $x++) {
810
+								if ( ! isset($row_qty[$x])) {
811 811
 									$row_qty[$x] = 0;
812 812
 								}
813 813
 							}
814 814
 						}
815
-						ksort( $row_qty );
815
+						ksort($row_qty);
816 816
 						//							 d( $row_qty );
817 817
 						// cycle thru values
818
-						foreach ( $row_qty as $qty ) {
819
-							$qty = absint( $qty );
818
+						foreach ($row_qty as $qty) {
819
+							$qty = absint($qty);
820 820
 							// sanitize as integers
821 821
 							$valid_data[$what][] = $qty;
822 822
 							$valid_data['total_tickets'] += $qty;
@@ -827,19 +827,19 @@  discard block
 block discarded – undo
827 827
 					case 'ticket_id':
828 828
 						$value_array = array();
829 829
 						// cycle thru values
830
-						foreach ( (array) $input_value as $key => $value ) {
830
+						foreach ((array) $input_value as $key => $value) {
831 831
 							// allow only numbers, letters,  spaces, commas and dashes
832
-							$value_array[ $key ] = wp_strip_all_tags( $value );
832
+							$value_array[$key] = wp_strip_all_tags($value);
833 833
 							// get ticket via the ticket id we put in the form
834
-							$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
835
-							$valid_data['ticket_obj'][ $key ] = $ticket_obj;
834
+							$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
835
+							$valid_data['ticket_obj'][$key] = $ticket_obj;
836 836
 						}
837
-						$valid_data[ $what ] = $value_array;
837
+						$valid_data[$what] = $value_array;
838 838
 						break;
839 839
 
840 840
 					case 'return_url' :
841 841
 						// grab and sanitize return-url
842
-						$valid_data[$what] = esc_url_raw( $input_value );
842
+						$valid_data[$what] = esc_url_raw($input_value);
843 843
 						break;
844 844
 
845 845
 				} 	// end switch $what
@@ -862,28 +862,28 @@  discard block
 block discarded – undo
862 862
 	 * @return TRUE on success, FALSE on fail
863 863
 	 * @throws \EE_Error
864 864
 	 */
865
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
866
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
865
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
866
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
867 867
 		// get the number of spaces left for this datetime ticket
868
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
868
+		$available_spaces = self::_ticket_datetime_availability($ticket);
869 869
 		// compare available spaces against the number of tickets being purchased
870
-		if ( $available_spaces >= $qty ) {
870
+		if ($available_spaces >= $qty) {
871 871
 			// allow addons to prevent a ticket from being added to cart
872
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
872
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
873 873
 				return false;
874 874
 			}
875 875
 			// add event to cart
876
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
877
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
876
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
877
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
878 878
 				return true;
879 879
 			} else {
880 880
 				return false;
881 881
 			}
882 882
 		} else {
883 883
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
884
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
884
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
885 885
 			// greedy greedy greedy eh?
886
-			if ( $available_spaces > 0 ) {
886
+			if ($available_spaces > 0) {
887 887
 				// 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
888 888
 				EE_Error::add_error(
889 889
 					sprintf(
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 					__FILE__, __FUNCTION__, __LINE__
900 900
 				);
901 901
 			} else {
902
-				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__ );
902
+				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__);
903 903
 			}
904 904
 			return false;
905 905
 		}
@@ -918,22 +918,22 @@  discard block
 block discarded – undo
918 918
 	 * @return int
919 919
 	 * @throws \EE_Error
920 920
 	 */
921
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
921
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
922 922
 		// if the $_available_spaces array has not been set up yet...
923
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
924
-				self::_set_initial_ticket_datetime_availability( $ticket );
923
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
924
+				self::_set_initial_ticket_datetime_availability($ticket);
925 925
 		}
926 926
 		$available_spaces = $ticket->qty() - $ticket->sold();
927
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
927
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
928 928
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
929
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
929
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
930 930
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
931
-				if ( $get_original_ticket_spaces ) {
931
+				if ($get_original_ticket_spaces) {
932 932
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
933
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
933
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
934 934
 				} else {
935 935
 					// we want the updated ticket availability as stored in the "datetimes" array
936
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
936
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
937 937
 				}
938 938
 			}
939 939
 		}
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 	 * @return void
951 951
 	 * @throws \EE_Error
952 952
 	 */
953
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
953
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
954 954
 		// first, get all of the datetimes that are available to this ticket
955 955
 		$datetimes = $ticket->get_many_related(
956 956
 			'Datetime',
@@ -958,23 +958,23 @@  discard block
 block discarded – undo
958 958
 				array(
959 959
 					'DTT_EVT_end' => array(
960 960
 						'>=',
961
-						EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ),
961
+						EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'),
962 962
 					),
963 963
 				),
964
-				'order_by' => array( 'DTT_EVT_start' => 'ASC' ),
964
+				'order_by' => array('DTT_EVT_start' => 'ASC'),
965 965
 			)
966 966
 		);
967
-		if ( ! empty( $datetimes )) {
967
+		if ( ! empty($datetimes)) {
968 968
 			// now loop thru all of the datetimes
969
-			foreach ( $datetimes as $datetime  ) {
970
-				if ( $datetime instanceof EE_Datetime ) {
969
+			foreach ($datetimes as $datetime) {
970
+				if ($datetime instanceof EE_Datetime) {
971 971
 					// the number of spaces available for the datetime without considering individual ticket quantities
972 972
 					$spaces_remaining = $datetime->spaces_remaining();
973 973
 					// 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
974
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
974
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
975 975
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
976 976
 					// else just take the datetime spaces remaining, and assign to the datetimes array
977
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
977
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
978 978
 				}
979 979
 			}
980 980
 		}
@@ -990,12 +990,12 @@  discard block
 block discarded – undo
990 990
 	 * @param 	int   $qty
991 991
 	 * @return 	void
992 992
 	 */
993
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
994
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
993
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
994
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
995 995
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
996
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
996
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
997 997
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
998
-				self::$_available_spaces['datetimes'][ $DTD_ID ] -= $qty;
998
+				self::$_available_spaces['datetimes'][$DTD_ID] -= $qty;
999 999
 			}
1000 1000
 		}
1001 1001
 	}
@@ -1012,8 +1012,8 @@  discard block
 block discarded – undo
1012 1012
 	*/
1013 1013
 	public static function load_tckt_slctr_assets() {
1014 1014
 		// add some style
1015
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
1016
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
1015
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
1016
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
1017 1017
 			wp_enqueue_style('ticket_selector');
1018 1018
 			// make it dance
1019 1019
 			// wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -1027,9 +1027,9 @@  discard block
 block discarded – undo
1027 1027
 
1028 1028
 	public static function load_tckt_slctr_assets_admin() {
1029 1029
 		//iframe button js on admin event editor page
1030
-		if ( EE_Registry::instance()->REQ->get('page') === 'espresso_events' && EE_Registry::instance()->REQ->get('action') === 'edit' ) {
1031
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
1032
-			wp_enqueue_script( 'ticket_selector_embed' );
1030
+		if (EE_Registry::instance()->REQ->get('page') === 'espresso_events' && EE_Registry::instance()->REQ->get('action') === 'edit') {
1031
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1032
+			wp_enqueue_script('ticket_selector_embed');
1033 1033
 		}
1034 1034
 	}
1035 1035
 
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.
espresso_ticket_selector/EES_Espresso_Ticket_Selector.shortcode.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	 * @access    public
51 51
 	 * @param \WP $WP
52 52
 	 */
53
-	public function run( WP $WP ) {
54
-		add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
53
+	public function run(WP $WP) {
54
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
55 55
 	}
56 56
 
57 57
 
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 	 *  @param		array 	$attributes
63 63
 	 *  @return 	string
64 64
 	 */
65
-	public function process_shortcode( $attributes = array() ) {
66
-		extract( $attributes );
67
-		$event_id = isset( $event_id ) ? $event_id : 0;
68
-		$event = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $event_id );
65
+	public function process_shortcode($attributes = array()) {
66
+		extract($attributes);
67
+		$event_id = isset($event_id) ? $event_id : 0;
68
+		$event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id);
69 69
 		ob_start();
70
-		do_action( 'AHEE_event_details_before_post', $event_id );
71
-		espresso_ticket_selector( $event );
72
-		do_action( 'AHEE_event_details_after_post' );
70
+		do_action('AHEE_event_details_before_post', $event_id);
71
+		espresso_ticket_selector($event);
72
+		do_action('AHEE_event_details_after_post');
73 73
 		return ob_get_clean();
74 74
 	}
75 75
 
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/EEG_Paypal_Pro.gateway.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEG_Paypal_Pro extends EE_Onsite_Gateway{
28
+class EEG_Paypal_Pro extends EE_Onsite_Gateway {
29 29
 	/**
30 30
 	 *
31 31
 	 * @var $_paypal_api_username string
@@ -88,30 +88,30 @@  discard block
 block discarded – undo
88 88
 	 * } @see parent::do_direct_payment for more info
89 89
 	 * @return \EE_Payment|\EEI_Payment
90 90
 	 */
91
-	public function do_direct_payment($payment,$billing_info = null){
91
+	public function do_direct_payment($payment, $billing_info = null) {
92 92
 		$transaction = $payment->transaction();
93 93
 		$primary_registrant = $transaction->primary_registration();
94
-		$order_description  = $this->_format_order_description( $payment );
94
+		$order_description  = $this->_format_order_description($payment);
95 95
 		//charge for the full amount. Show itemized list
96
-		if( $this->_can_easily_itemize_transaction_for( $payment ) ){
96
+		if ($this->_can_easily_itemize_transaction_for($payment)) {
97 97
 			$item_num = 1;
98 98
 			$total_line_item = $transaction->total_line_item();
99 99
 			$order_items = array();
100 100
 			foreach ($total_line_item->get_items() as $line_item) {
101 101
 				//ignore line items with a quantity of 0
102
-				if( $line_item->quantity() == 0 ) {
102
+				if ($line_item->quantity() == 0) {
103 103
 					continue;
104 104
 				}
105 105
 				$item = array(
106 106
 						// Item Name.  127 char max.
107 107
 						'l_name' => substr(
108
-							$this->_format_line_item_name( $line_item, $payment ),
108
+							$this->_format_line_item_name($line_item, $payment),
109 109
 							0,
110 110
 							127
111 111
 						),
112 112
 						// Item description.  127 char max.
113 113
 						'l_desc' => substr( 
114
-							$this->_format_line_item_desc( $line_item, $payment ),
114
+							$this->_format_line_item_desc($line_item, $payment),
115 115
 							0,
116 116
 							127
117 117
 						),
@@ -135,20 +135,20 @@  discard block
 block discarded – undo
135 135
 			}
136 136
 			$item_amount = $total_line_item->get_items_total();
137 137
 			$tax_amount = $total_line_item->get_total_tax();
138
-		}else{
138
+		} else {
139 139
 			$order_items = array();
140 140
 			$item_amount = $payment->amount();
141 141
 			$tax_amount = 0;
142
-			array_push($order_items,array(
142
+			array_push($order_items, array(
143 143
 				// Item Name.  127 char max.
144 144
 				'l_name' => substr(
145
-					$this->_format_partial_payment_line_item_name( $payment ),
145
+					$this->_format_partial_payment_line_item_name($payment),
146 146
 					0,
147 147
 					127
148 148
 				),
149 149
 				// Item description.  127 char max.
150 150
 				'l_desc' => substr( 
151
-					$this->_format_partial_payment_line_item_desc( $payment ),
151
+					$this->_format_partial_payment_line_item_desc($payment),
152 152
 					0,
153 153
 					127
154 154
 				),
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 			// Payer's salutation.  20 char max.
197 197
 			'salutation' => '',
198 198
 			// Payer's first name.  25 char max.
199
-			'firstname' => substr($billing_info['first_name'],0,25),
199
+			'firstname' => substr($billing_info['first_name'], 0, 25),
200 200
 			// Payer's middle name.  25 char max.
201 201
 			'middlename' => '',
202 202
 			// Payer's last name.  25 char max.
203
-			'lastname' => substr($billing_info['last_name'],0,25),
203
+			'lastname' => substr($billing_info['last_name'], 0, 25),
204 204
 			// Payer's suffix.  12 char max.
205 205
 			'suffix' => ''
206 206
 		);
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 			// Required.  Name of City.
214 214
 			'city' => $billing_info['city'],
215 215
 			// Required. Name of State or Province.
216
-			'state' => substr( $billing_info['state'], 0, 40 ),
216
+			'state' => substr($billing_info['state'], 0, 40),
217 217
 			// Required.  Country code.
218 218
 			'countrycode' => $billing_info['country'],
219 219
 			// Required.  Postal code of payer.
220 220
 			'zip' => $billing_info['zip'],
221 221
 			// Phone Number of payer.  20 char max.
222
-			'shiptophonenum' => substr($billing_info['phone'],0,20)
222
+			'shiptophonenum' => substr($billing_info['phone'], 0, 20)
223 223
 		);
224 224
 
225 225
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			// Required.  Three-letter currency code.  Default is USD.
230 230
 			'currencycode' => $payment->currency_code(),
231 231
 			// Required if you include itemized cart details. (L_AMTn, etc.)  Subtotal of items not including S&H, or tax.
232
-			'itemamt' => $this->format_currency($item_amount),//
232
+			'itemamt' => $this->format_currency($item_amount), //
233 233
 			// Total shipping costs for the order.  If you specify shippingamt, you must also specify itemamt.
234 234
 			'shippingamt' => '',
235 235
 			// Total handling costs for the order.  If you specify handlingamt, you must also specify itemamt.
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
 			// Free-form field for your own use.  256 char max.
242 242
 			'custom' => $primary_registrant ? $primary_registrant->ID() : '',
243 243
 			// Your own invoice or tracking number
244
-			'invnum' => wp_generate_password(12,false),//$transaction->ID(),
244
+			'invnum' => wp_generate_password(12, false), //$transaction->ID(),
245 245
 			// URL for receiving Instant Payment Notifications.  This overrides what your profile is set to use.
246 246
 			'notifyurl' => '',
247
-			'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this
247
+			'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this
248 248
 		);
249 249
 		// Wrap all data arrays into a single, "master" array which will be passed into the class function.
250 250
 		$PayPalRequestData = array(
@@ -257,32 +257,32 @@  discard block
 block discarded – undo
257 257
 				'OrderItems' => $order_items,
258 258
 		);
259 259
 		$this->_log_clean_request($PayPalRequestData, $payment);
260
-		try{
260
+		try {
261 261
 			$PayPalResult = $this->prep_and_curl_request($PayPalRequestData);
262 262
 			//remove PCI-sensitive data so it doesn't get stored
263
-			$PayPalResult = $this->_log_clean_response($PayPalResult,$payment);
263
+			$PayPalResult = $this->_log_clean_response($PayPalResult, $payment);
264 264
 
265 265
 			$message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK'];
266
-			if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) {
267
-				$payment->set_status( $this->_pay_model->failed_status() ) ;
268
-				$payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) );
266
+			if (empty($PayPalResult['RAWRESPONSE'])) {
267
+				$payment->set_status($this->_pay_model->failed_status());
268
+				$payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso'));
269 269
 				$payment->set_details($PayPalResult);
270
-			}else{
271
-				if($this->_APICallSuccessful($PayPalResult)){
270
+			} else {
271
+				if ($this->_APICallSuccessful($PayPalResult)) {
272 272
 					$payment->set_status($this->_pay_model->approved_status());
273
-				}else{
273
+				} else {
274 274
 					$payment->set_status($this->_pay_model->declined_status());
275 275
 				}
276 276
 				//make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
277
-				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0);
277
+				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0);
278 278
 				$payment->set_gateway_response($message);
279
-				$payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null);
279
+				$payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null);
280 280
 
281 281
 				$primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : '';
282 282
 				$payment->set_extra_accntng($primary_registration_code);
283 283
 				$payment->set_details($PayPalResult);
284 284
 			}
285
-		}catch(Exception $e){
285
+		} catch (Exception $e) {
286 286
 			$payment->set_status($this->_pay_model->failed_status());
287 287
 			$payment->set_gateway_response($e->getMessage());
288 288
 		}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @param EEI_Payment $payment
300 300
 	 * @return array
301 301
 	 */
302
-	private function _log_clean_request($request,$payment){
302
+	private function _log_clean_request($request, $payment) {
303 303
 		$cleaned_request_data = $request;
304 304
 		unset($cleaned_request_data['CCDetails']['acct']);
305 305
 		unset($cleaned_request_data['CCDetails']['cvv2']);
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 	 * @param EEI_Payment $payment
316 316
 	 * @return array cleaned
317 317
 	 */
318
-	private function _log_clean_response($response,$payment){
318
+	private function _log_clean_response($response, $payment) {
319 319
 		unset($response['REQUESTDATA']['CREDITCARDTYPE']);
320 320
 		unset($response['REQUESTDATA']['ACCT']);
321 321
 		unset($response['REQUESTDATA']['EXPDATE']);
322 322
 		unset($response['REQUESTDATA']['CVV2']);
323 323
 		unset($response['RAWREQUEST']);
324
-		$this->log(array('Paypal Response'=>$response),$payment);
324
+		$this->log(array('Paypal Response'=>$response), $payment);
325 325
 		return $response;
326 326
 	}
327 327
 
@@ -346,32 +346,32 @@  discard block
 block discarded – undo
346 346
 		// DP Fields
347 347
 		$DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array();
348 348
 		foreach ($DPFields as $DPFieldsVar => $DPFieldsVal)
349
-			$DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
349
+			$DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal);
350 350
 
351 351
 		// CC Details Fields
352 352
 		$CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array();
353 353
 		foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal)
354
-			$CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
354
+			$CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal);
355 355
 
356 356
 		// PayerInfo Type Fields
357 357
 		$PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array();
358 358
 		foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal)
359
-			$PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
359
+			$PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal);
360 360
 
361 361
 		// Payer Name Fields
362 362
 		$PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array();
363 363
 		foreach ($PayerName as $PayerNameVar => $PayerNameVal)
364
-			$PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
364
+			$PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal);
365 365
 
366 366
 		// Address Fields (Billing)
367 367
 		$BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array();
368 368
 		foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal)
369
-			$BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
369
+			$BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal);
370 370
 
371 371
 		// Payment Details Type Fields
372 372
 		$PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array();
373 373
 		foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal)
374
-			$PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
374
+			$PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal);
375 375
 
376 376
 		// Payment Details Item Type Fields
377 377
 		$OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array();
@@ -379,22 +379,22 @@  discard block
 block discarded – undo
379 379
 		foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) {
380 380
 			$CurrentItem = $OrderItems[$OrderItemsVar];
381 381
 			foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal)
382
-				$OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
382
+				$OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal);
383 383
 			$n++;
384 384
 		}
385 385
 
386 386
 		// Ship To Address Fields
387 387
 		$ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array();
388 388
 		foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal)
389
-			$ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
389
+			$ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal);
390 390
 
391 391
 		// 3D Secure Fields
392 392
 		$Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array();
393 393
 		foreach ($Secure3D as $Secure3DVar => $Secure3DVal)
394
-			$Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
394
+			$Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal);
395 395
 
396 396
 		// Now that we have each chunk we need to go ahead and append them all together for our entire NVP string
397
-		$NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP;
397
+		$NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP;
398 398
 		$NVPResponse = $this->_CURLRequest($NVPRequest);
399 399
 		$NVPRequestArray = $this->_NVPToArray($NVPRequest);
400 400
 		$NVPResponseArray = $this->_NVPToArray($NVPResponse);
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	private function _CURLRequest($Request) {
419 419
 		$EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
420 420
 		$curl = curl_init();
421
-		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) );
421
+		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE));
422 422
 		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
423 423
 		curl_setopt($curl, CURLOPT_TIMEOUT, 60);
424 424
 		curl_setopt($curl, CURLOPT_URL, $EndPointURL);
@@ -468,9 +468,9 @@  discard block
 block discarded – undo
468 468
 	private function _APICallSuccessful($PayPalResult) {
469 469
 		$approved = false;
470 470
 		// check main response message from PayPal
471
-		if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) {
471
+		if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) {
472 472
 			$ack = strtoupper($PayPalResult['ACK']);
473
-			$approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false;
473
+			$approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false;
474 474
 		}
475 475
 
476 476
 		return $approved;
@@ -486,11 +486,11 @@  discard block
 block discarded – undo
486 486
 
487 487
 		$Errors = array();
488 488
 		$n = 0;
489
-		while (isset($DataArray['L_ERRORCODE' . $n . ''])) {
490
-			$LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : '';
491
-			$LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : '';
492
-			$LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : '';
493
-			$LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : '';
489
+		while (isset($DataArray['L_ERRORCODE'.$n.''])) {
490
+			$LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : '';
491
+			$LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : '';
492
+			$LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : '';
493
+			$LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : '';
494 494
 
495 495
 			$CurrentItem = array(
496 496
 					'L_ERRORCODE' => $LErrorCode,
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 				elseif ($CurrentErrorVar == 'L_SEVERITYCODE')
531 531
 					$CurrentVarName = 'Severity Code';
532 532
 
533
-				$error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal;
533
+				$error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal;
534 534
 			}
535 535
 		}
536 536
 		return $error;
Please login to merge, or discard this patch.