Completed
Branch ENH-9844-update-decaf-rating-l... (cc0077)
by
unknown
117:50 queued 93:16
created
core/data_migration_scripts/EE_DMS_Core_4_3_0.dms.php 2 patches
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.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@
 block discarded – undo
49 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 55
 			return false;//changed mind. dont want people thinking they should migrate yet because they cant
56
-		}else{
56
+		} else{
57 57
 //			echo "$version_string doesnt apply";
58 58
 			return false;
59 59
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_5_0.dms.php 2 patches
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.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@
 block discarded – undo
54 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 60
 			return false;//changed mind. dont want people thinking they should migrate yet because they cant
61
-		}else{
61
+		} else{
62 62
 //			echo "$version_string doesnt apply";
63 63
 			return false;
64 64
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_1_0.dms.php 2 patches
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.
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		$results = $wpdb->get_results("SHOW TABLES LIKE '".$wpdb->prefix."events_attendee_checkin"."'");
83 83
 		if($results){
84 84
 			return true;
85
-		}else{
85
+		} else{
86 86
 			return false;
87 87
 		}
88 88
 	}
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 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 99
 			return false;//changed mind. dont want people thinking they should migrate yet because they cant
100
-		}else{
100
+		} else{
101 101
 //			echo "$version_string doesnt apply";
102 102
 			return false;
103 103
 		}
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 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;
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 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
 		}
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
 		//EE team can read the related discussion: https://app.asana.com/0/2400967562914/9418495544455
1420 1420
 		if($this_thing_required_pre_approval){
1421 1421
 				return 'RNA';
1422
-		}else{
1422
+		} else{
1423 1423
 				$mapping = $default_reg_stati_conversions=array(
1424 1424
 			'Completed'=>'RAP',
1425 1425
 			''=>'RPP',
@@ -1464,7 +1464,7 @@  discard block
 block discarded – undo
1464 1464
 			//double-check we actually have an attachment post
1465 1465
 			if( $attachment_post_id){
1466 1466
 				update_post_meta($new_cpt_id,'_thumbnail_id',$attachment_post_id);
1467
-			}else{
1467
+			} else{
1468 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
 		}
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 		$head_response = wp_remote_head($original_guid);
1486 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
 	}
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 			fwrite($savefile, $contents);
1522 1522
 			fclose($savefile);
1523 1523
 			$guid = str_replace($wp_upload_dir['path'],$wp_upload_dir['url'],$local_filepath);
1524
-		}else{
1524
+		} else{
1525 1525
 			$local_filepath = str_replace($wp_upload_dir['url'],$wp_upload_dir['path'],$guid);
1526 1526
 		}
1527 1527
 
@@ -1587,7 +1587,7 @@  discard block
 block discarded – undo
1587 1587
 		try{
1588 1588
 			$date_obj = new DateTime( $DATETIME_string, new DateTimeZone( $timezone ) );
1589 1589
 			$date_obj->setTimezone(new DateTimeZone('UTC'));
1590
-		}catch(Exception $e){
1590
+		} catch(Exception $e){
1591 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
 		}
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *
43 43
  */
44 44
 
