Completed
Branch fix/kses-23 (9a0112)
by
unknown
04:46 queued 02:29
created
widgets/upcoming_events/EEW_Upcoming_Events.widget.php 1 patch
Indentation   +618 added lines, -618 removed lines patch added patch discarded remove patch
@@ -12,109 +12,109 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class EEW_Upcoming_Events extends EspressoWidget
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,38 +151,38 @@  discard block
 block discarded – undo
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 wp_kses(
159
-                EEH_Form_Fields::select(
160
-                    esc_html__('Show Expired Events:', 'event_espresso'),
161
-                    $instance['show_expired'],
162
-                    $show_expired_options,
163
-                    $this->fieldName('show_expired'),
164
-                    $this->fieldID('show_expired')
165
-                ),
166
-                AllowedTags::getWithFormTags()
167
-            );
168
-            ?>
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 wp_kses(
159
+				EEH_Form_Fields::select(
160
+					esc_html__('Show Expired Events:', 'event_espresso'),
161
+					$instance['show_expired'],
162
+					$show_expired_options,
163
+					$this->fieldName('show_expired'),
164
+					$this->fieldID('show_expired')
165
+				),
166
+				AllowedTags::getWithFormTags()
167
+			);
168
+			?>
169 169
         </p>
170 170
         <p>
171 171
             <label for="<?php echo esc_attr($this->fieldID('sort')); ?>">
172 172
                 <?php esc_html_e('Sort Events:', 'event_espresso'); ?>
173 173
             </label>
174 174
             <?php
175
-            echo wp_kses(
176
-                EEH_Form_Fields::select(
177
-                    esc_html__('Sort Events:', 'event_espresso'),
178
-                    $instance['sort'],
179
-                    $sort_values,
180
-                    $this->fieldName('sort'),
181
-                    $this->fieldID('sort')
182
-                ),
183
-                AllowedTags::getWithFormTags()
184
-            );
185
-            ?>
175
+			echo wp_kses(
176
+				EEH_Form_Fields::select(
177
+					esc_html__('Sort Events:', 'event_espresso'),
178
+					$instance['sort'],
179
+					$sort_values,
180
+					$this->fieldName('sort'),
181
+					$this->fieldID('sort')
182
+				),
183
+				AllowedTags::getWithFormTags()
184
+			);
185
+			?>
186 186
         </p>
187 187
         <p>
188 188
             <label for="<?php echo esc_attr($this->fieldID('image_size')); ?>">
@@ -196,51 +196,51 @@  discard block
 block discarded – undo
196 196
                 <?php esc_html_e('Show Description:', 'event_espresso'); ?>
197 197
             </label>
198 198
             <?php
199
-            echo wp_kses(
200
-                EEH_Form_Fields::select(
201
-                    esc_html__('Show Description:', 'event_espresso'),
202
-                    $instance['show_desc'],
203
-                    $yes_no_values,
204
-                    $this->fieldName('show_desc'),
205
-                    $this->fieldID('show_desc')
206
-                ),
207
-                AllowedTags::getWithFormTags()
208
-            );
209
-            ?>
199
+			echo wp_kses(
200
+				EEH_Form_Fields::select(
201
+					esc_html__('Show Description:', 'event_espresso'),
202
+					$instance['show_desc'],
203
+					$yes_no_values,
204
+					$this->fieldName('show_desc'),
205
+					$this->fieldID('show_desc')
206
+				),
207
+				AllowedTags::getWithFormTags()
208
+			);
209
+			?>
210 210
         </p>
211 211
         <p>
212 212
             <label for="<?php echo esc_attr($this->fieldID('show_dates')); ?>">
213 213
                 <?php esc_html_e('Show Dates:', 'event_espresso'); ?>
214 214
             </label>
215 215
             <?php
216
-            echo wp_kses(
217
-                EEH_Form_Fields::select(
218
-                    esc_html__('Show Dates:', 'event_espresso'),
219
-                    $instance['show_dates'],
220
-                    $yes_no_values,
221
-                    $this->fieldName('show_dates'),
222
-                    $this->fieldID('show_dates')
223
-                ),
224
-                AllowedTags::getWithFormTags()
225
-            );
226
-            ?>
216
+			echo wp_kses(
217
+				EEH_Form_Fields::select(
218
+					esc_html__('Show Dates:', 'event_espresso'),
219
+					$instance['show_dates'],
220
+					$yes_no_values,
221
+					$this->fieldName('show_dates'),
222
+					$this->fieldID('show_dates')
223
+				),
224
+				AllowedTags::getWithFormTags()
225
+			);
226
+			?>
227 227
         </p>
228 228
         <p>
229 229
             <label for="<?php echo esc_attr($this->fieldID('show_everywhere')); ?>">
230 230
                 <?php esc_html_e('Show on all Pages:', 'event_espresso'); ?>
231 231
             </label>
232 232
             <?php
233
-            echo wp_kses(
234
-                EEH_Form_Fields::select(
235
-                    esc_html__('Show on all Pages:', 'event_espresso'),
236
-                    $instance['show_everywhere'],
237
-                    $yes_no_values,
238
-                    $this->fieldName('show_everywhere'),
239
-                    $this->fieldID('show_everywhere')
240
-                ),
241
-                AllowedTags::getWithFormTags()
242
-            );
243
-            ?>
233
+			echo wp_kses(
234
+				EEH_Form_Fields::select(
235
+					esc_html__('Show on all Pages:', 'event_espresso'),
236
+					$instance['show_everywhere'],
237
+					$yes_no_values,
238
+					$this->fieldName('show_everywhere'),
239
+					$this->fieldID('show_everywhere')
240
+				),
241
+				AllowedTags::getWithFormTags()
242
+			);
243
+			?>
244 244
         </p>
245 245
         <p>
246 246
             <label for="<?php echo esc_attr($this->fieldID('date_limit')); ?>">
@@ -258,287 +258,287 @@  discard block
 block discarded – undo
258 258
                 <?php esc_html_e('Show Date Range:', 'event_espresso'); ?>
259 259
             </label>
260 260
             <?php
261
-            echo wp_kses(
262
-                EEH_Form_Fields::select(
263
-                    esc_html__('Show Date Range:', 'event_espresso'),
264
-                    $instance['date_range'],
265
-                    $yes_no_values,
266
-                    $this->fieldName('date_range'),
267
-                    $this->fieldID('date_range')
268
-                ),
269
-                AllowedTags::getWithFormTags()
270
-            );
271
-            ?>
261
+			echo wp_kses(
262
+				EEH_Form_Fields::select(
263
+					esc_html__('Show Date Range:', 'event_espresso'),
264
+					$instance['date_range'],
265
+					$yes_no_values,
266
+					$this->fieldName('date_range'),
267
+					$this->fieldID('date_range')
268
+				),
269
+				AllowedTags::getWithFormTags()
270
+			);
271
+			?>
272 272
             <span class="description">
273 273
                 <br />
274 274
                 <?php esc_html_e(
275
-                    'This setting will replace the list of dates in the widget.',
276
-                    'event_espresso'
277
-                ); ?>
275
+					'This setting will replace the list of dates in the widget.',
276
+					'event_espresso'
277
+				); ?>
278 278
             </span>
279 279
         </p>
280 280
 
281 281
         <?php
