Completed
Branch FET-8394-RULES (a1b783)
by
unknown
69:09 queued 58:34
created
core/data_migration_scripts/EE_DMS_Core_4_6_0.dms.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 //unfortunately, this needs to be done upon INCLUSION of this file,
12 12
 //instead of construction, because it only gets constructed on first page load
13 13
 //(all other times it gets resurrected from a wordpress option)
14
-$stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*');
14
+$stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 foreach ($stages as $filepath) {
17 17
     $matches = array();
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         } elseif ( ! $version_string) {
75 75
 //			echo "no version string provided: $version_string";
76 76
             //no version string provided... this must be pre 4.3
77
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
77
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
78 78
         } else {
79 79
 //			echo "$version_string doesnt apply";
80 80
             return false;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     public function schema_changes_before_migration()
100 100
     {
101 101
         //relies on 4.1's EEH_Activation::create_table
102
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
102
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
103 103
         $table_name = 'esp_answer';
104 104
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
105 105
 					REG_ID INT UNSIGNED NOT NULL,
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
     public function add_default_admin_only_payments()
547 547
     {
548 548
         global $wpdb;
549
-        $table_name = $wpdb->prefix . "esp_payment_method";
549
+        $table_name = $wpdb->prefix."esp_payment_method";
550 550
         $user_id = EEH_Activation::get_default_creator_id();
551 551
         if ($this->_get_table_analysis()->tableExists($table_name)) {
552 552
             $SQL = "SELECT COUNT( * ) FROM $table_name";
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
                         $table_name,
586 586
                         $values,
587 587
                         array(
588
-                            '%s',//PMD_type
589
-                            '%s',//PMD_name
590
-                            '%s',//PMD_admin_name
591
-                            '%s',//PMD_admin_desc
592
-                            '%s',//PMD_slug
593
-                            '%d',//PMD_wp_user
594
-                            '%s',//PMD_scope
588
+                            '%s', //PMD_type
589
+                            '%s', //PMD_name
590
+                            '%s', //PMD_admin_name
591
+                            '%s', //PMD_admin_desc
592
+                            '%s', //PMD_slug
593
+                            '%d', //PMD_wp_user
594
+                            '%s', //PMD_scope
595 595
                         )
596 596
                     );
597 597
                     if ( ! $success) {
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
     public function insert_default_currencies()
615 615
     {
616 616
         global $wpdb;
617
-        $currency_table = $wpdb->prefix . "esp_currency";
617
+        $currency_table = $wpdb->prefix."esp_currency";
618 618
         if ($this->_get_table_analysis()->tableExists($currency_table)) {
619 619
             $SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
620 620
             $countries = $wpdb->get_var($SQL);
Please login to merge, or discard this patch.
Indentation   +269 added lines, -269 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 $stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 foreach ($stages as $filepath) {
17
-    $matches = array();
18
-    preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19
-    $class_to_filepath[$matches[1]] = $filepath;
17
+	$matches = array();
18
+	preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19
+	$class_to_filepath[$matches[1]] = $filepath;
20 20
 }
21 21
 //give addons a chance to autoload their stages too
22 22
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath);
@@ -35,69 +35,69 @@  discard block
 block discarded – undo
35 35
 class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base
36 36
 {
37 37
 
38
-    /**
39
-     * return EE_DMS_Core_4_6_0
40
-     *
41
-     * @param TableManager  $table_manager
42
-     * @param TableAnalysis $table_analysis
43
-     */
44
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
45
-    {
46
-        $this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso");
47
-        $this->_priority = 10;
48
-        $this->_migration_stages = array(
49
-            new EE_DMS_4_6_0_gateways(),
50
-            new EE_DMS_4_6_0_question_types(),
51
-            new EE_DMS_4_6_0_country_system_question(),
52
-            new EE_DMS_4_6_0_state_system_question(),
53
-            new EE_DMS_4_6_0_billing_info(),
54
-            new EE_DMS_4_6_0_transactions(),
55
-            new EE_DMS_4_6_0_payments(),
56
-            new EE_DMS_4_6_0_invoice_settings(),
57
-        );
58
-        parent::__construct($table_manager, $table_analysis);
59
-    }
60
-
61
-
62
-
63
-    /**
64
-     * @param array $version_array
65
-     * @return bool
66
-     */
67
-    public function can_migrate_from_version($version_array)
68
-    {
69
-        $version_string = $version_array['Core'];
70
-        if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) {
38
+	/**
39
+	 * return EE_DMS_Core_4_6_0
40
+	 *
41
+	 * @param TableManager  $table_manager
42
+	 * @param TableAnalysis $table_analysis
43
+	 */
44
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
45
+	{
46
+		$this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso");
47
+		$this->_priority = 10;
48
+		$this->_migration_stages = array(
49
+			new EE_DMS_4_6_0_gateways(),
50
+			new EE_DMS_4_6_0_question_types(),
51
+			new EE_DMS_4_6_0_country_system_question(),
52
+			new EE_DMS_4_6_0_state_system_question(),
53
+			new EE_DMS_4_6_0_billing_info(),
54
+			new EE_DMS_4_6_0_transactions(),
55
+			new EE_DMS_4_6_0_payments(),
56
+			new EE_DMS_4_6_0_invoice_settings(),
57
+		);
58
+		parent::__construct($table_manager, $table_analysis);
59
+	}
60
+
61
+
62
+
63
+	/**
64
+	 * @param array $version_array
65
+	 * @return bool
66
+	 */
67
+	public function can_migrate_from_version($version_array)
68
+	{
69
+		$version_string = $version_array['Core'];
70
+		if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) {
71 71
 //			echo "$version_string can be migrated from";
72
-            return true;
73
-        } elseif ( ! $version_string) {
72
+			return true;
73
+		} elseif ( ! $version_string) {
74 74
 //			echo "no version string provided: $version_string";
75
-            //no version string provided... this must be pre 4.3
76
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
77
-        } else {
75
+			//no version string provided... this must be pre 4.3
76
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
77
+		} else {
78 78
 //			echo "$version_string doesnt apply";
79
-            return false;
80
-        }
81
-    }
79
+			return false;
80
+		}
81
+	}
82 82
 
83 83
 
84 84
 
85
-    /**
86
-     * @return bool
87
-     */
88
-    public function schema_changes_before_migration()
89
-    {
90
-        //relies on 4.1's EEH_Activation::create_table
91
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
92
-        $table_name = 'esp_answer';
93
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
85
+	/**
86
+	 * @return bool
87
+	 */
88
+	public function schema_changes_before_migration()
89
+	{
90
+		//relies on 4.1's EEH_Activation::create_table
91
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
92
+		$table_name = 'esp_answer';
93
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
94 94
 					REG_ID INT UNSIGNED NOT NULL,
95 95
 					QST_ID INT UNSIGNED NOT NULL,
96 96
 					ANS_value TEXT NOT NULL,
97 97
 					PRIMARY KEY  (ANS_ID)";
98
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
99
-        $table_name = 'esp_attendee_meta';
100
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
98
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
99
+		$table_name = 'esp_attendee_meta';
100
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
101 101
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
102 102
 						ATT_fname VARCHAR(45) NOT NULL,
103 103
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 								KEY ATT_fname (ATT_fname),
114 114
 								KEY ATT_lname (ATT_lname),
115 115
 								KEY ATT_email (ATT_email)";
116
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
117
-        $table_name = 'esp_country';
118
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
116
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
117
+		$table_name = 'esp_country';
118
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
119 119
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
120 120
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
121 121
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -131,24 +131,24 @@  discard block
 block discarded – undo
131 131
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
132 132
 					  CNT_active TINYINT(1) DEFAULT '0',
133 133
 					  PRIMARY KEY  (CNT_ISO)";
134
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
135
-        $table_name = 'esp_currency';
136
-        $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
134
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
135
+		$table_name = 'esp_currency';
136
+		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
137 137
 				CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar',
138 138
 				CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars',
139 139
 				CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$',
140 140
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
141 141
 				CUR_active TINYINT(1) DEFAULT '0',
142 142
 				PRIMARY KEY  (CUR_code)";
143
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
144
-        $table_name = 'esp_currency_payment_method';
145
-        $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
143
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
144
+		$table_name = 'esp_currency_payment_method';
145
+		$sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
146 146
 				CUR_code  VARCHAR(6) COLLATE utf8_bin NOT NULL,
147 147
 				PMD_ID INT(11) NOT NULL,
148 148
 				PRIMARY KEY  (CPM_ID)";
149
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
150
-        $table_name = 'esp_datetime';
151
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
149
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
150
+		$table_name = 'esp_datetime';
151
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
152 152
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
153 153
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
154 154
 				  DTT_description TEXT NOT NULL,
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 						PRIMARY KEY  (DTT_ID),
164 164
 						KEY EVT_ID (EVT_ID),
165 165
 						KEY DTT_is_primary (DTT_is_primary)";
166
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
167
-        $table_name = 'esp_event_meta';
168
-        $sql = "
166
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
167
+		$table_name = 'esp_event_meta';
168
+		$sql = "
169 169
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
170 170
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
171 171
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -180,31 +180,31 @@  discard block
 block discarded – undo
180 180
 			EVT_external_URL VARCHAR(200) NULL,
181 181
 			EVT_donations TINYINT(1) NULL,
182 182
 			PRIMARY KEY  (EVTM_ID)";
183
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
184
-        $table_name = 'esp_event_question_group';
185
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
183
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
184
+		$table_name = 'esp_event_question_group';
185
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
186 186
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
187 187
 					QSG_ID INT UNSIGNED NOT NULL,
188 188
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
189 189
 					PRIMARY KEY  (EQG_ID)";
190
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
191
-        $table_name = 'esp_event_venue';
192
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
190
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
191
+		$table_name = 'esp_event_venue';
192
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
193 193
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
194 194
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
195 195
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
196 196
 				PRIMARY KEY  (EVV_ID)";
197
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
198
-        $table_name = 'esp_extra_meta';
199
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
197
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
198
+		$table_name = 'esp_extra_meta';
199
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
200 200
 				OBJ_ID INT(11) DEFAULT NULL,
201 201
 				EXM_type VARCHAR(45) DEFAULT NULL,
202 202
 				EXM_key VARCHAR(45) DEFAULT NULL,
203 203
 				EXM_value TEXT,
204 204
 				PRIMARY KEY  (EXM_ID)";
205
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
206
-        $table_name = 'esp_line_item';
207
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
205
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
206
+		$table_name = 'esp_line_item';
207
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
208 208
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
209 209
 				TXN_ID INT(11) DEFAULT NULL,
210 210
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 				OBJ_ID INT(11) DEFAULT NULL,
221 221
 				OBJ_type VARCHAR(45)DEFAULT NULL,
222 222
 				PRIMARY KEY  (LIN_ID)";
223
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
224
-        $table_name = 'esp_log';
225
-        $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
223
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
224
+		$table_name = 'esp_log';
225
+		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
226 226
 				LOG_time DATETIME DEFAULT NULL,
227 227
 				OBJ_ID VARCHAR(45) DEFAULT NULL,
228 228
 				OBJ_type VARCHAR(45) DEFAULT NULL,
@@ -230,19 +230,19 @@  discard block
 block discarded – undo
230 230
 				LOG_message TEXT,
231 231
 				LOG_wp_user INT(11) DEFAULT NULL,
232 232
 				PRIMARY KEY  (LOG_ID)";
233
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
234
-        $table_name = 'esp_message_template';
235
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
233
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
234
+		$table_name = 'esp_message_template';
235
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
236 236
 					GRP_ID INT(10) UNSIGNED NOT NULL,
237 237
 					MTP_context VARCHAR(50) NOT NULL,
238 238
 					MTP_template_field VARCHAR(30) NOT NULL,
239 239
 					MTP_content TEXT NOT NULL,
240 240
 					PRIMARY KEY  (MTP_ID),
241 241
 					KEY GRP_ID (GRP_ID)";
242
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
243
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
244
-        $table_name = 'esp_message_template_group';
245
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
242
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
243
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
244
+		$table_name = 'esp_message_template_group';
245
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
246 246
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
247 247
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
248 248
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
255 255
 					PRIMARY KEY  (GRP_ID),
256 256
 					KEY MTP_user_id (MTP_user_id)";
257
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
258
-        $table_name = 'esp_event_message_template';
259
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
257
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
258
+		$table_name = 'esp_event_message_template';
259
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
260 260
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
261 261
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
262 262
 					PRIMARY KEY  (EMT_ID),
263 263
 					KEY EVT_ID (EVT_ID),
264 264
 					KEY GRP_ID (GRP_ID)";
265
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
266
-        $table_name = 'esp_payment';
267
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
265
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
266
+		$table_name = 'esp_payment';
267
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
268 268
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
269 269
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
270 270
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
 					PRIMARY KEY  (PAY_ID),
282 282
 					KEY TXN_ID (TXN_ID),
283 283
 					KEY PAY_timestamp (PAY_timestamp)";
284
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
285
-        $table_name = 'esp_payment_method';
286
-        $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
284
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
285
+		$table_name = 'esp_payment_method';
286
+		$sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
287 287
 				PMD_type VARCHAR(124) DEFAULT NULL,
288 288
 				PMD_name VARCHAR(255) DEFAULT NULL,
289 289
 				PMD_desc TEXT,
@@ -298,28 +298,28 @@  discard block
 block discarded – undo
298 298
 				PMD_scope VARCHAR(255) NULL DEFAULT 'frontend',
299 299
 				PRIMARY KEY  (PMD_ID),
300 300
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug)";
301
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
302
-        $table_name = "esp_ticket_price";
303
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
301
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
302
+		$table_name = "esp_ticket_price";
303
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
304 304
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
305 305
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
306 306
 					  PRIMARY KEY  (TKP_ID)";
307
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
308
-        $table_name = "esp_datetime_ticket";
309
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
307
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
308
+		$table_name = "esp_datetime_ticket";
309
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
310 310
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
311 311
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
312 312
 					  PRIMARY KEY  (DTK_ID)";
313
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
314
-        $table_name = "esp_ticket_template";
315
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
313
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
314
+		$table_name = "esp_ticket_template";
315
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
316 316
 					  TTM_name VARCHAR(45) NOT NULL,
317 317
 					  TTM_description TEXT,
318 318
 					  TTM_file VARCHAR(45),
319 319
 					  PRIMARY KEY  (TTM_ID)";
320
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
321
-        $table_name = 'esp_question';
322
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
320
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
321
+		$table_name = 'esp_question';
322
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
323 323
 					QST_display_text TEXT NOT NULL,
324 324
 					QST_admin_label VARCHAR(255) NOT NULL,
325 325
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -331,25 +331,25 @@  discard block
 block discarded – undo
331 331
 					QST_wp_user BIGINT UNSIGNED NULL,
332 332
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
333 333
 					PRIMARY KEY  (QST_ID)';
334
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
335
-        $table_name = 'esp_question_group_question';
336
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
334
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
335
+		$table_name = 'esp_question_group_question';
336
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
337 337
 					QSG_ID INT UNSIGNED NOT NULL,
338 338
 					QST_ID INT UNSIGNED NOT NULL,
339 339
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
340 340
 					PRIMARY KEY  (QGQ_ID) ";
341
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
342
-        $table_name = 'esp_question_option';
343
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
341
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
342
+		$table_name = 'esp_question_option';
343
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
344 344
 					QSO_value VARCHAR(255) NOT NULL,
345 345
 					QSO_desc TEXT NOT NULL,
346 346
 					QST_ID INT UNSIGNED NOT NULL,
347 347
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
348 348
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
349 349
 					PRIMARY KEY  (QSO_ID)";
350
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
351
-        $table_name = 'esp_registration';
352
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
350
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
351
+		$table_name = 'esp_registration';
352
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
353 353
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
354 354
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
355 355
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -372,25 +372,25 @@  discard block
 block discarded – undo
372 372
 					  KEY STS_ID (STS_ID),
373 373
 					  KEY REG_url_link (REG_url_link),
374 374
 					  KEY REG_code (REG_code)";
375
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
376
-        $table_name = 'esp_checkin';
377
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
375
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
376
+		$table_name = 'esp_checkin';
377
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
378 378
 					REG_ID INT(10) UNSIGNED NOT NULL,
379 379
 					DTT_ID INT(10) UNSIGNED NOT NULL,
380 380
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
381 381
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
382 382
 					PRIMARY KEY  (CHK_ID)";
383
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
384
-        $table_name = 'esp_state';
385
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
383
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
384
+		$table_name = 'esp_state';
385
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
386 386
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
387 387
 					  STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL,
388 388
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
389 389
 					  STA_active TINYINT(1) DEFAULT '1',
390 390
 					  PRIMARY KEY  (STA_ID)";
391
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
392
-        $table_name = 'esp_status';
393
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
391
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
392
+		$table_name = 'esp_status';
393
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
394 394
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
395 395
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
396 396
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -398,9 +398,9 @@  discard block
 block discarded – undo
398 398
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
399 399
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
400 400
 					  KEY STS_type (STS_type)";
401
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
402
-        $table_name = 'esp_transaction';
403
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
401
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
402
+		$table_name = 'esp_transaction';
403
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
404 404
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
405 405
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
406 406
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -412,9 +412,9 @@  discard block
 block discarded – undo
412 412
 					  PRIMARY KEY  (TXN_ID),
413 413
 					  KEY TXN_timestamp (TXN_timestamp),
414 414
 					  KEY STS_ID (STS_ID)";
415
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
416
-        $table_name = 'esp_venue_meta';
417
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
415
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
416
+		$table_name = 'esp_venue_meta';
417
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
418 418
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
419 419
 			VNU_address VARCHAR(255) DEFAULT NULL,
420 420
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -432,10 +432,10 @@  discard block
 block discarded – undo
432 432
 			PRIMARY KEY  (VNUM_ID),
433 433
 			KEY STA_ID (STA_ID),
434 434
 			KEY CNT_ISO (CNT_ISO)";
435
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
436
-        //modified tables
437
-        $table_name = "esp_price";
438
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
435
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
436
+		//modified tables
437
+		$table_name = "esp_price";
438
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
439 439
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
440 440
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
441 441
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 					  PRC_wp_user BIGINT UNSIGNED NULL,
448 448
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
449 449
 					  PRIMARY KEY  (PRC_ID)";
450
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
451
-        $table_name = "esp_price_type";
452
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
450
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
451
+		$table_name = "esp_price_type";
452
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
453 453
 				  PRT_name VARCHAR(45) NOT NULL,
454 454
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
455 455
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
459 459
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
460 460
 				  PRIMARY KEY  (PRT_ID)";
461
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
462
-        $table_name = "esp_ticket";
463
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
461
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
462
+		$table_name = "esp_ticket";
463
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
464 464
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
465 465
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
466 466
 					  TKT_description TEXT NOT NULL,
@@ -481,10 +481,10 @@  discard block
 block discarded – undo
481 481
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
482 482
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
483 483
 					  PRIMARY KEY  (TKT_ID)";
484
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
485
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
486
-        $table_name = 'esp_question_group';
487
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
484
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
485
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
486
+		$table_name = 'esp_question_group';
487
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
488 488
 					QSG_name VARCHAR(255) NOT NULL,
489 489
 					QSG_identifier VARCHAR(100) NOT NULL,
490 490
 					QSG_desc TEXT NULL,
@@ -496,119 +496,119 @@  discard block
 block discarded – undo
496 496
 					QSG_wp_user BIGINT UNSIGNED NULL,
497 497
 					PRIMARY KEY  (QSG_ID),
498 498
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
499
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
500
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
501
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
502
-        //(because many need to convert old string states to foreign keys into the states table)
503
-        $script_4_1_defaults->insert_default_states();
504
-        $script_4_1_defaults->insert_default_countries();
505
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
506
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
507
-        $script_4_5_defaults->insert_default_price_types();
508
-        $script_4_5_defaults->insert_default_prices();
509
-        $script_4_5_defaults->insert_default_tickets();
510
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
511
-        EE_Config::instance()->update_espresso_config(false, true);
512
-        $this->add_default_admin_only_payments();
513
-        $this->insert_default_currencies();
514
-        return true;
515
-    }
516
-
517
-
518
-
519
-    /**
520
-     * @return boolean
521
-     */
522
-    public function schema_changes_after_migration()
523
-    {
524
-        return true;
525
-    }
526
-
527
-
528
-
529
-    public function migration_page_hooks()
530
-    {
531
-    }
532
-
533
-
534
-
535
-    public function add_default_admin_only_payments()
536
-    {
537
-        global $wpdb;
538
-        $table_name = $wpdb->prefix . "esp_payment_method";
539
-        $user_id = EEH_Activation::get_default_creator_id();
540
-        if ($this->_get_table_analysis()->tableExists($table_name)) {
541
-            $SQL = "SELECT COUNT( * ) FROM $table_name";
542
-            $existing_payment_methods = $wpdb->get_var($SQL);
543
-            $default_admin_only_payment_methods = apply_filters(
544
-                'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
545
-                array(
546
-                    __("Bank", 'event_espresso')        => __("Bank Draft", 'event_espresso'),
547
-                    __("Cash", 'event_espresso')        => __("Cash Delivered Physically", 'event_espresso'),
548
-                    __("Check", 'event_espresso')       => __("Paper Check", 'event_espresso'),
549
-                    __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'),
550
-                    __("Debit Card", 'event_espresso')  => __("Offline Debit Payment", 'event_espresso'),
551
-                    __("Invoice", 'event_espresso')     => __("Invoice received with monies included",
552
-                        'event_espresso'),
553
-                    __("Money Order", 'event_espresso') => '',
554
-                    __("Paypal", 'event_espresso')      => __("Paypal eCheck, Invoice, etc", 'event_espresso'),
555
-                    __('Other', 'event_espresso')       => __('Other method of payment', 'event_espresso'),
556
-                ));
557
-            //make sure we hae payment method records for the following
558
-            //so admins can record payments for them from the admin page
559
-            foreach ($default_admin_only_payment_methods as $nicename => $description) {
560
-                $slug = sanitize_key($nicename);
561
-                //check that such a payment method exists
562
-                $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
563
-                if ( ! $exists) {
564
-                    $values = array(
565
-                        'PMD_type'       => 'Admin_Only',
566
-                        'PMD_name'       => $nicename,
567
-                        'PMD_admin_name' => $nicename,
568
-                        'PMD_admin_desc' => $description,
569
-                        'PMD_slug'       => $slug,
570
-                        'PMD_wp_user'    => $user_id,
571
-                        'PMD_scope'      => serialize(array('ADMIN')),
572
-                    );
573
-                    $success = $wpdb->insert(
574
-                        $table_name,
575
-                        $values,
576
-                        array(
577
-                            '%s',//PMD_type
578
-                            '%s',//PMD_name
579
-                            '%s',//PMD_admin_name
580
-                            '%s',//PMD_admin_desc
581
-                            '%s',//PMD_slug
582
-                            '%d',//PMD_wp_user
583
-                            '%s',//PMD_scope
584
-                        )
585
-                    );
586
-                    if ( ! $success) {
587
-                        $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration",
588
-                            "event_espresso"), $this->_json_encode($values)));
589
-                    }
590
-                }
591
-            }
592
-        }
593
-    }
594
-
595
-
596
-
597
-    /**
598
-     * insert_default_countries
599
-     *
600
-     * @static
601
-     * @return void
602
-     */
603
-    public function insert_default_currencies()
604
-    {
605
-        global $wpdb;
606
-        $currency_table = $wpdb->prefix . "esp_currency";
607
-        if ($this->_get_table_analysis()->tableExists($currency_table)) {
608
-            $SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
609
-            $countries = $wpdb->get_var($SQL);
610
-            if ( ! $countries) {
611
-                $SQL = "INSERT INTO $currency_table
499
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
500
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
501
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
502
+		//(because many need to convert old string states to foreign keys into the states table)
503
+		$script_4_1_defaults->insert_default_states();
504
+		$script_4_1_defaults->insert_default_countries();
505
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
506
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
507
+		$script_4_5_defaults->insert_default_price_types();
508
+		$script_4_5_defaults->insert_default_prices();
509
+		$script_4_5_defaults->insert_default_tickets();
510
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
511
+		EE_Config::instance()->update_espresso_config(false, true);
512
+		$this->add_default_admin_only_payments();
513
+		$this->insert_default_currencies();
514
+		return true;
515
+	}
516
+
517
+
518
+
519
+	/**
520
+	 * @return boolean
521
+	 */
522
+	public function schema_changes_after_migration()
523
+	{
524
+		return true;
525
+	}
526
+
527
+
528
+
529
+	public function migration_page_hooks()
530
+	{
531
+	}
532
+
533
+
534
+
535
+	public function add_default_admin_only_payments()
536
+	{
537
+		global $wpdb;
538
+		$table_name = $wpdb->prefix . "esp_payment_method";
539
+		$user_id = EEH_Activation::get_default_creator_id();
540
+		if ($this->_get_table_analysis()->tableExists($table_name)) {
541
+			$SQL = "SELECT COUNT( * ) FROM $table_name";
542
+			$existing_payment_methods = $wpdb->get_var($SQL);
543
+			$default_admin_only_payment_methods = apply_filters(
544
+				'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
545
+				array(
546
+					__("Bank", 'event_espresso')        => __("Bank Draft", 'event_espresso'),
547
+					__("Cash", 'event_espresso')        => __("Cash Delivered Physically", 'event_espresso'),
548
+					__("Check", 'event_espresso')       => __("Paper Check", 'event_espresso'),
549
+					__("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'),
550
+					__("Debit Card", 'event_espresso')  => __("Offline Debit Payment", 'event_espresso'),
551
+					__("Invoice", 'event_espresso')     => __("Invoice received with monies included",
552
+						'event_espresso'),
553
+					__("Money Order", 'event_espresso') => '',
554
+					__("Paypal", 'event_espresso')      => __("Paypal eCheck, Invoice, etc", 'event_espresso'),
555
+					__('Other', 'event_espresso')       => __('Other method of payment', 'event_espresso'),
556
+				));
557
+			//make sure we hae payment method records for the following
558
+			//so admins can record payments for them from the admin page
559
+			foreach ($default_admin_only_payment_methods as $nicename => $description) {
560
+				$slug = sanitize_key($nicename);
561
+				//check that such a payment method exists
562
+				$exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
563
+				if ( ! $exists) {
564
+					$values = array(
565
+						'PMD_type'       => 'Admin_Only',
566
+						'PMD_name'       => $nicename,
567
+						'PMD_admin_name' => $nicename,
568
+						'PMD_admin_desc' => $description,
569
+						'PMD_slug'       => $slug,
570
+						'PMD_wp_user'    => $user_id,
571
+						'PMD_scope'      => serialize(array('ADMIN')),
572
+					);
573
+					$success = $wpdb->insert(
574
+						$table_name,
575
+						$values,
576
+						array(
577
+							'%s',//PMD_type
578
+							'%s',//PMD_name
579
+							'%s',//PMD_admin_name
580
+							'%s',//PMD_admin_desc
581
+							'%s',//PMD_slug
582
+							'%d',//PMD_wp_user
583
+							'%s',//PMD_scope
584
+						)
585
+					);
586
+					if ( ! $success) {
587
+						$this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration",
588
+							"event_espresso"), $this->_json_encode($values)));
589
+					}
590
+				}
591
+			}
592
+		}
593
+	}
594
+
595
+
596
+
597
+	/**
598
+	 * insert_default_countries
599
+	 *
600
+	 * @static
601
+	 * @return void
602
+	 */
603
+	public function insert_default_currencies()
604
+	{
605
+		global $wpdb;
606
+		$currency_table = $wpdb->prefix . "esp_currency";
607
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
608
+			$SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
609
+			$countries = $wpdb->get_var($SQL);
610
+			if ( ! $countries) {
611
+				$SQL = "INSERT INTO $currency_table
612 612
 				( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES
613 613
 				( 'EUR',  'Euro',  'Euros',  '€',  2,1),
614 614
 				( 'AED',  'Dirham',  'Dirhams', 'د.إ',2,1),
@@ -762,10 +762,10 @@  discard block
 block discarded – undo
762 762
 				( 'ZAR',  'Rand',  'Rands',  'R',  2,1),
763 763
 				( 'ZMK',  'Kwacha',  'Kwachas',  '',  2,1),
764 764
 				( 'ZWD', 'Dollar', 'Dollars', 'Z$', 2,1);";
765
-                $wpdb->query($SQL);
766
-            }
767
-        }
768
-    }
765
+				$wpdb->query($SQL);
766
+			}
767
+		}
768
+	}
769 769
 
770 770
 }
771 771
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_8_0.dms.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 //unfortunately, this needs to be done upon INCLUSION of this file,
15 15
 //instead of construction, because it only gets constructed on first page load
16 16
 //(all other times it gets resurrected from a wordpress option)
17
-$stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*');
17
+$stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*');
18 18
 $class_to_filepath = array();
19 19
 foreach ($stages as $filepath) {
20 20
     $matches = array();
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         } elseif ( ! $version_string) {
76 76
 //			echo "no version string provided: $version_string";
77 77
             //no version string provided... this must be pre 4.3
78
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
78
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
79 79
         } else {
80 80
 //			echo "$version_string doesnt apply";
81 81
             return false;
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function schema_changes_before_migration()
101 101
     {
102
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
102
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
103 103
         $now_in_mysql = current_time('mysql', true);
104
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
104
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
105 105
         $table_name = 'esp_answer';
106 106
         $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
107 107
 					REG_ID int(10) unsigned NOT NULL,
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
             ),
698 698
         );
699 699
         global $wpdb;
700
-        $country_table = $wpdb->prefix . "esp_country";
700
+        $country_table = $wpdb->prefix."esp_country";
701 701
         $country_format = array(
702 702
             "CNT_ISO"         => '%s',
703 703
             "CNT_ISO3"        => '%s',
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
             array('RSD', 'Dinar', 'Dinars', '', 3, 1),
744 744
         );
745 745
         global $wpdb;
746
-        $currency_table = $wpdb->prefix . "esp_currency";
746
+        $currency_table = $wpdb->prefix."esp_currency";
747 747
         $currency_format = array(
748 748
             "CUR_code"    => '%s',
749 749
             "CUR_single"  => '%s',
Please login to merge, or discard this patch.
Indentation   +355 added lines, -355 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 $stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*');
18 18
 $class_to_filepath = array();
19 19
 foreach ($stages as $filepath) {
20
-    $matches = array();
21
-    preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22
-    $class_to_filepath[$matches[1]] = $filepath;
20
+	$matches = array();
21
+	preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22
+	$class_to_filepath[$matches[1]] = $filepath;
23 23
 }
24 24
 //give addons a chance to autoload their stages too
25 25
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath);
@@ -38,71 +38,71 @@  discard block
 block discarded – undo
38 38
 class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base
39 39
 {
40 40
 
41
-    /**
42
-     * return EE_DMS_Core_4_8_0
43
-     *
44
-     * @param TableManager  $table_manager
45
-     * @param TableAnalysis $table_analysis
46
-     */
47
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
48
-    {
49
-        $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso");
50
-        $this->_priority = 10;
51
-        $this->_migration_stages = array(
52
-            new EE_DMS_4_8_0_pretax_totals(),
53
-            new EE_DMS_4_8_0_event_subtotals(),
54
-        );
55
-        parent::__construct($table_manager, $table_analysis);
56
-    }
41
+	/**
42
+	 * return EE_DMS_Core_4_8_0
43
+	 *
44
+	 * @param TableManager  $table_manager
45
+	 * @param TableAnalysis $table_analysis
46
+	 */
47
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
48
+	{
49
+		$this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso");
50
+		$this->_priority = 10;
51
+		$this->_migration_stages = array(
52
+			new EE_DMS_4_8_0_pretax_totals(),
53
+			new EE_DMS_4_8_0_event_subtotals(),
54
+		);
55
+		parent::__construct($table_manager, $table_analysis);
56
+	}
57 57
 
58 58
 
59 59
 
60
-    /**
61
-     * Because this is being done at basically the same time as the MER-ready branch
62
-     * of core, it's possible people might have installed MEr-ready branch first,
63
-     * and then this one, in which case we still want to perform this migration,
64
-     * even though the version might not have increased
65
-     *
66
-     * @param array $version_array
67
-     * @return bool
68
-     */
69
-    public function can_migrate_from_version($version_array)
70
-    {
71
-        $version_string = $version_array['Core'];
72
-        if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) {
60
+	/**
61
+	 * Because this is being done at basically the same time as the MER-ready branch
62
+	 * of core, it's possible people might have installed MEr-ready branch first,
63
+	 * and then this one, in which case we still want to perform this migration,
64
+	 * even though the version might not have increased
65
+	 *
66
+	 * @param array $version_array
67
+	 * @return bool
68
+	 */
69
+	public function can_migrate_from_version($version_array)
70
+	{
71
+		$version_string = $version_array['Core'];
72
+		if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) {
73 73
 //			echo "$version_string can be migrated from";
74
-            return true;
75
-        } elseif ( ! $version_string) {
74
+			return true;
75
+		} elseif ( ! $version_string) {
76 76
 //			echo "no version string provided: $version_string";
77
-            //no version string provided... this must be pre 4.3
78
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
79
-        } else {
77
+			//no version string provided... this must be pre 4.3
78
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
79
+		} else {
80 80
 //			echo "$version_string doesnt apply";
81
-            return false;
82
-        }
83
-    }
81
+			return false;
82
+		}
83
+	}
84 84
 
