Completed
Branch dependabot/npm_and_yarn/wordpr... (839ddb)
by
unknown
16:10 queued 14:20
created
admin_pages/events/templates/event_category_details.template.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
                 <br/>
20 20
                 <p class="small-text">
21 21
                     <?php _e(
22
-                        'This is a default category so you can edit the label and the description but not the slug',
23
-                        'event_espresso'
24
-                    ); ?></p>
22
+						'This is a default category so you can edit the label and the description but not the slug',
23
+						'event_espresso'
24
+					); ?></p>
25 25
             <?php endif; ?>
26 26
         </td>
27 27
     </tr>
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
             <br/>
34 34
             <p class="description">
35 35
                 <?php _e(
36
-                    'Categories are hierarchical.  You can change the parent for this category here.',
37
-                    'event_espresso'
38
-                ); ?></p>
36
+					'Categories are hierarchical.  You can change the parent for this category here.',
37
+					'event_espresso'
38
+				); ?></p>
39 39
         </td>
40 40
     </tr>
41 41
     <tr>
Please login to merge, or discard this patch.
admin_pages/events/templates/event_tickets_metabox_main.template.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@  discard block
 block discarded – undo
2 2
     <div id="event-and-ticket-form-content">
3 3
         <h4 class="event-tickets-datetimes-title">
4 4
             <?php _e(
5
-                'Event Datetime',
6
-                'event_espresso'
7
-            ); ?></h4><?php echo $event_datetime_help_link; ?>
5
+				'Event Datetime',
6
+				'event_espresso'
7
+			); ?></h4><?php echo $event_datetime_help_link; ?>
8 8
         <div class="event-datetimes-container">
9 9
             <!-- these are the ids for the current displayed datetimes (on create new this is blank -->
10 10
             <input type="hidden" name="datetime_IDs" id="datetime-IDs" value="<?php echo $existing_datetime_ids; ?>">
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
                         </td>
47 47
                         <td class="event-datetime-column reg-limit-column">
48 48
                             <?php
49
-                            $reg_limit = $time->get_pretty('DTT_reg_limit', 'input');
50
-                            ?>
49
+							$reg_limit = $time->get_pretty('DTT_reg_limit', 'input');
50
+							?>
51 51
                             <input type="text" name="edit_event_datetimes[1][DTT_reg_limit]"
52 52
                                    id="event-datetime-DTT_reg_limit-1"
53 53
                                    class="ee-small-text-inp ee-inp-right event-datetime-DTT_reg_limit"
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
                         </td>
56 56
                         <td class="datetime-tickets-sold">
57 57
                             <?php printf(
58
-                                __('Tickets Sold: %s', 'event_espresso'),
59
-                                $time->get('DTT_sold')
60
-                            ); ?></td>
58
+								__('Tickets Sold: %s', 'event_espresso'),
59
+								$time->get('DTT_sold')
60
+							); ?></td>
61 61
                     </tr>
62 62
                     </tbody>
63 63
                 </table>
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
         <div class="event-tickets-container">
70 70
             <h4 class="event-tickets-datetimes-title">
71 71
                 <?php _e(
72
-                    'Ticket Options',
73
-                    'event_espresso'
74
-                ); ?></h4><?php echo $ticket_options_help_link; ?><br/>
72
+					'Ticket Options',
73
+					'event_espresso'
74
+				); ?></h4><?php echo $ticket_options_help_link; ?><br/>
75 75
             <table class="add-new-ticket-table">
76 76
                 <thead>
77 77
                 <tr valign="top">
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
             <div class="save-cancel-button-container">
98 98
                 <button class="button-secondary ee-create-button" data-context="ticket">
99 99
                     <?php _e(
100
-                        'Create New Ticket',
101
-                        'event_espresso'
102
-                    ); ?></button>
100
+						'Create New Ticket',
101
+						'event_espresso'
102
+					); ?></button>
103 103
             </div>
104 104
         </div> <!-- end .event-tickets-container -->
105 105
         <div style="clear:both"></div>
Please login to merge, or discard this patch.
admin_pages/events/templates/event_registration_options.template.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
 <p>
7 7
     <label for="max-registrants">
8 8
         <?php _e(
9
-            'Maximum number of tickets allowed per order for this event: ',
10
-            'event_espresso'
11
-        ); ?></label>
9
+			'Maximum number of tickets allowed per order for this event: ',
10
+			'event_espresso'
11
+		); ?></label>
12 12
     <input class="ee-numeric" type="text" id="max-registrants" name="additional_limit"
13 13
            value="<?php echo $additional_limit; ?>" size="4"/>
14 14
 </p>
Please login to merge, or discard this patch.
admin_pages/registration_form/qtips/EE_Registration_Form_Tips.lib.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -15,39 +15,39 @@
 block discarded – undo
15 15
 {
16 16
 
17 17
 
18
-    protected function _set_tips_array()
19
-    {
20
-        $this->_qtipsa = array(
21
-            0 => array(
22
-                'content_id' => 'about-system-lock-icon',
23
-                'target'     => '.questions .ee-system-lock',
24
-                'content'    => __('This question is a system question and cannot be trashed', 'event_espresso'),
25
-                'options'    => array(), // defaults
26
-            ),
27
-            1 => array(
28
-                'content_id' => 'about-non-system-lock-icon',
29
-                'target'     => '.questions .ee-alternate-color',
30
-                'content'    => __(
31
-                    'This question has answers attached to it from registrations that have the question.  It cannot be permanently deleted.',
32
-                    'event_espresso'
33
-                ),
34
-                'options'    => array(),
35
-            ),
36
-            2 => array(
37
-                'content_id' => 'about-question-group-lock-icon',
38
-                'target'     => '.questiongroups .ee-system-lock',
39
-                'content'    => __('This question group is a system group and cannot be trashed', 'event_espresso'),
40
-                'options'    => array(),
41
-            ),
42
-            3 => array(
43
-                'content_id' => 'about-non-system-qg-lock-icon',
44
-                'target'     => '.questiongroups .ee-alternate-color',
45
-                'content'    => __(
46
-                    'This question group has questions that have answers attached to it from registrations that have the question. It cannot be permanently deleted.',
47
-                    'event_espresso'
48
-                ),
49
-                'options'    => array(),
50
-            ),
51
-        );
52
-    }
18
+	protected function _set_tips_array()
19
+	{
20
+		$this->_qtipsa = array(
21
+			0 => array(
22
+				'content_id' => 'about-system-lock-icon',
23
+				'target'     => '.questions .ee-system-lock',
24
+				'content'    => __('This question is a system question and cannot be trashed', 'event_espresso'),
25
+				'options'    => array(), // defaults
26
+			),
27
+			1 => array(
28
+				'content_id' => 'about-non-system-lock-icon',
29
+				'target'     => '.questions .ee-alternate-color',
30
+				'content'    => __(
31
+					'This question has answers attached to it from registrations that have the question.  It cannot be permanently deleted.',
32
+					'event_espresso'
33
+				),
34
+				'options'    => array(),
35
+			),
36
+			2 => array(
37
+				'content_id' => 'about-question-group-lock-icon',
38
+				'target'     => '.questiongroups .ee-system-lock',
39
+				'content'    => __('This question group is a system group and cannot be trashed', 'event_espresso'),
40
+				'options'    => array(),
41
+			),
42
+			3 => array(
43
+				'content_id' => 'about-non-system-qg-lock-icon',
44
+				'target'     => '.questiongroups .ee-alternate-color',
45
+				'content'    => __(
46
+					'This question group has questions that have answers attached to it from registrations that have the question. It cannot be permanently deleted.',
47
+					'event_espresso'
48
+				),
49
+				'options'    => array(),
50
+			),
51
+		);
52
+	}
53 53
 }