282
-    }
283
-
284
-
285
-    /**
286
-     * Sanitize widget form values as they are saved.
287
-     *
288
-     * @param array $new_instance Values just sent to be saved.
289
-     * @param array $old_instance Previously saved values from database.
290
-     *
291
-     * @return array Updated safe values to be saved.
292
-     * @see WP_Widget::update()
293
-     *
294
-     */
295
-    public function update($new_instance, $old_instance)
296
-    {
297
-        $instance                    = $old_instance;
298
-        $instance['title']           = ! empty($new_instance['title']) ? strip_tags((string) $new_instance['title']) : '';
299
-        $instance['category_name']   = $new_instance['category_name'];
300
-        $instance['show_expired']    = $new_instance['show_expired'];
301
-        $instance['limit']           = $new_instance['limit'];
302
-        $instance['sort']            = $new_instance['sort'];
303
-        $instance['image_size']      = $new_instance['image_size'];
304
-        $instance['show_desc']       = $new_instance['show_desc'];
305
-        $instance['show_dates']      = $new_instance['show_dates'];
306
-        $instance['show_everywhere'] = $new_instance['show_everywhere'];
307
-        $instance['date_limit']      = $new_instance['date_limit'];
308
-        $instance['date_range']      = $new_instance['date_range'];
309
-        return $instance;
310
-    }
311
-
312
-
313
-    /**
314
-     * Front-end display of widget.
315
-     *
316
-     * @param array $args     Widget arguments.
317
-     * @param array $instance Saved values from database.
318
-     * @throws EE_Error
319
-     * @throws ReflectionException
320
-     * @see WP_Widget::widget()
321
-     *
322
-     */
323
-    public function widget($args, $instance)
324
-    {
325
-
326
-        global $post;
327
-        // make sure there is some kinda post object
328
-        if ($post instanceof WP_Post) {
329
-            $before_widget = '';
330
-            $before_title  = '';
331
-            $after_title   = '';
332
-            $after_widget  = '';
333
-            // but NOT an events archives page, cuz that would be like two event lists on the same page
334
-            $show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']);
335
-            if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) {
336
-                // let's use some of the event helper functions'
337
-                // make separate vars out of attributes
338
-                extract($args);
339
-
340
-                // grab widget settings
341
-                $this->parseWidgetSettings($instance);
342
-                $title = $this->widgetTitle();
343
-
344
-                // Before widget (defined by themes).
345
-                echo wp_kses($before_widget, AllowedTags::getAllowedTags());
346
-                // Display the widget title if one was input (before and after defined by themes).
347
-                if (! empty($title)) {
348
-                    echo wp_kses($before_title . $title . $after_title, AllowedTags::getAllowedTags());
349
-                }
350
-                echo wp_kses($this->widgetContent($post), AllowedTags::getWithFormTags());
351
-                // After widget (defined by themes).
352
-                echo wp_kses($after_widget, AllowedTags::getAllowedTags());
353
-            }
354
-        }
355
-    }
356
-
357
-
358
-    /**
359
-     * make_the_title_a_link
360
-     * callback for widget_title filter
361
-     *
362
-     * @param $title
363
-     * @return string
364
-     */
365
-    public function make_the_title_a_link($title)
366
-    {
367
-        return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>';
368
-    }
369
-
370
-
371
-    /**
372
-     * @param string $field_name
373
-     * @return string
374
-     * @since   4.10.14.p
375
-     */
376
-    public function fieldID($field_name)
377
-    {
378
-        return parent::get_field_id($field_name);
379
-    }
380
-
381
-
382
-    /**
383
-     * @param string $field_name
384
-     * @return string
385
-     * @since   4.10.14.p
386
-     */
387
-    public function fieldName($field_name)
388
-    {
389
-        return parent::get_field_name($field_name);
390
-    }
391
-
392
-
393
-    /**
394
-     * @param array $instance
395
-     * @throws EE_Error
396
-     * @throws ReflectionException
397
-     * @since   4.10.14.p
398
-     */
399
-    private function eventCategoriesSelector(array $instance)
400
-    {
401
-        $event_categories = [];
402
-        $categories       = EEM_Term::instance()->get_all_ee_categories(true);
403
-        if ($categories) {
404
-            foreach ($categories as $category) {
405
-                if ($category instanceof EE_Term) {
406
-                    $event_categories[] =
407
-                        EE_Question_Option::new_instance(
408
-                            [
409
-                                'QSO_value' => $category->get('slug'),
410
-                                'QSO_desc'  => $category->get('name'),
411
-                            ]
412
-                        );
413
-                }
414
-            }
415
-        }
416
-        array_unshift(
417
-            $event_categories,
418
-            EE_Question_Option::new_instance(
419
-                [
420
-                    'QSO_value' => '',
421
-                    'QSO_desc'  => esc_html__(' - display all - ', 'event_espresso'),
422
-                ]
423
-            )
424
-        );
425
-        echo wp_kses(
426
-            EEH_Form_Fields::select(
427
-                esc_html__('Event Category:', 'event_espresso'),
428
-                $instance['category_name'],
429
-                $event_categories,
430
-                $this->fieldName('category_name'),
431
-                $this->fieldID('category_name')
432
-            ),
433
-            AllowedTags::getWithFormTags()
434
-        );
435
-    }
436
-
437
-
438
-    /**
439
-     * @param array $instance
440
-     * @since   4.10.14.p
441
-     */
442
-    private function imageSizeSelector(array $instance)
443
-    {
444
-        $image_sizes = [];
445
-        $sizes       = get_intermediate_image_sizes();
446
-        if ($sizes) {
447
-            // loop thru images and create option objects out of them
448
-            foreach ($sizes as $image_size) {
449
-                $image_size = trim($image_size);
450
-                // no big images plz
451
-                if (! in_array($image_size, ['large', 'post-thumbnail'])) {
452
-                    $image_sizes[] =
453
-                        EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]);
454
-                }
455
-            }
456
-            $image_sizes[] =
457
-                EE_Question_Option::new_instance(
458
-                    ['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')]
459
-                );
460
-        }
461
-        echo wp_kses(
462
-            EEH_Form_Fields::select(
463
-                esc_html__('Image Size:', 'event_espresso'),
464
-                $instance['image_size'],
465
-                $image_sizes,
466
-                $this->fieldName('image_size'),
467
-                $this->fieldID('image_size')
468
-            ),
469
-            AllowedTags::getWithFormTags()
470
-        );
471
-    }
472
-
473
-
474
-    /**
475
-     * @param array $instance
476
-     * @since   4.10.14.p
477
-     */
478
-    private function parseWidgetSettings(array $instance)
479
-    {
480
-        $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : '';
481
-        $this->events_category     = isset($instance['category_name']) && ! empty($instance['category_name'])
482
-            ? $instance['category_name']
483
-            : false;
484
-        $this->show_expired = isset($instance['show_expired'])
485
-            ? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN)
486
-            : 0;
487
-        $this->image_size   = isset($instance['image_size']) && ! empty($instance['image_size'])
488
-            ? $instance['image_size']
489
-            : 'medium';
490
-        $this->show_desc    = ! isset($instance['show_desc'])
491
-                              || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN);
492
-        $this->show_dates   = ! isset($instance['show_dates'])
493
-                              || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN);
494
-        $this->date_limit   = isset($instance['date_limit']) && ! empty($instance['date_limit'])
495
-            ? $instance['date_limit']
496
-            : null;
497
-        $this->date_range   = isset($instance['date_range']) && ! empty($instance['date_range'])
498
-            ? $instance['date_range']
499
-            : false;
500
-        $this->limit        = isset($instance['limit']) ? absint($instance['limit']) : 10;
501
-        $this->order        = isset($instance['sort']) && $instance['sort'] === 'DESC'
502
-            ? 'DESC'
503
-            : 'ASC';
504
-    }
505
-
506
-
507
-    /**
508
-     * @return mixed|void
509
-     * @since   4.10.14.p
510
-     */
511
-    private function widgetTitle()
512
-    {
513
-        // add function to make the title a link
514
-        add_filter('widget_title', [$this, 'make_the_title_a_link'], 15);
515
-        // filter the title
516
-        $title = apply_filters('widget_title', $this->title);
517
-        // remove the function from the filter, so it does not affect other widgets
518
-        remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15);
519
-        return $title;
520
-    }
521
-
522
-
523
-    /**
524
-     * @param WP_Post $post
525
-     * @return string
526
-     * @throws EE_Error
527
-     * @throws ReflectionException
528
-     * @since   4.10.14.p
529
-     */
530
-    private function widgetContent(WP_Post $post)
531
-    {
532
-        // run the query
533
-        $events = $this->getUpcomingEvents();
534
-        if (empty($events)) {
535
-            return '';
536
-        }
537
-        $list_items = '';
538
-        foreach ($events as $event) {
539
-            if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) {
540
-                $event_url = $this->eventUrl($event);
541
-                $list_items .= '
282
+	}
283
+
284
+
285
+	/**
286
+	 * Sanitize widget form values as they are saved.
287
+	 *
288
+	 * @param array $new_instance Values just sent to be saved.
289
+	 * @param array $old_instance Previously saved values from database.
290
+	 *
291
+	 * @return array Updated safe values to be saved.
292
+	 * @see WP_Widget::update()
293
+	 *
294
+	 */
295
+	public function update($new_instance, $old_instance)
296
+	{
297
+		$instance                    = $old_instance;
298
+		$instance['title']           = ! empty($new_instance['title']) ? strip_tags((string) $new_instance['title']) : '';
299
+		$instance['category_name']   = $new_instance['category_name'];
300
+		$instance['show_expired']    = $new_instance['show_expired'];
301
+		$instance['limit']           = $new_instance['limit'];
302
+		$instance['sort']            = $new_instance['sort'];
303
+		$instance['image_size']      = $new_instance['image_size'];
304
+		$instance['show_desc']       = $new_instance['show_desc'];
305
+		$instance['show_dates']      = $new_instance['show_dates'];
306
+		$instance['show_everywhere'] = $new_instance['show_everywhere'];
307
+		$instance['date_limit']      = $new_instance['date_limit'];
308
+		$instance['date_range']      = $new_instance['date_range'];
309
+		return $instance;
310
+	}
311
+
312
+
313
+	/**
314
+	 * Front-end display of widget.
315
+	 *
316
+	 * @param array $args     Widget arguments.
317
+	 * @param array $instance Saved values from database.
318
+	 * @throws EE_Error
319
+	 * @throws ReflectionException
320
+	 * @see WP_Widget::widget()
321
+	 *
322
+	 */
323
+	public function widget($args, $instance)
324
+	{
325
+
326
+		global $post;
327
+		// make sure there is some kinda post object
328
+		if ($post instanceof WP_Post) {
329
+			$before_widget = '';
330
+			$before_title  = '';
331
+			$after_title   = '';
332
+			$after_widget  = '';
333
+			// but NOT an events archives page, cuz that would be like two event lists on the same page
334
+			$show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']);
335
+			if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) {
336
+				// let's use some of the event helper functions'
337
+				// make separate vars out of attributes
338
+				extract($args);
339
+
340
+				// grab widget settings
341
+				$this->parseWidgetSettings($instance);
342
+				$title = $this->widgetTitle();
343
+
344
+				// Before widget (defined by themes).
345
+				echo wp_kses($before_widget, AllowedTags::getAllowedTags());
346
+				// Display the widget title if one was input (before and after defined by themes).
347
+				if (! empty($title)) {
348
+					echo wp_kses($before_title . $title . $after_title, AllowedTags::getAllowedTags());
349
+				}
350
+				echo wp_kses($this->widgetContent($post), AllowedTags::getWithFormTags());
351
+				// After widget (defined by themes).
352
+				echo wp_kses($after_widget, AllowedTags::getAllowedTags());
353
+			}
354
+		}
355
+	}
356
+
357
+
358
+	/**
359
+	 * make_the_title_a_link
360
+	 * callback for widget_title filter
361
+	 *
362
+	 * @param $title
363
+	 * @return string
364
+	 */
365
+	public function make_the_title_a_link($title)
366
+	{
367
+		return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>';
368
+	}
369
+
370
+
371
+	/**
372
+	 * @param string $field_name
373
+	 * @return string
374
+	 * @since   4.10.14.p
375
+	 */
376
+	public function fieldID($field_name)
377
+	{
378
+		return parent::get_field_id($field_name);
379
+	}
380
+
381
+
382
+	/**
383
+	 * @param string $field_name
384
+	 * @return string
385
+	 * @since   4.10.14.p
386
+	 */
387
+	public function fieldName($field_name)
388
+	{
389
+		return parent::get_field_name($field_name);
390
+	}
391
+
392
+
393
+	/**
394
+	 * @param array $instance
395
+	 * @throws EE_Error
396
+	 * @throws ReflectionException
397
+	 * @since   4.10.14.p
398
+	 */
399
+	private function eventCategoriesSelector(array $instance)
400
+	{
401
+		$event_categories = [];
402
+		$categories       = EEM_Term::instance()->get_all_ee_categories(true);
403
+		if ($categories) {
404
+			foreach ($categories as $category) {
405
+				if ($category instanceof EE_Term) {
406
+					$event_categories[] =
407
+						EE_Question_Option::new_instance(
408
+							[
409
+								'QSO_value' => $category->get('slug'),
410
+								'QSO_desc'  => $category->get('name'),
411
+							]
412
+						);
413
+				}
414
+			}
415
+		}
416
+		array_unshift(
417
+			$event_categories,
418
+			EE_Question_Option::new_instance(
419
+				[
420
+					'QSO_value' => '',
421
+					'QSO_desc'  => esc_html__(' - display all - ', 'event_espresso'),
422
+				]
423
+			)
424
+		);
425
+		echo wp_kses(
426
+			EEH_Form_Fields::select(
427
+				esc_html__('Event Category:', 'event_espresso'),
428
+				$instance['category_name'],
429
+				$event_categories,
430
+				$this->fieldName('category_name'),
431
+				$this->fieldID('category_name')
432
+			),
433
+			AllowedTags::getWithFormTags()
434
+		);
435
+	}
436
+
437
+
438
+	/**
439
+	 * @param array $instance
440
+	 * @since   4.10.14.p
441
+	 */
442
+	private function imageSizeSelector(array $instance)
443
+	{
444
+		$image_sizes = [];
445
+		$sizes       = get_intermediate_image_sizes();
446
+		if ($sizes) {
447
+			// loop thru images and create option objects out of them
448
+			foreach ($sizes as $image_size) {
449
+				$image_size = trim($image_size);
450
+				// no big images plz
451
+				if (! in_array($image_size, ['large', 'post-thumbnail'])) {
452
+					$image_sizes[] =
453
+						EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]);
454
+				}
455
+			}
456
+			$image_sizes[] =
457
+				EE_Question_Option::new_instance(
458
+					['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')]
459
+				);
460
+		}
461
+		echo wp_kses(
462
+			EEH_Form_Fields::select(
463
+				esc_html__('Image Size:', 'event_espresso'),
464
+				$instance['image_size'],
465
+				$image_sizes,
466
+				$this->fieldName('image_size'),
467
+				$this->fieldID('image_size')
468
+			),
469
+			AllowedTags::getWithFormTags()
470
+		);
471
+	}
472
+
473
+
474
+	/**
475
+	 * @param array $instance
476
+	 * @since   4.10.14.p
477
+	 */
478
+	private function parseWidgetSettings(array $instance)
479
+	{
480
+		$this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : '';
481
+		$this->events_category     = isset($instance['category_name']) && ! empty($instance['category_name'])
482
+			? $instance['category_name']
483
+			: false;
484
+		$this->show_expired = isset($instance['show_expired'])
485
+			? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN)
486
+			: 0;
487
+		$this->image_size   = isset($instance['image_size']) && ! empty($instance['image_size'])
488
+			? $instance['image_size']
489
+			: 'medium';
490
+		$this->show_desc    = ! isset($instance['show_desc'])
491
+							  || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN);
492
+		$this->show_dates   = ! isset($instance['show_dates'])
493
+							  || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN);
494
+		$this->date_limit   = isset($instance['date_limit']) && ! empty($instance['date_limit'])
495
+			? $instance['date_limit']
496
+			: null;
497
+		$this->date_range   = isset($instance['date_range']) && ! empty($instance['date_range'])
498
+			? $instance['date_range']
499
+			: false;
500
+		$this->limit        = isset($instance['limit']) ? absint($instance['limit']) : 10;
501
+		$this->order        = isset($instance['sort']) && $instance['sort'] === 'DESC'
502
+			? 'DESC'
503
+			: 'ASC';
504
+	}
505
+
506
+
507
+	/**
508
+	 * @return mixed|void
509
+	 * @since   4.10.14.p
510
+	 */
511
+	private function widgetTitle()
512
+	{
513
+		// add function to make the title a link
514
+		add_filter('widget_title', [$this, 'make_the_title_a_link'], 15);
515
+		// filter the title
516
+		$title = apply_filters('widget_title', $this->title);
517
+		// remove the function from the filter, so it does not affect other widgets
518
+		remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15);
519
+		return $title;
520
+	}
521
+
522
+
523
+	/**
524
+	 * @param WP_Post $post
525
+	 * @return string
526
+	 * @throws EE_Error
527
+	 * @throws ReflectionException
528
+	 * @since   4.10.14.p
529
+	 */
530
+	private function widgetContent(WP_Post $post)
531
+	{
532
+		// run the query
533
+		$events = $this->getUpcomingEvents();
534
+		if (empty($events)) {
535
+			return '';
536
+		}
537
+		$list_items = '';
538
+		foreach ($events as $event) {
539
+			if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) {
540
+				$event_url = $this->eventUrl($event);
541
+				$list_items .= '
542 542
                 <li id="ee-upcoming-events-widget-li-' . absint($event->ID()) . '" 
543 543
                     class="ee-upcoming-events-widget-li"
544 544
                 >
@@ -549,194 +549,194 @@  discard block
 block discarded – undo
549 549
                     </h5>
550 550
                     ' . $this->eventWidgetContent($event, $event_url) . '
551 551
                 </li>';
552
-            }
553
-        }
554
-        return '
552
+			}
553
+		}
554
+		return '
555 555
             <ul class="ee-upcoming-events-widget-ul">
556 556
                 ' . $list_items . '
557 557
             </ul>';