85 85
 
86 86
 
87
-    /**
88
-     * @return bool
89
-     */
90
-    public function schema_changes_before_migration()
91
-    {
92
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
-        $now_in_mysql = current_time('mysql', true);
94
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
95
-        $table_name = 'esp_answer';
96
-        $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
87
+	/**
88
+	 * @return bool
89
+	 */
90
+	public function schema_changes_before_migration()
91
+	{
92
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
+		$now_in_mysql = current_time('mysql', true);
94
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
95
+		$table_name = 'esp_answer';
96
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
97 97
 					REG_ID int(10) unsigned NOT NULL,
98 98
 					QST_ID int(10) unsigned NOT NULL,
99 99
 					ANS_value text NOT NULL,
100 100
 					PRIMARY KEY  (ANS_ID),
101 101
 					KEY REG_ID (REG_ID),
102 102
 					KEY QST_ID (QST_ID)";
103
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
104
-        $table_name = 'esp_attendee_meta';
105
-        $sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
103
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
104
+		$table_name = 'esp_attendee_meta';
105
+		$sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
106 106
 						ATT_ID bigint(20) unsigned NOT NULL,
107 107
 						ATT_fname varchar(45) NOT NULL,
108 108
 						ATT_lname varchar(45) NOT	NULL,
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 								KEY ATT_email (ATT_email),
120 120
 								KEY ATT_lname (ATT_lname),
121 121
 								KEY ATT_fname (ATT_fname)";
122
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
123
-        $table_name = 'esp_country';
124
-        $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL,
122
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
123
+		$table_name = 'esp_country';
124
+		$sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL,
125 125
 					  CNT_ISO3 varchar(3) collate utf8_bin NOT NULL,
126 126
 					  RGN_ID tinyint(3) unsigned DEFAULT NULL,
127 127
 					  CNT_name varchar(45) collate utf8_bin NOT NULL,
@@ -137,25 +137,25 @@  discard block
 block discarded – undo
137 137
 					  CNT_is_EU tinyint(1) DEFAULT '0',
138 138
 					  CNT_active tinyint(1) DEFAULT '0',
139 139
 					  PRIMARY KEY  (CNT_ISO)";
140
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
141
-        $table_name = 'esp_currency';
142
-        $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
140
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
141
+		$table_name = 'esp_currency';
142
+		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
143 143
 				CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar',
144 144
 				CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars',
145 145
 				CUR_sign varchar(45) collate utf8_bin DEFAULT '$',
146 146
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
147 147
 				CUR_active tinyint(1) DEFAULT '0',
148 148
 				PRIMARY KEY  (CUR_code)";
149
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
150
-        $table_name = 'esp_currency_payment_method';
151
-        $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
149
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
150
+		$table_name = 'esp_currency_payment_method';
151
+		$sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
152 152
 				CUR_code varchar(6) collate utf8_bin NOT NULL,
153 153
 				PMD_ID int(11) NOT NULL,
154 154
 				PRIMARY KEY  (CPM_ID),
155 155
 				KEY PMD_ID (PMD_ID)";
156
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
157
-        $table_name = 'esp_datetime';
158
-        $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
156
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
157
+		$table_name = 'esp_datetime';
158
+		$sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
159 159
 				  EVT_ID bigint(20) unsigned NOT NULL,
160 160
 				  DTT_name varchar(255) NOT NULL DEFAULT '',
161 161
 				  DTT_description text NOT NULL,
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 						KEY DTT_EVT_start (DTT_EVT_start),
172 172
 						KEY EVT_ID (EVT_ID),
173 173
 						KEY DTT_is_primary (DTT_is_primary)";
174
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
175
-        $table_name = 'esp_event_meta';
176
-        $sql = "
174
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
175
+		$table_name = 'esp_event_meta';
176
+		$sql = "
177 177
 			EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
178 178
 			EVT_ID bigint(20) unsigned NOT NULL,
179 179
 			EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -189,34 +189,34 @@  discard block
 block discarded – undo
189 189
 			EVT_donations tinyint(1) NULL,
190 190
 			PRIMARY KEY  (EVTM_ID),
191 191
 			KEY EVT_ID (EVT_ID)";
192
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
193
-        $table_name = 'esp_event_question_group';
194
-        $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
192
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
193
+		$table_name = 'esp_event_question_group';
194
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
195 195
 					EVT_ID bigint(20) unsigned NOT NULL,
196 196
 					QSG_ID int(10) unsigned NOT NULL,
197 197
 					EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
198 198
 					PRIMARY KEY  (EQG_ID),
199 199
 					KEY EVT_ID (EVT_ID),
200 200
 					KEY QSG_ID (QSG_ID)";
201
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
202
-        $table_name = 'esp_event_venue';
203
-        $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
201
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
202
+		$table_name = 'esp_event_venue';
203
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
204 204
 				EVT_ID bigint(20) unsigned NOT NULL,
205 205
 				VNU_ID bigint(20) unsigned NOT NULL,
206 206
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
207 207
 				PRIMARY KEY  (EVV_ID)";
208
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209
-        $table_name = 'esp_extra_meta';
210
-        $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
208
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209
+		$table_name = 'esp_extra_meta';
210
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
211 211
 				OBJ_ID int(11) DEFAULT NULL,
212 212
 				EXM_type varchar(45) DEFAULT NULL,
213 213
 				EXM_key varchar(45) DEFAULT NULL,
214 214
 				EXM_value text,
215 215
 				PRIMARY KEY  (EXM_ID),
216 216
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
217
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
218
-        $table_name = 'esp_extra_join';
219
-        $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
217
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
218
+		$table_name = 'esp_extra_join';
219
+		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
220 220
 				EXJ_first_model_id varchar(6) NOT NULL,
221 221
 				EXJ_first_model_name varchar(20) NOT NULL,
222 222
 				EXJ_second_model_id varchar(6) NOT NULL,
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 				PRIMARY KEY  (EXJ_ID),
225 225
 				KEY first_model (EXJ_first_model_name,EXJ_first_model_id),
226 226
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
227
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
228
-        $table_name = 'esp_line_item';
229
-        $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
227
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
228
+		$table_name = 'esp_line_item';
229
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
230 230
 				LIN_code varchar(245) NOT NULL DEFAULT '',
231 231
 				TXN_ID int(11) DEFAULT NULL,
232 232
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 				PRIMARY KEY  (LIN_ID),
246 246
 				KEY LIN_code (LIN_code(191)),
247 247
 				KEY TXN_ID (TXN_ID)";
248
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
249
-        $table_name = 'esp_log';
250
-        $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
248
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
249
+		$table_name = 'esp_log';
250
+		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
251 251
 				LOG_time datetime DEFAULT NULL,
252 252
 				OBJ_ID varchar(45) DEFAULT NULL,
253 253
 				OBJ_type varchar(45) DEFAULT NULL,
@@ -258,18 +258,18 @@  discard block
 block discarded – undo
258 258
 				KEY LOG_time (LOG_time),
259 259
 				KEY OBJ (OBJ_type,OBJ_ID),
260 260
 				KEY LOG_type (LOG_type)";
261
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
262
-        $table_name = 'esp_message_template';
263
-        $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
261
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
262
+		$table_name = 'esp_message_template';
263
+		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
264 264
 					GRP_ID int(10) unsigned NOT NULL,
265 265
 					MTP_context varchar(50) NOT NULL,
266 266
 					MTP_template_field varchar(30) NOT NULL,
267 267
 					MTP_content text NOT NULL,
268 268
 					PRIMARY KEY  (MTP_ID),
269 269
 					KEY GRP_ID (GRP_ID)";
270
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
271
-        $table_name = 'esp_message_template_group';
272
-        $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
270
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
271
+		$table_name = 'esp_message_template_group';
272
+		$sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
273 273
 					MTP_user_id int(10) NOT NULL DEFAULT '1',
274 274
 					MTP_name varchar(245) NOT NULL DEFAULT '',
275 275
 					MTP_description varchar(245) NOT NULL DEFAULT '',
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
 					MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
282 282
 					PRIMARY KEY  (GRP_ID),
283 283
 					KEY MTP_user_id (MTP_user_id)";
284
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
285
-        $table_name = 'esp_event_message_template';
286
-        $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
284
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
285
+		$table_name = 'esp_event_message_template';
286
+		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
287 287
 					EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0,
288 288
 					GRP_ID int(10) unsigned NOT NULL DEFAULT 0,
289 289
 					PRIMARY KEY  (EMT_ID),
290 290
 					KEY EVT_ID (EVT_ID),
291 291
 					KEY GRP_ID (GRP_ID)";
292
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
293
-        $table_name = 'esp_payment';
294
-        $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
292
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
293
+		$table_name = 'esp_payment';
294
+		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
295 295
 					TXN_ID int(10) unsigned DEFAULT NULL,
296 296
 					STS_ID varchar(3) collate utf8_bin DEFAULT NULL,
297 297
 					PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
 					PRIMARY KEY  (PAY_ID),
309 309
 					KEY PAY_timestamp (PAY_timestamp),
310 310
 					KEY TXN_ID (TXN_ID)";
311
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
312
-        $table_name = 'esp_payment_method';
313
-        $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
311
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
312
+		$table_name = 'esp_payment_method';
313
+		$sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
314 314
 				PMD_type varchar(124) DEFAULT NULL,
315 315
 				PMD_name varchar(255) DEFAULT NULL,
316 316
 				PMD_desc text,
@@ -326,32 +326,32 @@  discard block
 block discarded – undo
326 326
 				PRIMARY KEY  (PMD_ID),
327 327
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
328 328
 				KEY PMD_type (PMD_type)";
329
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
330
-        $table_name = "esp_ticket_price";
331
-        $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
329
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
330
+		$table_name = "esp_ticket_price";
331
+		$sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
332 332
 					  TKT_ID int(10) unsigned NOT NULL,
333 333
 					  PRC_ID int(10) unsigned NOT NULL,
334 334
 					  PRIMARY KEY  (TKP_ID),
335 335
 					  KEY TKT_ID (TKT_ID),
336 336
 					  KEY PRC_ID (PRC_ID)";
337
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
338
-        $table_name = "esp_datetime_ticket";
339
-        $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
337
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
338
+		$table_name = "esp_datetime_ticket";
339
+		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
340 340
 					  DTT_ID int(10) unsigned NOT NULL,
341 341
 					  TKT_ID int(10) unsigned NOT NULL,
342 342
 					  PRIMARY KEY  (DTK_ID),
343 343
 					  KEY DTT_ID (DTT_ID),
344 344
 					  KEY TKT_ID (TKT_ID)";
345
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
346
-        $table_name = "esp_ticket_template";
347
-        $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
345
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
346
+		$table_name = "esp_ticket_template";
347
+		$sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
348 348
 					  TTM_name varchar(45) NOT NULL,
349 349
 					  TTM_description text,
350 350
 					  TTM_file varchar(45),
351 351
 					  PRIMARY KEY  (TTM_ID)";
352
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
353
-        $table_name = 'esp_question';
354
-        $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
352
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
353
+		$table_name = 'esp_question';
354
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
355 355
 					QST_display_text text NOT NULL,
356 356
 					QST_admin_label varchar(255) NOT NULL,
357 357
 					QST_system varchar(25) NOT NULL DEFAULT "",
@@ -365,18 +365,18 @@  discard block
 block discarded – undo
365 365
 					QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
366 366
 					PRIMARY KEY  (QST_ID),
367 367
 					KEY QST_order (QST_order)';
368
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
369
-        $table_name = 'esp_question_group_question';
370
-        $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
368
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
369
+		$table_name = 'esp_question_group_question';
370
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
371 371
 					QSG_ID int(10) unsigned NOT NULL,
372 372
 					QST_ID int(10) unsigned NOT NULL,
373 373
 					QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
374 374
 					PRIMARY KEY  (QGQ_ID),
375 375
 					KEY QST_ID (QST_ID),
376 376
 					KEY QSG_ID_order (QSG_ID,QGQ_order)";
377
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
378
-        $table_name = 'esp_question_option';
379
-        $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
377
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
378
+		$table_name = 'esp_question_option';
379
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
380 380
 					QSO_value varchar(255) NOT NULL,
381 381
 					QSO_desc text NOT NULL,
382 382
 					QST_ID int(10) unsigned NOT NULL,
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 					PRIMARY KEY  (QSO_ID),
387 387
 					KEY QST_ID (QST_ID),
388 388
 					KEY QSO_order (QSO_order)";
389
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
390
-        $table_name = 'esp_registration';
391
-        $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
389
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
390
+		$table_name = 'esp_registration';
391
+		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
392 392
 					  EVT_ID bigint(20) unsigned NOT NULL,
393 393
 					  ATT_ID bigint(20) unsigned NOT NULL,
394 394
 					  TXN_ID int(10) unsigned NOT NULL,
@@ -412,18 +412,18 @@  discard block
 block discarded – undo
412 412
 					  KEY TKT_ID (TKT_ID),
413 413
 					  KEY EVT_ID (EVT_ID),
414 414
 					  KEY STS_ID (STS_ID)";
415
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
416
-        $table_name = 'esp_registration_payment';
417
-        $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
415
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
416
+		$table_name = 'esp_registration_payment';
417
+		$sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
418 418
 					  REG_ID int(10) unsigned NOT NULL,
419 419
 					  PAY_ID int(10) unsigned NULL,
420 420
 					  RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00',
421 421
 					  PRIMARY KEY  (RPY_ID),
422 422
 					  KEY REG_ID (REG_ID),
423 423
 					  KEY PAY_ID (PAY_ID)";
424
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
425
-        $table_name = 'esp_checkin';
426
-        $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
424
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
425
+		$table_name = 'esp_checkin';
426
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
427 427
 					REG_ID int(10) unsigned NOT NULL,
428 428
 					DTT_ID int(10) unsigned NOT NULL,
429 429
 					CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
 					PRIMARY KEY  (CHK_ID),
432 432
 					KEY REG_ID (REG_ID),
433 433
 					KEY DTT_ID (DTT_ID)";
434
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
435
-        $table_name = 'esp_state';
436
-        $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
434
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
435
+		$table_name = 'esp_state';
436
+		$sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
437 437
 					  CNT_ISO varchar(2) collate utf8_bin NOT NULL,
438 438
 					  STA_abbrev varchar(24) collate utf8_bin NOT NULL,
439 439
 					  STA_name varchar(100) collate utf8_bin NOT NULL,
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 					  PRIMARY KEY  (STA_ID),
442 442
 					  KEY STA_abbrev (STA_abbrev),
443 443
 					  KEY CNT_ISO (CNT_ISO)";
444
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
445
-        $table_name = 'esp_status';
446
-        $sql = "STS_ID varchar(3) NOT NULL,
444
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
445
+		$table_name = 'esp_status';
446
+		$sql = "STS_ID varchar(3) NOT NULL,
447 447
 					  STS_code varchar(45) NOT NULL,
448 448
 					  STS_type varchar(45) NOT NULL,
449 449
 					  STS_can_edit tinyint(1) NOT NULL DEFAULT 0,
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
 					  STS_open tinyint(1) NOT NULL DEFAULT 1,
452 452
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
453 453
 					  KEY STS_type (STS_type)";
454
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
455
-        $table_name = 'esp_transaction';
456
-        $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
454
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
455
+		$table_name = 'esp_transaction';
456
+		$sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
457 457
 					  TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
458 458
 					  TXN_total decimal(10,3) DEFAULT '0.00',
459 459
 					  TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00',
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 					  PRIMARY KEY  (TXN_ID),
466 466
 					  KEY TXN_timestamp (TXN_timestamp),
467 467
 					  KEY STS_ID (STS_ID)";
468
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
469
-        $table_name = 'esp_venue_meta';
470
-        $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
468
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
469
+		$table_name = 'esp_venue_meta';
470
+		$sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
471 471
 			VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0,
472 472
 			VNU_address varchar(255) DEFAULT NULL,
473 473
 			VNU_address2 varchar(255) DEFAULT NULL,
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 			KEY VNU_ID (VNU_ID),
487 487
 			KEY STA_ID (STA_ID),
488 488
 			KEY CNT_ISO (CNT_ISO)";
489
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
490
-        //modified tables
491
-        $table_name = "esp_price";
492
-        $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
489
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
490
+		//modified tables
491
+		$table_name = "esp_price";
492
+		$sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
493 493
 					  PRT_ID tinyint(3) unsigned NOT NULL,
494 494
 					  PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00',
495 495
 					  PRC_name varchar(245) NOT NULL,
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 					  PRC_parent int(10) unsigned DEFAULT 0,
503 503
 					  PRIMARY KEY  (PRC_ID),
504 504
 					  KEY PRT_ID (PRT_ID)";
505
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
506
-        $table_name = "esp_price_type";
507
-        $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
505
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
506
+		$table_name = "esp_price_type";
507
+		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
508 508
 				  PRT_name varchar(45) NOT NULL,
509 509
 				  PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1',
510 510
 				  PRT_is_percent tinyint(1) NOT NULL DEFAULT '0',
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 				  PRT_deleted tinyint(1) NOT NULL DEFAULT '0',
514 514
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
515 515
 				  PRIMARY KEY  (PRT_ID)";
516
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
517
-        $table_name = "esp_ticket";
518
-        $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
516
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
517
+		$table_name = "esp_ticket";
518
+		$sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
519 519
 					  TTM_ID int(10) unsigned NOT NULL,
520 520
 					  TKT_name varchar(245) NOT NULL DEFAULT '',
521 521
 					  TKT_description text NOT NULL,
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
 					  TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
538 538
 					  PRIMARY KEY  (TKT_ID),
539 539
 					  KEY TKT_start_date (TKT_start_date)";
540
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
541
-        $table_name = 'esp_question_group';
542
-        $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
540
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
541
+		$table_name = 'esp_question_group';
542
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
543 543
 					QSG_name varchar(255) NOT NULL,
544 544
 					QSG_identifier varchar(100) NOT NULL,
545 545
 					QSG_desc text NULL,
@@ -552,221 +552,221 @@  discard block
 block discarded – undo
552 552
 					PRIMARY KEY  (QSG_ID),
553 553
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
554 554
 					KEY QSG_order (QSG_order)';
555
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
556
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
557
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
558
-        //(because many need to convert old string states to foreign keys into the states table)
559
-        $script_4_1_defaults->insert_default_states();
560
-        $script_4_1_defaults->insert_default_countries();
561
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
562
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
563
-        $script_4_5_defaults->insert_default_price_types();
564
-        $script_4_5_defaults->insert_default_prices();
565
-        $script_4_5_defaults->insert_default_tickets();
566
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
567
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
568
-        $script_4_6_defaults->add_default_admin_only_payments();
569
-        $script_4_6_defaults->insert_default_currencies();
570
-        $this->verify_new_countries();
571
-        $this->verify_new_currencies();
572
-        return true;
573
-    }
555
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
556
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
557
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
558
+		//(because many need to convert old string states to foreign keys into the states table)
559
+		$script_4_1_defaults->insert_default_states();
560
+		$script_4_1_defaults->insert_default_countries();
561
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
562
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
563
+		$script_4_5_defaults->insert_default_price_types();
564
+		$script_4_5_defaults->insert_default_prices();
565
+		$script_4_5_defaults->insert_default_tickets();
566
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
567
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
568
+		$script_4_6_defaults->add_default_admin_only_payments();
569
+		$script_4_6_defaults->insert_default_currencies();
570
+		$this->verify_new_countries();
571
+		$this->verify_new_currencies();
572
+		return true;
573
+	}
574 574
 
575 575
 
576 576
 
577
-    /**
578
-     * @return boolean
579
-     */
580
-    public function schema_changes_after_migration()
581
-    {
582
-        $this->fix_non_default_taxes();
583
-        //this is actually the same as the last DMS
584
-        /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */
585
-        $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0');
586
-        return $script_4_7_defaults->schema_changes_after_migration();
587
-    }
577
+	/**
578
+	 * @return boolean
579
+	 */
580
+	public function schema_changes_after_migration()
581
+	{
582
+		$this->fix_non_default_taxes();
583
+		//this is actually the same as the last DMS
584
+		/** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */
585
+		$script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0');
586
+		return $script_4_7_defaults->schema_changes_after_migration();
587
+	}
588 588
 
589 589
 
590 590
 
591
-    public function migration_page_hooks()
592
-    {
593
-    }
591
+	public function migration_page_hooks()
592
+	{
593
+	}
594 594
 
595 595
 
596 596
 
597
-    /**
598
-     * verifies each of the new countries exists that somehow we missed in 4.1
599
-     */
600
-    public function verify_new_countries()
601
-    {
602
-        //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
603
-        //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
604
-        //currency symbols: http://www.xe.com/symbols.php
605
-        //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
606
-        //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
607
-        $newer_countries = array(
608
-            array('AX', 'ALA', 0, '&#197;land Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
609
-            array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
610
-            array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
611
-            array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
612
-            array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
613
-            array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
614
-            array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
615
-            array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
616
-            array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0),
617
-            array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
618
-            array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
619
-            array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0),
620
-            array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
621
-            array(
622
-                'BQ',
623
-                'BES',
624
-                0,
625
-                'Bonaire, Saint Eustatius and Saba',
626
-                'USD',
627
-                'Dollar',
628
-                'Dollars',
629
-                '$',
630
-                1,
631
-                2,
632
-                '+599',
633
-                0,
634
-                0,
635
-            ),
636
-            array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0),
637
-            array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0),
638
-            array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0),
639
-            array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0),
640
-            array(
641
-                'HM',
642
-                'HMD',
643
-                0,
644
-                'Heard Island and McDonald Islands',
645
-                'AUD',
646
-                'Dollar',
647
-                'Dollars',
648
-                '$',
649
-                1,
650
-                2,
651
-                '+891',
652
-                0,
653
-                0,
654
-            ),
655
-            array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0),
656
-            array(
657
-                'GS',
658
-                'SGS',
659
-                0,
660
-                'South Georgia and the South Sandwich Islands',
661
-                'GBP',
662
-                'Pound',
663
-                'Pounds',
664
-                '£',
665
-                1,
666
-                2,
667
-                '+500',
668
-                0,
669
-                0,
670
-            ),
671
-            array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0),
672
-            array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0),
673
-            array(
674
-                'UM',
675
-                'UMI',
676
-                0,
677
-                'United States Minor Outlying Islands',
678
-                'USD',
679
-                'Dollar',
680
-                'Dollars',
681
-                '$',
682
-                1,
683
-                2,
684
-                '+1',
685
-                0,
686
-                0,
687
-            ),
688
-        );
689
-        global $wpdb;
690
-        $country_table = $wpdb->prefix . "esp_country";
691
-        $country_format = array(
692
-            "CNT_ISO"         => '%s',
693
-            "CNT_ISO3"        => '%s',
694
-            "RGN_ID"          => '%d',
695
-            "CNT_name"        => '%s',
696
-            "CNT_cur_code"    => '%s',
697
-            "CNT_cur_single"  => '%s',
698
-            "CNT_cur_plural"  => '%s',
699
-            "CNT_cur_sign"    => '%s',
700
-            "CNT_cur_sign_b4" => '%d',
701
-            "CNT_cur_dec_plc" => '%d',
702
-            "CNT_tel_code"    => '%s',
703
-            "CNT_is_EU"       => '%d',
704
-            "CNT_active"      => '%d',
705
-        );
706
-        if ($this->_get_table_analysis()->tableExists($country_table)) {
707
-            foreach ($newer_countries as $country) {
708
-                $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
709
-                $countries = $wpdb->get_var($SQL);
710
-                if ( ! $countries) {
711
-                    $wpdb->insert($country_table,
712
-                        array_combine(array_keys($country_format), $country),
713
-                        $country_format
714
-                    );
715
-                }
716
-            }
717
-        }
718
-    }
597
+	/**
598
+	 * verifies each of the new countries exists that somehow we missed in 4.1
599
+	 */
600
+	public function verify_new_countries()
601
+	{
602
+		//a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
603
+		//how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
604
+		//currency symbols: http://www.xe.com/symbols.php
605
+		//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
606
+		//('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
607
+		$newer_countries = array(
608
+			array('AX', 'ALA', 0, '&#197;land Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
609
+			array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
610
+			array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
611
+			array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
612
+			array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
613
+			array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
614
+			array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
615
+			array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
616
+			array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0),
617
+			array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
618
+			array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
619
+			array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0),
620
+			array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
621
+			array(
622
+				'BQ',
623
+				'BES',
624
+				0,
625
+				'Bonaire, Saint Eustatius and Saba',
626
+				'USD',
627
+				'Dollar',
628
+				'Dollars',
629
+				'$',
630
+				1,
631
+				2,
632
+				'+599',
633
+				0,
634
+				0,
635
+			),
636
+			array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0),
637
+			array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0),
638
+			array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0),
639
+			array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0),
640
+			array(
641
+				'HM',
642
+				'HMD',
643
+				0,
644
+				'Heard Island and McDonald Islands',
645
+				'AUD',
646
+				'Dollar',
647
+				'Dollars',
648
+				'$',
649
+				1,
650
+				2,
651
+				'+891',
652
+				0,
653
+				0,
654
+			),
655
+			array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0),
656
+			array(
657
+				'GS',
658
+				'SGS',
659
+				0,
660
+				'South Georgia and the South Sandwich Islands',
661
+				'GBP',
662
+				'Pound',
663
+				'Pounds',
664
+				'£',
665
+				1,
666
+				2,
667
+				'+500',
668
+				0,
669
+				0,
670
+			),
671
+			array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0),
672
+			array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0),
673
+			array(
674
+				'UM',
675
+				'UMI',
676
+				0,
677
+				'United States Minor Outlying Islands',
678
+				'USD',
679
+				'Dollar',
680
+				'Dollars',
681
+				'$',
682
+				1,
683
+				2,
684
+				'+1',
685
+				0,
686
+				0,
687
+			),
688
+		);
689
+		global $wpdb;
690
+		$country_table = $wpdb->prefix . "esp_country";
691
+		$country_format = array(
692
+			"CNT_ISO"         => '%s',
693
+			"CNT_ISO3"        => '%s',
694
+			"RGN_ID"          => '%d',
695
+			"CNT_name"        => '%s',
696
+			"CNT_cur_code"    => '%s',
697
+			"CNT_cur_single"  => '%s',
698
+			"CNT_cur_plural"  => '%s',
699
+			"CNT_cur_sign"    => '%s',
700
+			"CNT_cur_sign_b4" => '%d',
701
+			"CNT_cur_dec_plc" => '%d',
702
+			"CNT_tel_code"    => '%s',
703
+			"CNT_is_EU"       => '%d',
704
+			"CNT_active"      => '%d',
705
+		);
706
+		if ($this->_get_table_analysis()->tableExists($country_table)) {
707
+			foreach ($newer_countries as $country) {
708
+				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
709
+				$countries = $wpdb->get_var($SQL);
710
+				if ( ! $countries) {
711
+					$wpdb->insert($country_table,
712
+						array_combine(array_keys($country_format), $country),
713
+						$country_format
714
+					);
715
+				}
716
+			}
717
+		}
718
+	}
719 719
 
720 720
 
721 721
 
722
-    /**
723
-     * verifies each of the new currencies exists that somehow we missed in 4.6
724
-     */
725
-    public function verify_new_currencies()
726
-    {
727
-        //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
728
-        //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
729
-        //currency symbols: http://www.xe.com/symbols.php
730
-        // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
731
-        //( 'EUR',  'Euro',  'Euros',  '€',  2,1),
732
-        $newer_currencies = array(
733
-            array('RSD', 'Dinar', 'Dinars', '', 3, 1),
734
-        );
735
-        global $wpdb;
736
-        $currency_table = $wpdb->prefix . "esp_currency";
737
-        $currency_format = array(
738
-            "CUR_code"    => '%s',
739
-            "CUR_single"  => '%s',
740
-            "CUR_plural"  => '%s',
741
-            "CUR_sign"    => '%s',
742
-            "CUR_dec_plc" => '%d',
743
-            "CUR_active"  => '%d',
744
-        );
745
-        if ($this->_get_table_analysis()->tableExists($currency_table)) {
746
-            foreach ($newer_currencies as $currency) {
747
-                $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
748
-                $countries = $wpdb->get_var($SQL);
749
-                if ( ! $countries) {
750
-                    $wpdb->insert($currency_table,
751
-                        array_combine(array_keys($currency_format), $currency),
752
-                        $currency_format
753
-                    );
754
-                }
755
-            }
756
-        }
757
-    }
722
+	/**
723
+	 * verifies each of the new currencies exists that somehow we missed in 4.6
724
+	 */
725
+	public function verify_new_currencies()
726
+	{
727
+		//a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
728
+		//how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
729
+		//currency symbols: http://www.xe.com/symbols.php
730
+		// CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
731
+		//( 'EUR',  'Euro',  'Euros',  '€',  2,1),
732
+		$newer_currencies = array(
733
+			array('RSD', 'Dinar', 'Dinars', '', 3, 1),
734
+		);
735
+		global $wpdb;
736
+		$currency_table = $wpdb->prefix . "esp_currency";
737
+		$currency_format = array(
738
+			"CUR_code"    => '%s',
739
+			"CUR_single"  => '%s',
740
+			"CUR_plural"  => '%s',
741
+			"CUR_sign"    => '%s',
742
+			"CUR_dec_plc" => '%d',
743
+			"CUR_active"  => '%d',
744
+		);
745
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
746
+			foreach ($newer_currencies as $currency) {
747
+				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
748
+				$countries = $wpdb->get_var($SQL);
749
+				if ( ! $countries) {
750
+					$wpdb->insert($currency_table,
751
+						array_combine(array_keys($currency_format), $currency),
752
+						$currency_format
753
+					);
754
+				}
755
+			}
756
+		}
757
+	}
758 758
 
759 759
 
760 760
 
