@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | $stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | 16 | foreach ($stages as $filepath) { |
17 | - $matches = array(); |
|
18 | - preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
17 | + $matches = array(); |
|
18 | + preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
20 | 20 | } |
21 | 21 | // give addons a chance to autoload their stages too |
22 | 22 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath); |
@@ -35,69 +35,69 @@ discard block |
||
35 | 35 | class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base |
36 | 36 | { |
37 | 37 | |
38 | - /** |
|
39 | - * return EE_DMS_Core_4_6_0 |
|
40 | - * |
|
41 | - * @param TableManager $table_manager |
|
42 | - * @param TableAnalysis $table_analysis |
|
43 | - */ |
|
44 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
45 | - { |
|
46 | - $this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso"); |
|
47 | - $this->_priority = 10; |
|
48 | - $this->_migration_stages = array( |
|
49 | - new EE_DMS_4_6_0_gateways(), |
|
50 | - new EE_DMS_4_6_0_question_types(), |
|
51 | - new EE_DMS_4_6_0_country_system_question(), |
|
52 | - new EE_DMS_4_6_0_state_system_question(), |
|
53 | - new EE_DMS_4_6_0_billing_info(), |
|
54 | - new EE_DMS_4_6_0_transactions(), |
|
55 | - new EE_DMS_4_6_0_payments(), |
|
56 | - new EE_DMS_4_6_0_invoice_settings(), |
|
57 | - ); |
|
58 | - parent::__construct($table_manager, $table_analysis); |
|
59 | - } |
|
38 | + /** |
|
39 | + * return EE_DMS_Core_4_6_0 |
|
40 | + * |
|
41 | + * @param TableManager $table_manager |
|
42 | + * @param TableAnalysis $table_analysis |
|
43 | + */ |
|
44 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
45 | + { |
|
46 | + $this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso"); |
|
47 | + $this->_priority = 10; |
|
48 | + $this->_migration_stages = array( |
|
49 | + new EE_DMS_4_6_0_gateways(), |
|
50 | + new EE_DMS_4_6_0_question_types(), |
|
51 | + new EE_DMS_4_6_0_country_system_question(), |
|
52 | + new EE_DMS_4_6_0_state_system_question(), |
|
53 | + new EE_DMS_4_6_0_billing_info(), |
|
54 | + new EE_DMS_4_6_0_transactions(), |
|
55 | + new EE_DMS_4_6_0_payments(), |
|
56 | + new EE_DMS_4_6_0_invoice_settings(), |
|
57 | + ); |
|
58 | + parent::__construct($table_manager, $table_analysis); |
|
59 | + } |
|
60 | 60 | |
61 | 61 | |
62 | 62 | |
63 | - /** |
|
64 | - * @param array $version_array |
|
65 | - * @return bool |
|
66 | - */ |
|
67 | - public function can_migrate_from_version($version_array) |
|
68 | - { |
|
69 | - $version_string = $version_array['Core']; |
|
70 | - if (version_compare($version_string, '4.6.0.decaf', '<') && version_compare($version_string, '4.5.0.decaf', '>=')) { |
|
63 | + /** |
|
64 | + * @param array $version_array |
|
65 | + * @return bool |
|
66 | + */ |
|
67 | + public function can_migrate_from_version($version_array) |
|
68 | + { |
|
69 | + $version_string = $version_array['Core']; |
|
70 | + if (version_compare($version_string, '4.6.0.decaf', '<') && version_compare($version_string, '4.5.0.decaf', '>=')) { |
|
71 | 71 | // echo "$version_string can be migrated from"; |
72 | - return true; |
|
73 | - } elseif (! $version_string) { |
|
72 | + return true; |
|
73 | + } elseif (! $version_string) { |
|
74 | 74 | // echo "no version string provided: $version_string"; |
75 | - // no version string provided... this must be pre 4.3 |
|
76 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
77 | - } else { |
|
75 | + // no version string provided... this must be pre 4.3 |
|
76 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
77 | + } else { |
|
78 | 78 | // echo "$version_string doesnt apply"; |
79 | - return false; |
|
80 | - } |
|
81 | - } |
|
79 | + return false; |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | 84 | |
85 | - /** |
|
86 | - * @return bool |
|
87 | - */ |
|
88 | - public function schema_changes_before_migration() |
|
89 | - { |
|
90 | - // relies on 4.1's EEH_Activation::create_table |
|
91 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
92 | - $table_name = 'esp_answer'; |
|
93 | - $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
85 | + /** |
|
86 | + * @return bool |
|
87 | + */ |
|
88 | + public function schema_changes_before_migration() |
|
89 | + { |
|
90 | + // relies on 4.1's EEH_Activation::create_table |
|
91 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
92 | + $table_name = 'esp_answer'; |
|
93 | + $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
94 | 94 | REG_ID int(10) unsigned NOT NULL, |
95 | 95 | QST_ID int(10) unsigned NOT NULL, |
96 | 96 | ANS_value text NOT NULL, |
97 | 97 | PRIMARY KEY (ANS_ID)"; |
98 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
99 | - $table_name = 'esp_attendee_meta'; |
|
100 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
98 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
99 | + $table_name = 'esp_attendee_meta'; |
|
100 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
101 | 101 | ATT_ID bigint(20) unsigned NOT NULL, |
102 | 102 | ATT_fname varchar(45) NOT NULL, |
103 | 103 | ATT_lname varchar(45) NOT NULL, |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | KEY ATT_fname (ATT_fname), |
114 | 114 | KEY ATT_lname (ATT_lname), |
115 | 115 | KEY ATT_email (ATT_email(191))"; |
116 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
117 | - $table_name = 'esp_country'; |
|
118 | - $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
116 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
117 | + $table_name = 'esp_country'; |
|
118 | + $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
119 | 119 | CNT_ISO3 varchar(3) COLLATE utf8_bin NOT NULL, |
120 | 120 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
121 | 121 | CNT_name varchar(45) COLLATE utf8_bin NOT NULL, |
@@ -131,24 +131,24 @@ discard block |
||
131 | 131 | CNT_is_EU tinyint(1) DEFAULT '0', |
132 | 132 | CNT_active tinyint(1) DEFAULT '0', |
133 | 133 | PRIMARY KEY (CNT_ISO)"; |
134 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
135 | - $table_name = 'esp_currency'; |
|
136 | - $sql = "CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
|
134 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
135 | + $table_name = 'esp_currency'; |
|
136 | + $sql = "CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
|
137 | 137 | CUR_single varchar(45) COLLATE utf8_bin DEFAULT 'dollar', |
138 | 138 | CUR_plural varchar(45) COLLATE utf8_bin DEFAULT 'dollars', |
139 | 139 | CUR_sign varchar(45) COLLATE utf8_bin DEFAULT '$', |
140 | 140 | CUR_dec_plc varchar(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
141 | 141 | CUR_active tinyint(1) DEFAULT '0', |
142 | 142 | PRIMARY KEY (CUR_code)"; |
143 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | - $table_name = 'esp_currency_payment_method'; |
|
145 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
143 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | + $table_name = 'esp_currency_payment_method'; |
|
145 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
146 | 146 | CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
147 | 147 | PMD_ID int(11) NOT NULL, |
148 | 148 | PRIMARY KEY (CPM_ID)"; |
149 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
150 | - $table_name = 'esp_datetime'; |
|
151 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
149 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
150 | + $table_name = 'esp_datetime'; |
|
151 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
152 | 152 | EVT_ID bigint(20) unsigned NOT NULL, |
153 | 153 | DTT_name varchar(255) NOT NULL DEFAULT '', |
154 | 154 | DTT_description text NOT NULL, |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | PRIMARY KEY (DTT_ID), |
164 | 164 | KEY EVT_ID (EVT_ID), |
165 | 165 | KEY DTT_is_primary (DTT_is_primary)"; |
166 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
167 | - $table_name = 'esp_event_meta'; |
|
168 | - $sql = " |
|
166 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
167 | + $table_name = 'esp_event_meta'; |
|
168 | + $sql = " |
|
169 | 169 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
170 | 170 | EVT_ID bigint(20) unsigned NOT NULL, |
171 | 171 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -180,31 +180,31 @@ discard block |
||
180 | 180 | EVT_external_URL varchar(200) NULL, |
181 | 181 | EVT_donations tinyint(1) NULL, |
182 | 182 | PRIMARY KEY (EVTM_ID)"; |
183 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
184 | - $table_name = 'esp_event_question_group'; |
|
185 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
183 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
184 | + $table_name = 'esp_event_question_group'; |
|
185 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
186 | 186 | EVT_ID bigint(20) unsigned NOT NULL, |
187 | 187 | QSG_ID int(10) unsigned NOT NULL, |
188 | 188 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
189 | 189 | PRIMARY KEY (EQG_ID)"; |
190 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
191 | - $table_name = 'esp_event_venue'; |
|
192 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
190 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
191 | + $table_name = 'esp_event_venue'; |
|
192 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
193 | 193 | EVT_ID bigint(20) unsigned NOT NULL, |
194 | 194 | VNU_ID bigint(20) unsigned NOT NULL, |
195 | 195 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
196 | 196 | PRIMARY KEY (EVV_ID)"; |
197 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | - $table_name = 'esp_extra_meta'; |
|
199 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
197 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
198 | + $table_name = 'esp_extra_meta'; |
|
199 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
200 | 200 | OBJ_ID int(11) DEFAULT NULL, |
201 | 201 | EXM_type varchar(45) DEFAULT NULL, |
202 | 202 | EXM_key varchar(45) DEFAULT NULL, |
203 | 203 | EXM_value text, |
204 | 204 | PRIMARY KEY (EXM_ID)"; |
205 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
206 | - $table_name = 'esp_line_item'; |
|
207 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
205 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
206 | + $table_name = 'esp_line_item'; |
|
207 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
208 | 208 | LIN_code varchar(245) NOT NULL DEFAULT '', |
209 | 209 | TXN_ID int(11) DEFAULT NULL, |
210 | 210 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | OBJ_ID int(11) DEFAULT NULL, |
221 | 221 | OBJ_type varchar(45)DEFAULT NULL, |
222 | 222 | PRIMARY KEY (LIN_ID)"; |
223 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | - $table_name = 'esp_log'; |
|
225 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
223 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | + $table_name = 'esp_log'; |
|
225 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
226 | 226 | LOG_time datetime DEFAULT NULL, |
227 | 227 | OBJ_ID varchar(45) DEFAULT NULL, |
228 | 228 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -230,19 +230,19 @@ discard block |
||
230 | 230 | LOG_message text, |
231 | 231 | LOG_wp_user int(11) DEFAULT NULL, |
232 | 232 | PRIMARY KEY (LOG_ID)"; |
233 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
234 | - $table_name = 'esp_message_template'; |
|
235 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
233 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
234 | + $table_name = 'esp_message_template'; |
|
235 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
236 | 236 | GRP_ID int(10) unsigned NOT NULL, |
237 | 237 | MTP_context varchar(50) NOT NULL, |
238 | 238 | MTP_template_field varchar(30) NOT NULL, |
239 | 239 | MTP_content text NOT NULL, |
240 | 240 | PRIMARY KEY (MTP_ID), |
241 | 241 | KEY GRP_ID (GRP_ID)"; |
242 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
243 | - $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
244 | - $table_name = 'esp_message_template_group'; |
|
245 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
242 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
243 | + $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID'); |
|
244 | + $table_name = 'esp_message_template_group'; |
|
245 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
246 | 246 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
247 | 247 | MTP_name varchar(245) NOT NULL DEFAULT '', |
248 | 248 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -254,17 +254,17 @@ discard block |
||
254 | 254 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
255 | 255 | PRIMARY KEY (GRP_ID), |
256 | 256 | KEY MTP_user_id (MTP_user_id)"; |
257 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | - $table_name = 'esp_event_message_template'; |
|
259 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
257 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | + $table_name = 'esp_event_message_template'; |
|
259 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
260 | 260 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
261 | 261 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
262 | 262 | PRIMARY KEY (EMT_ID), |
263 | 263 | KEY EVT_ID (EVT_ID), |
264 | 264 | KEY GRP_ID (GRP_ID)"; |
265 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
266 | - $table_name = 'esp_payment'; |
|
267 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
265 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
266 | + $table_name = 'esp_payment'; |
|
267 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
268 | 268 | TXN_ID int(10) unsigned DEFAULT NULL, |
269 | 269 | STS_ID varchar(3) COLLATE utf8_bin DEFAULT NULL, |
270 | 270 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | PRIMARY KEY (PAY_ID), |
282 | 282 | KEY TXN_ID (TXN_ID), |
283 | 283 | KEY PAY_timestamp (PAY_timestamp)"; |
284 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
285 | - $table_name = 'esp_payment_method'; |
|
286 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
284 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
285 | + $table_name = 'esp_payment_method'; |
|
286 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
287 | 287 | PMD_type varchar(124) DEFAULT NULL, |
288 | 288 | PMD_name varchar(255) DEFAULT NULL, |
289 | 289 | PMD_desc text, |
@@ -298,28 +298,28 @@ discard block |
||
298 | 298 | PMD_scope varchar(255) NULL DEFAULT 'frontend', |
299 | 299 | PRIMARY KEY (PMD_ID), |
300 | 300 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug)"; |
301 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
302 | - $table_name = "esp_ticket_price"; |
|
303 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
301 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
302 | + $table_name = "esp_ticket_price"; |
|
303 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
304 | 304 | TKT_ID int(10) unsigned NOT NULL, |
305 | 305 | PRC_ID int(10) unsigned NOT NULL, |
306 | 306 | PRIMARY KEY (TKP_ID)"; |
307 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
308 | - $table_name = "esp_datetime_ticket"; |
|
309 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
307 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
308 | + $table_name = "esp_datetime_ticket"; |
|
309 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
310 | 310 | DTT_ID int(10) unsigned NOT NULL, |
311 | 311 | TKT_ID int(10) unsigned NOT NULL, |
312 | 312 | PRIMARY KEY (DTK_ID)"; |
313 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
314 | - $table_name = "esp_ticket_template"; |
|
315 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
313 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
314 | + $table_name = "esp_ticket_template"; |
|
315 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
316 | 316 | TTM_name varchar(45) NOT NULL, |
317 | 317 | TTM_description text, |
318 | 318 | TTM_file varchar(45), |
319 | 319 | PRIMARY KEY (TTM_ID)"; |
320 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
321 | - $table_name = 'esp_question'; |
|
322 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
320 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
321 | + $table_name = 'esp_question'; |
|
322 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
323 | 323 | QST_display_text text NOT NULL, |
324 | 324 | QST_admin_label varchar(255) NOT NULL, |
325 | 325 | QST_system varchar(25) DEFAULT NULL, |
@@ -331,25 +331,25 @@ discard block |
||
331 | 331 | QST_wp_user bigint(20) unsigned NULL, |
332 | 332 | QST_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
333 | 333 | PRIMARY KEY (QST_ID)'; |
334 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | - $table_name = 'esp_question_group_question'; |
|
336 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
334 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
335 | + $table_name = 'esp_question_group_question'; |
|
336 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
337 | 337 | QSG_ID int(10) unsigned NOT NULL, |
338 | 338 | QST_ID int(10) unsigned NOT NULL, |
339 | 339 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
340 | 340 | PRIMARY KEY (QGQ_ID) "; |
341 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
342 | - $table_name = 'esp_question_option'; |
|
343 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
341 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
342 | + $table_name = 'esp_question_option'; |
|
343 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
344 | 344 | QSO_value varchar(255) NOT NULL, |
345 | 345 | QSO_desc text NOT NULL, |
346 | 346 | QST_ID int(10) unsigned NOT NULL, |
347 | 347 | QSO_order int(10) unsigned NOT NULL DEFAULT 0, |
348 | 348 | QSO_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
349 | 349 | PRIMARY KEY (QSO_ID)"; |
350 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
351 | - $table_name = 'esp_registration'; |
|
352 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
350 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
351 | + $table_name = 'esp_registration'; |
|
352 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
353 | 353 | EVT_ID bigint(20) unsigned NOT NULL, |
354 | 354 | ATT_ID bigint(20) unsigned NOT NULL, |
355 | 355 | TXN_ID int(10) unsigned NOT NULL, |
@@ -372,25 +372,25 @@ discard block |
||
372 | 372 | KEY STS_ID (STS_ID), |
373 | 373 | KEY REG_url_link (REG_url_link), |
374 | 374 | KEY REG_code (REG_code)"; |
375 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
376 | - $table_name = 'esp_checkin'; |
|
377 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
375 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
376 | + $table_name = 'esp_checkin'; |
|
377 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
378 | 378 | REG_ID int(10) unsigned NOT NULL, |
379 | 379 | DTT_ID int(10) unsigned NOT NULL, |
380 | 380 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
381 | 381 | CHK_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
382 | 382 | PRIMARY KEY (CHK_ID)"; |
383 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
384 | - $table_name = 'esp_state'; |
|
385 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
383 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
384 | + $table_name = 'esp_state'; |
|
385 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
386 | 386 | CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
387 | 387 | STA_abbrev varchar(24) COLLATE utf8_bin NOT NULL, |
388 | 388 | STA_name varchar(100) COLLATE utf8_bin NOT NULL, |
389 | 389 | STA_active tinyint(1) DEFAULT '1', |
390 | 390 | PRIMARY KEY (STA_ID)"; |
391 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
392 | - $table_name = 'esp_status'; |
|
393 | - $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
391 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
392 | + $table_name = 'esp_status'; |
|
393 | + $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
394 | 394 | STS_code varchar(45) COLLATE utf8_bin NOT NULL, |
395 | 395 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
396 | 396 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
399 | 399 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
400 | 400 | KEY STS_type (STS_type)"; |
401 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
402 | - $table_name = 'esp_transaction'; |
|
403 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
401 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
402 | + $table_name = 'esp_transaction'; |
|
403 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
404 | 404 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
405 | 405 | TXN_total decimal(10,3) DEFAULT '0.00', |
406 | 406 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -412,9 +412,9 @@ discard block |
||
412 | 412 | PRIMARY KEY (TXN_ID), |
413 | 413 | KEY TXN_timestamp (TXN_timestamp), |
414 | 414 | KEY STS_ID (STS_ID)"; |
415 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
416 | - $table_name = 'esp_venue_meta'; |
|
417 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
415 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
416 | + $table_name = 'esp_venue_meta'; |
|
417 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
418 | 418 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
419 | 419 | VNU_address varchar(255) DEFAULT NULL, |
420 | 420 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -432,10 +432,10 @@ discard block |
||
432 | 432 | PRIMARY KEY (VNUM_ID), |
433 | 433 | KEY STA_ID (STA_ID), |
434 | 434 | KEY CNT_ISO (CNT_ISO)"; |
435 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
436 | - // modified tables |
|
437 | - $table_name = "esp_price"; |
|
438 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
435 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
436 | + // modified tables |
|
437 | + $table_name = "esp_price"; |
|
438 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
439 | 439 | PRT_ID tinyint(3) unsigned NOT NULL, |
440 | 440 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
441 | 441 | PRC_name varchar(245) NOT NULL, |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | PRC_wp_user bigint(20) unsigned NULL, |
448 | 448 | PRC_parent int(10) unsigned DEFAULT 0, |
449 | 449 | PRIMARY KEY (PRC_ID)"; |
450 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
451 | - $table_name = "esp_price_type"; |
|
452 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
450 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
451 | + $table_name = "esp_price_type"; |
|
452 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
453 | 453 | PRT_name varchar(45) NOT NULL, |
454 | 454 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
455 | 455 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
459 | 459 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
460 | 460 | PRIMARY KEY (PRT_ID)"; |
461 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
462 | - $table_name = "esp_ticket"; |
|
463 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
461 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
462 | + $table_name = "esp_ticket"; |
|
463 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
464 | 464 | TTM_ID int(10) unsigned NOT NULL, |
465 | 465 | TKT_name varchar(245) NOT NULL DEFAULT '', |
466 | 466 | TKT_description text NOT NULL, |
@@ -481,10 +481,10 @@ discard block |
||
481 | 481 | TKT_parent int(10) unsigned DEFAULT '0', |
482 | 482 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
483 | 483 | PRIMARY KEY (TKT_ID)"; |
484 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
485 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
486 | - $table_name = 'esp_question_group'; |
|
487 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
484 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
485 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
486 | + $table_name = 'esp_question_group'; |
|
487 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
488 | 488 | QSG_name varchar(255) NOT NULL, |
489 | 489 | QSG_identifier varchar(100) NOT NULL, |
490 | 490 | QSG_desc text NULL, |
@@ -496,124 +496,124 @@ discard block |
||
496 | 496 | QSG_wp_user bigint(20) unsigned NULL, |
497 | 497 | PRIMARY KEY (QSG_ID), |
498 | 498 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
499 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
500 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
501 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
502 | - // (because many need to convert old string states to foreign keys into the states table) |
|
503 | - $script_4_1_defaults->insert_default_states(); |
|
504 | - $script_4_1_defaults->insert_default_countries(); |
|
505 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
506 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
507 | - $script_4_5_defaults->insert_default_price_types(); |
|
508 | - $script_4_5_defaults->insert_default_prices(); |
|
509 | - $script_4_5_defaults->insert_default_tickets(); |
|
510 | - // setting up the config wp option pretty well counts as a 'schema change', or at least should happen here |
|
511 | - EE_Config::instance()->update_espresso_config(false, true); |
|
512 | - $this->add_default_admin_only_payments(); |
|
513 | - $this->insert_default_currencies(); |
|
514 | - return true; |
|
515 | - } |
|
499 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
500 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
501 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
502 | + // (because many need to convert old string states to foreign keys into the states table) |
|
503 | + $script_4_1_defaults->insert_default_states(); |
|
504 | + $script_4_1_defaults->insert_default_countries(); |
|
505 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
506 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
507 | + $script_4_5_defaults->insert_default_price_types(); |
|
508 | + $script_4_5_defaults->insert_default_prices(); |
|
509 | + $script_4_5_defaults->insert_default_tickets(); |
|
510 | + // setting up the config wp option pretty well counts as a 'schema change', or at least should happen here |
|
511 | + EE_Config::instance()->update_espresso_config(false, true); |
|
512 | + $this->add_default_admin_only_payments(); |
|
513 | + $this->insert_default_currencies(); |
|
514 | + return true; |
|
515 | + } |
|
516 | 516 | |
517 | 517 | |
518 | 518 | |
519 | - /** |
|
520 | - * @return boolean |
|
521 | - */ |
|
522 | - public function schema_changes_after_migration() |
|
523 | - { |
|
524 | - return true; |
|
525 | - } |
|
519 | + /** |
|
520 | + * @return boolean |
|
521 | + */ |
|
522 | + public function schema_changes_after_migration() |
|
523 | + { |
|
524 | + return true; |
|
525 | + } |
|
526 | 526 | |
527 | 527 | |
528 | 528 | |
529 | - public function migration_page_hooks() |
|
530 | - { |
|
531 | - } |
|
529 | + public function migration_page_hooks() |
|
530 | + { |
|
531 | + } |
|
532 | 532 | |
533 | 533 | |
534 | 534 | |
535 | - public function add_default_admin_only_payments() |
|
536 | - { |
|
537 | - global $wpdb; |
|
538 | - $table_name = $wpdb->prefix . "esp_payment_method"; |
|
539 | - $user_id = EEH_Activation::get_default_creator_id(); |
|
540 | - if ($this->_get_table_analysis()->tableExists($table_name)) { |
|
541 | - $SQL = "SELECT COUNT( * ) FROM $table_name"; |
|
542 | - $existing_payment_methods = $wpdb->get_var($SQL); |
|
543 | - $default_admin_only_payment_methods = apply_filters( |
|
544 | - 'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods', |
|
545 | - array( |
|
546 | - (string) __("Bank", 'event_espresso') => __("Bank Draft", 'event_espresso'), |
|
547 | - (string) __("Cash", 'event_espresso') => __("Cash Delivered Physically", 'event_espresso'), |
|
548 | - (string) __("Check", 'event_espresso') => __("Paper Check", 'event_espresso'), |
|
549 | - (string) __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'), |
|
550 | - (string) __("Debit Card", 'event_espresso') => __("Offline Debit Payment", 'event_espresso'), |
|
551 | - (string) __("Invoice", 'event_espresso') => __( |
|
552 | - "Invoice received with monies included", |
|
553 | - 'event_espresso' |
|
554 | - ), |
|
555 | - (string) __("Money Order", 'event_espresso') => '', |
|
556 | - (string) __("Paypal", 'event_espresso') => __("Paypal eCheck, Invoice, etc", 'event_espresso'), |
|
557 | - (string) __('Other', 'event_espresso') => __('Other method of payment', 'event_espresso'), |
|
558 | - ) |
|
559 | - ); |
|
560 | - // make sure we hae payment method records for the following |
|
561 | - // so admins can record payments for them from the admin page |
|
562 | - foreach ($default_admin_only_payment_methods as $nicename => $description) { |
|
563 | - $slug = sanitize_key($nicename); |
|
564 | - // check that such a payment method exists |
|
565 | - $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
|
566 | - if (! $exists) { |
|
567 | - $values = array( |
|
568 | - 'PMD_type' => 'Admin_Only', |
|
569 | - 'PMD_name' => $nicename, |
|
570 | - 'PMD_admin_name' => $nicename, |
|
571 | - 'PMD_admin_desc' => $description, |
|
572 | - 'PMD_slug' => $slug, |
|
573 | - 'PMD_wp_user' => $user_id, |
|
574 | - 'PMD_scope' => serialize(array('ADMIN')), |
|
575 | - ); |
|
576 | - $success = $wpdb->insert( |
|
577 | - $table_name, |
|
578 | - $values, |
|
579 | - array( |
|
580 | - '%s',// PMD_type |
|
581 | - '%s',// PMD_name |
|
582 | - '%s',// PMD_admin_name |
|
583 | - '%s',// PMD_admin_desc |
|
584 | - '%s',// PMD_slug |
|
585 | - '%d',// PMD_wp_user |
|
586 | - '%s',// PMD_scope |
|
587 | - ) |
|
588 | - ); |
|
589 | - if (! $success) { |
|
590 | - $this->add_error(sprintf(__( |
|
591 | - "Could not insert new admin-only payment method with values %s during migration", |
|
592 | - "event_espresso" |
|
593 | - ), $this->_json_encode($values))); |
|
594 | - } |
|
595 | - } |
|
596 | - } |
|
597 | - } |
|
598 | - } |
|
535 | + public function add_default_admin_only_payments() |
|
536 | + { |
|
537 | + global $wpdb; |
|
538 | + $table_name = $wpdb->prefix . "esp_payment_method"; |
|
539 | + $user_id = EEH_Activation::get_default_creator_id(); |
|
540 | + if ($this->_get_table_analysis()->tableExists($table_name)) { |
|
541 | + $SQL = "SELECT COUNT( * ) FROM $table_name"; |
|
542 | + $existing_payment_methods = $wpdb->get_var($SQL); |
|
543 | + $default_admin_only_payment_methods = apply_filters( |
|
544 | + 'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods', |
|
545 | + array( |
|
546 | + (string) __("Bank", 'event_espresso') => __("Bank Draft", 'event_espresso'), |
|
547 | + (string) __("Cash", 'event_espresso') => __("Cash Delivered Physically", 'event_espresso'), |
|
548 | + (string) __("Check", 'event_espresso') => __("Paper Check", 'event_espresso'), |
|
549 | + (string) __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'), |
|
550 | + (string) __("Debit Card", 'event_espresso') => __("Offline Debit Payment", 'event_espresso'), |
|
551 | + (string) __("Invoice", 'event_espresso') => __( |
|
552 | + "Invoice received with monies included", |
|
553 | + 'event_espresso' |
|
554 | + ), |
|
555 | + (string) __("Money Order", 'event_espresso') => '', |
|
556 | + (string) __("Paypal", 'event_espresso') => __("Paypal eCheck, Invoice, etc", 'event_espresso'), |
|
557 | + (string) __('Other', 'event_espresso') => __('Other method of payment', 'event_espresso'), |
|
558 | + ) |
|
559 | + ); |
|
560 | + // make sure we hae payment method records for the following |
|
561 | + // so admins can record payments for them from the admin page |
|
562 | + foreach ($default_admin_only_payment_methods as $nicename => $description) { |
|
563 | + $slug = sanitize_key($nicename); |
|
564 | + // check that such a payment method exists |
|
565 | + $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
|
566 | + if (! $exists) { |
|
567 | + $values = array( |
|
568 | + 'PMD_type' => 'Admin_Only', |
|
569 | + 'PMD_name' => $nicename, |
|
570 | + 'PMD_admin_name' => $nicename, |
|
571 | + 'PMD_admin_desc' => $description, |
|
572 | + 'PMD_slug' => $slug, |
|
573 | + 'PMD_wp_user' => $user_id, |
|
574 | + 'PMD_scope' => serialize(array('ADMIN')), |
|
575 | + ); |
|
576 | + $success = $wpdb->insert( |
|
577 | + $table_name, |
|
578 | + $values, |
|
579 | + array( |
|
580 | + '%s',// PMD_type |
|
581 | + '%s',// PMD_name |
|
582 | + '%s',// PMD_admin_name |
|
583 | + '%s',// PMD_admin_desc |
|
584 | + '%s',// PMD_slug |
|
585 | + '%d',// PMD_wp_user |
|
586 | + '%s',// PMD_scope |
|
587 | + ) |
|
588 | + ); |
|
589 | + if (! $success) { |
|
590 | + $this->add_error(sprintf(__( |
|
591 | + "Could not insert new admin-only payment method with values %s during migration", |
|
592 | + "event_espresso" |
|
593 | + ), $this->_json_encode($values))); |
|
594 | + } |
|
595 | + } |
|
596 | + } |
|
597 | + } |
|
598 | + } |
|
599 | 599 | |
600 | 600 | |
601 | 601 | |
602 | - /** |
|
603 | - * insert_default_countries |
|
604 | - * |
|
605 | - * @static |
|
606 | - * @return void |
|
607 | - */ |
|
608 | - public function insert_default_currencies() |
|
609 | - { |
|
610 | - global $wpdb; |
|
611 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
612 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
613 | - $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
|
614 | - $countries = $wpdb->get_var($SQL); |
|
615 | - if (! $countries) { |
|
616 | - $SQL = "INSERT INTO $currency_table |
|
602 | + /** |
|
603 | + * insert_default_countries |
|
604 | + * |
|
605 | + * @static |
|
606 | + * @return void |
|
607 | + */ |
|
608 | + public function insert_default_currencies() |
|
609 | + { |
|
610 | + global $wpdb; |
|
611 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
612 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
613 | + $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
|
614 | + $countries = $wpdb->get_var($SQL); |
|
615 | + if (! $countries) { |
|
616 | + $SQL = "INSERT INTO $currency_table |
|
617 | 617 | ( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES |
618 | 618 | ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
619 | 619 | ( 'AED', 'Dirham', 'Dirhams', 'د.إ',2,1), |
@@ -767,8 +767,8 @@ discard block |
||
767 | 767 | ( 'ZAR', 'Rand', 'Rands', 'R', 2,1), |
768 | 768 | ( 'ZMK', 'Kwacha', 'Kwachas', '', 2,1), |
769 | 769 | ( 'ZWD', 'Dollar', 'Dollars', 'Z$', 2,1);"; |
770 | - $wpdb->query($SQL); |
|
771 | - } |
|
772 | - } |
|
773 | - } |
|
770 | + $wpdb->query($SQL); |
|
771 | + } |
|
772 | + } |
|
773 | + } |
|
774 | 774 | } |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | // unfortunately, this needs to be done upon INCLUSION of this file, |
12 | 12 | // instead of construction, because it only gets constructed on first page load |
13 | 13 | // (all other times it gets resurrected from a wordpress option) |
14 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*'); |
|
14 | +$stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*'); |
|
15 | 15 | $class_to_filepath = array(); |
16 | 16 | foreach ($stages as $filepath) { |
17 | 17 | $matches = array(); |
18 | 18 | preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
19 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
19 | + $class_to_filepath[$matches[1]] = $filepath; |
|
20 | 20 | } |
21 | 21 | // give addons a chance to autoload their stages too |
22 | 22 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath); |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | if (version_compare($version_string, '4.6.0.decaf', '<') && version_compare($version_string, '4.5.0.decaf', '>=')) { |
71 | 71 | // echo "$version_string can be migrated from"; |
72 | 72 | return true; |
73 | - } elseif (! $version_string) { |
|
73 | + } elseif ( ! $version_string) { |
|
74 | 74 | // echo "no version string provided: $version_string"; |
75 | 75 | // no version string provided... this must be pre 4.3 |
76 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
76 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
77 | 77 | } else { |
78 | 78 | // echo "$version_string doesnt apply"; |
79 | 79 | return false; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function schema_changes_before_migration() |
89 | 89 | { |
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 | $table_name = 'esp_answer'; |
93 | 93 | $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
94 | 94 | REG_ID int(10) unsigned NOT NULL, |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | public function add_default_admin_only_payments() |
536 | 536 | { |
537 | 537 | global $wpdb; |
538 | - $table_name = $wpdb->prefix . "esp_payment_method"; |
|
538 | + $table_name = $wpdb->prefix."esp_payment_method"; |
|
539 | 539 | $user_id = EEH_Activation::get_default_creator_id(); |
540 | 540 | if ($this->_get_table_analysis()->tableExists($table_name)) { |
541 | 541 | $SQL = "SELECT COUNT( * ) FROM $table_name"; |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | $slug = sanitize_key($nicename); |
564 | 564 | // check that such a payment method exists |
565 | 565 | $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug)); |
566 | - if (! $exists) { |
|
566 | + if ( ! $exists) { |
|
567 | 567 | $values = array( |
568 | 568 | 'PMD_type' => 'Admin_Only', |
569 | 569 | 'PMD_name' => $nicename, |
@@ -577,16 +577,16 @@ discard block |
||
577 | 577 | $table_name, |
578 | 578 | $values, |
579 | 579 | array( |
580 | - '%s',// PMD_type |
|
581 | - '%s',// PMD_name |
|
582 | - '%s',// PMD_admin_name |
|
583 | - '%s',// PMD_admin_desc |
|
584 | - '%s',// PMD_slug |
|
585 | - '%d',// PMD_wp_user |
|
586 | - '%s',// PMD_scope |
|
580 | + '%s', // PMD_type |
|
581 | + '%s', // PMD_name |
|
582 | + '%s', // PMD_admin_name |
|
583 | + '%s', // PMD_admin_desc |
|
584 | + '%s', // PMD_slug |
|
585 | + '%d', // PMD_wp_user |
|
586 | + '%s', // PMD_scope |
|
587 | 587 | ) |
588 | 588 | ); |
589 | - if (! $success) { |
|
589 | + if ( ! $success) { |
|
590 | 590 | $this->add_error(sprintf(__( |
591 | 591 | "Could not insert new admin-only payment method with values %s during migration", |
592 | 592 | "event_espresso" |
@@ -608,11 +608,11 @@ discard block |
||
608 | 608 | public function insert_default_currencies() |
609 | 609 | { |
610 | 610 | global $wpdb; |
611 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
611 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
612 | 612 | if ($this->_get_table_analysis()->tableExists($currency_table)) { |
613 | 613 | $SQL = "SELECT COUNT('CUR_code') FROM $currency_table"; |
614 | 614 | $countries = $wpdb->get_var($SQL); |
615 | - if (! $countries) { |
|
615 | + if ( ! $countries) { |
|
616 | 616 | $SQL = "INSERT INTO $currency_table |
617 | 617 | ( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES |
618 | 618 | ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | $stages = glob(EE_CORE . 'data_migration_scripts/4_2_0_stages/*'); |
16 | 16 | $class_to_filepath = array(); |
17 | 17 | if (! empty($stages)) { |
18 | - foreach ($stages as $filepath) { |
|
19 | - $matches = array(); |
|
20 | - preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
21 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
22 | - } |
|
18 | + foreach ($stages as $filepath) { |
|
19 | + $matches = array(); |
|
20 | + preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
21 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | // give addons a chance to autoload their stages too |
25 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_2_0__autoloaded_stages', $class_to_filepath); |
@@ -32,57 +32,57 @@ discard block |
||
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * EE_DMS_Core_4_2_0 constructor. |
|
37 | - * |
|
38 | - * @param TableManager $table_manager |
|
39 | - * @param TableAnalysis $table_analysis |
|
40 | - */ |
|
41 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
42 | - { |
|
43 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.2.0", "event_espresso"); |
|
44 | - $this->_priority = 10; |
|
45 | - $this->_migration_stages = array( |
|
46 | - new EE_DMS_4_2_0_question_group_questions(), |
|
47 | - new EE_DMS_4_2_0_datetime_fields(), |
|
48 | - ); |
|
49 | - parent::__construct($table_manager, $table_analysis); |
|
50 | - } |
|
35 | + /** |
|
36 | + * EE_DMS_Core_4_2_0 constructor. |
|
37 | + * |
|
38 | + * @param TableManager $table_manager |
|
39 | + * @param TableAnalysis $table_analysis |
|
40 | + */ |
|
41 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
42 | + { |
|
43 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.2.0", "event_espresso"); |
|
44 | + $this->_priority = 10; |
|
45 | + $this->_migration_stages = array( |
|
46 | + new EE_DMS_4_2_0_question_group_questions(), |
|
47 | + new EE_DMS_4_2_0_datetime_fields(), |
|
48 | + ); |
|
49 | + parent::__construct($table_manager, $table_analysis); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - public function can_migrate_from_version($version_array) |
|
55 | - { |
|
56 | - $version_string = $version_array['Core']; |
|
57 | - if (version_compare($version_string, '4.2.0.decaf', '<') && version_compare($version_string, '4.1.0.decaf', '>=')) { |
|
54 | + public function can_migrate_from_version($version_array) |
|
55 | + { |
|
56 | + $version_string = $version_array['Core']; |
|
57 | + if (version_compare($version_string, '4.2.0.decaf', '<') && version_compare($version_string, '4.1.0.decaf', '>=')) { |
|
58 | 58 | // echo "$version_string can be migrated fro"; |
59 | - return true; |
|
60 | - } elseif (! $version_string) { |
|
59 | + return true; |
|
60 | + } elseif (! $version_string) { |
|
61 | 61 | // echo "no version string provided: $version_string"; |
62 | - // no version string provided... this must be pre 4.1 |
|
63 | - // because since 4.1 we're |
|
64 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
65 | - } else { |
|
62 | + // no version string provided... this must be pre 4.1 |
|
63 | + // because since 4.1 we're |
|
64 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
65 | + } else { |
|
66 | 66 | // echo "$version_string doesnt apply"; |
67 | - return false; |
|
68 | - } |
|
69 | - } |
|
67 | + return false; |
|
68 | + } |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | 72 | |
73 | - public function schema_changes_before_migration() |
|
74 | - { |
|
75 | - // relies on 4.1's EEH_Activation::create_table |
|
76 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
77 | - $table_name = 'esp_answer'; |
|
78 | - $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
73 | + public function schema_changes_before_migration() |
|
74 | + { |
|
75 | + // relies on 4.1's EEH_Activation::create_table |
|
76 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
77 | + $table_name = 'esp_answer'; |
|
78 | + $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
79 | 79 | REG_ID int(10) unsigned NOT NULL, |
80 | 80 | QST_ID int(10) unsigned NOT NULL, |
81 | 81 | ANS_value text NOT NULL, |
82 | 82 | PRIMARY KEY (ANS_ID)"; |
83 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
84 | - $table_name = 'esp_attendee_meta'; |
|
85 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
83 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
84 | + $table_name = 'esp_attendee_meta'; |
|
85 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
86 | 86 | ATT_ID bigint(20) unsigned NOT NULL, |
87 | 87 | ATT_fname varchar(45) NOT NULL, |
88 | 88 | ATT_lname varchar(45) NOT NULL, |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | KEY ATT_fname (ATT_fname), |
99 | 99 | KEY ATT_lname (ATT_lname), |
100 | 100 | KEY ATT_email (ATT_email(191))"; |
101 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
102 | - $table_name = 'esp_country'; |
|
103 | - $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
101 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
102 | + $table_name = 'esp_country'; |
|
103 | + $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
104 | 104 | CNT_ISO3 varchar(3) COLLATE utf8_bin NOT NULL, |
105 | 105 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
106 | 106 | CNT_name varchar(45) COLLATE utf8_bin NOT NULL, |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | CNT_is_EU tinyint(1) DEFAULT '0', |
117 | 117 | CNT_active tinyint(1) DEFAULT '0', |
118 | 118 | PRIMARY KEY (CNT_ISO)"; |
119 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
120 | - $table_name = 'esp_datetime'; |
|
121 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
119 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
120 | + $table_name = 'esp_datetime'; |
|
121 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
122 | 122 | EVT_ID bigint(20) unsigned NOT NULL, |
123 | 123 | DTT_name varchar(255) NOT NULL DEFAULT '', |
124 | 124 | DTT_description text NOT NULL, |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | PRIMARY KEY (DTT_ID), |
134 | 134 | KEY EVT_ID (EVT_ID), |
135 | 135 | KEY DTT_is_primary (DTT_is_primary)"; |
136 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
137 | - $table_name = 'esp_event_meta'; |
|
138 | - $sql = " |
|
136 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
137 | + $table_name = 'esp_event_meta'; |
|
138 | + $sql = " |
|
139 | 139 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
140 | 140 | EVT_ID bigint(20) unsigned NOT NULL, |
141 | 141 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -150,31 +150,31 @@ discard block |
||
150 | 150 | EVT_external_URL varchar(200) NULL, |
151 | 151 | EVT_donations tinyint(1) NULL, |
152 | 152 | PRIMARY KEY (EVTM_ID)"; |
153 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
154 | - $table_name = 'esp_event_question_group'; |
|
155 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
153 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
154 | + $table_name = 'esp_event_question_group'; |
|
155 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
156 | 156 | EVT_ID bigint(20) unsigned NOT NULL, |
157 | 157 | QSG_ID int(10) unsigned NOT NULL, |
158 | 158 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
159 | 159 | PRIMARY KEY (EQG_ID)"; |
160 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
161 | - $table_name = 'esp_event_venue'; |
|
162 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
160 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
161 | + $table_name = 'esp_event_venue'; |
|
162 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
163 | 163 | EVT_ID bigint(20) unsigned NOT NULL, |
164 | 164 | VNU_ID bigint(20) unsigned NOT NULL, |
165 | 165 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
166 | 166 | PRIMARY KEY (EVV_ID)"; |
167 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
168 | - $table_name = 'esp_extra_meta'; |
|
169 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
167 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
168 | + $table_name = 'esp_extra_meta'; |
|
169 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
170 | 170 | OBJ_ID int(11) DEFAULT NULL, |
171 | 171 | EXM_type varchar(45) DEFAULT NULL, |
172 | 172 | EXM_key varchar(45) DEFAULT NULL, |
173 | 173 | EXM_value text, |
174 | 174 | PRIMARY KEY (EXM_ID)"; |
175 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
176 | - $table_name = 'esp_line_item'; |
|
177 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
175 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
176 | + $table_name = 'esp_line_item'; |
|
177 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
178 | 178 | LIN_code varchar(245) NOT NULL DEFAULT '', |
179 | 179 | TXN_ID int(11) DEFAULT NULL, |
180 | 180 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -190,18 +190,18 @@ discard block |
||
190 | 190 | OBJ_ID int(11) DEFAULT NULL, |
191 | 191 | OBJ_type varchar(45)DEFAULT NULL, |
192 | 192 | PRIMARY KEY (LIN_ID)"; |
193 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
194 | - $table_name = 'esp_message_template'; |
|
195 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
193 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
194 | + $table_name = 'esp_message_template'; |
|
195 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
196 | 196 | GRP_ID int(10) unsigned NOT NULL, |
197 | 197 | MTP_context varchar(50) NOT NULL, |
198 | 198 | MTP_template_field varchar(30) NOT NULL, |
199 | 199 | MTP_content text NOT NULL, |
200 | 200 | PRIMARY KEY (MTP_ID), |
201 | 201 | KEY GRP_ID (GRP_ID)"; |
202 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | - $table_name = 'esp_message_template_group'; |
|
204 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
202 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | + $table_name = 'esp_message_template_group'; |
|
204 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
205 | 205 | EVT_ID bigint(20) unsigned DEFAULT NULL, |
206 | 206 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
207 | 207 | MTP_messenger varchar(30) NOT NULL, |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | PRIMARY KEY (GRP_ID), |
214 | 214 | KEY EVT_ID (EVT_ID), |
215 | 215 | KEY MTP_user_id (MTP_user_id)"; |
216 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | - $table_name = 'esp_payment'; |
|
218 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
216 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | + $table_name = 'esp_payment'; |
|
218 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
219 | 219 | TXN_ID int(10) unsigned DEFAULT NULL, |
220 | 220 | STS_ID varchar(3) COLLATE utf8_bin DEFAULT NULL, |
221 | 221 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | PRIMARY KEY (PAY_ID), |
232 | 232 | KEY TXN_ID (TXN_ID), |
233 | 233 | KEY PAY_timestamp (PAY_timestamp)"; |
234 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
235 | - $table_name = "esp_ticket"; |
|
236 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
234 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
235 | + $table_name = "esp_ticket"; |
|
236 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
237 | 237 | TTM_ID int(10) unsigned NOT NULL, |
238 | 238 | TKT_name varchar(245) NOT NULL DEFAULT '', |
239 | 239 | TKT_description text NOT NULL, |
@@ -252,28 +252,28 @@ discard block |
||
252 | 252 | TKT_parent int(10) unsigned DEFAULT '0', |
253 | 253 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
254 | 254 | PRIMARY KEY (TKT_ID)"; |
255 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
256 | - $table_name = "esp_ticket_price"; |
|
257 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
255 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
256 | + $table_name = "esp_ticket_price"; |
|
257 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
258 | 258 | TKT_ID int(10) unsigned NOT NULL, |
259 | 259 | PRC_ID int(10) unsigned NOT NULL, |
260 | 260 | PRIMARY KEY (TKP_ID)"; |
261 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
262 | - $table_name = "esp_datetime_ticket"; |
|
263 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
261 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
262 | + $table_name = "esp_datetime_ticket"; |
|
263 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
264 | 264 | DTT_ID int(10) unsigned NOT NULL, |
265 | 265 | TKT_ID int(10) unsigned NOT NULL, |
266 | 266 | PRIMARY KEY (DTK_ID)"; |
267 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
268 | - $table_name = "esp_ticket_template"; |
|
269 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
267 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
268 | + $table_name = "esp_ticket_template"; |
|
269 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
270 | 270 | TTM_name varchar(45) NOT NULL, |
271 | 271 | TTM_description text, |
272 | 272 | TTM_file varchar(45), |
273 | 273 | PRIMARY KEY (TTM_ID)"; |
274 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
275 | - $table_name = "esp_price"; |
|
276 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
274 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
275 | + $table_name = "esp_price"; |
|
276 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
277 | 277 | PRT_ID tinyint(3) unsigned NOT NULL, |
278 | 278 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
279 | 279 | PRC_name varchar(245) NOT NULL, |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | PRC_order tinyint(3) unsigned NOT NULL DEFAULT '0', |
285 | 285 | PRC_parent int(10) unsigned DEFAULT 0, |
286 | 286 | PRIMARY KEY (PRC_ID)"; |
287 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
288 | - $table_name = "esp_price_type"; |
|
289 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
287 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
288 | + $table_name = "esp_price_type"; |
|
289 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
290 | 290 | PRT_name varchar(45) NOT NULL, |
291 | 291 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
292 | 292 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
295 | 295 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
296 | 296 | PRIMARY KEY (PRT_ID)"; |
297 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
298 | - $table_name = 'esp_question'; |
|
299 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
297 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
298 | + $table_name = 'esp_question'; |
|
299 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
300 | 300 | QST_display_text text NOT NULL, |
301 | 301 | QST_admin_label varchar(255) NOT NULL, |
302 | 302 | QST_system varchar(25) DEFAULT NULL, |
@@ -308,10 +308,10 @@ discard block |
||
308 | 308 | QST_wp_user bigint(20) unsigned NULL, |
309 | 309 | QST_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
310 | 310 | PRIMARY KEY (QST_ID)'; |
311 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
312 | - $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
313 | - $table_name = 'esp_question_group'; |
|
314 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
311 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
312 | + $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
313 | + $table_name = 'esp_question_group'; |
|
314 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
315 | 315 | QSG_name varchar(255) NOT NULL, |
316 | 316 | QSG_identifier varchar(100) NOT NULL, |
317 | 317 | QSG_desc text NULL, |
@@ -322,24 +322,24 @@ discard block |
||
322 | 322 | QSG_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
323 | 323 | PRIMARY KEY (QSG_ID), |
324 | 324 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
325 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
326 | - $table_name = 'esp_question_group_question'; |
|
327 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
325 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
326 | + $table_name = 'esp_question_group_question'; |
|
327 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
328 | 328 | QSG_ID int(10) unsigned NOT NULL, |
329 | 329 | QST_ID int(10) unsigned NOT NULL, |
330 | 330 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
331 | 331 | PRIMARY KEY (QGQ_ID) "; |
332 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
333 | - $table_name = 'esp_question_option'; |
|
334 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
332 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
333 | + $table_name = 'esp_question_option'; |
|
334 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
335 | 335 | QSO_value varchar(255) NOT NULL, |
336 | 336 | QSO_desc text NOT NULL, |
337 | 337 | QST_ID int(10) unsigned NOT NULL, |
338 | 338 | QSO_deleted tinyint(1) unsigned NOT NULL DEFAULT 0, |
339 | 339 | PRIMARY KEY (QSO_ID)"; |
340 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
341 | - $table_name = 'esp_registration'; |
|
342 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
340 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
341 | + $table_name = 'esp_registration'; |
|
342 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
343 | 343 | EVT_ID bigint(20) unsigned NOT NULL, |
344 | 344 | ATT_ID bigint(20) unsigned NOT NULL, |
345 | 345 | TXN_ID int(10) unsigned NOT NULL, |
@@ -362,25 +362,25 @@ discard block |
||
362 | 362 | KEY STS_ID (STS_ID), |
363 | 363 | KEY REG_url_link (REG_url_link), |
364 | 364 | KEY REG_code (REG_code)"; |
365 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
366 | - $table_name = 'esp_checkin'; |
|
367 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
365 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB '); |
|
366 | + $table_name = 'esp_checkin'; |
|
367 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
368 | 368 | REG_ID int(10) unsigned NOT NULL, |
369 | 369 | DTT_ID int(10) unsigned NOT NULL, |
370 | 370 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
371 | 371 | CHK_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
372 | 372 | PRIMARY KEY (CHK_ID)"; |
373 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
374 | - $table_name = 'esp_state'; |
|
375 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
373 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
374 | + $table_name = 'esp_state'; |
|
375 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
376 | 376 | CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
377 | 377 | STA_abbrev varchar(6) COLLATE utf8_bin NOT NULL, |
378 | 378 | STA_name varchar(100) COLLATE utf8_bin NOT NULL, |
379 | 379 | STA_active tinyint(1) DEFAULT '1', |
380 | 380 | PRIMARY KEY (STA_ID)"; |
381 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
382 | - $table_name = 'esp_status'; |
|
383 | - $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
381 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
382 | + $table_name = 'esp_status'; |
|
383 | + $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
384 | 384 | STS_code varchar(45) COLLATE utf8_bin NOT NULL, |
385 | 385 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
386 | 386 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -388,9 +388,9 @@ discard block |
||
388 | 388 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
389 | 389 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
390 | 390 | KEY STS_type (STS_type)"; |
391 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
392 | - $table_name = 'esp_transaction'; |
|
393 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
391 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
392 | + $table_name = 'esp_transaction'; |
|
393 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
394 | 394 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
395 | 395 | TXN_total decimal(10,3) DEFAULT '0.00', |
396 | 396 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | PRIMARY KEY (TXN_ID), |
401 | 401 | KEY TXN_timestamp (TXN_timestamp), |
402 | 402 | KEY STS_ID (STS_ID)"; |
403 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
404 | - $table_name = 'esp_venue_meta'; |
|
405 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
403 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
404 | + $table_name = 'esp_venue_meta'; |
|
405 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
406 | 406 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
407 | 407 | VNU_address varchar(255) DEFAULT NULL, |
408 | 408 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -420,36 +420,36 @@ discard block |
||
420 | 420 | PRIMARY KEY (VNUM_ID), |
421 | 421 | KEY STA_ID (STA_ID), |
422 | 422 | KEY CNT_ISO (CNT_ISO)"; |
423 | - $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
424 | - $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
425 | - // setting up the DEFAULT stats and countries is also essential for the data migrations to run |
|
426 | - // (because many need to convert old string states to foreign keys into the states table) |
|
427 | - $script_with_defaults->insert_default_states(); |
|
428 | - $script_with_defaults->insert_default_countries(); |
|
429 | - // setting up DEFAULT prices, price types, and tickets is also essential for the price migrations |
|
430 | - $script_with_defaults->insert_default_price_types(); |
|
431 | - $script_with_defaults->insert_default_prices(); |
|
432 | - $script_with_defaults->insert_default_tickets(); |
|
433 | - // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
434 | - EE_Config::instance()->update_espresso_config(false, true); |
|
435 | - return true; |
|
436 | - } |
|
423 | + $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB'); |
|
424 | + $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
425 | + // setting up the DEFAULT stats and countries is also essential for the data migrations to run |
|
426 | + // (because many need to convert old string states to foreign keys into the states table) |
|
427 | + $script_with_defaults->insert_default_states(); |
|
428 | + $script_with_defaults->insert_default_countries(); |
|
429 | + // setting up DEFAULT prices, price types, and tickets is also essential for the price migrations |
|
430 | + $script_with_defaults->insert_default_price_types(); |
|
431 | + $script_with_defaults->insert_default_prices(); |
|
432 | + $script_with_defaults->insert_default_tickets(); |
|
433 | + // setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre |
|
434 | + EE_Config::instance()->update_espresso_config(false, true); |
|
435 | + return true; |
|
436 | + } |
|
437 | 437 | |
438 | 438 | |
439 | 439 | |
440 | - /** |
|
441 | - * We COULD clean up the esp_question.QST_order field here. We'll leave it for now |
|
442 | - * |
|
443 | - * @return boolean |
|
444 | - */ |
|
445 | - public function schema_changes_after_migration() |
|
446 | - { |
|
447 | - return true; |
|
448 | - } |
|
440 | + /** |
|
441 | + * We COULD clean up the esp_question.QST_order field here. We'll leave it for now |
|
442 | + * |
|
443 | + * @return boolean |
|
444 | + */ |
|
445 | + public function schema_changes_after_migration() |
|
446 | + { |
|
447 | + return true; |
|
448 | + } |
|
449 | 449 | |
450 | 450 | |
451 | 451 | |
452 | - public function migration_page_hooks() |
|
453 | - { |
|
454 | - } |
|
452 | + public function migration_page_hooks() |
|
453 | + { |
|
454 | + } |
|
455 | 455 | } |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | // unfortunately, this needs to be done upon INCLUSION of this file, |
13 | 13 | // instead of construction, because it only gets constructed on first page load |
14 | 14 | // (all other times it gets resurrected from a wordpress option) |
15 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_2_0_stages/*'); |
|
15 | +$stages = glob(EE_CORE.'data_migration_scripts/4_2_0_stages/*'); |
|
16 | 16 | $class_to_filepath = array(); |
17 | -if (! empty($stages)) { |
|
17 | +if ( ! empty($stages)) { |
|
18 | 18 | foreach ($stages as $filepath) { |
19 | 19 | $matches = array(); |
20 | 20 | preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
21 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
21 | + $class_to_filepath[$matches[1]] = $filepath; |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | // give addons a chance to autoload their stages too |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | if (version_compare($version_string, '4.2.0.decaf', '<') && version_compare($version_string, '4.1.0.decaf', '>=')) { |
58 | 58 | // echo "$version_string can be migrated fro"; |
59 | 59 | return true; |
60 | - } elseif (! $version_string) { |
|
60 | + } elseif ( ! $version_string) { |
|
61 | 61 | // echo "no version string provided: $version_string"; |
62 | 62 | // no version string provided... this must be pre 4.1 |
63 | 63 | // because since 4.1 we're |
64 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
64 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
65 | 65 | } else { |
66 | 66 | // echo "$version_string doesnt apply"; |
67 | 67 | return false; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function schema_changes_before_migration() |
74 | 74 | { |
75 | 75 | // relies on 4.1's EEH_Activation::create_table |
76 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
76 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
77 | 77 | $table_name = 'esp_answer'; |
78 | 78 | $sql = "ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
79 | 79 | REG_ID int(10) unsigned NOT NULL, |
@@ -18,373 +18,373 @@ |
||
18 | 18 | abstract class TicketSelectorRow |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var EE_Ticket $ticket |
|
23 | - */ |
|
24 | - protected $ticket; |
|
25 | - |
|
26 | - /** |
|
27 | - * @var int $total_tickets |
|
28 | - */ |
|
29 | - protected $total_tickets; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var int $max_attendees |
|
33 | - */ |
|
34 | - protected $max_attendees; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var string $date_format |
|
38 | - */ |
|
39 | - protected $date_format; |
|
40 | - |
|
41 | - /** |
|
42 | - * @var int $EVT_ID |
|
43 | - */ |
|
44 | - protected $EVT_ID; |
|
45 | - |
|
46 | - /** |
|
47 | - * @var string $event_status |
|
48 | - */ |
|
49 | - protected $event_status; |
|
50 | - |
|
51 | - /** |
|
52 | - * @var boolean $required_ticket_sold_out |
|
53 | - */ |
|
54 | - protected $required_ticket_sold_out; |
|
55 | - |
|
56 | - /** |
|
57 | - * @var string $ticket_status_display |
|
58 | - */ |
|
59 | - protected $ticket_status_display; |
|
60 | - |
|
61 | - /** |
|
62 | - * @var int $max |
|
63 | - */ |
|
64 | - protected $max = 0; |
|
65 | - |
|
66 | - /** |
|
67 | - * @var int $min |
|
68 | - */ |
|
69 | - protected $min = 0; |
|
70 | - |
|
71 | - /** |
|
72 | - * @var float $ticket_price |
|
73 | - */ |
|
74 | - protected $ticket_price = 0.00; |
|
75 | - |
|
76 | - /** |
|
77 | - * @var bool $ticket_bundle |
|
78 | - */ |
|
79 | - protected $ticket_bundle = false; |
|
80 | - |
|
81 | - /** |
|
82 | - * @var string $ticket_status_id |
|
83 | - */ |
|
84 | - protected $ticket_status_id = EE_Ticket::sold_out; |
|
85 | - |
|
86 | - /** |
|
87 | - * @var string $ticket_status_html |
|
88 | - */ |
|
89 | - protected $ticket_status_html = 'ticket-sales-sold-out'; |
|
90 | - |
|
91 | - /** |
|
92 | - * @var string $status_class |
|
93 | - */ |
|
94 | - protected $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param EE_Ticket $ticket |
|
99 | - * @param int $max_attendees |
|
100 | - * @param string $date_format |
|
101 | - * @param string $event_status |
|
102 | - * @param bool $required_ticket_sold_out |
|
103 | - * @param int $total_tickets |
|
104 | - * @throws EE_Error |
|
105 | - * @throws UnexpectedEntityException |
|
106 | - */ |
|
107 | - public function __construct( |
|
108 | - EE_Ticket $ticket, |
|
109 | - $max_attendees, |
|
110 | - $date_format, |
|
111 | - $event_status, |
|
112 | - $required_ticket_sold_out = false, |
|
113 | - $total_tickets = 1 |
|
114 | - ) { |
|
115 | - $this->ticket = $ticket; |
|
116 | - $this->max_attendees = $max_attendees; |
|
117 | - $this->date_format = $date_format; |
|
118 | - $this->EVT_ID = $this->ticket->get_event_ID(); |
|
119 | - $this->event_status = $event_status; |
|
120 | - $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
121 | - $this->total_tickets = $total_tickets; |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * getTicketStatusClasses |
|
127 | - * |
|
128 | - * @param int $remaining |
|
129 | - * @return void |
|
130 | - * @throws EE_Error |
|
131 | - */ |
|
132 | - protected function setTicketStatusClasses($remaining = 0) |
|
133 | - { |
|
134 | - // if a previous required ticket with the same sale start date is sold out, |
|
135 | - // then mark this ticket as sold out as well. |
|
136 | - // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
137 | - $this->ticket_status_id = $this->required_ticket_sold_out !== false |
|
138 | - && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
139 | - ? EE_Ticket::sold_out |
|
140 | - : $this->ticket->ticket_status(); |
|
141 | - $this->ticket_status_id = $this->event_status === EE_Datetime::sold_out |
|
142 | - ? EE_Ticket::sold_out |
|
143 | - : $this->ticket_status_id; |
|
144 | - // If at admin area, display expired tickets as on sale. |
|
145 | - $this->ticket_status_id = is_admin() && $this->ticket_status_id === EE_Ticket::expired |
|
146 | - ? EE_Ticket::onsale |
|
147 | - : $this->ticket_status_id; |
|
148 | - // check ticket status |
|
149 | - switch ($this->ticket_status_id) { |
|
150 | - // sold_out |
|
151 | - case EE_Ticket::sold_out: |
|
152 | - $ticket_status_class = 'ticket-sales-sold-out'; |
|
153 | - $this->status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
154 | - break; |
|
155 | - // expired |
|
156 | - case EE_Ticket::expired: |
|
157 | - $ticket_status_class = 'ticket-sales-expired'; |
|
158 | - $this->status_class = 'ticket-sales-expired lt-grey-text'; |
|
159 | - break; |
|
160 | - // archived |
|
161 | - case EE_Ticket::archived: |
|
162 | - $ticket_status_class = 'archived-ticket'; |
|
163 | - $this->status_class = 'archived-ticket hidden'; |
|
164 | - break; |
|
165 | - // pending |
|
166 | - case EE_Ticket::pending: |
|
167 | - $ticket_status_class = 'ticket-pending'; |
|
168 | - $this->status_class = 'ticket-pending'; |
|
169 | - break; |
|
170 | - // on sale |
|
171 | - case EE_Ticket::onsale: |
|
172 | - default: |
|
173 | - $ticket_status_class = 'ticket-on-sale'; |
|
174 | - $this->status_class = 'ticket-on-sale'; |
|
175 | - break; |
|
176 | - } |
|
177 | - $this->ticket_status_html = EEH_HTML::span( |
|
178 | - $this->ticket->ticket_status(true, ($remaining > 0)), |
|
179 | - "{$ticket_status_class}-{$this->ticket->ID()}", |
|
180 | - $ticket_status_class |
|
181 | - ); |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - /** |
|
186 | - * @return string |
|
187 | - */ |
|
188 | - public function getTicketStatusDisplay() |
|
189 | - { |
|
190 | - return $this->ticket_status_display; |
|
191 | - } |
|
192 | - |
|
193 | - |
|
194 | - /** |
|
195 | - * setTicketStatusDisplay |
|
196 | - * |
|
197 | - * @param int $remaining |
|
198 | - * @throws EE_Error |
|
199 | - */ |
|
200 | - protected function setTicketStatusDisplay($remaining) |
|
201 | - { |
|
202 | - $this->ticket_status_display = ''; |
|
203 | - |
|
204 | - // now depending on the ticket and other circumstances... |
|
205 | - if ($this->max_attendees === 0) { |
|
206 | - // registration is CLOSED because admin set max attendees to ZERO |
|
207 | - $this->ticket_status_display = $this->registrationClosed(); |
|
208 | - } elseif ($this->ticket_status_id === EE_Ticket::sold_out || $remaining === 0) { |
|
209 | - // SOLD OUT - no tickets remaining |
|
210 | - $this->ticket_status_display = $this->ticketsSoldOut(); |
|
211 | - } elseif ($this->ticket_status_id === EE_Ticket::expired || $this->ticket_status_id === EE_Ticket::archived) { |
|
212 | - // expired or archived ticket |
|
213 | - $this->ticket_status_display = $this->ticket_status_html; |
|
214 | - } elseif ($this->ticket_status_id === EE_Ticket::pending) { |
|
215 | - // ticket not on sale yet |
|
216 | - $this->ticket_status_display = $this->ticketsSalesPending(); |
|
217 | - } elseif ($this->ticket->min() > $remaining) { |
|
218 | - // min qty purchasable is less than tickets available |
|
219 | - $this->ticket_status_display = $this->notEnoughTicketsAvailable(); |
|
220 | - } |
|
221 | - } |
|
222 | - |
|
223 | - |
|
224 | - /** |
|
225 | - * registrationClosed |
|
226 | - */ |
|
227 | - protected function registrationClosed() |
|
228 | - { |
|
229 | - return EEH_HTML::span( |
|
230 | - apply_filters( |
|
231 | - 'FHEE__ticket_selector_chart_template__ticket_closed_msg', |
|
232 | - __('Closed', 'event_espresso') |
|
233 | - ), |
|
234 | - '', |
|
235 | - 'sold-out' |
|
236 | - ); |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - /** |
|
241 | - * ticketsSoldOut |
|
242 | - */ |
|
243 | - protected function ticketsSoldOut() |
|
244 | - { |
|
245 | - return EEH_HTML::span( |
|
246 | - apply_filters( |
|
247 | - 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', |
|
248 | - __('Sold Out', 'event_espresso') |
|
249 | - ), |
|
250 | - '', |
|
251 | - 'sold-out' |
|
252 | - ); |
|
253 | - } |
|
254 | - |
|
255 | - |
|
256 | - /** |
|
257 | - * ticketsSalesPending |
|
258 | - * |
|
259 | - * @throws EE_Error |
|
260 | - */ |
|
261 | - protected function ticketsSalesPending() |
|
262 | - { |
|
263 | - return EEH_HTML::span( |
|
264 | - EEH_HTML::span( |
|
265 | - apply_filters( |
|
266 | - 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', |
|
267 | - __('Goes On Sale', 'event_espresso') |
|
268 | - ), |
|
269 | - '', |
|
270 | - 'ticket-pending' |
|
271 | - ) |
|
272 | - . EEH_HTML::br() |
|
273 | - . EEH_HTML::span( |
|
274 | - $this->ticket->get_i18n_datetime( |
|
275 | - 'TKT_start_date', |
|
276 | - apply_filters( |
|
277 | - 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', |
|
278 | - $this->date_format |
|
279 | - ) |
|
280 | - ), |
|
281 | - '', |
|
282 | - 'small-text' |
|
283 | - ), |
|
284 | - '', |
|
285 | - 'ticket-pending-pg' |
|
286 | - ); |
|
287 | - } |
|
288 | - |
|
289 | - |
|
290 | - /** |
|
291 | - * notEnoughTicketsAvailable |
|
292 | - */ |
|
293 | - protected function notEnoughTicketsAvailable() |
|
294 | - { |
|
295 | - return EEH_HTML::div( |
|
296 | - EEH_HTML::span( |
|
297 | - apply_filters( |
|
298 | - 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', |
|
299 | - __('Not Available', 'event_espresso') |
|
300 | - ), |
|
301 | - '', |
|
302 | - 'archived-ticket small-text' |
|
303 | - ) |
|
304 | - . EEH_HTML::br(), |
|
305 | - '', |
|
306 | - 'archived-ticket-pg' |
|
307 | - ); |
|
308 | - } |
|
309 | - |
|
310 | - |
|
311 | - /** |
|
312 | - * setTicketMinAndMax |
|
313 | - * |
|
314 | - * @param int $remaining |
|
315 | - * @return void |
|
316 | - * @throws EE_Error |
|
317 | - */ |
|
318 | - protected function setTicketMinAndMax($remaining) |
|
319 | - { |
|
320 | - // offer the number of $tickets_remaining or $this->max_attendees, whichever is smaller |
|
321 | - $this->max = min($remaining, $this->max_attendees); |
|
322 | - // but... we also want to restrict the number of tickets by the ticket max setting, |
|
323 | - // however, the max still can't be higher than what was just set above |
|
324 | - $this->max = $this->ticket->max() > 0 |
|
325 | - ? min($this->ticket->max(), $this->max) |
|
326 | - : $this->max; |
|
327 | - // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
328 | - $this->min = $this->ticket->min() > 0 |
|
329 | - ? $this->ticket->min() |
|
330 | - : 0; |
|
331 | - // and if the ticket is required, then make sure that min qty is at least 1 |
|
332 | - $this->min = $this->ticket->required() |
|
333 | - ? max($this->min, 1) |
|
334 | - : $this->min; |
|
335 | - } |
|
336 | - |
|
337 | - |
|
338 | - /** |
|
339 | - * Allow plugins to hook in and abort the generation and display of this row to do |
|
340 | - * something elseif they want. |
|
341 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
342 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
343 | - * current row. |
|
344 | - * |
|
345 | - * @return string|bool |
|
346 | - */ |
|
347 | - protected function getFilteredRowHtml() |
|
348 | - { |
|
349 | - return apply_filters( |
|
350 | - 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
351 | - false, |
|
352 | - $this->ticket, |
|
353 | - $this->max, |
|
354 | - $this->min, |
|
355 | - $this->required_ticket_sold_out, |
|
356 | - $this->ticket_price, |
|
357 | - $this->ticket_bundle, |
|
358 | - $this->ticket_status_html, |
|
359 | - $this->status_class, |
|
360 | - $this |
|
361 | - ); |
|
362 | - } |
|
363 | - |
|
364 | - |
|
365 | - /** |
|
366 | - * Allow plugins to hook in and abort the generation and display of the contents of this |
|
367 | - * row to do something elseif they want. |
|
368 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
369 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
370 | - * current row. |
|
371 | - * |
|
372 | - * @return string|bool |
|
373 | - */ |
|
374 | - protected function getFilteredRowContents() |
|
375 | - { |
|
376 | - return apply_filters( |
|
377 | - 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
378 | - false, |
|
379 | - $this->ticket, |
|
380 | - $this->max, |
|
381 | - $this->min, |
|
382 | - $this->required_ticket_sold_out, |
|
383 | - $this->ticket_price, |
|
384 | - $this->ticket_bundle, |
|
385 | - $this->ticket_status_html, |
|
386 | - $this->status_class, |
|
387 | - $this |
|
388 | - ); |
|
389 | - } |
|
21 | + /** |
|
22 | + * @var EE_Ticket $ticket |
|
23 | + */ |
|
24 | + protected $ticket; |
|
25 | + |
|
26 | + /** |
|
27 | + * @var int $total_tickets |
|
28 | + */ |
|
29 | + protected $total_tickets; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var int $max_attendees |
|
33 | + */ |
|
34 | + protected $max_attendees; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var string $date_format |
|
38 | + */ |
|
39 | + protected $date_format; |
|
40 | + |
|
41 | + /** |
|
42 | + * @var int $EVT_ID |
|
43 | + */ |
|
44 | + protected $EVT_ID; |
|
45 | + |
|
46 | + /** |
|
47 | + * @var string $event_status |
|
48 | + */ |
|
49 | + protected $event_status; |
|
50 | + |
|
51 | + /** |
|
52 | + * @var boolean $required_ticket_sold_out |
|
53 | + */ |
|
54 | + protected $required_ticket_sold_out; |
|
55 | + |
|
56 | + /** |
|
57 | + * @var string $ticket_status_display |
|
58 | + */ |
|
59 | + protected $ticket_status_display; |
|
60 | + |
|
61 | + /** |
|
62 | + * @var int $max |
|
63 | + */ |
|
64 | + protected $max = 0; |
|
65 | + |
|
66 | + /** |
|
67 | + * @var int $min |
|
68 | + */ |
|
69 | + protected $min = 0; |
|
70 | + |
|
71 | + /** |
|
72 | + * @var float $ticket_price |
|
73 | + */ |
|
74 | + protected $ticket_price = 0.00; |
|
75 | + |
|
76 | + /** |
|
77 | + * @var bool $ticket_bundle |
|
78 | + */ |
|
79 | + protected $ticket_bundle = false; |
|
80 | + |
|
81 | + /** |
|
82 | + * @var string $ticket_status_id |
|
83 | + */ |
|
84 | + protected $ticket_status_id = EE_Ticket::sold_out; |
|
85 | + |
|
86 | + /** |
|
87 | + * @var string $ticket_status_html |
|
88 | + */ |
|
89 | + protected $ticket_status_html = 'ticket-sales-sold-out'; |
|
90 | + |
|
91 | + /** |
|
92 | + * @var string $status_class |
|
93 | + */ |
|
94 | + protected $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param EE_Ticket $ticket |
|
99 | + * @param int $max_attendees |
|
100 | + * @param string $date_format |
|
101 | + * @param string $event_status |
|
102 | + * @param bool $required_ticket_sold_out |
|
103 | + * @param int $total_tickets |
|
104 | + * @throws EE_Error |
|
105 | + * @throws UnexpectedEntityException |
|
106 | + */ |
|
107 | + public function __construct( |
|
108 | + EE_Ticket $ticket, |
|
109 | + $max_attendees, |
|
110 | + $date_format, |
|
111 | + $event_status, |
|
112 | + $required_ticket_sold_out = false, |
|
113 | + $total_tickets = 1 |
|
114 | + ) { |
|
115 | + $this->ticket = $ticket; |
|
116 | + $this->max_attendees = $max_attendees; |
|
117 | + $this->date_format = $date_format; |
|
118 | + $this->EVT_ID = $this->ticket->get_event_ID(); |
|
119 | + $this->event_status = $event_status; |
|
120 | + $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
121 | + $this->total_tickets = $total_tickets; |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * getTicketStatusClasses |
|
127 | + * |
|
128 | + * @param int $remaining |
|
129 | + * @return void |
|
130 | + * @throws EE_Error |
|
131 | + */ |
|
132 | + protected function setTicketStatusClasses($remaining = 0) |
|
133 | + { |
|
134 | + // if a previous required ticket with the same sale start date is sold out, |
|
135 | + // then mark this ticket as sold out as well. |
|
136 | + // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
137 | + $this->ticket_status_id = $this->required_ticket_sold_out !== false |
|
138 | + && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
139 | + ? EE_Ticket::sold_out |
|
140 | + : $this->ticket->ticket_status(); |
|
141 | + $this->ticket_status_id = $this->event_status === EE_Datetime::sold_out |
|
142 | + ? EE_Ticket::sold_out |
|
143 | + : $this->ticket_status_id; |
|
144 | + // If at admin area, display expired tickets as on sale. |
|
145 | + $this->ticket_status_id = is_admin() && $this->ticket_status_id === EE_Ticket::expired |
|
146 | + ? EE_Ticket::onsale |
|
147 | + : $this->ticket_status_id; |
|
148 | + // check ticket status |
|
149 | + switch ($this->ticket_status_id) { |
|
150 | + // sold_out |
|
151 | + case EE_Ticket::sold_out: |
|
152 | + $ticket_status_class = 'ticket-sales-sold-out'; |
|
153 | + $this->status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
154 | + break; |
|
155 | + // expired |
|
156 | + case EE_Ticket::expired: |
|
157 | + $ticket_status_class = 'ticket-sales-expired'; |
|
158 | + $this->status_class = 'ticket-sales-expired lt-grey-text'; |
|
159 | + break; |
|
160 | + // archived |
|
161 | + case EE_Ticket::archived: |
|
162 | + $ticket_status_class = 'archived-ticket'; |
|
163 | + $this->status_class = 'archived-ticket hidden'; |
|
164 | + break; |
|
165 | + // pending |
|
166 | + case EE_Ticket::pending: |
|
167 | + $ticket_status_class = 'ticket-pending'; |
|
168 | + $this->status_class = 'ticket-pending'; |
|
169 | + break; |
|
170 | + // on sale |
|
171 | + case EE_Ticket::onsale: |
|
172 | + default: |
|
173 | + $ticket_status_class = 'ticket-on-sale'; |
|
174 | + $this->status_class = 'ticket-on-sale'; |
|
175 | + break; |
|
176 | + } |
|
177 | + $this->ticket_status_html = EEH_HTML::span( |
|
178 | + $this->ticket->ticket_status(true, ($remaining > 0)), |
|
179 | + "{$ticket_status_class}-{$this->ticket->ID()}", |
|
180 | + $ticket_status_class |
|
181 | + ); |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + /** |
|
186 | + * @return string |
|
187 | + */ |
|
188 | + public function getTicketStatusDisplay() |
|
189 | + { |
|
190 | + return $this->ticket_status_display; |
|
191 | + } |
|
192 | + |
|
193 | + |
|
194 | + /** |
|
195 | + * setTicketStatusDisplay |
|
196 | + * |
|
197 | + * @param int $remaining |
|
198 | + * @throws EE_Error |
|
199 | + */ |
|
200 | + protected function setTicketStatusDisplay($remaining) |
|
201 | + { |
|
202 | + $this->ticket_status_display = ''; |
|
203 | + |
|
204 | + // now depending on the ticket and other circumstances... |
|
205 | + if ($this->max_attendees === 0) { |
|
206 | + // registration is CLOSED because admin set max attendees to ZERO |
|
207 | + $this->ticket_status_display = $this->registrationClosed(); |
|
208 | + } elseif ($this->ticket_status_id === EE_Ticket::sold_out || $remaining === 0) { |
|
209 | + // SOLD OUT - no tickets remaining |
|
210 | + $this->ticket_status_display = $this->ticketsSoldOut(); |
|
211 | + } elseif ($this->ticket_status_id === EE_Ticket::expired || $this->ticket_status_id === EE_Ticket::archived) { |
|
212 | + // expired or archived ticket |
|
213 | + $this->ticket_status_display = $this->ticket_status_html; |
|
214 | + } elseif ($this->ticket_status_id === EE_Ticket::pending) { |
|
215 | + // ticket not on sale yet |
|
216 | + $this->ticket_status_display = $this->ticketsSalesPending(); |
|
217 | + } elseif ($this->ticket->min() > $remaining) { |
|
218 | + // min qty purchasable is less than tickets available |
|
219 | + $this->ticket_status_display = $this->notEnoughTicketsAvailable(); |
|
220 | + } |
|
221 | + } |
|
222 | + |
|
223 | + |
|
224 | + /** |
|
225 | + * registrationClosed |
|
226 | + */ |
|
227 | + protected function registrationClosed() |
|
228 | + { |
|
229 | + return EEH_HTML::span( |
|
230 | + apply_filters( |
|
231 | + 'FHEE__ticket_selector_chart_template__ticket_closed_msg', |
|
232 | + __('Closed', 'event_espresso') |
|
233 | + ), |
|
234 | + '', |
|
235 | + 'sold-out' |
|
236 | + ); |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + /** |
|
241 | + * ticketsSoldOut |
|
242 | + */ |
|
243 | + protected function ticketsSoldOut() |
|
244 | + { |
|
245 | + return EEH_HTML::span( |
|
246 | + apply_filters( |
|
247 | + 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', |
|
248 | + __('Sold Out', 'event_espresso') |
|
249 | + ), |
|
250 | + '', |
|
251 | + 'sold-out' |
|
252 | + ); |
|
253 | + } |
|
254 | + |
|
255 | + |
|
256 | + /** |
|
257 | + * ticketsSalesPending |
|
258 | + * |
|
259 | + * @throws EE_Error |
|
260 | + */ |
|
261 | + protected function ticketsSalesPending() |
|
262 | + { |
|
263 | + return EEH_HTML::span( |
|
264 | + EEH_HTML::span( |
|
265 | + apply_filters( |
|
266 | + 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', |
|
267 | + __('Goes On Sale', 'event_espresso') |
|
268 | + ), |
|
269 | + '', |
|
270 | + 'ticket-pending' |
|
271 | + ) |
|
272 | + . EEH_HTML::br() |
|
273 | + . EEH_HTML::span( |
|
274 | + $this->ticket->get_i18n_datetime( |
|
275 | + 'TKT_start_date', |
|
276 | + apply_filters( |
|
277 | + 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', |
|
278 | + $this->date_format |
|
279 | + ) |
|
280 | + ), |
|
281 | + '', |
|
282 | + 'small-text' |
|
283 | + ), |
|
284 | + '', |
|
285 | + 'ticket-pending-pg' |
|
286 | + ); |
|
287 | + } |
|
288 | + |
|
289 | + |
|
290 | + /** |
|
291 | + * notEnoughTicketsAvailable |
|
292 | + */ |
|
293 | + protected function notEnoughTicketsAvailable() |
|
294 | + { |
|
295 | + return EEH_HTML::div( |
|
296 | + EEH_HTML::span( |
|
297 | + apply_filters( |
|
298 | + 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', |
|
299 | + __('Not Available', 'event_espresso') |
|
300 | + ), |
|
301 | + '', |
|
302 | + 'archived-ticket small-text' |
|
303 | + ) |
|
304 | + . EEH_HTML::br(), |
|
305 | + '', |
|
306 | + 'archived-ticket-pg' |
|
307 | + ); |
|
308 | + } |
|
309 | + |
|
310 | + |
|
311 | + /** |
|
312 | + * setTicketMinAndMax |
|
313 | + * |
|
314 | + * @param int $remaining |
|
315 | + * @return void |
|
316 | + * @throws EE_Error |
|
317 | + */ |
|
318 | + protected function setTicketMinAndMax($remaining) |
|
319 | + { |
|
320 | + // offer the number of $tickets_remaining or $this->max_attendees, whichever is smaller |
|
321 | + $this->max = min($remaining, $this->max_attendees); |
|
322 | + // but... we also want to restrict the number of tickets by the ticket max setting, |
|
323 | + // however, the max still can't be higher than what was just set above |
|
324 | + $this->max = $this->ticket->max() > 0 |
|
325 | + ? min($this->ticket->max(), $this->max) |
|
326 | + : $this->max; |
|
327 | + // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
328 | + $this->min = $this->ticket->min() > 0 |
|
329 | + ? $this->ticket->min() |
|
330 | + : 0; |
|
331 | + // and if the ticket is required, then make sure that min qty is at least 1 |
|
332 | + $this->min = $this->ticket->required() |
|
333 | + ? max($this->min, 1) |
|
334 | + : $this->min; |
|
335 | + } |
|
336 | + |
|
337 | + |
|
338 | + /** |
|
339 | + * Allow plugins to hook in and abort the generation and display of this row to do |
|
340 | + * something elseif they want. |
|
341 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
342 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
343 | + * current row. |
|
344 | + * |
|
345 | + * @return string|bool |
|
346 | + */ |
|
347 | + protected function getFilteredRowHtml() |
|
348 | + { |
|
349 | + return apply_filters( |
|
350 | + 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
351 | + false, |
|
352 | + $this->ticket, |
|
353 | + $this->max, |
|
354 | + $this->min, |
|
355 | + $this->required_ticket_sold_out, |
|
356 | + $this->ticket_price, |
|
357 | + $this->ticket_bundle, |
|
358 | + $this->ticket_status_html, |
|
359 | + $this->status_class, |
|
360 | + $this |
|
361 | + ); |
|
362 | + } |
|
363 | + |
|
364 | + |
|
365 | + /** |
|
366 | + * Allow plugins to hook in and abort the generation and display of the contents of this |
|
367 | + * row to do something elseif they want. |
|
368 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
369 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
370 | + * current row. |
|
371 | + * |
|
372 | + * @return string|bool |
|
373 | + */ |
|
374 | + protected function getFilteredRowContents() |
|
375 | + { |
|
376 | + return apply_filters( |
|
377 | + 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
378 | + false, |
|
379 | + $this->ticket, |
|
380 | + $this->max, |
|
381 | + $this->min, |
|
382 | + $this->required_ticket_sold_out, |
|
383 | + $this->ticket_price, |
|
384 | + $this->ticket_bundle, |
|
385 | + $this->ticket_status_html, |
|
386 | + $this->status_class, |
|
387 | + $this |
|
388 | + ); |
|
389 | + } |
|
390 | 390 | } |
@@ -18,225 +18,225 @@ |
||
18 | 18 | class EE_Recipient_List_Shortcodes extends EE_Shortcodes |
19 | 19 | { |
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct(); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - protected function _init_props() |
|
28 | - { |
|
29 | - $this->label = __('Recipient List Shortcodes', 'event_espresso'); |
|
30 | - $this->description = __('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
31 | - $this->_shortcodes = array( |
|
32 | - '[RECIPIENT_TICKET_LIST]' => __( |
|
33 | - 'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.', |
|
34 | - 'event_espresso' |
|
35 | - ), |
|
36 | - '[RECIPIENT_DATETIME_LIST]' => __( |
|
37 | - 'Will output a list of datetimes that the person receiving this message has been registered for.', |
|
38 | - 'event_espresso' |
|
39 | - ), |
|
40 | - ); |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - protected function _parser($shortcode) |
|
45 | - { |
|
46 | - switch ($shortcode) { |
|
47 | - case '[RECIPIENT_TICKET_LIST]': |
|
48 | - return $this->_get_recipient_ticket_list(); |
|
49 | - break; |
|
50 | - |
|
51 | - case '[RECIPIENT_DATETIME_LIST]': |
|
52 | - return $this->_get_recipient_datetime_list(); |
|
53 | - break; |
|
54 | - } |
|
55 | - return ''; |
|
56 | - } |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * figure out what the incoming data is and then return the appropriate parsed value |
|
61 | - * |
|
62 | - * @return string |
|
63 | - */ |
|
64 | - private function _get_recipient_ticket_list() |
|
65 | - { |
|
66 | - $this->_validate_list_requirements(); |
|
67 | - |
|
68 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
69 | - return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
70 | - } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
71 | - return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
72 | - } else { |
|
73 | - return ''; |
|
74 | - } |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) |
|
79 | - { |
|
80 | - // first get registrations just for this attendee. |
|
81 | - $att = $data->att_obj; |
|
82 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
83 | - $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
84 | - ? array($data->reg_obj) : $registrations_on_attendee; |
|
85 | - $tkts = array(); |
|
86 | - |
|
87 | - // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
|
88 | - // which means we want to get tickets for all events this addressee is a part of. |
|
89 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
90 | - $valid_shortcodes = array( |
|
91 | - 'ticket', |
|
92 | - 'event_list', |
|
93 | - 'attendee_list', |
|
94 | - 'datetime_list', |
|
95 | - 'registration_details', |
|
96 | - 'attendee', |
|
97 | - 'recipient_details', |
|
98 | - ); |
|
99 | - $template = $this->_data['template']; |
|
100 | - |
|
101 | - // tickets will be tickets for all registrations on this attendee. |
|
102 | - foreach ($registrations_on_attendee as $reg) { |
|
103 | - if ($reg instanceof EE_Registration) { |
|
104 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
105 | - $data->registrations[ $reg->ID() ] |
|
106 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
107 | - ) ]['tkt_obj'] : null; |
|
108 | - if ($ticket instanceof EE_Ticket) { |
|
109 | - $tkts[ $ticket->ID() ] = $ticket; |
|
110 | - } |
|
111 | - } |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - // if coming from the context of the event list parser, then let's return just the tickets for that event. |
|
116 | - $event = $this->_data['data']; |
|
117 | - if ($event instanceof EE_Event) { |
|
118 | - $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
|
119 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
120 | - ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
121 | - // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
122 | - $template = str_replace('[EVENT_LIST]', '', $template); |
|
123 | - // data will be tickets for this event for this recipient. |
|
124 | - foreach ($registrations_on_attendee as $reg) { |
|
125 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
126 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
127 | - $data->registrations[ $reg->ID() ] |
|
128 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
129 | - ) ]['tkt_obj'] : null; |
|
130 | - if ($ticket instanceof EE_Ticket) { |
|
131 | - $tkts[ $ticket->ID() ] = $ticket; |
|
132 | - } |
|
133 | - } |
|
134 | - } |
|
135 | - } |
|
136 | - |
|
137 | - $tkt_parsed = ''; |
|
138 | - foreach ($tkts as $ticket) { |
|
139 | - $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
140 | - $template, |
|
141 | - $ticket, |
|
142 | - $valid_shortcodes, |
|
143 | - $this->_extra_data |
|
144 | - ); |
|
145 | - } |
|
146 | - return $tkt_parsed; |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * figure out what the incoming data is and then return the appropriate parsed value |
|
152 | - * |
|
153 | - * @return string |
|
154 | - */ |
|
155 | - private function _get_recipient_datetime_list() |
|
156 | - { |
|
157 | - $this->_validate_list_requirements(); |
|
158 | - |
|
159 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
160 | - return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
161 | - } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
162 | - return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
163 | - } else { |
|
164 | - return ''; |
|
165 | - } |
|
166 | - } |
|
167 | - |
|
168 | - |
|
169 | - private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) |
|
170 | - { |
|
171 | - // first get registrations just for this attendee. |
|
172 | - $att = $data->att_obj; |
|
173 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
174 | - $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
175 | - ? array($data->reg_obj) |
|
176 | - : $registrations_on_attendee; |
|
177 | - $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
178 | - $template = ''; |
|
179 | - $dtts = array(); |
|
180 | - |
|
181 | - // setup valid shortcodes depending on what the status of the $this->_data property is |
|
182 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
183 | - $template = $this->_data['template']; |
|
184 | - |
|
185 | - // dtts will be datetimes for all registrations on this attendee |
|
186 | - foreach ($registrations_on_attendee as $reg) { |
|
187 | - if ($reg instanceof EE_Registration) { |
|
188 | - $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
189 | - $data->registrations[ $reg->ID() ] |
|
190 | - ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
191 | - ) ]['dtt_objs'] : array(); |
|
192 | - $dtt_objs = (array) $dtt_objs; |
|
193 | - foreach ($dtt_objs as $dtt_obj) { |
|
194 | - if ($dtt_obj instanceof EE_Datetime) { |
|
195 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
196 | - } |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
200 | - } |
|
201 | - |
|
202 | - // if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
|
203 | - $event = $this->_data['data']; |
|
204 | - if ($event instanceof EE_Event) { |
|
205 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
206 | - ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
207 | - |
|
208 | - // data will be datetimes for this event for this recipient |
|
209 | - foreach ($registrations_on_attendee as $reg) { |
|
210 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
211 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
212 | - $data->registrations[ $reg->ID() ] |
|
213 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
214 | - ) ]['tkt_obj'] : null; |
|
215 | - if ($ticket instanceof EE_Ticket) { |
|
216 | - $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
217 | - $data->tickets[ $ticket->ID() ] |
|
218 | - ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
219 | - ) ]['dtt_objs'] : array(); |
|
220 | - $dtt_objs = (array) $dtt_objs; |
|
221 | - foreach ($dtt_objs as $dtt_obj) { |
|
222 | - if ($dtt_obj instanceof EE_Datetime) { |
|
223 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
224 | - } |
|
225 | - } |
|
226 | - } |
|
227 | - } |
|
228 | - } |
|
229 | - } |
|
230 | - |
|
231 | - $dtt_parsed = ''; |
|
232 | - foreach ($dtts as $datetime) { |
|
233 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
234 | - $template, |
|
235 | - $datetime, |
|
236 | - $valid_shortcodes, |
|
237 | - $this->_extra_data |
|
238 | - ); |
|
239 | - } |
|
240 | - return $dtt_parsed; |
|
241 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + protected function _init_props() |
|
28 | + { |
|
29 | + $this->label = __('Recipient List Shortcodes', 'event_espresso'); |
|
30 | + $this->description = __('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
31 | + $this->_shortcodes = array( |
|
32 | + '[RECIPIENT_TICKET_LIST]' => __( |
|
33 | + 'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.', |
|
34 | + 'event_espresso' |
|
35 | + ), |
|
36 | + '[RECIPIENT_DATETIME_LIST]' => __( |
|
37 | + 'Will output a list of datetimes that the person receiving this message has been registered for.', |
|
38 | + 'event_espresso' |
|
39 | + ), |
|
40 | + ); |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + protected function _parser($shortcode) |
|
45 | + { |
|
46 | + switch ($shortcode) { |
|
47 | + case '[RECIPIENT_TICKET_LIST]': |
|
48 | + return $this->_get_recipient_ticket_list(); |
|
49 | + break; |
|
50 | + |
|
51 | + case '[RECIPIENT_DATETIME_LIST]': |
|
52 | + return $this->_get_recipient_datetime_list(); |
|
53 | + break; |
|
54 | + } |
|
55 | + return ''; |
|
56 | + } |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * figure out what the incoming data is and then return the appropriate parsed value |
|
61 | + * |
|
62 | + * @return string |
|
63 | + */ |
|
64 | + private function _get_recipient_ticket_list() |
|
65 | + { |
|
66 | + $this->_validate_list_requirements(); |
|
67 | + |
|
68 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
69 | + return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
70 | + } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
71 | + return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
72 | + } else { |
|
73 | + return ''; |
|
74 | + } |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) |
|
79 | + { |
|
80 | + // first get registrations just for this attendee. |
|
81 | + $att = $data->att_obj; |
|
82 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
83 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
84 | + ? array($data->reg_obj) : $registrations_on_attendee; |
|
85 | + $tkts = array(); |
|
86 | + |
|
87 | + // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
|
88 | + // which means we want to get tickets for all events this addressee is a part of. |
|
89 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
90 | + $valid_shortcodes = array( |
|
91 | + 'ticket', |
|
92 | + 'event_list', |
|
93 | + 'attendee_list', |
|
94 | + 'datetime_list', |
|
95 | + 'registration_details', |
|
96 | + 'attendee', |
|
97 | + 'recipient_details', |
|
98 | + ); |
|
99 | + $template = $this->_data['template']; |
|
100 | + |
|
101 | + // tickets will be tickets for all registrations on this attendee. |
|
102 | + foreach ($registrations_on_attendee as $reg) { |
|
103 | + if ($reg instanceof EE_Registration) { |
|
104 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
105 | + $data->registrations[ $reg->ID() ] |
|
106 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
107 | + ) ]['tkt_obj'] : null; |
|
108 | + if ($ticket instanceof EE_Ticket) { |
|
109 | + $tkts[ $ticket->ID() ] = $ticket; |
|
110 | + } |
|
111 | + } |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + // if coming from the context of the event list parser, then let's return just the tickets for that event. |
|
116 | + $event = $this->_data['data']; |
|
117 | + if ($event instanceof EE_Event) { |
|
118 | + $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
|
119 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
120 | + ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
121 | + // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
122 | + $template = str_replace('[EVENT_LIST]', '', $template); |
|
123 | + // data will be tickets for this event for this recipient. |
|
124 | + foreach ($registrations_on_attendee as $reg) { |
|
125 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
126 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
127 | + $data->registrations[ $reg->ID() ] |
|
128 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
129 | + ) ]['tkt_obj'] : null; |
|
130 | + if ($ticket instanceof EE_Ticket) { |
|
131 | + $tkts[ $ticket->ID() ] = $ticket; |
|
132 | + } |
|
133 | + } |
|
134 | + } |
|
135 | + } |
|
136 | + |
|
137 | + $tkt_parsed = ''; |
|
138 | + foreach ($tkts as $ticket) { |
|
139 | + $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
140 | + $template, |
|
141 | + $ticket, |
|
142 | + $valid_shortcodes, |
|
143 | + $this->_extra_data |
|
144 | + ); |
|
145 | + } |
|
146 | + return $tkt_parsed; |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * figure out what the incoming data is and then return the appropriate parsed value |
|
152 | + * |
|
153 | + * @return string |
|
154 | + */ |
|
155 | + private function _get_recipient_datetime_list() |
|
156 | + { |
|
157 | + $this->_validate_list_requirements(); |
|
158 | + |
|
159 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
160 | + return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
161 | + } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
162 | + return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
163 | + } else { |
|
164 | + return ''; |
|
165 | + } |
|
166 | + } |
|
167 | + |
|
168 | + |
|
169 | + private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) |
|
170 | + { |
|
171 | + // first get registrations just for this attendee. |
|
172 | + $att = $data->att_obj; |
|
173 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
174 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
175 | + ? array($data->reg_obj) |
|
176 | + : $registrations_on_attendee; |
|
177 | + $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
178 | + $template = ''; |
|
179 | + $dtts = array(); |
|
180 | + |
|
181 | + // setup valid shortcodes depending on what the status of the $this->_data property is |
|
182 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
183 | + $template = $this->_data['template']; |
|
184 | + |
|
185 | + // dtts will be datetimes for all registrations on this attendee |
|
186 | + foreach ($registrations_on_attendee as $reg) { |
|
187 | + if ($reg instanceof EE_Registration) { |
|
188 | + $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
189 | + $data->registrations[ $reg->ID() ] |
|
190 | + ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
191 | + ) ]['dtt_objs'] : array(); |
|
192 | + $dtt_objs = (array) $dtt_objs; |
|
193 | + foreach ($dtt_objs as $dtt_obj) { |
|
194 | + if ($dtt_obj instanceof EE_Datetime) { |
|
195 | + $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
196 | + } |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | + } |
|
201 | + |
|
202 | + // if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
|
203 | + $event = $this->_data['data']; |
|
204 | + if ($event instanceof EE_Event) { |
|
205 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
206 | + ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
207 | + |
|
208 | + // data will be datetimes for this event for this recipient |
|
209 | + foreach ($registrations_on_attendee as $reg) { |
|
210 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
211 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
212 | + $data->registrations[ $reg->ID() ] |
|
213 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
214 | + ) ]['tkt_obj'] : null; |
|
215 | + if ($ticket instanceof EE_Ticket) { |
|
216 | + $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
217 | + $data->tickets[ $ticket->ID() ] |
|
218 | + ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
219 | + ) ]['dtt_objs'] : array(); |
|
220 | + $dtt_objs = (array) $dtt_objs; |
|
221 | + foreach ($dtt_objs as $dtt_obj) { |
|
222 | + if ($dtt_obj instanceof EE_Datetime) { |
|
223 | + $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
224 | + } |
|
225 | + } |
|
226 | + } |
|
227 | + } |
|
228 | + } |
|
229 | + } |
|
230 | + |
|
231 | + $dtt_parsed = ''; |
|
232 | + foreach ($dtts as $datetime) { |
|
233 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
234 | + $template, |
|
235 | + $datetime, |
|
236 | + $valid_shortcodes, |
|
237 | + $this->_extra_data |
|
238 | + ); |
|
239 | + } |
|
240 | + return $dtt_parsed; |
|
241 | + } |
|
242 | 242 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | // first get registrations just for this attendee. |
81 | 81 | $att = $data->att_obj; |
82 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
82 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
|
83 | 83 | $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
84 | 84 | ? array($data->reg_obj) : $registrations_on_attendee; |
85 | 85 | $tkts = array(); |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | // tickets will be tickets for all registrations on this attendee. |
102 | 102 | foreach ($registrations_on_attendee as $reg) { |
103 | 103 | if ($reg instanceof EE_Registration) { |
104 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
105 | - $data->registrations[ $reg->ID() ] |
|
106 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
107 | - ) ]['tkt_obj'] : null; |
|
104 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
105 | + $data->registrations[$reg->ID()] |
|
106 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
107 | + )]['tkt_obj'] : null; |
|
108 | 108 | if ($ticket instanceof EE_Ticket) { |
109 | - $tkts[ $ticket->ID() ] = $ticket; |
|
109 | + $tkts[$ticket->ID()] = $ticket; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | // data will be tickets for this event for this recipient. |
124 | 124 | foreach ($registrations_on_attendee as $reg) { |
125 | 125 | if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
126 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
127 | - $data->registrations[ $reg->ID() ] |
|
128 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
129 | - ) ]['tkt_obj'] : null; |
|
126 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
127 | + $data->registrations[$reg->ID()] |
|
128 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
129 | + )]['tkt_obj'] : null; |
|
130 | 130 | if ($ticket instanceof EE_Ticket) { |
131 | - $tkts[ $ticket->ID() ] = $ticket; |
|
131 | + $tkts[$ticket->ID()] = $ticket; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | // first get registrations just for this attendee. |
172 | 172 | $att = $data->att_obj; |
173 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
173 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
|
174 | 174 | $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
175 | 175 | ? array($data->reg_obj) |
176 | 176 | : $registrations_on_attendee; |
@@ -185,14 +185,14 @@ discard block |
||
185 | 185 | // dtts will be datetimes for all registrations on this attendee |
186 | 186 | foreach ($registrations_on_attendee as $reg) { |
187 | 187 | if ($reg instanceof EE_Registration) { |
188 | - $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
189 | - $data->registrations[ $reg->ID() ] |
|
190 | - ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
191 | - ) ]['dtt_objs'] : array(); |
|
188 | + $dtt_objs = isset($data->registrations[$reg->ID()]) && is_array( |
|
189 | + $data->registrations[$reg->ID()] |
|
190 | + ) && isset($data->registrations[$reg->ID()]['dtt_objs']) ? $data->registrations[$reg->ID( |
|
191 | + )]['dtt_objs'] : array(); |
|
192 | 192 | $dtt_objs = (array) $dtt_objs; |
193 | 193 | foreach ($dtt_objs as $dtt_obj) { |
194 | 194 | if ($dtt_obj instanceof EE_Datetime) { |
195 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
195 | + $dtts[$dtt_obj->ID()] = $dtt_obj; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | } |
@@ -208,19 +208,19 @@ discard block |
||
208 | 208 | // data will be datetimes for this event for this recipient |
209 | 209 | foreach ($registrations_on_attendee as $reg) { |
210 | 210 | if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
211 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
212 | - $data->registrations[ $reg->ID() ] |
|
213 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
214 | - ) ]['tkt_obj'] : null; |
|
211 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
212 | + $data->registrations[$reg->ID()] |
|
213 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
214 | + )]['tkt_obj'] : null; |
|
215 | 215 | if ($ticket instanceof EE_Ticket) { |
216 | - $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
217 | - $data->tickets[ $ticket->ID() ] |
|
218 | - ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
219 | - ) ]['dtt_objs'] : array(); |
|
216 | + $dtt_objs = isset($data->tickets[$ticket->ID()]) && is_array( |
|
217 | + $data->tickets[$ticket->ID()] |
|
218 | + ) && isset($data->tickets[$ticket->ID()]['dtt_objs']) ? $data->tickets[$ticket->ID( |
|
219 | + )]['dtt_objs'] : array(); |
|
220 | 220 | $dtt_objs = (array) $dtt_objs; |
221 | 221 | foreach ($dtt_objs as $dtt_obj) { |
222 | 222 | if ($dtt_obj instanceof EE_Datetime) { |
223 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
223 | + $dtts[$dtt_obj->ID()] = $dtt_obj; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $text .= '<span class="drk-grey-text">'; |
71 | 71 | $text .= '<span class="dashicons dashicons-calendar"></span>'; |
72 | 72 | $text .= $datetime->name(); |
73 | - $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
73 | + $text .= ' ( '.$datetime->start_date().' )'; |
|
74 | 74 | $text .= '</span></h3>'; |
75 | 75 | } |
76 | 76 | } |
@@ -23,58 +23,58 @@ |
||
23 | 23 | class DateFilterHeader extends AdminPageHeaderDecorator |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var EEM_Datetime $datetime_model |
|
28 | - */ |
|
29 | - private $datetime_model; |
|
26 | + /** |
|
27 | + * @var EEM_Datetime $datetime_model |
|
28 | + */ |
|
29 | + private $datetime_model; |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * DateFilterHeader constructor. |
|
34 | - * |
|
35 | - * @param RequestInterface $request |
|
36 | - * @param EEM_Datetime $datetime_model |
|
37 | - */ |
|
38 | - public function __construct(RequestInterface $request, EEM_Datetime $datetime_model) |
|
39 | - { |
|
40 | - parent::__construct($request); |
|
41 | - $this->datetime_model = $datetime_model; |
|
42 | - } |
|
32 | + /** |
|
33 | + * DateFilterHeader constructor. |
|
34 | + * |
|
35 | + * @param RequestInterface $request |
|
36 | + * @param EEM_Datetime $datetime_model |
|
37 | + */ |
|
38 | + public function __construct(RequestInterface $request, EEM_Datetime $datetime_model) |
|
39 | + { |
|
40 | + parent::__construct($request); |
|
41 | + $this->datetime_model = $datetime_model; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @param string $text |
|
47 | - * @return string |
|
48 | - * @throws EE_Error |
|
49 | - * @throws InvalidDataTypeException |
|
50 | - * @throws InvalidInterfaceException |
|
51 | - * @throws InvalidArgumentException |
|
52 | - * @throws ReflectionException |
|
53 | - * @since 4.10.2.p |
|
54 | - */ |
|
55 | - public function getHeaderText($text = '') |
|
56 | - { |
|
57 | - $DTT_ID = $this->request->getRequestParam('DTT_ID'); |
|
58 | - $DTT_ID = $this->request->getRequestParam('datetime_id', $DTT_ID); |
|
59 | - $DTT_ID = absint($DTT_ID); |
|
60 | - if ($DTT_ID) { |
|
61 | - $datetime = $this->datetime_model->get_one_by_ID($DTT_ID); |
|
62 | - if ($datetime instanceof EE_Datetime && $text !== '') { |
|
63 | - // remove the closing h3 heading tag if it exists |
|
64 | - $text = str_replace( |
|
65 | - '</h3>', |
|
66 | - '', |
|
67 | - $text |
|
68 | - ); |
|
69 | - $text .= ' '; |
|
70 | - $text .= '<span class="drk-grey-text">'; |
|
71 | - $text .= '<span class="dashicons dashicons-calendar"></span>'; |
|
72 | - $text .= $datetime->name(); |
|
73 | - $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
74 | - $text .= '</span></h3>'; |
|
75 | - } |
|
76 | - } |
|
45 | + /** |
|
46 | + * @param string $text |
|
47 | + * @return string |
|
48 | + * @throws EE_Error |
|
49 | + * @throws InvalidDataTypeException |
|
50 | + * @throws InvalidInterfaceException |
|
51 | + * @throws InvalidArgumentException |
|
52 | + * @throws ReflectionException |
|
53 | + * @since 4.10.2.p |
|
54 | + */ |
|
55 | + public function getHeaderText($text = '') |
|
56 | + { |
|
57 | + $DTT_ID = $this->request->getRequestParam('DTT_ID'); |
|
58 | + $DTT_ID = $this->request->getRequestParam('datetime_id', $DTT_ID); |
|
59 | + $DTT_ID = absint($DTT_ID); |
|
60 | + if ($DTT_ID) { |
|
61 | + $datetime = $this->datetime_model->get_one_by_ID($DTT_ID); |
|
62 | + if ($datetime instanceof EE_Datetime && $text !== '') { |
|
63 | + // remove the closing h3 heading tag if it exists |
|
64 | + $text = str_replace( |
|
65 | + '</h3>', |
|
66 | + '', |
|
67 | + $text |
|
68 | + ); |
|
69 | + $text .= ' '; |
|
70 | + $text .= '<span class="drk-grey-text">'; |
|
71 | + $text .= '<span class="dashicons dashicons-calendar"></span>'; |
|
72 | + $text .= $datetime->name(); |
|
73 | + $text .= ' ( ' . $datetime->start_date() . ' )'; |
|
74 | + $text .= '</span></h3>'; |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - return $text; |
|
79 | - } |
|
78 | + return $text; |
|
79 | + } |
|
80 | 80 | } |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | if ($TKT_ID) { |
61 | 61 | $ticket = $this->ticket_model->get_one_by_ID($TKT_ID); |
62 | 62 | if ($ticket instanceof EE_Ticket) { |
63 | - $ticket_details = '<span class="ee-ticket-name">' . $ticket->name() . '</span> '; |
|
63 | + $ticket_details = '<span class="ee-ticket-name">'.$ticket->name().'</span> '; |
|
64 | 64 | $ticket_details .= ! $ticket->is_free() |
65 | - ? '<span class="ee-ticket-price">' . $ticket->pretty_price() . '</span>' |
|
65 | + ? '<span class="ee-ticket-price">'.$ticket->pretty_price().'</span>' |
|
66 | 66 | : '<span class="reg-overview-free-event-spn">' |
67 | 67 | . __('free', 'event_espresso') |
68 | 68 | . '</span>'; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $text .= ' '; |
81 | 81 | $text .= '<span class="drk-grey-text" style="font-size:.9em;">'; |
82 | 82 | $text .= '<span class="dashicons dashicons-tickets-alt"></span>'; |
83 | - $text .= $ticket_details . '</span></h3>'; |
|
83 | + $text .= $ticket_details.'</span></h3>'; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | return $text; |
@@ -23,65 +23,65 @@ |
||
23 | 23 | class TicketFilterHeader extends AdminPageHeaderDecorator |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var EEM_Ticket $ticket_model |
|
28 | - */ |
|
29 | - private $ticket_model; |
|
26 | + /** |
|
27 | + * @var EEM_Ticket $ticket_model |
|
28 | + */ |
|
29 | + private $ticket_model; |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * TicketFilterHeader constructor. |
|
34 | - * |
|
35 | - * @param RequestInterface $request |
|
36 | - * @param EEM_Ticket $ticket_model |
|
37 | - */ |
|
38 | - public function __construct(RequestInterface $request, EEM_Ticket $ticket_model) |
|
39 | - { |
|
40 | - parent::__construct($request); |
|
41 | - $this->ticket_model = $ticket_model; |
|
42 | - } |
|
32 | + /** |
|
33 | + * TicketFilterHeader constructor. |
|
34 | + * |
|
35 | + * @param RequestInterface $request |
|
36 | + * @param EEM_Ticket $ticket_model |
|
37 | + */ |
|
38 | + public function __construct(RequestInterface $request, EEM_Ticket $ticket_model) |
|
39 | + { |
|
40 | + parent::__construct($request); |
|
41 | + $this->ticket_model = $ticket_model; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @param string $text |
|
47 | - * @return string |
|
48 | - * @throws EE_Error |
|
49 | - * @throws InvalidDataTypeException |
|
50 | - * @throws InvalidInterfaceException |
|
51 | - * @throws InvalidArgumentException |
|
52 | - * @throws ReflectionException |
|
53 | - * @since 4.10.2.p |
|
54 | - */ |
|
55 | - public function getHeaderText($text = '') |
|
56 | - { |
|
57 | - $TKT_ID = $this->request->getRequestParam('TKT_ID'); |
|
58 | - $TKT_ID = $this->request->getRequestParam('ticket_id', $TKT_ID); |
|
59 | - $TKT_ID = absint($TKT_ID); |
|
60 | - if ($TKT_ID) { |
|
61 | - $ticket = $this->ticket_model->get_one_by_ID($TKT_ID); |
|
62 | - if ($ticket instanceof EE_Ticket) { |
|
63 | - $ticket_details = '<span class="ee-ticket-name">' . $ticket->name() . '</span> '; |
|
64 | - $ticket_details .= ! $ticket->is_free() |
|
65 | - ? '<span class="ee-ticket-price">' . $ticket->pretty_price() . '</span>' |
|
66 | - : '<span class="reg-overview-free-event-spn">' |
|
67 | - . __('free', 'event_espresso') |
|
68 | - . '</span>'; |
|
69 | - // remove the closing h3 heading tag if it exists |
|
70 | - $text = str_replace( |
|
71 | - '</h3>', |
|
72 | - '', |
|
73 | - $text |
|
74 | - ); |
|
75 | - if (empty($text)) { |
|
76 | - $text = '<h3 style="line-height:1.5em;">'; |
|
77 | - $text .= esc_html__('Viewing registrations for ticket:', 'event_espresso'); |
|
78 | - } |
|
79 | - $text .= ' '; |
|
80 | - $text .= '<span class="drk-grey-text" style="font-size:.9em;">'; |
|
81 | - $text .= '<span class="dashicons dashicons-tickets-alt"></span>'; |
|
82 | - $text .= $ticket_details . '</span></h3>'; |
|
83 | - } |
|
84 | - } |
|
85 | - return $text; |
|
86 | - } |
|
45 | + /** |
|
46 | + * @param string $text |
|
47 | + * @return string |
|
48 | + * @throws EE_Error |
|
49 | + * @throws InvalidDataTypeException |
|
50 | + * @throws InvalidInterfaceException |
|
51 | + * @throws InvalidArgumentException |
|
52 | + * @throws ReflectionException |
|
53 | + * @since 4.10.2.p |
|
54 | + */ |
|
55 | + public function getHeaderText($text = '') |
|
56 | + { |
|
57 | + $TKT_ID = $this->request->getRequestParam('TKT_ID'); |
|
58 | + $TKT_ID = $this->request->getRequestParam('ticket_id', $TKT_ID); |
|
59 | + $TKT_ID = absint($TKT_ID); |
|
60 | + if ($TKT_ID) { |
|
61 | + $ticket = $this->ticket_model->get_one_by_ID($TKT_ID); |
|
62 | + if ($ticket instanceof EE_Ticket) { |
|
63 | + $ticket_details = '<span class="ee-ticket-name">' . $ticket->name() . '</span> '; |
|
64 | + $ticket_details .= ! $ticket->is_free() |
|
65 | + ? '<span class="ee-ticket-price">' . $ticket->pretty_price() . '</span>' |
|
66 | + : '<span class="reg-overview-free-event-spn">' |
|
67 | + . __('free', 'event_espresso') |
|
68 | + . '</span>'; |
|
69 | + // remove the closing h3 heading tag if it exists |
|
70 | + $text = str_replace( |
|
71 | + '</h3>', |
|
72 | + '', |
|
73 | + $text |
|
74 | + ); |
|
75 | + if (empty($text)) { |
|
76 | + $text = '<h3 style="line-height:1.5em;">'; |
|
77 | + $text .= esc_html__('Viewing registrations for ticket:', 'event_espresso'); |
|
78 | + } |
|
79 | + $text .= ' '; |
|
80 | + $text .= '<span class="drk-grey-text" style="font-size:.9em;">'; |
|
81 | + $text .= '<span class="dashicons dashicons-tickets-alt"></span>'; |
|
82 | + $text .= $ticket_details . '</span></h3>'; |
|
83 | + } |
|
84 | + } |
|
85 | + return $text; |
|
86 | + } |
|
87 | 87 | } |
@@ -59,13 +59,13 @@ |
||
59 | 59 | 'event_espresso' |
60 | 60 | ), |
61 | 61 | '<h3 style="line-height:1.5em;">', |
62 | - '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
62 | + '<a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
63 | 63 | array( |
64 | 64 | 'action' => 'edit_attendee', |
65 | 65 | 'post' => $ATT_ID, |
66 | 66 | ), |
67 | 67 | REG_ADMIN_URL |
68 | - ) . '">' . $attendee->full_name() . '</a>', |
|
68 | + ).'">'.$attendee->full_name().'</a>', |
|
69 | 69 | '</h3>' |
70 | 70 | ); |
71 | 71 | } |
@@ -20,56 +20,56 @@ |
||
20 | 20 | class AttendeeFilterHeader extends AdminPageHeaderDecorator |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var EEM_Attendee $attendee_model |
|
25 | - */ |
|
26 | - private $attendee_model; |
|
23 | + /** |
|
24 | + * @var EEM_Attendee $attendee_model |
|
25 | + */ |
|
26 | + private $attendee_model; |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * AttendeeFilterHeader constructor. |
|
31 | - * |
|
32 | - * @param RequestInterface $request |
|
33 | - * @param EEM_Attendee $attendee_model |
|
34 | - */ |
|
35 | - public function __construct(RequestInterface $request, EEM_Attendee $attendee_model) |
|
36 | - { |
|
37 | - parent::__construct($request); |
|
38 | - $this->attendee_model = $attendee_model; |
|
39 | - } |
|
29 | + /** |
|
30 | + * AttendeeFilterHeader constructor. |
|
31 | + * |
|
32 | + * @param RequestInterface $request |
|
33 | + * @param EEM_Attendee $attendee_model |
|
34 | + */ |
|
35 | + public function __construct(RequestInterface $request, EEM_Attendee $attendee_model) |
|
36 | + { |
|
37 | + parent::__construct($request); |
|
38 | + $this->attendee_model = $attendee_model; |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | - /** |
|
43 | - * @param string $text |
|
44 | - * @return string |
|
45 | - * @throws EE_Error |
|
46 | - * @since 4.10.2.p |
|
47 | - */ |
|
48 | - public function getHeaderText($text = '') |
|
49 | - { |
|
50 | - $ATT_ID = $this->request->getRequestParam('ATT_ID'); |
|
51 | - $ATT_ID = $this->request->getRequestParam('attendee_id', $ATT_ID); |
|
52 | - $ATT_ID = absint($ATT_ID); |
|
53 | - if ($ATT_ID) { |
|
54 | - $attendee = $this->attendee_model->get_one_by_ID($ATT_ID); |
|
55 | - if ($attendee instanceof EE_Attendee) { |
|
56 | - $text .= sprintf( |
|
57 | - esc_html__( |
|
58 | - '%1$s Viewing registrations for %2$s%3$s', |
|
59 | - 'event_espresso' |
|
60 | - ), |
|
61 | - '<h3 style="line-height:1.5em;">', |
|
62 | - '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
63 | - array( |
|
64 | - 'action' => 'edit_attendee', |
|
65 | - 'post' => $ATT_ID, |
|
66 | - ), |
|
67 | - REG_ADMIN_URL |
|
68 | - ) . '">' . $attendee->full_name() . '</a>', |
|
69 | - '</h3>' |
|
70 | - ); |
|
71 | - } |
|
72 | - } |
|
73 | - return $text; |
|
74 | - } |
|
42 | + /** |
|
43 | + * @param string $text |
|
44 | + * @return string |
|
45 | + * @throws EE_Error |
|
46 | + * @since 4.10.2.p |
|
47 | + */ |
|
48 | + public function getHeaderText($text = '') |
|
49 | + { |
|
50 | + $ATT_ID = $this->request->getRequestParam('ATT_ID'); |
|
51 | + $ATT_ID = $this->request->getRequestParam('attendee_id', $ATT_ID); |
|
52 | + $ATT_ID = absint($ATT_ID); |
|
53 | + if ($ATT_ID) { |
|
54 | + $attendee = $this->attendee_model->get_one_by_ID($ATT_ID); |
|
55 | + if ($attendee instanceof EE_Attendee) { |
|
56 | + $text .= sprintf( |
|
57 | + esc_html__( |
|
58 | + '%1$s Viewing registrations for %2$s%3$s', |
|
59 | + 'event_espresso' |
|
60 | + ), |
|
61 | + '<h3 style="line-height:1.5em;">', |
|
62 | + '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
63 | + array( |
|
64 | + 'action' => 'edit_attendee', |
|
65 | + 'post' => $ATT_ID, |
|
66 | + ), |
|
67 | + REG_ADMIN_URL |
|
68 | + ) . '">' . $attendee->full_name() . '</a>', |
|
69 | + '</h3>' |
|
70 | + ); |
|
71 | + } |
|
72 | + } |
|
73 | + return $text; |
|
74 | + } |
|
75 | 75 | } |
@@ -46,40 +46,40 @@ discard block |
||
46 | 46 | ? (string) $input->html_id() |
47 | 47 | : spl_object_hash($input); |
48 | 48 | // and add a generic input type class |
49 | - $html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv'; |
|
49 | + $html_class = sanitize_key(str_replace('_', '-', get_class($input))).'-dv'; |
|
50 | 50 | if ($input instanceof EE_Hidden_Input) { |
51 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
51 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
52 | 52 | } elseif ($input instanceof EE_Submit_Input) { |
53 | 53 | $html .= EEH_HTML::div( |
54 | 54 | $input->get_html_for_input(), |
55 | - $html_id . '-submit-dv', |
|
55 | + $html_id.'-submit-dv', |
|
56 | 56 | "{$input->html_class()}-submit-dv {$html_class}" |
57 | 57 | ); |
58 | 58 | } elseif ($input instanceof EE_Select_Input) { |
59 | 59 | $html .= EEH_HTML::div( |
60 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
61 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
62 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
63 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
64 | - $html_id . '-input-dv', |
|
60 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
61 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
62 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
63 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
64 | + $html_id.'-input-dv', |
|
65 | 65 | "{$input->html_class()}-input-dv {$html_class}" |
66 | 66 | ); |
67 | 67 | } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
68 | 68 | $html .= EEH_HTML::div( |
69 | - EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) . |
|
70 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
71 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
72 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
73 | - $html_id . '-input-dv', |
|
69 | + EEH_HTML::nl().$this->_display_label_for_option_type_question($input). |
|
70 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
71 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
72 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
73 | + $html_id.'-input-dv', |
|
74 | 74 | "{$input->html_class()}-input-dv {$html_class}" |
75 | 75 | ); |
76 | 76 | } else { |
77 | 77 | $html .= EEH_HTML::div( |
78 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
79 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
80 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
81 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
82 | - $html_id . '-input-dv', |
|
78 | + EEH_HTML::nl(1).$input->get_html_for_label(). |
|
79 | + EEH_HTML::nl().$input->get_html_for_errors(). |
|
80 | + EEH_HTML::nl().$input->get_html_for_input(). |
|
81 | + EEH_HTML::nl().$input->get_html_for_help(), |
|
82 | + $html_id.'-input-dv', |
|
83 | 83 | "{$input->html_class()}-input-dv {$html_class}" |
84 | 84 | ); |
85 | 85 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | $html_label_text = $input->html_label_text(); |
104 | 104 | $label_html = EEH_HTML::div( |
105 | 105 | $input->required() |
106 | - ? $html_label_text . EEH_HTML::span('*', '', 'ee-asterisk') |
|
106 | + ? $html_label_text.EEH_HTML::span('*', '', 'ee-asterisk') |
|
107 | 107 | : $html_label_text, |
108 | 108 | $input->html_label_id(), |
109 | 109 | $input->required() |
110 | - ? 'ee-required-label ' . $input->html_label_class() |
|
110 | + ? 'ee-required-label '.$input->html_label_class() |
|
111 | 111 | : $input->html_label_class(), |
112 | 112 | $input->html_label_style(), |
113 | 113 | $input->other_html_attributes() |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function layout_subsection($form_section) |
134 | 134 | { |
135 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
135 | + return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 |
@@ -12,136 +12,136 @@ |
||
12 | 12 | class EE_Div_Per_Section_Layout extends EE_Form_Section_Layout_Base |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * opening div tag for a form |
|
17 | - * |
|
18 | - * @return string |
|
19 | - */ |
|
20 | - public function layout_form_begin() |
|
21 | - { |
|
22 | - return EEH_HTML::div( |
|
23 | - '', |
|
24 | - $this->_form_section->html_id(), |
|
25 | - $this->_form_section->html_class(), |
|
26 | - $this->_form_section->html_style() |
|
27 | - ); |
|
28 | - } |
|
15 | + /** |
|
16 | + * opening div tag for a form |
|
17 | + * |
|
18 | + * @return string |
|
19 | + */ |
|
20 | + public function layout_form_begin() |
|
21 | + { |
|
22 | + return EEH_HTML::div( |
|
23 | + '', |
|
24 | + $this->_form_section->html_id(), |
|
25 | + $this->_form_section->html_class(), |
|
26 | + $this->_form_section->html_style() |
|
27 | + ); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * Lays out the row for the input, including label and errors |
|
34 | - * |
|
35 | - * @param EE_Form_Input_Base $input |
|
36 | - * @return string |
|
37 | - * @throws \EE_Error |
|
38 | - */ |
|
39 | - public function layout_input($input) |
|
40 | - { |
|
41 | - $html = ''; |
|
42 | - // set something unique for the id |
|
43 | - $html_id = (string) $input->html_id() !== '' |
|
44 | - ? (string) $input->html_id() |
|
45 | - : spl_object_hash($input); |
|
46 | - // and add a generic input type class |
|
47 | - $html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv'; |
|
48 | - if ($input instanceof EE_Hidden_Input) { |
|
49 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
50 | - } elseif ($input instanceof EE_Submit_Input) { |
|
51 | - $html .= EEH_HTML::div( |
|
52 | - $input->get_html_for_input(), |
|
53 | - $html_id . '-submit-dv', |
|
54 | - "{$input->html_class()}-submit-dv {$html_class}" |
|
55 | - ); |
|
56 | - } elseif ($input instanceof EE_Select_Input) { |
|
57 | - $html .= EEH_HTML::div( |
|
58 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
59 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
60 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
61 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
62 | - $html_id . '-input-dv', |
|
63 | - "{$input->html_class()}-input-dv {$html_class}" |
|
64 | - ); |
|
65 | - } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
|
66 | - $html .= EEH_HTML::div( |
|
67 | - EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) . |
|
68 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
69 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
70 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
71 | - $html_id . '-input-dv', |
|
72 | - "{$input->html_class()}-input-dv {$html_class}" |
|
73 | - ); |
|
74 | - } else { |
|
75 | - $html .= EEH_HTML::div( |
|
76 | - EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
77 | - EEH_HTML::nl() . $input->get_html_for_errors() . |
|
78 | - EEH_HTML::nl() . $input->get_html_for_input() . |
|
79 | - EEH_HTML::nl() . $input->get_html_for_help(), |
|
80 | - $html_id . '-input-dv', |
|
81 | - "{$input->html_class()}-input-dv {$html_class}" |
|
82 | - ); |
|
83 | - } |
|
84 | - return $html; |
|
85 | - } |
|
32 | + /** |
|
33 | + * Lays out the row for the input, including label and errors |
|
34 | + * |
|
35 | + * @param EE_Form_Input_Base $input |
|
36 | + * @return string |
|
37 | + * @throws \EE_Error |
|
38 | + */ |
|
39 | + public function layout_input($input) |
|
40 | + { |
|
41 | + $html = ''; |
|
42 | + // set something unique for the id |
|
43 | + $html_id = (string) $input->html_id() !== '' |
|
44 | + ? (string) $input->html_id() |
|
45 | + : spl_object_hash($input); |
|
46 | + // and add a generic input type class |
|
47 | + $html_class = sanitize_key(str_replace('_', '-', get_class($input))) . '-dv'; |
|
48 | + if ($input instanceof EE_Hidden_Input) { |
|
49 | + $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
50 | + } elseif ($input instanceof EE_Submit_Input) { |
|
51 | + $html .= EEH_HTML::div( |
|
52 | + $input->get_html_for_input(), |
|
53 | + $html_id . '-submit-dv', |
|
54 | + "{$input->html_class()}-submit-dv {$html_class}" |
|
55 | + ); |
|
56 | + } elseif ($input instanceof EE_Select_Input) { |
|
57 | + $html .= EEH_HTML::div( |
|
58 | + EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
59 | + EEH_HTML::nl() . $input->get_html_for_errors() . |
|
60 | + EEH_HTML::nl() . $input->get_html_for_input() . |
|
61 | + EEH_HTML::nl() . $input->get_html_for_help(), |
|
62 | + $html_id . '-input-dv', |
|
63 | + "{$input->html_class()}-input-dv {$html_class}" |
|
64 | + ); |
|
65 | + } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
|
66 | + $html .= EEH_HTML::div( |
|
67 | + EEH_HTML::nl() . $this->_display_label_for_option_type_question($input) . |
|
68 | + EEH_HTML::nl() . $input->get_html_for_errors() . |
|
69 | + EEH_HTML::nl() . $input->get_html_for_input() . |
|
70 | + EEH_HTML::nl() . $input->get_html_for_help(), |
|
71 | + $html_id . '-input-dv', |
|
72 | + "{$input->html_class()}-input-dv {$html_class}" |
|
73 | + ); |
|
74 | + } else { |
|
75 | + $html .= EEH_HTML::div( |
|
76 | + EEH_HTML::nl(1) . $input->get_html_for_label() . |
|
77 | + EEH_HTML::nl() . $input->get_html_for_errors() . |
|
78 | + EEH_HTML::nl() . $input->get_html_for_input() . |
|
79 | + EEH_HTML::nl() . $input->get_html_for_help(), |
|
80 | + $html_id . '-input-dv', |
|
81 | + "{$input->html_class()}-input-dv {$html_class}" |
|
82 | + ); |
|
83 | + } |
|
84 | + return $html; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | 88 | |
89 | - /** |
|
90 | - * |
|
91 | - * _display_label_for_option_type_question |
|
92 | - * Gets the HTML for the 'label', which is just text for this (because labels |
|
93 | - * should be for each input) |
|
94 | - * |
|
95 | - * @param EE_Form_Input_With_Options_Base $input |
|
96 | - * @return string |
|
97 | - */ |
|
98 | - protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) |
|
99 | - { |
|
100 | - if ($input->display_html_label_text()) { |
|
101 | - $html_label_text = $input->html_label_text(); |
|
102 | - $label_html = EEH_HTML::div( |
|
103 | - $input->required() |
|
104 | - ? $html_label_text . EEH_HTML::span('*', '', 'ee-asterisk') |
|
105 | - : $html_label_text, |
|
106 | - $input->html_label_id(), |
|
107 | - $input->required() |
|
108 | - ? 'ee-required-label ' . $input->html_label_class() |
|
109 | - : $input->html_label_class(), |
|
110 | - $input->html_label_style(), |
|
111 | - $input->other_html_attributes() |
|
112 | - ); |
|
113 | - // if no content was provided to EEH_HTML::div() above (ie: an empty label), |
|
114 | - // then we need to close the div manually |
|
115 | - if (empty($html_label_text)) { |
|
116 | - $label_html .= EEH_HTML::divx($input->html_label_id(), $input->html_label_class()); |
|
117 | - } |
|
118 | - return $label_html; |
|
119 | - } |
|
120 | - return ''; |
|
121 | - } |
|
89 | + /** |
|
90 | + * |
|
91 | + * _display_label_for_option_type_question |
|
92 | + * Gets the HTML for the 'label', which is just text for this (because labels |
|
93 | + * should be for each input) |
|
94 | + * |
|
95 | + * @param EE_Form_Input_With_Options_Base $input |
|
96 | + * @return string |
|
97 | + */ |
|
98 | + protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) |
|
99 | + { |
|
100 | + if ($input->display_html_label_text()) { |
|
101 | + $html_label_text = $input->html_label_text(); |
|
102 | + $label_html = EEH_HTML::div( |
|
103 | + $input->required() |
|
104 | + ? $html_label_text . EEH_HTML::span('*', '', 'ee-asterisk') |
|
105 | + : $html_label_text, |
|
106 | + $input->html_label_id(), |
|
107 | + $input->required() |
|
108 | + ? 'ee-required-label ' . $input->html_label_class() |
|
109 | + : $input->html_label_class(), |
|
110 | + $input->html_label_style(), |
|
111 | + $input->other_html_attributes() |
|
112 | + ); |
|
113 | + // if no content was provided to EEH_HTML::div() above (ie: an empty label), |
|
114 | + // then we need to close the div manually |
|
115 | + if (empty($html_label_text)) { |
|
116 | + $label_html .= EEH_HTML::divx($input->html_label_id(), $input->html_label_class()); |
|
117 | + } |
|
118 | + return $label_html; |
|
119 | + } |
|
120 | + return ''; |
|
121 | + } |
|
122 | 122 | |
123 | 123 | |
124 | 124 | |
125 | - /** |
|
126 | - * Lays out a row for the subsection |
|
127 | - * |
|
128 | - * @param EE_Form_Section_Proper $form_section |
|
129 | - * @return string |
|
130 | - */ |
|
131 | - public function layout_subsection($form_section) |
|
132 | - { |
|
133 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
134 | - } |
|
125 | + /** |
|
126 | + * Lays out a row for the subsection |
|
127 | + * |
|
128 | + * @param EE_Form_Section_Proper $form_section |
|
129 | + * @return string |
|
130 | + */ |
|
131 | + public function layout_subsection($form_section) |
|
132 | + { |
|
133 | + return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
134 | + } |
|
135 | 135 | |
136 | 136 | |
137 | 137 | |
138 | - /** |
|
139 | - * closing div tag for a form |
|
140 | - * |
|
141 | - * @return string |
|
142 | - */ |
|
143 | - public function layout_form_end() |
|
144 | - { |
|
145 | - return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class()); |
|
146 | - } |
|
138 | + /** |
|
139 | + * closing div tag for a form |
|
140 | + * |
|
141 | + * @return string |
|
142 | + */ |
|
143 | + public function layout_form_end() |
|
144 | + { |
|
145 | + return EEH_HTML::divx($this->_form_section->html_id(), $this->_form_section->html_class()); |
|
146 | + } |
|
147 | 147 | } |
@@ -19,20 +19,20 @@ discard block |
||
19 | 19 | { |
20 | 20 | wp_register_style( |
21 | 21 | 'checkbox_dropdown_selector', |
22 | - EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css', |
|
22 | + EE_GLOBAL_ASSETS_URL.'css/checkbox_dropdown_selector.css', |
|
23 | 23 | array('espresso_default'), |
24 | 24 | EVENT_ESPRESSO_VERSION |
25 | 25 | ); |
26 | 26 | wp_register_style( |
27 | 27 | 'espresso_default', |
28 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
28 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', |
|
29 | 29 | array('dashicons'), |
30 | 30 | EVENT_ESPRESSO_VERSION |
31 | 31 | ); |
32 | 32 | wp_enqueue_style('checkbox_dropdown_selector'); |
33 | 33 | wp_register_script( |
34 | 34 | 'checkbox_dropdown_selector', |
35 | - EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js', |
|
35 | + EE_GLOBAL_ASSETS_URL.'scripts/checkbox_dropdown_selector.js', |
|
36 | 36 | array('jquery'), |
37 | 37 | EVENT_ESPRESSO_VERSION, |
38 | 38 | true |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function iframe_css(array $iframe_css) |
73 | 73 | { |
74 | - $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css'; |
|
74 | + $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL.'css/checkbox_dropdown_selector.css'; |
|
75 | 75 | return $iframe_css; |
76 | 76 | } |
77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function iframe_js(array $iframe_js) |
87 | 87 | { |
88 | - $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js'; |
|
88 | + $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL.'scripts/checkbox_dropdown_selector.js'; |
|
89 | 89 | return $iframe_js; |
90 | 90 | } |
91 | 91 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
102 | 102 | $input->set_label_sizes(); |
103 | 103 | $label_size_class = $input->get_label_size_class(); |
104 | - if (! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
104 | + if ( ! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
105 | 105 | EE_Error::doing_it_wrong( |
106 | 106 | 'EE_Checkbox_Display_Strategy::display()', |
107 | 107 | sprintf( |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | ), |
112 | 112 | $input->html_id(), |
113 | 113 | var_export($input->raw_value(), true), |
114 | - $input->html_name() . '[]' |
|
114 | + $input->html_name().'[]' |
|
115 | 115 | ), |
116 | 116 | '4.8.1' |
117 | 117 | ); |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | |
120 | 120 | |
121 | 121 | $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv'); |
122 | - $html .= '<button id="' . $input->html_id() . '-btn"'; |
|
122 | + $html .= '<button id="'.$input->html_id().'-btn"'; |
|
123 | 123 | // $html .= ' name="' . $input->html_name() . '"'; |
124 | - $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"'; |
|
125 | - $html .= ' style="' . $input->html_style() . '"'; |
|
126 | - $html .= ' data-target="' . $input->html_id() . '-options-dv"'; |
|
127 | - $html .= ' ' . $input->other_html_attributes() . '>'; |
|
124 | + $html .= ' class="'.$input->html_class().' checkbox-dropdown-selector-btn button-secondary button"'; |
|
125 | + $html .= ' style="'.$input->html_style().'"'; |
|
126 | + $html .= ' data-target="'.$input->html_id().'-options-dv"'; |
|
127 | + $html .= ' '.$input->other_html_attributes().'>'; |
|
128 | 128 | $html .= '<span class="checkbox-dropdown-selector-selected-spn">'; |
129 | 129 | $html .= $select_button_text; |
130 | 130 | $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>'; |
131 | 131 | $html .= '</button>'; |
132 | 132 | $html .= EEH_HTML::div( |
133 | 133 | '', |
134 | - $input->html_id() . '-options-dv', |
|
134 | + $input->html_id().'-options-dv', |
|
135 | 135 | 'checkbox-dropdown-selector' |
136 | 136 | ); |
137 | 137 | $html .= EEH_HTML::link( |
@@ -157,18 +157,18 @@ discard block |
||
157 | 157 | . '">'; |
158 | 158 | $html .= EEH_HTML::nl(1, 'checkbox'); |
159 | 159 | $html .= '<input type="checkbox"'; |
160 | - $html .= ' name="' . $input->html_name() . '[]"'; |
|
161 | - $html .= ' id="' . $html_id . '"'; |
|
162 | - $html .= ' class="' . $input->html_class() . '-option"'; |
|
163 | - $html .= $input->html_style() ? ' style="' . $input->html_style() . '"' : ''; |
|
164 | - $html .= ' value="' . esc_attr($value) . '"'; |
|
160 | + $html .= ' name="'.$input->html_name().'[]"'; |
|
161 | + $html .= ' id="'.$html_id.'"'; |
|
162 | + $html .= ' class="'.$input->html_class().'-option"'; |
|
163 | + $html .= $input->html_style() ? ' style="'.$input->html_style().'"' : ''; |
|
164 | + $html .= ' value="'.esc_attr($value).'"'; |
|
165 | 165 | $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true) |
166 | 166 | ? ' checked="checked"' |
167 | 167 | : ''; |
168 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
168 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
169 | 169 | $html .= '>'; |
170 | - $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>'; |
|
171 | - $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>'; |
|
170 | + $html .= '<span class="datetime-selector-option-text-spn">'.$display_text.'</span>'; |
|
171 | + $html .= EEH_HTML::nl(-1, 'checkbox').'</label>'; |
|
172 | 172 | $html .= EEH_HTML::lix(); |
173 | 173 | } |
174 | 174 | $html .= EEH_HTML::ulx(); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | 'event_espresso' |
183 | 183 | ) |
184 | 184 | ), |
185 | - $input->html_id() . '-date-time-filter-notice-pg', |
|
185 | + $input->html_id().'-date-time-filter-notice-pg', |
|
186 | 186 | 'date-time-filter-notice-pg small-text lt-grey-text' |
187 | 187 | ); |
188 | 188 | $html .= \EEH_HTML::br(); |
@@ -13,180 +13,180 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * enqueues css and js, so that this can be called statically |
|
18 | - */ |
|
19 | - public static function enqueue_styles_and_scripts() |
|
20 | - { |
|
21 | - wp_register_style( |
|
22 | - 'checkbox_dropdown_selector', |
|
23 | - EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css', |
|
24 | - array('espresso_default'), |
|
25 | - EVENT_ESPRESSO_VERSION |
|
26 | - ); |
|
27 | - wp_register_style( |
|
28 | - 'espresso_default', |
|
29 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
30 | - array('dashicons'), |
|
31 | - EVENT_ESPRESSO_VERSION |
|
32 | - ); |
|
33 | - wp_enqueue_style('checkbox_dropdown_selector'); |
|
34 | - wp_register_script( |
|
35 | - 'checkbox_dropdown_selector', |
|
36 | - EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js', |
|
37 | - array('jquery'), |
|
38 | - EVENT_ESPRESSO_VERSION, |
|
39 | - true |
|
40 | - ); |
|
41 | - wp_localize_script( |
|
42 | - 'ticket_selector', |
|
43 | - 'eeDTS', |
|
44 | - array( |
|
45 | - 'maxChecked' => EE_Registry::instance() |
|
46 | - ->CFG |
|
47 | - ->template_settings |
|
48 | - ->EED_Ticket_Selector |
|
49 | - ->getDatetimeSelectorMaxChecked() |
|
50 | - ) |
|
51 | - ); |
|
52 | - wp_enqueue_script('checkbox_dropdown_selector'); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
59 | - */ |
|
60 | - public function enqueue_js() |
|
61 | - { |
|
62 | - EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * callback for Iframe::addStylesheets() child class methods |
|
69 | - * |
|
70 | - * @param array $iframe_css |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - public function iframe_css(array $iframe_css) |
|
74 | - { |
|
75 | - $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css'; |
|
76 | - return $iframe_css; |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * callback for Iframe::addScripts() child class methods |
|
83 | - * |
|
84 | - * @param array $iframe_js |
|
85 | - * @return array |
|
86 | - */ |
|
87 | - public function iframe_js(array $iframe_js) |
|
88 | - { |
|
89 | - $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js'; |
|
90 | - return $iframe_js; |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * @throws EE_Error |
|
96 | - * @return string of html to display the field |
|
97 | - */ |
|
98 | - public function display() |
|
99 | - { |
|
100 | - $input = $this->get_input(); |
|
101 | - $select_button_text = $input instanceof EE_Checkbox_Dropdown_Selector_Input ? $input->select_button_text() : ''; |
|
102 | - // $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
|
103 | - $input->set_label_sizes(); |
|
104 | - $label_size_class = $input->get_label_size_class(); |
|
105 | - if (! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
106 | - EE_Error::doing_it_wrong( |
|
107 | - 'EE_Checkbox_Display_Strategy::display()', |
|
108 | - sprintf( |
|
109 | - esc_html__( |
|
110 | - 'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', |
|
111 | - 'event_espresso' |
|
112 | - ), |
|
113 | - $input->html_id(), |
|
114 | - var_export($input->raw_value(), true), |
|
115 | - $input->html_name() . '[]' |
|
116 | - ), |
|
117 | - '4.8.1' |
|
118 | - ); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv'); |
|
123 | - $html .= '<button id="' . $input->html_id() . '-btn"'; |
|
124 | - // $html .= ' name="' . $input->html_name() . '"'; |
|
125 | - $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"'; |
|
126 | - $html .= ' style="' . $input->html_style() . '"'; |
|
127 | - $html .= ' data-target="' . $input->html_id() . '-options-dv"'; |
|
128 | - $html .= ' ' . $input->other_html_attributes() . '>'; |
|
129 | - $html .= '<span class="checkbox-dropdown-selector-selected-spn">'; |
|
130 | - $html .= $select_button_text; |
|
131 | - $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>'; |
|
132 | - $html .= '</button>'; |
|
133 | - $html .= EEH_HTML::div( |
|
134 | - '', |
|
135 | - $input->html_id() . '-options-dv', |
|
136 | - 'checkbox-dropdown-selector' |
|
137 | - ); |
|
138 | - $html .= EEH_HTML::link( |
|
139 | - '', |
|
140 | - '<span class="dashicons dashicons-no"></span>', |
|
141 | - esc_html__('close datetime selector', 'event_espresso'), |
|
142 | - '', |
|
143 | - 'close-espresso-notice' |
|
144 | - ); |
|
145 | - $html .= EEH_HTML::ul(); |
|
146 | - $input_raw_value = (array) $input->raw_value(); |
|
147 | - foreach ($input->options() as $value => $display_text) { |
|
148 | - $html .= EEH_HTML::li(); |
|
149 | - $value = $input->get_normalization_strategy()->unnormalize_one($value); |
|
150 | - $html_id = $this->get_sub_input_id($value); |
|
151 | - $html .= EEH_HTML::nl(0, 'checkbox'); |
|
152 | - $html .= '<label for="' |
|
153 | - . $html_id |
|
154 | - . '" id="' |
|
155 | - . $html_id |
|
156 | - . '-lbl" class="ee-checkbox-label-after' |
|
157 | - . $label_size_class |
|
158 | - . '">'; |
|
159 | - $html .= EEH_HTML::nl(1, 'checkbox'); |
|
160 | - $html .= '<input type="checkbox"'; |
|
161 | - $html .= ' name="' . $input->html_name() . '[]"'; |
|
162 | - $html .= ' id="' . $html_id . '"'; |
|
163 | - $html .= ' class="' . $input->html_class() . '-option"'; |
|
164 | - $html .= $input->html_style() ? ' style="' . $input->html_style() . '"' : ''; |
|
165 | - $html .= ' value="' . esc_attr($value) . '"'; |
|
166 | - $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true) |
|
167 | - ? ' checked="checked"' |
|
168 | - : ''; |
|
169 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
170 | - $html .= '>'; |
|
171 | - $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>'; |
|
172 | - $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>'; |
|
173 | - $html .= EEH_HTML::lix(); |
|
174 | - } |
|
175 | - $html .= EEH_HTML::ulx(); |
|
176 | - $html .= EEH_HTML::divx(); |
|
177 | - $html .= EEH_HTML::divx(); |
|
178 | - $html .= EEH_HTML::p( |
|
179 | - apply_filters( |
|
180 | - 'FHEE__EE_Checkbox_Dropdown_Selector_Display_Strategy__display__html', |
|
181 | - esc_html__( |
|
182 | - 'To view additional ticket options, click the "Filter by Date" button and select more dates.', |
|
183 | - 'event_espresso' |
|
184 | - ) |
|
185 | - ), |
|
186 | - $input->html_id() . '-date-time-filter-notice-pg', |
|
187 | - 'date-time-filter-notice-pg small-text lt-grey-text' |
|
188 | - ); |
|
189 | - $html .= \EEH_HTML::br(); |
|
190 | - return $html; |
|
191 | - } |
|
16 | + /** |
|
17 | + * enqueues css and js, so that this can be called statically |
|
18 | + */ |
|
19 | + public static function enqueue_styles_and_scripts() |
|
20 | + { |
|
21 | + wp_register_style( |
|
22 | + 'checkbox_dropdown_selector', |
|
23 | + EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css', |
|
24 | + array('espresso_default'), |
|
25 | + EVENT_ESPRESSO_VERSION |
|
26 | + ); |
|
27 | + wp_register_style( |
|
28 | + 'espresso_default', |
|
29 | + EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
30 | + array('dashicons'), |
|
31 | + EVENT_ESPRESSO_VERSION |
|
32 | + ); |
|
33 | + wp_enqueue_style('checkbox_dropdown_selector'); |
|
34 | + wp_register_script( |
|
35 | + 'checkbox_dropdown_selector', |
|
36 | + EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js', |
|
37 | + array('jquery'), |
|
38 | + EVENT_ESPRESSO_VERSION, |
|
39 | + true |
|
40 | + ); |
|
41 | + wp_localize_script( |
|
42 | + 'ticket_selector', |
|
43 | + 'eeDTS', |
|
44 | + array( |
|
45 | + 'maxChecked' => EE_Registry::instance() |
|
46 | + ->CFG |
|
47 | + ->template_settings |
|
48 | + ->EED_Ticket_Selector |
|
49 | + ->getDatetimeSelectorMaxChecked() |
|
50 | + ) |
|
51 | + ); |
|
52 | + wp_enqueue_script('checkbox_dropdown_selector'); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
59 | + */ |
|
60 | + public function enqueue_js() |
|
61 | + { |
|
62 | + EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * callback for Iframe::addStylesheets() child class methods |
|
69 | + * |
|
70 | + * @param array $iframe_css |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + public function iframe_css(array $iframe_css) |
|
74 | + { |
|
75 | + $iframe_css['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'css/checkbox_dropdown_selector.css'; |
|
76 | + return $iframe_css; |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * callback for Iframe::addScripts() child class methods |
|
83 | + * |
|
84 | + * @param array $iframe_js |
|
85 | + * @return array |
|
86 | + */ |
|
87 | + public function iframe_js(array $iframe_js) |
|
88 | + { |
|
89 | + $iframe_js['checkbox_dropdown_selector'] = EE_GLOBAL_ASSETS_URL . 'scripts/checkbox_dropdown_selector.js'; |
|
90 | + return $iframe_js; |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * @throws EE_Error |
|
96 | + * @return string of html to display the field |
|
97 | + */ |
|
98 | + public function display() |
|
99 | + { |
|
100 | + $input = $this->get_input(); |
|
101 | + $select_button_text = $input instanceof EE_Checkbox_Dropdown_Selector_Input ? $input->select_button_text() : ''; |
|
102 | + // $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
|
103 | + $input->set_label_sizes(); |
|
104 | + $label_size_class = $input->get_label_size_class(); |
|
105 | + if (! is_array($input->raw_value()) && $input->raw_value() !== null) { |
|
106 | + EE_Error::doing_it_wrong( |
|
107 | + 'EE_Checkbox_Display_Strategy::display()', |
|
108 | + sprintf( |
|
109 | + esc_html__( |
|
110 | + 'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', |
|
111 | + 'event_espresso' |
|
112 | + ), |
|
113 | + $input->html_id(), |
|
114 | + var_export($input->raw_value(), true), |
|
115 | + $input->html_name() . '[]' |
|
116 | + ), |
|
117 | + '4.8.1' |
|
118 | + ); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + $html = \EEH_HTML::div('', '', 'checkbox-dropdown-selector-wrap-dv'); |
|
123 | + $html .= '<button id="' . $input->html_id() . '-btn"'; |
|
124 | + // $html .= ' name="' . $input->html_name() . '"'; |
|
125 | + $html .= ' class="' . $input->html_class() . ' checkbox-dropdown-selector-btn button-secondary button"'; |
|
126 | + $html .= ' style="' . $input->html_style() . '"'; |
|
127 | + $html .= ' data-target="' . $input->html_id() . '-options-dv"'; |
|
128 | + $html .= ' ' . $input->other_html_attributes() . '>'; |
|
129 | + $html .= '<span class="checkbox-dropdown-selector-selected-spn">'; |
|
130 | + $html .= $select_button_text; |
|
131 | + $html .= '</span> <span class="dashicons dashicons-arrow-down"></span>'; |
|
132 | + $html .= '</button>'; |
|
133 | + $html .= EEH_HTML::div( |
|
134 | + '', |
|
135 | + $input->html_id() . '-options-dv', |
|
136 | + 'checkbox-dropdown-selector' |
|
137 | + ); |
|
138 | + $html .= EEH_HTML::link( |
|
139 | + '', |
|
140 | + '<span class="dashicons dashicons-no"></span>', |
|
141 | + esc_html__('close datetime selector', 'event_espresso'), |
|
142 | + '', |
|
143 | + 'close-espresso-notice' |
|
144 | + ); |
|
145 | + $html .= EEH_HTML::ul(); |
|
146 | + $input_raw_value = (array) $input->raw_value(); |
|
147 | + foreach ($input->options() as $value => $display_text) { |
|
148 | + $html .= EEH_HTML::li(); |
|
149 | + $value = $input->get_normalization_strategy()->unnormalize_one($value); |
|
150 | + $html_id = $this->get_sub_input_id($value); |
|
151 | + $html .= EEH_HTML::nl(0, 'checkbox'); |
|
152 | + $html .= '<label for="' |
|
153 | + . $html_id |
|
154 | + . '" id="' |
|
155 | + . $html_id |
|
156 | + . '-lbl" class="ee-checkbox-label-after' |
|
157 | + . $label_size_class |
|
158 | + . '">'; |
|
159 | + $html .= EEH_HTML::nl(1, 'checkbox'); |
|
160 | + $html .= '<input type="checkbox"'; |
|
161 | + $html .= ' name="' . $input->html_name() . '[]"'; |
|
162 | + $html .= ' id="' . $html_id . '"'; |
|
163 | + $html .= ' class="' . $input->html_class() . '-option"'; |
|
164 | + $html .= $input->html_style() ? ' style="' . $input->html_style() . '"' : ''; |
|
165 | + $html .= ' value="' . esc_attr($value) . '"'; |
|
166 | + $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true) |
|
167 | + ? ' checked="checked"' |
|
168 | + : ''; |
|
169 | + $html .= ' ' . $this->_input->other_html_attributes(); |
|
170 | + $html .= '>'; |
|
171 | + $html .= '<span class="datetime-selector-option-text-spn">' . $display_text . '</span>'; |
|
172 | + $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>'; |
|
173 | + $html .= EEH_HTML::lix(); |
|
174 | + } |
|
175 | + $html .= EEH_HTML::ulx(); |
|
176 | + $html .= EEH_HTML::divx(); |
|
177 | + $html .= EEH_HTML::divx(); |
|
178 | + $html .= EEH_HTML::p( |
|
179 | + apply_filters( |
|
180 | + 'FHEE__EE_Checkbox_Dropdown_Selector_Display_Strategy__display__html', |
|
181 | + esc_html__( |
|
182 | + 'To view additional ticket options, click the "Filter by Date" button and select more dates.', |
|
183 | + 'event_espresso' |
|
184 | + ) |
|
185 | + ), |
|
186 | + $input->html_id() . '-date-time-filter-notice-pg', |
|
187 | + 'date-time-filter-notice-pg small-text lt-grey-text' |
|
188 | + ); |
|
189 | + $html .= \EEH_HTML::br(); |
|
190 | + return $html; |
|
191 | + } |
|
192 | 192 | } |