558
-    }
559
-
560
-
561
-    /**
562
-     * @param EE_Event $event
563
-     * @return string|null
564
-     * @throws EE_Error
565
-     * @since   4.10.14.p
566
-     */
567
-    private function eventUrl(EE_Event $event)
568
-    {
569
-        return esc_url_raw(
570
-            apply_filters(
571
-                'FHEE_EEW_Upcoming_Events__widget__event_url',
572
-                $event->get_permalink(),
573
-                $event
574
-            )
575
-        );
576
-    }
577
-
578
-
579
-    /**
580
-     * @return EE_Base_Class[]
581
-     * @throws EE_Error
582
-     */
583
-    private function getUpcomingEvents()
584
-    {
585
-        return EEM_Event::instance()->get_all(
586
-            [
587
-                $this->queryWhereParams(),
588
-                'limit'    => '0,' . $this->limit,
589
-                'order_by' => 'Datetime.DTT_EVT_start',
590
-                'order'    => $this->order,
591
-                'group_by' => 'EVT_ID',
592
-            ]
593
-        );
594
-    }
595
-
596
-
597
-    /**
598
-     * @return mixed|void
599
-     * @throws EE_Error
600
-     * @since   4.10.14.p
601
-     */
602
-    private function queryWhereParams()
603
-    {
604
-        // start to build our where clause
605
-        $where = [
606
-            'status' => ['IN', ['publish', 'sold_out']],
607
-        ];
608
-        // add category
609
-        if ($this->events_category) {
610
-            $where['Term_Taxonomy.taxonomy']  = 'espresso_event_categories';
611
-            $where['Term_Taxonomy.Term.slug'] = $this->events_category;
612
-        }
613
-        // if NOT expired then we want events that start today or in the future
614
-        // if NOT show expired then we want events that start today or in the future
615
-        if ($this->show_expired == 0) {
616
-            $where['Datetime.DTT_EVT_end'] = [
617
-                '>=',
618
-                EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'),
619
-            ];
620
-        }
621
-        // if show ONLY expired we want events that ended prior to today
622
-        if ($this->show_expired == 2) {
623
-            $where['Datetime.DTT_EVT_end'] = [
624
-                '<=',
625
-                EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'),
626
-            ];
627
-        }
628
-        // allow $where to be filtered
629
-        return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired);
630
-    }
631
-
632
-
633
-    /**
634
-     * @param EE_Event $event
635
-     * @return string
636
-     * @throws EE_Error
637
-     * @throws ReflectionException
638
-     * @since   4.10.14.p
639
-     */
640
-    private function linkClass(EE_Event $event)
641
-    {
642
-        // how big is the event name ?
643
-        $name_length = strlen($event->name());
644
-        switch ($name_length) {
645
-            case $name_length > 70:
646
-                return ' three-line';
647
-            case $name_length > 35:
648
-                return ' two-line';
649
-        }
650
-        return ' one-line';
651
-    }
652
-
653
-
654
-    /**
655
-     * @param EE_Event $event
656
-     * @param string   $event_url
657
-     * @return mixed|string|void
658
-     * @throws EE_Error
659
-     * @throws ReflectionException
660
-     * @since   4.10.14.p
661
-     */
662
-    private function eventWidgetContent(EE_Event $event, $event_url = '')
663
-    {
664
-        if (post_password_required($event->ID())) {
665
-            return apply_filters(
666
-                'FHEE_EEW_Upcoming_Events__widget__password_form',
667
-                get_the_password_form($event->ID()),
668
-                $event
669
-            );
670
-        }
671
-
672
-        $content = '';
673
-        if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') {
674
-            $content .= '
558
+	}
559
+
560
+
561
+	/**
562
+	 * @param EE_Event $event
563
+	 * @return string|null
564
+	 * @throws EE_Error
565
+	 * @since   4.10.14.p
566
+	 */
567
+	private function eventUrl(EE_Event $event)
568
+	{
569
+		return esc_url_raw(
570
+			apply_filters(
571
+				'FHEE_EEW_Upcoming_Events__widget__event_url',
572
+				$event->get_permalink(),
573
+				$event
574
+			)
575
+		);
576
+	}
577
+
578
+
579
+	/**
580
+	 * @return EE_Base_Class[]
581
+	 * @throws EE_Error
582
+	 */
583
+	private function getUpcomingEvents()
584
+	{
585
+		return EEM_Event::instance()->get_all(
586
+			[
587
+				$this->queryWhereParams(),
588
+				'limit'    => '0,' . $this->limit,
589
+				'order_by' => 'Datetime.DTT_EVT_start',
590
+				'order'    => $this->order,
591
+				'group_by' => 'EVT_ID',
592
+			]
593
+		);
594
+	}
595
+
596
+
597
+	/**
598
+	 * @return mixed|void
599
+	 * @throws EE_Error
600
+	 * @since   4.10.14.p
601
+	 */
602
+	private function queryWhereParams()
603
+	{
604
+		// start to build our where clause
605
+		$where = [
606
+			'status' => ['IN', ['publish', 'sold_out']],
607
+		];
608
+		// add category
609
+		if ($this->events_category) {
610
+			$where['Term_Taxonomy.taxonomy']  = 'espresso_event_categories';
611
+			$where['Term_Taxonomy.Term.slug'] = $this->events_category;
612
+		}
613
+		// if NOT expired then we want events that start today or in the future
614
+		// if NOT show expired then we want events that start today or in the future
615
+		if ($this->show_expired == 0) {
616
+			$where['Datetime.DTT_EVT_end'] = [
617
+				'>=',
618
+				EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'),
619
+			];
620
+		}
621
+		// if show ONLY expired we want events that ended prior to today
622
+		if ($this->show_expired == 2) {
623
+			$where['Datetime.DTT_EVT_end'] = [
624
+				'<=',
625
+				EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'),
626
+			];
627
+		}
628
+		// allow $where to be filtered
629
+		return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired);
630
+	}
631
+
632
+
633
+	/**
634
+	 * @param EE_Event $event
635
+	 * @return string
636
+	 * @throws EE_Error
637
+	 * @throws ReflectionException
638
+	 * @since   4.10.14.p
639
+	 */
640
+	private function linkClass(EE_Event $event)
641
+	{
642
+		// how big is the event name ?
643
+		$name_length = strlen($event->name());
644
+		switch ($name_length) {
645
+			case $name_length > 70:
646
+				return ' three-line';
647
+			case $name_length > 35:
648
+				return ' two-line';
649
+		}
650
+		return ' one-line';
651
+	}
652
+
653
+
654
+	/**
655
+	 * @param EE_Event $event
656
+	 * @param string   $event_url
657
+	 * @return mixed|string|void
658
+	 * @throws EE_Error
659
+	 * @throws ReflectionException
660
+	 * @since   4.10.14.p
661
+	 */
662
+	private function eventWidgetContent(EE_Event $event, $event_url = '')
663
+	{
664
+		if (post_password_required($event->ID())) {
665
+			return apply_filters(
666
+				'FHEE_EEW_Upcoming_Events__widget__password_form',
667
+				get_the_password_form($event->ID()),
668
+				$event
669
+			);
670
+		}
671
+
672
+		$content = '';
673
+		if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') {
674
+			$content .= '
675 675
                 <div class="ee-upcoming-events-widget-img-dv">
676 676
                     <a class="ee-upcoming-events-widget-img" href="' . $event_url . '">
677 677
                         ' . get_the_post_thumbnail($event->ID(), $this->image_size) . '
678 678
                     </a>
679 679
                 </div>';
680
-        }
681
-
682
-        if ($this->show_dates) {
683
-            $content .= $this->eventDates($event);
684
-        }
685
-
686
-        if ($this->show_desc) {
687
-            $allowedtags = AllowedTags::getAllowedTags();
688
-            $desc    = $event->short_description(25);
689
-            $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : '';
690
-        }
691
-
692
-        return $content;
693
-    }
694
-
695
-
696
-    /**
697
-     * @param EE_Event $event
698
-     * @return string
699
-     * @throws EE_Error
700
-     * @throws ReflectionException
701
-     * @since   4.10.14.p
702
-     */
703
-    private function eventDates(EE_Event $event)
704
-    {
705
-        $date_format        = apply_filters(
706
-            'FHEE__espresso_event_date_range__date_format',
707
-            get_option('date_format')
708
-        );
709
-        $time_format        = apply_filters(
710
-            'FHEE__espresso_event_date_range__time_format',
711
-            get_option('time_format')
712
-        );
713
-        $single_date_format = apply_filters(
714
-            'FHEE__espresso_event_date_range__single_date_format',
715
-            get_option('date_format')
716
-        );
717
-        $single_time_format = apply_filters(
718
-            'FHEE__espresso_event_date_range__single_time_format',
719
-            get_option('time_format')
720
-        );
721
-        if ($this->date_range == true) {
722
-            return espresso_event_date_range(
723
-                $date_format,
724
-                $time_format,
725
-                $single_date_format,
726
-                $single_time_format,
727
-                $event->ID(),
728
-                false
729
-            );
730
-        }
731
-        return espresso_list_of_event_dates(
732
-            $event->ID(),
733
-            $date_format,
734
-            $time_format,
735
-            false,
736
-            null,
737
-            true,
738
-            true,
739
-            $this->date_limit
740
-        );
741
-    }
680
+		}
681
+
682
+		if ($this->show_dates) {
683
+			$content .= $this->eventDates($event);
684
+		}
685
+
686
+		if ($this->show_desc) {
687
+			$allowedtags = AllowedTags::getAllowedTags();
688
+			$desc    = $event->short_description(25);
689
+			$content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : '';
690
+		}
691
+
692
+		return $content;
693
+	}
694
+
695
+
696
+	/**
697
+	 * @param EE_Event $event
698
+	 * @return string
699
+	 * @throws EE_Error
700
+	 * @throws ReflectionException
701
+	 * @since   4.10.14.p
702
+	 */
703
+	private function eventDates(EE_Event $event)
704
+	{
705
+		$date_format        = apply_filters(
706
+			'FHEE__espresso_event_date_range__date_format',
707
+			get_option('date_format')
708
+		);
709
+		$time_format        = apply_filters(
710
+			'FHEE__espresso_event_date_range__time_format',
711
+			get_option('time_format')
712
+		);
713
+		$single_date_format = apply_filters(
714
+			'FHEE__espresso_event_date_range__single_date_format',
715
+			get_option('date_format')
716
+		);
717
+		$single_time_format = apply_filters(
718
+			'FHEE__espresso_event_date_range__single_time_format',
719
+			get_option('time_format')
720
+		);
721
+		if ($this->date_range == true) {
722
+			return espresso_event_date_range(
723
+				$date_format,
724
+				$time_format,
725
+				$single_date_format,
726
+				$single_time_format,
727
+				$event->ID(),
728
+				false
729
+			);
730
+		}
731
+		return espresso_list_of_event_dates(
732
+			$event->ID(),
733
+			$date_format,
734
+			$time_format,
735
+			false,
736
+			null,
737
+			true,
738
+			true,
739
+			$this->date_limit
740
+		);
741
+	}
742 742
 }
Please login to merge, or discard this patch.
admin/new/pricing/templates/pricing_details_main_meta_box.template.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -15,48 +15,48 @@  discard block
 block discarded – undo
15 15
         <tbody>
16 16
         <tr valign="top">
17 17
             <th><label for="PRT_ID"><?php
18
-                esc_html_e(
19
-                    'Type',
20
-                    'event_espresso'
21
-                ); ?></label> <?php echo wp_kses(EEH_Template::get_help_tab_link('type_field_info'), AllowedTags::getAllowedTags()); ?></th>
18
+				esc_html_e(
19
+					'Type',
20
+					'event_espresso'
21
+				); ?></label> <?php echo wp_kses(EEH_Template::get_help_tab_link('type_field_info'), AllowedTags::getAllowedTags()); ?></th>
22 22
             <td>
23 23
                 <?php if ($price->type_obj() && $price->type_obj()->base_type() === 1) : ?>
24 24
                     <input type="hidden" name="PRT_ID" id="PRT_ID" value="<?php echo esc_attr($price->type()); ?>"/>
25 25
                     <p><strong><?php esc_html_e('Price', 'event_espresso'); ?></strong></p>
26 26
                     <p class="description">
27 27
                         <?php
28
-                        esc_html_e(
29
-                            'This is the default base price. Every new ticket created will start off with this base price.',
30
-                            'event_espresso'
31
-                        );
32
-                        ?>
28
+						esc_html_e(
29
+							'This is the default base price. Every new ticket created will start off with this base price.',
30
+							'event_espresso'
31
+						);
32
+						?>
33 33
                     </p>
34 34
                 <?php else : ?>
35 35
                     <?php echo wp_kses(
36
-                        EEH_Form_Fields::select_input(
37
-                            'PRT_ID',
38
-                            $price_types,
39
-                            $price->type(),
40
-                            'id="PRT_ID"'
41
-                        ),
42
-                        AllowedTags::getWithFormTags()
43
-                    ); ?>
36
+						EEH_Form_Fields::select_input(
37
+							'PRT_ID',
38
+							$price_types,
39
+							$price->type(),
40
+							'id="PRT_ID"'
41
+						),
42
+						AllowedTags::getWithFormTags()
43
+					); ?>
44 44
                     <p class="description">