761
-    /**
762
-     * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
763
-     * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
764
-     * we should be able to stop doing this in 4.9
765
-     */
766
-    public function fix_non_default_taxes()
767
-    {
768
-        global $wpdb;
769
-        $query = $wpdb->prepare("UPDATE
761
+	/**
762
+	 * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
763
+	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
764
+	 * we should be able to stop doing this in 4.9
765
+	 */
766
+	public function fix_non_default_taxes()
767
+	{
768
+		global $wpdb;
769
+		$query = $wpdb->prepare("UPDATE
770 770
 				{$wpdb->prefix}esp_price p INNER JOIN
771 771
 				{$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID
772 772
 			SET
@@ -775,6 +775,6 @@  discard block
 block discarded – undo
775 775
 				p.PRC_is_default = 0 AND
776 776
 				pt.PBT_ID = %d
777 777
 					", EEM_Price_Type::base_type_tax);
778
-        $wpdb->query($query);
779
-    }
778
+		$wpdb->query($query);
779
+	}
780 780
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_5_0.dms.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 //unfortunately, this needs to be done upon INCLUSION of this file,
14 14
 //instead of construction, because it only gets constructed on first page load
15 15
 //(all other times it gets resurrected from a wordpress option)
16
-$stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*');
16
+$stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*');
17 17
 $class_to_filepath = array();
18 18
 foreach ($stages as $filepath) {
19 19
     $matches = array();
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         } elseif ( ! $version_string) {
63 63
 //			echo "no version string provided: $version_string";
64 64
             //no version string provided... this must be pre 4.3
65
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
65
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
66 66
         } else {
67 67
 //			echo "$version_string doesnt apply";
68 68
             return false;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     public function schema_changes_before_migration()
82 82
     {
83 83
         //relies on 4.1's EEH_Activation::create_table
84
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
84
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
85 85
         $table_name = 'esp_answer';
86 86
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
87 87
 					REG_ID INT UNSIGNED NOT NULL,
@@ -486,18 +486,18 @@  discard block
 block discarded – undo
486 486
     public function insert_default_price_types()
487 487
     {
488 488
         global $wpdb;
489
-        $price_type_table = $wpdb->prefix . "esp_price_type";
489
+        $price_type_table = $wpdb->prefix."esp_price_type";
490 490
         if ($this->_get_table_analysis()->tableExists($price_type_table)) {
491
-            $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
491
+            $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
492 492
             $price_types_exist = $wpdb->get_var($SQL);
493 493
             if ( ! $price_types_exist) {
494 494
                 $user_id = EEH_Activation::get_default_creator_id();
495 495
                 $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
496
-							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, $user_id, 0),
497
-							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, $user_id, 0),
498
-							(3, '" . __('Dollar Discount', 'event_espresso') . "', 2,  0, 30, $user_id, 0),
499
-							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, $user_id,  0),
500
-							(5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3,  0, 50, $user_id, 0);";
496
+							(1, '".__('Base Price', 'event_espresso')."', 1,  0, 0, $user_id, 0),
497
+							(2, '".__('Percent Discount', 'event_espresso')."', 2,  1, 20, $user_id, 0),
498
+							(3, '".__('Dollar Discount', 'event_espresso')."', 2,  0, 30, $user_id, 0),
499
+							(4, '".__('Percent Surcharge', 'event_espresso')."', 3,  1, 40, $user_id,  0),
500
+							(5, '".__('Dollar Surcharge', 'event_espresso')."', 3,  0, 50, $user_id, 0);";
501 501
                 $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
502 502
                 $wpdb->query($SQL);
503 503
             }
@@ -518,9 +518,9 @@  discard block
 block discarded – undo
518 518
     public function insert_default_prices()
519 519
     {
520 520
         global $wpdb;
521
-        $price_table = $wpdb->prefix . "esp_price";
521
+        $price_table = $wpdb->prefix."esp_price";
522 522
         if ($this->_get_table_analysis()->tableExists($price_table)) {
523
-            $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
523
+            $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
524 524
             $prices_exist = $wpdb->get_var($SQL);
525 525
             if ( ! $prices_exist) {
526 526
                 $user_id = EEH_Activation::get_default_creator_id();
@@ -545,9 +545,9 @@  discard block
 block discarded – undo
545 545
     public function insert_default_tickets()
546 546
     {
547 547
         global $wpdb;
548
-        $ticket_table = $wpdb->prefix . "esp_ticket";
548
+        $ticket_table = $wpdb->prefix."esp_ticket";
549 549
         if ($this->_get_table_analysis()->tableExists($ticket_table)) {
550
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
550
+            $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
551 551
             $tickets_exist = $wpdb->get_var($SQL);
552 552
             if ( ! $tickets_exist) {
553 553
                 $user_id = EEH_Activation::get_default_creator_id();
@@ -560,9 +560,9 @@  discard block
 block discarded – undo
560 560
                 $wpdb->query($SQL);
561 561
             }
562 562
         }
563
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
563
+        $ticket_price_table = $wpdb->prefix."esp_ticket_price";
564 564
         if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
565
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
565
+            $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
566 566
             $ticket_prc_exist = $wpdb->get_var($SQL);
567 567
             if ( ! $ticket_prc_exist) {
568 568
                 $SQL = "INSERT INTO $ticket_price_table
Please login to merge, or discard this patch.
Indentation   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 $stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*');
17 17
 $class_to_filepath = array();
18 18
 foreach ($stages as $filepath) {
19
-    $matches = array();
20
-    preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
-    $class_to_filepath[$matches[1]] = $filepath;
19
+	$matches = array();
20
+	preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
+	$class_to_filepath[$matches[1]] = $filepath;
22 22
 }
23 23
 //give addons a chance to autoload their stages too
24 24
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath);
@@ -31,59 +31,59 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 
34
-    /**
35
-     * EE_DMS_Core_4_5_0 constructor.
36
-     *
37
-     * @param TableManager  $table_manager
38
-     * @param TableAnalysis $table_analysis
39
-     */
40
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
41
-    {
42
-        $this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso");
43
-        $this->_priority = 10;
44
-        $this->_migration_stages = array(
45
-            new EE_DMS_4_5_0_update_wp_user_for_tickets(),
46
-            new EE_DMS_4_5_0_update_wp_user_for_prices(),
47
-            new EE_DMS_4_5_0_update_wp_user_for_price_types(),
48
-            new EE_DMS_4_5_0_update_wp_user_for_question_groups(),
49
-            new EE_DMS_4_5_0_invoice_settings(),
50
-        );
51
-        parent::__construct($table_manager, $table_analysis);
52
-    }
53
-
54
-
55
-
56
-    public function can_migrate_from_version($version_array)
57
-    {
58
-        $version_string = $version_array['Core'];
59
-        if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) {
34
+	/**
35
+	 * EE_DMS_Core_4_5_0 constructor.
36
+	 *
37
+	 * @param TableManager  $table_manager
38
+	 * @param TableAnalysis $table_analysis
39
+	 */
40
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
41
+	{
42
+		$this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso");
43
+		$this->_priority = 10;
44
+		$this->_migration_stages = array(
45
+			new EE_DMS_4_5_0_update_wp_user_for_tickets(),
46
+			new EE_DMS_4_5_0_update_wp_user_for_prices(),
47
+			new EE_DMS_4_5_0_update_wp_user_for_price_types(),
48
+			new EE_DMS_4_5_0_update_wp_user_for_question_groups(),
49
+			new EE_DMS_4_5_0_invoice_settings(),
50
+		);
51
+		parent::__construct($table_manager, $table_analysis);
52
+	}
53
+
54
+
55
+
56
+	public function can_migrate_from_version($version_array)
57
+	{
58
+		$version_string = $version_array['Core'];
59
+		if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) {
60 60
 //			echo "$version_string can be migrated from";
61
-            return true;
62
-        } elseif ( ! $version_string) {
61
+			return true;
62
+		} elseif ( ! $version_string) {
63 63
 //			echo "no version string provided: $version_string";
64
-            //no version string provided... this must be pre 4.3
65
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
66
-        } else {
64
+			//no version string provided... this must be pre 4.3
65
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
66
+		} else {
67 67
 //			echo "$version_string doesnt apply";
68
-            return false;
69
-        }
70
-    }
68
+			return false;
69
+		}
70
+	}
71 71
 
72 72
 
73 73
 
74
-    public function schema_changes_before_migration()
75
-    {
76
-        //relies on 4.1's EEH_Activation::create_table
77
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
78
-        $table_name = 'esp_answer';
79
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
74
+	public function schema_changes_before_migration()
75
+	{
76
+		//relies on 4.1's EEH_Activation::create_table
77
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
78
+		$table_name = 'esp_answer';
79
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
80 80
 					REG_ID INT UNSIGNED NOT NULL,
81 81
 					QST_ID INT UNSIGNED NOT NULL,
82 82
 					ANS_value TEXT NOT NULL,
83 83
 					PRIMARY KEY  (ANS_ID)";
84
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
85
-        $table_name = 'esp_attendee_meta';
86
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
84
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
85
+		$table_name = 'esp_attendee_meta';
86
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
87 87
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
88 88
 						ATT_fname VARCHAR(45) NOT NULL,
89 89
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 								KEY ATT_fname (ATT_fname),
100 100
 								KEY ATT_lname (ATT_lname),
101 101
 								KEY ATT_email (ATT_email)";
102
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
103
-        $table_name = 'esp_country';
104
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
102
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
103
+		$table_name = 'esp_country';
104
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
105 105
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
106 106
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
107 107
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
118 118
 					  CNT_active TINYINT(1) DEFAULT '0',
119 119
 					  PRIMARY KEY  (CNT_ISO)";
120
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
121
-        $table_name = 'esp_datetime';
122
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
120
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
121
+		$table_name = 'esp_datetime';
122
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
123 123
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
124 124
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
125 125
 				  DTT_description TEXT NOT NULL,
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 						PRIMARY KEY  (DTT_ID),
135 135
 						KEY EVT_ID (EVT_ID),
136 136
 						KEY DTT_is_primary (DTT_is_primary)";
137
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138
-        $table_name = 'esp_event_meta';
139
-        $sql = "
137
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138
+		$table_name = 'esp_event_meta';
139
+		$sql = "
140 140
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
141 141
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
142 142
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -151,31 +151,31 @@  discard block
 block discarded – undo
151 151
 			EVT_external_URL VARCHAR(200) NULL,
152 152
 			EVT_donations TINYINT(1) NULL,
153 153
 			PRIMARY KEY  (EVTM_ID)";
154
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
155
-        $table_name = 'esp_event_question_group';
156
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
154
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
155
+		$table_name = 'esp_event_question_group';
156
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
157 157
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
158 158
 					QSG_ID INT UNSIGNED NOT NULL,
159 159
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
160 160
 					PRIMARY KEY  (EQG_ID)";
161
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
162
-        $table_name = 'esp_event_venue';
163
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
161
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
162
+		$table_name = 'esp_event_venue';
163
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
164 164
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
165 165
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
166 166
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
167 167
 				PRIMARY KEY  (EVV_ID)";
168
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169
-        $table_name = 'esp_extra_meta';
170
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
168
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169
+		$table_name = 'esp_extra_meta';
170
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
171 171
 				OBJ_ID INT(11) DEFAULT NULL,
172 172
 				EXM_type VARCHAR(45) DEFAULT NULL,
173 173
 				EXM_key VARCHAR(45) DEFAULT NULL,
174 174
 				EXM_value TEXT,
175 175
 				PRIMARY KEY  (EXM_ID)";
176
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
177
-        $table_name = 'esp_line_item';
178
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
176
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
177
+		$table_name = 'esp_line_item';
178
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
179 179
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
180 180
 				TXN_ID INT(11) DEFAULT NULL,
181 181
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -191,19 +191,19 @@  discard block
 block discarded – undo
191 191
 				OBJ_ID INT(11) DEFAULT NULL,
192 192
 				OBJ_type VARCHAR(45)DEFAULT NULL,
193 193
 				PRIMARY KEY  (LIN_ID)";
194
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
195
-        $table_name = 'esp_message_template';
196
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
194
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
195
+		$table_name = 'esp_message_template';
196
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
197 197
 					GRP_ID INT(10) UNSIGNED NOT NULL,
198 198
 					MTP_context VARCHAR(50) NOT NULL,
199 199
 					MTP_template_field VARCHAR(30) NOT NULL,
200 200
 					MTP_content TEXT NOT NULL,
201 201
 					PRIMARY KEY  (MTP_ID),
202 202
 					KEY GRP_ID (GRP_ID)";
203
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
204
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
205
-        $table_name = 'esp_message_template_group';
206
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
203
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
204
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
205
+		$table_name = 'esp_message_template_group';
206
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
207 207
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
208 208
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
209 209
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -215,17 +215,17 @@  discard block
 block discarded – undo
215 215
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
216 216
 					PRIMARY KEY  (GRP_ID),
217 217
 					KEY MTP_user_id (MTP_user_id)";
218
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
219
-        $table_name = 'esp_event_message_template';
220
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
218
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
219
+		$table_name = 'esp_event_message_template';
220
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
221 221
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
222 222
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
223 223
 					PRIMARY KEY  (EMT_ID),
224 224
 					KEY EVT_ID (EVT_ID),
225 225
 					KEY GRP_ID (GRP_ID)";
226
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
227
-        $table_name = 'esp_payment';
228
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
226
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
227
+		$table_name = 'esp_payment';
228
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
229 229
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
230 230
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
231 231
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -241,28 +241,28 @@  discard block
 block discarded – undo
241 241
 					PRIMARY KEY  (PAY_ID),
242 242
 					KEY TXN_ID (TXN_ID),
243 243
 					KEY PAY_timestamp (PAY_timestamp)";
244
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
245
-        $table_name = "esp_ticket_price";
246
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
244
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
245
+		$table_name = "esp_ticket_price";
246
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
247 247
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
248 248
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
249 249
 					  PRIMARY KEY  (TKP_ID)";
250
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
251
-        $table_name = "esp_datetime_ticket";
252
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
250
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
251
+		$table_name = "esp_datetime_ticket";
252
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
253 253
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
254 254
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
255 255
 					  PRIMARY KEY  (DTK_ID)";
256
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
257
-        $table_name = "esp_ticket_template";
258
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
256
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
257
+		$table_name = "esp_ticket_template";
258
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
259 259
 					  TTM_name VARCHAR(45) NOT NULL,
260 260
 					  TTM_description TEXT,
261 261
 					  TTM_file VARCHAR(45),
262 262
 					  PRIMARY KEY  (TTM_ID)";
263
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
-        $table_name = 'esp_question';
265
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
263
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
+		$table_name = 'esp_question';
265
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
266 266
 					QST_display_text TEXT NOT NULL,
267 267
 					QST_admin_label VARCHAR(255) NOT NULL,
268 268
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -274,25 +274,25 @@  discard block
 block discarded – undo
274 274
 					QST_wp_user BIGINT UNSIGNED NULL,
275 275
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
276 276
 					PRIMARY KEY  (QST_ID)';
277
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
278
-        $table_name = 'esp_question_group_question';
279
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
277
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
278
+		$table_name = 'esp_question_group_question';
279
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
280 280
 					QSG_ID INT UNSIGNED NOT NULL,
281 281
 					QST_ID INT UNSIGNED NOT NULL,
282 282
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
283 283
 					PRIMARY KEY  (QGQ_ID) ";
284
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
285
-        $table_name = 'esp_question_option';
286
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
284
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
285
+		$table_name = 'esp_question_option';
286
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
287 287
 					QSO_value VARCHAR(255) NOT NULL,
288 288
 					QSO_desc TEXT NOT NULL,
289 289
 					QST_ID INT UNSIGNED NOT NULL,
290 290
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
291 291
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
292 292
 					PRIMARY KEY  (QSO_ID)";
293
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
294
-        $table_name = 'esp_registration';
295
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
293
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
294
+		$table_name = 'esp_registration';
295
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
296 296
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
297 297
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
298 298
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -315,25 +315,25 @@  discard block
 block discarded – undo
315 315
 					  KEY STS_ID (STS_ID),
316 316
 					  KEY REG_url_link (REG_url_link),
317 317
 					  KEY REG_code (REG_code)";
318
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
319
-        $table_name = 'esp_checkin';
320
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
318
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
319
+		$table_name = 'esp_checkin';
320
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
321 321
 					REG_ID INT(10) UNSIGNED NOT NULL,
322 322
 					DTT_ID INT(10) UNSIGNED NOT NULL,
323 323
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
324 324
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
325 325
 					PRIMARY KEY  (CHK_ID)";
326
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
327
-        $table_name = 'esp_state';
328
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
326
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
327
+		$table_name = 'esp_state';
328
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
329 329
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
330 330
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
331 331
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
332 332
 					  STA_active TINYINT(1) DEFAULT '1',
333 333
 					  PRIMARY KEY  (STA_ID)";
334
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
335
-        $table_name = 'esp_status';
336
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
334
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
335
+		$table_name = 'esp_status';
336
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
337 337
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
338 338
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
339 339
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -341,9 +341,9 @@  discard block
 block discarded – undo
341 341
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
342 342
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
343 343
 					  KEY STS_type (STS_type)";
344
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
345
-        $table_name = 'esp_transaction';
346
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
344
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
345
+		$table_name = 'esp_transaction';
346
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
347 347
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
348 348
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
349 349
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 					  PRIMARY KEY  (TXN_ID),
355 355
 					  KEY TXN_timestamp (TXN_timestamp),
356 356
 					  KEY STS_ID (STS_ID)";
357
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
358
-        $table_name = 'esp_venue_meta';
359
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
357
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
358
+		$table_name = 'esp_venue_meta';
359
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
360 360
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
361 361
 			VNU_address VARCHAR(255) DEFAULT NULL,
362 362
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 			PRIMARY KEY  (VNUM_ID),
375 375
 			KEY STA_ID (STA_ID),
376 376
 			KEY CNT_ISO (CNT_ISO)";
377
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
378
-        //modified tables
379
-        $table_name = "esp_price";
380
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
377
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
378
+		//modified tables
379
+		$table_name = "esp_price";
380
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
381 381
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
382 382
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
383 383
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
 					  PRC_wp_user BIGINT UNSIGNED NULL,
390 390
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
391 391
 					  PRIMARY KEY  (PRC_ID)";
392
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
393
-        $table_name = "esp_price_type";
394
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
392
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
393
+		$table_name = "esp_price_type";
394
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
395 395
 				  PRT_name VARCHAR(45) NOT NULL,
396 396
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
397 397
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
401 401
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
402 402
 				  PRIMARY KEY  (PRT_ID)";
403
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
404
-        $table_name = "esp_ticket";
405
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
403
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
404
+		$table_name = "esp_ticket";
405
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
406 406
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
407 407
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
408 408
 					  TKT_description TEXT NOT NULL,
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
424 424
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
425 425
 					  PRIMARY KEY  (TKT_ID)";
426
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
427
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
428
-        $table_name = 'esp_question_group';
429
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
426
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
427
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
428
+		$table_name = 'esp_question_group';
429
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
430 430
 					QSG_name VARCHAR(255) NOT NULL,
431 431
 					QSG_identifier VARCHAR(100) NOT NULL,
432 432
 					QSG_desc TEXT NULL,
@@ -438,135 +438,135 @@  discard block
 block discarded – undo
438 438
 					QSG_wp_user BIGINT UNSIGNED NULL,
439 439
 					PRIMARY KEY  (QSG_ID),
440 440
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
441
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
442
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
443
-        //(because many need to convert old string states to foreign keys into the states table)
444
-        $script_4_1_defaults->insert_default_states();
445
-        $script_4_1_defaults->insert_default_countries();
446
-        //schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later.
447
-        $this->insert_default_price_types();
448
-        $this->insert_default_prices();
449
-        $this->insert_default_tickets();
450
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
451
-        EE_Config::instance()->update_espresso_config(false, true);
452
-        return true;
453
-    }
454
-
455
-
456
-
457
-    /**
458
-     * @return boolean
459
-     */
460
-    public function schema_changes_after_migration()
461
-    {
462
-        return true;
463
-    }
464
-
465
-
466
-
467
-    public function migration_page_hooks()
468
-    {
469
-    }
470
-
471
-
472
-
473
-    /**
474
-     * insert_default_price_types
475
-     *
476
-     * @since 4.5.0
477
-     * @return void
478
-     */
479
-    public function insert_default_price_types()
480
-    {
481
-        global $wpdb;
482
-        $price_type_table = $wpdb->prefix . "esp_price_type";
483
-        if ($this->_get_table_analysis()->tableExists($price_type_table)) {
484
-            $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
485
-            $price_types_exist = $wpdb->get_var($SQL);
486
-            if ( ! $price_types_exist) {
487
-                $user_id = EEH_Activation::get_default_creator_id();
488
-                $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
441
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
442
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
443
+		//(because many need to convert old string states to foreign keys into the states table)
444
+		$script_4_1_defaults->insert_default_states();
445
+		$script_4_1_defaults->insert_default_countries();
446
+		//schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later.
447
+		$this->insert_default_price_types();
448
+		$this->insert_default_prices();
449
+		$this->insert_default_tickets();
450
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
451
+		EE_Config::instance()->update_espresso_config(false, true);
452
+		return true;
453
+	}
454
+
455
+
456
+
457
+	/**
458
+	 * @return boolean
459
+	 */
460
+	public function schema_changes_after_migration()
461
+	{
462
+		return true;
463
+	}
464
+
465
+
466
+
467
+	public function migration_page_hooks()
468
+	{
469
+	}
470
+
471
+
472
+
473
+	/**
474
+	 * insert_default_price_types
475
+	 *
476
+	 * @since 4.5.0
477
+	 * @return void
478
+	 */
479
+	public function insert_default_price_types()
480
+	{
481
+		global $wpdb;
482
+		$price_type_table = $wpdb->prefix . "esp_price_type";
483
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
484
+			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
485
+			$price_types_exist = $wpdb->get_var($SQL);
486
+			if ( ! $price_types_exist) {
487
+				$user_id = EEH_Activation::get_default_creator_id();
488
+				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
489 489
 							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, $user_id, 0),
490 490
 							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, $user_id, 0),
491 491
 							(3, '" . __('Dollar Discount', 'event_espresso') . "', 2,  0, 30, $user_id, 0),
492 492
 							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, $user_id,  0),
493 493
 							(5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3,  0, 50, $user_id, 0);";
494
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
495
-                $wpdb->query($SQL);
496
-            }
497
-        }
498
-    }
499
-
500
-
501
-
502
-    /**
503
-     * insert DEFAULT prices.
504
-     *  If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices
505
-     * when EEH_Activaion's initialize_db_content is called via  ahook in
506
-     * EE_Brewing_regular
507
-     *
508
-     * @since 4.5.0
509
-     * @return void
510
-     */
511
-    public function insert_default_prices()
512
-    {
513
-        global $wpdb;
514
-        $price_table = $wpdb->prefix . "esp_price";
515
-        if ($this->_get_table_analysis()->tableExists($price_table)) {
516
-            $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
517
-            $prices_exist = $wpdb->get_var($SQL);
518
-            if ( ! $prices_exist) {
519
-                $user_id = EEH_Activation::get_default_creator_id();
520
-                $SQL = "INSERT INTO $price_table
494
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
495
+				$wpdb->query($SQL);
496
+			}
497
+		}
498
+	}
499
+
500
+
501
+
502
+	/**
503
+	 * insert DEFAULT prices.
504
+	 *  If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices
505
+	 * when EEH_Activaion's initialize_db_content is called via  ahook in
506
+	 * EE_Brewing_regular
507
+	 *
508
+	 * @since 4.5.0
509
+	 * @return void
510
+	 */
511
+	public function insert_default_prices()
512
+	{
513
+		global $wpdb;
514
+		$price_table = $wpdb->prefix . "esp_price";
515
+		if ($this->_get_table_analysis()->tableExists($price_table)) {
516
+			$SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
517
+			$prices_exist = $wpdb->get_var($SQL);
518
+			if ( ! $prices_exist) {
519
+				$user_id = EEH_Activation::get_default_creator_id();
520
+				$SQL = "INSERT INTO $price_table
521 521
 							(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
522 522
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);";
523
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
524
-                $wpdb->query($SQL);
525
-            }
526
-        }
527
-    }
528
-
529
-
530
-
531
-    /**
532
-     * insert DEFAULT ticket
533
-     * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field
534
-     *
535
-     * @since 4.5.0
536
-     * @return void
537
-     */
538
-    public function insert_default_tickets()
539
-    {
540
-        global $wpdb;
541
-        $ticket_table = $wpdb->prefix . "esp_ticket";
542
-        if ($this->_get_table_analysis()->tableExists($ticket_table)) {
543
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
544
-            $tickets_exist = $wpdb->get_var($SQL);
545
-            if ( ! $tickets_exist) {
546
-                $user_id = EEH_Activation::get_default_creator_id();
547
-                $SQL = "INSERT INTO $ticket_table
523
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
524
+				$wpdb->query($SQL);
525
+			}
526
+		}
527
+	}
528
+
529
+
530
+
531
+	/**
532
+	 * insert DEFAULT ticket
533
+	 * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field
534
+	 *
535
+	 * @since 4.5.0
536
+	 * @return void
537
+	 */
538
+	public function insert_default_tickets()
539
+	{
540
+		global $wpdb;
541
+		$ticket_table = $wpdb->prefix . "esp_ticket";
542
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
543
+			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
544
+			$tickets_exist = $wpdb->get_var($SQL);
545
+			if ( ! $tickets_exist) {
546
+				$user_id = EEH_Activation::get_default_creator_id();
547
+				$SQL = "INSERT INTO $ticket_table
548 548
 					( 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
549 549
 					( 1, 0, '"
550
-                       . __("Free Ticket", "event_espresso")
551
-                       . "', '', 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);";
552
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
553
-                $wpdb->query($SQL);
554
-            }
555
-        }
556
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
557
-        if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
558
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
559
-            $ticket_prc_exist = $wpdb->get_var($SQL);
560
-            if ( ! $ticket_prc_exist) {
561
-                $SQL = "INSERT INTO $ticket_price_table
550
+					   . __("Free Ticket", "event_espresso")
551
+					   . "', '', 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);";
552
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
553
+				$wpdb->query($SQL);
554
+			}
555
+		}
556
+		$ticket_price_table = $wpdb->prefix . "esp_ticket_price";
557
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
558
+			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
559
+			$ticket_prc_exist = $wpdb->get_var($SQL);
560
+			if ( ! $ticket_prc_exist) {
561
+				$SQL = "INSERT INTO $ticket_price_table
562 562
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
563 563
 				( 1, 1, 1 )
564 564
 				";
565
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
566
-                $wpdb->query($SQL);
567
-            }
568
-        }
569
-    }
565
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
566
+				$wpdb->query($SQL);
567
+			}
568
+		}
569
+	}
570 570
 
571 571
 }
572 572
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 // unfortunately, this needs to be done upon INCLUSION of this file,
16 16
 // instead of construction, because it only gets constructed on first page load
17 17
 // (all other times it gets resurrected from a wordpress option)
18
-$stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*');
18
+$stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*');
19 19
 $class_to_filepath = array();
20 20
 foreach ($stages as $filepath) {
21 21
     $matches = array();
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             return true;
80 80
         } elseif ( ! $version_string) {
81 81
             //no version string provided... this must be pre 4.3
82
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
82
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
83 83
         } else {
84 84
             return false;
85 85
         }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     public function schema_changes_before_migration()
104 104
     {
105 105
         //relies on 4.1's EEH_Activation::create_table
106
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
106
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
107 107
         $table_name = 'esp_answer';
108 108
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
109 109
 					REG_ID INT UNSIGNED NOT NULL,
Please login to merge, or discard this patch.
Indentation   +181 added lines, -182 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@  discard block
 block discarded – undo
9 9
  * and recalculates esp_registration.REG_final_price to actually be the final price
10 10
  * for that registration (before this it was just the ticket's price, NOT including
11 11
  * taxes or other price modifiers)
12
-
13 12
  */
14 13
 // make sure we have all the stages loaded too
15 14
 // unfortunately, this needs to be done upon INCLUSION of this file,
@@ -18,9 +17,9 @@  discard block
 block discarded – undo
18 17
 $stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*');
19 18
 $class_to_filepath = array();
20 19
 foreach ($stages as $filepath) {
21
-    $matches = array();
22
-    preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches);
23
-    $class_to_filepath[$matches[1]] = $filepath;
20
+	$matches = array();
21
+	preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22
+	$class_to_filepath[$matches[1]] = $filepath;
24 23
 }
25 24
 //give addons a chance to autoload their stages too
26 25
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath);
@@ -39,72 +38,72 @@  discard block
 block discarded – undo
39 38
 class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base
