@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * really, you're best off copying the whole thing when 4.1 is released into this file |
18 | 18 | * and wrapping its declaration in if( ! class_exists()){...} |
19 | 19 | */ |
20 | -class EE_DMS_Core_4_1_0 extends EE_Data_Migration_Script_Base{ |
|
20 | +class EE_DMS_Core_4_1_0 extends EE_Data_Migration_Script_Base { |
|
21 | 21 | |
22 | 22 | |
23 | 23 | |
@@ -59,26 +59,26 @@ discard block |
||
59 | 59 | * @global type $wpdb |
60 | 60 | * @return boolean |
61 | 61 | */ |
62 | - private function _checkin_table_exists(){ |
|
62 | + private function _checkin_table_exists() { |
|
63 | 63 | global $wpdb; |
64 | 64 | $results = $wpdb->get_results("SHOW TABLES LIKE '".$wpdb->prefix."events_attendee_checkin"."'"); |
65 | - if($results){ |
|
65 | + if ($results) { |
|
66 | 66 | return true; |
67 | - }else{ |
|
67 | + } else { |
|
68 | 68 | return false; |
69 | 69 | } |
70 | 70 | } |
71 | 71 | public function can_migrate_from_version($version_array) { |
72 | 72 | $version_string = $version_array['Core']; |
73 | - if($version_string < '4.0.0' && $version_string > '3.1.26' ){ |
|
73 | + if ($version_string < '4.0.0' && $version_string > '3.1.26') { |
|
74 | 74 | // echo "$version_string can be migrated fro"; |
75 | 75 | return true; |
76 | - }elseif( ! $version_string ){ |
|
76 | + }elseif ( ! $version_string) { |
|
77 | 77 | // echo "no version string provided: $version_string"; |
78 | 78 | //no version string provided... this must be pre 4.1 |
79 | 79 | //because since 4.1 we're |
80 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
81 | - }else{ |
|
80 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
81 | + } else { |
|
82 | 82 | // echo "$version_string doesnt apply"; |
83 | 83 | return false; |
84 | 84 | } |
@@ -88,15 +88,15 @@ discard block |
||
88 | 88 | } |
89 | 89 | public function schema_changes_before_migration() { |
90 | 90 | //relies on 4.1's EEH_Activation::create_table |
91 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
91 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
92 | 92 | |
93 | - $table_name='esp_answer'; |
|
94 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
93 | + $table_name = 'esp_answer'; |
|
94 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
95 | 95 | REG_ID INT UNSIGNED NOT NULL, |
96 | 96 | QST_ID INT UNSIGNED NOT NULL, |
97 | 97 | ANS_value TEXT NOT NULL, |
98 | 98 | PRIMARY KEY (ANS_ID)"; |
99 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
99 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
100 | 100 | |
101 | 101 | $table_name = 'esp_attendee_meta'; |
102 | 102 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | CNT_is_EU TINYINT(1) DEFAULT '0', |
137 | 137 | CNT_active TINYINT(1) DEFAULT '0', |
138 | 138 | PRIMARY KEY (CNT_ISO)"; |
139 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
139 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
140 | 140 | |
141 | 141 | |
142 | 142 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | |
159 | 159 | |
160 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
160 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
161 | 161 | $table_name = 'esp_event_meta'; |
162 | 162 | $sql = " |
163 | 163 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
@@ -174,41 +174,41 @@ discard block |
||
174 | 174 | EVT_external_URL VARCHAR(200) NULL, |
175 | 175 | EVT_donations TINYINT(1) NULL, |
176 | 176 | PRIMARY KEY (EVTM_ID)"; |
177 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
177 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
178 | 178 | |
179 | 179 | |
180 | 180 | |
181 | - $table_name='esp_event_question_group'; |
|
182 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
181 | + $table_name = 'esp_event_question_group'; |
|
182 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
183 | 183 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
184 | 184 | QSG_ID INT UNSIGNED NOT NULL, |
185 | 185 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
186 | 186 | PRIMARY KEY (EQG_ID)"; |
187 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
187 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
188 | 188 | |
189 | 189 | |
190 | 190 | |
191 | - $table_name='esp_event_venue'; |
|
192 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
191 | + $table_name = 'esp_event_venue'; |
|
192 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
193 | 193 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
194 | 194 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
195 | 195 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
196 | 196 | PRIMARY KEY (EVV_ID)"; |
197 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
197 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | 198 | |
199 | 199 | |
200 | 200 | |
201 | - $table_name='esp_extra_meta'; |
|
202 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
201 | + $table_name = 'esp_extra_meta'; |
|
202 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
203 | 203 | OBJ_ID INT(11) DEFAULT NULL, |
204 | 204 | EXM_type VARCHAR(45) DEFAULT NULL, |
205 | 205 | EXM_key VARCHAR(45) DEFAULT NULL, |
206 | 206 | EXM_value TEXT, |
207 | 207 | PRIMARY KEY (EXM_ID)"; |
208 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
208 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
209 | 209 | |
210 | - $table_name='esp_line_item'; |
|
211 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
210 | + $table_name = 'esp_line_item'; |
|
211 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
212 | 212 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
213 | 213 | TXN_ID INT(11) DEFAULT NULL, |
214 | 214 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | OBJ_ID INT(11) DEFAULT NULL, |
225 | 225 | OBJ_type VARCHAR(45)DEFAULT NULL, |
226 | 226 | PRIMARY KEY (LIN_ID)"; |
227 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
227 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
228 | 228 | |
229 | 229 | $table_name = 'esp_message_template'; |
230 | 230 | $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | PRIMARY KEY (GRP_ID), |
252 | 252 | KEY EVT_ID (EVT_ID), |
253 | 253 | KEY MTP_user_id (MTP_user_id)"; |
254 | - $this->_table_is_new_in_this_version( $table_name, $sql, 'ENGINE=InnoDB'); |
|
254 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
255 | 255 | |
256 | 256 | |
257 | 257 | |
@@ -359,8 +359,8 @@ discard block |
||
359 | 359 | |
360 | 360 | |
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,12 +372,12 @@ 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_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
375 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
376 | 376 | |
377 | - EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' ); |
|
377 | + EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
378 | 378 | |
379 | 379 | $table_name = 'esp_question_group'; |
380 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
380 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
381 | 381 | QSG_name VARCHAR(255) NOT NULL, |
382 | 382 | QSG_identifier VARCHAR(100) NOT NULL, |
383 | 383 | QSG_desc TEXT NULL, |
@@ -388,27 +388,27 @@ discard block |
||
388 | 388 | QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
389 | 389 | PRIMARY KEY (QSG_ID), |
390 | 390 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
391 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
391 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
392 | 392 | |
393 | 393 | |
394 | 394 | |
395 | - $table_name='esp_question_group_question'; |
|
396 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
395 | + $table_name = 'esp_question_group_question'; |
|
396 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
397 | 397 | QSG_ID INT UNSIGNED NOT NULL, |
398 | 398 | QST_ID INT UNSIGNED NOT NULL, |
399 | 399 | PRIMARY KEY (QGQ_ID) "; |
400 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
400 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
401 | 401 | |
402 | 402 | |
403 | 403 | |
404 | - $table_name='esp_question_option'; |
|
405 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
404 | + $table_name = 'esp_question_option'; |
|
405 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
406 | 406 | QSO_value VARCHAR(255) NOT NULL, |
407 | 407 | QSO_desc TEXT NOT NULL, |
408 | 408 | QST_ID INT UNSIGNED NOT NULL, |
409 | 409 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
410 | 410 | PRIMARY KEY (QSO_ID)"; |
411 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
411 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
412 | 412 | |
413 | 413 | |
414 | 414 | |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | |
442 | 442 | |
443 | 443 | |
444 | - $table_name='esp_checkin'; |
|
445 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
444 | + $table_name = 'esp_checkin'; |
|
445 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
446 | 446 | REG_ID INT(10) UNSIGNED NOT NULL, |
447 | 447 | DTT_ID INT(10) UNSIGNED NOT NULL, |
448 | 448 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -549,12 +549,12 @@ discard block |
||
549 | 549 | |
550 | 550 | global $wpdb; |
551 | 551 | $state_table = $wpdb->prefix."esp_state"; |
552 | - if ( EEH_Activation::table_exists( $state_table ) ) { |
|
552 | + if (EEH_Activation::table_exists($state_table)) { |
|
553 | 553 | |
554 | - $SQL = "SELECT COUNT('STA_ID') FROM " . $state_table; |
|
554 | + $SQL = "SELECT COUNT('STA_ID') FROM ".$state_table; |
|
555 | 555 | $states = $wpdb->get_var($SQL); |
556 | - if ( ! $states ) { |
|
557 | - $SQL = "INSERT INTO " . $state_table . " |
|
556 | + if ( ! $states) { |
|
557 | + $SQL = "INSERT INTO ".$state_table." |
|
558 | 558 | (STA_ID, CNT_ISO, STA_abbrev, STA_name, STA_active) VALUES |
559 | 559 | (1, 'US', 'AK', 'Alaska', 1), |
560 | 560 | (2, 'US', 'AL', 'Alabama', 1), |
@@ -641,12 +641,12 @@ discard block |
||
641 | 641 | |
642 | 642 | global $wpdb; |
643 | 643 | $country_table = $wpdb->prefix."esp_country"; |
644 | - if ( EEH_Activation::table_exists( $country_table ) ) { |
|
644 | + if (EEH_Activation::table_exists($country_table)) { |
|
645 | 645 | |
646 | - $SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table; |
|
646 | + $SQL = "SELECT COUNT('CNT_ISO') FROM ".$country_table; |
|
647 | 647 | $countries = $wpdb->get_var($SQL); |
648 | - if ( ! $countries ) { |
|
649 | - $SQL = "INSERT INTO " . $country_table . " |
|
648 | + if ( ! $countries) { |
|
649 | + $SQL = "INSERT INTO ".$country_table." |
|
650 | 650 | (CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active) VALUES |
651 | 651 | ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
652 | 652 | ('AE', 'ARE', 0, 'United Arab Emirates', 'AED', 'Dirham', 'Dirhams', 'د.إ', 1, 2, '+971', 0, 0), |
@@ -893,20 +893,20 @@ discard block |
||
893 | 893 | global $wpdb; |
894 | 894 | $price_type_table = $wpdb->prefix."esp_price_type"; |
895 | 895 | |
896 | - if ( EEH_Activation::table_exists( $price_type_table ) ) { |
|
896 | + if (EEH_Activation::table_exists($price_type_table)) { |
|
897 | 897 | |
898 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
899 | - $price_types_exist = $wpdb->get_var( $SQL ); |
|
898 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table; |
|
899 | + $price_types_exist = $wpdb->get_var($SQL); |
|
900 | 900 | |
901 | - if ( ! $price_types_exist ) { |
|
901 | + if ( ! $price_types_exist) { |
|
902 | 902 | $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES |
903 | - (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, 0), |
|
904 | - (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, 0), |
|
905 | - (3, '" . __('Fixed Discount', 'event_espresso') . "', 2, 0, 30, 0), |
|
906 | - (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, 0), |
|
907 | - (5, '" . __('Fixed Surcharge', 'event_espresso') . "', 3, 0, 50, 0);"; |
|
908 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL ); |
|
909 | - $wpdb->query( $SQL ); |
|
903 | + (1, '".__('Base Price', 'event_espresso')."', 1, 0, 0, 0), |
|
904 | + (2, '" . __('Percent Discount', 'event_espresso')."', 2, 1, 20, 0), |
|
905 | + (3, '" . __('Fixed Discount', 'event_espresso')."', 2, 0, 30, 0), |
|
906 | + (4, '" . __('Percent Surcharge', 'event_espresso')."', 3, 1, 40, 0), |
|
907 | + (5, '" . __('Fixed Surcharge', 'event_espresso')."', 3, 0, 50, 0);"; |
|
908 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL); |
|
909 | + $wpdb->query($SQL); |
|
910 | 910 | } |
911 | 911 | } |
912 | 912 | } |
@@ -926,16 +926,16 @@ discard block |
||
926 | 926 | global $wpdb; |
927 | 927 | $price_table = $wpdb->prefix."esp_price"; |
928 | 928 | |
929 | - if ( EEH_Activation::table_exists( $price_table ) ) { |
|
929 | + if (EEH_Activation::table_exists($price_table)) { |
|
930 | 930 | |
931 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' .$price_table; |
|
932 | - $prices_exist = $wpdb->get_var( $SQL ); |
|
931 | + $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table; |
|
932 | + $prices_exist = $wpdb->get_var($SQL); |
|
933 | 933 | |
934 | - if ( ! $prices_exist ) { |
|
934 | + if ( ! $prices_exist) { |
|
935 | 935 | $SQL = "INSERT INTO $price_table |
936 | 936 | (PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc, PRC_is_default, PRC_overrides, PRC_order, PRC_deleted, PRC_parent ) VALUES |
937 | 937 | (1, 1, '0.00', 'Free Admission', '', 1, NULL, 0, 0, 0);"; |
938 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL ); |
|
938 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL); |
|
939 | 939 | $wpdb->query($SQL); |
940 | 940 | } |
941 | 941 | } |
@@ -952,34 +952,34 @@ discard block |
||
952 | 952 | |
953 | 953 | global $wpdb; |
954 | 954 | $ticket_table = $wpdb->prefix."esp_ticket"; |
955 | - if ( EEH_Activation::table_exists( $ticket_table ) ) { |
|
955 | + if (EEH_Activation::table_exists($ticket_table)) { |
|
956 | 956 | |
957 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
957 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
958 | 958 | $tickets_exist = $wpdb->get_var($SQL); |
959 | 959 | |
960 | - if ( ! $tickets_exist ) { |
|
960 | + if ( ! $tickets_exist) { |
|
961 | 961 | $SQL = "INSERT INTO $ticket_table |
962 | 962 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES |
963 | - ( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);"; |
|
964 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL ); |
|
963 | + ( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);"; |
|
964 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL); |
|
965 | 965 | $wpdb->query($SQL); |
966 | 966 | } |
967 | 967 | } |
968 | 968 | $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
969 | 969 | |
970 | - if ( EEH_Activation::table_exists( $ticket_price_table ) ) { |
|
970 | + if (EEH_Activation::table_exists($ticket_price_table)) { |
|
971 | 971 | |
972 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
972 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
973 | 973 | $ticket_prc_exist = $wpdb->get_var($SQL); |
974 | 974 | |
975 | - if ( ! $ticket_prc_exist ) { |
|
975 | + if ( ! $ticket_prc_exist) { |
|
976 | 976 | |
977 | 977 | $SQL = "INSERT INTO $ticket_price_table |
978 | 978 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
979 | 979 | ( 1, 1, 1 ) |
980 | 980 | "; |
981 | 981 | |
982 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL ); |
|
982 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
983 | 983 | $wpdb->query($SQL); |
984 | 984 | } |
985 | 985 | } |
@@ -992,20 +992,20 @@ discard block |
||
992 | 992 | * @param string $country_name |
993 | 993 | * @return array where keys are columns, values are column values |
994 | 994 | */ |
995 | - public function get_or_create_country($country_name){ |
|
996 | - if( ! $country_name ){ |
|
995 | + public function get_or_create_country($country_name) { |
|
996 | + if ( ! $country_name) { |
|
997 | 997 | throw new EE_Error(__("Could not get a country because country name is blank", "event_espresso")); |
998 | 998 | } |
999 | 999 | global $wpdb; |
1000 | 1000 | $country_table = $wpdb->prefix."esp_country"; |
1001 | - if(is_int($country_name)){ |
|
1001 | + if (is_int($country_name)) { |
|
1002 | 1002 | $country_name = $this->get_iso_from_3_1_country_id($country_name); |
1003 | 1003 | } |
1004 | 1004 | $country = $wpdb->get_row($wpdb->prepare("SELECT * FROM $country_table WHERE |
1005 | 1005 | CNT_ISO LIKE %s OR |
1006 | 1006 | CNT_ISO3 LIKE %s OR |
1007 | - CNT_name LIKE %s LIMIT 1",$country_name,$country_name,$country_name),ARRAY_A); |
|
1008 | - if( ! $country ){ |
|
1007 | + CNT_name LIKE %s LIMIT 1", $country_name, $country_name, $country_name), ARRAY_A); |
|
1008 | + if ( ! $country) { |
|
1009 | 1009 | //insert a new one then |
1010 | 1010 | $cols_n_values = array( |
1011 | 1011 | 'CNT_ISO'=> $this->_find_available_country_iso(2), |
@@ -1025,26 +1025,26 @@ discard block |
||
1025 | 1025 | 'CNT_active'=>true |
1026 | 1026 | ); |
1027 | 1027 | $data_types = array( |
1028 | - '%s',//CNT_ISO |
|
1029 | - '%s',//CNT_ISO3 |
|
1030 | - '%d',//RGN_ID |
|
1031 | - '%s',//CNT_name |
|
1032 | - '%s',//CNT_cur_code |
|
1033 | - '%s',//CNT_cur_single |
|
1034 | - '%s',//CNT_cur_plural |
|
1035 | - '%s',//CNT_cur_sign |
|
1036 | - '%d',//CNT_cur_sign_b4 |
|
1037 | - '%d',//CNT_cur_dec_plc |
|
1038 | - '%s',//CNT_cur_dec_mrk |
|
1039 | - '%s',//CNT_cur_thsnds |
|
1040 | - '%s',//CNT_tel_code |
|
1041 | - '%d',//CNT_is_EU |
|
1042 | - '%d',//CNT_active |
|
1028 | + '%s', //CNT_ISO |
|
1029 | + '%s', //CNT_ISO3 |
|
1030 | + '%d', //RGN_ID |
|
1031 | + '%s', //CNT_name |
|
1032 | + '%s', //CNT_cur_code |
|
1033 | + '%s', //CNT_cur_single |
|
1034 | + '%s', //CNT_cur_plural |
|
1035 | + '%s', //CNT_cur_sign |
|
1036 | + '%d', //CNT_cur_sign_b4 |
|
1037 | + '%d', //CNT_cur_dec_plc |
|
1038 | + '%s', //CNT_cur_dec_mrk |
|
1039 | + '%s', //CNT_cur_thsnds |
|
1040 | + '%s', //CNT_tel_code |
|
1041 | + '%d', //CNT_is_EU |
|
1042 | + '%d', //CNT_active |
|
1043 | 1043 | ); |
1044 | 1044 | $success = $wpdb->insert($country_table, |
1045 | 1045 | $cols_n_values, |
1046 | 1046 | $data_types); |
1047 | - if( ! $success){ |
|
1047 | + if ( ! $success) { |
|
1048 | 1048 | throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('country_id'=>$country_name), $country_table, $cols_n_values, $data_types)); |
1049 | 1049 | } |
1050 | 1050 | $country = $cols_n_values; |
@@ -1056,13 +1056,13 @@ discard block |
||
1056 | 1056 | * @global type $wpdb |
1057 | 1057 | * @return string |
1058 | 1058 | */ |
1059 | - private function _find_available_country_iso($num_letters = 2){ |
|
1059 | + private function _find_available_country_iso($num_letters = 2) { |
|
1060 | 1060 | global $wpdb; |
1061 | 1061 | $country_table = $wpdb->prefix."esp_country"; |
1062 | - do{ |
|
1062 | + do { |
|
1063 | 1063 | $current_iso = strtoupper(wp_generate_password($num_letters, false)); |
1064 | - $country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM ".$country_table." WHERE CNT_ISO=%s",$current_iso)); |
|
1065 | - }while(intval($country_with_that_iso)); |
|
1064 | + $country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM ".$country_table." WHERE CNT_ISO=%s", $current_iso)); |
|
1065 | + }while (intval($country_with_that_iso)); |
|
1066 | 1066 | return $current_iso; |
1067 | 1067 | } |
1068 | 1068 | |
@@ -1073,14 +1073,14 @@ discard block |
||
1073 | 1073 | * @param string $state_name |
1074 | 1074 | * @return array where keys are columns, values are column values |
1075 | 1075 | */ |
1076 | - public function get_or_create_state($state_name,$country_name = ''){ |
|
1077 | - if( ! $state_name ){ |
|
1076 | + public function get_or_create_state($state_name, $country_name = '') { |
|
1077 | + if ( ! $state_name) { |
|
1078 | 1078 | throw new EE_Error(__("Could not get-or-create state because no state name was provided", "event_espresso")); |
1079 | 1079 | } |
1080 | - try{ |
|
1080 | + try { |
|
1081 | 1081 | $country = $this->get_or_create_country($country_name); |
1082 | 1082 | $country_iso = $country['CNT_ISO']; |
1083 | - }catch(EE_Error $e){ |
|
1083 | + } catch (EE_Error $e) { |
|
1084 | 1084 | $country_iso = $this->get_default_country_iso(); |
1085 | 1085 | } |
1086 | 1086 | global $wpdb; |
@@ -1088,24 +1088,24 @@ discard block |
||
1088 | 1088 | $state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE |
1089 | 1089 | (STA_abbrev LIKE %s OR |
1090 | 1090 | STA_name LIKE %s) AND |
1091 | - CNT_ISO LIKE %s LIMIT 1",$state_name,$state_name,$country_iso),ARRAY_A); |
|
1092 | - if ( ! $state){ |
|
1091 | + CNT_ISO LIKE %s LIMIT 1", $state_name, $state_name, $country_iso), ARRAY_A); |
|
1092 | + if ( ! $state) { |
|
1093 | 1093 | //insert a new one then |
1094 | 1094 | $cols_n_values = array( |
1095 | 1095 | 'CNT_ISO'=>$country_iso, |
1096 | - 'STA_abbrev'=>substr($state_name,0,6), |
|
1096 | + 'STA_abbrev'=>substr($state_name, 0, 6), |
|
1097 | 1097 | 'STA_name'=>$state_name, |
1098 | 1098 | 'STA_active'=>true |
1099 | 1099 | ); |
1100 | 1100 | $data_types = array( |
1101 | - '%s',//CNT_ISO |
|
1102 | - '%s',//STA_abbrev |
|
1103 | - '%s',//STA_name |
|
1104 | - '%d',//STA_active |
|
1101 | + '%s', //CNT_ISO |
|
1102 | + '%s', //STA_abbrev |
|
1103 | + '%s', //STA_name |
|
1104 | + '%d', //STA_active |
|
1105 | 1105 | ); |
1106 | - $success = $wpdb->insert($state_table,$cols_n_values,$data_types); |
|
1107 | - if ( ! $success ){ |
|
1108 | - throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('state'=>$state_name,'country_id'=>$country_name), $state_table, $cols_n_values, $data_types)); |
|
1106 | + $success = $wpdb->insert($state_table, $cols_n_values, $data_types); |
|
1107 | + if ( ! $success) { |
|
1108 | + throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('state'=>$state_name, 'country_id'=>$country_name), $state_table, $cols_n_values, $data_types)); |
|
1109 | 1109 | } |
1110 | 1110 | $state = $cols_n_values; |
1111 | 1111 | $state['STA_ID'] = $wpdb->insert_id; |
@@ -1118,21 +1118,21 @@ discard block |
||
1118 | 1118 | * @param type $timeString |
1119 | 1119 | * @return string in the php DATETIME format: "G:i" (24-hour format hour with leading zeros, a colon, and minutes with leading zeros) |
1120 | 1120 | */ |
1121 | - public function convertTimeFromAMPM($timeString){ |
|
1121 | + public function convertTimeFromAMPM($timeString) { |
|
1122 | 1122 | $matches = array(); |
1123 | - preg_match("~(\\d*):(\\d*)~",$timeString,$matches); |
|
1124 | - if( ! $matches || count($matches)<3){ |
|
1123 | + preg_match("~(\\d*):(\\d*)~", $timeString, $matches); |
|
1124 | + if ( ! $matches || count($matches) < 3) { |
|
1125 | 1125 | $hour = '00'; |
1126 | 1126 | $minutes = '00'; |
1127 | - }else{ |
|
1127 | + } else { |
|
1128 | 1128 | $hour = intval($matches[1]); |
1129 | 1129 | $minutes = $matches[2]; |
1130 | 1130 | } |
1131 | - if(strpos($timeString, 'PM') || strpos($timeString, 'pm')){ |
|
1131 | + if (strpos($timeString, 'PM') || strpos($timeString, 'pm')) { |
|
1132 | 1132 | $hour = intval($hour) + 12; |
1133 | 1133 | } |
1134 | - $hour = str_pad( "$hour", 2, '0',STR_PAD_LEFT); |
|
1135 | - $minutes = str_pad( "$minutes", 2, '0',STR_PAD_LEFT); |
|
1134 | + $hour = str_pad("$hour", 2, '0', STR_PAD_LEFT); |
|
1135 | + $minutes = str_pad("$minutes", 2, '0', STR_PAD_LEFT); |
|
1136 | 1136 | return "$hour:$minutes"; |
1137 | 1137 | } |
1138 | 1138 | |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | * @param int $country_id |
1142 | 1142 | * @return string the country's ISO3 code |
1143 | 1143 | */ |
1144 | - public function get_iso_from_3_1_country_id($country_id){ |
|
1144 | + public function get_iso_from_3_1_country_id($country_id) { |
|
1145 | 1145 | $old_countries = array( |
1146 | 1146 | array(64, 'United States', 'US', 'USA', 1), |
1147 | 1147 | array(15, 'Australia', 'AU', 'AUS', 1), |
@@ -1367,9 +1367,9 @@ discard block |
||
1367 | 1367 | array(226, 'Zimbabwe', 'ZW', 'ZWE', 1)); |
1368 | 1368 | |
1369 | 1369 | $country_iso = 'US'; |
1370 | - foreach($old_countries as $country_array){ |
|
1370 | + foreach ($old_countries as $country_array) { |
|
1371 | 1371 | //note: index 0 is the 3.1 country ID |
1372 | - if($country_array[0] == $country_id){ |
|
1372 | + if ($country_array[0] == $country_id) { |
|
1373 | 1373 | //note: index 2 is the ISO |
1374 | 1374 | $country_iso = $country_array[2]; |
1375 | 1375 | break; |
@@ -1382,8 +1382,8 @@ discard block |
||
1382 | 1382 | * Gets the ISO3 for the |
1383 | 1383 | * @return string |
1384 | 1384 | */ |
1385 | - public function get_default_country_iso(){ |
|
1386 | - $old_org_options= get_option('events_organization_settings'); |
|
1385 | + public function get_default_country_iso() { |
|
1386 | + $old_org_options = get_option('events_organization_settings'); |
|
1387 | 1387 | $iso = $this->get_iso_from_3_1_country_id($old_org_options['organization_country']); |
1388 | 1388 | return $iso; |
1389 | 1389 | } |
@@ -1395,13 +1395,13 @@ discard block |
||
1395 | 1395 | * the event's DEFAULT payment status, or the attendee's payment status) required pre-approval. |
1396 | 1396 | * @return string STS_ID for use in 4.1 |
1397 | 1397 | */ |
1398 | - public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false){ |
|
1398 | + public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false) { |
|
1399 | 1399 | |
1400 | 1400 | //EE team can read the related discussion: https://app.asana.com/0/2400967562914/9418495544455 |
1401 | - if($this_thing_required_pre_approval){ |
|
1401 | + if ($this_thing_required_pre_approval) { |
|
1402 | 1402 | return 'RNA'; |
1403 | - }else{ |
|
1404 | - $mapping = $default_reg_stati_conversions=array( |
|
1403 | + } else { |
|
1404 | + $mapping = $default_reg_stati_conversions = array( |
|
1405 | 1405 | 'Completed'=>'RAP', |
1406 | 1406 | ''=>'RPP', |
1407 | 1407 | 'Incomplete'=>'RPP', |
@@ -1431,22 +1431,22 @@ discard block |
||
1431 | 1431 | * @param EE_Data_Migration_Script_Stage $migration_stage the stage which called this, where errors should be added |
1432 | 1432 | * @return boolean whether or not we had to do the big job of creating an image attachment |
1433 | 1433 | */ |
1434 | - public function convert_image_url_to_attachment_and_attach_to_post($guid,$new_cpt_id, EE_Data_Migration_Script_Stage $migration_stage){ |
|
1434 | + public function convert_image_url_to_attachment_and_attach_to_post($guid, $new_cpt_id, EE_Data_Migration_Script_Stage $migration_stage) { |
|
1435 | 1435 | $created_attachment_post = false; |
1436 | 1436 | $guid = $this->_get_original_guid($guid); |
1437 | - if($guid){ |
|
1437 | + if ($guid) { |
|
1438 | 1438 | //check for an existing attachment post with this guid |
1439 | 1439 | $attachment_post_id = $this->_get_image_attachment_id_by_GUID($guid); |
1440 | - if( ! $attachment_post_id){ |
|
1440 | + if ( ! $attachment_post_id) { |
|
1441 | 1441 | //post thumbnail with that GUID doesn't exist, we should create one |
1442 | 1442 | $attachment_post_id = $this->_create_image_attachment_from_GUID($guid, $migration_stage); |
1443 | 1443 | $created_attachment_post = true; |
1444 | 1444 | } |
1445 | 1445 | //double-check we actually have an attachment post |
1446 | - if( $attachment_post_id){ |
|
1447 | - update_post_meta($new_cpt_id,'_thumbnail_id',$attachment_post_id); |
|
1448 | - }else{ |
|
1449 | - $migration_stage->add_error(sprintf(__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d", "event_espresso"),$guid,$new_cpt_id,$attachment_post_id)); |
|
1446 | + if ($attachment_post_id) { |
|
1447 | + update_post_meta($new_cpt_id, '_thumbnail_id', $attachment_post_id); |
|
1448 | + } else { |
|
1449 | + $migration_stage->add_error(sprintf(__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d", "event_espresso"), $guid, $new_cpt_id, $attachment_post_id)); |
|
1450 | 1450 | } |
1451 | 1451 | } |
1452 | 1452 | return $created_attachment_post; |
@@ -1460,13 +1460,13 @@ discard block |
||
1460 | 1460 | * @param string $guid_in_old_event |
1461 | 1461 | * @return string either the original guid, or $guid_in_old_event if we couldn't figure out what the original was |
1462 | 1462 | */ |
1463 | - private function _get_original_guid($guid_in_old_event){ |
|
1464 | - $original_guid = preg_replace('~-\d*x\d*\.~','.',$guid_in_old_event,1); |
|
1463 | + private function _get_original_guid($guid_in_old_event) { |
|
1464 | + $original_guid = preg_replace('~-\d*x\d*\.~', '.', $guid_in_old_event, 1); |
|
1465 | 1465 | //do a head request to verify the file exists |
1466 | 1466 | $head_response = wp_remote_head($original_guid); |
1467 | - if( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK'){ |
|
1467 | + if ( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK') { |
|
1468 | 1468 | return $original_guid; |
1469 | - }else{ |
|
1469 | + } else { |
|
1470 | 1470 | return $guid_in_old_event; |
1471 | 1471 | } |
1472 | 1472 | } |
@@ -1478,32 +1478,32 @@ discard block |
||
1478 | 1478 | * @param EE_Data_Migration_Script_Stage $migration_stage |
1479 | 1479 | * @return int |
1480 | 1480 | */ |
1481 | - private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage){ |
|
1482 | - if ( ! $guid){ |
|
1481 | + private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage) { |
|
1482 | + if ( ! $guid) { |
|
1483 | 1483 | $migration_stage->add_error(sprintf(__("Cannot create image attachment for a blank GUID!", "event_espresso"))); |
1484 | 1484 | return 0; |
1485 | 1485 | } |
1486 | - $wp_filetype = wp_check_filetype(basename($guid), null ); |
|
1486 | + $wp_filetype = wp_check_filetype(basename($guid), null); |
|
1487 | 1487 | $wp_upload_dir = wp_upload_dir(); |
1488 | 1488 | //if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local |
1489 | - if(strpos($guid,$wp_upload_dir['url']) === FALSE){ |
|
1489 | + if (strpos($guid, $wp_upload_dir['url']) === FALSE) { |
|
1490 | 1490 | //image is located remotely. download it and place it in the uploads directory |
1491 | - if( ! is_readable($guid)){ |
|
1492 | - $migration_stage->add_error(sprintf(__("Could not create image attachment from non-existent file: %s", "event_espresso"),$guid)); |
|
1491 | + if ( ! is_readable($guid)) { |
|
1492 | + $migration_stage->add_error(sprintf(__("Could not create image attachment from non-existent file: %s", "event_espresso"), $guid)); |
|
1493 | 1493 | return 0; |
1494 | 1494 | } |
1495 | - $contents= file_get_contents($guid); |
|
1496 | - if($contents === FALSE){ |
|
1497 | - $migration_stage->add_error(sprintf(__("Could not read image at %s, and therefore couldnt create an attachment post for it.", "event_espresso"),$guid)); |
|
1495 | + $contents = file_get_contents($guid); |
|
1496 | + if ($contents === FALSE) { |
|
1497 | + $migration_stage->add_error(sprintf(__("Could not read image at %s, and therefore couldnt create an attachment post for it.", "event_espresso"), $guid)); |
|
1498 | 1498 | return false; |
1499 | 1499 | } |
1500 | - $local_filepath = $wp_upload_dir['path'].DS.basename($guid); |
|
1500 | + $local_filepath = $wp_upload_dir['path'].DS.basename($guid); |
|
1501 | 1501 | $savefile = fopen($local_filepath, 'w'); |
1502 | 1502 | fwrite($savefile, $contents); |
1503 | 1503 | fclose($savefile); |
1504 | - $guid = str_replace($wp_upload_dir['path'],$wp_upload_dir['url'],$local_filepath); |
|
1505 | - }else{ |
|
1506 | - $local_filepath = str_replace($wp_upload_dir['url'],$wp_upload_dir['path'],$guid); |
|
1504 | + $guid = str_replace($wp_upload_dir['path'], $wp_upload_dir['url'], $local_filepath); |
|
1505 | + } else { |
|
1506 | + $local_filepath = str_replace($wp_upload_dir['url'], $wp_upload_dir['path'], $guid); |
|
1507 | 1507 | } |
1508 | 1508 | |
1509 | 1509 | $attachment = array( |
@@ -1513,24 +1513,24 @@ discard block |
||
1513 | 1513 | 'post_content' => '', |
1514 | 1514 | 'post_status' => 'inherit' |
1515 | 1515 | ); |
1516 | - $attach_id = wp_insert_attachment( $attachment, $guid ); |
|
1517 | - if( ! $attach_id ){ |
|
1518 | - $migration_stage->add_error(sprintf(__("Could not create image attachment post from image '%s'. Attachment data was %s.", "event_espresso"),$guid,$this->_json_encode($attachment))); |
|
1516 | + $attach_id = wp_insert_attachment($attachment, $guid); |
|
1517 | + if ( ! $attach_id) { |
|
1518 | + $migration_stage->add_error(sprintf(__("Could not create image attachment post from image '%s'. Attachment data was %s.", "event_espresso"), $guid, $this->_json_encode($attachment))); |
|
1519 | 1519 | return $attach_id; |
1520 | 1520 | } |
1521 | 1521 | |
1522 | 1522 | // you must first include the image.php file |
1523 | 1523 | // for the function wp_generate_attachment_metadata() to work |
1524 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1524 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
1525 | 1525 | |
1526 | - $attach_data = wp_generate_attachment_metadata( $attach_id, $local_filepath ); |
|
1527 | - if( ! $attach_data){ |
|
1528 | - $migration_stage->add_error(sprintf(__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.", "event_espresso"),$attach_id,$local_filepath,$guid)); |
|
1526 | + $attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath); |
|
1527 | + if ( ! $attach_data) { |
|
1528 | + $migration_stage->add_error(sprintf(__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.", "event_espresso"), $attach_id, $local_filepath, $guid)); |
|
1529 | 1529 | return $attach_id; |
1530 | 1530 | } |
1531 | - $metadata_save_result = wp_update_attachment_metadata( $attach_id, $attach_data ); |
|
1532 | - if( ! $metadata_save_result ){ |
|
1533 | - $migration_stage->add_error(sprintf(__("Could not update attachment metadata for attachment %d with data %s", "event_espresso"),$attach_id,$this->_json_encode($attach_data))); |
|
1531 | + $metadata_save_result = wp_update_attachment_metadata($attach_id, $attach_data); |
|
1532 | + if ( ! $metadata_save_result) { |
|
1533 | + $migration_stage->add_error(sprintf(__("Could not update attachment metadata for attachment %d with data %s", "event_espresso"), $attach_id, $this->_json_encode($attach_data))); |
|
1534 | 1534 | } |
1535 | 1535 | return $attach_id; |
1536 | 1536 | } |
@@ -1542,9 +1542,9 @@ discard block |
||
1542 | 1542 | * @param string $guid |
1543 | 1543 | * @return int |
1544 | 1544 | */ |
1545 | - private function _get_image_attachment_id_by_GUID($guid){ |
|
1545 | + private function _get_image_attachment_id_by_GUID($guid) { |
|
1546 | 1546 | global $wpdb; |
1547 | - $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1",$guid)); |
|
1547 | + $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1", $guid)); |
|
1548 | 1548 | return $attachment_id; |
1549 | 1549 | } |
1550 | 1550 | /** |
@@ -1556,20 +1556,20 @@ discard block |
||
1556 | 1556 | * @param string $timezone |
1557 | 1557 | * @return string |
1558 | 1558 | */ |
1559 | - public function convert_date_string_to_utc(EE_Data_Migration_Script_Stage $stage, $row_of_data, $DATETIME_string,$timezone = null){ |
|
1559 | + public function convert_date_string_to_utc(EE_Data_Migration_Script_Stage $stage, $row_of_data, $DATETIME_string, $timezone = null) { |
|
1560 | 1560 | $original_tz = $timezone; |
1561 | - if( ! $timezone){ |
|
1561 | + if ( ! $timezone) { |
|
1562 | 1562 | $timezone = $this->_get_wp_timezone(); |
1563 | 1563 | } |
1564 | - if( ! $timezone){ |
|
1565 | - $stage->add_error(sprintf(__("Could not find timezone given %s for %s", "event_espresso"),$original_tz,$row_of_data)); |
|
1564 | + if ( ! $timezone) { |
|
1565 | + $stage->add_error(sprintf(__("Could not find timezone given %s for %s", "event_espresso"), $original_tz, $row_of_data)); |
|
1566 | 1566 | $timezone = 'UTC'; |
1567 | 1567 | } |
1568 | - try{ |
|
1569 | - $date_obj = new DateTime( $DATETIME_string, new DateTimeZone( $timezone ) ); |
|
1568 | + try { |
|
1569 | + $date_obj = new DateTime($DATETIME_string, new DateTimeZone($timezone)); |
|
1570 | 1570 | $date_obj->setTimezone(new DateTimeZone('UTC')); |
1571 | - }catch(Exception $e){ |
|
1572 | - $stage->add_error(sprintf(__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.", "event_espresso"),$DATETIME_string,$timezone)); |
|
1571 | + } catch (Exception $e) { |
|
1572 | + $stage->add_error(sprintf(__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.", "event_espresso"), $DATETIME_string, $timezone)); |
|
1573 | 1573 | $date_obj = new DateTime(); |
1574 | 1574 | } |
1575 | 1575 | |
@@ -1580,14 +1580,14 @@ discard block |
||
1580 | 1580 | * Gets the DEFAULT timezone string from wordpress (even if they set a gmt offset) |
1581 | 1581 | * @return string |
1582 | 1582 | */ |
1583 | - private function _get_wp_timezone(){ |
|
1584 | - $timezone = empty( $timezone ) ? get_option('timezone_string') : $timezone; |
|
1583 | + private function _get_wp_timezone() { |
|
1584 | + $timezone = empty($timezone) ? get_option('timezone_string') : $timezone; |
|
1585 | 1585 | |
1586 | 1586 | //if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter |
1587 | - if ( empty( $timezone ) ) { |
|
1587 | + if (empty($timezone)) { |
|
1588 | 1588 | //let's get a the WordPress UTC offset |
1589 | 1589 | $offset = get_option('gmt_offset'); |
1590 | - $timezone = $this->timezone_convert_to_string_from_offset( $offset ); |
|
1590 | + $timezone = $this->timezone_convert_to_string_from_offset($offset); |
|
1591 | 1591 | } |
1592 | 1592 | return $timezone; |
1593 | 1593 | } |
@@ -1596,11 +1596,11 @@ discard block |
||
1596 | 1596 | * @param int $offset |
1597 | 1597 | * @return boolean |
1598 | 1598 | */ |
1599 | - private function timezone_convert_to_string_from_offset($offset){ |
|
1599 | + private function timezone_convert_to_string_from_offset($offset) { |
|
1600 | 1600 | //shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable |
1601 | 1601 | $offset *= 3600; // convert hour offset to seconds |
1602 | 1602 | $abbrarray = timezone_abbreviations_list(); |
1603 | - foreach ($abbrarray as $abbr){ |
|
1603 | + foreach ($abbrarray as $abbr) { |
|
1604 | 1604 | foreach ($abbr as $city) |
1605 | 1605 | { |
1606 | 1606 | if ($city['offset'] == $offset) |
@@ -1614,32 +1614,32 @@ discard block |
||
1614 | 1614 | return FALSE; |
1615 | 1615 | } |
1616 | 1616 | |
1617 | - public function migration_page_hooks(){ |
|
1618 | - add_filter('FHEE__ee_migration_page__header',array($this,'_migrate_page_hook_simplify_version_strings'),10,3); |
|
1619 | - add_filter('FHEE__ee_migration_page__p_after_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2); |
|
1620 | - add_filter('FHEE__ee_migration_page__option_1_main',array($this,'_migrate_page_hook_simplify_version_strings'),10,3); |
|
1621 | - add_filter('FHEE__ee_migration_page__option_1_button_text',array($this,'_migrate_page_hook_simplify_version_strings'),10,3); |
|
1622 | - add_action('AHEE__ee_migration_page__option_1_extra_details',array($this,'_migration_page_hook_option_1_extra_details'),10,3); |
|
1623 | - add_filter('FHEE__ee_migration_page__option_2_main',array($this,'_migrate_page_hook_simplify_version_strings'),10,4); |
|
1624 | - add_filter('FHEE__ee_migration_page__option_2_button_text',array($this,'_migration_page_hook_simplify_next_db_state'),10,2); |
|
1625 | - add_filter('FHEE__ee_migration_page__option_2_details',array($this,'_migration_page_hook_simplify_next_db_state'),10,2); |
|
1626 | - add_action('AHEE__ee_migration_page__after_migration_options_table',array($this,'_migration_page_hook_after_migration_options_table')); |
|
1627 | - add_filter('FHEE__ee_migration_page__done_migration_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2); |
|
1628 | - add_filter('FHEE__ee_migration_page__p_after_done_migration_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2); |
|
1617 | + public function migration_page_hooks() { |
|
1618 | + add_filter('FHEE__ee_migration_page__header', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3); |
|
1619 | + add_filter('FHEE__ee_migration_page__p_after_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2); |
|
1620 | + add_filter('FHEE__ee_migration_page__option_1_main', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3); |
|
1621 | + add_filter('FHEE__ee_migration_page__option_1_button_text', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3); |
|
1622 | + add_action('AHEE__ee_migration_page__option_1_extra_details', array($this, '_migration_page_hook_option_1_extra_details'), 10, 3); |
|
1623 | + add_filter('FHEE__ee_migration_page__option_2_main', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 4); |
|
1624 | + add_filter('FHEE__ee_migration_page__option_2_button_text', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2); |
|
1625 | + add_filter('FHEE__ee_migration_page__option_2_details', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2); |
|
1626 | + add_action('AHEE__ee_migration_page__after_migration_options_table', array($this, '_migration_page_hook_after_migration_options_table')); |
|
1627 | + add_filter('FHEE__ee_migration_page__done_migration_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2); |
|
1628 | + add_filter('FHEE__ee_migration_page__p_after_done_migration_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2); |
|
1629 | 1629 | } |
1630 | 1630 | |
1631 | - public function _migrate_page_hook_simplify_version_strings($old_content,$current_db_state,$next_db_state,$ultimate_db_state = NULL){ |
|
1632 | - return str_replace(array($current_db_state,$next_db_state,$ultimate_db_state),array(__('EE3','event_espresso'),__('EE4','event_espresso'), __("EE4", 'event_espresso')),$old_content); |
|
1631 | + public function _migrate_page_hook_simplify_version_strings($old_content, $current_db_state, $next_db_state, $ultimate_db_state = NULL) { |
|
1632 | + return str_replace(array($current_db_state, $next_db_state, $ultimate_db_state), array(__('EE3', 'event_espresso'), __('EE4', 'event_espresso'), __("EE4", 'event_espresso')), $old_content); |
|
1633 | 1633 | } |
1634 | - public function _migration_page_hook_simplify_next_db_state($old_content,$next_db_state){ |
|
1635 | - return str_replace($next_db_state, __("EE4", 'event_espresso'),$old_content); |
|
1634 | + public function _migration_page_hook_simplify_next_db_state($old_content, $next_db_state) { |
|
1635 | + return str_replace($next_db_state, __("EE4", 'event_espresso'), $old_content); |
|
1636 | 1636 | } |
1637 | - public function _migration_page_hook_option_1_extra_details(){ |
|
1638 | - ?><p><?php printf(__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents", "event_espresso"));?></p><?php |
|
1637 | + public function _migration_page_hook_option_1_extra_details() { |
|
1638 | + ?><p><?php printf(__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents", "event_espresso")); ?></p><?php |
|
1639 | 1639 | } |
1640 | - public function _migration_page_hook_after_migration_options_table(){ |
|
1640 | + public function _migration_page_hook_after_migration_options_table() { |
|
1641 | 1641 | ?><p class="ee-attention"> |
1642 | - <strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ", "event_espresso");?></span></strong><br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.", "event_espresso"); ?> |
|
1642 | + <strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ", "event_espresso"); ?></span></strong><br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.", "event_espresso"); ?> |
|
1643 | 1643 | </p><?php |
1644 | 1644 | } |
1645 | 1645 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -defined( 'ABSPATH' ) || exit; |
|
2 | +defined('ABSPATH') || exit; |
|
3 | 3 | |
4 | 4 | |
5 | 5 | |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | |
16 | 16 | public function __construct() { |
17 | 17 | global $wpdb; |
18 | - $this->_pretty_name = __( 'Registration Form Questions Refactor', 'event_espresso' ); |
|
19 | - $this->_old_table = $wpdb->prefix . 'esp_question'; |
|
18 | + $this->_pretty_name = __('Registration Form Questions Refactor', 'event_espresso'); |
|
19 | + $this->_old_table = $wpdb->prefix.'esp_question'; |
|
20 | 20 | parent::__construct(); |
21 | 21 | } |
22 | 22 | |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * @param array $question an associative array where keys are column names and values are their values. |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - protected function _migrate_old_row( $question ) { |
|
29 | + protected function _migrate_old_row($question) { |
|
30 | 30 | global $wpdb; |
31 | - if ( $question['QST_ID'] ) { |
|
32 | - $html_class = sanitize_key( $question['QST_type'] ); |
|
33 | - $identifier = $html_class . '-' . time(); |
|
31 | + if ($question['QST_ID']) { |
|
32 | + $html_class = sanitize_key($question['QST_type']); |
|
33 | + $identifier = $html_class.'-'.time(); |
|
34 | 34 | $success = $wpdb->update( |
35 | 35 | $this->_old_table, |
36 | 36 | // data |
@@ -56,29 +56,29 @@ discard block |
||
56 | 56 | 'QST_html_label_class' => "{$html_class}-lbl", |
57 | 57 | //QST_default_value |
58 | 58 | 'QST_validation_strategies' => $question['QST_required'] |
59 | - ? array( 'required' ) |
|
59 | + ? array('required') |
|
60 | 60 | : array(), |
61 | 61 | 'QST_validation_message' => $question['QST_required'] |
62 | - ? array( 'required' => $question['QST_required_text'] ) |
|
62 | + ? array('required' => $question['QST_required_text']) |
|
63 | 63 | : array(), |
64 | 64 | ), |
65 | 65 | // where |
66 | - array( 'QST_ID' => $question['QST_ID'] ), |
|
66 | + array('QST_ID' => $question['QST_ID']), |
|
67 | 67 | // data format |
68 | 68 | array( |
69 | 69 | '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', |
70 | 70 | ), |
71 | 71 | // where format |
72 | - array( '%d' ) |
|
72 | + array('%d') |
|
73 | 73 | ); |
74 | - if ( ! $success ) { |
|
74 | + if ( ! $success) { |
|
75 | 75 | $this->add_error( |
76 | 76 | sprintf( |
77 | 77 | __( |
78 | 78 | 'Could not update the "%1$s" question (ID:%2$d) because "%3$s"', |
79 | 79 | 'event_espresso' |
80 | 80 | ), |
81 | - json_encode( $question['QST_admin_label'] ), |
|
81 | + json_encode($question['QST_admin_label']), |
|
82 | 82 | $question['QST_ID'], |
83 | 83 | $wpdb->last_error |
84 | 84 | ) |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @author Mike Nelson |
14 | 14 | * @since 4.6.0 |
15 | 15 | */ |
16 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
16 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * return EE_DMS_Core_4_8_0 |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function can_migrate_from_version($version_array) { |
45 | 45 | $version_string = $version_array['Core']; |
46 | - if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){ |
|
46 | + if ($version_string <= '4.8.0' && $version_string >= '4.7.0') { |
|
47 | 47 | // echo "$version_string can be migrated from"; |
48 | 48 | return true; |
49 | - }elseif( ! $version_string ){ |
|
49 | + }elseif ( ! $version_string) { |
|
50 | 50 | // echo "no version string provided: $version_string"; |
51 | 51 | //no version string provided... this must be pre 4.3 |
52 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
53 | - }else{ |
|
52 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
53 | + } else { |
|
54 | 54 | // echo "$version_string doesnt apply"; |
55 | 55 | return false; |
56 | 56 | } |
@@ -71,19 +71,19 @@ discard block |
||
71 | 71 | * @return bool |
72 | 72 | */ |
73 | 73 | public function schema_changes_before_migration() { |
74 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
75 | - $now_in_mysql = current_time( 'mysql', true ); |
|
74 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
75 | + $now_in_mysql = current_time('mysql', true); |
|
76 | 76 | |
77 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
78 | - $table_name='esp_answer'; |
|
79 | - $sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
77 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
78 | + $table_name = 'esp_answer'; |
|
79 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
80 | 80 | REG_ID int(10) unsigned NOT NULL, |
81 | 81 | QST_ID int(10) unsigned NOT NULL, |
82 | 82 | ANS_value text NOT NULL, |
83 | 83 | PRIMARY KEY (ANS_ID), |
84 | 84 | KEY REG_ID (REG_ID), |
85 | 85 | KEY QST_ID (QST_ID)"; |
86 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
86 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
87 | 87 | |
88 | 88 | $table_name = 'esp_attendee_meta'; |
89 | 89 | $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | CNT_is_EU tinyint(1) DEFAULT '0', |
124 | 124 | CNT_active tinyint(1) DEFAULT '0', |
125 | 125 | PRIMARY KEY (CNT_ISO)"; |
126 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
126 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
127 | 127 | |
128 | 128 | $table_name = 'esp_currency'; |
129 | 129 | $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
134 | 134 | CUR_active tinyint(1) DEFAULT '0', |
135 | 135 | PRIMARY KEY (CUR_code)"; |
136 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
136 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
137 | 137 | |
138 | 138 | |
139 | 139 | $table_name = 'esp_currency_payment_method'; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | KEY EVT_ID (EVT_ID), |
164 | 164 | KEY DTT_is_primary (DTT_is_primary)"; |
165 | 165 | |
166 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
166 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
167 | 167 | |
168 | 168 | $table_name = 'esp_event_meta'; |
169 | 169 | $sql = " |
@@ -182,41 +182,41 @@ discard block |
||
182 | 182 | EVT_donations tinyint(1) NULL, |
183 | 183 | PRIMARY KEY (EVTM_ID), |
184 | 184 | KEY EVT_ID (EVT_ID)"; |
185 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
185 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | 186 | |
187 | 187 | |
188 | 188 | |
189 | - $table_name='esp_event_question_group'; |
|
190 | - $sql="EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
189 | + $table_name = 'esp_event_question_group'; |
|
190 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
191 | 191 | EVT_ID bigint(20) unsigned NOT NULL, |
192 | 192 | QSG_ID int(10) unsigned NOT NULL, |
193 | 193 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
194 | 194 | PRIMARY KEY (EQG_ID), |
195 | 195 | KEY EVT_ID (EVT_ID), |
196 | 196 | KEY QSG_ID (QSG_ID)"; |
197 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
197 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | 198 | |
199 | 199 | |
200 | 200 | |
201 | - $table_name='esp_event_venue'; |
|
202 | - $sql="EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
201 | + $table_name = 'esp_event_venue'; |
|
202 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
203 | 203 | EVT_ID bigint(20) unsigned NOT NULL, |
204 | 204 | VNU_ID bigint(20) unsigned NOT NULL, |
205 | 205 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
206 | 206 | PRIMARY KEY (EVV_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_extra_meta'; |
|
212 | - $sql="EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
211 | + $table_name = 'esp_extra_meta'; |
|
212 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
213 | 213 | OBJ_ID int(11) DEFAULT NULL, |
214 | 214 | EXM_type varchar(45) DEFAULT NULL, |
215 | 215 | EXM_key varchar(45) DEFAULT NULL, |
216 | 216 | EXM_value text, |
217 | 217 | PRIMARY KEY (EXM_ID), |
218 | 218 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
219 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
219 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
220 | 220 | |
221 | 221 | $table_name = 'esp_extra_join'; |
222 | 222 | $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
230 | 230 | $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
231 | 231 | |
232 | - $table_name='esp_line_item'; |
|
233 | - $sql="LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
232 | + $table_name = 'esp_line_item'; |
|
233 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
234 | 234 | LIN_code varchar(245) NOT NULL DEFAULT '', |
235 | 235 | TXN_ID int(11) DEFAULT NULL, |
236 | 236 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | PRIMARY KEY (LIN_ID), |
250 | 250 | KEY LIN_code (LIN_code(191)), |
251 | 251 | KEY TXN_ID (TXN_ID)"; |
252 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
252 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
253 | 253 | |
254 | 254 | $table_name = 'esp_log'; |
255 | 255 | $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
289 | 289 | PRIMARY KEY (GRP_ID), |
290 | 290 | KEY MTP_user_id (MTP_user_id)"; |
291 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
291 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
292 | 292 | |
293 | 293 | $table_name = 'esp_event_message_template'; |
294 | 294 | $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | PRIMARY KEY (EMT_ID), |
298 | 298 | KEY EVT_ID (EVT_ID), |
299 | 299 | KEY GRP_ID (GRP_ID)"; |
300 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
300 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
301 | 301 | |
302 | 302 | |
303 | 303 | $table_name = 'esp_payment'; |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | PRIMARY KEY (TTM_ID)"; |
371 | 371 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
372 | 372 | |
373 | - $table_name='esp_question'; |
|
374 | - $sql='QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
373 | + $table_name = 'esp_question'; |
|
374 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
375 | 375 | QST_display_text text NOT NULL, |
376 | 376 | QST_admin_label varchar(255) NOT NULL, |
377 | 377 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -385,22 +385,22 @@ discard block |
||
385 | 385 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
386 | 386 | PRIMARY KEY (QST_ID), |
387 | 387 | KEY QST_order (QST_order)'; |
388 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
388 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
389 | 389 | |
390 | - $table_name='esp_question_group_question'; |
|
391 | - $sql="QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
390 | + $table_name = 'esp_question_group_question'; |
|
391 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
392 | 392 | QSG_ID int(10) unsigned NOT NULL, |
393 | 393 | QST_ID int(10) unsigned NOT NULL, |
394 | 394 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
395 | 395 | PRIMARY KEY (QGQ_ID), |
396 | 396 | KEY QST_ID (QST_ID), |
397 | 397 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
398 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
398 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
399 | 399 | |
400 | 400 | |
401 | 401 | |
402 | - $table_name='esp_question_option'; |
|
403 | - $sql="QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
402 | + $table_name = 'esp_question_option'; |
|
403 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
404 | 404 | QSO_value varchar(255) NOT NULL, |
405 | 405 | QSO_desc text NOT NULL, |
406 | 406 | QST_ID int(10) unsigned NOT NULL, |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | PRIMARY KEY (QSO_ID), |
411 | 411 | KEY QST_ID (QST_ID), |
412 | 412 | KEY QSO_order (QSO_order)"; |
413 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
413 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
414 | 414 | |
415 | 415 | |
416 | 416 | |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | |
457 | 457 | |
458 | 458 | |
459 | - $table_name='esp_checkin'; |
|
460 | - $sql="CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
459 | + $table_name = 'esp_checkin'; |
|
460 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
461 | 461 | REG_ID int(10) unsigned NOT NULL, |
462 | 462 | DTT_ID int(10) unsigned NOT NULL, |
463 | 463 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | PRC_parent int(10) unsigned DEFAULT 0, |
553 | 553 | PRIMARY KEY (PRC_ID), |
554 | 554 | KEY PRT_ID (PRT_ID)"; |
555 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
555 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
556 | 556 | |
557 | 557 | $table_name = "esp_price_type"; |
558 | 558 | $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
@@ -590,10 +590,10 @@ discard block |
||
590 | 590 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
591 | 591 | PRIMARY KEY (TKT_ID), |
592 | 592 | KEY TKT_start_date (TKT_start_date)"; |
593 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
593 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
594 | 594 | |
595 | 595 | $table_name = 'esp_question_group'; |
596 | - $sql='QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
596 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
597 | 597 | QSG_name varchar(255) NOT NULL, |
598 | 598 | QSG_identifier varchar(100) NOT NULL, |
599 | 599 | QSG_desc text NULL, |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | PRIMARY KEY (QSG_ID), |
607 | 607 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
608 | 608 | KEY QSG_order (QSG_order)'; |
609 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
609 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
610 | 610 | |
611 | 611 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
612 | 612 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | return $script_4_7_defaults->schema_changes_after_migration(); |
643 | 643 | } |
644 | 644 | |
645 | - public function migration_page_hooks(){ |
|
645 | + public function migration_page_hooks() { |
|
646 | 646 | |
647 | 647 | } |
648 | 648 | |
@@ -656,19 +656,19 @@ discard block |
||
656 | 656 | //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
657 | 657 | //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
658 | 658 | $newer_countries = array( |
659 | - array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ), |
|
660 | - array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
661 | - array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ), |
|
662 | - array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ), |
|
663 | - array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
664 | - array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
665 | - array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
666 | - array( 'MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0 ), |
|
667 | - array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ), |
|
668 | - array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ), |
|
669 | - array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ), |
|
670 | - array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ), |
|
671 | - array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ), |
|
659 | + array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
660 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
661 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
662 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
663 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
664 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
665 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
666 | + array('MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
667 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0), |
|
668 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
669 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
670 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0), |
|
671 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
672 | 672 | ); |
673 | 673 | global $wpdb; |
674 | 674 | $country_table = $wpdb->prefix."esp_country"; |
@@ -687,14 +687,14 @@ discard block |
||
687 | 687 | "CNT_is_EU" => '%d', |
688 | 688 | "CNT_active" => '%d', |
689 | 689 | ); |
690 | - if ( EEH_Activation::table_exists( $country_table ) ) { |
|
691 | - foreach( $newer_countries as $country ) { |
|
692 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ; |
|
690 | + if (EEH_Activation::table_exists($country_table)) { |
|
691 | + foreach ($newer_countries as $country) { |
|
692 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
693 | 693 | $countries = $wpdb->get_var($SQL); |
694 | - if ( ! $countries ) { |
|
694 | + if ( ! $countries) { |
|
695 | 695 | |
696 | - $wpdb->insert( $country_table, |
|
697 | - array_combine( array_keys( $country_format), $country ), |
|
696 | + $wpdb->insert($country_table, |
|
697 | + array_combine(array_keys($country_format), $country), |
|
698 | 698 | $country_format |
699 | 699 | ); |
700 | 700 | } |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
713 | 713 | //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
714 | 714 | $newer_currencies = array( |
715 | - array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ), |
|
715 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
716 | 716 | ); |
717 | 717 | global $wpdb; |
718 | 718 | $currency_table = $wpdb->prefix."esp_currency"; |
@@ -724,14 +724,14 @@ discard block |
||
724 | 724 | "CUR_dec_plc" => '%d', |
725 | 725 | "CUR_active" => '%d', |
726 | 726 | ); |
727 | - if ( EEH_Activation::table_exists( $currency_table ) ) { |
|
728 | - foreach( $newer_currencies as $currency ) { |
|
729 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ; |
|
727 | + if (EEH_Activation::table_exists($currency_table)) { |
|
728 | + foreach ($newer_currencies as $currency) { |
|
729 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
730 | 730 | $countries = $wpdb->get_var($SQL); |
731 | - if ( ! $countries ) { |
|
731 | + if ( ! $countries) { |
|
732 | 732 | |
733 | - $wpdb->insert( $currency_table, |
|
734 | - array_combine( array_keys( $currency_format), $currency ), |
|
733 | + $wpdb->insert($currency_table, |
|
734 | + array_combine(array_keys($currency_format), $currency), |
|
735 | 735 | $currency_format |
736 | 736 | ); |
737 | 737 | } |
@@ -743,9 +743,9 @@ discard block |
||
743 | 743 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
744 | 744 | * we should be able to stop doing this in 4.9 |
745 | 745 | */ |
746 | - public function fix_non_default_taxes(){ |
|
746 | + public function fix_non_default_taxes() { |
|
747 | 747 | global $wpdb; |
748 | - $query = $wpdb->prepare( "UPDATE |
|
748 | + $query = $wpdb->prepare("UPDATE |
|
749 | 749 | {$wpdb->prefix}esp_price p INNER JOIN |
750 | 750 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
751 | 751 | SET |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | WHERE |
754 | 754 | p.PRC_is_default = 0 AND |
755 | 755 | pt.PBT_ID = %d |
756 | - ", EEM_Price_Type::base_type_tax ); |
|
757 | - $wpdb->query( $query ); |
|
756 | + ", EEM_Price_Type::base_type_tax); |
|
757 | + $wpdb->query($query); |
|
758 | 758 | } |
759 | 759 | } |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | use EventEspresso\core\libraries\form_sections\strategies\validation\ValidationStrategiesLoader; |
4 | 4 | |
5 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
6 | - exit( 'No direct script access allowed' ); |
|
5 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
6 | + exit('No direct script access allowed'); |
|
7 | 7 | } |
8 | 8 | /** |
9 | 9 | * Event Espresso |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * @return EE_Question |
42 | 42 | * @throws \EE_Error |
43 | 43 | */ |
44 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
45 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
46 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
44 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
45 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
46 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @return EE_Question |
56 | 56 | * @throws \EE_Error |
57 | 57 | */ |
58 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
59 | - return new self( $props_n_values, TRUE, $timezone ); |
|
58 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
59 | + return new self($props_n_values, TRUE, $timezone); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * @param string $QST_display_text |
69 | 69 | * @throws \EE_Error |
70 | 70 | */ |
71 | - public function set_display_text( $QST_display_text = '' ) { |
|
72 | - $this->set( 'QST_display_text', $QST_display_text ); |
|
71 | + public function set_display_text($QST_display_text = '') { |
|
72 | + $this->set('QST_display_text', $QST_display_text); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * @param string $QST_admin_label |
82 | 82 | * @throws \EE_Error |
83 | 83 | */ |
84 | - public function set_admin_label( $QST_admin_label = '' ) { |
|
85 | - $this->set( 'QST_admin_label', $QST_admin_label ); |
|
84 | + public function set_admin_label($QST_admin_label = '') { |
|
85 | + $this->set('QST_admin_label', $QST_admin_label); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @param mixed $QST_system |
95 | 95 | * @throws \EE_Error |
96 | 96 | */ |
97 | - public function set_system_ID( $QST_system = '' ) { |
|
98 | - $this->set( 'QST_system', $QST_system ); |
|
97 | + public function set_system_ID($QST_system = '') { |
|
98 | + $this->set('QST_system', $QST_system); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | * @param string $QST_type |
108 | 108 | * @throws \EE_Error |
109 | 109 | */ |
110 | - public function set_question_type( $QST_type = '' ) { |
|
111 | - $this->set( 'QST_type', $QST_type ); |
|
110 | + public function set_question_type($QST_type = '') { |
|
111 | + $this->set('QST_type', $QST_type); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * @param string $QST_html_name |
121 | 121 | * @throws \EE_Error |
122 | 122 | */ |
123 | - public function set_html_name( $QST_html_name = '' ) { |
|
124 | - $this->set( 'QST_html_name', $QST_html_name ); |
|
123 | + public function set_html_name($QST_html_name = '') { |
|
124 | + $this->set('QST_html_name', $QST_html_name); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param string $QST_html_id |
134 | 134 | * @throws \EE_Error |
135 | 135 | */ |
136 | - public function set_html_id( $QST_html_id = '' ) { |
|
137 | - $this->set( 'QST_html_id', $QST_html_id ); |
|
136 | + public function set_html_id($QST_html_id = '') { |
|
137 | + $this->set('QST_html_id', $QST_html_id); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | * @param string $QST_html_class |
147 | 147 | * @throws \EE_Error |
148 | 148 | */ |
149 | - public function set_html_class( $QST_html_class = '' ) { |
|
150 | - $this->set( 'QST_html_class', $QST_html_class ); |
|
149 | + public function set_html_class($QST_html_class = '') { |
|
150 | + $this->set('QST_html_class', $QST_html_class); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | * @param string $QST_html_label_id |
160 | 160 | * @throws \EE_Error |
161 | 161 | */ |
162 | - public function set_html_label_id( $QST_html_label_id = '' ) { |
|
163 | - $this->set( 'QST_html_label_id', $QST_html_label_id ); |
|
162 | + public function set_html_label_id($QST_html_label_id = '') { |
|
163 | + $this->set('QST_html_label_id', $QST_html_label_id); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * @param string $QST_html_label_class |
173 | 173 | * @throws \EE_Error |
174 | 174 | */ |
175 | - public function set_html_label_class( $QST_html_label_class = '' ) { |
|
176 | - $this->set( 'QST_html_label_class', $QST_html_label_class ); |
|
175 | + public function set_html_label_class($QST_html_label_class = '') { |
|
176 | + $this->set('QST_html_label_class', $QST_html_label_class); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | * @param string|array $validation_strategies |
187 | 187 | * @throws \EE_Error |
188 | 188 | */ |
189 | - public function set_validation_strategies( $validation_strategies ) { |
|
189 | + public function set_validation_strategies($validation_strategies) { |
|
190 | 190 | $strategies = array(); |
191 | - foreach ( (array) $validation_strategies as $validation_strategy ) { |
|
191 | + foreach ((array) $validation_strategies as $validation_strategy) { |
|
192 | 192 | $strategies = ValidationStrategiesLoader::add( |
193 | 193 | $validation_strategy, |
194 | 194 | $strategies |
195 | 195 | ); |
196 | 196 | } |
197 | - $this->set( 'QST_validation_strategies', $strategies ); |
|
197 | + $this->set('QST_validation_strategies', $strategies); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | * @param string $QST_validation_message |
207 | 207 | * @throws \EE_Error |
208 | 208 | */ |
209 | - public function set_validation_message( $QST_validation_message = '' ) { |
|
210 | - $this->set( 'QST_validation_message', $QST_validation_message ); |
|
209 | + public function set_validation_message($QST_validation_message = '') { |
|
210 | + $this->set('QST_validation_message', $QST_validation_message); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | * @param int $QST_order |
220 | 220 | * @throws \EE_Error |
221 | 221 | */ |
222 | - public function set_order( $QST_order = 0 ) { |
|
223 | - $this->set( 'QST_order', $QST_order ); |
|
222 | + public function set_order($QST_order = 0) { |
|
223 | + $this->set('QST_order', $QST_order); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * @param bool $QST_admin_only |
233 | 233 | * @throws \EE_Error |
234 | 234 | */ |
235 | - public function set_admin_only( $QST_admin_only = FALSE ) { |
|
236 | - $this->set( 'QST_admin_only', $QST_admin_only ); |
|
235 | + public function set_admin_only($QST_admin_only = FALSE) { |
|
236 | + $this->set('QST_admin_only', $QST_admin_only); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | * @param int $QST_wp_user |
246 | 246 | * @throws \EE_Error |
247 | 247 | */ |
248 | - public function set_wp_user( $QST_wp_user = 1 ) { |
|
249 | - $this->set( 'QST_wp_user', $QST_wp_user ); |
|
248 | + public function set_wp_user($QST_wp_user = 1) { |
|
249 | + $this->set('QST_wp_user', $QST_wp_user); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | * @param bool $QST_deleted |
264 | 264 | * @throws \EE_Error |
265 | 265 | */ |
266 | - public function set_deleted( $QST_deleted = FALSE ) { |
|
267 | - $this->set( 'QST_deleted', $QST_deleted ); |
|
266 | + public function set_deleted($QST_deleted = FALSE) { |
|
267 | + $this->set('QST_deleted', $QST_deleted); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @throws \EE_Error |
278 | 278 | */ |
279 | 279 | public function identifier() { |
280 | - return $this->get( 'QST_identifier' ); |
|
280 | + return $this->get('QST_identifier'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @throws \EE_Error |
291 | 291 | */ |
292 | 292 | public function display_text() { |
293 | - return $this->get( 'QST_display_text' ); |
|
293 | + return $this->get('QST_display_text'); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @throws \EE_Error |
304 | 304 | */ |
305 | 305 | public function admin_label() { |
306 | - return $this->get( 'QST_admin_label' ); |
|
306 | + return $this->get('QST_admin_label'); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @throws \EE_Error |
317 | 317 | */ |
318 | 318 | public function system_ID() { |
319 | - return $this->get( 'QST_system' ); |
|
319 | + return $this->get('QST_system'); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | * @return string |
330 | 330 | * @throws \EE_Error |
331 | 331 | */ |
332 | - public function desc( $pretty = false ) { |
|
333 | - return $pretty ? $this->get_pretty( 'QST_desc' ) : $this->get( 'QST_desc' ); |
|
332 | + public function desc($pretty = false) { |
|
333 | + return $pretty ? $this->get_pretty('QST_desc') : $this->get('QST_desc'); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * @throws \EE_Error |
344 | 344 | */ |
345 | 345 | public function html_name() { |
346 | - return $this->get( 'QST_html_name' ); |
|
346 | + return $this->get('QST_html_name'); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @throws \EE_Error |
357 | 357 | */ |
358 | 358 | public function html_id() { |
359 | - return $this->get( 'QST_html_id' ); |
|
359 | + return $this->get('QST_html_id'); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * @throws \EE_Error |
370 | 370 | */ |
371 | 371 | public function html_class() { |
372 | - return $this->get( 'QST_html_class' ); |
|
372 | + return $this->get('QST_html_class'); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | * @throws \EE_Error |
383 | 383 | */ |
384 | 384 | public function html_content() { |
385 | - return $this->get( 'QST_html_content' ); |
|
385 | + return $this->get('QST_html_content'); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @throws \EE_Error |
397 | 397 | */ |
398 | 398 | public function html_label_id() { |
399 | - return $this->get( 'QST_html_label_id' ); |
|
399 | + return $this->get('QST_html_label_id'); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @throws \EE_Error |
411 | 411 | */ |
412 | 412 | public function html_label_class() { |
413 | - return $this->get( 'QST_html_label_class' ); |
|
413 | + return $this->get('QST_html_label_class'); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @throws \EE_Error |
428 | 428 | */ |
429 | 429 | public function validation_strategies() { |
430 | - return $this->get( 'QST_validation_strategies' ); |
|
430 | + return $this->get('QST_validation_strategies'); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -440,9 +440,9 @@ discard block |
||
440 | 440 | * @return bool |
441 | 441 | * @throws \EE_Error |
442 | 442 | */ |
443 | - public function has_validation_strategy( $validation_strategy = '' ) { |
|
444 | - $validations = $this->get( 'QST_validation_strategies' ); |
|
445 | - return isset( $validations[ $validation_strategy ] ) ? true : false; |
|
443 | + public function has_validation_strategy($validation_strategy = '') { |
|
444 | + $validations = $this->get('QST_validation_strategies'); |
|
445 | + return isset($validations[$validation_strategy]) ? true : false; |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | * @throws \EE_Error |
456 | 456 | */ |
457 | 457 | public function validation_message() { |
458 | - return $this->get( 'QST_validation_message' ); |
|
458 | + return $this->get('QST_validation_message'); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | * @throws \EE_Error |
469 | 469 | */ |
470 | 470 | public function type() { |
471 | - return $this->get( 'QST_type' ); |
|
471 | + return $this->get('QST_type'); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * @throws \EE_Error |
483 | 483 | */ |
484 | 484 | public function order() { |
485 | - return $this->get( 'QST_order' ); |
|
485 | + return $this->get('QST_order'); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @throws \EE_Error |
497 | 497 | */ |
498 | 498 | public function admin_only() { |
499 | - return $this->get( 'QST_admin_only' ); |
|
499 | + return $this->get('QST_admin_only'); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | * @throws \EE_Error |
510 | 510 | */ |
511 | 511 | public function wp_user() { |
512 | - return $this->get( 'QST_wp_user' ); |
|
512 | + return $this->get('QST_wp_user'); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | * @throws \EE_Error |
523 | 523 | */ |
524 | 524 | public function deleted() { |
525 | - return $this->get( 'QST_deleted' ); |
|
525 | + return $this->get('QST_deleted'); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @throws \EE_Error |
535 | 535 | */ |
536 | 536 | public function answers() { |
537 | - return $this->get_many_related( 'Answer' ); |
|
537 | + return $this->get_many_related('Answer'); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | * @return boolean true = has answers, false = no answers. |
545 | 545 | */ |
546 | 546 | public function has_answers() { |
547 | - return $this->count_related( 'Answer' ) > 0 ? TRUE : FALSE; |
|
547 | + return $this->count_related('Answer') > 0 ? TRUE : FALSE; |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * @throws \EE_Error |
557 | 557 | */ |
558 | 558 | public function question_groups() { |
559 | - return $this->get_many_related( 'Question_Group' ); |
|
559 | + return $this->get_many_related('Question_Group'); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | |
@@ -573,24 +573,24 @@ discard block |
||
573 | 573 | * @return EE_Question_Option[] |
574 | 574 | * @throws \EE_Error |
575 | 575 | */ |
576 | - public function options( $notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL ) { |
|
577 | - if ( ! $this->ID() ) { |
|
576 | + public function options($notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL) { |
|
577 | + if ( ! $this->ID()) { |
|
578 | 578 | return array(); |
579 | 579 | } |
580 | 580 | $query_params = array(); |
581 | - if ( $selected_value_to_always_include ) { |
|
582 | - if ( is_array( $selected_value_to_always_include ) ) { |
|
583 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_value' ] = array( 'IN', $selected_value_to_always_include ); |
|
581 | + if ($selected_value_to_always_include) { |
|
582 | + if (is_array($selected_value_to_always_include)) { |
|
583 | + $query_params[0]['OR*options-query']['QSO_value'] = array('IN', $selected_value_to_always_include); |
|
584 | 584 | } else { |
585 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_value' ] = $selected_value_to_always_include; |
|
585 | + $query_params[0]['OR*options-query']['QSO_value'] = $selected_value_to_always_include; |
|
586 | 586 | } |
587 | 587 | } |
588 | - if ( $notDeletedOptionsOnly ) { |
|
589 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_deleted' ] = FALSE; |
|
588 | + if ($notDeletedOptionsOnly) { |
|
589 | + $query_params[0]['OR*options-query']['QSO_deleted'] = FALSE; |
|
590 | 590 | } |
591 | 591 | //order by QSO_order |
592 | - $query_params[ 'order_by' ] = array( 'QSO_order' => 'ASC' ); |
|
593 | - return $this->get_many_related( 'Question_Option', $query_params ); |
|
592 | + $query_params['order_by'] = array('QSO_order' => 'ASC'); |
|
593 | + return $this->get_many_related('Question_Option', $query_params); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | * @return \EE_Question_Option[] |
601 | 601 | */ |
602 | 602 | public function temp_options() { |
603 | - return $this->_model_relations[ 'Question_Option' ]; |
|
603 | + return $this->_model_relations['Question_Option']; |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | * @return boolean success |
614 | 614 | * @throws \EE_Error |
615 | 615 | */ |
616 | - public function add_option( EE_Question_Option $option ) { |
|
617 | - return $this->_add_relation_to( $option, 'Question_Option' ); |
|
616 | + public function add_option(EE_Question_Option $option) { |
|
617 | + return $this->_add_relation_to($option, 'Question_Option'); |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | |
@@ -624,8 +624,8 @@ discard block |
||
624 | 624 | * @param EE_Question_Option $option |
625 | 625 | * @return boolean success |
626 | 626 | */ |
627 | - public function add_temp_option( EE_Question_Option $option ) { |
|
628 | - $this->_model_relations[ 'Question_Option' ][ ] = $option; |
|
627 | + public function add_temp_option(EE_Question_Option $option) { |
|
628 | + $this->_model_relations['Question_Option'][] = $option; |
|
629 | 629 | return TRUE; |
630 | 630 | } |
631 | 631 | |
@@ -638,8 +638,8 @@ discard block |
||
638 | 638 | * @return boolean success |
639 | 639 | * @throws \EE_Error |
640 | 640 | */ |
641 | - public function remove_option( EE_Question_Option $option ) { |
|
642 | - return $this->_remove_relation_to( $option, 'Question_Option' ); |
|
641 | + public function remove_option(EE_Question_Option $option) { |
|
642 | + return $this->_remove_relation_to($option, 'Question_Option'); |
|
643 | 643 | } |
644 | 644 | |
645 | 645 | |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | * @throws \EE_Error |
650 | 650 | */ |
651 | 651 | public function is_system_question() { |
652 | - $system_ID = $this->get( 'QST_system' ); |
|
653 | - return ! empty( $system_ID ) ? TRUE : FALSE; |
|
652 | + $system_ID = $this->get('QST_system'); |
|
653 | + return ! empty($system_ID) ? TRUE : FALSE; |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | |
@@ -663,8 +663,8 @@ discard block |
||
663 | 663 | */ |
664 | 664 | public function set_order_to_latest() { |
665 | 665 | $latest_order = $this->get_model()->get_latest_question_order(); |
666 | - $latest_order ++; |
|
667 | - $this->set( 'QST_order', $latest_order ); |
|
666 | + $latest_order++; |
|
667 | + $this->set('QST_order', $latest_order); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | |
@@ -688,20 +688,20 @@ discard block |
||
688 | 688 | * @return \EE_Question |
689 | 689 | * @throws \EE_Error |
690 | 690 | */ |
691 | - public function duplicate( $options = array() ) { |
|
691 | + public function duplicate($options = array()) { |
|
692 | 692 | $new_question = clone $this; |
693 | - $new_question->set( 'QST_ID', null ); |
|
694 | - $new_question->set_display_text( sprintf( __( '%s **Duplicate**', 'event_espresso' ), $this->display_text() ) ); |
|
695 | - $new_question->set_admin_label( sprintf( __( '%s **Duplicate**', 'event_espresso' ), $this->admin_label() ) ); |
|
696 | - $new_question->set_system_ID( null ); |
|
697 | - $new_question->set_wp_user( get_current_user_id() ); |
|
693 | + $new_question->set('QST_ID', null); |
|
694 | + $new_question->set_display_text(sprintf(__('%s **Duplicate**', 'event_espresso'), $this->display_text())); |
|
695 | + $new_question->set_admin_label(sprintf(__('%s **Duplicate**', 'event_espresso'), $this->admin_label())); |
|
696 | + $new_question->set_system_ID(null); |
|
697 | + $new_question->set_wp_user(get_current_user_id()); |
|
698 | 698 | //if we're duplicating a trashed question, assume we don't want the new one to be trashed |
699 | - $new_question->set_deleted( false ); |
|
699 | + $new_question->set_deleted(false); |
|
700 | 700 | $success = $new_question->save(); |
701 | - if( $success ) { |
|
701 | + if ($success) { |
|
702 | 702 | //we don't totally want to duplicate the question options, because we want them to be for the NEW question |
703 | - foreach( $this->options() as $question_option ) { |
|
704 | - $question_option->duplicate( array( 'QST_ID' => $new_question->ID() ) ); |
|
703 | + foreach ($this->options() as $question_option) { |
|
704 | + $question_option->duplicate(array('QST_ID' => $new_question->ID())); |
|
705 | 705 | } |
706 | 706 | return $new_question; |
707 | 707 | } else { |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | * @throws \EE_Error |
719 | 719 | */ |
720 | 720 | public function max() { |
721 | - return $this->get( 'QST_max' ); |
|
721 | + return $this->get('QST_max'); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | * @return void |
731 | 731 | * @throws \EE_Error |
732 | 732 | */ |
733 | - public function set_max( $new_max ) { |
|
734 | - $this->set( 'QST_max', $new_max ); |
|
733 | + public function set_max($new_max) { |
|
734 | + $this->set('QST_max', $new_max); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | * @return EE_Form_Input_Base |
746 | 746 | * @throws \EE_Error |
747 | 747 | */ |
748 | - public function generate_form_input( $registration = null, $answer = null, $input_constructor_args = array() ) { |
|
748 | + public function generate_form_input($registration = null, $answer = null, $input_constructor_args = array()) { |
|
749 | 749 | $identifier = $this->is_system_question() ? $this->system_ID() : $this->ID(); |
750 | 750 | |
751 | 751 | $input_constructor_args = array_merge( |
@@ -756,27 +756,27 @@ discard block |
||
756 | 756 | ), |
757 | 757 | $input_constructor_args |
758 | 758 | ); |
759 | - if( ! $answer instanceof EE_Answer && $registration instanceof EE_Registration ) { |
|
760 | - $answer = EEM_Answer::instance()->get_registration_question_answer_object( $registration, $this->ID() ); |
|
759 | + if ( ! $answer instanceof EE_Answer && $registration instanceof EE_Registration) { |
|
760 | + $answer = EEM_Answer::instance()->get_registration_question_answer_object($registration, $this->ID()); |
|
761 | 761 | } |
762 | 762 | // has this question been answered ? |
763 | - if ( $answer instanceof EE_Answer ) { |
|
763 | + if ($answer instanceof EE_Answer) { |
|
764 | 764 | //answer gets htmlspecialchars called on it, undo that please |
765 | 765 | //because the form input's display strategy may call esc_attr too |
766 | 766 | //which also does html special characters |
767 | 767 | $values_with_html_special_chars = $answer->value(); |
768 | - if( is_array( $values_with_html_special_chars ) ) { |
|
769 | - $default_value = array_map( 'htmlspecialchars_decode', $values_with_html_special_chars ); |
|
768 | + if (is_array($values_with_html_special_chars)) { |
|
769 | + $default_value = array_map('htmlspecialchars_decode', $values_with_html_special_chars); |
|
770 | 770 | } else { |
771 | - $default_value = htmlspecialchars_decode( $values_with_html_special_chars ); |
|
771 | + $default_value = htmlspecialchars_decode($values_with_html_special_chars); |
|
772 | 772 | } |
773 | 773 | $input_constructor_args['default'] = $default_value; |
774 | 774 | } |
775 | - $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question( $this->system_ID() ); |
|
776 | - if( EEM_Question::instance()->question_type_is_in_category( $this->type(), 'text' ) ) { |
|
777 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Max_Length_Validation_Strategy( |
|
775 | + $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question($this->system_ID()); |
|
776 | + if (EEM_Question::instance()->question_type_is_in_category($this->type(), 'text')) { |
|
777 | + $input_constructor_args['validation_strategies'][] = new EE_Max_Length_Validation_Strategy( |
|
778 | 778 | null, |
779 | - min( $max_max_for_question, $this->max() ) |
|
779 | + min($max_max_for_question, $this->max()) |
|
780 | 780 | ); |
781 | 781 | } |
782 | 782 | $input_constructor_args = (array) apply_filters( |
@@ -788,22 +788,22 @@ discard block |
||
788 | 788 | ); |
789 | 789 | |
790 | 790 | $result = null; |
791 | - switch ( $this->type() ) { |
|
791 | + switch ($this->type()) { |
|
792 | 792 | // Text |
793 | 793 | case EEM_Question::QST_type_text : |
794 | - $result = new EE_Text_Input( $input_constructor_args ); |
|
794 | + $result = new EE_Text_Input($input_constructor_args); |
|
795 | 795 | break; |
796 | 796 | // Textarea |
797 | 797 | case EEM_Question::QST_type_textarea : |
798 | - $result = new EE_Text_Area_Input( $input_constructor_args ); |
|
798 | + $result = new EE_Text_Area_Input($input_constructor_args); |
|
799 | 799 | break; |
800 | 800 | // Radio Buttons |
801 | 801 | case EEM_Question::QST_type_radio : |
802 | - $result = new EE_Radio_Button_Input( $this->options(), $input_constructor_args ); |
|
802 | + $result = new EE_Radio_Button_Input($this->options(), $input_constructor_args); |
|
803 | 803 | break; |
804 | 804 | // Dropdown |
805 | 805 | case EEM_Question::QST_type_dropdown : |
806 | - $result = new EE_Select_Input( $this->options(), $input_constructor_args ); |
|
806 | + $result = new EE_Select_Input($this->options(), $input_constructor_args); |
|
807 | 807 | break; |
808 | 808 | // State Dropdown |
809 | 809 | case EEM_Question::QST_type_state : |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | $registration, |
815 | 815 | $answer |
816 | 816 | ); |
817 | - $result = new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
817 | + $result = new EE_State_Select_Input($state_options, $input_constructor_args); |
|
818 | 818 | break; |
819 | 819 | // Country Dropdown |
820 | 820 | case EEM_Question::QST_type_country : |
@@ -825,49 +825,49 @@ discard block |
||
825 | 825 | $registration, |
826 | 826 | $answer |
827 | 827 | ); |
828 | - $result = new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
828 | + $result = new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
829 | 829 | break; |
830 | 830 | // Checkboxes |
831 | 831 | case EEM_Question::QST_type_checkbox : |
832 | - $result = new EE_Checkbox_Multi_Input( $this->options(), $input_constructor_args ); |
|
832 | + $result = new EE_Checkbox_Multi_Input($this->options(), $input_constructor_args); |
|
833 | 833 | break; |
834 | 834 | // Date |
835 | 835 | case EEM_Question::QST_type_date : |
836 | - $result = new EE_Datepicker_Input( $input_constructor_args ); |
|
836 | + $result = new EE_Datepicker_Input($input_constructor_args); |
|
837 | 837 | break; |
838 | 838 | case EEM_Question::QST_type_html_textarea : |
839 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
840 | - $result = new EE_Text_Area_Input( $input_constructor_args ); |
|
841 | - $result->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
839 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
840 | + $result = new EE_Text_Area_Input($input_constructor_args); |
|
841 | + $result->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
842 | 842 | break; |
843 | 843 | case EEM_Question::QST_type_email : |
844 | - $result = new EE_Email_Input( $input_constructor_args ); |
|
844 | + $result = new EE_Email_Input($input_constructor_args); |
|
845 | 845 | break; |
846 | 846 | case EEM_Question::QST_type_us_phone : |
847 | - $result = new EE_Phone_Input( $input_constructor_args ); |
|
847 | + $result = new EE_Phone_Input($input_constructor_args); |
|
848 | 848 | break; |
849 | 849 | case EEM_Question::QST_type_int : |
850 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Int_Validation_Strategy(); |
|
851 | - $result = new EE_Text_Input( $input_constructor_args ); |
|
850 | + $input_constructor_args['validation_strategies'][] = new EE_Int_Validation_Strategy(); |
|
851 | + $result = new EE_Text_Input($input_constructor_args); |
|
852 | 852 | break; |
853 | 853 | case EEM_Question::QST_type_decimal : |
854 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Float_Validation_Strategy(); |
|
855 | - $result = new EE_Text_Input( $input_constructor_args ); |
|
854 | + $input_constructor_args['validation_strategies'][] = new EE_Float_Validation_Strategy(); |
|
855 | + $result = new EE_Text_Input($input_constructor_args); |
|
856 | 856 | break; |
857 | 857 | case EEM_Question::QST_type_url : |
858 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_URL_Validation_Strategy(); |
|
859 | - $result = new EE_Text_Input( $input_constructor_args ); |
|
858 | + $input_constructor_args['validation_strategies'][] = new EE_URL_Validation_Strategy(); |
|
859 | + $result = new EE_Text_Input($input_constructor_args); |
|
860 | 860 | break; |
861 | 861 | case EEM_Question::QST_type_year : |
862 | 862 | $result = new EE_Year_Input( |
863 | 863 | $input_constructor_args, |
864 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__four_digit', true, $this ), |
|
865 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__early_range', 100, $this ), |
|
866 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__end_range', 100, $this ) |
|
864 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__four_digit', true, $this), |
|
865 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__early_range', 100, $this), |
|
866 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__end_range', 100, $this) |
|
867 | 867 | ); |
868 | 868 | break; |
869 | 869 | case EEM_Question::QST_type_multi_select : |
870 | - $result = new EE_Select_Multiple_Input( $this->options(), $input_constructor_args ); |
|
870 | + $result = new EE_Select_Multiple_Input($this->options(), $input_constructor_args); |
|
871 | 871 | break; |
872 | 872 | // fallback |
873 | 873 | default : |
@@ -878,12 +878,12 @@ discard block |
||
878 | 878 | $this, |
879 | 879 | $input_constructor_args |
880 | 880 | ); |
881 | - if( ! $default_input ){ |
|
882 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
881 | + if ( ! $default_input) { |
|
882 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
883 | 883 | } |
884 | 884 | $result = $default_input; |
885 | 885 | } |
886 | - return apply_filters( 'FHEE__EE_Question__generate_form_input__return', $result, $registration, $this, $answer ); |
|
886 | + return apply_filters('FHEE__EE_Question__generate_form_input__return', $result, $registration, $this, $answer); |
|
887 | 887 | } |
888 | 888 | |
889 | 889 | |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | * @throws \EE_Error |
896 | 896 | */ |
897 | 897 | public function get_form_input_class_name() { |
898 | - switch ( $this->type() ) { |
|
898 | + switch ($this->type()) { |
|
899 | 899 | case EEM_Question::QST_type_textarea : |
900 | 900 | case EEM_Question::QST_type_html_textarea : |
901 | 901 | return 'EE_Text_Area_Input'; |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | * @throws \EE_Error |
936 | 936 | */ |
937 | 937 | public function required() { |
938 | - return $this->has_validation_strategy( 'required' ); |
|
938 | + return $this->has_validation_strategy('required'); |
|
939 | 939 | } |
940 | 940 | |
941 | 941 |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | * Question, that relationship will be overwritten. |
611 | 611 | * |
612 | 612 | * @param EE_Question_Option $option |
613 | - * @return boolean success |
|
613 | + * @return EE_Base_Class success |
|
614 | 614 | * @throws \EE_Error |
615 | 615 | */ |
616 | 616 | public function add_option( EE_Question_Option $option ) { |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * Marks the option as deleted. |
636 | 636 | * |
637 | 637 | * @param EE_Question_Option $option |
638 | - * @return boolean success |
|
638 | + * @return EE_Base_Class success |
|
639 | 639 | * @throws \EE_Error |
640 | 640 | */ |
641 | 641 | public function remove_option( EE_Question_Option $option ) { |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | -require_once( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
5 | -require_once( EE_CLASSES . 'EE_Question.class.php' ); |
|
4 | +require_once(EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
5 | +require_once(EE_CLASSES.'EE_Question.class.php'); |
|
6 | 6 | |
7 | 7 | |
8 | 8 | |
@@ -107,54 +107,54 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @param null $timezone |
109 | 109 | */ |
110 | - protected function __construct( $timezone = NULL ) { |
|
111 | - $this->singular_item = __('Question','event_espresso'); |
|
112 | - $this->plural_item = __('Questions','event_espresso'); |
|
113 | - $this->_allowed_question_types=apply_filters( |
|
110 | + protected function __construct($timezone = NULL) { |
|
111 | + $this->singular_item = __('Question', 'event_espresso'); |
|
112 | + $this->plural_item = __('Questions', 'event_espresso'); |
|
113 | + $this->_allowed_question_types = apply_filters( |
|
114 | 114 | 'FHEE__EEM_Question__construct__allowed_question_types', |
115 | 115 | array( |
116 | - EEM_Question::QST_type_text =>__('Text','event_espresso'), |
|
117 | - EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'), |
|
118 | - EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'), |
|
119 | - EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'), |
|
120 | - EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'), |
|
121 | - EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'), |
|
122 | - EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'), |
|
123 | - EEM_Question::QST_type_date =>__('Date Picker','event_espresso'), |
|
124 | - EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ), |
|
125 | - EEM_Question::QST_type_email => __( 'Email', 'event_espresso' ), |
|
126 | - EEM_Question::QST_type_us_phone => __( 'USA - Format Phone', 'event_espresso' ), |
|
127 | - EEM_Question::QST_type_decimal => __( 'Number', 'event_espresso' ), |
|
128 | - EEM_Question::QST_type_int => __( 'Whole Number', 'event_espresso' ), |
|
129 | - EEM_Question::QST_type_url => __( 'URL', 'event_espresso' ), |
|
130 | - EEM_Question::QST_type_year => __( 'Year', 'event_espresso' ), |
|
131 | - EEM_Question::QST_type_multi_select => __( 'Multi Select', 'event_espresso' ), |
|
132 | - EEM_Question::QST_type_ajax_select => __( 'AJAX Select', 'event_espresso' ), |
|
116 | + EEM_Question::QST_type_text =>__('Text', 'event_espresso'), |
|
117 | + EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'), |
|
118 | + EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'), |
|
119 | + EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'), |
|
120 | + EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'), |
|
121 | + EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'), |
|
122 | + EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'), |
|
123 | + EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'), |
|
124 | + EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'), |
|
125 | + EEM_Question::QST_type_email => __('Email', 'event_espresso'), |
|
126 | + EEM_Question::QST_type_us_phone => __('USA - Format Phone', 'event_espresso'), |
|
127 | + EEM_Question::QST_type_decimal => __('Number', 'event_espresso'), |
|
128 | + EEM_Question::QST_type_int => __('Whole Number', 'event_espresso'), |
|
129 | + EEM_Question::QST_type_url => __('URL', 'event_espresso'), |
|
130 | + EEM_Question::QST_type_year => __('Year', 'event_espresso'), |
|
131 | + EEM_Question::QST_type_multi_select => __('Multi Select', 'event_espresso'), |
|
132 | + EEM_Question::QST_type_ajax_select => __('AJAX Select', 'event_espresso'), |
|
133 | 133 | ) |
134 | 134 | ); |
135 | 135 | $this->_question_descriptions = apply_filters( |
136 | 136 | 'FHEE__EEM_Question__construct__allowed_question_types', |
137 | 137 | array( |
138 | - EEM_Question::QST_type_text => __( 'A single line text input field', 'event_espresso' ), |
|
139 | - EEM_Question::QST_type_textarea => __( 'A multi line text input field', 'event_espresso' ), |
|
140 | - EEM_Question::QST_type_checkbox => __( 'Allows multiple preset options to be selected', 'event_espresso' ), |
|
141 | - EEM_Question::QST_type_radio => __( 'Allows a single preset option to be selected', 'event_espresso' ), |
|
142 | - EEM_Question::QST_type_dropdown => __( 'A dropdown that allows a single selection', 'event_espresso' ), |
|
143 | - EEM_Question::QST_type_state => __( 'A dropdown that lists states/provinces', 'event_espresso' ), |
|
144 | - EEM_Question::QST_type_country => __( 'A dropdown that lists countries', 'event_espresso' ), |
|
145 | - EEM_Question::QST_type_date => __( 'A popup calendar that allows date selections', 'event_espresso' ), |
|
146 | - EEM_Question::QST_type_html_textarea => __( 'A multi line text input field that allows HTML', 'event_espresso' ), |
|
147 | - EEM_Question::QST_type_email => __( 'A text field that must contain a valid Email address', 'event_espresso' ), |
|
148 | - EEM_Question::QST_type_us_phone => __( 'A text field that must contain a valid US phone number', 'event_espresso' ), |
|
149 | - EEM_Question::QST_type_decimal => __( 'A text field that allows number values with decimals', 'event_espresso' ), |
|
150 | - EEM_Question::QST_type_int => __( 'A text field that only allows whole numbers (no decimals)', 'event_espresso' ), |
|
151 | - EEM_Question::QST_type_url => __( 'A text field that must contain a valid URL', 'event_espresso' ), |
|
152 | - EEM_Question::QST_type_year => __( 'A dropdown that lists the last 100 years', 'event_espresso' ), |
|
153 | - EEM_Question::QST_type_multi_select => __( 'A dropdown that allows multiple selections', 'event_espresso' ), |
|
154 | - EEM_Question::QST_type_ajax_select => __( 'A dropdown that populates it\'s options dynamically via AJAX', 'event_espresso' ), |
|
138 | + EEM_Question::QST_type_text => __('A single line text input field', 'event_espresso'), |
|
139 | + EEM_Question::QST_type_textarea => __('A multi line text input field', 'event_espresso'), |
|
140 | + EEM_Question::QST_type_checkbox => __('Allows multiple preset options to be selected', 'event_espresso'), |
|
141 | + EEM_Question::QST_type_radio => __('Allows a single preset option to be selected', 'event_espresso'), |
|
142 | + EEM_Question::QST_type_dropdown => __('A dropdown that allows a single selection', 'event_espresso'), |
|
143 | + EEM_Question::QST_type_state => __('A dropdown that lists states/provinces', 'event_espresso'), |
|
144 | + EEM_Question::QST_type_country => __('A dropdown that lists countries', 'event_espresso'), |
|
145 | + EEM_Question::QST_type_date => __('A popup calendar that allows date selections', 'event_espresso'), |
|
146 | + EEM_Question::QST_type_html_textarea => __('A multi line text input field that allows HTML', 'event_espresso'), |
|
147 | + EEM_Question::QST_type_email => __('A text field that must contain a valid Email address', 'event_espresso'), |
|
148 | + EEM_Question::QST_type_us_phone => __('A text field that must contain a valid US phone number', 'event_espresso'), |
|
149 | + EEM_Question::QST_type_decimal => __('A text field that allows number values with decimals', 'event_espresso'), |
|
150 | + EEM_Question::QST_type_int => __('A text field that only allows whole numbers (no decimals)', 'event_espresso'), |
|
151 | + EEM_Question::QST_type_url => __('A text field that must contain a valid URL', 'event_espresso'), |
|
152 | + EEM_Question::QST_type_year => __('A dropdown that lists the last 100 years', 'event_espresso'), |
|
153 | + EEM_Question::QST_type_multi_select => __('A dropdown that allows multiple selections', 'event_espresso'), |
|
154 | + EEM_Question::QST_type_ajax_select => __('A dropdown that populates it\'s options dynamically via AJAX', 'event_espresso'), |
|
155 | 155 | ) |
156 | 156 | ); |
157 | - $this->_question_type_categories = (array)apply_filters( |
|
157 | + $this->_question_type_categories = (array) apply_filters( |
|
158 | 158 | 'FHEE__EEM_Question__construct__question_type_categories', |
159 | 159 | array( |
160 | 160 | 'text' => array( |
@@ -180,33 +180,33 @@ discard block |
||
180 | 180 | ); |
181 | 181 | |
182 | 182 | $this->_tables = array( |
183 | - 'Question'=>new EE_Primary_Table('esp_question','QST_ID') |
|
183 | + 'Question'=>new EE_Primary_Table('esp_question', 'QST_ID') |
|
184 | 184 | ); |
185 | 185 | $this->_fields = array( |
186 | 186 | 'Question'=>array( |
187 | - 'QST_ID'=> new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')), |
|
188 | - 'QSG_ID' => new EE_Foreign_Key_Int_Field('QSG_ID',__( 'Question Group ID', 'event_espresso' ),false,0,'Question_Group'), |
|
189 | - 'QST_admin_label' => new EE_Plain_Text_Field('QST_admin_label',__( 'Question Label (admin-only)', 'event_espresso' ),true,''), |
|
190 | - 'QST_display_text'=> new EE_Post_Content_Field('QST_display_text', __('Question Text','event_espresso'), true, ''), |
|
191 | - 'QST_identifier'=> new EE_Plain_Text_Field('QST_identifier', __('Internal string ID for question','event_espresso'), TRUE, NULL ), |
|
192 | - 'QST_system'=> new EE_Plain_Text_Field('QST_system', __('System Question type ID','event_espresso'), TRUE, NULL ), |
|
193 | - 'QST_type'=> new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types), |
|
194 | - 'QST_required'=> new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false), |
|
195 | - 'QST_required_text'=> new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''), |
|
196 | - 'QST_desc'=> new EE_Full_HTML_Field('QST_desc', __( 'Description of Question', 'event_espresso' ), true, ''), |
|
197 | - 'QST_html_name' => new EE_Plain_Text_Field('QST_html_name',__( 'HTML name property', 'event_espresso' ),true,null), |
|
198 | - 'QST_html_id' => new EE_Plain_Text_Field('QST_html_id',__( 'HTML CSS "id" property', 'event_espresso' ),true,null), |
|
199 | - 'QST_html_class' => new EE_Plain_Text_Field('QST_html_class',__( 'HTML CSS "class" property', 'event_espresso' ),true,null), |
|
200 | - 'QST_html_label_id' => new EE_Plain_Text_Field( 'QST_html_label_id', __( "HTML CSS \"id\" property for the Question's label", 'event_espresso' ), true, null), |
|
201 | - 'QST_html_label_class' => new EE_Plain_Text_Field( 'QST_html_label_class', __( "HTML CSS \"class\" property for the Question's label", 'event_espresso' ), true, null), |
|
202 | - 'QST_default_value' => new EE_Plain_Text_Field( 'QST_default_value', __( 'Default value for input', 'event_espresso' ), true, null), |
|
203 | - 'QST_validation_strategies'=> new EE_Plain_Text_Field('QST_validation_strategies', __('List of validations to be applied to Question.','event_espresso'), false, false), |
|
204 | - 'QST_validation_message'=> new EE_Simple_HTML_Field('QST_validation_message', __('Validation message to be displayed if this question fails to pass a validation check','event_espresso'), true, ''), |
|
205 | - 'QST_order'=> new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0), |
|
206 | - 'QST_admin_only'=> new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false), |
|
207 | - 'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso' ), false, EE_INF ), |
|
208 | - 'QST_wp_user'=> new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ), |
|
209 | - 'QST_deleted'=> new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false) |
|
187 | + 'QST_ID'=> new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), |
|
188 | + 'QSG_ID' => new EE_Foreign_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso'), false, 0, 'Question_Group'), |
|
189 | + 'QST_admin_label' => new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), |
|
190 | + 'QST_display_text'=> new EE_Post_Content_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), |
|
191 | + 'QST_identifier'=> new EE_Plain_Text_Field('QST_identifier', __('Internal string ID for question', 'event_espresso'), TRUE, NULL), |
|
192 | + 'QST_system'=> new EE_Plain_Text_Field('QST_system', __('System Question type ID', 'event_espresso'), TRUE, NULL), |
|
193 | + 'QST_type'=> new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), |
|
194 | + 'QST_required'=> new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), |
|
195 | + 'QST_required_text'=> new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), |
|
196 | + 'QST_desc'=> new EE_Full_HTML_Field('QST_desc', __('Description of Question', 'event_espresso'), true, ''), |
|
197 | + 'QST_html_name' => new EE_Plain_Text_Field('QST_html_name', __('HTML name property', 'event_espresso'), true, null), |
|
198 | + 'QST_html_id' => new EE_Plain_Text_Field('QST_html_id', __('HTML CSS "id" property', 'event_espresso'), true, null), |
|
199 | + 'QST_html_class' => new EE_Plain_Text_Field('QST_html_class', __('HTML CSS "class" property', 'event_espresso'), true, null), |
|
200 | + 'QST_html_label_id' => new EE_Plain_Text_Field('QST_html_label_id', __("HTML CSS \"id\" property for the Question's label", 'event_espresso'), true, null), |
|
201 | + 'QST_html_label_class' => new EE_Plain_Text_Field('QST_html_label_class', __("HTML CSS \"class\" property for the Question's label", 'event_espresso'), true, null), |
|
202 | + 'QST_default_value' => new EE_Plain_Text_Field('QST_default_value', __('Default value for input', 'event_espresso'), true, null), |
|
203 | + 'QST_validation_strategies'=> new EE_Plain_Text_Field('QST_validation_strategies', __('List of validations to be applied to Question.', 'event_espresso'), false, false), |
|
204 | + 'QST_validation_message'=> new EE_Simple_HTML_Field('QST_validation_message', __('Validation message to be displayed if this question fails to pass a validation check', 'event_espresso'), true, ''), |
|
205 | + 'QST_order'=> new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), |
|
206 | + 'QST_admin_only'=> new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), |
|
207 | + 'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF), |
|
208 | + 'QST_wp_user'=> new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), |
|
209 | + 'QST_deleted'=> new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false) |
|
210 | 210 | ) |
211 | 211 | ); |
212 | 212 | |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | 'Question_Group_Question' => new EE_Has_Many_Relation(), |
219 | 219 | ); |
220 | 220 | //this model is generally available for reading |
221 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
222 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
223 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
224 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
225 | - parent::__construct( $timezone ); |
|
221 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
222 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
223 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
224 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
225 | + parent::__construct($timezone); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * but they can be extended |
231 | 231 | * @return string[] |
232 | 232 | */ |
233 | - public function allowed_question_types(){ |
|
233 | + public function allowed_question_types() { |
|
234 | 234 | return $this->_allowed_question_types; |
235 | 235 | } |
236 | 236 | /** |
@@ -238,16 +238,16 @@ discard block |
||
238 | 238 | * @param string $question_type one of EEM_Question::allowed_question_types( |
239 | 239 | * @return string[] like EEM_Question::allowed_question_types() |
240 | 240 | */ |
241 | - public function question_types_in_same_category( $question_type ) { |
|
242 | - $question_types = array( $question_type ); |
|
243 | - foreach( $this->_question_type_categories as $category => $question_types_in_category ) { |
|
244 | - if( in_array( $question_type, $question_types_in_category ) ) { |
|
241 | + public function question_types_in_same_category($question_type) { |
|
242 | + $question_types = array($question_type); |
|
243 | + foreach ($this->_question_type_categories as $category => $question_types_in_category) { |
|
244 | + if (in_array($question_type, $question_types_in_category)) { |
|
245 | 245 | $question_types = $question_types_in_category; |
246 | 246 | break; |
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | - return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) ); |
|
250 | + return array_intersect_key($this->allowed_question_types(), array_flip($question_types)); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | * @param string $category one of the top-level keys of EEM_Question::question_type_categories() |
257 | 257 | * @return boolean |
258 | 258 | */ |
259 | - public function question_type_is_in_category( $question_type, $category ) { |
|
260 | - if( ! isset( $this->_question_type_categories[ $category ] ) ) { |
|
259 | + public function question_type_is_in_category($question_type, $category) { |
|
260 | + if ( ! isset($this->_question_type_categories[$category])) { |
|
261 | 261 | return false; |
262 | 262 | } |
263 | - return in_array( $question_type, $this->_question_type_categories[ $category ] ); |
|
263 | + return in_array($question_type, $this->_question_type_categories[$category]); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | * @param string $system_question_group_id QSG_system |
278 | 278 | * @return array of system question names (QST_system) |
279 | 279 | */ |
280 | - public function allowed_system_questions_in_system_question_group( $system_question_group_id ) { |
|
280 | + public function allowed_system_questions_in_system_question_group($system_question_group_id) { |
|
281 | 281 | $question_system_ids = array(); |
282 | - switch( $system_question_group_id ) { |
|
282 | + switch ($system_question_group_id) { |
|
283 | 283 | case EEM_Question_Group::system_personal: |
284 | 284 | $question_system_ids = array( |
285 | 285 | EEM_Attendee::system_question_fname, |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | ); |
301 | 301 | break; |
302 | 302 | } |
303 | - return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id ); |
|
303 | + return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | * @param string $system_question_group_id QSG_system |
310 | 310 | * @return array of system question names (QST_system) |
311 | 311 | */ |
312 | - public function required_system_questions_in_system_question_group( $system_question_group_id ) { |
|
312 | + public function required_system_questions_in_system_question_group($system_question_group_id) { |
|
313 | 313 | $question_system_ids = null; |
314 | - switch( $system_question_group_id ) { |
|
314 | + switch ($system_question_group_id) { |
|
315 | 315 | case EEM_Question_Group::system_personal: |
316 | - $question_system_ids = array( |
|
316 | + $question_system_ids = array( |
|
317 | 317 | EEM_Attendee::system_question_fname, |
318 | 318 | EEM_Attendee::system_question_email, |
319 | 319 | ); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | default: |
322 | 322 | $question_system_ids = array(); |
323 | 323 | } |
324 | - return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id ); |
|
324 | + return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | * @return int of QST_ID for the question that corresponds to that QST_system |
335 | 335 | * @throws \EE_Error |
336 | 336 | */ |
337 | - public function get_Question_ID_from_system_string( $QST_system ){ |
|
338 | - return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
|
337 | + public function get_Question_ID_from_system_string($QST_system) { |
|
338 | + return $this->get_var(array(array('QST_system' => $QST_system))); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | |
@@ -349,10 +349,10 @@ discard block |
||
349 | 349 | */ |
350 | 350 | public function get_latest_question_order() { |
351 | 351 | $columns_to_select = array( |
352 | - 'max_order' => array("MAX(QST_order)","%d") |
|
352 | + 'max_order' => array("MAX(QST_order)", "%d") |
|
353 | 353 | ); |
354 | - $max = (array) $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select ); |
|
355 | - return isset( $max[0], $max[0]['max_order'] ) ? $max[0]['max_order'] : 0; |
|
354 | + $max = (array) $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
355 | + return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -381,10 +381,10 @@ discard block |
||
381 | 381 | * @param string $system_question_value |
382 | 382 | * @return int|float |
383 | 383 | */ |
384 | - public function absolute_max_for_system_question( $system_question_value ) { |
|
384 | + public function absolute_max_for_system_question($system_question_value) { |
|
385 | 385 | $maxes = $this->system_question_maxes(); |
386 | - if( isset( $maxes[ $system_question_value ] ) ) { |
|
387 | - return $maxes[ $system_question_value ]; |
|
386 | + if (isset($maxes[$system_question_value])) { |
|
387 | + return $maxes[$system_question_value]; |
|
388 | 388 | } else { |
389 | 389 | return EE_INF; |
390 | 390 | } |
@@ -331,7 +331,7 @@ |
||
331 | 331 | * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city'); |
332 | 332 | * |
333 | 333 | * @param $QST_system |
334 | - * @return int of QST_ID for the question that corresponds to that QST_system |
|
334 | + * @return string of QST_ID for the question that corresponds to that QST_system |
|
335 | 335 | * @throws \EE_Error |
336 | 336 | */ |
337 | 337 | public function get_Question_ID_from_system_string( $QST_system ){ |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
3 | -require_once( EE_CLASSES . 'EE_Question_Group.class.php' ); |
|
2 | +require_once(EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
3 | +require_once(EE_CLASSES.'EE_Question_Group.class.php'); |
|
4 | 4 | |
5 | 5 | |
6 | 6 | |
@@ -26,30 +26,30 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @param null $timezone |
28 | 28 | */ |
29 | - protected function __construct( $timezone = NULL ) { |
|
29 | + protected function __construct($timezone = NULL) { |
|
30 | 30 | |
31 | - $this->singular_item = __('Question Group','event_espresso'); |
|
32 | - $this->plural_item = __('Question Groups','event_espresso'); |
|
31 | + $this->singular_item = __('Question Group', 'event_espresso'); |
|
32 | + $this->plural_item = __('Question Groups', 'event_espresso'); |
|
33 | 33 | |
34 | 34 | $this->_tables = array( |
35 | - 'Question_Group'=>new EE_Primary_Table('esp_question_group','QSG_ID') |
|
35 | + 'Question_Group'=>new EE_Primary_Table('esp_question_group', 'QSG_ID') |
|
36 | 36 | ); |
37 | 37 | |
38 | 38 | $this->_fields = array( |
39 | 39 | 'Question_Group'=>array( |
40 | - 'QSG_ID'=>new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID','event_espresso')), |
|
41 | - 'QSG_name'=>new EE_Plain_Text_Field('QSG_name', __('Question Group Name','event_espresso'), false, ''), |
|
42 | - 'QSG_identifier'=>new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group','event_espresso'), false, ''), |
|
43 | - 'QSG_desc'=>new EE_Post_Content_Field('QSG_desc', __('Description of Question Group','event_espresso'), true, ''), |
|
44 | - 'QSG_parent' => new EE_Integer_Field('QSG_parent',__('The Question Group that this is a child of.','event_espresso'),true,null), |
|
45 | - 'QSG_html_name' => new EE_Plain_Text_Field('QSG_html_name',__('Form Section Name','event_espresso'),true,null), |
|
46 | - 'QSG_html_id' => new EE_Plain_Text_Field('QSG_html_id',__('HTML CSS id for question Group','event_espresso'),true,null), |
|
47 | - 'QSG_html_class' => new EE_Plain_Text_Field('QSG_html_class',__('HTML CSS class for question Group','event_espresso'),true,null), |
|
48 | - 'QSG_html_content' => new EE_Plain_Text_Field('QSG_html_content',__('Actual content if this is an HTML Form Section','event_espresso'),true,null), |
|
49 | - 'QSG_order'=>new EE_Integer_Field('QSG_order', __('Order in which to show the question group','event_espresso'), true, 0), |
|
50 | - 'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE ), |
|
51 | - 'QSG_system'=>new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.','event_espresso'), false, 0), |
|
52 | - 'QSG_deleted'=>new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted','event_espresso'), false, false) |
|
40 | + 'QSG_ID'=>new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso')), |
|
41 | + 'QSG_name'=>new EE_Plain_Text_Field('QSG_name', __('Question Group Name', 'event_espresso'), false, ''), |
|
42 | + 'QSG_identifier'=>new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group', 'event_espresso'), false, ''), |
|
43 | + 'QSG_desc'=>new EE_Post_Content_Field('QSG_desc', __('Description of Question Group', 'event_espresso'), true, ''), |
|
44 | + 'QSG_parent' => new EE_Integer_Field('QSG_parent', __('The Question Group that this is a child of.', 'event_espresso'), true, null), |
|
45 | + 'QSG_html_name' => new EE_Plain_Text_Field('QSG_html_name', __('Form Section Name', 'event_espresso'), true, null), |
|
46 | + 'QSG_html_id' => new EE_Plain_Text_Field('QSG_html_id', __('HTML CSS id for question Group', 'event_espresso'), true, null), |
|
47 | + 'QSG_html_class' => new EE_Plain_Text_Field('QSG_html_class', __('HTML CSS class for question Group', 'event_espresso'), true, null), |
|
48 | + 'QSG_html_content' => new EE_Plain_Text_Field('QSG_html_content', __('Actual content if this is an HTML Form Section', 'event_espresso'), true, null), |
|
49 | + 'QSG_order'=>new EE_Integer_Field('QSG_order', __('Order in which to show the question group', 'event_espresso'), true, 0), |
|
50 | + 'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE), |
|
51 | + 'QSG_system'=>new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.', 'event_espresso'), false, 0), |
|
52 | + 'QSG_deleted'=>new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted', 'event_espresso'), false, false) |
|
53 | 53 | ) |
54 | 54 | ); |
55 | 55 | |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | ); |
62 | 62 | |
63 | 63 | //this model is generally available for reading |
64 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
65 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
66 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
67 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
68 | - parent::__construct( $timezone ); |
|
64 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
65 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
66 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
67 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
68 | + parent::__construct($timezone); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | array(), |
84 | 84 | ARRAY_A, |
85 | 85 | array( |
86 | - 'max_order' => array( "MAX(QSG_order)", "%d" ), |
|
86 | + 'max_order' => array("MAX(QSG_order)", "%d"), |
|
87 | 87 | ) |
88 | 88 | ); |
89 | - return is_array( $max ) && isset( $max[0], $max[0]['max_order'] ) ? $max[0]['max_order'] : 0; |
|
89 | + return is_array($max) && isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 |
@@ -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 | require_once( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
3 | 5 | require_once( EE_CLASSES . 'EE_Question_Group.class.php' ); |
4 | 6 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * EEH_Activation Helper |
4 | 4 | * |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | * @param $table_name |
49 | 49 | * @return string |
50 | 50 | */ |
51 | - public static function ensure_table_name_has_prefix( $table_name ) { |
|
51 | + public static function ensure_table_name_has_prefix($table_name) { |
|
52 | 52 | global $wpdb; |
53 | - return strpos( $table_name, $wpdb->base_prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name; |
|
53 | + return strpos($table_name, $wpdb->base_prefix) === 0 ? $table_name : $wpdb->prefix.$table_name; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return boolean success, whether the database and folders are setup properly |
79 | 79 | * @throws \EE_Error |
80 | 80 | */ |
81 | - public static function initialize_db_and_folders(){ |
|
81 | + public static function initialize_db_and_folders() { |
|
82 | 82 | $good_filesystem = EEH_Activation::create_upload_directories(); |
83 | 83 | $good_db = EEH_Activation::create_database_tables(); |
84 | 84 | return $good_filesystem && $good_db; |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @throws \EE_Error |
96 | 96 | */ |
97 | - public static function initialize_db_content(){ |
|
97 | + public static function initialize_db_content() { |
|
98 | 98 | //let's avoid doing all this logic repeatedly, especially when addons are requesting it |
99 | - if( EEH_Activation::$_initialized_db_content_already_in_this_request ) { |
|
99 | + if (EEH_Activation::$_initialized_db_content_already_in_this_request) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | EEH_Activation::$_initialized_db_content_already_in_this_request = true; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | EEH_Activation::remove_cron_tasks(); |
114 | 114 | EEH_Activation::create_cron_tasks(); |
115 | 115 | // remove all TXN locks since that is being done via extra meta now |
116 | - delete_option( 'ee_locked_transactions' ); |
|
116 | + delete_option('ee_locked_transactions'); |
|
117 | 117 | //also, check for CAF default db content |
118 | - do_action( 'AHEE__EEH_Activation__initialize_db_content' ); |
|
118 | + do_action('AHEE__EEH_Activation__initialize_db_content'); |
|
119 | 119 | //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages |
120 | 120 | //which users really won't care about on initial activation |
121 | 121 | EE_Error::overwrite_success(); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @return array |
136 | 136 | * @throws \EE_Error |
137 | 137 | */ |
138 | - public static function get_cron_tasks( $which_to_include ) { |
|
138 | + public static function get_cron_tasks($which_to_include) { |
|
139 | 139 | $cron_tasks = apply_filters( |
140 | 140 | 'FHEE__EEH_Activation__get_cron_tasks', |
141 | 141 | array( |
@@ -144,16 +144,16 @@ discard block |
||
144 | 144 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates |
145 | 145 | ) |
146 | 146 | ); |
147 | - if ( $which_to_include === 'old' ) { |
|
147 | + if ($which_to_include === 'old') { |
|
148 | 148 | $cron_tasks = array_filter( |
149 | 149 | $cron_tasks, |
150 | - function ( $value ) { |
|
150 | + function($value) { |
|
151 | 151 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
152 | 152 | } |
153 | 153 | ); |
154 | - } elseif ( $which_to_include === 'current' ) { |
|
155 | - $cron_tasks = array_filter( $cron_tasks ); |
|
156 | - } elseif ( WP_DEBUG && $which_to_include !== 'all' ) { |
|
154 | + } elseif ($which_to_include === 'current') { |
|
155 | + $cron_tasks = array_filter($cron_tasks); |
|
156 | + } elseif (WP_DEBUG && $which_to_include !== 'all') { |
|
157 | 157 | throw new EE_Error( |
158 | 158 | sprintf( |
159 | 159 | __( |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public static function create_cron_tasks() { |
178 | 178 | |
179 | - foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) { |
|
180 | - if( ! wp_next_scheduled( $hook_name ) ) { |
|
181 | - wp_schedule_event( time(), $frequency, $hook_name ); |
|
179 | + foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) { |
|
180 | + if ( ! wp_next_scheduled($hook_name)) { |
|
181 | + wp_schedule_event(time(), $frequency, $hook_name); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones |
193 | 193 | * @throws \EE_Error |
194 | 194 | */ |
195 | - public static function remove_cron_tasks( $remove_all = true ) { |
|
195 | + public static function remove_cron_tasks($remove_all = true) { |
|
196 | 196 | $cron_tasks_to_remove = $remove_all ? 'all' : 'old'; |
197 | 197 | $crons = _get_cron_array(); |
198 | - $crons = is_array( $crons ) ? $crons : array(); |
|
198 | + $crons = is_array($crons) ? $crons : array(); |
|
199 | 199 | /* reminder of what $crons look like: |
200 | 200 | * Top-level keys are timestamps, and their values are arrays. |
201 | 201 | * The 2nd level arrays have keys with each of the cron task hook names to run at that time |
@@ -213,23 +213,23 @@ discard block |
||
213 | 213 | * ... |
214 | 214 | * ... |
215 | 215 | */ |
216 | - $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ); |
|
217 | - foreach ( (array) $crons as $timestamp => $hooks_to_fire_at_time ) { |
|
218 | - if ( is_array( $hooks_to_fire_at_time ) ) { |
|
219 | - foreach ( (array) $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
|
220 | - if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
221 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
216 | + $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks($cron_tasks_to_remove); |
|
217 | + foreach ((array) $crons as $timestamp => $hooks_to_fire_at_time) { |
|
218 | + if (is_array($hooks_to_fire_at_time)) { |
|
219 | + foreach ((array) $hooks_to_fire_at_time as $hook_name => $hook_actions) { |
|
220 | + if (isset($ee_cron_tasks_to_remove[$hook_name]) |
|
221 | + && is_array($ee_cron_tasks_to_remove[$hook_name]) |
|
222 | 222 | ) { |
223 | - unset( $crons[ $timestamp ][ $hook_name ] ); |
|
223 | + unset($crons[$timestamp][$hook_name]); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | //also take care of any empty cron timestamps. |
227 | - if ( empty( $hooks_to_fire_at_time ) ) { |
|
228 | - unset( $crons[ $timestamp ] ); |
|
227 | + if (empty($hooks_to_fire_at_time)) { |
|
228 | + unset($crons[$timestamp]); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | } |
232 | - _set_cron_array( $crons ); |
|
232 | + _set_cron_array($crons); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public static function CPT_initialization() { |
246 | 246 | // register Custom Post Types |
247 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
247 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
248 | 248 | flush_rewrite_rules(); |
249 | 249 | } |
250 | 250 | |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | * @return void |
263 | 263 | */ |
264 | 264 | public static function reset_and_update_config() { |
265 | - do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) ); |
|
266 | - add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 ); |
|
265 | + do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config')); |
|
266 | + add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3); |
|
267 | 267 | //EE_Config::reset(); |
268 | 268 | } |
269 | 269 | |
@@ -276,28 +276,28 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public static function load_calendar_config() { |
278 | 278 | // grab array of all plugin folders and loop thru it |
279 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
280 | - if ( empty( $plugins ) ) { |
|
279 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
280 | + if (empty($plugins)) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | - foreach ( $plugins as $plugin_path ) { |
|
283 | + foreach ($plugins as $plugin_path) { |
|
284 | 284 | // grab plugin folder name from path |
285 | - $plugin = basename( $plugin_path ); |
|
285 | + $plugin = basename($plugin_path); |
|
286 | 286 | // drill down to Espresso plugins |
287 | 287 | // then to calendar related plugins |
288 | 288 | if ( |
289 | - strpos( $plugin, 'espresso' ) !== FALSE |
|
290 | - || strpos( $plugin, 'Espresso' ) !== FALSE |
|
291 | - || strpos( $plugin, 'ee4' ) !== FALSE |
|
292 | - || strpos( $plugin, 'EE4' ) !== FALSE |
|
293 | - || strpos( $plugin, 'calendar' ) !== false |
|
289 | + strpos($plugin, 'espresso') !== FALSE |
|
290 | + || strpos($plugin, 'Espresso') !== FALSE |
|
291 | + || strpos($plugin, 'ee4') !== FALSE |
|
292 | + || strpos($plugin, 'EE4') !== FALSE |
|
293 | + || strpos($plugin, 'calendar') !== false |
|
294 | 294 | ) { |
295 | 295 | // this is what we are looking for |
296 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
296 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
297 | 297 | // does it exist in this folder ? |
298 | - if ( is_readable( $calendar_config )) { |
|
298 | + if (is_readable($calendar_config)) { |
|
299 | 299 | // YEAH! let's load it |
300 | - require_once( $calendar_config ); |
|
300 | + require_once($calendar_config); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | } |
@@ -313,21 +313,21 @@ discard block |
||
313 | 313 | * @param \EE_Config $EE_Config |
314 | 314 | * @return \stdClass |
315 | 315 | */ |
316 | - public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) { |
|
317 | - $convert_from_array = array( 'addons' ); |
|
316 | + public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) { |
|
317 | + $convert_from_array = array('addons'); |
|
318 | 318 | // in case old settings were saved as an array |
319 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
319 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
320 | 320 | // convert existing settings to an object |
321 | 321 | $config_array = $settings; |
322 | 322 | $settings = new stdClass(); |
323 | - foreach ( (array) $config_array as $key => $value ){ |
|
324 | - if ( $key === 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
325 | - $EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
323 | + foreach ((array) $config_array as $key => $value) { |
|
324 | + if ($key === 'calendar' && class_exists('EE_Calendar_Config')) { |
|
325 | + $EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
326 | 326 | } else { |
327 | 327 | $settings->{$key} = $value; |
328 | 328 | } |
329 | 329 | } |
330 | - add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' ); |
|
330 | + add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true'); |
|
331 | 331 | } |
332 | 332 | return $settings; |
333 | 333 | } |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | */ |
344 | 344 | public static function deactivate_event_espresso() { |
345 | 345 | // check permissions |
346 | - if ( current_user_can( 'activate_plugins' )) { |
|
347 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
346 | + if (current_user_can('activate_plugins')) { |
|
347 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
@@ -366,25 +366,25 @@ discard block |
||
366 | 366 | $critical_pages = array( |
367 | 367 | array( |
368 | 368 | 'id' =>'reg_page_id', |
369 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
369 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
370 | 370 | 'post' => NULL, |
371 | 371 | 'code' => 'ESPRESSO_CHECKOUT' |
372 | 372 | ), |
373 | 373 | array( |
374 | 374 | 'id' => 'txn_page_id', |
375 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
375 | + 'name' => __('Transactions', 'event_espresso'), |
|
376 | 376 | 'post' => NULL, |
377 | 377 | 'code' => 'ESPRESSO_TXN_PAGE' |
378 | 378 | ), |
379 | 379 | array( |
380 | 380 | 'id' => 'thank_you_page_id', |
381 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
381 | + 'name' => __('Thank You', 'event_espresso'), |
|
382 | 382 | 'post' => NULL, |
383 | 383 | 'code' => 'ESPRESSO_THANK_YOU' |
384 | 384 | ), |
385 | 385 | array( |
386 | 386 | 'id' => 'cancel_page_id', |
387 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
387 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
388 | 388 | 'post' => NULL, |
389 | 389 | 'code' => 'ESPRESSO_CANCELLED' |
390 | 390 | ), |
@@ -392,62 +392,62 @@ discard block |
||
392 | 392 | |
393 | 393 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
394 | 394 | |
395 | - foreach ( $critical_pages as $critical_page ) { |
|
395 | + foreach ($critical_pages as $critical_page) { |
|
396 | 396 | // is critical page ID set in config ? |
397 | - if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) { |
|
397 | + if ($EE_Core_Config->{$critical_page['id']} !== FALSE) { |
|
398 | 398 | // attempt to find post by ID |
399 | - $critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} ); |
|
399 | + $critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} ); |
|
400 | 400 | } |
401 | 401 | // no dice? |
402 | - if ( $critical_page['post'] === null ) { |
|
402 | + if ($critical_page['post'] === null) { |
|
403 | 403 | // attempt to find post by title |
404 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
404 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
405 | 405 | // still nothing? |
406 | - if ( $critical_page['post'] === null ) { |
|
407 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
406 | + if ($critical_page['post'] === null) { |
|
407 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
408 | 408 | // REALLY? Still nothing ??!?!? |
409 | - if ( $critical_page['post'] === null ) { |
|
410 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
411 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
409 | + if ($critical_page['post'] === null) { |
|
410 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
411 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
412 | 412 | break; |
413 | 413 | } |
414 | 414 | } |
415 | 415 | } |
416 | 416 | // track post_shortcodes |
417 | - if ( $critical_page['post'] ) { |
|
418 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
417 | + if ($critical_page['post']) { |
|
418 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
419 | 419 | } |
420 | 420 | // check that Post ID matches critical page ID in config |
421 | 421 | if ( |
422 | - isset( $critical_page['post']->ID ) |
|
423 | - && $critical_page['post']->ID !== $EE_Core_Config->{$critical_page[ 'id' ]} |
|
422 | + isset($critical_page['post']->ID) |
|
423 | + && $critical_page['post']->ID !== $EE_Core_Config->{$critical_page['id']} |
|
424 | 424 | ) { |
425 | 425 | //update Config with post ID |
426 | - $EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID; |
|
427 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
428 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
429 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
426 | + $EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID; |
|
427 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
428 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
429 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | |
433 | 433 | $critical_page_problem = |
434 | - ! isset( $critical_page['post']->post_status ) |
|
434 | + ! isset($critical_page['post']->post_status) |
|
435 | 435 | || $critical_page['post']->post_status !== 'publish' |
436 | - || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE |
|
436 | + || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE |
|
437 | 437 | ? TRUE |
438 | 438 | : $critical_page_problem; |
439 | 439 | |
440 | 440 | } |
441 | 441 | |
442 | - if ( $critical_page_problem ) { |
|
442 | + if ($critical_page_problem) { |
|
443 | 443 | $msg = sprintf( |
444 | - __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ), |
|
445 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
444 | + __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), |
|
445 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
446 | 446 | ); |
447 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
447 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
448 | 448 | } |
449 | - if ( EE_Error::has_notices() ) { |
|
450 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
449 | + if (EE_Error::has_notices()) { |
|
450 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
@@ -459,13 +459,13 @@ discard block |
||
459 | 459 | * parameter to the shortcode |
460 | 460 | * @return WP_Post or NULl |
461 | 461 | */ |
462 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
462 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
463 | 463 | global $wpdb; |
464 | 464 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
465 | 465 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
466 | - if($post_id){ |
|
466 | + if ($post_id) { |
|
467 | 467 | return get_post($post_id); |
468 | - }else{ |
|
468 | + } else { |
|
469 | 469 | return NULL; |
470 | 470 | } |
471 | 471 | |
@@ -482,32 +482,32 @@ discard block |
||
482 | 482 | * @param array $critical_page |
483 | 483 | * @return array |
484 | 484 | */ |
485 | - public static function create_critical_page( $critical_page ) { |
|
485 | + public static function create_critical_page($critical_page) { |
|
486 | 486 | |
487 | 487 | $post_args = array( |
488 | 488 | 'post_title' => $critical_page['name'], |
489 | 489 | 'post_status' => 'publish', |
490 | 490 | 'post_type' => 'page', |
491 | 491 | 'comment_status' => 'closed', |
492 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
492 | + 'post_content' => '['.$critical_page['code'].']' |
|
493 | 493 | ); |
494 | 494 | |
495 | - $post_id = wp_insert_post( $post_args ); |
|
496 | - if ( ! $post_id ) { |
|
495 | + $post_id = wp_insert_post($post_args); |
|
496 | + if ( ! $post_id) { |
|
497 | 497 | $msg = sprintf( |
498 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
498 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
499 | 499 | $critical_page['name'] |
500 | 500 | ); |
501 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
501 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
502 | 502 | return $critical_page; |
503 | 503 | } |
504 | 504 | // get newly created post's details |
505 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
505 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
506 | 506 | $msg = sprintf( |
507 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
507 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
508 | 508 | $critical_page['name'] |
509 | 509 | ); |
510 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
510 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | return $critical_page; |
@@ -526,35 +526,35 @@ discard block |
||
526 | 526 | * @param array $critical_page |
527 | 527 | * @return void |
528 | 528 | */ |
529 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
529 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
530 | 530 | // check the goods |
531 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
531 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
532 | 532 | $msg = sprintf( |
533 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
533 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
534 | 534 | $critical_page['name'] |
535 | 535 | ); |
536 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
536 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
537 | 537 | return; |
538 | 538 | } |
539 | 539 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
540 | 540 | // map shortcode to post |
541 | - $EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
541 | + $EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
542 | 542 | // and make sure it's NOT added to the WP "Posts Page" |
543 | 543 | // name of the WP Posts Page |
544 | 544 | $posts_page = EE_Config::get_page_for_posts(); |
545 | - if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) { |
|
546 | - unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
545 | + if (isset($EE_Core_Config->post_shortcodes[$posts_page])) { |
|
546 | + unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]); |
|
547 | 547 | } |
548 | - if ( $posts_page !== 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) { |
|
549 | - unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
548 | + if ($posts_page !== 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) { |
|
549 | + unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]); |
|
550 | 550 | } |
551 | 551 | // update post_shortcode CFG |
552 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
552 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
553 | 553 | $msg = sprintf( |
554 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
554 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
555 | 555 | $critical_page['name'] |
556 | 556 | ); |
557 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
557 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
@@ -572,24 +572,24 @@ discard block |
||
572 | 572 | public static function get_default_creator_id() { |
573 | 573 | global $wpdb; |
574 | 574 | |
575 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
575 | + if ( ! empty(self::$_default_creator_id)) { |
|
576 | 576 | return self::$_default_creator_id; |
577 | 577 | }/**/ |
578 | 578 | |
579 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
579 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
580 | 580 | |
581 | 581 | //let's allow pre_filtering for early exits by alternative methods for getting id. We check for truthy result and if so then exit early. |
582 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
583 | - if ( $pre_filtered_id !== false ) { |
|
582 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
583 | + if ($pre_filtered_id !== false) { |
|
584 | 584 | return (int) $pre_filtered_id; |
585 | 585 | } |
586 | 586 | |
587 | - $capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' ); |
|
588 | - $query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' ); |
|
589 | - $user_id = $wpdb->get_var( $query ); |
|
590 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
591 | - if ( $user_id && (int)$user_id ) { |
|
592 | - self::$_default_creator_id = (int)$user_id; |
|
587 | + $capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities'); |
|
588 | + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%'); |
|
589 | + $user_id = $wpdb->get_var($query); |
|
590 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
591 | + if ($user_id && (int) $user_id) { |
|
592 | + self::$_default_creator_id = (int) $user_id; |
|
593 | 593 | return self::$_default_creator_id; |
594 | 594 | } else { |
595 | 595 | return NULL; |
@@ -616,29 +616,29 @@ discard block |
||
616 | 616 | * @return void |
617 | 617 | * @throws EE_Error if there are database errors |
618 | 618 | */ |
619 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) { |
|
620 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
619 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) { |
|
620 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
621 | 621 | return; |
622 | 622 | } |
623 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
624 | - if ( ! function_exists( 'dbDelta' )) { |
|
625 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
623 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
624 | + if ( ! function_exists('dbDelta')) { |
|
625 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
626 | 626 | } |
627 | 627 | /** @var WPDB $wpdb */ |
628 | 628 | global $wpdb; |
629 | - $wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
629 | + $wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
630 | 630 | // do we need to first delete an existing version of this table ? |
631 | - if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){ |
|
631 | + if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) { |
|
632 | 632 | // ok, delete the table... but ONLY if it's empty |
633 | - $deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name ); |
|
633 | + $deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name); |
|
634 | 634 | // table is NOT empty, are you SURE you want to delete this table ??? |
635 | - if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
636 | - EEH_Activation::delete_unused_db_table( $wp_table_name ); |
|
637 | - } else if ( ! $deleted_safely ) { |
|
635 | + if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
636 | + EEH_Activation::delete_unused_db_table($wp_table_name); |
|
637 | + } else if ( ! $deleted_safely) { |
|
638 | 638 | // so we should be more cautious rather than just dropping tables so easily |
639 | 639 | EE_Error::add_persistent_admin_notice( |
640 | - 'bad_table_' . $wp_table_name . '_detected', |
|
641 | - sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ), |
|
640 | + 'bad_table_'.$wp_table_name.'_detected', |
|
641 | + sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'), |
|
642 | 642 | $wp_table_name, |
643 | 643 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
644 | 644 | '<b>wp-config.php</b>', |
@@ -647,25 +647,25 @@ discard block |
||
647 | 647 | } |
648 | 648 | } |
649 | 649 | // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns ) |
650 | - if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) { |
|
650 | + if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) { |
|
651 | 651 | $SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
652 | 652 | //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
653 | 653 | //happened. And then we can choose to tell the end user |
654 | - $old_show_errors_policy = $wpdb->show_errors( TRUE ); |
|
655 | - $old_error_suppression_policy = $wpdb->suppress_errors( FALSE ); |
|
654 | + $old_show_errors_policy = $wpdb->show_errors(TRUE); |
|
655 | + $old_error_suppression_policy = $wpdb->suppress_errors(FALSE); |
|
656 | 656 | ob_start(); |
657 | - dbDelta( $SQL ); |
|
657 | + dbDelta($SQL); |
|
658 | 658 | $output = ob_get_contents(); |
659 | 659 | ob_end_clean(); |
660 | - $wpdb->show_errors( $old_show_errors_policy ); |
|
661 | - $wpdb->suppress_errors( $old_error_suppression_policy ); |
|
662 | - if( ! empty( $output ) ){ |
|
663 | - throw new EE_Error( $output ); |
|
660 | + $wpdb->show_errors($old_show_errors_policy); |
|
661 | + $wpdb->suppress_errors($old_error_suppression_policy); |
|
662 | + if ( ! empty($output)) { |
|
663 | + throw new EE_Error($output); |
|
664 | 664 | } |
665 | 665 | } else { |
666 | 666 | throw new EE_Error( |
667 | 667 | sprintf( |
668 | - __( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ), |
|
668 | + __('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'), |
|
669 | 669 | '<br />', |
670 | 670 | $sql |
671 | 671 | ) |
@@ -688,15 +688,15 @@ discard block |
||
688 | 688 | * 'VARCHAR(10)' |
689 | 689 | * @return bool|int |
690 | 690 | */ |
691 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
692 | - if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){ |
|
691 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
692 | + if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) { |
|
693 | 693 | return FALSE; |
694 | 694 | } |
695 | 695 | global $wpdb; |
696 | - $full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
696 | + $full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
697 | 697 | $fields = self::get_fields_on_table($table_name); |
698 | - if (!in_array($column_name, $fields)){ |
|
699 | - $alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
698 | + if ( ! in_array($column_name, $fields)) { |
|
699 | + $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
700 | 700 | //echo "alter query:$alter_query"; |
701 | 701 | return $wpdb->query($alter_query); |
702 | 702 | } |
@@ -715,14 +715,14 @@ discard block |
||
715 | 715 | * @param string $table_name, without prefixed $wpdb->prefix |
716 | 716 | * @return array|boolean of database column names |
717 | 717 | */ |
718 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
718 | + public static function get_fields_on_table($table_name = NULL) { |
|
719 | 719 | global $wpdb; |
720 | - $table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
721 | - if ( ! empty( $table_name )) { |
|
720 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
721 | + if ( ! empty($table_name)) { |
|
722 | 722 | $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
723 | 723 | if ($columns !== FALSE) { |
724 | 724 | $field_array = array(); |
725 | - foreach( (array) $columns as $column ){ |
|
725 | + foreach ((array) $columns as $column) { |
|
726 | 726 | $field_array[] = $column->Field; |
727 | 727 | } |
728 | 728 | return $field_array; |
@@ -741,12 +741,12 @@ discard block |
||
741 | 741 | * @param string $table_name |
742 | 742 | * @return bool |
743 | 743 | */ |
744 | - public static function db_table_is_empty( $table_name ) { |
|
744 | + public static function db_table_is_empty($table_name) { |
|
745 | 745 | global $wpdb; |
746 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
747 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
748 | - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" ); |
|
749 | - return absint( $count ) === 0 ? true : false; |
|
746 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
747 | + if (EEH_Activation::table_exists($table_name)) { |
|
748 | + $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name"); |
|
749 | + return absint($count) === 0 ? true : false; |
|
750 | 750 | } |
751 | 751 | return false; |
752 | 752 | } |
@@ -761,9 +761,9 @@ discard block |
||
761 | 761 | * @param string $table_name |
762 | 762 | * @return bool | int |
763 | 763 | */ |
764 | - public static function delete_db_table_if_empty( $table_name ) { |
|
765 | - if ( EEH_Activation::db_table_is_empty( $table_name ) ) { |
|
766 | - return EEH_Activation::delete_unused_db_table( $table_name ); |
|
764 | + public static function delete_db_table_if_empty($table_name) { |
|
765 | + if (EEH_Activation::db_table_is_empty($table_name)) { |
|
766 | + return EEH_Activation::delete_unused_db_table($table_name); |
|
767 | 767 | } |
768 | 768 | return false; |
769 | 769 | } |
@@ -778,11 +778,11 @@ discard block |
||
778 | 778 | * @param string $table_name |
779 | 779 | * @return bool | int |
780 | 780 | */ |
781 | - public static function delete_unused_db_table( $table_name ) { |
|
781 | + public static function delete_unused_db_table($table_name) { |
|
782 | 782 | global $wpdb; |
783 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
784 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
785 | - return $wpdb->query( "DROP TABLE IF EXISTS $table_name" ); |
|
783 | + if (EEH_Activation::table_exists($table_name)) { |
|
784 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
785 | + return $wpdb->query("DROP TABLE IF EXISTS $table_name"); |
|
786 | 786 | } |
787 | 787 | return false; |
788 | 788 | } |
@@ -798,18 +798,18 @@ discard block |
||
798 | 798 | * @param string $index_name |
799 | 799 | * @return bool | int |
800 | 800 | */ |
801 | - public static function drop_index( $table_name, $index_name ) { |
|
802 | - if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){ |
|
801 | + public static function drop_index($table_name, $index_name) { |
|
802 | + if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) { |
|
803 | 803 | return FALSE; |
804 | 804 | } |
805 | 805 | global $wpdb; |
806 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
806 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
807 | 807 | $index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'"; |
808 | 808 | if ( |
809 | - EEH_Activation::table_exists( $table_name ) |
|
810 | - && $wpdb->get_var( $index_exists_query ) === $table_name //using get_var with the $index_exists_query returns the table's name |
|
809 | + EEH_Activation::table_exists($table_name) |
|
810 | + && $wpdb->get_var($index_exists_query) === $table_name //using get_var with the $index_exists_query returns the table's name |
|
811 | 811 | ) { |
812 | - return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" ); |
|
812 | + return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name"); |
|
813 | 813 | } |
814 | 814 | return TRUE; |
815 | 815 | } |
@@ -825,27 +825,27 @@ discard block |
||
825 | 825 | * @return boolean success (whether database is setup properly or not) |
826 | 826 | */ |
827 | 827 | public static function create_database_tables() { |
828 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
828 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
829 | 829 | //find the migration script that sets the database to be compatible with the code |
830 | 830 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
831 | - if( $dms_name ){ |
|
832 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
833 | - $current_data_migration_script->set_migrating( false ); |
|
831 | + if ($dms_name) { |
|
832 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
833 | + $current_data_migration_script->set_migrating(false); |
|
834 | 834 | $current_data_migration_script->schema_changes_before_migration(); |
835 | 835 | $current_data_migration_script->schema_changes_after_migration(); |
836 | - if( $current_data_migration_script->get_errors() ){ |
|
837 | - if( WP_DEBUG ){ |
|
838 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
839 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
836 | + if ($current_data_migration_script->get_errors()) { |
|
837 | + if (WP_DEBUG) { |
|
838 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
839 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
840 | 840 | } |
841 | - }else{ |
|
842 | - EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
|
841 | + } else { |
|
842 | + EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso')); |
|
843 | 843 | } |
844 | 844 | return false; |
845 | 845 | } |
846 | 846 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
847 | - }else{ |
|
848 | - EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
847 | + } else { |
|
848 | + EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
849 | 849 | return false; |
850 | 850 | } |
851 | 851 | return true; |
@@ -865,36 +865,36 @@ discard block |
||
865 | 865 | public static function initialize_system_questions() { |
866 | 866 | // QUESTION GROUPS |
867 | 867 | global $wpdb; |
868 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' ); |
|
868 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group'); |
|
869 | 869 | $SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0"; |
870 | 870 | // what we have |
871 | - $question_groups = $wpdb->get_col( $SQL ); |
|
871 | + $question_groups = $wpdb->get_col($SQL); |
|
872 | 872 | // check the response |
873 | - $question_groups = is_array( $question_groups ) ? $question_groups : array(); |
|
873 | + $question_groups = is_array($question_groups) ? $question_groups : array(); |
|
874 | 874 | // what we should have |
875 | - $QSG_systems = array( 1, 2 ); |
|
875 | + $QSG_systems = array(1, 2); |
|
876 | 876 | $QSG_IDs = array(); |
877 | 877 | $timestamp = time(); |
878 | 878 | // loop thru what we should have and compare to what we have |
879 | - foreach ( $QSG_systems as $QSG_system ) { |
|
879 | + foreach ($QSG_systems as $QSG_system) { |
|
880 | 880 | // reset values array |
881 | 881 | $QSG_values = array(); |
882 | 882 | // if we don't have what we should have (but use $QST_system as as string because that's what we got from the db) |
883 | - if ( ! in_array( "$QSG_system", $question_groups )) { |
|
883 | + if ( ! in_array("$QSG_system", $question_groups)) { |
|
884 | 884 | // add it |
885 | - switch ( $QSG_system ) { |
|
885 | + switch ($QSG_system) { |
|
886 | 886 | |
887 | 887 | case 1: |
888 | 888 | $QSG_values = array( |
889 | - 'QSG_name' => __( 'Personal Information', 'event_espresso' ), |
|
890 | - 'QSG_identifier' => 'personal-information-' . $timestamp, |
|
889 | + 'QSG_name' => __('Personal Information', 'event_espresso'), |
|
890 | + 'QSG_identifier' => 'personal-information-'.$timestamp, |
|
891 | 891 | 'QSG_desc' => __( |
892 | 892 | 'Questions for gathering critical details like "Name" and "Email Address"', |
893 | 893 | 'event_espresso' |
894 | 894 | ), |
895 | 895 | 'QSG_parent' => null, |
896 | - 'QSG_html_name' => 'personal-information-' . $timestamp, |
|
897 | - 'QSG_html_id' => 'personal-information-' . $timestamp, |
|
896 | + 'QSG_html_name' => 'personal-information-'.$timestamp, |
|
897 | + 'QSG_html_id' => 'personal-information-'.$timestamp, |
|
898 | 898 | 'QSG_order' => 1, |
899 | 899 | 'QSG_wp_user' => self::get_default_creator_id(), |
900 | 900 | 'QSG_system' => EEM_Question_Group::system_personal, |
@@ -904,15 +904,15 @@ discard block |
||
904 | 904 | |
905 | 905 | case 2: |
906 | 906 | $QSG_values = array( |
907 | - 'QSG_name' => __( 'Address Information', 'event_espresso' ), |
|
908 | - 'QSG_identifier' => 'address-information-' . $timestamp, |
|
907 | + 'QSG_name' => __('Address Information', 'event_espresso'), |
|
908 | + 'QSG_identifier' => 'address-information-'.$timestamp, |
|
909 | 909 | 'QSG_desc' => __( |
910 | 910 | 'Questions for gathering mailing address details', |
911 | 911 | 'event_espresso' |
912 | 912 | ), |
913 | 913 | 'QSG_parent' => null, |
914 | - 'QSG_html_name' => 'address-information-' . $timestamp, |
|
915 | - 'QSG_html_id' => 'address-information-' . $timestamp, |
|
914 | + 'QSG_html_name' => 'address-information-'.$timestamp, |
|
915 | + 'QSG_html_id' => 'address-information-'.$timestamp, |
|
916 | 916 | 'QSG_order' => 2, |
917 | 917 | 'QSG_wp_user' => self::get_default_creator_id(), |
918 | 918 | 'QSG_system' => EEM_Question_Group::system_address, |
@@ -922,14 +922,14 @@ discard block |
||
922 | 922 | |
923 | 923 | } |
924 | 924 | // make sure we have some values before inserting them |
925 | - if ( ! empty( $QSG_values )) { |
|
925 | + if ( ! empty($QSG_values)) { |
|
926 | 926 | // insert system question |
927 | 927 | $wpdb->insert( |
928 | 928 | $table_name, |
929 | 929 | $QSG_values, |
930 | - array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) |
|
930 | + array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d') |
|
931 | 931 | ); |
932 | - $QSG_IDs[ $QSG_system ] = $wpdb->insert_id; |
|
932 | + $QSG_IDs[$QSG_system] = $wpdb->insert_id; |
|
933 | 933 | } |
934 | 934 | } |
935 | 935 | } |
@@ -938,10 +938,10 @@ discard block |
||
938 | 938 | |
939 | 939 | // QUESTIONS |
940 | 940 | global $wpdb; |
941 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' ); |
|
941 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question'); |
|
942 | 942 | $SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''"; |
943 | 943 | // what we have |
944 | - $questions = $wpdb->get_col( $SQL ); |
|
944 | + $questions = $wpdb->get_col($SQL); |
|
945 | 945 | // what we should have |
946 | 946 | $QST_systems = array( |
947 | 947 | 'fname', |
@@ -956,32 +956,32 @@ discard block |
||
956 | 956 | 'phone' |
957 | 957 | ); |
958 | 958 | // loop thru what we should have and compare to what we have |
959 | - foreach ( $QST_systems as $QST_system ) { |
|
959 | + foreach ($QST_systems as $QST_system) { |
|
960 | 960 | // reset values array |
961 | 961 | $QST_values = array(); |
962 | 962 | // if we don't have what we should have |
963 | - if ( ! in_array( $QST_system, $questions )) { |
|
963 | + if ( ! in_array($QST_system, $questions)) { |
|
964 | 964 | // add it |
965 | - switch ( $QST_system ) { |
|
965 | + switch ($QST_system) { |
|
966 | 966 | |
967 | 967 | case 'fname': |
968 | 968 | $QST_values = array( |
969 | - 'QSG_ID' => $QSG_IDs[ EEM_Question_Group::system_personal ], |
|
970 | - 'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ), |
|
971 | - 'QST_display_text' => __( 'First Name', 'event_espresso' ), |
|
972 | - 'QST_identifier' => 'fname-' . $timestamp, |
|
969 | + 'QSG_ID' => $QSG_IDs[EEM_Question_Group::system_personal], |
|
970 | + 'QST_admin_label' => __('First Name - System Question', 'event_espresso'), |
|
971 | + 'QST_display_text' => __('First Name', 'event_espresso'), |
|
972 | + 'QST_identifier' => 'fname-'.$timestamp, |
|
973 | 973 | 'QST_system' => 'fname', |
974 | 974 | 'QST_type' => 'TEXT', |
975 | 975 | 'QST_required' => 1, |
976 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
976 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
977 | 977 | 'QST_desc' => 'The registrant\'s given name', |
978 | - 'QST_html_name' => 'fname-' . $timestamp, |
|
979 | - 'QST_html_id' => 'fname-' . $timestamp, |
|
978 | + 'QST_html_name' => 'fname-'.$timestamp, |
|
979 | + 'QST_html_id' => 'fname-'.$timestamp, |
|
980 | 980 | 'QST_html_class' => 'fname', |
981 | - 'QST_html_label_id' => 'fname-' . $timestamp . '-lbl', |
|
981 | + 'QST_html_label_id' => 'fname-'.$timestamp.'-lbl', |
|
982 | 982 | 'QST_html_label_class' => 'fname-lbl', |
983 | 983 | 'QST_default_value' => '', |
984 | - 'QST_validation_strategies' => array( 'required' => '' ), |
|
984 | + 'QST_validation_strategies' => array('required' => ''), |
|
985 | 985 | 'QST_validation_message' => '', |
986 | 986 | 'QST_order' => 1, |
987 | 987 | 'QST_admin_only' => 0, |
@@ -995,19 +995,19 @@ discard block |
||
995 | 995 | |
996 | 996 | case 'lname': |
997 | 997 | $QST_values = array( |
998 | - 'QSG_ID' => $QSG_IDs[ EEM_Question_Group::system_personal ], |
|
999 | - 'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ), |
|
1000 | - 'QST_display_text' => __( 'Last Name', 'event_espresso' ), |
|
1001 | - 'QST_identifier' => 'lname-' . $timestamp, |
|
998 | + 'QSG_ID' => $QSG_IDs[EEM_Question_Group::system_personal], |
|
999 | + 'QST_admin_label' => __('Last Name - System Question', 'event_espresso'), |
|
1000 | + 'QST_display_text' => __('Last Name', 'event_espresso'), |
|
1001 | + 'QST_identifier' => 'lname-'.$timestamp, |
|
1002 | 1002 | 'QST_system' => 'lname', |
1003 | 1003 | 'QST_type' => 'TEXT', |
1004 | 1004 | 'QST_required' => 1, |
1005 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1005 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1006 | 1006 | 'QST_desc' => 'The registrant\'s family name', |
1007 | - 'QST_html_name' => 'lname-' . $timestamp, |
|
1008 | - 'QST_html_id' => 'lname-' . $timestamp, |
|
1007 | + 'QST_html_name' => 'lname-'.$timestamp, |
|
1008 | + 'QST_html_id' => 'lname-'.$timestamp, |
|
1009 | 1009 | 'QST_html_class' => 'lname', |
1010 | - 'QST_html_label_id' => 'lname-' . $timestamp . '-lbl', |
|
1010 | + 'QST_html_label_id' => 'lname-'.$timestamp.'-lbl', |
|
1011 | 1011 | 'QST_html_label_class' => 'lname-lbl', |
1012 | 1012 | 'QST_default_value' => '', |
1013 | 1013 | 'QST_validation_strategies' => array(), |
@@ -1024,22 +1024,22 @@ discard block |
||
1024 | 1024 | |
1025 | 1025 | case 'email': |
1026 | 1026 | $QST_values = array( |
1027 | - 'QSG_ID' => $QSG_IDs[ EEM_Question_Group::system_personal ], |
|
1028 | - 'QST_display_text' => __( 'Email Address', 'event_espresso' ), |
|
1029 | - 'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ), |
|
1030 | - 'QST_identifier' => 'email-' . $timestamp, |
|
1027 | + 'QSG_ID' => $QSG_IDs[EEM_Question_Group::system_personal], |
|
1028 | + 'QST_display_text' => __('Email Address', 'event_espresso'), |
|
1029 | + 'QST_admin_label' => __('Email Address - System Question', 'event_espresso'), |
|
1030 | + 'QST_identifier' => 'email-'.$timestamp, |
|
1031 | 1031 | 'QST_system' => 'email', |
1032 | 1032 | 'QST_type' => 'EMAIL', |
1033 | 1033 | 'QST_required' => 1, |
1034 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1034 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1035 | 1035 | 'QST_desc' => 'The registrant\'s email address', |
1036 | - 'QST_html_name' => 'email-' . $timestamp, |
|
1037 | - 'QST_html_id' => 'email-' . $timestamp, |
|
1036 | + 'QST_html_name' => 'email-'.$timestamp, |
|
1037 | + 'QST_html_id' => 'email-'.$timestamp, |
|
1038 | 1038 | 'QST_html_class' => 'email', |
1039 | - 'QST_html_label_id' => 'email-' . $timestamp . '-lbl', |
|
1039 | + 'QST_html_label_id' => 'email-'.$timestamp.'-lbl', |
|
1040 | 1040 | 'QST_html_label_class' => 'email-lbl', |
1041 | 1041 | 'QST_default_value' => '', |
1042 | - 'QST_validation_strategies' => array( 'required' => '', 'email' => '', ), |
|
1042 | + 'QST_validation_strategies' => array('required' => '', 'email' => '',), |
|
1043 | 1043 | 'QST_validation_message' => '', |
1044 | 1044 | 'QST_order' => 3, |
1045 | 1045 | 'QST_admin_only' => 0, |
@@ -1053,22 +1053,22 @@ discard block |
||
1053 | 1053 | |
1054 | 1054 | case 'address': |
1055 | 1055 | $QST_values = array( |
1056 | - 'QSG_ID' => $QSG_IDs[ EEM_Question_Group::system_address ], |
|
1057 | - 'QST_display_text' => __( 'Address', 'event_espresso' ), |
|
1058 | - 'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ), |
|
1059 | - 'QST_identifier' => 'address-' . $timestamp, |
|
1056 | + 'QSG_ID' => $QSG_IDs[EEM_Question_Group::system_address], |
|
1057 | + 'QST_display_text' => __('Address', 'event_espresso'), |
|
1058 | + 'QST_admin_label' => __('Address - System Question', 'event_espresso'), |
|
1059 | + 'QST_identifier' => 'address-'.$timestamp, |
|
1060 | 1060 | 'QST_system' => 'address', |
1061 | 1061 | 'QST_type' => 'TEXT', |
1062 | 1062 | 'QST_required' => 0, |
1063 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1063 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1064 | 1064 | 'QST_desc' => 'The registrant\'s street address', |
1065 | - 'QST_html_name' => 'address-' . $timestamp, |
|
1066 | - 'QST_html_id' => 'address-' . $timestamp, |
|
1065 | + 'QST_html_name' => 'address-'.$timestamp, |
|
1066 | + 'QST_html_id' => 'address-'.$timestamp, |
|
1067 | 1067 | 'QST_html_class' => 'address', |
1068 | - 'QST_html_label_id' => 'address-' . $timestamp . '-lbl', |
|
1068 | + 'QST_html_label_id' => 'address-'.$timestamp.'-lbl', |
|
1069 | 1069 | 'QST_html_label_class' => 'address-lbl', |
1070 | 1070 | 'QST_default_value' => '', |
1071 | - 'QST_validation_strategies' => array( 'required' => '' ), |
|
1071 | + 'QST_validation_strategies' => array('required' => ''), |
|
1072 | 1072 | 'QST_validation_message' => '', |
1073 | 1073 | 'QST_order' => 4, |
1074 | 1074 | 'QST_admin_only' => 0, |
@@ -1082,22 +1082,22 @@ discard block |
||
1082 | 1082 | |
1083 | 1083 | case 'address2': |
1084 | 1084 | $QST_values = array( |
1085 | - 'QSG_ID' => $QSG_IDs[ EEM_Question_Group::system_address ], |
|
1086 | - 'QST_display_text' => __( 'Address2', 'event_espresso' ), |
|
1087 | - 'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ), |
|
1088 | - 'QST_identifier' => 'address2-' . $timestamp, |
|
1085 | + 'QSG_ID' => $QSG_IDs[EEM_Question_Group::system_address], |
|
1086 | + 'QST_display_text' => __('Address2', 'event_espresso'), |
|
1087 | + 'QST_admin_label' => __('Address2 - System Question', 'event_espresso'), |
|
1088 | + 'QST_identifier' => 'address2-'.$timestamp, |
|
1089 | 1089 | 'QST_system' => 'address2', |
1090 | 1090 | 'QST_type' => 'TEXT', |
1091 | 1091 | 'QST_required' => 0, |
1092 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1092 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1093 | 1093 | 'QST_desc' => 'The registrant\'s street address (additional info)', |
1094 | - 'QST_html_name' => 'address2-' . $timestamp, |
|
1095 | - 'QST_html_id' => 'address2-' . $timestamp, |
|
1094 | + 'QST_html_name' => 'address2-'.$timestamp, |
|
1095 | + 'QST_html_id' => 'address2-'.$timestamp, |
|
1096 | 1096 | 'QST_html_class' => 'address2', |
1097 | - 'QST_html_label_id' => 'address2-' . $timestamp . '-lbl', |
|
1097 | + 'QST_html_label_id' => 'address2-'.$timestamp.'-lbl', |
|
1098 | 1098 | 'QST_html_label_class' => 'address2-lbl', |
1099 | 1099 | 'QST_default_value' => '', |
1100 | - 'QST_validation_strategies' => array( 'required' => '' ), |
|
1100 | + 'QST_validation_strategies' => array('required' => ''), |
|
1101 | 1101 | 'QST_validation_message' => '', |
1102 | 1102 | 'QST_order' => 5, |
1103 | 1103 | 'QST_admin_only' => 0, |
@@ -1111,22 +1111,22 @@ discard block |
||
1111 | 1111 | |
1112 | 1112 | case 'city': |
1113 | 1113 | $QST_values = array( |
1114 | - 'QSG_ID' => $QSG_IDs[ EEM_Question_Group::system_address ], |
|
1115 | - 'QST_display_text' => __( 'City', 'event_espresso' ), |
|
1116 | - 'QST_admin_label' => __( 'City - System Question', 'event_espresso' ), |
|
1117 | - 'QST_identifier' => 'city-' . $timestamp, |
|
1114 | + 'QSG_ID' => $QSG_IDs[EEM_Question_Group::system_address], |
|
1115 | + 'QST_display_text' => __('City', 'event_espresso'), |
|
1116 | + 'QST_admin_label' => __('City - System Question', 'event_espresso'), |
|
1117 | + 'QST_identifier' => 'city-'.$timestamp, |
|
1118 | 1118 | 'QST_system' => 'city', |
1119 | 1119 | 'QST_type' => 'TEXT', |
1120 | 1120 | 'QST_required' => 0, |
1121 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1121 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1122 | 1122 | 'QST_desc' => 'The registrant\'s city', |
1123 | - 'QST_html_name' => 'city-' . $timestamp, |
|
1124 | - 'QST_html_id' => 'city-' . $timestamp, |
|
1123 | + 'QST_html_name' => 'city-'.$timestamp, |
|
1124 | + 'QST_html_id' => 'city-'.$timestamp, |
|
1125 | 1125 | 'QST_html_class' => 'city', |
1126 | - 'QST_html_label_id' => 'city-' . $timestamp . '-lbl', |
|
1126 | + 'QST_html_label_id' => 'city-'.$timestamp.'-lbl', |
|
1127 | 1127 | 'QST_html_label_class' => 'city-lbl', |
1128 | 1128 | 'QST_default_value' => '', |
1129 | - 'QST_validation_strategies' => array( 'required' => '' ), |
|
1129 | + 'QST_validation_strategies' => array('required' => ''), |
|
1130 | 1130 | 'QST_validation_message' => '', |
1131 | 1131 | 'QST_order' => 6, |
1132 | 1132 | 'QST_admin_only' => 0, |
@@ -1140,22 +1140,22 @@ discard block |
||
1140 | 1140 | |
1141 | 1141 | case 'state': |
1142 | 1142 | $QST_values = array( |
1143 | - 'QSG_ID' => $QSG_IDs[ EEM_Question_Group::system_address ], |
|
1144 | - 'QST_display_text' => __( 'State/Province', 'event_espresso' ), |
|
1145 | - 'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ), |
|
1146 | - 'QST_identifier' => 'state-' . $timestamp, |
|
1143 | + 'QSG_ID' => $QSG_IDs[EEM_Question_Group::system_address], |
|
1144 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
1145 | + 'QST_admin_label' => __('State/Province - System Question', 'event_espresso'), |
|
1146 | + 'QST_identifier' => 'state-'.$timestamp, |
|
1147 | 1147 | 'QST_system' => 'state', |
1148 | 1148 | 'QST_type' => 'STATE', |
1149 | 1149 | 'QST_required' => 0, |
1150 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1150 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1151 | 1151 | 'QST_desc' => 'The registrant\'s state/province', |
1152 | - 'QST_html_name' => 'state-' . $timestamp, |
|
1153 | - 'QST_html_id' => 'state-' . $timestamp, |
|
1152 | + 'QST_html_name' => 'state-'.$timestamp, |
|
1153 | + 'QST_html_id' => 'state-'.$timestamp, |
|
1154 | 1154 | 'QST_html_class' => 'state', |
1155 | - 'QST_html_label_id' => 'state-' . $timestamp . '-lbl', |
|
1155 | + 'QST_html_label_id' => 'state-'.$timestamp.'-lbl', |
|
1156 | 1156 | 'QST_html_label_class' => 'state-lbl', |
1157 | 1157 | 'QST_default_value' => '', |
1158 | - 'QST_validation_strategies' => array( 'required' => '' ), |
|
1158 | + 'QST_validation_strategies' => array('required' => ''), |
|
1159 | 1159 | 'QST_validation_message' => '', |
1160 | 1160 | 'QST_order' => 7, |
1161 | 1161 | 'QST_admin_only' => 0, |
@@ -1166,22 +1166,22 @@ discard block |
||
1166 | 1166 | |
1167 | 1167 | case 'country' : |
1168 | 1168 | $QST_values = array( |
1169 | - 'QSG_ID' => $QSG_IDs[ EEM_Question_Group::system_address ], |
|
1170 | - 'QST_display_text' => __( 'Country', 'event_espresso' ), |
|
1171 | - 'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ), |
|
1172 | - 'QST_identifier' => 'country-' . $timestamp, |
|
1169 | + 'QSG_ID' => $QSG_IDs[EEM_Question_Group::system_address], |
|
1170 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
1171 | + 'QST_admin_label' => __('Country - System Question', 'event_espresso'), |
|
1172 | + 'QST_identifier' => 'country-'.$timestamp, |
|
1173 | 1173 | 'QST_system' => 'country', |
1174 | 1174 | 'QST_type' => 'COUNTRY', |
1175 | 1175 | 'QST_required' => 0, |
1176 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1176 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1177 | 1177 | 'QST_desc' => 'The registrant\'s country', |
1178 | - 'QST_html_name' => 'country-' . $timestamp, |
|
1179 | - 'QST_html_id' => 'country-' . $timestamp, |
|
1178 | + 'QST_html_name' => 'country-'.$timestamp, |
|
1179 | + 'QST_html_id' => 'country-'.$timestamp, |
|
1180 | 1180 | 'QST_html_class' => 'country', |
1181 | - 'QST_html_label_id' => 'country-' . $timestamp . '-lbl', |
|
1181 | + 'QST_html_label_id' => 'country-'.$timestamp.'-lbl', |
|
1182 | 1182 | 'QST_html_label_class' => 'country-lbl', |
1183 | 1183 | 'QST_default_value' => '', |
1184 | - 'QST_validation_strategies' => array( 'required' => '' ), |
|
1184 | + 'QST_validation_strategies' => array('required' => ''), |
|
1185 | 1185 | 'QST_validation_message' => '', |
1186 | 1186 | 'QST_order' => 8, |
1187 | 1187 | 'QST_admin_only' => 0, |
@@ -1192,22 +1192,22 @@ discard block |
||
1192 | 1192 | |
1193 | 1193 | case 'zip': |
1194 | 1194 | $QST_values = array( |
1195 | - 'QSG_ID' => $QSG_IDs[ EEM_Question_Group::system_address ], |
|
1196 | - 'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ), |
|
1197 | - 'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ), |
|
1198 | - 'QST_identifier' => 'zip-' . $timestamp, |
|
1195 | + 'QSG_ID' => $QSG_IDs[EEM_Question_Group::system_address], |
|
1196 | + 'QST_display_text' => __('Zip/Postal Code', 'event_espresso'), |
|
1197 | + 'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'), |
|
1198 | + 'QST_identifier' => 'zip-'.$timestamp, |
|
1199 | 1199 | 'QST_system' => 'zip', |
1200 | 1200 | 'QST_type' => 'TEXT', |
1201 | 1201 | 'QST_required' => 0, |
1202 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1202 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1203 | 1203 | 'QST_desc' => 'The registrant\'s zip/postal code', |
1204 | - 'QST_html_name' => 'zip-' . $timestamp, |
|
1205 | - 'QST_html_id' => 'zip-' . $timestamp, |
|
1204 | + 'QST_html_name' => 'zip-'.$timestamp, |
|
1205 | + 'QST_html_id' => 'zip-'.$timestamp, |
|
1206 | 1206 | 'QST_html_class' => 'zip', |
1207 | - 'QST_html_label_id' => 'zip-' . $timestamp . '-lbl', |
|
1207 | + 'QST_html_label_id' => 'zip-'.$timestamp.'-lbl', |
|
1208 | 1208 | 'QST_html_label_class' => 'zip-lbl', |
1209 | 1209 | 'QST_default_value' => '', |
1210 | - 'QST_validation_strategies' => array( 'required' => '' ), |
|
1210 | + 'QST_validation_strategies' => array('required' => ''), |
|
1211 | 1211 | 'QST_validation_message' => '', |
1212 | 1212 | 'QST_order' => 9, |
1213 | 1213 | 'QST_admin_only' => 0, |
@@ -1221,22 +1221,22 @@ discard block |
||
1221 | 1221 | |
1222 | 1222 | case 'phone': |
1223 | 1223 | $QST_values = array( |
1224 | - 'QSG_ID' => $QSG_IDs[ EEM_Question_Group::system_address ], |
|
1225 | - 'QST_display_text' => __( 'Phone Number', 'event_espresso' ), |
|
1226 | - 'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ), |
|
1227 | - 'QST_identifier' => 'phone-' . $timestamp, |
|
1224 | + 'QSG_ID' => $QSG_IDs[EEM_Question_Group::system_address], |
|
1225 | + 'QST_display_text' => __('Phone Number', 'event_espresso'), |
|
1226 | + 'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'), |
|
1227 | + 'QST_identifier' => 'phone-'.$timestamp, |
|
1228 | 1228 | 'QST_system' => 'phone', |
1229 | 1229 | 'QST_type' => 'TEXT', |
1230 | 1230 | 'QST_required' => 0, |
1231 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1231 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1232 | 1232 | 'QST_desc' => 'The registrant\'s phone number', |
1233 | - 'QST_html_name' => 'phone-' . $timestamp, |
|
1234 | - 'QST_html_id' => 'phone-' . $timestamp, |
|
1233 | + 'QST_html_name' => 'phone-'.$timestamp, |
|
1234 | + 'QST_html_id' => 'phone-'.$timestamp, |
|
1235 | 1235 | 'QST_html_class' => 'phone', |
1236 | - 'QST_html_label_id' => 'phone-' . $timestamp . '-lbl', |
|
1236 | + 'QST_html_label_id' => 'phone-'.$timestamp.'-lbl', |
|
1237 | 1237 | 'QST_html_label_class' => 'phone-lbl', |
1238 | 1238 | 'QST_default_value' => '', |
1239 | - 'QST_validation_strategies' => array( 'required' => '' ), |
|
1239 | + 'QST_validation_strategies' => array('required' => ''), |
|
1240 | 1240 | 'QST_validation_message' => '', |
1241 | 1241 | 'QST_order' => 10, |
1242 | 1242 | 'QST_admin_only' => 0, |
@@ -1249,12 +1249,12 @@ discard block |
||
1249 | 1249 | break; |
1250 | 1250 | |
1251 | 1251 | } |
1252 | - if ( ! empty( $QST_values )) { |
|
1252 | + if ( ! empty($QST_values)) { |
|
1253 | 1253 | // insert system question |
1254 | 1254 | $wpdb->insert( |
1255 | 1255 | $table_name, |
1256 | 1256 | $QST_values, |
1257 | - array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' ) |
|
1257 | + array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d') |
|
1258 | 1258 | ); |
1259 | 1259 | } |
1260 | 1260 | } |
@@ -1268,11 +1268,11 @@ discard block |
||
1268 | 1268 | * |
1269 | 1269 | * @throws \EE_Error |
1270 | 1270 | */ |
1271 | - public static function insert_default_payment_methods(){ |
|
1272 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
1273 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
1274 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
1275 | - }else{ |
|
1271 | + public static function insert_default_payment_methods() { |
|
1272 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
1273 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
1274 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
1275 | + } else { |
|
1276 | 1276 | EEM_Payment_Method::instance()->verify_button_urls(); |
1277 | 1277 | } |
1278 | 1278 | } |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | |
1289 | 1289 | global $wpdb; |
1290 | 1290 | |
1291 | - if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) { |
|
1291 | + if (EEH_Activation::table_exists(EEM_Status::instance()->table())) { |
|
1292 | 1292 | |
1293 | 1293 | $table_name = EEM_Status::instance()->table(); |
1294 | 1294 | |
@@ -1364,33 +1364,33 @@ discard block |
||
1364 | 1364 | $folders = array( |
1365 | 1365 | EVENT_ESPRESSO_TEMPLATE_DIR, |
1366 | 1366 | EVENT_ESPRESSO_GATEWAY_DIR, |
1367 | - EVENT_ESPRESSO_UPLOAD_DIR . 'logs/', |
|
1368 | - EVENT_ESPRESSO_UPLOAD_DIR . 'css/', |
|
1369 | - EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/' |
|
1367 | + EVENT_ESPRESSO_UPLOAD_DIR.'logs/', |
|
1368 | + EVENT_ESPRESSO_UPLOAD_DIR.'css/', |
|
1369 | + EVENT_ESPRESSO_UPLOAD_DIR.'tickets/' |
|
1370 | 1370 | ); |
1371 | - foreach ( $folders as $folder ) { |
|
1371 | + foreach ($folders as $folder) { |
|
1372 | 1372 | try { |
1373 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
1374 | - @ chmod( $folder, 0755 ); |
|
1375 | - } catch( EE_Error $e ){ |
|
1373 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
1374 | + @ chmod($folder, 0755); |
|
1375 | + } catch (EE_Error $e) { |
|
1376 | 1376 | EE_Error::add_error( |
1377 | 1377 | sprintf( |
1378 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
1378 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
1379 | 1379 | $folder, |
1380 | - '<br />' . $e->getMessage() |
|
1380 | + '<br />'.$e->getMessage() |
|
1381 | 1381 | ), |
1382 | 1382 | __FILE__, __FUNCTION__, __LINE__ |
1383 | 1383 | ); |
1384 | 1384 | //indicate we'll need to fix this later |
1385 | - update_option( EEH_Activation::upload_directories_incomplete_option_name, true ); |
|
1385 | + update_option(EEH_Activation::upload_directories_incomplete_option_name, true); |
|
1386 | 1386 | return FALSE; |
1387 | 1387 | } |
1388 | 1388 | } |
1389 | 1389 | //just add the .htaccess file to the logs directory to begin with. Even if logging |
1390 | 1390 | //is disabled, there might be activation errors recorded in there |
1391 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' ); |
|
1391 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/'); |
|
1392 | 1392 | //remember EE's folders are all good |
1393 | - delete_option( EEH_Activation::upload_directories_incomplete_option_name ); |
|
1393 | + delete_option(EEH_Activation::upload_directories_incomplete_option_name); |
|
1394 | 1394 | return TRUE; |
1395 | 1395 | } |
1396 | 1396 | |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | * @return boolean |
1404 | 1404 | */ |
1405 | 1405 | public static function upload_directories_incomplete() { |
1406 | - return get_option( EEH_Activation::upload_directories_incomplete_option_name, false ); |
|
1406 | + return get_option(EEH_Activation::upload_directories_incomplete_option_name, false); |
|
1407 | 1407 | } |
1408 | 1408 | |
1409 | 1409 | |
@@ -1420,7 +1420,7 @@ discard block |
||
1420 | 1420 | */ |
1421 | 1421 | public static function generate_default_message_templates() { |
1422 | 1422 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
1423 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
1423 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
1424 | 1424 | /* |
1425 | 1425 | * This first method is taking care of ensuring any default messengers |
1426 | 1426 | * that should be made active and have templates generated are done. |
@@ -1456,22 +1456,22 @@ discard block |
||
1456 | 1456 | $active_messengers = $message_resource_manager->active_messengers(); |
1457 | 1457 | $installed_message_types = $message_resource_manager->installed_message_types(); |
1458 | 1458 | $templates_created = false; |
1459 | - foreach ( $active_messengers as $active_messenger ) { |
|
1459 | + foreach ($active_messengers as $active_messenger) { |
|
1460 | 1460 | $default_message_type_names_for_messenger = $active_messenger->get_default_message_types(); |
1461 | 1461 | $default_message_type_names_to_activate = array(); |
1462 | 1462 | // looping through each default message type reported by the messenger |
1463 | 1463 | // and setup the actual message types to activate. |
1464 | - foreach ( $default_message_type_names_for_messenger as $default_message_type_name_for_messenger ) { |
|
1464 | + foreach ($default_message_type_names_for_messenger as $default_message_type_name_for_messenger) { |
|
1465 | 1465 | // if already active or has already been activated before we skip |
1466 | 1466 | // (otherwise we might reactivate something user's intentionally deactivated.) |
1467 | 1467 | // we also skip if the message type is not installed. |
1468 | 1468 | if ( |
1469 | - $message_resource_manager->has_message_type_been_activated_for_messenger( $default_message_type_name_for_messenger, $active_messenger->name ) |
|
1469 | + $message_resource_manager->has_message_type_been_activated_for_messenger($default_message_type_name_for_messenger, $active_messenger->name) |
|
1470 | 1470 | || $message_resource_manager->is_message_type_active_for_messenger( |
1471 | 1471 | $active_messenger->name, |
1472 | 1472 | $default_message_type_name_for_messenger |
1473 | 1473 | ) |
1474 | - || ! isset( $installed_message_types[ $default_message_type_name_for_messenger ] ) |
|
1474 | + || ! isset($installed_message_types[$default_message_type_name_for_messenger]) |
|
1475 | 1475 | ) { |
1476 | 1476 | continue; |
1477 | 1477 | } |
@@ -1484,7 +1484,7 @@ discard block |
||
1484 | 1484 | false |
1485 | 1485 | ); |
1486 | 1486 | //activate the templates for these message types |
1487 | - if ( ! empty( $default_message_type_names_to_activate ) ) { |
|
1487 | + if ( ! empty($default_message_type_names_to_activate)) { |
|
1488 | 1488 | $templates_created = EEH_MSG_Template::generate_new_templates( |
1489 | 1489 | $active_messenger->name, |
1490 | 1490 | $default_message_type_names_for_messenger, |
@@ -1511,18 +1511,18 @@ discard block |
||
1511 | 1511 | EE_Message_Resource_Manager $message_resource_manager |
1512 | 1512 | ) { |
1513 | 1513 | /** @type EE_messenger[] $messengers_to_generate */ |
1514 | - $messengers_to_generate = self::_get_default_messengers_to_generate_on_activation( $message_resource_manager ); |
|
1514 | + $messengers_to_generate = self::_get_default_messengers_to_generate_on_activation($message_resource_manager); |
|
1515 | 1515 | $installed_message_types = $message_resource_manager->installed_message_types(); |
1516 | 1516 | $templates_generated = false; |
1517 | - foreach ( $messengers_to_generate as $messenger_to_generate ) { |
|
1517 | + foreach ($messengers_to_generate as $messenger_to_generate) { |
|
1518 | 1518 | $default_message_type_names_for_messenger = $messenger_to_generate->get_default_message_types(); |
1519 | 1519 | //verify the default message types match an installed message type. |
1520 | - foreach ( $default_message_type_names_for_messenger as $key => $name ) { |
|
1520 | + foreach ($default_message_type_names_for_messenger as $key => $name) { |
|
1521 | 1521 | if ( |
1522 | - ! isset( $installed_message_types[ $name ] ) |
|
1523 | - || $message_resource_manager->has_message_type_been_activated_for_messenger( $name, $messenger_to_generate->name ) |
|
1522 | + ! isset($installed_message_types[$name]) |
|
1523 | + || $message_resource_manager->has_message_type_been_activated_for_messenger($name, $messenger_to_generate->name) |
|
1524 | 1524 | ) { |
1525 | - unset( $default_message_type_names_for_messenger[ $key ] ); |
|
1525 | + unset($default_message_type_names_for_messenger[$key]); |
|
1526 | 1526 | } |
1527 | 1527 | } |
1528 | 1528 | // in previous iterations, the active_messengers option in the db |
@@ -1536,7 +1536,7 @@ discard block |
||
1536 | 1536 | false |
1537 | 1537 | ); |
1538 | 1538 | //create any templates needing created (or will reactivate templates already generated as necessary). |
1539 | - if ( ! empty( $default_message_type_names_for_messenger ) ) { |
|
1539 | + if ( ! empty($default_message_type_names_for_messenger)) { |
|
1540 | 1540 | $templates_generated = EEH_MSG_Template::generate_new_templates( |
1541 | 1541 | $messenger_to_generate->name, |
1542 | 1542 | $default_message_type_names_for_messenger, |
@@ -1568,18 +1568,18 @@ discard block |
||
1568 | 1568 | $has_activated = $message_resource_manager->get_has_activated_messengers_option(); |
1569 | 1569 | |
1570 | 1570 | $messengers_to_generate = array(); |
1571 | - foreach ( $installed_messengers as $installed_messenger ) { |
|
1571 | + foreach ($installed_messengers as $installed_messenger) { |
|
1572 | 1572 | //if installed messenger is a messenger that should be activated on install |
1573 | 1573 | //and is not already active |
1574 | 1574 | //and has never been activated |
1575 | 1575 | if ( |
1576 | 1576 | ! $installed_messenger->activate_on_install |
1577 | - || isset( $active_messengers[ $installed_messenger->name ] ) |
|
1578 | - || isset( $has_activated[ $installed_messenger->name ] ) |
|
1577 | + || isset($active_messengers[$installed_messenger->name]) |
|
1578 | + || isset($has_activated[$installed_messenger->name]) |
|
1579 | 1579 | ) { |
1580 | 1580 | continue; |
1581 | 1581 | } |
1582 | - $messengers_to_generate[ $installed_messenger->name ] = $installed_messenger; |
|
1582 | + $messengers_to_generate[$installed_messenger->name] = $installed_messenger; |
|
1583 | 1583 | } |
1584 | 1584 | return $messengers_to_generate; |
1585 | 1585 | } |
@@ -1604,9 +1604,9 @@ discard block |
||
1604 | 1604 | */ |
1605 | 1605 | public static function validate_messages_system() { |
1606 | 1606 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
1607 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
1607 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
1608 | 1608 | $message_resource_manager->validate_active_message_types_are_installed(); |
1609 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
1609 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
1610 | 1610 | } |
1611 | 1611 | |
1612 | 1612 | |
@@ -1619,12 +1619,12 @@ discard block |
||
1619 | 1619 | * @static |
1620 | 1620 | * @return void |
1621 | 1621 | */ |
1622 | - public static function create_no_ticket_prices_array(){ |
|
1622 | + public static function create_no_ticket_prices_array() { |
|
1623 | 1623 | // this creates an array for tracking events that have no active ticket prices created |
1624 | 1624 | // this allows us to warn admins of the situation so that it can be corrected |
1625 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
1626 | - if ( ! $espresso_no_ticket_prices ) { |
|
1627 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
1625 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
1626 | + if ( ! $espresso_no_ticket_prices) { |
|
1627 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
1628 | 1628 | } |
1629 | 1629 | } |
1630 | 1630 | |
@@ -1649,24 +1649,24 @@ discard block |
||
1649 | 1649 | * @global wpdb $wpdb |
1650 | 1650 | * @throws \EE_Error |
1651 | 1651 | */ |
1652 | - public static function delete_all_espresso_cpt_data(){ |
|
1652 | + public static function delete_all_espresso_cpt_data() { |
|
1653 | 1653 | global $wpdb; |
1654 | 1654 | //get all the CPT post_types |
1655 | 1655 | $ee_post_types = array(); |
1656 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
1657 | - if ( method_exists( $model_name, 'instance' )) { |
|
1658 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1659 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
1660 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
1656 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1657 | + if (method_exists($model_name, 'instance')) { |
|
1658 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1659 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
1660 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
1661 | 1661 | } |
1662 | 1662 | } |
1663 | 1663 | } |
1664 | 1664 | //get all our CPTs |
1665 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
1665 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
1666 | 1666 | $cpt_ids = $wpdb->get_col($query); |
1667 | 1667 | //delete each post meta and term relations too |
1668 | - foreach($cpt_ids as $post_id){ |
|
1669 | - wp_delete_post($post_id,true); |
|
1668 | + foreach ($cpt_ids as $post_id) { |
|
1669 | + wp_delete_post($post_id, true); |
|
1670 | 1670 | } |
1671 | 1671 | } |
1672 | 1672 | |
@@ -1680,18 +1680,18 @@ discard block |
||
1680 | 1680 | * @param bool $remove_all |
1681 | 1681 | * @return void |
1682 | 1682 | */ |
1683 | - public static function delete_all_espresso_tables_and_data( $remove_all = true ) { |
|
1683 | + public static function delete_all_espresso_tables_and_data($remove_all = true) { |
|
1684 | 1684 | global $wpdb; |
1685 | 1685 | $undeleted_tables = array(); |
1686 | 1686 | |
1687 | 1687 | // load registry |
1688 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
1689 | - if ( method_exists( $model_name, 'instance' )) { |
|
1690 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1691 | - if ( $model_obj instanceof EEM_Base ) { |
|
1692 | - foreach ( $model_obj->get_tables() as $table ) { |
|
1693 | - if ( strpos( $table->get_table_name(), 'esp_' )) { |
|
1694 | - switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) { |
|
1688 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1689 | + if (method_exists($model_name, 'instance')) { |
|
1690 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1691 | + if ($model_obj instanceof EEM_Base) { |
|
1692 | + foreach ($model_obj->get_tables() as $table) { |
|
1693 | + if (strpos($table->get_table_name(), 'esp_')) { |
|
1694 | + switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) { |
|
1695 | 1695 | case false : |
1696 | 1696 | $undeleted_tables[] = $table->get_table_name(); |
1697 | 1697 | break; |
@@ -1716,8 +1716,8 @@ discard block |
||
1716 | 1716 | 'esp_promotion_rule', |
1717 | 1717 | 'esp_rule' |
1718 | 1718 | ); |
1719 | - foreach( $tables_without_models as $table ){ |
|
1720 | - EEH_Activation::delete_db_table_if_empty( $table ); |
|
1719 | + foreach ($tables_without_models as $table) { |
|
1720 | + EEH_Activation::delete_db_table_if_empty($table); |
|
1721 | 1721 | } |
1722 | 1722 | |
1723 | 1723 | |
@@ -1755,58 +1755,58 @@ discard block |
||
1755 | 1755 | 'ee_job_parameters_' => false, |
1756 | 1756 | 'ee_upload_directories_incomplete' => true, |
1757 | 1757 | ); |
1758 | - if( is_main_site() ) { |
|
1759 | - $wp_options_to_delete[ 'ee_network_config' ] = true; |
|
1758 | + if (is_main_site()) { |
|
1759 | + $wp_options_to_delete['ee_network_config'] = true; |
|
1760 | 1760 | } |
1761 | 1761 | |
1762 | 1762 | $undeleted_options = array(); |
1763 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
1763 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
1764 | 1764 | |
1765 | - if( $no_wildcard ){ |
|
1766 | - if( ! delete_option( $option_name ) ){ |
|
1765 | + if ($no_wildcard) { |
|
1766 | + if ( ! delete_option($option_name)) { |
|
1767 | 1767 | $undeleted_options[] = $option_name; |
1768 | 1768 | } |
1769 | - }else{ |
|
1770 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
1771 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
1772 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
1769 | + } else { |
|
1770 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
1771 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
1772 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
1773 | 1773 | $undeleted_options[] = $option_name_from_wildcard; |
1774 | 1774 | } |
1775 | 1775 | } |
1776 | 1776 | } |
1777 | 1777 | } |
1778 | 1778 | //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
1779 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1779 | + remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10); |
|
1780 | 1780 | |
1781 | - if ( $remove_all && $espresso_db_update = (array) get_option( 'espresso_db_update' )) { |
|
1781 | + if ($remove_all && $espresso_db_update = (array) get_option('espresso_db_update')) { |
|
1782 | 1782 | $db_update_sans_ee4 = array(); |
1783 | - foreach($espresso_db_update as $version => $times_activated){ |
|
1784 | - if( (string)$version[0] === '3'){//if its NON EE4 |
|
1783 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
1784 | + if ((string) $version[0] === '3') {//if its NON EE4 |
|
1785 | 1785 | $db_update_sans_ee4[$version] = $times_activated; |
1786 | 1786 | } |
1787 | 1787 | } |
1788 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
1788 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
1789 | 1789 | } |
1790 | 1790 | |
1791 | 1791 | $errors = ''; |
1792 | - if ( ! empty( $undeleted_tables )) { |
|
1792 | + if ( ! empty($undeleted_tables)) { |
|
1793 | 1793 | $errors .= sprintf( |
1794 | - __( 'The following tables could not be deleted: %s%s', 'event_espresso' ), |
|
1794 | + __('The following tables could not be deleted: %s%s', 'event_espresso'), |
|
1795 | 1795 | '<br/>', |
1796 | - implode( ',<br/>', $undeleted_tables ) |
|
1796 | + implode(',<br/>', $undeleted_tables) |
|
1797 | 1797 | ); |
1798 | 1798 | } |
1799 | - if ( ! empty( $undeleted_options )) { |
|
1800 | - $errors .= ! empty( $undeleted_tables ) ? '<br/>' : ''; |
|
1799 | + if ( ! empty($undeleted_options)) { |
|
1800 | + $errors .= ! empty($undeleted_tables) ? '<br/>' : ''; |
|
1801 | 1801 | $errors .= sprintf( |
1802 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
1802 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
1803 | 1803 | '<br/>', |
1804 | - implode( ',<br/>', $undeleted_options ) |
|
1804 | + implode(',<br/>', $undeleted_options) |
|
1805 | 1805 | ); |
1806 | 1806 | |
1807 | 1807 | } |
1808 | - if ( ! empty( $errors ) ) { |
|
1809 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
1808 | + if ( ! empty($errors)) { |
|
1809 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
1810 | 1810 | } |
1811 | 1811 | } |
1812 | 1812 | |
@@ -1816,10 +1816,10 @@ discard block |
||
1816 | 1816 | */ |
1817 | 1817 | public static function last_wpdb_error_code() { |
1818 | 1818 | global $wpdb; |
1819 | - if( $wpdb->use_mysqli ) { |
|
1820 | - return mysqli_errno( $wpdb->dbh ); |
|
1819 | + if ($wpdb->use_mysqli) { |
|
1820 | + return mysqli_errno($wpdb->dbh); |
|
1821 | 1821 | } else { |
1822 | - return mysql_errno( $wpdb->dbh ); |
|
1822 | + return mysql_errno($wpdb->dbh); |
|
1823 | 1823 | } |
1824 | 1824 | } |
1825 | 1825 | |
@@ -1829,23 +1829,23 @@ discard block |
||
1829 | 1829 | * @param string $table_name with or without $wpdb->prefix |
1830 | 1830 | * @return boolean |
1831 | 1831 | */ |
1832 | - public static function table_exists( $table_name ){ |
|
1832 | + public static function table_exists($table_name) { |
|
1833 | 1833 | global $wpdb, $EZSQL_ERROR; |
1834 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
1834 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
1835 | 1835 | //ignore if this causes an sql error |
1836 | 1836 | $old_error = $wpdb->last_error; |
1837 | 1837 | $old_suppress_errors = $wpdb->suppress_errors(); |
1838 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
1838 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
1839 | 1839 | $ezsql_error_cache = $EZSQL_ERROR; |
1840 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
1841 | - $wpdb->show_errors( $old_show_errors_value ); |
|
1842 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
1840 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
1841 | + $wpdb->show_errors($old_show_errors_value); |
|
1842 | + $wpdb->suppress_errors($old_suppress_errors); |
|
1843 | 1843 | $new_error = $wpdb->last_error; |
1844 | 1844 | $wpdb->last_error = $old_error; |
1845 | 1845 | $EZSQL_ERROR = $ezsql_error_cache; |
1846 | 1846 | //if there was a table doesn't exist error |
1847 | - if( ! empty( $new_error ) ) { |
|
1848 | - if( |
|
1847 | + if ( ! empty($new_error)) { |
|
1848 | + if ( |
|
1849 | 1849 | in_array( |
1850 | 1850 | EEH_Activation::last_wpdb_error_code(), |
1851 | 1851 | array( |
@@ -1855,14 +1855,14 @@ discard block |
||
1855 | 1855 | ) |
1856 | 1856 | ) |
1857 | 1857 | || |
1858 | - preg_match( '~^Table .* doesn\'t exist~', $new_error ) //in case not using mysql and error codes aren't reliable, just check for this error string |
|
1858 | + preg_match('~^Table .* doesn\'t exist~', $new_error) //in case not using mysql and error codes aren't reliable, just check for this error string |
|
1859 | 1859 | ) { |
1860 | 1860 | return false; |
1861 | 1861 | } else { |
1862 | 1862 | //log this because that's weird. Just use the normal PHP error log |
1863 | 1863 | error_log( |
1864 | 1864 | sprintf( |
1865 | - __( 'Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso' ), |
|
1865 | + __('Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso'), |
|
1866 | 1866 | $new_error |
1867 | 1867 | ) |
1868 | 1868 | ); |
@@ -1874,7 +1874,7 @@ discard block |
||
1874 | 1874 | /** |
1875 | 1875 | * Resets the cache on EEH_Activation |
1876 | 1876 | */ |
1877 | - public static function reset(){ |
|
1877 | + public static function reset() { |
|
1878 | 1878 | self::$_default_creator_id = NULL; |
1879 | 1879 | self::$_initialized_db_content_already_in_this_request = false; |
1880 | 1880 | } |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | * @since 4.6.0 |
568 | 568 | * @global WPDB $wpdb |
569 | 569 | * |
570 | - * @return mixed null|int WP_user ID or NULL |
|
570 | + * @return integer|null null|int WP_user ID or NULL |
|
571 | 571 | */ |
572 | 572 | public static function get_default_creator_id() { |
573 | 573 | global $wpdb; |
@@ -713,6 +713,7 @@ discard block |
||
713 | 713 | * @access public |
714 | 714 | * @static |
715 | 715 | * @param string $table_name, without prefixed $wpdb->prefix |
716 | + * @param string $table_name |
|
716 | 717 | * @return array|boolean of database column names |
717 | 718 | */ |
718 | 719 | public static function get_fields_on_table( $table_name = NULL ) { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | if ( is_array( $hooks_to_fire_at_time ) ) { |
219 | 219 | foreach ( (array) $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
220 | 220 | if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
221 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
221 | + && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
222 | 222 | ) { |
223 | 223 | unset( $crons[ $timestamp ][ $hook_name ] ); |
224 | 224 | } |
@@ -1775,8 +1775,8 @@ discard block |
||
1775 | 1775 | } |
1776 | 1776 | } |
1777 | 1777 | } |
1778 | - //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1779 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1778 | + //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1779 | + remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1780 | 1780 | |
1781 | 1781 | if ( $remove_all && $espresso_db_update = (array) get_option( 'espresso_db_update' )) { |
1782 | 1782 | $db_update_sans_ee4 = array(); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\admin_pages\registration_form; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @throws \EE_Error |
80 | 80 | */ |
81 | 81 | public function getAdminPageTitle() { |
82 | - $page_title = ucwords( str_replace( '_', ' ', $this->reg_form_admin_page->get_req_action() ) ); |
|
82 | + $page_title = ucwords(str_replace('_', ' ', $this->reg_form_admin_page->get_req_action())); |
|
83 | 83 | return $this->question_group->ID() |
84 | - ? $page_title . ' # ' . $this->question_group->ID() |
|
84 | + ? $page_title.' # '.$this->question_group->ID() |
|
85 | 85 | : $page_title; |
86 | 86 | } |
87 | 87 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @throws \EE_Error |
95 | 95 | */ |
96 | 96 | public function getAdditionalHiddenFields() { |
97 | - if ( $this->question_group->ID() ) { |
|
98 | - return array( 'QSG_ID' => array( 'type' => 'hidden', 'value' => $this->question_group->ID() ) ); |
|
97 | + if ($this->question_group->ID()) { |
|
98 | + return array('QSG_ID' => array('type' => 'hidden', 'value' => $this->question_group->ID())); |
|
99 | 99 | } else { |
100 | 100 | return array(); |
101 | 101 | } |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | * @throws \EE_Error |
131 | 131 | */ |
132 | 132 | public function getAdminPageContent() { |
133 | - \EE_Registry::instance()->load_helper( 'EEH_HTML' ); |
|
134 | - $html = \EEH_HTML::div( '', 'ee-reg-form-editor-form-main-meta-box', 'ee-reg-form-editor-form-dv postbox' ); |
|
133 | + \EE_Registry::instance()->load_helper('EEH_HTML'); |
|
134 | + $html = \EEH_HTML::div('', 'ee-reg-form-editor-form-main-meta-box', 'ee-reg-form-editor-form-dv postbox'); |
|
135 | 135 | $html .= \EEH_HTML::div( |
136 | 136 | '', |
137 | 137 | 'ee-reg-form-editor-form-inputs-wrapper-dv', |
138 | 138 | 'ee-reg-form-editor-form-inputs-wrapper-dv' |
139 | 139 | ); |
140 | - $html .= \EEH_HTML::ul( 'ee-reg-form-editor-active-form-ul', 'sortable' ); |
|
140 | + $html .= \EEH_HTML::ul('ee-reg-form-editor-active-form-ul', 'sortable'); |
|
141 | 141 | // foreach ( $this->available_form_inputs as $form_input => $form_input_class_name ) { |
142 | 142 | // \EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
143 | 143 | // \EEH_Debug_Tools::printr( $form_input_class_name, '$form_input_class_name', __FILE__, __LINE__ ); |
144 | 144 | // } |
145 | - if ( $this->question_group->ID() ) { |
|
146 | - foreach ( $this->question_group->questions() as $question ) { |
|
145 | + if ($this->question_group->ID()) { |
|
146 | + foreach ($this->question_group->questions() as $question) { |
|
147 | 147 | $html .= $this->formatInputListItem( |
148 | 148 | $question->identifier(), |
149 | 149 | $question->get_form_input_class_name(), |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | $html .= \EEH_HTML::ulx(); |
156 | - $html .= \EEH_HTML::div( '', '', 'ee-reg-form-editor-form-new-input-dv droppable' ); |
|
157 | - $html .= \EEH_HTML::h2( 'drag and drop form inputs to add', '', 'ee-reg-form-editor-form-new-input-hdr' ); |
|
156 | + $html .= \EEH_HTML::div('', '', 'ee-reg-form-editor-form-new-input-dv droppable'); |
|
157 | + $html .= \EEH_HTML::h2('drag and drop form inputs to add', '', 'ee-reg-form-editor-form-new-input-hdr'); |
|
158 | 158 | $html .= \EEH_HTML::divx(); |
159 | 159 | $html .= \EEH_HTML::divx(); |
160 | 160 | $html .= \EEH_HTML::divx(); |
161 | - do_action( 'AHEE__EE_Admin_Page__reg_form_editor_form_sections_meta_box__after_content' ); |
|
161 | + do_action('AHEE__EE_Admin_Page__reg_form_editor_form_sections_meta_box__after_content'); |
|
162 | 162 | $input_list = new \EE_Hidden_Input( |
163 | 163 | array( |
164 | 164 | 'html_id' => 'reg_form-input_list', |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | 'ee-reg-form-editor-form-layout-meta-box', |
183 | 183 | 'ee-reg-form-editor-form-layout-dv infolinks' |
184 | 184 | ); |
185 | - $html .= \EEH_HTML::ul( '', 'ee-reg-form-editor-form-layout-ul draggable' ); |
|
185 | + $html .= \EEH_HTML::ul('', 'ee-reg-form-editor-form-layout-ul draggable'); |
|
186 | 186 | $html .= \EEH_HTML::li( |
187 | 187 | '', |
188 | 188 | 'ee-reg-form-editor-form-layout-li-html', |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $html .= \EEH_HTML::ulx(); |
200 | 200 | $html .= \EEH_HTML::divx(); |
201 | 201 | echo $html; |
202 | - do_action( 'AHEE__EE_Admin_Page__reg_form_editor_form_layout_meta_box__after_content' ); |
|
202 | + do_action('AHEE__EE_Admin_Page__reg_form_editor_form_layout_meta_box__after_content'); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -208,19 +208,19 @@ discard block |
||
208 | 208 | * addMetaBoxes |
209 | 209 | */ |
210 | 210 | public function addMetaBoxes() { |
211 | - \EE_Registry::instance()->load_helper( 'EEH_HTML' ); |
|
211 | + \EE_Registry::instance()->load_helper('EEH_HTML'); |
|
212 | 212 | //sidebars |
213 | 213 | add_meta_box( |
214 | 214 | 'espresso_reg_form_editor_form_layout_meta_box', |
215 | - __( 'Form Layout', 'event_espresso' ), |
|
216 | - array( $this, 'formLayoutMetaBox' ), |
|
215 | + __('Form Layout', 'event_espresso'), |
|
216 | + array($this, 'formLayoutMetaBox'), |
|
217 | 217 | $this->reg_form_admin_page->get_wp_page_slug(), |
218 | 218 | 'side' |
219 | 219 | ); |
220 | 220 | add_meta_box( |
221 | 221 | 'espresso_reg_form_editor_form_inputs_meta_box', |
222 | - __( 'Form Inputs', 'event_espresso' ), |
|
223 | - array( $this, 'formInputsMetaBox' ), |
|
222 | + __('Form Inputs', 'event_espresso'), |
|
223 | + array($this, 'formInputsMetaBox'), |
|
224 | 224 | $this->reg_form_admin_page->get_wp_page_slug(), |
225 | 225 | 'side' |
226 | 226 | ); |
@@ -240,27 +240,27 @@ discard block |
||
240 | 240 | 'ee-reg-form-editor-form-inputs-meta-box', |
241 | 241 | 'ee-reg-form-editor-form-inputs-dv infolinks' |
242 | 242 | ); |
243 | - $html .= \EEH_HTML::ul( '', 'ee-reg-form-editor-form-inputs-ul draggable' ); |
|
244 | - foreach ( $this->available_form_inputs as $form_input => $form_input_class_name ) { |
|
243 | + $html .= \EEH_HTML::ul('', 'ee-reg-form-editor-form-inputs-ul draggable'); |
|
244 | + foreach ($this->available_form_inputs as $form_input => $form_input_class_name) { |
|
245 | 245 | $html .= \EEH_HTML::li( |
246 | 246 | '', |
247 | - 'ee-reg-form-editor-form-input-li-' . $form_input, |
|
247 | + 'ee-reg-form-editor-form-input-li-'.$form_input, |
|
248 | 248 | 'ee-reg-form-editor-form-input-li' |
249 | 249 | ); |
250 | 250 | $html .= \EEH_HTML::div( |
251 | - $this->formatInputName( $form_input_class_name ), |
|
252 | - 'ee-reg-form-editor-form-input-' . $form_input, |
|
251 | + $this->formatInputName($form_input_class_name), |
|
252 | + 'ee-reg-form-editor-form-input-'.$form_input, |
|
253 | 253 | 'ee-reg-form-editor-form-input draggable button', |
254 | 254 | '', |
255 | - 'data-form_input="ee-reg-form-editor-active-form-li-' . $form_input . '"' |
|
255 | + 'data-form_input="ee-reg-form-editor-active-form-li-'.$form_input.'"' |
|
256 | 256 | ); |
257 | - $html .= $this->formatInputListItem( $form_input, $form_input_class_name ); |
|
257 | + $html .= $this->formatInputListItem($form_input, $form_input_class_name); |
|
258 | 258 | $html .= \EEH_HTML::lix(); // end 'ee-reg-form-editor-form-input-li' |
259 | 259 | } |
260 | 260 | $html .= \EEH_HTML::ulx(); |
261 | 261 | $html .= \EEH_HTML::divx(); |
262 | 262 | echo $html; |
263 | - do_action( 'AHEE__EE_Admin_Page__reg_form_editor_form_sections_meta_box__after_content' ); |
|
263 | + do_action('AHEE__EE_Admin_Page__reg_form_editor_form_sections_meta_box__after_content'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -283,41 +283,41 @@ discard block |
||
283 | 283 | ) { |
284 | 284 | $html = \EEH_HTML::li( |
285 | 285 | '', |
286 | - 'ee-reg-form-editor-active-form-li-' . $form_input, |
|
286 | + 'ee-reg-form-editor-active-form-li-'.$form_input, |
|
287 | 287 | 'ee-reg-form-editor-active-form-li', |
288 | 288 | ! $display ? 'display:none;' : '' |
289 | 289 | ); |
290 | - $html .= \EEH_HTML::div( '', '', 'ee-reg-form-editor-active-form-controls-dv' ); |
|
290 | + $html .= \EEH_HTML::div('', '', 'ee-reg-form-editor-active-form-controls-dv'); |
|
291 | 291 | $html .= \EEH_HTML::span( |
292 | 292 | '', |
293 | 293 | '', |
294 | 294 | 'ee-form-input-control-config ee-config-form-input dashicons dashicons-admin-generic', |
295 | 295 | '', |
296 | - 'title="' . __( 'Click to Edit Settings', 'event_espresso' ) . '"' |
|
296 | + 'title="'.__('Click to Edit Settings', 'event_espresso').'"' |
|
297 | 297 | ); |
298 | 298 | $html .= \EEH_HTML::span( |
299 | 299 | '', |
300 | 300 | '', |
301 | 301 | 'ee-form-input-control-delete ee-delete-form-input dashicons dashicons-trash', |
302 | 302 | '', |
303 | - 'title="' . __( 'Click to Delete', 'event_espresso' ) . '"' |
|
303 | + 'title="'.__('Click to Delete', 'event_espresso').'"' |
|
304 | 304 | ); |
305 | 305 | $html .= \EEH_HTML::span( |
306 | 306 | '', |
307 | 307 | '', |
308 | 308 | 'ee-form-input-control-sort dashicons dashicons-arrow-up-alt2', |
309 | 309 | '', |
310 | - 'title="' . __( 'Drag to Sort', 'event_espresso' ) . '"' |
|
310 | + 'title="'.__('Drag to Sort', 'event_espresso').'"' |
|
311 | 311 | ); |
312 | 312 | $html .= \EEH_HTML::span( |
313 | 313 | '', |
314 | 314 | '', |
315 | 315 | 'ee-form-input-control-sort dashicons dashicons-arrow-down-alt2', //list-view |
316 | 316 | '', |
317 | - 'title="' . __( 'Drag to Sort', 'event_espresso' ) . '"' |
|
317 | + 'title="'.__('Drag to Sort', 'event_espresso').'"' |
|
318 | 318 | ); |
319 | 319 | $html .= \EEH_HTML::divx(); // end 'ee-reg-form-editor-active-form-controls-dv' |
320 | - $html .= $this->input_form_generator->formHTML( $form_input, $form_input_class_name, $question ); |
|
320 | + $html .= $this->input_form_generator->formHTML($form_input, $form_input_class_name, $question); |
|
321 | 321 | $html .= \EEH_HTML::lix(); // end 'ee-reg-form-editor-active-form-li' |
322 | 322 | return $html; |
323 | 323 | } |
@@ -330,15 +330,15 @@ discard block |
||
330 | 330 | * @param $form_input_class_name |
331 | 331 | * @return string |
332 | 332 | */ |
333 | - protected function formatInputName( $form_input_class_name ) { |
|
333 | + protected function formatInputName($form_input_class_name) { |
|
334 | 334 | $form_input_class_name = trim( |
335 | 335 | str_replace( |
336 | - array( '\EE_', '_Input', '_' ), // find |
|
337 | - array( '', '', ' ' ), // replace |
|
336 | + array('\EE_', '_Input', '_'), // find |
|
337 | + array('', '', ' '), // replace |
|
338 | 338 | $form_input_class_name |
339 | 339 | ) |
340 | 340 | ); |
341 | - switch( $form_input_class_name ) { |
|
341 | + switch ($form_input_class_name) { |
|
342 | 342 | case 'Admin File Uploader' : |
343 | 343 | $form_input_class_name = 'File Uploader'; |
344 | 344 | break; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | $lock_icon = $system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers |
123 | 123 | ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock'; |
124 | 124 | return $system_group > 0 |
125 | - || ( $system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers ) |
|
126 | - || ! \EE_Registry::instance()->CAP->current_user_can( |
|
125 | + || ( $system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers ) |
|
126 | + || ! \EE_Registry::instance()->CAP->current_user_can( |
|
127 | 127 | 'ee_delete_question_groups', |
128 | 128 | 'espresso_registration_form_trash_form_sections', |
129 | 129 | $item->ID() |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | ) { |
193 | 193 | $actions = array( |
194 | 194 | 'edit' => '<a href="' |
195 | - . $edit_link |
|
196 | - . '" title="' |
|
197 | - . esc_attr__( 'Edit Question Group', 'event_espresso' ) |
|
198 | - . '">' |
|
199 | - . __( 'Edit', 'event_espresso' ) |
|
200 | - . '</a>' |
|
195 | + . $edit_link |
|
196 | + . '" title="' |
|
197 | + . esc_attr__( 'Edit Question Group', 'event_espresso' ) |
|
198 | + . '">' |
|
199 | + . __( 'Edit', 'event_espresso' ) |
|
200 | + . '</a>' |
|
201 | 201 | ); |
202 | 202 | } |
203 | 203 | if ( |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
228 | 228 | } |
229 | 229 | if ( ! $item->has_questions_with_answers() |
230 | - && \EE_Registry::instance()->CAP->current_user_can( |
|
230 | + && \EE_Registry::instance()->CAP->current_user_can( |
|
231 | 231 | 'ee_delete_question_group', |
232 | 232 | 'espresso_registration_form_delete_form_section', |
233 | 233 | $item->ID() |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\admin_pages\registration_form; |
3 | 3 | |
4 | -defined( 'ABSPATH' ) || exit; |
|
4 | +defined('ABSPATH') || exit; |
|
5 | 5 | |
6 | 6 | |
7 | 7 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param \Registration_Form_Admin_Page $admin_page |
31 | 31 | */ |
32 | - public function __construct( \Registration_Form_Admin_Page $admin_page ) { |
|
32 | + public function __construct(\Registration_Form_Admin_Page $admin_page) { |
|
33 | 33 | $this->adminPage = $admin_page; |
34 | - parent::__construct( $admin_page ); |
|
34 | + parent::__construct($admin_page); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -41,32 +41,32 @@ discard block |
||
41 | 41 | $this->_per_page, |
42 | 42 | $this->_current_page, |
43 | 43 | false |
44 | - ) : $this->adminPage->get_trashed_form_sections( $this->_per_page, $this->_current_page, false ); |
|
44 | + ) : $this->adminPage->get_trashed_form_sections($this->_per_page, $this->_current_page, false); |
|
45 | 45 | $this->_all_data_count = $this->_view !== 'trash' ? $this->adminPage->get_form_sections( |
46 | 46 | $this->_per_page, |
47 | 47 | $this->_current_page, |
48 | 48 | true |
49 | - ) : $this->adminPage->get_trashed_form_sections( $this->_per_page, $this->_current_page, true ); |
|
49 | + ) : $this->adminPage->get_trashed_form_sections($this->_per_page, $this->_current_page, true); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | 54 | protected function _set_properties() { |
55 | 55 | $this->_wp_list_args = array( |
56 | - 'singular' => __( 'question group', 'event_espresso' ), |
|
57 | - 'plural' => __( 'question groups', 'event_espresso' ), |
|
56 | + 'singular' => __('question group', 'event_espresso'), |
|
57 | + 'plural' => __('question groups', 'event_espresso'), |
|
58 | 58 | 'ajax' => true, //for now, |
59 | 59 | 'screen' => $this->adminPage->get_current_screen()->id |
60 | 60 | ); |
61 | 61 | $this->_columns = array( |
62 | 62 | 'cb' => '<input type="checkbox" />', |
63 | - 'id' => __( 'ID', 'event_espresso' ), |
|
64 | - 'name' => __( 'Form Section Name', 'event_espresso' ), |
|
65 | - 'description' => __( 'Description', 'event_espresso' ), |
|
63 | + 'id' => __('ID', 'event_espresso'), |
|
64 | + 'name' => __('Form Section Name', 'event_espresso'), |
|
65 | + 'description' => __('Description', 'event_espresso'), |
|
66 | 66 | ); |
67 | 67 | $this->_sortable_columns = array( |
68 | - 'id' => array( 'QSG_ID' => false ), |
|
69 | - 'name' => array( 'QSG_name' => false ) |
|
68 | + 'id' => array('QSG_ID' => false), |
|
69 | + 'name' => array('QSG_name' => false) |
|
70 | 70 | ); |
71 | 71 | $this->_hidden_columns = array( |
72 | 72 | 'id' |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->_current_page, |
97 | 97 | true |
98 | 98 | ); |
99 | - if ( \EE_Registry::instance()->CAP->current_user_can( |
|
99 | + if (\EE_Registry::instance()->CAP->current_user_can( |
|
100 | 100 | 'ee_delete_question_groups', |
101 | 101 | 'espresso_registration_form_trash_form_section' |
102 | 102 | ) |
@@ -116,19 +116,19 @@ discard block |
||
116 | 116 | * @return string|void |
117 | 117 | * @throws \EE_Error |
118 | 118 | */ |
119 | - public function column_cb( $item ) { |
|
120 | - $system_group = $item->get( 'QSG_system' ); |
|
119 | + public function column_cb($item) { |
|
120 | + $system_group = $item->get('QSG_system'); |
|
121 | 121 | $has_questions_with_answers = $item->has_questions_with_answers(); |
122 | 122 | $lock_icon = $system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers |
123 | 123 | ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock'; |
124 | 124 | return $system_group > 0 |
125 | - || ( $system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers ) |
|
125 | + || ($system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers) |
|
126 | 126 | || ! \EE_Registry::instance()->CAP->current_user_can( |
127 | 127 | 'ee_delete_question_groups', |
128 | 128 | 'espresso_registration_form_trash_form_sections', |
129 | 129 | $item->ID() |
130 | 130 | ) |
131 | - ? '<span class="' . $lock_icon . '"></span>' . sprintf( |
|
131 | + ? '<span class="'.$lock_icon.'"></span>'.sprintf( |
|
132 | 132 | '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', |
133 | 133 | $item->ID() |
134 | 134 | ) |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | * @return mixed|string |
146 | 146 | * @throws \EE_Error |
147 | 147 | */ |
148 | - public function column_id( \EE_Question_Group $item ) { |
|
148 | + public function column_id(\EE_Question_Group $item) { |
|
149 | 149 | $content = $item->ID(); |
150 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
150 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
151 | 151 | return $content; |
152 | 152 | } |
153 | 153 | |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | * @return string |
159 | 159 | * @throws \EE_Error |
160 | 160 | */ |
161 | - public function column_name( \EE_Question_Group $item ) { |
|
161 | + public function column_name(\EE_Question_Group $item) { |
|
162 | 162 | $actions = array(); |
163 | 163 | //return $item->name(); |
164 | - if ( ! defined( 'REG_ADMIN_URL' ) ) { |
|
165 | - define( 'REG_ADMIN_URL', EVENTS_ADMIN_URL ); |
|
164 | + if ( ! defined('REG_ADMIN_URL')) { |
|
165 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
166 | 166 | } |
167 | 167 | $edit_query_args = array( |
168 | 168 | 'action' => 'add_edit_form_section', |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | 'action' => 'delete_form_section', |
181 | 181 | 'QSG_ID' => $item->ID() |
182 | 182 | ); |
183 | - $edit_link = \EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_FORMS_ADMIN_URL ); |
|
184 | - $trash_link = \EE_Admin_Page::add_query_args_and_nonce( $trash_query_args, EE_FORMS_ADMIN_URL ); |
|
185 | - $restore_link = \EE_Admin_Page::add_query_args_and_nonce( $restore_query_args, EE_FORMS_ADMIN_URL ); |
|
186 | - $delete_link = \EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_FORMS_ADMIN_URL ); |
|
187 | - if ( \EE_Registry::instance()->CAP->current_user_can( |
|
183 | + $edit_link = \EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
184 | + $trash_link = \EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
185 | + $restore_link = \EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
186 | + $delete_link = \EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
187 | + if (\EE_Registry::instance()->CAP->current_user_can( |
|
188 | 188 | 'ee_edit_question_group', |
189 | 189 | 'espresso_registration_form_edit_form_section', |
190 | 190 | $item->ID() |
@@ -194,37 +194,37 @@ discard block |
||
194 | 194 | 'edit' => '<a href="' |
195 | 195 | . $edit_link |
196 | 196 | . '" title="' |
197 | - . esc_attr__( 'Edit Question Group', 'event_espresso' ) |
|
197 | + . esc_attr__('Edit Question Group', 'event_espresso') |
|
198 | 198 | . '">' |
199 | - . __( 'Edit', 'event_espresso' ) |
|
199 | + . __('Edit', 'event_espresso') |
|
200 | 200 | . '</a>' |
201 | 201 | ); |
202 | 202 | } |
203 | 203 | if ( |
204 | 204 | $this->_view !== 'trash' |
205 | - && $item->get( 'QSG_system' ) < 1 |
|
205 | + && $item->get('QSG_system') < 1 |
|
206 | 206 | && \EE_Registry::instance()->CAP->current_user_can( |
207 | 207 | 'ee_delete_question_group', |
208 | 208 | 'espresso_registration_form_trash_form_section', |
209 | 209 | $item->ID() |
210 | 210 | ) |
211 | 211 | ) { |
212 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' . esc_attr__( |
|
212 | + $actions['delete'] = '<a href="'.$trash_link.'" title="'.esc_attr__( |
|
213 | 213 | 'Delete Question Group', |
214 | 214 | 'event_espresso' |
215 | - ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
215 | + ).'">'.__('Trash', 'event_espresso').'</a>'; |
|
216 | 216 | } |
217 | - if ( $this->_view === 'trash' ) { |
|
218 | - if ( \EE_Registry::instance()->CAP->current_user_can( |
|
217 | + if ($this->_view === 'trash') { |
|
218 | + if (\EE_Registry::instance()->CAP->current_user_can( |
|
219 | 219 | 'ee_delete_question_group', |
220 | 220 | 'espresso_registration_form_restore_form_section', |
221 | 221 | $item->ID() |
222 | 222 | ) |
223 | 223 | ) { |
224 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' . esc_attr__( |
|
224 | + $actions['restore'] = '<a href="'.$restore_link.'" title="'.esc_attr__( |
|
225 | 225 | 'Restore Question Group', |
226 | 226 | 'event_espresso' |
227 | - ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
227 | + ).'">'.__('Restore', 'event_espresso').'</a>'; |
|
228 | 228 | } |
229 | 229 | if ( ! $item->has_questions_with_answers() |
230 | 230 | && \EE_Registry::instance()->CAP->current_user_can( |
@@ -233,18 +233,18 @@ discard block |
||
233 | 233 | $item->ID() |
234 | 234 | ) |
235 | 235 | ) { |
236 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__( |
|
236 | + $actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__( |
|
237 | 237 | 'Delete Question Group Permanently', |
238 | 238 | 'event_espresso' |
239 | - ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
239 | + ).'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | $content = \EE_Registry::instance()->CAP->current_user_can( |
243 | 243 | 'ee_edit_question_group', |
244 | 244 | 'espresso_registration_form_edit_form_section', |
245 | 245 | $item->ID() |
246 | - ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' : $item->name(); |
|
247 | - $content .= $this->row_actions( $actions ); |
|
246 | + ) ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>' : $item->name(); |
|
247 | + $content .= $this->row_actions($actions); |
|
248 | 248 | return $content; |
249 | 249 | } |
250 | 250 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @param \EE_Question_Group $item |
255 | 255 | * @return string |
256 | 256 | */ |
257 | - public function column_identifier( \EE_Question_Group $item ) { |
|
257 | + public function column_identifier(\EE_Question_Group $item) { |
|
258 | 258 | return $item->identifier(); |
259 | 259 | } |
260 | 260 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @param \EE_Question_Group $item |
265 | 265 | * @return string |
266 | 266 | */ |
267 | - public function column_description( \EE_Question_Group $item ) { |
|
267 | + public function column_description(\EE_Question_Group $item) { |
|
268 | 268 | return $item->desc(); |
269 | 269 | } |
270 | 270 |
@@ -142,7 +142,7 @@ |
||
142 | 142 | |
143 | 143 | /** |
144 | 144 | * @param \EE_Question_Group $item |
145 | - * @return mixed|string |
|
145 | + * @return string |
|
146 | 146 | * @throws \EE_Error |
147 | 147 | */ |
148 | 148 | public function column_id( \EE_Question_Group $item ) { |