45 45
                         <?php
46
-                            esc_html_e(
47
-                                'Price Modifier. Default items will apply to ALL new events you create.',
48
-                                'event_espresso'
49
-                            );
50
-                        ?></p>
46
+							esc_html_e(
47
+								'Price Modifier. Default items will apply to ALL new events you create.',
48
+								'event_espresso'
49
+							);
50
+						?></p>
51 51
                 <?php endif; ?>
52 52
             </td>
53 53
         </tr>
54 54
         <tr valign="top">
55 55
             <th><label for="PRC_name"><?php
56
-                    esc_html_e(
57
-                        'Name',
58
-                        'event_espresso'
59
-                    ); ?></label> <?php echo wp_kses(EEH_Template::get_help_tab_link('name_field_info'), AllowedTags::getAllowedTags()); ?></th>
56
+					esc_html_e(
57
+						'Name',
58
+						'event_espresso'
59
+					); ?></label> <?php echo wp_kses(EEH_Template::get_help_tab_link('name_field_info'), AllowedTags::getAllowedTags()); ?></th>
60 60
             <td>
61 61
                 <input class="regular-text" type="text" id="PRC_name" name="PRC_name"
62 62
                        value="<?php $price->f('PRC_name'); ?>"/>
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
         </tr>
65 65
         <tr valign="top">
66 66
             <th><label for="PRC_desc"><?php
67
-                    esc_html_e(
68
-                        'Description',
69
-                        'event_espresso'
70
-                    ); ?></label> <?php echo wp_kses(EEH_Template::get_help_tab_link('description_field_info'), AllowedTags::getAllowedTags()); ?></th>
67
+					esc_html_e(
68
+						'Description',
69
+						'event_espresso'
70
+					); ?></label> <?php echo wp_kses(EEH_Template::get_help_tab_link('description_field_info'), AllowedTags::getAllowedTags()); ?></th>
71 71
             <td>
72 72
                     <textarea class="regular-text" id="PRC_desc" name="PRC_desc" rows="5"><?php
73
-                        echo esc_textarea($price->get_f('PRC_desc'));
74
-                    ?></textarea><br/>
73
+						echo esc_textarea($price->get_f('PRC_desc'));
74
+					?></textarea><br/>
75 75
             </td>
76 76
         </tr>
77 77
         <tr valign="top">
78 78
             <th><label for="PRC_amount"><?php
79
-                    esc_html_e(
80
-                        'Amount',
81
-                        'event_espresso'
82
-                    ); ?><?php echo wp_kses(EEH_Template::get_help_tab_link('amount_field_info'), AllowedTags::getAllowedTags()); ?></label></th>
79
+					esc_html_e(
80
+						'Amount',
81
+						'event_espresso'
82
+					); ?><?php echo wp_kses(EEH_Template::get_help_tab_link('amount_field_info'), AllowedTags::getAllowedTags()); ?></label></th>
83 83
             <td>
84 84
                 <input class="small-text ee-numeric" type="text" id="PRC_amount" name="PRC_amount"
85 85
                        value="<?php echo esc_attr($price->amount()); ?>"/>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@  discard block
 block discarded – undo
31 31
                         );
32 32
                         ?>
33 33
                     </p>
34
-                <?php else : ?>
34
+                <?php else {
35
+	: ?>
35 36
                     <?php echo wp_kses(
36 37
                         EEH_Form_Fields::select_input(
37 38
                             'PRT_ID',
@@ -40,7 +41,9 @@  discard block
 block discarded – undo
40 41
                             'id="PRT_ID"'
41 42
                         ),
42 43
                         AllowedTags::getWithFormTags()
43
-                    ); ?>
44
+                    );
45
+}
46
+?>
44 47
                     <p class="description">
45 48
                         <?php
46 49
                             esc_html_e(
Please login to merge, or discard this patch.
registration_form/templates/question_groups_main_meta_box.template.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 /* @var EE_Question[] $all_questions */
16 16
 assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));// list of unused questions
17 17
 foreach ($all_questions as $unused_question) {
18
-    assert($unused_question);
19
-    assert($unused_question instanceof EE_Question);
18
+	assert($unused_question);
19
+	assert($unused_question instanceof EE_Question);
20 20
 }
21 21
 /* @var array $values . Array of arrays, where each sub-array contains 2 keys: 'id' (internal value) and 'name' (label for displaying) */
22 22
 assert(is_array($values));
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
             <td>
101 101
                 <label for="QSG_show_group_name">
102 102
                     <?php echo wp_kses(
103
-                        EEH_Form_Fields::select_input(
104
-                            'QSG_show_group_name',
105
-                            $values,
106
-                            $question_group->show_group_name()
107
-                        ),
108
-                        AllowedTags::getWithFormTags()
109
-                    ); ?>
103
+						EEH_Form_Fields::select_input(
104
+							'QSG_show_group_name',
105
+							$values,
106
+							$question_group->show_group_name()
107
+						),
108
+						AllowedTags::getWithFormTags()
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>
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
             <td>
123 123
                 <label for="QSG_show_group_order">
124 124
                     <?php echo wp_kses(
125
-                        EEH_Form_Fields::select_input(
126
-                            'QSG_show_group_desc',
127
-                            $values,
128
-                            $question_group->show_group_desc()
129
-                        ),
130
-                        AllowedTags::getWithFormTags()
131
-                    ); ?>
125
+						EEH_Form_Fields::select_input(
126
+							'QSG_show_group_desc',
127
+							$values,
128
+							$question_group->show_group_desc()
129
+						),
130
+						AllowedTags::getWithFormTags()
131
+					); ?>
132 132
                     <p class="description"><?php
133
-                        esc_html_e(' Show Group Description on Registration Page?', 'event_espresso');
134
-                    ?></p>
133
+						esc_html_e(' Show Group Description on Registration Page?', 'event_espresso');
134
+					?></p>
135 135
                 </label>
136 136
                 <input type="hidden" name="QSG_system" value="<?php echo esc_attr($question_group->system_group()); ?>">
137 137
             </td>
@@ -147,85 +147,85 @@  discard block
 block discarded – undo
147 147
     <div class="form-table question-group-questions inside">
148 148
         <div class="padding">
149 149
             <p><span class="description"><?php
150
-                    esc_html_e(
151
-                        '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.',
152
-                        'event_espresso'
153
-                    ); ?></span></p>
150
+					esc_html_e(
151
+						'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.',
152
+						'event_espresso'
153
+					); ?></span></p>
154 154
             <div>
155 155
                 <ul class="question-list-sortable">
156 156
                     <?php
157
-                    $question_order = 0;
158
-                    $question_group_questions = $question_group->questions();
159
-                    foreach ($all_questions as $question_ID => $question) {
160
-                        if ($question instanceof EE_Question) {
161
-                            /*@var $question EE_Question*/
162
-                            $checked = isset($question_group_questions[ $question_ID ]) ? 'checked' : '';
163
-                            // disable questions from the personal information question group
164
-                            // is it required in the current question group? if so don't allow admins to remove it
165
-                            $disabled = in_array(
166
-                                $question->system_ID(),
167
-                                EEM_Question::instance()->required_system_questions_in_system_question_group(
168
-                                    $QSG_system
169
-                                )
170
-                            ) ? 'disabled' : '';
171
-                            // limit where system questions can appear
172
-                            if (
173
-                                $question->system_ID() &&
174
-                                ! in_array(
175
-                                    $question->system_ID(),
176
-                                    EEM_Question::instance()->allowed_system_questions_in_system_question_group(
177
-                                        $QSG_system
178
-                                    )
179
-                                )
180
-                            ) {
181
-                                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.
182
-                            }
183
-                            ?>
157
+					$question_order = 0;
158
+					$question_group_questions = $question_group->questions();
159
+					foreach ($all_questions as $question_ID => $question) {
160
+						if ($question instanceof EE_Question) {
161
+							/*@var $question EE_Question*/
162
+							$checked = isset($question_group_questions[ $question_ID ]) ? 'checked' : '';
163
+							// disable questions from the personal information question group
164
+							// is it required in the current question group? if so don't allow admins to remove it
165
+							$disabled = in_array(
166
+								$question->system_ID(),
167
+								EEM_Question::instance()->required_system_questions_in_system_question_group(
168
+									$QSG_system
169
+								)
170
+							) ? 'disabled' : '';
171
+							// limit where system questions can appear
172
+							if (
173
+								$question->system_ID() &&
174
+								! in_array(
175
+									$question->system_ID(),
176
+									EEM_Question::instance()->allowed_system_questions_in_system_question_group(
177
+										$QSG_system
178
+									)
179
+								)
180
+							) {
181
+								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.
182
+							}
183
+							?>
184 184
                             <li class="ee-question-sortable">
185 185
                                 <label for="question-<?php echo absint($question_ID); ?>">
186 186
                                     <input type="checkbox" name="questions[<?php echo absint($question_ID); ?>]"
187 187
                                            id="question-<?php echo absint($question_ID); ?>"
188 188
                                            value="<?php echo absint($question_ID); ?>" <?php echo esc_attr($disabled); ?> <?php echo esc_attr($checked); ?>>
189 189
                                     <span class="question-text"><?php
190
-                                        echo wp_kses(trim($question->display_text()), AllowedTags::getAllowedTags())
191
-                                             . (95 <= strlen(trim($question->display_text()))
192
-                                                ? "&hellip;"
193
-                                                : '');
194
-                                                                ?>
190
+										echo wp_kses(trim($question->display_text()), AllowedTags::getAllowedTags())
191
+											 . (95 <= strlen(trim($question->display_text()))
192
+												? "&hellip;"
193
+												: '');
194
+																?>
195 195
                                     </span>
196 196
                                     <input class="question-group-QGQ_order" type="hidden"
197 197
                                            name="question_orders[<?php echo absint($question_ID); ?>]"
198 198
                                            value="<?php echo esc_attr($question_order); ?>">
199 199
                                 </label>
200 200
                                 <?php
201
-                                if (
202
-                                    EE_Registry::instance()->CAP->current_user_can(
203
-                                        'ee_edit_question',
204
-                                        'espresso_registration_form_edit_question',
205
-                                        $question->ID()
206
-                                    )
207
-                                ) {
208
-                                    $edit_query_args = array(
209
-                                        'action' => 'edit_question',
210
-                                        'QST_ID' => $question->ID(),
211
-                                    );
212
-                                    $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
213
-
214
-                                    echo '<a href="' . $edit_link . '" target="_blank" aria-label="' .
215
-                                        sprintf(
216
-                                            esc_attr__('Edit %s', 'event_espresso'),
217
-                                            $question->admin_label()
218
-                                        )
219
-                                        . '"><span class="dashicons dashicons-edit"></span>
201
+								if (
202
+									EE_Registry::instance()->CAP->current_user_can(
203
+										'ee_edit_question',
204
+										'espresso_registration_form_edit_question',
205
+										$question->ID()
206
+									)
207
+								) {
208
+									$edit_query_args = array(
209
+										'action' => 'edit_question',
210
+										'QST_ID' => $question->ID(),
211
+									);
212
+									$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
213
+
214
+									echo '<a href="' . $edit_link . '" target="_blank" aria-label="' .
215
+										sprintf(
216
+											esc_attr__('Edit %s', 'event_espresso'),
217
+											$question->admin_label()
218
+										)
219
+										. '"><span class="dashicons dashicons-edit"></span>
220 220
                                         </a>';
221
-                                }
222
-                                ?>
221
+								}
222
+								?>
223 223
                             </li>
224 224
                             <?php
225
-                            $question_order++;
226
-                        }
227
-                    }
228
-                    ?>
225
+							$question_order++;
226
+						}
227
+					}
228
+					?>
229 229
                 </ul>
230 230
             </div>
231 231
         </div>
Please login to merge, or discard this patch.
admin/extend/general_settings/templates/debug_log_settings.template.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
         </th>
22 22
         <td>
23 23
             <?php echo wp_kses(
24
-                EEH_Form_Fields::select_input(
25
-                    'use_remote_logging',
26
-                    $values,
27
-                    $use_remote_logging
28
-                ),
29
-                AllowedTags::getWithFormTags()
30
-            ); ?>
24
+				EEH_Form_Fields::select_input(
25
+					'use_remote_logging',
26
+					$values,
27
+					$use_remote_logging
28
+				),
29
+				AllowedTags::getWithFormTags()
30
+			); ?>
31 31
             <p class="description">
32 32
                 <?php esc_html_e('Send debugging data to the remote URL below.', 'event_espresso'); ?>
33 33
             </p>
Please login to merge, or discard this patch.
event_single_caff/templates/admin-event-single-settings.template.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@  discard block
 block discarded – undo
4 4
 
5 5
 add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
6 6
 $values = EEH_Form_Fields::prep_answer_options(
7
-    array(
8
-        array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')),
9
-        array('id' => 0, 'text' => esc_html__('No', 'event_espresso')),
10
-    )
7
+	array(
8
+		array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')),
9
+		array('id' => 0, 'text' => esc_html__('No', 'event_espresso')),
10
+	)
11 11
 );