40 39
 {
41 40
 
42
-    /**
43
-     * return EE_DMS_Core_4_7_0
44
-     *
45
-     * @param TableManager  $table_manager
46
-     * @param TableAnalysis $table_analysis
47
-     */
48
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
49
-    {
50
-        $this->_pretty_name = __("Data Update to Event Espresso 4.7.0", "event_espresso");
51
-        $this->_priority = 10;
52
-        $this->_migration_stages = array(
53
-            new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(),
54
-            new EE_DMS_4_7_0_Registration_Payments(),
55
-        );
56
-        parent::__construct($table_manager, $table_analysis);
57
-    }
41
+	/**
42
+	 * return EE_DMS_Core_4_7_0
43
+	 *
44
+	 * @param TableManager  $table_manager
45
+	 * @param TableAnalysis $table_analysis
46
+	 */
47
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
48
+	{
49
+		$this->_pretty_name = __("Data Update to Event Espresso 4.7.0", "event_espresso");
50
+		$this->_priority = 10;
51
+		$this->_migration_stages = array(
52
+			new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(),
53
+			new EE_DMS_4_7_0_Registration_Payments(),
54
+		);
55
+		parent::__construct($table_manager, $table_analysis);
56
+	}
58 57
 
59 58
 
60 59
 
61
-    /**
62
-     * @param array $version_array
63
-     * @return bool
64
-     */
65
-    public function can_migrate_from_version($version_array)
66
-    {
67
-        $version_string = $version_array['Core'];
68
-        if (
69
-            (
70
-                version_compare($version_string, '4.7.0', '<=')
71
-                && version_compare($version_string, '4.6.0', '>=')
72
-            )
73
-            || (
74
-                version_compare($version_string, '4.7.0', '>=')
75
-                && ! $this->_get_table_analysis()->tableExists('esp_registration_payment')
76
-                && $this->_get_table_analysis()->tableExists('esp_registration')
77
-            )
78
-        ) {
79
-            return true;
80
-        } elseif ( ! $version_string) {
81
-            //no version string provided... this must be pre 4.3
82
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
83
-        } else {
84
-            return false;
85
-        }
86
-    }
60
+	/**
61
+	 * @param array $version_array
62
+	 * @return bool
63
+	 */
64
+	public function can_migrate_from_version($version_array)
65
+	{
66
+		$version_string = $version_array['Core'];
67
+		if (
68
+			(
69
+				version_compare($version_string, '4.7.0', '<=')
70
+				&& version_compare($version_string, '4.6.0', '>=')
71
+			)
72
+			|| (
73
+				version_compare($version_string, '4.7.0', '>=')
74
+				&& ! $this->_get_table_analysis()->tableExists('esp_registration_payment')
75
+				&& $this->_get_table_analysis()->tableExists('esp_registration')
76
+			)
77
+		) {
78
+			return true;
79
+		} elseif ( ! $version_string) {
80
+			//no version string provided... this must be pre 4.3
81
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
82
+		} else {
83
+			return false;
84
+		}
85
+	}
87 86
 
88 87
 
89 88
 
90
-    /**
91
-     * @return bool
92
-     */
93
-    public function schema_changes_before_migration()
94
-    {
95
-        //relies on 4.1's EEH_Activation::create_table
96
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
97
-        $table_name = 'esp_answer';
98
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
89
+	/**
90
+	 * @return bool
91
+	 */
92
+	public function schema_changes_before_migration()
93
+	{
94
+		//relies on 4.1's EEH_Activation::create_table
95
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
96
+		$table_name = 'esp_answer';
97
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
99 98
 					REG_ID INT UNSIGNED NOT NULL,
100 99
 					QST_ID INT UNSIGNED NOT NULL,
101 100
 					ANS_value TEXT NOT NULL,
102 101
 					PRIMARY KEY  (ANS_ID),
103 102
 					KEY REG_ID (REG_ID),
104 103
 					KEY QST_ID (QST_ID)";
105
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
106
-        $table_name = 'esp_attendee_meta';
107
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
104
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
105
+		$table_name = 'esp_attendee_meta';
106
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
108 107
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
109 108
 						ATT_fname VARCHAR(45) NOT NULL,
110 109
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -121,9 +120,9 @@  discard block
 block discarded – undo
121 120
 								KEY ATT_email (ATT_email),
122 121
 								KEY ATT_lname (ATT_lname),
123 122
 								KEY ATT_fname (ATT_fname)";
124
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
125
-        $table_name = 'esp_country';
126
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
123
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
124
+		$table_name = 'esp_country';
125
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
127 126
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
128 127
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
129 128
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -139,25 +138,25 @@  discard block
 block discarded – undo
139 138
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
140 139
 					  CNT_active TINYINT(1) DEFAULT '0',
141 140
 					  PRIMARY KEY  (CNT_ISO)";
142
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
143
-        $table_name = 'esp_currency';
144
-        $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
141
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
142
+		$table_name = 'esp_currency';
143
+		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
145 144
 				CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar',
146 145
 				CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars',
147 146
 				CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$',
148 147
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
149 148
 				CUR_active TINYINT(1) DEFAULT '0',
150 149
 				PRIMARY KEY  (CUR_code)";
151
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
152
-        $table_name = 'esp_currency_payment_method';
153
-        $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
150
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
151
+		$table_name = 'esp_currency_payment_method';
152
+		$sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
154 153
 				CUR_code  VARCHAR(6) COLLATE utf8_bin NOT NULL,
155 154
 				PMD_ID INT(11) NOT NULL,
156 155
 				PRIMARY KEY  (CPM_ID),
157 156
 				KEY PMD_ID (PMD_ID)";
158
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
159
-        $table_name = 'esp_datetime';
160
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
157
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
158
+		$table_name = 'esp_datetime';
159
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
161 160
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
162 161
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
163 162
 				  DTT_description TEXT NOT NULL,
@@ -173,9 +172,9 @@  discard block
 block discarded – undo
173 172
 						KEY DTT_EVT_start (DTT_EVT_start),
174 173
 						KEY EVT_ID (EVT_ID),
175 174
 						KEY DTT_is_primary (DTT_is_primary)";
176
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
177
-        $table_name = 'esp_event_meta';
178
-        $sql = "
175
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
176
+		$table_name = 'esp_event_meta';
177
+		$sql = "
179 178
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
180 179
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
181 180
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -191,34 +190,34 @@  discard block
 block discarded – undo
191 190
 			EVT_donations TINYINT(1) NULL,
192 191
 			PRIMARY KEY  (EVTM_ID),
193 192
 			KEY EVT_ID (EVT_ID)";
194
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
195
-        $table_name = 'esp_event_question_group';
196
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
193
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
194
+		$table_name = 'esp_event_question_group';
195
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
197 196
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
198 197
 					QSG_ID INT UNSIGNED NOT NULL,
199 198
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
200 199
 					PRIMARY KEY  (EQG_ID),
201 200
 					KEY EVT_ID (EVT_ID),
202 201
 					KEY QSG_ID (QSG_ID)";
203
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
204
-        $table_name = 'esp_event_venue';
205
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
202
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
203
+		$table_name = 'esp_event_venue';
204
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
206 205
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
207 206
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
208 207
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
209 208
 				PRIMARY KEY  (EVV_ID)";
210
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
211
-        $table_name = 'esp_extra_meta';
212
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
209
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
210
+		$table_name = 'esp_extra_meta';
211
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
213 212
 				OBJ_ID INT(11) DEFAULT NULL,
214 213
 				EXM_type VARCHAR(45) DEFAULT NULL,
215 214
 				EXM_key VARCHAR(45) DEFAULT NULL,
216 215
 				EXM_value TEXT,
217 216
 				PRIMARY KEY  (EXM_ID),
218 217
 				KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))";
219
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
220
-        $table_name = 'esp_line_item';
221
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
218
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
219
+		$table_name = 'esp_line_item';
220
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
222 221
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
223 222
 				TXN_ID INT(11) DEFAULT NULL,
224 223
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -236,9 +235,9 @@  discard block
 block discarded – undo
236 235
 				PRIMARY KEY  (LIN_ID),
237 236
 				KEY LIN_code (LIN_code(191)),
238 237
 				KEY TXN_ID (TXN_ID)";
239
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
240
-        $table_name = 'esp_log';
241
-        $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
238
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
239
+		$table_name = 'esp_log';
240
+		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
242 241
 				LOG_time DATETIME DEFAULT NULL,
243 242
 				OBJ_ID VARCHAR(45) DEFAULT NULL,
244 243
 				OBJ_type VARCHAR(45) DEFAULT NULL,
@@ -249,18 +248,18 @@  discard block
 block discarded – undo
249 248
 				KEY LOG_time (LOG_time),
250 249
 				KEY OBJ (OBJ_type,OBJ_ID),
251 250
 				KEY LOG_type (LOG_type)";
252
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
253
-        $table_name = 'esp_message_template';
254
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
251
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
252
+		$table_name = 'esp_message_template';
253
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
255 254
 					GRP_ID INT(10) UNSIGNED NOT NULL,
256 255
 					MTP_context VARCHAR(50) NOT NULL,
257 256
 					MTP_template_field VARCHAR(30) NOT NULL,
258 257
 					MTP_content TEXT NOT NULL,
259 258
 					PRIMARY KEY  (MTP_ID),
260 259
 					KEY GRP_ID (GRP_ID)";
261
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
262
-        $table_name = 'esp_message_template_group';
263
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
260
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
261
+		$table_name = 'esp_message_template_group';
262
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
264 263
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
265 264
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
266 265
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -272,17 +271,17 @@  discard block
 block discarded – undo
272 271
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
273 272
 					PRIMARY KEY  (GRP_ID),
274 273
 					KEY MTP_user_id (MTP_user_id)";
275
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
276
-        $table_name = 'esp_event_message_template';
277
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
274
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
275
+		$table_name = 'esp_event_message_template';
276
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
278 277
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
279 278
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
280 279
 					PRIMARY KEY  (EMT_ID),
281 280
 					KEY EVT_ID (EVT_ID),
282 281
 					KEY GRP_ID (GRP_ID)";
283
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
284
-        $table_name = 'esp_payment';
285
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
282
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
283
+		$table_name = 'esp_payment';
284
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
286 285
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
287 286
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
288 287
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -299,9 +298,9 @@  discard block
 block discarded – undo
299 298
 					PRIMARY KEY  (PAY_ID),
300 299
 					KEY PAY_timestamp (PAY_timestamp),
301 300
 					KEY TXN_ID (TXN_ID)";
302
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
303
-        $table_name = 'esp_payment_method';
304
-        $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
301
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
302
+		$table_name = 'esp_payment_method';
303
+		$sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
305 304
 				PMD_type VARCHAR(124) DEFAULT NULL,
306 305
 				PMD_name VARCHAR(255) DEFAULT NULL,
307 306
 				PMD_desc TEXT,
@@ -317,32 +316,32 @@  discard block
 block discarded – undo
317 316
 				PRIMARY KEY  (PMD_ID),
318 317
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
319 318
 				KEY PMD_type (PMD_type)";
320
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
321
-        $table_name = "esp_ticket_price";
322
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
319
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
320
+		$table_name = "esp_ticket_price";
321
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
323 322
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
324 323
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
325 324
 					  PRIMARY KEY  (TKP_ID),
326 325
 					  KEY TKT_ID (TKT_ID),
327 326
 					  KEY PRC_ID (PRC_ID)";
328
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
329
-        $table_name = "esp_datetime_ticket";
330
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
327
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
328
+		$table_name = "esp_datetime_ticket";
329
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
331 330
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
332 331
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
333 332
 					  PRIMARY KEY  (DTK_ID),
334 333
 					  KEY DTT_ID (DTT_ID),
335 334
 					  KEY TKT_ID (TKT_ID)";
336
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
337
-        $table_name = "esp_ticket_template";
338
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
335
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
336
+		$table_name = "esp_ticket_template";
337
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
339 338
 					  TTM_name VARCHAR(45) NOT NULL,
340 339
 					  TTM_description TEXT,
341 340
 					  TTM_file VARCHAR(45),
342 341
 					  PRIMARY KEY  (TTM_ID)";
343
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
344
-        $table_name = 'esp_question';
345
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
342
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
343
+		$table_name = 'esp_question';
344
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
346 345
 					QST_display_text TEXT NOT NULL,
347 346
 					QST_admin_label VARCHAR(255) NOT NULL,
348 347
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -355,18 +354,18 @@  discard block
 block discarded – undo
355 354
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
356 355
 					PRIMARY KEY  (QST_ID),
357 356
 					KEY QST_order (QST_order)';
358
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
359
-        $table_name = 'esp_question_group_question';
360
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
357
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
358
+		$table_name = 'esp_question_group_question';
359
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
361 360
 					QSG_ID INT UNSIGNED NOT NULL,
362 361
 					QST_ID INT UNSIGNED NOT NULL,
363 362
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
364 363
 					PRIMARY KEY  (QGQ_ID),
365 364
 					KEY QST_ID (QST_ID),
366 365
 					KEY QSG_ID_order (QSG_ID, QGQ_order)";
367
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
368
-        $table_name = 'esp_question_option';
369
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
366
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
367
+		$table_name = 'esp_question_option';
368
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
370 369
 					QSO_value VARCHAR(255) NOT NULL,
371 370
 					QSO_desc TEXT NOT NULL,
372 371
 					QST_ID INT UNSIGNED NOT NULL,
@@ -375,9 +374,9 @@  discard block
 block discarded – undo
375 374
 					PRIMARY KEY  (QSO_ID),
376 375
 					KEY QST_ID (QST_ID),
377 376
 					KEY QSO_order (QSO_order)";
378
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
379
-        $table_name = 'esp_registration';
380
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
377
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
378
+		$table_name = 'esp_registration';
379
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
381 380
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
382 381
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
383 382
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -401,18 +400,18 @@  discard block
 block discarded – undo
401 400
 					  KEY TKT_ID (TKT_ID),
402 401
 					  KEY EVT_ID (EVT_ID),
403 402
 					  KEY STS_ID (STS_ID)";
404
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
405
-        $table_name = 'esp_registration_payment';
406
-        $sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
403
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
404
+		$table_name = 'esp_registration_payment';
405
+		$sql = "RPY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
407 406
 					  REG_ID INT(10) UNSIGNED NOT NULL,
408 407
 					  PAY_ID INT(10) UNSIGNED NULL,
409 408
 					  RPY_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
410 409
 					  PRIMARY KEY  (RPY_ID),
411 410
 					  KEY REG_ID (REG_ID),
412 411
 					  KEY PAY_ID (PAY_ID)";
413
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
414
-        $table_name = 'esp_checkin';
415
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
412
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
413
+		$table_name = 'esp_checkin';
414
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
416 415
 					REG_ID INT(10) UNSIGNED NOT NULL,
417 416
 					DTT_ID INT(10) UNSIGNED NOT NULL,
418 417
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -420,9 +419,9 @@  discard block
 block discarded – undo
420 419
 					PRIMARY KEY  (CHK_ID),
421 420
 					KEY REG_ID (REG_ID),
422 421
 					KEY DTT_ID (DTT_ID)";
423
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
424
-        $table_name = 'esp_state';
425
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
422
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
423
+		$table_name = 'esp_state';
424
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
426 425
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
427 426
 					  STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL,
428 427
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
@@ -430,9 +429,9 @@  discard block
 block discarded – undo
430 429
 					  PRIMARY KEY  (STA_ID),
431 430
 					  KEY STA_abbrev (STA_abbrev),
432 431
 					  KEY CNT_ISO (CNT_ISO)";
433
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
434
-        $table_name = 'esp_status';
435
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
432
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
433
+		$table_name = 'esp_status';
434
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
436 435
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
437 436
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
438 437
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -440,9 +439,9 @@  discard block
 block discarded – undo
440 439
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
441 440
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
442 441
 					  KEY STS_type (STS_type)";
443
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
444
-        $table_name = 'esp_transaction';
445
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
442
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
443
+		$table_name = 'esp_transaction';
444
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
446 445
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
447 446
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
448 447
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -454,9 +453,9 @@  discard block
 block discarded – undo
454 453
 					  PRIMARY KEY  (TXN_ID),
455 454
 					  KEY TXN_timestamp (TXN_timestamp),
456 455
 					  KEY STS_ID (STS_ID)";
457
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
458
-        $table_name = 'esp_venue_meta';
459
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
456
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
457
+		$table_name = 'esp_venue_meta';
458
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
460 459
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
461 460
 			VNU_address VARCHAR(255) DEFAULT NULL,
462 461
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -475,10 +474,10 @@  discard block
 block discarded – undo
475 474
 			KEY VNU_ID (VNU_ID),
476 475
 			KEY STA_ID (STA_ID),
477 476
 			KEY CNT_ISO (CNT_ISO)";
478
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
479
-        //modified tables
480
-        $table_name = "esp_price";
481
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
477
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
478
+		//modified tables
479
+		$table_name = "esp_price";
480
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
482 481
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
483 482
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
484 483
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -491,9 +490,9 @@  discard block
 block discarded – undo
491 490
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
492 491
 					  PRIMARY KEY  (PRC_ID),
493 492
 					  KEY PRT_ID (PRT_ID)";
494
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
495
-        $table_name = "esp_price_type";
496
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
493
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
494
+		$table_name = "esp_price_type";
495
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
497 496
 				  PRT_name VARCHAR(45) NOT NULL,
498 497
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
499 498
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -502,9 +501,9 @@  discard block
 block discarded – undo
502 501
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
503 502
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
504 503
 				  PRIMARY KEY  (PRT_ID)";
505
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
506
-        $table_name = "esp_ticket";
507
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
504
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
505
+		$table_name = "esp_ticket";
506
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
508 507
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
509 508
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
510 509
 					  TKT_description TEXT NOT NULL,
@@ -526,9 +525,9 @@  discard block
 block discarded – undo
526 525
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
527 526
 					  PRIMARY KEY  (TKT_ID),
528 527
 					  KEY TKT_start_date (TKT_start_date)";
529
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
530
-        $table_name = 'esp_question_group';
531
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
528
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
529
+		$table_name = 'esp_question_group';
530
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
532 531
 					QSG_name VARCHAR(255) NOT NULL,
533 532
 					QSG_identifier VARCHAR(100) NOT NULL,
534 533
 					QSG_desc TEXT NULL,
@@ -541,38 +540,38 @@  discard block
 block discarded – undo
541 540
 					PRIMARY KEY  (QSG_ID),
542 541
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
543 542
 					KEY QSG_order (QSG_order)';
544
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
545
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
546
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
547
-        //(because many need to convert old string states to foreign keys into the states table)
548
-        $script_4_1_defaults->insert_default_states();
549
-        $script_4_1_defaults->insert_default_countries();
550
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
551
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
552
-        $script_4_5_defaults->insert_default_price_types();
553
-        $script_4_5_defaults->insert_default_prices();
554
-        $script_4_5_defaults->insert_default_tickets();
555
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
556
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
557
-        $script_4_6_defaults->add_default_admin_only_payments();
558
-        $script_4_6_defaults->insert_default_currencies();
559
-        return true;
560
-    }
543
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
544
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
545
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
546
+		//(because many need to convert old string states to foreign keys into the states table)
547
+		$script_4_1_defaults->insert_default_states();
548
+		$script_4_1_defaults->insert_default_countries();
549
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
550
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
551
+		$script_4_5_defaults->insert_default_price_types();
552
+		$script_4_5_defaults->insert_default_prices();
553
+		$script_4_5_defaults->insert_default_tickets();
554
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
555
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
556
+		$script_4_6_defaults->add_default_admin_only_payments();
557
+		$script_4_6_defaults->insert_default_currencies();
558
+		return true;
559
+	}
561 560
 
562 561
 
563 562
 
564
-    /**
565
-     * @return boolean
566
-     */
567
-    public function schema_changes_after_migration()
568
-    {
569
-        return true;
570
-    }
563
+	/**
564
+	 * @return boolean
565
+	 */
566
+	public function schema_changes_after_migration()
567
+	{
568
+		return true;
569
+	}
571 570
 
572 571
 
573 572
 
574
-    public function migration_page_hooks()
575
-    {
576
-    }
573
+	public function migration_page_hooks()
574
+	{
575
+	}
577 576
 }
578 577
 // end of file: /core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php
579 578
\ No newline at end of file
Please login to merge, or discard this patch.
maintenance/templates/ee_confirm_migration_crash_report_sent.template.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,39 +5,39 @@  discard block
 block discarded – undo
5 5
 /** @type string $reset_db_action_url */
6 6
 /** @type EE_Data_Migration_Script_Base $most_recent_migration */
7 7
 ?>
8
-<?php if ( $success ) { ?>
9
-	<h1><?php _e( "Database Update Crash Report Sent", "event_espresso" ); ?></h1>
10
-	<p><?php _e( "A crash report email was sent to Event Espresso. You should hear back from us soon.", "event_espresso" ); ?></p>
8
+<?php if ($success) { ?>
9
+	<h1><?php _e("Database Update Crash Report Sent", "event_espresso"); ?></h1>
10
+	<p><?php _e("A crash report email was sent to Event Espresso. You should hear back from us soon.", "event_espresso"); ?></p>
11 11
 <?php } else {//didn't send email properly ?>
12
-	<h1><?php _e( "Migration Report not sent", "event_espresso" ); ?></h1>
13
-	<p><?php _e( "An error occurred and we were not able to automatically send a report to Event Espresso support.", "event_espresso" ); ?></p>
14
-	<p><?php printf( esc_html__( "Please copy-and-paste the system information below to %s", "event_espresso" ), '<a href="mailto:' . EE_SUPPORT_EMAIL . '">' .EE_SUPPORT_EMAIL . "</a>" ); ?></p>
12
+	<h1><?php _e("Migration Report not sent", "event_espresso"); ?></h1>
13
+	<p><?php _e("An error occurred and we were not able to automatically send a report to Event Espresso support.", "event_espresso"); ?></p>
14
+	<p><?php printf(esc_html__("Please copy-and-paste the system information below to %s", "event_espresso"), '<a href="mailto:'.EE_SUPPORT_EMAIL.'">'.EE_SUPPORT_EMAIL."</a>"); ?></p>
15 15
 	<label>
16
-		<?php _e( "system status info", "event_espresso" ); ?>
17
-		<textarea name="system_status_info" class="system_status_info"><?php print_r( EEM_System_Status::instance()->get_system_stati() ); ?></textarea>
16
+		<?php _e("system status info", "event_espresso"); ?>
17
+		<textarea name="system_status_info" class="system_status_info"><?php print_r(EEM_System_Status::instance()->get_system_stati()); ?></textarea>
18 18
 	</label>
19 19
 <?php } ?>
20 20
 
21 21
 
22
-<h1><?php _e( "What's next?", 'event_espresso' ); ?></h1>
23
-<p><?php _e( "Well, it depends on your situation:", 'event_espresso' ); ?></p>
22
+<h1><?php _e("What's next?", 'event_espresso'); ?></h1>
23
+<p><?php _e("Well, it depends on your situation:", 'event_espresso'); ?></p>
24 24
 <div class='ee-table-wrap'>
25 25
 	<table>
26 26
 		<thead>
27 27
 			<tr>
28
-				<th><?php _e( "Your Situation", 'event_espresso' ); ?></th>
29
-				<th><?php _e( "Suggested Action", 'event_espresso' ); ?></th>
28
+				<th><?php _e("Your Situation", 'event_espresso'); ?></th>
29
+				<th><?php _e("Suggested Action", 'event_espresso'); ?></th>
30 30
 			</tr>
31 31
 		</thead>
32 32
 		<tbody>
33 33
 			<tr>
34
-				<td><p class='big-text'><?php _e( "I want to retry migrating my data", 'event_espresso' ); ?></p></td>
34
+				<td><p class='big-text'><?php _e("I want to retry migrating my data", 'event_espresso'); ?></p></td>
35 35
 				<td>
36 36
 					<p>
37 37
 						<?php
38 38
 						printf(
39
-							esc_html__( 'First, %1$s check the forums %2$s to see if there is a solution before re-attempting the Database Update. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the update run slower, but may resolve any memory exhaustion errors.', 'event_espresso' ),
40
-							"<a href='" . EE_SUPPORT_EMAIL . "' target='_blank'>",
39
+							esc_html__('First, %1$s check the forums %2$s to see if there is a solution before re-attempting the Database Update. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the update run slower, but may resolve any memory exhaustion errors.', 'event_espresso'),
40
+							"<a href='".EE_SUPPORT_EMAIL."' target='_blank'>",
41 41
 							'</a>',
42 42
 							'<pre lang="php">define( EE_MIGRATION_STEP_SIZE, 10 );</pre>',
43 43
 							'<b>',
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 					<p>
50 50
 						<?php
51 51
 						printf(
52
-							esc_html__( 'To retry updating your data: restore to the backup you made before the update and reactivate EE (and any addons you are using) and re-run the Database Update. If you did not make a database backup and are migrating from EE3: delete your EE4 data (use the %1$s Reset/Delete Data tab above%2$s), and then reactivate EE4, and then re-run the migration and updates. If you did not make a database backup, are only updating from a previous install of EE4, have found a solution to the fatal error you received, and are willing to possibly have some data lost, %3$sattempt to continue migrating%2$s.', 'event_espresso' ),
52
+							esc_html__('To retry updating your data: restore to the backup you made before the update and reactivate EE (and any addons you are using) and re-run the Database Update. If you did not make a database backup and are migrating from EE3: delete your EE4 data (use the %1$s Reset/Delete Data tab above%2$s), and then reactivate EE4, and then re-run the migration and updates. If you did not make a database backup, are only updating from a previous install of EE4, have found a solution to the fatal error you received, and are willing to possibly have some data lost, %3$sattempt to continue migrating%2$s.', 'event_espresso'),
53 53
 							"<a href='$reset_db_page_url'>",
54 54
 							"</a>",
55 55
 							"<a class='button-primary' href='$reattempt_action_url'>"
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 			</tr>
61 61
 			<tr>
62 62
 				<td>
63
-					<p class='big-text'><?php _e( "I want to hear from Support before proceeding", 'event_espresso' ); ?></p>
63
+					<p class='big-text'><?php _e("I want to hear from Support before proceeding", 'event_espresso'); ?></p>
64 64
 				</td>
65 65
 				<td>
66 66
 					<?php
67 67
 					printf(
68
-						esc_html__( 'Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible', 'event_espresso' ),
69
-						"<a href='" . EE_SUPPORT_EMAIL . "'>",
68
+						esc_html__('Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible', 'event_espresso'),
69
+						"<a href='".EE_SUPPORT_EMAIL."'>",
70 70
 						"</a>"
71 71
 					);
72 72
 					?>
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 			</tr>
75 75
 			<tr>
76 76
 				<td>
77
-					<p class='big-text'><?php printf( esc_html__( 'I don\'t need my old EE %s data', 'event_espresso' ), $most_recent_migration->slug() ); ?></p>
77
+					<p class='big-text'><?php printf(esc_html__('I don\'t need my old EE %s data', 'event_espresso'), $most_recent_migration->slug()); ?></p>
78 78
 				</td>
79 79
 				<td>
80 80
 					<?php
81 81
 					printf(
82
-						esc_html__( 'If you are ok with losing all the EE %1$s data, you can skip the Database Updates and %2$s use EE4 with only default Data%3$s', 'event_espresso' ),
82
+						esc_html__('If you are ok with losing all the EE %1$s data, you can skip the Database Updates and %2$s use EE4 with only default Data%3$s', 'event_espresso'),
83 83
 						$most_recent_migration->slug(),
84 84
 						"<a id='do-not-migrate' class='do-not-migrate button-primary' href='$reset_db_action_url'>",
85 85
 						"</a>"
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
 			</tr>
90 90
 			<tr>
91 91
 				<td>
92
-					<p class='big-text'><?php printf( esc_html__( 'I want to go back to my old version of EE %1$s', 'event_espresso' ), $most_recent_migration->slug() ); ?>
92
+					<p class='big-text'><?php printf(esc_html__('I want to go back to my old version of EE %1$s', 'event_espresso'), $most_recent_migration->slug()); ?>
93 93
 				</td>
94 94
 				<td>
95 95
 					<p>
96 96
 					<?php
97 97
 					printf(
98
-						esc_html__( 'Then we suggest you re-activate the old version of EE %3$s and restore your database to the backup you made just before the Database Update . If you didn\'t backup your database and are migrating from EE3, you can also delete your EE4 data (use on the %1$s"Reset/Delete Data" tab above%2$s), and then reactivate EE3 from the plugins page. Note: some of your EE3 shortcodes may have been changed to their EE4 equivalents, so you will need to change them back.', 'event_espresso' ),
98
+						esc_html__('Then we suggest you re-activate the old version of EE %3$s and restore your database to the backup you made just before the Database Update . If you didn\'t backup your database and are migrating from EE3, you can also delete your EE4 data (use on the %1$s"Reset/Delete Data" tab above%2$s), and then reactivate EE3 from the plugins page. Note: some of your EE3 shortcodes may have been changed to their EE4 equivalents, so you will need to change them back.', 'event_espresso'),
99 99
 						"<a href='$reset_db_page_url'>",
100 100
 						"</a>",
101 101
 						$most_recent_migration->slug()
102 102
 					);
103 103
 					?>
104 104
 					</p>
105
-					<p><?php _e( "If you ever decide to re-attempt using EE4, you will again be given the option to migrate your EE3 data or not.", 'event_espresso' ); ?></p>
105
+					<p><?php _e("If you ever decide to re-attempt using EE4, you will again be given the option to migrate your EE3 data or not.", 'event_espresso'); ?></p>
106 106
 				</td>
107 107
 			</tr>
108 108
 
Please login to merge, or discard this patch.
maintenance/templates/ee_upgrade_addons_before_migrating.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 ?>
4
-<h1><?php esc_html_e("You must upgrade your Event Espresso Add-ons before Migrating", "event_espresso");?></h1>
5
-<p><?php printf(esc_html__("Please %s visit the plugins page%s and update all Event Espresso addon plugins before updating your database.", "event_espresso"), "<a href='".admin_url('/plugins.php')."'>","</a>");?></p>
6
-<p><?php esc_html_e("You can also deactivate the addons, but all of their data will be lost when your database is migrated", "event_espresso");?></p>
7 4
\ No newline at end of file
5
+<h1><?php esc_html_e("You must upgrade your Event Espresso Add-ons before Migrating", "event_espresso"); ?></h1>
6
+<p><?php printf(esc_html__("Please %s visit the plugins page%s and update all Event Espresso addon plugins before updating your database.", "event_espresso"), "<a href='".admin_url('/plugins.php')."'>", "</a>"); ?></p>
7
+<p><?php esc_html_e("You can also deactivate the addons, but all of their data will be lost when your database is migrated", "event_espresso"); ?></p>
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_migration_page.template.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -28,29 +28,29 @@  discard block
 block discarded – undo
28 28
             <h3 class="espresso-header">
29 29
                 <span class="dashicons dashicons-flag ee-icon-size-22"></span>
30 30
                 <?php
31
-                echo apply_filters(
32
-                        'FHEE__ee_migration_page__header',
33
-                        sprintf(
34
-                                esc_html__("Your Event Espresso data needs to be updated.", "event_espresso"),
35
-                                $current_db_state,
36
-                                $next_db_state
37
-                        ),
38
-                        $current_db_state,
39
-                        $next_db_state
40
-                );
41
-                ?>
31
+				echo apply_filters(
32
+						'FHEE__ee_migration_page__header',
33
+						sprintf(
34
+								esc_html__("Your Event Espresso data needs to be updated.", "event_espresso"),
35
+								$current_db_state,
36
+								$next_db_state
37
+						),
38
+						$current_db_state,
39
+						$next_db_state
40
+				);
41
+				?>
42 42
             </h3>
43 43
         <?php } elseif ($show_most_recent_migration) { ?>
44 44
             <h3 class="espresso-header">
45 45
                 <span class="dashicons dashicons-awards ee-icon-size-22"></span>
46 46
                 <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header',
47
-                        sprintf(esc_html__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s',
48
-                                "event_espresso"), $ultimate_db_state)); ?>
47
+						sprintf(esc_html__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s',
48
+								"event_espresso"), $ultimate_db_state)); ?>
49 49
             </h3>
50 50
             <p>
51 51
                 <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header',
52
-                        sprintf(esc_html__("Time to find out about all the great new features %s has to offer.",
53
-                                "event_espresso"), $ultimate_db_state)); ?> &nbsp;
52
+						sprintf(esc_html__("Time to find out about all the great new features %s has to offer.",
53
+								"event_espresso"), $ultimate_db_state)); ?> &nbsp;
54 54
                 <b><a id="get-started-after-migrate" class="button-primary"
55 55
                       href="<?php echo add_query_arg(array('page' => 'espresso_about'), admin_url('admin.php')); ?>">
56 56
                         <?php esc_html_e("Let's Get Started", "event_espresso"); ?>&nbsp;<span
@@ -61,34 +61,34 @@  discard block
 block discarded – undo
61 61
 
62 62
 
63 63
         <?php if ($show_backup_db_text) {
64
-            echo $migration_options_html;
65
-        } ?>
64
+			echo $migration_options_html;
65
+		} ?>
66 66
 
67 67
         <?php
68
-        if ($show_most_recent_migration) {
69
-            if ($most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base) {
70
-                if ($most_recent_migration->can_continue()) {
71
-                    //tell the user they should continue their migration because it appears to be unfinished... well, assuming there were no errors ?>
68
+		if ($show_most_recent_migration) {
69
+			if ($most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base) {
70
+				if ($most_recent_migration->can_continue()) {
71
+					//tell the user they should continue their migration because it appears to be unfinished... well, assuming there were no errors ?>
72 72
                     <h3 class="espresso-header">
73 73
                         <span class="dashicons dashicons-star-half ee-icon-size-22"></span>
74 74
                         <?php printf(esc_html__("It appears that your previous Database Update (%s) is incomplete, and should be resumed",
75
-                                "event_espresso"), $most_recent_migration->pretty_name()); ?>
75
+								"event_espresso"), $most_recent_migration->pretty_name()); ?>
76 76
                     </h3>
77 77
                 <?php } elseif ($most_recent_migration->is_broken()) {
78
-                    //tell the user the migration failed and they should notify EE?>
78
+					//tell the user the migration failed and they should notify EE?>
79 79
                     <h3 class="espresso-header">
80 80
                         <span class="dashicons dashicons-no ee-icon-size-22"></span>
81 81
                         <?php echo $most_recent_migration->get_feedback_message() ?>
82 82
                     </h3>
83 83
                 <?php }
84
-                //display errors or not of the most recent migration ran
85
-                if ($most_recent_migration->get_errors()) { ?>
84
+				//display errors or not of the most recent migration ran
85
+				if ($most_recent_migration->get_errors()) { ?>
86 86
                     <div class="ee-attention">
87 87
                         <strong><?php printf(esc_html__("Warnings occurred during your last Database Update (%s):",
88
-                                    'event_espresso'),
89
-                                    $most_recent_migration->pretty_name()) ?></strong>
88
+									'event_espresso'),
89
+									$most_recent_migration->pretty_name()) ?></strong>
90 90
                         <a id="show-hide-migration-warnings" class="display-the-hidden"><?php esc_html_e("Show Warnings",
91
-                                    'event_espresso'); ?></a>
91
+									'event_espresso'); ?></a>
92 92
                         <ul class="migration-warnings" style="display:none">
93 93
                             <?php foreach ($most_recent_migration->get_errors() as $error) { ?>
94 94
                                 <li><?php echo htmlentities($error) ?></li>
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
                         </ul>
97 97
                     </div>
98 98
                 <?php } else {
99
-                    //there were no errors during the last migration, just say so?>
99
+					//there were no errors during the last migration, just say so?>
100 100
                     <h2><?php printf(esc_html__("The last Database Update (%s) ran successfully without errors.",
101
-                                "event_espresso"), $most_recent_migration->pretty_name()) ?></h2>
101
+								"event_espresso"), $most_recent_migration->pretty_name()) ?></h2>
102 102
                 <?php }
103
-            } else {
104
-            }
105
-        }
106
-        // end of: if ( $show_most_recent_migration )
107
-        ?>
103
+			} else {
104
+			}
105
+		}
106
+		// end of: if ( $show_most_recent_migration )
107
+		?>
108 108
 
109 109
     </div>
110 110
     <!--end of #migration-prep-->
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
             <div id='progress-area'>
125 125
                 <h3 class="espresso-header">
126 126
                     <?php
127
-                    echo sprintf(_n(
128
-                            "The following task needs to be performed:",
129
-                            "The following %s tasks need to be performed:",
130
-                            count($script_names),
131
-                            "event_espresso"
132
-                    ), count($script_names)); ?>
127
+					echo sprintf(_n(
128
+							"The following task needs to be performed:",
129
+							"The following %s tasks need to be performed:",
130
+							count($script_names),
131
+							"event_espresso"
132
+					), count($script_names)); ?>
133 133
                 </h3>
134 134
                 <ul style="list-style: inside;">
135 135
                     <?php foreach ($script_names as $script_name) { ?>
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 <br/>
140 140
                 <?php if (count($script_names) > 1) { ?>
141 141
                     <p><?php esc_html_e("Please note: after each task is completed you will need to continue the Database Update, or report an error to Event Espresso.",
142
-                                "event_espresso"); ?></p>
142
+								"event_espresso"); ?></p>
143 143
                 <?php } ?>
144 144
 
145 145
                 <div class="ee-attention">
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
 					</span>
150 150
                         <br/>
151 151
                         <?php esc_html_e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.",
152
-                                "event_espresso"); ?>
152
+								"event_espresso"); ?>
153 153
                     </p>
154 154
                     <p>
155 155
                         <?php printf(esc_html__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.",
156
-                                "event_espresso"), '<strong>', '</strong>'); ?>
156
+								"event_espresso"), '<strong>', '</strong>'); ?>
157 157
                     </p>
158 158
                     <p>
159 159
                         <?php esc_html_e("Click the button below to begin the migration process.", "event_espresso") ?>
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 
170 170
                 <button id='start-migration' class='button-primary'>
171 171
                     <?php echo $show_continue_current_migration_script ? esc_html__("Continue Database Update",
172
-                            "event_espresso")
173
-                            : esc_html__("Begin Database Update", "event_espresso"); ?>
172
+							"event_espresso")
173
+							: esc_html__("Begin Database Update", "event_espresso"); ?>
174 174
                 </button>
175 175
                 <br class="clear"/>
176 176
 
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
         </div>
187 187
 
188 188
     <?php }
189
-    if ($show_maintenance_switch) {
190
-        ?>
189
+	if ($show_maintenance_switch) {
190
+		?>
191 191
         <h2><span class="dashicons dashicons-admin-tools"></span><?php esc_html_e('Set Event Espresso Maintenance Mode',
192
-                    'event_espresso'); ?></h2>
192
+					'event_espresso'); ?></h2>
193 193
         <form method='post' action='<?php echo $update_migration_script_page_link ?>'>
194 194
             <div class="ee-table-wrap">
195 195
                 <table>
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
                         <td width="40px" align="center">
198 198
                             <input type="radio" id="maintenance_mode_level_off" name="maintenance_mode_level"
199 199
                                    value="0" <?php echo EE_Maintenance_Mode::instance()->level()
200
-                                                        == EE_Maintenance_Mode::level_0_not_in_maintenance
201
-                                    ? 'checked="checked"' : '' ?>>
200
+														== EE_Maintenance_Mode::level_0_not_in_maintenance
201
+									? 'checked="checked"' : '' ?>>
202 202
                         </td>
203 203
                         <th align="left">
204 204
                             <label for="maintenance_mode_level_off"><?php esc_html_e('Maintenance Mode OFF',
205
-                                        'event_espresso'); ?></label>
205
+										'event_espresso'); ?></label>
206 206
                             <p class='description' style="font-weight: normal;">
207 207
                                 <?php esc_html_e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.",
208
-                                        "event_espresso"); ?>
208
+										"event_espresso"); ?>
209 209
                             </p>
210 210
                         </th>
211 211
                     </tr>
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
                         <td width="40px" align="center">