Please login to merge, or discard this patch.
admin_pages/registration_form/Registration_Form_Admin_Page.core.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function __construct($routing = true)
55 55
     {
56
-        require_once(EE_MODELS . 'EEM_Question.model.php');
57
-        require_once(EE_MODELS . 'EEM_Question_Group.model.php');
56
+        require_once(EE_MODELS.'EEM_Question.model.php');
57
+        require_once(EE_MODELS.'EEM_Question_Group.model.php');
58 58
         $this->_question_model = EEM_Question::instance();
59 59
         $this->_question_group_model = EEM_Question_Group::instance();
60 60
         parent::__construct($routing);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     {
223 223
         wp_register_style(
224 224
             'espresso_registration',
225
-            REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css',
225
+            REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css',
226 226
             array(),
227 227
             EVENT_ESPRESSO_VERSION
228 228
         );
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $this->load_scripts_styles_forms();
266 266
         wp_register_script(
267 267
             'espresso_registration_form_single',
268
-            REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js',
268
+            REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js',
269 269
             array('jquery-ui-sortable'),
270 270
             EVENT_ESPRESSO_VERSION,
271 271
             true
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
     public function recaptcha_info_help_tab()
286 286
     {
287
-        $template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php';
287
+        $template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php';
288 288
         EEH_Template::display_template($template, array());
289 289
     }
290 290
 
@@ -329,16 +329,16 @@  discard block
 block discarded – undo
329 329
     protected function _questions_groups_preview()
330 330
     {
331 331
         $this->_admin_page_title = esc_html__('Question Groups (Preview)', 'event_espresso');
332
-        $this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="'
332
+        $this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'
333 333
                                                . esc_attr__(
334 334
                                                    'Preview Question Groups Overview List Table screenshot',
335 335
                                                    'event_espresso'
336
-                                               ) . '" />';
336
+                                               ).'" />';
337 337
         $this->_template_args['preview_text'] = '<strong>'
338 338
                                                 . esc_html__(
339 339
                                                     'Question Groups is a feature that is only available in the premium version of Event Espresso 4 which is available with a support license purchase on EventEspresso.com. With the Question Groups feature you are able to create new question groups, edit existing question groups, and create and edit new questions and add them to question groups.',
340 340
                                                     'event_espresso'
341
-                                                ) . '</strong>';
341
+                                                ).'</strong>';
342 342
         $this->display_admin_caf_preview_page('question_groups_tab');
343 343
     }
344 344
 
@@ -356,11 +356,11 @@  discard block
 block discarded – undo
356 356
 
357 357
         // some initial checks for proper values.
358 358
         // if QST_admin_only, then no matter what QST_required is we disable.
359
-        if (! empty($this->_req_data['QST_admin_only'])) {
359
+        if ( ! empty($this->_req_data['QST_admin_only'])) {
360 360
             $this->_req_data['QST_required'] = 0;
361 361
         }
362 362
         // if the question shouldn't have a max length, don't let them set one
363
-        if (! isset(
363
+        if ( ! isset(
364 364
             $this->_req_data['QST_type'],
365 365
             $this->_req_data['QST_max']
366 366
         )
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
377 377
             // basically if QSG_identifier is empty or not set
378 378
             if ($fieldName === 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) {
379 379
                 $QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : '';
380
-                $set_column_values[ $fieldName ] = sanitize_title($QSG_name) . '-' . uniqid('', true);
380
+                $set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid('', true);
381 381
             } //if the admin label is blank, use a slug version of the question text
382 382
             elseif ($fieldName === 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) {
383 383
                 $QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : '';
384
-                $set_column_values[ $fieldName ] = sanitize_title(wp_trim_words($QST_text, 10));
385
-            } elseif ($fieldName === 'QST_admin_only' && (! isset($this->_req_data['QST_admin_only']))) {
386
-                $set_column_values[ $fieldName ] = 0;
384
+                $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10));
385
+            } elseif ($fieldName === 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) {
386
+                $set_column_values[$fieldName] = 0;
387 387
             } elseif ($fieldName === 'QST_max') {
388 388
                 $qst_system = EEM_Question::instance()->get_var(
389 389
                     array(
@@ -397,19 +397,19 @@  discard block
 block discarded – undo
397 397
                 if (empty($this->_req_data['QST_max']) ||
398 398
                     $this->_req_data['QST_max'] > $max_max
399 399
                 ) {
400
-                    $set_column_values[ $fieldName ] = $max_max;
400
+                    $set_column_values[$fieldName] = $max_max;
401 401
                 }
402 402
             }
403 403
 
404 404
 
405 405
             // only add a property to the array if it's not null (otherwise the model should just use the default value)
406
-            if (! isset($set_column_values[ $fieldName ]) &&
407
-                isset($this->_req_data[ $fieldName ])
406
+            if ( ! isset($set_column_values[$fieldName]) &&
407
+                isset($this->_req_data[$fieldName])
408 408
             ) {
409
-                $set_column_values[ $fieldName ] = $this->_req_data[ $fieldName ];
409
+                $set_column_values[$fieldName] = $this->_req_data[$fieldName];
410 410
             }
411 411
         }
412
-        return $set_column_values;// validation fo this data to be performed by the model before insertion.
412
+        return $set_column_values; // validation fo this data to be performed by the model before insertion.
413 413
     }
414 414
 
415 415
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         }
446 446
 
447 447
         // add PRC_ID to title if editing
448
-        $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
448
+        $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
449 449
         if ($ID) {
450 450
             $question = $this->_question_model->get_one_by_ID($ID);
451 451
             $additional_hidden_fields = array('QST_ID' => array('type' => 'hidden', 'value' => $ID));
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         $this->_template_args['question_type_descriptions'] = $this->_get_question_type_descriptions();
480 480
         $this->_set_publish_post_box_vars('id', $ID);
481 481
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
482
-            REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php',
482
+            REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php',
483 483
             $this->_template_args,
484 484
             true
485 485
         );
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
             }
509 509
             $descriptions .= EEH_HTML::p(
510 510
                 $question_type_description,
511
-                'question_type_description-' . $type,
511
+                'question_type_description-'.$type,
512 512
                 'question_type_description description',
513 513
                 'display:none;'
514 514
             );
@@ -542,11 +542,11 @@  discard block
 block discarded – undo
542 542
             // trash removed options, save old ones
543 543
             // get list of all options
544 544
             $options = $question->options();
545
-            if (! empty($options)) {
545
+            if ( ! empty($options)) {
546 546
                 foreach ($options as $option_ID => $option) {
547 547
                     $option_req_index = $this->_get_option_req_data_index($option_ID);
548 548
                     if ($option_req_index !== false) {
549
-                        $option->save($this->_req_data['question_options'][ $option_req_index ]);
549
+                        $option->save($this->_req_data['question_options'][$option_req_index]);
550 550
                     } else {
551 551
                         // not found, remove it
552 552
                         $option->delete();
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
         $field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby'];
639 639
         $query_params['order_by'] = array($field_to_order_by => $order);
640 640
         $search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null;
641
-        if (! empty($search_string)) {
641
+        if ( ! empty($search_string)) {
642 642
             if ($model instanceof EEM_Question_Group) {
643 643
                 $query_params[0] = array(
644 644
                     'OR' => array(
Please login to merge, or discard this patch.
Indentation   +698 added lines, -698 removed lines patch added patch discarded remove patch
@@ -15,649 +15,649 @@  discard block
 block discarded – undo
15 15
 class Registration_Form_Admin_Page extends EE_Admin_Page
16 16
 {
17 17
 
18
-    /**
19
-     * _question
20
-     * holds the specific question object for the question details screen
21
-     *
22
-     * @var EE_Question $_question
23
-     */
24
-    protected $_question;
25
-
26
-    /**
27
-     * _question_group
28
-     * holds the specific question group object for the question group details screen
29
-     *
30
-     * @var EE_Question_Group $_question_group
31
-     */
32
-    protected $_question_group;
33
-
34
-    /**
35
-     *_question_model EEM_Question model instance (for queries)
36
-     *
37
-     * @var EEM_Question $_question_model ;
38
-     */
39
-    protected $_question_model;
40
-
41
-    /**
42
-     * _question_group_model EEM_Question_group instance (for queries)
43
-     *
44
-     * @var EEM_Question_Group $_question_group_model
45
-     */
46
-    protected $_question_group_model;
47
-
48
-
49
-    /**
50
-     * @Constructor
51
-     * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
52
-     * @access public
53
-     */
54
-    public function __construct($routing = true)
55
-    {
56
-        require_once(EE_MODELS . 'EEM_Question.model.php');
57
-        require_once(EE_MODELS . 'EEM_Question_Group.model.php');
58
-        $this->_question_model = EEM_Question::instance();
59
-        $this->_question_group_model = EEM_Question_Group::instance();
60
-        parent::__construct($routing);
61
-    }
62
-
63
-
64
-    protected function _init_page_props()
65
-    {
66
-        $this->page_slug = REGISTRATION_FORM_PG_SLUG;
67
-        $this->page_label = esc_html__('Registration Form', 'event_espresso');
68
-        $this->_admin_base_url = REGISTRATION_FORM_ADMIN_URL;
69
-        $this->_admin_base_path = REGISTRATION_FORM_ADMIN;
70
-    }
71
-
72
-
73
-    protected function _ajax_hooks()
74
-    {
75
-    }
76
-
77
-
78
-    protected function _define_page_props()
79
-    {
80
-        $this->_admin_page_title = esc_html__('Registration Form', 'event_espresso');
81
-        $this->_labels = array(
82
-            'buttons' => array(
83
-                'edit_question' => esc_html__('Edit Question', 'event_espresso'),
84
-            ),
85
-        );
86
-    }
87
-
88
-
89
-    /**
90
-     *_set_page_routes
91
-     */
92
-    protected function _set_page_routes()
93
-    {
94
-        $qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
95
-        $this->_page_routes = array(
96
-            'default' => array(
97
-                'func'       => '_questions_overview_list_table',
98
-                'capability' => 'ee_read_questions',
99
-            ),
100
-
101
-            'edit_question' => array(
102
-                'func'       => '_edit_question',
103
-                'capability' => 'ee_edit_question',
104
-                'obj_id'     => $qst_id,
105
-                'args'       => array('edit'),
106
-            ),
107
-
108
-            'question_groups' => array(
109
-                'func'       => '_questions_groups_preview',
110
-                'capability' => 'ee_read_question_groups',
111
-            ),
112
-
113
-            'update_question' => array(
114
-                'func'       => '_insert_or_update_question',
115
-                'args'       => array('new_question' => false),
116
-                'capability' => 'ee_edit_question',
117
-                'obj_id'     => $qst_id,
118
-                'noheader'   => true,
119
-            ),
120
-        );
121
-    }
122
-
123
-
124
-    protected function _set_page_config()
125
-    {
126
-        $this->_page_config = array(
127
-            'default' => array(
128
-                'nav'           => array(
129
-                    'label' => esc_html__('Questions', 'event_espresso'),
130
-                    'order' => 10,
131
-                ),
132
-                'list_table'    => 'Registration_Form_Questions_Admin_List_Table',
133
-                'metaboxes'     => $this->_default_espresso_metaboxes,
134
-                'help_tabs'     => array(
135
-                    'registration_form_questions_overview_help_tab'                           => array(
136
-                        'title'    => esc_html__('Questions Overview', 'event_espresso'),
137
-                        'filename' => 'registration_form_questions_overview',
138
-                    ),
139
-                    'registration_form_questions_overview_table_column_headings_help_tab'     => array(
140
-                        'title'    => esc_html__('Questions Overview Table Column Headings', 'event_espresso'),
141
-                        'filename' => 'registration_form_questions_overview_table_column_headings',
142
-                    ),
143
-                    'registration_form_questions_overview_views_bulk_actions_search_help_tab' => array(
144
-                        'title'    => esc_html__('Question Overview Views & Bulk Actions & Search', 'event_espresso'),
145
-                        'filename' => 'registration_form_questions_overview_views_bulk_actions_search',
146
-                    ),
147
-                ),
148
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
149
-                // 'help_tour'     => array('Registration_Form_Questions_Overview_Help_Tour'),
150
-                'require_nonce' => false,
151
-                'qtips'         => array(
152
-                    'EE_Registration_Form_Tips',
153
-                )/**/
154
-            ),
155
-
156
-            'question_groups' => array(
157
-                'nav'           => array(
158
-                    'label' => esc_html__('Question Groups', 'event_espresso'),
159
-                    'order' => 20,
160
-                ),
161
-                'metaboxes'     => $this->_default_espresso_metaboxes,
162
-                'help_tabs'     => array(
163
-                    'registration_form_question_groups_help_tab' => array(
164
-                        'title'    => esc_html__('Question Groups', 'event_espresso'),
165
-                        'filename' => 'registration_form_question_groups',
166
-                    ),
167
-                ),
168
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
169
-                // 'help_tour'     => array('Registration_Form_Question_Groups_Help_Tour'),
170
-                'require_nonce' => false,
171
-            ),
172
-
173
-            'edit_question' => array(
174
-                'nav'           => array(
175
-                    'label'      => esc_html__('Edit Question', 'event_espresso'),
176
-                    'order'      => 15,
177
-                    'persistent' => false,
178
-                    'url'        => isset($this->_req_data['question_id']) ? add_query_arg(
179
-                        array('question_id' => $this->_req_data['question_id']),
180
-                        $this->_current_page_view_url
181
-                    ) : $this->_admin_base_url,
182
-                ),
183
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
184
-                'help_tabs'     => array(
185
-                    'registration_form_edit_question_group_help_tab' => array(
186
-                        'title'    => esc_html__('Edit Question', 'event_espresso'),
187
-                        'filename' => 'registration_form_edit_question',
188
-                    ),
189
-                ),
190
-                // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
191
-                // 'help_tour'     => array('Registration_Form_Edit_Question_Help_Tour'),
192
-                'require_nonce' => false,
193
-            ),
194
-        );
195
-    }
196
-
197
-
198
-    protected function _add_screen_options()
199
-    {
200
-        // todo
201
-    }
202
-
203
-    protected function _add_screen_options_default()
204
-    {
205
-        $page_title = $this->_admin_page_title;
206
-        $this->_admin_page_title = esc_html__('Questions', 'event_espresso');
207
-        $this->_per_page_screen_option();
208
-        $this->_admin_page_title = $page_title;
209
-    }
210
-
211
-    protected function _add_screen_options_question_groups()
212
-    {
213
-        $page_title = $this->_admin_page_title;
214
-        $this->_admin_page_title = esc_html__('Question Groups', 'event_espresso');
215
-        $this->_per_page_screen_option();
216
-        $this->_admin_page_title = $page_title;
217
-    }
218
-
219
-    // none of the below group are currently used for Event Categories
220
-    protected function _add_feature_pointers()
221
-    {
222
-    }
223
-
224
-    public function load_scripts_styles()
225
-    {
226
-        wp_register_style(
227
-            'espresso_registration',
228
-            REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css',
229
-            array(),
230
-            EVENT_ESPRESSO_VERSION
231
-        );
232
-        wp_enqueue_style('espresso_registration');
233
-    }
234
-
235
-    public function admin_init()
236
-    {
237
-    }
238
-
239
-    public function admin_notices()
240
-    {
241
-    }
242
-
243
-    public function admin_footer_scripts()
244
-    {
245
-    }
246
-
247
-
248
-    public function load_scripts_styles_default()
249
-    {
250
-    }
251
-
252
-
253
-    public function load_scripts_styles_add_question()
254
-    {
255
-        $this->load_scripts_styles_question_details();
256
-    }
257
-
258
-    public function load_scripts_styles_edit_question()
259
-    {
260
-        $this->load_scripts_styles_question_details();
261
-    }
262
-
263
-    /**
264
-     * Loads the JS required for adding or editing a question
265
-     */
266
-    protected function load_scripts_styles_question_details()
267
-    {
268
-        $this->load_scripts_styles_forms();
269
-        wp_register_script(
270
-            'espresso_registration_form_single',
271
-            REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js',
272
-            array('jquery-ui-sortable'),
273
-            EVENT_ESPRESSO_VERSION,
274
-            true
275
-        );
276
-        wp_enqueue_script('espresso_registration_form_single');
277
-        wp_localize_script(
278
-            'espresso_registration_form_single',
279
-            'ee_question_data',
280
-            array(
281
-                'question_types_with_max'    => EEM_Question::instance()->questionTypesWithMaxLength(),
282
-                'question_type_with_options' => EEM_Question::instance()->question_types_with_options(),
283
-            )
284
-        );
285
-    }
286
-
287
-
288
-    public function recaptcha_info_help_tab()
289
-    {
290
-        $template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php';
291
-        EEH_Template::display_template($template, array());
292
-    }
293
-
294
-
295
-    public function load_scripts_styles_forms()
296
-    {
297
-        // styles
298
-        wp_enqueue_style('espresso-ui-theme');
299
-        // scripts
300
-        wp_enqueue_script('ee_admin_js');
301
-    }
302
-
303
-
304
-    protected function _set_list_table_views_default()
305
-    {
306
-        $this->_views = array(
307
-            'all' => array(
308
-                'slug'  => 'all',
309
-                'label' => esc_html__('View All Questions', 'event_espresso'),
310
-                'count' => 0,
311
-            ),
312
-        );
313
-
314
-        if (EE_Registry::instance()->CAP->current_user_can(
315
-            'ee_delete_questions',
316
-            'espresso_registration_form_trash_questions'
317
-        )
318
-        ) {
319
-            $this->_views['trash'] = array(
320
-                'slug'  => 'trash',
321
-                'label' => esc_html__('Trash', 'event_espresso'),
322
-                'count' => 0,
323
-            );
324
-        }
325
-    }
326
-
327
-    /**
328
-     * This just previews the question groups tab that comes in caffeinated.
329
-     *
330
-     * @return string html
331
-     */
332
-    protected function _questions_groups_preview()
333
-    {
334
-        $this->_admin_page_title = esc_html__('Question Groups (Preview)', 'event_espresso');
335
-        $this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="'
336
-                                               . esc_attr__(
337
-                                                   'Preview Question Groups Overview List Table screenshot',
338
-                                                   'event_espresso'
339
-                                               ) . '" />';
340
-        $this->_template_args['preview_text'] = '<strong>'
341
-                                                . esc_html__(
342
-                                                    'Question Groups is a feature that is only available in the premium version of Event Espresso 4 which is available with a support license purchase on EventEspresso.com. With the Question Groups feature you are able to create new question groups, edit existing question groups, and create and edit new questions and add them to question groups.',
343
-                                                    'event_espresso'
344
-                                                ) . '</strong>';
345
-        $this->display_admin_caf_preview_page('question_groups_tab');
346
-    }
347
-
348
-
349
-    /**
350
-     * Extracts the question field's values from the POST request to update or insert them
351
-     *
352
-     * @param \EEM_Base $model
353
-     * @return array where each key is the name of a model's field/db column, and each value is its value.
354
-     */
355
-    protected function _set_column_values_for(EEM_Base $model)
356
-    {
357
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
358
-        $set_column_values = array();
359
-
360
-        // some initial checks for proper values.
361
-        // if QST_admin_only, then no matter what QST_required is we disable.
362
-        if (! empty($this->_req_data['QST_admin_only'])) {
363
-            $this->_req_data['QST_required'] = 0;
364
-        }
365
-        // if the question shouldn't have a max length, don't let them set one
366
-        if (! isset(
367
-            $this->_req_data['QST_type'],
368
-            $this->_req_data['QST_max']
369
-        )
370
-            || ! in_array(
371
-                $this->_req_data['QST_type'],
372
-                EEM_Question::instance()->questionTypesWithMaxLength(),
373
-                true
374
-            )
375
-        ) {
376
-            // they're not allowed to set the max
377
-            $this->_req_data['QST_max'] = null;
378
-        }
379
-        foreach ($model->field_settings() as $fieldName => $settings) {
380
-            // basically if QSG_identifier is empty or not set
381
-            if ($fieldName === 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) {
382
-                $QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : '';
383
-                $set_column_values[ $fieldName ] = sanitize_title($QSG_name) . '-' . uniqid('', true);
384
-            } //if the admin label is blank, use a slug version of the question text
385
-            elseif ($fieldName === 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) {
386
-                $QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : '';
387
-                $set_column_values[ $fieldName ] = sanitize_title(wp_trim_words($QST_text, 10));
388
-            } elseif ($fieldName === 'QST_admin_only' && (! isset($this->_req_data['QST_admin_only']))) {
389
-                $set_column_values[ $fieldName ] = 0;
390
-            } elseif ($fieldName === 'QST_max') {
391
-                $qst_system = EEM_Question::instance()->get_var(
392
-                    array(
393
-                        array(
394
-                            'QST_ID' => isset($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0,
395
-                        ),
396
-                    ),
397
-                    'QST_system'
398
-                );
399
-                $max_max = EEM_Question::instance()->absolute_max_for_system_question($qst_system);
400
-                if (empty($this->_req_data['QST_max']) ||
401
-                    $this->_req_data['QST_max'] > $max_max
402
-                ) {
403
-                    $set_column_values[ $fieldName ] = $max_max;
404
-                }
405
-            }
406
-
407
-
408
-            // only add a property to the array if it's not null (otherwise the model should just use the default value)
409
-            if (! isset($set_column_values[ $fieldName ]) &&
410
-                isset($this->_req_data[ $fieldName ])
411
-            ) {
412
-                $set_column_values[ $fieldName ] = $this->_req_data[ $fieldName ];
413
-            }
414
-        }
415
-        return $set_column_values;// validation fo this data to be performed by the model before insertion.
416
-    }
417
-
418
-
419
-    /**
420
-     *_questions_overview_list_table
421
-     */
422
-    protected function _questions_overview_list_table()
423
-    {
424
-        $this->_search_btn_label = esc_html__('Questions', 'event_espresso');
425
-        $this->display_admin_list_table_page_with_sidebar();
426
-    }
427
-
428
-
429
-    /**
430
-     * _edit_question
431
-     */
432
-    protected function _edit_question()
433
-    {
434
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
435
-        $ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint(
436
-            $this->_req_data['QST_ID']
437
-        ) : false;
438
-
439
-        switch ($this->_req_action) {
440
-            case 'add_question':
441
-                $this->_admin_page_title = esc_html__('Add Question', 'event_espresso');
442
-                break;
443
-            case 'edit_question':
444
-                $this->_admin_page_title = esc_html__('Edit Question', 'event_espresso');
445
-                break;
446
-            default:
447
-                $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
448
-        }
449
-
450
-        // add PRC_ID to title if editing
451
-        $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
452
-        if ($ID) {
453
-            $question = $this->_question_model->get_one_by_ID($ID);
454
-            $additional_hidden_fields = array('QST_ID' => array('type' => 'hidden', 'value' => $ID));
455
-            $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields);
456
-        } else {
457
-            $question = EE_Question::new_instance();
458
-            $question->set_order_to_latest();
459
-            $this->_set_add_edit_form_tags('insert_question');
460
-        }
461
-        if ($question->system_ID() === EEM_Attendee::system_question_phone) {
462
-            $question_types = array_intersect_key(
463
-                EEM_Question::instance()->allowed_question_types(),
464
-                array_flip(
465
-                    array(
466
-                        EEM_Question::QST_type_text,
467
-                        EEM_Question::QST_type_us_phone,
468
-                    )
469
-                )
470
-            );
471
-        } else {
472
-            $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category(
473
-                $question->type()
474
-            ) : $this->_question_model->allowed_question_types();
475
-        }
476
-        $this->_template_args['QST_ID'] = $ID;
477
-        $this->_template_args['question'] = $question;
478
-        $this->_template_args['question_types'] = $question_types;
479
-        $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question(
480
-            $question->system_ID()
481
-        );
482
-        $this->_template_args['question_type_descriptions'] = $this->_get_question_type_descriptions();
483
-        $this->_set_publish_post_box_vars('id', $ID);
484
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
485
-            REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php',
486
-            $this->_template_args,
487
-            true
488
-        );
489
-
490
-        // the details template wrapper
491
-        $this->display_admin_page_with_sidebar();
492
-    }
493
-
494
-
495
-    /**
496
-     * @return string
497
-     */
498
-    protected function _get_question_type_descriptions()
499
-    {
500
-        EE_Registry::instance()->load_helper('HTML');
501
-        $descriptions = '';
502
-        $question_type_descriptions = EEM_Question::instance()->question_descriptions();
503
-        foreach ($question_type_descriptions as $type => $question_type_description) {
504
-            if ($type == 'HTML_TEXTAREA') {
505
-                $html = new EE_Simple_HTML_Validation_Strategy();
506
-                $question_type_description .= sprintf(
507
-                    esc_html__('%1$s(allowed tags: %2$s)', 'event_espresso'),
508
-                    '<br/>',
509
-                    $html->get_list_of_allowed_tags()
510
-                );
511
-            }
512
-            $descriptions .= EEH_HTML::p(
513
-                $question_type_description,
514
-                'question_type_description-' . $type,
515
-                'question_type_description description',
516
-                'display:none;'
517
-            );
518
-        }
519
-        return $descriptions;
520
-    }
521
-
522
-
523
-    /**
524
-     * @param bool|true $new_question
525
-     * @throws \EE_Error
526
-     */
527
-    protected function _insert_or_update_question($new_question = true)
528
-    {
529
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
530
-        $set_column_values = $this->_set_column_values_for($this->_question_model);
531
-        if ($new_question) {
532
-            $question = EE_Question::new_instance($set_column_values);
533
-            $action_desc = 'added';
534
-        } else {
535
-            $question = EEM_Question::instance()->get_one_by_ID(absint($this->_req_data['QST_ID']));
536
-            foreach ($set_column_values as $field => $new_value) {
537
-                $question->set($field, $new_value);
538
-            }
539
-            $action_desc = 'updated';
540
-        }
541
-        $success = $question->save();
542
-        $ID = $question->ID();
543
-        if ($ID && $question->should_have_question_options()) {
544
-            // save the related options
545
-            // trash removed options, save old ones
546
-            // get list of all options
547
-            $options = $question->options();
548
-            if (! empty($options)) {
549
-                foreach ($options as $option_ID => $option) {
550
-                    $option_req_index = $this->_get_option_req_data_index($option_ID);
551
-                    if ($option_req_index !== false) {
552
-                        $option->save($this->_req_data['question_options'][ $option_req_index ]);
553
-                    } else {
554
-                        // not found, remove it
555
-                        $option->delete();
556
-                    }
557
-                }
558
-            }
559
-            // save new related options
560
-            foreach ($this->_req_data['question_options'] as $index => $option_req_data) {
561
-                // skip $index that is from our sample
562
-                if ($index === 'xxcountxx') {
563
-                    continue;
564
-                }
565
-                // note we allow saving blank options.
566
-                if (empty($option_req_data['QSO_ID'])
567
-                ) {// no ID! save it!
568
-                    $new_option = EE_Question_Option::new_instance(
569
-                        array(
570
-                            'QSO_value' => $option_req_data['QSO_value'],
571
-                            'QSO_desc'  => $option_req_data['QSO_desc'],
572
-                            'QSO_order' => $option_req_data['QSO_order'],
573
-                            'QST_ID'    => $question->ID(),
574
-                        )
575
-                    );
576
-                    $new_option->save();
577
-                }
578
-            }
579
-        }
580
-        $query_args = array('action' => 'edit_question', 'QST_ID' => $ID);
581
-        if ($success !== false) {
582
-            $msg = $new_question
583
-                ? sprintf(
584
-                    esc_html__('The %s has been created', 'event_espresso'),
585
-                    $this->_question_model->item_name()
586
-                )
587
-                : sprintf(
588
-                    esc_html__('The %s has been updated', 'event_espresso'),
589
-                    $this->_question_model->item_name()
590
-                );
591
-            EE_Error::add_success($msg);
592
-        }
593
-
594
-        $this->_redirect_after_action(false, '', $action_desc, $query_args, true);
595
-    }
596
-
597
-
598
-    /**
599
-     * Upon saving a question, there should be an array of 'question_options'. This array is index numerically, but not
600
-     * by ID
601
-     * (this is done because new question options don't have an ID, but we may want to add multiple simultaneously).
602
-     * So, this function gets the index in that request data array called question_options. Returns FALSE if not found.
603
-     *
604
-     * @param int $ID of the question option to find
605
-     * @return int index in question_options array if successful, FALSE if unsuccessful
606
-     */
607
-    protected function _get_option_req_data_index($ID)
608
-    {
609
-        $req_data_for_question_options = $this->_req_data['question_options'];
610
-        foreach ($req_data_for_question_options as $num => $option_data) {
611
-            if (array_key_exists('QSO_ID', $option_data) && (int) $option_data['QSO_ID'] === $ID) {
612
-                return $num;
613
-            }
614
-        }
615
-        return false;
616
-    }
617
-
618
-
619
-
620
-
621
-    /***********/
622
-    /* QUERIES */
623
-    /**
624
-     * For internal use in getting all the query parameters
625
-     * (because it's pretty well the same between question, question groups,
626
-     * and for both when searching for trashed and untrashed ones)
627
-     *
628
-     * @param EEM_Base $model either EEM_Question or EEM_Question_Group
629
-     * @param int      $per_page
630
-     * @param int      $current_page
631
-     * @return array model query params, @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
632
-     */
633
-    protected function get_query_params($model, $per_page = 10, $current_page = 10)
634
-    {
635
-        $query_params = array();
636
-        $offset = ($current_page - 1) * $per_page;
637
-        $query_params['limit'] = array($offset, $per_page);
638
-        $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order']
639
-            : 'ASC';
640
-        $orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order';
641
-        $field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby'];
642
-        $query_params['order_by'] = array($field_to_order_by => $order);
643
-        $search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null;
644
-        if (! empty($search_string)) {
645
-            if ($model instanceof EEM_Question_Group) {
646
-                $query_params[0] = array(
647
-                    'OR' => array(
648
-                        'QSG_name' => array('LIKE', "%$search_string%"),
649
-                        'QSG_desc' => array('LIKE', "%$search_string%"),
650
-                    ),
651
-                );
652
-            } else {
653
-                $query_params[0] = array(
654
-                    'QST_display_text' => array('LIKE', "%$search_string%"),
655
-                );
656
-            }
657
-        }
658
-
659
-        // capability checks (just leaving this commented out for reference because it illustrates some complicated query params that could be useful when fully implemented)
660
-        /*if ( $model instanceof EEM_Question_Group ) {
18
+	/**
19
+	 * _question
20
+	 * holds the specific question object for the question details screen
21
+	 *
22
+	 * @var EE_Question $_question
23
+	 */
24
+	protected $_question;
25
+
26
+	/**
27
+	 * _question_group
28
+	 * holds the specific question group object for the question group details screen
29
+	 *
30
+	 * @var EE_Question_Group $_question_group
31
+	 */
32
+	protected $_question_group;
33
+
34
+	/**
35
+	 *_question_model EEM_Question model instance (for queries)
36
+	 *
37
+	 * @var EEM_Question $_question_model ;
38
+	 */
39
+	protected $_question_model;
40
+
41
+	/**
42
+	 * _question_group_model EEM_Question_group instance (for queries)
43
+	 *
44
+	 * @var EEM_Question_Group $_question_group_model
45
+	 */
46
+	protected $_question_group_model;
47
+
48
+
49
+	/**
50
+	 * @Constructor
51
+	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
52
+	 * @access public
53
+	 */
54
+	public function __construct($routing = true)
55
+	{
56
+		require_once(EE_MODELS . 'EEM_Question.model.php');
57
+		require_once(EE_MODELS . 'EEM_Question_Group.model.php');
58
+		$this->_question_model = EEM_Question::instance();
59
+		$this->_question_group_model = EEM_Question_Group::instance();
60
+		parent::__construct($routing);
61
+	}
62
+
63
+
64
+	protected function _init_page_props()
65
+	{
66
+		$this->page_slug = REGISTRATION_FORM_PG_SLUG;
67
+		$this->page_label = esc_html__('Registration Form', 'event_espresso');
68
+		$this->_admin_base_url = REGISTRATION_FORM_ADMIN_URL;
69
+		$this->_admin_base_path = REGISTRATION_FORM_ADMIN;
70
+	}
71
+
72
+
73
+	protected function _ajax_hooks()
74
+	{
75
+	}
76
+
77
+
78
+	protected function _define_page_props()
79
+	{
80
+		$this->_admin_page_title = esc_html__('Registration Form', 'event_espresso');
81
+		$this->_labels = array(
82
+			'buttons' => array(
83
+				'edit_question' => esc_html__('Edit Question', 'event_espresso'),
84
+			),
85
+		);
86
+	}
87
+
88
+
89
+	/**
90
+	 *_set_page_routes
91
+	 */
92
+	protected function _set_page_routes()
93
+	{
94
+		$qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
95
+		$this->_page_routes = array(
96
+			'default' => array(
97
+				'func'       => '_questions_overview_list_table',
98
+				'capability' => 'ee_read_questions',
99
+			),
100
+
101
+			'edit_question' => array(
102
+				'func'       => '_edit_question',
103
+				'capability' => 'ee_edit_question',
104
+				'obj_id'     => $qst_id,
105
+				'args'       => array('edit'),
106
+			),
107
+
108
+			'question_groups' => array(
109
+				'func'       => '_questions_groups_preview',
110
+				'capability' => 'ee_read_question_groups',
111
+			),
112
+
113
+			'update_question' => array(
114
+				'func'       => '_insert_or_update_question',
115
+				'args'       => array('new_question' => false),
116
+				'capability' => 'ee_edit_question',
117
+				'obj_id'     => $qst_id,
118
+				'noheader'   => true,
119
+			),
120
+		);
121
+	}
122
+
123
+
124
+	protected function _set_page_config()
125
+	{
126
+		$this->_page_config = array(
127
+			'default' => array(
128
+				'nav'           => array(
129
+					'label' => esc_html__('Questions', 'event_espresso'),
130
+					'order' => 10,
131
+				),
132
+				'list_table'    => 'Registration_Form_Questions_Admin_List_Table',
133
+				'metaboxes'     => $this->_default_espresso_metaboxes,
134
+				'help_tabs'     => array(
135
+					'registration_form_questions_overview_help_tab'                           => array(
136
+						'title'    => esc_html__('Questions Overview', 'event_espresso'),
137
+						'filename' => 'registration_form_questions_overview',
138
+					),
139
+					'registration_form_questions_overview_table_column_headings_help_tab'     => array(
140
+						'title'    => esc_html__('Questions Overview Table Column Headings', 'event_espresso'),
141
+						'filename' => 'registration_form_questions_overview_table_column_headings',
142
+					),
143
+					'registration_form_questions_overview_views_bulk_actions_search_help_tab' => array(
144
+						'title'    => esc_html__('Question Overview Views & Bulk Actions & Search', 'event_espresso'),
145
+						'filename' => 'registration_form_questions_overview_views_bulk_actions_search',
146
+					),
147
+				),
148
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
149
+				// 'help_tour'     => array('Registration_Form_Questions_Overview_Help_Tour'),
150
+				'require_nonce' => false,
151
+				'qtips'         => array(
152
+					'EE_Registration_Form_Tips',
153
+				)/**/
154
+			),
155
+
156
+			'question_groups' => array(
157
+				'nav'           => array(
158
+					'label' => esc_html__('Question Groups', 'event_espresso'),
159
+					'order' => 20,
160
+				),
161
+				'metaboxes'     => $this->_default_espresso_metaboxes,
162
+				'help_tabs'     => array(
163
+					'registration_form_question_groups_help_tab' => array(
164
+						'title'    => esc_html__('Question Groups', 'event_espresso'),
165
+						'filename' => 'registration_form_question_groups',
166
+					),
167
+				),
168
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
169
+				// 'help_tour'     => array('Registration_Form_Question_Groups_Help_Tour'),
170
+				'require_nonce' => false,
171
+			),
172
+
173
+			'edit_question' => array(
174
+				'nav'           => array(
175
+					'label'      => esc_html__('Edit Question', 'event_espresso'),
176
+					'order'      => 15,
177
+					'persistent' => false,
178
+					'url'        => isset($this->_req_data['question_id']) ? add_query_arg(
179
+						array('question_id' => $this->_req_data['question_id']),
180
+						$this->_current_page_view_url
181
+					) : $this->_admin_base_url,
182
+				),
183
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
184
+				'help_tabs'     => array(
185
+					'registration_form_edit_question_group_help_tab' => array(
186
+						'title'    => esc_html__('Edit Question', 'event_espresso'),
187
+						'filename' => 'registration_form_edit_question',
188
+					),
189
+				),
190
+				// disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836
191
+				// 'help_tour'     => array('Registration_Form_Edit_Question_Help_Tour'),
192
+				'require_nonce' => false,
193
+			),
194
+		);
195
+	}
196
+
197
+
198
+	protected function _add_screen_options()
199
+	{
200
+		// todo
201
+	}
202
+
203
+	protected function _add_screen_options_default()
204
+	{
205
+		$page_title = $this->_admin_page_title;
206
+		$this->_admin_page_title = esc_html__('Questions', 'event_espresso');
207
+		$this->_per_page_screen_option();
208
+		$this->_admin_page_title = $page_title;
209
+	}
210
+
211
+	protected function _add_screen_options_question_groups()
212
+	{
213
+		$page_title = $this->_admin_page_title;
214
+		$this->_admin_page_title = esc_html__('Question Groups', 'event_espresso');
215
+		$this->_per_page_screen_option();
216
+		$this->_admin_page_title = $page_title;
217
+	}
218
+
219
+	// none of the below group are currently used for Event Categories
220
+	protected function _add_feature_pointers()
221
+	{
222
+	}
223
+
224
+	public function load_scripts_styles()
225
+	{
226
+		wp_register_style(
227
+			'espresso_registration',
228
+			REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css',
229
+			array(),
230
+			EVENT_ESPRESSO_VERSION
231
+		);
232
+		wp_enqueue_style('espresso_registration');
233
+	}
234
+
235
+	public function admin_init()
236
+	{
237
+	}
238
+
239
+	public function admin_notices()
240
+	{
241
+	}
242
+
243
+	public function admin_footer_scripts()
244
+	{
245
+	}
246
+
247
+
248
+	public function load_scripts_styles_default()
249
+	{
250
+	}
251
+
252
+
253
+	public function load_scripts_styles_add_question()
254
+	{
255
+		$this->load_scripts_styles_question_details();
256
+	}
257
+
258
+	public function load_scripts_styles_edit_question()
259
+	{
260
+		$this->load_scripts_styles_question_details();
261
+	}
262
+
263
+	/**
264
+	 * Loads the JS required for adding or editing a question
265
+	 */
266
+	protected function load_scripts_styles_question_details()
267
+	{
268
+		$this->load_scripts_styles_forms();
269
+		wp_register_script(
270
+			'espresso_registration_form_single',
271
+			REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js',
272
+			array('jquery-ui-sortable'),
273
+			EVENT_ESPRESSO_VERSION,
274
+			true
275
+		);
276
+		wp_enqueue_script('espresso_registration_form_single');
277
+		wp_localize_script(
278
+			'espresso_registration_form_single',
279
+			'ee_question_data',
280
+			array(
281
+				'question_types_with_max'    => EEM_Question::instance()->questionTypesWithMaxLength(),
282
+				'question_type_with_options' => EEM_Question::instance()->question_types_with_options(),
283
+			)
284
+		);
285
+	}
286
+
287
+
288
+	public function recaptcha_info_help_tab()
289
+	{
290
+		$template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php';
291
+		EEH_Template::display_template($template, array());
292
+	}
293
+
294
+
295
+	public function load_scripts_styles_forms()
296
+	{
297
+		// styles
298
+		wp_enqueue_style('espresso-ui-theme');
299
+		// scripts
300
+		wp_enqueue_script('ee_admin_js');
301
+	}
302
+
303
+
304
+	protected function _set_list_table_views_default()
305
+	{
306
+		$this->_views = array(
307
+			'all' => array(
308
+				'slug'  => 'all',
309
+				'label' => esc_html__('View All Questions', 'event_espresso'),
310
+				'count' => 0,
311
+			),
312
+		);
313
+
314
+		if (EE_Registry::instance()->CAP->current_user_can(
315
+			'ee_delete_questions',
316
+			'espresso_registration_form_trash_questions'
317
+		)
318
+		) {
319
+			$this->_views['trash'] = array(
320
+				'slug'  => 'trash',
321
+				'label' => esc_html__('Trash', 'event_espresso'),
322
+				'count' => 0,
323
+			);
324
+		}
325
+	}
326
+
327
+	/**
328
+	 * This just previews the question groups tab that comes in caffeinated.
329
+	 *
330
+	 * @return string html
331
+	 */
332
+	protected function _questions_groups_preview()
333
+	{
334
+		$this->_admin_page_title = esc_html__('Question Groups (Preview)', 'event_espresso');
335
+		$this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="'
336
+											   . esc_attr__(
337
+												   'Preview Question Groups Overview List Table screenshot',
338
+												   'event_espresso'
339
+											   ) . '" />';
340
+		$this->_template_args['preview_text'] = '<strong>'
341
+												. esc_html__(
342
+													'Question Groups is a feature that is only available in the premium version of Event Espresso 4 which is available with a support license purchase on EventEspresso.com. With the Question Groups feature you are able to create new question groups, edit existing question groups, and create and edit new questions and add them to question groups.',
343
+													'event_espresso'
344
+												) . '</strong>';
345
+		$this->display_admin_caf_preview_page('question_groups_tab');
346
+	}
347
+
348
+
349
+	/**
350
+	 * Extracts the question field's values from the POST request to update or insert them
351
+	 *
352
+	 * @param \EEM_Base $model
353
+	 * @return array where each key is the name of a model's field/db column, and each value is its value.
354
+	 */
355
+	protected function _set_column_values_for(EEM_Base $model)
356
+	{
357
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
358
+		$set_column_values = array();
359
+
360
+		// some initial checks for proper values.
361
+		// if QST_admin_only, then no matter what QST_required is we disable.
362
+		if (! empty($this->_req_data['QST_admin_only'])) {
363
+			$this->_req_data['QST_required'] = 0;
364
+		}
365
+		// if the question shouldn't have a max length, don't let them set one
366
+		if (! isset(
367
+			$this->_req_data['QST_type'],
368
+			$this->_req_data['QST_max']
369
+		)
370
+			|| ! in_array(
371
+				$this->_req_data['QST_type'],
372
+				EEM_Question::instance()->questionTypesWithMaxLength(),
373
+				true
374
+			)
375
+		) {
376
+			// they're not allowed to set the max
377
+			$this->_req_data['QST_max'] = null;
378
+		}
379
+		foreach ($model->field_settings() as $fieldName => $settings) {
380
+			// basically if QSG_identifier is empty or not set
381
+			if ($fieldName === 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) {
382
+				$QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : '';
383
+				$set_column_values[ $fieldName ] = sanitize_title($QSG_name) . '-' . uniqid('', true);
384
+			} //if the admin label is blank, use a slug version of the question text
385
+			elseif ($fieldName === 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) {
386
+				$QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : '';
387
+				$set_column_values[ $fieldName ] = sanitize_title(wp_trim_words($QST_text, 10));
388
+			} elseif ($fieldName === 'QST_admin_only' && (! isset($this->_req_data['QST_admin_only']))) {
389
+				$set_column_values[ $fieldName ] = 0;
390
+			} elseif ($fieldName === 'QST_max') {
391
+				$qst_system = EEM_Question::instance()->get_var(
392
+					array(
393
+						array(
394
+							'QST_ID' => isset($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0,
395
+						),
396
+					),
397
+					'QST_system'
398
+				);
399
+				$max_max = EEM_Question::instance()->absolute_max_for_system_question($qst_system);
400
+				if (empty($this->_req_data['QST_max']) ||
401
+					$this->_req_data['QST_max'] > $max_max
402
+				) {
403
+					$set_column_values[ $fieldName ] = $max_max;
404
+				}
405
+			}
406
+
407
+
408
+			// only add a property to the array if it's not null (otherwise the model should just use the default value)
409
+			if (! isset($set_column_values[ $fieldName ]) &&
410
+				isset($this->_req_data[ $fieldName ])
411
+			) {
412
+				$set_column_values[ $fieldName ] = $this->_req_data[ $fieldName ];
413
+			}
414
+		}
415
+		return $set_column_values;// validation fo this data to be performed by the model before insertion.
416
+	}
417
+
418
+
419
+	/**
420
+	 *_questions_overview_list_table
421
+	 */
422
+	protected function _questions_overview_list_table()
423
+	{
424
+		$this->_search_btn_label = esc_html__('Questions', 'event_espresso');
425
+		$this->display_admin_list_table_page_with_sidebar();
426
+	}
427
+
428
+
429
+	/**
430
+	 * _edit_question
431
+	 */
432
+	protected function _edit_question()
433
+	{
434
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
435
+		$ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint(
436
+			$this->_req_data['QST_ID']
437
+		) : false;
438
+
439
+		switch ($this->_req_action) {
440
+			case 'add_question':
441
+				$this->_admin_page_title = esc_html__('Add Question', 'event_espresso');
442
+				break;
443
+			case 'edit_question':
444
+				$this->_admin_page_title = esc_html__('Edit Question', 'event_espresso');
445
+				break;
446
+			default:
447
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
448
+		}
449
+
450
+		// add PRC_ID to title if editing
451
+		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
452
+		if ($ID) {
453
+			$question = $this->_question_model->get_one_by_ID($ID);
454
+			$additional_hidden_fields = array('QST_ID' => array('type' => 'hidden', 'value' => $ID));
455
+			$this->_set_add_edit_form_tags('update_question', $additional_hidden_fields);
456
+		} else {
457
+			$question = EE_Question::new_instance();
458
+			$question->set_order_to_latest();
459
+			$this->_set_add_edit_form_tags('insert_question');
460
+		}
461
+		if ($question->system_ID() === EEM_Attendee::system_question_phone) {
462
+			$question_types = array_intersect_key(
463
+				EEM_Question::instance()->allowed_question_types(),
464
+				array_flip(
465
+					array(
466
+						EEM_Question::QST_type_text,
467
+						EEM_Question::QST_type_us_phone,
468
+					)
469
+				)
470
+			);
471
+		} else {
472
+			$question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category(
473
+				$question->type()
474
+			) : $this->_question_model->allowed_question_types();
475
+		}
476
+		$this->_template_args['QST_ID'] = $ID;
477
+		$this->_template_args['question'] = $question;
478
+		$this->_template_args['question_types'] = $question_types;
479
+		$this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question(
480
+			$question->system_ID()
481
+		);
482
+		$this->_template_args['question_type_descriptions'] = $this->_get_question_type_descriptions();
483
+		$this->_set_publish_post_box_vars('id', $ID);
484
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
485
+			REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php',
486
+			$this->_template_args,
487
+			true
488
+		);
489
+
490
+		// the details template wrapper
491
+		$this->display_admin_page_with_sidebar();
492
+	}
493
+
494
+
495
+	/**
496
+	 * @return string
497
+	 */
498
+	protected function _get_question_type_descriptions()
499
+	{
500
+		EE_Registry::instance()->load_helper('HTML');
501
+		$descriptions = '';
502
+		$question_type_descriptions = EEM_Question::instance()->question_descriptions();
503
+		foreach ($question_type_descriptions as $type => $question_type_description) {
504
+			if ($type == 'HTML_TEXTAREA') {
505
+				$html = new EE_Simple_HTML_Validation_Strategy();
506
+				$question_type_description .= sprintf(
507
+					esc_html__('%1$s(allowed tags: %2$s)', 'event_espresso'),
508
+					'<br/>',
509
+					$html->get_list_of_allowed_tags()
510
+				);
511
+			}
512
+			$descriptions .= EEH_HTML::p(
513
+				$question_type_description,
514
+				'question_type_description-' . $type,
515
+				'question_type_description description',
516
+				'display:none;'
517
+			);
518
+		}
519
+		return $descriptions;
520
+	}
521
+
522
+
523
+	/**
524
+	 * @param bool|true $new_question
525
+	 * @throws \EE_Error
526
+	 */
527
+	protected function _insert_or_update_question($new_question = true)
528
+	{
529
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
530
+		$set_column_values = $this->_set_column_values_for($this->_question_model);
531
+		if ($new_question) {
532
+			$question = EE_Question::new_instance($set_column_values);
533
+			$action_desc = 'added';
534
+		} else {
535
+			$question = EEM_Question::instance()->get_one_by_ID(absint($this->_req_data['QST_ID']));
536
+			foreach ($set_column_values as $field => $new_value) {
537
+				$question->set($field, $new_value);
538
+			}
539
+			$action_desc = 'updated';
540
+		}
541
+		$success = $question->save();
542
+		$ID = $question->ID();
543
+		if ($ID && $question->should_have_question_options()) {
544
+			// save the related options
545
+			// trash removed options, save old ones
546
+			// get list of all options
547
+			$options = $question->options();
548
+			if (! empty($options)) {
549
+				foreach ($options as $option_ID => $option) {
550
+					$option_req_index = $this->_get_option_req_data_index($option_ID);
551
+					if ($option_req_index !== false) {
552
+						$option->save($this->_req_data['question_options'][ $option_req_index ]);
553
+					} else {
554
+						// not found, remove it
555
+						$option->delete();
556
+					}
557
+				}
558
+			}
559
+			// save new related options
560
+			foreach ($this->_req_data['question_options'] as $index => $option_req_data) {
561
+				// skip $index that is from our sample
562
+				if ($index === 'xxcountxx') {
563
+					continue;
564
+				}
565
+				// note we allow saving blank options.
566
+				if (empty($option_req_data['QSO_ID'])
567
+				) {// no ID! save it!
568
+					$new_option = EE_Question_Option::new_instance(
569
+						array(
570
+							'QSO_value' => $option_req_data['QSO_value'],
571
+							'QSO_desc'  => $option_req_data['QSO_desc'],
572
+							'QSO_order' => $option_req_data['QSO_order'],
573
+							'QST_ID'    => $question->ID(),
574
+						)
575
+					);
576
+					$new_option->save();
577
+				}
578
+			}
579
+		}
580
+		$query_args = array('action' => 'edit_question', 'QST_ID' => $ID);
581
+		if ($success !== false) {
582
+			$msg = $new_question
583
+				? sprintf(
584
+					esc_html__('The %s has been created', 'event_espresso'),
585
+					$this->_question_model->item_name()
586
+				)
587
+				: sprintf(
588
+					esc_html__('The %s has been updated', 'event_espresso'),
589
+					$this->_question_model->item_name()
590
+				);
591
+			EE_Error::add_success($msg);
592
+		}
593
+
594
+		$this->_redirect_after_action(false, '', $action_desc, $query_args, true);
595
+	}
596
+
597
+
598
+	/**
599
+	 * Upon saving a question, there should be an array of 'question_options'. This array is index numerically, but not
600
+	 * by ID
601
+	 * (this is done because new question options don't have an ID, but we may want to add multiple simultaneously).
602
+	 * So, this function gets the index in that request data array called question_options. Returns FALSE if not found.
603
+	 *
604
+	 * @param int $ID of the question option to find
605
+	 * @return int index in question_options array if successful, FALSE if unsuccessful
606
+	 */
607
+	protected function _get_option_req_data_index($ID)
608
+	{
609
+		$req_data_for_question_options = $this->_req_data['question_options'];
610
+		foreach ($req_data_for_question_options as $num => $option_data) {
611
+			if (array_key_exists('QSO_ID', $option_data) && (int) $option_data['QSO_ID'] === $ID) {
612
+				return $num;
613
+			}
614
+		}
615
+		return false;
616
+	}
617
+
618
+
619
+
620
+
621
+	/***********/
622
+	/* QUERIES */
623
+	/**
624
+	 * For internal use in getting all the query parameters
625
+	 * (because it's pretty well the same between question, question groups,
626
+	 * and for both when searching for trashed and untrashed ones)
627
+	 *
628
+	 * @param EEM_Base $model either EEM_Question or EEM_Question_Group
629
+	 * @param int      $per_page
630
+	 * @param int      $current_page
631
+	 * @return array model query params, @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
632
+	 */
633
+	protected function get_query_params($model, $per_page = 10, $current_page = 10)
634
+	{
635
+		$query_params = array();
636
+		$offset = ($current_page - 1) * $per_page;
637
+		$query_params['limit'] = array($offset, $per_page);
638
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order']
639
+			: 'ASC';
640
+		$orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order';
641
+		$field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby'];
642
+		$query_params['order_by'] = array($field_to_order_by => $order);
643
+		$search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null;
644
+		if (! empty($search_string)) {
645
+			if ($model instanceof EEM_Question_Group) {
646
+				$query_params[0] = array(
647
+					'OR' => array(
648
+						'QSG_name' => array('LIKE', "%$search_string%"),
649
+						'QSG_desc' => array('LIKE', "%$search_string%"),
650
+					),
651
+				);
652
+			} else {
653
+				$query_params[0] = array(
654
+					'QST_display_text' => array('LIKE', "%$search_string%"),
655
+				);
656
+			}
657
+		}
658
+
659
+		// capability checks (just leaving this commented out for reference because it illustrates some complicated query params that could be useful when fully implemented)
660
+		/*if ( $model instanceof EEM_Question_Group ) {
661 661
             if ( ! EE_Registry::instance()->CAP->current_user_can( 'edit_others_question_groups', 'espresso_registration_form_edit_question_group' ) ) {
662 662
                 $query_params[0] = array(
663 663
                     'AND' => array(
@@ -687,59 +687,59 @@  discard block
 block discarded – undo
687 687
             }
688 688
         }/**/
689 689
 
690
-        return $query_params;
691
-    }
692
-
693
-
694
-    /**
695
-     * @param int        $per_page
696
-     * @param int        $current_page
697
-     * @param bool|false $count
698
-     * @return \EE_Soft_Delete_Base_Class[]|int
699
-     */
700
-    public function get_questions($per_page = 10, $current_page = 1, $count = false)
701
-    {
702
-        $QST = EEM_Question::instance();
703
-        $query_params = $this->get_query_params($QST, $per_page, $current_page);
704
-        if ($count) {
705
-            $where = isset($query_params[0]) ? array($query_params[0]) : array();
706
-            $results = $QST->count($where);
707
-        } else {
708
-            $results = $QST->get_all($query_params);
709
-        }
710
-        return $results;
711
-    }
712
-
713
-
714
-    /**
715
-     * @param            $per_page
716
-     * @param int        $current_page
717
-     * @param bool|false $count
718
-     * @return \EE_Soft_Delete_Base_Class[]|int
719
-     */
720
-    public function get_trashed_questions($per_page, $current_page = 1, $count = false)
721
-    {
722
-        $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
723
-        $where = isset($query_params[0]) ? array($query_params[0]) : array();
724
-        $questions = $count ? EEM_Question::instance()->count_deleted($where)
725
-            : EEM_Question::instance()->get_all_deleted($query_params);
726
-        return $questions;
727
-    }
728
-
729
-
730
-    /**
731
-     * @param            $per_page
732
-     * @param int        $current_page
733
-     * @param bool|false $count
734
-     * @return \EE_Soft_Delete_Base_Class[]
735
-     */
736
-    public function get_question_groups($per_page, $current_page = 1, $count = false)
737
-    {
738
-        /** @type EEM_Question_Group $questionGroupModel */
739
-        $questionGroupModel = EEM_Question_Group::instance();
740
-        // note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
741
-        return $questionGroupModel->get_all(
742
-            $this->get_query_params($questionGroupModel, $per_page, $current_page)
743
-        );
744
-    }
690
+		return $query_params;
691
+	}
692
+
693
+
694
+	/**
695
+	 * @param int        $per_page
696
+	 * @param int        $current_page
697
+	 * @param bool|false $count
698
+	 * @return \EE_Soft_Delete_Base_Class[]|int
699
+	 */
700
+	public function get_questions($per_page = 10, $current_page = 1, $count = false)
701
+	{
702
+		$QST = EEM_Question::instance();
703
+		$query_params = $this->get_query_params($QST, $per_page, $current_page);
704
+		if ($count) {
705
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
706
+			$results = $QST->count($where);
707
+		} else {
708
+			$results = $QST->get_all($query_params);
709
+		}
710
+		return $results;
711
+	}
712
+
713
+
714
+	/**
715
+	 * @param            $per_page
716
+	 * @param int        $current_page
717
+	 * @param bool|false $count
718
+	 * @return \EE_Soft_Delete_Base_Class[]|int
719
+	 */
720
+	public function get_trashed_questions($per_page, $current_page = 1, $count = false)
721
+	{
722
+		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
723
+		$where = isset($query_params[0]) ? array($query_params[0]) : array();
724
+		$questions = $count ? EEM_Question::instance()->count_deleted($where)
725
+			: EEM_Question::instance()->get_all_deleted($query_params);
726
+		return $questions;
727
+	}
728
+
729
+
730
+	/**
731
+	 * @param            $per_page
732
+	 * @param int        $current_page
733
+	 * @param bool|false $count
734
+	 * @return \EE_Soft_Delete_Base_Class[]
735
+	 */
736
+	public function get_question_groups($per_page, $current_page = 1, $count = false)
737
+	{
738
+		/** @type EEM_Question_Group $questionGroupModel */
739
+		$questionGroupModel = EEM_Question_Group::instance();
740
+		// note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
741
+		return $questionGroupModel->get_all(
742
+			$this->get_query_params($questionGroupModel, $per_page, $current_page)
743
+		);
744
+	}
745 745
 }
Please login to merge, or discard this patch.
espresso_ticket_selector/EES_Espresso_Ticket_Selector.shortcode.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -10,50 +10,50 @@
 block discarded – undo
10 10
 class EES_Espresso_Ticket_Selector extends EES_Shortcode
11 11
 {
12 12
 
13
-    /**
14
-     * @deprecated 4.9.27
15
-     * @return  void
16
-     */
17
-    public static function set_hooks()
18
-    {
19
-    }
20
-
21
-
22
-
23
-    /**
24
-     * @deprecated 4.9.27
25
-     * @return  void
26
-     */
27
-    public static function set_hooks_admin()
28
-    {
29
-    }
30
-
31
-
32
-
33
-    /**
34
-     * @deprecated 4.9.27
35
-     * @param \WP $WP
36
-     */
37
-    public function run(WP $WP)
38
-    {
39
-    }
40
-
41
-
42
-    /**
43
-     * @deprecated 4.9.27
44
-     * @param       array   $attributes
45
-     * @return  string
46
-     */
47
-    public function process_shortcode($attributes = array())
48
-    {
49
-        \EE_Error::doing_it_wrong(
50
-            __METHOD__,
51
-            __(
52
-                'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector instead.',
53
-                'event_espresso'
54
-            ),
55
-            '4.9.27'
56
-        );
57
-        return '';
58
-    }
13
+	/**
14
+	 * @deprecated 4.9.27
15
+	 * @return  void
16
+	 */
17
+	public static function set_hooks()
18
+	{
19
+	}
20
+
21
+
22
+
23
+	/**
24
+	 * @deprecated 4.9.27
25
+	 * @return  void
26
+	 */
27
+	public static function set_hooks_admin()
28
+	{
29
+	}
30
+
31
+
32
+
33
+	/**
34
+	 * @deprecated 4.9.27
35
+	 * @param \WP $WP
36
+	 */
37
+	public function run(WP $WP)
38
+	{
39
+	}
40
+
41
+
42
+	/**
43
+	 * @deprecated 4.9.27
44
+	 * @param       array   $attributes
45
+	 * @return  string
46
+	 */
47
+	public function process_shortcode($attributes = array())
48
+	{
49
+		\EE_Error::doing_it_wrong(
50
+			__METHOD__,
51
+			__(
52
+				'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector instead.',
53
+				'event_espresso'
54
+			),
55
+			'4.9.27'
56
+		);
57
+		return '';
58
+	}
59 59
 }
Please login to merge, or discard this patch.
shortcodes/espresso_txn_page/EES_Espresso_Txn_Page.shortcode.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -11,55 +11,55 @@
 block discarded – undo
11 11
 {
12 12
 
13 13
 
14
-    /**
15
-     * @deprecated 4.9.27
16
-     * @return  void
17
-     */
18
-    public static function set_hooks()
19
-    {
20
-    }
14
+	/**
15
+	 * @deprecated 4.9.27
16
+	 * @return  void
17
+	 */
18
+	public static function set_hooks()
19
+	{
20
+	}
21 21
 
22
-    /**
23
-     * @deprecated 4.9.27
24
-     * @return  void
25
-     */
26
-    public static function set_hooks_admin()
27
-    {
28
-    }
22
+	/**
23
+	 * @deprecated 4.9.27
24
+	 * @return  void
25
+	 */
26
+	public static function set_hooks_admin()
27
+	{
28
+	}
29 29
 
30 30
 
31 31
 
32
-    /**
33
-     * @deprecated 4.9.27
34
-     * @return  void
35
-     */
36
-    public static function set_definitions()
37
-    {
38
-    }
32
+	/**
33
+	 * @deprecated 4.9.27
34
+	 * @return  void
35
+	 */
36
+	public static function set_definitions()
37
+	{
38
+	}
39 39
 
40 40
 
41 41
 
42
-    /**
43
-     * @deprecated 4.9.27
44
-     * @param  WP $WP
45
-     * @return void
46
-     * @throws \Exception
47
-     * @throws \EE_Error
48
-     */
49
-    public function run(WP $WP)
50
-    {
51
-    }
42
+	/**
43
+	 * @deprecated 4.9.27
44
+	 * @param  WP $WP
45
+	 * @return void
46
+	 * @throws \Exception
47
+	 * @throws \EE_Error
48
+	 */
49
+	public function run(WP $WP)
50
+	{
51
+	}
52 52
 
53 53
 
54 54
 
55 55
 
56
-    /**
57
-     * @deprecated 4.9.27
58
-     * @param array $attributes
59
-     * @return string
60
-     */
61
-    public function process_shortcode($attributes = array())
62
-    {
63
-        return __('This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso');
64
-    }
56
+	/**
57
+	 * @deprecated 4.9.27
58
+	 * @param array $attributes
59
+	 * @return string
60
+	 */
61
+	public function process_shortcode($attributes = array())
62
+	{
63
+		return __('This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso');
64
+	}
65 65
 }
Please login to merge, or discard this patch.
shortcodes/espresso_events/EES_Espresso_Events.shortcode.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -10,50 +10,50 @@
 block discarded – undo
10 10
 class EES_Espresso_Events extends EES_Shortcode
11 11
 {
12 12
 
13
-    /**
14
-     * @deprecated 4.9.27
15
-     *  @return     void
16
-     */
17
-    public static function set_hooks()
18
-    {
19
-    }
20
-
21
-    /**
22
-     * @deprecated 4.9.27
23
-     *  @return     void
24
-     */
25
-    public static function set_hooks_admin()
26
-    {
27
-    }
28
-
29
-
30
-
31
-    /**
32
-     * @deprecated 4.9.27
33
-     * @param WP $WP
34
-     * @return    void
35
-     */
36
-    public function run(WP $WP)
37
-    {
38
-    }
39
-
40
-
41
-
42
-    /**
43
-     * @deprecated 4.9.27
44
-     *  @param  array   $attributes
45
-     *  @return     string
46
-     */
47
-    public function process_shortcode($attributes = array())
48
-    {
49
-        \EE_Error::doing_it_wrong(
50
-            __METHOD__,
51
-            __(
52
-                'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoEvents instead.',
53
-                'event_espresso'
54
-            ),
55
-            '4.9.27'
56
-        );
57
-        return '';
58
-    }
13
+	/**
14
+	 * @deprecated 4.9.27
15
+	 *  @return     void
16
+	 */
17
+	public static function set_hooks()
18
+	{
19
+	}
20
+
21
+	/**
22
+	 * @deprecated 4.9.27
23
+	 *  @return     void
24
+	 */
25
+	public static function set_hooks_admin()
26
+	{
27
+	}
28
+
29
+
30
+
31
+	/**
32
+	 * @deprecated 4.9.27
33
+	 * @param WP $WP
34
+	 * @return    void
35
+	 */
36
+	public function run(WP $WP)
37
+	{
38
+	}
39
+
40
+
41
+
42
+	/**
43
+	 * @deprecated 4.9.27
44
+	 *  @param  array   $attributes
45
+	 *  @return     string
46
+	 */
47
+	public function process_shortcode($attributes = array())
48
+	{
49
+		\EE_Error::doing_it_wrong(
50
+			__METHOD__,
51
+			__(
52
+				'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoEvents instead.',
53
+				'event_espresso'
54
+			),
55
+			'4.9.27'
56
+		);
57
+		return '';
58
+	}
59 59
 }
Please login to merge, or discard this patch.
shortcodes/espresso_checkout/EES_Espresso_Checkout.shortcode.php 1 patch
Indentation   +49 added lines, -50 removed lines patch added patch discarded remove patch
@@ -6,66 +6,65 @@
 block discarded – undo
6 6
  * @package     Event Espresso
7 7
  * @subpackage  /shortcodes/
8 8
  * @author      Brent Christensen
9
-
10 9
  * ------------------------------------------------------------------------
11 10
  */
12 11
 class EES_Espresso_Checkout extends EES_Shortcode
13 12
 {
14 13
 
15
-    /**
16
-     *  set_hooks - for hooking into EE Core, modules, etc
17
-     *
18
-     *  @access     public
19
-     *  @return     void
20
-     */
21
-    public static function set_hooks()
22
-    {
23
-    }
14
+	/**
15
+	 *  set_hooks - for hooking into EE Core, modules, etc
16
+	 *
17
+	 *  @access     public
18
+	 *  @return     void
19
+	 */
20
+	public static function set_hooks()
21
+	{
22
+	}
24 23
 
25
-    /**
26
-     *  set_hooks_admin - for hooking into EE Admin Core, modules, etc
27
-     *
28
-     *  @access     public
29
-     *  @return     void
30
-     */
31
-    public static function set_hooks_admin()
32
-    {
33
-    }
24
+	/**
25
+	 *  set_hooks_admin - for hooking into EE Admin Core, modules, etc
26
+	 *
27
+	 *  @access     public
28
+	 *  @return     void
29
+	 */
30
+	public static function set_hooks_admin()
31
+	{
32
+	}
34 33
 
35 34
 
36 35
 
37
-    /**
38
-     *    run - initial shortcode module setup called during "wp_loaded" hook
39
-     *    this method is primarily used for loading resources that will be required by the shortcode when it is actually processed
40
-     *
41
-     * @access    public
42
-     * @param WP $WP
43
-     * @return    void
44
-     * @throws \EE_Error
45
-     */
46
-    public function run(WP $WP)
47
-    {
48
-    }
36
+	/**
37
+	 *    run - initial shortcode module setup called during "wp_loaded" hook
38
+	 *    this method is primarily used for loading resources that will be required by the shortcode when it is actually processed
39
+	 *
40
+	 * @access    public
41
+	 * @param WP $WP
42
+	 * @return    void
43
+	 * @throws \EE_Error
44
+	 */
45
+	public function run(WP $WP)
46
+	{
47
+	}
49 48
 
50 49
 
51 50
 
52
-    /**
53
-     *  process_shortcode - ESPRESSO_CHECKOUT
54
-     *
55
-     *  @access     public
56
-     *  @param      array   $attributes
57
-     *  @return     string
58
-     */
59
-    public function process_shortcode($attributes = array())
60
-    {
61
-        \EE_Error::doing_it_wrong(
62
-            __METHOD__,
63
-            __(
64
-                'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoCheckout::processShortcode() instead.',
65
-                'event_espresso'
66
-            ),
67
-            '4.9.27'
68
-        );
69
-        return '';
70
-    }
51
+	/**
52
+	 *  process_shortcode - ESPRESSO_CHECKOUT
53
+	 *
54
+	 *  @access     public
55
+	 *  @param      array   $attributes
56
+	 *  @return     string
57
+	 */
58
+	public function process_shortcode($attributes = array())
59
+	{
60
+		\EE_Error::doing_it_wrong(
61
+			__METHOD__,
62
+			__(
63
+				'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoCheckout::processShortcode() instead.',
64
+				'event_espresso'
65
+			),
66
+			'4.9.27'
67
+		);
68
+		return '';
69
+	}
71 70
 }
Please login to merge, or discard this patch.