12 12
 ?>
13 13
 
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 
16 16
 <h2 class="ee-admin-settings-hdr">
17 17
     <?php esc_html_e(
18
-        'Single Event Pages',
19
-        'event_espresso'
20
-    ); ?><?php // echo wp_kses(EEH_Template::get_help_tab_link('event_single_settings_info'),AllowedTags::getAllowedTags()); ?>
18
+		'Single Event Pages',
19
+		'event_espresso'
20
+	); ?><?php // echo wp_kses(EEH_Template::get_help_tab_link('event_single_settings_info'),AllowedTags::getAllowedTags()); ?>
21 21
 </h2>
22 22
 <table class="form-table">
23 23
     <tbody>
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
         </th>
30 30
         <td>
31 31
             <?php echo wp_kses(
32
-                EEH_Form_Fields::select(
33
-                    'display_status_banner_single',
34
-                    $display_status_banner_single,
35
-                    $values,
36
-                    'display_status_banner_single',
37
-                    'display_status_banner_single'
38
-                ),
39
-                AllowedTags::getWithFormTags()
40
-            ); ?>
32
+				EEH_Form_Fields::select(
33
+					'display_status_banner_single',
34
+					$display_status_banner_single,
35
+					$values,
36
+					'display_status_banner_single',
37
+					'display_status_banner_single'
38
+				),
39
+				AllowedTags::getWithFormTags()
40
+			); ?>
41 41
             <p class="description"><?php
42
-                esc_html_e(
43
-                    'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.',
44
-                    'event_espresso'
45
-                ); ?></p>
42
+				esc_html_e(
43
+					'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.',
44
+					'event_espresso'
45
+				); ?></p>
46 46
         </td>
47 47
     </tr>
48 48
 
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
         </th>
56 56
         <td>
57 57
             <?php echo wp_kses(
58
-                EEH_Form_Fields::select(
59
-                    'display_venue',
60
-                    $display_venue,
61
-                    $values,
62
-                    'display_venue',
63
-                    'display_venue'
64
-                ),
65
-                AllowedTags::getWithFormTags()
66
-            ); ?>
58
+				EEH_Form_Fields::select(
59
+					'display_venue',
60
+					$display_venue,
61
+					$values,
62
+					'display_venue',
63
+					'display_venue'
64
+				),
65
+				AllowedTags::getWithFormTags()
66
+			); ?>
67 67
             <p class="description"><?php
68
-                esc_html_e(
69
-                    'Do not use this if you are using the venue shortcodes in your event description.',
70
-                    'event_espresso'
71
-                ); ?></p>
68
+				esc_html_e(
69
+					'Do not use this if you are using the venue shortcodes in your event description.',
70
+					'event_espresso'
71
+				); ?></p>
72 72
         </td>
73 73
     </tr>
74 74
 
@@ -80,17 +80,17 @@  discard block
 block discarded – undo
80 80
         </th>
81 81
         <td>
82 82
             <?php
83
-            echo wp_kses(
84
-                EEH_Form_Fields::select(
85
-                    'use_sortable_display_order',
86
-                    $use_sortable_display_order,
87
-                    $values,
88
-                    'EED_Events_Single_use_sortable_display_order',
89
-                    'EED_Events_Single_use_sortable_display_order'
90
-                ),
91
-                AllowedTags::getWithFormTags()
92
-            );
93
-            ?>
83
+			echo wp_kses(
84
+				EEH_Form_Fields::select(
85
+					'use_sortable_display_order',
86
+					$use_sortable_display_order,
87
+					$values,
88
+					'EED_Events_Single_use_sortable_display_order',
89
+					'EED_Events_Single_use_sortable_display_order'
90
+				),
91
+				AllowedTags::getWithFormTags()
92
+			);
93
+			?>
94 94
         </td>
95 95
     </tr>
96 96
 
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
         <td>
103 103
 
104 104
             <?php wp_nonce_field(
105
-                'espresso_update_event_single_order',
106
-                'espresso_update_event_single_order_nonce',
107
-                false
108
-            ); ?>
105
+				'espresso_update_event_single_order',
106
+				'espresso_update_event_single_order_nonce',
107
+				false
108
+			); ?>
109 109
             <?php echo wp_kses($event_single_display_order, AllowedTags::getWithFormTags()); ?>
110 110
 
111 111
             <p class="description"><?php
112
-                esc_html_e(
113
-                    'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the single event page.',
114
-                    'event_espresso'
115
-                ); ?></p>
112
+				esc_html_e(
113
+					'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the single event page.',
114
+					'event_espresso'
115
+				); ?></p>
116 116
 
117 117
         </td>
118 118
     </tr>
Please login to merge, or discard this patch.
events_archive_caff/templates/admin-event-list-settings.template.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -5,18 +5,18 @@  discard block
 block discarded – undo
5 5
 add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
6 6
 
7 7
 $values = EEH_Form_Fields::prep_answer_options(
8
-    array(
9
-        array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')),
10
-        array('id' => 0, 'text' => esc_html__('No', 'event_espresso')),
11
-    )
8
+	array(
9
+		array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')),
10
+		array('id' => 0, 'text' => esc_html__('No', 'event_espresso')),
11
+	)
12 12
 );
13 13
 
14 14
 $description = EEH_Form_Fields::prep_answer_options(
15
-    array(
16
-        array('id' => 0, 'text' => esc_html__('none', 'event_espresso')),
17
-        array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')),
18
-        array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')),
19
-    )
15
+	array(
16
+		array('id' => 0, 'text' => esc_html__('none', 'event_espresso')),
17
+		array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')),
18
+		array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')),
19
+	)
20 20
 );
21 21
 
22 22
 ?>
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         <td>
42 42
             <a id="event_listings_url" class="ee-admin-settings-hdr-lnk small-text"
43 43
                href="<?php echo EEH_Event_View::event_archive_url(); ?>"><?php
44
-                echo EEH_Event_View::event_archive_url(); ?></a>
44
+				echo EEH_Event_View::event_archive_url(); ?></a>
45 45
         </td>
46 46
     </tr>
47 47
 
@@ -53,30 +53,30 @@  discard block
 block discarded – undo
53 53
         </th>
54 54
         <td>
55 55
             <p><?php echo site_url() . '/ '
56
-                          . EEH_Form_Fields::text(
57
-                              'not_used',
58
-                              EE_Registry::instance()->CFG->core->event_cpt_slug,
59
-                              'event_cpt_slug',
60
-                              'event_cpt_slug',
61
-                              'regular'
62
-                          ); ?></p>
56
+						  . EEH_Form_Fields::text(
57
+							  'not_used',
58
+							  EE_Registry::instance()->CFG->core->event_cpt_slug,
59
+							  'event_cpt_slug',
60
+							  'event_cpt_slug',
61
+							  'regular'
62
+						  ); ?></p>
63 63
             <p class="description"><?php
64
-                esc_html_e(
65
-                    'This allows you to configure what slug is used for the url of all event pages.',
66
-                    'event_espresso'
67
-                ); ?></p>
64
+				esc_html_e(
65
+					'This allows you to configure what slug is used for the url of all event pages.',
66
+					'event_espresso'
67
+				); ?></p>
68 68
             <?php if (has_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite')) : ?>
69 69
                 <p class="important-notice">
70 70
                     <?php
71
-                    sprintf(
72
-                        esc_html__(
73
-                            'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected.  Please be aware that while this filter is being used, this setting has no affect.',
74
-                            'event_espresso'
75
-                        ),
76
-                        '<code>',
77
-                        '</code>'
78
-                    );
79
-                    ?>
71
+					sprintf(
72
+						esc_html__(
73
+							'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected.  Please be aware that while this filter is being used, this setting has no affect.',
74
+							'event_espresso'
75
+						),
76
+						'<code>',
77
+						'</code>'
78
+					);
79
+					?>
80 80
                 </p>
81 81
             <?php endif; ?>
82 82
         </td>
@@ -90,20 +90,20 @@  discard block
 block discarded – undo
90 90
         </th>
91 91
         <td>
92 92
             <?php echo wp_kses(
93
-                EEH_Form_Fields::select(
94
-                    'display_status_banner',
95
-                    $display_status_banner,
96
-                    $values,
97
-                    'EED_Events_Archive_display_status_banner',
98
-                    'EED_Events_Archive_display_status_banner'
99
-                ),
100
-                AllowedTags::getWithFormTags()
101
-            ); ?>
93
+				EEH_Form_Fields::select(
94
+					'display_status_banner',
95
+					$display_status_banner,
96
+					$values,
97
+					'EED_Events_Archive_display_status_banner',
98
+					'EED_Events_Archive_display_status_banner'
99
+				),
100
+				AllowedTags::getWithFormTags()
101
+			); ?>
102 102
             <p class="description"><?php
103
-                esc_html_e(
104
-                    'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.',
105
-                    'event_espresso'
106
-                ); ?></p>
103
+				esc_html_e(
104
+					'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.',
105
+					'event_espresso'
106
+				); ?></p>
107 107
         </td>
108 108
     </tr>
109 109
 
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
         </th>
117 117
         <td>
118 118
             <?php echo wp_kses(
119
-                EEH_Form_Fields::select(
120
-                    'description',
121
-                    $display_description,
122
-                    $description,
123
-                    'EED_Events_Archive_display_description',
124
-                    'EED_Events_Archive_display_description'
125
-                ),
126
-                AllowedTags::getWithFormTags()
127
-            ); ?>
119
+				EEH_Form_Fields::select(
120
+					'description',
121
+					$display_description,
122
+					$description,
123
+					'EED_Events_Archive_display_description',
124
+					'EED_Events_Archive_display_description'
125
+				),
126
+				AllowedTags::getWithFormTags()
127
+			); ?>
128 128
         </td>
129 129
     </tr>
130 130
 
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
         </th>
138 138
         <td>
139 139
             <?php echo wp_kses(
140
-                EEH_Form_Fields::select(
141
-                    'ticket_selector',
142
-                    $display_ticket_selector,
143
-                    $values,
144
-                    'EED_Events_Archive_display_ticket_selector',
145
-                    'EED_Events_Archive_display_ticket_selector'
146
-                ),
147
-                AllowedTags::getWithFormTags()
148
-            ); ?>
140
+				EEH_Form_Fields::select(
141
+					'ticket_selector',
142
+					$display_ticket_selector,
143
+					$values,
144
+					'EED_Events_Archive_display_ticket_selector',
145
+					'EED_Events_Archive_display_ticket_selector'
146
+				),
147
+				AllowedTags::getWithFormTags()
148
+			); ?>
149 149
         </td>
150 150
     </tr>
151 151
 
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
         </th>
159 159
         <td>
160 160
             <?php echo wp_kses(
161
-                EEH_Form_Fields::select(
162
-                    'venue_details',
163
-                    $display_datetimes,
164
-                    $values,
165
-                    'EED_Events_Archive_display_datetimes',
166
-                    'EED_Events_Archive_display_datetimes'
167
-                ),
168
-                AllowedTags::getWithFormTags()
169
-            ); ?>
161
+				EEH_Form_Fields::select(
162
+					'venue_details',
163
+					$display_datetimes,
164
+					$values,
165
+					'EED_Events_Archive_display_datetimes',
166
+					'EED_Events_Archive_display_datetimes'
167
+				),
168
+				AllowedTags::getWithFormTags()
169
+			); ?>
170 170
         </td>
171 171
     </tr>
172 172
 
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
         </th>
180 180
         <td>
181 181
             <?php echo wp_kses(
182
-                EEH_Form_Fields::select(
183
-                    'display_venue',
184
-                    $display_venue,
185
-                    $values,
186
-                    'EED_Events_Archive_display_venue',
187
-                    'EED_Events_Archive_display_venue'
188
-                ),
189
-                AllowedTags::getWithFormTags()
190
-            ); ?>
182
+				EEH_Form_Fields::select(
183
+					'display_venue',
184
+					$display_venue,
185
+					$values,
186
+					'EED_Events_Archive_display_venue',
187
+					'EED_Events_Archive_display_venue'
188
+				),
189
+				AllowedTags::getWithFormTags()
190
+			); ?>
191 191
         </td>
192 192
     </tr>
193 193
 
@@ -200,15 +200,15 @@  discard block
 block discarded – undo
200 200
         </th>
201 201
         <td>
202 202
             <?php echo wp_kses(
203
-                EEH_Form_Fields::select(
204
-                    'expired_events',
205
-                    $display_expired_events,
206
-                    $values,
207
-                    'EED_Events_Archive_display_expired_events',
208
-                    'EED_Events_Archive_display_expired_events'
209
-                ),
210
-                AllowedTags::getWithFormTags()
211
-            ); ?>
203
+				EEH_Form_Fields::select(
204
+					'expired_events',
205
+					$display_expired_events,
206
+					$values,
207
+					'EED_Events_Archive_display_expired_events',
208
+					'EED_Events_Archive_display_expired_events'
209
+				),
210
+				AllowedTags::getWithFormTags()
211
+			); ?>
212 212
         </td>