214 214
                             <input type="radio" id="maintenance_mode_level_on" name="maintenance_mode_level"
215 215
                                    value="1" <?php echo EE_Maintenance_Mode::instance()->level()
216
-                                                        == EE_Maintenance_Mode::level_1_frontend_only_maintenance
217
-                                    ? 'checked="checked"' : '' ?>>
216
+														== EE_Maintenance_Mode::level_1_frontend_only_maintenance
217
+									? 'checked="checked"' : '' ?>>
218 218
                         </td>
219 219
                         <th align="left">
220 220
                             <label for="maintenance_mode_level_on">
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                             </label>
223 223
                             <p class='description' style="font-weight: normal;">
224 224
                                 <?php esc_html_e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.",
225
-                                        "event_espresso"); ?>
225
+										"event_espresso"); ?>
226 226
                             </p>
227 227
                         </th>
228 228
                     </tr>
@@ -234,6 +234,6 @@  discard block
 block discarded – undo
234 234
             </p>
235 235
         </form>
236 236
         <?php
237
-    } ?>
237
+	} ?>
238 238
 
239 239
 </div>
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_migration_was_borked_page.template.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 ?>
4
-<h1><?php esc_html_e("Data Migration Error", "event_espresso");?></h1>
5
-<p class='error'><?php printf(esc_html__("Your last Database Update had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"),"<b>","</b>");?></p>
6
-<a id="show-hide-migration-warnings" class="display-the-hidden"><?php esc_html_e("Show Errors", 'event_espresso');?></a>
4
+<h1><?php esc_html_e("Data Migration Error", "event_espresso"); ?></h1>
5
+<p class='error'><?php printf(esc_html__("Your last Database Update had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"), "<b>", "</b>"); ?></p>
6
+<a id="show-hide-migration-warnings" class="display-the-hidden"><?php esc_html_e("Show Errors", 'event_espresso'); ?></a>
7 7
 <ul class="migration-warnings" style="display:none">
8
-<?php foreach($most_recent_migration->get_errors() as $error){ ?>
8
+<?php foreach ($most_recent_migration->get_errors() as $error) { ?>
9 9
 	<li style="overflow-y:auto;max-height:100px"><?php echo esc_html($error)?></li>
10 10
 <?php }?>
11 11
 </ul>
12
-<h2><?php esc_html_e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso");?></h2>
13
-<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL);?>' method='post'>
12
+<h2><?php esc_html_e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso"); ?></h2>
13
+<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL); ?>' method='post'>
14 14
 	<table class='widefat'>
15
-		<tr><td><label for='from'><?php esc_html_e("From/Reply-To:", "event_espresso");?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email','display'); ?>'></td></tr>
16
-		<tr><td><label for='from_name'><?php esc_html_e("Your Name", "event_espresso");?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(esc_html__("Admin of %s", "event_espresso"),get_bloginfo('name','display'));?>'></td></tr>
17
-		<tr><td><label for='body'><?php esc_html_e("Comments", "event_espresso");?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php esc_html_e("Enter any comments about why you think the error may have occurred", "event_espresso");?></textarea>
18
-			<p class='description'><?php esc_html_e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso");?></p></td></tr>
19
-		<tr><td colspan="2"><input type="submit" value="<?php esc_html_e("Mail Crash Report to Event Espresso", "event_espresso");?>"/></td></tr>
15
+		<tr><td><label for='from'><?php esc_html_e("From/Reply-To:", "event_espresso"); ?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email', 'display'); ?>'></td></tr>
16
+		<tr><td><label for='from_name'><?php esc_html_e("Your Name", "event_espresso"); ?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(esc_html__("Admin of %s", "event_espresso"), get_bloginfo('name', 'display')); ?>'></td></tr>
17
+		<tr><td><label for='body'><?php esc_html_e("Comments", "event_espresso"); ?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php esc_html_e("Enter any comments about why you think the error may have occurred", "event_espresso"); ?></textarea>
18
+			<p class='description'><?php esc_html_e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso"); ?></p></td></tr>
19
+		<tr><td colspan="2"><input type="submit" value="<?php esc_html_e("Mail Crash Report to Event Espresso", "event_espresso"); ?>"/></td></tr>
20 20
 	</table>
21 21
 </form>
22 22
 <br>
