@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | // (all other times it gets resurrected from a wordpress option) |
15 | 15 | $stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*'); |
16 | 16 | $class_to_filepath = array(); |
17 | -foreach($stages as $filepath){ |
|
17 | +foreach ($stages as $filepath) { |
|
18 | 18 | $matches = array(); |
19 | - preg_match('~4_7_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
19 | + preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | 20 | $class_to_filepath[$matches[1]] = $filepath; |
21 | 21 | } |
22 | 22 | //give addons a chance to autoload their stages too |
23 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages',$class_to_filepath); |
|
23 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
|
24 | 24 | EEH_Autoloader::register_autoloader($class_to_filepath); |
25 | 25 | |
26 | 26 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @since 4.7.0 |
37 | 37 | * |
38 | 38 | */ |
39 | -class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{ |
|
39 | +class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base { |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * return EE_DMS_Core_4_7_0 |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | * @return bool |
59 | 59 | */ |
60 | 60 | public function can_migrate_from_version($version_array) { |
61 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
61 | + EE_Registry::instance()->load_helper('Activation'); |
|
62 | 62 | $version_string = $version_array['Core']; |
63 | 63 | if ( |
64 | - ( $version_string <= '4.7.0' && $version_string >= '4.6.0' ) |
|
64 | + ($version_string <= '4.7.0' && $version_string >= '4.6.0') |
|
65 | 65 | || |
66 | - ( $version_string >= '4.7.0' && |
|
67 | - ! EEH_Activation::table_exists( 'esp_registration_payment' ) && |
|
68 | - EEH_Activation::table_exists( 'esp_registration' ) ) ) { |
|
66 | + ($version_string >= '4.7.0' && |
|
67 | + ! EEH_Activation::table_exists('esp_registration_payment') && |
|
68 | + EEH_Activation::table_exists('esp_registration')) ) { |
|
69 | 69 | return true; |
70 | - } elseif ( ! $version_string ) { |
|
70 | + } elseif ( ! $version_string) { |
|
71 | 71 | //no version string provided... this must be pre 4.3 |
72 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
73 | 73 | } else { |
74 | 74 | return false; |
75 | 75 | } |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | 93 | //relies on 4.1's EEH_Activation::create_table |
94 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
95 | - $table_name='esp_answer'; |
|
96 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
94 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
95 | + $table_name = 'esp_answer'; |
|
96 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
97 | 97 | REG_ID INT UNSIGNED NOT NULL, |
98 | 98 | QST_ID INT UNSIGNED NOT NULL, |
99 | 99 | ANS_value TEXT NOT NULL, |
100 | 100 | PRIMARY KEY (ANS_ID)"; |
101 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
101 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
102 | 102 | |
103 | 103 | $table_name = 'esp_attendee_meta'; |
104 | 104 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -137,7 +137,7 @@ discard block |
||
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' ); |
|
140 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
141 | 141 | |
142 | 142 | $table_name = 'esp_currency'; |
143 | 143 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
148 | 148 | CUR_active TINYINT(1) DEFAULT '0', |
149 | 149 | PRIMARY KEY (CUR_code)"; |
150 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
150 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
151 | 151 | |
152 | 152 | |
153 | 153 | $table_name = 'esp_currency_payment_method'; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | |
179 | 179 | |
180 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
180 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
181 | 181 | $table_name = 'esp_event_meta'; |
182 | 182 | $sql = " |
183 | 183 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
@@ -194,41 +194,41 @@ discard block |
||
194 | 194 | EVT_external_URL VARCHAR(200) NULL, |
195 | 195 | EVT_donations TINYINT(1) NULL, |
196 | 196 | PRIMARY KEY (EVTM_ID)"; |
197 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
197 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | 198 | |
199 | 199 | |
200 | 200 | |
201 | - $table_name='esp_event_question_group'; |
|
202 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
201 | + $table_name = 'esp_event_question_group'; |
|
202 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
203 | 203 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
204 | 204 | QSG_ID INT UNSIGNED NOT NULL, |
205 | 205 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
206 | 206 | PRIMARY KEY (EQG_ID)"; |
207 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
207 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
208 | 208 | |
209 | 209 | |
210 | 210 | |
211 | - $table_name='esp_event_venue'; |
|
212 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
211 | + $table_name = 'esp_event_venue'; |
|
212 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
213 | 213 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
214 | 214 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
215 | 215 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
216 | 216 | PRIMARY KEY (EVV_ID)"; |
217 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
217 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
218 | 218 | |
219 | 219 | |
220 | 220 | |
221 | - $table_name='esp_extra_meta'; |
|
222 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
221 | + $table_name = 'esp_extra_meta'; |
|
222 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
223 | 223 | OBJ_ID INT(11) DEFAULT NULL, |
224 | 224 | EXM_type VARCHAR(45) DEFAULT NULL, |
225 | 225 | EXM_key VARCHAR(45) DEFAULT NULL, |
226 | 226 | EXM_value TEXT, |
227 | 227 | PRIMARY KEY (EXM_ID)"; |
228 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
228 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
229 | 229 | |
230 | - $table_name='esp_line_item'; |
|
231 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
230 | + $table_name = 'esp_line_item'; |
|
231 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
232 | 232 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
233 | 233 | TXN_ID INT(11) DEFAULT NULL, |
234 | 234 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | OBJ_ID INT(11) DEFAULT NULL, |
245 | 245 | OBJ_type VARCHAR(45)DEFAULT NULL, |
246 | 246 | PRIMARY KEY (LIN_ID)"; |
247 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB' ); |
|
247 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
248 | 248 | |
249 | 249 | $table_name = 'esp_log'; |
250 | 250 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | KEY GRP_ID (GRP_ID)"; |
268 | 268 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
269 | 269 | |
270 | - EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' ); |
|
270 | + EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID'); |
|
271 | 271 | |
272 | 272 | $table_name = 'esp_message_template_group'; |
273 | 273 | $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
283 | 283 | PRIMARY KEY (GRP_ID), |
284 | 284 | KEY MTP_user_id (MTP_user_id)"; |
285 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
286 | 286 | |
287 | 287 | $table_name = 'esp_event_message_template'; |
288 | 288 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | PRIMARY KEY (EMT_ID), |
292 | 292 | KEY EVT_ID (EVT_ID), |
293 | 293 | KEY GRP_ID (GRP_ID)"; |
294 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
294 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
295 | 295 | |
296 | 296 | |
297 | 297 | $table_name = 'esp_payment'; |
@@ -359,8 +359,8 @@ discard block |
||
359 | 359 | PRIMARY KEY (TTM_ID)"; |
360 | 360 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
361 | 361 | |
362 | - $table_name='esp_question'; |
|
363 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
362 | + $table_name = 'esp_question'; |
|
363 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
364 | 364 | QST_display_text TEXT NOT NULL, |
365 | 365 | QST_admin_label VARCHAR(255) NOT NULL, |
366 | 366 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -372,27 +372,27 @@ discard block |
||
372 | 372 | QST_wp_user BIGINT UNSIGNED NULL, |
373 | 373 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
374 | 374 | PRIMARY KEY (QST_ID)'; |
375 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
375 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
376 | 376 | |
377 | - $table_name='esp_question_group_question'; |
|
378 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
377 | + $table_name = 'esp_question_group_question'; |
|
378 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
379 | 379 | QSG_ID INT UNSIGNED NOT NULL, |
380 | 380 | QST_ID INT UNSIGNED NOT NULL, |
381 | 381 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
382 | 382 | PRIMARY KEY (QGQ_ID) "; |
383 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
383 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
384 | 384 | |
385 | 385 | |
386 | 386 | |
387 | - $table_name='esp_question_option'; |
|
388 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
387 | + $table_name = 'esp_question_option'; |
|
388 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
389 | 389 | QSO_value VARCHAR(255) NOT NULL, |
390 | 390 | QSO_desc TEXT NOT NULL, |
391 | 391 | QST_ID INT UNSIGNED NOT NULL, |
392 | 392 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
393 | 393 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
394 | 394 | PRIMARY KEY (QSO_ID)"; |
395 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
395 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
396 | 396 | |
397 | 397 | |
398 | 398 | |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | |
439 | 439 | |
440 | 440 | |
441 | - $table_name='esp_checkin'; |
|
442 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
441 | + $table_name = 'esp_checkin'; |
|
442 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
443 | 443 | REG_ID INT(10) UNSIGNED NOT NULL, |
444 | 444 | DTT_ID INT(10) UNSIGNED NOT NULL, |
445 | 445 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | PRC_wp_user BIGINT UNSIGNED NULL, |
529 | 529 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
530 | 530 | PRIMARY KEY (PRC_ID)"; |
531 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
531 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
532 | 532 | |
533 | 533 | $table_name = "esp_price_type"; |
534 | 534 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -565,12 +565,12 @@ discard block |
||
565 | 565 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
566 | 566 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
567 | 567 | PRIMARY KEY (TKT_ID)"; |
568 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
568 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
569 | 569 | |
570 | - EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' ); |
|
570 | + EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
571 | 571 | |
572 | 572 | $table_name = 'esp_question_group'; |
573 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
573 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
574 | 574 | QSG_name VARCHAR(255) NOT NULL, |
575 | 575 | QSG_identifier VARCHAR(100) NOT NULL, |
576 | 576 | QSG_desc TEXT NULL, |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | QSG_wp_user BIGINT UNSIGNED NULL, |
583 | 583 | PRIMARY KEY (QSG_ID), |
584 | 584 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
585 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
585 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
586 | 586 | |
587 | 587 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
588 | 588 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | return true; |
615 | 615 | } |
616 | 616 | |
617 | - public function migration_page_hooks(){ |
|
617 | + public function migration_page_hooks() { |
|
618 | 618 | |
619 | 619 | } |
620 | 620 |
@@ -65,11 +65,11 @@ |
||
65 | 65 | if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){ |
66 | 66 | // echo "$version_string can be migrated from"; |
67 | 67 | return true; |
68 | - }elseif( ! $version_string ){ |
|
68 | + } elseif( ! $version_string ){ |
|
69 | 69 | // echo "no version string provided: $version_string"; |
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | 71 | return false;//changed mind. dont want people thinking they should migrate yet because they cant |
72 | - }else{ |
|
72 | + } else{ |
|
73 | 73 | // echo "$version_string doesnt apply"; |
74 | 74 | return false; |
75 | 75 | } |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | 14 | $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | -foreach($stages as $filepath){ |
|
16 | +foreach ($stages as $filepath) { |
|
17 | 17 | $matches = array(); |
18 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
18 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | 19 | $class_to_filepath[$matches[1]] = $filepath; |
20 | 20 | } |
21 | 21 | //give addons a chance to autoload their stages too |
22 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath); |
|
22 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
|
23 | 23 | EEH_Autoloader::register_autoloader($class_to_filepath); |
24 | 24 | |
25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @since 4.6.0 |
36 | 36 | * |
37 | 37 | */ |
38 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
38 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * return EE_DMS_Core_4_8_0 |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function can_migrate_from_version($version_array) { |
64 | 64 | $version_string = $version_array['Core']; |
65 | - if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){ |
|
65 | + if ($version_string <= '4.8.0' && $version_string >= '4.7.0') { |
|
66 | 66 | // echo "$version_string can be migrated from"; |
67 | 67 | return true; |
68 | - }elseif( ! $version_string ){ |
|
68 | + }elseif ( ! $version_string) { |
|
69 | 69 | // echo "no version string provided: $version_string"; |
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | - }else{ |
|
71 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + } else { |
|
73 | 73 | // echo "$version_string doesnt apply"; |
74 | 74 | return false; |
75 | 75 | } |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | * @return bool |
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
93 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
94 | 94 | |
95 | - $table_name='esp_answer'; |
|
96 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
95 | + $table_name = 'esp_answer'; |
|
96 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
97 | 97 | REG_ID INT UNSIGNED NOT NULL, |
98 | 98 | QST_ID INT UNSIGNED NOT NULL, |
99 | 99 | ANS_value TEXT NOT NULL, |
100 | 100 | PRIMARY KEY (ANS_ID)"; |
101 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
101 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
102 | 102 | |
103 | 103 | $table_name = 'esp_attendee_meta'; |
104 | 104 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -137,7 +137,7 @@ discard block |
||
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' ); |
|
140 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
141 | 141 | |
142 | 142 | $table_name = 'esp_currency'; |
143 | 143 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
148 | 148 | CUR_active TINYINT(1) DEFAULT '0', |
149 | 149 | PRIMARY KEY (CUR_code)"; |
150 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
150 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
151 | 151 | |
152 | 152 | |
153 | 153 | $table_name = 'esp_currency_payment_method'; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | |
179 | 179 | |
180 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
180 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
181 | 181 | $table_name = 'esp_event_meta'; |
182 | 182 | $sql = " |
183 | 183 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
@@ -194,41 +194,41 @@ discard block |
||
194 | 194 | EVT_external_URL VARCHAR(200) NULL, |
195 | 195 | EVT_donations TINYINT(1) NULL, |
196 | 196 | PRIMARY KEY (EVTM_ID)"; |
197 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
197 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | 198 | |
199 | 199 | |
200 | 200 | |
201 | - $table_name='esp_event_question_group'; |
|
202 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
201 | + $table_name = 'esp_event_question_group'; |
|
202 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
203 | 203 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
204 | 204 | QSG_ID INT UNSIGNED NOT NULL, |
205 | 205 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
206 | 206 | PRIMARY KEY (EQG_ID)"; |
207 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
207 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
208 | 208 | |
209 | 209 | |
210 | 210 | |
211 | - $table_name='esp_event_venue'; |
|
212 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
211 | + $table_name = 'esp_event_venue'; |
|
212 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
213 | 213 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
214 | 214 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
215 | 215 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
216 | 216 | PRIMARY KEY (EVV_ID)"; |
217 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
217 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
218 | 218 | |
219 | 219 | |
220 | 220 | |
221 | - $table_name='esp_extra_meta'; |
|
222 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
221 | + $table_name = 'esp_extra_meta'; |
|
222 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
223 | 223 | OBJ_ID INT(11) DEFAULT NULL, |
224 | 224 | EXM_type VARCHAR(45) DEFAULT NULL, |
225 | 225 | EXM_key VARCHAR(45) DEFAULT NULL, |
226 | 226 | EXM_value TEXT, |
227 | 227 | PRIMARY KEY (EXM_ID)"; |
228 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
228 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
229 | 229 | |
230 | - $table_name='esp_line_item'; |
|
231 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
230 | + $table_name = 'esp_line_item'; |
|
231 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
232 | 232 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
233 | 233 | TXN_ID INT(11) DEFAULT NULL, |
234 | 234 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | OBJ_ID INT(11) DEFAULT NULL, |
245 | 245 | OBJ_type VARCHAR(45)DEFAULT NULL, |
246 | 246 | PRIMARY KEY (LIN_ID)"; |
247 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB' ); |
|
247 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
248 | 248 | |
249 | 249 | $table_name = 'esp_log'; |
250 | 250 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | KEY GRP_ID (GRP_ID)"; |
268 | 268 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
269 | 269 | |
270 | - EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' ); |
|
270 | + EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID'); |
|
271 | 271 | |
272 | 272 | $table_name = 'esp_message_template_group'; |
273 | 273 | $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
283 | 283 | PRIMARY KEY (GRP_ID), |
284 | 284 | KEY MTP_user_id (MTP_user_id)"; |
285 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
285 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
286 | 286 | |
287 | 287 | $table_name = 'esp_event_message_template'; |
288 | 288 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | PRIMARY KEY (EMT_ID), |
292 | 292 | KEY EVT_ID (EVT_ID), |
293 | 293 | KEY GRP_ID (GRP_ID)"; |
294 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
294 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
295 | 295 | |
296 | 296 | |
297 | 297 | $table_name = 'esp_payment'; |
@@ -359,8 +359,8 @@ discard block |
||
359 | 359 | PRIMARY KEY (TTM_ID)"; |
360 | 360 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
361 | 361 | |
362 | - $table_name='esp_question'; |
|
363 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
362 | + $table_name = 'esp_question'; |
|
363 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
364 | 364 | QST_display_text TEXT NOT NULL, |
365 | 365 | QST_admin_label VARCHAR(255) NOT NULL, |
366 | 366 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -372,27 +372,27 @@ discard block |
||
372 | 372 | QST_wp_user BIGINT UNSIGNED NULL, |
373 | 373 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
374 | 374 | PRIMARY KEY (QST_ID)'; |
375 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
375 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
376 | 376 | |
377 | - $table_name='esp_question_group_question'; |
|
378 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
377 | + $table_name = 'esp_question_group_question'; |
|
378 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
379 | 379 | QSG_ID INT UNSIGNED NOT NULL, |
380 | 380 | QST_ID INT UNSIGNED NOT NULL, |
381 | 381 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
382 | 382 | PRIMARY KEY (QGQ_ID) "; |
383 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
383 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
384 | 384 | |
385 | 385 | |
386 | 386 | |
387 | - $table_name='esp_question_option'; |
|
388 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
387 | + $table_name = 'esp_question_option'; |
|
388 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
389 | 389 | QSO_value VARCHAR(255) NOT NULL, |
390 | 390 | QSO_desc TEXT NOT NULL, |
391 | 391 | QST_ID INT UNSIGNED NOT NULL, |
392 | 392 | QSO_order INT UNSIGNED NOT NULL DEFAULT 0, |
393 | 393 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
394 | 394 | PRIMARY KEY (QSO_ID)"; |
395 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
395 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
396 | 396 | |
397 | 397 | |
398 | 398 | |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | |
439 | 439 | |
440 | 440 | |
441 | - $table_name='esp_checkin'; |
|
442 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
441 | + $table_name = 'esp_checkin'; |
|
442 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
443 | 443 | REG_ID INT(10) UNSIGNED NOT NULL, |
444 | 444 | DTT_ID INT(10) UNSIGNED NOT NULL, |
445 | 445 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | PRC_wp_user BIGINT UNSIGNED NULL, |
529 | 529 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
530 | 530 | PRIMARY KEY (PRC_ID)"; |
531 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
531 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
532 | 532 | |
533 | 533 | $table_name = "esp_price_type"; |
534 | 534 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -565,12 +565,12 @@ discard block |
||
565 | 565 | TKT_parent INT(10) UNSIGNED DEFAULT '0', |
566 | 566 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
567 | 567 | PRIMARY KEY (TKT_ID)"; |
568 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
568 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
569 | 569 | |
570 | - EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' ); |
|
570 | + EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
571 | 571 | |
572 | 572 | $table_name = 'esp_question_group'; |
573 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
573 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
574 | 574 | QSG_name VARCHAR(255) NOT NULL, |
575 | 575 | QSG_identifier VARCHAR(100) NOT NULL, |
576 | 576 | QSG_desc TEXT NULL, |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | QSG_wp_user BIGINT UNSIGNED NULL, |
583 | 583 | PRIMARY KEY (QSG_ID), |
584 | 584 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
585 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
585 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
586 | 586 | |
587 | 587 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
588 | 588 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | return $script_4_7_defaults->schema_changes_after_migration(); |
616 | 616 | } |
617 | 617 | |
618 | - public function migration_page_hooks(){ |
|
618 | + public function migration_page_hooks() { |
|
619 | 619 | |
620 | 620 | } |
621 | 621 | |
@@ -624,9 +624,9 @@ discard block |
||
624 | 624 | * which should just be a temporary issue for folks who isntalled 4.8.0-4.8.5; |
625 | 625 | * we should be able to stop doing this in 4.9 |
626 | 626 | */ |
627 | - public function fix_non_default_taxes(){ |
|
627 | + public function fix_non_default_taxes() { |
|
628 | 628 | global $wpdb; |
629 | - $query = $wpdb->prepare( "UPDATE |
|
629 | + $query = $wpdb->prepare("UPDATE |
|
630 | 630 | {$wpdb->prefix}esp_price p INNER JOIN |
631 | 631 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
632 | 632 | SET |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | WHERE |
635 | 635 | p.PRC_is_default = 0 AND |
636 | 636 | pt.PBT_ID = %d |
637 | - ", EEM_Price_Type::base_type_tax ); |
|
638 | - $wpdb->query( $query ); |
|
637 | + ", EEM_Price_Type::base_type_tax); |
|
638 | + $wpdb->query($query); |
|
639 | 639 | } |
640 | 640 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | /** |
19 | 19 | */ |
20 | -class EE_DMS_Unknown_1_0_0 extends EE_Data_Migration_Script_Base{ |
|
20 | +class EE_DMS_Unknown_1_0_0 extends EE_Data_Migration_Script_Base { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Returns whether or not this data migration script can operate on the given version of the database. |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated); |
307 | 307 | $num_records_actually_migrated += $records_migrated_during_stage; |
308 | 308 | $records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage; |
309 | - }catch(Exception $e){ |
|
309 | + } catch(Exception $e){ |
|
310 | 310 | //yes if we catch an exception here, we consider that migration stage borked. |
311 | 311 | $stage->set_status(EE_Data_Migration_Manager::status_fatal_error); |
312 | 312 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
@@ -332,14 +332,14 @@ discard block |
||
332 | 332 | //this migration script apparently has NO stages... which is super weird, but whatever |
333 | 333 | $this->set_completed(); |
334 | 334 | $this->_maybe_do_schema_changes(false); |
335 | - }else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
335 | + } else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
336 | 336 | //apparently we're done, because we couldn't migrate the number we intended to |
337 | 337 | $this->set_completed(); |
338 | 338 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
339 | 339 | //do schema changes for after the migration now |
340 | 340 | //first double-check we haven't already done this |
341 | 341 | $this->_maybe_do_schema_changes(false); |
342 | - }else{ |
|
342 | + } else{ |
|
343 | 343 | //update feedback message, keeping in mind that we show them with the most recent at the top |
344 | 344 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
345 | 345 | } |
@@ -378,12 +378,12 @@ discard block |
||
378 | 378 | ob_start(); |
379 | 379 | if($before){ |
380 | 380 | $this->schema_changes_before_migration(); |
381 | - }else{ |
|
381 | + } else{ |
|
382 | 382 | $this->schema_changes_after_migration(); |
383 | 383 | } |
384 | 384 | $output = ob_get_contents(); |
385 | 385 | ob_end_clean(); |
386 | - }catch(Exception $e){ |
|
386 | + } catch(Exception $e){ |
|
387 | 387 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
388 | 388 | throw $e; |
389 | 389 | } |
@@ -511,13 +511,13 @@ discard block |
||
511 | 511 | if( $table_is_new ) { |
512 | 512 | if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating() ){ |
513 | 513 | return true; |
514 | - }else{ |
|
514 | + } else{ |
|
515 | 515 | return false; |
516 | 516 | } |
517 | - }else{ |
|
517 | + } else{ |
|
518 | 518 | if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){ |
519 | 519 | return true; |
520 | - }else{ |
|
520 | + } else{ |
|
521 | 521 | return false; |
522 | 522 | } |
523 | 523 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | EE_Registry::instance()->load_helper('Activation'); |
535 | 535 | try{ |
536 | 536 | EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables); |
537 | - }catch( EE_Error $e ) { |
|
537 | + } catch( EE_Error $e ) { |
|
538 | 538 | $message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString(); |
539 | 539 | $this->add_error( $message ); |
540 | 540 | $this->_feedback_message .= $message; |
@@ -551,11 +551,11 @@ discard block |
||
551 | 551 | private function _get_req_type_for_plugin_corresponding_to_this_dms(){ |
552 | 552 | if($this->slug() == 'Core'){ |
553 | 553 | return EE_System::instance()->detect_req_type(); |
554 | - }else{//it must be for an addon |
|
554 | + } else{//it must be for an addon |
|
555 | 555 | $addon_name = $this->slug(); |
556 | 556 | if( EE_Registry::instance()->get_addon_by_name($addon_name)){ |
557 | 557 | return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type(); |
558 | - }else{ |
|
558 | + } else{ |
|
559 | 559 | throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ; |
560 | 560 | } |
561 | 561 | } |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | * All children of this must call parent::__construct() at the end of their constructor or suffer the consequences! |
118 | 118 | */ |
119 | 119 | public function __construct() { |
120 | - $this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages',$this->_migration_stages); |
|
121 | - foreach($this->_migration_stages as $migration_stage){ |
|
122 | - if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) { |
|
120 | + $this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages', $this->_migration_stages); |
|
121 | + foreach ($this->_migration_stages as $migration_stage) { |
|
122 | + if ($migration_stage instanceof EE_Data_Migration_Script_Stage) { |
|
123 | 123 | $migration_stage->_construct_finalize($this); |
124 | 124 | } |
125 | 125 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Place to add hooks and filters for tweaking the migrations page, in order |
133 | 133 | * to customize it |
134 | 134 | */ |
135 | - public function migration_page_hooks(){ |
|
135 | + public function migration_page_hooks() { |
|
136 | 136 | //by default none are added because we normally like the default look of the migration page |
137 | 137 | } |
138 | 138 | |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * @param int|string $new_pk eg posts.ID |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function set_mapping($old_table,$old_pk,$new_table,$new_pk){ |
|
150 | + public function set_mapping($old_table, $old_pk, $new_table, $new_pk) { |
|
151 | 151 | //make sure it has the needed keys |
152 | - if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){ |
|
152 | + if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) { |
|
153 | 153 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
154 | 154 | } |
155 | 155 | $this->_mappings[$old_table][$new_table][$old_pk] = $new_pk; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts |
166 | 166 | * @return mixed the primary key on the new table |
167 | 167 | */ |
168 | - public function get_mapping_new_pk($old_table,$old_pk,$new_table){ |
|
169 | - if( ! isset($this->_mappings[$old_table]) || |
|
170 | - ! isset($this->_mappings[$old_table][$new_table])){ |
|
168 | + public function get_mapping_new_pk($old_table, $old_pk, $new_table) { |
|
169 | + if ( ! isset($this->_mappings[$old_table]) || |
|
170 | + ! isset($this->_mappings[$old_table][$new_table])) { |
|
171 | 171 | //try fetching the option |
172 | 172 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
173 | 173 | } |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | * @param mixed $new_pk |
185 | 185 | * @return mixed |
186 | 186 | */ |
187 | - public function get_mapping_old_pk($old_table,$new_table,$new_pk){ |
|
188 | - if( ! isset($this->_mappings[$old_table]) || |
|
189 | - ! isset($this->_mappings[$old_table][$new_table])){ |
|
187 | + public function get_mapping_old_pk($old_table, $new_table, $new_pk) { |
|
188 | + if ( ! isset($this->_mappings[$old_table]) || |
|
189 | + ! isset($this->_mappings[$old_table][$new_table])) { |
|
190 | 190 | //try fetching the option |
191 | 191 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
192 | 192 | } |
193 | - if(isset($this->_mappings[$old_table][$new_table])){ |
|
193 | + if (isset($this->_mappings[$old_table][$new_table])) { |
|
194 | 194 | $new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]); |
195 | - if(isset($new_pk_to_old_pk[$new_pk])){ |
|
195 | + if (isset($new_pk_to_old_pk[$new_pk])) { |
|
196 | 196 | return $new_pk_to_old_pk[$new_pk]; |
197 | 197 | } |
198 | 198 | } |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * @param string $new_table_name |
208 | 208 | * @return array |
209 | 209 | */ |
210 | - protected function _get_mapping_option($old_table_name,$new_table_name){ |
|
211 | - $option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array()); |
|
210 | + protected function _get_mapping_option($old_table_name, $new_table_name) { |
|
211 | + $option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array()); |
|
212 | 212 | return $option; |
213 | 213 | } |
214 | 214 | |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | * @param array $mapping_array |
222 | 222 | * @return boolean success of updating option |
223 | 223 | */ |
224 | - protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){ |
|
224 | + protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) { |
|
225 | 225 | // echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>"; |
226 | - $success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array); |
|
226 | + $success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array); |
|
227 | 227 | return $success; |
228 | 228 | } |
229 | 229 | |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | * @param string $new_table_name |
236 | 236 | * @return string |
237 | 237 | */ |
238 | - protected function _get_mapping_option_name($old_table_name,$new_table_name){ |
|
238 | + protected function _get_mapping_option_name($old_table_name, $new_table_name) { |
|
239 | 239 | global $wpdb; |
240 | - $old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name); |
|
241 | - $new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name); |
|
240 | + $old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name); |
|
241 | + $new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name); |
|
242 | 242 | $migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this)); |
243 | - return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 ); |
|
243 | + return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete. |
258 | 258 | * @return int |
259 | 259 | */ |
260 | - protected function _count_records_to_migrate(){ |
|
260 | + protected function _count_records_to_migrate() { |
|
261 | 261 | $count = 0; |
262 | - foreach($this->stages() as $stage){ |
|
263 | - $count+= $stage->count_records_to_migrate(); |
|
262 | + foreach ($this->stages() as $stage) { |
|
263 | + $count += $stage->count_records_to_migrate(); |
|
264 | 264 | } |
265 | 265 | return $count; |
266 | 266 | } |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | * by just setting a transient and updating it after each migration_step |
273 | 273 | * @return int |
274 | 274 | */ |
275 | - public function count_records_migrated(){ |
|
275 | + public function count_records_migrated() { |
|
276 | 276 | $count = 0; |
277 | - foreach($this->stages() as $stage){ |
|
278 | - $count+= $stage->count_records_migrated(); |
|
277 | + foreach ($this->stages() as $stage) { |
|
278 | + $count += $stage->count_records_migrated(); |
|
279 | 279 | } |
280 | 280 | $this->_records_migrated = $count; |
281 | 281 | return $count; |
@@ -289,24 +289,24 @@ discard block |
||
289 | 289 | * @throws EE_Error |
290 | 290 | * @throws Exception |
291 | 291 | */ |
292 | - public function migration_step($num_records_to_migrate_limit){ |
|
292 | + public function migration_step($num_records_to_migrate_limit) { |
|
293 | 293 | //reset the feedback message |
294 | 294 | $this->_feedback_message = ''; |
295 | 295 | //if we haven't yet done the 1st schema changes, do them now. buffer any output |
296 | 296 | $this->_maybe_do_schema_changes(true); |
297 | 297 | |
298 | - $num_records_actually_migrated =0; |
|
298 | + $num_records_actually_migrated = 0; |
|
299 | 299 | $records_migrated_per_stage = array(); |
300 | 300 | //setup the 'stage' variable, which should hold the last run stage of the migration (or none at all if nothing runs) |
301 | 301 | $stage = null; |
302 | 302 | //get the next stage that isn't complete |
303 | - foreach($this->stages() as $stage){ |
|
304 | - if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){ |
|
305 | - try{ |
|
303 | + foreach ($this->stages() as $stage) { |
|
304 | + if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) { |
|
305 | + try { |
|
306 | 306 | $records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated); |
307 | 307 | $num_records_actually_migrated += $records_migrated_during_stage; |
308 | 308 | $records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage; |
309 | - }catch(Exception $e){ |
|
309 | + } catch (Exception $e) { |
|
310 | 310 | //yes if we catch an exception here, we consider that migration stage borked. |
311 | 311 | $stage->set_status(EE_Data_Migration_Manager::status_fatal_error); |
312 | 312 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | throw $e; |
315 | 315 | } |
316 | 316 | //check that the migration stage didn't mark itself as having a fatal error |
317 | - if($stage->is_broken()){ |
|
317 | + if ($stage->is_broken()) { |
|
318 | 318 | $this->set_broken(); |
319 | 319 | throw new EE_Error($stage->get_last_error()); |
320 | 320 | } |
@@ -322,24 +322,24 @@ discard block |
||
322 | 322 | //once we've migrated all the number we intended to (possibly from different stages), stop migrating |
323 | 323 | //or if we had a fatal error |
324 | 324 | //or if the current script stopped early- its not done, but it's done all it thinks we should do on this step |
325 | - if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){ |
|
325 | + if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) { |
|
326 | 326 | break; |
327 | 327 | } |
328 | 328 | } |
329 | 329 | //check if we're all done this data migration... |
330 | 330 | //which is indicated by being done early AND the last stage claims to be done |
331 | - if($stage == NULL){ |
|
331 | + if ($stage == NULL) { |
|
332 | 332 | //this migration script apparently has NO stages... which is super weird, but whatever |
333 | 333 | $this->set_completed(); |
334 | 334 | $this->_maybe_do_schema_changes(false); |
335 | - }else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
335 | + } else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) { |
|
336 | 336 | //apparently we're done, because we couldn't migrate the number we intended to |
337 | 337 | $this->set_completed(); |
338 | 338 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
339 | 339 | //do schema changes for after the migration now |
340 | 340 | //first double-check we haven't already done this |
341 | 341 | $this->_maybe_do_schema_changes(false); |
342 | - }else{ |
|
342 | + } else { |
|
343 | 343 | //update feedback message, keeping in mind that we show them with the most recent at the top |
344 | 344 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
345 | 345 | } |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage |
354 | 354 | * @return void |
355 | 355 | */ |
356 | - private function _update_feedback_message($records_migrated_per_stage){ |
|
356 | + private function _update_feedback_message($records_migrated_per_stage) { |
|
357 | 357 | $feedback_message_array = array(); |
358 | - foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){ |
|
359 | - $feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ; |
|
358 | + foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) { |
|
359 | + $feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name); |
|
360 | 360 | } |
361 | - $this->_feedback_message .= implode("<br>",$feedback_message_array); |
|
361 | + $this->_feedback_message .= implode("<br>", $feedback_message_array); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | |
@@ -370,27 +370,27 @@ discard block |
||
370 | 370 | * @throws Exception |
371 | 371 | * @return void |
372 | 372 | */ |
373 | - private function _maybe_do_schema_changes($before = true){ |
|
373 | + private function _maybe_do_schema_changes($before = true) { |
|
374 | 374 | //so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran |
375 | - $property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran'; |
|
376 | - if ( ! $this->$property_name ){ |
|
377 | - try{ |
|
375 | + $property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran'; |
|
376 | + if ( ! $this->$property_name) { |
|
377 | + try { |
|
378 | 378 | ob_start(); |
379 | - if($before){ |
|
379 | + if ($before) { |
|
380 | 380 | $this->schema_changes_before_migration(); |
381 | - }else{ |
|
381 | + } else { |
|
382 | 382 | $this->schema_changes_after_migration(); |
383 | 383 | } |
384 | 384 | $output = ob_get_contents(); |
385 | 385 | ob_end_clean(); |
386 | - }catch(Exception $e){ |
|
386 | + } catch (Exception $e) { |
|
387 | 387 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
388 | 388 | throw $e; |
389 | 389 | } |
390 | 390 | //record that we've done these schema changes |
391 | 391 | $this->$property_name = true; |
392 | 392 | //if there were any warnings etc, record them as non-fatal errors |
393 | - if( $output ){ |
|
393 | + if ($output) { |
|
394 | 394 | //there were some warnings |
395 | 395 | $this->_errors[] = $output; |
396 | 396 | } |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | * @param string $table_definition_sql |
418 | 418 | * @param string $engine_string |
419 | 419 | */ |
420 | - protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){ |
|
420 | + protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') { |
|
421 | 421 | // EEH_Debug_Tools::instance()->start_timer( '_table_is_new_in_this_version_' . $table_name ); |
422 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( true ) ); |
|
422 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(true)); |
|
423 | 423 | // EEH_Debug_Tools::instance()->stop_timer( '_table_is_new_in_this_version_' . $table_name ); |
424 | 424 | } |
425 | 425 | |
@@ -433,9 +433,9 @@ discard block |
||
433 | 433 | * @param string $table_definition_sql |
434 | 434 | * @param string $engine_string |
435 | 435 | */ |
436 | - protected function _table_is_changed_in_this_version($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
436 | + protected function _table_is_changed_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
437 | 437 | // EEH_Debug_Tools::instance()->start_timer( '_table_is_changed_in_this_version' . $table_name ); |
438 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
438 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
439 | 439 | // EEH_Debug_Tools::instance()->stop_timer( '_table_is_changed_in_this_version' . $table_name ); |
440 | 440 | } |
441 | 441 | |
@@ -446,9 +446,9 @@ discard block |
||
446 | 446 | * @param string $table_name |
447 | 447 | * @return boolean |
448 | 448 | */ |
449 | - protected function _old_table_exists( $table_name ) { |
|
450 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
451 | - return EEH_Activation::table_exists( $table_name ); |
|
449 | + protected function _old_table_exists($table_name) { |
|
450 | + EE_Registry::instance()->load_helper('Activation'); |
|
451 | + return EEH_Activation::table_exists($table_name); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | * @param string $table_name |
459 | 459 | * @return boolean |
460 | 460 | */ |
461 | - protected function _delete_table_if_empty( $table_name ) { |
|
462 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
463 | - return EEH_Activation::delete_db_table_if_empty( $table_name ); |
|
461 | + protected function _delete_table_if_empty($table_name) { |
|
462 | + EE_Registry::instance()->load_helper('Activation'); |
|
463 | + return EEH_Activation::delete_db_table_if_empty($table_name); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | |
@@ -479,9 +479,9 @@ discard block |
||
479 | 479 | * @param string $table_definition_sql |
480 | 480 | * @param string $engine_string |
481 | 481 | */ |
482 | - protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
482 | + protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
483 | 483 | // EEH_Debug_Tools::instance()->start_timer( '_table_should_exist_previously' . $table_name ); |
484 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
484 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
485 | 485 | // EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name ); |
486 | 486 | } |
487 | 487 | |
@@ -496,13 +496,13 @@ discard block |
||
496 | 496 | * @param string $table_definition_sql |
497 | 497 | * @param string $engine_string |
498 | 498 | */ |
499 | - protected function _table_has_not_changed_since_previous( $table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
500 | - if( $this->_currently_migrating() ) { |
|
499 | + protected function _table_has_not_changed_since_previous($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
500 | + if ($this->_currently_migrating()) { |
|
501 | 501 | //if we're doing a migration, and this table apparently already exists, then we don't need do anything right? |
502 | 502 | // EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name ); |
503 | 503 | return; |
504 | 504 | } |
505 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
505 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | protected function _currently_migrating() { |
513 | 513 | //we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM) |
514 | 514 | return $this->_migrating && |
515 | - $this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) && |
|
515 | + $this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) && |
|
516 | 516 | EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance; |
517 | 517 | } |
518 | 518 | |
@@ -523,17 +523,17 @@ discard block |
||
523 | 523 | * @param boolean $table_is_new |
524 | 524 | * @return boolean |
525 | 525 | */ |
526 | - protected function _pre_existing_table_should_be_dropped( $table_is_new ) { |
|
527 | - if( $table_is_new ) { |
|
528 | - if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating() ){ |
|
526 | + protected function _pre_existing_table_should_be_dropped($table_is_new) { |
|
527 | + if ($table_is_new) { |
|
528 | + if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating()) { |
|
529 | 529 | return true; |
530 | - }else{ |
|
530 | + } else { |
|
531 | 531 | return false; |
532 | 532 | } |
533 | - }else{ |
|
534 | - if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){ |
|
533 | + } else { |
|
534 | + if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) { |
|
535 | 535 | return true; |
536 | - }else{ |
|
536 | + } else { |
|
537 | 537 | return false; |
538 | 538 | } |
539 | 539 | } |
@@ -546,13 +546,13 @@ discard block |
||
546 | 546 | * @param string $engine_string |
547 | 547 | * @param boolean $drop_pre_existing_tables |
548 | 548 | */ |
549 | - private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){ |
|
549 | + private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) { |
|
550 | 550 | EE_Registry::instance()->load_helper('Activation'); |
551 | - try{ |
|
552 | - EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
553 | - }catch( EE_Error $e ) { |
|
554 | - $message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString(); |
|
555 | - $this->add_error( $message ); |
|
551 | + try { |
|
552 | + EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
553 | + } catch (EE_Error $e) { |
|
554 | + $message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString(); |
|
555 | + $this->add_error($message); |
|
556 | 556 | $this->_feedback_message .= $message; |
557 | 557 | } |
558 | 558 | } |
@@ -564,15 +564,15 @@ discard block |
||
564 | 564 | * @return int one of EE_System::_req_type_* constants |
565 | 565 | * @throws EE_Error |
566 | 566 | */ |
567 | - private function _get_req_type_for_plugin_corresponding_to_this_dms(){ |
|
568 | - if($this->slug() == 'Core'){ |
|
567 | + private function _get_req_type_for_plugin_corresponding_to_this_dms() { |
|
568 | + if ($this->slug() == 'Core') { |
|
569 | 569 | return EE_System::instance()->detect_req_type(); |
570 | - }else{//it must be for an addon |
|
570 | + } else {//it must be for an addon |
|
571 | 571 | $addon_name = $this->slug(); |
572 | - if( EE_Registry::instance()->get_addon_by_name($addon_name)){ |
|
572 | + if (EE_Registry::instance()->get_addon_by_name($addon_name)) { |
|
573 | 573 | return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type(); |
574 | - }else{ |
|
575 | - throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ; |
|
574 | + } else { |
|
575 | + throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name())))); |
|
576 | 576 | } |
577 | 577 | } |
578 | 578 | } |
@@ -583,13 +583,13 @@ discard block |
||
583 | 583 | * returns an array of strings describing errors by all the script's stages |
584 | 584 | * @return array |
585 | 585 | */ |
586 | - public function get_errors(){ |
|
586 | + public function get_errors() { |
|
587 | 587 | $all_errors = $this->_errors; |
588 | - if( ! is_array($all_errors)){ |
|
588 | + if ( ! is_array($all_errors)) { |
|
589 | 589 | $all_errors = array(); |
590 | 590 | } |
591 | - foreach($this->stages() as $stage){ |
|
592 | - $all_errors = array_merge($stage->get_errors(),$all_errors); |
|
591 | + foreach ($this->stages() as $stage) { |
|
592 | + $all_errors = array_merge($stage->get_errors(), $all_errors); |
|
593 | 593 | } |
594 | 594 | return $all_errors; |
595 | 595 | } |
@@ -600,8 +600,8 @@ discard block |
||
600 | 600 | * Indicates whether or not this migration script should continue |
601 | 601 | * @return boolean |
602 | 602 | */ |
603 | - public function can_continue(){ |
|
604 | - return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script); |
|
603 | + public function can_continue() { |
|
604 | + return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | * get ordered by the indexes |
614 | 614 | * @return EE_Data_Migration_Script_Stage[] |
615 | 615 | */ |
616 | - protected function stages(){ |
|
617 | - $stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages ); |
|
616 | + protected function stages() { |
|
617 | + $stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages); |
|
618 | 618 | ksort($stages); |
619 | 619 | return $stages; |
620 | 620 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * can be displayed to the user |
627 | 627 | * @return string |
628 | 628 | */ |
629 | - public function get_feedback_message(){ |
|
629 | + public function get_feedback_message() { |
|
630 | 630 | return $this->_feedback_message; |
631 | 631 | } |
632 | 632 | |
@@ -638,16 +638,16 @@ discard block |
||
638 | 638 | * possible that this class is defined when it goes to sleep, but NOT available when it |
639 | 639 | * awakes (eg, this class is part of an addon that is deactivated at some point). |
640 | 640 | */ |
641 | - public function properties_as_array(){ |
|
641 | + public function properties_as_array() { |
|
642 | 642 | $properties = parent::properties_as_array(); |
643 | 643 | $properties['_migration_stages'] = array(); |
644 | - foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){ |
|
644 | + foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) { |
|
645 | 645 | $properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array(); |
646 | 646 | } |
647 | 647 | unset($properties['_mappings']); |
648 | 648 | |
649 | - foreach($this->_mappings as $old_table_name => $mapping_to_new_table){ |
|
650 | - foreach($mapping_to_new_table as $new_table_name => $mapping){ |
|
649 | + foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) { |
|
650 | + foreach ($mapping_to_new_table as $new_table_name => $mapping) { |
|
651 | 651 | $this->_set_mapping_option($old_table_name, $new_table_name, $mapping); |
652 | 652 | } |
653 | 653 | } |
@@ -662,19 +662,19 @@ discard block |
||
662 | 662 | * @param array $array_of_properties like what's produced from properties_as_array() method |
663 | 663 | * @return void |
664 | 664 | */ |
665 | - public function instantiate_from_array_of_properties($array_of_properties){ |
|
665 | + public function instantiate_from_array_of_properties($array_of_properties) { |
|
666 | 666 | $stages_properties_arrays = $array_of_properties['_migration_stages']; |
667 | 667 | unset($array_of_properties['_migration_stages']); |
668 | 668 | unset($array_of_properties['class']); |
669 | - foreach($array_of_properties as $property_name => $property_value){ |
|
669 | + foreach ($array_of_properties as $property_name => $property_value) { |
|
670 | 670 | $this->$property_name = $property_value; |
671 | 671 | } |
672 | 672 | //_migration_stages are already instantiated, but have only default data |
673 | - foreach($this->_migration_stages as $stage){ |
|
674 | - $stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays); |
|
673 | + foreach ($this->_migration_stages as $stage) { |
|
674 | + $stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays); |
|
675 | 675 | //SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by |
676 | 676 | //an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet) |
677 | - if($stage_data){ |
|
677 | + if ($stage_data) { |
|
678 | 678 | $stage->instantiate_from_array_of_properties($stage_data); |
679 | 679 | } |
680 | 680 | } |
@@ -690,9 +690,9 @@ discard block |
||
690 | 690 | * @param array $migration_stage_data_arrays |
691 | 691 | * @return null |
692 | 692 | */ |
693 | - private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){ |
|
694 | - foreach($migration_stage_data_arrays as $migration_stage_data_array){ |
|
695 | - if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){ |
|
693 | + private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) { |
|
694 | + foreach ($migration_stage_data_arrays as $migration_stage_data_array) { |
|
695 | + if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) { |
|
696 | 696 | return $migration_stage_data_array; |
697 | 697 | } |
698 | 698 | } |
@@ -708,8 +708,8 @@ discard block |
||
708 | 708 | * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin |
709 | 709 | * that will be updated to. Eg array('Core','4.1.0') |
710 | 710 | */ |
711 | - public final function migrates_to_version(){ |
|
712 | - return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) ); |
|
711 | + public final function migrates_to_version() { |
|
712 | + return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this)); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | |
@@ -721,10 +721,10 @@ discard block |
||
721 | 721 | * Or 'Core' for core (non-addon). |
722 | 722 | * @return string |
723 | 723 | */ |
724 | - public function slug(){ |
|
724 | + public function slug() { |
|
725 | 725 | $migrates_to_version_info = $this->migrates_to_version(); |
726 | 726 | //the slug is the first part of the array |
727 | - return $migrates_to_version_info[ 'slug' ]; |
|
727 | + return $migrates_to_version_info['slug']; |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * the database up so it can run), then you can set "A" to priority 3 or something. |
739 | 739 | * @return int |
740 | 740 | */ |
741 | - public function priority(){ |
|
741 | + public function priority() { |
|
742 | 742 | return $this->_priority; |
743 | 743 | } |
744 | 744 | |
@@ -751,18 +751,18 @@ discard block |
||
751 | 751 | * @param boolean $migrating |
752 | 752 | * @return void |
753 | 753 | */ |
754 | - public function set_migrating( $migrating = TRUE ){ |
|
754 | + public function set_migrating($migrating = TRUE) { |
|
755 | 755 | $this->_migrating = $migrating; |
756 | 756 | } |
757 | 757 | |
758 | 758 | /** |
759 | 759 | * Marks that we think this migration class can continue to migrate |
760 | 760 | */ |
761 | - public function reattempt(){ |
|
761 | + public function reattempt() { |
|
762 | 762 | parent::reattempt(); |
763 | 763 | //also, we want to reattempt any stages that were marked as borked |
764 | - foreach( $this->stages() as $stage ) { |
|
765 | - if( $stage->is_broken() ) { |
|
764 | + foreach ($this->stages() as $stage) { |
|
765 | + if ($stage->is_broken()) { |
|
766 | 766 | $stage->reattempt(); |
767 | 767 | } |
768 | 768 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * _migration_step() (ie, it its a count of rows in the old attendees table in _count_records_to_migrate(), it should also be OLD attendee rows migrated |
35 | 35 | * on each call to _migration_step(). |
36 | 36 | */ |
37 | -abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base{ |
|
37 | +abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base { |
|
38 | 38 | /** |
39 | 39 | * The migration script this is a stage of |
40 | 40 | * @var EE_Data_Migration_Script_Base |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * called by EE_Data_Migration_Script_Base's __construct() method so children don't have to |
48 | 48 | * @param EE_Data_Migration_Script_Base $migration_script |
49 | 49 | */ |
50 | - public function _construct_finalize($migration_script){ |
|
50 | + public function _construct_finalize($migration_script) { |
|
51 | 51 | $this->_migration_script = $migration_script; |
52 | 52 | } |
53 | 53 | |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | * @param int $num_items_to_migrate |
59 | 59 | * @return int |
60 | 60 | */ |
61 | - public function migration_step($num_items_to_migrate=50){ |
|
61 | + public function migration_step($num_items_to_migrate = 50) { |
|
62 | 62 | //before we run the migration step, we want ot take note of warnings that get outputted |
63 | 63 | ob_start(); |
64 | 64 | $items_migrated = $this->_migration_step($num_items_to_migrate); |
65 | 65 | $output = ob_get_contents(); |
66 | 66 | ob_end_clean(); |
67 | - if( $output ){ |
|
67 | + if ($output) { |
|
68 | 68 | $this->add_error($output); |
69 | 69 | } |
70 | 70 | $this->_records_migrated += $items_migrated; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param int $num_items_to_migrate |
83 | 83 | * @return int number of items ACTUALLY migrated |
84 | 84 | */ |
85 | - abstract protected function _migration_step($num_items_to_migrate=50); |
|
85 | + abstract protected function _migration_step($num_items_to_migrate = 50); |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Counts the records that have been migrated so far |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * returns an array of strings describing errors |
97 | 97 | * @return array |
98 | 98 | */ |
99 | - public function get_errors(){ |
|
99 | + public function get_errors() { |
|
100 | 100 | return $this->_errors; |
101 | 101 | } |
102 | 102 | |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | * to have been made from the properties_as_array() function. |
107 | 107 | * @param array $array_of_properties like what's produced from properties_as_array() method |
108 | 108 | */ |
109 | - public function instantiate_from_array_of_properties($array_of_properties){ |
|
109 | + public function instantiate_from_array_of_properties($array_of_properties) { |
|
110 | 110 | unset($array_of_properties['class']); |
111 | - foreach($array_of_properties as $property_name => $property_value){ |
|
111 | + foreach ($array_of_properties as $property_name => $property_value) { |
|
112 | 112 | $this->$property_name = $property_value; |
113 | 113 | } |
114 | 114 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * Gets the script this is a stage of |
118 | 118 | * @return EE_Data_Migration_Script_Base |
119 | 119 | */ |
120 | - protected function get_migration_script(){ |
|
120 | + protected function get_migration_script() { |
|
121 | 121 | return $this->_migration_script; |
122 | 122 | } |
123 | 123 | } |
@@ -21,12 +21,12 @@ |
||
21 | 21 | protected $_old_table; |
22 | 22 | |
23 | 23 | /** |
24 | - * Set in the constructor to add this sql to both the counting query in |
|
25 | - * EE_Data_Migration_Script_Stage_Table::_count_records_to_migrate() and |
|
26 | - * EE_Data_Migration_Script_Stage_Table::_get_rows(). |
|
27 | - * Eg "where column_name like '%some_value%'" |
|
28 | - * @var string |
|
29 | - */ |
|
24 | + * Set in the constructor to add this sql to both the counting query in |
|
25 | + * EE_Data_Migration_Script_Stage_Table::_count_records_to_migrate() and |
|
26 | + * EE_Data_Migration_Script_Stage_Table::_get_rows(). |
|
27 | + * Eg "where column_name like '%some_value%'" |
|
28 | + * @var string |
|
29 | + */ |
|
30 | 30 | protected $_extra_where_sql; |
31 | 31 | |
32 | 32 |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | * @param int $num_items |
42 | 42 | * @return int number of items ACTUALLY migrated |
43 | 43 | */ |
44 | - function _migration_step($num_items=50){ |
|
45 | - $rows = $this->_get_rows( $num_items ); |
|
44 | + function _migration_step($num_items = 50) { |
|
45 | + $rows = $this->_get_rows($num_items); |
|
46 | 46 | $items_actually_migrated = 0; |
47 | - foreach($rows as $old_row){ |
|
47 | + foreach ($rows as $old_row) { |
|
48 | 48 | $this->_migrate_old_row($old_row); |
49 | 49 | $items_actually_migrated++; |
50 | 50 | } |
51 | - if($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()){ |
|
51 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
52 | 52 | $this->set_completed(); |
53 | 53 | } |
54 | 54 | return $items_actually_migrated; |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | * @param int $limit |
61 | 61 | * @return array of arrays like $wpdb->get_results($sql, ARRAY_A) |
62 | 62 | */ |
63 | - protected function _get_rows( $limit ){ |
|
63 | + protected function _get_rows($limit) { |
|
64 | 64 | global $wpdb; |
65 | 65 | $start_at_record = $this->count_records_migrated(); |
66 | - $query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare("LIMIT %d, %d",$start_at_record,$limit); |
|
67 | - return $wpdb->get_results($query,ARRAY_A); |
|
66 | + $query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} ".$wpdb->prepare("LIMIT %d, %d", $start_at_record, $limit); |
|
67 | + return $wpdb->get_results($query, ARRAY_A); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function _count_records_to_migrate() { |
77 | 77 | global $wpdb; |
78 | - $query = "SELECT COUNT(*) FROM {$this->_old_table} {$this->_extra_where_sql}"; |
|
79 | - $count = $wpdb->get_var( $query ); |
|
78 | + $query = "SELECT COUNT(*) FROM {$this->_old_table} {$this->_extra_where_sql}"; |
|
79 | + $count = $wpdb->get_var($query); |
|
80 | 80 | return $count; |
81 | 81 | } |
82 | 82 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * date_format and the second value is the time format |
51 | 51 | * @return EE_Attendee |
52 | 52 | */ |
53 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
54 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
55 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
53 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
54 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
55 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * the website will be used. |
64 | 64 | * @return EE_Attendee |
65 | 65 | */ |
66 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
67 | - return new self( $props_n_values, TRUE, $timezone ); |
|
66 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
67 | + return new self($props_n_values, TRUE, $timezone); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @param boolean $show_deleted whether or not to include deleted events |
79 | 79 | * @return EE_Datetime[] |
80 | 80 | */ |
81 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE, $limit = NULL ) { |
|
82 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_event_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted, $limit ); |
|
81 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE, $limit = NULL) { |
|
82 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_event_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted, $limit); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return EE_Datetime |
90 | 90 | */ |
91 | 91 | public function first_datetime() { |
92 | - return $this->get_first_related( 'Datetime' ); |
|
92 | + return $this->get_first_related('Datetime'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | * @param bool $try_to_exclude_deleted |
101 | 101 | * @return EE_Datetime |
102 | 102 | */ |
103 | - public function primary_datetime( $try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE ) { |
|
104 | - if ( !empty ( $this->_Primary_Datetime ) ) { |
|
103 | + public function primary_datetime($try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE) { |
|
104 | + if ( ! empty ($this->_Primary_Datetime)) { |
|
105 | 105 | return $this->_Primary_Datetime; |
106 | 106 | } |
107 | - $this->_Primary_Datetime = EEM_Datetime::instance( $this->_timezone )->get_primary_datetime_for_event( $this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted ); |
|
107 | + $this->_Primary_Datetime = EEM_Datetime::instance($this->_timezone)->get_primary_datetime_for_event($this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted); |
|
108 | 108 | return $this->_Primary_Datetime; |
109 | 109 | } |
110 | 110 | |
@@ -115,30 +115,30 @@ discard block |
||
115 | 115 | * @param array $query_params like EEM_Base::get_all |
116 | 116 | * @return EE_Ticket[] |
117 | 117 | */ |
118 | - public function tickets( $query_params = array() ) { |
|
118 | + public function tickets($query_params = array()) { |
|
119 | 119 | //first get all datetimes |
120 | 120 | $datetimes = $this->datetimes_ordered(); |
121 | - if ( ! $datetimes ) { |
|
121 | + if ( ! $datetimes) { |
|
122 | 122 | return array(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | $datetime_ids = array(); |
126 | - foreach ( $datetimes as $datetime ) { |
|
126 | + foreach ($datetimes as $datetime) { |
|
127 | 127 | $datetime_ids[] = $datetime->ID(); |
128 | 128 | } |
129 | 129 | |
130 | - $where_params = array( 'Datetime.DTT_ID' => array( 'IN', $datetime_ids ) ); |
|
130 | + $where_params = array('Datetime.DTT_ID' => array('IN', $datetime_ids)); |
|
131 | 131 | |
132 | 132 | //if incoming $query_params has where conditions let's merge but not override existing. |
133 | - if ( is_array( $query_params ) && isset( $query_params[0]) ) { |
|
134 | - $where_params = array_merge( $query_params[0], $where_params ); |
|
135 | - unset( $query_params[0] ); |
|
133 | + if (is_array($query_params) && isset($query_params[0])) { |
|
134 | + $where_params = array_merge($query_params[0], $where_params); |
|
135 | + unset($query_params[0]); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | //now add $where_params to $query_params |
139 | 139 | $query_params[0] = $where_params; |
140 | 140 | |
141 | - return EEM_Ticket::instance()->get_all( $query_params ); |
|
141 | + return EEM_Ticket::instance()->get_all($query_params); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @return bool |
148 | 148 | */ |
149 | 149 | function additional_limit() { |
150 | - return $this->get( 'EVT_additional_limit' ); |
|
150 | + return $this->get('EVT_additional_limit'); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @return bool |
157 | 157 | */ |
158 | 158 | function allow_overflow() { |
159 | - return $this->get( 'EVT_allow_overflow' ); |
|
159 | + return $this->get('EVT_allow_overflow'); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @return bool |
166 | 166 | */ |
167 | 167 | function created() { |
168 | - return $this->get( 'EVT_created' ); |
|
168 | + return $this->get('EVT_created'); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @return bool |
175 | 175 | */ |
176 | 176 | function description() { |
177 | - return $this->get( 'EVT_desc' ); |
|
177 | + return $this->get('EVT_desc'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @return string of html |
185 | 185 | */ |
186 | 186 | function description_filtered() { |
187 | - return $this->get_pretty( 'EVT_desc' ); |
|
187 | + return $this->get_pretty('EVT_desc'); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @return bool |
194 | 194 | */ |
195 | 195 | function display_description() { |
196 | - return $this->get( 'EVT_display_desc' ); |
|
196 | + return $this->get('EVT_display_desc'); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return bool |
203 | 203 | */ |
204 | 204 | function display_ticket_selector() { |
205 | - return (bool)$this->get( 'EVT_display_ticket_selector' ); |
|
205 | + return (bool) $this->get('EVT_display_ticket_selector'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @return bool |
212 | 212 | */ |
213 | 213 | function external_url() { |
214 | - return $this->get( 'EVT_external_URL' ); |
|
214 | + return $this->get('EVT_external_URL'); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return bool |
221 | 221 | */ |
222 | 222 | function member_only() { |
223 | - return $this->get( 'EVT_member_only' ); |
|
223 | + return $this->get('EVT_member_only'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @return bool |
230 | 230 | */ |
231 | 231 | function phone() { |
232 | - return $this->get( 'EVT_phone' ); |
|
232 | + return $this->get('EVT_phone'); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @return bool |
239 | 239 | */ |
240 | 240 | function modified() { |
241 | - return $this->get( 'EVT_modified' ); |
|
241 | + return $this->get('EVT_modified'); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @return bool |
248 | 248 | */ |
249 | 249 | function name() { |
250 | - return $this->get( 'EVT_name' ); |
|
250 | + return $this->get('EVT_name'); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return bool |
257 | 257 | */ |
258 | 258 | function order() { |
259 | - return $this->get( 'EVT_order' ); |
|
259 | + return $this->get('EVT_order'); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | * @return bool|string |
266 | 266 | */ |
267 | 267 | function default_registration_status() { |
268 | - $event_default_registration_status = $this->get( 'EVT_default_registration_status' ); |
|
269 | - return !empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
268 | + $event_default_registration_status = $this->get('EVT_default_registration_status'); |
|
269 | + return ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -277,14 +277,14 @@ discard block |
||
277 | 277 | * @param bool $not_full_desc |
278 | 278 | * @return bool|string |
279 | 279 | */ |
280 | - function short_description( $num_words = 55, $more = NULL, $not_full_desc = FALSE ) { |
|
281 | - $short_desc = $this->get( 'EVT_short_desc' ); |
|
282 | - if ( !empty( $short_desc ) || $not_full_desc ) { |
|
280 | + function short_description($num_words = 55, $more = NULL, $not_full_desc = FALSE) { |
|
281 | + $short_desc = $this->get('EVT_short_desc'); |
|
282 | + if ( ! empty($short_desc) || $not_full_desc) { |
|
283 | 283 | return $short_desc; |
284 | 284 | } |
285 | 285 | else { |
286 | - $full_desc = $this->get( 'EVT_desc' ); |
|
287 | - return wp_trim_words( $full_desc, $num_words, $more ); |
|
286 | + $full_desc = $this->get('EVT_desc'); |
|
287 | + return wp_trim_words($full_desc, $num_words, $more); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @return bool |
295 | 295 | */ |
296 | 296 | function slug() { |
297 | - return $this->get( 'EVT_slug' ); |
|
297 | + return $this->get('EVT_slug'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @return bool |
304 | 304 | */ |
305 | 305 | function timezone_string() { |
306 | - return $this->get( 'EVT_timezone_string' ); |
|
306 | + return $this->get('EVT_timezone_string'); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @return bool |
313 | 313 | */ |
314 | 314 | function visible_on() { |
315 | - return $this->get( 'EVT_visible_on' ); |
|
315 | + return $this->get('EVT_visible_on'); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @return bool |
322 | 322 | */ |
323 | 323 | function wp_user() { |
324 | - return $this->get( 'EVT_wp_user' ); |
|
324 | + return $this->get('EVT_wp_user'); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @return bool |
331 | 331 | */ |
332 | 332 | function donations() { |
333 | - return $this->get( 'EVT_donations' ); |
|
333 | + return $this->get('EVT_donations'); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | /** |
339 | 339 | * @param $limit |
340 | 340 | */ |
341 | - function set_additional_limit( $limit ) { |
|
342 | - $this->set( 'EVT_additional_limit', $limit ); |
|
341 | + function set_additional_limit($limit) { |
|
342 | + $this->set('EVT_additional_limit', $limit); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | /** |
348 | 348 | * @param $created |
349 | 349 | */ |
350 | - function set_created( $created ) { |
|
351 | - $this->set( 'EVT_created', $created ); |
|
350 | + function set_created($created) { |
|
351 | + $this->set('EVT_created', $created); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | /** |
357 | 357 | * @param $desc |
358 | 358 | */ |
359 | - function set_description( $desc ) { |
|
360 | - $this->set( 'EVT_desc', $desc ); |
|
359 | + function set_description($desc) { |
|
360 | + $this->set('EVT_desc', $desc); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | /** |
366 | 366 | * @param $display_desc |
367 | 367 | */ |
368 | - function set_display_description( $display_desc ) { |
|
369 | - $this->set( 'EVT_display_desc', $display_desc ); |
|
368 | + function set_display_description($display_desc) { |
|
369 | + $this->set('EVT_display_desc', $display_desc); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | /** |
375 | 375 | * @param $display_ticket_selector |
376 | 376 | */ |
377 | - function set_display_ticket_selector( $display_ticket_selector ) { |
|
378 | - $this->set( 'EVT_display_ticket_selector', $display_ticket_selector ); |
|
377 | + function set_display_ticket_selector($display_ticket_selector) { |
|
378 | + $this->set('EVT_display_ticket_selector', $display_ticket_selector); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | |
@@ -383,8 +383,8 @@ discard block |
||
383 | 383 | /** |
384 | 384 | * @param $external_url |
385 | 385 | */ |
386 | - function set_external_url( $external_url ) { |
|
387 | - $this->set( 'EVT_external_URL', $external_url ); |
|
386 | + function set_external_url($external_url) { |
|
387 | + $this->set('EVT_external_URL', $external_url); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | /** |
393 | 393 | * @param $member_only |
394 | 394 | */ |
395 | - function set_member_only( $member_only ) { |
|
396 | - $this->set( 'EVT_member_only', $member_only ); |
|
395 | + function set_member_only($member_only) { |
|
396 | + $this->set('EVT_member_only', $member_only); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | /** |
402 | 402 | * @param $event_phone |
403 | 403 | */ |
404 | - function set_event_phone( $event_phone ) { |
|
405 | - $this->set( 'EVT_phone', $event_phone ); |
|
404 | + function set_event_phone($event_phone) { |
|
405 | + $this->set('EVT_phone', $event_phone); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -410,8 +410,8 @@ discard block |
||
410 | 410 | /** |
411 | 411 | * @param $modified |
412 | 412 | */ |
413 | - function set_modified( $modified ) { |
|
414 | - $this->set( 'EVT_modified', $modified ); |
|
413 | + function set_modified($modified) { |
|
414 | + $this->set('EVT_modified', $modified); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | /** |
420 | 420 | * @param $name |
421 | 421 | */ |
422 | - function set_name( $name ) { |
|
423 | - $this->set( 'EVT_name', $name ); |
|
422 | + function set_name($name) { |
|
423 | + $this->set('EVT_name', $name); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | |
@@ -428,8 +428,8 @@ discard block |
||
428 | 428 | /** |
429 | 429 | * @param $order |
430 | 430 | */ |
431 | - function set_order( $order ) { |
|
432 | - $this->set( 'EVT_order', $order ); |
|
431 | + function set_order($order) { |
|
432 | + $this->set('EVT_order', $order); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -437,8 +437,8 @@ discard block |
||
437 | 437 | /** |
438 | 438 | * @param $short_desc |
439 | 439 | */ |
440 | - function set_short_description( $short_desc ) { |
|
441 | - $this->set( 'EVT_short_desc', $short_desc ); |
|
440 | + function set_short_description($short_desc) { |
|
441 | + $this->set('EVT_short_desc', $short_desc); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | |
@@ -446,8 +446,8 @@ discard block |
||
446 | 446 | /** |
447 | 447 | * @param $slug |
448 | 448 | */ |
449 | - function set_slug( $slug ) { |
|
450 | - $this->set( 'EVT_slug', $slug ); |
|
449 | + function set_slug($slug) { |
|
450 | + $this->set('EVT_slug', $slug); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | /** |
456 | 456 | * @param $timezone_string |
457 | 457 | */ |
458 | - function set_timezone_string( $timezone_string ) { |
|
459 | - $this->set( 'EVT_timezone_string', $timezone_string ); |
|
458 | + function set_timezone_string($timezone_string) { |
|
459 | + $this->set('EVT_timezone_string', $timezone_string); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | |
@@ -464,8 +464,8 @@ discard block |
||
464 | 464 | /** |
465 | 465 | * @param $visible_on |
466 | 466 | */ |
467 | - function set_visible_on( $visible_on ) { |
|
468 | - $this->set( 'EVT_visible_on', $visible_on ); |
|
467 | + function set_visible_on($visible_on) { |
|
468 | + $this->set('EVT_visible_on', $visible_on); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | /** |
474 | 474 | * @param $wp_user |
475 | 475 | */ |
476 | - function set_wp_user( $wp_user ) { |
|
477 | - $this->set( 'EVT_wp_user', $wp_user ); |
|
476 | + function set_wp_user($wp_user) { |
|
477 | + $this->set('EVT_wp_user', $wp_user); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | /** |
483 | 483 | * @param $default_registration_status |
484 | 484 | */ |
485 | - function set_default_registration_status( $default_registration_status ) { |
|
486 | - $this->set( 'EVT_default_registration_status', $default_registration_status ); |
|
485 | + function set_default_registration_status($default_registration_status) { |
|
486 | + $this->set('EVT_default_registration_status', $default_registration_status); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | /** |
492 | 492 | * @param $donations |
493 | 493 | */ |
494 | - function set_donations( $donations ) { |
|
495 | - $this->set( 'EVT_donations', $donations ); |
|
494 | + function set_donations($donations) { |
|
495 | + $this->set('EVT_donations', $donations); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | * @param EE_Venue /int $venue_id_or_obj |
503 | 503 | * @return EE_Venue |
504 | 504 | */ |
505 | - function add_venue( $venue_id_or_obj ) { |
|
506 | - return $this->_add_relation_to( $venue_id_or_obj, 'Venue' ); |
|
505 | + function add_venue($venue_id_or_obj) { |
|
506 | + return $this->_add_relation_to($venue_id_or_obj, 'Venue'); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | * @param EE_Venue /int $venue_id_or_obj |
514 | 514 | * @return EE_Venue |
515 | 515 | */ |
516 | - function remove_venue( $venue_id_or_obj ) { |
|
517 | - return $this->_remove_relation_to( $venue_id_or_obj, 'Venue' ); |
|
516 | + function remove_venue($venue_id_or_obj) { |
|
517 | + return $this->_remove_relation_to($venue_id_or_obj, 'Venue'); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | * @param array $query_params like EEM_Base::get_all's $query_params |
525 | 525 | * @return EE_Venue[] |
526 | 526 | */ |
527 | - function venues( $query_params = array() ) { |
|
528 | - return $this->get_many_related( 'Venue', $query_params ); |
|
527 | + function venues($query_params = array()) { |
|
528 | + return $this->get_many_related('Venue', $query_params); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | */ |
538 | 538 | private function _has_ID_and_is_published() { |
539 | 539 | // first check if event id is present and not NULL, then check if this event is published (or any of the equivalent "published" statuses) |
540 | - return ( $this->ID() && $this->ID() !== NULL && ( $this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled ) ) ? TRUE : FALSE; |
|
540 | + return ($this->ID() && $this->ID() !== NULL && ($this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled)) ? TRUE : FALSE; |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -549,21 +549,21 @@ discard block |
||
549 | 549 | */ |
550 | 550 | public function is_upcoming() { |
551 | 551 | // check if event id is present and if this event is published |
552 | - if ( $this->is_inactive() ) { |
|
552 | + if ($this->is_inactive()) { |
|
553 | 553 | return FALSE; |
554 | 554 | } |
555 | 555 | // set initial value |
556 | 556 | $upcoming = FALSE; |
557 | 557 | //next let's get all datetimes and loop through them |
558 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
559 | - foreach ( $datetimes as $datetime ) { |
|
560 | - if ( $datetime instanceof EE_Datetime ) { |
|
558 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
559 | + foreach ($datetimes as $datetime) { |
|
560 | + if ($datetime instanceof EE_Datetime) { |
|
561 | 561 | //if this dtt is expired then we continue cause one of the other datetimes might be upcoming. |
562 | - if ( $datetime->is_expired() ) { |
|
562 | + if ($datetime->is_expired()) { |
|
563 | 563 | continue; |
564 | 564 | } |
565 | 565 | //if this dtt is active then we return false. |
566 | - if ( $datetime->is_active() ) { |
|
566 | + if ($datetime->is_active()) { |
|
567 | 567 | return FALSE; |
568 | 568 | } |
569 | 569 | //otherwise let's check upcoming status |
@@ -580,21 +580,21 @@ discard block |
||
580 | 580 | */ |
581 | 581 | public function is_active() { |
582 | 582 | // check if event id is present and if this event is published |
583 | - if ( $this->is_inactive() ) { |
|
583 | + if ($this->is_inactive()) { |
|
584 | 584 | return FALSE; |
585 | 585 | } |
586 | 586 | // set initial value |
587 | 587 | $active = FALSE; |
588 | 588 | //next let's get all datetimes and loop through them |
589 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
590 | - foreach ( $datetimes as $datetime ) { |
|
591 | - if ( $datetime instanceof EE_Datetime ) { |
|
589 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
590 | + foreach ($datetimes as $datetime) { |
|
591 | + if ($datetime instanceof EE_Datetime) { |
|
592 | 592 | //if this dtt is expired then we continue cause one of the other datetimes might be active. |
593 | - if ( $datetime->is_expired() ) { |
|
593 | + if ($datetime->is_expired()) { |
|
594 | 594 | continue; |
595 | 595 | } |
596 | 596 | //if this dtt is upcoming then we return false. |
597 | - if ( $datetime->is_upcoming() ) { |
|
597 | + if ($datetime->is_upcoming()) { |
|
598 | 598 | return FALSE; |
599 | 599 | } |
600 | 600 | //otherwise let's check active status |
@@ -611,17 +611,17 @@ discard block |
||
611 | 611 | */ |
612 | 612 | public function is_expired() { |
613 | 613 | // check if event id is present and if this event is published |
614 | - if ( $this->is_inactive() ) { |
|
614 | + if ($this->is_inactive()) { |
|
615 | 615 | return FALSE; |
616 | 616 | } |
617 | 617 | // set initial value |
618 | 618 | $expired = FALSE; |
619 | 619 | //first let's get all datetimes and loop through them |
620 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
621 | - foreach ( $datetimes as $datetime ) { |
|
622 | - if ( $datetime instanceof EE_Datetime ) { |
|
620 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
621 | + foreach ($datetimes as $datetime) { |
|
622 | + if ($datetime instanceof EE_Datetime) { |
|
623 | 623 | //if this dtt is upcoming or active then we return false. |
624 | - if ( $datetime->is_upcoming() || $datetime->is_active() ) { |
|
624 | + if ($datetime->is_upcoming() || $datetime->is_active()) { |
|
625 | 625 | return FALSE; |
626 | 626 | } |
627 | 627 | //otherwise let's check active status |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | */ |
639 | 639 | public function is_inactive() { |
640 | 640 | // check if event id is present and if this event is published |
641 | - if ( $this->_has_ID_and_is_published() ) { |
|
641 | + if ($this->_has_ID_and_is_published()) { |
|
642 | 642 | return FALSE; |
643 | 643 | } |
644 | 644 | return TRUE; |
@@ -658,22 +658,22 @@ discard block |
||
658 | 658 | // set initial value |
659 | 659 | $spaces_remaining = 0; |
660 | 660 | //next let's get all datetimes and loop through them |
661 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
662 | - foreach ( $datetimes as $datetime ) { |
|
663 | - if ( $datetime instanceof EE_Datetime ) { |
|
664 | - $dtt_spaces_remaining = $datetime->spaces_remaining( TRUE ); |
|
661 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
662 | + foreach ($datetimes as $datetime) { |
|
663 | + if ($datetime instanceof EE_Datetime) { |
|
664 | + $dtt_spaces_remaining = $datetime->spaces_remaining(TRUE); |
|
665 | 665 | // if datetime has unlimited reg limit then the event can never be sold out |
666 | - if ( $dtt_spaces_remaining === INF ) { |
|
666 | + if ($dtt_spaces_remaining === INF) { |
|
667 | 667 | return FALSE; |
668 | 668 | } |
669 | 669 | else { |
670 | - $spaces_remaining = max( $dtt_spaces_remaining, $spaces_remaining ); |
|
670 | + $spaces_remaining = max($dtt_spaces_remaining, $spaces_remaining); |
|
671 | 671 | } |
672 | 672 | } |
673 | 673 | } |
674 | - if ( $spaces_remaining === 0 ) { |
|
675 | - $this->set_status( EEM_Event::sold_out ); |
|
676 | - if ( !is_admin() || ( is_admin() && defined( 'DOING_AJAX' ) ) ) { |
|
674 | + if ($spaces_remaining === 0) { |
|
675 | + $this->set_status(EEM_Event::sold_out); |
|
676 | + if ( ! is_admin() || (is_admin() && defined('DOING_AJAX'))) { |
|
677 | 677 | $this->save(); |
678 | 678 | } |
679 | 679 | $sold_out = TRUE; |
@@ -701,15 +701,15 @@ discard block |
||
701 | 701 | */ |
702 | 702 | public function spaces_remaining_for_sale() { |
703 | 703 | //first get total available spaces including consideration for tickets that have already sold. |
704 | - $spaces_available = $this->total_available_spaces( true ); |
|
704 | + $spaces_available = $this->total_available_spaces(true); |
|
705 | 705 | |
706 | 706 | //if total available = 0, then exit right away because that means everything is expired. |
707 | - if ( $spaces_available === 0 ) { |
|
707 | + if ($spaces_available === 0) { |
|
708 | 708 | return 0; |
709 | 709 | } |
710 | 710 | |
711 | 711 | //subtract total approved registrations from spaces available to get how many are remaining. |
712 | - $spots_taken = EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true ); |
|
712 | + $spots_taken = EEM_Registration::instance()->count(array(array('EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true); |
|
713 | 713 | $spaces_remaining = $spaces_available - $spots_taken; |
714 | 714 | |
715 | 715 | return $spaces_remaining > 0 ? $spaces_remaining : 0; |
@@ -742,53 +742,53 @@ discard block |
||
742 | 742 | * |
743 | 743 | * @return int|float (Note: if INF is returned its considered a float by PHP) |
744 | 744 | */ |
745 | - public function total_available_spaces( $current_total_available = false ) { |
|
745 | + public function total_available_spaces($current_total_available = false) { |
|
746 | 746 | $spaces_available = 0; |
747 | 747 | |
748 | 748 | //first get all tickets on the event and include expired tickets |
749 | - $tickets = $this->tickets( array( 'default_where_conditions' => 'none' ) ); |
|
749 | + $tickets = $this->tickets(array('default_where_conditions' => 'none')); |
|
750 | 750 | $ticket_sums = array(); |
751 | 751 | $datetime_limits = array(); |
752 | 752 | |
753 | 753 | //loop through tickets and normalize them |
754 | - foreach ( $tickets as $ticket ) { |
|
755 | - $datetimes = $ticket->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) ); |
|
754 | + foreach ($tickets as $ticket) { |
|
755 | + $datetimes = $ticket->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC'))); |
|
756 | 756 | |
757 | - if ( empty( $datetimes ) ) { |
|
757 | + if (empty($datetimes)) { |
|
758 | 758 | continue; |
759 | 759 | } |
760 | 760 | |
761 | 761 | //first datetime should be the lowest datetime |
762 | - $least_datetime = reset( $datetimes ); |
|
762 | + $least_datetime = reset($datetimes); |
|
763 | 763 | |
764 | 764 | //lets reset the ticket quantity to be the lower of either the lowest datetime reg limit or the ticket quantity |
765 | 765 | //IF datetimes sold (and we're not doing current live total available, then use spaces remaining for datetime, not reg_limit. |
766 | - if ( $current_total_available ) { |
|
767 | - if ( $ticket->is_remaining() ) { |
|
766 | + if ($current_total_available) { |
|
767 | + if ($ticket->is_remaining()) { |
|
768 | 768 | $remaining = $ticket->remaining(); |
769 | 769 | } else { |
770 | - $spaces_available += $ticket->get( 'TKT_sold' ); |
|
770 | + $spaces_available += $ticket->get('TKT_sold'); |
|
771 | 771 | //and we don't cache this ticket to our list because its sold out. |
772 | 772 | continue; |
773 | 773 | } |
774 | 774 | } else { |
775 | - $remaining = min( $ticket->qty(), $least_datetime->reg_limit() ); |
|
775 | + $remaining = min($ticket->qty(), $least_datetime->reg_limit()); |
|
776 | 776 | } |
777 | 777 | |
778 | 778 | //if $ticket_limit == infinity then let's drop out right away and just return that because any infinity amount trumps all other "available" amounts. |
779 | - if ( $remaining == INF ) { |
|
779 | + if ($remaining == INF) { |
|
780 | 780 | return INF; |
781 | 781 | } |
782 | 782 | |
783 | 783 | //multiply normalized $tkt quantity by the number of datetimes on the ticket as the "sum" |
784 | 784 | //also include the sum of all the datetime reg limits on the ticket for breaking ties. |
785 | - $ticket_sums[$ticket->ID()]['sum'] = $remaining * count( $datetimes ); |
|
785 | + $ticket_sums[$ticket->ID()]['sum'] = $remaining * count($datetimes); |
|
786 | 786 | $ticket_sums[$ticket->ID()]['datetime_sums'] = 0; |
787 | - foreach ( $datetimes as $datetime ) { |
|
788 | - if ( $datetime->reg_limit() === INF ) { |
|
787 | + foreach ($datetimes as $datetime) { |
|
788 | + if ($datetime->reg_limit() === INF) { |
|
789 | 789 | $ticket_sums[$ticket->ID()]['datetime_sums'] = INF; |
790 | 790 | } else { |
791 | - $ticket_sums[ $ticket->ID() ]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
|
791 | + $ticket_sums[$ticket->ID()]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
|
792 | 792 | } |
793 | 793 | $datetime_limits[$datetime->ID()] = $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
794 | 794 | } |
@@ -799,66 +799,66 @@ discard block |
||
799 | 799 | //ticket quantity by the number of datetimes on the ticket). For tie-breakers, then the next sort is based on the |
800 | 800 | //ticket with the greatest sum of all remaining datetime->spaces_remaining() ( or $datetime->reg_limit() if not |
801 | 801 | //$current_total_available ) for the datetimes on the ticket. |
802 | - usort( $ticket_sums, function( $a, $b ) { |
|
803 | - if ( $a['sum'] == $b['sum'] ) { |
|
804 | - if ( $a['datetime_sums'] == $b['datetime_sums'] ) { |
|
802 | + usort($ticket_sums, function($a, $b) { |
|
803 | + if ($a['sum'] == $b['sum']) { |
|
804 | + if ($a['datetime_sums'] == $b['datetime_sums']) { |
|
805 | 805 | return 0; |
806 | 806 | } |
807 | 807 | |
808 | 808 | return $a['datetime_sums'] < $b['datetime_sums'] ? 1 : -1; |
809 | 809 | } |
810 | - return ( $a['sum'] < $b['sum'] ) ? -1 : 1; |
|
810 | + return ($a['sum'] < $b['sum']) ? -1 : 1; |
|
811 | 811 | }); |
812 | 812 | |
813 | 813 | //now let's loop through the sorted tickets and simulate sellouts |
814 | - foreach ( $ticket_sums as $ticket_info ) { |
|
815 | - $datetimes = $ticket_info['ticket']->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) ); |
|
814 | + foreach ($ticket_sums as $ticket_info) { |
|
815 | + $datetimes = $ticket_info['ticket']->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC'))); |
|
816 | 816 | //need to sort these $datetimes by remaining (only if $current_total_available) |
817 | 817 | //setup datetimes for simulation |
818 | 818 | $ticket_datetimes_remaining = array(); |
819 | - foreach( $datetimes as $datetime ) { |
|
819 | + foreach ($datetimes as $datetime) { |
|
820 | 820 | $ticket_datetimes_remaining[$datetime->ID()]['rem'] = $datetime_limits[$datetime->ID()]; |
821 | 821 | $ticket_datetimes_remaining[$datetime->ID()]['datetime'] = $datetime; |
822 | 822 | } |
823 | - usort( $ticket_datetimes_remaining, function( $a, $b ) { |
|
824 | - if ( $a['rem'] == $b['rem'] ) { |
|
823 | + usort($ticket_datetimes_remaining, function($a, $b) { |
|
824 | + if ($a['rem'] == $b['rem']) { |
|
825 | 825 | return 0; |
826 | 826 | } |
827 | - return ( $a['rem'] < $b['rem'] ) ? -1 : 1; |
|
827 | + return ($a['rem'] < $b['rem']) ? -1 : 1; |
|
828 | 828 | }); |
829 | 829 | |
830 | 830 | |
831 | 831 | //get the remaining on the first datetime (which should be the one with the least remaining) and that is |
832 | 832 | //what we add to the spaces_available running total. Then we need to decrease the remaining on our datetime tracker. |
833 | - $lowest_datetime = reset( $ticket_datetimes_remaining ); |
|
833 | + $lowest_datetime = reset($ticket_datetimes_remaining); |
|
834 | 834 | |
835 | 835 | //need to get the lower of; what the remaining is on the lowest datetime, and the remaining on the ticket. |
836 | 836 | // If this ends up being 0 (because of previous tickets in our simulation selling out), then it has already |
837 | 837 | // been tracked on $spaces available and this ticket is now sold out for the simulation, so we can continue |
838 | 838 | // to the next ticket. |
839 | - $remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->remaining() ); |
|
839 | + $remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->remaining()); |
|
840 | 840 | |
841 | 841 | //if $remaining is infinite that means that all datetimes on this ticket are infinite but we've made it here because all |
842 | 842 | //tickets have a quantity. So we don't have to track datetimes, we can just use ticket quantities for total |
843 | 843 | //available. |
844 | - if ( $remaining === INF ) { |
|
844 | + if ($remaining === INF) { |
|
845 | 845 | $spaces_available += $ticket_info['ticket']->qty(); |
846 | 846 | continue; |
847 | 847 | } |
848 | 848 | |
849 | 849 | //if ticket has sold amounts then we also need to add that (but only if doing live counts) |
850 | - if ( $current_total_available ) { |
|
850 | + if ($current_total_available) { |
|
851 | 851 | $spaces_available += $ticket_info['ticket']->sold(); |
852 | 852 | } |
853 | 853 | |
854 | - if ( $remaining <= 0 ) { |
|
854 | + if ($remaining <= 0) { |
|
855 | 855 | continue; |
856 | 856 | } else { |
857 | 857 | $spaces_available += $remaining; |
858 | 858 | } |
859 | 859 | |
860 | 860 | //loop through the datetimes and sell them out! |
861 | - foreach ( $ticket_datetimes_remaining as $datetime_info ) { |
|
861 | + foreach ($ticket_datetimes_remaining as $datetime_info) { |
|
862 | 862 | $datetime_limits[$datetime_info['datetime']->ID()] += - $remaining; |
863 | 863 | } |
864 | 864 | } |
@@ -873,8 +873,8 @@ discard block |
||
873 | 873 | * @param bool $actual whether or not to perform calculations to not only figure the actual status but also to flip the status if necessary to sold out If false, we just check the existing status of the event |
874 | 874 | * @return boolean |
875 | 875 | */ |
876 | - public function is_sold_out( $actual = FALSE ) { |
|
877 | - if ( !$actual ) { |
|
876 | + public function is_sold_out($actual = FALSE) { |
|
877 | + if ( ! $actual) { |
|
878 | 878 | return $this->status() == EEM_Event::sold_out; |
879 | 879 | } |
880 | 880 | else { |
@@ -912,36 +912,36 @@ discard block |
||
912 | 912 | * @param bool $reset |
913 | 913 | * @return bool | string - based on EE_Datetime active constants or FALSE if error. |
914 | 914 | */ |
915 | - public function get_active_status( $reset = FALSE ) { |
|
915 | + public function get_active_status($reset = FALSE) { |
|
916 | 916 | // if the active status has already been set, then just use that value (unless we are resetting it) |
917 | - if ( ! empty( $this->_active_status ) && ! $reset ) { |
|
917 | + if ( ! empty($this->_active_status) && ! $reset) { |
|
918 | 918 | return $this->_active_status; |
919 | 919 | } |
920 | 920 | //first check if event id is present on this object |
921 | - if ( ! $this->ID() ) { |
|
921 | + if ( ! $this->ID()) { |
|
922 | 922 | return FALSE; |
923 | 923 | } |
924 | 924 | //first get all datetimes ordered by date |
925 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
925 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
926 | 926 | //next loop through $datetimes and setup status array |
927 | 927 | $status_array = array(); |
928 | - foreach ( $datetimes as $datetime ) { |
|
929 | - if ( $datetime instanceof EE_Datetime ) { |
|
928 | + foreach ($datetimes as $datetime) { |
|
929 | + if ($datetime instanceof EE_Datetime) { |
|
930 | 930 | $status_array[] = $datetime->get_active_status(); |
931 | 931 | } |
932 | 932 | } |
933 | 933 | //now we can conditionally determine status |
934 | - if ( $this->status() == 'publish' ) { |
|
935 | - if ( in_array( EE_Datetime::active, $status_array ) ) { |
|
934 | + if ($this->status() == 'publish') { |
|
935 | + if (in_array(EE_Datetime::active, $status_array)) { |
|
936 | 936 | $this->_active_status = EE_Datetime::active; |
937 | 937 | } else { |
938 | - if ( in_array( EE_Datetime::upcoming, $status_array ) ) { |
|
938 | + if (in_array(EE_Datetime::upcoming, $status_array)) { |
|
939 | 939 | $this->_active_status = EE_Datetime::upcoming; |
940 | 940 | } else { |
941 | - if ( in_array( EE_Datetime::expired, $status_array ) ) { |
|
941 | + if (in_array(EE_Datetime::expired, $status_array)) { |
|
942 | 942 | $this->_active_status = EE_Datetime::expired; |
943 | 943 | } else { |
944 | - if ( in_array( EE_Datetime::sold_out, $status_array ) ) { |
|
944 | + if (in_array(EE_Datetime::sold_out, $status_array)) { |
|
945 | 945 | $this->_active_status = EE_Datetime::sold_out; |
946 | 946 | } else { |
947 | 947 | $this->_active_status = EE_Datetime::expired; //catchall |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | } |
951 | 951 | } |
952 | 952 | } else { |
953 | - switch ( $this->status() ) { |
|
953 | + switch ($this->status()) { |
|
954 | 954 | case EEM_Event::sold_out : |
955 | 955 | $this->_active_status = EE_Datetime::sold_out; |
956 | 956 | break; |
@@ -976,10 +976,10 @@ discard block |
||
976 | 976 | * @param boolean $echo whether to return (FALSE), or echo out the result (TRUE) |
977 | 977 | * @return mixed void|string |
978 | 978 | */ |
979 | - public function pretty_active_status( $echo = TRUE ) { |
|
979 | + public function pretty_active_status($echo = TRUE) { |
|
980 | 980 | $active_status = $this->get_active_status(); |
981 | - $status = '<span class="ee-status event-active-status-' . $active_status . '">' . EEH_Template::pretty_status( $active_status, FALSE, 'sentence' ) . '</span>'; |
|
982 | - if ( $echo ) { |
|
981 | + $status = '<span class="ee-status event-active-status-'.$active_status.'">'.EEH_Template::pretty_status($active_status, FALSE, 'sentence').'</span>'; |
|
982 | + if ($echo) { |
|
983 | 983 | echo $status; |
984 | 984 | } else { |
985 | 985 | return $status; |
@@ -993,12 +993,12 @@ discard block |
||
993 | 993 | */ |
994 | 994 | public function get_number_of_tickets_sold() { |
995 | 995 | $tkt_sold = 0; |
996 | - if ( !$this->ID() ) { |
|
996 | + if ( ! $this->ID()) { |
|
997 | 997 | return 0; |
998 | 998 | } |
999 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
1000 | - foreach ( $datetimes as $datetime ) { |
|
1001 | - $tkt_sold += $datetime->get( 'DTT_sold' ); |
|
999 | + $datetimes = $this->get_many_related('Datetime'); |
|
1000 | + foreach ($datetimes as $datetime) { |
|
1001 | + $tkt_sold += $datetime->get('DTT_sold'); |
|
1002 | 1002 | } |
1003 | 1003 | return $tkt_sold; |
1004 | 1004 | } |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | * @return int |
1012 | 1012 | */ |
1013 | 1013 | public function get_count_of_all_registrations() { |
1014 | - return EEM_Event::instance()->count_related( $this, 'Registration' ); |
|
1014 | + return EEM_Event::instance()->count_related($this, 'Registration'); |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | |
@@ -1021,9 +1021,9 @@ discard block |
||
1021 | 1021 | * @return EE_Ticket |
1022 | 1022 | */ |
1023 | 1023 | public function get_ticket_with_earliest_start_time() { |
1024 | - $where[ 'Datetime.EVT_ID' ] = $this->ID(); |
|
1025 | - $query_params = array( $where, 'order_by' => array( 'TKT_start_date' => 'ASC' ) ); |
|
1026 | - return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params ); |
|
1024 | + $where['Datetime.EVT_ID'] = $this->ID(); |
|
1025 | + $query_params = array($where, 'order_by' => array('TKT_start_date' => 'ASC')); |
|
1026 | + return EE_Registry::instance()->load_model('Ticket')->get_one($query_params); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | |
@@ -1033,9 +1033,9 @@ discard block |
||
1033 | 1033 | * @return EE_Ticket |
1034 | 1034 | */ |
1035 | 1035 | public function get_ticket_with_latest_end_time() { |
1036 | - $where[ 'Datetime.EVT_ID' ] = $this->ID(); |
|
1037 | - $query_params = array( $where, 'order_by' => array( 'TKT_end_date' => 'DESC' ) ); |
|
1038 | - return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params ); |
|
1036 | + $where['Datetime.EVT_ID'] = $this->ID(); |
|
1037 | + $query_params = array($where, 'order_by' => array('TKT_end_date' => 'DESC')); |
|
1038 | + return EE_Registry::instance()->load_model('Ticket')->get_one($query_params); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | |
@@ -1047,11 +1047,11 @@ discard block |
||
1047 | 1047 | public function tickets_on_sale() { |
1048 | 1048 | $earliest_ticket = $this->get_ticket_with_earliest_start_time(); |
1049 | 1049 | $latest_ticket = $this->get_ticket_with_latest_end_time(); |
1050 | - if ( !$latest_ticket instanceof EE_Ticket && !$earliest_ticket instanceof EE_Ticket ) { |
|
1050 | + if ( ! $latest_ticket instanceof EE_Ticket && ! $earliest_ticket instanceof EE_Ticket) { |
|
1051 | 1051 | return FALSE; |
1052 | 1052 | } |
1053 | 1053 | //check on sale for these two tickets. |
1054 | - if ( $latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale() ) { |
|
1054 | + if ($latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale()) { |
|
1055 | 1055 | return TRUE; |
1056 | 1056 | } |
1057 | 1057 | return FALSE; |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | * @return string |
1066 | 1066 | */ |
1067 | 1067 | public function get_permalink() { |
1068 | - if ( $this->external_url() ) { |
|
1068 | + if ($this->external_url()) { |
|
1069 | 1069 | return $this->external_url(); |
1070 | 1070 | } |
1071 | 1071 | else { |
@@ -1080,10 +1080,10 @@ discard block |
||
1080 | 1080 | * @param array $query_params like EEM_Base::get_all |
1081 | 1081 | * @return EE_Term |
1082 | 1082 | */ |
1083 | - public function first_event_category( $query_params = array() ) { |
|
1084 | - $query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories'; |
|
1085 | - $query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID(); |
|
1086 | - return EEM_Term::instance()->get_one( $query_params ); |
|
1083 | + public function first_event_category($query_params = array()) { |
|
1084 | + $query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
1085 | + $query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID(); |
|
1086 | + return EEM_Term::instance()->get_one($query_params); |
|
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | |
@@ -1093,10 +1093,10 @@ discard block |
||
1093 | 1093 | * @param array $query_params |
1094 | 1094 | * @return EE_Term[] |
1095 | 1095 | */ |
1096 | - public function get_all_event_categories( $query_params = array() ) { |
|
1097 | - $query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories'; |
|
1098 | - $query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID(); |
|
1099 | - return EEM_Term::instance()->get_all( $query_params ); |
|
1096 | + public function get_all_event_categories($query_params = array()) { |
|
1097 | + $query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
1098 | + $query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID(); |
|
1099 | + return EEM_Term::instance()->get_all($query_params); |
|
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | /** |
@@ -1104,8 +1104,8 @@ discard block |
||
1104 | 1104 | * @param array $query_params @see EEM_Base::get_all |
1105 | 1105 | * @return EE_Question_Group[] |
1106 | 1106 | */ |
1107 | - public function question_groups($query_params = array()){ |
|
1108 | - $query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'QSG_order' => 'ASC' )); |
|
1107 | + public function question_groups($query_params = array()) { |
|
1108 | + $query_params = ! empty($query_params) ? $query_params : array('order_by' => array('QSG_order' => 'ASC')); |
|
1109 | 1109 | return $this->get_many_related('Question_Group', $query_params); |
1110 | 1110 | } |
1111 | 1111 | |
@@ -1145,12 +1145,12 @@ discard block |
||
1145 | 1145 | */ |
1146 | 1146 | public function get_admin_edit_link() { |
1147 | 1147 | EE_Registry::instance()->load_helper('URL'); |
1148 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1148 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1149 | 1149 | 'page' => 'espresso_events', |
1150 | 1150 | 'action' => 'edit', |
1151 | 1151 | 'post' => $this->ID() |
1152 | 1152 | ), |
1153 | - admin_url( 'admin.php' ) |
|
1153 | + admin_url('admin.php') |
|
1154 | 1154 | ); |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1163,11 +1163,11 @@ discard block |
||
1163 | 1163 | */ |
1164 | 1164 | public function get_admin_settings_link() { |
1165 | 1165 | EE_Registry::instance()->load_helper('URL'); |
1166 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1166 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1167 | 1167 | 'page' => 'espresso_events', |
1168 | 1168 | 'action' => 'default_event_settings' |
1169 | 1169 | ), |
1170 | - admin_url( 'admin.php' ) |
|
1170 | + admin_url('admin.php') |
|
1171 | 1171 | ); |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1183,11 +1183,11 @@ discard block |
||
1183 | 1183 | public function get_admin_overview_link() { |
1184 | 1184 | |
1185 | 1185 | EE_Registry::instance()->load_helper('URL'); |
1186 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1186 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1187 | 1187 | 'page' => 'espresso_events', |
1188 | 1188 | 'action' => 'default' |
1189 | 1189 | ), |
1190 | - admin_url( 'admin.php' ) |
|
1190 | + admin_url('admin.php') |
|
1191 | 1191 | ); |
1192 | 1192 | } |
1193 | 1193 |
@@ -281,8 +281,7 @@ discard block |
||
281 | 281 | $short_desc = $this->get( 'EVT_short_desc' ); |
282 | 282 | if ( !empty( $short_desc ) || $not_full_desc ) { |
283 | 283 | return $short_desc; |
284 | - } |
|
285 | - else { |
|
284 | + } else { |
|
286 | 285 | $full_desc = $this->get( 'EVT_desc' ); |
287 | 286 | return wp_trim_words( $full_desc, $num_words, $more ); |
288 | 287 | } |
@@ -665,8 +664,7 @@ discard block |
||
665 | 664 | // if datetime has unlimited reg limit then the event can never be sold out |
666 | 665 | if ( $dtt_spaces_remaining === INF ) { |
667 | 666 | return FALSE; |
668 | - } |
|
669 | - else { |
|
667 | + } else { |
|
670 | 668 | $spaces_remaining = max( $dtt_spaces_remaining, $spaces_remaining ); |
671 | 669 | } |
672 | 670 | } |
@@ -677,8 +675,7 @@ discard block |
||
677 | 675 | $this->save(); |
678 | 676 | } |
679 | 677 | $sold_out = TRUE; |
680 | - } |
|
681 | - else { |
|
678 | + } else { |
|
682 | 679 | $sold_out = FALSE; |
683 | 680 | } |
684 | 681 | //note: I considered changing the EEM_Event status away from sold_out if this status check reveals that it's no longer sold out (yet the status is still set as sold out) but the problem is... what do we change the status BACK to? We can't always assume that the previous event status was 'published' because this status check is always done in the admin and its entirely possible the event admin manually changes to sold_out status from some other status. We also don't want a draft event to become a "publish event" because the sold out check reveals its NOT sold out. |
@@ -876,8 +873,7 @@ discard block |
||
876 | 873 | public function is_sold_out( $actual = FALSE ) { |
877 | 874 | if ( !$actual ) { |
878 | 875 | return $this->status() == EEM_Event::sold_out; |
879 | - } |
|
880 | - else { |
|
876 | + } else { |
|
881 | 877 | return $this->perform_sold_out_status_check(); |
882 | 878 | } |
883 | 879 | } |
@@ -1067,8 +1063,7 @@ discard block |
||
1067 | 1063 | public function get_permalink() { |
1068 | 1064 | if ( $this->external_url() ) { |
1069 | 1065 | return $this->external_url(); |
1070 | - } |
|
1071 | - else { |
|
1066 | + } else { |
|
1072 | 1067 | return parent::get_permalink(); |
1073 | 1068 | } |
1074 | 1069 | } |
@@ -2,18 +2,18 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Event Espresso |
|
6 | - * |
|
7 | - * Event Registration and Management Plugin for WordPress |
|
8 | - * |
|
9 | - * @ package Event Espresso |
|
10 | - * @ author Event Espresso |
|
11 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | - * @ link {@link http://www.eventespresso.com} |
|
14 | - * @ since 4.0 |
|
15 | - * |
|
16 | - */ |
|
5 | + * Event Espresso |
|
6 | + * |
|
7 | + * Event Registration and Management Plugin for WordPress |
|
8 | + * |
|
9 | + * @ package Event Espresso |
|
10 | + * @ author Event Espresso |
|
11 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | + * @ link {@link http://www.eventespresso.com} |
|
14 | + * @ since 4.0 |
|
15 | + * |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | |
19 | 19 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param array $props_n_values incoming values from the database |
62 | 62 | * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
63 | 63 | * the website will be used. |
64 | - * @return EE_Attendee |
|
64 | + * @return EE_Event |
|
65 | 65 | */ |
66 | 66 | public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
67 | 67 | return new self( $props_n_values, TRUE, $timezone ); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | |
319 | 319 | |
320 | 320 | /** |
321 | - * @return int |
|
321 | + * @return boolean |
|
322 | 322 | */ |
323 | 323 | function wp_user() { |
324 | 324 | return $this->get( 'EVT_wp_user' ); |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * |
975 | 975 | * @access public |
976 | 976 | * @param boolean $echo whether to return (FALSE), or echo out the result (TRUE) |
977 | - * @return mixed void|string |
|
977 | + * @return null|string void|string |
|
978 | 978 | */ |
979 | 979 | public function pretty_active_status( $echo = TRUE ) { |
980 | 980 | $active_status = $this->get_active_status(); |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | /** |
1142 | 1142 | * Implementation for EEI_Admin_Links interface method. |
1143 | 1143 | * @see EEI_Admin_Links for comments |
1144 | - * @return return string |
|
1144 | + * @return string string |
|
1145 | 1145 | */ |
1146 | 1146 | public function get_admin_edit_link() { |
1147 | 1147 | EE_Registry::instance()->load_helper('URL'); |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param null $timezone |
23 | 23 | * @return EE_Event_Message_Template|mixed |
24 | 24 | */ |
25 | - public static function new_instance( $props_n_values = array(), $timezone = NULL ) { |
|
26 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
27 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
25 | + public static function new_instance($props_n_values = array(), $timezone = NULL) { |
|
26 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
27 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @param null $timezone |
35 | 35 | * @return EE_Event_Message_Template |
36 | 36 | */ |
37 | - public static function new_instance_from_db ( $props_n_values = array(), $timezone = NULL ) { |
|
38 | - return new self( $props_n_values, TRUE, $timezone ); |
|
37 | + public static function new_instance_from_db($props_n_values = array(), $timezone = NULL) { |
|
38 | + return new self($props_n_values, TRUE, $timezone); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Contains definition for EE_Event_Message_Template model object |
|
4 | - * @package Event Espresso |
|
5 | - * @subpackage models |
|
6 | - * @since 4.3.0 |
|
7 | - */ |
|
3 | + * Contains definition for EE_Event_Message_Template model object |
|
4 | + * @package Event Espresso |
|
5 | + * @subpackage models |
|
6 | + * @since 4.3.0 |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * EE_Event_Message_Template |
@@ -1,18 +1,18 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Required by EEM_Event_Question_Group in case someone queries for all its model objects |
6 | 6 | */ |
7 | -class EE_Event_Question_Group extends EE_Base_Class{ |
|
7 | +class EE_Event_Question_Group extends EE_Base_Class { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @param array $props_n_values |
11 | 11 | * @return EE_Event_Question_Group|mixed |
12 | 12 | */ |
13 | - public static function new_instance( $props_n_values = array() ) { |
|
14 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
15 | - return $has_object ? $has_object : new self( $props_n_values); |
|
13 | + public static function new_instance($props_n_values = array()) { |
|
14 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
15 | + return $has_object ? $has_object : new self($props_n_values); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param array $props_n_values |
22 | 22 | * @return EE_Event_Question_Group |
23 | 23 | */ |
24 | - public static function new_instance_from_db ( $props_n_values = array() ) { |
|
25 | - return new self( $props_n_values, TRUE ); |
|
24 | + public static function new_instance_from_db($props_n_values = array()) { |
|
25 | + return new self($props_n_values, TRUE); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Required by EEM_Event_Question_Group in case someone queries for all its model objects |
|
4 | - */ |
|
3 | + * Required by EEM_Event_Question_Group in case someone queries for all its model objects |
|
4 | + */ |
|
5 | 5 | class EE_Event_Venue extends EE_Base_Class{ |
6 | 6 | |
7 | 7 | /** |