@@ -5,18 +5,18 @@ discard block |
||
5 | 5 | add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
6 | 6 | |
7 | 7 | $values = EEH_Form_Fields::prep_answer_options( |
8 | - array( |
|
9 | - array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')), |
|
10 | - array('id' => 0, 'text' => esc_html__('No', 'event_espresso')), |
|
11 | - ) |
|
8 | + array( |
|
9 | + array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')), |
|
10 | + array('id' => 0, 'text' => esc_html__('No', 'event_espresso')), |
|
11 | + ) |
|
12 | 12 | ); |
13 | 13 | |
14 | 14 | $description = EEH_Form_Fields::prep_answer_options( |
15 | - array( |
|
16 | - array('id' => 0, 'text' => esc_html__('none', 'event_espresso')), |
|
17 | - array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')), |
|
18 | - array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')), |
|
19 | - ) |
|
15 | + array( |
|
16 | + array('id' => 0, 'text' => esc_html__('none', 'event_espresso')), |
|
17 | + array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')), |
|
18 | + array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')), |
|
19 | + ) |
|
20 | 20 | ); |
21 | 21 | |
22 | 22 | $event_archive_url = EEH_Event_View::event_archive_url(); |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | <th> |
38 | 38 | <label for="event_listings_url"> |
39 | 39 | <?php esc_html_e('Event Listings URL', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
40 | - 'event_listings_url_info' |
|
41 | - ); ?> |
|
40 | + 'event_listings_url_info' |
|
41 | + ); ?> |
|
42 | 42 | </label> |
43 | 43 | </th> |
44 | 44 | <td> |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | </th> |
58 | 58 | <td> |
59 | 59 | <?php echo site_url() . '/ ' |
60 | - . EEH_Form_Fields::text( |
|
61 | - 'not_used', |
|
62 | - EE_Registry::instance()->CFG->core->event_cpt_slug, |
|
63 | - 'event_cpt_slug', |
|
64 | - 'event_cpt_slug', |
|
65 | - 'regular' |
|
66 | - ); ?> |
|
60 | + . EEH_Form_Fields::text( |
|
61 | + 'not_used', |
|
62 | + EE_Registry::instance()->CFG->core->event_cpt_slug, |
|
63 | + 'event_cpt_slug', |
|
64 | + 'event_cpt_slug', |
|
65 | + 'regular' |
|
66 | + ); ?> |
|
67 | 67 | <p class="description"><?php |
68 | - esc_html_e( |
|
69 | - 'This allows you to configure what slug is used for the url of all event pages.', |
|
70 | - 'event_espresso' |
|
71 | - ); ?></p> |
|
68 | + esc_html_e( |
|
69 | + 'This allows you to configure what slug is used for the url of all event pages.', |
|
70 | + 'event_espresso' |
|
71 | + ); ?></p> |
|
72 | 72 | <?php if (has_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite')) : ?> |
73 | 73 | <p class="important-notice"> |
74 | 74 | <?php |
75 | - sprintf( |
|
76 | - esc_html__( |
|
77 | - 'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', |
|
78 | - 'event_espresso' |
|
79 | - ), |
|
80 | - '<code>', |
|
81 | - '</code>' |
|
82 | - ); |
|
83 | - ?> |
|
75 | + sprintf( |
|
76 | + esc_html__( |
|
77 | + 'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', |
|
78 | + 'event_espresso' |
|
79 | + ), |
|
80 | + '<code>', |
|
81 | + '</code>' |
|
82 | + ); |
|
83 | + ?> |
|
84 | 84 | </p> |
85 | 85 | <?php endif; ?> |
86 | 86 | </td> |
@@ -94,17 +94,17 @@ discard block |
||
94 | 94 | </th> |
95 | 95 | <td> |
96 | 96 | <?php echo EEH_Form_Fields::select( |
97 | - 'display_status_banner', |
|
98 | - $display_status_banner, |
|
99 | - $values, |
|
100 | - 'EED_Events_Archive_display_status_banner', |
|
101 | - 'EED_Events_Archive_display_status_banner' |
|
102 | - ); ?> |
|
97 | + 'display_status_banner', |
|
98 | + $display_status_banner, |
|
99 | + $values, |
|
100 | + 'EED_Events_Archive_display_status_banner', |
|
101 | + 'EED_Events_Archive_display_status_banner' |
|
102 | + ); ?> |
|
103 | 103 | <p class="description"><?php |
104 | - esc_html_e( |
|
105 | - 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.', |
|
106 | - 'event_espresso' |
|
107 | - ); ?></p> |
|
104 | + esc_html_e( |
|
105 | + 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.', |
|
106 | + 'event_espresso' |
|
107 | + ); ?></p> |
|
108 | 108 | </td> |
109 | 109 | </tr> |
110 | 110 | |
@@ -112,18 +112,18 @@ discard block |
||
112 | 112 | <th> |
113 | 113 | <label for="EED_Events_Archive_display_description"> |
114 | 114 | <?php esc_html_e('Display Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
115 | - 'display_description_info' |
|
116 | - ); ?> |
|
115 | + 'display_description_info' |
|
116 | + ); ?> |
|
117 | 117 | </label> |
118 | 118 | </th> |
119 | 119 | <td> |
120 | 120 | <?php echo EEH_Form_Fields::select( |
121 | - 'description', |
|
122 | - $display_description, |
|
123 | - $description, |
|
124 | - 'EED_Events_Archive_display_description', |
|
125 | - 'EED_Events_Archive_display_description' |
|
126 | - ); ?> |
|
121 | + 'description', |
|
122 | + $display_description, |
|
123 | + $description, |
|
124 | + 'EED_Events_Archive_display_description', |
|
125 | + 'EED_Events_Archive_display_description' |
|
126 | + ); ?> |
|
127 | 127 | </td> |
128 | 128 | </tr> |
129 | 129 | |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | <th> |
132 | 132 | <label for="EED_Events_Archive_display_ticket_selector"> |
133 | 133 | <?php esc_html_e('Display Ticket Selector', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
134 | - 'display_ticket_selector_info' |
|
135 | - ); ?> |
|
134 | + 'display_ticket_selector_info' |
|
135 | + ); ?> |
|
136 | 136 | </label> |
137 | 137 | </th> |
138 | 138 | <td> |
139 | 139 | <?php echo EEH_Form_Fields::select( |
140 | - 'ticket_selector', |
|
141 | - $display_ticket_selector, |
|
142 | - $values, |
|
143 | - 'EED_Events_Archive_display_ticket_selector', |
|
144 | - 'EED_Events_Archive_display_ticket_selector' |
|
145 | - ); ?> |
|
140 | + 'ticket_selector', |
|
141 | + $display_ticket_selector, |
|
142 | + $values, |
|
143 | + 'EED_Events_Archive_display_ticket_selector', |
|
144 | + 'EED_Events_Archive_display_ticket_selector' |
|
145 | + ); ?> |
|
146 | 146 | </td> |
147 | 147 | </tr> |
148 | 148 | |
@@ -150,18 +150,18 @@ discard block |
||
150 | 150 | <th> |
151 | 151 | <label for="EED_Events_Archive_display_datetimes"> |
152 | 152 | <?php esc_html_e('Display Datetimes', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
153 | - 'display_datetimes_info' |
|
154 | - ); ?> |
|
153 | + 'display_datetimes_info' |
|
154 | + ); ?> |
|
155 | 155 | </label> |
156 | 156 | </th> |
157 | 157 | <td> |
158 | 158 | <?php echo EEH_Form_Fields::select( |
159 | - 'venue_details', |
|
160 | - $display_datetimes, |
|
161 | - $values, |
|
162 | - 'EED_Events_Archive_display_datetimes', |
|
163 | - 'EED_Events_Archive_display_datetimes' |
|
164 | - ); ?> |
|
159 | + 'venue_details', |
|
160 | + $display_datetimes, |
|
161 | + $values, |
|
162 | + 'EED_Events_Archive_display_datetimes', |
|
163 | + 'EED_Events_Archive_display_datetimes' |
|
164 | + ); ?> |
|
165 | 165 | </td> |
166 | 166 | </tr> |
167 | 167 | |
@@ -169,18 +169,18 @@ discard block |
||
169 | 169 | <th> |
170 | 170 | <label for="EED_Events_Archive_display_venue"> |
171 | 171 | <?php esc_html_e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
172 | - 'display_venue_details_info' |
|
173 | - ); ?> |
|
172 | + 'display_venue_details_info' |
|
173 | + ); ?> |
|
174 | 174 | </label> |
175 | 175 | </th> |
176 | 176 | <td> |
177 | 177 | <?php echo EEH_Form_Fields::select( |
178 | - 'display_venue', |
|
179 | - $display_venue, |
|
180 | - $values, |
|
181 | - 'EED_Events_Archive_display_venue', |
|
182 | - 'EED_Events_Archive_display_venue' |
|
183 | - ); ?> |
|
178 | + 'display_venue', |
|
179 | + $display_venue, |
|
180 | + $values, |
|
181 | + 'EED_Events_Archive_display_venue', |
|
182 | + 'EED_Events_Archive_display_venue' |
|
183 | + ); ?> |
|
184 | 184 | </td> |
185 | 185 | </tr> |
186 | 186 | |
@@ -188,18 +188,18 @@ discard block |
||
188 | 188 | <th> |
189 | 189 | <label for="EED_Events_Archive_display_expired_events"> |
190 | 190 | <?php esc_html_e('Display Expired Events', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
191 | - 'display_expired_events_info' |
|
192 | - ); ?> |
|
191 | + 'display_expired_events_info' |
|
192 | + ); ?> |
|
193 | 193 | </label> |
194 | 194 | </th> |
195 | 195 | <td> |
196 | 196 | <?php echo EEH_Form_Fields::select( |
197 | - 'expired_events', |
|
198 | - $display_expired_events, |
|
199 | - $values, |
|
200 | - 'EED_Events_Archive_display_expired_events', |
|
201 | - 'EED_Events_Archive_display_expired_events' |
|
202 | - ); ?> |
|
197 | + 'expired_events', |
|
198 | + $display_expired_events, |
|
199 | + $values, |
|
200 | + 'EED_Events_Archive_display_expired_events', |
|
201 | + 'EED_Events_Archive_display_expired_events' |
|
202 | + ); ?> |
|
203 | 203 | </td> |
204 | 204 | </tr> |
205 | 205 | |
@@ -207,43 +207,43 @@ discard block |
||
207 | 207 | <th> |
208 | 208 | <label for="EED_Events_Archive_use_sortable_display_order"> |
209 | 209 | <?php esc_html_e( |
210 | - 'Use Custom Display Order?', |
|
211 | - 'event_espresso' |
|
212 | - ); ?><?php // echo EEH_Template::get_help_tab_link('use_sortable_display_order_info');?> |
|
210 | + 'Use Custom Display Order?', |
|
211 | + 'event_espresso' |
|
212 | + ); ?><?php // echo EEH_Template::get_help_tab_link('use_sortable_display_order_info');?> |
|
213 | 213 | </label> |
214 | 214 | </th> |
215 | 215 | <td> |
216 | 216 | <?php echo EEH_Form_Fields::select( |
217 | - 'use_sortable_display_order', |
|
218 | - $use_sortable_display_order, |
|
219 | - $values, |
|
220 | - 'EED_Events_Archive_use_sortable_display_order', |
|
221 | - 'EED_Events_Archive_use_sortable_display_order' |
|
222 | - ); ?> |
|
217 | + 'use_sortable_display_order', |
|
218 | + $use_sortable_display_order, |
|
219 | + $values, |
|
220 | + 'EED_Events_Archive_use_sortable_display_order', |
|
221 | + 'EED_Events_Archive_use_sortable_display_order' |
|
222 | + ); ?> |
|
223 | 223 | </td> |
224 | 224 | </tr> |
225 | 225 | |
226 | 226 | <tr> |
227 | 227 | <th> |
228 | 228 | <?php esc_html_e( |
229 | - 'Display Order', |
|
230 | - 'event_espresso' |
|
231 | - ); ?><?php // echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
229 | + 'Display Order', |
|
230 | + 'event_espresso' |
|
231 | + ); ?><?php // echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
232 | 232 | </th> |
233 | 233 | <td> |
234 | 234 | |
235 | 235 | <?php wp_nonce_field( |
236 | - 'espresso_update_event_archive_order', |
|
237 | - 'espresso_update_event_archive_order_nonce', |
|
238 | - false |
|
239 | - ); ?> |
|
236 | + 'espresso_update_event_archive_order', |
|
237 | + 'espresso_update_event_archive_order_nonce', |
|
238 | + false |
|
239 | + ); ?> |
|
240 | 240 | <?php echo wp_kses($event_archive_display_order, AllowedTags::getWithFormTags()); ?> |
241 | 241 | |
242 | 242 | <p class="description"><?php |
243 | - esc_html_e( |
|
244 | - 'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', |
|
245 | - 'event_espresso' |
|
246 | - ); ?></p> |
|
243 | + esc_html_e( |
|
244 | + 'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', |
|
245 | + 'event_espresso' |
|
246 | + ); ?></p> |
|
247 | 247 | |
248 | 248 | </td> |
249 | 249 | </tr> |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | </th> |
257 | 257 | <td> |
258 | 258 | <?php echo EEH_Form_Fields::select( |
259 | - 'reset_event_list_settings', |
|
260 | - 0, |
|
261 | - $values, |
|
262 | - 'EED_Events_Archive_reset_event_list_settings', |
|
263 | - 'EED_Events_Archive_reset_event_list_settings' |
|
264 | - ); ?> |
|
259 | + 'reset_event_list_settings', |
|
260 | + 0, |
|
261 | + $values, |
|
262 | + 'EED_Events_Archive_reset_event_list_settings', |
|
263 | + 'EED_Events_Archive_reset_event_list_settings' |
|
264 | + ); ?> |
|
265 | 265 | </td> |
266 | 266 | </tr> |
267 | 267 |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | if (! function_exists('espressoSubtotalRow')) { |
13 | - function espressoSubtotalRow(float $running_total, bool $show = true): string |
|
14 | - { |
|
15 | - return $show |
|
16 | - ? ' |
|
13 | + function espressoSubtotalRow(float $running_total, bool $show = true): string |
|
14 | + { |
|
15 | + return $show |
|
16 | + ? ' |
|
17 | 17 | <tr> |
18 | 18 | <td colspan="2" class="jst-rght small-text sbttl"> |
19 | 19 | <b>' . esc_html__('subtotal', 'event_espresso') . '</b> |
@@ -23,18 +23,18 @@ discard block |
||
23 | 23 | </td> |
24 | 24 | </tr> |
25 | 25 | ' |
26 | - : ''; |
|
27 | - } |
|
26 | + : ''; |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if ($display_ticket_price) { ?> |
31 | 31 | <section class="tckt-slctr-tkt-price-sctn"> |
32 | 32 | <h5><?php echo esc_html( |
33 | - apply_filters( |
|
34 | - 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
35 | - __('Price', 'event_espresso') |
|
36 | - ) |
|
37 | - ); ?></h5> |
|
33 | + apply_filters( |
|
34 | + 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
35 | + __('Price', 'event_espresso') |
|
36 | + ) |
|
37 | + ); ?></h5> |
|
38 | 38 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
39 | 39 | <table class="tckt-slctr-tkt-details-tbl"> |
40 | 40 | <thead> |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | </thead> |
55 | 55 | <tbody> |
56 | 56 | <?php |
57 | - if ($ticket->base_price() instanceof EE_Price) { ?> |
|
57 | + if ($ticket->base_price() instanceof EE_Price) { ?> |
|
58 | 58 | <tr> |
59 | 59 | <td data-th="<?php esc_html_e('Name', 'event_espresso'); ?>" class="small-text" colspan="2"> |
60 | 60 | <b> |
@@ -66,31 +66,31 @@ discard block |
||
66 | 66 | </td> |
67 | 67 | </tr> |
68 | 68 | <?php |
69 | - $running_total = $ticket->base_price()->amount(); |
|
70 | - } else { |
|
71 | - $running_total = 0; |
|
72 | - } |
|
73 | - $pretax_total = $running_total; |
|
74 | - $display_subtotal = true; |
|
75 | - // now add price modifiers |
|
76 | - foreach ($ticket->price_modifiers() as $price_mod) { |
|
77 | - if ($price_mod->is_tax()) { |
|
78 | - echo espressoSubtotalRow($running_total, $display_subtotal); |
|
79 | - $display_subtotal = false; |
|
80 | - $new_sub_total = $pretax_total * ($price_mod->amount() / 100); |
|
81 | - } elseif ($price_mod->is_percent()) { |
|
82 | - $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
83 | - } else { |
|
84 | - $new_sub_total = $price_mod->amount(); |
|
85 | - } |
|
86 | - $new_sub_total = $price_mod->is_discount() |
|
87 | - ? $new_sub_total * -1 |
|
88 | - : $new_sub_total; |
|
89 | - $description = $price_mod->desc() . ' '; |
|
90 | - $description .= $price_mod->is_percent() |
|
91 | - ? $price_mod->amount() . '%' |
|
92 | - : EEH_Template::format_currency($price_mod->amount()); |
|
93 | - ?> |
|
69 | + $running_total = $ticket->base_price()->amount(); |
|
70 | + } else { |
|
71 | + $running_total = 0; |
|
72 | + } |
|
73 | + $pretax_total = $running_total; |
|
74 | + $display_subtotal = true; |
|
75 | + // now add price modifiers |
|
76 | + foreach ($ticket->price_modifiers() as $price_mod) { |
|
77 | + if ($price_mod->is_tax()) { |
|
78 | + echo espressoSubtotalRow($running_total, $display_subtotal); |
|
79 | + $display_subtotal = false; |
|
80 | + $new_sub_total = $pretax_total * ($price_mod->amount() / 100); |
|
81 | + } elseif ($price_mod->is_percent()) { |
|
82 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
83 | + } else { |
|
84 | + $new_sub_total = $price_mod->amount(); |
|
85 | + } |
|
86 | + $new_sub_total = $price_mod->is_discount() |
|
87 | + ? $new_sub_total * -1 |
|
88 | + : $new_sub_total; |
|
89 | + $description = $price_mod->desc() . ' '; |
|
90 | + $description .= $price_mod->is_percent() |
|
91 | + ? $price_mod->amount() . '%' |
|
92 | + : EEH_Template::format_currency($price_mod->amount()); |
|
93 | + ?> |
|
94 | 94 | <tr> |
95 | 95 | <td data-th="<?php esc_html_e('Name', 'event_espresso'); ?>" |
96 | 96 | class="jst-rght small-text" |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | </td> |
103 | 103 | <td data-th="<?php esc_html_e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"> |
104 | 104 | <?php echo wp_kses( |
105 | - EEH_Template::format_currency($new_sub_total), |
|
106 | - AllowedTags::getAllowedTags() |
|
107 | - ); ?> |
|
105 | + EEH_Template::format_currency($new_sub_total), |
|
106 | + AllowedTags::getAllowedTags() |
|
107 | + ); ?> |
|
108 | 108 | </td> |
109 | 109 | <?php $pretax_total += ! $price_mod->is_tax() ? $new_sub_total : 0; ?> |
110 | 110 | <?php $running_total += $new_sub_total; ?> |
111 | 111 | </tr> |
112 | 112 | <?php } ?> |
113 | 113 | <?php if ($ticket->taxable()) { |
114 | - echo espressoSubtotalRow($running_total); |
|
115 | - foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
114 | + echo espressoSubtotalRow($running_total); |
|
115 | + foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
116 | 116 | <tr> |
117 | 117 | <td data-th="<?php esc_html_e('Name', 'event_espresso'); ?>" |
118 | 118 | class="jst-rght small-text" |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | class="jst-rght small-text" |
130 | 130 | > |
131 | 131 | <?php echo wp_kses( |
132 | - EEH_Template::format_currency($tax_amount), |
|
133 | - AllowedTags::getAllowedTags() |
|
134 | - ); ?> |
|
132 | + EEH_Template::format_currency($tax_amount), |
|
133 | + AllowedTags::getAllowedTags() |
|
134 | + ); ?> |
|
135 | 135 | </td> |
136 | 136 | <?php $running_total += $tax_amount; ?> |
137 | 137 | </tr> |
@@ -141,24 +141,24 @@ discard block |
||
141 | 141 | <td colspan="2" class="jst-rght small-text ttl-lbl-td"> |
142 | 142 | <b> |
143 | 143 | <?php echo esc_html( |
144 | - apply_filters( |
|
145 | - 'FHEE__ticket_selector_chart_template__ticket_details_total_price', |
|
146 | - __('Total', 'event_espresso') |
|
147 | - ) |
|
148 | - ); ?> |
|
144 | + apply_filters( |
|
145 | + 'FHEE__ticket_selector_chart_template__ticket_details_total_price', |
|
146 | + __('Total', 'event_espresso') |
|
147 | + ) |
|
148 | + ); ?> |
|
149 | 149 | </b> |
150 | 150 | </td> |
151 | 151 | <td data-th="<?php echo esc_html( |
152 | - apply_filters( |
|
153 | - 'FHEE__ticket_selector_chart_template__ticket_details_total_price', |
|
154 | - __('Total', 'event_espresso') |
|
155 | - ) |
|
156 | - ); ?>" class="jst-rght small-text" |
|
152 | + apply_filters( |
|
153 | + 'FHEE__ticket_selector_chart_template__ticket_details_total_price', |
|
154 | + __('Total', 'event_espresso') |
|
155 | + ) |
|
156 | + ); ?>" class="jst-rght small-text" |
|
157 | 157 | > |
158 | 158 | <b><?php wp_kses( |
159 | - EEH_Template::format_currency($running_total), |
|
160 | - AllowedTags::getAllowedTags() |
|
161 | - ); ?></b> |
|
159 | + EEH_Template::format_currency($running_total), |
|
160 | + AllowedTags::getAllowedTags() |
|
161 | + ); ?></b> |
|
162 | 162 | </td> |
163 | 163 | </tr> |
164 | 164 | </tbody> |
@@ -15,102 +15,102 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class espresso_events_Registration_Form_Hooks extends EE_Admin_Hooks |
17 | 17 | { |
18 | - /** |
|
19 | - * @var EE_Event|null |
|
20 | - */ |
|
21 | - protected $_event; |
|
22 | - |
|
23 | - |
|
24 | - protected function _set_hooks_properties() |
|
25 | - { |
|
26 | - $this->_name = 'registration_form'; |
|
27 | - if ( |
|
28 | - $this->_adminpage_obj->adminConfig()->useAdvancedEditor() |
|
29 | - && $this->_adminpage_obj->feature()->allowed('use_reg_form_builder') |
|
30 | - ) { |
|
31 | - $this->_metaboxes = []; |
|
32 | - $this->_scripts_styles = []; |
|
33 | - return; |
|
34 | - } |
|
35 | - $this->_metaboxes = [ |
|
36 | - 0 => [ |
|
37 | - 'page_route' => ['edit', 'create_new'], |
|
38 | - 'func' => 'primary_questions', |
|
39 | - 'label' => esc_html__('Questions for Primary Registrant', 'event_espresso'), |
|
40 | - 'priority' => 'default', |
|
41 | - 'context' => 'side', |
|
42 | - ], |
|
43 | - ]; |
|
44 | - |
|
45 | - // hook into the handler for saving question groups |
|
46 | - add_filter( |
|
47 | - 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
48 | - [$this, 'modify_callbacks'], |
|
49 | - 10 |
|
50 | - ); |
|
51 | - |
|
52 | - // hook into revision restores (we're hooking into the global action because EE_Admin_Hooks classes are already |
|
53 | - // restricted by page) |
|
54 | - add_action('AHEE_EE_Admin_Page_CPT__restore_revision', [$this, 'restore_revision'], 10, 2); |
|
55 | - } |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * Callback for FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks hook |
|
60 | - * |
|
61 | - * @param $callbacks |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - public function modify_callbacks($callbacks) |
|
65 | - { |
|
66 | - // now let's add the question group callback |
|
67 | - $callbacks['primary_question_group_update'] = [$this, 'primary_question_group_update']; |
|
68 | - return $callbacks; |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * Hooked into revision restores. |
|
74 | - * |
|
75 | - * @param $post_id |
|
76 | - * @param $revision_id |
|
77 | - * @return EE_Base_Class |
|
78 | - * @throws EE_Error |
|
79 | - * @throws InvalidArgumentException |
|
80 | - * @throws InvalidDataTypeException |
|
81 | - * @throws InvalidInterfaceException |
|
82 | - */ |
|
83 | - public function restore_revision($post_id, $revision_id) |
|
84 | - { |
|
85 | - $post_evt = EEM_Event::instance()->get_one_by_ID($post_id); |
|
86 | - // restore revision for primary questions |
|
87 | - if ($post_evt instanceof EE_Event) { |
|
88 | - $post_evt->restore_revision( |
|
89 | - $revision_id, |
|
90 | - ['Question_Group'], |
|
91 | - ['Question_Group' => ['Event_Question_Group.EQG_primary' => true]] |
|
92 | - ); |
|
93 | - } |
|
94 | - return $post_evt; |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * Content of metabox. |
|
100 | - * |
|
101 | - * @param $post_id |
|
102 | - * @param $post |
|
103 | - * @throws EE_Error |
|
104 | - * @throws InvalidArgumentException |
|
105 | - * @throws InvalidDataTypeException |
|
106 | - * @throws InvalidInterfaceException |
|
107 | - * @throws ReflectionException |
|
108 | - */ |
|
109 | - public function primary_questions($post_id, $post) |
|
110 | - { |
|
111 | - $this->_event = $this->_adminpage_obj->get_event_object(); |
|
112 | - $event_id = $this->_event->ID(); |
|
113 | - ?> |
|
18 | + /** |
|
19 | + * @var EE_Event|null |
|
20 | + */ |
|
21 | + protected $_event; |
|
22 | + |
|
23 | + |
|
24 | + protected function _set_hooks_properties() |
|
25 | + { |
|
26 | + $this->_name = 'registration_form'; |
|
27 | + if ( |
|
28 | + $this->_adminpage_obj->adminConfig()->useAdvancedEditor() |
|
29 | + && $this->_adminpage_obj->feature()->allowed('use_reg_form_builder') |
|
30 | + ) { |
|
31 | + $this->_metaboxes = []; |
|
32 | + $this->_scripts_styles = []; |
|
33 | + return; |
|
34 | + } |
|
35 | + $this->_metaboxes = [ |
|
36 | + 0 => [ |
|
37 | + 'page_route' => ['edit', 'create_new'], |
|
38 | + 'func' => 'primary_questions', |
|
39 | + 'label' => esc_html__('Questions for Primary Registrant', 'event_espresso'), |
|
40 | + 'priority' => 'default', |
|
41 | + 'context' => 'side', |
|
42 | + ], |
|
43 | + ]; |
|
44 | + |
|
45 | + // hook into the handler for saving question groups |
|
46 | + add_filter( |
|
47 | + 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
48 | + [$this, 'modify_callbacks'], |
|
49 | + 10 |
|
50 | + ); |
|
51 | + |
|
52 | + // hook into revision restores (we're hooking into the global action because EE_Admin_Hooks classes are already |
|
53 | + // restricted by page) |
|
54 | + add_action('AHEE_EE_Admin_Page_CPT__restore_revision', [$this, 'restore_revision'], 10, 2); |
|
55 | + } |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * Callback for FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks hook |
|
60 | + * |
|
61 | + * @param $callbacks |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + public function modify_callbacks($callbacks) |
|
65 | + { |
|
66 | + // now let's add the question group callback |
|
67 | + $callbacks['primary_question_group_update'] = [$this, 'primary_question_group_update']; |
|
68 | + return $callbacks; |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * Hooked into revision restores. |
|
74 | + * |
|
75 | + * @param $post_id |
|
76 | + * @param $revision_id |
|
77 | + * @return EE_Base_Class |
|
78 | + * @throws EE_Error |
|
79 | + * @throws InvalidArgumentException |
|
80 | + * @throws InvalidDataTypeException |
|
81 | + * @throws InvalidInterfaceException |
|
82 | + */ |
|
83 | + public function restore_revision($post_id, $revision_id) |
|
84 | + { |
|
85 | + $post_evt = EEM_Event::instance()->get_one_by_ID($post_id); |
|
86 | + // restore revision for primary questions |
|
87 | + if ($post_evt instanceof EE_Event) { |
|
88 | + $post_evt->restore_revision( |
|
89 | + $revision_id, |
|
90 | + ['Question_Group'], |
|
91 | + ['Question_Group' => ['Event_Question_Group.EQG_primary' => true]] |
|
92 | + ); |
|
93 | + } |
|
94 | + return $post_evt; |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * Content of metabox. |
|
100 | + * |
|
101 | + * @param $post_id |
|
102 | + * @param $post |
|
103 | + * @throws EE_Error |
|
104 | + * @throws InvalidArgumentException |
|
105 | + * @throws InvalidDataTypeException |
|
106 | + * @throws InvalidInterfaceException |
|
107 | + * @throws ReflectionException |
|
108 | + */ |
|
109 | + public function primary_questions($post_id, $post) |
|
110 | + { |
|
111 | + $this->_event = $this->_adminpage_obj->get_event_object(); |
|
112 | + $event_id = $this->_event->ID(); |
|
113 | + ?> |
|
114 | 114 | <div class="inside"> |
115 | 115 | <p> |
116 | 116 | <strong> |
@@ -118,64 +118,64 @@ discard block |
||
118 | 118 | </strong> |
119 | 119 | <br /> |
120 | 120 | <?php |
121 | - printf( |
|
122 | - esc_html__( |
|
123 | - 'Add a pre-populated %1$sgroup of questions%2$s to your event. The personal information group is required for all events', |
|
124 | - 'event_espresso' |
|
125 | - ), |
|
126 | - '<a href="admin.php?page=espresso_registration_form" target="_blank">', |
|
127 | - '</a>' |
|
128 | - ) |
|
129 | - ?> |
|
121 | + printf( |
|
122 | + esc_html__( |
|
123 | + 'Add a pre-populated %1$sgroup of questions%2$s to your event. The personal information group is required for all events', |
|
124 | + 'event_espresso' |
|
125 | + ), |
|
126 | + '<a href="admin.php?page=espresso_registration_form" target="_blank">', |
|
127 | + '</a>' |
|
128 | + ) |
|
129 | + ?> |
|
130 | 130 | </p> |
131 | 131 | <?php |
132 | 132 | |
133 | - $qsg_where['QSG_deleted'] = false; |
|
134 | - $query_params = apply_filters( |
|
135 | - 'FHEE__espresso_events_Registration_Form_Hooks__primary_questions__question_group_query_parameters', |
|
136 | - [$qsg_where, 'order_by' => ['QSG_order' => 'ASC']] |
|
137 | - ); |
|
138 | - $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
139 | - $EQGs = ! empty($event_id) |
|
140 | - ? $this->_event->get_many_related( |
|
141 | - 'Question_Group', |
|
142 | - [['Event_Question_Group.EQG_primary' => true]] |
|
143 | - ) |
|
144 | - : []; |
|
145 | - $EQGids = array_keys($EQGs); |
|
146 | - |
|
147 | - if (! empty($QSGs)) { |
|
148 | - $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
149 | - foreach ($QSGs as $QSG) { |
|
150 | - $QSG_ID = absint($QSG->ID()); |
|
151 | - $checked = in_array($QSG_ID, $EQGids, true) || $QSG->get('QSG_system') === 1 |
|
152 | - ? ' checked' |
|
153 | - : ''; |
|
154 | - $visibility = $QSG->get('QSG_system') === 1 |
|
155 | - ? ' style="visibility:hidden"' |
|
156 | - : ''; |
|
157 | - $edit_query_args = $this->_adminpage_obj->is_caf() |
|
158 | - ? [ |
|
159 | - 'action' => 'edit_question_group', |
|
160 | - 'QSG_ID' => $QSG_ID, |
|
161 | - ] |
|
162 | - : ['action' => 'question_groups']; |
|
163 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( |
|
164 | - $edit_query_args, |
|
165 | - EE_FORMS_ADMIN_URL |
|
166 | - ); |
|
167 | - $edit_link_title = sprintf( |
|
168 | - esc_attr__('Edit %s Group', 'event_espresso'), |
|
169 | - $QSG->get('QSG_name') |
|
170 | - ); |
|
171 | - |
|
172 | - $html .= ' |
|
133 | + $qsg_where['QSG_deleted'] = false; |
|
134 | + $query_params = apply_filters( |
|
135 | + 'FHEE__espresso_events_Registration_Form_Hooks__primary_questions__question_group_query_parameters', |
|
136 | + [$qsg_where, 'order_by' => ['QSG_order' => 'ASC']] |
|
137 | + ); |
|
138 | + $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
139 | + $EQGs = ! empty($event_id) |
|
140 | + ? $this->_event->get_many_related( |
|
141 | + 'Question_Group', |
|
142 | + [['Event_Question_Group.EQG_primary' => true]] |
|
143 | + ) |
|
144 | + : []; |
|
145 | + $EQGids = array_keys($EQGs); |
|
146 | + |
|
147 | + if (! empty($QSGs)) { |
|
148 | + $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
149 | + foreach ($QSGs as $QSG) { |
|
150 | + $QSG_ID = absint($QSG->ID()); |
|
151 | + $checked = in_array($QSG_ID, $EQGids, true) || $QSG->get('QSG_system') === 1 |
|
152 | + ? ' checked' |
|
153 | + : ''; |
|
154 | + $visibility = $QSG->get('QSG_system') === 1 |
|
155 | + ? ' style="visibility:hidden"' |
|
156 | + : ''; |
|
157 | + $edit_query_args = $this->_adminpage_obj->is_caf() |
|
158 | + ? [ |
|
159 | + 'action' => 'edit_question_group', |
|
160 | + 'QSG_ID' => $QSG_ID, |
|
161 | + ] |
|
162 | + : ['action' => 'question_groups']; |
|
163 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce( |
|
164 | + $edit_query_args, |
|
165 | + EE_FORMS_ADMIN_URL |
|
166 | + ); |
|
167 | + $edit_link_title = sprintf( |
|
168 | + esc_attr__('Edit %s Group', 'event_espresso'), |
|
169 | + $QSG->get('QSG_name') |
|
170 | + ); |
|
171 | + |
|
172 | + $html .= ' |
|
173 | 173 | <p id="event-question-group-' . $QSG_ID . '"> |
174 | 174 | <input value="' . $QSG_ID . '" |
175 | 175 | type="checkbox" |
176 | 176 | name="question_groups[' . $QSG_ID . ']" ' |
177 | - . $visibility |
|
178 | - . $checked . ' |
|
177 | + . $visibility |
|
178 | + . $checked . ' |
|
179 | 179 | /> |
180 | 180 | <a href="' . esc_url_raw($edit_link) . '" |
181 | 181 | title="' . esc_attr($edit_link_title) . '" |
@@ -184,62 +184,62 @@ discard block |
||
184 | 184 | ' . $QSG->get('QSG_name') . ' |
185 | 185 | </a> |
186 | 186 | </p>'; |
187 | - } |
|
188 | - $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
189 | - echo wp_kses($html, AllowedTags::getWithFormTags()); |
|
190 | - } else { |
|
191 | - esc_html_e( |
|
192 | - 'There seems to be a problem with your questions. Please contact [email protected]', |
|
193 | - 'event_espresso' |
|
194 | - ); |
|
195 | - } |
|
196 | - do_action('AHEE_event_editor_questions_notice'); |
|
197 | - ?> |
|
187 | + } |
|
188 | + $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
189 | + echo wp_kses($html, AllowedTags::getWithFormTags()); |
|
190 | + } else { |
|
191 | + esc_html_e( |
|
192 | + 'There seems to be a problem with your questions. Please contact [email protected]', |
|
193 | + 'event_espresso' |
|
194 | + ); |
|
195 | + } |
|
196 | + do_action('AHEE_event_editor_questions_notice'); |
|
197 | + ?> |
|
198 | 198 | </div> |
199 | 199 | <?php |
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - /** |
|
204 | - * @param EE_Event $event |
|
205 | - * @param array $data |
|
206 | - * @return bool |
|
207 | - * @throws EE_Error |
|
208 | - * @throws ReflectionException |
|
209 | - */ |
|
210 | - public function primary_question_group_update($event, $data) |
|
211 | - { |
|
212 | - $question_groups = ! empty($data['question_groups']) ? (array) $data['question_groups'] : []; |
|
213 | - $added_qgs = array_keys($question_groups); |
|
214 | - $success = true; |
|
215 | - |
|
216 | - // let's get all current question groups associated with this event. |
|
217 | - $current_qgs = $event->get_many_related( |
|
218 | - 'Question_Group', |
|
219 | - [['Event_Question_Group.EQG_primary' => true]] |
|
220 | - ); |
|
221 | - $current_qgs = array_keys($current_qgs); // we just want the ids |
|
222 | - |
|
223 | - // now let's get the groups selected in the editor and update (IF we have data) |
|
224 | - if (! empty($question_groups)) { |
|
225 | - foreach ($question_groups as $QSG_ID => $val) { |
|
226 | - // add to event |
|
227 | - if ($val) { |
|
228 | - $qg = $event->_add_relation_to($QSG_ID, 'Question_Group', ['EQG_primary' => true]); |
|
229 | - } |
|
230 | - // trip success to false if result is empty |
|
231 | - $success = ! empty($qg) ? $success : false; |
|
232 | - } |
|
233 | - } |
|
234 | - |
|
235 | - // wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
|
236 | - $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
237 | - |
|
238 | - foreach ($removed_qgs as $QSG_ID) { |
|
239 | - $qg = $event->_remove_relation_to($QSG_ID, 'Question_Group', ['EQG_primary' => true]); |
|
240 | - // trip success to false if result is empty |
|
241 | - $success = ! empty($qg) ? $success : false; |
|
242 | - } |
|
243 | - return $success; |
|
244 | - } |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + /** |
|
204 | + * @param EE_Event $event |
|
205 | + * @param array $data |
|
206 | + * @return bool |
|
207 | + * @throws EE_Error |
|
208 | + * @throws ReflectionException |
|
209 | + */ |
|
210 | + public function primary_question_group_update($event, $data) |
|
211 | + { |
|
212 | + $question_groups = ! empty($data['question_groups']) ? (array) $data['question_groups'] : []; |
|
213 | + $added_qgs = array_keys($question_groups); |
|
214 | + $success = true; |
|
215 | + |
|
216 | + // let's get all current question groups associated with this event. |
|
217 | + $current_qgs = $event->get_many_related( |
|
218 | + 'Question_Group', |
|
219 | + [['Event_Question_Group.EQG_primary' => true]] |
|
220 | + ); |
|
221 | + $current_qgs = array_keys($current_qgs); // we just want the ids |
|
222 | + |
|
223 | + // now let's get the groups selected in the editor and update (IF we have data) |
|
224 | + if (! empty($question_groups)) { |
|
225 | + foreach ($question_groups as $QSG_ID => $val) { |
|
226 | + // add to event |
|
227 | + if ($val) { |
|
228 | + $qg = $event->_add_relation_to($QSG_ID, 'Question_Group', ['EQG_primary' => true]); |
|
229 | + } |
|
230 | + // trip success to false if result is empty |
|
231 | + $success = ! empty($qg) ? $success : false; |
|
232 | + } |
|
233 | + } |
|
234 | + |
|
235 | + // wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
|
236 | + $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
237 | + |
|
238 | + foreach ($removed_qgs as $QSG_ID) { |
|
239 | + $qg = $event->_remove_relation_to($QSG_ID, 'Question_Group', ['EQG_primary' => true]); |
|
240 | + // trip success to false if result is empty |
|
241 | + $success = ! empty($qg) ? $success : false; |
|
242 | + } |
|
243 | + return $success; |
|
244 | + } |
|
245 | 245 | } |
@@ -30,23 +30,23 @@ discard block |
||
30 | 30 | global $allowedposttags; |
31 | 31 | $info_box = ''; |
32 | 32 | if ($QST_system === 'country') { |
33 | - // already escaped |
|
34 | - $info_box = EEH_HTML::div( |
|
35 | - EEH_HTML::h3( |
|
36 | - '<span class="dashicons dashicons-info"></span> ' |
|
37 | - . esc_html__('Did you know...', 'event_espresso'), |
|
38 | - '', |
|
39 | - 'ee-status--info' |
|
40 | - ) . |
|
41 | - EEH_HTML::p( |
|
42 | - esc_html__( |
|
43 | - 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.', |
|
44 | - 'event_espresso' |
|
45 | - ) |
|
46 | - ), |
|
47 | - '', |
|
48 | - 'ee-info-box' |
|
49 | - ); |
|
33 | + // already escaped |
|
34 | + $info_box = EEH_HTML::div( |
|
35 | + EEH_HTML::h3( |
|
36 | + '<span class="dashicons dashicons-info"></span> ' |
|
37 | + . esc_html__('Did you know...', 'event_espresso'), |
|
38 | + '', |
|
39 | + 'ee-status--info' |
|
40 | + ) . |
|
41 | + EEH_HTML::p( |
|
42 | + esc_html__( |
|
43 | + 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.', |
|
44 | + 'event_espresso' |
|
45 | + ) |
|
46 | + ), |
|
47 | + '', |
|
48 | + 'ee-info-box' |
|
49 | + ); |
|
50 | 50 | } |
51 | 51 | ?> |
52 | 52 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | </th> |
83 | 83 | <td> |
84 | 84 | <?php |
85 | - $id = ! empty($QST_system) ? '_disabled' : ''; |
|
86 | - $disabled_attr = ! empty($QST_system) ? 'disabled' : ''; |
|
87 | - ?> |
|
85 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
86 | + $disabled_attr = ! empty($QST_system) ? 'disabled' : ''; |
|
87 | + ?> |
|
88 | 88 | <input id="QST_admin_label<?php echo esc_attr($id); ?>" |
89 | 89 | name="QST_admin_label<?php echo esc_attr($id); ?>" |
90 | 90 | type="text" |
@@ -122,29 +122,29 @@ discard block |
||
122 | 122 | </th> |
123 | 123 | <td> |
124 | 124 | <?php |
125 | - $id = ! empty($QST_system) ? '_disabled' : ''; |
|
126 | - $disabled_attr = ! empty($QST_system) ? 'disabled' : ''; |
|
127 | - $admin_only = $question->get('QST_admin_only'); |
|
128 | - $checked = ! empty($admin_only) ? ' checked' : ''; |
|
129 | - ?> |
|
125 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
126 | + $disabled_attr = ! empty($QST_system) ? 'disabled' : ''; |
|
127 | + $admin_only = $question->get('QST_admin_only'); |
|
128 | + $checked = ! empty($admin_only) ? ' checked' : ''; |
|
129 | + ?> |
|
130 | 130 | <input class="QST_admin_only" |
131 | 131 | id="QST_admin_only<?php echo esc_attr($id); ?>" |
132 | 132 | name="QST_admin_only<?php echo esc_attr($id); ?>" |
133 | 133 | type="checkbox" |
134 | 134 | value="1" |
135 | 135 | <?php |
136 | - echo esc_attr($disabled_attr); |
|
137 | - echo esc_attr($checked); |
|
138 | - ?> |
|
136 | + echo esc_attr($disabled_attr); |
|
137 | + echo esc_attr($checked); |
|
138 | + ?> |
|
139 | 139 | /> |
140 | 140 | <br /> |
141 | 141 | <?php |
142 | - if (! empty($QST_system)) { ?> |
|
142 | + if (! empty($QST_system)) { ?> |
|
143 | 143 | <p class="description" style="color:#D54E21;"> |
144 | 144 | <?php esc_html_e( |
145 | - 'System question! This field cannot be changed.', |
|
146 | - 'event_espresso' |
|
147 | - ); ?> |
|
145 | + 'System question! This field cannot be changed.', |
|
146 | + 'event_espresso' |
|
147 | + ); ?> |
|
148 | 148 | </p> |
149 | 149 | <?php } ?> |
150 | 150 | </td> |
@@ -159,44 +159,44 @@ discard block |
||
159 | 159 | </th> |
160 | 160 | <td> |
161 | 161 | <?php |
162 | - $disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone; |
|
163 | - if ($disabled) { |
|
164 | - $disabled_attr = 'disabled="disabled"'; |
|
165 | - $id = '_disabled'; |
|
166 | - } else { |
|
167 | - $disabled_attr = ''; |
|
168 | - $id = ''; |
|
169 | - } |
|
162 | + $disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone; |
|
163 | + if ($disabled) { |
|
164 | + $disabled_attr = 'disabled="disabled"'; |
|
165 | + $id = '_disabled'; |
|
166 | + } else { |
|
167 | + $disabled_attr = ''; |
|
168 | + $id = ''; |
|
169 | + } |
|
170 | 170 | |
171 | - // Only display Confirm email for |
|
172 | - if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) { |
|
173 | - unset($question_types[ EEM_Question::QST_type_email_confirm ]); |
|
174 | - } |
|
171 | + // Only display Confirm email for |
|
172 | + if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) { |
|
173 | + unset($question_types[ EEM_Question::QST_type_email_confirm ]); |
|
174 | + } |
|
175 | 175 | |
176 | - echo EEH_Form_Fields::select_input( |
|
177 | - 'QST_type' . $id, |
|
178 | - $question_types, |
|
179 | - $question->type(), |
|
180 | - 'id="QST_type' . $id . '"' . $disabled_attr |
|
181 | - ); // already escaped |
|
182 | - if ($disabled) { ?> |
|
176 | + echo EEH_Form_Fields::select_input( |
|
177 | + 'QST_type' . $id, |
|
178 | + $question_types, |
|
179 | + $question->type(), |
|
180 | + 'id="QST_type' . $id . '"' . $disabled_attr |
|
181 | + ); // already escaped |
|
182 | + if ($disabled) { ?> |
|
183 | 183 | <input id='QST_type' |
184 | 184 | name="QST_type" |
185 | 185 | type="hidden" |
186 | 186 | value="<?php echo esc_attr($question->type()); ?>" |
187 | 187 | /> |
188 | 188 | <?php |
189 | - $explanatory_text = esc_html__( |
|
190 | - 'System question! This field cannot be changed.', |
|
191 | - 'event_espresso' |
|
192 | - ); |
|
193 | - } else { |
|
194 | - $explanatory_text = esc_html__( |
|
195 | - 'Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', |
|
196 | - 'event_espresso' |
|
197 | - ); |
|
198 | - } |
|
199 | - if ($disabled || $has_answers) { ?> |
|
189 | + $explanatory_text = esc_html__( |
|
190 | + 'System question! This field cannot be changed.', |
|
191 | + 'event_espresso' |
|
192 | + ); |
|
193 | + } else { |
|
194 | + $explanatory_text = esc_html__( |
|
195 | + 'Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', |
|
196 | + 'event_espresso' |
|
197 | + ); |
|
198 | + } |
|
199 | + if ($disabled || $has_answers) { ?> |
|
200 | 200 | <p class="description" style="color:#D54E21;"> |
201 | 201 | <?php echo esc_html($explanatory_text); ?> |
202 | 202 | </p> |
@@ -224,21 +224,21 @@ discard block |
||
224 | 224 | <p> |
225 | 225 | <span class="description"> |
226 | 226 | <?php esc_html_e( |
227 | - 'Maximum number of characters allowed when answering this question', |
|
228 | - 'event_espresso' |
|
229 | - ); ?> |
|
227 | + 'Maximum number of characters allowed when answering this question', |
|
228 | + 'event_espresso' |
|
229 | + ); ?> |
|
230 | 230 | </span> |
231 | 231 | </p> |
232 | 232 | <?php if ($QST_system) { ?> |
233 | 233 | <p> |
234 | 234 | <span class="description" style="color:#D54E21;"> |
235 | 235 | <?php printf( |
236 | - esc_html__( |
|
237 | - 'System question! The maximum number of characters that can be used for this question is %1$s', |
|
238 | - 'event_espresso' |
|
239 | - ), |
|
240 | - $max_max |
|
241 | - ); ?> |
|
236 | + esc_html__( |
|
237 | + 'System question! The maximum number of characters that can be used for this question is %1$s', |
|
238 | + 'event_espresso' |
|
239 | + ), |
|
240 | + $max_max |
|
241 | + ); ?> |
|
242 | 242 | </span> |
243 | 243 | </p> |
244 | 244 | <?php } ?> |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | <th class="option-desc-header"> |
264 | 264 | <label> |
265 | 265 | <?php esc_html_e( |
266 | - 'Description (optional, only shown on registration form)', |
|
267 | - 'event_espresso' |
|
268 | - ) ?> |
|
266 | + 'Description (optional, only shown on registration form)', |
|
267 | + 'event_espresso' |
|
268 | + ) ?> |
|
269 | 269 | </label> |
270 | 270 | </th> |
271 | 271 | <th> |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | </a> |
309 | 309 | <a class="button button--icon-only sortable-drag-handle ee-aria-tooltip" |
310 | 310 | aria-label="<?php esc_html_e( |
311 | - 'click and drag to change the order of this option', |
|
312 | - 'event_espresso' |
|
313 | - ) ?>" |
|
311 | + 'click and drag to change the order of this option', |
|
312 | + 'event_espresso' |
|
313 | + ) ?>" |
|
314 | 314 | > |
315 | 315 | <span class='dashicons dashicons-image-flip-vertical '></span> |
316 | 316 | </a> |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | </tr> |
319 | 319 | |
320 | 320 | <?php |
321 | - $count = 0; |
|
322 | - $question_options = $question->options(); |
|
323 | - if (! empty($question_options)) { |
|
324 | - foreach ($question_options as $option_id => $option) { |
|
325 | - $disabled_attr = $has_answers || $option->get('QSO_system') |
|
326 | - ? 'disabled' |
|
327 | - : ''; |
|
328 | - ?> |
|
321 | + $count = 0; |
|
322 | + $question_options = $question->options(); |
|
323 | + if (! empty($question_options)) { |
|
324 | + foreach ($question_options as $option_id => $option) { |
|
325 | + $disabled_attr = $has_answers || $option->get('QSO_system') |
|
326 | + ? 'disabled' |
|
327 | + : ''; |
|
328 | + ?> |
|
329 | 329 | <tr class="question-option ee-options-sortable"> |
330 | 330 | <td class="option-value-cell"> |
331 | 331 | <label class='screen-reader-text' |
@@ -375,29 +375,29 @@ discard block |
||
375 | 375 | <?php } ?> |
376 | 376 | <a class='button button--icon-only sortable-drag-handle ee-aria-tooltip' |
377 | 377 | aria-label="<?php esc_html_e( |
378 | - 'click and drag to change the order of this option', |
|
379 | - 'event_espresso' |
|
380 | - ) ?>" |
|
378 | + 'click and drag to change the order of this option', |
|
379 | + 'event_espresso' |
|
380 | + ) ?>" |
|
381 | 381 | > |
382 | 382 | <span class='dashicons dashicons-image-flip-vertical '></span> |
383 | 383 | </a> |
384 | 384 | <?php |
385 | - echo EEH_Form_Fields::hidden_input( |
|
386 | - "question_options[{$count}][QST_ID])", |
|
387 | - $option->question_ID() |
|
388 | - ); // already escaped |
|
389 | - echo EEH_Form_Fields::hidden_input( |
|
390 | - "question_options[{$count}][QSO_ID])", |
|
391 | - $option->ID() |
|
392 | - ); // already escaped |
|
393 | - $count++; |
|
394 | - ?> |
|
385 | + echo EEH_Form_Fields::hidden_input( |
|
386 | + "question_options[{$count}][QST_ID])", |
|
387 | + $option->question_ID() |
|
388 | + ); // already escaped |
|
389 | + echo EEH_Form_Fields::hidden_input( |
|
390 | + "question_options[{$count}][QSO_ID])", |
|
391 | + $option->ID() |
|
392 | + ); // already escaped |
|
393 | + $count++; |
|
394 | + ?> |
|
395 | 395 | </td> |
396 | 396 | </tr> |
397 | 397 | <?php |
398 | - } |
|
399 | - } else { |
|
400 | - ?> |
|
398 | + } |
|
399 | + } else { |
|
400 | + ?> |
|
401 | 401 | <tr class="question-option ee-options-sortable"> |
402 | 402 | <td class="option-value-cell"> |
403 | 403 | <input type="text" |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | </td> |
422 | 422 | </tr> |
423 | 423 | <?php |
424 | - } |
|
425 | - ?> |
|
424 | + } |
|
425 | + ?> |
|
426 | 426 | </tbody> |
427 | 427 | </table> |
428 | 428 | <div class="ee-admin-button-row"> |
@@ -430,24 +430,24 @@ discard block |
||
430 | 430 | <?php esc_html_e('Add Another Answer Option', 'event_espresso') ?> |
431 | 431 | </a> |
432 | 432 | <?php echo EEH_Form_Fields::hidden_input( |
433 | - 'question_options_count', |
|
434 | - $count |
|
435 | - ); // already escaped ?> |
|
433 | + 'question_options_count', |
|
434 | + $count |
|
435 | + ); // already escaped ?> |
|
436 | 436 | </div> |
437 | 437 | <br /> |
438 | 438 | |
439 | 439 | <p class="description"> |
440 | 440 | <?php esc_html_e( |
441 | - 'Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', |
|
442 | - 'event_espresso' |
|
443 | - ) ?> |
|
441 | + 'Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', |
|
442 | + 'event_espresso' |
|
443 | + ) ?> |
|
444 | 444 | </p> |
445 | 445 | <?php if ($has_answers) : ?> |
446 | 446 | <p class="description" style="color:#D54E21;"> |
447 | 447 | <?php esc_html_e( |
448 | - 'Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', |
|
449 | - 'event_espresso' |
|
450 | - ); ?> |
|
448 | + 'Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', |
|
449 | + 'event_espresso' |
|
450 | + ); ?> |
|
451 | 451 | </p> |
452 | 452 | <?php endif; ?> |
453 | 453 | </td> |
@@ -462,38 +462,38 @@ discard block |
||
462 | 462 | </th> |
463 | 463 | <td> |
464 | 464 | <?php |
465 | - $system_required = ['fname', 'email']; |
|
466 | - $disabled_attr = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
467 | - $required_on = $question->get('QST_admin_only'); |
|
468 | - $show_required_msg = $required_on ? '' : ' display:none;'; |
|
469 | - $disabled_attr = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : ''; |
|
470 | - $id = |
|
471 | - ! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
472 | - $requiredOptions = [ |
|
473 | - ['text' => esc_html__('Optional', 'event_espresso'), 'id' => 0], |
|
474 | - ['text' => esc_html__('Required', 'event_espresso'), 'id' => 1], |
|
475 | - ]; |
|
476 | - echo EEH_Form_Fields::select_input( |
|
477 | - 'QST_required' . $id, |
|
478 | - $requiredOptions, |
|
479 | - $question->required(), |
|
480 | - 'id="QST_required' . $id . '"' . $disabled_attr, |
|
481 | - 'ee-input-width--small' |
|
482 | - ); // already escaped |
|
483 | - ?> |
|
465 | + $system_required = ['fname', 'email']; |
|
466 | + $disabled_attr = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
467 | + $required_on = $question->get('QST_admin_only'); |
|
468 | + $show_required_msg = $required_on ? '' : ' display:none;'; |
|
469 | + $disabled_attr = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : ''; |
|
470 | + $id = |
|
471 | + ! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
472 | + $requiredOptions = [ |
|
473 | + ['text' => esc_html__('Optional', 'event_espresso'), 'id' => 0], |
|
474 | + ['text' => esc_html__('Required', 'event_espresso'), 'id' => 1], |
|
475 | + ]; |
|
476 | + echo EEH_Form_Fields::select_input( |
|
477 | + 'QST_required' . $id, |
|
478 | + $requiredOptions, |
|
479 | + $question->required(), |
|
480 | + 'id="QST_required' . $id . '"' . $disabled_attr, |
|
481 | + 'ee-input-width--small' |
|
482 | + ); // already escaped |
|
483 | + ?> |
|
484 | 484 | <p id="required_toggled_on" class="description" |
485 | 485 | style="color:#D54E21;<?php echo esc_attr($show_required_msg); ?>" |
486 | 486 | > |
487 | 487 | <?php esc_html_e( |
488 | - 'Required is set to optional, and this field is disabled, because the question is Admin-Only.', |
|
489 | - 'event_espresso' |
|
490 | - ) ?> |
|
488 | + 'Required is set to optional, and this field is disabled, because the question is Admin-Only.', |
|
489 | + 'event_espresso' |
|
490 | + ) ?> |
|
491 | 491 | </p> |
492 | 492 | <p id="required_toggled_off" class="description" style="color:#D54E21; display: none;"> |
493 | 493 | <?php esc_html_e( |
494 | - 'Required option field is no longer disabled because the question is not Admin-Only', |
|
495 | - 'event_espresso' |
|
496 | - ) ?> |
|
494 | + 'Required option field is no longer disabled because the question is not Admin-Only', |
|
495 | + 'event_espresso' |
|
496 | + ) ?> |
|
497 | 497 | </p> |
498 | 498 | <?php if (! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?> |
499 | 499 | <input id="QST_required" |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | </td> |
528 | 528 | </tr> |
529 | 529 | <?php |
530 | - do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question); |
|
531 | - ?> |
|
530 | + do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question); |
|
531 | + ?> |
|
532 | 532 | </tbody> |
533 | 533 | </table> |
534 | 534 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | . esc_html__('Did you know...', 'event_espresso'), |
38 | 38 | '', |
39 | 39 | 'ee-status--info' |
40 | - ) . |
|
40 | + ). |
|
41 | 41 | EEH_HTML::p( |
42 | 42 | esc_html__( |
43 | 43 | 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.', |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | value="<?php echo esc_attr($question->get_f('QST_admin_label')); ?>" |
92 | 92 | <?php echo esc_attr($disabled_attr); ?> |
93 | 93 | /> |
94 | - <?php if (! empty($QST_system)) { ?> |
|
94 | + <?php if ( ! empty($QST_system)) { ?> |
|
95 | 95 | <input id='QST_admin_label' |
96 | 96 | name="QST_admin_label" |
97 | 97 | type="hidden" |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | /> |
100 | 100 | <?php } ?> |
101 | 101 | <br /> |
102 | - <?php if (! empty($QST_system)) { ?> |
|
102 | + <?php if ( ! empty($QST_system)) { ?> |
|
103 | 103 | <p class="description" style="color:#D54E21;"> |
104 | 104 | <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso') ?> |
105 | 105 | </p> |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | /> |
140 | 140 | <br /> |
141 | 141 | <?php |
142 | - if (! empty($QST_system)) { ?> |
|
142 | + if ( ! empty($QST_system)) { ?> |
|
143 | 143 | <p class="description" style="color:#D54E21;"> |
144 | 144 | <?php esc_html_e( |
145 | 145 | 'System question! This field cannot be changed.', |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | |
171 | 171 | // Only display Confirm email for |
172 | 172 | if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) { |
173 | - unset($question_types[ EEM_Question::QST_type_email_confirm ]); |
|
173 | + unset($question_types[EEM_Question::QST_type_email_confirm]); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | echo EEH_Form_Fields::select_input( |
177 | - 'QST_type' . $id, |
|
177 | + 'QST_type'.$id, |
|
178 | 178 | $question_types, |
179 | 179 | $question->type(), |
180 | - 'id="QST_type' . $id . '"' . $disabled_attr |
|
180 | + 'id="QST_type'.$id.'"'.$disabled_attr |
|
181 | 181 | ); // already escaped |
182 | 182 | if ($disabled) { ?> |
183 | 183 | <input id='QST_type' |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | </th> |
215 | 215 | <td> |
216 | 216 | <input id="QST_max" |
217 | - <?php echo ($max_max === EE_INF ? '' : 'max="' . esc_attr($max_max) . '"'); ?> |
|
217 | + <?php echo ($max_max === EE_INF ? '' : 'max="'.esc_attr($max_max).'"'); ?> |
|
218 | 218 | min="1" |
219 | 219 | name="QST_max" |
220 | 220 | type="number" |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | <?php |
321 | 321 | $count = 0; |
322 | 322 | $question_options = $question->options(); |
323 | - if (! empty($question_options)) { |
|
323 | + if ( ! empty($question_options)) { |
|
324 | 324 | foreach ($question_options as $option_id => $option) { |
325 | 325 | $disabled_attr = $has_answers || $option->get('QSO_system') |
326 | 326 | ? 'disabled' |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | /> |
367 | 367 | </td> |
368 | 368 | <td> |
369 | - <?php if (! $option->system()) { ?> |
|
369 | + <?php if ( ! $option->system()) { ?> |
|
370 | 370 | <a class='button button--icon-only remove-option remove-item ee-aria-tooltip' |
371 | 371 | aria-label="<?php esc_html_e('click to delete this option', 'event_espresso') ?>" |
372 | 372 | > |
@@ -474,10 +474,10 @@ discard block |
||
474 | 474 | ['text' => esc_html__('Required', 'event_espresso'), 'id' => 1], |
475 | 475 | ]; |
476 | 476 | echo EEH_Form_Fields::select_input( |
477 | - 'QST_required' . $id, |
|
477 | + 'QST_required'.$id, |
|
478 | 478 | $requiredOptions, |
479 | 479 | $question->required(), |
480 | - 'id="QST_required' . $id . '"' . $disabled_attr, |
|
480 | + 'id="QST_required'.$id.'"'.$disabled_attr, |
|
481 | 481 | 'ee-input-width--small' |
482 | 482 | ); // already escaped |
483 | 483 | ?> |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | 'event_espresso' |
496 | 496 | ) ?> |
497 | 497 | </p> |
498 | - <?php if (! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?> |
|
498 | + <?php if ( ! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?> |
|
499 | 499 | <input id="QST_required" |
500 | 500 | name="QST_required" |
501 | 501 | type='hidden' |
@@ -20,1422 +20,1422 @@ |
||
20 | 20 | class General_Settings_Admin_Page extends EE_Admin_Page |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var EE_Core_Config |
|
25 | - */ |
|
26 | - public $core_config; |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * Initialize basic properties. |
|
31 | - */ |
|
32 | - protected function _init_page_props() |
|
33 | - { |
|
34 | - $this->page_slug = GEN_SET_PG_SLUG; |
|
35 | - $this->page_label = GEN_SET_LABEL; |
|
36 | - $this->_admin_base_url = GEN_SET_ADMIN_URL; |
|
37 | - $this->_admin_base_path = GEN_SET_ADMIN; |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * Set ajax hooks |
|
43 | - */ |
|
44 | - protected function _ajax_hooks() |
|
45 | - { |
|
46 | - add_action('wp_ajax_espresso_display_country_settings', [$this, 'display_country_settings']); |
|
47 | - add_action('wp_ajax_espresso_display_country_states', [$this, 'display_country_states']); |
|
48 | - add_action('wp_ajax_espresso_delete_state', [$this, 'delete_state'], 10, 3); |
|
49 | - add_action('wp_ajax_espresso_add_new_state', [$this, 'add_new_state']); |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * More page properties initialization. |
|
55 | - */ |
|
56 | - protected function _define_page_props() |
|
57 | - { |
|
58 | - $this->_admin_page_title = GEN_SET_LABEL; |
|
59 | - $this->_labels = ['publishbox' => esc_html__('Update Settings', 'event_espresso')]; |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * Set page routes property. |
|
65 | - */ |
|
66 | - protected function _set_page_routes() |
|
67 | - { |
|
68 | - $this->_page_routes = [ |
|
69 | - 'critical_pages' => [ |
|
70 | - 'func' => '_espresso_page_settings', |
|
71 | - 'capability' => 'manage_options', |
|
72 | - ], |
|
73 | - 'update_espresso_page_settings' => [ |
|
74 | - 'func' => '_update_espresso_page_settings', |
|
75 | - 'capability' => 'manage_options', |
|
76 | - 'noheader' => true, |
|
77 | - ], |
|
78 | - 'default' => [ |
|
79 | - 'func' => '_your_organization_settings', |
|
80 | - 'capability' => 'manage_options', |
|
81 | - ], |
|
82 | - |
|
83 | - 'update_your_organization_settings' => [ |
|
84 | - 'func' => '_update_your_organization_settings', |
|
85 | - 'capability' => 'manage_options', |
|
86 | - 'noheader' => true, |
|
87 | - ], |
|
88 | - |
|
89 | - 'admin_option_settings' => [ |
|
90 | - 'func' => '_admin_option_settings', |
|
91 | - 'capability' => 'manage_options', |
|
92 | - ], |
|
93 | - |
|
94 | - 'update_admin_option_settings' => [ |
|
95 | - 'func' => '_update_admin_option_settings', |
|
96 | - 'capability' => 'manage_options', |
|
97 | - 'noheader' => true, |
|
98 | - ], |
|
99 | - |
|
100 | - 'country_settings' => [ |
|
101 | - 'func' => '_country_settings', |
|
102 | - 'capability' => 'manage_options', |
|
103 | - ], |
|
104 | - |
|
105 | - 'update_country_settings' => [ |
|
106 | - 'func' => '_update_country_settings', |
|
107 | - 'capability' => 'manage_options', |
|
108 | - 'noheader' => true, |
|
109 | - ], |
|
110 | - |
|
111 | - 'display_country_settings' => [ |
|
112 | - 'func' => 'display_country_settings', |
|
113 | - 'capability' => 'manage_options', |
|
114 | - 'noheader' => true, |
|
115 | - ], |
|
116 | - |
|
117 | - 'add_new_state' => [ |
|
118 | - 'func' => 'add_new_state', |
|
119 | - 'capability' => 'manage_options', |
|
120 | - 'noheader' => true, |
|
121 | - ], |
|
122 | - |
|
123 | - 'delete_state' => [ |
|
124 | - 'func' => 'delete_state', |
|
125 | - 'capability' => 'manage_options', |
|
126 | - 'noheader' => true, |
|
127 | - ], |
|
128 | - 'privacy_settings' => [ |
|
129 | - 'func' => 'privacySettings', |
|
130 | - 'capability' => 'manage_options', |
|
131 | - ], |
|
132 | - 'update_privacy_settings' => [ |
|
133 | - 'func' => 'updatePrivacySettings', |
|
134 | - 'capability' => 'manage_options', |
|
135 | - 'noheader' => true, |
|
136 | - 'headers_sent_route' => 'privacy_settings', |
|
137 | - ], |
|
138 | - ]; |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - /** |
|
143 | - * Set page configuration property |
|
144 | - */ |
|
145 | - protected function _set_page_config() |
|
146 | - { |
|
147 | - $this->_page_config = [ |
|
148 | - 'critical_pages' => [ |
|
149 | - 'nav' => [ |
|
150 | - 'label' => esc_html__('Critical Pages', 'event_espresso'), |
|
151 | - 'order' => 50, |
|
152 | - ], |
|
153 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
154 | - 'help_tabs' => [ |
|
155 | - 'general_settings_critical_pages_help_tab' => [ |
|
156 | - 'title' => esc_html__('Critical Pages', 'event_espresso'), |
|
157 | - 'filename' => 'general_settings_critical_pages', |
|
158 | - ], |
|
159 | - ], |
|
160 | - 'require_nonce' => false, |
|
161 | - ], |
|
162 | - 'default' => [ |
|
163 | - 'nav' => [ |
|
164 | - 'label' => esc_html__('Your Organization', 'event_espresso'), |
|
165 | - 'order' => 20, |
|
166 | - ], |
|
167 | - 'help_tabs' => [ |
|
168 | - 'general_settings_your_organization_help_tab' => [ |
|
169 | - 'title' => esc_html__('Your Organization', 'event_espresso'), |
|
170 | - 'filename' => 'general_settings_your_organization', |
|
171 | - ], |
|
172 | - ], |
|
173 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
174 | - 'require_nonce' => false, |
|
175 | - ], |
|
176 | - 'admin_option_settings' => [ |
|
177 | - 'nav' => [ |
|
178 | - 'label' => esc_html__('Admin Options', 'event_espresso'), |
|
179 | - 'order' => 60, |
|
180 | - ], |
|
181 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
182 | - 'help_tabs' => [ |
|
183 | - 'general_settings_admin_options_help_tab' => [ |
|
184 | - 'title' => esc_html__('Admin Options', 'event_espresso'), |
|
185 | - 'filename' => 'general_settings_admin_options', |
|
186 | - ], |
|
187 | - ], |
|
188 | - 'require_nonce' => false, |
|
189 | - ], |
|
190 | - 'country_settings' => [ |
|
191 | - 'nav' => [ |
|
192 | - 'label' => esc_html__('Countries', 'event_espresso'), |
|
193 | - 'order' => 70, |
|
194 | - ], |
|
195 | - 'help_tabs' => [ |
|
196 | - 'general_settings_countries_help_tab' => [ |
|
197 | - 'title' => esc_html__('Countries', 'event_espresso'), |
|
198 | - 'filename' => 'general_settings_countries', |
|
199 | - ], |
|
200 | - ], |
|
201 | - 'require_nonce' => false, |
|
202 | - ], |
|
203 | - 'privacy_settings' => [ |
|
204 | - 'nav' => [ |
|
205 | - 'label' => esc_html__('Privacy', 'event_espresso'), |
|
206 | - 'order' => 80, |
|
207 | - ], |
|
208 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
209 | - 'require_nonce' => false, |
|
210 | - ], |
|
211 | - ]; |
|
212 | - } |
|
213 | - |
|
214 | - |
|
215 | - protected function _add_screen_options() |
|
216 | - { |
|
217 | - } |
|
218 | - |
|
219 | - |
|
220 | - protected function _add_feature_pointers() |
|
221 | - { |
|
222 | - } |
|
223 | - |
|
224 | - |
|
225 | - /** |
|
226 | - * Enqueue global scripts and styles for all routes in the General Settings Admin Pages. |
|
227 | - */ |
|
228 | - public function load_scripts_styles() |
|
229 | - { |
|
230 | - // styles |
|
231 | - wp_enqueue_style('espresso-ui-theme'); |
|
232 | - // scripts |
|
233 | - wp_enqueue_script('ee_admin_js'); |
|
234 | - } |
|
235 | - |
|
236 | - |
|
237 | - /** |
|
238 | - * Execute logic running on `admin_init` |
|
239 | - */ |
|
240 | - public function admin_init() |
|
241 | - { |
|
242 | - $this->core_config = EE_Registry::instance()->CFG->core; |
|
243 | - |
|
244 | - EE_Registry::$i18n_js_strings['invalid_server_response'] = wp_strip_all_tags( |
|
245 | - esc_html__( |
|
246 | - 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', |
|
247 | - 'event_espresso' |
|
248 | - ) |
|
249 | - ); |
|
250 | - EE_Registry::$i18n_js_strings['error_occurred'] = wp_strip_all_tags( |
|
251 | - esc_html__( |
|
252 | - 'An error occurred! Please refresh the page and try again.', |
|
253 | - 'event_espresso' |
|
254 | - ) |
|
255 | - ); |
|
256 | - EE_Registry::$i18n_js_strings['confirm_delete_state'] = wp_strip_all_tags( |
|
257 | - esc_html__( |
|
258 | - 'Are you sure you want to delete this State / Province?', |
|
259 | - 'event_espresso' |
|
260 | - ) |
|
261 | - ); |
|
262 | - EE_Registry::$i18n_js_strings['ajax_url'] = admin_url( |
|
263 | - 'admin-ajax.php?page=espresso_general_settings', |
|
264 | - is_ssl() ? 'https://' : 'http://' |
|
265 | - ); |
|
266 | - } |
|
267 | - |
|
268 | - |
|
269 | - public function admin_notices() |
|
270 | - { |
|
271 | - } |
|
272 | - |
|
273 | - |
|
274 | - public function admin_footer_scripts() |
|
275 | - { |
|
276 | - } |
|
277 | - |
|
278 | - |
|
279 | - /** |
|
280 | - * Enqueue scripts and styles for the default route. |
|
281 | - */ |
|
282 | - public function load_scripts_styles_default() |
|
283 | - { |
|
284 | - // styles |
|
285 | - wp_enqueue_style('thickbox'); |
|
286 | - // scripts |
|
287 | - wp_enqueue_script('media-upload'); |
|
288 | - wp_enqueue_script('thickbox'); |
|
289 | - wp_register_script( |
|
290 | - 'organization_settings', |
|
291 | - GEN_SET_ASSETS_URL . 'your_organization_settings.js', |
|
292 | - ['jquery', 'media-upload', 'thickbox'], |
|
293 | - EVENT_ESPRESSO_VERSION, |
|
294 | - true |
|
295 | - ); |
|
296 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
297 | - wp_enqueue_script('organization_settings'); |
|
298 | - wp_enqueue_style('organization-css'); |
|
299 | - $confirm_image_delete = [ |
|
300 | - 'text' => wp_strip_all_tags( |
|
301 | - esc_html__( |
|
302 | - 'Do you really want to delete this image? Please remember to save your settings to complete the removal.', |
|
303 | - 'event_espresso' |
|
304 | - ) |
|
305 | - ), |
|
306 | - ]; |
|
307 | - wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
308 | - } |
|
309 | - |
|
310 | - |
|
311 | - /** |
|
312 | - * Enqueue scripts and styles for the country settings route. |
|
313 | - */ |
|
314 | - public function load_scripts_styles_country_settings() |
|
315 | - { |
|
316 | - // scripts |
|
317 | - wp_register_script( |
|
318 | - 'gen_settings_countries', |
|
319 | - GEN_SET_ASSETS_URL . 'gen_settings_countries.js', |
|
320 | - ['ee_admin_js'], |
|
321 | - EVENT_ESPRESSO_VERSION, |
|
322 | - true |
|
323 | - ); |
|
324 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
325 | - wp_enqueue_script('gen_settings_countries'); |
|
326 | - wp_enqueue_style('organization-css'); |
|
327 | - } |
|
328 | - |
|
329 | - |
|
330 | - /************* Espresso Pages *************/ |
|
331 | - /** |
|
332 | - * _espresso_page_settings |
|
333 | - * |
|
334 | - * @throws EE_Error |
|
335 | - * @throws DomainException |
|
336 | - * @throws DomainException |
|
337 | - * @throws InvalidDataTypeException |
|
338 | - * @throws InvalidArgumentException |
|
339 | - */ |
|
340 | - protected function _espresso_page_settings() |
|
341 | - { |
|
342 | - // Check to make sure all of the main pages are set up properly, |
|
343 | - // if not create the default pages and display an admin notice |
|
344 | - EEH_Activation::verify_default_pages_exist(); |
|
345 | - $this->_transient_garbage_collection(); |
|
346 | - |
|
347 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
348 | - |
|
349 | - $this->_template_args['reg_page_id'] = $this->core_config->reg_page_id ?? null; |
|
350 | - $this->_template_args['reg_page_obj'] = isset($this->core_config->reg_page_id) |
|
351 | - ? get_post($this->core_config->reg_page_id) |
|
352 | - : false; |
|
353 | - |
|
354 | - $this->_template_args['txn_page_id'] = $this->core_config->txn_page_id ?? null; |
|
355 | - $this->_template_args['txn_page_obj'] = isset($this->core_config->txn_page_id) |
|
356 | - ? get_post($this->core_config->txn_page_id) |
|
357 | - : false; |
|
358 | - |
|
359 | - $this->_template_args['thank_you_page_id'] = $this->core_config->thank_you_page_id ?? null; |
|
360 | - $this->_template_args['thank_you_page_obj'] = isset($this->core_config->thank_you_page_id) |
|
361 | - ? get_post($this->core_config->thank_you_page_id) |
|
362 | - : false; |
|
363 | - |
|
364 | - $this->_template_args['cancel_page_id'] = $this->core_config->cancel_page_id ?? null; |
|
365 | - $this->_template_args['cancel_page_obj'] = isset($this->core_config->cancel_page_id) |
|
366 | - ? get_post($this->core_config->cancel_page_id) |
|
367 | - : false; |
|
368 | - |
|
369 | - $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
370 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
371 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
372 | - GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', |
|
373 | - $this->_template_args, |
|
374 | - true |
|
375 | - ); |
|
376 | - $this->display_admin_page_with_sidebar(); |
|
377 | - } |
|
378 | - |
|
379 | - |
|
380 | - /** |
|
381 | - * Handler for updating espresso page settings. |
|
382 | - * |
|
383 | - * @throws EE_Error |
|
384 | - */ |
|
385 | - protected function _update_espresso_page_settings() |
|
386 | - { |
|
387 | - // capture incoming request data && set page IDs |
|
388 | - $this->core_config->reg_page_id = $this->request->getRequestParam( |
|
389 | - 'reg_page_id', |
|
390 | - $this->core_config->reg_page_id, |
|
391 | - DataType::INT |
|
392 | - ); |
|
393 | - $this->core_config->txn_page_id = $this->request->getRequestParam( |
|
394 | - 'txn_page_id', |
|
395 | - $this->core_config->txn_page_id, |
|
396 | - DataType::INT |
|
397 | - ); |
|
398 | - $this->core_config->thank_you_page_id = $this->request->getRequestParam( |
|
399 | - 'thank_you_page_id', |
|
400 | - $this->core_config->thank_you_page_id, |
|
401 | - DataType::INT |
|
402 | - ); |
|
403 | - $this->core_config->cancel_page_id = $this->request->getRequestParam( |
|
404 | - 'cancel_page_id', |
|
405 | - $this->core_config->cancel_page_id, |
|
406 | - DataType::INT |
|
407 | - ); |
|
408 | - |
|
409 | - $this->core_config = apply_filters( |
|
410 | - 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', |
|
411 | - $this->core_config, |
|
412 | - $this->request->requestParams() |
|
413 | - ); |
|
414 | - |
|
415 | - $what = esc_html__('Critical Pages & Shortcodes', 'event_espresso'); |
|
416 | - $this->_redirect_after_action( |
|
417 | - $this->_update_espresso_configuration( |
|
418 | - $what, |
|
419 | - $this->core_config, |
|
420 | - __FILE__, |
|
421 | - __FUNCTION__, |
|
422 | - __LINE__ |
|
423 | - ), |
|
424 | - $what, |
|
425 | - '', |
|
426 | - [ |
|
427 | - 'action' => 'critical_pages', |
|
428 | - ], |
|
429 | - true |
|
430 | - ); |
|
431 | - } |
|
432 | - |
|
433 | - |
|
434 | - /************* Your Organization *************/ |
|
435 | - |
|
436 | - |
|
437 | - /** |
|
438 | - * @throws DomainException |
|
439 | - * @throws EE_Error |
|
440 | - * @throws InvalidArgumentException |
|
441 | - * @throws InvalidDataTypeException |
|
442 | - * @throws InvalidInterfaceException |
|
443 | - */ |
|
444 | - protected function _your_organization_settings() |
|
445 | - { |
|
446 | - $this->_template_args['admin_page_content'] = ''; |
|
447 | - try { |
|
448 | - /** @var OrganizationSettings $organization_settings_form */ |
|
449 | - $organization_settings_form = $this->loader->getShared(OrganizationSettings::class); |
|
450 | - |
|
451 | - $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
452 | - $organization_settings_form->display(), |
|
453 | - '', |
|
454 | - 'padding' |
|
455 | - ); |
|
456 | - } catch (Exception $e) { |
|
457 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
458 | - } |
|
459 | - $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
460 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
461 | - $this->display_admin_page_with_sidebar(); |
|
462 | - } |
|
463 | - |
|
464 | - |
|
465 | - /** |
|
466 | - * Handler for updating organization settings. |
|
467 | - * |
|
468 | - * @throws EE_Error |
|
469 | - */ |
|
470 | - protected function _update_your_organization_settings() |
|
471 | - { |
|
472 | - try { |
|
473 | - /** @var OrganizationSettings $organization_settings_form */ |
|
474 | - $organization_settings_form = $this->loader->getShared(OrganizationSettings::class); |
|
475 | - |
|
476 | - $success = $organization_settings_form->process($this->request->requestParams()); |
|
477 | - |
|
478 | - EE_Registry::instance()->CFG = apply_filters( |
|
479 | - 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', |
|
480 | - EE_Registry::instance()->CFG |
|
481 | - ); |
|
482 | - } catch (Exception $e) { |
|
483 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
484 | - $success = false; |
|
485 | - } |
|
486 | - |
|
487 | - if ($success) { |
|
488 | - $success = $this->_update_espresso_configuration( |
|
489 | - esc_html__('Your Organization Settings', 'event_espresso'), |
|
490 | - EE_Registry::instance()->CFG, |
|
491 | - __FILE__, |
|
492 | - __FUNCTION__, |
|
493 | - __LINE__ |
|
494 | - ); |
|
495 | - } |
|
496 | - |
|
497 | - $this->_redirect_after_action($success, '', '', ['action' => 'default'], true); |
|
498 | - } |
|
499 | - |
|
500 | - |
|
501 | - |
|
502 | - /************* Admin Options *************/ |
|
503 | - |
|
504 | - |
|
505 | - /** |
|
506 | - * _admin_option_settings |
|
507 | - * |
|
508 | - * @throws EE_Error |
|
509 | - * @throws LogicException |
|
510 | - */ |
|
511 | - protected function _admin_option_settings() |
|
512 | - { |
|
513 | - $this->_template_args['admin_page_content'] = ''; |
|
514 | - try { |
|
515 | - $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
516 | - // still need this for the old school form in Extend_General_Settings_Admin_Page |
|
517 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
518 | - // also need to account for the do_action that was in the old template |
|
519 | - $admin_options_settings_form->setTemplateArgs($this->_template_args); |
|
520 | - $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
521 | - $admin_options_settings_form->display(), |
|
522 | - '', |
|
523 | - 'padding' |
|
524 | - ); |
|
525 | - } catch (Exception $e) { |
|
526 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
527 | - } |
|
528 | - $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
529 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
530 | - $this->display_admin_page_with_sidebar(); |
|
531 | - } |
|
532 | - |
|
533 | - |
|
534 | - /** |
|
535 | - * _update_admin_option_settings |
|
536 | - * |
|
537 | - * @throws EE_Error |
|
538 | - * @throws InvalidDataTypeException |
|
539 | - * @throws InvalidFormSubmissionException |
|
540 | - * @throws InvalidArgumentException |
|
541 | - * @throws LogicException |
|
542 | - */ |
|
543 | - protected function _update_admin_option_settings() |
|
544 | - { |
|
545 | - try { |
|
546 | - $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
547 | - $admin_options_settings_form->process( |
|
548 | - $this->request->getRequestParam( |
|
549 | - $admin_options_settings_form->slug(), |
|
550 | - [], |
|
551 | - DataType::STRING, |
|
552 | - true |
|
553 | - ) |
|
554 | - ); |
|
555 | - EE_Registry::instance()->CFG->admin = apply_filters( |
|
556 | - 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
557 | - EE_Registry::instance()->CFG->admin |
|
558 | - ); |
|
559 | - } catch (Exception $e) { |
|
560 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
561 | - } |
|
562 | - $this->_redirect_after_action( |
|
563 | - apply_filters( |
|
564 | - 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', |
|
565 | - $this->_update_espresso_configuration( |
|
566 | - esc_html__('Admin Options', 'event_espresso'), |
|
567 | - EE_Registry::instance()->CFG->admin, |
|
568 | - __FILE__, |
|
569 | - __FUNCTION__, |
|
570 | - __LINE__ |
|
571 | - ) |
|
572 | - ), |
|
573 | - esc_html__('Admin Options', 'event_espresso'), |
|
574 | - 'updated', |
|
575 | - ['action' => 'admin_option_settings'] |
|
576 | - ); |
|
577 | - } |
|
578 | - |
|
579 | - |
|
580 | - /************* Countries *************/ |
|
581 | - |
|
582 | - |
|
583 | - /** |
|
584 | - * @param string|null $default |
|
585 | - * @return string |
|
586 | - */ |
|
587 | - protected function getCountryISO(?string $default = null): string |
|
588 | - { |
|
589 | - $default = $default ?? $this->getCountryIsoForSite(); |
|
590 | - $CNT_ISO = $this->request->getRequestParam('country', $default); |
|
591 | - return strtoupper($CNT_ISO); |
|
592 | - } |
|
593 | - |
|
594 | - |
|
595 | - /** |
|
596 | - * @return string |
|
597 | - */ |
|
598 | - protected function getCountryIsoForSite(): string |
|
599 | - { |
|
600 | - return ! empty(EE_Registry::instance()->CFG->organization->CNT_ISO) |
|
601 | - ? EE_Registry::instance()->CFG->organization->CNT_ISO |
|
602 | - : 'US'; |
|
603 | - } |
|
604 | - |
|
605 | - |
|
606 | - /** |
|
607 | - * @param string $CNT_ISO |
|
608 | - * @param EE_Country|null $country |
|
609 | - * @return EE_Base_Class|EE_Country |
|
610 | - * @throws EE_Error |
|
611 | - * @throws InvalidArgumentException |
|
612 | - * @throws InvalidDataTypeException |
|
613 | - * @throws InvalidInterfaceException |
|
614 | - * @throws ReflectionException |
|
615 | - */ |
|
616 | - protected function verifyOrGetCountryFromIso(string $CNT_ISO, ?EE_Country $country = null) |
|
617 | - { |
|
618 | - /** @var EE_Country $country */ |
|
619 | - return $country instanceof EE_Country && $country->ID() === $CNT_ISO |
|
620 | - ? $country |
|
621 | - : EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
622 | - } |
|
623 | - |
|
624 | - |
|
625 | - /** |
|
626 | - * Output Country Settings view. |
|
627 | - * |
|
628 | - * @throws DomainException |
|
629 | - * @throws EE_Error |
|
630 | - * @throws InvalidArgumentException |
|
631 | - * @throws InvalidDataTypeException |
|
632 | - * @throws InvalidInterfaceException |
|
633 | - * @throws ReflectionException |
|
634 | - */ |
|
635 | - protected function _country_settings() |
|
636 | - { |
|
637 | - $CNT_ISO = $this->getCountryISO(); |
|
638 | - |
|
639 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
640 | - $this->_template_args['countries'] = new EE_Question_Form_Input( |
|
641 | - EE_Question::new_instance( |
|
642 | - [ |
|
643 | - 'QST_ID' => 0, |
|
644 | - 'QST_display_text' => esc_html__('Select Country', 'event_espresso'), |
|
645 | - 'QST_system' => 'admin-country', |
|
646 | - ] |
|
647 | - ), |
|
648 | - EE_Answer::new_instance( |
|
649 | - [ |
|
650 | - 'ANS_ID' => 0, |
|
651 | - 'ANS_value' => $CNT_ISO, |
|
652 | - ] |
|
653 | - ), |
|
654 | - [ |
|
655 | - 'input_id' => 'country', |
|
656 | - 'input_name' => 'country', |
|
657 | - 'input_prefix' => '', |
|
658 | - 'append_qstn_id' => false, |
|
659 | - ] |
|
660 | - ); |
|
661 | - |
|
662 | - $country = $this->verifyOrGetCountryFromIso($CNT_ISO); |
|
663 | - add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10); |
|
664 | - add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10); |
|
665 | - $this->_template_args['country_details_settings'] = $this->display_country_settings( |
|
666 | - $country->ID(), |
|
667 | - $country |
|
668 | - ); |
|
669 | - $this->_template_args['country_states_settings'] = $this->display_country_states( |
|
670 | - $country->ID(), |
|
671 | - $country |
|
672 | - ); |
|
673 | - $this->_template_args['CNT_name_for_site'] = $country->name(); |
|
674 | - |
|
675 | - $this->_set_add_edit_form_tags('update_country_settings'); |
|
676 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
677 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
678 | - GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', |
|
679 | - $this->_template_args, |
|
680 | - true |
|
681 | - ); |
|
682 | - $this->display_admin_page_with_no_sidebar(); |
|
683 | - } |
|
684 | - |
|
685 | - |
|
686 | - /** |
|
687 | - * @param string $CNT_ISO |
|
688 | - * @param EE_Country|null $country |
|
689 | - * @return string |
|
690 | - * @throws DomainException |
|
691 | - * @throws EE_Error |
|
692 | - * @throws InvalidArgumentException |
|
693 | - * @throws InvalidDataTypeException |
|
694 | - * @throws InvalidInterfaceException |
|
695 | - * @throws ReflectionException |
|
696 | - */ |
|
697 | - public function display_country_settings(string $CNT_ISO = '', ?EE_Country $country = null): string |
|
698 | - { |
|
699 | - $CNT_ISO = $this->getCountryISO($CNT_ISO); |
|
700 | - $CNT_ISO_for_site = $this->getCountryIsoForSite(); |
|
701 | - |
|
702 | - if (! $CNT_ISO) { |
|
703 | - return ''; |
|
704 | - } |
|
705 | - |
|
706 | - // for ajax |
|
707 | - remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
708 | - remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
709 | - add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10, 2); |
|
710 | - add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10, 2); |
|
711 | - $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country); |
|
712 | - $CNT_cur_disabled = $CNT_ISO !== $CNT_ISO_for_site; |
|
713 | - $this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled; |
|
714 | - |
|
715 | - $country_input_types = [ |
|
716 | - 'CNT_active' => [ |
|
717 | - 'type' => 'RADIO_BTN', |
|
718 | - 'input_name' => "cntry[$CNT_ISO]", |
|
719 | - 'class' => '', |
|
720 | - 'options' => $this->_yes_no_values, |
|
721 | - 'use_desc_4_label' => true, |
|
722 | - ], |
|
723 | - 'CNT_ISO' => [ |
|
724 | - 'type' => 'TEXT', |
|
725 | - 'input_name' => "cntry[$CNT_ISO]", |
|
726 | - 'class' => 'ee-input-width--small', |
|
727 | - ], |
|
728 | - 'CNT_ISO3' => [ |
|
729 | - 'type' => 'TEXT', |
|
730 | - 'input_name' => "cntry[$CNT_ISO]", |
|
731 | - 'class' => 'ee-input-width--small', |
|
732 | - ], |
|
733 | - // 'RGN_ID' => [ |
|
734 | - // 'type' => 'TEXT', |
|
735 | - // 'input_name' => "cntry[$CNT_ISO]", |
|
736 | - // 'class' => 'ee-input-width--small', |
|
737 | - // ], |
|
738 | - 'CNT_name' => [ |
|
739 | - 'type' => 'TEXT', |
|
740 | - 'input_name' => "cntry[$CNT_ISO]", |
|
741 | - 'class' => 'ee-input-width--big', |
|
742 | - ], |
|
743 | - 'CNT_cur_code' => [ |
|
744 | - 'type' => 'TEXT', |
|
745 | - 'input_name' => "cntry[$CNT_ISO]", |
|
746 | - 'class' => 'ee-input-width--small', |
|
747 | - 'disabled' => $CNT_cur_disabled, |
|
748 | - ], |
|
749 | - 'CNT_cur_single' => [ |
|
750 | - 'type' => 'TEXT', |
|
751 | - 'input_name' => "cntry[$CNT_ISO]", |
|
752 | - 'class' => 'ee-input-width--reg', |
|
753 | - 'disabled' => $CNT_cur_disabled, |
|
754 | - ], |
|
755 | - 'CNT_cur_plural' => [ |
|
756 | - 'type' => 'TEXT', |
|
757 | - 'input_name' => "cntry[$CNT_ISO]", |
|
758 | - 'class' => 'ee-input-width--reg', |
|
759 | - 'disabled' => $CNT_cur_disabled, |
|
760 | - ], |
|
761 | - 'CNT_cur_sign' => [ |
|
762 | - 'type' => 'TEXT', |
|
763 | - 'input_name' => "cntry[$CNT_ISO]", |
|
764 | - 'class' => 'ee-input-width--small', |
|
765 | - 'htmlentities' => false, |
|
766 | - 'disabled' => $CNT_cur_disabled, |
|
767 | - ], |
|
768 | - 'CNT_cur_sign_b4' => [ |
|
769 | - 'type' => 'RADIO_BTN', |
|
770 | - 'input_name' => "cntry[$CNT_ISO]", |
|
771 | - 'class' => '', |
|
772 | - 'options' => $this->_yes_no_values, |
|
773 | - 'use_desc_4_label' => true, |
|
774 | - 'disabled' => $CNT_cur_disabled, |
|
775 | - ], |
|
776 | - 'CNT_cur_dec_plc' => [ |
|
777 | - 'type' => 'RADIO_BTN', |
|
778 | - 'input_name' => "cntry[$CNT_ISO]", |
|
779 | - 'class' => '', |
|
780 | - 'options' => [ |
|
781 | - ['id' => 0, 'text' => ''], |
|
782 | - ['id' => 1, 'text' => ''], |
|
783 | - ['id' => 2, 'text' => ''], |
|
784 | - ['id' => 3, 'text' => ''], |
|
785 | - ], |
|
786 | - 'disabled' => $CNT_cur_disabled, |
|
787 | - ], |
|
788 | - 'CNT_cur_dec_mrk' => [ |
|
789 | - 'type' => 'RADIO_BTN', |
|
790 | - 'input_name' => "cntry[$CNT_ISO]", |
|
791 | - 'class' => '', |
|
792 | - 'options' => [ |
|
793 | - [ |
|
794 | - 'id' => ',', |
|
795 | - 'text' => esc_html__(', (comma)', 'event_espresso'), |
|
796 | - ], |
|
797 | - ['id' => '.', 'text' => esc_html__('. (decimal)', 'event_espresso')], |
|
798 | - ], |
|
799 | - 'use_desc_4_label' => true, |
|
800 | - 'disabled' => $CNT_cur_disabled, |
|
801 | - ], |
|
802 | - 'CNT_cur_thsnds' => [ |
|
803 | - 'type' => 'RADIO_BTN', |
|
804 | - 'input_name' => "cntry[$CNT_ISO]", |
|
805 | - 'class' => '', |
|
806 | - 'options' => [ |
|
807 | - [ |
|
808 | - 'id' => ',', |
|
809 | - 'text' => esc_html__(', (comma)', 'event_espresso'), |
|
810 | - ], |
|
811 | - [ |
|
812 | - 'id' => '.', |
|
813 | - 'text' => esc_html__('. (decimal)', 'event_espresso'), |
|
814 | - ], |
|
815 | - [ |
|
816 | - 'id' => ' ', |
|
817 | - 'text' => esc_html__('(space)', 'event_espresso'), |
|
818 | - ], |
|
819 | - ], |
|
820 | - 'use_desc_4_label' => true, |
|
821 | - 'disabled' => $CNT_cur_disabled, |
|
822 | - ], |
|
823 | - 'CNT_tel_code' => [ |
|
824 | - 'type' => 'TEXT', |
|
825 | - 'input_name' => "cntry[$CNT_ISO]", |
|
826 | - 'class' => 'ee-input-width--small', |
|
827 | - ], |
|
828 | - 'CNT_is_EU' => [ |
|
829 | - 'type' => 'RADIO_BTN', |
|
830 | - 'input_name' => "cntry[$CNT_ISO]", |
|
831 | - 'class' => '', |
|
832 | - 'options' => $this->_yes_no_values, |
|
833 | - 'use_desc_4_label' => true, |
|
834 | - ], |
|
835 | - ]; |
|
836 | - $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( |
|
837 | - $country, |
|
838 | - $country_input_types |
|
839 | - ); |
|
840 | - $country_details_settings = EEH_Template::display_template( |
|
841 | - GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', |
|
842 | - $this->_template_args, |
|
843 | - true |
|
844 | - ); |
|
845 | - |
|
846 | - if (defined('DOING_AJAX')) { |
|
847 | - $notices = EE_Error::get_notices(false, false, false); |
|
848 | - echo wp_json_encode( |
|
849 | - [ |
|
850 | - 'return_data' => $country_details_settings, |
|
851 | - 'success' => $notices['success'], |
|
852 | - 'errors' => $notices['errors'], |
|
853 | - ] |
|
854 | - ); |
|
855 | - die(); |
|
856 | - } |
|
857 | - return $country_details_settings; |
|
858 | - } |
|
859 | - |
|
860 | - |
|
861 | - /** |
|
862 | - * @param string $CNT_ISO |
|
863 | - * @param EE_Country|null $country |
|
864 | - * @return string |
|
865 | - * @throws DomainException |
|
866 | - * @throws EE_Error |
|
867 | - * @throws InvalidArgumentException |
|
868 | - * @throws InvalidDataTypeException |
|
869 | - * @throws InvalidInterfaceException |
|
870 | - * @throws ReflectionException |
|
871 | - */ |
|
872 | - public function display_country_states(string $CNT_ISO = '', ?EE_Country $country = null): string |
|
873 | - { |
|
874 | - $CNT_ISO = $this->getCountryISO($CNT_ISO); |
|
875 | - if (! $CNT_ISO) { |
|
876 | - return ''; |
|
877 | - } |
|
878 | - // for ajax |
|
879 | - remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
880 | - remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
881 | - add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'state_form_field_label_wrap'], 10, 2); |
|
882 | - add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'state_form_field_input__wrap'], 10); |
|
883 | - $states = EEM_State::instance()->get_all_states_for_these_countries([$CNT_ISO => $CNT_ISO]); |
|
884 | - if (empty($states)) { |
|
885 | - /** @var EventEspresso\core\services\address\CountrySubRegionDao $countrySubRegionDao */ |
|
886 | - $countrySubRegionDao = $this->loader->getShared( |
|
887 | - 'EventEspresso\core\services\address\CountrySubRegionDao' |
|
888 | - ); |
|
889 | - if ($countrySubRegionDao instanceof EventEspresso\core\services\address\CountrySubRegionDao) { |
|
890 | - $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country); |
|
891 | - if ($countrySubRegionDao->saveCountrySubRegions($country)) { |
|
892 | - $states = EEM_State::instance()->get_all_states_for_these_countries([$CNT_ISO => $CNT_ISO]); |
|
893 | - } |
|
894 | - } |
|
895 | - } |
|
896 | - if (is_array($states)) { |
|
897 | - foreach ($states as $STA_ID => $state) { |
|
898 | - if ($state instanceof EE_State) { |
|
899 | - $inputs = EE_Question_Form_Input::generate_question_form_inputs_for_object( |
|
900 | - $state, |
|
901 | - [ |
|
902 | - 'STA_abbrev' => [ |
|
903 | - 'type' => 'TEXT', |
|
904 | - 'label' => esc_html__('Code', 'event_espresso'), |
|
905 | - 'input_name' => "states[$STA_ID]", |
|
906 | - 'class' => 'ee-input-width--tiny', |
|
907 | - 'add_mobile_label' => true, |
|
908 | - ], |
|
909 | - 'STA_name' => [ |
|
910 | - 'type' => 'TEXT', |
|
911 | - 'label' => esc_html__('Name', 'event_espresso'), |
|
912 | - 'input_name' => "states[$STA_ID]", |
|
913 | - 'class' => 'ee-input-width--big', |
|
914 | - 'add_mobile_label' => true, |
|
915 | - ], |
|
916 | - 'STA_active' => [ |
|
917 | - 'type' => 'RADIO_BTN', |
|
918 | - 'label' => esc_html__('State Appears in Dropdown Select Lists', 'event_espresso'), |
|
919 | - 'input_name' => "states[$STA_ID]", |
|
920 | - 'options' => $this->_yes_no_values, |
|
921 | - 'use_desc_4_label' => true, |
|
922 | - 'add_mobile_label' => true, |
|
923 | - ], |
|
924 | - ] |
|
925 | - ); |
|
926 | - |
|
927 | - $delete_state_url = EE_Admin_Page::add_query_args_and_nonce( |
|
928 | - [ |
|
929 | - 'action' => 'delete_state', |
|
930 | - 'STA_ID' => $STA_ID, |
|
931 | - 'CNT_ISO' => $CNT_ISO, |
|
932 | - 'STA_abbrev' => $state->abbrev(), |
|
933 | - ], |
|
934 | - GEN_SET_ADMIN_URL |
|
935 | - ); |
|
936 | - |
|
937 | - $this->_template_args['states'][$STA_ID]['inputs'] = $inputs; |
|
938 | - $this->_template_args['states'][$STA_ID]['delete_state_url'] = $delete_state_url; |
|
939 | - } |
|
940 | - } |
|
941 | - } else { |
|
942 | - $this->_template_args['states'] = false; |
|
943 | - } |
|
944 | - |
|
945 | - $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
946 | - ['action' => 'add_new_state'], |
|
947 | - GEN_SET_ADMIN_URL |
|
948 | - ); |
|
949 | - |
|
950 | - $state_details_settings = EEH_Template::display_template( |
|
951 | - GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', |
|
952 | - $this->_template_args, |
|
953 | - true |
|
954 | - ); |
|
955 | - |
|
956 | - if (defined('DOING_AJAX')) { |
|
957 | - $notices = EE_Error::get_notices(false, false, false); |
|
958 | - echo wp_json_encode( |
|
959 | - [ |
|
960 | - 'return_data' => $state_details_settings, |
|
961 | - 'success' => $notices['success'], |
|
962 | - 'errors' => $notices['errors'], |
|
963 | - ] |
|
964 | - ); |
|
965 | - die(); |
|
966 | - } |
|
967 | - return $state_details_settings; |
|
968 | - } |
|
969 | - |
|
970 | - |
|
971 | - /** |
|
972 | - * @return void |
|
973 | - * @throws EE_Error |
|
974 | - * @throws InvalidArgumentException |
|
975 | - * @throws InvalidDataTypeException |
|
976 | - * @throws InvalidInterfaceException |
|
977 | - * @throws ReflectionException |
|
978 | - */ |
|
979 | - public function add_new_state() |
|
980 | - { |
|
981 | - $success = true; |
|
982 | - $CNT_ISO = $this->getCountryISO(''); |
|
983 | - if (! $CNT_ISO) { |
|
984 | - EE_Error::add_error( |
|
985 | - esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
|
986 | - __FILE__, |
|
987 | - __FUNCTION__, |
|
988 | - __LINE__ |
|
989 | - ); |
|
990 | - $success = false; |
|
991 | - } |
|
992 | - $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
|
993 | - if (! $STA_abbrev) { |
|
994 | - EE_Error::add_error( |
|
995 | - esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), |
|
996 | - __FILE__, |
|
997 | - __FUNCTION__, |
|
998 | - __LINE__ |
|
999 | - ); |
|
1000 | - $success = false; |
|
1001 | - } |
|
1002 | - $STA_name = $this->request->getRequestParam('STA_name'); |
|
1003 | - if (! $STA_name) { |
|
1004 | - EE_Error::add_error( |
|
1005 | - esc_html__('No State name or an invalid State name was received.', 'event_espresso'), |
|
1006 | - __FILE__, |
|
1007 | - __FUNCTION__, |
|
1008 | - __LINE__ |
|
1009 | - ); |
|
1010 | - $success = false; |
|
1011 | - } |
|
1012 | - |
|
1013 | - if ($success) { |
|
1014 | - $cols_n_values = [ |
|
1015 | - 'CNT_ISO' => $CNT_ISO, |
|
1016 | - 'STA_abbrev' => $STA_abbrev, |
|
1017 | - 'STA_name' => $STA_name, |
|
1018 | - 'STA_active' => true, |
|
1019 | - ]; |
|
1020 | - $success = EEM_State::instance()->insert($cols_n_values); |
|
1021 | - EE_Error::add_success(esc_html__('The State was added successfully.', 'event_espresso')); |
|
1022 | - } |
|
1023 | - |
|
1024 | - if (defined('DOING_AJAX')) { |
|
1025 | - $notices = EE_Error::get_notices(false, false, false); |
|
1026 | - echo wp_json_encode(array_merge($notices, ['return_data' => $CNT_ISO])); |
|
1027 | - die(); |
|
1028 | - } |
|
1029 | - $this->_redirect_after_action( |
|
1030 | - $success, |
|
1031 | - esc_html__('State', 'event_espresso'), |
|
1032 | - 'added', |
|
1033 | - ['action' => 'country_settings'] |
|
1034 | - ); |
|
1035 | - } |
|
1036 | - |
|
1037 | - |
|
1038 | - /** |
|
1039 | - * @return void |
|
1040 | - * @throws EE_Error |
|
1041 | - * @throws InvalidArgumentException |
|
1042 | - * @throws InvalidDataTypeException |
|
1043 | - * @throws InvalidInterfaceException |
|
1044 | - * @throws ReflectionException |
|
1045 | - */ |
|
1046 | - public function delete_state() |
|
1047 | - { |
|
1048 | - $CNT_ISO = $this->getCountryISO(); |
|
1049 | - $STA_ID = $this->request->getRequestParam('STA_ID'); |
|
1050 | - $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
|
1051 | - |
|
1052 | - if (! $STA_ID) { |
|
1053 | - EE_Error::add_error( |
|
1054 | - esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'), |
|
1055 | - __FILE__, |
|
1056 | - __FUNCTION__, |
|
1057 | - __LINE__ |
|
1058 | - ); |
|
1059 | - return; |
|
1060 | - } |
|
1061 | - |
|
1062 | - $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
1063 | - if ($success !== false) { |
|
1064 | - do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', |
|
1065 | - $CNT_ISO, |
|
1066 | - $STA_ID, |
|
1067 | - ['STA_abbrev' => $STA_abbrev]); |
|
1068 | - EE_Error::add_success(esc_html__('The State was deleted successfully.', 'event_espresso')); |
|
1069 | - } |
|
1070 | - if (defined('DOING_AJAX')) { |
|
1071 | - $notices = EE_Error::get_notices(false); |
|
1072 | - $notices['return_data'] = true; |
|
1073 | - echo wp_json_encode($notices); |
|
1074 | - die(); |
|
1075 | - } |
|
1076 | - $this->_redirect_after_action( |
|
1077 | - $success, |
|
1078 | - esc_html__('State', 'event_espresso'), |
|
1079 | - 'deleted', |
|
1080 | - ['action' => 'country_settings'] |
|
1081 | - ); |
|
1082 | - } |
|
1083 | - |
|
1084 | - |
|
1085 | - /** |
|
1086 | - * @return void |
|
1087 | - * @throws EE_Error |
|
1088 | - * @throws InvalidArgumentException |
|
1089 | - * @throws InvalidDataTypeException |
|
1090 | - * @throws InvalidInterfaceException |
|
1091 | - * @throws ReflectionException |
|
1092 | - */ |
|
1093 | - protected function _update_country_settings() |
|
1094 | - { |
|
1095 | - $CNT_ISO = $this->getCountryISO(); |
|
1096 | - if (! $CNT_ISO) { |
|
1097 | - EE_Error::add_error( |
|
1098 | - esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
|
1099 | - __FILE__, |
|
1100 | - __FUNCTION__, |
|
1101 | - __LINE__ |
|
1102 | - ); |
|
1103 | - return; |
|
1104 | - } |
|
1105 | - |
|
1106 | - $country = $this->verifyOrGetCountryFromIso($CNT_ISO); |
|
1107 | - |
|
1108 | - $cols_n_values = []; |
|
1109 | - $cols_n_values['CNT_ISO3'] = strtoupper( |
|
1110 | - $this->request->getRequestParam('cntry', '', $country->ISO3()) |
|
1111 | - ); |
|
1112 | - $cols_n_values['CNT_name'] = |
|
1113 | - $this->request->getRequestParam("cntry[$CNT_ISO][CNT_name]", $country->name()); |
|
1114 | - $cols_n_values['CNT_cur_code'] = strtoupper( |
|
1115 | - $this->request->getRequestParam( |
|
1116 | - "cntry[$CNT_ISO][CNT_cur_code]", |
|
1117 | - $country->currency_code() |
|
1118 | - ) |
|
1119 | - ); |
|
1120 | - $cols_n_values['CNT_cur_single'] = $this->request->getRequestParam( |
|
1121 | - "cntry[$CNT_ISO][CNT_cur_single]", |
|
1122 | - $country->currency_name_single() |
|
1123 | - ); |
|
1124 | - $cols_n_values['CNT_cur_plural'] = $this->request->getRequestParam( |
|
1125 | - "cntry[$CNT_ISO][CNT_cur_plural]", |
|
1126 | - $country->currency_name_plural() |
|
1127 | - ); |
|
1128 | - $cols_n_values['CNT_cur_sign'] = $this->request->getRequestParam( |
|
1129 | - "cntry[$CNT_ISO][CNT_cur_sign]", |
|
1130 | - $country->currency_sign() |
|
1131 | - ); |
|
1132 | - $cols_n_values['CNT_cur_sign_b4'] = $this->request->getRequestParam( |
|
1133 | - "cntry[$CNT_ISO][CNT_cur_sign_b4]", |
|
1134 | - $country->currency_sign_before(), |
|
1135 | - DataType::BOOL |
|
1136 | - ); |
|
1137 | - $cols_n_values['CNT_cur_dec_plc'] = $this->request->getRequestParam( |
|
1138 | - "cntry[$CNT_ISO][CNT_cur_dec_plc]", |
|
1139 | - $country->currency_decimal_places() |
|
1140 | - ); |
|
1141 | - $cols_n_values['CNT_cur_dec_mrk'] = $this->request->getRequestParam( |
|
1142 | - "cntry[$CNT_ISO][CNT_cur_dec_mrk]", |
|
1143 | - $country->currency_decimal_mark() |
|
1144 | - ); |
|
1145 | - $cols_n_values['CNT_cur_thsnds'] = $this->request->getRequestParam( |
|
1146 | - "cntry[$CNT_ISO][CNT_cur_thsnds]", |
|
1147 | - $country->currency_thousands_separator() |
|
1148 | - ); |
|
1149 | - $cols_n_values['CNT_tel_code'] = $this->request->getRequestParam( |
|
1150 | - "cntry[$CNT_ISO][CNT_tel_code]", |
|
1151 | - $country->telephoneCode() |
|
1152 | - ); |
|
1153 | - $cols_n_values['CNT_active'] = $this->request->getRequestParam( |
|
1154 | - "cntry[$CNT_ISO][CNT_active]", |
|
1155 | - $country->isActive(), |
|
1156 | - DataType::BOOL |
|
1157 | - ); |
|
1158 | - |
|
1159 | - // allow filtering of country data |
|
1160 | - $cols_n_values = apply_filters( |
|
1161 | - 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', |
|
1162 | - $cols_n_values |
|
1163 | - ); |
|
1164 | - |
|
1165 | - // where values |
|
1166 | - $where_cols_n_values = [['CNT_ISO' => $CNT_ISO]]; |
|
1167 | - // run the update |
|
1168 | - $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
1169 | - |
|
1170 | - // allow filtering of states data |
|
1171 | - $states = apply_filters( |
|
1172 | - 'FHEE__General_Settings_Admin_Page___update_country_settings__states', |
|
1173 | - $this->request->getRequestParam('states', [], DataType::STRING, true) |
|
1174 | - ); |
|
1175 | - |
|
1176 | - if (! empty($states) && $success !== false) { |
|
1177 | - // loop thru state data ( looks like : states[75][STA_name] ) |
|
1178 | - foreach ($states as $STA_ID => $state) { |
|
1179 | - $cols_n_values = [ |
|
1180 | - 'CNT_ISO' => $CNT_ISO, |
|
1181 | - 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
1182 | - 'STA_name' => sanitize_text_field($state['STA_name']), |
|
1183 | - 'STA_active' => filter_var($state['STA_active'], FILTER_VALIDATE_BOOLEAN), |
|
1184 | - ]; |
|
1185 | - // where values |
|
1186 | - $where_cols_n_values = [['STA_ID' => $STA_ID]]; |
|
1187 | - // run the update |
|
1188 | - $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
1189 | - if ($success !== false) { |
|
1190 | - do_action( |
|
1191 | - 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', |
|
1192 | - $CNT_ISO, |
|
1193 | - $STA_ID, |
|
1194 | - $cols_n_values |
|
1195 | - ); |
|
1196 | - } |
|
1197 | - } |
|
1198 | - } |
|
1199 | - // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
|
1200 | - if ( |
|
1201 | - isset(EE_Registry::instance()->CFG->organization->CNT_ISO) |
|
1202 | - && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO |
|
1203 | - ) { |
|
1204 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
1205 | - EE_Registry::instance()->CFG->update_espresso_config(); |
|
1206 | - } |
|
1207 | - |
|
1208 | - if ($success !== false) { |
|
1209 | - EE_Error::add_success( |
|
1210 | - esc_html__('Country Settings updated successfully.', 'event_espresso') |
|
1211 | - ); |
|
1212 | - } |
|
1213 | - $this->_redirect_after_action( |
|
1214 | - $success, |
|
1215 | - '', |
|
1216 | - '', |
|
1217 | - ['action' => 'country_settings', 'country' => $CNT_ISO], |
|
1218 | - true |
|
1219 | - ); |
|
1220 | - } |
|
1221 | - |
|
1222 | - |
|
1223 | - /** |
|
1224 | - * form_form_field_label_wrap |
|
1225 | - * |
|
1226 | - * @param string $label |
|
1227 | - * @return string |
|
1228 | - */ |
|
1229 | - public function country_form_field_label_wrap(string $label): string |
|
1230 | - { |
|
1231 | - return ' |
|
23 | + /** |
|
24 | + * @var EE_Core_Config |
|
25 | + */ |
|
26 | + public $core_config; |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * Initialize basic properties. |
|
31 | + */ |
|
32 | + protected function _init_page_props() |
|
33 | + { |
|
34 | + $this->page_slug = GEN_SET_PG_SLUG; |
|
35 | + $this->page_label = GEN_SET_LABEL; |
|
36 | + $this->_admin_base_url = GEN_SET_ADMIN_URL; |
|
37 | + $this->_admin_base_path = GEN_SET_ADMIN; |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * Set ajax hooks |
|
43 | + */ |
|
44 | + protected function _ajax_hooks() |
|
45 | + { |
|
46 | + add_action('wp_ajax_espresso_display_country_settings', [$this, 'display_country_settings']); |
|
47 | + add_action('wp_ajax_espresso_display_country_states', [$this, 'display_country_states']); |
|
48 | + add_action('wp_ajax_espresso_delete_state', [$this, 'delete_state'], 10, 3); |
|
49 | + add_action('wp_ajax_espresso_add_new_state', [$this, 'add_new_state']); |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * More page properties initialization. |
|
55 | + */ |
|
56 | + protected function _define_page_props() |
|
57 | + { |
|
58 | + $this->_admin_page_title = GEN_SET_LABEL; |
|
59 | + $this->_labels = ['publishbox' => esc_html__('Update Settings', 'event_espresso')]; |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * Set page routes property. |
|
65 | + */ |
|
66 | + protected function _set_page_routes() |
|
67 | + { |
|
68 | + $this->_page_routes = [ |
|
69 | + 'critical_pages' => [ |
|
70 | + 'func' => '_espresso_page_settings', |
|
71 | + 'capability' => 'manage_options', |
|
72 | + ], |
|
73 | + 'update_espresso_page_settings' => [ |
|
74 | + 'func' => '_update_espresso_page_settings', |
|
75 | + 'capability' => 'manage_options', |
|
76 | + 'noheader' => true, |
|
77 | + ], |
|
78 | + 'default' => [ |
|
79 | + 'func' => '_your_organization_settings', |
|
80 | + 'capability' => 'manage_options', |
|
81 | + ], |
|
82 | + |
|
83 | + 'update_your_organization_settings' => [ |
|
84 | + 'func' => '_update_your_organization_settings', |
|
85 | + 'capability' => 'manage_options', |
|
86 | + 'noheader' => true, |
|
87 | + ], |
|
88 | + |
|
89 | + 'admin_option_settings' => [ |
|
90 | + 'func' => '_admin_option_settings', |
|
91 | + 'capability' => 'manage_options', |
|
92 | + ], |
|
93 | + |
|
94 | + 'update_admin_option_settings' => [ |
|
95 | + 'func' => '_update_admin_option_settings', |
|
96 | + 'capability' => 'manage_options', |
|
97 | + 'noheader' => true, |
|
98 | + ], |
|
99 | + |
|
100 | + 'country_settings' => [ |
|
101 | + 'func' => '_country_settings', |
|
102 | + 'capability' => 'manage_options', |
|
103 | + ], |
|
104 | + |
|
105 | + 'update_country_settings' => [ |
|
106 | + 'func' => '_update_country_settings', |
|
107 | + 'capability' => 'manage_options', |
|
108 | + 'noheader' => true, |
|
109 | + ], |
|
110 | + |
|
111 | + 'display_country_settings' => [ |
|
112 | + 'func' => 'display_country_settings', |
|
113 | + 'capability' => 'manage_options', |
|
114 | + 'noheader' => true, |
|
115 | + ], |
|
116 | + |
|
117 | + 'add_new_state' => [ |
|
118 | + 'func' => 'add_new_state', |
|
119 | + 'capability' => 'manage_options', |
|
120 | + 'noheader' => true, |
|
121 | + ], |
|
122 | + |
|
123 | + 'delete_state' => [ |
|
124 | + 'func' => 'delete_state', |
|
125 | + 'capability' => 'manage_options', |
|
126 | + 'noheader' => true, |
|
127 | + ], |
|
128 | + 'privacy_settings' => [ |
|
129 | + 'func' => 'privacySettings', |
|
130 | + 'capability' => 'manage_options', |
|
131 | + ], |
|
132 | + 'update_privacy_settings' => [ |
|
133 | + 'func' => 'updatePrivacySettings', |
|
134 | + 'capability' => 'manage_options', |
|
135 | + 'noheader' => true, |
|
136 | + 'headers_sent_route' => 'privacy_settings', |
|
137 | + ], |
|
138 | + ]; |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + /** |
|
143 | + * Set page configuration property |
|
144 | + */ |
|
145 | + protected function _set_page_config() |
|
146 | + { |
|
147 | + $this->_page_config = [ |
|
148 | + 'critical_pages' => [ |
|
149 | + 'nav' => [ |
|
150 | + 'label' => esc_html__('Critical Pages', 'event_espresso'), |
|
151 | + 'order' => 50, |
|
152 | + ], |
|
153 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
154 | + 'help_tabs' => [ |
|
155 | + 'general_settings_critical_pages_help_tab' => [ |
|
156 | + 'title' => esc_html__('Critical Pages', 'event_espresso'), |
|
157 | + 'filename' => 'general_settings_critical_pages', |
|
158 | + ], |
|
159 | + ], |
|
160 | + 'require_nonce' => false, |
|
161 | + ], |
|
162 | + 'default' => [ |
|
163 | + 'nav' => [ |
|
164 | + 'label' => esc_html__('Your Organization', 'event_espresso'), |
|
165 | + 'order' => 20, |
|
166 | + ], |
|
167 | + 'help_tabs' => [ |
|
168 | + 'general_settings_your_organization_help_tab' => [ |
|
169 | + 'title' => esc_html__('Your Organization', 'event_espresso'), |
|
170 | + 'filename' => 'general_settings_your_organization', |
|
171 | + ], |
|
172 | + ], |
|
173 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
174 | + 'require_nonce' => false, |
|
175 | + ], |
|
176 | + 'admin_option_settings' => [ |
|
177 | + 'nav' => [ |
|
178 | + 'label' => esc_html__('Admin Options', 'event_espresso'), |
|
179 | + 'order' => 60, |
|
180 | + ], |
|
181 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
182 | + 'help_tabs' => [ |
|
183 | + 'general_settings_admin_options_help_tab' => [ |
|
184 | + 'title' => esc_html__('Admin Options', 'event_espresso'), |
|
185 | + 'filename' => 'general_settings_admin_options', |
|
186 | + ], |
|
187 | + ], |
|
188 | + 'require_nonce' => false, |
|
189 | + ], |
|
190 | + 'country_settings' => [ |
|
191 | + 'nav' => [ |
|
192 | + 'label' => esc_html__('Countries', 'event_espresso'), |
|
193 | + 'order' => 70, |
|
194 | + ], |
|
195 | + 'help_tabs' => [ |
|
196 | + 'general_settings_countries_help_tab' => [ |
|
197 | + 'title' => esc_html__('Countries', 'event_espresso'), |
|
198 | + 'filename' => 'general_settings_countries', |
|
199 | + ], |
|
200 | + ], |
|
201 | + 'require_nonce' => false, |
|
202 | + ], |
|
203 | + 'privacy_settings' => [ |
|
204 | + 'nav' => [ |
|
205 | + 'label' => esc_html__('Privacy', 'event_espresso'), |
|
206 | + 'order' => 80, |
|
207 | + ], |
|
208 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
209 | + 'require_nonce' => false, |
|
210 | + ], |
|
211 | + ]; |
|
212 | + } |
|
213 | + |
|
214 | + |
|
215 | + protected function _add_screen_options() |
|
216 | + { |
|
217 | + } |
|
218 | + |
|
219 | + |
|
220 | + protected function _add_feature_pointers() |
|
221 | + { |
|
222 | + } |
|
223 | + |
|
224 | + |
|
225 | + /** |
|
226 | + * Enqueue global scripts and styles for all routes in the General Settings Admin Pages. |
|
227 | + */ |
|
228 | + public function load_scripts_styles() |
|
229 | + { |
|
230 | + // styles |
|
231 | + wp_enqueue_style('espresso-ui-theme'); |
|
232 | + // scripts |
|
233 | + wp_enqueue_script('ee_admin_js'); |
|
234 | + } |
|
235 | + |
|
236 | + |
|
237 | + /** |
|
238 | + * Execute logic running on `admin_init` |
|
239 | + */ |
|
240 | + public function admin_init() |
|
241 | + { |
|
242 | + $this->core_config = EE_Registry::instance()->CFG->core; |
|
243 | + |
|
244 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = wp_strip_all_tags( |
|
245 | + esc_html__( |
|
246 | + 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', |
|
247 | + 'event_espresso' |
|
248 | + ) |
|
249 | + ); |
|
250 | + EE_Registry::$i18n_js_strings['error_occurred'] = wp_strip_all_tags( |
|
251 | + esc_html__( |
|
252 | + 'An error occurred! Please refresh the page and try again.', |
|
253 | + 'event_espresso' |
|
254 | + ) |
|
255 | + ); |
|
256 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = wp_strip_all_tags( |
|
257 | + esc_html__( |
|
258 | + 'Are you sure you want to delete this State / Province?', |
|
259 | + 'event_espresso' |
|
260 | + ) |
|
261 | + ); |
|
262 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url( |
|
263 | + 'admin-ajax.php?page=espresso_general_settings', |
|
264 | + is_ssl() ? 'https://' : 'http://' |
|
265 | + ); |
|
266 | + } |
|
267 | + |
|
268 | + |
|
269 | + public function admin_notices() |
|
270 | + { |
|
271 | + } |
|
272 | + |
|
273 | + |
|
274 | + public function admin_footer_scripts() |
|
275 | + { |
|
276 | + } |
|
277 | + |
|
278 | + |
|
279 | + /** |
|
280 | + * Enqueue scripts and styles for the default route. |
|
281 | + */ |
|
282 | + public function load_scripts_styles_default() |
|
283 | + { |
|
284 | + // styles |
|
285 | + wp_enqueue_style('thickbox'); |
|
286 | + // scripts |
|
287 | + wp_enqueue_script('media-upload'); |
|
288 | + wp_enqueue_script('thickbox'); |
|
289 | + wp_register_script( |
|
290 | + 'organization_settings', |
|
291 | + GEN_SET_ASSETS_URL . 'your_organization_settings.js', |
|
292 | + ['jquery', 'media-upload', 'thickbox'], |
|
293 | + EVENT_ESPRESSO_VERSION, |
|
294 | + true |
|
295 | + ); |
|
296 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
297 | + wp_enqueue_script('organization_settings'); |
|
298 | + wp_enqueue_style('organization-css'); |
|
299 | + $confirm_image_delete = [ |
|
300 | + 'text' => wp_strip_all_tags( |
|
301 | + esc_html__( |
|
302 | + 'Do you really want to delete this image? Please remember to save your settings to complete the removal.', |
|
303 | + 'event_espresso' |
|
304 | + ) |
|
305 | + ), |
|
306 | + ]; |
|
307 | + wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
308 | + } |
|
309 | + |
|
310 | + |
|
311 | + /** |
|
312 | + * Enqueue scripts and styles for the country settings route. |
|
313 | + */ |
|
314 | + public function load_scripts_styles_country_settings() |
|
315 | + { |
|
316 | + // scripts |
|
317 | + wp_register_script( |
|
318 | + 'gen_settings_countries', |
|
319 | + GEN_SET_ASSETS_URL . 'gen_settings_countries.js', |
|
320 | + ['ee_admin_js'], |
|
321 | + EVENT_ESPRESSO_VERSION, |
|
322 | + true |
|
323 | + ); |
|
324 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
325 | + wp_enqueue_script('gen_settings_countries'); |
|
326 | + wp_enqueue_style('organization-css'); |
|
327 | + } |
|
328 | + |
|
329 | + |
|
330 | + /************* Espresso Pages *************/ |
|
331 | + /** |
|
332 | + * _espresso_page_settings |
|
333 | + * |
|
334 | + * @throws EE_Error |
|
335 | + * @throws DomainException |
|
336 | + * @throws DomainException |
|
337 | + * @throws InvalidDataTypeException |
|
338 | + * @throws InvalidArgumentException |
|
339 | + */ |
|
340 | + protected function _espresso_page_settings() |
|
341 | + { |
|
342 | + // Check to make sure all of the main pages are set up properly, |
|
343 | + // if not create the default pages and display an admin notice |
|
344 | + EEH_Activation::verify_default_pages_exist(); |
|
345 | + $this->_transient_garbage_collection(); |
|
346 | + |
|
347 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
348 | + |
|
349 | + $this->_template_args['reg_page_id'] = $this->core_config->reg_page_id ?? null; |
|
350 | + $this->_template_args['reg_page_obj'] = isset($this->core_config->reg_page_id) |
|
351 | + ? get_post($this->core_config->reg_page_id) |
|
352 | + : false; |
|
353 | + |
|
354 | + $this->_template_args['txn_page_id'] = $this->core_config->txn_page_id ?? null; |
|
355 | + $this->_template_args['txn_page_obj'] = isset($this->core_config->txn_page_id) |
|
356 | + ? get_post($this->core_config->txn_page_id) |
|
357 | + : false; |
|
358 | + |
|
359 | + $this->_template_args['thank_you_page_id'] = $this->core_config->thank_you_page_id ?? null; |
|
360 | + $this->_template_args['thank_you_page_obj'] = isset($this->core_config->thank_you_page_id) |
|
361 | + ? get_post($this->core_config->thank_you_page_id) |
|
362 | + : false; |
|
363 | + |
|
364 | + $this->_template_args['cancel_page_id'] = $this->core_config->cancel_page_id ?? null; |
|
365 | + $this->_template_args['cancel_page_obj'] = isset($this->core_config->cancel_page_id) |
|
366 | + ? get_post($this->core_config->cancel_page_id) |
|
367 | + : false; |
|
368 | + |
|
369 | + $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
370 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
371 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
372 | + GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', |
|
373 | + $this->_template_args, |
|
374 | + true |
|
375 | + ); |
|
376 | + $this->display_admin_page_with_sidebar(); |
|
377 | + } |
|
378 | + |
|
379 | + |
|
380 | + /** |
|
381 | + * Handler for updating espresso page settings. |
|
382 | + * |
|
383 | + * @throws EE_Error |
|
384 | + */ |
|
385 | + protected function _update_espresso_page_settings() |
|
386 | + { |
|
387 | + // capture incoming request data && set page IDs |
|
388 | + $this->core_config->reg_page_id = $this->request->getRequestParam( |
|
389 | + 'reg_page_id', |
|
390 | + $this->core_config->reg_page_id, |
|
391 | + DataType::INT |
|
392 | + ); |
|
393 | + $this->core_config->txn_page_id = $this->request->getRequestParam( |
|
394 | + 'txn_page_id', |
|
395 | + $this->core_config->txn_page_id, |
|
396 | + DataType::INT |
|
397 | + ); |
|
398 | + $this->core_config->thank_you_page_id = $this->request->getRequestParam( |
|
399 | + 'thank_you_page_id', |
|
400 | + $this->core_config->thank_you_page_id, |
|
401 | + DataType::INT |
|
402 | + ); |
|
403 | + $this->core_config->cancel_page_id = $this->request->getRequestParam( |
|
404 | + 'cancel_page_id', |
|
405 | + $this->core_config->cancel_page_id, |
|
406 | + DataType::INT |
|
407 | + ); |
|
408 | + |
|
409 | + $this->core_config = apply_filters( |
|
410 | + 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', |
|
411 | + $this->core_config, |
|
412 | + $this->request->requestParams() |
|
413 | + ); |
|
414 | + |
|
415 | + $what = esc_html__('Critical Pages & Shortcodes', 'event_espresso'); |
|
416 | + $this->_redirect_after_action( |
|
417 | + $this->_update_espresso_configuration( |
|
418 | + $what, |
|
419 | + $this->core_config, |
|
420 | + __FILE__, |
|
421 | + __FUNCTION__, |
|
422 | + __LINE__ |
|
423 | + ), |
|
424 | + $what, |
|
425 | + '', |
|
426 | + [ |
|
427 | + 'action' => 'critical_pages', |
|
428 | + ], |
|
429 | + true |
|
430 | + ); |
|
431 | + } |
|
432 | + |
|
433 | + |
|
434 | + /************* Your Organization *************/ |
|
435 | + |
|
436 | + |
|
437 | + /** |
|
438 | + * @throws DomainException |
|
439 | + * @throws EE_Error |
|
440 | + * @throws InvalidArgumentException |
|
441 | + * @throws InvalidDataTypeException |
|
442 | + * @throws InvalidInterfaceException |
|
443 | + */ |
|
444 | + protected function _your_organization_settings() |
|
445 | + { |
|
446 | + $this->_template_args['admin_page_content'] = ''; |
|
447 | + try { |
|
448 | + /** @var OrganizationSettings $organization_settings_form */ |
|
449 | + $organization_settings_form = $this->loader->getShared(OrganizationSettings::class); |
|
450 | + |
|
451 | + $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
452 | + $organization_settings_form->display(), |
|
453 | + '', |
|
454 | + 'padding' |
|
455 | + ); |
|
456 | + } catch (Exception $e) { |
|
457 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
458 | + } |
|
459 | + $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
460 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
461 | + $this->display_admin_page_with_sidebar(); |
|
462 | + } |
|
463 | + |
|
464 | + |
|
465 | + /** |
|
466 | + * Handler for updating organization settings. |
|
467 | + * |
|
468 | + * @throws EE_Error |
|
469 | + */ |
|
470 | + protected function _update_your_organization_settings() |
|
471 | + { |
|
472 | + try { |
|
473 | + /** @var OrganizationSettings $organization_settings_form */ |
|
474 | + $organization_settings_form = $this->loader->getShared(OrganizationSettings::class); |
|
475 | + |
|
476 | + $success = $organization_settings_form->process($this->request->requestParams()); |
|
477 | + |
|
478 | + EE_Registry::instance()->CFG = apply_filters( |
|
479 | + 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', |
|
480 | + EE_Registry::instance()->CFG |
|
481 | + ); |
|
482 | + } catch (Exception $e) { |
|
483 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
484 | + $success = false; |
|
485 | + } |
|
486 | + |
|
487 | + if ($success) { |
|
488 | + $success = $this->_update_espresso_configuration( |
|
489 | + esc_html__('Your Organization Settings', 'event_espresso'), |
|
490 | + EE_Registry::instance()->CFG, |
|
491 | + __FILE__, |
|
492 | + __FUNCTION__, |
|
493 | + __LINE__ |
|
494 | + ); |
|
495 | + } |
|
496 | + |
|
497 | + $this->_redirect_after_action($success, '', '', ['action' => 'default'], true); |
|
498 | + } |
|
499 | + |
|
500 | + |
|
501 | + |
|
502 | + /************* Admin Options *************/ |
|
503 | + |
|
504 | + |
|
505 | + /** |
|
506 | + * _admin_option_settings |
|
507 | + * |
|
508 | + * @throws EE_Error |
|
509 | + * @throws LogicException |
|
510 | + */ |
|
511 | + protected function _admin_option_settings() |
|
512 | + { |
|
513 | + $this->_template_args['admin_page_content'] = ''; |
|
514 | + try { |
|
515 | + $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
516 | + // still need this for the old school form in Extend_General_Settings_Admin_Page |
|
517 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
518 | + // also need to account for the do_action that was in the old template |
|
519 | + $admin_options_settings_form->setTemplateArgs($this->_template_args); |
|
520 | + $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
521 | + $admin_options_settings_form->display(), |
|
522 | + '', |
|
523 | + 'padding' |
|
524 | + ); |
|
525 | + } catch (Exception $e) { |
|
526 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
527 | + } |
|
528 | + $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
529 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
530 | + $this->display_admin_page_with_sidebar(); |
|
531 | + } |
|
532 | + |
|
533 | + |
|
534 | + /** |
|
535 | + * _update_admin_option_settings |
|
536 | + * |
|
537 | + * @throws EE_Error |
|
538 | + * @throws InvalidDataTypeException |
|
539 | + * @throws InvalidFormSubmissionException |
|
540 | + * @throws InvalidArgumentException |
|
541 | + * @throws LogicException |
|
542 | + */ |
|
543 | + protected function _update_admin_option_settings() |
|
544 | + { |
|
545 | + try { |
|
546 | + $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
547 | + $admin_options_settings_form->process( |
|
548 | + $this->request->getRequestParam( |
|
549 | + $admin_options_settings_form->slug(), |
|
550 | + [], |
|
551 | + DataType::STRING, |
|
552 | + true |
|
553 | + ) |
|
554 | + ); |
|
555 | + EE_Registry::instance()->CFG->admin = apply_filters( |
|
556 | + 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
557 | + EE_Registry::instance()->CFG->admin |
|
558 | + ); |
|
559 | + } catch (Exception $e) { |
|
560 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
561 | + } |
|
562 | + $this->_redirect_after_action( |
|
563 | + apply_filters( |
|
564 | + 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', |
|
565 | + $this->_update_espresso_configuration( |
|
566 | + esc_html__('Admin Options', 'event_espresso'), |
|
567 | + EE_Registry::instance()->CFG->admin, |
|
568 | + __FILE__, |
|
569 | + __FUNCTION__, |
|
570 | + __LINE__ |
|
571 | + ) |
|
572 | + ), |
|
573 | + esc_html__('Admin Options', 'event_espresso'), |
|
574 | + 'updated', |
|
575 | + ['action' => 'admin_option_settings'] |
|
576 | + ); |
|
577 | + } |
|
578 | + |
|
579 | + |
|
580 | + /************* Countries *************/ |
|
581 | + |
|
582 | + |
|
583 | + /** |
|
584 | + * @param string|null $default |
|
585 | + * @return string |
|
586 | + */ |
|
587 | + protected function getCountryISO(?string $default = null): string |
|
588 | + { |
|
589 | + $default = $default ?? $this->getCountryIsoForSite(); |
|
590 | + $CNT_ISO = $this->request->getRequestParam('country', $default); |
|
591 | + return strtoupper($CNT_ISO); |
|
592 | + } |
|
593 | + |
|
594 | + |
|
595 | + /** |
|
596 | + * @return string |
|
597 | + */ |
|
598 | + protected function getCountryIsoForSite(): string |
|
599 | + { |
|
600 | + return ! empty(EE_Registry::instance()->CFG->organization->CNT_ISO) |
|
601 | + ? EE_Registry::instance()->CFG->organization->CNT_ISO |
|
602 | + : 'US'; |
|
603 | + } |
|
604 | + |
|
605 | + |
|
606 | + /** |
|
607 | + * @param string $CNT_ISO |
|
608 | + * @param EE_Country|null $country |
|
609 | + * @return EE_Base_Class|EE_Country |
|
610 | + * @throws EE_Error |
|
611 | + * @throws InvalidArgumentException |
|
612 | + * @throws InvalidDataTypeException |
|
613 | + * @throws InvalidInterfaceException |
|
614 | + * @throws ReflectionException |
|
615 | + */ |
|
616 | + protected function verifyOrGetCountryFromIso(string $CNT_ISO, ?EE_Country $country = null) |
|
617 | + { |
|
618 | + /** @var EE_Country $country */ |
|
619 | + return $country instanceof EE_Country && $country->ID() === $CNT_ISO |
|
620 | + ? $country |
|
621 | + : EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
622 | + } |
|
623 | + |
|
624 | + |
|
625 | + /** |
|
626 | + * Output Country Settings view. |
|
627 | + * |
|
628 | + * @throws DomainException |
|
629 | + * @throws EE_Error |
|
630 | + * @throws InvalidArgumentException |
|
631 | + * @throws InvalidDataTypeException |
|
632 | + * @throws InvalidInterfaceException |
|
633 | + * @throws ReflectionException |
|
634 | + */ |
|
635 | + protected function _country_settings() |
|
636 | + { |
|
637 | + $CNT_ISO = $this->getCountryISO(); |
|
638 | + |
|
639 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
640 | + $this->_template_args['countries'] = new EE_Question_Form_Input( |
|
641 | + EE_Question::new_instance( |
|
642 | + [ |
|
643 | + 'QST_ID' => 0, |
|
644 | + 'QST_display_text' => esc_html__('Select Country', 'event_espresso'), |
|
645 | + 'QST_system' => 'admin-country', |
|
646 | + ] |
|
647 | + ), |
|
648 | + EE_Answer::new_instance( |
|
649 | + [ |
|
650 | + 'ANS_ID' => 0, |
|
651 | + 'ANS_value' => $CNT_ISO, |
|
652 | + ] |
|
653 | + ), |
|
654 | + [ |
|
655 | + 'input_id' => 'country', |
|
656 | + 'input_name' => 'country', |
|
657 | + 'input_prefix' => '', |
|
658 | + 'append_qstn_id' => false, |
|
659 | + ] |
|
660 | + ); |
|
661 | + |
|
662 | + $country = $this->verifyOrGetCountryFromIso($CNT_ISO); |
|
663 | + add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10); |
|
664 | + add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10); |
|
665 | + $this->_template_args['country_details_settings'] = $this->display_country_settings( |
|
666 | + $country->ID(), |
|
667 | + $country |
|
668 | + ); |
|
669 | + $this->_template_args['country_states_settings'] = $this->display_country_states( |
|
670 | + $country->ID(), |
|
671 | + $country |
|
672 | + ); |
|
673 | + $this->_template_args['CNT_name_for_site'] = $country->name(); |
|
674 | + |
|
675 | + $this->_set_add_edit_form_tags('update_country_settings'); |
|
676 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
677 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
678 | + GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', |
|
679 | + $this->_template_args, |
|
680 | + true |
|
681 | + ); |
|
682 | + $this->display_admin_page_with_no_sidebar(); |
|
683 | + } |
|
684 | + |
|
685 | + |
|
686 | + /** |
|
687 | + * @param string $CNT_ISO |
|
688 | + * @param EE_Country|null $country |
|
689 | + * @return string |
|
690 | + * @throws DomainException |
|
691 | + * @throws EE_Error |
|
692 | + * @throws InvalidArgumentException |
|
693 | + * @throws InvalidDataTypeException |
|
694 | + * @throws InvalidInterfaceException |
|
695 | + * @throws ReflectionException |
|
696 | + */ |
|
697 | + public function display_country_settings(string $CNT_ISO = '', ?EE_Country $country = null): string |
|
698 | + { |
|
699 | + $CNT_ISO = $this->getCountryISO($CNT_ISO); |
|
700 | + $CNT_ISO_for_site = $this->getCountryIsoForSite(); |
|
701 | + |
|
702 | + if (! $CNT_ISO) { |
|
703 | + return ''; |
|
704 | + } |
|
705 | + |
|
706 | + // for ajax |
|
707 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
708 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
709 | + add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10, 2); |
|
710 | + add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10, 2); |
|
711 | + $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country); |
|
712 | + $CNT_cur_disabled = $CNT_ISO !== $CNT_ISO_for_site; |
|
713 | + $this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled; |
|
714 | + |
|
715 | + $country_input_types = [ |
|
716 | + 'CNT_active' => [ |
|
717 | + 'type' => 'RADIO_BTN', |
|
718 | + 'input_name' => "cntry[$CNT_ISO]", |
|
719 | + 'class' => '', |
|
720 | + 'options' => $this->_yes_no_values, |
|
721 | + 'use_desc_4_label' => true, |
|
722 | + ], |
|
723 | + 'CNT_ISO' => [ |
|
724 | + 'type' => 'TEXT', |
|
725 | + 'input_name' => "cntry[$CNT_ISO]", |
|
726 | + 'class' => 'ee-input-width--small', |
|
727 | + ], |
|
728 | + 'CNT_ISO3' => [ |
|
729 | + 'type' => 'TEXT', |
|
730 | + 'input_name' => "cntry[$CNT_ISO]", |
|
731 | + 'class' => 'ee-input-width--small', |
|
732 | + ], |
|
733 | + // 'RGN_ID' => [ |
|
734 | + // 'type' => 'TEXT', |
|
735 | + // 'input_name' => "cntry[$CNT_ISO]", |
|
736 | + // 'class' => 'ee-input-width--small', |
|
737 | + // ], |
|
738 | + 'CNT_name' => [ |
|
739 | + 'type' => 'TEXT', |
|
740 | + 'input_name' => "cntry[$CNT_ISO]", |
|
741 | + 'class' => 'ee-input-width--big', |
|
742 | + ], |
|
743 | + 'CNT_cur_code' => [ |
|
744 | + 'type' => 'TEXT', |
|
745 | + 'input_name' => "cntry[$CNT_ISO]", |
|
746 | + 'class' => 'ee-input-width--small', |
|
747 | + 'disabled' => $CNT_cur_disabled, |
|
748 | + ], |
|
749 | + 'CNT_cur_single' => [ |
|
750 | + 'type' => 'TEXT', |
|
751 | + 'input_name' => "cntry[$CNT_ISO]", |
|
752 | + 'class' => 'ee-input-width--reg', |
|
753 | + 'disabled' => $CNT_cur_disabled, |
|
754 | + ], |
|
755 | + 'CNT_cur_plural' => [ |
|
756 | + 'type' => 'TEXT', |
|
757 | + 'input_name' => "cntry[$CNT_ISO]", |
|
758 | + 'class' => 'ee-input-width--reg', |
|
759 | + 'disabled' => $CNT_cur_disabled, |
|
760 | + ], |
|
761 | + 'CNT_cur_sign' => [ |
|
762 | + 'type' => 'TEXT', |
|
763 | + 'input_name' => "cntry[$CNT_ISO]", |
|
764 | + 'class' => 'ee-input-width--small', |
|
765 | + 'htmlentities' => false, |
|
766 | + 'disabled' => $CNT_cur_disabled, |
|
767 | + ], |
|
768 | + 'CNT_cur_sign_b4' => [ |
|
769 | + 'type' => 'RADIO_BTN', |
|
770 | + 'input_name' => "cntry[$CNT_ISO]", |
|
771 | + 'class' => '', |
|
772 | + 'options' => $this->_yes_no_values, |
|
773 | + 'use_desc_4_label' => true, |
|
774 | + 'disabled' => $CNT_cur_disabled, |
|
775 | + ], |
|
776 | + 'CNT_cur_dec_plc' => [ |
|
777 | + 'type' => 'RADIO_BTN', |
|
778 | + 'input_name' => "cntry[$CNT_ISO]", |
|
779 | + 'class' => '', |
|
780 | + 'options' => [ |
|
781 | + ['id' => 0, 'text' => ''], |
|
782 | + ['id' => 1, 'text' => ''], |
|
783 | + ['id' => 2, 'text' => ''], |
|
784 | + ['id' => 3, 'text' => ''], |
|
785 | + ], |
|
786 | + 'disabled' => $CNT_cur_disabled, |
|
787 | + ], |
|
788 | + 'CNT_cur_dec_mrk' => [ |
|
789 | + 'type' => 'RADIO_BTN', |
|
790 | + 'input_name' => "cntry[$CNT_ISO]", |
|
791 | + 'class' => '', |
|
792 | + 'options' => [ |
|
793 | + [ |
|
794 | + 'id' => ',', |
|
795 | + 'text' => esc_html__(', (comma)', 'event_espresso'), |
|
796 | + ], |
|
797 | + ['id' => '.', 'text' => esc_html__('. (decimal)', 'event_espresso')], |
|
798 | + ], |
|
799 | + 'use_desc_4_label' => true, |
|
800 | + 'disabled' => $CNT_cur_disabled, |
|
801 | + ], |
|
802 | + 'CNT_cur_thsnds' => [ |
|
803 | + 'type' => 'RADIO_BTN', |
|
804 | + 'input_name' => "cntry[$CNT_ISO]", |
|
805 | + 'class' => '', |
|
806 | + 'options' => [ |
|
807 | + [ |
|
808 | + 'id' => ',', |
|
809 | + 'text' => esc_html__(', (comma)', 'event_espresso'), |
|
810 | + ], |
|
811 | + [ |
|
812 | + 'id' => '.', |
|
813 | + 'text' => esc_html__('. (decimal)', 'event_espresso'), |
|
814 | + ], |
|
815 | + [ |
|
816 | + 'id' => ' ', |
|
817 | + 'text' => esc_html__('(space)', 'event_espresso'), |
|
818 | + ], |
|
819 | + ], |
|
820 | + 'use_desc_4_label' => true, |
|
821 | + 'disabled' => $CNT_cur_disabled, |
|
822 | + ], |
|
823 | + 'CNT_tel_code' => [ |
|
824 | + 'type' => 'TEXT', |
|
825 | + 'input_name' => "cntry[$CNT_ISO]", |
|
826 | + 'class' => 'ee-input-width--small', |
|
827 | + ], |
|
828 | + 'CNT_is_EU' => [ |
|
829 | + 'type' => 'RADIO_BTN', |
|
830 | + 'input_name' => "cntry[$CNT_ISO]", |
|
831 | + 'class' => '', |
|
832 | + 'options' => $this->_yes_no_values, |
|
833 | + 'use_desc_4_label' => true, |
|
834 | + ], |
|
835 | + ]; |
|
836 | + $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( |
|
837 | + $country, |
|
838 | + $country_input_types |
|
839 | + ); |
|
840 | + $country_details_settings = EEH_Template::display_template( |
|
841 | + GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', |
|
842 | + $this->_template_args, |
|
843 | + true |
|
844 | + ); |
|
845 | + |
|
846 | + if (defined('DOING_AJAX')) { |
|
847 | + $notices = EE_Error::get_notices(false, false, false); |
|
848 | + echo wp_json_encode( |
|
849 | + [ |
|
850 | + 'return_data' => $country_details_settings, |
|
851 | + 'success' => $notices['success'], |
|
852 | + 'errors' => $notices['errors'], |
|
853 | + ] |
|
854 | + ); |
|
855 | + die(); |
|
856 | + } |
|
857 | + return $country_details_settings; |
|
858 | + } |
|
859 | + |
|
860 | + |
|
861 | + /** |
|
862 | + * @param string $CNT_ISO |
|
863 | + * @param EE_Country|null $country |
|
864 | + * @return string |
|
865 | + * @throws DomainException |
|
866 | + * @throws EE_Error |
|
867 | + * @throws InvalidArgumentException |
|
868 | + * @throws InvalidDataTypeException |
|
869 | + * @throws InvalidInterfaceException |
|
870 | + * @throws ReflectionException |
|
871 | + */ |
|
872 | + public function display_country_states(string $CNT_ISO = '', ?EE_Country $country = null): string |
|
873 | + { |
|
874 | + $CNT_ISO = $this->getCountryISO($CNT_ISO); |
|
875 | + if (! $CNT_ISO) { |
|
876 | + return ''; |
|
877 | + } |
|
878 | + // for ajax |
|
879 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
880 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
881 | + add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'state_form_field_label_wrap'], 10, 2); |
|
882 | + add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'state_form_field_input__wrap'], 10); |
|
883 | + $states = EEM_State::instance()->get_all_states_for_these_countries([$CNT_ISO => $CNT_ISO]); |
|
884 | + if (empty($states)) { |
|
885 | + /** @var EventEspresso\core\services\address\CountrySubRegionDao $countrySubRegionDao */ |
|
886 | + $countrySubRegionDao = $this->loader->getShared( |
|
887 | + 'EventEspresso\core\services\address\CountrySubRegionDao' |
|
888 | + ); |
|
889 | + if ($countrySubRegionDao instanceof EventEspresso\core\services\address\CountrySubRegionDao) { |
|
890 | + $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country); |
|
891 | + if ($countrySubRegionDao->saveCountrySubRegions($country)) { |
|
892 | + $states = EEM_State::instance()->get_all_states_for_these_countries([$CNT_ISO => $CNT_ISO]); |
|
893 | + } |
|
894 | + } |
|
895 | + } |
|
896 | + if (is_array($states)) { |
|
897 | + foreach ($states as $STA_ID => $state) { |
|
898 | + if ($state instanceof EE_State) { |
|
899 | + $inputs = EE_Question_Form_Input::generate_question_form_inputs_for_object( |
|
900 | + $state, |
|
901 | + [ |
|
902 | + 'STA_abbrev' => [ |
|
903 | + 'type' => 'TEXT', |
|
904 | + 'label' => esc_html__('Code', 'event_espresso'), |
|
905 | + 'input_name' => "states[$STA_ID]", |
|
906 | + 'class' => 'ee-input-width--tiny', |
|
907 | + 'add_mobile_label' => true, |
|
908 | + ], |
|
909 | + 'STA_name' => [ |
|
910 | + 'type' => 'TEXT', |
|
911 | + 'label' => esc_html__('Name', 'event_espresso'), |
|
912 | + 'input_name' => "states[$STA_ID]", |
|
913 | + 'class' => 'ee-input-width--big', |
|
914 | + 'add_mobile_label' => true, |
|
915 | + ], |
|
916 | + 'STA_active' => [ |
|
917 | + 'type' => 'RADIO_BTN', |
|
918 | + 'label' => esc_html__('State Appears in Dropdown Select Lists', 'event_espresso'), |
|
919 | + 'input_name' => "states[$STA_ID]", |
|
920 | + 'options' => $this->_yes_no_values, |
|
921 | + 'use_desc_4_label' => true, |
|
922 | + 'add_mobile_label' => true, |
|
923 | + ], |
|
924 | + ] |
|
925 | + ); |
|
926 | + |
|
927 | + $delete_state_url = EE_Admin_Page::add_query_args_and_nonce( |
|
928 | + [ |
|
929 | + 'action' => 'delete_state', |
|
930 | + 'STA_ID' => $STA_ID, |
|
931 | + 'CNT_ISO' => $CNT_ISO, |
|
932 | + 'STA_abbrev' => $state->abbrev(), |
|
933 | + ], |
|
934 | + GEN_SET_ADMIN_URL |
|
935 | + ); |
|
936 | + |
|
937 | + $this->_template_args['states'][$STA_ID]['inputs'] = $inputs; |
|
938 | + $this->_template_args['states'][$STA_ID]['delete_state_url'] = $delete_state_url; |
|
939 | + } |
|
940 | + } |
|
941 | + } else { |
|
942 | + $this->_template_args['states'] = false; |
|
943 | + } |
|
944 | + |
|
945 | + $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
946 | + ['action' => 'add_new_state'], |
|
947 | + GEN_SET_ADMIN_URL |
|
948 | + ); |
|
949 | + |
|
950 | + $state_details_settings = EEH_Template::display_template( |
|
951 | + GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', |
|
952 | + $this->_template_args, |
|
953 | + true |
|
954 | + ); |
|
955 | + |
|
956 | + if (defined('DOING_AJAX')) { |
|
957 | + $notices = EE_Error::get_notices(false, false, false); |
|
958 | + echo wp_json_encode( |
|
959 | + [ |
|
960 | + 'return_data' => $state_details_settings, |
|
961 | + 'success' => $notices['success'], |
|
962 | + 'errors' => $notices['errors'], |
|
963 | + ] |
|
964 | + ); |
|
965 | + die(); |
|
966 | + } |
|
967 | + return $state_details_settings; |
|
968 | + } |
|
969 | + |
|
970 | + |
|
971 | + /** |
|
972 | + * @return void |
|
973 | + * @throws EE_Error |
|
974 | + * @throws InvalidArgumentException |
|
975 | + * @throws InvalidDataTypeException |
|
976 | + * @throws InvalidInterfaceException |
|
977 | + * @throws ReflectionException |
|
978 | + */ |
|
979 | + public function add_new_state() |
|
980 | + { |
|
981 | + $success = true; |
|
982 | + $CNT_ISO = $this->getCountryISO(''); |
|
983 | + if (! $CNT_ISO) { |
|
984 | + EE_Error::add_error( |
|
985 | + esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
|
986 | + __FILE__, |
|
987 | + __FUNCTION__, |
|
988 | + __LINE__ |
|
989 | + ); |
|
990 | + $success = false; |
|
991 | + } |
|
992 | + $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
|
993 | + if (! $STA_abbrev) { |
|
994 | + EE_Error::add_error( |
|
995 | + esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), |
|
996 | + __FILE__, |
|
997 | + __FUNCTION__, |
|
998 | + __LINE__ |
|
999 | + ); |
|
1000 | + $success = false; |
|
1001 | + } |
|
1002 | + $STA_name = $this->request->getRequestParam('STA_name'); |
|
1003 | + if (! $STA_name) { |
|
1004 | + EE_Error::add_error( |
|
1005 | + esc_html__('No State name or an invalid State name was received.', 'event_espresso'), |
|
1006 | + __FILE__, |
|
1007 | + __FUNCTION__, |
|
1008 | + __LINE__ |
|
1009 | + ); |
|
1010 | + $success = false; |
|
1011 | + } |
|
1012 | + |
|
1013 | + if ($success) { |
|
1014 | + $cols_n_values = [ |
|
1015 | + 'CNT_ISO' => $CNT_ISO, |
|
1016 | + 'STA_abbrev' => $STA_abbrev, |
|
1017 | + 'STA_name' => $STA_name, |
|
1018 | + 'STA_active' => true, |
|
1019 | + ]; |
|
1020 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
1021 | + EE_Error::add_success(esc_html__('The State was added successfully.', 'event_espresso')); |
|
1022 | + } |
|
1023 | + |
|
1024 | + if (defined('DOING_AJAX')) { |
|
1025 | + $notices = EE_Error::get_notices(false, false, false); |
|
1026 | + echo wp_json_encode(array_merge($notices, ['return_data' => $CNT_ISO])); |
|
1027 | + die(); |
|
1028 | + } |
|
1029 | + $this->_redirect_after_action( |
|
1030 | + $success, |
|
1031 | + esc_html__('State', 'event_espresso'), |
|
1032 | + 'added', |
|
1033 | + ['action' => 'country_settings'] |
|
1034 | + ); |
|
1035 | + } |
|
1036 | + |
|
1037 | + |
|
1038 | + /** |
|
1039 | + * @return void |
|
1040 | + * @throws EE_Error |
|
1041 | + * @throws InvalidArgumentException |
|
1042 | + * @throws InvalidDataTypeException |
|
1043 | + * @throws InvalidInterfaceException |
|
1044 | + * @throws ReflectionException |
|
1045 | + */ |
|
1046 | + public function delete_state() |
|
1047 | + { |
|
1048 | + $CNT_ISO = $this->getCountryISO(); |
|
1049 | + $STA_ID = $this->request->getRequestParam('STA_ID'); |
|
1050 | + $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
|
1051 | + |
|
1052 | + if (! $STA_ID) { |
|
1053 | + EE_Error::add_error( |
|
1054 | + esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'), |
|
1055 | + __FILE__, |
|
1056 | + __FUNCTION__, |
|
1057 | + __LINE__ |
|
1058 | + ); |
|
1059 | + return; |
|
1060 | + } |
|
1061 | + |
|
1062 | + $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
1063 | + if ($success !== false) { |
|
1064 | + do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', |
|
1065 | + $CNT_ISO, |
|
1066 | + $STA_ID, |
|
1067 | + ['STA_abbrev' => $STA_abbrev]); |
|
1068 | + EE_Error::add_success(esc_html__('The State was deleted successfully.', 'event_espresso')); |
|
1069 | + } |
|
1070 | + if (defined('DOING_AJAX')) { |
|
1071 | + $notices = EE_Error::get_notices(false); |
|
1072 | + $notices['return_data'] = true; |
|
1073 | + echo wp_json_encode($notices); |
|
1074 | + die(); |
|
1075 | + } |
|
1076 | + $this->_redirect_after_action( |
|
1077 | + $success, |
|
1078 | + esc_html__('State', 'event_espresso'), |
|
1079 | + 'deleted', |
|
1080 | + ['action' => 'country_settings'] |
|
1081 | + ); |
|
1082 | + } |
|
1083 | + |
|
1084 | + |
|
1085 | + /** |
|
1086 | + * @return void |
|
1087 | + * @throws EE_Error |
|
1088 | + * @throws InvalidArgumentException |
|
1089 | + * @throws InvalidDataTypeException |
|
1090 | + * @throws InvalidInterfaceException |
|
1091 | + * @throws ReflectionException |
|
1092 | + */ |
|
1093 | + protected function _update_country_settings() |
|
1094 | + { |
|
1095 | + $CNT_ISO = $this->getCountryISO(); |
|
1096 | + if (! $CNT_ISO) { |
|
1097 | + EE_Error::add_error( |
|
1098 | + esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
|
1099 | + __FILE__, |
|
1100 | + __FUNCTION__, |
|
1101 | + __LINE__ |
|
1102 | + ); |
|
1103 | + return; |
|
1104 | + } |
|
1105 | + |
|
1106 | + $country = $this->verifyOrGetCountryFromIso($CNT_ISO); |
|
1107 | + |
|
1108 | + $cols_n_values = []; |
|
1109 | + $cols_n_values['CNT_ISO3'] = strtoupper( |
|
1110 | + $this->request->getRequestParam('cntry', '', $country->ISO3()) |
|
1111 | + ); |
|
1112 | + $cols_n_values['CNT_name'] = |
|
1113 | + $this->request->getRequestParam("cntry[$CNT_ISO][CNT_name]", $country->name()); |
|
1114 | + $cols_n_values['CNT_cur_code'] = strtoupper( |
|
1115 | + $this->request->getRequestParam( |
|
1116 | + "cntry[$CNT_ISO][CNT_cur_code]", |
|
1117 | + $country->currency_code() |
|
1118 | + ) |
|
1119 | + ); |
|
1120 | + $cols_n_values['CNT_cur_single'] = $this->request->getRequestParam( |
|
1121 | + "cntry[$CNT_ISO][CNT_cur_single]", |
|
1122 | + $country->currency_name_single() |
|
1123 | + ); |
|
1124 | + $cols_n_values['CNT_cur_plural'] = $this->request->getRequestParam( |
|
1125 | + "cntry[$CNT_ISO][CNT_cur_plural]", |
|
1126 | + $country->currency_name_plural() |
|
1127 | + ); |
|
1128 | + $cols_n_values['CNT_cur_sign'] = $this->request->getRequestParam( |
|
1129 | + "cntry[$CNT_ISO][CNT_cur_sign]", |
|
1130 | + $country->currency_sign() |
|
1131 | + ); |
|
1132 | + $cols_n_values['CNT_cur_sign_b4'] = $this->request->getRequestParam( |
|
1133 | + "cntry[$CNT_ISO][CNT_cur_sign_b4]", |
|
1134 | + $country->currency_sign_before(), |
|
1135 | + DataType::BOOL |
|
1136 | + ); |
|
1137 | + $cols_n_values['CNT_cur_dec_plc'] = $this->request->getRequestParam( |
|
1138 | + "cntry[$CNT_ISO][CNT_cur_dec_plc]", |
|
1139 | + $country->currency_decimal_places() |
|
1140 | + ); |
|
1141 | + $cols_n_values['CNT_cur_dec_mrk'] = $this->request->getRequestParam( |
|
1142 | + "cntry[$CNT_ISO][CNT_cur_dec_mrk]", |
|
1143 | + $country->currency_decimal_mark() |
|
1144 | + ); |
|
1145 | + $cols_n_values['CNT_cur_thsnds'] = $this->request->getRequestParam( |
|
1146 | + "cntry[$CNT_ISO][CNT_cur_thsnds]", |
|
1147 | + $country->currency_thousands_separator() |
|
1148 | + ); |
|
1149 | + $cols_n_values['CNT_tel_code'] = $this->request->getRequestParam( |
|
1150 | + "cntry[$CNT_ISO][CNT_tel_code]", |
|
1151 | + $country->telephoneCode() |
|
1152 | + ); |
|
1153 | + $cols_n_values['CNT_active'] = $this->request->getRequestParam( |
|
1154 | + "cntry[$CNT_ISO][CNT_active]", |
|
1155 | + $country->isActive(), |
|
1156 | + DataType::BOOL |
|
1157 | + ); |
|
1158 | + |
|
1159 | + // allow filtering of country data |
|
1160 | + $cols_n_values = apply_filters( |
|
1161 | + 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', |
|
1162 | + $cols_n_values |
|
1163 | + ); |
|
1164 | + |
|
1165 | + // where values |
|
1166 | + $where_cols_n_values = [['CNT_ISO' => $CNT_ISO]]; |
|
1167 | + // run the update |
|
1168 | + $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
1169 | + |
|
1170 | + // allow filtering of states data |
|
1171 | + $states = apply_filters( |
|
1172 | + 'FHEE__General_Settings_Admin_Page___update_country_settings__states', |
|
1173 | + $this->request->getRequestParam('states', [], DataType::STRING, true) |
|
1174 | + ); |
|
1175 | + |
|
1176 | + if (! empty($states) && $success !== false) { |
|
1177 | + // loop thru state data ( looks like : states[75][STA_name] ) |
|
1178 | + foreach ($states as $STA_ID => $state) { |
|
1179 | + $cols_n_values = [ |
|
1180 | + 'CNT_ISO' => $CNT_ISO, |
|
1181 | + 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
1182 | + 'STA_name' => sanitize_text_field($state['STA_name']), |
|
1183 | + 'STA_active' => filter_var($state['STA_active'], FILTER_VALIDATE_BOOLEAN), |
|
1184 | + ]; |
|
1185 | + // where values |
|
1186 | + $where_cols_n_values = [['STA_ID' => $STA_ID]]; |
|
1187 | + // run the update |
|
1188 | + $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
1189 | + if ($success !== false) { |
|
1190 | + do_action( |
|
1191 | + 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', |
|
1192 | + $CNT_ISO, |
|
1193 | + $STA_ID, |
|
1194 | + $cols_n_values |
|
1195 | + ); |
|
1196 | + } |
|
1197 | + } |
|
1198 | + } |
|
1199 | + // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
|
1200 | + if ( |
|
1201 | + isset(EE_Registry::instance()->CFG->organization->CNT_ISO) |
|
1202 | + && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO |
|
1203 | + ) { |
|
1204 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
1205 | + EE_Registry::instance()->CFG->update_espresso_config(); |
|
1206 | + } |
|
1207 | + |
|
1208 | + if ($success !== false) { |
|
1209 | + EE_Error::add_success( |
|
1210 | + esc_html__('Country Settings updated successfully.', 'event_espresso') |
|
1211 | + ); |
|
1212 | + } |
|
1213 | + $this->_redirect_after_action( |
|
1214 | + $success, |
|
1215 | + '', |
|
1216 | + '', |
|
1217 | + ['action' => 'country_settings', 'country' => $CNT_ISO], |
|
1218 | + true |
|
1219 | + ); |
|
1220 | + } |
|
1221 | + |
|
1222 | + |
|
1223 | + /** |
|
1224 | + * form_form_field_label_wrap |
|
1225 | + * |
|
1226 | + * @param string $label |
|
1227 | + * @return string |
|
1228 | + */ |
|
1229 | + public function country_form_field_label_wrap(string $label): string |
|
1230 | + { |
|
1231 | + return ' |
|
1232 | 1232 | <tr> |
1233 | 1233 | <th> |
1234 | 1234 | ' . $label . ' |
1235 | 1235 | </th>'; |
1236 | - } |
|
1237 | - |
|
1238 | - |
|
1239 | - /** |
|
1240 | - * form_form_field_input__wrap |
|
1241 | - * |
|
1242 | - * @param string $input |
|
1243 | - * @return string |
|
1244 | - */ |
|
1245 | - public function country_form_field_input__wrap(string $input): string |
|
1246 | - { |
|
1247 | - return ' |
|
1236 | + } |
|
1237 | + |
|
1238 | + |
|
1239 | + /** |
|
1240 | + * form_form_field_input__wrap |
|
1241 | + * |
|
1242 | + * @param string $input |
|
1243 | + * @return string |
|
1244 | + */ |
|
1245 | + public function country_form_field_input__wrap(string $input): string |
|
1246 | + { |
|
1247 | + return ' |
|
1248 | 1248 | <td class="general-settings-country-input-td"> |
1249 | 1249 | ' . $input . ' |
1250 | 1250 | </td> |
1251 | 1251 | </tr>'; |
1252 | - } |
|
1253 | - |
|
1254 | - |
|
1255 | - /** |
|
1256 | - * form_form_field_label_wrap |
|
1257 | - * |
|
1258 | - * @param string $label |
|
1259 | - * @param string $required_text |
|
1260 | - * @return string |
|
1261 | - */ |
|
1262 | - public function state_form_field_label_wrap(string $label, string $required_text): string |
|
1263 | - { |
|
1264 | - return $required_text; |
|
1265 | - } |
|
1266 | - |
|
1267 | - |
|
1268 | - /** |
|
1269 | - * form_form_field_input__wrap |
|
1270 | - * |
|
1271 | - * @param string $input |
|
1272 | - * @return string |
|
1273 | - */ |
|
1274 | - public function state_form_field_input__wrap(string $input): string |
|
1275 | - { |
|
1276 | - return ' |
|
1252 | + } |
|
1253 | + |
|
1254 | + |
|
1255 | + /** |
|
1256 | + * form_form_field_label_wrap |
|
1257 | + * |
|
1258 | + * @param string $label |
|
1259 | + * @param string $required_text |
|
1260 | + * @return string |
|
1261 | + */ |
|
1262 | + public function state_form_field_label_wrap(string $label, string $required_text): string |
|
1263 | + { |
|
1264 | + return $required_text; |
|
1265 | + } |
|
1266 | + |
|
1267 | + |
|
1268 | + /** |
|
1269 | + * form_form_field_input__wrap |
|
1270 | + * |
|
1271 | + * @param string $input |
|
1272 | + * @return string |
|
1273 | + */ |
|
1274 | + public function state_form_field_input__wrap(string $input): string |
|
1275 | + { |
|
1276 | + return ' |
|
1277 | 1277 | <td class="general-settings-country-state-input-td"> |
1278 | 1278 | ' . $input . ' |
1279 | 1279 | </td>'; |
1280 | - } |
|
1281 | - |
|
1282 | - |
|
1283 | - /***********/ |
|
1284 | - |
|
1285 | - |
|
1286 | - /** |
|
1287 | - * displays edit and view links for critical EE pages |
|
1288 | - * |
|
1289 | - * @param int $ee_page_id |
|
1290 | - * @return string |
|
1291 | - */ |
|
1292 | - public static function edit_view_links(int $ee_page_id): string |
|
1293 | - { |
|
1294 | - $edit_url = add_query_arg( |
|
1295 | - ['post' => $ee_page_id, 'action' => 'edit'], |
|
1296 | - admin_url('post.php') |
|
1297 | - ); |
|
1298 | - $links = '<a href="' . esc_url_raw($edit_url) . '" >' . esc_html__('Edit', 'event_espresso') . '</a>'; |
|
1299 | - $links .= ' | '; |
|
1300 | - $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>'; |
|
1301 | - |
|
1302 | - return $links; |
|
1303 | - } |
|
1304 | - |
|
1305 | - |
|
1306 | - /** |
|
1307 | - * displays page and shortcode status for critical EE pages |
|
1308 | - * |
|
1309 | - * @param WP_Post $ee_page |
|
1310 | - * @param string $shortcode |
|
1311 | - * @return string |
|
1312 | - */ |
|
1313 | - public static function page_and_shortcode_status(WP_Post $ee_page, string $shortcode): string |
|
1314 | - { |
|
1315 | - // page status |
|
1316 | - if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
1317 | - $pg_class = 'ee-status-bg--success'; |
|
1318 | - $pg_status = sprintf(esc_html__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
1319 | - } else { |
|
1320 | - $pg_class = 'ee-status-bg--error'; |
|
1321 | - $pg_status = sprintf(esc_html__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
1322 | - } |
|
1323 | - |
|
1324 | - // shortcode status |
|
1325 | - if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) { |
|
1326 | - $sc_class = 'ee-status-bg--success'; |
|
1327 | - $sc_status = sprintf(esc_html__('Shortcode%sOK', 'event_espresso'), ' '); |
|
1328 | - } else { |
|
1329 | - $sc_class = 'ee-status-bg--error'; |
|
1330 | - $sc_status = sprintf(esc_html__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
1331 | - } |
|
1332 | - |
|
1333 | - return ' |
|
1280 | + } |
|
1281 | + |
|
1282 | + |
|
1283 | + /***********/ |
|
1284 | + |
|
1285 | + |
|
1286 | + /** |
|
1287 | + * displays edit and view links for critical EE pages |
|
1288 | + * |
|
1289 | + * @param int $ee_page_id |
|
1290 | + * @return string |
|
1291 | + */ |
|
1292 | + public static function edit_view_links(int $ee_page_id): string |
|
1293 | + { |
|
1294 | + $edit_url = add_query_arg( |
|
1295 | + ['post' => $ee_page_id, 'action' => 'edit'], |
|
1296 | + admin_url('post.php') |
|
1297 | + ); |
|
1298 | + $links = '<a href="' . esc_url_raw($edit_url) . '" >' . esc_html__('Edit', 'event_espresso') . '</a>'; |
|
1299 | + $links .= ' | '; |
|
1300 | + $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>'; |
|
1301 | + |
|
1302 | + return $links; |
|
1303 | + } |
|
1304 | + |
|
1305 | + |
|
1306 | + /** |
|
1307 | + * displays page and shortcode status for critical EE pages |
|
1308 | + * |
|
1309 | + * @param WP_Post $ee_page |
|
1310 | + * @param string $shortcode |
|
1311 | + * @return string |
|
1312 | + */ |
|
1313 | + public static function page_and_shortcode_status(WP_Post $ee_page, string $shortcode): string |
|
1314 | + { |
|
1315 | + // page status |
|
1316 | + if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
1317 | + $pg_class = 'ee-status-bg--success'; |
|
1318 | + $pg_status = sprintf(esc_html__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
1319 | + } else { |
|
1320 | + $pg_class = 'ee-status-bg--error'; |
|
1321 | + $pg_status = sprintf(esc_html__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
1322 | + } |
|
1323 | + |
|
1324 | + // shortcode status |
|
1325 | + if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) { |
|
1326 | + $sc_class = 'ee-status-bg--success'; |
|
1327 | + $sc_status = sprintf(esc_html__('Shortcode%sOK', 'event_espresso'), ' '); |
|
1328 | + } else { |
|
1329 | + $sc_class = 'ee-status-bg--error'; |
|
1330 | + $sc_status = sprintf(esc_html__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
1331 | + } |
|
1332 | + |
|
1333 | + return ' |
|
1334 | 1334 | <span class="ee-page-status ' . $pg_class . '"><strong>' . $pg_status . '</strong></span> |
1335 | 1335 | <span class="ee-page-status ' . $sc_class . '"><strong>' . $sc_status . '</strong></span>'; |
1336 | - } |
|
1337 | - |
|
1338 | - |
|
1339 | - /** |
|
1340 | - * generates a dropdown of all parent pages - copied from WP core |
|
1341 | - * |
|
1342 | - * @param int $default |
|
1343 | - * @param int $parent |
|
1344 | - * @param int $level |
|
1345 | - * @param bool $echo |
|
1346 | - * @return string; |
|
1347 | - */ |
|
1348 | - public static function page_settings_dropdown( |
|
1349 | - int $default = 0, |
|
1350 | - int $parent = 0, |
|
1351 | - int $level = 0, |
|
1352 | - bool $echo = true |
|
1353 | - ): string { |
|
1354 | - global $wpdb; |
|
1355 | - $items = $wpdb->get_results( |
|
1356 | - $wpdb->prepare( |
|
1357 | - "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", |
|
1358 | - $parent |
|
1359 | - ) |
|
1360 | - ); |
|
1361 | - $output = ''; |
|
1362 | - |
|
1363 | - if ($items) { |
|
1364 | - $level = absint($level); |
|
1365 | - foreach ($items as $item) { |
|
1366 | - $ID = absint($item->ID); |
|
1367 | - $post_title = wp_strip_all_tags($item->post_title); |
|
1368 | - $pad = str_repeat(' ', $level * 3); |
|
1369 | - $option = "\n\t"; |
|
1370 | - $option .= '<option class="level-' . $level . '" '; |
|
1371 | - $option .= 'value="' . $ID . '" '; |
|
1372 | - $option .= $ID === absint($default) ? ' selected' : ''; |
|
1373 | - $option .= '>'; |
|
1374 | - $option .= "$pad {$post_title}"; |
|
1375 | - $option .= '</option>'; |
|
1376 | - $output .= $option; |
|
1377 | - ob_start(); |
|
1378 | - parent_dropdown($default, $item->ID, $level + 1); |
|
1379 | - $output .= ob_get_clean(); |
|
1380 | - } |
|
1381 | - } |
|
1382 | - if ($echo) { |
|
1383 | - echo wp_kses($output, AllowedTags::getWithFormTags()); |
|
1384 | - return ''; |
|
1385 | - } |
|
1386 | - return $output; |
|
1387 | - } |
|
1388 | - |
|
1389 | - |
|
1390 | - /** |
|
1391 | - * Loads the scripts for the privacy settings form |
|
1392 | - */ |
|
1393 | - public function load_scripts_styles_privacy_settings() |
|
1394 | - { |
|
1395 | - $form_handler = $this->loader->getShared( |
|
1396 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1397 | - ); |
|
1398 | - $form_handler->enqueueStylesAndScripts(); |
|
1399 | - } |
|
1400 | - |
|
1401 | - |
|
1402 | - /** |
|
1403 | - * display the privacy settings form |
|
1404 | - * |
|
1405 | - * @throws EE_Error |
|
1406 | - */ |
|
1407 | - public function privacySettings() |
|
1408 | - { |
|
1409 | - $this->_set_add_edit_form_tags('update_privacy_settings'); |
|
1410 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1411 | - $form_handler = $this->loader->getShared( |
|
1412 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1413 | - ); |
|
1414 | - $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
1415 | - $form_handler->display(), |
|
1416 | - '', |
|
1417 | - 'padding' |
|
1418 | - ); |
|
1419 | - $this->display_admin_page_with_sidebar(); |
|
1420 | - } |
|
1421 | - |
|
1422 | - |
|
1423 | - /** |
|
1424 | - * Update the privacy settings from form data |
|
1425 | - * |
|
1426 | - * @throws EE_Error |
|
1427 | - */ |
|
1428 | - public function updatePrivacySettings() |
|
1429 | - { |
|
1430 | - $form_handler = $this->loader->getShared( |
|
1431 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1432 | - ); |
|
1433 | - $success = $form_handler->process($this->get_request_data()); |
|
1434 | - $this->_redirect_after_action( |
|
1435 | - $success, |
|
1436 | - esc_html__('Registration Form Options', 'event_espresso'), |
|
1437 | - 'updated', |
|
1438 | - ['action' => 'privacy_settings'] |
|
1439 | - ); |
|
1440 | - } |
|
1336 | + } |
|
1337 | + |
|
1338 | + |
|
1339 | + /** |
|
1340 | + * generates a dropdown of all parent pages - copied from WP core |
|
1341 | + * |
|
1342 | + * @param int $default |
|
1343 | + * @param int $parent |
|
1344 | + * @param int $level |
|
1345 | + * @param bool $echo |
|
1346 | + * @return string; |
|
1347 | + */ |
|
1348 | + public static function page_settings_dropdown( |
|
1349 | + int $default = 0, |
|
1350 | + int $parent = 0, |
|
1351 | + int $level = 0, |
|
1352 | + bool $echo = true |
|
1353 | + ): string { |
|
1354 | + global $wpdb; |
|
1355 | + $items = $wpdb->get_results( |
|
1356 | + $wpdb->prepare( |
|
1357 | + "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", |
|
1358 | + $parent |
|
1359 | + ) |
|
1360 | + ); |
|
1361 | + $output = ''; |
|
1362 | + |
|
1363 | + if ($items) { |
|
1364 | + $level = absint($level); |
|
1365 | + foreach ($items as $item) { |
|
1366 | + $ID = absint($item->ID); |
|
1367 | + $post_title = wp_strip_all_tags($item->post_title); |
|
1368 | + $pad = str_repeat(' ', $level * 3); |
|
1369 | + $option = "\n\t"; |
|
1370 | + $option .= '<option class="level-' . $level . '" '; |
|
1371 | + $option .= 'value="' . $ID . '" '; |
|
1372 | + $option .= $ID === absint($default) ? ' selected' : ''; |
|
1373 | + $option .= '>'; |
|
1374 | + $option .= "$pad {$post_title}"; |
|
1375 | + $option .= '</option>'; |
|
1376 | + $output .= $option; |
|
1377 | + ob_start(); |
|
1378 | + parent_dropdown($default, $item->ID, $level + 1); |
|
1379 | + $output .= ob_get_clean(); |
|
1380 | + } |
|
1381 | + } |
|
1382 | + if ($echo) { |
|
1383 | + echo wp_kses($output, AllowedTags::getWithFormTags()); |
|
1384 | + return ''; |
|
1385 | + } |
|
1386 | + return $output; |
|
1387 | + } |
|
1388 | + |
|
1389 | + |
|
1390 | + /** |
|
1391 | + * Loads the scripts for the privacy settings form |
|
1392 | + */ |
|
1393 | + public function load_scripts_styles_privacy_settings() |
|
1394 | + { |
|
1395 | + $form_handler = $this->loader->getShared( |
|
1396 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1397 | + ); |
|
1398 | + $form_handler->enqueueStylesAndScripts(); |
|
1399 | + } |
|
1400 | + |
|
1401 | + |
|
1402 | + /** |
|
1403 | + * display the privacy settings form |
|
1404 | + * |
|
1405 | + * @throws EE_Error |
|
1406 | + */ |
|
1407 | + public function privacySettings() |
|
1408 | + { |
|
1409 | + $this->_set_add_edit_form_tags('update_privacy_settings'); |
|
1410 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1411 | + $form_handler = $this->loader->getShared( |
|
1412 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1413 | + ); |
|
1414 | + $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
1415 | + $form_handler->display(), |
|
1416 | + '', |
|
1417 | + 'padding' |
|
1418 | + ); |
|
1419 | + $this->display_admin_page_with_sidebar(); |
|
1420 | + } |
|
1421 | + |
|
1422 | + |
|
1423 | + /** |
|
1424 | + * Update the privacy settings from form data |
|
1425 | + * |
|
1426 | + * @throws EE_Error |
|
1427 | + */ |
|
1428 | + public function updatePrivacySettings() |
|
1429 | + { |
|
1430 | + $form_handler = $this->loader->getShared( |
|
1431 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1432 | + ); |
|
1433 | + $success = $form_handler->process($this->get_request_data()); |
|
1434 | + $this->_redirect_after_action( |
|
1435 | + $success, |
|
1436 | + esc_html__('Registration Form Options', 'event_espresso'), |
|
1437 | + 'updated', |
|
1438 | + ['action' => 'privacy_settings'] |
|
1439 | + ); |
|
1440 | + } |
|
1441 | 1441 | } |
@@ -247,19 +247,19 @@ discard block |
||
247 | 247 | 'event_espresso' |
248 | 248 | ) |
249 | 249 | ); |
250 | - EE_Registry::$i18n_js_strings['error_occurred'] = wp_strip_all_tags( |
|
250 | + EE_Registry::$i18n_js_strings['error_occurred'] = wp_strip_all_tags( |
|
251 | 251 | esc_html__( |
252 | 252 | 'An error occurred! Please refresh the page and try again.', |
253 | 253 | 'event_espresso' |
254 | 254 | ) |
255 | 255 | ); |
256 | - EE_Registry::$i18n_js_strings['confirm_delete_state'] = wp_strip_all_tags( |
|
256 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = wp_strip_all_tags( |
|
257 | 257 | esc_html__( |
258 | 258 | 'Are you sure you want to delete this State / Province?', |
259 | 259 | 'event_espresso' |
260 | 260 | ) |
261 | 261 | ); |
262 | - EE_Registry::$i18n_js_strings['ajax_url'] = admin_url( |
|
262 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url( |
|
263 | 263 | 'admin-ajax.php?page=espresso_general_settings', |
264 | 264 | is_ssl() ? 'https://' : 'http://' |
265 | 265 | ); |
@@ -288,12 +288,12 @@ discard block |
||
288 | 288 | wp_enqueue_script('thickbox'); |
289 | 289 | wp_register_script( |
290 | 290 | 'organization_settings', |
291 | - GEN_SET_ASSETS_URL . 'your_organization_settings.js', |
|
291 | + GEN_SET_ASSETS_URL.'your_organization_settings.js', |
|
292 | 292 | ['jquery', 'media-upload', 'thickbox'], |
293 | 293 | EVENT_ESPRESSO_VERSION, |
294 | 294 | true |
295 | 295 | ); |
296 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
296 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
297 | 297 | wp_enqueue_script('organization_settings'); |
298 | 298 | wp_enqueue_style('organization-css'); |
299 | 299 | $confirm_image_delete = [ |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | // scripts |
317 | 317 | wp_register_script( |
318 | 318 | 'gen_settings_countries', |
319 | - GEN_SET_ASSETS_URL . 'gen_settings_countries.js', |
|
319 | + GEN_SET_ASSETS_URL.'gen_settings_countries.js', |
|
320 | 320 | ['ee_admin_js'], |
321 | 321 | EVENT_ESPRESSO_VERSION, |
322 | 322 | true |
323 | 323 | ); |
324 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
324 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
325 | 325 | wp_enqueue_script('gen_settings_countries'); |
326 | 326 | wp_enqueue_style('organization-css'); |
327 | 327 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
370 | 370 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
371 | 371 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
372 | - GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', |
|
372 | + GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', |
|
373 | 373 | $this->_template_args, |
374 | 374 | true |
375 | 375 | ); |
@@ -385,12 +385,12 @@ discard block |
||
385 | 385 | protected function _update_espresso_page_settings() |
386 | 386 | { |
387 | 387 | // capture incoming request data && set page IDs |
388 | - $this->core_config->reg_page_id = $this->request->getRequestParam( |
|
388 | + $this->core_config->reg_page_id = $this->request->getRequestParam( |
|
389 | 389 | 'reg_page_id', |
390 | 390 | $this->core_config->reg_page_id, |
391 | 391 | DataType::INT |
392 | 392 | ); |
393 | - $this->core_config->txn_page_id = $this->request->getRequestParam( |
|
393 | + $this->core_config->txn_page_id = $this->request->getRequestParam( |
|
394 | 394 | 'txn_page_id', |
395 | 395 | $this->core_config->txn_page_id, |
396 | 396 | DataType::INT |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $this->core_config->thank_you_page_id, |
401 | 401 | DataType::INT |
402 | 402 | ); |
403 | - $this->core_config->cancel_page_id = $this->request->getRequestParam( |
|
403 | + $this->core_config->cancel_page_id = $this->request->getRequestParam( |
|
404 | 404 | 'cancel_page_id', |
405 | 405 | $this->core_config->cancel_page_id, |
406 | 406 | DataType::INT |
@@ -666,16 +666,16 @@ discard block |
||
666 | 666 | $country->ID(), |
667 | 667 | $country |
668 | 668 | ); |
669 | - $this->_template_args['country_states_settings'] = $this->display_country_states( |
|
669 | + $this->_template_args['country_states_settings'] = $this->display_country_states( |
|
670 | 670 | $country->ID(), |
671 | 671 | $country |
672 | 672 | ); |
673 | - $this->_template_args['CNT_name_for_site'] = $country->name(); |
|
673 | + $this->_template_args['CNT_name_for_site'] = $country->name(); |
|
674 | 674 | |
675 | 675 | $this->_set_add_edit_form_tags('update_country_settings'); |
676 | 676 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
677 | 677 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
678 | - GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', |
|
678 | + GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', |
|
679 | 679 | $this->_template_args, |
680 | 680 | true |
681 | 681 | ); |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | $CNT_ISO = $this->getCountryISO($CNT_ISO); |
700 | 700 | $CNT_ISO_for_site = $this->getCountryIsoForSite(); |
701 | 701 | |
702 | - if (! $CNT_ISO) { |
|
702 | + if ( ! $CNT_ISO) { |
|
703 | 703 | return ''; |
704 | 704 | } |
705 | 705 | |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $CNT_cur_disabled = $CNT_ISO !== $CNT_ISO_for_site; |
713 | 713 | $this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled; |
714 | 714 | |
715 | - $country_input_types = [ |
|
715 | + $country_input_types = [ |
|
716 | 716 | 'CNT_active' => [ |
717 | 717 | 'type' => 'RADIO_BTN', |
718 | 718 | 'input_name' => "cntry[$CNT_ISO]", |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | $country, |
838 | 838 | $country_input_types |
839 | 839 | ); |
840 | - $country_details_settings = EEH_Template::display_template( |
|
841 | - GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', |
|
840 | + $country_details_settings = EEH_Template::display_template( |
|
841 | + GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', |
|
842 | 842 | $this->_template_args, |
843 | 843 | true |
844 | 844 | ); |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | public function display_country_states(string $CNT_ISO = '', ?EE_Country $country = null): string |
873 | 873 | { |
874 | 874 | $CNT_ISO = $this->getCountryISO($CNT_ISO); |
875 | - if (! $CNT_ISO) { |
|
875 | + if ( ! $CNT_ISO) { |
|
876 | 876 | return ''; |
877 | 877 | } |
878 | 878 | // for ajax |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | ); |
949 | 949 | |
950 | 950 | $state_details_settings = EEH_Template::display_template( |
951 | - GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', |
|
951 | + GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', |
|
952 | 952 | $this->_template_args, |
953 | 953 | true |
954 | 954 | ); |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | { |
981 | 981 | $success = true; |
982 | 982 | $CNT_ISO = $this->getCountryISO(''); |
983 | - if (! $CNT_ISO) { |
|
983 | + if ( ! $CNT_ISO) { |
|
984 | 984 | EE_Error::add_error( |
985 | 985 | esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
986 | 986 | __FILE__, |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | $success = false; |
991 | 991 | } |
992 | 992 | $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
993 | - if (! $STA_abbrev) { |
|
993 | + if ( ! $STA_abbrev) { |
|
994 | 994 | EE_Error::add_error( |
995 | 995 | esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), |
996 | 996 | __FILE__, |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | $success = false; |
1001 | 1001 | } |
1002 | 1002 | $STA_name = $this->request->getRequestParam('STA_name'); |
1003 | - if (! $STA_name) { |
|
1003 | + if ( ! $STA_name) { |
|
1004 | 1004 | EE_Error::add_error( |
1005 | 1005 | esc_html__('No State name or an invalid State name was received.', 'event_espresso'), |
1006 | 1006 | __FILE__, |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | 'STA_name' => $STA_name, |
1018 | 1018 | 'STA_active' => true, |
1019 | 1019 | ]; |
1020 | - $success = EEM_State::instance()->insert($cols_n_values); |
|
1020 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
1021 | 1021 | EE_Error::add_success(esc_html__('The State was added successfully.', 'event_espresso')); |
1022 | 1022 | } |
1023 | 1023 | |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | $STA_ID = $this->request->getRequestParam('STA_ID'); |
1050 | 1050 | $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
1051 | 1051 | |
1052 | - if (! $STA_ID) { |
|
1052 | + if ( ! $STA_ID) { |
|
1053 | 1053 | EE_Error::add_error( |
1054 | 1054 | esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'), |
1055 | 1055 | __FILE__, |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | protected function _update_country_settings() |
1094 | 1094 | { |
1095 | 1095 | $CNT_ISO = $this->getCountryISO(); |
1096 | - if (! $CNT_ISO) { |
|
1096 | + if ( ! $CNT_ISO) { |
|
1097 | 1097 | EE_Error::add_error( |
1098 | 1098 | esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
1099 | 1099 | __FILE__, |
@@ -1117,15 +1117,15 @@ discard block |
||
1117 | 1117 | $country->currency_code() |
1118 | 1118 | ) |
1119 | 1119 | ); |
1120 | - $cols_n_values['CNT_cur_single'] = $this->request->getRequestParam( |
|
1120 | + $cols_n_values['CNT_cur_single'] = $this->request->getRequestParam( |
|
1121 | 1121 | "cntry[$CNT_ISO][CNT_cur_single]", |
1122 | 1122 | $country->currency_name_single() |
1123 | 1123 | ); |
1124 | - $cols_n_values['CNT_cur_plural'] = $this->request->getRequestParam( |
|
1124 | + $cols_n_values['CNT_cur_plural'] = $this->request->getRequestParam( |
|
1125 | 1125 | "cntry[$CNT_ISO][CNT_cur_plural]", |
1126 | 1126 | $country->currency_name_plural() |
1127 | 1127 | ); |
1128 | - $cols_n_values['CNT_cur_sign'] = $this->request->getRequestParam( |
|
1128 | + $cols_n_values['CNT_cur_sign'] = $this->request->getRequestParam( |
|
1129 | 1129 | "cntry[$CNT_ISO][CNT_cur_sign]", |
1130 | 1130 | $country->currency_sign() |
1131 | 1131 | ); |
@@ -1142,15 +1142,15 @@ discard block |
||
1142 | 1142 | "cntry[$CNT_ISO][CNT_cur_dec_mrk]", |
1143 | 1143 | $country->currency_decimal_mark() |
1144 | 1144 | ); |
1145 | - $cols_n_values['CNT_cur_thsnds'] = $this->request->getRequestParam( |
|
1145 | + $cols_n_values['CNT_cur_thsnds'] = $this->request->getRequestParam( |
|
1146 | 1146 | "cntry[$CNT_ISO][CNT_cur_thsnds]", |
1147 | 1147 | $country->currency_thousands_separator() |
1148 | 1148 | ); |
1149 | - $cols_n_values['CNT_tel_code'] = $this->request->getRequestParam( |
|
1149 | + $cols_n_values['CNT_tel_code'] = $this->request->getRequestParam( |
|
1150 | 1150 | "cntry[$CNT_ISO][CNT_tel_code]", |
1151 | 1151 | $country->telephoneCode() |
1152 | 1152 | ); |
1153 | - $cols_n_values['CNT_active'] = $this->request->getRequestParam( |
|
1153 | + $cols_n_values['CNT_active'] = $this->request->getRequestParam( |
|
1154 | 1154 | "cntry[$CNT_ISO][CNT_active]", |
1155 | 1155 | $country->isActive(), |
1156 | 1156 | DataType::BOOL |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | $this->request->getRequestParam('states', [], DataType::STRING, true) |
1174 | 1174 | ); |
1175 | 1175 | |
1176 | - if (! empty($states) && $success !== false) { |
|
1176 | + if ( ! empty($states) && $success !== false) { |
|
1177 | 1177 | // loop thru state data ( looks like : states[75][STA_name] ) |
1178 | 1178 | foreach ($states as $STA_ID => $state) { |
1179 | 1179 | $cols_n_values = [ |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | return ' |
1232 | 1232 | <tr> |
1233 | 1233 | <th> |
1234 | - ' . $label . ' |
|
1234 | + ' . $label.' |
|
1235 | 1235 | </th>'; |
1236 | 1236 | } |
1237 | 1237 | |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | { |
1247 | 1247 | return ' |
1248 | 1248 | <td class="general-settings-country-input-td"> |
1249 | - ' . $input . ' |
|
1249 | + ' . $input.' |
|
1250 | 1250 | </td> |
1251 | 1251 | </tr>'; |
1252 | 1252 | } |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | { |
1276 | 1276 | return ' |
1277 | 1277 | <td class="general-settings-country-state-input-td"> |
1278 | - ' . $input . ' |
|
1278 | + ' . $input.' |
|
1279 | 1279 | </td>'; |
1280 | 1280 | } |
1281 | 1281 | |
@@ -1295,9 +1295,9 @@ discard block |
||
1295 | 1295 | ['post' => $ee_page_id, 'action' => 'edit'], |
1296 | 1296 | admin_url('post.php') |
1297 | 1297 | ); |
1298 | - $links = '<a href="' . esc_url_raw($edit_url) . '" >' . esc_html__('Edit', 'event_espresso') . '</a>'; |
|
1298 | + $links = '<a href="'.esc_url_raw($edit_url).'" >'.esc_html__('Edit', 'event_espresso').'</a>'; |
|
1299 | 1299 | $links .= ' | '; |
1300 | - $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>'; |
|
1300 | + $links .= '<a href="'.get_permalink($ee_page_id).'" >'.esc_html__('View', 'event_espresso').'</a>'; |
|
1301 | 1301 | |
1302 | 1302 | return $links; |
1303 | 1303 | } |
@@ -1331,8 +1331,8 @@ discard block |
||
1331 | 1331 | } |
1332 | 1332 | |
1333 | 1333 | return ' |
1334 | - <span class="ee-page-status ' . $pg_class . '"><strong>' . $pg_status . '</strong></span> |
|
1335 | - <span class="ee-page-status ' . $sc_class . '"><strong>' . $sc_status . '</strong></span>'; |
|
1334 | + <span class="ee-page-status ' . $pg_class.'"><strong>'.$pg_status.'</strong></span> |
|
1335 | + <span class="ee-page-status ' . $sc_class.'"><strong>'.$sc_status.'</strong></span>'; |
|
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | |
@@ -1352,7 +1352,7 @@ discard block |
||
1352 | 1352 | bool $echo = true |
1353 | 1353 | ): string { |
1354 | 1354 | global $wpdb; |
1355 | - $items = $wpdb->get_results( |
|
1355 | + $items = $wpdb->get_results( |
|
1356 | 1356 | $wpdb->prepare( |
1357 | 1357 | "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", |
1358 | 1358 | $parent |
@@ -1367,8 +1367,8 @@ discard block |
||
1367 | 1367 | $post_title = wp_strip_all_tags($item->post_title); |
1368 | 1368 | $pad = str_repeat(' ', $level * 3); |
1369 | 1369 | $option = "\n\t"; |
1370 | - $option .= '<option class="level-' . $level . '" '; |
|
1371 | - $option .= 'value="' . $ID . '" '; |
|
1370 | + $option .= '<option class="level-'.$level.'" '; |
|
1371 | + $option .= 'value="'.$ID.'" '; |
|
1372 | 1372 | $option .= $ID === absint($default) ? ' selected' : ''; |
1373 | 1373 | $option .= '>'; |
1374 | 1374 | $option .= "$pad {$post_title}"; |
@@ -33,11 +33,11 @@ |
||
33 | 33 | <td class="jst-rght"><?php echo wp_kses($attendee['ticket_price'], AllowedTags::getAllowedTags()); ?></td> |
34 | 34 | <td class="jst-left"> |
35 | 35 | <?php |
36 | - $att_link = EE_Admin_Page::add_query_args_and_nonce( |
|
37 | - ['action' => 'view_registration', '_REG_ID' => $registration], |
|
38 | - REG_ADMIN_URL |
|
39 | - ); |
|
40 | - ?> |
|
36 | + $att_link = EE_Admin_Page::add_query_args_and_nonce( |
|
37 | + ['action' => 'view_registration', '_REG_ID' => $registration], |
|
38 | + REG_ADMIN_URL |
|
39 | + ); |
|
40 | + ?> |
|
41 | 41 | <a href="<?php echo esc_url_raw($att_link); ?>" |
42 | 42 | title="<?php esc_attr_e('View details for this registrant', 'event_espresso'); ?>" |
43 | 43 | > |
@@ -18,14 +18,14 @@ |
||
18 | 18 | <div class="ee-admin-page-nav-strip-wrap"> |
19 | 19 | <div class='ee-admin-page-nav-strip'> |
20 | 20 | <?php |
21 | - echo wp_kses($previous_transaction, AllowedTags::getAllowedTags()); |
|
22 | - echo ' ' . sprintf( |
|
23 | - /* translators: %s: transaction number */ |
|
24 | - esc_html__('Transaction # %1$s', 'event_espresso'), |
|
25 | - esc_html($txn_nmbr['value']) |
|
26 | - ) . ' '; |
|
27 | - echo wp_kses($next_transaction, AllowedTags::getAllowedTags()); |
|
28 | - ?> |
|
21 | + echo wp_kses($previous_transaction, AllowedTags::getAllowedTags()); |
|
22 | + echo ' ' . sprintf( |
|
23 | + /* translators: %s: transaction number */ |
|
24 | + esc_html__('Transaction # %1$s', 'event_espresso'), |
|
25 | + esc_html($txn_nmbr['value']) |
|
26 | + ) . ' '; |
|
27 | + echo wp_kses($next_transaction, AllowedTags::getAllowedTags()); |
|
28 | + ?> |
|
29 | 29 | </div> |
30 | 30 | </div> |
31 | 31 |
@@ -19,11 +19,11 @@ |
||
19 | 19 | <div class='ee-admin-page-nav-strip'> |
20 | 20 | <?php |
21 | 21 | echo wp_kses($previous_transaction, AllowedTags::getAllowedTags()); |
22 | - echo ' ' . sprintf( |
|
22 | + echo ' '.sprintf( |
|
23 | 23 | /* translators: %s: transaction number */ |
24 | 24 | esc_html__('Transaction # %1$s', 'event_espresso'), |
25 | 25 | esc_html($txn_nmbr['value']) |
26 | - ) . ' '; |
|
26 | + ).' '; |
|
27 | 27 | echo wp_kses($next_transaction, AllowedTags::getAllowedTags()); |
28 | 28 | ?> |
29 | 29 | </div> |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | </div> |
84 | 84 | <br class="clear" /> |
85 | 85 | <?php |
86 | - $no_payments = $grand_raw_total > 0 |
|
87 | - || $TXN_status !== EEM_Transaction::complete_status_code |
|
88 | - || ! empty($payments); |
|
89 | - ?> |
|
86 | + $no_payments = $grand_raw_total > 0 |
|
87 | + || $TXN_status !== EEM_Transaction::complete_status_code |
|
88 | + || ! empty($payments); |
|
89 | + ?> |
|
90 | 90 | <?php if ($attendee instanceof EE_Attendee && $no_payments) : ?> |
91 | 91 | <?php $no_payment_text = $can_edit_payments |
92 | - ? esc_html__( |
|
93 | - 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', |
|
94 | - 'event_espresso' |
|
95 | - ) |
|
96 | - : esc_html__( |
|
97 | - 'No payments have been applied to this transaction yet.', |
|
98 | - 'event_espresso' |
|
99 | - ); |
|
100 | - ?> |
|
92 | + ? esc_html__( |
|
93 | + 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', |
|
94 | + 'event_espresso' |
|
95 | + ) |
|
96 | + : esc_html__( |
|
97 | + 'No payments have been applied to this transaction yet.', |
|
98 | + 'event_espresso' |
|
99 | + ); |
|
100 | + ?> |
|
101 | 101 | |
102 | 102 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
103 | 103 | <?php esc_html_e('Payment Details', 'event_espresso'); ?> |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | <?php if ($payments) : ?> |
144 | 144 | <?php $payment_total = 0; ?> |
145 | 145 | <?php foreach ($payments as $PAY_ID => $payment) : |
146 | - if (! $payment instanceof EE_Payment) { |
|
147 | - continue; |
|
148 | - } |
|
149 | - $existing_reg_payment_json = isset($existing_reg_payments[ $PAY_ID ]) |
|
150 | - ? wp_json_encode($existing_reg_payments[ $PAY_ID ]) |
|
151 | - : '{}'; |
|
152 | - ?> |
|
146 | + if (! $payment instanceof EE_Payment) { |
|
147 | + continue; |
|
148 | + } |
|
149 | + $existing_reg_payment_json = isset($existing_reg_payments[ $PAY_ID ]) |
|
150 | + ? wp_json_encode($existing_reg_payments[ $PAY_ID ]) |
|
151 | + : '{}'; |
|
152 | + ?> |
|
153 | 153 | <tr id="txn-admin-payment-tr-<?php echo absint($PAY_ID); ?>" class=' jst-cntr'> |
154 | 154 | <td class="jst-cntr no-pad"> |
155 | 155 | <span id="payment-status-<?php echo absint($PAY_ID); ?>" |
@@ -173,20 +173,20 @@ discard block |
||
173 | 173 | </td> |
174 | 174 | <td class=' jst-rght'> |
175 | 175 | <?php |
176 | - $payment_class = $payment->amount() > 0 |
|
177 | - ? 'txn-admin-payment-status-' . $payment->STS_ID() |
|
178 | - : 'txn-admin-payment-status-PDC'; |
|
179 | - ?> |
|
176 | + $payment_class = $payment->amount() > 0 |
|
177 | + ? 'txn-admin-payment-status-' . $payment->STS_ID() |
|
178 | + : 'txn-admin-payment-status-PDC'; |
|
179 | + ?> |
|
180 | 180 | <span class="<?php echo esc_attr($payment_class); ?>"> |
181 | 181 | <span id="payment-amount-<?php echo $escaped_pay_id; ?>" |
182 | 182 | style="display:inline;" |
183 | 183 | > |
184 | 184 | <?php echo EEH_Template::format_currency( |
185 | - $payment->amount(), |
|
186 | - false, |
|
187 | - false |
|
188 | - ); // already escaped |
|
189 | - ?> |
|
185 | + $payment->amount(), |
|
186 | + false, |
|
187 | + false |
|
188 | + ); // already escaped |
|
189 | + ?> |
|
190 | 190 | </span> |
191 | 191 | </span> |
192 | 192 | </td> |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | <span class="ee-status--ignore">»</span> |
198 | 198 | <span id="payment-gateway-<?php echo absint($PAY_ID); ?>"> |
199 | 199 | <?php echo ($payment->payment_method() instanceof EE_Payment_Method |
200 | - ? esc_html($payment->payment_method()->admin_name()) |
|
201 | - : esc_html__("Unknown", 'event_espresso')); ?> |
|
200 | + ? esc_html($payment->payment_method()->admin_name()) |
|
201 | + : esc_html__("Unknown", 'event_espresso')); ?> |
|
202 | 202 | </span> |
203 | 203 | <span id="payment-gateway-id-<?php echo absint($PAY_ID); ?>" class="hidden"> |
204 | 204 | <?php echo ($payment->payment_method() instanceof EE_Payment_Method |
205 | - ? esc_html($payment->payment_method()->ID()) |
|
206 | - : 0); ?> |
|
205 | + ? esc_html($payment->payment_method()->ID()) |
|
206 | + : 0); ?> |
|
207 | 207 | </span> |
208 | 208 | </td> |
209 | 209 | <td class=" jst-left"> |
@@ -228,18 +228,18 @@ discard block |
||
228 | 228 | </td> |
229 | 229 | <td class=" jst-rght"> |
230 | 230 | <?php |
231 | - $payment_class = $payment->amount() > 0 |
|
232 | - ? 'txn-admin-payment-status-' . $payment->STS_ID() |
|
233 | - : 'txn-admin-payment-status-PDC'; |
|
234 | - ?> |
|
231 | + $payment_class = $payment->amount() > 0 |
|
232 | + ? 'txn-admin-payment-status-' . $payment->STS_ID() |
|
233 | + : 'txn-admin-payment-status-PDC'; |
|
234 | + ?> |
|
235 | 235 | <span class="<?php echo esc_attr($payment_class); ?>"> |
236 | 236 | <span id="payment-amount-<?php echo absint($PAY_ID); ?>" style="display:inline;"> |
237 | 237 | <?php echo EEH_Template::format_currency( |
238 | - $payment->amount(), |
|
239 | - false, |
|
240 | - false |
|
241 | - ); // already escaped |
|
242 | - ?> |
|
238 | + $payment->amount(), |
|
239 | + false, |
|
240 | + false |
|
241 | + ); // already escaped |
|
242 | + ?> |
|
243 | 243 | </span> |
244 | 244 | </span> |
245 | 245 | </td> |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | <?php $payment_total += $payment->STS_ID() == 'PAP' ? $payment->amount() : 0; ?> |
272 | 272 | <?php endforeach; ?> |
273 | 273 | <?php $pay_totals_class = $payment_total > $grand_raw_total |
274 | - ? ' important-notice' |
|
275 | - : ''; |
|
276 | - ?> |
|
274 | + ? ' important-notice' |
|
275 | + : ''; |
|
276 | + ?> |
|
277 | 277 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden"> |
278 | 278 | <td class=" jst-rght" colspan="10"> |
279 | 279 | <span class="important-notice"><?php echo wp_kses($no_payment_text, AllowedTags::getAllowedTags()); ?></span> |
@@ -285,27 +285,27 @@ discard block |
||
285 | 285 | <th class=" jst-rght" colspan="9"> |
286 | 286 | <span id="payments-total-spn"> |
287 | 287 | <?php |
288 | - $overpaid = $payment_total > $grand_raw_total |
|
289 | - ? '<span id="overpaid">' |
|
290 | - . __('This transaction has been overpaid ! ', 'event_espresso') |
|
291 | - . '</span>' |
|
292 | - : ''; |
|
293 | - echo $overpaid . esc_html( |
|
294 | - sprintf( |
|
295 | - __('Payments Total %s', 'event_espresso'), |
|
296 | - '(' . EE_Registry::instance()->CFG->currency->code . ')' |
|
297 | - ) |
|
298 | - ); ?> |
|
288 | + $overpaid = $payment_total > $grand_raw_total |
|
289 | + ? '<span id="overpaid">' |
|
290 | + . __('This transaction has been overpaid ! ', 'event_espresso') |
|
291 | + . '</span>' |
|
292 | + : ''; |
|
293 | + echo $overpaid . esc_html( |
|
294 | + sprintf( |
|
295 | + __('Payments Total %s', 'event_espresso'), |
|
296 | + '(' . EE_Registry::instance()->CFG->currency->code . ')' |
|
297 | + ) |
|
298 | + ); ?> |
|
299 | 299 | </span> |
300 | 300 | </th> |
301 | 301 | <th class=" jst-rght"> |
302 | 302 | <span id="txn-admin-payment-total"> |
303 | 303 | <?php |
304 | - echo EEH_Template::format_currency( |
|
305 | - $payment_total, |
|
306 | - false, |
|
307 | - false |
|
308 | - ); // already escaped ?> |
|
304 | + echo EEH_Template::format_currency( |
|
305 | + $payment_total, |
|
306 | + false, |
|
307 | + false |
|
308 | + ); // already escaped ?> |
|
309 | 309 | </span> |
310 | 310 | </th> |
311 | 311 | </tr> |
@@ -406,15 +406,15 @@ discard block |
||
406 | 406 | </span> |
407 | 407 | <?php endif; ?> |
408 | 408 | <?php |
409 | - // Allows extend the fields at actions area. |
|
410 | - ob_start(); |
|
411 | - do_action( |
|
412 | - 'AHEE__txn_admin_details_main_meta_box_txn_details__after_actions_buttons', |
|
413 | - $can_edit_payments |
|
414 | - ); |
|
415 | - $extra_actions = ob_get_clean(); |
|
416 | - echo str_replace(['<li', '</li>'], ['<span', '</span>'], $extra_actions); |
|
417 | - ?> |
|
409 | + // Allows extend the fields at actions area. |
|
410 | + ob_start(); |
|
411 | + do_action( |
|
412 | + 'AHEE__txn_admin_details_main_meta_box_txn_details__after_actions_buttons', |
|
413 | + $can_edit_payments |
|
414 | + ); |
|
415 | + $extra_actions = ob_get_clean(); |
|
416 | + echo str_replace(['<li', '</li>'], ['<span', '</span>'], $extra_actions); |
|
417 | + ?> |
|
418 | 418 | </div> |
419 | 419 | |
420 | 420 | <div id="txn-admin-apply-payment-dv" class="txn-admin-payment-option auto-hide" style="display: none;"> |
@@ -430,23 +430,23 @@ discard block |
||
430 | 430 | style="display:none;" |
431 | 431 | > |
432 | 432 | <?php |
433 | - printf( |
|
434 | - esc_html__('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
435 | - '<span class="ee-admin-payment-id"></span>', |
|
436 | - $txn_nmbr['value'] |
|
437 | - ); |
|
438 | - ?> |
|
433 | + printf( |
|
434 | + esc_html__('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
435 | + '<span class="ee-admin-payment-id"></span>', |
|
436 | + $txn_nmbr['value'] |
|
437 | + ); |
|
438 | + ?> |
|
439 | 439 | <span class='dashicons dashicons-money-alt'></span> |
440 | 440 | </h2> |
441 | 441 | |
442 | 442 | <h2 id="admin-modal-dialog-edit-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
443 | 443 | <?php |
444 | - printf( |
|
445 | - esc_html__('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
446 | - '<span class="ee-admin-payment-id"></span>', |
|
447 | - $txn_nmbr['value'] |
|
448 | - ); |
|
449 | - ?> |
|
444 | + printf( |
|
445 | + esc_html__('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
446 | + '<span class="ee-admin-payment-id"></span>', |
|
447 | + $txn_nmbr['value'] |
|
448 | + ); |
|
449 | + ?> |
|
450 | 450 | <span class='dashicons dashicons-money-alt'></span> |
451 | 451 | </h2> |
452 | 452 | |
@@ -454,9 +454,9 @@ discard block |
||
454 | 454 | style="display:none;" |
455 | 455 | > |
456 | 456 | <?php |
457 | - echo esc_html__('Apply a Refund to Transaction #', 'event_espresso'); |
|
458 | - echo esc_html($txn_nmbr['value']); |
|
459 | - ?> |
|
457 | + echo esc_html__('Apply a Refund to Transaction #', 'event_espresso'); |
|
458 | + echo esc_html($txn_nmbr['value']); |
|
459 | + ?> |
|
460 | 460 | <span class='dashicons dashicons-money-alt'></span> |
461 | 461 | </h2> |
462 | 462 | |
@@ -570,20 +570,20 @@ discard block |
||
570 | 570 | <?php echo esc_attr($selected); ?> |
571 | 571 | > |
572 | 572 | <?php |
573 | - echo esc_html( |
|
574 | - sanitize_key($method->admin_desc()) |
|
575 | - ? substr($method->admin_desc(), 0, 128) |
|
576 | - : $method->admin_name() |
|
577 | - ); |
|
578 | - ?> |
|
573 | + echo esc_html( |
|
574 | + sanitize_key($method->admin_desc()) |
|
575 | + ? substr($method->admin_desc(), 0, 128) |
|
576 | + : $method->admin_name() |
|
577 | + ); |
|
578 | + ?> |
|
579 | 579 | </option> |
580 | 580 | <?php endforeach; ?> |
581 | 581 | </select> |
582 | 582 | <p class="description"> |
583 | 583 | <?php esc_html_e( |
584 | - 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', |
|
585 | - 'event_espresso' |
|
586 | - ); ?> |
|
584 | + 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', |
|
585 | + 'event_espresso' |
|
586 | + ); ?> |
|
587 | 587 | </p> |
588 | 588 | </div> |
589 | 589 | </div> |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | admin-modal-dialog-row ee-layout-row"> |
593 | 593 | <label for="txn-admin-payment-txn-id-chq-nmbr-inp" class=""> |
594 | 594 | <?php esc_html_e( |
595 | - 'TXN ID / CHQ #', |
|
596 | - 'event_espresso' |
|
597 | - ); ?> |
|
595 | + 'TXN ID / CHQ #', |
|
596 | + 'event_espresso' |
|
597 | + ); ?> |
|
598 | 598 | </label> |
599 | 599 | <div class='ee-layout-stack'> |
600 | 600 | <input name="txn_admin_payment[txn_id_chq_nmbr]" |
@@ -604,9 +604,9 @@ discard block |
||
604 | 604 | /> |
605 | 605 | <p class="description"> |
606 | 606 | <?php esc_html_e( |
607 | - 'The Transaction ID sent back from the payment gateway, or the Cheque #', |
|
608 | - 'event_espresso' |
|
609 | - ); ?> |
|
607 | + 'The Transaction ID sent back from the payment gateway, or the Cheque #', |
|
608 | + 'event_espresso' |
|
609 | + ); ?> |
|
610 | 610 | </p> |
611 | 611 | </div> |
612 | 612 | </div> |
@@ -624,9 +624,9 @@ discard block |
||
624 | 624 | /> |
625 | 625 | <p class="description"> |
626 | 626 | <?php esc_html_e( |
627 | - 'The gateway response string (optional)', |
|
628 | - 'event_espresso' |
|
629 | - ); ?> |
|
627 | + 'The gateway response string (optional)', |
|
628 | + 'event_espresso' |
|
629 | + ); ?> |
|
630 | 630 | </p> |
631 | 631 | </div> |
632 | 632 | </div> |
@@ -635,9 +635,9 @@ discard block |
||
635 | 635 | ee-layout-row"> |
636 | 636 | <label for="txn-admin-payment-status-slct" class=""> |
637 | 637 | <?php esc_html_e( |
638 | - 'Payment Status', |
|
639 | - 'event_espresso' |
|
640 | - ); ?> |
|
638 | + 'Payment Status', |
|
639 | + 'event_espresso' |
|
640 | + ); ?> |
|
641 | 641 | </label> |
642 | 642 | <div class='ee-layout-stack'> |
643 | 643 | <select name="txn_admin_payment[status]" |
@@ -647,10 +647,10 @@ discard block |
||
647 | 647 | > |
648 | 648 | <?php foreach ($payment_status as $STS_ID => $STS_code) : ?> |
649 | 649 | <?php |
650 | - $selected = $STS_ID == 'PAP' |
|
651 | - ? 'selected' |
|
652 | - : ''; |
|
653 | - ?> |
|
650 | + $selected = $STS_ID == 'PAP' |
|
651 | + ? 'selected' |
|
652 | + : ''; |
|
653 | + ?> |
|
654 | 654 | <option id="payment-status-opt-<?php echo esc_attr($STS_ID); ?>" |
655 | 655 | value="<?php echo esc_attr($STS_ID); ?>" |
656 | 656 | <?php echo esc_attr($selected); ?> |
@@ -661,10 +661,10 @@ discard block |
||
661 | 661 | </select> |
662 | 662 | <p class="description"> |
663 | 663 | <?php |
664 | - esc_html_e( |
|
665 | - 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', |
|
666 | - 'event_espresso' |
|
667 | - ); ?> |
|
664 | + esc_html_e( |
|
665 | + 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', |
|
666 | + 'event_espresso' |
|
667 | + ); ?> |
|
668 | 668 | </p> |
669 | 669 | </div> |
670 | 670 | </div> |
@@ -682,9 +682,9 @@ discard block |
||
682 | 682 | /> |
683 | 683 | <p class="description"> |
684 | 684 | <?php esc_html_e( |
685 | - 'The Purchase or Sales Order Number if any (optional)', |
|
686 | - 'event_espresso' |
|
687 | - ); ?> |
|
685 | + 'The Purchase or Sales Order Number if any (optional)', |
|
686 | + 'event_espresso' |
|
687 | + ); ?> |
|
688 | 688 | </p> |
689 | 689 | </div> |
690 | 690 | </div> |
@@ -707,9 +707,9 @@ discard block |
||
707 | 707 | /> |
708 | 708 | <p class="description"> |
709 | 709 | <?php esc_html_e( |
710 | - 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', |
|
711 | - 'event_espresso' |
|
712 | - ); ?> |
|
710 | + 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', |
|
711 | + 'event_espresso' |
|
712 | + ); ?> |
|
713 | 713 | </p> |
714 | 714 | </div> |
715 | 715 | </div> |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | <?php echo wp_kses($status_change_select, AllowedTags::getWithFormTags()); ?> |
749 | 749 | <p class="description"> |
750 | 750 | <?php esc_html_e( |
751 | - 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', |
|
752 | - 'event_espresso' |
|
753 | - ); ?> |
|
751 | + 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', |
|
752 | + 'event_espresso' |
|
753 | + ); ?> |
|
754 | 754 | </p> |
755 | 755 | </div> |
756 | 756 | </div> |
@@ -781,14 +781,14 @@ discard block |
||
781 | 781 | <br class="clear-float" /> |
782 | 782 | <p class="description"> |
783 | 783 | <?php printf( |
784 | - esc_html__( |
|
785 | - 'By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', |
|
786 | - 'event_espresso' |
|
787 | - ), |
|
788 | - '<strong>', |
|
789 | - '</strong>', |
|
790 | - '<br />' |
|
791 | - ); ?> |
|
784 | + esc_html__( |
|
785 | + 'By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', |
|
786 | + 'event_espresso' |
|
787 | + ), |
|
788 | + '<strong>', |
|
789 | + '</strong>', |
|
790 | + '<br />' |
|
791 | + ); ?> |
|
792 | 792 | </p> |
793 | 793 | </div> |
794 | 794 | </div> |
@@ -843,10 +843,10 @@ discard block |
||
843 | 843 | style="display:none;" |
844 | 844 | > |
845 | 845 | <?php printf( |
846 | - esc_html__('Delete Payment/Refund for Transaction #', 'event_espresso'), |
|
847 | - $txn_nmbr['value'] |
|
848 | - ); |
|
849 | - ?> |
|
846 | + esc_html__('Delete Payment/Refund for Transaction #', 'event_espresso'), |
|
847 | + $txn_nmbr['value'] |
|
848 | + ); |
|
849 | + ?> |
|
850 | 850 | <span class='dashicons dashicons-money-alt'></span> |
851 | 851 | </h2> |
852 | 852 | |
@@ -886,13 +886,13 @@ discard block |
||
886 | 886 | <?php echo wp_kses($delete_status_change_select, AllowedTags::getWithFormTags()); ?> |
887 | 887 | <p class="description"> |
888 | 888 | <?php printf( |
889 | - esc_html__( |
|
890 | - 'If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', |
|
891 | - 'event_espresso' |
|
892 | - ), |
|
893 | - '<strong>', |
|
894 | - '</strong>' |
|
895 | - ); ?> |
|
889 | + esc_html__( |
|
890 | + 'If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', |
|
891 | + 'event_espresso' |
|
892 | + ), |
|
893 | + '<strong>', |
|
894 | + '</strong>' |
|
895 | + ); ?> |
|
896 | 896 | </p> |
897 | 897 | </div> |
898 | 898 | </div> |
@@ -909,10 +909,10 @@ discard block |
||
909 | 909 | /> |
910 | 910 | <p class="description"> |
911 | 911 | <?php |
912 | - esc_html_e( |
|
913 | - 'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', |
|
914 | - 'event_espresso' |
|
915 | - ); ?> |
|
912 | + esc_html_e( |
|
913 | + 'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', |
|
914 | + 'event_espresso' |
|
915 | + ); ?> |
|
916 | 916 | </p> |
917 | 917 | </div> |
918 | 918 | </div> |
@@ -940,8 +940,8 @@ discard block |
||
940 | 940 | <?php endif; // $grand_raw_total > 0?> |
941 | 941 | |
942 | 942 | <?php if (WP_DEBUG) { |
943 | - $delivered_messages = get_option('EED_Messages__payment', []); |
|
944 | - if (isset($delivered_messages[ $TXN_ID ])) { ?> |
|
943 | + $delivered_messages = get_option('EED_Messages__payment', []); |
|
944 | + if (isset($delivered_messages[ $TXN_ID ])) { ?> |
|
945 | 945 | <h4 class="admin-primary-mbox-h4 hdr-has-icon"> |
946 | 946 | <?php esc_html_e('Messages Sent to Primary Registrant', 'event_espresso'); ?> |
947 | 947 | <span class="dashicons dashicons-email-alt"></span> |
@@ -953,39 +953,39 @@ discard block |
||
953 | 953 | <th class="jst-left"><?php esc_html_e('Date & Time', 'event_espresso'); ?></th> |
954 | 954 | <th class="jst-left"><?php esc_html_e('Message Type', 'event_espresso'); ?></th> |
955 | 955 | <th class="jst-left"><?php esc_html_e( |
956 | - 'Payment Status Upon Sending', |
|
957 | - 'event_espresso' |
|
958 | - ); ?></th> |
|
956 | + 'Payment Status Upon Sending', |
|
957 | + 'event_espresso' |
|
958 | + ); ?></th> |
|
959 | 959 | <th class="jst-left"><?php esc_html_e('TXN Status Upon Sending', 'event_espresso'); ?></th> |
960 | 960 | </tr> |
961 | 961 | </thead> |
962 | 962 | <tbody> |
963 | 963 | <?php |
964 | - foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) : |
|
965 | - ?> |
|
964 | + foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) : |
|
965 | + ?> |
|
966 | 966 | <tr> |
967 | 967 | <td class="jst-left"> |
968 | 968 | <?php echo esc_html( |
969 | - date( |
|
970 | - get_option('date_format') . ' ' . get_option('time_format'), |
|
971 | - ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
972 | - ) |
|
973 | - ); ?> |
|
969 | + date( |
|
970 | + get_option('date_format') . ' ' . get_option('time_format'), |
|
971 | + ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
972 | + ) |
|
973 | + ); ?> |
|
974 | 974 | </td> |
975 | 975 | <td class="jst-left"><?php |
976 | - echo isset($delivered_message['message_type']) |
|
977 | - ? esc_html($delivered_message['message_type']) |
|
978 | - : ''; ?> |
|
976 | + echo isset($delivered_message['message_type']) |
|
977 | + ? esc_html($delivered_message['message_type']) |
|
978 | + : ''; ?> |
|
979 | 979 | </td> |
980 | 980 | <td class="jst-left"><?php |
981 | - echo isset($delivered_message['pay_status']) |
|
982 | - ? esc_html($delivered_message['pay_status']) |
|
983 | - : ''; ?> |
|
981 | + echo isset($delivered_message['pay_status']) |
|
982 | + ? esc_html($delivered_message['pay_status']) |
|
983 | + : ''; ?> |
|
984 | 984 | </td> |
985 | 985 | <td class="jst-left"><?php |
986 | - echo isset($delivered_message['txn_status']) |
|
987 | - ? esc_html($delivered_message['txn_status']) |
|
988 | - : ''; ?> |
|
986 | + echo isset($delivered_message['txn_status']) |
|
987 | + ? esc_html($delivered_message['txn_status']) |
|
988 | + : ''; ?> |
|
989 | 989 | </td> |
990 | 990 | </tr> |
991 | 991 | <?php endforeach; // $delivered_messages?> |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | </table> |
994 | 994 | </div> |
995 | 995 | <?php |
996 | - } |
|
997 | - } |
|
998 | - ?> |
|
996 | + } |
|
997 | + } |
|
998 | + ?> |
|
999 | 999 | </div> |
@@ -309,10 +309,13 @@ discard block |
||
309 | 309 | </span> |
310 | 310 | </th> |
311 | 311 | </tr> |
312 | - <?php else : ?> |
|
312 | + <?php else { |
|
313 | + : ?> |
|
313 | 314 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr"> |
314 | 315 | <td class=" jst-rght" colspan="10"> |
315 | - <span class="important-notice"><?php echo wp_kses($no_payment_text, AllowedTags::getAllowedTags()); ?></span> |
|
316 | + <span class="important-notice"><?php echo wp_kses($no_payment_text, AllowedTags::getAllowedTags()); |
|
317 | +} |
|
318 | +?></span> |
|
316 | 319 | </td> |
317 | 320 | </tr> |
318 | 321 | <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden"> |
@@ -400,9 +403,12 @@ discard block |
||
400 | 403 | > <!--display-the-hidden --> |
401 | 404 | <?php esc_html_e('Apply Refund', 'event_espresso'); ?> |
402 | 405 | </a> |
403 | - <?php else : ?> |
|
406 | + <?php else { |
|
407 | + : ?> |
|
404 | 408 | <span> |
405 | - <?php esc_html__('You do not have access to apply payments or refunds.', 'event_espresso'); ?> |
|
409 | + <?php esc_html__('You do not have access to apply payments or refunds.', 'event_espresso'); |
|
410 | +} |
|
411 | +?> |
|
406 | 412 | </span> |
407 | 413 | <?php endif; ?> |
408 | 414 | <?php |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $avatar = get_avatar_url($prime_reg_email); |
19 | 19 | ?> |
20 | 20 | <div id="admin-side-mbox-primary-registrant-dv" class="admin-side-mbox-dv"> |
21 | -<?php if (! empty($no_attendee_message)) : ?> |
|
21 | +<?php if ( ! empty($no_attendee_message)) : ?> |
|
22 | 22 | <div> |
23 | 23 | <?php echo esc_html($no_attendee_message); ?> |
24 | 24 | </div> |
25 | 25 | <?php else : ?> |
26 | - <?php if (! empty($avatar)) : ?> |
|
26 | + <?php if ( ! empty($avatar)) : ?> |
|
27 | 27 | <div class="ee-admin-attendee-avatar"> |
28 | 28 | <img alt="profile pic for <?php echo esc_html($attendee_full_name); ?>" src="<?php echo esc_url_raw($avatar); ?>" /> |
29 | 29 | </div> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | </a> |
41 | 41 | </div> |
42 | 42 | </div> |
43 | - <?php if (! empty($prime_reg_phone)) : ?> |
|
43 | + <?php if ( ! empty($prime_reg_phone)) : ?> |
|
44 | 44 | <div class='ee-admin-attendee-phone'> |
45 | 45 | <div class='ee-admin-contact-details-with-dashicon'> |
46 | 46 | <span class='dashicons dashicons-phone'></span> |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | </div> |
51 | 51 | </div> |
52 | 52 | <?php endif; ?> |
53 | - <?php if (! empty($formatted_address)) : ?> |
|
53 | + <?php if ( ! empty($formatted_address)) : ?> |
|
54 | 54 | <div class='ee-admin-attendee-address'> |
55 | 55 | <div class='ee-admin-contact-details-with-dashicon'> |
56 | 56 | <span class='dashicons dashicons-location'></span> |
@@ -22,10 +22,13 @@ |
||
22 | 22 | <div> |
23 | 23 | <?php echo esc_html($no_attendee_message); ?> |
24 | 24 | </div> |
25 | -<?php else : ?> |
|
25 | +<?php else { |
|
26 | + : ?> |
|
26 | 27 | <?php if (! empty($avatar)) : ?> |
27 | 28 | <div class="ee-admin-attendee-avatar"> |
28 | - <img alt="profile pic for <?php echo esc_html($attendee_full_name); ?>" src="<?php echo esc_url_raw($avatar); ?>" /> |
|
29 | + <img alt="profile pic for <?php echo esc_html($attendee_full_name); |
|
30 | +} |
|
31 | +?>" src="<?php echo esc_url_raw($avatar); ?>" /> |
|
29 | 32 | </div> |
30 | 33 | <?php endif; ?> |
31 | 34 | <div class='admin-side-mbox-text-dv'> |