23
-<p><?php printf(esc_html__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"),'<a href="mailto:'.EE_SUPPORT_EMAIL.'">',EE_SUPPORT_EMAIL,"</a>");?></p>
24
-<textarea class="system_status_info"><?php print_r( EEM_System_Status::instance()->get_system_stati())?></textarea>
25
-<p><?php printf( esc_html__( '%1$sNext Step%2$s', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p>
26
-<p><?php printf( esc_html__( '...or %1$sDON\'T send crash report%2$s.', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p>
23
+<p><?php printf(esc_html__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"), '<a href="mailto:'.EE_SUPPORT_EMAIL.'">', EE_SUPPORT_EMAIL, "</a>"); ?></p>
24
+<textarea class="system_status_info"><?php print_r(EEM_System_Status::instance()->get_system_stati())?></textarea>
25
+<p><?php printf(esc_html__('%1$sNext Step%2$s', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p>
26
+<p><?php printf(esc_html__('...or %1$sDON\'T send crash report%2$s.', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p>
Please login to merge, or discard this patch.
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
      * _get_transaction_and_cart_for_previous_visit
782 782
      *
783 783
      * @access private
784
-     * @return mixed EE_Transaction|NULL
784
+     * @return EE_Transaction|null EE_Transaction|NULL
785 785
      */
786 786
     private function _get_transaction_and_cart_for_previous_visit()
787 787
     {
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
      *    generates a new EE_Transaction object and adds it to the $_transaction property.
864 864
      *
865 865
      * @access private
866
-     * @return mixed EE_Transaction|NULL
866
+     * @return EE_Transaction|null EE_Transaction|NULL
867 867
      */
868 868
     private function _initialize_transaction()
869 869
     {
Please login to merge, or discard this patch.
Indentation   +1856 added lines, -1856 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use EventEspresso\core\exceptions\InvalidEntityException;
6 6
 
7 7
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
8
-    exit('No direct script access allowed');
8
+	exit('No direct script access allowed');
9 9
 }
10 10
 
11 11
 
@@ -20,1861 +20,1861 @@  discard block
 block discarded – undo
20 20
 class EED_Single_Page_Checkout extends EED_Module
21 21
 {
22 22
 
23
-    /**
24
-     * $_initialized - has the SPCO controller already been initialized ?
25
-     *
26
-     * @access private
27
-     * @var bool $_initialized
28
-     */
29
-    private static $_initialized = false;
30
-
31
-
32
-    /**
33
-     * $_checkout_verified - is the EE_Checkout verified as correct for this request ?
34
-     *
35
-     * @access private
36
-     * @var bool $_valid_checkout
37
-     */
38
-    private static $_checkout_verified = true;
39
-
40
-    /**
41
-     *    $_reg_steps_array - holds initial array of reg steps
42
-     *
43
-     * @access private
44
-     * @var array $_reg_steps_array
45
-     */
46
-    private static $_reg_steps_array = array();
47
-
48
-    /**
49
-     *    $checkout - EE_Checkout object for handling the properties of the current checkout process
50
-     *
51
-     * @access public
52
-     * @var EE_Checkout $checkout
53
-     */
54
-    public $checkout;
55
-
56
-
57
-
58
-    /**
59
-     * @return EED_Module|EED_Single_Page_Checkout
60
-     */
61
-    public static function instance()
62
-    {
63
-        add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
64
-        return parent::get_instance(__CLASS__);
65
-    }
66
-
67
-
68
-
69
-    /**
70
-     * @return EE_CART
71
-     */
72
-    public function cart()
73
-    {
74
-        return $this->checkout->cart;
75
-    }
76
-
77
-
78
-
79
-    /**
80
-     * @return EE_Transaction
81
-     */
82
-    public function transaction()
83
-    {
84
-        return $this->checkout->transaction;
85
-    }
86
-
87
-
88
-
89
-    /**
90
-     *    set_hooks - for hooking into EE Core, other modules, etc
91
-     *
92
-     * @access    public
93
-     * @return    void
94
-     * @throws EE_Error
95
-     */
96
-    public static function set_hooks()
97
-    {
98
-        EED_Single_Page_Checkout::set_definitions();
99
-    }
100
-
101
-
102
-
103
-    /**
104
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
105
-     *
106
-     * @access    public
107
-     * @return    void
108
-     * @throws EE_Error
109
-     */
110
-    public static function set_hooks_admin()
111
-    {
112
-        EED_Single_Page_Checkout::set_definitions();
113
-        if ( ! (defined('DOING_AJAX') && DOING_AJAX)) {
114
-            return;
115
-        }
116
-        // going to start an output buffer in case anything gets accidentally output
117
-        // that might disrupt our JSON response
118
-        ob_start();
119
-        EED_Single_Page_Checkout::load_request_handler();
120
-        EED_Single_Page_Checkout::load_reg_steps();
121
-        // set ajax hooks
122
-        add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
123
-        add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
124
-        add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
125
-        add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
126
-        add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
127
-        add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
128
-    }
129
-
130
-
131
-
132
-    /**
133
-     *    process ajax request
134
-     *
135
-     * @param string $ajax_action
136
-     * @throws EE_Error
137
-     */
138
-    public static function process_ajax_request($ajax_action)
139
-    {
140
-        EE_Registry::instance()->REQ->set('action', $ajax_action);
141
-        EED_Single_Page_Checkout::instance()->_initialize();
142
-    }
143
-
144
-
145
-
146
-    /**
147
-     *    ajax display registration step
148
-     *
149
-     * @throws EE_Error
150
-     */
151
-    public static function display_reg_step()
152
-    {
153
-        EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
154
-    }
155
-
156
-
157
-
158
-    /**
159
-     *    ajax process registration step
160
-     *
161
-     * @throws EE_Error
162
-     */
163
-    public static function process_reg_step()
164
-    {
165
-        EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
166
-    }
167
-
168
-
169
-
170
-    /**
171
-     *    ajax process registration step
172
-     *
173
-     * @throws EE_Error
174
-     */
175
-    public static function update_reg_step()
176
-    {
177
-        EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
178
-    }
179
-
180
-
181
-
182
-    /**
183
-     *   update_checkout
184
-     *
185
-     * @access public
186
-     * @return void
187
-     * @throws EE_Error
188
-     */
189
-    public static function update_checkout()
190
-    {
191
-        EED_Single_Page_Checkout::process_ajax_request('update_checkout');
192
-    }
193
-
194
-
195
-
196
-    /**
197
-     *    load_request_handler
198
-     *
199
-     * @access    public
200
-     * @return    void
201
-     */
202
-    public static function load_request_handler()
203
-    {
204
-        // load core Request_Handler class
205
-        if (EE_Registry::instance()->REQ !== null) {
206
-            EE_Registry::instance()->load_core('Request_Handler');
207
-        }
208
-    }
209
-
210
-
211
-
212
-    /**
213
-     *    set_definitions
214
-     *
215
-     * @access    public
216
-     * @return    void
217
-     * @throws EE_Error
218
-     */
219
-    public static function set_definitions()
220
-    {
221
-        if(defined('SPCO_BASE_PATH')) {
222
-            return;
223
-        }
224
-        define(
225
-            'SPCO_BASE_PATH',
226
-            rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS) . DS
227
-        );
228
-        define('SPCO_CSS_URL', plugin_dir_url(__FILE__) . 'css' . DS);
229
-        define('SPCO_IMG_URL', plugin_dir_url(__FILE__) . 'img' . DS);
230
-        define('SPCO_JS_URL', plugin_dir_url(__FILE__) . 'js' . DS);
231
-        define('SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS);
232
-        define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS);
233
-        define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS);
234
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, true);
235
-        EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
236
-            __('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s',
237
-                'event_espresso'),
238
-            '<h4 class="important-notice">',
239
-            '</h4>',
240
-            '<br />',
241
-            '<p>',
242
-            '<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
243
-            '">',
244
-            '</a>',
245
-            '</p>'
246
-        );
247
-    }
248
-
249
-
250
-
251
-    /**
252
-     * load_reg_steps
253
-     * loads and instantiates each reg step based on the EE_Registry::instance()->CFG->registration->reg_steps array
254
-     *
255
-     * @access    private
256
-     * @throws EE_Error
257
-     */
258
-    public static function load_reg_steps()
259
-    {
260
-        static $reg_steps_loaded = false;
261
-        if ($reg_steps_loaded) {
262
-            return;
263
-        }
264
-        // filter list of reg_steps
265
-        $reg_steps_to_load = (array)apply_filters(
266
-            'AHEE__SPCO__load_reg_steps__reg_steps_to_load',
267
-            EED_Single_Page_Checkout::get_reg_steps()
268
-        );
269
-        // sort by key (order)
270
-        ksort($reg_steps_to_load);
271
-        // loop through folders
272
-        foreach ($reg_steps_to_load as $order => $reg_step) {
273
-            // we need a
274
-            if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
275
-                // copy over to the reg_steps_array
276
-                EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
277
-                // register custom key route for each reg step
278
-                // ie: step=>"slug" - this is the entire reason we load the reg steps array now
279
-                EE_Config::register_route(
280
-                    $reg_step['slug'],
281
-                    'EED_Single_Page_Checkout',
282
-                    'run',
283
-                    'step'
284
-                );
285
-                // add AJAX or other hooks
286
-                if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
287
-                    // setup autoloaders if necessary
288
-                    if ( ! class_exists($reg_step['class_name'])) {
289
-                        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(
290
-                            $reg_step['file_path'],
291
-                            true
292
-                        );
293
-                    }
294
-                    if (is_callable($reg_step['class_name'], 'set_hooks')) {
295
-                        call_user_func(array($reg_step['class_name'], 'set_hooks'));
296
-                    }
297
-                }
298
-            }
299
-        }
300
-        $reg_steps_loaded = true;
301
-    }
302
-
303
-
304
-
305
-    /**
306
-     *    get_reg_steps
307
-     *
308
-     * @access    public
309
-     * @return    array
310
-     */
311
-    public static function get_reg_steps()
312
-    {
313
-        $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
314
-        if (empty($reg_steps)) {
315
-            $reg_steps = array(
316
-                10  => array(
317
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'attendee_information',
318
-                    'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
319
-                    'slug'       => 'attendee_information',
320
-                    'has_hooks'  => false,
321
-                ),
322
-                20  => array(
323
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'registration_confirmation',
324
-                    'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
325
-                    'slug'       => 'registration_confirmation',
326
-                    'has_hooks'  => false,
327
-                ),
328
-                30  => array(
329
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'payment_options',
330
-                    'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
331
-                    'slug'       => 'payment_options',
332
-                    'has_hooks'  => true,
333
-                ),
334
-                999 => array(
335
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'finalize_registration',
336
-                    'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
337
-                    'slug'       => 'finalize_registration',
338
-                    'has_hooks'  => false,
339
-                ),
340
-            );
341
-        }
342
-        return $reg_steps;
343
-    }
344
-
345
-
346
-
347
-    /**
348
-     *    registration_checkout_for_admin
349
-     *
350
-     * @access    public
351
-     * @return    string
352
-     * @throws EE_Error
353
-     */
354
-    public static function registration_checkout_for_admin()
355
-    {
356
-        EED_Single_Page_Checkout::load_request_handler();
357
-        EE_Registry::instance()->REQ->set('step', 'attendee_information');
358
-        EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
359
-        EE_Registry::instance()->REQ->set('process_form_submission', false);
360
-        EED_Single_Page_Checkout::instance()->_initialize();
361
-        EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
362
-        return EE_Registry::instance()->REQ->get_output();
363
-    }
364
-
365
-
366
-
367
-    /**
368
-     * process_registration_from_admin
369
-     *
370
-     * @access public
371
-     * @return \EE_Transaction
372
-     * @throws EE_Error
373
-     */
374
-    public static function process_registration_from_admin()
375
-    {
376
-        EED_Single_Page_Checkout::load_request_handler();
377
-        EE_Registry::instance()->REQ->set('step', 'attendee_information');
378
-        EE_Registry::instance()->REQ->set('action', 'process_reg_step');
379
-        EE_Registry::instance()->REQ->set('process_form_submission', true);
380
-        EED_Single_Page_Checkout::instance()->_initialize();
381
-        if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
382
-            $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
383
-            if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
384
-                EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step);
385
-                if ($final_reg_step->process_reg_step()) {
386
-                    $final_reg_step->set_completed();
387
-                    EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array();
388
-                    return EED_Single_Page_Checkout::instance()->checkout->transaction;
389
-                }
390
-            }
391
-        }
392
-        return null;
393
-    }
394
-
395
-
396
-
397
-    /**
398
-     *    run
399
-     *
400
-     * @access    public
401
-     * @param WP_Query $WP_Query
402
-     * @return    void
403
-     * @throws EE_Error
404
-     */
405
-    public function run($WP_Query)
406
-    {
407
-        if (
408
-            $WP_Query instanceof WP_Query
409
-            && $WP_Query->is_main_query()
410
-            && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
411
-            && $this->_is_reg_checkout()
412
-        ) {
413
-            $this->_initialize();
414
-        }
415
-    }
416
-
417
-
418
-
419
-    /**
420
-     * determines whether current url matches reg page url
421
-     *
422
-     * @return bool
423
-     */
424
-    protected function _is_reg_checkout()
425
-    {
426
-        // get current permalink for reg page without any extra query args
427
-        $reg_page_url = \get_permalink(EE_Config::instance()->core->reg_page_id);
428
-        // get request URI for current request, but without the scheme or host
429
-        $current_request_uri = \EEH_URL::filter_input_server_url('REQUEST_URI');
430
-        $current_request_uri = html_entity_decode($current_request_uri);
431
-        // get array of query args from the current request URI
432
-        $query_args = \EEH_URL::get_query_string($current_request_uri);
433
-        // grab page id if it is set
434
-        $page_id = isset($query_args['page_id']) ? absint($query_args['page_id']) : 0;
435
-        // and remove the page id from the query args (we will re-add it later)
436
-        unset($query_args['page_id']);
437
-        // now strip all query args from current request URI
438
-        $current_request_uri = remove_query_arg(array_keys($query_args), $current_request_uri);
439
-        // and re-add the page id if it was set
440
-        if ($page_id) {
441
-            $current_request_uri = add_query_arg('page_id', $page_id, $current_request_uri);
442
-        }
443
-        // remove slashes and ?
444
-        $current_request_uri = trim($current_request_uri, '?/');
445
-        // is current request URI part of the known full reg page URL ?
446
-        return ! empty($current_request_uri) && strpos($reg_page_url, $current_request_uri) !== false;
447
-    }
448
-
449
-
450
-
451
-    /**
452
-     * @param WP_Query $wp_query
453
-     * @return    void
454
-     * @throws EE_Error
455
-     */
456
-    public static function init($wp_query)
457
-    {
458
-        EED_Single_Page_Checkout::instance()->run($wp_query);
459
-    }
460
-
461
-
462
-
463
-    /**
464
-     *    _initialize - initial module setup
465
-     *
466
-     * @access    private
467
-     * @throws EE_Error
468
-     * @return    void
469
-     */
470
-    private function _initialize()
471
-    {
472
-        // ensure SPCO doesn't run twice
473
-        if (EED_Single_Page_Checkout::$_initialized) {
474
-            return;
475
-        }
476
-        try {
477
-            EED_Single_Page_Checkout::load_reg_steps();
478
-            $this->_verify_session();
479
-            // setup the EE_Checkout object
480
-            $this->checkout = $this->_initialize_checkout();
481
-            // filter checkout
482
-            $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
483
-            // get the $_GET
484
-            $this->_get_request_vars();
485
-            if ($this->_block_bots()) {
486
-                return;
487
-            }
488
-            // filter continue_reg
489
-            $this->checkout->continue_reg = apply_filters(
490
-                'FHEE__EED_Single_Page_Checkout__init___continue_reg',
491
-                true,
492
-                $this->checkout
493
-            );
494
-            // load the reg steps array
495
-            if ( ! $this->_load_and_instantiate_reg_steps()) {
496
-                EED_Single_Page_Checkout::$_initialized = true;
497
-                return;
498
-            }
499
-            // set the current step
500
-            $this->checkout->set_current_step($this->checkout->step);
501
-            // and the next step
502
-            $this->checkout->set_next_step();
503
-            // verify that everything has been setup correctly
504
-            if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) {
505
-                EED_Single_Page_Checkout::$_initialized = true;
506
-                return;
507
-            }
508
-            // lock the transaction
509
-            $this->checkout->transaction->lock();
510
-            // make sure all of our cached objects are added to their respective model entity mappers
511
-            $this->checkout->refresh_all_entities();
512
-            // set amount owing
513
-            $this->checkout->amount_owing = $this->checkout->transaction->remaining();
514
-            // initialize each reg step, which gives them the chance to potentially alter the process
515
-            $this->_initialize_reg_steps();
516
-            // DEBUG LOG
517
-            //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
518
-            // get reg form
519
-            if( ! $this->_check_form_submission()) {
520
-                EED_Single_Page_Checkout::$_initialized = true;
521
-                return;
522
-            }
523
-            // checkout the action!!!
524
-            $this->_process_form_action();
525
-            // add some style and make it dance
526
-            $this->add_styles_and_scripts();
527
-            // kk... SPCO has successfully run
528
-            EED_Single_Page_Checkout::$_initialized = true;
529
-            // set no cache headers and constants
530
-            EE_System::do_not_cache();
531
-            // add anchor
532
-            add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
533
-            // remove transaction lock
534
-            add_action('shutdown', array($this, 'unlock_transaction'), 1);
535
-        } catch (Exception $e) {
536
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
537
-        }
538
-    }
539
-
540
-
541
-
542
-    /**
543
-     *    _verify_session
544
-     * checks that the session is valid and not expired
545
-     *
546
-     * @access    private
547
-     * @throws EE_Error
548
-     */
549
-    private function _verify_session()
550
-    {
551
-        if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
552
-            throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso'));
553
-        }
554
-        $clear_session_requested = filter_var(
555
-            EE_Registry::instance()->REQ->get('clear_session', false),
556
-            FILTER_VALIDATE_BOOLEAN
557
-        );
558
-        // is session still valid ?
559
-        if ($clear_session_requested
560
-            || ( EE_Registry::instance()->SSN->expired()
561
-              && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === ''
562
-            )
563
-        ) {
564
-            $this->checkout = new EE_Checkout();
565
-            EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
566
-            // EE_Registry::instance()->SSN->reset_cart();
567
-            // EE_Registry::instance()->SSN->reset_checkout();
568
-            // EE_Registry::instance()->SSN->reset_transaction();
569
-            if (! $clear_session_requested) {
570
-                EE_Error::add_attention(
571
-                    EE_Registry::$i18n_js_strings['registration_expiration_notice'],
572
-                    __FILE__, __FUNCTION__, __LINE__
573
-                );
574
-            }
575
-            // EE_Registry::instance()->SSN->reset_expired();
576
-        }
577
-    }
578
-
579
-
580
-
581
-    /**
582
-     *    _initialize_checkout
583
-     * loads and instantiates EE_Checkout
584
-     *
585
-     * @access    private
586
-     * @throws EE_Error
587
-     * @return EE_Checkout
588
-     */
589
-    private function _initialize_checkout()
590
-    {
591
-        // look in session for existing checkout
592
-        /** @type EE_Checkout $checkout */
593
-        $checkout = EE_Registry::instance()->SSN->checkout();
594
-        // verify
595
-        if ( ! $checkout instanceof EE_Checkout) {
596
-            // instantiate EE_Checkout object for handling the properties of the current checkout process
597
-            $checkout = EE_Registry::instance()->load_file(
598
-                SPCO_INC_PATH,
599
-                'EE_Checkout',
600
-                'class', array(),
601
-                false
602
-            );
603
-        } else {
604
-            if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
605
-                $this->unlock_transaction();
606
-                wp_safe_redirect($checkout->redirect_url);
607
-                exit();
608
-            }
609
-        }
610
-        $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
611
-        // verify again
612
-        if ( ! $checkout instanceof EE_Checkout) {
613
-            throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
614
-        }
615
-        // reset anything that needs a clean slate for each request
616
-        $checkout->reset_for_current_request();
617
-        return $checkout;
618
-    }
619
-
620
-
621
-
622
-    /**
623
-     *    _get_request_vars
624
-     *
625
-     * @access    private
626
-     * @return    void
627
-     * @throws EE_Error
628
-     */
629
-    private function _get_request_vars()
630
-    {
631
-        // load classes
632
-        EED_Single_Page_Checkout::load_request_handler();
633
-        //make sure this request is marked as belonging to EE
634
-        EE_Registry::instance()->REQ->set_espresso_page(true);
635
-        // which step is being requested ?
636
-        $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
637
-        // which step is being edited ?
638
-        $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
639
-        // and what we're doing on the current step
640
-        $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
641
-        // timestamp
642
-        $this->checkout->uts = EE_Registry::instance()->REQ->get('uts', 0);
643
-        // returning to edit ?
644
-        $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
645
-        // or some other kind of revisit ?
646
-        $this->checkout->revisit = filter_var(
647
-            EE_Registry::instance()->REQ->get('revisit', false),
648
-            FILTER_VALIDATE_BOOLEAN
649
-        );
650
-        // and whether or not to generate a reg form for this request
651
-        $this->checkout->generate_reg_form = filter_var(
652
-            EE_Registry::instance()->REQ->get('generate_reg_form', true),
653
-            FILTER_VALIDATE_BOOLEAN
654
-        );
655
-        // and whether or not to process a reg form submission for this request
656
-        $this->checkout->process_form_submission = filter_var(
657
-            EE_Registry::instance()->REQ->get(
658
-                'process_form_submission',
659
-                $this->checkout->action === 'process_reg_step'
660
-            ),
661
-            FILTER_VALIDATE_BOOLEAN
662
-        );
663
-        $this->checkout->process_form_submission = filter_var(
664
-            $this->checkout->action !== 'display_spco_reg_step'
665
-                ? $this->checkout->process_form_submission
666
-                : false,
667
-            FILTER_VALIDATE_BOOLEAN
668
-        );
669
-        // $this->_display_request_vars();
670
-    }
671
-
672
-
673
-
674
-    /**
675
-     *  _display_request_vars
676
-     *
677
-     * @access    protected
678
-     * @return    void
679
-     */
680
-    protected function _display_request_vars()
681
-    {
682
-        if ( ! WP_DEBUG) {
683
-            return;
684
-        }
685
-        EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
686
-        EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
687
-        EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
688
-        EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
689
-        EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
690
-        EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
691
-        EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
692
-        EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
693
-    }
694
-
695
-
696
-
697
-    /**
698
-     * _block_bots
699
-     * checks that the incoming request has either of the following set:
700
-     *  a uts (unix timestamp) which indicates that the request was redirected from the Ticket Selector
701
-     *  a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN
702
-     * so if you're not coming from the Ticket Selector nor returning for a valid IP...
703
-     * then where you coming from man?
704
-     *
705
-     * @return boolean
706
-     */
707
-    private function _block_bots()
708
-    {
709
-        $invalid_checkout_access = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess();
710
-        if ($invalid_checkout_access->checkoutAccessIsInvalid($this->checkout)) {
711
-            return true;
712
-        }
713
-        return false;
714
-    }
715
-
716
-
717
-
718
-    /**
719
-     *    _get_first_step
720
-     *  gets slug for first step in $_reg_steps_array
721
-     *
722
-     * @access    private
723
-     * @throws EE_Error
724
-     * @return    string
725
-     */
726
-    private function _get_first_step()
727
-    {
728
-        $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
729
-        return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
730
-    }
731
-
732
-
733
-
734
-    /**
735
-     *    _load_and_instantiate_reg_steps
736
-     *  instantiates each reg step based on the loaded reg_steps array
737
-     *
738
-     * @access    private
739
-     * @throws EE_Error
740
-     * @return    bool
741
-     */
742
-    private function _load_and_instantiate_reg_steps()
743
-    {
744
-        do_action('AHEE__Single_Page_Checkout___load_and_instantiate_reg_steps__start', $this->checkout);
745
-        // have reg_steps already been instantiated ?
746
-        if (
747
-            empty($this->checkout->reg_steps)
748
-            || apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
749
-        ) {
750
-            // if not, then loop through raw reg steps array
751
-            foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
752
-                if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
753
-                    return false;
754
-                }
755
-            }
756
-            EE_Registry::instance()->CFG->registration->skip_reg_confirmation = true;
757
-            EE_Registry::instance()->CFG->registration->reg_confirmation_last = true;
758
-            // skip the registration_confirmation page ?
759
-            if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
760
-                // just remove it from the reg steps array
761
-                $this->checkout->remove_reg_step('registration_confirmation', false);
762
-            } else if (
763
-                isset($this->checkout->reg_steps['registration_confirmation'])
764
-                && EE_Registry::instance()->CFG->registration->reg_confirmation_last
765
-            ) {
766
-                // set the order to something big like 100
767
-                $this->checkout->set_reg_step_order('registration_confirmation', 100);
768
-            }
769
-            // filter the array for good luck
770
-            $this->checkout->reg_steps = apply_filters(
771
-                'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps',
772
-                $this->checkout->reg_steps
773
-            );
774
-            // finally re-sort based on the reg step class order properties
775
-            $this->checkout->sort_reg_steps();
776
-        } else {
777
-            foreach ($this->checkout->reg_steps as $reg_step) {
778
-                // set all current step stati to FALSE
779
-                $reg_step->set_is_current_step(false);
780
-            }
781
-        }
782
-        if (empty($this->checkout->reg_steps)) {
783
-            EE_Error::add_error(
784
-                __('No Reg Steps were loaded..', 'event_espresso'),
785
-                __FILE__, __FUNCTION__, __LINE__
786
-            );
787
-            return false;
788
-        }
789
-        // make reg step details available to JS
790
-        $this->checkout->set_reg_step_JSON_info();
791
-        return true;
792
-    }
793
-
794
-
795
-
796
-    /**
797
-     *     _load_and_instantiate_reg_step
798
-     *
799
-     * @access    private
800
-     * @param array $reg_step
801
-     * @param int   $order
802
-     * @return bool
803
-     */
804
-    private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0)
805
-    {
806
-        // we need a file_path, class_name, and slug to add a reg step
807
-        if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
808
-            // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
809
-            if (
810
-                $this->checkout->reg_url_link
811
-                && $this->checkout->step !== $reg_step['slug']
812
-                && $reg_step['slug'] !== 'finalize_registration'
813
-                // normally at this point we would NOT load the reg step, but this filter can change that
814
-                && apply_filters(
815
-                    'FHEE__Single_Page_Checkout___load_and_instantiate_reg_step__bypass_reg_step',
816
-                    true,
817
-                    $reg_step,
818
-                    $this->checkout
819
-                )
820
-            ) {
821
-                return true;
822
-            }
823
-            // instantiate step class using file path and class name
824
-            $reg_step_obj = EE_Registry::instance()->load_file(
825
-                $reg_step['file_path'],
826
-                $reg_step['class_name'],
827
-                'class',
828
-                $this->checkout,
829
-                false
830
-            );
831
-            // did we gets the goods ?
832
-            if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
833
-                // set reg step order based on config
834
-                $reg_step_obj->set_order($order);
835
-                // add instantiated reg step object to the master reg steps array
836
-                $this->checkout->add_reg_step($reg_step_obj);
837
-            } else {
838
-                EE_Error::add_error(
839
-                    __('The current step could not be set.', 'event_espresso'),
840
-                    __FILE__, __FUNCTION__, __LINE__
841
-                );
842
-                return false;
843
-            }
844
-        } else {
845
-            if (WP_DEBUG) {
846
-                EE_Error::add_error(
847
-                    sprintf(
848
-                        __(
849
-                            'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s',
850
-                            'event_espresso'
851
-                        ),
852
-                        isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
853
-                        isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
854
-                        isset($reg_step['slug']) ? $reg_step['slug'] : '',
855
-                        '<ul>',
856
-                        '<li>',
857
-                        '</li>',
858
-                        '</ul>'
859
-                    ),
860
-                    __FILE__, __FUNCTION__, __LINE__
861
-                );
862
-            }
863
-            return false;
864
-        }
865
-        return true;
866
-    }
867
-
868
-
869
-    /**
870
-     * _verify_transaction_and_get_registrations
871
-     *
872
-     * @access private
873
-     * @return bool
874
-     * @throws InvalidDataTypeException
875
-     * @throws InvalidEntityException
876
-     * @throws EE_Error
877
-     */
878
-    private function _verify_transaction_and_get_registrations()
879
-    {
880
-        // was there already a valid transaction in the checkout from the session ?
881
-        if ( ! $this->checkout->transaction instanceof EE_Transaction) {
882
-            // get transaction from db or session
883
-            $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
884
-                ? $this->_get_transaction_and_cart_for_previous_visit()
885
-                : $this->_get_cart_for_current_session_and_setup_new_transaction();
886
-            if ( ! $this->checkout->transaction instanceof EE_Transaction) {
887
-                EE_Error::add_error(
888
-                    __('Your Registration and Transaction information could not be retrieved from the db.',
889
-                        'event_espresso'),
890
-                    __FILE__, __FUNCTION__, __LINE__
891
-                );
892
-                $this->checkout->transaction = EE_Transaction::new_instance();
893
-                // add some style and make it dance
894
-                $this->add_styles_and_scripts();
895
-                EED_Single_Page_Checkout::$_initialized = true;
896
-                return false;
897
-            }
898
-            // and the registrations for the transaction
899
-            $this->_get_registrations($this->checkout->transaction);
900
-        }
901
-        return true;
902
-    }
903
-
904
-
905
-
906
-    /**
907
-     * _get_transaction_and_cart_for_previous_visit
908
-     *
909
-     * @access private
910
-     * @return mixed EE_Transaction|NULL
911
-     */
912
-    private function _get_transaction_and_cart_for_previous_visit()
913
-    {
914
-        /** @var $TXN_model EEM_Transaction */
915
-        $TXN_model = EE_Registry::instance()->load_model('Transaction');
916
-        // because the reg_url_link is present in the request,
917
-        // this is a return visit to SPCO, so we'll get the transaction data from the db
918
-        $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
919
-        // verify transaction
920
-        if ($transaction instanceof EE_Transaction) {
921
-            // and get the cart that was used for that transaction
922
-            $this->checkout->cart = $this->_get_cart_for_transaction($transaction);
923
-            return $transaction;
924
-        }
925
-        EE_Error::add_error(
926
-            __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'),
927
-            __FILE__, __FUNCTION__, __LINE__
928
-        );
929
-        return null;
930
-
931
-    }
932
-
933
-
934
-
935
-    /**
936
-     * _get_cart_for_transaction
937
-     *
938
-     * @access private
939
-     * @param EE_Transaction $transaction
940
-     * @return EE_Cart
941
-     */
942
-    private function _get_cart_for_transaction($transaction)
943
-    {
944
-        return $this->checkout->get_cart_for_transaction($transaction);
945
-    }
946
-
947
-
948
-
949
-    /**
950
-     * get_cart_for_transaction
951
-     *
952
-     * @access public
953
-     * @param EE_Transaction $transaction
954
-     * @return EE_Cart
955
-     */
956
-    public function get_cart_for_transaction(EE_Transaction $transaction)
957
-    {
958
-        return $this->checkout->get_cart_for_transaction($transaction);
959
-    }
960
-
961
-
962
-
963
-    /**
964
-     * _get_transaction_and_cart_for_current_session
965
-     *    generates a new EE_Transaction object and adds it to the $_transaction property.
966
-     *
967
-     * @access private
968
-     * @return EE_Transaction
969
-     * @throws EE_Error
970
-     */
971
-    private function _get_cart_for_current_session_and_setup_new_transaction()
972
-    {
973
-        //  if there's no transaction, then this is the FIRST visit to SPCO
974
-        // so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
975
-        $this->checkout->cart = $this->_get_cart_for_transaction(null);
976
-        // and then create a new transaction
977
-        $transaction = $this->_initialize_transaction();
978
-        // verify transaction
979
-        if ($transaction instanceof EE_Transaction) {
980
-            // save it so that we have an ID for other objects to use
981
-            $transaction->save();
982
-            // and save TXN data to the cart
983
-            $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
984
-        } else {
985
-            EE_Error::add_error(
986
-                __('A Valid Transaction could not be initialized.', 'event_espresso'),
987
-                __FILE__, __FUNCTION__, __LINE__
988
-            );
989
-        }
990
-        return $transaction;
991
-    }
992
-
993
-
994
-
995
-    /**
996
-     *    generates a new EE_Transaction object and adds it to the $_transaction property.
997
-     *
998
-     * @access private
999
-     * @return mixed EE_Transaction|NULL
1000
-     */
1001
-    private function _initialize_transaction()
1002
-    {
1003
-        try {
1004
-            // ensure cart totals have been calculated
1005
-            $this->checkout->cart->get_grand_total()->recalculate_total_including_taxes();
1006
-            // grab the cart grand total
1007
-            $cart_total = $this->checkout->cart->get_cart_grand_total();
1008
-            // create new TXN
1009
-            $transaction = EE_Transaction::new_instance(
1010
-                array(
1011
-                    'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(),
1012
-                    'TXN_total'     => $cart_total > 0 ? $cart_total : 0,
1013
-                    'TXN_paid'      => 0,
1014
-                    'STS_ID'        => EEM_Transaction::failed_status_code,
1015
-                )
1016
-            );
1017
-            // save it so that we have an ID for other objects to use
1018
-            $transaction->save();
1019
-            // set cron job for following up on TXNs after their session has expired
1020
-            EE_Cron_Tasks::schedule_expired_transaction_check(
1021
-                EE_Registry::instance()->SSN->expiration() + 1,
1022
-                $transaction->ID()
1023
-            );
1024
-            return $transaction;
1025
-        } catch (Exception $e) {
1026
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1027
-        }
1028
-        return null;
1029
-    }
1030
-
1031
-
1032
-    /**
1033
-     * _get_registrations
1034
-     *
1035
-     * @access private
1036
-     * @param EE_Transaction $transaction
1037
-     * @return void
1038
-     * @throws InvalidDataTypeException
1039
-     * @throws InvalidEntityException
1040
-     * @throws EE_Error
1041
-     */
1042
-    private function _get_registrations(EE_Transaction $transaction)
1043
-    {
1044
-        // first step: grab the registrants  { : o
1045
-        $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
1046
-        // verify registrations have been set
1047
-        if (empty($registrations)) {
1048
-            // if no cached registrations, then check the db
1049
-            $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
1050
-            // still nothing ? well as long as this isn't a revisit
1051
-            if (empty($registrations) && ! $this->checkout->revisit) {
1052
-                // generate new registrations from scratch
1053
-                $registrations = $this->_initialize_registrations($transaction);
1054
-            }
1055
-        }
1056
-        // sort by their original registration order
1057
-        usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
1058
-        // then loop thru the array
1059
-        foreach ($registrations as $registration) {
1060
-            // verify each registration
1061
-            if ($registration instanceof EE_Registration) {
1062
-                // we display all attendee info for the primary registrant
1063
-                if ($this->checkout->reg_url_link === $registration->reg_url_link()
1064
-                    && $registration->is_primary_registrant()
1065
-                ) {
1066
-                    $this->checkout->primary_revisit = true;
1067
-                    break;
1068
-                }
1069
-                if ($this->checkout->revisit
1070
-                           && $this->checkout->reg_url_link !== $registration->reg_url_link()
1071
-                ) {
1072
-                    // but hide info if it doesn't belong to you
1073
-                    $transaction->clear_cache('Registration', $registration->ID());
1074
-                }
1075
-                $this->checkout->set_reg_status_updated($registration->ID(), false);
1076
-            }
1077
-        }
1078
-    }
1079
-
1080
-
1081
-    /**
1082
-     *    adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object
1083
-     *
1084
-     * @access private
1085
-     * @param EE_Transaction $transaction
1086
-     * @return    array
1087
-     * @throws InvalidDataTypeException
1088
-     * @throws InvalidEntityException
1089
-     * @throws EE_Error
1090
-     */
1091
-    private function _initialize_registrations(EE_Transaction $transaction)
1092
-    {
1093
-        $att_nmbr = 0;
1094
-        $registrations = array();
1095
-        if ($transaction instanceof EE_Transaction) {
1096
-            /** @type EE_Registration_Processor $registration_processor */
1097
-            $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1098
-            $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
1099
-            // now let's add the cart items to the $transaction
1100
-            foreach ($this->checkout->cart->get_tickets() as $line_item) {
1101
-                //do the following for each ticket of this type they selected
1102
-                for ($x = 1; $x <= $line_item->quantity(); $x++) {
1103
-                    $att_nmbr++;
1104
-                    /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
1105
-                    $CreateRegistrationCommand = EE_Registry::instance()->create(
1106
-                        'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
1107
-                        array(
1108
-                            $transaction,
1109
-                            $line_item,
1110
-                            $att_nmbr,
1111
-                            $this->checkout->total_ticket_count,
1112
-                        )
1113
-                    );
1114
-                    // override capabilities for frontend registrations
1115
-                    if ( ! is_admin()) {
1116
-                        $CreateRegistrationCommand->setCapCheck(
1117
-                            new PublicCapabilities('', 'create_new_registration')
1118
-                        );
1119
-                    }
1120
-                    $registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand);
1121
-                    if ( ! $registration instanceof EE_Registration) {
1122
-                        throw new InvalidEntityException($registration, 'EE_Registration');
1123
-                    }
1124
-                    $registrations[ $registration->ID() ] = $registration;
1125
-                }
1126
-            }
1127
-            $registration_processor->fix_reg_final_price_rounding_issue($transaction);
1128
-        }
1129
-        return $registrations;
1130
-    }
1131
-
1132
-
1133
-
1134
-    /**
1135
-     * sorts registrations by REG_count
1136
-     *
1137
-     * @access public
1138
-     * @param EE_Registration $reg_A
1139
-     * @param EE_Registration $reg_B
1140
-     * @return int
1141
-     */
1142
-    public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B)
1143
-    {
1144
-        // this shouldn't ever happen within the same TXN, but oh well
1145
-        if ($reg_A->count() === $reg_B->count()) {
1146
-            return 0;
1147
-        }
1148
-        return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
1149
-    }
1150
-
1151
-
1152
-
1153
-    /**
1154
-     *    _final_verifications
1155
-     * just makes sure that everything is set up correctly before proceeding
1156
-     *
1157
-     * @access    private
1158
-     * @return    bool
1159
-     * @throws EE_Error
1160
-     */
1161
-    private function _final_verifications()
1162
-    {
1163
-        // filter checkout
1164
-        $this->checkout = apply_filters(
1165
-            'FHEE__EED_Single_Page_Checkout___final_verifications__checkout',
1166
-            $this->checkout
1167
-        );
1168
-        //verify that current step is still set correctly
1169
-        if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
1170
-            EE_Error::add_error(
1171
-                __('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'),
1172
-                __FILE__,
1173
-                __FUNCTION__,
1174
-                __LINE__
1175
-            );
1176
-            return false;
1177
-        }
1178
-        // if returning to SPCO, then verify that primary registrant is set
1179
-        if ( ! empty($this->checkout->reg_url_link)) {
1180
-            $valid_registrant = $this->checkout->transaction->primary_registration();
1181
-            if ( ! $valid_registrant instanceof EE_Registration) {
1182
-                EE_Error::add_error(
1183
-                    __('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'),
1184
-                    __FILE__,
1185
-                    __FUNCTION__,
1186
-                    __LINE__
1187
-                );
1188
-                return false;
1189
-            }
1190
-            $valid_registrant = null;
1191
-            foreach (
1192
-                $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration
1193
-            ) {
1194
-                if (
1195
-                    $registration instanceof EE_Registration
1196
-                    && $registration->reg_url_link() === $this->checkout->reg_url_link
1197
-                ) {
1198
-                    $valid_registrant = $registration;
1199
-                }
1200
-            }
1201
-            if ( ! $valid_registrant instanceof EE_Registration) {
1202
-                // hmmm... maybe we have the wrong session because the user is opening multiple tabs ?
1203
-                if (EED_Single_Page_Checkout::$_checkout_verified) {
1204
-                    // clear the session, mark the checkout as unverified, and try again
1205
-                    EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
1206
-                    EED_Single_Page_Checkout::$_initialized = false;
1207
-                    EED_Single_Page_Checkout::$_checkout_verified = false;
1208
-                    $this->_initialize();
1209
-                    EE_Error::reset_notices();
1210
-                    return false;
1211
-                }
1212
-                EE_Error::add_error(
1213
-                    __(
1214
-                        'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.',
1215
-                        'event_espresso'
1216
-                    ),
1217
-                    __FILE__,
1218
-                    __FUNCTION__,
1219
-                    __LINE__
1220
-                );
1221
-                return false;
1222
-            }
1223
-        }
1224
-        // now that things have been kinda sufficiently verified,
1225
-        // let's add the checkout to the session so that it's available to other systems
1226
-        EE_Registry::instance()->SSN->set_checkout($this->checkout);
1227
-        return true;
1228
-    }
1229
-
1230
-
1231
-
1232
-    /**
1233
-     *    _initialize_reg_steps
1234
-     * first makes sure that EE_Transaction_Processor::set_reg_step_initiated() is called as required
1235
-     * then loops thru all of the active reg steps and calls the initialize_reg_step() method
1236
-     *
1237
-     * @access    private
1238
-     * @param bool $reinitializing
1239
-     * @throws EE_Error
1240
-     */
1241
-    private function _initialize_reg_steps($reinitializing = false)
1242
-    {
1243
-        $this->checkout->set_reg_step_initiated($this->checkout->current_step);
1244
-        // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
1245
-        foreach ($this->checkout->reg_steps as $reg_step) {
1246
-            if ( ! $reg_step->initialize_reg_step()) {
1247
-                // if not initialized then maybe this step is being removed...
1248
-                if ( ! $reinitializing && $reg_step->is_current_step()) {
1249
-                    // if it was the current step, then we need to start over here
1250
-                    $this->_initialize_reg_steps(true);
1251
-                    return;
1252
-                }
1253
-                continue;
1254
-            }
1255
-            // add css and JS for current step
1256
-            $reg_step->enqueue_styles_and_scripts();
1257
-            // i18n
1258
-            $reg_step->translate_js_strings();
1259
-            if ($reg_step->is_current_step()) {
1260
-                // the text that appears on the reg step form submit button
1261
-                $reg_step->set_submit_button_text();
1262
-            }
1263
-        }
1264
-        // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
1265
-        do_action(
1266
-            "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}",
1267
-            $this->checkout->current_step
1268
-        );
1269
-    }
1270
-
1271
-
1272
-
1273
-    /**
1274
-     * _check_form_submission
1275
-     *
1276
-     * @access private
1277
-     * @return boolean
1278
-     */
1279
-    private function _check_form_submission()
1280
-    {
1281
-        //does this request require the reg form to be generated ?
1282
-        if ($this->checkout->generate_reg_form) {
1283
-            // ever heard that song by Blue Rodeo ?
1284
-            try {
1285
-                $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
1286
-                // if not displaying a form, then check for form submission
1287
-                if (
1288
-                    $this->checkout->process_form_submission
1289
-                    && $this->checkout->current_step->reg_form->was_submitted()
1290
-                ) {
1291
-                    // clear out any old data in case this step is being run again
1292
-                    $this->checkout->current_step->set_valid_data(array());
1293
-                    // capture submitted form data
1294
-                    $this->checkout->current_step->reg_form->receive_form_submission(
1295
-                        apply_filters(
1296
-                            'FHEE__Single_Page_Checkout___check_form_submission__request_params',
1297
-                            EE_Registry::instance()->REQ->params(),
1298
-                            $this->checkout
1299
-                        )
1300
-                    );
1301
-                    // validate submitted form data
1302
-                    if ( ! $this->checkout->continue_reg || ! $this->checkout->current_step->reg_form->is_valid()) {
1303
-                        // thou shall not pass !!!
1304
-                        $this->checkout->continue_reg = false;
1305
-                        // any form validation errors?
1306
-                        if ($this->checkout->current_step->reg_form->submission_error_message() !== '') {
1307
-                            $submission_error_messages = array();
1308
-                            // bad, bad, bad registrant
1309
-                            foreach (
1310
-                                $this->checkout->current_step->reg_form->get_validation_errors_accumulated()
1311
-                                as $validation_error
1312
-                            ) {
1313
-                                if ($validation_error instanceof EE_Validation_Error) {
1314
-                                    $submission_error_messages[] = sprintf(
1315
-                                        __('%s : %s', 'event_espresso'),
1316
-                                        $validation_error->get_form_section()->html_label_text(),
1317
-                                        $validation_error->getMessage()
1318
-                                    );
1319
-                                }
1320
-                            }
1321
-                            EE_Error::add_error(
1322
-                                implode('<br />', $submission_error_messages),
1323
-                                __FILE__, __FUNCTION__, __LINE__
1324
-                            );
1325
-                        }
1326
-                        // well not really... what will happen is
1327
-                        // we'll just get redirected back to redo the current step
1328
-                        $this->go_to_next_step();
1329
-                        return false;
1330
-                    }
1331
-                }
1332
-            } catch (EE_Error $e) {
1333
-                $e->get_error();
1334
-            }
1335
-        }
1336
-        return true;
1337
-    }
1338
-
1339
-
1340
-
1341
-    /**
1342
-     * _process_action
1343
-     *
1344
-     * @access private
1345
-     * @return void
1346
-     * @throws EE_Error
1347
-     */
1348
-    private function _process_form_action()
1349
-    {
1350
-        // what cha wanna do?
1351
-        switch ($this->checkout->action) {
1352
-            // AJAX next step reg form
1353
-            case 'display_spco_reg_step' :
1354
-                $this->checkout->redirect = false;
1355
-                if (EE_Registry::instance()->REQ->ajax) {
1356
-                    $this->checkout->json_response->set_reg_step_html(
1357
-                        $this->checkout->current_step->display_reg_form()
1358
-                    );
1359
-                }
1360
-                break;
1361
-            default :
1362
-                // meh... do one of those other steps first
1363
-                if (
1364
-                    ! empty($this->checkout->action)
1365
-                    && is_callable(array($this->checkout->current_step, $this->checkout->action))
1366
-                ) {
1367
-                    // dynamically creates hook point like:
1368
-                    //   AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1369
-                    do_action(
1370
-                        "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}",
1371
-                        $this->checkout->current_step
1372
-                    );
1373
-                    // call action on current step
1374
-                    if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
1375
-                        // good registrant, you get to proceed
1376
-                        if (
1377
-                            $this->checkout->current_step->success_message() !== ''
1378
-                            && apply_filters(
1379
-                                'FHEE__Single_Page_Checkout___process_form_action__display_success',
1380
-                                false
1381
-                            )
1382
-                        ) {
1383
-                            EE_Error::add_success(
1384
-                                $this->checkout->current_step->success_message()
1385
-                                . '<br />' . $this->checkout->next_step->_instructions()
1386
-                            );
1387
-                        }
1388
-                        // pack it up, pack it in...
1389
-                        $this->_setup_redirect();
1390
-                    }
1391
-                    // dynamically creates hook point like:
1392
-                    //  AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1393
-                    do_action(
1394
-                        "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}",
1395
-                        $this->checkout->current_step
1396
-                    );
1397
-                } else {
1398
-                    EE_Error::add_error(
1399
-                        sprintf(
1400
-                            __(
1401
-                                'The requested form action "%s" does not exist for the current "%s" registration step.',
1402
-                                'event_espresso'
1403
-                            ),
1404
-                            $this->checkout->action,
1405
-                            $this->checkout->current_step->name()
1406
-                        ),
1407
-                        __FILE__,
1408
-                        __FUNCTION__,
1409
-                        __LINE__
1410
-                    );
1411
-                }
1412
-            // end default
1413
-        }
1414
-        // store our progress so far
1415
-        $this->checkout->stash_transaction_and_checkout();
1416
-        // advance to the next step! If you pass GO, collect $200
1417
-        $this->go_to_next_step();
1418
-    }
1419
-
1420
-
1421
-
1422
-    /**
1423
-     *        add_styles_and_scripts
1424
-     *
1425
-     * @access        public
1426
-     * @return        void
1427
-     */
1428
-    public function add_styles_and_scripts()
1429
-    {
1430
-        // i18n
1431
-        $this->translate_js_strings();
1432
-        if ($this->checkout->admin_request) {
1433
-            add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1434
-        } else {
1435
-            add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1436
-        }
1437
-    }
1438
-
1439
-
1440
-
1441
-    /**
1442
-     *        translate_js_strings
1443
-     *
1444
-     * @access        public
1445
-     * @return        void
1446
-     */
1447
-    public function translate_js_strings()
1448
-    {
1449
-        EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1450
-        EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1451
-        EE_Registry::$i18n_js_strings['server_error'] = __(
1452
-            'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.',
1453
-            'event_espresso'
1454
-        );
1455
-        EE_Registry::$i18n_js_strings['invalid_json_response'] = __(
1456
-            'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.',
1457
-            'event_espresso'
1458
-        );
1459
-        EE_Registry::$i18n_js_strings['validation_error'] = __(
1460
-            'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.',
1461
-            'event_espresso'
1462
-        );
1463
-        EE_Registry::$i18n_js_strings['invalid_payment_method'] = __(
1464
-            'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.',
1465
-            'event_espresso'
1466
-        );
1467
-        EE_Registry::$i18n_js_strings['reg_step_error'] = __(
1468
-            'This registration step could not be completed. Please refresh the page and try again.',
1469
-            'event_espresso'
1470
-        );
1471
-        EE_Registry::$i18n_js_strings['invalid_coupon'] = __(
1472
-            'We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.',
1473
-            'event_espresso'
1474
-        );
1475
-        EE_Registry::$i18n_js_strings['process_registration'] = sprintf(
1476
-            __(
1477
-                'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.',
1478
-                'event_espresso'
1479
-            ),
1480
-            '<br/>',
1481
-            '<br/>'
1482
-        );
1483
-        EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1484
-        EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1485
-        EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1486
-        EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1487
-        EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1488
-        EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1489
-        EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1490
-        EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1491
-        EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1492
-        EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1493
-        EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1494
-        EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1495
-        EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1496
-        EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1497
-        EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1498
-        EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1499
-        EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1500
-        EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1501
-        EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1502
-            __(
1503
-                '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s',
1504
-                'event_espresso'
1505
-            ),
1506
-            '<h4 class="important-notice">',
1507
-            '</h4>',
1508
-            '<br />',
1509
-            '<p>',
1510
-            '<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
1511
-            '">',
1512
-            '</a>',
1513
-            '</p>'
1514
-        );
1515
-        EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters(
1516
-            'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
1517
-            true
1518
-        );
1519
-        EE_Registry::$i18n_js_strings['session_extension'] = absint(
1520
-            apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS)
1521
-        );
1522
-        EE_Registry::$i18n_js_strings['session_expiration'] = gmdate(
1523
-            'M d, Y H:i:s',
1524
-            EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1525
-        );
1526
-    }
1527
-
1528
-
1529
-
1530
-    /**
1531
-     *    enqueue_styles_and_scripts
1532
-     *
1533
-     * @access        public
1534
-     * @return        void
1535
-     * @throws EE_Error
1536
-     */
1537
-    public function enqueue_styles_and_scripts()
1538
-    {
1539
-        // load css
1540
-        wp_register_style(
1541
-            'single_page_checkout',
1542
-            SPCO_CSS_URL . 'single_page_checkout.css',
1543
-            array('espresso_default'),
1544
-            EVENT_ESPRESSO_VERSION
1545
-        );
1546
-        wp_enqueue_style('single_page_checkout');
1547
-        // load JS
1548
-        wp_register_script(
1549
-            'jquery_plugin',
1550
-            EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js',
1551
-            array('jquery'),
1552
-            '1.0.1',
1553
-            true
1554
-        );
1555
-        wp_register_script(
1556
-            'jquery_countdown',
1557
-            EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js',
1558
-            array('jquery_plugin'),
1559
-            '2.0.2',
1560
-            true
1561
-        );
1562
-        wp_register_script(
1563
-            'single_page_checkout',
1564
-            SPCO_JS_URL . 'single_page_checkout.js',
1565
-            array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'),
1566
-            EVENT_ESPRESSO_VERSION,
1567
-            true
1568
-        );
1569
-        if ($this->checkout->registration_form instanceof EE_Form_Section_Proper) {
1570
-            $this->checkout->registration_form->enqueue_js();
1571
-        }
1572
-        if ($this->checkout->current_step->reg_form instanceof EE_Form_Section_Proper) {
1573
-            $this->checkout->current_step->reg_form->enqueue_js();
1574
-        }
1575
-        wp_enqueue_script('single_page_checkout');
1576
-        /**
1577
-         * global action hook for enqueueing styles and scripts with
1578
-         * spco calls.
1579
-         */
1580
-        do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1581
-        /**
1582
-         * dynamic action hook for enqueueing styles and scripts with spco calls.
1583
-         * The hook will end up being something like:
1584
-         *      AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1585
-         */
1586
-        do_action(
1587
-            'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(),
1588
-            $this
1589
-        );
1590
-    }
1591
-
1592
-
1593
-
1594
-    /**
1595
-     *    display the Registration Single Page Checkout Form
1596
-     *
1597
-     * @access    private
1598
-     * @return    void
1599
-     * @throws EE_Error
1600
-     */
1601
-    private function _display_spco_reg_form()
1602
-    {
1603
-        // if registering via the admin, just display the reg form for the current step
1604
-        if ($this->checkout->admin_request) {
1605
-            EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1606
-        } else {
1607
-            // add powered by EE msg
1608
-            add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1609
-            $empty_cart = count(
1610
-                $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)
1611
-            ) < 1;
1612
-            EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart;
1613
-            $cookies_not_set_msg = '';
1614
-            if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) {
1615
-                $cookies_not_set_msg = apply_filters(
1616
-                    'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1617
-                    sprintf(
1618
-                        __(
1619
-                            '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s',
1620
-                            'event_espresso'
1621
-                        ),
1622
-                        '<div class="ee-attention">',
1623
-                        '</div>',
1624
-                        '<h6 class="important-notice">',
1625
-                        '</h6>',
1626
-                        '<p>',
1627
-                        '</p>',
1628
-                        '<br />',
1629
-                        '<a href="http://www.whatarecookies.com/enable.asp" target="_blank">',
1630
-                        '</a>'
1631
-                    )
1632
-                );
1633
-            }
1634
-            $this->checkout->registration_form = new EE_Form_Section_Proper(
1635
-                array(
1636
-                    'name'            => 'single-page-checkout',
1637
-                    'html_id'         => 'ee-single-page-checkout-dv',
1638
-                    'layout_strategy' =>
1639
-                        new EE_Template_Layout(
1640
-                            array(
1641
-                                'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1642
-                                'template_args'        => array(
1643
-                                    'empty_cart'              => $empty_cart,
1644
-                                    'revisit'                 => $this->checkout->revisit,
1645
-                                    'reg_steps'               => $this->checkout->reg_steps,
1646
-                                    'next_step'               => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
1647
-                                        ? $this->checkout->next_step->slug()
1648
-                                        : '',
1649
-                                    'cancel_page_url'         => $this->checkout->cancel_page_url,
1650
-                                    'empty_msg'               => apply_filters(
1651
-                                        'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1652
-                                        sprintf(
1653
-                                            __(
1654
-                                                'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.',
1655
-                                                'event_espresso'
1656
-                                            ),
1657
-                                            '<a href="'
1658
-                                            . get_post_type_archive_link('espresso_events')
1659
-                                            . '" title="',
1660
-                                            '">',
1661
-                                            '</a>'
1662
-                                        )
1663
-                                    ),
1664
-                                    'cookies_not_set_msg'     => $cookies_not_set_msg,
1665
-                                    'registration_time_limit' => $this->checkout->get_registration_time_limit(),
1666
-                                    'session_expiration'      => gmdate(
1667
-                                        'M d, Y H:i:s',
1668
-                                        EE_Registry::instance()->SSN->expiration()
1669
-                                        + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1670
-                                    ),
1671
-                                ),
1672
-                            )
1673
-                        ),
1674
-                )
1675
-            );
1676
-            // load template and add to output sent that gets filtered into the_content()
1677
-            EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html());
1678
-        }
1679
-    }
1680
-
1681
-
1682
-
1683
-    /**
1684
-     *    add_extra_finalize_registration_inputs
1685
-     *
1686
-     * @access    public
1687
-     * @param $next_step
1688
-     * @internal  param string $label
1689
-     * @return void
1690
-     */
1691
-    public function add_extra_finalize_registration_inputs($next_step)
1692
-    {
1693
-        if ($next_step === 'finalize_registration') {
1694
-            echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1695
-        }
1696
-    }
1697
-
1698
-
1699
-
1700
-    /**
1701
-     *    display_registration_footer
1702
-     *
1703
-     * @access    public
1704
-     * @return    string
1705
-     */
1706
-    public static function display_registration_footer()
1707
-    {
1708
-        if (
1709
-        apply_filters(
1710
-            'FHEE__EE_Front__Controller__show_reg_footer',
1711
-            EE_Registry::instance()->CFG->admin->show_reg_footer
1712
-        )
1713
-        ) {
1714
-            add_filter(
1715
-                'FHEE__EEH_Template__powered_by_event_espresso__url',
1716
-                function ($url) {
1717
-                    return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1718
-                }
1719
-            );
1720
-            echo apply_filters(
1721
-                'FHEE__EE_Front_Controller__display_registration_footer',
1722
-                \EEH_Template::powered_by_event_espresso(
1723
-                    '',
1724
-                    'espresso-registration-footer-dv',
1725
-                    array('utm_content' => 'registration_checkout')
1726
-                )
1727
-            );
1728
-        }
1729
-        return '';
1730
-    }
1731
-
1732
-
1733
-
1734
-    /**
1735
-     *    unlock_transaction
1736
-     *
1737
-     * @access    public
1738
-     * @return    void
1739
-     * @throws EE_Error
1740
-     */
1741
-    public function unlock_transaction()
1742
-    {
1743
-        if ($this->checkout->transaction instanceof EE_Transaction) {
1744
-            $this->checkout->transaction->unlock();
1745
-        }
1746
-    }
1747
-
1748
-
1749
-
1750
-    /**
1751
-     *        _setup_redirect
1752
-     *
1753
-     * @access    private
1754
-     * @return void
1755
-     */
1756
-    private function _setup_redirect()
1757
-    {
1758
-        if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1759
-            $this->checkout->redirect = true;
1760
-            if (empty($this->checkout->redirect_url)) {
1761
-                $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1762
-            }
1763
-            $this->checkout->redirect_url = apply_filters(
1764
-                'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url',
1765
-                $this->checkout->redirect_url,
1766
-                $this->checkout
1767
-            );
1768
-        }
1769
-    }
1770
-
1771
-
1772
-
1773
-    /**
1774
-     *   handle ajax message responses and redirects
1775
-     *
1776
-     * @access public
1777
-     * @return void
1778
-     * @throws EE_Error
1779
-     */
1780
-    public function go_to_next_step()
1781
-    {
1782
-        if (EE_Registry::instance()->REQ->ajax) {
1783
-            // capture contents of output buffer we started earlier in the request, and insert into JSON response
1784
-            $this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1785
-        }
1786
-        $this->unlock_transaction();
1787
-        // just return for these conditions
1788
-        if (
1789
-            $this->checkout->admin_request
1790
-            || $this->checkout->action === 'redirect_form'
1791
-            || $this->checkout->action === 'update_checkout'
1792
-        ) {
1793
-            return;
1794
-        }
1795
-        // AJAX response
1796
-        $this->_handle_json_response();
1797
-        // redirect to next step or the Thank You page
1798
-        $this->_handle_html_redirects();
1799
-        // hmmm... must be something wrong, so let's just display the form again !
1800
-        $this->_display_spco_reg_form();
1801
-    }
1802
-
1803
-
1804
-
1805
-    /**
1806
-     *   _handle_json_response
1807
-     *
1808
-     * @access protected
1809
-     * @return void
1810
-     */
1811
-    protected function _handle_json_response()
1812
-    {
1813
-        // if this is an ajax request
1814
-        if (EE_Registry::instance()->REQ->ajax) {
1815
-            // DEBUG LOG
1816
-            //$this->checkout->log(
1817
-            //	__CLASS__, __FUNCTION__, __LINE__,
1818
-            //	array(
1819
-            //		'json_response_redirect_url' => $this->checkout->json_response->redirect_url(),
1820
-            //		'redirect'                   => $this->checkout->redirect,
1821
-            //		'continue_reg'               => $this->checkout->continue_reg,
1822
-            //	)
1823
-            //);
1824
-            $this->checkout->json_response->set_registration_time_limit(
1825
-                $this->checkout->get_registration_time_limit()
1826
-            );
1827
-            $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1828
-            // just send the ajax (
1829
-            $json_response = apply_filters(
1830
-                'FHEE__EE_Single_Page_Checkout__JSON_response',
1831
-                $this->checkout->json_response
1832
-            );
1833
-            echo $json_response;
1834
-            exit();
1835
-        }
1836
-    }
1837
-
1838
-
1839
-
1840
-    /**
1841
-     *   _handle_redirects
1842
-     *
1843
-     * @access protected
1844
-     * @return void
1845
-     */
1846
-    protected function _handle_html_redirects()
1847
-    {
1848
-        // going somewhere ?
1849
-        if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1850
-            // store notices in a transient
1851
-            EE_Error::get_notices(false, true, true);
1852
-            // DEBUG LOG
1853
-            //$this->checkout->log(
1854
-            //	__CLASS__, __FUNCTION__, __LINE__,
1855
-            //	array(
1856
-            //		'headers_sent' => headers_sent(),
1857
-            //		'redirect_url'     => $this->checkout->redirect_url,
1858
-            //		'headers_list'    => headers_list(),
1859
-            //	)
1860
-            //);
1861
-            wp_safe_redirect($this->checkout->redirect_url);
1862
-            exit();
1863
-        }
1864
-    }
1865
-
1866
-
1867
-
1868
-    /**
1869
-     *   set_checkout_anchor
1870
-     *
1871
-     * @access public
1872
-     * @return void
1873
-     */
1874
-    public function set_checkout_anchor()
1875
-    {
1876
-        echo '<a id="checkout" style="float: left; margin-left: -999em;"></a>';
1877
-    }
23
+	/**
24
+	 * $_initialized - has the SPCO controller already been initialized ?
25
+	 *
26
+	 * @access private
27
+	 * @var bool $_initialized
28
+	 */
29
+	private static $_initialized = false;
30
+
31
+
32
+	/**
33
+	 * $_checkout_verified - is the EE_Checkout verified as correct for this request ?
34
+	 *
35
+	 * @access private
36
+	 * @var bool $_valid_checkout
37
+	 */
38
+	private static $_checkout_verified = true;
39
+
40
+	/**
41
+	 *    $_reg_steps_array - holds initial array of reg steps
42
+	 *
43
+	 * @access private
44
+	 * @var array $_reg_steps_array
45
+	 */
46
+	private static $_reg_steps_array = array();
47
+
48
+	/**
49
+	 *    $checkout - EE_Checkout object for handling the properties of the current checkout process
50
+	 *
51
+	 * @access public
52
+	 * @var EE_Checkout $checkout
53
+	 */
54
+	public $checkout;
55
+
56
+
57
+
58
+	/**
59
+	 * @return EED_Module|EED_Single_Page_Checkout
60
+	 */
61
+	public static function instance()
62
+	{
63
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
64
+		return parent::get_instance(__CLASS__);
65
+	}
66
+
67
+
68
+
69
+	/**
70
+	 * @return EE_CART
71
+	 */
72
+	public function cart()
73
+	{
74
+		return $this->checkout->cart;
75
+	}
76
+
77
+
78
+
79
+	/**
80
+	 * @return EE_Transaction
81
+	 */
82
+	public function transaction()
83
+	{
84
+		return $this->checkout->transaction;
85
+	}
86
+
87
+
88
+
89
+	/**
90
+	 *    set_hooks - for hooking into EE Core, other modules, etc
91
+	 *
92
+	 * @access    public
93
+	 * @return    void
94
+	 * @throws EE_Error
95
+	 */
96
+	public static function set_hooks()
97
+	{
98
+		EED_Single_Page_Checkout::set_definitions();
99
+	}
100
+
101
+
102
+
103
+	/**
104
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
105
+	 *
106
+	 * @access    public
107
+	 * @return    void
108
+	 * @throws EE_Error
109
+	 */
110
+	public static function set_hooks_admin()
111
+	{
112
+		EED_Single_Page_Checkout::set_definitions();
113
+		if ( ! (defined('DOING_AJAX') && DOING_AJAX)) {
114
+			return;
115
+		}
116
+		// going to start an output buffer in case anything gets accidentally output
117
+		// that might disrupt our JSON response
118
+		ob_start();
119
+		EED_Single_Page_Checkout::load_request_handler();
120
+		EED_Single_Page_Checkout::load_reg_steps();
121
+		// set ajax hooks
122
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
123
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
124
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
125
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
126
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
127
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
128
+	}
129
+
130
+
131
+
132
+	/**
133
+	 *    process ajax request
134
+	 *
135
+	 * @param string $ajax_action
136
+	 * @throws EE_Error
137
+	 */
138
+	public static function process_ajax_request($ajax_action)
139
+	{
140
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
141
+		EED_Single_Page_Checkout::instance()->_initialize();
142
+	}
143
+
144
+
145
+
146
+	/**
147
+	 *    ajax display registration step
148
+	 *
149
+	 * @throws EE_Error
150
+	 */
151
+	public static function display_reg_step()
152
+	{
153
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
154
+	}
155
+
156
+
157
+
158
+	/**
159
+	 *    ajax process registration step
160
+	 *
161
+	 * @throws EE_Error
162
+	 */
163
+	public static function process_reg_step()
164
+	{
165
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
166
+	}
167
+
168
+
169
+
170
+	/**
171
+	 *    ajax process registration step
172
+	 *
173
+	 * @throws EE_Error
174
+	 */
175
+	public static function update_reg_step()
176
+	{
177
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
178
+	}
179
+
180
+
181
+
182
+	/**
183
+	 *   update_checkout
184
+	 *
185
+	 * @access public
186
+	 * @return void
187
+	 * @throws EE_Error
188
+	 */
189
+	public static function update_checkout()
190
+	{
191
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
192
+	}
193
+
194
+
195
+
196
+	/**
197
+	 *    load_request_handler
198
+	 *
199
+	 * @access    public
200
+	 * @return    void
201
+	 */
202
+	public static function load_request_handler()
203
+	{
204
+		// load core Request_Handler class
205
+		if (EE_Registry::instance()->REQ !== null) {
206
+			EE_Registry::instance()->load_core('Request_Handler');
207
+		}
208
+	}
209
+
210
+
211
+
212
+	/**
213
+	 *    set_definitions
214
+	 *
215
+	 * @access    public
216
+	 * @return    void
217
+	 * @throws EE_Error
218
+	 */
219
+	public static function set_definitions()
220
+	{
221
+		if(defined('SPCO_BASE_PATH')) {
222
+			return;
223
+		}
224
+		define(
225
+			'SPCO_BASE_PATH',
226
+			rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS) . DS
227
+		);
228
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__) . 'css' . DS);
229
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__) . 'img' . DS);
230
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__) . 'js' . DS);
231
+		define('SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS);
232
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS);
233
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS);
234
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, true);
235
+		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
236
+			__('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s',
237
+				'event_espresso'),
238
+			'<h4 class="important-notice">',
239
+			'</h4>',
240
+			'<br />',
241
+			'<p>',
242
+			'<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
243
+			'">',
244
+			'</a>',
245
+			'</p>'
246
+		);
247
+	}
248
+
249
+
250
+
251
+	/**
252
+	 * load_reg_steps
253
+	 * loads and instantiates each reg step based on the EE_Registry::instance()->CFG->registration->reg_steps array
254
+	 *
255
+	 * @access    private
256
+	 * @throws EE_Error
257
+	 */
258
+	public static function load_reg_steps()
259
+	{
260
+		static $reg_steps_loaded = false;
261
+		if ($reg_steps_loaded) {
262
+			return;
263
+		}
264
+		// filter list of reg_steps
265
+		$reg_steps_to_load = (array)apply_filters(
266
+			'AHEE__SPCO__load_reg_steps__reg_steps_to_load',
267
+			EED_Single_Page_Checkout::get_reg_steps()
268
+		);
269
+		// sort by key (order)
270
+		ksort($reg_steps_to_load);
271
+		// loop through folders
272
+		foreach ($reg_steps_to_load as $order => $reg_step) {
273
+			// we need a
274
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
275
+				// copy over to the reg_steps_array
276
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
277
+				// register custom key route for each reg step
278
+				// ie: step=>"slug" - this is the entire reason we load the reg steps array now
279
+				EE_Config::register_route(
280
+					$reg_step['slug'],
281
+					'EED_Single_Page_Checkout',
282
+					'run',
283
+					'step'
284
+				);
285
+				// add AJAX or other hooks
286
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
287
+					// setup autoloaders if necessary
288
+					if ( ! class_exists($reg_step['class_name'])) {
289
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder(
290
+							$reg_step['file_path'],
291
+							true
292
+						);
293
+					}
294
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
295
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
296
+					}
297
+				}
298
+			}
299
+		}
300
+		$reg_steps_loaded = true;
301
+	}
302
+
303
+
304
+
305
+	/**
306
+	 *    get_reg_steps
307
+	 *
308
+	 * @access    public
309
+	 * @return    array
310
+	 */
311
+	public static function get_reg_steps()
312
+	{
313
+		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
314
+		if (empty($reg_steps)) {
315
+			$reg_steps = array(
316
+				10  => array(
317
+					'file_path'  => SPCO_REG_STEPS_PATH . 'attendee_information',
318
+					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
319
+					'slug'       => 'attendee_information',
320
+					'has_hooks'  => false,
321
+				),
322
+				20  => array(
323
+					'file_path'  => SPCO_REG_STEPS_PATH . 'registration_confirmation',
324
+					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
325
+					'slug'       => 'registration_confirmation',
326
+					'has_hooks'  => false,
327
+				),
328
+				30  => array(
329
+					'file_path'  => SPCO_REG_STEPS_PATH . 'payment_options',
330
+					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
331
+					'slug'       => 'payment_options',
332
+					'has_hooks'  => true,
333
+				),
334
+				999 => array(
335
+					'file_path'  => SPCO_REG_STEPS_PATH . 'finalize_registration',
336
+					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
337
+					'slug'       => 'finalize_registration',
338
+					'has_hooks'  => false,
339
+				),
340
+			);
341
+		}
342
+		return $reg_steps;
343
+	}
344
+
345
+
346
+
347
+	/**
348
+	 *    registration_checkout_for_admin
349
+	 *
350
+	 * @access    public
351
+	 * @return    string
352
+	 * @throws EE_Error
353
+	 */
354
+	public static function registration_checkout_for_admin()
355
+	{
356
+		EED_Single_Page_Checkout::load_request_handler();
357
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
358
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
359
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
360
+		EED_Single_Page_Checkout::instance()->_initialize();
361
+		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
362
+		return EE_Registry::instance()->REQ->get_output();
363
+	}
364
+
365
+
366
+
367
+	/**
368
+	 * process_registration_from_admin
369
+	 *
370
+	 * @access public
371
+	 * @return \EE_Transaction
372
+	 * @throws EE_Error
373
+	 */
374
+	public static function process_registration_from_admin()
375
+	{
376
+		EED_Single_Page_Checkout::load_request_handler();
377
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
378
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
379
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
380
+		EED_Single_Page_Checkout::instance()->_initialize();
381
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
382
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
383
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
384
+				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step);
385
+				if ($final_reg_step->process_reg_step()) {
386
+					$final_reg_step->set_completed();
387
+					EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array();
388
+					return EED_Single_Page_Checkout::instance()->checkout->transaction;
389
+				}
390
+			}
391
+		}
392
+		return null;
393
+	}
394
+
395
+
396
+
397
+	/**
398
+	 *    run
399
+	 *
400
+	 * @access    public
401
+	 * @param WP_Query $WP_Query
402
+	 * @return    void
403
+	 * @throws EE_Error
404
+	 */
405
+	public function run($WP_Query)
406
+	{
407
+		if (
408
+			$WP_Query instanceof WP_Query
409
+			&& $WP_Query->is_main_query()
410
+			&& apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
411
+			&& $this->_is_reg_checkout()
412
+		) {
413
+			$this->_initialize();
414
+		}
415
+	}
416
+
417
+
418
+
419
+	/**
420
+	 * determines whether current url matches reg page url
421
+	 *
422
+	 * @return bool
423
+	 */
424
+	protected function _is_reg_checkout()
425
+	{
426
+		// get current permalink for reg page without any extra query args
427
+		$reg_page_url = \get_permalink(EE_Config::instance()->core->reg_page_id);
428
+		// get request URI for current request, but without the scheme or host
429
+		$current_request_uri = \EEH_URL::filter_input_server_url('REQUEST_URI');
430
+		$current_request_uri = html_entity_decode($current_request_uri);
431
+		// get array of query args from the current request URI
432
+		$query_args = \EEH_URL::get_query_string($current_request_uri);
433
+		// grab page id if it is set
434
+		$page_id = isset($query_args['page_id']) ? absint($query_args['page_id']) : 0;
435
+		// and remove the page id from the query args (we will re-add it later)
436
+		unset($query_args['page_id']);
437
+		// now strip all query args from current request URI
438
+		$current_request_uri = remove_query_arg(array_keys($query_args), $current_request_uri);
439
+		// and re-add the page id if it was set
440
+		if ($page_id) {
441
+			$current_request_uri = add_query_arg('page_id', $page_id, $current_request_uri);
442
+		}
443
+		// remove slashes and ?
444
+		$current_request_uri = trim($current_request_uri, '?/');
445
+		// is current request URI part of the known full reg page URL ?
446
+		return ! empty($current_request_uri) && strpos($reg_page_url, $current_request_uri) !== false;
447
+	}
448
+
449
+
450
+
451
+	/**
452
+	 * @param WP_Query $wp_query
453
+	 * @return    void
454
+	 * @throws EE_Error
455
+	 */
456
+	public static function init($wp_query)
457
+	{
458
+		EED_Single_Page_Checkout::instance()->run($wp_query);
459
+	}
460
+
461
+
462
+
463
+	/**
464
+	 *    _initialize - initial module setup
465
+	 *
466
+	 * @access    private
467
+	 * @throws EE_Error
468
+	 * @return    void
469
+	 */
470
+	private function _initialize()
471
+	{
472
+		// ensure SPCO doesn't run twice
473
+		if (EED_Single_Page_Checkout::$_initialized) {
474
+			return;
475
+		}
476
+		try {
477
+			EED_Single_Page_Checkout::load_reg_steps();
478
+			$this->_verify_session();
479
+			// setup the EE_Checkout object
480
+			$this->checkout = $this->_initialize_checkout();
481
+			// filter checkout
482
+			$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
483
+			// get the $_GET
484
+			$this->_get_request_vars();
485
+			if ($this->_block_bots()) {
486
+				return;
487
+			}
488
+			// filter continue_reg
489
+			$this->checkout->continue_reg = apply_filters(
490
+				'FHEE__EED_Single_Page_Checkout__init___continue_reg',
491
+				true,
492
+				$this->checkout
493
+			);
494
+			// load the reg steps array
495
+			if ( ! $this->_load_and_instantiate_reg_steps()) {
496
+				EED_Single_Page_Checkout::$_initialized = true;
497
+				return;
498
+			}
499
+			// set the current step
500
+			$this->checkout->set_current_step($this->checkout->step);
501
+			// and the next step
502
+			$this->checkout->set_next_step();
503
+			// verify that everything has been setup correctly
504
+			if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) {
505
+				EED_Single_Page_Checkout::$_initialized = true;
506
+				return;
507
+			}
508
+			// lock the transaction
509
+			$this->checkout->transaction->lock();
510
+			// make sure all of our cached objects are added to their respective model entity mappers
511
+			$this->checkout->refresh_all_entities();
512
+			// set amount owing
513
+			$this->checkout->amount_owing = $this->checkout->transaction->remaining();
514
+			// initialize each reg step, which gives them the chance to potentially alter the process
515
+			$this->_initialize_reg_steps();
516
+			// DEBUG LOG
517
+			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
518
+			// get reg form
519
+			if( ! $this->_check_form_submission()) {
520
+				EED_Single_Page_Checkout::$_initialized = true;
521
+				return;
522
+			}
523
+			// checkout the action!!!
524
+			$this->_process_form_action();
525
+			// add some style and make it dance
526
+			$this->add_styles_and_scripts();
527
+			// kk... SPCO has successfully run
528
+			EED_Single_Page_Checkout::$_initialized = true;
529
+			// set no cache headers and constants
530
+			EE_System::do_not_cache();
531
+			// add anchor
532
+			add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
533
+			// remove transaction lock
534
+			add_action('shutdown', array($this, 'unlock_transaction'), 1);
535
+		} catch (Exception $e) {
536
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
537
+		}
538
+	}
539
+
540
+
541
+
542
+	/**
543
+	 *    _verify_session
544
+	 * checks that the session is valid and not expired
545
+	 *
546
+	 * @access    private
547
+	 * @throws EE_Error
548
+	 */
549
+	private function _verify_session()
550
+	{
551
+		if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
552
+			throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso'));
553
+		}
554
+		$clear_session_requested = filter_var(
555
+			EE_Registry::instance()->REQ->get('clear_session', false),
556
+			FILTER_VALIDATE_BOOLEAN
557
+		);
558
+		// is session still valid ?
559
+		if ($clear_session_requested
560
+			|| ( EE_Registry::instance()->SSN->expired()
561
+			  && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === ''
562
+			)
563
+		) {
564
+			$this->checkout = new EE_Checkout();
565
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
566
+			// EE_Registry::instance()->SSN->reset_cart();
567
+			// EE_Registry::instance()->SSN->reset_checkout();
568
+			// EE_Registry::instance()->SSN->reset_transaction();
569
+			if (! $clear_session_requested) {
570
+				EE_Error::add_attention(
571
+					EE_Registry::$i18n_js_strings['registration_expiration_notice'],
572
+					__FILE__, __FUNCTION__, __LINE__
573
+				);
574
+			}
575
+			// EE_Registry::instance()->SSN->reset_expired();
576
+		}
577
+	}
578
+
579
+
580
+
581
+	/**
582
+	 *    _initialize_checkout
583
+	 * loads and instantiates EE_Checkout
584
+	 *
585
+	 * @access    private
586
+	 * @throws EE_Error
587
+	 * @return EE_Checkout
588
+	 */
589
+	private function _initialize_checkout()
590
+	{
591
+		// look in session for existing checkout
592
+		/** @type EE_Checkout $checkout */
593
+		$checkout = EE_Registry::instance()->SSN->checkout();
594
+		// verify
595
+		if ( ! $checkout instanceof EE_Checkout) {
596
+			// instantiate EE_Checkout object for handling the properties of the current checkout process
597
+			$checkout = EE_Registry::instance()->load_file(
598
+				SPCO_INC_PATH,
599
+				'EE_Checkout',
600
+				'class', array(),
601
+				false
602
+			);
603
+		} else {
604
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
605
+				$this->unlock_transaction();
606
+				wp_safe_redirect($checkout->redirect_url);
607
+				exit();
608
+			}
609
+		}
610
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
611
+		// verify again
612
+		if ( ! $checkout instanceof EE_Checkout) {
613
+			throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
614
+		}
615
+		// reset anything that needs a clean slate for each request
616
+		$checkout->reset_for_current_request();
617
+		return $checkout;
618
+	}
619
+
620
+
621
+
622
+	/**
623
+	 *    _get_request_vars
624
+	 *
625
+	 * @access    private
626
+	 * @return    void
627
+	 * @throws EE_Error
628
+	 */
629
+	private function _get_request_vars()
630
+	{
631
+		// load classes
632
+		EED_Single_Page_Checkout::load_request_handler();
633
+		//make sure this request is marked as belonging to EE
634
+		EE_Registry::instance()->REQ->set_espresso_page(true);
635
+		// which step is being requested ?
636
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
637
+		// which step is being edited ?
638
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
639
+		// and what we're doing on the current step
640
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
641
+		// timestamp
642
+		$this->checkout->uts = EE_Registry::instance()->REQ->get('uts', 0);
643
+		// returning to edit ?
644
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
645
+		// or some other kind of revisit ?
646
+		$this->checkout->revisit = filter_var(
647
+			EE_Registry::instance()->REQ->get('revisit', false),
648
+			FILTER_VALIDATE_BOOLEAN
649
+		);
650
+		// and whether or not to generate a reg form for this request
651
+		$this->checkout->generate_reg_form = filter_var(
652
+			EE_Registry::instance()->REQ->get('generate_reg_form', true),
653
+			FILTER_VALIDATE_BOOLEAN
654
+		);
655
+		// and whether or not to process a reg form submission for this request
656
+		$this->checkout->process_form_submission = filter_var(
657
+			EE_Registry::instance()->REQ->get(
658
+				'process_form_submission',
659
+				$this->checkout->action === 'process_reg_step'
660
+			),
661
+			FILTER_VALIDATE_BOOLEAN
662
+		);
663
+		$this->checkout->process_form_submission = filter_var(
664
+			$this->checkout->action !== 'display_spco_reg_step'
665
+				? $this->checkout->process_form_submission
666
+				: false,
667
+			FILTER_VALIDATE_BOOLEAN
668
+		);
669
+		// $this->_display_request_vars();
670
+	}
671
+
672
+
673
+
674
+	/**
675
+	 *  _display_request_vars
676
+	 *
677
+	 * @access    protected
678
+	 * @return    void
679
+	 */
680
+	protected function _display_request_vars()
681
+	{
682
+		if ( ! WP_DEBUG) {
683
+			return;
684
+		}
685
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
686
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
687
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
688
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
689
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
690
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
691
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
692
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
693
+	}
694
+
695
+
696
+
697
+	/**
698
+	 * _block_bots
699
+	 * checks that the incoming request has either of the following set:
700
+	 *  a uts (unix timestamp) which indicates that the request was redirected from the Ticket Selector
701
+	 *  a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN
702
+	 * so if you're not coming from the Ticket Selector nor returning for a valid IP...
703
+	 * then where you coming from man?
704
+	 *
705
+	 * @return boolean
706
+	 */
707
+	private function _block_bots()
708
+	{
709
+		$invalid_checkout_access = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess();
710
+		if ($invalid_checkout_access->checkoutAccessIsInvalid($this->checkout)) {
711
+			return true;
712
+		}
713
+		return false;
714
+	}
715
+
716
+
717
+
718
+	/**
719
+	 *    _get_first_step
720
+	 *  gets slug for first step in $_reg_steps_array
721
+	 *
722
+	 * @access    private
723
+	 * @throws EE_Error
724
+	 * @return    string
725
+	 */
726
+	private function _get_first_step()
727
+	{
728
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
729
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
730
+	}
731
+
732
+
733
+
734
+	/**
735
+	 *    _load_and_instantiate_reg_steps
736
+	 *  instantiates each reg step based on the loaded reg_steps array
737
+	 *
738
+	 * @access    private
739
+	 * @throws EE_Error
740
+	 * @return    bool
741
+	 */
742
+	private function _load_and_instantiate_reg_steps()
743
+	{
744
+		do_action('AHEE__Single_Page_Checkout___load_and_instantiate_reg_steps__start', $this->checkout);
745
+		// have reg_steps already been instantiated ?
746
+		if (
747
+			empty($this->checkout->reg_steps)
748
+			|| apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
749
+		) {
750
+			// if not, then loop through raw reg steps array
751
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
752
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
753
+					return false;
754
+				}
755
+			}
756
+			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = true;
757
+			EE_Registry::instance()->CFG->registration->reg_confirmation_last = true;
758
+			// skip the registration_confirmation page ?
759
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
760
+				// just remove it from the reg steps array
761
+				$this->checkout->remove_reg_step('registration_confirmation', false);
762
+			} else if (
763
+				isset($this->checkout->reg_steps['registration_confirmation'])
764
+				&& EE_Registry::instance()->CFG->registration->reg_confirmation_last
765
+			) {
766
+				// set the order to something big like 100
767
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
768
+			}
769
+			// filter the array for good luck
770
+			$this->checkout->reg_steps = apply_filters(
771
+				'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps',
772
+				$this->checkout->reg_steps
773
+			);
774
+			// finally re-sort based on the reg step class order properties
775
+			$this->checkout->sort_reg_steps();
776
+		} else {
777
+			foreach ($this->checkout->reg_steps as $reg_step) {
778
+				// set all current step stati to FALSE
779
+				$reg_step->set_is_current_step(false);
780
+			}
781
+		}
782
+		if (empty($this->checkout->reg_steps)) {
783
+			EE_Error::add_error(
784
+				__('No Reg Steps were loaded..', 'event_espresso'),
785
+				__FILE__, __FUNCTION__, __LINE__
786
+			);
787
+			return false;
788
+		}
789
+		// make reg step details available to JS
790
+		$this->checkout->set_reg_step_JSON_info();
791
+		return true;
792
+	}
793
+
794
+
795
+
796
+	/**
797
+	 *     _load_and_instantiate_reg_step
798
+	 *
799
+	 * @access    private
800
+	 * @param array $reg_step
801
+	 * @param int   $order
802
+	 * @return bool
803
+	 */
804
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0)
805
+	{
806
+		// we need a file_path, class_name, and slug to add a reg step
807
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
808
+			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
809
+			if (
810
+				$this->checkout->reg_url_link
811
+				&& $this->checkout->step !== $reg_step['slug']
812
+				&& $reg_step['slug'] !== 'finalize_registration'
813
+				// normally at this point we would NOT load the reg step, but this filter can change that
814
+				&& apply_filters(
815
+					'FHEE__Single_Page_Checkout___load_and_instantiate_reg_step__bypass_reg_step',
816
+					true,
817
+					$reg_step,
818
+					$this->checkout
819
+				)
820
+			) {
821
+				return true;
822
+			}
823
+			// instantiate step class using file path and class name
824
+			$reg_step_obj = EE_Registry::instance()->load_file(
825
+				$reg_step['file_path'],
826
+				$reg_step['class_name'],
827
+				'class',
828
+				$this->checkout,
829
+				false
830
+			);
831
+			// did we gets the goods ?
832
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
833
+				// set reg step order based on config
834
+				$reg_step_obj->set_order($order);
835
+				// add instantiated reg step object to the master reg steps array
836
+				$this->checkout->add_reg_step($reg_step_obj);
837
+			} else {
838
+				EE_Error::add_error(
839
+					__('The current step could not be set.', 'event_espresso'),
840
+					__FILE__, __FUNCTION__, __LINE__
841
+				);
842
+				return false;
843
+			}
844
+		} else {
845
+			if (WP_DEBUG) {
846
+				EE_Error::add_error(
847
+					sprintf(
848
+						__(
849
+							'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s',
850
+							'event_espresso'
851
+						),
852
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
853
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
854
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
855
+						'<ul>',
856
+						'<li>',
857
+						'</li>',
858
+						'</ul>'
859
+					),
860
+					__FILE__, __FUNCTION__, __LINE__
861
+				);
862
+			}
863
+			return false;
864
+		}
865
+		return true;
866
+	}
867
+
868
+
869
+	/**
870
+	 * _verify_transaction_and_get_registrations
871
+	 *
872
+	 * @access private
873
+	 * @return bool
874
+	 * @throws InvalidDataTypeException
875
+	 * @throws InvalidEntityException
876
+	 * @throws EE_Error
877
+	 */
878
+	private function _verify_transaction_and_get_registrations()
879
+	{
880
+		// was there already a valid transaction in the checkout from the session ?
881
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
882
+			// get transaction from db or session
883
+			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
884
+				? $this->_get_transaction_and_cart_for_previous_visit()
885
+				: $this->_get_cart_for_current_session_and_setup_new_transaction();
886
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
887
+				EE_Error::add_error(
888
+					__('Your Registration and Transaction information could not be retrieved from the db.',
889
+						'event_espresso'),
890
+					__FILE__, __FUNCTION__, __LINE__
891
+				);
892
+				$this->checkout->transaction = EE_Transaction::new_instance();
893
+				// add some style and make it dance
894
+				$this->add_styles_and_scripts();
895
+				EED_Single_Page_Checkout::$_initialized = true;
896
+				return false;
897
+			}
898
+			// and the registrations for the transaction
899
+			$this->_get_registrations($this->checkout->transaction);
900
+		}
901
+		return true;
902
+	}
903
+
904
+
905
+
906
+	/**
907
+	 * _get_transaction_and_cart_for_previous_visit
908
+	 *
909
+	 * @access private
910
+	 * @return mixed EE_Transaction|NULL
911
+	 */
912
+	private function _get_transaction_and_cart_for_previous_visit()
913
+	{
914
+		/** @var $TXN_model EEM_Transaction */
915
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
916
+		// because the reg_url_link is present in the request,
917
+		// this is a return visit to SPCO, so we'll get the transaction data from the db
918
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
919
+		// verify transaction
920
+		if ($transaction instanceof EE_Transaction) {
921
+			// and get the cart that was used for that transaction
922
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
923
+			return $transaction;
924
+		}
925
+		EE_Error::add_error(
926
+			__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'),
927
+			__FILE__, __FUNCTION__, __LINE__
928
+		);
929
+		return null;
930
+
931
+	}
932
+
933
+
934
+
935
+	/**
936
+	 * _get_cart_for_transaction
937
+	 *
938
+	 * @access private
939
+	 * @param EE_Transaction $transaction
940
+	 * @return EE_Cart
941
+	 */
942
+	private function _get_cart_for_transaction($transaction)
943
+	{
944
+		return $this->checkout->get_cart_for_transaction($transaction);
945
+	}
946
+
947
+
948
+
949
+	/**
950
+	 * get_cart_for_transaction
951
+	 *
952
+	 * @access public
953
+	 * @param EE_Transaction $transaction
954
+	 * @return EE_Cart
955
+	 */
956
+	public function get_cart_for_transaction(EE_Transaction $transaction)
957
+	{
958
+		return $this->checkout->get_cart_for_transaction($transaction);
959
+	}
960
+
961
+
962
+
963
+	/**
964
+	 * _get_transaction_and_cart_for_current_session
965
+	 *    generates a new EE_Transaction object and adds it to the $_transaction property.
966
+	 *
967
+	 * @access private
968
+	 * @return EE_Transaction
969
+	 * @throws EE_Error
970
+	 */
971
+	private function _get_cart_for_current_session_and_setup_new_transaction()
972
+	{
973
+		//  if there's no transaction, then this is the FIRST visit to SPCO
974
+		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
975
+		$this->checkout->cart = $this->_get_cart_for_transaction(null);
976
+		// and then create a new transaction
977
+		$transaction = $this->_initialize_transaction();
978
+		// verify transaction
979
+		if ($transaction instanceof EE_Transaction) {
980
+			// save it so that we have an ID for other objects to use
981
+			$transaction->save();
982
+			// and save TXN data to the cart
983
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
984
+		} else {
985
+			EE_Error::add_error(
986
+				__('A Valid Transaction could not be initialized.', 'event_espresso'),
987
+				__FILE__, __FUNCTION__, __LINE__
988
+			);
989
+		}
990
+		return $transaction;
991
+	}
992
+
993
+
994
+
995
+	/**
996
+	 *    generates a new EE_Transaction object and adds it to the $_transaction property.
997
+	 *
998
+	 * @access private
999
+	 * @return mixed EE_Transaction|NULL
1000
+	 */
1001
+	private function _initialize_transaction()
1002
+	{
1003
+		try {
1004
+			// ensure cart totals have been calculated
1005
+			$this->checkout->cart->get_grand_total()->recalculate_total_including_taxes();
1006
+			// grab the cart grand total
1007
+			$cart_total = $this->checkout->cart->get_cart_grand_total();
1008
+			// create new TXN
1009
+			$transaction = EE_Transaction::new_instance(
1010
+				array(
1011
+					'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(),
1012
+					'TXN_total'     => $cart_total > 0 ? $cart_total : 0,
1013
+					'TXN_paid'      => 0,
1014
+					'STS_ID'        => EEM_Transaction::failed_status_code,
1015
+				)
1016
+			);
1017
+			// save it so that we have an ID for other objects to use
1018
+			$transaction->save();
1019
+			// set cron job for following up on TXNs after their session has expired
1020
+			EE_Cron_Tasks::schedule_expired_transaction_check(
1021
+				EE_Registry::instance()->SSN->expiration() + 1,
1022
+				$transaction->ID()
1023
+			);
1024
+			return $transaction;
1025
+		} catch (Exception $e) {
1026
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1027
+		}
1028
+		return null;
1029
+	}
1030
+
1031
+
1032
+	/**
1033
+	 * _get_registrations
1034
+	 *
1035
+	 * @access private
1036
+	 * @param EE_Transaction $transaction
1037
+	 * @return void
1038
+	 * @throws InvalidDataTypeException
1039
+	 * @throws InvalidEntityException
1040
+	 * @throws EE_Error
1041
+	 */
1042
+	private function _get_registrations(EE_Transaction $transaction)
1043
+	{
1044
+		// first step: grab the registrants  { : o
1045
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
1046
+		// verify registrations have been set
1047
+		if (empty($registrations)) {
1048
+			// if no cached registrations, then check the db
1049
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
1050
+			// still nothing ? well as long as this isn't a revisit
1051
+			if (empty($registrations) && ! $this->checkout->revisit) {
1052
+				// generate new registrations from scratch
1053
+				$registrations = $this->_initialize_registrations($transaction);
1054
+			}
1055
+		}
1056
+		// sort by their original registration order
1057
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
1058
+		// then loop thru the array
1059
+		foreach ($registrations as $registration) {
1060
+			// verify each registration
1061
+			if ($registration instanceof EE_Registration) {
1062
+				// we display all attendee info for the primary registrant
1063
+				if ($this->checkout->reg_url_link === $registration->reg_url_link()
1064
+					&& $registration->is_primary_registrant()
1065
+				) {
1066
+					$this->checkout->primary_revisit = true;
1067
+					break;
1068
+				}
1069
+				if ($this->checkout->revisit
1070
+						   && $this->checkout->reg_url_link !== $registration->reg_url_link()
1071
+				) {
1072
+					// but hide info if it doesn't belong to you
1073
+					$transaction->clear_cache('Registration', $registration->ID());
1074
+				}
1075
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
1076
+			}
1077
+		}
1078
+	}
1079
+
1080
+
1081
+	/**
1082
+	 *    adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object
1083
+	 *
1084
+	 * @access private
1085
+	 * @param EE_Transaction $transaction
1086
+	 * @return    array
1087
+	 * @throws InvalidDataTypeException
1088
+	 * @throws InvalidEntityException
1089
+	 * @throws EE_Error
1090
+	 */
1091
+	private function _initialize_registrations(EE_Transaction $transaction)
1092
+	{
1093
+		$att_nmbr = 0;
1094
+		$registrations = array();
1095
+		if ($transaction instanceof EE_Transaction) {
1096
+			/** @type EE_Registration_Processor $registration_processor */
1097
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1098
+			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
1099
+			// now let's add the cart items to the $transaction
1100
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
1101
+				//do the following for each ticket of this type they selected
1102
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
1103
+					$att_nmbr++;
1104
+					/** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
1105
+					$CreateRegistrationCommand = EE_Registry::instance()->create(
1106
+						'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
1107
+						array(
1108
+							$transaction,
1109
+							$line_item,
1110
+							$att_nmbr,
1111
+							$this->checkout->total_ticket_count,
1112
+						)
1113
+					);
1114
+					// override capabilities for frontend registrations
1115
+					if ( ! is_admin()) {
1116
+						$CreateRegistrationCommand->setCapCheck(
1117
+							new PublicCapabilities('', 'create_new_registration')
1118
+						);
1119
+					}
1120
+					$registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand);
1121
+					if ( ! $registration instanceof EE_Registration) {
1122
+						throw new InvalidEntityException($registration, 'EE_Registration');
1123
+					}
1124
+					$registrations[ $registration->ID() ] = $registration;
1125
+				}
1126
+			}
1127
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
1128
+		}
1129
+		return $registrations;
1130
+	}
1131
+
1132
+
1133
+
1134
+	/**
1135
+	 * sorts registrations by REG_count
1136
+	 *
1137
+	 * @access public
1138
+	 * @param EE_Registration $reg_A
1139
+	 * @param EE_Registration $reg_B
1140
+	 * @return int
1141
+	 */
1142
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B)
1143
+	{
1144
+		// this shouldn't ever happen within the same TXN, but oh well
1145
+		if ($reg_A->count() === $reg_B->count()) {
1146
+			return 0;
1147
+		}
1148
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
1149
+	}
1150
+
1151
+
1152
+
1153
+	/**
1154
+	 *    _final_verifications
1155
+	 * just makes sure that everything is set up correctly before proceeding
1156
+	 *
1157
+	 * @access    private
1158
+	 * @return    bool
1159
+	 * @throws EE_Error
1160
+	 */
1161
+	private function _final_verifications()
1162
+	{
1163
+		// filter checkout
1164
+		$this->checkout = apply_filters(
1165
+			'FHEE__EED_Single_Page_Checkout___final_verifications__checkout',
1166
+			$this->checkout
1167
+		);
1168
+		//verify that current step is still set correctly
1169
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
1170
+			EE_Error::add_error(
1171
+				__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'),
1172
+				__FILE__,
1173
+				__FUNCTION__,
1174
+				__LINE__
1175
+			);
1176
+			return false;
1177
+		}
1178
+		// if returning to SPCO, then verify that primary registrant is set
1179
+		if ( ! empty($this->checkout->reg_url_link)) {
1180
+			$valid_registrant = $this->checkout->transaction->primary_registration();
1181
+			if ( ! $valid_registrant instanceof EE_Registration) {
1182
+				EE_Error::add_error(
1183
+					__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'),
1184
+					__FILE__,
1185
+					__FUNCTION__,
1186
+					__LINE__
1187
+				);
1188
+				return false;
1189
+			}
1190
+			$valid_registrant = null;
1191
+			foreach (
1192
+				$this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration
1193
+			) {
1194
+				if (
1195
+					$registration instanceof EE_Registration
1196
+					&& $registration->reg_url_link() === $this->checkout->reg_url_link
1197
+				) {
1198
+					$valid_registrant = $registration;
1199
+				}
1200
+			}
1201
+			if ( ! $valid_registrant instanceof EE_Registration) {
1202
+				// hmmm... maybe we have the wrong session because the user is opening multiple tabs ?
1203
+				if (EED_Single_Page_Checkout::$_checkout_verified) {
1204
+					// clear the session, mark the checkout as unverified, and try again
1205
+					EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
1206
+					EED_Single_Page_Checkout::$_initialized = false;
1207
+					EED_Single_Page_Checkout::$_checkout_verified = false;
1208
+					$this->_initialize();
1209
+					EE_Error::reset_notices();
1210
+					return false;
1211
+				}
1212
+				EE_Error::add_error(
1213
+					__(
1214
+						'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.',
1215
+						'event_espresso'
1216
+					),
1217
+					__FILE__,
1218
+					__FUNCTION__,
1219
+					__LINE__
1220
+				);
1221
+				return false;
1222
+			}
1223
+		}
1224
+		// now that things have been kinda sufficiently verified,
1225
+		// let's add the checkout to the session so that it's available to other systems
1226
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
1227
+		return true;
1228
+	}
1229
+
1230
+
1231
+
1232
+	/**
1233
+	 *    _initialize_reg_steps
1234
+	 * first makes sure that EE_Transaction_Processor::set_reg_step_initiated() is called as required
1235
+	 * then loops thru all of the active reg steps and calls the initialize_reg_step() method
1236
+	 *
1237
+	 * @access    private
1238
+	 * @param bool $reinitializing
1239
+	 * @throws EE_Error
1240
+	 */
1241
+	private function _initialize_reg_steps($reinitializing = false)
1242
+	{
1243
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
1244
+		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
1245
+		foreach ($this->checkout->reg_steps as $reg_step) {
1246
+			if ( ! $reg_step->initialize_reg_step()) {
1247
+				// if not initialized then maybe this step is being removed...
1248
+				if ( ! $reinitializing && $reg_step->is_current_step()) {
1249
+					// if it was the current step, then we need to start over here
1250
+					$this->_initialize_reg_steps(true);
1251
+					return;
1252
+				}
1253
+				continue;
1254
+			}
1255
+			// add css and JS for current step
1256
+			$reg_step->enqueue_styles_and_scripts();
1257
+			// i18n
1258
+			$reg_step->translate_js_strings();
1259
+			if ($reg_step->is_current_step()) {
1260
+				// the text that appears on the reg step form submit button
1261
+				$reg_step->set_submit_button_text();
1262
+			}
1263
+		}
1264
+		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
1265
+		do_action(
1266
+			"AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}",
1267
+			$this->checkout->current_step
1268
+		);
1269
+	}
1270
+
1271
+
1272
+
1273
+	/**
1274
+	 * _check_form_submission
1275
+	 *
1276
+	 * @access private
1277
+	 * @return boolean
1278
+	 */
1279
+	private function _check_form_submission()
1280
+	{
1281
+		//does this request require the reg form to be generated ?
1282
+		if ($this->checkout->generate_reg_form) {
1283
+			// ever heard that song by Blue Rodeo ?
1284
+			try {
1285
+				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
1286
+				// if not displaying a form, then check for form submission
1287
+				if (
1288
+					$this->checkout->process_form_submission
1289
+					&& $this->checkout->current_step->reg_form->was_submitted()
1290
+				) {
1291
+					// clear out any old data in case this step is being run again
1292
+					$this->checkout->current_step->set_valid_data(array());
1293
+					// capture submitted form data
1294
+					$this->checkout->current_step->reg_form->receive_form_submission(
1295
+						apply_filters(
1296
+							'FHEE__Single_Page_Checkout___check_form_submission__request_params',
1297
+							EE_Registry::instance()->REQ->params(),
1298
+							$this->checkout
1299
+						)
1300
+					);
1301
+					// validate submitted form data
1302
+					if ( ! $this->checkout->continue_reg || ! $this->checkout->current_step->reg_form->is_valid()) {
1303
+						// thou shall not pass !!!
1304
+						$this->checkout->continue_reg = false;
1305
+						// any form validation errors?
1306
+						if ($this->checkout->current_step->reg_form->submission_error_message() !== '') {
1307
+							$submission_error_messages = array();
1308
+							// bad, bad, bad registrant
1309
+							foreach (
1310
+								$this->checkout->current_step->reg_form->get_validation_errors_accumulated()
1311
+								as $validation_error
1312
+							) {
1313
+								if ($validation_error instanceof EE_Validation_Error) {
1314
+									$submission_error_messages[] = sprintf(
1315
+										__('%s : %s', 'event_espresso'),
1316
+										$validation_error->get_form_section()->html_label_text(),
1317
+										$validation_error->getMessage()
1318
+									);
1319
+								}
1320
+							}
1321
+							EE_Error::add_error(
1322
+								implode('<br />', $submission_error_messages),
1323
+								__FILE__, __FUNCTION__, __LINE__
1324
+							);
1325
+						}
1326
+						// well not really... what will happen is
1327
+						// we'll just get redirected back to redo the current step
1328
+						$this->go_to_next_step();
1329
+						return false;
1330
+					}
1331
+				}
1332
+			} catch (EE_Error $e) {
1333
+				$e->get_error();
1334
+			}
1335
+		}
1336
+		return true;
1337
+	}
1338
+
1339
+
1340
+
1341
+	/**
1342
+	 * _process_action
1343
+	 *
1344
+	 * @access private
1345
+	 * @return void
1346
+	 * @throws EE_Error
1347
+	 */
1348
+	private function _process_form_action()
1349
+	{
1350
+		// what cha wanna do?
1351
+		switch ($this->checkout->action) {
1352
+			// AJAX next step reg form
1353
+			case 'display_spco_reg_step' :
1354
+				$this->checkout->redirect = false;
1355
+				if (EE_Registry::instance()->REQ->ajax) {
1356
+					$this->checkout->json_response->set_reg_step_html(
1357
+						$this->checkout->current_step->display_reg_form()
1358
+					);
1359
+				}
1360
+				break;
1361
+			default :
1362
+				// meh... do one of those other steps first
1363
+				if (
1364
+					! empty($this->checkout->action)
1365
+					&& is_callable(array($this->checkout->current_step, $this->checkout->action))
1366
+				) {
1367
+					// dynamically creates hook point like:
1368
+					//   AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1369
+					do_action(
1370
+						"AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}",
1371
+						$this->checkout->current_step
1372
+					);
1373
+					// call action on current step
1374
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
1375
+						// good registrant, you get to proceed
1376
+						if (
1377
+							$this->checkout->current_step->success_message() !== ''
1378
+							&& apply_filters(
1379
+								'FHEE__Single_Page_Checkout___process_form_action__display_success',
1380
+								false
1381
+							)
1382
+						) {
1383
+							EE_Error::add_success(
1384
+								$this->checkout->current_step->success_message()
1385
+								. '<br />' . $this->checkout->next_step->_instructions()
1386
+							);
1387
+						}
1388
+						// pack it up, pack it in...
1389
+						$this->_setup_redirect();
1390
+					}
1391
+					// dynamically creates hook point like:
1392
+					//  AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1393
+					do_action(
1394
+						"AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}",
1395
+						$this->checkout->current_step
1396
+					);
1397
+				} else {
1398
+					EE_Error::add_error(
1399
+						sprintf(
1400
+							__(
1401
+								'The requested form action "%s" does not exist for the current "%s" registration step.',
1402
+								'event_espresso'
1403
+							),
1404
+							$this->checkout->action,
1405
+							$this->checkout->current_step->name()
1406
+						),
1407
+						__FILE__,
1408
+						__FUNCTION__,
1409
+						__LINE__
1410
+					);
1411
+				}
1412
+			// end default
1413
+		}
1414
+		// store our progress so far
1415
+		$this->checkout->stash_transaction_and_checkout();
1416
+		// advance to the next step! If you pass GO, collect $200
1417
+		$this->go_to_next_step();
1418
+	}
1419
+
1420
+
1421
+
1422
+	/**
1423
+	 *        add_styles_and_scripts
1424
+	 *
1425
+	 * @access        public
1426
+	 * @return        void
1427
+	 */
1428
+	public function add_styles_and_scripts()
1429
+	{
1430
+		// i18n
1431
+		$this->translate_js_strings();
1432
+		if ($this->checkout->admin_request) {
1433
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1434
+		} else {
1435
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1436
+		}
1437
+	}
1438
+
1439
+
1440
+
1441
+	/**
1442
+	 *        translate_js_strings
1443
+	 *
1444
+	 * @access        public
1445
+	 * @return        void
1446
+	 */
1447
+	public function translate_js_strings()
1448
+	{
1449
+		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1450
+		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1451
+		EE_Registry::$i18n_js_strings['server_error'] = __(
1452
+			'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.',
1453
+			'event_espresso'
1454
+		);
1455
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __(
1456
+			'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.',
1457
+			'event_espresso'
1458
+		);
1459
+		EE_Registry::$i18n_js_strings['validation_error'] = __(
1460
+			'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.',
1461
+			'event_espresso'
1462
+		);
1463
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __(
1464
+			'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.',
1465
+			'event_espresso'
1466
+		);
1467
+		EE_Registry::$i18n_js_strings['reg_step_error'] = __(
1468
+			'This registration step could not be completed. Please refresh the page and try again.',
1469
+			'event_espresso'
1470
+		);
1471
+		EE_Registry::$i18n_js_strings['invalid_coupon'] = __(
1472
+			'We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.',
1473
+			'event_espresso'
1474
+		);
1475
+		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(
1476
+			__(
1477
+				'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.',
1478
+				'event_espresso'
1479
+			),
1480
+			'<br/>',
1481
+			'<br/>'
1482
+		);
1483
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1484
+		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1485
+		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1486
+		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1487
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1488
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1489
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1490
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1491
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1492
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1493
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1494
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1495
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1496
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1497
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1498
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1499
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1500
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1501
+		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1502
+			__(
1503
+				'%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s',
1504
+				'event_espresso'
1505
+			),
1506
+			'<h4 class="important-notice">',
1507
+			'</h4>',
1508
+			'<br />',
1509
+			'<p>',
1510
+			'<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
1511
+			'">',
1512
+			'</a>',
1513
+			'</p>'
1514
+		);
1515
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters(
1516
+			'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
1517
+			true
1518
+		);
1519
+		EE_Registry::$i18n_js_strings['session_extension'] = absint(
1520
+			apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS)
1521
+		);
1522
+		EE_Registry::$i18n_js_strings['session_expiration'] = gmdate(
1523
+			'M d, Y H:i:s',
1524
+			EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1525
+		);
1526
+	}
1527
+
1528
+
1529
+
1530
+	/**
1531
+	 *    enqueue_styles_and_scripts
1532
+	 *
1533
+	 * @access        public
1534
+	 * @return        void
1535
+	 * @throws EE_Error
1536
+	 */
1537
+	public function enqueue_styles_and_scripts()
1538
+	{
1539
+		// load css
1540
+		wp_register_style(
1541
+			'single_page_checkout',
1542
+			SPCO_CSS_URL . 'single_page_checkout.css',
1543
+			array('espresso_default'),
1544
+			EVENT_ESPRESSO_VERSION
1545
+		);
1546
+		wp_enqueue_style('single_page_checkout');
1547
+		// load JS
1548
+		wp_register_script(
1549
+			'jquery_plugin',
1550
+			EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js',
1551
+			array('jquery'),
1552
+			'1.0.1',
1553
+			true
1554
+		);
1555
+		wp_register_script(
1556
+			'jquery_countdown',
1557
+			EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js',
1558
+			array('jquery_plugin'),
1559
+			'2.0.2',
1560
+			true
1561
+		);
1562
+		wp_register_script(
1563
+			'single_page_checkout',
1564
+			SPCO_JS_URL . 'single_page_checkout.js',
1565
+			array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'),
1566
+			EVENT_ESPRESSO_VERSION,
1567
+			true
1568
+		);
1569
+		if ($this->checkout->registration_form instanceof EE_Form_Section_Proper) {
1570
+			$this->checkout->registration_form->enqueue_js();
1571
+		}
1572
+		if ($this->checkout->current_step->reg_form instanceof EE_Form_Section_Proper) {
1573
+			$this->checkout->current_step->reg_form->enqueue_js();
1574
+		}
1575
+		wp_enqueue_script('single_page_checkout');
1576
+		/**
1577
+		 * global action hook for enqueueing styles and scripts with
1578
+		 * spco calls.
1579
+		 */
1580
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1581
+		/**
1582
+		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1583
+		 * The hook will end up being something like:
1584
+		 *      AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1585
+		 */
1586
+		do_action(
1587
+			'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(),
1588
+			$this
1589
+		);
1590
+	}
1591
+
1592
+
1593
+
1594
+	/**
1595
+	 *    display the Registration Single Page Checkout Form
1596
+	 *
1597
+	 * @access    private
1598
+	 * @return    void
1599
+	 * @throws EE_Error
1600
+	 */
1601
+	private function _display_spco_reg_form()
1602
+	{
1603
+		// if registering via the admin, just display the reg form for the current step
1604
+		if ($this->checkout->admin_request) {
1605
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1606
+		} else {
1607
+			// add powered by EE msg
1608
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1609
+			$empty_cart = count(
1610
+				$this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)
1611
+			) < 1;
1612
+			EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart;
1613
+			$cookies_not_set_msg = '';
1614
+			if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) {
1615
+				$cookies_not_set_msg = apply_filters(
1616
+					'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1617
+					sprintf(
1618
+						__(
1619
+							'%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s',
1620
+							'event_espresso'
1621
+						),
1622
+						'<div class="ee-attention">',
1623
+						'</div>',
1624
+						'<h6 class="important-notice">',
1625
+						'</h6>',
1626
+						'<p>',
1627
+						'</p>',
1628
+						'<br />',
1629
+						'<a href="http://www.whatarecookies.com/enable.asp" target="_blank">',
1630
+						'</a>'
1631
+					)
1632
+				);
1633
+			}
1634
+			$this->checkout->registration_form = new EE_Form_Section_Proper(
1635
+				array(
1636
+					'name'            => 'single-page-checkout',
1637
+					'html_id'         => 'ee-single-page-checkout-dv',
1638
+					'layout_strategy' =>
1639
+						new EE_Template_Layout(
1640
+							array(
1641
+								'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1642
+								'template_args'        => array(
1643
+									'empty_cart'              => $empty_cart,
1644
+									'revisit'                 => $this->checkout->revisit,
1645
+									'reg_steps'               => $this->checkout->reg_steps,
1646
+									'next_step'               => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
1647
+										? $this->checkout->next_step->slug()
1648
+										: '',
1649
+									'cancel_page_url'         => $this->checkout->cancel_page_url,
1650
+									'empty_msg'               => apply_filters(
1651
+										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1652
+										sprintf(
1653
+											__(
1654
+												'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.',
1655
+												'event_espresso'
1656
+											),
1657
+											'<a href="'
1658
+											. get_post_type_archive_link('espresso_events')
1659
+											. '" title="',
1660
+											'">',
1661
+											'</a>'
1662
+										)
1663
+									),
1664
+									'cookies_not_set_msg'     => $cookies_not_set_msg,
1665
+									'registration_time_limit' => $this->checkout->get_registration_time_limit(),
1666
+									'session_expiration'      => gmdate(
1667
+										'M d, Y H:i:s',
1668
+										EE_Registry::instance()->SSN->expiration()
1669
+										+ (get_option('gmt_offset') * HOUR_IN_SECONDS)
1670
+									),
1671
+								),
1672
+							)
1673
+						),
1674
+				)
1675
+			);
1676
+			// load template and add to output sent that gets filtered into the_content()
1677
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html());
1678
+		}
1679
+	}
1680
+
1681
+
1682
+
1683
+	/**
1684
+	 *    add_extra_finalize_registration_inputs
1685
+	 *
1686
+	 * @access    public
1687
+	 * @param $next_step
1688
+	 * @internal  param string $label
1689
+	 * @return void
1690
+	 */
1691
+	public function add_extra_finalize_registration_inputs($next_step)
1692
+	{
1693
+		if ($next_step === 'finalize_registration') {
1694
+			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1695
+		}
1696
+	}
1697
+
1698
+
1699
+
1700
+	/**
1701
+	 *    display_registration_footer
1702
+	 *
1703
+	 * @access    public
1704
+	 * @return    string
1705
+	 */
1706
+	public static function display_registration_footer()
1707
+	{
1708
+		if (
1709
+		apply_filters(
1710
+			'FHEE__EE_Front__Controller__show_reg_footer',
1711
+			EE_Registry::instance()->CFG->admin->show_reg_footer
1712
+		)
1713
+		) {
1714
+			add_filter(
1715
+				'FHEE__EEH_Template__powered_by_event_espresso__url',
1716
+				function ($url) {
1717
+					return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1718
+				}
1719
+			);
1720
+			echo apply_filters(
1721
+				'FHEE__EE_Front_Controller__display_registration_footer',
1722
+				\EEH_Template::powered_by_event_espresso(
1723
+					'',
1724
+					'espresso-registration-footer-dv',
1725
+					array('utm_content' => 'registration_checkout')
1726
+				)
1727
+			);
1728
+		}
1729
+		return '';
1730
+	}
1731
+
1732
+
1733
+
1734
+	/**
1735
+	 *    unlock_transaction
1736
+	 *
1737
+	 * @access    public
1738
+	 * @return    void
1739
+	 * @throws EE_Error
1740
+	 */
1741
+	public function unlock_transaction()
1742
+	{
1743
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1744
+			$this->checkout->transaction->unlock();
1745
+		}
1746
+	}
1747
+
1748
+
1749
+
1750
+	/**
1751
+	 *        _setup_redirect
1752
+	 *
1753
+	 * @access    private
1754
+	 * @return void
1755
+	 */
1756
+	private function _setup_redirect()
1757
+	{
1758
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1759
+			$this->checkout->redirect = true;
1760
+			if (empty($this->checkout->redirect_url)) {
1761
+				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1762
+			}
1763
+			$this->checkout->redirect_url = apply_filters(
1764
+				'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url',
1765
+				$this->checkout->redirect_url,
1766
+				$this->checkout
1767
+			);
1768
+		}
1769
+	}
1770
+
1771
+
1772
+
1773
+	/**
1774
+	 *   handle ajax message responses and redirects
1775
+	 *
1776
+	 * @access public
1777
+	 * @return void
1778
+	 * @throws EE_Error
1779
+	 */
1780
+	public function go_to_next_step()
1781
+	{
1782
+		if (EE_Registry::instance()->REQ->ajax) {
1783
+			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1784
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1785
+		}
1786
+		$this->unlock_transaction();
1787
+		// just return for these conditions
1788
+		if (
1789
+			$this->checkout->admin_request
1790
+			|| $this->checkout->action === 'redirect_form'
1791
+			|| $this->checkout->action === 'update_checkout'
1792
+		) {
1793
+			return;
1794
+		}
1795
+		// AJAX response
1796
+		$this->_handle_json_response();
1797
+		// redirect to next step or the Thank You page
1798
+		$this->_handle_html_redirects();
1799
+		// hmmm... must be something wrong, so let's just display the form again !
1800
+		$this->_display_spco_reg_form();
1801
+	}
1802
+
1803
+
1804
+
1805
+	/**
1806
+	 *   _handle_json_response
1807
+	 *
1808
+	 * @access protected
1809
+	 * @return void
1810
+	 */
1811
+	protected function _handle_json_response()
1812
+	{
1813
+		// if this is an ajax request
1814
+		if (EE_Registry::instance()->REQ->ajax) {
1815
+			// DEBUG LOG
1816
+			//$this->checkout->log(
1817
+			//	__CLASS__, __FUNCTION__, __LINE__,
1818
+			//	array(
1819
+			//		'json_response_redirect_url' => $this->checkout->json_response->redirect_url(),
1820
+			//		'redirect'                   => $this->checkout->redirect,
1821
+			//		'continue_reg'               => $this->checkout->continue_reg,
1822
+			//	)
1823
+			//);
1824
+			$this->checkout->json_response->set_registration_time_limit(
1825
+				$this->checkout->get_registration_time_limit()
1826
+			);
1827
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1828
+			// just send the ajax (
1829
+			$json_response = apply_filters(
1830
+				'FHEE__EE_Single_Page_Checkout__JSON_response',
1831
+				$this->checkout->json_response
1832
+			);
1833
+			echo $json_response;
1834
+			exit();
1835
+		}
1836
+	}
1837
+
1838
+
1839
+
1840
+	/**
1841
+	 *   _handle_redirects
1842
+	 *
1843
+	 * @access protected
1844
+	 * @return void
1845
+	 */
1846
+	protected function _handle_html_redirects()
1847
+	{
1848
+		// going somewhere ?
1849
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1850
+			// store notices in a transient
1851
+			EE_Error::get_notices(false, true, true);
1852
+			// DEBUG LOG
1853
+			//$this->checkout->log(
1854
+			//	__CLASS__, __FUNCTION__, __LINE__,
1855
+			//	array(
1856
+			//		'headers_sent' => headers_sent(),
1857
+			//		'redirect_url'     => $this->checkout->redirect_url,
1858
+			//		'headers_list'    => headers_list(),
1859
+			//	)
1860
+			//);
1861
+			wp_safe_redirect($this->checkout->redirect_url);
1862
+			exit();
1863
+		}
1864
+	}
1865
+
1866
+
1867
+
1868
+	/**
1869
+	 *   set_checkout_anchor
1870
+	 *
1871
+	 * @access public
1872
+	 * @return void
1873
+	 */
1874
+	public function set_checkout_anchor()
1875
+	{
1876
+		echo '<a id="checkout" style="float: left; margin-left: -999em;"></a>';
1877
+	}
1878 1878
 
