@@ -19,11 +19,11 @@ |
||
19 | 19 | </div> <!-- post-body-content --> |
20 | 20 | |
21 | 21 | <?php |
22 | - // let's loop through the columns |
|
23 | - for ($i = 1; $i <= $num_columns; $i++) { |
|
24 | - $context = ($i === 1) ? 'normal' : 'side'; |
|
25 | - $context = ($i > 2) ? 'column' . $i : $context; |
|
26 | - ?> |
|
22 | + // let's loop through the columns |
|
23 | + for ($i = 1; $i <= $num_columns; $i++) { |
|
24 | + $context = ($i === 1) ? 'normal' : 'side'; |
|
25 | + $context = ($i > 2) ? 'column' . $i : $context; |
|
26 | + ?> |
|
27 | 27 | <div id='postbox-container-<?php echo absint($i); ?>' class='postbox-container'> |
28 | 28 | <?php do_meta_boxes($current_page, $context, null); ?> |
29 | 29 | </div> |
@@ -22,7 +22,7 @@ |
||
22 | 22 | // let's loop through the columns |
23 | 23 | for ($i = 1; $i <= $num_columns; $i++) { |
24 | 24 | $context = ($i === 1) ? 'normal' : 'side'; |
25 | - $context = ($i > 2) ? 'column' . $i : $context; |
|
25 | + $context = ($i > 2) ? 'column'.$i : $context; |
|
26 | 26 | ?> |
27 | 27 | <div id='postbox-container-<?php echo absint($i); ?>' class='postbox-container'> |
28 | 28 | <?php do_meta_boxes($current_page, $context, null); ?> |
@@ -12,109 +12,109 @@ discard block |
||
12 | 12 | class EEW_Upcoming_Events extends EspressoWidget |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - private $title; |
|
19 | - /** |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - private $events_category; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var bool |
|
26 | - */ |
|
27 | - private $show_expired; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - private $image_size; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var bool |
|
36 | - */ |
|
37 | - private $show_desc; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var bool |
|
41 | - */ |
|
42 | - private $show_dates; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - private $date_limit; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var string |
|
51 | - */ |
|
52 | - private $date_range; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var string |
|
56 | - */ |
|
57 | - private $limit; |
|
58 | - |
|
59 | - /** |
|
60 | - * @var string |
|
61 | - */ |
|
62 | - private $order; |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * Register widget with WordPress. |
|
67 | - */ |
|
68 | - public function __construct() |
|
69 | - { |
|
70 | - parent::__construct( |
|
71 | - esc_html__('Event Espresso Upcoming Events', 'event_espresso'), |
|
72 | - ['description' => esc_html__('A widget to display your upcoming events.', 'event_espresso')] |
|
73 | - ); |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * Back-end widget form. |
|
79 | - * |
|
80 | - * @param array $instance Previously saved values from database. |
|
81 | - * @return void |
|
82 | - * @throws EE_Error |
|
83 | - * @throws ReflectionException |
|
84 | - * @see WP_Widget::form() |
|
85 | - */ |
|
86 | - public function form($instance) |
|
87 | - { |
|
88 | - |
|
89 | - EE_Registry::instance()->load_class('Question_Option', [], false, false, true); |
|
90 | - // Set up some default widget settings. |
|
91 | - $defaults = [ |
|
92 | - 'title' => esc_html__('Upcoming Events', 'event_espresso'), |
|
93 | - 'category_name' => '', |
|
94 | - 'show_expired' => 0, |
|
95 | - 'show_desc' => true, |
|
96 | - 'show_dates' => true, |
|
97 | - 'show_everywhere' => false, |
|
98 | - 'date_limit' => 2, |
|
99 | - 'limit' => 10, |
|
100 | - 'sort' => 'ASC', |
|
101 | - 'date_range' => false, |
|
102 | - 'image_size' => 'medium', |
|
103 | - ]; |
|
104 | - |
|
105 | - $instance = wp_parse_args((array) $instance, $defaults); |
|
106 | - // don't add HTML labels for EE_Form_Fields generated inputs |
|
107 | - add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
108 | - $yes_no_values = [ |
|
109 | - EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]), |
|
110 | - EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]), |
|
111 | - ]; |
|
112 | - $sort_values = [ |
|
113 | - EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]), |
|
114 | - EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]), |
|
115 | - ]; |
|
116 | - |
|
117 | - ?> |
|
15 | + /** |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + private $title; |
|
19 | + /** |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + private $events_category; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var bool |
|
26 | + */ |
|
27 | + private $show_expired; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + private $image_size; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var bool |
|
36 | + */ |
|
37 | + private $show_desc; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var bool |
|
41 | + */ |
|
42 | + private $show_dates; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + private $date_limit; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var string |
|
51 | + */ |
|
52 | + private $date_range; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var string |
|
56 | + */ |
|
57 | + private $limit; |
|
58 | + |
|
59 | + /** |
|
60 | + * @var string |
|
61 | + */ |
|
62 | + private $order; |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * Register widget with WordPress. |
|
67 | + */ |
|
68 | + public function __construct() |
|
69 | + { |
|
70 | + parent::__construct( |
|
71 | + esc_html__('Event Espresso Upcoming Events', 'event_espresso'), |
|
72 | + ['description' => esc_html__('A widget to display your upcoming events.', 'event_espresso')] |
|
73 | + ); |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * Back-end widget form. |
|
79 | + * |
|
80 | + * @param array $instance Previously saved values from database. |
|
81 | + * @return void |
|
82 | + * @throws EE_Error |
|
83 | + * @throws ReflectionException |
|
84 | + * @see WP_Widget::form() |
|
85 | + */ |
|
86 | + public function form($instance) |
|
87 | + { |
|
88 | + |
|
89 | + EE_Registry::instance()->load_class('Question_Option', [], false, false, true); |
|
90 | + // Set up some default widget settings. |
|
91 | + $defaults = [ |
|
92 | + 'title' => esc_html__('Upcoming Events', 'event_espresso'), |
|
93 | + 'category_name' => '', |
|
94 | + 'show_expired' => 0, |
|
95 | + 'show_desc' => true, |
|
96 | + 'show_dates' => true, |
|
97 | + 'show_everywhere' => false, |
|
98 | + 'date_limit' => 2, |
|
99 | + 'limit' => 10, |
|
100 | + 'sort' => 'ASC', |
|
101 | + 'date_range' => false, |
|
102 | + 'image_size' => 'medium', |
|
103 | + ]; |
|
104 | + |
|
105 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
106 | + // don't add HTML labels for EE_Form_Fields generated inputs |
|
107 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
108 | + $yes_no_values = [ |
|
109 | + EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]), |
|
110 | + EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]), |
|
111 | + ]; |
|
112 | + $sort_values = [ |
|
113 | + EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]), |
|
114 | + EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]), |
|
115 | + ]; |
|
116 | + |
|
117 | + ?> |
|
118 | 118 | |
119 | 119 | <!-- Widget Title: Text Input --> |
120 | 120 | |
@@ -151,32 +151,32 @@ discard block |
||
151 | 151 | <?php esc_html_e('Show Expired Events:', 'event_espresso'); ?> |
152 | 152 | </label> |
153 | 153 | <?php |
154 | - $show_expired_options = $yes_no_values; |
|
155 | - $show_expired_options[] = EE_Question_Option::new_instance( |
|
156 | - ['QSO_value' => 2, 'QSO_desc' => esc_html__('Show Only Expired', 'event_espresso')] |
|
157 | - ); |
|
158 | - echo EEH_Form_Fields::select( |
|
159 | - esc_html__('Show Expired Events:', 'event_espresso'), |
|
160 | - $instance['show_expired'], |
|
161 | - $show_expired_options, |
|
162 | - $this->fieldName('show_expired'), |
|
163 | - $this->fieldID('show_expired') |
|
164 | - ); |
|
165 | - ?> |
|
154 | + $show_expired_options = $yes_no_values; |
|
155 | + $show_expired_options[] = EE_Question_Option::new_instance( |
|
156 | + ['QSO_value' => 2, 'QSO_desc' => esc_html__('Show Only Expired', 'event_espresso')] |
|
157 | + ); |
|
158 | + echo EEH_Form_Fields::select( |
|
159 | + esc_html__('Show Expired Events:', 'event_espresso'), |
|
160 | + $instance['show_expired'], |
|
161 | + $show_expired_options, |
|
162 | + $this->fieldName('show_expired'), |
|
163 | + $this->fieldID('show_expired') |
|
164 | + ); |
|
165 | + ?> |
|
166 | 166 | </p> |
167 | 167 | <p> |
168 | 168 | <label for="<?php echo $this->fieldID('sort'); ?>"> |
169 | 169 | <?php esc_html_e('Sort Events:', 'event_espresso'); ?> |
170 | 170 | </label> |
171 | 171 | <?php |
172 | - echo EEH_Form_Fields::select( |
|
173 | - esc_html__('Sort Events:', 'event_espresso'), |
|
174 | - $instance['sort'], |
|
175 | - $sort_values, |
|
176 | - $this->fieldName('sort'), |
|
177 | - $this->fieldID('sort') |
|
178 | - ); |
|
179 | - ?> |
|
172 | + echo EEH_Form_Fields::select( |
|
173 | + esc_html__('Sort Events:', 'event_espresso'), |
|
174 | + $instance['sort'], |
|
175 | + $sort_values, |
|
176 | + $this->fieldName('sort'), |
|
177 | + $this->fieldID('sort') |
|
178 | + ); |
|
179 | + ?> |
|
180 | 180 | </p> |
181 | 181 | <p> |
182 | 182 | <label for="<?php echo $this->fieldID('image_size'); ?>"> |
@@ -190,42 +190,42 @@ discard block |
||
190 | 190 | <?php esc_html_e('Show Description:', 'event_espresso'); ?> |
191 | 191 | </label> |
192 | 192 | <?php |
193 | - echo EEH_Form_Fields::select( |
|
194 | - esc_html__('Show Description:', 'event_espresso'), |
|
195 | - $instance['show_desc'], |
|
196 | - $yes_no_values, |
|
197 | - $this->fieldName('show_desc'), |
|
198 | - $this->fieldID('show_desc') |
|
199 | - ); |
|
200 | - ?> |
|
193 | + echo EEH_Form_Fields::select( |
|
194 | + esc_html__('Show Description:', 'event_espresso'), |
|
195 | + $instance['show_desc'], |
|
196 | + $yes_no_values, |
|
197 | + $this->fieldName('show_desc'), |
|
198 | + $this->fieldID('show_desc') |
|
199 | + ); |
|
200 | + ?> |
|
201 | 201 | </p> |
202 | 202 | <p> |
203 | 203 | <label for="<?php echo $this->fieldID('show_dates'); ?>"> |
204 | 204 | <?php esc_html_e('Show Dates:', 'event_espresso'); ?> |
205 | 205 | </label> |
206 | 206 | <?php |
207 | - echo EEH_Form_Fields::select( |
|
208 | - esc_html__('Show Dates:', 'event_espresso'), |
|
209 | - $instance['show_dates'], |
|
210 | - $yes_no_values, |
|
211 | - $this->fieldName('show_dates'), |
|
212 | - $this->fieldID('show_dates') |
|
213 | - ); |
|
214 | - ?> |
|
207 | + echo EEH_Form_Fields::select( |
|
208 | + esc_html__('Show Dates:', 'event_espresso'), |
|
209 | + $instance['show_dates'], |
|
210 | + $yes_no_values, |
|
211 | + $this->fieldName('show_dates'), |
|
212 | + $this->fieldID('show_dates') |
|
213 | + ); |
|
214 | + ?> |
|
215 | 215 | </p> |
216 | 216 | <p> |
217 | 217 | <label for="<?php echo $this->fieldID('show_everywhere'); ?>"> |
218 | 218 | <?php esc_html_e('Show on all Pages:', 'event_espresso'); ?> |
219 | 219 | </label> |
220 | 220 | <?php |
221 | - echo EEH_Form_Fields::select( |
|
222 | - esc_html__('Show on all Pages:', 'event_espresso'), |
|
223 | - $instance['show_everywhere'], |
|
224 | - $yes_no_values, |
|
225 | - $this->fieldName('show_everywhere'), |
|
226 | - $this->fieldID('show_everywhere') |
|
227 | - ); |
|
228 | - ?> |
|
221 | + echo EEH_Form_Fields::select( |
|
222 | + esc_html__('Show on all Pages:', 'event_espresso'), |
|
223 | + $instance['show_everywhere'], |
|
224 | + $yes_no_values, |
|
225 | + $this->fieldName('show_everywhere'), |
|
226 | + $this->fieldID('show_everywhere') |
|
227 | + ); |
|
228 | + ?> |
|
229 | 229 | </p> |
230 | 230 | <p> |
231 | 231 | <label for="<?php echo $this->fieldID('date_limit'); ?>"> |
@@ -243,278 +243,278 @@ discard block |
||
243 | 243 | <?php esc_html_e('Show Date Range:', 'event_espresso'); ?> |
244 | 244 | </label> |
245 | 245 | <?php |
246 | - echo EEH_Form_Fields::select( |
|
247 | - esc_html__('Show Date Range:', 'event_espresso'), |
|
248 | - $instance['date_range'], |
|
249 | - $yes_no_values, |
|
250 | - $this->fieldName('date_range'), |
|
251 | - $this->fieldID('date_range') |
|
252 | - ); |
|
253 | - ?> |
|
246 | + echo EEH_Form_Fields::select( |
|
247 | + esc_html__('Show Date Range:', 'event_espresso'), |
|
248 | + $instance['date_range'], |
|
249 | + $yes_no_values, |
|
250 | + $this->fieldName('date_range'), |
|
251 | + $this->fieldID('date_range') |
|
252 | + ); |
|
253 | + ?> |
|
254 | 254 | <span class="description"> |
255 | 255 | <br /> |
256 | 256 | <?php esc_html_e( |
257 | - 'This setting will replace the list of dates in the widget.', |
|
258 | - 'event_espresso' |
|
259 | - ); ?> |
|
257 | + 'This setting will replace the list of dates in the widget.', |
|
258 | + 'event_espresso' |
|
259 | + ); ?> |
|
260 | 260 | </span> |
261 | 261 | </p> |
262 | 262 | |
263 | 263 | <?php |
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * Sanitize widget form values as they are saved. |
|
269 | - * |
|
270 | - * @param array $new_instance Values just sent to be saved. |
|
271 | - * @param array $old_instance Previously saved values from database. |
|
272 | - * |
|
273 | - * @return array Updated safe values to be saved. |
|
274 | - * @see WP_Widget::update() |
|
275 | - * |
|
276 | - */ |
|
277 | - public function update($new_instance, $old_instance) |
|
278 | - { |
|
279 | - $instance = $old_instance; |
|
280 | - $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
281 | - $instance['category_name'] = $new_instance['category_name']; |
|
282 | - $instance['show_expired'] = $new_instance['show_expired']; |
|
283 | - $instance['limit'] = $new_instance['limit']; |
|
284 | - $instance['sort'] = $new_instance['sort']; |
|
285 | - $instance['image_size'] = $new_instance['image_size']; |
|
286 | - $instance['show_desc'] = $new_instance['show_desc']; |
|
287 | - $instance['show_dates'] = $new_instance['show_dates']; |
|
288 | - $instance['show_everywhere'] = $new_instance['show_everywhere']; |
|
289 | - $instance['date_limit'] = $new_instance['date_limit']; |
|
290 | - $instance['date_range'] = $new_instance['date_range']; |
|
291 | - return $instance; |
|
292 | - } |
|
293 | - |
|
294 | - |
|
295 | - /** |
|
296 | - * Front-end display of widget. |
|
297 | - * |
|
298 | - * @param array $args Widget arguments. |
|
299 | - * @param array $instance Saved values from database. |
|
300 | - * @throws EE_Error |
|
301 | - * @throws ReflectionException |
|
302 | - * @see WP_Widget::widget() |
|
303 | - * |
|
304 | - */ |
|
305 | - public function widget($args, $instance) |
|
306 | - { |
|
307 | - |
|
308 | - global $post; |
|
309 | - // make sure there is some kinda post object |
|
310 | - if ($post instanceof WP_Post) { |
|
311 | - $before_widget = ''; |
|
312 | - $before_title = ''; |
|
313 | - $after_title = ''; |
|
314 | - $after_widget = ''; |
|
315 | - // but NOT an events archives page, cuz that would be like two event lists on the same page |
|
316 | - $show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']); |
|
317 | - if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
318 | - // let's use some of the event helper functions' |
|
319 | - // make separate vars out of attributes |
|
320 | - extract($args); |
|
321 | - |
|
322 | - // grab widget settings |
|
323 | - $this->parseWidgetSettings($instance); |
|
324 | - $title = $this->widgetTitle(); |
|
325 | - |
|
326 | - // Before widget (defined by themes). |
|
327 | - echo $before_widget; |
|
328 | - // Display the widget title if one was input (before and after defined by themes). |
|
329 | - if (! empty($title)) { |
|
330 | - echo $before_title . $title . $after_title; |
|
331 | - } |
|
332 | - echo $this->widgetContent($post); |
|
333 | - // After widget (defined by themes). |
|
334 | - echo $after_widget; |
|
335 | - } |
|
336 | - } |
|
337 | - } |
|
338 | - |
|
339 | - |
|
340 | - /** |
|
341 | - * make_the_title_a_link |
|
342 | - * callback for widget_title filter |
|
343 | - * |
|
344 | - * @param $title |
|
345 | - * @return string |
|
346 | - */ |
|
347 | - public function make_the_title_a_link($title) |
|
348 | - { |
|
349 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
350 | - } |
|
351 | - |
|
352 | - |
|
353 | - /** |
|
354 | - * @param string $field_name |
|
355 | - * @return string |
|
356 | - * @since 4.10.14.p |
|
357 | - */ |
|
358 | - public function fieldID($field_name) |
|
359 | - { |
|
360 | - return esc_attr(parent::get_field_id($field_name)); |
|
361 | - } |
|
362 | - |
|
363 | - |
|
364 | - /** |
|
365 | - * @param string $field_name |
|
366 | - * @return string |
|
367 | - * @since 4.10.14.p |
|
368 | - */ |
|
369 | - public function fieldName($field_name) |
|
370 | - { |
|
371 | - return esc_attr(parent::get_field_name($field_name)); |
|
372 | - } |
|
373 | - |
|
374 | - |
|
375 | - /** |
|
376 | - * @param array $instance |
|
377 | - * @throws EE_Error |
|
378 | - * @throws ReflectionException |
|
379 | - * @since 4.10.14.p |
|
380 | - */ |
|
381 | - private function eventCategoriesSelector(array $instance) |
|
382 | - { |
|
383 | - $event_categories = []; |
|
384 | - $categories = EEM_Term::instance()->get_all_ee_categories(true); |
|
385 | - if ($categories) { |
|
386 | - foreach ($categories as $category) { |
|
387 | - if ($category instanceof EE_Term) { |
|
388 | - $event_categories[] = |
|
389 | - EE_Question_Option::new_instance( |
|
390 | - [ |
|
391 | - 'QSO_value' => $category->get('slug'), |
|
392 | - 'QSO_desc' => $category->get('name'), |
|
393 | - ] |
|
394 | - ); |
|
395 | - } |
|
396 | - } |
|
397 | - } |
|
398 | - array_unshift( |
|
399 | - $event_categories, |
|
400 | - EE_Question_Option::new_instance( |
|
401 | - [ |
|
402 | - 'QSO_value' => '', |
|
403 | - 'QSO_desc' => esc_html__(' - display all - ', 'event_espresso'), |
|
404 | - ] |
|
405 | - ) |
|
406 | - ); |
|
407 | - echo EEH_Form_Fields::select( |
|
408 | - esc_html__('Event Category:', 'event_espresso'), |
|
409 | - $instance['category_name'], |
|
410 | - $event_categories, |
|
411 | - $this->fieldName('category_name'), |
|
412 | - $this->fieldID('category_name') |
|
413 | - ); |
|
414 | - } |
|
415 | - |
|
416 | - |
|
417 | - /** |
|
418 | - * @param array $instance |
|
419 | - * @since 4.10.14.p |
|
420 | - */ |
|
421 | - private function imageSizeSelector(array $instance) |
|
422 | - { |
|
423 | - $image_sizes = []; |
|
424 | - $sizes = get_intermediate_image_sizes(); |
|
425 | - if ($sizes) { |
|
426 | - // loop thru images and create option objects out of them |
|
427 | - foreach ($sizes as $image_size) { |
|
428 | - $image_size = trim($image_size); |
|
429 | - // no big images plz |
|
430 | - if (! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
431 | - $image_sizes[] = |
|
432 | - EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]); |
|
433 | - } |
|
434 | - } |
|
435 | - $image_sizes[] = |
|
436 | - EE_Question_Option::new_instance( |
|
437 | - ['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')] |
|
438 | - ); |
|
439 | - } |
|
440 | - echo EEH_Form_Fields::select( |
|
441 | - esc_html__('Image Size:', 'event_espresso'), |
|
442 | - $instance['image_size'], |
|
443 | - $image_sizes, |
|
444 | - $this->fieldName('image_size'), |
|
445 | - $this->fieldID('image_size') |
|
446 | - ); |
|
447 | - } |
|
448 | - |
|
449 | - |
|
450 | - /** |
|
451 | - * @param array $instance |
|
452 | - * @since 4.10.14.p |
|
453 | - */ |
|
454 | - private function parseWidgetSettings(array $instance) |
|
455 | - { |
|
456 | - $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
|
457 | - $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
458 | - ? $instance['category_name'] |
|
459 | - : false; |
|
460 | - $this->show_expired = isset($instance['show_expired']) |
|
461 | - ? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN) |
|
462 | - : 0; |
|
463 | - $this->image_size = isset($instance['image_size']) && ! empty($instance['image_size']) |
|
464 | - ? $instance['image_size'] |
|
465 | - : 'medium'; |
|
466 | - $this->show_desc = ! isset($instance['show_desc']) |
|
467 | - || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN); |
|
468 | - $this->show_dates = ! isset($instance['show_dates']) |
|
469 | - || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN); |
|
470 | - $this->date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) |
|
471 | - ? $instance['date_limit'] |
|
472 | - : null; |
|
473 | - $this->date_range = isset($instance['date_range']) && ! empty($instance['date_range']) |
|
474 | - ? $instance['date_range'] |
|
475 | - : false; |
|
476 | - $this->limit = isset($instance['limit']) ? absint($instance['limit']) : 10; |
|
477 | - $this->order = isset($instance['sort']) && $instance['sort'] === 'DESC' |
|
478 | - ? 'DESC' |
|
479 | - : 'ASC'; |
|
480 | - } |
|
481 | - |
|
482 | - |
|
483 | - /** |
|
484 | - * @return mixed|void |
|
485 | - * @since 4.10.14.p |
|
486 | - */ |
|
487 | - private function widgetTitle() |
|
488 | - { |
|
489 | - // add function to make the title a link |
|
490 | - add_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
491 | - // filter the title |
|
492 | - $title = apply_filters('widget_title', $this->title); |
|
493 | - // remove the function from the filter, so it does not affect other widgets |
|
494 | - remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
495 | - return $title; |
|
496 | - } |
|
497 | - |
|
498 | - |
|
499 | - /** |
|
500 | - * @param WP_Post $post |
|
501 | - * @return string |
|
502 | - * @throws EE_Error |
|
503 | - * @throws ReflectionException |
|
504 | - * @since 4.10.14.p |
|
505 | - */ |
|
506 | - private function widgetContent(WP_Post $post) |
|
507 | - { |
|
508 | - // run the query |
|
509 | - $events = $this->getUpcomingEvents(); |
|
510 | - if (empty($events)) { |
|
511 | - return ''; |
|
512 | - } |
|
513 | - $list_items = ''; |
|
514 | - foreach ($events as $event) { |
|
515 | - if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) { |
|
516 | - $event_url = $this->eventUrl($event); |
|
517 | - $list_items .= ' |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * Sanitize widget form values as they are saved. |
|
269 | + * |
|
270 | + * @param array $new_instance Values just sent to be saved. |
|
271 | + * @param array $old_instance Previously saved values from database. |
|
272 | + * |
|
273 | + * @return array Updated safe values to be saved. |
|
274 | + * @see WP_Widget::update() |
|
275 | + * |
|
276 | + */ |
|
277 | + public function update($new_instance, $old_instance) |
|
278 | + { |
|
279 | + $instance = $old_instance; |
|
280 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
281 | + $instance['category_name'] = $new_instance['category_name']; |
|
282 | + $instance['show_expired'] = $new_instance['show_expired']; |
|
283 | + $instance['limit'] = $new_instance['limit']; |
|
284 | + $instance['sort'] = $new_instance['sort']; |
|
285 | + $instance['image_size'] = $new_instance['image_size']; |
|
286 | + $instance['show_desc'] = $new_instance['show_desc']; |
|
287 | + $instance['show_dates'] = $new_instance['show_dates']; |
|
288 | + $instance['show_everywhere'] = $new_instance['show_everywhere']; |
|
289 | + $instance['date_limit'] = $new_instance['date_limit']; |
|
290 | + $instance['date_range'] = $new_instance['date_range']; |
|
291 | + return $instance; |
|
292 | + } |
|
293 | + |
|
294 | + |
|
295 | + /** |
|
296 | + * Front-end display of widget. |
|
297 | + * |
|
298 | + * @param array $args Widget arguments. |
|
299 | + * @param array $instance Saved values from database. |
|
300 | + * @throws EE_Error |
|
301 | + * @throws ReflectionException |
|
302 | + * @see WP_Widget::widget() |
|
303 | + * |
|
304 | + */ |
|
305 | + public function widget($args, $instance) |
|
306 | + { |
|
307 | + |
|
308 | + global $post; |
|
309 | + // make sure there is some kinda post object |
|
310 | + if ($post instanceof WP_Post) { |
|
311 | + $before_widget = ''; |
|
312 | + $before_title = ''; |
|
313 | + $after_title = ''; |
|
314 | + $after_widget = ''; |
|
315 | + // but NOT an events archives page, cuz that would be like two event lists on the same page |
|
316 | + $show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']); |
|
317 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
318 | + // let's use some of the event helper functions' |
|
319 | + // make separate vars out of attributes |
|
320 | + extract($args); |
|
321 | + |
|
322 | + // grab widget settings |
|
323 | + $this->parseWidgetSettings($instance); |
|
324 | + $title = $this->widgetTitle(); |
|
325 | + |
|
326 | + // Before widget (defined by themes). |
|
327 | + echo $before_widget; |
|
328 | + // Display the widget title if one was input (before and after defined by themes). |
|
329 | + if (! empty($title)) { |
|
330 | + echo $before_title . $title . $after_title; |
|
331 | + } |
|
332 | + echo $this->widgetContent($post); |
|
333 | + // After widget (defined by themes). |
|
334 | + echo $after_widget; |
|
335 | + } |
|
336 | + } |
|
337 | + } |
|
338 | + |
|
339 | + |
|
340 | + /** |
|
341 | + * make_the_title_a_link |
|
342 | + * callback for widget_title filter |
|
343 | + * |
|
344 | + * @param $title |
|
345 | + * @return string |
|
346 | + */ |
|
347 | + public function make_the_title_a_link($title) |
|
348 | + { |
|
349 | + return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
350 | + } |
|
351 | + |
|
352 | + |
|
353 | + /** |
|
354 | + * @param string $field_name |
|
355 | + * @return string |
|
356 | + * @since 4.10.14.p |
|
357 | + */ |
|
358 | + public function fieldID($field_name) |
|
359 | + { |
|
360 | + return esc_attr(parent::get_field_id($field_name)); |
|
361 | + } |
|
362 | + |
|
363 | + |
|
364 | + /** |
|
365 | + * @param string $field_name |
|
366 | + * @return string |
|
367 | + * @since 4.10.14.p |
|
368 | + */ |
|
369 | + public function fieldName($field_name) |
|
370 | + { |
|
371 | + return esc_attr(parent::get_field_name($field_name)); |
|
372 | + } |
|
373 | + |
|
374 | + |
|
375 | + /** |
|
376 | + * @param array $instance |
|
377 | + * @throws EE_Error |
|
378 | + * @throws ReflectionException |
|
379 | + * @since 4.10.14.p |
|
380 | + */ |
|
381 | + private function eventCategoriesSelector(array $instance) |
|
382 | + { |
|
383 | + $event_categories = []; |
|
384 | + $categories = EEM_Term::instance()->get_all_ee_categories(true); |
|
385 | + if ($categories) { |
|
386 | + foreach ($categories as $category) { |
|
387 | + if ($category instanceof EE_Term) { |
|
388 | + $event_categories[] = |
|
389 | + EE_Question_Option::new_instance( |
|
390 | + [ |
|
391 | + 'QSO_value' => $category->get('slug'), |
|
392 | + 'QSO_desc' => $category->get('name'), |
|
393 | + ] |
|
394 | + ); |
|
395 | + } |
|
396 | + } |
|
397 | + } |
|
398 | + array_unshift( |
|
399 | + $event_categories, |
|
400 | + EE_Question_Option::new_instance( |
|
401 | + [ |
|
402 | + 'QSO_value' => '', |
|
403 | + 'QSO_desc' => esc_html__(' - display all - ', 'event_espresso'), |
|
404 | + ] |
|
405 | + ) |
|
406 | + ); |
|
407 | + echo EEH_Form_Fields::select( |
|
408 | + esc_html__('Event Category:', 'event_espresso'), |
|
409 | + $instance['category_name'], |
|
410 | + $event_categories, |
|
411 | + $this->fieldName('category_name'), |
|
412 | + $this->fieldID('category_name') |
|
413 | + ); |
|
414 | + } |
|
415 | + |
|
416 | + |
|
417 | + /** |
|
418 | + * @param array $instance |
|
419 | + * @since 4.10.14.p |
|
420 | + */ |
|
421 | + private function imageSizeSelector(array $instance) |
|
422 | + { |
|
423 | + $image_sizes = []; |
|
424 | + $sizes = get_intermediate_image_sizes(); |
|
425 | + if ($sizes) { |
|
426 | + // loop thru images and create option objects out of them |
|
427 | + foreach ($sizes as $image_size) { |
|
428 | + $image_size = trim($image_size); |
|
429 | + // no big images plz |
|
430 | + if (! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
431 | + $image_sizes[] = |
|
432 | + EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]); |
|
433 | + } |
|
434 | + } |
|
435 | + $image_sizes[] = |
|
436 | + EE_Question_Option::new_instance( |
|
437 | + ['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')] |
|
438 | + ); |
|
439 | + } |
|
440 | + echo EEH_Form_Fields::select( |
|
441 | + esc_html__('Image Size:', 'event_espresso'), |
|
442 | + $instance['image_size'], |
|
443 | + $image_sizes, |
|
444 | + $this->fieldName('image_size'), |
|
445 | + $this->fieldID('image_size') |
|
446 | + ); |
|
447 | + } |
|
448 | + |
|
449 | + |
|
450 | + /** |
|
451 | + * @param array $instance |
|
452 | + * @since 4.10.14.p |
|
453 | + */ |
|
454 | + private function parseWidgetSettings(array $instance) |
|
455 | + { |
|
456 | + $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
|
457 | + $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
458 | + ? $instance['category_name'] |
|
459 | + : false; |
|
460 | + $this->show_expired = isset($instance['show_expired']) |
|
461 | + ? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN) |
|
462 | + : 0; |
|
463 | + $this->image_size = isset($instance['image_size']) && ! empty($instance['image_size']) |
|
464 | + ? $instance['image_size'] |
|
465 | + : 'medium'; |
|
466 | + $this->show_desc = ! isset($instance['show_desc']) |
|
467 | + || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN); |
|
468 | + $this->show_dates = ! isset($instance['show_dates']) |
|
469 | + || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN); |
|
470 | + $this->date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) |
|
471 | + ? $instance['date_limit'] |
|
472 | + : null; |
|
473 | + $this->date_range = isset($instance['date_range']) && ! empty($instance['date_range']) |
|
474 | + ? $instance['date_range'] |
|
475 | + : false; |
|
476 | + $this->limit = isset($instance['limit']) ? absint($instance['limit']) : 10; |
|
477 | + $this->order = isset($instance['sort']) && $instance['sort'] === 'DESC' |
|
478 | + ? 'DESC' |
|
479 | + : 'ASC'; |
|
480 | + } |
|
481 | + |
|
482 | + |
|
483 | + /** |
|
484 | + * @return mixed|void |
|
485 | + * @since 4.10.14.p |
|
486 | + */ |
|
487 | + private function widgetTitle() |
|
488 | + { |
|
489 | + // add function to make the title a link |
|
490 | + add_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
491 | + // filter the title |
|
492 | + $title = apply_filters('widget_title', $this->title); |
|
493 | + // remove the function from the filter, so it does not affect other widgets |
|
494 | + remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
495 | + return $title; |
|
496 | + } |
|
497 | + |
|
498 | + |
|
499 | + /** |
|
500 | + * @param WP_Post $post |
|
501 | + * @return string |
|
502 | + * @throws EE_Error |
|
503 | + * @throws ReflectionException |
|
504 | + * @since 4.10.14.p |
|
505 | + */ |
|
506 | + private function widgetContent(WP_Post $post) |
|
507 | + { |
|
508 | + // run the query |
|
509 | + $events = $this->getUpcomingEvents(); |
|
510 | + if (empty($events)) { |
|
511 | + return ''; |
|
512 | + } |
|
513 | + $list_items = ''; |
|
514 | + foreach ($events as $event) { |
|
515 | + if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) { |
|
516 | + $event_url = $this->eventUrl($event); |
|
517 | + $list_items .= ' |
|
518 | 518 | <li id="ee-upcoming-events-widget-li-' . absint($event->ID()) . '" |
519 | 519 | class="ee-upcoming-events-widget-li" |
520 | 520 | > |
@@ -525,194 +525,194 @@ discard block |
||
525 | 525 | </h5> |
526 | 526 | ' . $this->eventWidgetContent($event, $event_url) . ' |
527 | 527 | </li>'; |
528 | - } |
|
529 | - } |
|
530 | - return ' |
|
528 | + } |
|
529 | + } |
|
530 | + return ' |
|
531 | 531 | <ul class="ee-upcoming-events-widget-ul"> |
532 | 532 | ' . $list_items . ' |
533 | 533 | </ul>'; |
534 | - } |
|
535 | - |
|
536 | - |
|
537 | - /** |
|
538 | - * @param EE_Event $event |
|
539 | - * @return string|null |
|
540 | - * @throws EE_Error |
|
541 | - * @since 4.10.14.p |
|
542 | - */ |
|
543 | - private function eventUrl(EE_Event $event) |
|
544 | - { |
|
545 | - return esc_url_raw( |
|
546 | - apply_filters( |
|
547 | - 'FHEE_EEW_Upcoming_Events__widget__event_url', |
|
548 | - $event->get_permalink(), |
|
549 | - $event |
|
550 | - ) |
|
551 | - ); |
|
552 | - } |
|
553 | - |
|
554 | - |
|
555 | - /** |
|
556 | - * @return EE_Base_Class[] |
|
557 | - * @throws EE_Error |
|
558 | - */ |
|
559 | - private function getUpcomingEvents() |
|
560 | - { |
|
561 | - return EEM_Event::instance()->get_all( |
|
562 | - [ |
|
563 | - $this->queryWhereParams(), |
|
564 | - 'limit' => '0,' . $this->limit, |
|
565 | - 'order_by' => 'Datetime.DTT_EVT_start', |
|
566 | - 'order' => $this->order, |
|
567 | - 'group_by' => 'EVT_ID', |
|
568 | - ] |
|
569 | - ); |
|
570 | - } |
|
571 | - |
|
572 | - |
|
573 | - /** |
|
574 | - * @return mixed|void |
|
575 | - * @throws EE_Error |
|
576 | - * @since 4.10.14.p |
|
577 | - */ |
|
578 | - private function queryWhereParams() |
|
579 | - { |
|
580 | - // start to build our where clause |
|
581 | - $where = [ |
|
582 | - 'status' => ['IN', ['publish', 'sold_out']], |
|
583 | - ]; |
|
584 | - // add category |
|
585 | - if ($this->events_category) { |
|
586 | - $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
587 | - $where['Term_Taxonomy.Term.slug'] = $this->events_category; |
|
588 | - } |
|
589 | - // if NOT expired then we want events that start today or in the future |
|
590 | - // if NOT show expired then we want events that start today or in the future |
|
591 | - if ($this->show_expired == 0) { |
|
592 | - $where['Datetime.DTT_EVT_end'] = [ |
|
593 | - '>=', |
|
594 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), |
|
595 | - ]; |
|
596 | - } |
|
597 | - // if show ONLY expired we want events that ended prior to today |
|
598 | - if ($this->show_expired == 2) { |
|
599 | - $where['Datetime.DTT_EVT_end'] = [ |
|
600 | - '<=', |
|
601 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'), |
|
602 | - ]; |
|
603 | - } |
|
604 | - // allow $where to be filtered |
|
605 | - return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired); |
|
606 | - } |
|
607 | - |
|
608 | - |
|
609 | - /** |
|
610 | - * @param EE_Event $event |
|
611 | - * @return string |
|
612 | - * @throws EE_Error |
|
613 | - * @throws ReflectionException |
|
614 | - * @since 4.10.14.p |
|
615 | - */ |
|
616 | - private function linkClass(EE_Event $event) |
|
617 | - { |
|
618 | - // how big is the event name ? |
|
619 | - $name_length = strlen($event->name()); |
|
620 | - switch ($name_length) { |
|
621 | - case $name_length > 70: |
|
622 | - return ' three-line'; |
|
623 | - case $name_length > 35: |
|
624 | - return ' two-line'; |
|
625 | - } |
|
626 | - return ' one-line'; |
|
627 | - } |
|
628 | - |
|
629 | - |
|
630 | - /** |
|
631 | - * @param EE_Event $event |
|
632 | - * @param string $event_url |
|
633 | - * @return mixed|string|void |
|
634 | - * @throws EE_Error |
|
635 | - * @throws ReflectionException |
|
636 | - * @since 4.10.14.p |
|
637 | - */ |
|
638 | - private function eventWidgetContent(EE_Event $event, $event_url = '') |
|
639 | - { |
|
640 | - if (post_password_required($event->ID())) { |
|
641 | - return apply_filters( |
|
642 | - 'FHEE_EEW_Upcoming_Events__widget__password_form', |
|
643 | - get_the_password_form($event->ID()), |
|
644 | - $event |
|
645 | - ); |
|
646 | - } |
|
647 | - |
|
648 | - $content = ''; |
|
649 | - if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') { |
|
650 | - $content .= ' |
|
534 | + } |
|
535 | + |
|
536 | + |
|
537 | + /** |
|
538 | + * @param EE_Event $event |
|
539 | + * @return string|null |
|
540 | + * @throws EE_Error |
|
541 | + * @since 4.10.14.p |
|
542 | + */ |
|
543 | + private function eventUrl(EE_Event $event) |
|
544 | + { |
|
545 | + return esc_url_raw( |
|
546 | + apply_filters( |
|
547 | + 'FHEE_EEW_Upcoming_Events__widget__event_url', |
|
548 | + $event->get_permalink(), |
|
549 | + $event |
|
550 | + ) |
|
551 | + ); |
|
552 | + } |
|
553 | + |
|
554 | + |
|
555 | + /** |
|
556 | + * @return EE_Base_Class[] |
|
557 | + * @throws EE_Error |
|
558 | + */ |
|
559 | + private function getUpcomingEvents() |
|
560 | + { |
|
561 | + return EEM_Event::instance()->get_all( |
|
562 | + [ |
|
563 | + $this->queryWhereParams(), |
|
564 | + 'limit' => '0,' . $this->limit, |
|
565 | + 'order_by' => 'Datetime.DTT_EVT_start', |
|
566 | + 'order' => $this->order, |
|
567 | + 'group_by' => 'EVT_ID', |
|
568 | + ] |
|
569 | + ); |
|
570 | + } |
|
571 | + |
|
572 | + |
|
573 | + /** |
|
574 | + * @return mixed|void |
|
575 | + * @throws EE_Error |
|
576 | + * @since 4.10.14.p |
|
577 | + */ |
|
578 | + private function queryWhereParams() |
|
579 | + { |
|
580 | + // start to build our where clause |
|
581 | + $where = [ |
|
582 | + 'status' => ['IN', ['publish', 'sold_out']], |
|
583 | + ]; |
|
584 | + // add category |
|
585 | + if ($this->events_category) { |
|
586 | + $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
587 | + $where['Term_Taxonomy.Term.slug'] = $this->events_category; |
|
588 | + } |
|
589 | + // if NOT expired then we want events that start today or in the future |
|
590 | + // if NOT show expired then we want events that start today or in the future |
|
591 | + if ($this->show_expired == 0) { |
|
592 | + $where['Datetime.DTT_EVT_end'] = [ |
|
593 | + '>=', |
|
594 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), |
|
595 | + ]; |
|
596 | + } |
|
597 | + // if show ONLY expired we want events that ended prior to today |
|
598 | + if ($this->show_expired == 2) { |
|
599 | + $where['Datetime.DTT_EVT_end'] = [ |
|
600 | + '<=', |
|
601 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'), |
|
602 | + ]; |
|
603 | + } |
|
604 | + // allow $where to be filtered |
|
605 | + return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired); |
|
606 | + } |
|
607 | + |
|
608 | + |
|
609 | + /** |
|
610 | + * @param EE_Event $event |
|
611 | + * @return string |
|
612 | + * @throws EE_Error |
|
613 | + * @throws ReflectionException |
|
614 | + * @since 4.10.14.p |
|
615 | + */ |
|
616 | + private function linkClass(EE_Event $event) |
|
617 | + { |
|
618 | + // how big is the event name ? |
|
619 | + $name_length = strlen($event->name()); |
|
620 | + switch ($name_length) { |
|
621 | + case $name_length > 70: |
|
622 | + return ' three-line'; |
|
623 | + case $name_length > 35: |
|
624 | + return ' two-line'; |
|
625 | + } |
|
626 | + return ' one-line'; |
|
627 | + } |
|
628 | + |
|
629 | + |
|
630 | + /** |
|
631 | + * @param EE_Event $event |
|
632 | + * @param string $event_url |
|
633 | + * @return mixed|string|void |
|
634 | + * @throws EE_Error |
|
635 | + * @throws ReflectionException |
|
636 | + * @since 4.10.14.p |
|
637 | + */ |
|
638 | + private function eventWidgetContent(EE_Event $event, $event_url = '') |
|
639 | + { |
|
640 | + if (post_password_required($event->ID())) { |
|
641 | + return apply_filters( |
|
642 | + 'FHEE_EEW_Upcoming_Events__widget__password_form', |
|
643 | + get_the_password_form($event->ID()), |
|
644 | + $event |
|
645 | + ); |
|
646 | + } |
|
647 | + |
|
648 | + $content = ''; |
|
649 | + if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') { |
|
650 | + $content .= ' |
|
651 | 651 | <div class="ee-upcoming-events-widget-img-dv"> |
652 | 652 | <a class="ee-upcoming-events-widget-img" href="' . $event_url . '"> |
653 | 653 | ' . get_the_post_thumbnail($event->ID(), $this->image_size) . ' |
654 | 654 | </a> |
655 | 655 | </div>'; |
656 | - } |
|
657 | - |
|
658 | - if ($this->show_dates) { |
|
659 | - $content .= $this->eventDates($event); |
|
660 | - } |
|
661 | - |
|
662 | - if ($this->show_desc) { |
|
663 | - global $allowedtags; |
|
664 | - $desc = $event->short_description(25); |
|
665 | - $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : ''; |
|
666 | - } |
|
667 | - |
|
668 | - return $content; |
|
669 | - } |
|
670 | - |
|
671 | - |
|
672 | - /** |
|
673 | - * @param EE_Event $event |
|
674 | - * @return string |
|
675 | - * @throws EE_Error |
|
676 | - * @throws ReflectionException |
|
677 | - * @since 4.10.14.p |
|
678 | - */ |
|
679 | - private function eventDates(EE_Event $event) |
|
680 | - { |
|
681 | - $date_format = apply_filters( |
|
682 | - 'FHEE__espresso_event_date_range__date_format', |
|
683 | - get_option('date_format') |
|
684 | - ); |
|
685 | - $time_format = apply_filters( |
|
686 | - 'FHEE__espresso_event_date_range__time_format', |
|
687 | - get_option('time_format') |
|
688 | - ); |
|
689 | - $single_date_format = apply_filters( |
|
690 | - 'FHEE__espresso_event_date_range__single_date_format', |
|
691 | - get_option('date_format') |
|
692 | - ); |
|
693 | - $single_time_format = apply_filters( |
|
694 | - 'FHEE__espresso_event_date_range__single_time_format', |
|
695 | - get_option('time_format') |
|
696 | - ); |
|
697 | - if ($this->date_range == true) { |
|
698 | - return espresso_event_date_range( |
|
699 | - $date_format, |
|
700 | - $time_format, |
|
701 | - $single_date_format, |
|
702 | - $single_time_format, |
|
703 | - $event->ID(), |
|
704 | - false |
|
705 | - ); |
|
706 | - } |
|
707 | - return espresso_list_of_event_dates( |
|
708 | - $event->ID(), |
|
709 | - $date_format, |
|
710 | - $time_format, |
|
711 | - false, |
|
712 | - null, |
|
713 | - true, |
|
714 | - true, |
|
715 | - $this->date_limit |
|
716 | - ); |
|
717 | - } |
|
656 | + } |
|
657 | + |
|
658 | + if ($this->show_dates) { |
|
659 | + $content .= $this->eventDates($event); |
|
660 | + } |
|
661 | + |
|
662 | + if ($this->show_desc) { |
|
663 | + global $allowedtags; |
|
664 | + $desc = $event->short_description(25); |
|
665 | + $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : ''; |
|
666 | + } |
|
667 | + |
|
668 | + return $content; |
|
669 | + } |
|
670 | + |
|
671 | + |
|
672 | + /** |
|
673 | + * @param EE_Event $event |
|
674 | + * @return string |
|
675 | + * @throws EE_Error |
|
676 | + * @throws ReflectionException |
|
677 | + * @since 4.10.14.p |
|
678 | + */ |
|
679 | + private function eventDates(EE_Event $event) |
|
680 | + { |
|
681 | + $date_format = apply_filters( |
|
682 | + 'FHEE__espresso_event_date_range__date_format', |
|
683 | + get_option('date_format') |
|
684 | + ); |
|
685 | + $time_format = apply_filters( |
|
686 | + 'FHEE__espresso_event_date_range__time_format', |
|
687 | + get_option('time_format') |
|
688 | + ); |
|
689 | + $single_date_format = apply_filters( |
|
690 | + 'FHEE__espresso_event_date_range__single_date_format', |
|
691 | + get_option('date_format') |
|
692 | + ); |
|
693 | + $single_time_format = apply_filters( |
|
694 | + 'FHEE__espresso_event_date_range__single_time_format', |
|
695 | + get_option('time_format') |
|
696 | + ); |
|
697 | + if ($this->date_range == true) { |
|
698 | + return espresso_event_date_range( |
|
699 | + $date_format, |
|
700 | + $time_format, |
|
701 | + $single_date_format, |
|
702 | + $single_time_format, |
|
703 | + $event->ID(), |
|
704 | + false |
|
705 | + ); |
|
706 | + } |
|
707 | + return espresso_list_of_event_dates( |
|
708 | + $event->ID(), |
|
709 | + $date_format, |
|
710 | + $time_format, |
|
711 | + false, |
|
712 | + null, |
|
713 | + true, |
|
714 | + true, |
|
715 | + $this->date_limit |
|
716 | + ); |
|
717 | + } |
|
718 | 718 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]), |
110 | 110 | EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]), |
111 | 111 | ]; |
112 | - $sort_values = [ |
|
112 | + $sort_values = [ |
|
113 | 113 | EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]), |
114 | 114 | EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]), |
115 | 115 | ]; |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | // Before widget (defined by themes). |
327 | 327 | echo $before_widget; |
328 | 328 | // Display the widget title if one was input (before and after defined by themes). |
329 | - if (! empty($title)) { |
|
330 | - echo $before_title . $title . $after_title; |
|
329 | + if ( ! empty($title)) { |
|
330 | + echo $before_title.$title.$after_title; |
|
331 | 331 | } |
332 | 332 | echo $this->widgetContent($post); |
333 | 333 | // After widget (defined by themes). |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function make_the_title_a_link($title) |
348 | 348 | { |
349 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
349 | + return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>'; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | foreach ($sizes as $image_size) { |
428 | 428 | $image_size = trim($image_size); |
429 | 429 | // no big images plz |
430 | - if (! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
430 | + if ( ! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
431 | 431 | $image_sizes[] = |
432 | 432 | EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]); |
433 | 433 | } |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | private function parseWidgetSettings(array $instance) |
455 | 455 | { |
456 | 456 | $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
457 | - $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
457 | + $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
458 | 458 | ? $instance['category_name'] |
459 | 459 | : false; |
460 | 460 | $this->show_expired = isset($instance['show_expired']) |
@@ -512,24 +512,24 @@ discard block |
||
512 | 512 | } |
513 | 513 | $list_items = ''; |
514 | 514 | foreach ($events as $event) { |
515 | - if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) { |
|
515 | + if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) { |
|
516 | 516 | $event_url = $this->eventUrl($event); |
517 | 517 | $list_items .= ' |
518 | - <li id="ee-upcoming-events-widget-li-' . absint($event->ID()) . '" |
|
518 | + <li id="ee-upcoming-events-widget-li-' . absint($event->ID()).'" |
|
519 | 519 | class="ee-upcoming-events-widget-li" |
520 | 520 | > |
521 | 521 | <h5 class="ee-upcoming-events-widget-title-h5"> |
522 | - <a class="ee-widget-event-name-a' . $this->linkClass($event) . '" href="' . $event_url . '"> |
|
523 | - ' . esc_html($event->name()) . ' |
|
522 | + <a class="ee-widget-event-name-a' . $this->linkClass($event).'" href="'.$event_url.'"> |
|
523 | + ' . esc_html($event->name()).' |
|
524 | 524 | </a> |
525 | 525 | </h5> |
526 | - ' . $this->eventWidgetContent($event, $event_url) . ' |
|
526 | + ' . $this->eventWidgetContent($event, $event_url).' |
|
527 | 527 | </li>'; |
528 | 528 | } |
529 | 529 | } |
530 | 530 | return ' |
531 | 531 | <ul class="ee-upcoming-events-widget-ul"> |
532 | - ' . $list_items . ' |
|
532 | + ' . $list_items.' |
|
533 | 533 | </ul>'; |
534 | 534 | } |
535 | 535 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | return EEM_Event::instance()->get_all( |
562 | 562 | [ |
563 | 563 | $this->queryWhereParams(), |
564 | - 'limit' => '0,' . $this->limit, |
|
564 | + 'limit' => '0,'.$this->limit, |
|
565 | 565 | 'order_by' => 'Datetime.DTT_EVT_start', |
566 | 566 | 'order' => $this->order, |
567 | 567 | 'group_by' => 'EVT_ID', |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') { |
650 | 650 | $content .= ' |
651 | 651 | <div class="ee-upcoming-events-widget-img-dv"> |
652 | - <a class="ee-upcoming-events-widget-img" href="' . $event_url . '"> |
|
653 | - ' . get_the_post_thumbnail($event->ID(), $this->image_size) . ' |
|
652 | + <a class="ee-upcoming-events-widget-img" href="' . $event_url.'"> |
|
653 | + ' . get_the_post_thumbnail($event->ID(), $this->image_size).' |
|
654 | 654 | </a> |
655 | 655 | </div>'; |
656 | 656 | } |
@@ -661,8 +661,8 @@ discard block |
||
661 | 661 | |
662 | 662 | if ($this->show_desc) { |
663 | 663 | global $allowedtags; |
664 | - $desc = $event->short_description(25); |
|
665 | - $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : ''; |
|
664 | + $desc = $event->short_description(25); |
|
665 | + $content .= $desc ? '<p style="margin-top: .5em">'.wp_kses($desc, $allowedtags).'</p>' : ''; |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | return $content; |
@@ -678,11 +678,11 @@ discard block |
||
678 | 678 | */ |
679 | 679 | private function eventDates(EE_Event $event) |
680 | 680 | { |
681 | - $date_format = apply_filters( |
|
681 | + $date_format = apply_filters( |
|
682 | 682 | 'FHEE__espresso_event_date_range__date_format', |
683 | 683 | get_option('date_format') |
684 | 684 | ); |
685 | - $time_format = apply_filters( |
|
685 | + $time_format = apply_filters( |
|
686 | 686 | 'FHEE__espresso_event_date_range__time_format', |
687 | 687 | get_option('time_format') |
688 | 688 | ); |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | placeholder="Datetime Description (optional)"><?php echo esc_textarea($DTT_description); ?></textarea> |
24 | 24 | </div> |
25 | 25 | <?php do_action( |
26 | - 'AHEE__event_tickets_datetime_attached_tickets_row_template__advanced_details_after_dtt_description', |
|
27 | - $dtt_row, |
|
28 | - $DTT_ID |
|
29 | - ); ?> |
|
26 | + 'AHEE__event_tickets_datetime_attached_tickets_row_template__advanced_details_after_dtt_description', |
|
27 | + $dtt_row, |
|
28 | + $DTT_ID |
|
29 | + ); ?> |
|
30 | 30 | <h4 class="datetime-tickets-heading"><?php esc_html_e('Assigned Tickets', 'event_espresso'); ?></h4> |
31 | 31 | |
32 | 32 | <ul class="datetime-tickets-list"> |
@@ -36,28 +36,28 @@ discard block |
||
36 | 36 | |
37 | 37 | <div class="add-datetime-ticket-container"> |
38 | 38 | <h4 class="datetime-tickets-heading"><?php |
39 | - esc_html_e( |
|
40 | - 'Add New Ticket', |
|
41 | - 'event_espresso' |
|
42 | - ); ?></h4><?php echo $add_new_datetime_ticket_help_link; ?><br> |
|
39 | + esc_html_e( |
|
40 | + 'Add New Ticket', |
|
41 | + 'event_espresso' |
|
42 | + ); ?></h4><?php echo $add_new_datetime_ticket_help_link; ?><br> |
|
43 | 43 | <table class="add-new-ticket-table"> |
44 | 44 | <thead> |
45 | 45 | <tr valign="top"> |
46 | 46 | <td><span class="ANT_TKT_name_label"><?php |
47 | - esc_html_e( |
|
48 | - 'Ticket Name', |
|
49 | - 'event_espresso' |
|
50 | - ); ?></span></td> |
|
47 | + esc_html_e( |
|
48 | + 'Ticket Name', |
|
49 | + 'event_espresso' |
|
50 | + ); ?></span></td> |
|
51 | 51 | <td><span class="ANT_TKT_goes_on_sale_label"><?php |
52 | - esc_html_e( |
|
53 | - 'Sale Starts', |
|
54 | - 'event_espresso' |
|
55 | - ); ?></span></td> |
|
52 | + esc_html_e( |
|
53 | + 'Sale Starts', |
|
54 | + 'event_espresso' |
|
55 | + ); ?></span></td> |
|
56 | 56 | <td><span class="ANT_TKT_sell_until_label"><?php |
57 | - esc_html_e( |
|
58 | - 'Sell Until', |
|
59 | - 'event_espresso' |
|
60 | - ); ?></span></td> |
|
57 | + esc_html_e( |
|
58 | + 'Sell Until', |
|
59 | + 'event_espresso' |
|
60 | + ); ?></span></td> |
|
61 | 61 | <td><span class="ANT_TKT_price_label"><?php esc_html_e('Price', 'event_espresso'); ?></span> |
62 | 62 | </td> |
63 | 63 | <td><span class="ANT_TKT_qty_label"><?php esc_html_e('Qty', 'event_espresso'); ?></span></td> |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | <div class="ee-editor-footer-container"> |
108 | 108 | <div class="ee-editor-id-container"> |
109 | 109 | <span class="ee-item-id"><?php |
110 | - echo $DTT_ID |
|
111 | - ? sprintf( |
|
112 | - esc_html__('Datetime ID: %d', 'event_espresso'), |
|
113 | - $DTT_ID |
|
114 | - ) |
|
115 | - : ''; ?></span> |
|
110 | + echo $DTT_ID |
|
111 | + ? sprintf( |
|
112 | + esc_html__('Datetime ID: %d', 'event_espresso'), |
|
113 | + $DTT_ID |
|
114 | + ) |
|
115 | + : ''; ?></span> |
|
116 | 116 | </div> |
117 | 117 | <div class="save-cancel-button-container"> |
118 | 118 | <button data-context="short-ticket" data-datetime-row="<?php echo absint($dtt_row); ?>" |
@@ -61,9 +61,12 @@ discard block |
||
61 | 61 | <input type="text" size="1" class="edit-price-PRC_amount ee-numeric" |
62 | 62 | name="prices_archive[<?php echo absint($tkt_row); ?>][<?php echo absint($PRC_order); ?>][PRC_amount]" |
63 | 63 | value="<?php echo esc_attr($PRC_amount); ?>" disabled> |
64 | - <?php else : ?> |
|
64 | + <?php else { |
|
65 | + : ?> |
|
65 | 66 | <input type="text" size="1" class="edit-price-PRC_amount ee-numeric" |
66 | - name="<?php echo esc_attr($edit_prices_name); ?>[<?php echo absint($tkt_row); ?>][<?php echo absint($PRC_order); ?>][PRC_amount]" |
|
67 | + name="<?php echo esc_attr($edit_prices_name); |
|
68 | +} |
|
69 | +?>[<?php echo absint($tkt_row); ?>][<?php echo absint($PRC_order); ?>][PRC_amount]" |
|
67 | 70 | value="<?php echo esc_attr($PRC_amount); ?>"> |
68 | 71 | <?php endif; ?> |
69 | 72 | </td> |
@@ -74,8 +77,11 @@ discard block |
||
74 | 77 | <td> |
75 | 78 | <?php if ($disabled) : ?> |
76 | 79 | <span class="ee-lock-icon"></span> |
77 | - <?php else : ?> |
|
78 | - <!-- <span class="gear-icon dashicons dashicons-admin-generic clickable" data-ticket-row="<?php echo absint($tkt_row); ?>" data-context="price" data-price-row="<?php echo absint($PRC_order); ?>"></span> --> |
|
80 | + <?php else { |
|
81 | + : ?> |
|
82 | + <!-- <span class="gear-icon dashicons dashicons-admin-generic clickable" data-ticket-row="<?php echo absint($tkt_row); |
|
83 | +} |
|
84 | +?>" data-context="price" data-price-row="<?php echo absint($PRC_order); ?>"></span> --> |
|
79 | 85 | <span class="trash-icon dashicons dashicons-post-trash clickable" data-ticket-row="<?php echo absint($tkt_row); ?>" |
80 | 86 | data-context="price" data-price-row="<?php echo absint($PRC_order); ?>"<?php echo $show_trash_icon; ?>></span> |
81 | 87 | <button data-ticket-row="<?php echo absint($tkt_row); ?>" data-price-row="<?php echo absint($PRC_order); ?>" |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | <li data-datetime-row="<?php echo absint($dtt_row); ?>" data-context="datetime-ticket" data-ticket-row="<?php echo absint($tkt_row); ?>" |
16 | 16 | class="datetime-ticket clickable<?php echo $ticket_selected; |
17 | - echo $tkt_status_class; ?>"> |
|
17 | + echo $tkt_status_class; ?>"> |
|
18 | 18 | <input type="checkbox" name="datetime_ticket[<?php echo absint($dtt_row); ?>][<?php echo absint($tkt_row); ?>]" |
19 | 19 | class="datetime-ticket-checkbox" value="1"<?php echo $datetime_ticket_checked; ?>> |
20 | 20 | <span class="ee-icon ee-icon-tickets ticket-list-ticket-name"><?php echo $TKT_name; ?></span> |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ?> |
59 | 59 | <tr valign="top" class="ee-ticket-sortable ticket-row <?php echo sanitize_html_class($ticket_archive_class); |
60 | 60 | if (WP_DEBUG) { |
61 | - echo ' ee-wp-debug'; |
|
61 | + echo ' ee-wp-debug'; |
|
62 | 62 | } ?>" id="display-ticketrow-<?php echo absint($tkt_row); ?>"> |
63 | 63 | <!--<td class="ee-tkt-order-field"><span class="dashicons dashicons-sort <?php echo sanitize_html_class($tkt_status_class); ?>"> |
64 | 64 | <input type="hidden" name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_order]" class="edit-ticket-TKT_order" value ="<?php echo esc_attr($TKT_order); ?>" ></span></td>--> |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | class="edit-ticket-TKT_row" value="<?php echo absint($tkt_row); ?>"> |
168 | 168 | |
169 | 169 | <!--<div class="total-price-container"><?php printf( |
170 | - esc_html__('Total Final Price: %s', 'event_espresso'), |
|
171 | - '<span class="ticket-price-amount">' . $TKT_price . '</span>' |
|
172 | - ); ?> </div>--> |
|
170 | + esc_html__('Total Final Price: %s', 'event_espresso'), |
|
171 | + '<span class="ticket-price-amount">' . $TKT_price . '</span>' |
|
172 | + ); ?> </div>--> |
|
173 | 173 | <textarea name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_description]" |
174 | 174 | class="edit-ticket-TKT_description ee-full-textarea-inp" |
175 | 175 | placeholder="Ticket Description"><?php echo esc_textarea($TKT_description); ?></textarea> |
@@ -183,20 +183,20 @@ discard block |
||
183 | 183 | <thead> |
184 | 184 | <tr valign="bottom"> |
185 | 185 | <td><span class="TD_TKT_number_datetimes_label"><?php |
186 | - esc_html_e( |
|
187 | - '# Datetimes', |
|
188 | - 'event_espresso' |
|
189 | - ); ?></span></td> |
|
186 | + esc_html_e( |
|
187 | + '# Datetimes', |
|
188 | + 'event_espresso' |
|
189 | + ); ?></span></td> |
|
190 | 190 | <td><span class="TD_TKT_min_qty_label"><?php |
191 | - esc_html_e( |
|
192 | - 'Minimum Quantity', |
|
193 | - 'event_espresso' |
|
194 | - ); ?></span></td> |
|
191 | + esc_html_e( |
|
192 | + 'Minimum Quantity', |
|
193 | + 'event_espresso' |
|
194 | + ); ?></span></td> |
|
195 | 195 | <td><span class="TD_TKT_max_qty_label"><?php |
196 | - esc_html_e( |
|
197 | - 'Maximum Quantity', |
|
198 | - 'event_espresso' |
|
199 | - ); ?></span></td> |
|
196 | + esc_html_e( |
|
197 | + 'Maximum Quantity', |
|
198 | + 'event_espresso' |
|
199 | + ); ?></span></td> |
|
200 | 200 | </tr> |
201 | 201 | </thead> |
202 | 202 | <tbody> |
@@ -254,24 +254,24 @@ discard block |
||
254 | 254 | <input type="checkbox" |
255 | 255 | name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_required]" |
256 | 256 | class="edit-ticket-TKT_required" value="1"<?php |
257 | - echo $TKT_required |
|
258 | - ? ' checked="checked"' |
|
259 | - : ''; |
|
260 | - echo $disabled |
|
261 | - ? ' disabled' |
|
262 | - : ''; ?>> |
|
257 | + echo $TKT_required |
|
258 | + ? ' checked="checked"' |
|
259 | + : ''; |
|
260 | + echo $disabled |
|
261 | + ? ' disabled' |
|
262 | + : ''; ?>> |
|
263 | 263 | <label for="edit-ticket-TKT_required"><?php |
264 | - esc_html_e( |
|
265 | - 'This ticket is required (will appear first in frontend ticket lists).', |
|
266 | - 'event_espresso' |
|
267 | - ); ?></label> |
|
264 | + esc_html_e( |
|
265 | + 'This ticket is required (will appear first in frontend ticket lists).', |
|
266 | + 'event_espresso' |
|
267 | + ); ?></label> |
|
268 | 268 | </div> |
269 | 269 | <div class="ticket-is-taxable-container"> |
270 | 270 | <?php if (! empty($tax_rows)) { ?> |
271 | 271 | <?php if ($disabled) : ?> |
272 | 272 | <?php |
273 | - $tax_value = ! empty($TKT_taxable) ? 1 : 0; |
|
274 | - ?> |
|
273 | + $tax_value = ! empty($TKT_taxable) ? 1 : 0; |
|
274 | + ?> |
|
275 | 275 | <input class="TKT-taxable-checkbox" type="hidden" |
276 | 276 | name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_taxable]" |
277 | 277 | value="<?php echo esc_attr($tax_value); ?>"> |
@@ -285,16 +285,16 @@ discard block |
||
285 | 285 | value="1"<?php echo $TKT_taxable; ?>> |
286 | 286 | <?php endif; ?> |
287 | 287 | <label for="edit-ticket-TKT_taxable-<?php echo absint($tkt_row); ?>"> <?php |
288 | - esc_html_e('This ticket is taxable.', 'event_espresso'); ?> |
|
288 | + esc_html_e('This ticket is taxable.', 'event_espresso'); ?> |
|
289 | 289 | <?php } //end tax_rows check ?> |
290 | 290 | </div> |
291 | 291 | </div> |
292 | 292 | <div class="price-table-container"> |
293 | 293 | <h4 class="tickets-heading price-table-info"<?php echo $show_price_modifier; ?>><?php |
294 | - esc_html_e( |
|
295 | - 'Price Modifiers', |
|
296 | - 'event_espresso' |
|
297 | - ); ?></h4> |
|
294 | + esc_html_e( |
|
295 | + 'Price Modifiers', |
|
296 | + 'event_espresso' |
|
297 | + ); ?></h4> |
|
298 | 298 | <table class="price-table"> |
299 | 299 | <thead class="price-table-info"<?php echo $show_price_modifier; ?>> |
300 | 300 | <tr> |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | <tr class="price-subtotal-row TKT-taxes-display"<?php echo $display_subtotal; ?>> |
315 | 315 | <td colspan="4" class="ee-numeric"> |
316 | 316 | <span class="TKT-taxable-subtotal-label"><strong><?php |
317 | - esc_html_e( |
|
318 | - 'Subtotal', |
|
319 | - 'event_espresso' |
|
320 | - ); ?></strong></span> |
|
317 | + esc_html_e( |
|
318 | + 'Subtotal', |
|
319 | + 'event_espresso' |
|
320 | + ); ?></strong></span> |
|
321 | 321 | </td> |
322 | 322 | <td class="ee-numeric"> |
323 | 323 | <span |
@@ -350,51 +350,51 @@ discard block |
||
350 | 350 | <div style="clear:both"></div> |
351 | 351 | <h4 class="tickets-heading"><?php esc_html_e('Event Datetimes', 'event_espresso'); ?></h4> |
352 | 352 | <p><?php |
353 | - esc_html_e( |
|
354 | - 'This ticket will be usable (allow entrance) for the following selected event datetimes (click to select). The "# Datetimes" amount (above) indicates how many of the assigned datetimes the ticket holder can gain access to:', |
|
355 | - 'event_espresso' |
|
356 | - ); ?></p> |
|
353 | + esc_html_e( |
|
354 | + 'This ticket will be usable (allow entrance) for the following selected event datetimes (click to select). The "# Datetimes" amount (above) indicates how many of the assigned datetimes the ticket holder can gain access to:', |
|
355 | + 'event_espresso' |
|
356 | + ); ?></p> |
|
357 | 357 | <ul class="datetime-tickets-list"> |
358 | 358 | <?php echo $ticket_datetimes_list; ?> |
359 | 359 | </ul> |
360 | 360 | |
361 | 361 | <?php do_action( |
362 | - 'AHEE__event_tickets_datetime_ticket_row_template__advanced_details_end', |
|
363 | - $tkt_row, |
|
364 | - $TKT_ID |
|
365 | - ); ?> |
|
362 | + 'AHEE__event_tickets_datetime_ticket_row_template__advanced_details_end', |
|
363 | + $tkt_row, |
|
364 | + $TKT_ID |
|
365 | + ); ?> |
|
366 | 366 | <div class="ee-editor-footer-container"> |
367 | 367 | <div class="ee-editor-id-container"> |
368 | 368 | <span class="ee-item-id"><?php echo |
369 | - $TKT_ID |
|
370 | - ? sprintf( |
|
371 | - esc_html__('Ticket ID: %d', 'event_espresso'), |
|
372 | - $TKT_ID |
|
373 | - ) |
|
374 | - : ''; ?></span> |
|
369 | + $TKT_ID |
|
370 | + ? sprintf( |
|
371 | + esc_html__('Ticket ID: %d', 'event_espresso'), |
|
372 | + $TKT_ID |
|
373 | + ) |
|
374 | + : ''; ?></span> |
|
375 | 375 | </div> |
376 | 376 | <div class="save-cancel-button-container"> |
377 | 377 | <label for="edit-ticket-TKT_is_default_selector"><?php |
378 | - esc_html_e( |
|
379 | - 'use this new ticket as a default ticket for any new events', |
|
380 | - 'event_espresso' |
|
381 | - ); ?></label> |
|
378 | + esc_html_e( |
|
379 | + 'use this new ticket as a default ticket for any new events', |
|
380 | + 'event_espresso' |
|
381 | + ); ?></label> |
|
382 | 382 | <input type="checkbox" |
383 | 383 | name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_is_default_selector]" |
384 | 384 | class="edit-ticket-TKT_is_default_selector" value="1"<?php |
385 | - echo $disabled |
|
386 | - ? ' disabled' |
|
387 | - : ''; ?>> |
|
385 | + echo $disabled |
|
386 | + ? ' disabled' |
|
387 | + : ''; ?>> |
|
388 | 388 | <input type="hidden" |
389 | 389 | name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_is_default]" |
390 | 390 | class="edit-ticket-TKT_is_default" value="<?php echo esc_attr($TKT_is_default); ?>"> |
391 | 391 | <!--<button class="button-primary ee-save-button" data-context="ticket" data-ticket-row="<?php echo absint($tkt_row); ?>"><?php esc_html_e( |
392 | - 'Update Ticket', |
|
393 | - 'event_espresso' |
|
394 | - ); ?></button>--> |
|
392 | + 'Update Ticket', |
|
393 | + 'event_espresso' |
|
394 | + ); ?></button>--> |
|
395 | 395 | <button class="button-secondary ee-cancel-button" data-context="ticket" |
396 | 396 | data-ticket-row="<?php echo absint($tkt_row); ?>"><?php |
397 | - esc_html_e('Close', 'event_espresso'); ?></button> |
|
397 | + esc_html_e('Close', 'event_espresso'); ?></button> |
|
398 | 398 | </div> |
399 | 399 | </div> |
400 | 400 | <!-- these hidden inputs are for tracking changes in dtts attached to tickets during a js session --> |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | <!--<div class="total-price-container"><?php printf( |
170 | 170 | esc_html__('Total Final Price: %s', 'event_espresso'), |
171 | - '<span class="ticket-price-amount">' . $TKT_price . '</span>' |
|
171 | + '<span class="ticket-price-amount">'.$TKT_price.'</span>' |
|
172 | 172 | ); ?> </div>--> |
173 | 173 | <textarea name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_description]" |
174 | 174 | class="edit-ticket-TKT_description ee-full-textarea-inp" |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | ); ?></label> |
268 | 268 | </div> |
269 | 269 | <div class="ticket-is-taxable-container"> |
270 | - <?php if (! empty($tax_rows)) { ?> |
|
270 | + <?php if ( ! empty($tax_rows)) { ?> |
|
271 | 271 | <?php if ($disabled) : ?> |
272 | 272 | <?php |
273 | 273 | $tax_value = ! empty($TKT_taxable) ? 1 : 0; |
@@ -79,8 +79,11 @@ discard block |
||
79 | 79 | class="edit-ticket-TKT_start_date ee-text-inp" value="<?php echo esc_attr($TKT_start_date); ?>"> |
80 | 80 | <input type="text" name="archived_ticket[TKT_start_date]" class="edit-ticket-TKT_start_date ee-text-inp" |
81 | 81 | value="<?php echo esc_attr($TKT_start_date); ?>" disabled> |
82 | - <?php else : ?> |
|
83 | - <input id="edit-ticket-TKT_start_date-<?php echo absint($tkt_row); ?>" type="text" |
|
82 | + <?php else { |
|
83 | + : ?> |
|
84 | + <input id="edit-ticket-TKT_start_date-<?php echo absint($tkt_row); |
|
85 | +} |
|
86 | +?>" type="text" |
|
84 | 87 | name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_start_date]" |
85 | 88 | class="edit-ticket-TKT_start_date ee-text-inp ee-datepicker" value="<?php echo esc_attr($TKT_start_date); ?>" |
86 | 89 | data-context="start-ticket" data-date-field-context="#display-ticketrow-<?php echo absint($tkt_row); ?>" |
@@ -94,8 +97,11 @@ discard block |
||
94 | 97 | class="edit-ticket-TKT_end_date ee-text-inp" value="<?php echo esc_attr($TKT_end_date); ?>"> |
95 | 98 | <input type="text" name="archived_ticket[TKT_end_date]" class="edit-ticket-TKT_end_date ee-text-inp" |
96 | 99 | value="<?php echo esc_attr($TKT_end_date); ?>" disabled> |
97 | - <?php else : ?> |
|
98 | - <input id="edit-ticket-TKT_end_date-<?php echo absint($tkt_row); ?>" type="text" |
|
100 | + <?php else { |
|
101 | + : ?> |
|
102 | + <input id="edit-ticket-TKT_end_date-<?php echo absint($tkt_row); |
|
103 | +} |
|
104 | +?>" type="text" |
|
99 | 105 | name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_end_date]" |
100 | 106 | class="edit-ticket-TKT_end_date ee-text-inp ee-datepicker" value="<?php echo esc_attr($TKT_end_date); ?>" |
101 | 107 | data-context="end-ticket" data-date-field-context="#display-ticketrow-<?php echo absint($tkt_row); ?>" |
@@ -111,8 +117,11 @@ discard block |
||
111 | 117 | <input type="text" name="archived_ticket[<?php echo absint($tkt_row); ?>][TKT_base_price]" |
112 | 118 | class="edit-ticket-TKT_base_price ee-small-text-inp edit-price-PRC_amount ee-numeric" |
113 | 119 | value="<?php echo esc_attr($TKT_base_price); ?>" disabled> |
114 | - <?php else : ?> |
|
115 | - <input id="edit-ticket-TKT_base_price-<?php echo absint($tkt_row); ?>" type="text" |
|
120 | + <?php else { |
|
121 | + : ?> |
|
122 | + <input id="edit-ticket-TKT_base_price-<?php echo absint($tkt_row); |
|
123 | +} |
|
124 | +?>" type="text" |
|
116 | 125 | name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_base_price]" |
117 | 126 | class="edit-ticket-TKT_base_price ee-small-text-inp edit-price-PRC_amount ee-numeric" |
118 | 127 | value="<?php echo esc_attr($TKT_base_price); ?>"> |
@@ -129,8 +138,11 @@ discard block |
||
129 | 138 | <input type="text" class="edit-ticket-TKT_qty ee-small-text-inp ee-numeric" |
130 | 139 | name="archived_ticket[<?php echo absint($tkt_row); ?>][TKT_qty]" value="<?php echo esc_attr($TKT_qty_for_input); ?>" |
131 | 140 | disabled> |
132 | - <?php else : ?> |
|
133 | - <input type="text" id="edit-ticket-TKT_qty-<?php echo absint($tkt_row); ?>" |
|
141 | + <?php else { |
|
142 | + : ?> |
|
143 | + <input type="text" id="edit-ticket-TKT_qty-<?php echo absint($tkt_row); |
|
144 | +} |
|
145 | +?>" |
|
134 | 146 | class="edit-ticket-TKT_qty ee-small-text-inp ee-numeric" |
135 | 147 | name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_qty]" |
136 | 148 | value="<?php echo esc_attr($TKT_qty_for_input); ?>"> |
@@ -209,9 +221,12 @@ discard block |
||
209 | 221 | <input type="text" class="edit-ticket-TKT_uses ee-small-text-inp ee-numeric" |
210 | 222 | name="archived_ticket[<?php echo absint($tkt_row); ?>][TKT_uses]" |
211 | 223 | value="<?php echo esc_attr($TKT_uses); ?>" disabled> |
212 | - <?php else : ?> |
|
224 | + <?php else { |
|
225 | + : ?> |
|
213 | 226 | <input type="text" class="edit-ticket-TKT_uses ee-small-text-inp ee-numeric" |
214 | - name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_uses]" |
|
227 | + name="<?php echo esc_attr($edit_tickets_name); |
|
228 | +} |
|
229 | +?>[<?php echo absint($tkt_row); ?>][TKT_uses]" |
|
215 | 230 | value="<?php echo esc_attr($TKT_uses); ?>"> |
216 | 231 | <?php endif; ?> |
217 | 232 | </td> |
@@ -223,9 +238,12 @@ discard block |
||
223 | 238 | <input type="text" class="edit-ticket-TKT_min ee-small-text-inp ee-numeric" |
224 | 239 | name="archived_ticket[<?php echo absint($tkt_row); ?>][TKT_min]" |
225 | 240 | value="<?php echo esc_attr($TKT_min); ?>" disabled> |
226 | - <?php else : ?> |
|
241 | + <?php else { |
|
242 | + : ?> |
|
227 | 243 | <input type="text" class="edit-ticket-TKT_min ee-small-text-inp ee-numeric" |
228 | - name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_min]" |
|
244 | + name="<?php echo esc_attr($edit_tickets_name); |
|
245 | +} |
|
246 | +?>[<?php echo absint($tkt_row); ?>][TKT_min]" |
|
229 | 247 | value="<?php echo esc_attr($TKT_min); ?>"> |
230 | 248 | <?php endif; ?> |
231 | 249 | </td> |
@@ -237,9 +255,12 @@ discard block |
||
237 | 255 | <input type="text" class="edit-ticket-TKT_max ee-small-text-inp ee-numeric" |
238 | 256 | name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_max]" |
239 | 257 | value="<?php echo esc_attr($TKT_max); ?>" disabled> |
240 | - <?php else : ?> |
|
258 | + <?php else { |
|
259 | + : ?> |
|
241 | 260 | <input type="text" class="edit-ticket-TKT_max ee-small-text-inp ee-numeric" |
242 | - name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_max]" |
|
261 | + name="<?php echo esc_attr($edit_tickets_name); |
|
262 | +} |
|
263 | +?>[<?php echo absint($tkt_row); ?>][TKT_max]" |
|
243 | 264 | value="<?php echo esc_attr($TKT_max); ?>"> |
244 | 265 | <?php endif; ?> |
245 | 266 | </td> |
@@ -278,8 +299,11 @@ discard block |
||
278 | 299 | <input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo absint($tkt_row); ?>" |
279 | 300 | type="checkbox" name="archived_ticket[<?php echo absint($tkt_row); ?>][TKT_taxable]" |
280 | 301 | value="1"<?php echo $TKT_taxable; ?> disabled> |
281 | - <?php else : ?> |
|
282 | - <input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo absint($tkt_row); ?>" |
|
302 | + <?php else { |
|
303 | + : ?> |
|
304 | + <input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo absint($tkt_row); |
|
305 | +} |
|
306 | +?>" |
|
283 | 307 | type="checkbox" |
284 | 308 | name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo absint($tkt_row); ?>][TKT_taxable]" |
285 | 309 | value="1"<?php echo $TKT_taxable; ?>> |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | /* @var EE_Question[] $all_questions */ |
14 | 14 | assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));// list of unused questions |
15 | 15 | foreach ($all_questions as $unused_question) { |
16 | - assert($unused_question); |
|
17 | - assert($unused_question instanceof EE_Question); |
|
16 | + assert($unused_question); |
|
17 | + assert($unused_question instanceof EE_Question); |
|
18 | 18 | } |
19 | 19 | /* @var array $values . Array of arrays, where each sub-array contains 2 keys: 'id' (internal value) and 'name' (label for displaying) */ |
20 | 20 | assert(is_array($values)); |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | <th> |
34 | 34 | <label for="QSG_name"> |
35 | 35 | <?php esc_html_e('Group Name', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
36 | - 'group_name_info' |
|
37 | - ); ?> |
|
36 | + 'group_name_info' |
|
37 | + ); ?> |
|
38 | 38 | </label> |
39 | 39 | </th> |
40 | 40 | <td> |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | <th> |
49 | 49 | <label for="QSG_identifier"> |
50 | 50 | <?php esc_html_e('Group Identifier', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
51 | - 'group_identifier_info' |
|
52 | - ); ?> |
|
51 | + 'group_identifier_info' |
|
52 | + ); ?> |
|
53 | 53 | </label> |
54 | 54 | </th> |
55 | 55 | <td> |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | <th> |
69 | 69 | <label for="QSG_desc"> |
70 | 70 | <?php esc_html_e('Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
71 | - 'group_description_info' |
|
72 | - ); ?> |
|
71 | + 'group_description_info' |
|
72 | + ); ?> |
|
73 | 73 | </label> |
74 | 74 | </th> |
75 | 75 | <td> |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | <th> |
83 | 83 | <label for="QSG_order"> |
84 | 84 | <?php esc_html_e('Question Group Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
85 | - 'group_order_info' |
|
86 | - ); ?> |
|
85 | + 'group_order_info' |
|
86 | + ); ?> |
|
87 | 87 | </label> |
88 | 88 | </th> |
89 | 89 | <td> |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | <th> |
97 | 97 | <label> |
98 | 98 | <?php esc_html_e('Show Name', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
99 | - 'show_group_name_info' |
|
100 | - ); ?> |
|
99 | + 'show_group_name_info' |
|
100 | + ); ?> |
|
101 | 101 | </label> |
102 | 102 | </th> |
103 | 103 | <td> |
104 | 104 | <label for="QSG_show_group_name"> |
105 | 105 | <?php echo EEH_Form_Fields::select_input( |
106 | - 'QSG_show_group_name', |
|
107 | - $values, |
|
108 | - $question_group->show_group_name() |
|
109 | - ); ?> |
|
106 | + 'QSG_show_group_name', |
|
107 | + $values, |
|
108 | + $question_group->show_group_name() |
|
109 | + ); ?> |
|
110 | 110 | <p class="description"><?php esc_html_e('Show Group Name on Registration Page?', 'event_espresso'); ?></p> |
111 | 111 | </label> |
112 | 112 | </td> |
@@ -116,20 +116,20 @@ discard block |
||
116 | 116 | <th> |
117 | 117 | <label> |
118 | 118 | <?php esc_html_e(' Show Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
119 | - 'show_group_description_info' |
|
120 | - ); ?> |
|
119 | + 'show_group_description_info' |
|
120 | + ); ?> |
|
121 | 121 | </label> |
122 | 122 | </th> |
123 | 123 | <td> |
124 | 124 | <label for="QSG_show_group_order"> |
125 | 125 | <?php echo EEH_Form_Fields::select_input( |
126 | - 'QSG_show_group_desc', |
|
127 | - $values, |
|
128 | - $question_group->show_group_desc() |
|
129 | - ); ?> |
|
126 | + 'QSG_show_group_desc', |
|
127 | + $values, |
|
128 | + $question_group->show_group_desc() |
|
129 | + ); ?> |
|
130 | 130 | <p class="description"><?php |
131 | - esc_html_e(' Show Group Description on Registration Page?', 'event_espresso'); |
|
132 | - ?></p> |
|
131 | + esc_html_e(' Show Group Description on Registration Page?', 'event_espresso'); |
|
132 | + ?></p> |
|
133 | 133 | </label> |
134 | 134 | <input type="hidden" name="QSG_system" value="<?php echo esc_attr($question_group->system_group()); ?>"> |
135 | 135 | </td> |
@@ -145,85 +145,85 @@ discard block |
||
145 | 145 | <div class="form-table question-group-questions inside"> |
146 | 146 | <div class="padding"> |
147 | 147 | <p><span class="description"><?php |
148 | - esc_html_e( |
|
149 | - 'Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.', |
|
150 | - 'event_espresso' |
|
151 | - ); ?></span></p> |
|
148 | + esc_html_e( |
|
149 | + 'Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.', |
|
150 | + 'event_espresso' |
|
151 | + ); ?></span></p> |
|
152 | 152 | <div> |
153 | 153 | <ul class="question-list-sortable"> |
154 | 154 | <?php |
155 | - $question_order = 0; |
|
156 | - $question_group_questions = $question_group->questions(); |
|
157 | - foreach ($all_questions as $question_ID => $question) { |
|
158 | - if ($question instanceof EE_Question) { |
|
159 | - /*@var $question EE_Question*/ |
|
160 | - $checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : ''; |
|
161 | - // disable questions from the personal information question group |
|
162 | - // is it required in the current question group? if so don't allow admins to remove it |
|
163 | - $disabled = in_array( |
|
164 | - $question->system_ID(), |
|
165 | - EEM_Question::instance()->required_system_questions_in_system_question_group( |
|
166 | - $QSG_system |
|
167 | - ) |
|
168 | - ) ? 'disabled="disabled"' : ''; |
|
169 | - // limit where system questions can appear |
|
170 | - if ( |
|
171 | - $question->system_ID() && |
|
172 | - ! in_array( |
|
173 | - $question->system_ID(), |
|
174 | - EEM_Question::instance()->allowed_system_questions_in_system_question_group( |
|
175 | - $QSG_system |
|
176 | - ) |
|
177 | - ) |
|
178 | - ) { |
|
179 | - continue; // skip over system question not assigned to this group except for the address system group cause we want the address questions to display even if they aren't selected (but still not show the personal system questions). The third condition checks if we're displaying a non system question group and the question is a system question, then we skip because for non-system question groups we only want to show non-system questions. |
|
180 | - } |
|
181 | - ?> |
|
155 | + $question_order = 0; |
|
156 | + $question_group_questions = $question_group->questions(); |
|
157 | + foreach ($all_questions as $question_ID => $question) { |
|
158 | + if ($question instanceof EE_Question) { |
|
159 | + /*@var $question EE_Question*/ |
|
160 | + $checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : ''; |
|
161 | + // disable questions from the personal information question group |
|
162 | + // is it required in the current question group? if so don't allow admins to remove it |
|
163 | + $disabled = in_array( |
|
164 | + $question->system_ID(), |
|
165 | + EEM_Question::instance()->required_system_questions_in_system_question_group( |
|
166 | + $QSG_system |
|
167 | + ) |
|
168 | + ) ? 'disabled="disabled"' : ''; |
|
169 | + // limit where system questions can appear |
|
170 | + if ( |
|
171 | + $question->system_ID() && |
|
172 | + ! in_array( |
|
173 | + $question->system_ID(), |
|
174 | + EEM_Question::instance()->allowed_system_questions_in_system_question_group( |
|
175 | + $QSG_system |
|
176 | + ) |
|
177 | + ) |
|
178 | + ) { |
|
179 | + continue; // skip over system question not assigned to this group except for the address system group cause we want the address questions to display even if they aren't selected (but still not show the personal system questions). The third condition checks if we're displaying a non system question group and the question is a system question, then we skip because for non-system question groups we only want to show non-system questions. |
|
180 | + } |
|
181 | + ?> |
|
182 | 182 | <li class="ee-question-sortable"> |
183 | 183 | <label for="question-<?php echo absint($question_ID); ?>"> |
184 | 184 | <input type="checkbox" name="questions[<?php echo absint($question_ID); ?>]" |
185 | 185 | id="question-<?php echo absint($question_ID); ?>" |
186 | 186 | value="<?php echo absint($question_ID); ?>"<?php echo $disabled; ?><?php echo $checked; ?>/> |
187 | 187 | <span class="question-text"><?php |
188 | - echo trim($question->display_text()) |
|
189 | - . (95 <= strlen(trim($question->display_text())) |
|
190 | - ? "…" |
|
191 | - : ''); |
|
192 | - ?> |
|
188 | + echo trim($question->display_text()) |
|
189 | + . (95 <= strlen(trim($question->display_text())) |
|
190 | + ? "…" |
|
191 | + : ''); |
|
192 | + ?> |
|
193 | 193 | </span> |
194 | 194 | <input class="question-group-QGQ_order" type="hidden" |
195 | 195 | name="question_orders[<?php echo absint($question_ID); ?>]" |
196 | 196 | value="<?php echo esc_attr($question_order); ?>"> |
197 | 197 | </label> |
198 | 198 | <?php |
199 | - if ( |
|
200 | - EE_Registry::instance()->CAP->current_user_can( |
|
201 | - 'ee_edit_question', |
|
202 | - 'espresso_registration_form_edit_question', |
|
203 | - $question->ID() |
|
204 | - ) |
|
205 | - ) { |
|
206 | - $edit_query_args = array( |
|
207 | - 'action' => 'edit_question', |
|
208 | - 'QST_ID' => $question->ID(), |
|
209 | - ); |
|
210 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
199 | + if ( |
|
200 | + EE_Registry::instance()->CAP->current_user_can( |
|
201 | + 'ee_edit_question', |
|
202 | + 'espresso_registration_form_edit_question', |
|
203 | + $question->ID() |
|
204 | + ) |
|
205 | + ) { |
|
206 | + $edit_query_args = array( |
|
207 | + 'action' => 'edit_question', |
|
208 | + 'QST_ID' => $question->ID(), |
|
209 | + ); |
|
210 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
211 | 211 | |
212 | - echo '<a href="' . $edit_link . '" target="_blank" title="' . |
|
213 | - sprintf( |
|
214 | - esc_attr__('Edit %s', 'event_espresso'), |
|
215 | - $question->admin_label() |
|
216 | - ) |
|
217 | - . '"><span class="dashicons dashicons-edit"></span> |
|
212 | + echo '<a href="' . $edit_link . '" target="_blank" title="' . |
|
213 | + sprintf( |
|
214 | + esc_attr__('Edit %s', 'event_espresso'), |
|
215 | + $question->admin_label() |
|
216 | + ) |
|
217 | + . '"><span class="dashicons dashicons-edit"></span> |
|
218 | 218 | </a>'; |
219 | - } |
|
220 | - ?> |
|
219 | + } |
|
220 | + ?> |
|
221 | 221 | </li> |
222 | 222 | <?php |
223 | - $question_order++; |
|
224 | - } |
|
225 | - } |
|
226 | - ?> |
|
223 | + $question_order++; |
|
224 | + } |
|
225 | + } |
|
226 | + ?> |
|
227 | 227 | </ul> |
228 | 228 | </div> |
229 | 229 | </div> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | assert($question_group); |
12 | 12 | assert($question_group instanceof EE_Question_Group); |
13 | 13 | /* @var EE_Question[] $all_questions */ |
14 | -assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));// list of unused questions |
|
14 | +assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions))); // list of unused questions |
|
15 | 15 | foreach ($all_questions as $unused_question) { |
16 | 16 | assert($unused_question); |
17 | 17 | assert($unused_question instanceof EE_Question); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | <input id="QSG_identifier" name="QSG_identifier<?php echo absint($id); ?>" |
57 | 57 | value="<?php echo esc_attr($question_group->get_f('QSG_identifier')); ?>" type="text" |
58 | 58 | class="regular-text"<?php echo $disabled; ?>> |
59 | - <?php if (! empty($QSG_system)) { ?> |
|
59 | + <?php if ( ! empty($QSG_system)) { ?> |
|
60 | 60 | <p><span class="description" style="color:#D54E21;"> |
61 | 61 | <?php esc_html_e('System question group! This field cannot be changed.', 'event_espresso') ?> |
62 | 62 | </span><br/></p> |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | foreach ($all_questions as $question_ID => $question) { |
158 | 158 | if ($question instanceof EE_Question) { |
159 | 159 | /*@var $question EE_Question*/ |
160 | - $checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : ''; |
|
160 | + $checked = isset($question_group_questions[$question_ID]) ? ' checked="checked"' : ''; |
|
161 | 161 | // disable questions from the personal information question group |
162 | 162 | // is it required in the current question group? if so don't allow admins to remove it |
163 | 163 | $disabled = in_array( |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | ); |
210 | 210 | $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
211 | 211 | |
212 | - echo '<a href="' . $edit_link . '" target="_blank" title="' . |
|
212 | + echo '<a href="'.$edit_link.'" target="_blank" title="'. |
|
213 | 213 | sprintf( |
214 | 214 | esc_attr__('Edit %s', 'event_espresso'), |
215 | 215 | $question->admin_label() |
@@ -3,17 +3,17 @@ |
||
3 | 3 | assert($question_group instanceof EE_Question_Group); |
4 | 4 | assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));// list of unused questions |
5 | 5 | foreach ($all_questions as $question_option) { |
6 | - assert($question_option); |
|
7 | - assert($question_option instanceof EE_Question); |
|
6 | + assert($question_option); |
|
7 | + assert($question_option instanceof EE_Question); |
|
8 | 8 | } |
9 | 9 | ?> |
10 | 10 | <h4><?php esc_html_e('Check off all questions that you wish to appear in this group.', 'event_espresso'); ?></h4> |
11 | 11 | <ul> |
12 | 12 | <?php |
13 | - foreach ($all_questions as $question_ID => $question) { |
|
14 | - /*@var $question EE_Question*/ |
|
15 | - $checked = array_key_exists($question_ID, $question_group->questions()) ? ' checked="checked"' : ''; |
|
16 | - ?> |
|
13 | + foreach ($all_questions as $question_ID => $question) { |
|
14 | + /*@var $question EE_Question*/ |
|
15 | + $checked = array_key_exists($question_ID, $question_group->questions()) ? ' checked="checked"' : ''; |
|
16 | + ?> |
|
17 | 17 | <li> |
18 | 18 | <label for="question-<?php echo absint($question_ID); ?>"> |
19 | 19 | <input type="checkbox" name="questions[<?php echo absint($question_ID); ?>]" |
@@ -18,38 +18,38 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function ee_recurse_into_array_for_display($data, $depth = 0, $td = true) |
20 | 20 | { |
21 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
22 | - // is_object($incomplete_class) actually returns false, hence why we check for it |
|
23 | - $data = json_decode(json_encode($data), true); |
|
24 | - } |
|
25 | - if (empty($data)) { |
|
26 | - return; |
|
27 | - } |
|
28 | - if (is_array($data)) { |
|
29 | - $depth++; |
|
30 | - ksort($data, SORT_NATURAL | SORT_FLAG_CASE); |
|
31 | - if (EEH_Array::is_associative_array($data)) { ?> |
|
21 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
22 | + // is_object($incomplete_class) actually returns false, hence why we check for it |
|
23 | + $data = json_decode(json_encode($data), true); |
|
24 | + } |
|
25 | + if (empty($data)) { |
|
26 | + return; |
|
27 | + } |
|
28 | + if (is_array($data)) { |
|
29 | + $depth++; |
|
30 | + ksort($data, SORT_NATURAL | SORT_FLAG_CASE); |
|
31 | + if (EEH_Array::is_associative_array($data)) { ?> |
|
32 | 32 | <table class='ee-system-stati ee-system-stati-<?php echo absint($depth); ?>'> |
33 | 33 | <tbody> |
34 | 34 | <?php foreach ($data as $data_key => $data_value) { |
35 | - // if the value is a single element array with no key, |
|
36 | - // and the value is a primitive (not an array, object, etc.) |
|
37 | - if ( |
|
38 | - is_array($data_value) |
|
39 | - && count($data_value) === 1 |
|
40 | - && empty(key($data_value)) |
|
41 | - && is_scalar(reset($data_value)) |
|
42 | - ) { |
|
43 | - ?> |
|
35 | + // if the value is a single element array with no key, |
|
36 | + // and the value is a primitive (not an array, object, etc.) |
|
37 | + if ( |
|
38 | + is_array($data_value) |
|
39 | + && count($data_value) === 1 |
|
40 | + && empty(key($data_value)) |
|
41 | + && is_scalar(reset($data_value)) |
|
42 | + ) { |
|
43 | + ?> |
|
44 | 44 | <tr> |
45 | 45 | <td class="ee-system-stati-value" colspan="2"> |
46 | 46 | <?php echo esc_html(reset($data_value)); ?> |
47 | 47 | </td> |
48 | 48 | </tr> |
49 | 49 | <?php |
50 | - continue; |
|
51 | - } |
|
52 | - ?> |
|
50 | + continue; |
|
51 | + } |
|
52 | + ?> |
|
53 | 53 | <tr> |
54 | 54 | <td class='ee-system-stati-key'> |
55 | 55 | <span class="ee-system-stati-label"> |
@@ -64,31 +64,31 @@ discard block |
||
64 | 64 | <?php if (is_scalar($data_value)) { ?> |
65 | 65 | <?php ee_recurse_into_array_for_display($data_value, $depth); ?> |
66 | 66 | <?php } else { |
67 | - if (is_array($data_value) && count($data_value) === 1) { |
|
68 | - // verify that values have been set |
|
69 | - $keys_only = empty( |
|
70 | - array_filter( |
|
71 | - array_values($data_value), |
|
72 | - function ($v) { |
|
73 | - return $v !== null && (is_array($v) || trim($v) !== ''); |
|
74 | - } |
|
75 | - ) |
|
76 | - ); |
|
77 | - // if the array only consists of keys (no values) |
|
78 | - if ($keys_only) { |
|
79 | - // then use keys for values |
|
80 | - $data_value = array_keys($data_value); |
|
81 | - // but if there is only one value now |
|
82 | - if (count($data_value) === 1) { |
|
83 | - // then pass that single value back into this function |
|
84 | - // this prevents extra empty layers of nothing being added to the output |
|
85 | - ee_recurse_into_array_for_display(reset($data_value), $depth); |
|
86 | - // need to finish the row off though |
|
87 | - echo '</tr>'; |
|
88 | - continue; |
|
89 | - } |
|
90 | - } |
|
91 | - } ?> |
|
67 | + if (is_array($data_value) && count($data_value) === 1) { |
|
68 | + // verify that values have been set |
|
69 | + $keys_only = empty( |
|
70 | + array_filter( |
|
71 | + array_values($data_value), |
|
72 | + function ($v) { |
|
73 | + return $v !== null && (is_array($v) || trim($v) !== ''); |
|
74 | + } |
|
75 | + ) |
|
76 | + ); |
|
77 | + // if the array only consists of keys (no values) |
|
78 | + if ($keys_only) { |
|
79 | + // then use keys for values |
|
80 | + $data_value = array_keys($data_value); |
|
81 | + // but if there is only one value now |
|
82 | + if (count($data_value) === 1) { |
|
83 | + // then pass that single value back into this function |
|
84 | + // this prevents extra empty layers of nothing being added to the output |
|
85 | + ee_recurse_into_array_for_display(reset($data_value), $depth); |
|
86 | + // need to finish the row off though |
|
87 | + echo '</tr>'; |
|
88 | + continue; |
|
89 | + } |
|
90 | + } |
|
91 | + } ?> |
|
92 | 92 | <td class="ee-system-stati-sub-values"> |
93 | 93 | <?php ee_recurse_into_array_for_display($data_value, $depth); ?> |
94 | 94 | </td> |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | <?php } ?> |
107 | 107 | </ul> |
108 | 108 | <?php } else { |
109 | - // there's no key (label) and there's only one value, |
|
110 | - // so let's just pass that value back into this function, |
|
111 | - // but reset the depth back to where it was. |
|
112 | - // this prevents extra empty layers of nothing being added to the output |
|
113 | - $depth--; |
|
114 | - ee_recurse_into_array_for_display(reset($data), $depth, false); |
|
115 | - } |
|
116 | - } else { |
|
117 | - echo $td ? '<td class="ee-system-stati-value">' : ''; |
|
118 | - // simple value |
|
119 | - echo $data; |
|
120 | - echo $td ? '</td>' : ''; |
|
121 | - } |
|
109 | + // there's no key (label) and there's only one value, |
|
110 | + // so let's just pass that value back into this function, |
|
111 | + // but reset the depth back to where it was. |
|
112 | + // this prevents extra empty layers of nothing being added to the output |
|
113 | + $depth--; |
|
114 | + ee_recurse_into_array_for_display(reset($data), $depth, false); |
|
115 | + } |
|
116 | + } else { |
|
117 | + echo $td ? '<td class="ee-system-stati-value">' : ''; |
|
118 | + // simple value |
|
119 | + echo $data; |
|
120 | + echo $td ? '</td>' : ''; |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | ?> |