45
-if ( function_exists( 'espresso_version' ) ) {
45
+if (function_exists('espresso_version')) {
46 46
 
47 47
 	/**
48 48
 	 *    espresso_duplicate_plugin_error
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	function espresso_duplicate_plugin_error() {
52 52
 		?>
53 53
 		<div class="error">
54
-			<p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
54
+			<p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
55 55
 		</div>
56 56
 		<?php
57
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
57
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
58 58
 	}
59
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
59
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
60 60
 
61 61
 } else {
62 62
 
@@ -67,103 +67,103 @@  discard block
 block discarded – undo
67 67
 	 * @return string
68 68
 	 */
69 69
 	function espresso_version() {
70
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.13.rc.013' );
70
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.13.rc.013');
71 71
 	}
72 72
 
73 73
 	// define versions
74
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
75
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
76
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
77
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
78
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
79
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
80
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
74
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
75
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
76
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
77
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
78
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
79
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
80
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
81 81
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
82
-	if ( ! defined( 'DS' ) ) {
83
-		define( 'DS', '/' );
82
+	if ( ! defined('DS')) {
83
+		define('DS', '/');
84 84
 	}
85
-	if ( ! defined( 'PS' ) ) {
86
-		define( 'PS', PATH_SEPARATOR );
85
+	if ( ! defined('PS')) {
86
+		define('PS', PATH_SEPARATOR);
87 87
 	}
88
-	if ( ! defined( 'SP' ) ) {
89
-		define( 'SP', ' ' );
88
+	if ( ! defined('SP')) {
89
+		define('SP', ' ');
90 90
 	}
91
-	if ( ! defined( 'EENL' ) ) {
92
-		define( 'EENL', "\n" );
91
+	if ( ! defined('EENL')) {
92
+		define('EENL', "\n");
93 93
 	}
94
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
94
+	define('EE_SUPPORT_EMAIL', '[email protected]');
95 95
 	// define the plugin directory and URL
96
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
98
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
96
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
98
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
99 99
 	// main root folder paths
100
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
101
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
102
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
103
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
104
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
105
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
106
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
107
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
100
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
101
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
102
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
103
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
104
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
105
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
106
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
107
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
108 108
 	// core system paths
109
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
110
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
111
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
112
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
113
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
114
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
115
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
116
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
117
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
118
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
119
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
120
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
109
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
110
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
111
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
112
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
113
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
114
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
115
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
116
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
117
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
118
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
119
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
120
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
121 121
 	// gateways
122
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
123
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
122
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
123
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
124 124
 	// asset URL paths
125
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
126
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
127
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
128
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
129
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
130
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
125
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
126
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
127
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
128
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
129
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
130
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
131 131
 	// define upload paths
132 132
 	$uploads = wp_upload_dir();
133 133
 	// define the uploads directory and URL
134
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
135
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
134
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
135
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
136 136
 	// define the templates directory and URL
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
138
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
137
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
138
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
139 139
 	// define the gateway directory and URL
140
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
141
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
141
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
142 142
 	// languages folder/path
143
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
144
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
143
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
144
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
145 145
 	//check for dompdf fonts in uploads
146
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
147
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
146
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
147
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
148 148
 	}
149 149
 	//ajax constants
150
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
151
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
150
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
151
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
152 152
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
153 153
 	//you're better to use this than its straight value (currently -1) in case you ever
154 154
 	//want to change its default value! or find when -1 means infinity
155
-	define( 'EE_INF_IN_DB', -1 );
156
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
157
-	define( 'EE_DEBUG', false );
155
+	define('EE_INF_IN_DB', -1);
156
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
157
+	define('EE_DEBUG', false);
158 158
 
159 159
 	/**
160 160
 	 *    espresso_plugin_activation
161 161
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
162 162
 	 */
163 163
 	function espresso_plugin_activation() {
164
-		update_option( 'ee_espresso_activation', true );
164
+		update_option('ee_espresso_activation', true);
165 165
 	}
166
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
166
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
167 167
 
168 168
 
169 169
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		//	}
178 178
 		//
179 179
 	}
180
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
180
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
181 181
 
182 182
 
183 183
 
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	function espresso_load_error_handling() {
189 189
 		// load debugging tools
190
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
191
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
190
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
191
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
192 192
 			EEH_Debug_Tools::instance();
193 193
 		}
194 194
 		// load error handling
195
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
196
-			require_once( EE_CORE . 'EE_Error.core.php' );
195
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
196
+			require_once(EE_CORE.'EE_Error.core.php');
197 197
 		} else {
198
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
198
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
199 199
 		}
200 200
 	}
201 201
 
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
 	 * @param    string $full_path_to_file
210 210
 	 * @throws    EE_Error
211 211
 	 */
212
-	function espresso_load_required( $classname, $full_path_to_file ) {
212
+	function espresso_load_required($classname, $full_path_to_file) {
213 213
 		static $error_handling_loaded = false;
214
-		if ( ! $error_handling_loaded ) {
214
+		if ( ! $error_handling_loaded) {
215 215
 			espresso_load_error_handling();
216 216
 			$error_handling_loaded = true;
217 217
 		}
218
-		if ( is_readable( $full_path_to_file ) ) {
219
-			require_once( $full_path_to_file );
218
+		if (is_readable($full_path_to_file)) {
219
+			require_once($full_path_to_file);
220 220
 		} else {
221
-			throw new EE_Error ( sprintf(
222
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
221
+			throw new EE_Error(sprintf(
222
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
223 223
 				$classname
224
-			) );
224
+			));
225 225
 		}
226 226
 	}
227 227
 
228
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
229
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
230
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
228
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
229
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
230
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
231 231
 	new EE_Bootstrap();
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 
238 238
 
239
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
239
+if ( ! function_exists('espresso_deactivate_plugin')) {
240 240
 	/**
241 241
 	*    deactivate_plugin
242 242
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
246 246
 	* @return    void
247 247
 	*/
248
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
249
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
250
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
248
+	function espresso_deactivate_plugin($plugin_basename = '') {
249
+		if ( ! function_exists('deactivate_plugins')) {
250
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
251 251
 		}
252
-		unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] );
253
-		deactivate_plugins( $plugin_basename );
252
+		unset($_GET['activate'], $_REQUEST['activate']);
253
+		deactivate_plugins($plugin_basename);
254 254
 	}
255 255
 }
Please login to merge, or discard this patch.
modules/gateways/Invoice/lib/Invoice.class.php 2 patches
Braces   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		//Get the CSS file
73 73
 		if( isset( $themes[ $theme_requested ] ) ) {
74 74
 			$template_args['invoice_css'] = $themes[ $theme_requested ];
75
-		}else{
75
+		} else{
76 76
 			$template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta( 'legacy_invoice_css', TRUE, 'simple.css' );
77 77
 		}
78 78
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$attendee_state = $primary_attendee->state_obj();
101 101
 		if($attendee_state){
102 102
 			$attendee_state_name = $attendee_state->name();
103
-		}else{
103
+		} else{
104 104
 			$attendee_state_name = '';
105 105
 		}
106 106
 		$template_args['attendee_state'] = $attendee_state_name;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 			$template_args['questions_to_skip'] = $questions_to_skip;
171 171
 //			d($template_args);
172 172
 			$template_args['download_link'] = $this->registration->receipt_url('download');
173
-		}else{
173
+		} else{
174 174
 			//it's just an invoice we're accessing
175 175
 			$template_args['download_link'] = $this->registration->invoice_url('download');
176 176
 		}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 		$template_header = EEH_Template::locate_template( $templates_relative_path . 'invoice_header.template.php', $template_args, TRUE, TRUE );
181 181
 		if(isset($_GET['receipt'])){
182 182
 			$template_body = EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', $template_args, TRUE, TRUE );
183
-		}else{
183
+		} else{
184 184
 			$template_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', $template_args, TRUE, TRUE );
185 185
 		}
186 186
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		//Create the PDF
206 206
 		if(array_key_exists('html',$_GET)){
207 207
 			echo $content;
208
-		}else{
208
+		} else{
209 209
 			//only load dompdf if nobody else has yet...
210 210
 			if( ! defined('DOMPDF_DIR')){
211 211
 				define('DOMPDF_ENABLE_REMOTE', TRUE);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	function check_if_any_line_items_have_a_description(EE_Line_Item $line_item){
230 230
 		if($line_item->desc()){
231 231
 			return true;
232
-		}else{
232
+		} else{
233 233
 			foreach($line_item->children() as $child_line_item){
234 234
 				if($this->check_if_any_line_items_have_a_description($child_line_item)){
235 235
 					return true;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$org_state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID );
274 274
 		if($org_state){
275 275
 			$org_state_name = $org_state->name();
276
-		}else{
276
+		} else{
277 277
 			$org_state_name = '';
278 278
 		}
279 279
 		$ReplaceValues = array(
@@ -300,8 +300,9 @@  discard block
 block discarded – undo
300 300
 	public function espressoLoadData($items) {
301 301
 		$lines = $items;
302 302
 		$data = array();
303
-		foreach ($lines as $line)
304
-			$data[] = explode(';', chop($line));
303
+		foreach ($lines as $line) {
304
+					$data[] = explode(';', chop($line));
305
+		}
305 306
 
306 307
 		return $data;
307 308
 	}
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
 			'4.9.12',
44 44
 			'5.0.0'
45 45
 		);
46
-		if ( $this->registration = EE_Registry::instance()->load_model( 'Registration' )->get_registration_for_reg_url_link( $url_link)) {
46
+		if ($this->registration = EE_Registry::instance()->load_model('Registration')->get_registration_for_reg_url_link($url_link)) {
47 47
 			$this->transaction = $this->registration->transaction();
48 48
 
49
-			$payment_settings = EE_Config::instance()->gateway->payment_settings;//get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE);
50
-			$this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type( 'Invoice' );
49
+			$payment_settings = EE_Config::instance()->gateway->payment_settings; //get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE);
50
+			$this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type('Invoice');
51 51
 		} else {
52
-			EE_Error::add_error( __( 'Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
52
+			EE_Error::add_error(__('Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
53 53
 		}
54 54
 
55 55
 	}
56 56
 
57
-	public function send_invoice( $download = FALSE ) {
57
+	public function send_invoice($download = FALSE) {
58 58
 		$template_args = array();
59 59
 		$EE = EE_Registry::instance();
60 60
 
61 61
 		//allow the request to override the default theme defined in the invoice settings
62
-		$theme_requested = ( isset( $_REQUEST['theme'] ) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8 ) ? absint( $_REQUEST['theme'] ) : null;
62
+		$theme_requested = (isset($_REQUEST['theme']) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8) ? absint($_REQUEST['theme']) : null;
63 63
 		$themes = array(
64 64
 										1 => "simple.css",
65 65
 										2 => "bauhaus.css",
@@ -70,26 +70,26 @@  discard block
 block discarded – undo
70 70
 										7 => "union.css"
71 71
 									);
72 72
 		//Get the CSS file
73
-		if( isset( $themes[ $theme_requested ] ) ) {
74
-			$template_args['invoice_css'] = $themes[ $theme_requested ];
75
-		}else{
76
-			$template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta( 'legacy_invoice_css', TRUE, 'simple.css' );
73
+		if (isset($themes[$theme_requested])) {
74
+			$template_args['invoice_css'] = $themes[$theme_requested];
75
+		} else {
76
+			$template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta('legacy_invoice_css', TRUE, 'simple.css');
77 77
 		}
78 78
 
79
-		if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) {
80
-			$template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/';
79
+		if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR.'/invoice')) {
80
+			$template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL.'Invoice/lib/templates/';
81 81
 		} else {
82
-			$template_args['base_url'] = EE_GATEWAYS . '/Invoice/lib/templates/';
82
+			$template_args['base_url'] = EE_GATEWAYS.'/Invoice/lib/templates/';
83 83
 		}
84 84
 		$primary_attendee = $this->transaction->primary_registration()->attendee();
85 85
 
86
-		$template_args['organization'] = $EE->CFG->organization->get_pretty( 'name' );
87
-		$template_args['street'] = empty( $EE->CFG->organization->address_2 ) ? $EE->CFG->organization->get_pretty( 'address_1' ) : $EE->CFG->organization->get_pretty( 'address_1' ) . '<br>' . $EE->CFG->organization->get_pretty( 'address_2' );
88
-		$template_args['city'] = $EE->CFG->organization->get_pretty( 'city' );
89
-		$template_args['state'] = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID );
90
-		$template_args['country'] = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $EE->CFG->organization->CNT_ISO );
91
-		$template_args['zip'] = $EE->CFG->organization->get_pretty( 'zip' );
92
-		$template_args['email'] = $EE->CFG->organization->get_pretty( 'email' );
86
+		$template_args['organization'] = $EE->CFG->organization->get_pretty('name');
87
+		$template_args['street'] = empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1').'<br>'.$EE->CFG->organization->get_pretty('address_2');
88
+		$template_args['city'] = $EE->CFG->organization->get_pretty('city');
89
+		$template_args['state'] = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID);
90
+		$template_args['country'] = EE_Registry::instance()->load_model('Country')->get_one_by_ID($EE->CFG->organization->CNT_ISO);
91
+		$template_args['zip'] = $EE->CFG->organization->get_pretty('zip');
92
+		$template_args['email'] = $EE->CFG->organization->get_pretty('email');
93 93
 
94 94
 		$template_args['registration_code'] = $this->registration->reg_code();
95 95
 		$template_args['registration_date'] = $this->registration->date();
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 		$template_args['attendee_address2'] = $primary_attendee->address2();
99 99
 		$template_args['attendee_city'] = $primary_attendee->city();
100 100
 		$attendee_state = $primary_attendee->state_obj();
101
-		if($attendee_state){
101
+		if ($attendee_state) {
102 102
 			$attendee_state_name = $attendee_state->name();
103
-		}else{
103
+		} else {
104 104
 			$attendee_state_name = '';
105 105
 		}
106 106
 		$template_args['attendee_state'] = $attendee_state_name;
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		if ($template_args['amount_pd'] != $template_args['total_cost']) {
125 125
 			//$template_args['net_total'] = $this->espressoInvoiceTotals( __('SubTotal', 'event_espresso'), $this->transaction->total());//$this->session_data['cart']['REG']['sub_total']);
126 126
 			$tax_items = $this->transaction->tax_items();
127
-			if(!empty($tax_items) ){
127
+			if ( ! empty($tax_items)) {
128 128
 				foreach ($tax_items as $tax) {
129
-					$template_args['net_total'] .= $this->espressoInvoiceTotals( $tax->name(), $tax->total());
129
+					$template_args['net_total'] .= $this->espressoInvoiceTotals($tax->name(), $tax->total());
130 130
 				}
131 131
 			}
132 132
 
@@ -136,30 +136,30 @@  discard block
 block discarded – undo
136 136
 			} else {
137 137
 				$text = __('Extra', 'event_espresso');
138 138
 			}
139
-			$template_args['discount'] = $this->espressoInvoiceTotals( $text, $difference );
139
+			$template_args['discount'] = $this->espressoInvoiceTotals($text, $difference);
140 140
 		}
141 141
 
142 142
 		$template_args['currency_symbol'] = $EE->CFG->currency->sign;
143
-		$template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta( 'pdf_instructions', TRUE ), ENT_QUOTES)));
144
-		$template_args['shameless_plug'] = apply_filters( 'FHEE_Invoice__send_invoice__shameless_plug',true );
145
-		if(isset($_GET['receipt'])){
143
+		$template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE), ENT_QUOTES)));
144
+		$template_args['shameless_plug'] = apply_filters('FHEE_Invoice__send_invoice__shameless_plug', true);
145
+		if (isset($_GET['receipt'])) {
146 146
 			//receipt-specific stuff
147 147
 			$events_for_txn = EEM_Event::instance()->get_all(array(array('Registration.TXN_ID'=>$this->transaction->ID())));
148 148
 			$ticket_line_items_per_event = array();
149 149
 			$registrations_per_line_item = array();
150 150
 			$venues_for_events = array();
151
-			foreach($events_for_txn as $event_id => $event){
152
-				$line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID'=>$event_id,'TXN_ID'=>$this->transaction->ID())));
151
+			foreach ($events_for_txn as $event_id => $event) {
152
+				$line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID'=>$event_id, 'TXN_ID'=>$this->transaction->ID())));
153 153
 				$ticket_line_items_per_event[$event_id] = $line_items_for_this_event;
154
-				foreach($line_items_for_this_event as $line_item_id => $line_item){
154
+				foreach ($line_items_for_this_event as $line_item_id => $line_item) {
155 155
 					$ticket = $line_item->ticket();
156
-					$registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID'=>$ticket->ID(),'TXN_ID'=>$this->transaction->ID())));
156
+					$registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID'=>$ticket->ID(), 'TXN_ID'=>$this->transaction->ID())));
157 157
 					$registrations_per_line_item[$line_item_id] = $registrations_for_this_ticket;
158 158
 				}
159 159
 				$venues_for_events = array_merge($venues_for_events, $event->venues());
160 160
 			}
161
-			$tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID'=>$this->transaction->ID(),'LIN_type'=>  EEM_Line_Item::type_tax_sub_total)));
162
-			$questions_to_skip = array(EEM_Attendee::system_question_fname,EEM_Attendee::system_question_lname,  EEM_Attendee::system_question_email);
161
+			$tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID'=>$this->transaction->ID(), 'LIN_type'=>  EEM_Line_Item::type_tax_sub_total)));
162
+			$questions_to_skip = array(EEM_Attendee::system_question_fname, EEM_Attendee::system_question_lname, EEM_Attendee::system_question_email);
163 163
 
164 164
 
165 165
 			$template_args['events_for_txn'] = $events_for_txn;
@@ -170,53 +170,53 @@  discard block
 block discarded – undo
170 170
 			$template_args['questions_to_skip'] = $questions_to_skip;
171 171
 //			d($template_args);
172 172
 			$template_args['download_link'] = $this->registration->receipt_url('download');
173
-		}else{
173
+		} else {
174 174
 			//it's just an invoice we're accessing
175 175
 			$template_args['download_link'] = $this->registration->invoice_url('download');
176 176
 		}
177 177
 
178 178
 		//Get the HTML as an object
179 179
 		$templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
180
-		$template_header = EEH_Template::locate_template( $templates_relative_path . 'invoice_header.template.php', $template_args, TRUE, TRUE );
181
-		if(isset($_GET['receipt'])){
182
-			$template_body = EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', $template_args, TRUE, TRUE );
183
-		}else{
184
-			$template_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', $template_args, TRUE, TRUE );
180
+		$template_header = EEH_Template::locate_template($templates_relative_path.'invoice_header.template.php', $template_args, TRUE, TRUE);
181
+		if (isset($_GET['receipt'])) {
182
+			$template_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', $template_args, TRUE, TRUE);
183
+		} else {
184
+			$template_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', $template_args, TRUE, TRUE);
185 185
 		}
186 186
 
187 187
 
188
-		$template_footer = EEH_Template::locate_template( $templates_relative_path . 'invoice_footer.template.php', $template_args, TRUE, TRUE );
188
+		$template_footer = EEH_Template::locate_template($templates_relative_path.'invoice_footer.template.php', $template_args, TRUE, TRUE);
189 189
 
190
-		$copies =  ! empty( $_REQUEST['copies'] ) ? $_REQUEST['copies'] : 1;
190
+		$copies = ! empty($_REQUEST['copies']) ? $_REQUEST['copies'] : 1;
191 191
 
192 192
 		$content = $this->espresso_replace_invoice_shortcodes($template_header);
193
-		for( $x = 1; $x <= $copies; $x++ ) {
193
+		for ($x = 1; $x <= $copies; $x++) {
194 194
 			$content .= $this->espresso_replace_invoice_shortcodes($template_body);
195 195
 		}
196 196
 		$content .= $this->espresso_replace_invoice_shortcodes($template_footer);
197 197
 
198 198
 		//Check if debugging or mobile is set
199
-		if (!empty($_REQUEST['html'])) {
199
+		if ( ! empty($_REQUEST['html'])) {
200 200
 			echo $content;
201 201
 			exit(0);
202 202
 		}
203
-		$invoice_name = $template_args['organization'] . ' ' . __('Invoice #', 'event_espresso') . $template_args['registration_code'] . __(' for ', 'event_espresso') . $template_args['name'];
204
-		$invoice_name = str_replace( ' ', '_', $invoice_name );
203
+		$invoice_name = $template_args['organization'].' '.__('Invoice #', 'event_espresso').$template_args['registration_code'].__(' for ', 'event_espresso').$template_args['name'];
204
+		$invoice_name = str_replace(' ', '_', $invoice_name);
205 205
 		//Create the PDF
206
-		if(array_key_exists('html',$_GET)){
206
+		if (array_key_exists('html', $_GET)) {
207 207
 			echo $content;
208
-		}else{
208
+		} else {
209 209
 			//only load dompdf if nobody else has yet...
210
-			if( ! defined('DOMPDF_DIR')){
210
+			if ( ! defined('DOMPDF_DIR')) {
211 211
 				define('DOMPDF_ENABLE_REMOTE', TRUE);
212 212
 				define('DOMPDF_ENABLE_JAVASCRIPT', FALSE);
213 213
 				define('DOMPDF_ENABLE_CSS_FLOAT', TRUE);
214
-				require_once(EE_THIRD_PARTY . 'dompdf/dompdf_config.inc.php');
214
+				require_once(EE_THIRD_PARTY.'dompdf/dompdf_config.inc.php');
215 215
 			}
216 216
 			$dompdf = new DOMPDF();
217 217
 			$dompdf->load_html($content);
218 218
 			$dompdf->render();
219
-			$dompdf->stream($invoice_name . ".pdf", array( 'Attachment' => $download ));
219
+			$dompdf->stream($invoice_name.".pdf", array('Attachment' => $download));
220 220
 		}
221 221
 		exit(0);
222 222
 	}
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
 	 * @param EE_Line_Item $line_item
227 227
 	 * @return boolean
228 228
 	 */
229
-	function check_if_any_line_items_have_a_description(EE_Line_Item $line_item){
230
-		if($line_item->desc()){
229
+	function check_if_any_line_items_have_a_description(EE_Line_Item $line_item) {
230
+		if ($line_item->desc()) {
231 231
 			return true;
232
-		}else{
233
-			foreach($line_item->children() as $child_line_item){
234
-				if($this->check_if_any_line_items_have_a_description($child_line_item)){
232
+		} else {
233
+			foreach ($line_item->children() as $child_line_item) {
234
+				if ($this->check_if_any_line_items_have_a_description($child_line_item)) {
235 235
 					return true;
236 236
 				}
237 237
 			}
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
 	}
242 242
 
243 243
 //Perform the shortcode replacement
244
-	function espresso_replace_invoice_shortcodes( $content ) {
244
+	function espresso_replace_invoice_shortcodes($content) {
245 245
 
246 246
 		$EE = EE_Registry::instance();
247 247
 		//Create the logo
248
-		$invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE,  $EE->CFG->organization->logo_url );
249
-		if (!empty($invoice_logo_url)) {
248
+		$invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE, $EE->CFG->organization->logo_url);
249
+		if ( ! empty($invoice_logo_url)) {
250 250
 			$image_size = getimagesize($invoice_logo_url);
251
-			$invoice_logo_image = '<img class="logo screen" src="' . $invoice_logo_url . '" ' . $image_size[3] . ' alt="logo" /> ';
251
+			$invoice_logo_image = '<img class="logo screen" src="'.$invoice_logo_url.'" '.$image_size[3].' alt="logo" /> ';
252 252
 		} else {
253 253
 			$invoice_logo_image = '';
254 254
 		}
@@ -270,28 +270,28 @@  discard block
 block discarded – undo
270 270
 				"[instructions]",
271 271
 		);
272 272
 		$primary_attendee = $this->transaction->primary_registration()->attendee();
273
-		$org_state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID );
274
-		if($org_state){
273
+		$org_state = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID);
274
+		if ($org_state) {
275 275
 			$org_state_name = $org_state->name();
276
-		}else{
276
+		} else {
277 277
 			$org_state_name = '';
278 278
 		}
279 279
 		$ReplaceValues = array(
280
-				$EE->CFG->organization->get_pretty( 'name' ),
280
+				$EE->CFG->organization->get_pretty('name'),
281 281
 				$this->registration->reg_code(),
282 282
 				$this->transaction->ID(),
283 283
 				$primary_attendee->full_name(),
284
-				(is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) ? EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/' : EE_GATEWAYS_URL . 'Invoice/lib/templates/',
285
-				$this->registration->invoice_url(),//home_url() . '/?download_invoice=true&amp;id=' . $this->registration->reg_url_link(),
284
+				(is_dir(EVENT_ESPRESSO_GATEWAY_DIR.'/invoice')) ? EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/' : EE_GATEWAYS_URL.'Invoice/lib/templates/',
285
+				$this->registration->invoice_url(), //home_url() . '/?download_invoice=true&amp;id=' . $this->registration->reg_url_link(),
286 286
 				$invoice_logo_image,
287
-				empty( $EE->CFG->organization->address_2 ) ? $EE->CFG->organization->get_pretty( 'address_1' ) : $EE->CFG->organization->get_pretty( 'address_1' ) . '<br>' . $EE->CFG->organization->get_pretty( 'address_2' ),
288
-				$EE->CFG->organization->get_pretty( 'city' ),
287
+				empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1').'<br>'.$EE->CFG->organization->get_pretty('address_2'),
288
+				$EE->CFG->organization->get_pretty('city'),
289 289
 				$org_state_name,
290
-				$EE->CFG->organization->get_pretty( 'zip' ),
291
-				$EE->CFG->organization->get_pretty( 'email' ),
290
+				$EE->CFG->organization->get_pretty('zip'),
291
+				$EE->CFG->organization->get_pretty('email'),
292 292
 				$EE->CFG->organization->vat,
293
-				$this->registration->get_i18n_datetime( 'REG_date', get_option( 'date_format' ) ),
294
-				$this->invoice_payment_method->get_extra_meta( 'pdf_instructions', TRUE ),
293
+				$this->registration->get_i18n_datetime('REG_date', get_option('date_format')),
294
+				$this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE),
295 295
 		);
296 296
 
297 297
 		return str_replace($SearchValues, $ReplaceValues, $content);
@@ -314,12 +314,12 @@  discard block
 block discarded – undo
314 314
 		if ($total_cost < 0) {
315 315
 			$total_cost = (-1) * $total_cost;
316 316
 		}
317
-		$find = array( ' ' );
318
-		$replace = array( '-' );
319
-		$row_id = strtolower( str_replace( $find, $replace, $text ));
317
+		$find = array(' ');
318
+		$replace = array('-');
319
+		$row_id = strtolower(str_replace($find, $replace, $text));
320 320
 		$html .= '<tr id="'.$row_id.'-tr"><td colspan="4">&nbsp;</td>';
321
-		$html .= '<td class="item_r">' . $text . '</td>';
322
-		$html .= '<td class="item_r">' . $total_cost . '</td>';
321
+		$html .= '<td class="item_r">'.$text.'</td>';
322
+		$html .= '<td class="item_r">'.$total_cost.'</td>';
323 323
 		$html .= '</tr>';
324 324
 		return $html;
325 325
 	}
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	 * @param  \EE_Request  $request
76 76
 	 * @param  \EE_Response $response
77 77
 	 */
78
-	protected function __construct( EE_Request $request, EE_Response $response ) {
78
+	protected function __construct(EE_Request $request, EE_Response $response) {
79 79
 		$this->_request = $request;
80 80
 		$this->_response = $response;
81
-		add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) );
82
-		do_action( 'EE_Dependency_Map____construct' );
81
+		add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize'));
82
+		do_action('EE_Dependency_Map____construct');
83 83
 	}
84 84
 
85 85
 
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 	 * @param  \EE_Response $response
102 102
 	 * @return \EE_Dependency_Map instance
103 103
 	 */
104
-	public static function instance( EE_Request $request = null, EE_Response $response = null ) {
104
+	public static function instance(EE_Request $request = null, EE_Response $response = null) {
105 105
 		// check if class object is instantiated, and instantiated properly
106
-		if ( ! self::$_instance instanceof EE_Dependency_Map ) {
107
-			self::$_instance = new EE_Dependency_Map( $request, $response );
106
+		if ( ! self::$_instance instanceof EE_Dependency_Map) {
107
+			self::$_instance = new EE_Dependency_Map($request, $response);
108 108
 		}
109 109
 		return self::$_instance;
110 110
 	}
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
 	 * @param array  $dependencies
117 117
 	 * @return boolean
118 118
 	 */
119
-	public static function register_dependencies( $class, $dependencies ) {
120
-		if ( ! isset( self::$_instance->_dependency_map[ $class ] ) ) {
119
+	public static function register_dependencies($class, $dependencies) {
120
+		if ( ! isset(self::$_instance->_dependency_map[$class])) {
121 121
 			// we need to make sure that any aliases used when registering a dependency
122 122
 			// get resolved to the correct class name
123
-			foreach ( (array) $dependencies as $dependency => $load_source ) {
124
-				$alias = self::$_instance->get_alias( $dependency );
125
-				unset( $dependencies[ $dependency ] );
126
-				$dependencies[ $alias ] = $load_source;
123
+			foreach ((array) $dependencies as $dependency => $load_source) {
124
+				$alias = self::$_instance->get_alias($dependency);
125
+				unset($dependencies[$dependency]);
126
+				$dependencies[$alias] = $load_source;
127 127
 			}
128
-			self::$_instance->_dependency_map[ $class ] = (array) $dependencies;
128
+			self::$_instance->_dependency_map[$class] = (array) $dependencies;
129 129
 			return true;
130 130
 		}
131 131
 		return false;
@@ -139,19 +139,19 @@  discard block
 block discarded – undo
139 139
 	 * @return bool
140 140
 	 * @throws \EE_Error
141 141
 	 */
142
-	public static function register_class_loader( $class_name, $loader = 'load_core' ) {
142
+	public static function register_class_loader($class_name, $loader = 'load_core') {
143 143
 		// check that loader method starts with "load_" and exists in EE_Registry
144
-		if ( strpos( $loader, 'load_' ) !== 0 || ! method_exists( 'EE_Registry', $loader ) ) {
144
+		if (strpos($loader, 'load_') !== 0 || ! method_exists('EE_Registry', $loader)) {
145 145
 			throw new EE_Error(
146 146
 				sprintf(
147
-					__( '"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso' ),
147
+					__('"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso'),
148 148
 					$loader
149 149
 				)
150 150
 			);
151 151
 		}
152
-		$class_name = self::$_instance->get_alias( $class_name );
153
-		if ( ! isset( self::$_instance->_class_loaders[ $class_name ] ) ) {
154
-			self::$_instance->_class_loaders[ $class_name ] = $loader;
152
+		$class_name = self::$_instance->get_alias($class_name);
153
+		if ( ! isset(self::$_instance->_class_loaders[$class_name])) {
154
+			self::$_instance->_class_loaders[$class_name] = $loader;
155 155
 			return true;
156 156
 		}
157 157
 		return false;
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @param string $class_name
175 175
 	 * @return boolean
176 176
 	 */
177
-	public function has( $class_name = '' ) {
178
-		return isset( $this->_dependency_map[ $class_name ] ) ? true : false;
177
+	public function has($class_name = '') {
178
+		return isset($this->_dependency_map[$class_name]) ? true : false;
179 179
 	}
180 180
 
181 181
 
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 	 * @param string $dependency
188 188
 	 * @return bool
189 189
 	 */
190
-	public function has_dependency_for_class( $class_name = '', $dependency = '' ) {
191
-		$dependency = $this->get_alias( $dependency );
192
-		return isset( $this->_dependency_map[ $class_name ], $this->_dependency_map[ $class_name ][ $dependency ] )
190
+	public function has_dependency_for_class($class_name = '', $dependency = '') {
191
+		$dependency = $this->get_alias($dependency);
192
+		return isset($this->_dependency_map[$class_name], $this->_dependency_map[$class_name][$dependency])
193 193
 			? true
194 194
 			: false;
195 195
 	}
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
 	 * @param string $dependency
204 204
 	 * @return int
205 205
 	 */
206
-	public function loading_strategy_for_class_dependency( $class_name = '', $dependency = '' ) {
207
-		$dependency = $this->get_alias( $dependency );
208
-		return $this->has_dependency_for_class( $class_name, $dependency )
209
-			? $this->_dependency_map[ $class_name ][ $dependency ]
206
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') {
207
+		$dependency = $this->get_alias($dependency);
208
+		return $this->has_dependency_for_class($class_name, $dependency)
209
+			? $this->_dependency_map[$class_name][$dependency]
210 210
 			: EE_Dependency_Map::not_registered;
211 211
 	}
212 212
 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 * @param string $class_name
217 217
 	 * @return string | Closure
218 218
 	 */
219
-	public function class_loader( $class_name ) {
220
-		$class_name = $this->get_alias( $class_name );
221
-		return isset( $this->_class_loaders[ $class_name ] ) ? $this->_class_loaders[ $class_name ] : '';
219
+	public function class_loader($class_name) {
220
+		$class_name = $this->get_alias($class_name);
221
+		return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : '';
222 222
 	}
223 223
 
224 224
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 * @param string $class_name
239 239
 	 * @param string $alias
240 240
 	 */
241
-	public function add_alias( $class_name, $alias ) {
242
-		$this->_aliases[ $class_name ] = $alias;
241
+	public function add_alias($class_name, $alias) {
242
+		$this->_aliases[$class_name] = $alias;
243 243
 	}
244 244
 
245 245
 
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @param string $class_name
251 251
 	 * @return boolean
252 252
 	 */
253
-	public function has_alias( $class_name = '' ) {
254
-		return isset( $this->_aliases[ $class_name ] ) ? true : false;
253
+	public function has_alias($class_name = '') {
254
+		return isset($this->_aliases[$class_name]) ? true : false;
255 255
 	}
256 256
 
257 257
 
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
 	 * @param string $class_name
272 272
 	 * @return string
273 273
 	 */
274
-	public function get_alias( $class_name = '' ) {
275
-		return $this->has_alias( $class_name )
276
-			? $this->get_alias( $this->_aliases[ $class_name ] )
274
+	public function get_alias($class_name = '') {
275
+		return $this->has_alias($class_name)
276
+			? $this->get_alias($this->_aliases[$class_name])
277 277
 			: $class_name;
278 278
 	}
279 279
 
@@ -489,17 +489,17 @@  discard block
 block discarded – undo
489 489
 			'EE_Messages_Data_Handler_Collection'  => 'load_lib',
490 490
 			'EE_Message_Template_Group_Collection' => 'load_lib',
491 491
 			'EE_Messages_Generator' => function() {
492
-				return EE_Registry::instance()->load_lib( 'Messages_Generator', array(), false, false );
492
+				return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false);
493 493
 			},
494
-			'EE_Messages_Template_Defaults' => function( $arguments = array() ) {
495
-				return EE_Registry::instance()->load_lib( 'Messages_Template_Defaults', $arguments, false, false );
494
+			'EE_Messages_Template_Defaults' => function($arguments = array()) {
495
+				return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false);
496 496
 			},
497 497
 			//load_model
498 498
 			'EEM_Message_Template_Group'           => 'load_model',
499 499
 			'EEM_Message_Template'                 => 'load_model',
500 500
 			//load_helper
501 501
 			'EEH_Parse_Shortcodes'                 => function() {
502
-				if ( EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ) ) {
502
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
503 503
 					return new EEH_Parse_Shortcodes();
504 504
 				}
505 505
 				return null;
Please login to merge, or discard this patch.
core/CPTs/EE_CPT_Strategy.core.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@
 block discarded – undo
9 9
 class EE_CPT_Strategy extends EE_Base {
10 10
 
11 11
    /**
12
-     * 	EE_CPT_Strategy Object
13
-     * 	@private _instance
14
-	 * 	@private 	protected
15
-     */
12
+    * 	EE_CPT_Strategy Object
13
+    * 	@private _instance
14
+    * 	@private 	protected
15
+    */
16 16
 	private static $_instance;
17 17
 
18 18
 
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 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
  * CPT_Strategy
4 4
  *
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function instance() {
71 71
 		// check if class object is instantiated
72
-		if ( ! self::$_instance instanceof EE_CPT_Strategy ) {
72
+		if ( ! self::$_instance instanceof EE_CPT_Strategy) {
73 73
 			self::$_instance = new self();
74 74
 		}
75 75
 		return self::$_instance;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		$this->_CPTs = EE_Register_CPTs::get_CPTs();
87 87
 		$this->_CPT_endpoints = $this->_set_CPT_endpoints();
88 88
 		$this->_CPT_taxonomies = EE_Register_CPTs::get_taxonomies();
89
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 );
89
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 5);
90 90
 	}
91 91
 
92 92
 
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	private function _set_CPT_endpoints() {
122 122
 		$_CPT_endpoints = array();
123
-		if ( is_array( $this->_CPTs )) {
124
-			foreach ( $this->_CPTs as $CPT_type => $CPT ) {
125
-				$_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type;
123
+		if (is_array($this->_CPTs)) {
124
+			foreach ($this->_CPTs as $CPT_type => $CPT) {
125
+				$_CPT_endpoints [$CPT['plural_slug']] = $CPT_type;
126 126
 			}
127 127
 		}
128 128
 		return $_CPT_endpoints;
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 	 * @param WP_Query $WP_Query
141 141
 	 * @return void
142 142
 	 */
143
-	public function pre_get_posts( $WP_Query ) {
143
+	public function pre_get_posts($WP_Query) {
144 144
 		// check that post-type is set
145
-		if ( ! $WP_Query instanceof WP_Query ) {
145
+		if ( ! $WP_Query instanceof WP_Query) {
146 146
 			return;
147 147
 		}
148 148
 		// add our conditionals
149
-		$this->_set_EE_tags_on_WP_Query( $WP_Query );
149
+		$this->_set_EE_tags_on_WP_Query($WP_Query);
150 150
 		// check for terms
151
-		$this->_set_post_type_for_terms( $WP_Query );
151
+		$this->_set_post_type_for_terms($WP_Query);
152 152
 		// make sure paging is always set
153
-		$this->_set_paging( $WP_Query );
153
+		$this->_set_paging($WP_Query);
154 154
 		// is a taxonomy set ?
155
-		$this->_set_CPT_taxonomies_on_WP_Query( $WP_Query );
155
+		$this->_set_CPT_taxonomies_on_WP_Query($WP_Query);
156 156
 		// loop thru post_types if set
157
-		$this->_process_WP_Query_post_types( $WP_Query );
157
+		$this->_process_WP_Query_post_types($WP_Query);
158 158
 	}
159 159
 
160 160
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @param WP_Query $WP_Query
166 166
 	 * @return void
167 167
 	 */
168
-	private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) {
168
+	private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) {
169 169
 		$WP_Query->is_espresso_event_single = FALSE;
170 170
 		$WP_Query->is_espresso_event_archive = FALSE;
171 171
 		$WP_Query->is_espresso_event_taxonomy = FALSE;
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @return void
184 184
 	 */
185 185
 	private function _set_CPT_terms() {
186
-		if ( empty( $this->_CPT_terms )) {
186
+		if (empty($this->_CPT_terms)) {
187 187
 			$terms = EEM_Term::instance()->get_all_CPT_post_tags();
188
-			foreach ( $terms as $term ) {
189
-				if ( $term instanceof EE_Term ) {
190
-					$this->_CPT_terms[ $term->slug() ] = $term;
188
+			foreach ($terms as $term) {
189
+				if ($term instanceof EE_Term) {
190
+					$this->_CPT_terms[$term->slug()] = $term;
191 191
 				}
192 192
 			}
193 193
 		}
@@ -202,24 +202,24 @@  discard block
 block discarded – undo
202 202
 	 * @param $WP_Query
203 203
 	 * @return void
204 204
 	 */
205
-	private function _set_post_type_for_terms( WP_Query $WP_Query ) {
205
+	private function _set_post_type_for_terms(WP_Query $WP_Query) {
206 206
 		// is a tag set ?
207
-		if ( isset( $WP_Query->query['tag'] )) {
207
+		if (isset($WP_Query->query['tag'])) {
208 208
 			// set post_tags
209 209
 			$this->_set_CPT_terms();
210 210
 			// is this tag archive term in the list of terms used by our CPTs ?
211
-			$term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL;
211
+			$term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL;
212 212
 			// verify the term
213
-			if ( $term instanceof EE_Term ) {
214
-				$term->post_type  = array_merge( array( 'post', 'page' ), (array)$term->post_type );
215
-				$term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term );
213
+			if ($term instanceof EE_Term) {
214
+				$term->post_type = array_merge(array('post', 'page'), (array) $term->post_type);
215
+				$term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term);
216 216
 				// if a post type is already set
217
-				if ( isset( $WP_Query->query_vars['post_type'] )) {
217
+				if (isset($WP_Query->query_vars['post_type'])) {
218 218
 						// add to existing array
219
-						$term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type );
219
+						$term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type);
220 220
 				}
221 221
 				// just set post_type to our CPT
222
-				$WP_Query->set( 'post_type', array_unique( $term->post_type ) );
222
+				$WP_Query->set('post_type', array_unique($term->post_type));
223 223
 			}
224 224
 		}
225 225
 	}
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
 	 * @param WP_Query $WP_Query
234 234
 	 * @return void
235 235
 	 */
236
-	public function _set_paging( $WP_Query ) {
237
-		if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) {
236
+	public function _set_paging($WP_Query) {
237
+		if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) {
238 238
 			$page = get_query_var('page') ? get_query_var('page') : NULL;
239 239
 			$paged = get_query_var('paged') ? get_query_var('paged') : $page;
240
-			$WP_Query->set( 'paged', $paged );
240
+			$WP_Query->set('paged', $paged);
241 241
 		}
242 242
 	}
243 243
 
@@ -247,28 +247,28 @@  discard block
 block discarded – undo
247 247
 	 * @access protected
248 248
 	 * @param \WP_Query $WP_Query
249 249
 	 */
250
-	protected function _set_CPT_taxonomies_on_WP_Query( WP_Query $WP_Query ) {
250
+	protected function _set_CPT_taxonomies_on_WP_Query(WP_Query $WP_Query) {
251 251
 		// is a taxonomy set ?
252
-		if ( $WP_Query->is_tax ) {
252
+		if ($WP_Query->is_tax) {
253 253
 			// loop thru our taxonomies
254
-			foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) {
254
+			foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) {
255 255
 				// check if one of our taxonomies is set as a query var
256
-				if ( isset( $WP_Query->query[ $CPT_taxonomy ] ) ) {
256
+				if (isset($WP_Query->query[$CPT_taxonomy])) {
257 257
 					// but which CPT does that correspond to??? hmmm... guess we gotta go looping
258
-					foreach ( $this->_CPTs as $post_type => $CPT ) {
258
+					foreach ($this->_CPTs as $post_type => $CPT) {
259 259
 						// verify our CPT has args, is public and has taxonomies set
260 260
 						if (
261
-							isset( $CPT['args'], $CPT['args']['public'] )
261
+							isset($CPT['args'], $CPT['args']['public'])
262 262
 							&& $CPT['args']['public']
263
-							&& ! empty( $CPT['args']['taxonomies'] )
264
-							&& in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )
263
+							&& ! empty($CPT['args']['taxonomies'])
264
+							&& in_array($CPT_taxonomy, $CPT['args']['taxonomies'])
265 265
 						) {
266 266
 							// if so, then add this CPT post_type to the current query's array of post_types'
267
-							$WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] )
267
+							$WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type'])
268 268
 								? (array) $WP_Query->query_vars['post_type']
269 269
 								: array();
270 270
 							$WP_Query->query_vars['post_type'][] = $post_type;
271
-							switch ( $post_type ) {
271
+							switch ($post_type) {
272 272
 								case 'espresso_events' :
273 273
 									$WP_Query->is_espresso_event_taxonomy = true;
274 274
 									break;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 									break;
278 278
 								default :
279 279
 									do_action(
280
-										'AHEE__EE_CPT_Strategy___set_CPT_taxonomies_on_WP_Query__for_' . $post_type . '_post_type',
280
+										'AHEE__EE_CPT_Strategy___set_CPT_taxonomies_on_WP_Query__for_'.$post_type.'_post_type',
281 281
 										$WP_Query,
282 282
 										$this
283 283
 									);
@@ -295,24 +295,24 @@  discard block
 block discarded – undo
295 295
 	 * @access public
296 296
 	 * @param \WP_Query $WP_Query
297 297
 	 */
298
-	protected function _process_WP_Query_post_types( WP_Query $WP_Query ) {
299
-		if ( isset( $WP_Query->query_vars['post_type'] ) ) {
298
+	protected function _process_WP_Query_post_types(WP_Query $WP_Query) {
299
+		if (isset($WP_Query->query_vars['post_type'])) {
300 300
 			// loop thru post_types as array
301
-			foreach ( (array) $WP_Query->query_vars['post_type'] as $post_type ) {
301
+			foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) {
302 302
 				// is current query for an EE CPT ?
303
-				if ( isset( $this->_CPTs[ $post_type ] ) ) {
303
+				if (isset($this->_CPTs[$post_type])) {
304 304
 					// is EE on or off ?
305
-					if ( EE_Maintenance_Mode::instance()->level() ) {
305
+					if (EE_Maintenance_Mode::instance()->level()) {
306 306
 						// reroute CPT template view to maintenance_mode.template.php
307
-						if ( ! has_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ) ) ) {
308
-							add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 );
307
+						if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) {
308
+							add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999);
309 309
 						}
310
-						if ( has_filter( 'the_content', array( EE_Maintenance_Mode::instance(), 'the_content' ) ) ) {
311
-							add_filter( 'the_content', array( $this, 'inject_EE_shortcode_placeholder' ), 1 );
310
+						if (has_filter('the_content', array(EE_Maintenance_Mode::instance(), 'the_content'))) {
311
+							add_filter('the_content', array($this, 'inject_EE_shortcode_placeholder'), 1);
312 312
 						}
313 313
 						return;
314 314
 					}
315
-					$this->_generate_CptQueryModifier( $WP_Query, $post_type );
315
+					$this->_generate_CptQueryModifier($WP_Query, $post_type);
316 316
 				}
317 317
 			}
318 318
 		}
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	 * @param \WP_Query $WP_Query
325 325
 	 * @param string    $post_type
326 326
 	 */
327
-	protected function _generate_CptQueryModifier( WP_Query $WP_Query, $post_type ) {
327
+	protected function _generate_CptQueryModifier(WP_Query $WP_Query, $post_type) {
328 328
 		$this->query_modifier = new EventEspresso\core\CPTs\CptQueryModifier(
329 329
 			$post_type,
330
-			$this->_CPTs[ $post_type ],
330
+			$this->_CPTs[$post_type],
331 331
 			$WP_Query,
332 332
 			EE_Registry::instance()->REQ
333 333
 		);
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
 	 * @param  $SQL
371 371
 	 * @return string
372 372
 	 */
373
-	public function posts_fields( $SQL ) {
374
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
375
-			return $this->query_modifier->postsFields( $SQL );
373
+	public function posts_fields($SQL) {
374
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
375
+			return $this->query_modifier->postsFields($SQL);
376 376
 		}
377 377
 		return $SQL;
378 378
 	}
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 	 * @param  $SQL
387 387
 	 * @return string
388 388
 	 */
389
-	public function posts_join( $SQL ) {
390
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
391
-			return $this->query_modifier->postsJoin( $SQL );
389
+	public function posts_join($SQL) {
390
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
391
+			return $this->query_modifier->postsJoin($SQL);
392 392
 		}
393 393
 		return $SQL;
394 394
 	}
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 	 * @param  \WP_Post[] $posts
403 403
 	 * @return \WP_Post[]
404 404
 	 */
405
-	public function the_posts( $posts ) {
406
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
407
-			$this->query_modifier->thePosts( $posts );
405
+	public function the_posts($posts) {
406
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
407
+			$this->query_modifier->thePosts($posts);
408 408
 		}
409 409
 		return $posts;
410 410
 	}
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
 	 * @param $ID
420 420
 	 * @return string
421 421
 	 */
422
-	public function get_edit_post_link( $url, $ID ) {
423
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
424
-			return $this->query_modifier->getEditPostLink( $url, $ID );
422
+	public function get_edit_post_link($url, $ID) {
423
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
424
+			return $this->query_modifier->getEditPostLink($url, $ID);
425 425
 		}
426 426
 		return '';
427 427
 	}
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	 * @access public
435 435
 	 * @param null $WP_Query
436 436
 	 */
437
-	protected function _do_template_filters( $WP_Query = null ) {
438
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
437
+	protected function _do_template_filters($WP_Query = null) {
438
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
439 439
 			$this->query_modifier->addTemplateFilters();
440 440
 		}
441 441
 	}
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 	 * @param string $current_template Existing default template path derived for this page call.
450 450
 	 * @return string the path to the full template file.
451 451
 	 */
452
-	public function single_cpt_template( $current_template ) {
453
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
454
-			return $this->query_modifier->singleCptTemplate( $current_template );
452
+	public function single_cpt_template($current_template) {
453
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
454
+			return $this->query_modifier->singleCptTemplate($current_template);
455 455
 		}
456 456
 		return $current_template;
457 457
 	}
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_Shortcodes.lib.php 1 patch
Spacing   +39 added lines, -39 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
 /**
@@ -55,38 +55,38 @@  discard block
 block discarded – undo
55 55
 			'[EVENT_NAME]' => __("This also can be used for the name of the event", 'event_espresso'),
56 56
 			'[EVENT_PHONE]' => __('The phone number for the event (usually an info number)', 'event_espresso'),
57 57
 			'[EVENT_DESCRIPTION]' => __('The description of the event', 'event_espresso'),
58
-			'[EVENT_EXCERPT]' => __( 'This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso' ),
58
+			'[EVENT_EXCERPT]' => __('This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso'),
59 59
 			'[EVENT_LINK]' => __('A link associated with the event', 'event_espresso'),
60 60
 			'[EVENT_URL]' => __('A link to the event set up on the host site.', 'event_espresso'),
61 61
 			'[VIRTUAL_URL]' => __('What was used for the "URL of Event" field in the Venue settings', 'event_espresso'),
62 62
 			'[VIRTUAL_PHONE]' => __('An alternate phone number for the event. Typically used as a "call-in" number', 'event_espresso'),
63 63
 			'[EVENT_IMAGE]' => __('This will parse to the Feature image for the event.', 'event_espresso'),
64 64
 			'[EVENT_IMAGE_*]' => sprintf(
65
-				__( 'This will parse to the Feature image for the event, %1$ssize%2$s can be set to determine the size of the image loaded by the shortcode. The %1$swidth%2$s and/or %1$sheight%2$s can also be set to determine the width and height of the image when output. By default the shortcode will load the %1$sthumbnail%2$s image size.', 'event_espresso' ),
65
+				__('This will parse to the Feature image for the event, %1$ssize%2$s can be set to determine the size of the image loaded by the shortcode. The %1$swidth%2$s and/or %1$sheight%2$s can also be set to determine the width and height of the image when output. By default the shortcode will load the %1$sthumbnail%2$s image size.', 'event_espresso'),
66 66
 				'<code>',
67 67
 				'</code>'
68 68
 				),
69 69
 			'[EVENT_TOTAL_AVAILABLE_SPACES_*]' => sprintf(
70
-				__( 'This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event.  There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode).  %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso' ),
70
+				__('This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event.  There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode).  %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso'),
71 71
 				'<code>',
72 72
 				'</code>'
73 73
 				),
74
-			'[EVENT_TOTAL_SPOTS_TAKEN]' => __( 'This shortcode will parse to the output the total approved registrations for this event', 'event_espresso' ),
74
+			'[EVENT_TOTAL_SPOTS_TAKEN]' => __('This shortcode will parse to the output the total approved registrations for this event', 'event_espresso'),
75 75
 			'[EVENT_FACEBOOK_URL]' => __('This will return the Facebook URL for the event if you have it set via custom field in your event, otherwise it will use the Facebook URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_facebook</code> and the value as your facebook url.', 'event_espresso'),
76 76
 			'[EVENT_TWITTER_URL]' => __('This will return the Twitter URL for the event if you have it set via custom field in your event, otherwise it will use the Twitter URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_twitter</code> and the value as your facebook url', 'event_espresso'),
77 77
 			'[EVENT_META_*]' => __('This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the event then it will be output in place of this shortcode.', 'event_espresso'),
78
-			'[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __( 'This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso' ),
78
+			'[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __('This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso'),
79 79
 			);
80 80
 	}
81 81
 
82 82
 
83
-	protected function _parser( $shortcode ) {
83
+	protected function _parser($shortcode) {
84 84
 
85 85
 
86 86
 		$this->_event = $this->_data instanceof EE_Event ? $this->_data : null;
87 87
 
88 88
 		//if no event, then let's see if there is a reg_obj.  If there IS, then we'll try and grab the event from the reg_obj instead.
89
-		if ( empty( $this->_event ) ) {
89
+		if (empty($this->_event)) {
90 90
 			$aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
91 91
 			$aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee;
92 92
 
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 
96 96
 
97 97
 		//If there is no event objecdt by now then get out.
98
-		if ( ! $this->_event instanceof EE_Event )
98
+		if ( ! $this->_event instanceof EE_Event)
99 99
 			return '';
100 100
 
101
-		switch ( $shortcode ) {
101
+		switch ($shortcode) {
102 102
 
103 103
 			case '[EVENT_ID]' :
104 104
 				return $this->_event->ID();
@@ -131,41 +131,41 @@  discard block
 block discarded – undo
131 131
 
132 132
 			case '[VIRTUAL_URL]' :
133 133
 				$venue = $this->_event->get_first_related('Venue');
134
-				if ( empty( $venue ) )
134
+				if (empty($venue))
135 135
 					return '';
136 136
 				return $venue->get('VNU_virtual_url');
137 137
 
138 138
 			case '[VIRTUAL_PHONE]' :
139 139
 				$venue = $this->_event->get_first_related('Venue');
140
-				if ( empty( $venue ) )
140
+				if (empty($venue))
141 141
 					return '';
142 142
 				return $venue->get('VNU_virtual_phone');
143 143
 				break;
144 144
 
145 145
 			case '[EVENT_IMAGE]' :
146
-				$image = $this->_event->feature_image_url(array(600,300) );
146
+				$image = $this->_event->feature_image_url(array(600, 300));
147 147
 				// @todo: eventually we should make this an attribute shortcode so that em can send along what size they want returned.
148
-				return ! empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '" />' : '';
148
+				return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'" />' : '';
149 149
 				break;
150 150
 
151 151
 			case '[EVENT_FACEBOOK_URL]' :
152
-				$facebook_url = $this->_event->get_post_meta('event_facebook', true );
153
-				return empty( $facebook_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : $facebook_url;
152
+				$facebook_url = $this->_event->get_post_meta('event_facebook', true);
153
+				return empty($facebook_url) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : $facebook_url;
154 154
 				break;
155 155
 
156 156
 			case '[EVENT_TWITTER_URL]' :
157 157
 				$twitter_url = $this->_event->get_post_meta('event_twitter', true);
158
-				return empty( $twitter_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : $twitter_url;
158
+				return empty($twitter_url) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : $twitter_url;
159 159
 				break;
160 160
 
161 161
 			case '[EVENT_AUTHOR_EMAIL]' :
162 162
 				$author_id = $this->_event->get('EVT_wp_user');
163
-				$user_data = get_userdata( (int) $author_id );
163
+				$user_data = get_userdata((int) $author_id);
164 164
 				return $user_data->user_email;
165 165
 				break;
166 166
 
167 167
 			case '[EVENT_TOTAL_SPOTS_TAKEN]' :
168
-				return EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true );
168
+				return EEM_Registration::instance()->count(array(array('EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true);
169 169
 				break;
170 170
 
171 171
 			case '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' :
@@ -175,49 +175,49 @@  discard block
 block discarded – undo
175 175
 						'page' => 'espresso_registrations',
176 176
 						'action' => 'default'
177 177
 					),
178
-					admin_url( 'admin.php' ),
178
+					admin_url('admin.php'),
179 179
 					true
180 180
 				);
181 181
 				break;
182 182
 		}
183 183
 
184
-		if ( strpos( $shortcode, '[EVENT_META_*' ) !== false ) {
185
-			$shortcode = str_replace( '[EVENT_META_*', '', $shortcode );
186
-			$shortcode = trim( str_replace( ']', '', $shortcode ) );
184
+		if (strpos($shortcode, '[EVENT_META_*') !== false) {
185
+			$shortcode = str_replace('[EVENT_META_*', '', $shortcode);
186
+			$shortcode = trim(str_replace(']', '', $shortcode));
187 187
 
188 188
 			//pull the meta value from the event post
189
-			$event_meta = $this->_event->get_post_meta( $shortcode, true );
189
+			$event_meta = $this->_event->get_post_meta($shortcode, true);
190 190
 
191
-			return ! empty( $event_meta ) ? $this->_event->get_post_meta( $shortcode, true ) : '';
191
+			return ! empty($event_meta) ? $this->_event->get_post_meta($shortcode, true) : '';
192 192
 
193 193
 		}
194 194
 
195
-		if ( strpos( $shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*' ) !== false ) {
196
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
197
-			$method = empty( $attrs['method'] ) ? 'current' : $attrs['method'];
195
+		if (strpos($shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*') !== false) {
196
+			$attrs = $this->_get_shortcode_attrs($shortcode);
197
+			$method = empty($attrs['method']) ? 'current' : $attrs['method'];
198 198
 			$method = $method === 'current';
199 199
 			$available = $this->_event->total_available_spaces($method);
200 200
 			return $available === EE_INF ? '&infin;' : $available;
201 201
 		}
202 202
 
203
-		if ( strpos( $shortcode, '[EVENT_IMAGE_*' ) !== false ) {
204
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
205
-			$width = empty( $attrs['width'] ) ? '' : ' width="' . $attrs['width'] . '"'; 
206
-			$height = empty( $attrs['height'] ) ? '' : ' height="'. $attrs['height'] .'"'; 
203
+		if (strpos($shortcode, '[EVENT_IMAGE_*') !== false) {
204
+			$attrs = $this->_get_shortcode_attrs($shortcode);
205
+			$width = empty($attrs['width']) ? '' : ' width="'.$attrs['width'].'"'; 
206
+			$height = empty($attrs['height']) ? '' : ' height="'.$attrs['height'].'"'; 
207 207
 
208 208
 			//Size may be set to a string such as 'tumbnail' or "width, height" eg - '200,200'
209
-			if ( ! empty( $attrs['size'] ) ) {
210
-				$size = explode( ',', $attrs['size'] );
211
-				if ( count($size) === 1 ) {
209
+			if ( ! empty($attrs['size'])) {
210
+				$size = explode(',', $attrs['size']);
211
+				if (count($size) === 1) {
212 212
 					$size = $size[0];
213 213
 				}
214 214
 			} else {
215 215
 				$size = 'thumbnail';
216 216
 			}
217 217
 
218
-			$image = $this->_event->feature_image_url( $size );
218
+			$image = $this->_event->feature_image_url($size);
219 219
 
220
-			return ! empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '"' . $width . $height . '/>' : '';
220
+			return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'"'.$width.$height.'/>' : '';
221 221
 		}
222 222
 
223 223
 		return '';
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 	 * @param  boolean $full_link if TRUE (default) we return the html for the name of the event linked to the event.  Otherwise we just return the url of the event.
231 231
 	 * @return string
232 232
 	 */
233
-	private function _get_event_link( $event, $full_link = TRUE ) {
233
+	private function _get_event_link($event, $full_link = TRUE) {
234 234
 		$url = get_permalink($event->ID());
235 235
 
236
-		return $full_link ? '<a href="' . $url . '">' . $event->get('EVT_name') . '</a>' : $url;
236
+		return $full_link ? '<a href="'.$url.'">'.$event->get('EVT_name').'</a>' : $url;
237 237
 	}
238 238
 
239 239
 
Please login to merge, or discard this patch.
core/EE_Base.core.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 	 *		@ return void
29 29
 	 */
30 30
 	public function __get($a) { return FALSE; }
31
-	public function __set($a,$b) { return FALSE; }
31
+	public function __set($a, $b) { return FALSE; }
32 32
 	public function __isset($a) { return FALSE; }
33 33
 	public function __unset($a) { return FALSE; }
34 34
 	public function __clone() { return FALSE; }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.