1879 1879
 
1880 1880
 
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -218,19 +218,19 @@  discard block
 block discarded – undo
218 218
      */
219 219
     public static function set_definitions()
220 220
     {
221
-        if(defined('SPCO_BASE_PATH')) {
221
+        if (defined('SPCO_BASE_PATH')) {
222 222
             return;
223 223
         }
224 224
         define(
225 225
             'SPCO_BASE_PATH',
226
-            rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS) . DS
226
+            rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS
227 227
         );
228
-        define('SPCO_CSS_URL', plugin_dir_url(__FILE__) . 'css' . DS);
229
-        define('SPCO_IMG_URL', plugin_dir_url(__FILE__) . 'img' . DS);
230
-        define('SPCO_JS_URL', plugin_dir_url(__FILE__) . 'js' . DS);
231
-        define('SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS);
232
-        define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS);
233
-        define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS);
228
+        define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
229
+        define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
230
+        define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
231
+        define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
232
+        define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
233
+        define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
234 234
         EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, true);
235 235
         EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
236 236
             __('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s',
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             '</h4>',
240 240
             '<br />',
241 241
             '<p>',
242
-            '<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
242
+            '<a href="'.get_post_type_archive_link('espresso_events').'" title="',
243 243
             '">',
244 244
             '</a>',
245 245
             '</p>'
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             return;
263 263
         }