213 213
     </tr>
214 214
 
@@ -216,46 +216,46 @@  discard block
 block discarded – undo
216 216
         <th>
217 217
             <label for="EED_Events_Archive_use_sortable_display_order">
218 218
                 <?php esc_html_e(
219
-                    'Use Custom Display Order?',
220
-                    'event_espresso'
221
-                ); ?><?php // echo wp_kses(EEH_Template::get_help_tab_link('use_sortable_display_order_info'),AllowedTags::getAllowedTags()); ?>
219
+					'Use Custom Display Order?',
220
+					'event_espresso'
221
+				); ?><?php // echo wp_kses(EEH_Template::get_help_tab_link('use_sortable_display_order_info'),AllowedTags::getAllowedTags()); ?>
222 222
             </label>
223 223
         </th>
224 224
         <td>
225 225
             <?php echo wp_kses(
226
-                EEH_Form_Fields::select(
227
-                    'use_sortable_display_order',
228
-                    $use_sortable_display_order,
229
-                    $values,
230
-                    'EED_Events_Archive_use_sortable_display_order',
231
-                    'EED_Events_Archive_use_sortable_display_order'
232
-                ),
233
-                AllowedTags::getWithFormTags()
234
-            ); ?>
226
+				EEH_Form_Fields::select(
227
+					'use_sortable_display_order',
228
+					$use_sortable_display_order,
229
+					$values,
230
+					'EED_Events_Archive_use_sortable_display_order',
231
+					'EED_Events_Archive_use_sortable_display_order'
232
+				),
233
+				AllowedTags::getWithFormTags()
234
+			); ?>
235 235
         </td>
236 236
     </tr>
237 237
 
238 238
     <tr>
239 239
         <th>
240 240
             <?php esc_html_e(
241
-                'Display Order',
242
-                'event_espresso'
243
-            ); ?><?php // echo wp_kses(EEH_Template::get_help_tab_link('event_archive_order_info'),AllowedTags::getAllowedTags()); ?>
241
+				'Display Order',
242
+				'event_espresso'
243
+			); ?><?php // echo wp_kses(EEH_Template::get_help_tab_link('event_archive_order_info'),AllowedTags::getAllowedTags()); ?>
244 244
         </th>
245 245
         <td>
246 246
 
247 247
             <?php wp_nonce_field(
248
-                'espresso_update_event_archive_order',
249
-                'espresso_update_event_archive_order_nonce',
250
-                false
251
-            ); ?>
248
+				'espresso_update_event_archive_order',
249
+				'espresso_update_event_archive_order_nonce',
250
+				false
251
+			); ?>
252 252
             <?php echo wp_kses($event_archive_display_order, AllowedTags::getWithFormTags()); ?>
253 253
 
254 254
             <p class="description"><?php
255
-                esc_html_e(
256
-                    'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.',
257
-                    'event_espresso'
258
-                ); ?></p>
255
+				esc_html_e(
256
+					'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.',
257
+					'event_espresso'
258
+				); ?></p>
259 259
 
260 260
         </td>
261 261
     </tr>
@@ -268,15 +268,15 @@  discard block
 block discarded – undo
268 268
         </th>
269 269
         <td>
270 270
             <?php echo wp_kses(
271
-                EEH_Form_Fields::select(
272
-                    'reset_event_list_settings',
273
-                    0,
274
-                    $values,
275
-                    'EED_Events_Archive_reset_event_list_settings',
276
-                    'EED_Events_Archive_reset_event_list_settings'
277
-                ),
278
-                AllowedTags::getWithFormTags()
279
-            ); ?>
271
+				EEH_Form_Fields::select(
272
+					'reset_event_list_settings',
273
+					0,
274
+					$values,
275
+					'EED_Events_Archive_reset_event_list_settings',
276
+					'EED_Events_Archive_reset_event_list_settings'
277
+				),
278
+				AllowedTags::getWithFormTags()
279
+			); ?>
280 280
         </td>
281 281
     </tr>
282 282
 
Please login to merge, or discard this patch.
registration_form/templates/questions_main_meta_box.template.php 2 patches
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -17,25 +17,25 @@  discard block
 block discarded – undo
17 17
 
18 18
 // the following are already escaped
19 19
 echo wp_kses(
20
-    EEH_Form_Fields::hidden_input(
21
-        'QST_system',
22
-        $question->system_ID()
23
-    ),
24
-    AllowedTags::getWithFormTags()
20
+	EEH_Form_Fields::hidden_input(
21
+		'QST_system',
22
+		$question->system_ID()
23
+	),
24
+	AllowedTags::getWithFormTags()
25 25
 );
26 26
 echo wp_kses(
27
-    EEH_Form_Fields::hidden_input(
28
-        'QST_wp_user',
29
-        $question->wp_user()
30
-    ),
31
-    AllowedTags::getWithFormTags()
27
+	EEH_Form_Fields::hidden_input(
28
+		'QST_wp_user',
29
+		$question->wp_user()
30
+	),
31
+	AllowedTags::getWithFormTags()
32 32
 );
33 33
 echo wp_kses(
34
-    EEH_Form_Fields::hidden_input(
35
-        'QST_deleted',
36
-        $question->deleted()
37
-    ),
38
-    AllowedTags::getWithFormTags()
34
+	EEH_Form_Fields::hidden_input(
35
+		'QST_deleted',
36
+		$question->deleted()
37
+	),
38
+	AllowedTags::getWithFormTags()
39 39
 );
40 40
 
41 41
 $QST_system = $question->system_ID();
@@ -47,21 +47,21 @@  discard block
 block discarded – undo
47 47
 $has_answers = $question->has_answers();
48 48
 
49 49
 if ($QST_system === 'country') {
50
-    // already escaped
51
-    echo EEH_HTML::div(
52
-        EEH_HTML::h4(
53
-            '<span class="dashicons dashicons-info"></span>'
54
-            . esc_html__('Did you know...', 'event_espresso')
55
-        ) .
56
-        EEH_HTML::p(
57
-            esc_html__(
58
-                'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.',
59
-                'event_espresso'
60
-            )
61
-        ),
62
-        '',
63
-        'ee-info-box'
64
-    );
50
+	// already escaped
51
+	echo EEH_HTML::div(
52
+		EEH_HTML::h4(
53
+			'<span class="dashicons dashicons-info"></span>'
54
+			. esc_html__('Did you know...', 'event_espresso')
55
+		) .
56
+		EEH_HTML::p(
57
+			esc_html__(
58
+				'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.',
59
+				'event_espresso'
60
+			)
61
+		),
62
+		'',
63
+		'ee-info-box'
64
+	);
65 65
 }
66 66
 ?>
67 67
 
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
                     </th>
98 98
                     <td>
99 99
                         <?php
100
-                        $id            = ! empty($QST_system) ? '_disabled' : '';
101
-                        $disabled_attr = ! empty($QST_system) ? 'disabled' : '';
102
-                        ?>
100
+						$id            = ! empty($QST_system) ? '_disabled' : '';
101
+						$disabled_attr = ! empty($QST_system) ? 'disabled' : '';
102
+						?>
103 103
                         <input class='regular-text'
104 104
                                id="QST_admin_label<?php echo esc_attr($id); ?>"
105 105
                                name="QST_admin_label<?php echo esc_attr($id); ?>"
@@ -141,30 +141,30 @@  discard block
 block discarded – undo
141 141
                     </th>
142 142
                     <td>
143 143
                         <?php
144
-                        $id            = ! empty($QST_system) ? '_disabled' : '';
145
-                        $disabled_attr = ! empty($QST_system) ? 'disabled' : '';
146
-                        $admin_only    = $question->get('QST_admin_only');
147
-                        $checked       = ! empty($admin_only) ? ' checked' : '';
148
-                        ?>
144
+						$id            = ! empty($QST_system) ? '_disabled' : '';
145
+						$disabled_attr = ! empty($QST_system) ? 'disabled' : '';
146
+						$admin_only    = $question->get('QST_admin_only');
147
+						$checked       = ! empty($admin_only) ? ' checked' : '';
148
+						?>
149 149
                         <input class="QST_admin_only"
150 150
                                id="QST_admin_only<?php echo esc_attr($id); ?>"
151 151
                                name="QST_admin_only<?php echo esc_attr($id); ?>"
152 152
                                type="checkbox"
153 153
                                value="1"
154 154
                             <?php
155
-                            echo esc_attr($disabled_attr);
156
-                            echo esc_attr($checked);
157
-                            ?>
155
+							echo esc_attr($disabled_attr);
156
+							echo esc_attr($checked);
157
+							?>
158 158
                         />
159 159
                         <br />
160 160
                         <p class="description">
161 161
                             <?php
162
-                            if (! empty($QST_system)) { ?>
162
+							if (! empty($QST_system)) { ?>
163 163
                                 <span class="description" style="color:#D54E21;">
164 164
                                     <?php esc_html_e(
165
-                                        'System question! This field cannot be changed.',
166
-                                        'event_espresso'
167
-                                    ); ?>
165
+										'System question! This field cannot be changed.',
166
+										'event_espresso'
167
+									); ?>
168 168
                                 </span>
169 169
                             <?php } ?>
170 170
                         </p>
@@ -180,47 +180,47 @@  discard block
 block discarded – undo
180 180
                     </th>
181 181
                     <td>
182 182
                         <?php
183
-                        $disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone;
184
-                        if ($disabled) {
185
-                            $disabled_attr = 'disabled="disabled"';
186
-                            $id            = '_disabled';
187
-                        } else {
188
-                            $disabled_attr = '';
189
-                            $id            = '';
190
-                        }
183
+						$disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone;
184
+						if ($disabled) {
185
+							$disabled_attr = 'disabled="disabled"';
186
+							$id            = '_disabled';
187
+						} else {
188
+							$disabled_attr = '';
189
+							$id            = '';
190
+						}
191 191
 
192
-                        // Only display Confirm email for
193
-                        if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) {
194
-                            unset($question_types[ EEM_Question::QST_type_email_confirm ]);
195
-                        }
192
+						// Only display Confirm email for
193
+						if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) {
194
+							unset($question_types[ EEM_Question::QST_type_email_confirm ]);
195
+						}
196 196
 
197
-                        echo wp_kses(
198
-                            EEH_Form_Fields::select_input(
199
-                                'QST_type' . $id,
200
-                                $question_types,
201
-                                $question->type(),
202
-                                'id="QST_type' . $id . '"' . $disabled_attr
203
-                            ),
204
-                            AllowedTags::getWithFormTags()
205
-                        );
206
-                        if ($disabled) { ?>
197
+						echo wp_kses(
198
+							EEH_Form_Fields::select_input(
199
+								'QST_type' . $id,
200
+								$question_types,
201
+								$question->type(),
202
+								'id="QST_type' . $id . '"' . $disabled_attr
203
+							),
204
+							AllowedTags::getWithFormTags()
205
+						);
206
+						if ($disabled) { ?>
207 207
                             <input id='QST_type'
208 208
                                    name="QST_type"
209 209
                                    type="hidden"
210 210
                                    value="<?php echo esc_attr($question->type()); ?>"
211 211
                             />
212 212
                             <?php
213
-                            $explanatory_text = esc_html__(
214
-                                'System question! This field cannot be changed.',
215
-                                'event_espresso'
216
-                            );
217
-                        } else {
218
-                            $explanatory_text = esc_html__(
219
-                                'Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.',
220
-                                'event_espresso'
221
-                            );
222
-                        }
223
-                        if ($disabled || $has_answers) { ?>
213
+							$explanatory_text = esc_html__(
214
+								'System question! This field cannot be changed.',
215
+								'event_espresso'
216
+							);
217
+						} else {
218
+							$explanatory_text = esc_html__(
219
+								'Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.',
220
+								'event_espresso'
221
+							);
222
+						}
223
+						if ($disabled || $has_answers) { ?>
224 224
                             <p>
225 225
                                 <span class="description" style="color:#D54E21;">
226 226
                                     <?php echo esc_html($explanatory_text); ?>
@@ -249,21 +249,21 @@  discard block
 block discarded – undo
249 249
                         <p>
250 250
                             <span class="description">
251 251
                                 <?php esc_html_e(
252
-                                    'Maximum number of characters allowed when answering this question',
253
-                                    'event_espresso'
254
-                                ); ?>
252
+									'Maximum number of characters allowed when answering this question',
253
+									'event_espresso'
254
+								); ?>
255 255
                             </span>
256 256
                         </p>
257 257
                         <?php if ($QST_system) { ?>
258 258
                         <p>
259 259
                             <span class="description" style="color:#D54E21;">
260 260
                                 <?php printf(
261
-                                    esc_html__(
262
-                                        'System question! The maximum number of characters that can be used for this question is %1$s',
263
-                                        'event_espresso'
264
-                                    ),
265
-                                    $max_max
266
-                                ); ?>
261
+									esc_html__(
262
+										'System question! The maximum number of characters that can be used for this question is %1$s',
263
+										'event_espresso'
264
+									),
265
+									$max_max
266
+								); ?>
267 267
                             </span>
268 268
                         </p>
269 269
                         <?php } ?>
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
                                     </th>