264 264
         // filter list of reg_steps
265
-        $reg_steps_to_load = (array)apply_filters(
265
+        $reg_steps_to_load = (array) apply_filters(
266 266
             'AHEE__SPCO__load_reg_steps__reg_steps_to_load',
267 267
             EED_Single_Page_Checkout::get_reg_steps()
268 268
         );
@@ -314,25 +314,25 @@  discard block
 block discarded – undo
314 314
         if (empty($reg_steps)) {
315 315
             $reg_steps = array(
316 316
                 10  => array(
317
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'attendee_information',
317
+                    'file_path'  => SPCO_REG_STEPS_PATH.'attendee_information',
318 318
                     'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
319 319
                     'slug'       => 'attendee_information',
320 320
                     'has_hooks'  => false,
321 321
                 ),
322 322
                 20  => array(
323
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'registration_confirmation',
323
+                    'file_path'  => SPCO_REG_STEPS_PATH.'registration_confirmation',
324 324
                     'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
325 325
                     'slug'       => 'registration_confirmation',
326 326
                     'has_hooks'  => false,
327 327
                 ),
328 328
                 30  => array(
329
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'payment_options',
329
+                    'file_path'  => SPCO_REG_STEPS_PATH.'payment_options',
330 330
                     'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
331 331
                     'slug'       => 'payment_options',
332 332
                     'has_hooks'  => true,
333 333
                 ),
334 334
                 999 => array(
335
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'finalize_registration',
335
+                    'file_path'  => SPCO_REG_STEPS_PATH.'finalize_registration',
336 336
                     'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
337 337
                     'slug'       => 'finalize_registration',
338 338
                     'has_hooks'  => false,
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
             // DEBUG LOG
517 517
             //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
518 518
             // get reg form
519
-            if( ! $this->_check_form_submission()) {
519
+            if ( ! $this->_check_form_submission()) {
520 520
                 EED_Single_Page_Checkout::$_initialized = true;
521 521
                 return;
522 522
             }
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
         );
558 558
         // is session still valid ?
559 559
         if ($clear_session_requested
560
-            || ( EE_Registry::instance()->SSN->expired()
560
+            || (EE_Registry::instance()->SSN->expired()
561 561
               && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === ''
562 562
             )
563 563
         ) {
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
             // EE_Registry::instance()->SSN->reset_cart();
567 567
             // EE_Registry::instance()->SSN->reset_checkout();
568 568
             // EE_Registry::instance()->SSN->reset_transaction();
569
-            if (! $clear_session_requested) {
569
+            if ( ! $clear_session_requested) {
570 570
                 EE_Error::add_attention(
571 571
                     EE_Registry::$i18n_js_strings['registration_expiration_notice'],
572 572
                     __FILE__, __FUNCTION__, __LINE__
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
                     if ( ! $registration instanceof EE_Registration) {
1122 1122
                         throw new InvalidEntityException($registration, 'EE_Registration');
1123 1123
                     }
1124
-                    $registrations[ $registration->ID() ] = $registration;
1124
+                    $registrations[$registration->ID()] = $registration;
1125 1125
                 }
1126 1126
             }
1127 1127
             $registration_processor->fix_reg_final_price_rounding_issue($transaction);
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
                         ) {
1383 1383
                             EE_Error::add_success(
1384 1384
                                 $this->checkout->current_step->success_message()
1385
-                                . '<br />' . $this->checkout->next_step->_instructions()
1385
+                                . '<br />'.$this->checkout->next_step->_instructions()
1386 1386
                             );
1387 1387
                         }
1388 1388
                         // pack it up, pack it in...
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
             '</h4>',
1508 1508
             '<br />',
1509 1509
             '<p>',
1510
-            '<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
1510
+            '<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1511 1511
             '">',
1512 1512
             '</a>',
1513 1513
             '</p>'
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
         // load css
1540 1540
         wp_register_style(
1541 1541
             'single_page_checkout',
1542
-            SPCO_CSS_URL . 'single_page_checkout.css',
1542
+            SPCO_CSS_URL.'single_page_checkout.css',
1543 1543
             array('espresso_default'),
1544 1544
             EVENT_ESPRESSO_VERSION
1545 1545
         );
@@ -1547,21 +1547,21 @@  discard block
 block discarded – undo
1547 1547
         // load JS
1548 1548
         wp_register_script(
1549 1549
             'jquery_plugin',
1550
-            EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js',
1550
+            EE_THIRD_PARTY_URL.'jquery	.plugin.min.js',
1551 1551
             array('jquery'),
1552 1552
             '1.0.1',
1553 1553
             true
1554 1554
         );
1555 1555
         wp_register_script(
1556 1556
             'jquery_countdown',
1557
-            EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js',
1557
+            EE_THIRD_PARTY_URL.'jquery	.countdown.min.js',
1558 1558
             array('jquery_plugin'),
1559 1559
             '2.0.2',
1560 1560
             true
1561 1561
         );
1562 1562
         wp_register_script(
1563 1563
             'single_page_checkout',
1564
-            SPCO_JS_URL . 'single_page_checkout.js',
1564
+            SPCO_JS_URL.'single_page_checkout.js',
1565 1565
             array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'),
1566 1566
             EVENT_ESPRESSO_VERSION,
1567 1567
             true
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
          *      AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1585 1585
          */
1586 1586
         do_action(
1587
-            'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(),
1587
+            'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(),
1588 1588
             $this
1589 1589
         );
1590 1590
     }
@@ -1638,7 +1638,7 @@  discard block
 block discarded – undo
1638 1638
                     'layout_strategy' =>
1639 1639
                         new EE_Template_Layout(
1640 1640
                             array(
1641
-                                'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1641
+                                'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1642 1642
                                 'template_args'        => array(
1643 1643
                                     'empty_cart'              => $empty_cart,
1644 1644
                                     'revisit'                 => $this->checkout->revisit,
@@ -1713,7 +1713,7 @@  discard block
 block discarded – undo
1713 1713
         ) {
1714 1714
             add_filter(
1715 1715
                 'FHEE__EEH_Template__powered_by_event_espresso__url',
1716
-                function ($url) {
1716
+                function($url) {
1717 1717
                     return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1718 1718
                 }
1719 1719
             );
Please login to merge, or discard this patch.