286 286
                                     <th class="option-desc-header">
287 287
                                         <?php esc_html_e(
288
-                                            'Description (optional, only shown on registration form)',
289
-                                            'event_espresso'
290
-                                        ) ?>
288
+											'Description (optional, only shown on registration form)',
289
+											'event_espresso'
290
+										) ?>
291 291
                                     </th>
292 292
                                     <th>
293 293
                                     </th>
@@ -322,14 +322,14 @@  discard block
 block discarded – undo
322 322
                                 </tr>
323 323
 
324 324
                                 <?php
325
-                                $count            = 0;
326
-                                $question_options = $question->options();
327
-                                if (! empty($question_options)) {
328
-                                    foreach ($question_options as $option_id => $option) {
329
-                                        $disabled_attr = $has_answers || $option->get('QSO_system')
330
-                                            ? 'disabled'
331
-                                            : '';
332
-                                        ?>
325
+								$count            = 0;
326
+								$question_options = $question->options();
327
+								if (! empty($question_options)) {
328
+									foreach ($question_options as $option_id => $option) {
329
+										$disabled_attr = $has_answers || $option->get('QSO_system')
330
+											? 'disabled'
331
+											: '';
332
+										?>
333 333
                                         <tr class="question-option ee-options-sortable">
334 334
                                             <td class="option-value-cell">
335 335
                                                 <input type="hidden"
@@ -366,27 +366,27 @@  discard block
 block discarded – undo
366 366
                                     </span>
367 367
                                             </td>
368 368
                                             <?php
369
-                                            echo wp_kses(
370
-                                                EEH_Form_Fields::hidden_input(
371
-                                                    "question_options[{$count}][QST_ID])",
372
-                                                    $option->question_ID()
373
-                                                ),
374
-                                                AllowedTags::getWithFormTags()
375
-                                            );
376
-                                            echo wp_kses(
377
-                                                EEH_Form_Fields::hidden_input(
378
-                                                    "question_options[{$count}][QSO_ID])",
379
-                                                    $option->ID()
380
-                                                ),
381
-                                                AllowedTags::getWithFormTags()
382
-                                            );
383
-                                            $count++;
384
-                                            ?>
369
+											echo wp_kses(
370
+												EEH_Form_Fields::hidden_input(
371
+													"question_options[{$count}][QST_ID])",
372
+													$option->question_ID()
373
+												),
374
+												AllowedTags::getWithFormTags()
375
+											);
376
+											echo wp_kses(
377
+												EEH_Form_Fields::hidden_input(
378
+													"question_options[{$count}][QSO_ID])",
379
+													$option->ID()
380
+												),
381
+												AllowedTags::getWithFormTags()
382
+											);
383
+											$count++;
384
+											?>
385 385
                                         </tr>
386 386
                                         <?php
387
-                                    }
388
-                                } else {
389
-                                    ?>
387
+									}
388
+								} else {
389
+									?>
390 390
                                     <tr class="question-option ee-options-sortable">
391 391
                                         <td class="option-value-cell">
392 392
                                             <input type="hidden"
@@ -407,26 +407,26 @@  discard block
 block discarded – undo
407 407
                                         </td>
408 408
                                         <td>
409 409
                                             <?php echo wp_kses(
410
-                                                EEH_Form_Fields::hidden_input(
411
-                                                    "question_options_count",
412
-                                                    $count
413
-                                                ),
414
-                                                AllowedTags::getWithFormTags()
415
-                                            ); ?>
410
+												EEH_Form_Fields::hidden_input(
411
+													"question_options_count",
412
+													$count
413
+												),
414
+												AllowedTags::getWithFormTags()
415
+											); ?>
416 416
                                         </td>
417 417
                                     </tr>
418 418
                                     <?php
419
-                                }
420
-                                ?>
419
+								}
420
+								?>
421 421
                                 <tr style="display:none">
422 422
                                     <td colspan="3">
423 423
                                         <?php echo wp_kses(
424
-                                            EEH_Form_Fields::hidden_input(
425
-                                                "question_options_count",
426
-                                                $count
427
-                                            ),
428
-                                            AllowedTags::getWithFormTags()
429
-                                        ); ?>
424
+											EEH_Form_Fields::hidden_input(
425
+												"question_options_count",
426
+												$count
427
+											),
428
+											AllowedTags::getWithFormTags()
429
+										); ?>
430 430
                                     </td>
431 431
                                 </tr>
432 432
                                 <tr>
@@ -442,16 +442,16 @@  discard block
 block discarded – undo
442 442
 
443 443
                         <p class="description">
444 444
                             <?php esc_html_e(
445
-                                'Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.',
446
-                                'event_espresso'
447
-                            ) ?>
445
+								'Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.',
446
+								'event_espresso'
447
+							) ?>
448 448
                         </p>
449 449
                         <?php if ($has_answers) : ?>
450 450
                             <p class="description" style="color:#D54E21;">
451 451
                                 <?php esc_html_e(
452
-                                    'Answer values that are uneditable are this way because there are registrations in the database that have answers for this question.  If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes.  This will ensure that the existing registrations that chose the original answer will preserve that answer.',
453
-                                    'event_espresso'
454
-                                ); ?>
452
+									'Answer values that are uneditable are this way because there are registrations in the database that have answers for this question.  If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes.  This will ensure that the existing registrations that chose the original answer will preserve that answer.',
453
+									'event_espresso'
454
+								); ?>
455 455
                             </p>
456 456
 
457 457
                         <?php endif; ?>
@@ -467,43 +467,43 @@  discard block
 block discarded – undo
467 467
                     </th>
468 468
                     <td>
469 469
                         <?php
470
-                        $system_required   = ['fname', 'email'];
471
-                        $disabled_attr     = in_array($QST_system, $system_required) ? ' disabled="disabled"' : '';
472
-                        $required_on       = $question->get('QST_admin_only');
473
-                        $show_required_msg = $required_on ? '' : ' display:none;';
474
-                        $disabled_attr     = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : '';
475
-                        $id                =
476
-                            ! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : '';
477
-                        $requiredOptions   = [
478
-                            ['text' => esc_html__('Optional', 'event_espresso'), 'id' => 0],
479
-                            ['text' => esc_html__('Required', 'event_espresso'), 'id' => 1],
480
-                        ];
481
-                        echo wp_kses(
482
-                            EEH_Form_Fields::select_input(
483
-                                'QST_required' . $id,
484
-                                $requiredOptions,
485
-                                $question->required(),
486
-                                'id="QST_required' . $id . '"' . $disabled_attr
487
-                            ),
488
-                            AllowedTags::getWithFormTags()
489
-                        );
490
-                        ?>
470
+						$system_required   = ['fname', 'email'];
471
+						$disabled_attr     = in_array($QST_system, $system_required) ? ' disabled="disabled"' : '';
472
+						$required_on       = $question->get('QST_admin_only');
473
+						$show_required_msg = $required_on ? '' : ' display:none;';
474
+						$disabled_attr     = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : '';
475
+						$id                =
476
+							! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : '';
477
+						$requiredOptions   = [
478
+							['text' => esc_html__('Optional', 'event_espresso'), 'id' => 0],
479
+							['text' => esc_html__('Required', 'event_espresso'), 'id' => 1],
480
+						];
481
+						echo wp_kses(
482
+							EEH_Form_Fields::select_input(
483
+								'QST_required' . $id,
484
+								$requiredOptions,
485
+								$question->required(),
486
+								'id="QST_required' . $id . '"' . $disabled_attr
487
+							),
488
+							AllowedTags::getWithFormTags()
489
+						);
490
+						?>
491 491
                         <p>
492 492
                             <span id="required_toggled_on" class="description"
493 493
                                   style="color:#D54E21;<?php echo esc_attr($show_required_msg); ?>"
494 494
                             >
495 495
                                 <?php esc_html_e(
496
-                                    'Required is set to optional, and this field is disabled, because the question is Admin-Only.',
497
-                                    'event_espresso'
498
-                                ) ?>
496
+									'Required is set to optional, and this field is disabled, because the question is Admin-Only.',
497
+									'event_espresso'
498
+								) ?>
499 499
                             </span
500 500
                         </p>
501 501
                         <p>
502 502
                             <span id="required_toggled_off" class="description" style="color:#D54E21; display: none;">
503 503
                                 <?php esc_html_e(
504
-                                    'Required option field is no longer disabled because the question is not Admin-Only',
505
-                                    'event_espresso'
506
-                                ) ?>
504
+									'Required option field is no longer disabled because the question is not Admin-Only',
505
+									'event_espresso'
506
+								) ?>
507 507
                             </span>
508 508
                         </p>
509 509
                         <?php if (! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?>
@@ -536,8 +536,8 @@  discard block
 block discarded – undo
536 536
                     </td>
537 537
                 </tr>
538 538
                 <?php
539
-                do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question);
540
-                ?>
539
+				do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question);
540
+				?>
541 541
             </tbody>
542 542
         </table>
543 543
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         EEH_HTML::h4(
53 53
             '<span class="dashicons dashicons-info"></span>'
54 54
             . esc_html__('Did you know...', 'event_espresso')
55
-        ) .
55
+        ).
56 56
         EEH_HTML::p(
57 57
             esc_html__(
58 58
                 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.',
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                                type="hidden"
114 114
                                value="<?php echo esc_attr($question->get('QST_order')); ?>"
115 115
                         />
116
-                        <?php if (! empty($QST_system)) { ?>
116
+                        <?php if ( ! empty($QST_system)) { ?>
117 117
                             <input id='QST_admin_label'
118 118
                                    name="QST_admin_label"
119 119
                                    type="hidden"
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                         <?php } ?>
123 123
                         <br />
124 124
                         <p class="description">
125
-                            <?php if (! empty($QST_system)) { ?>
125
+                            <?php if ( ! empty($QST_system)) { ?>
126 126
                                 <span class="description" style="color:#D54E21;">
127 127
                                 <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso') ?>
128 128
                         </span>
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                         <br />
160 160
                         <p class="description">
161 161
                             <?php
162
-                            if (! empty($QST_system)) { ?>
162
+                            if ( ! empty($QST_system)) { ?>
163 163
                                 <span class="description" style="color:#D54E21;">
164 164
                                     <?php esc_html_e(
165 165
                                         'System question! This field cannot be changed.',
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
 
192 192
                         // Only display Confirm email for
193 193
                         if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) {
194
-                            unset($question_types[ EEM_Question::QST_type_email_confirm ]);
194
+                            unset($question_types[EEM_Question::QST_type_email_confirm]);
195 195
                         }
196 196
 
197 197
                         echo wp_kses(
198 198
                             EEH_Form_Fields::select_input(
199
-                                'QST_type' . $id,
199
+                                'QST_type'.$id,
200 200
                                 $question_types,
201 201
                                 $question->type(),
202
-                                'id="QST_type' . $id . '"' . $disabled_attr
202
+                                'id="QST_type'.$id.'"'.$disabled_attr
203 203
                             ),
204 204
                             AllowedTags::getWithFormTags()
205 205
                         );
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                     </th>
241 241
                     <td>
242 242
                         <input id="QST_max"
243
-                            <?php echo ($max_max === EE_INF ? '' : 'max="' . esc_attr($max_max) . '"'); ?>
243
+                            <?php echo ($max_max === EE_INF ? '' : 'max="'.esc_attr($max_max).'"'); ?>
244 244
                                min="1"
245 245
                                name="QST_max"
246 246
                                type="number"
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
                                 <?php
325 325
                                 $count            = 0;
326 326
                                 $question_options = $question->options();
327
-                                if (! empty($question_options)) {
327
+                                if ( ! empty($question_options)) {
328 328
                                     foreach ($question_options as $option_id => $option) {
329 329
                                         $disabled_attr = $has_answers || $option->get('QSO_system')
330 330
                                             ? 'disabled'
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                                                 />
359 359
                                             </td>
360 360
                                             <td>
361
-                                                <?php if (! $option->system()) { ?>
361
+                                                <?php if ( ! $option->system()) { ?>
362 362
                                                     <span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item">
363 363
                                         </span>
364 364
                                                 <?php } ?>
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
                         ];
481 481
                         echo wp_kses(
482 482
                             EEH_Form_Fields::select_input(
483
-                                'QST_required' . $id,
483
+                                'QST_required'.$id,
484 484
                                 $requiredOptions,
485 485
                                 $question->required(),
486
-                                'id="QST_required' . $id . '"' . $disabled_attr
486
+                                'id="QST_required'.$id.'"'.$disabled_attr
487 487
                             ),
488 488
                             AllowedTags::getWithFormTags()
489 489
                         );
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
                                 ) ?>
507 507
                             </span>
508 508
                         </p>
509
-                        <?php if (! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?>
509
+                        <?php if ( ! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?>
510 510
                             <input type="hidden" id="QST_required" name="QST_required" value="1" />
511 511
                             <p>
512 512
                             <span class="description" style="color:#D54E21;">
Please login to merge, or discard this patch.
admin_pages/events/templates/event_settings.template.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,19 +22,19 @@
 block discarded – undo
22 22
             <td>
23 23
                 <p>
24 24
                     <?php echo wp_kses(
25
-                        EEH_Form_Fields::select_input(
26
-                            'default_reg_status',
27
-                            $reg_status_array,
28
-                            $default_reg_status
29
-                        ),
30
-                        AllowedTags::getWithFormTags()
31
-                    ); ?>
25
+						EEH_Form_Fields::select_input(
26
+							'default_reg_status',
27
+							$reg_status_array,
28
+							$default_reg_status
29
+						),
30
+						AllowedTags::getWithFormTags()
31
+					); ?>
32 32
                 </p>
33 33
                 <p class="description">
34 34
                     <?php esc_html_e(
35
-                        'This setting allows you to preselect what the default registration status setting is when creating an event.  Note that changing this setting does NOT retroactively apply it to existing events.',
36
-                        'event_espresso'
37
-                    ); ?>
35
+						'This setting allows you to preselect what the default registration status setting is when creating an event.  Note that changing this setting does NOT retroactively apply it to existing events.',
36
+						'event_espresso'
37
+					); ?>
38 38
                 </p>
39 39
             </td>
40 40
         </tr>
Please login to merge, or discard this patch.
admin_pages/venues/templates/google_map.template.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -20,24 +20,24 @@  discard block
 block discarded – undo
20 20
                 </th>
21 21
                 <td>
22 22
                     <?php echo wp_kses(
23
-                        EEH_Form_Fields::select_input(
24
-                            'use_google_maps',
25
-                            $values,
26
-                            $map_settings->use_google_maps,
27
-                            'id="ee-display-map-no-shortcodes"'
28
-                        ),
29
-                        AllowedTags::getWithFormTags()
30
-                    ); ?>
23
+						EEH_Form_Fields::select_input(
24
+							'use_google_maps',
25
+							$values,
26
+							$map_settings->use_google_maps,
27
+							'id="ee-display-map-no-shortcodes"'
28
+						),
29
+						AllowedTags::getWithFormTags()
30
+					); ?>
31 31
                     <p class="description">
32 32
                         <?php esc_html_e(
33
-                            'Turn Google maps on or off site wide for Event Espresso.',
34
-                            'event_espresso'
35
-                        ); ?>
33
+							'Turn Google maps on or off site wide for Event Espresso.',
34
+							'event_espresso'
35
+						); ?>
36 36
                     </p>
37 37
                 </td>
38 38
             </tr>
39 39
             <?php
40
-            if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?>
40
+			if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?>
41 41
                 <tr>
42 42
                     <th>
43 43
                         <label for="ee-google-map-api-key">
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
                         />
54 54
                         <p class="description">
55 55
                             <?php printf(
56
-                                esc_html__(
57
-                                    'An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s',
58
-                                    'event_espresso'
59
-                                ),
60
-                                '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank" rel="noopener noreferrer">',
61
-                                '</a>'
62
-                            );
63
-                            ?>
56
+								esc_html__(
57
+									'An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s',
58
+									'event_espresso'
59
+								),
60
+								'<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank" rel="noopener noreferrer">',
61
+								'</a>'
62
+							);
63
+							?>
64 64
                         </p>
65 65
                     </td>
66 66
                 </tr>
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
                 </th>
133 133
                 <td>
134 134
                     <?php echo wp_kses(
135
-                        EEH_Form_Fields::select_input(
136
-                            'event_details_display_nav',
137
-                            $values,
138
-                            $map_settings->event_details_display_nav,
139
-                            'id="event_details_display_nav" '
140
-                        ),
141
-                        AllowedTags::getWithFormTags()
142
-                    ); ?>
135
+						EEH_Form_Fields::select_input(
136
+							'event_details_display_nav',
137
+							$values,
138
+							$map_settings->event_details_display_nav,
139
+							'id="event_details_display_nav" '
140
+						),
141
+						AllowedTags::getWithFormTags()
142
+					); ?>
143 143
                 </td>
144 144
             </tr>
145 145
 
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
                 </th>
152 152
                 <td>
153 153
                     <?php echo wp_kses(
154
-                        EEH_Form_Fields::select_input(
155
-                            'event_details_nav_size',
156
-                            $values,
157
-                            $map_settings->event_details_nav_size,
158
-                            'id="event_details_nav_size"'
159
-                        ),
160
-                        AllowedTags::getWithFormTags()
161
-                    ); ?>
154
+						EEH_Form_Fields::select_input(
155
+							'event_details_nav_size',
156
+							$values,
157
+							$map_settings->event_details_nav_size,
158
+							'id="event_details_nav_size"'
159
+						),
160
+						AllowedTags::getWithFormTags()
161
+					); ?>
162 162
                 </td>
163 163
             </tr>
164 164
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
                 <td>
170 170
                     <label for="event_details_control_type-default" class="ee-admin-radio-lbl">
171 171
                         <?php $checked = $map_settings->event_details_control_type == 'default'
172
-                            ? 'checked'
173
-                            : ''; ?>
172
+							? 'checked'
173
+							: ''; ?>
174 174
                         <input id="event_details_control_type-default"
175 175
                                type="radio"
176 176
                                name="event_details_control_type"
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 
183 183
                     <label for="event_details_control_type-horizontal" class="ee-admin-radio-lbl">
184 184
                         <?php $checked = $map_settings->event_details_control_type == 'horizontal'
185
-                            ? 'checked'
186
-                            : ''; ?>
185
+							? 'checked'
186
+							: ''; ?>
187 187
                         <input id="event_details_control_type-horizontal"
188 188
                                type="radio"
189 189
                                name="event_details_control_type"
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 
196 196
                     <label for="event_details_control_type-dropdown" class="ee-admin-radio-lbl">
197 197
                         <?php $checked = $map_settings->event_details_control_type == 'dropdown'
198
-                            ? 'checked'
199
-                            : ''; ?>
198
+							? 'checked'
199
+							: ''; ?>
200 200
                         <input id="event_details_control_type-dropdown"
201 201
                                type="radio"
202 202
                                name="event_details_control_type"
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
                 <td>
215 215
                     <label for="event_details_map_align-none" class="ee-admin-radio-lbl">
216 216
                         <?php $checked = $map_settings->event_details_map_align == 'none'
217
-                            ? 'checked'
218
-                            : ''; ?>
217
+							? 'checked'
218
+							: ''; ?>
219 219
                         <input id="event_details_map_align-none"
220 220
                                type="radio"
221 221
                                name="event_details_map_align"
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 
228 228
                     <label for="event_details_map_align-left" class="ee-admin-radio-lbl">
229 229
                         <?php $checked = $map_settings->event_details_map_align == 'left'
230
-                            ? 'checked'
231
-                            : ''; ?>
230
+							? 'checked'
231
+							: ''; ?>
232 232
                         <input id="event_details_map_align-left"
233 233
                                type="radio"
234 234
                                name="event_details_map_align"
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 
241 241
                     <label for="event_details_map_align-center" class="ee-admin-radio-lbl">
242 242
                         <?php $checked = $map_settings->event_details_map_align == 'center'
243
-                            ? 'checked'
244
-                            : ''; ?>
243
+							? 'checked'
244
+							: ''; ?>
245 245
                         <input id="event_details_map_align-center"
246 246
                                type="radio"
247 247
                                name="event_details_map_align"
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 
254 254
                     <label for="event_details_map_align-right" class="ee-admin-radio-lbl">
255 255
                         <?php $checked = $map_settings->event_details_map_align == 'right'
256
-                            ? 'checked'
257
-                            : ''; ?>
256
+							? 'checked'
257
+							: ''; ?>
258 258
                         <input id="event_details_map_align-right"
259 259
                                type="radio"
260 260
                                name="event_details_map_align"
@@ -330,14 +330,14 @@  discard block
 block discarded – undo
330 330
                 </th>
331 331
                 <td>
332 332
                     <?php echo wp_kses(
333
-                        EEH_Form_Fields::select_input(
334
-                            'event_list_display_nav',
335
-                            $values,
336
-                            $map_settings->event_list_display_nav,
337
-                            'id="event_list_display_nav"'
338
-                        ),
339
-                        AllowedTags::getWithFormTags()
340
-                    ); ?>
333
+						EEH_Form_Fields::select_input(
334
+							'event_list_display_nav',
335
+							$values,
336
+							$map_settings->event_list_display_nav,
337
+							'id="event_list_display_nav"'
338
+						),
339
+						AllowedTags::getWithFormTags()
340
+					); ?>
341 341
                 </td>
342 342
             </tr>
343 343
 
@@ -349,14 +349,14 @@  discard block
 block discarded – undo
349 349
                 </th>
350 350
                 <td>
351 351
                     <?php echo wp_kses(
352
-                        EEH_Form_Fields::select_input(
353
-                            'event_list_nav_size',
354
-                            $values,
355
-                            $map_settings->event_list_nav_size,
356
-                            'id="event_list_nav_size"'
357
-                        ),
358
-                        AllowedTags::getWithFormTags()
359
-                    ); ?>
352
+						EEH_Form_Fields::select_input(
353
+							'event_list_nav_size',
354
+							$values,
355
+							$map_settings->event_list_nav_size,
356
+							'id="event_list_nav_size"'
357
+						),
358
+						AllowedTags::getWithFormTags()
359
+					); ?>
360 360
                 </td>
361 361
             </tr>
362 362
 
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
                 <td>
368 368
                     <label for="event_list_control_type-default" class="ee-admin-radio-lbl">
369 369
                         <?php $checked = $map_settings->event_list_control_type == 'default'
370
-                            ? 'checked'
371
-                            : ''; ?>
370
+							? 'checked'
371
+							: ''; ?>
372 372
                         <input id="event_list_control_type-default"
373 373
                                type="radio"
374 374
                                name="event_list_control_type"
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 
381 381
                     <label for="event_list_control_type-horizontal" class="ee-admin-radio-lbl">
382 382
                         <?php $checked = $map_settings->event_list_control_type == 'horizontal'
383
-                            ? 'checked'
384
-                            : ''; ?>
383
+							? 'checked'
384
+							: ''; ?>
385 385
                         <input id="event_list_control_type-horizontal"
386 386
                                type="radio"
387 387
                                name="event_list_control_type"
@@ -393,9 +393,9 @@  discard block
 block discarded – undo
393 393
 
394 394
                     <label for="event_list_control_type-dropdown" class="ee-admin-radio-lbl">
395 395
                         <?php $checked =
396
-                            $map_settings->event_list_control_type == 'dropdown'
397
-                                ? 'checked'
398
-                                : ''; ?>
396
+							$map_settings->event_list_control_type == 'dropdown'
397
+								? 'checked'
398
+								: ''; ?>
399 399
                         <input id="event_list_control_type-dropdown"
400 400
                                type="radio"
401 401
                                name="event_list_control_type"
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
                 <td>
416 416
                     <label for="event_list_map_align-none" class="ee-admin-radio-lbl">
417 417
                         <?php $checked = $map_settings->event_list_map_align == 'none'
418
-                            ? 'checked'
419
-                            : ''; ?>
418
+							? 'checked'
419
+							: ''; ?>
420 420
                         <input id="event_list_map_align-none"
421 421
                                type="radio"
422 422
                                name="event_list_map_align"
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 
429 429
                     <label for="event_list_map_align-left" class="ee-admin-radio-lbl">
430 430
                         <?php $checked = $map_settings->event_list_map_align == 'left'
431
-                            ? 'checked'
432
-                            : ''; ?>
431
+							? 'checked'
432
+							: ''; ?>
433 433
                         <input id="event_list_map_align-left"
434 434
                                type="radio"
435 435
                                name="event_list_map_align"
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 
442 442
                     <label for="event_list_map_align-center" class="ee-admin-radio-lbl">
443 443
                         <?php $checked = $map_settings->event_list_map_align == 'center'
444
-                            ? 'checked'
445
-                            : ''; ?>
444
+							? 'checked'
445
+							: ''; ?>
446 446
                         <input id="event_list_map_align-center"
447 447
                                type="radio"
448 448
                                name="event_list_map_align"
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 
455 455
                     <label for="event_list_map_align-right" class="ee-admin-radio-lbl">
456 456
                         <?php $checked = $map_settings->event_list_map_align == 'right'
457
-                            ? 'checked'
458
-                            : ''; ?>
457
+							? 'checked'
458
+							: ''; ?>
459 459
                         <input id="event_list_map_align-right"
460 460
                                type="radio"
461 461
                                name="event_list_map_align"
Please login to merge, or discard this patch.