Completed
Branch models-cleanup/model-relations (db5ca7)
by
unknown
13:03 queued 08:35
created
core/exceptions/ModelConfigurationException.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@
 block discarded – undo
18 18
  */
19 19
 class ModelConfigurationException extends DomainException
20 20
 {
21
-    /**
22
-     * ModelConfigurationException constructor.
23
-     *
24
-     * @param EEM_Base $model
25
-     * @param string $message Describe what's misconfigured about this model (don't bother mentioning which model,
26
-     * that will be automatically added to the message based on the $model provided in the previous parameter).
27
-     * @param int $code
28
-     * @param Exception $previous
29
-     */
30
-    public function __construct(EEM_Base $model, $message, $code = 0, Exception $previous = null)
31
-    {
32
-        $message_part_1 = sprintf(
33
-            /*
21
+	/**
22
+	 * ModelConfigurationException constructor.
23
+	 *
24
+	 * @param EEM_Base $model
25
+	 * @param string $message Describe what's misconfigured about this model (don't bother mentioning which model,
26
+	 * that will be automatically added to the message based on the $model provided in the previous parameter).
27
+	 * @param int $code
28
+	 * @param Exception $previous
29
+	 */
30
+	public function __construct(EEM_Base $model, $message, $code = 0, Exception $previous = null)
31
+	{
32
+		$message_part_1 = sprintf(
33
+			/*
34 34
              * translators: 1: the model name
35 35
              */
36
-            esc_html__('The model "%1$s" appears to be misconfigured.', 'event_espresso'),
37
-            $model->get_this_model_name()
38
-        );
39
-        $message = $message_part_1 . ' ' . $message;
40
-        parent::__construct($message, $code, $previous);
41
-    }
36
+			esc_html__('The model "%1$s" appears to be misconfigured.', 'event_espresso'),
37
+			$model->get_this_model_name()
38
+		);
39
+		$message = $message_part_1 . ' ' . $message;
40
+		parent::__construct($message, $code, $previous);
41
+	}
42 42
 }
43 43
 // End of file ModelConfigurationException.php
44 44
 // Location: EventEspresso\core\exceptions/ModelConfigurationException.php
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
             esc_html__('The model "%1$s" appears to be misconfigured.', 'event_espresso'),
37 37
             $model->get_this_model_name()
38 38
         );
39
-        $message = $message_part_1 . ' ' . $message;
39
+        $message = $message_part_1.' '.$message;
40 40
         parent::__construct($message, $code, $previous);
41 41
     }
42 42
 }
Please login to merge, or discard this patch.
core/exceptions/RestPasswordIncorrectException.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@
 block discarded – undo
16 16
  */
17 17
 class RestPasswordIncorrectException extends RestException
18 18
 {
19
-    public function __construct($previous = null)
20
-    {
21
-        parent::__construct(
22
-            'rest_post_incorrect_password',
23
-            esc_html__('Incorrect password.', 'event_espresso'),
24
-            array(
25
-                'status' => 403,
26
-            ),
27
-            $previous
28
-        );
29
-    }
19
+	public function __construct($previous = null)
20
+	{
21
+		parent::__construct(
22
+			'rest_post_incorrect_password',
23
+			esc_html__('Incorrect password.', 'event_espresso'),
24
+			array(
25
+				'status' => 403,
26
+			),
27
+			$previous
28
+		);
29
+	}
30 30
 }
31 31
 // End of file RestPasswordIncorrectException.php
32 32
 // Location: EventEspresso\core\exceptions/RestPasswordIncorrectException.php
Please login to merge, or discard this patch.
core/db_models/fields/EE_Password_Field.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -12,45 +12,45 @@
 block discarded – undo
12 12
  */
13 13
 class EE_Password_Field extends EE_Text_Field_Base
14 14
 {
15
-    /**
16
-     * @var array
17
-     */
18
-    protected $protected_fields;
15
+	/**
16
+	 * @var array
17
+	 */
18
+	protected $protected_fields;
19 19
 
20
-    /**
21
-     * EE_Password_Field constructor.
22
-     * @param $table_column
23
-     * @param $nicename
24
-     * @param $nullable
25
-     * @param null $default_value
26
-     * @param array $protected_fields
27
-     */
28
-    public function __construct($table_column, $nicename, $nullable, $default_value = null, $protected_fields = array())
29
-    {
30
-        $this->protected_fields = $protected_fields;
31
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
32
-    }
20
+	/**
21
+	 * EE_Password_Field constructor.
22
+	 * @param $table_column
23
+	 * @param $nicename
24
+	 * @param $nullable
25
+	 * @param null $default_value
26
+	 * @param array $protected_fields
27
+	 */
28
+	public function __construct($table_column, $nicename, $nullable, $default_value = null, $protected_fields = array())
29
+	{
30
+		$this->protected_fields = $protected_fields;
31
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
32
+	}
33 33
 
34
-    /**
35
-     * Returns the names of the fields on this model that this password field should protect
36
-     * @since 4.9.74.p
37
-     * @return array
38
-     */
39
-    public function protectedFields()
40
-    {
41
-        return $this->protected_fields;
42
-    }
34
+	/**
35
+	 * Returns the names of the fields on this model that this password field should protect
36
+	 * @since 4.9.74.p
37
+	 * @return array
38
+	 */
39
+	public function protectedFields()
40
+	{
41
+		return $this->protected_fields;
42
+	}
43 43
 
44
-    /**
45
-     * Returns whether or not the specified field is protected by this model
46
-     * @since 4.9.74.p
47
-     * @param $field_name
48
-     * @return bool
49
-     */
50
-    public function fieldIsProtected($field_name)
51
-    {
52
-        return in_array($field_name, $this->protectedFields(), true);
53
-    }
44
+	/**
45
+	 * Returns whether or not the specified field is protected by this model
46
+	 * @since 4.9.74.p
47
+	 * @param $field_name
48
+	 * @return bool
49
+	 */
50
+	public function fieldIsProtected($field_name)
51
+	{
52
+		return in_array($field_name, $this->protectedFields(), true);
53
+	}
54 54
 }
55 55
 // End of file EE_Password_Field.php
56 56
 // Location: ${NAMESPACE}/EE_Password_Field.php
Please login to merge, or discard this patch.
core/domain/services/admin/ajax/EventEditorHeartbeat.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -16,52 +16,52 @@
 block discarded – undo
16 16
 class EventEditorHeartbeat
17 17
 {
18 18
 
19
-    /**
20
-     * @var Domain $domain
21
-     */
22
-    protected $domain;
19
+	/**
20
+	 * @var Domain $domain
21
+	 */
22
+	protected $domain;
23 23
 
24
-    /**
25
-     * @var EE_Environment_Config $environment
26
-     */
27
-    protected $environment;
24
+	/**
25
+	 * @var EE_Environment_Config $environment
26
+	 */
27
+	protected $environment;
28 28
 
29 29
 
30
-    /**
31
-     * EventEditorHeartbeat constructor.
32
-     *
33
-     * @param Domain                $domain
34
-     * @param EE_Environment_Config $environment
35
-     */
36
-    public function __construct(Domain $domain, EE_Environment_Config $environment)
37
-    {
38
-        $this->domain = $domain;
39
-        $this->environment = $environment;
40
-        if ($this->domain->isCaffeinated()) {
41
-            add_filter('heartbeat_received', array($this, 'heartbeatResponse'), 10, 2);
42
-        }
43
-    }
30
+	/**
31
+	 * EventEditorHeartbeat constructor.
32
+	 *
33
+	 * @param Domain                $domain
34
+	 * @param EE_Environment_Config $environment
35
+	 */
36
+	public function __construct(Domain $domain, EE_Environment_Config $environment)
37
+	{
38
+		$this->domain = $domain;
39
+		$this->environment = $environment;
40
+		if ($this->domain->isCaffeinated()) {
41
+			add_filter('heartbeat_received', array($this, 'heartbeatResponse'), 10, 2);
42
+		}
43
+	}
44 44
 
45 45
 
46
-    /**
47
-     * This will be used to listen for any heartbeat data packages coming via the WordPress heartbeat API and handle
48
-     * accordingly.
49
-     *
50
-     * @param array $response The existing heartbeat response array.
51
-     * @param array $data     The incoming data package.
52
-     * @return array  possibly appended response.
53
-     */
54
-    public function heartbeatResponse($response, $data)
55
-    {
56
-        /**
57
-         * check whether count of tickets is approaching the potential
58
-         * limits for the server.
59
-         */
60
-        if (! empty($data['input_count'])) {
61
-            $response['max_input_vars_check'] = $this->environment->max_input_vars_limit_check(
62
-                $data['input_count']
63
-            );
64
-        }
65
-        return $response;
66
-    }
46
+	/**
47
+	 * This will be used to listen for any heartbeat data packages coming via the WordPress heartbeat API and handle
48
+	 * accordingly.
49
+	 *
50
+	 * @param array $response The existing heartbeat response array.
51
+	 * @param array $data     The incoming data package.
52
+	 * @return array  possibly appended response.
53
+	 */
54
+	public function heartbeatResponse($response, $data)
55
+	{
56
+		/**
57
+		 * check whether count of tickets is approaching the potential
58
+		 * limits for the server.
59
+		 */
60
+		if (! empty($data['input_count'])) {
61
+			$response['max_input_vars_check'] = $this->environment->max_input_vars_limit_check(
62
+				$data['input_count']
63
+			);
64
+		}
65
+		return $response;
66
+	}
67 67
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
          * check whether count of tickets is approaching the potential
58 58
          * limits for the server.
59 59
          */
60
-        if (! empty($data['input_count'])) {
60
+        if ( ! empty($data['input_count'])) {
61 61
             $response['max_input_vars_check'] = $this->environment->max_input_vars_limit_check(
62 62
                 $data['input_count']
63 63
             );
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/forms/PayPalProSettingsForm.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -17,30 +17,30 @@
 block discarded – undo
17 17
  */
18 18
 class PayPalProSettingsForm extends PayPalSettingsForm
19 19
 {
20
-    /**
21
-     * SettingsForm constructor.
22
-     *
23
-     * @param array $options_array
24
-     * @param string $help_tab_link
25
-     */
26
-    public function __construct(array $options_array = array(), $help_tab_link = '')
27
-    {
28
-        $options_array = array_replace_recursive(
29
-            array(
30
-                'extra_meta_inputs' => array(
31
-                    'credit_card_types' => new EE_Checkbox_Multi_Input(
32
-                        EE_PMT_Paypal_Pro::card_types_supported(),
33
-                        array(
34
-                            'html_label_text' => __('Card Types Supported', 'event_espresso'),
35
-                            'required' => true
36
-                        )
37
-                    ),
38
-                )
39
-            ),
40
-            $options_array
41
-        );
42
-        parent::__construct($options_array, $help_tab_link);
43
-    }
20
+	/**
21
+	 * SettingsForm constructor.
22
+	 *
23
+	 * @param array $options_array
24
+	 * @param string $help_tab_link
25
+	 */
26
+	public function __construct(array $options_array = array(), $help_tab_link = '')
27
+	{
28
+		$options_array = array_replace_recursive(
29
+			array(
30
+				'extra_meta_inputs' => array(
31
+					'credit_card_types' => new EE_Checkbox_Multi_Input(
32
+						EE_PMT_Paypal_Pro::card_types_supported(),
33
+						array(
34
+							'html_label_text' => __('Card Types Supported', 'event_espresso'),
35
+							'required' => true
36
+						)
37
+					),
38
+				)
39
+			),
40
+			$options_array
41
+		);
42
+		parent::__construct($options_array, $help_tab_link);
43
+	}
44 44
 }
45 45
 // End of file SettingsForm.php
46 46
 // Location: EventEspresso/caffeinated/payment_methods/PayPal_Pro/forms/PayPalProSettingsForm.php
Please login to merge, or discard this patch.
payment_methods/Paypal_Express/forms/SettingsForm.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -19,53 +19,53 @@
 block discarded – undo
19 19
  */
20 20
 class SettingsForm extends PayPalSettingsForm
21 21
 {
22
-    /**
23
-     * SettingsForm constructor.
24
-     *
25
-     * @param array $options_array
26
-     * @param string $help_tab_link
27
-     * @throws InvalidDataTypeException
28
-     * @throws InvalidInterfaceException
29
-     * @throws InvalidArgumentException
30
-     */
31
-    public function __construct(array $options_array = array(), $help_tab_link = '')
32
-    {
33
-        $options_array = array_replace_recursive(
34
-            array(
35
-                'extra_meta_inputs' => array(
36
-                    'request_shipping_addr' => new EE_Yes_No_Input(
37
-                        array(
38
-                            'html_label_text' => sprintf(
39
-                                esc_html__('Request Shipping Address %s', 'event_espresso'),
40
-                                $help_tab_link
41
-                            ),
42
-                            'html_help_text'  => esc_html__(
43
-                            // @codingStandardsIgnoreStart
44
-                                'If set to "Yes", then a shipping address will be requested on the PayPal checkout page.',
45
-                                // @codingStandardsIgnoreEnd
46
-                                'event_espresso'
47
-                            ),
48
-                            'required'        => true,
49
-                            'default'         => false,
50
-                        )
51
-                    ),
52
-                    'image_url' => new EE_Admin_File_Uploader_Input(
53
-                        array(
54
-                            'html_label_text' => sprintf(
55
-                                esc_html__('Image URL %s', 'event_espresso'),
56
-                                $help_tab_link
57
-                            ),
58
-                            'html_help_text'  => esc_html__(
59
-                                'Used for your business/personal logo on the PayPal page',
60
-                                'event_espresso'
61
-                            ),
62
-                            'required'        => false,
63
-                        )
64
-                    ),
65
-                )
66
-            ),
67
-            $options_array
68
-        );
69
-        parent::__construct($options_array, $help_tab_link);
70
-    }
22
+	/**
23
+	 * SettingsForm constructor.
24
+	 *
25
+	 * @param array $options_array
26
+	 * @param string $help_tab_link
27
+	 * @throws InvalidDataTypeException
28
+	 * @throws InvalidInterfaceException
29
+	 * @throws InvalidArgumentException
30
+	 */
31
+	public function __construct(array $options_array = array(), $help_tab_link = '')
32
+	{
33
+		$options_array = array_replace_recursive(
34
+			array(
35
+				'extra_meta_inputs' => array(
36
+					'request_shipping_addr' => new EE_Yes_No_Input(
37
+						array(
38
+							'html_label_text' => sprintf(
39
+								esc_html__('Request Shipping Address %s', 'event_espresso'),
40
+								$help_tab_link
41
+							),
42
+							'html_help_text'  => esc_html__(
43
+							// @codingStandardsIgnoreStart
44
+								'If set to "Yes", then a shipping address will be requested on the PayPal checkout page.',
45
+								// @codingStandardsIgnoreEnd
46
+								'event_espresso'
47
+							),
48
+							'required'        => true,
49
+							'default'         => false,
50
+						)
51
+					),
52
+					'image_url' => new EE_Admin_File_Uploader_Input(
53
+						array(
54
+							'html_label_text' => sprintf(
55
+								esc_html__('Image URL %s', 'event_espresso'),
56
+								$help_tab_link
57
+							),
58
+							'html_help_text'  => esc_html__(
59
+								'Used for your business/personal logo on the PayPal page',
60
+								'event_espresso'
61
+							),
62
+							'required'        => false,
63
+						)
64
+					),
65
+				)
66
+			),
67
+			$options_array
68
+		);
69
+		parent::__construct($options_array, $help_tab_link);
70
+	}
71 71
 }
Please login to merge, or discard this patch.
registration_form/espresso_events_Registration_Form_Hooks_Extend.class.php 2 patches
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -16,208 +16,208 @@
 block discarded – undo
16 16
 class espresso_events_Registration_Form_Hooks_Extend extends espresso_events_Registration_Form_Hooks
17 17
 {
18 18
 
19
-    /**
20
-     * extending the properties set in espresso_events_Registration_From_Hooks
21
-     *
22
-     * @access protected
23
-     * @return void
24
-     */
25
-    protected function _extend_properties()
26
-    {
27
-        $this->_metaboxes = array_merge(
28
-            $this->_metaboxes,
29
-            array(
30
-                1 => array(
31
-                    'page_route' => array('create_new', 'edit'),
32
-                    'func'       => 'additional_questions',
33
-                    'label'      => esc_html__('Questions for Additional Registrants', 'event_espresso'),
34
-                    'priority'   => 'default',
35
-                    'context'    => 'side',
36
-                ),
37
-            )
38
-        );
39
-        $this->_scripts_styles = array(
40
-            'registers' => array(
41
-                'extended-event-editor' => array(
42
-                    'url'     => EE_CORE_CAF_ADMIN_EXTEND_URL
43
-                                 . 'registration_form/assets/event-editor-question-groups.js',
44
-                    'depends' => array('jquery'),
45
-                ),
46
-            ),
47
-            'enqueues'  => array(
48
-                'extended-event-editor' => array('edit', 'create_new'),
49
-            ),
50
-        );
51
-    }
52
-
53
-
54
-    /**
55
-     * @param Callable[] $callbacks
56
-     * @return array
57
-     */
58
-    public function modify_callbacks($callbacks)
59
-    {
60
-        $callbacks = parent::modify_callbacks($callbacks);
61
-        $callbacks[] = array($this, 'additional_question_group_update');
62
-        return $callbacks;
63
-    }
64
-
65
-
66
-    /**
67
-     * Call back hooked into revision restores.
68
-     *
69
-     * @param $post_id
70
-     * @param $revision_id
71
-     * @return EE_Base_Class|void
72
-     * @throws EE_Error
73
-     * @throws InvalidArgumentException
74
-     * @throws InvalidDataTypeException
75
-     * @throws InvalidInterfaceException
76
-     * @throws ReflectionException
77
-     */
78
-    public function restore_revision($post_id, $revision_id)
79
-    {
80
-        $post_evt = parent::restore_revision($post_id, $revision_id);
81
-
82
-        // restore revision for additional questions
83
-        $post_evt->restore_revision(
84
-            $revision_id,
85
-            ['Question_Group'],
86
-            [
87
-                'Question_Group' => ['Event_Question_Group.EQG_additional' => true],
88
-            ]
89
-        );
90
-    }
91
-
92
-
93
-    /**
94
-     * @param $post_id
95
-     * @param $post
96
-     * @throws EE_Error
97
-     * @throws InvalidArgumentException
98
-     * @throws InvalidDataTypeException
99
-     * @throws InvalidInterfaceException
100
-     */
101
-    public function additional_questions($post_id, $post)
102
-    {
103
-        $this->_event = $this->_adminpage_obj->get_event_object();
104
-        $event_id = $this->_event->ID();
105
-        ?>
19
+	/**
20
+	 * extending the properties set in espresso_events_Registration_From_Hooks
21
+	 *
22
+	 * @access protected
23
+	 * @return void
24
+	 */
25
+	protected function _extend_properties()
26
+	{
27
+		$this->_metaboxes = array_merge(
28
+			$this->_metaboxes,
29
+			array(
30
+				1 => array(
31
+					'page_route' => array('create_new', 'edit'),
32
+					'func'       => 'additional_questions',
33
+					'label'      => esc_html__('Questions for Additional Registrants', 'event_espresso'),
34
+					'priority'   => 'default',
35
+					'context'    => 'side',
36
+				),
37
+			)
38
+		);
39
+		$this->_scripts_styles = array(
40
+			'registers' => array(
41
+				'extended-event-editor' => array(
42
+					'url'     => EE_CORE_CAF_ADMIN_EXTEND_URL
43
+								 . 'registration_form/assets/event-editor-question-groups.js',
44
+					'depends' => array('jquery'),
45
+				),
46
+			),
47
+			'enqueues'  => array(
48
+				'extended-event-editor' => array('edit', 'create_new'),
49
+			),
50
+		);
51
+	}
52
+
53
+
54
+	/**
55
+	 * @param Callable[] $callbacks
56
+	 * @return array
57
+	 */
58
+	public function modify_callbacks($callbacks)
59
+	{
60
+		$callbacks = parent::modify_callbacks($callbacks);
61
+		$callbacks[] = array($this, 'additional_question_group_update');
62
+		return $callbacks;
63
+	}
64
+
65
+
66
+	/**
67
+	 * Call back hooked into revision restores.
68
+	 *
69
+	 * @param $post_id
70
+	 * @param $revision_id
71
+	 * @return EE_Base_Class|void
72
+	 * @throws EE_Error
73
+	 * @throws InvalidArgumentException
74
+	 * @throws InvalidDataTypeException
75
+	 * @throws InvalidInterfaceException
76
+	 * @throws ReflectionException
77
+	 */
78
+	public function restore_revision($post_id, $revision_id)
79
+	{
80
+		$post_evt = parent::restore_revision($post_id, $revision_id);
81
+
82
+		// restore revision for additional questions
83
+		$post_evt->restore_revision(
84
+			$revision_id,
85
+			['Question_Group'],
86
+			[
87
+				'Question_Group' => ['Event_Question_Group.EQG_additional' => true],
88
+			]
89
+		);
90
+	}
91
+
92
+
93
+	/**
94
+	 * @param $post_id
95
+	 * @param $post
96
+	 * @throws EE_Error
97
+	 * @throws InvalidArgumentException
98
+	 * @throws InvalidDataTypeException
99
+	 * @throws InvalidInterfaceException
100
+	 */
101
+	public function additional_questions($post_id, $post)
102
+	{
103
+		$this->_event = $this->_adminpage_obj->get_event_object();
104
+		$event_id = $this->_event->ID();
105
+		?>
106 106
         <div class="inside">
107 107
             <p><strong>
108 108
                     <?php _e('Question Groups', 'event_espresso'); ?>
109 109
                 </strong><br/>
110 110
                 <?php
111
-                printf(
112
-                    esc_html__(
113
-                        'Add a pre-populated %1$sgroup of questions%2$s to your event.',
114
-                        'event_espresso'
115
-                    ),
116
-                    '<a href="admin.php?page=espresso_registration_form" target="_blank">',
117
-                    '</a>'
118
-                );
119
-                ?>
111
+				printf(
112
+					esc_html__(
113
+						'Add a pre-populated %1$sgroup of questions%2$s to your event.',
114
+						'event_espresso'
115
+					),
116
+					'<a href="admin.php?page=espresso_registration_form" target="_blank">',
117
+					'</a>'
118
+				);
119
+				?>
120 120
             </p>
121 121
             <?php
122 122
 
123
-            $qsg_where['QSG_deleted'] = false;
124
-            $query_params = apply_filters(
125
-                'FHEE__espresso_events_Registration_Form_Hooks_Extend__additional_questions__question_group_query_parameters',
126
-                array($qsg_where, 'order_by' => array('QSG_order' => 'ASC'))
127
-            );
128
-            $QSGs = EEM_Question_Group::instance()->get_all($query_params);
129
-            $EQGs = ! empty($event_id)
130
-                ? $this->_event->get_many_related(
131
-                    'Question_Group',
132
-                    [['Event_Question_Group.EQG_additional' => true]]
133
-                )
134
-                : [];
135
-            $EQGids = array_keys($EQGs);
136
-
137
-            if (! empty($QSGs)) {
138
-                $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : '';
139
-                foreach ($QSGs as $QSG) {
140
-                    $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : '';
141
-                    $edit_link = EE_Admin_Page::add_query_args_and_nonce(
142
-                        array(
143
-                            'action' => 'edit_question_group',
144
-                            'QSG_ID' => $QSG->ID(),
145
-                        ),
146
-                        EE_FORMS_ADMIN_URL
147
-                    );
148
-
149
-                    $html .= '
123
+			$qsg_where['QSG_deleted'] = false;
124
+			$query_params = apply_filters(
125
+				'FHEE__espresso_events_Registration_Form_Hooks_Extend__additional_questions__question_group_query_parameters',
126
+				array($qsg_where, 'order_by' => array('QSG_order' => 'ASC'))
127
+			);
128
+			$QSGs = EEM_Question_Group::instance()->get_all($query_params);
129
+			$EQGs = ! empty($event_id)
130
+				? $this->_event->get_many_related(
131
+					'Question_Group',
132
+					[['Event_Question_Group.EQG_additional' => true]]
133
+				)
134
+				: [];
135
+			$EQGids = array_keys($EQGs);
136
+
137
+			if (! empty($QSGs)) {
138
+				$html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : '';
139
+				foreach ($QSGs as $QSG) {
140
+					$checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : '';
141
+					$edit_link = EE_Admin_Page::add_query_args_and_nonce(
142
+						array(
143
+							'action' => 'edit_question_group',
144
+							'QSG_ID' => $QSG->ID(),
145
+						),
146
+						EE_FORMS_ADMIN_URL
147
+					);
148
+
149
+					$html .= '
150 150
 					<p id="event-question-group-' . $QSG->ID() . '">
151 151
 						<input value="' . $QSG->ID() . '"'
152
-                             . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' />
152
+							 . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' />
153 153
 						<a href="' . $edit_link . '" title="'
154
-                             . sprintf(
155
-                                 esc_attr__('Edit %s Group', 'event_espresso'),
156
-                                 $QSG->get('QSG_name')
157
-                             )
158
-                             . '" target="_blank">' . $QSG->get('QSG_name') . '</a>
154
+							 . sprintf(
155
+								 esc_attr__('Edit %s Group', 'event_espresso'),
156
+								 $QSG->get('QSG_name')
157
+							 )
158
+							 . '" target="_blank">' . $QSG->get('QSG_name') . '</a>
159 159
 					</p>';
160
-                    if ($QSG->ID() === 2) {
161
-                        $html .= '
160
+					if ($QSG->ID() === 2) {
161
+						$html .= '
162 162
 					<p id="question-group-requirements-notice-pg" class="important-notice small-text" style="display: none;">'
163
-                                 . esc_html__(
164
-                                     'The Personal Information question group is required whenever the Address Information question group is activated.',
165
-                                     'event_espresso'
166
-                                 )
167
-                                 . '</p>';
168
-                    }
169
-                }
170
-                $html .= count($QSGs) > 10 ? '</div>' : '';
171
-
172
-                echo $html;
173
-            } else {
174
-                esc_html_e(
175
-                    'There seems to be a problem with your questions. Please contact [email protected]',
176
-                    'event_espresso'
177
-                );
178
-            }
179
-            do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content');
180
-            ?>
163
+								 . esc_html__(
164
+									 'The Personal Information question group is required whenever the Address Information question group is activated.',
165
+									 'event_espresso'
166
+								 )
167
+								 . '</p>';
168
+					}
169
+				}
170
+				$html .= count($QSGs) > 10 ? '</div>' : '';
171
+
172
+				echo $html;
173
+			} else {
174
+				esc_html_e(
175
+					'There seems to be a problem with your questions. Please contact [email protected]',
176
+					'event_espresso'
177
+				);
178
+			}
179
+			do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content');
180
+			?>
181 181
         </div>
182 182
         <?php
183
-    }
184
-
185
-
186
-    public function additional_question_group_update($evtobj, $data)
187
-    {
188
-        $question_groups = ! empty($data['add_attendee_question_groups'])
189
-            ? (array) $data['add_attendee_question_groups']
190
-            : [];
191
-        $added_qgs = array_keys($question_groups);
192
-        $success = [];
193
-
194
-        // let's get all current question groups associated with this event.
195
-        $current_qgs = $evtobj->get_many_related(
196
-            'Question_Group',
197
-            [['Event_Question_Group.EQG_additional' => true]]
198
-        );
199
-        $current_qgs = array_keys($current_qgs); // we just want the ids
200
-
201
-        // now let's get the groups selected in the editor and update (IF we have data)
202
-        if (! empty($question_groups)) {
203
-            foreach ($question_groups as $qgid) {
204
-                // add to event
205
-                if ($qgid) {
206
-                    $qg = $evtobj->add_question_group($qgid, false);
207
-                }
208
-                $success[] = ! empty($qg) ? 1 : 0;
209
-            }
210
-        }
211
-
212
-        // wait a minute... are there question groups missing in the saved groups that ARE with the current event?
213
-        $removed_qgs = array_diff($current_qgs, $added_qgs);
214
-
215
-        foreach ($removed_qgs as $qgid) {
216
-            $qg = $evtobj->remove_question_group($qgid, false);
217
-            $success[] = ! empty($qg) ? 1 : 0;
218
-        }
219
-
220
-
221
-        return in_array(0, $success, true) ? false : true;
222
-    }
183
+	}
184
+
185
+
186
+	public function additional_question_group_update($evtobj, $data)
187
+	{
188
+		$question_groups = ! empty($data['add_attendee_question_groups'])
189
+			? (array) $data['add_attendee_question_groups']
190
+			: [];
191
+		$added_qgs = array_keys($question_groups);
192
+		$success = [];
193
+
194
+		// let's get all current question groups associated with this event.
195
+		$current_qgs = $evtobj->get_many_related(
196
+			'Question_Group',
197
+			[['Event_Question_Group.EQG_additional' => true]]
198
+		);
199
+		$current_qgs = array_keys($current_qgs); // we just want the ids
200
+
201
+		// now let's get the groups selected in the editor and update (IF we have data)
202
+		if (! empty($question_groups)) {
203
+			foreach ($question_groups as $qgid) {
204
+				// add to event
205
+				if ($qgid) {
206
+					$qg = $evtobj->add_question_group($qgid, false);
207
+				}
208
+				$success[] = ! empty($qg) ? 1 : 0;
209
+			}
210
+		}
211
+
212
+		// wait a minute... are there question groups missing in the saved groups that ARE with the current event?
213
+		$removed_qgs = array_diff($current_qgs, $added_qgs);
214
+
215
+		foreach ($removed_qgs as $qgid) {
216
+			$qg = $evtobj->remove_question_group($qgid, false);
217
+			$success[] = ! empty($qg) ? 1 : 0;
218
+		}
219
+
220
+
221
+		return in_array(0, $success, true) ? false : true;
222
+	}
223 223
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                 : [];
135 135
             $EQGids = array_keys($EQGs);
136 136
 
137
-            if (! empty($QSGs)) {
137
+            if ( ! empty($QSGs)) {
138 138
                 $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : '';
139 139
                 foreach ($QSGs as $QSG) {
140 140
                     $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : '';
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
                     );
148 148
 
149 149
                     $html .= '
150
-					<p id="event-question-group-' . $QSG->ID() . '">
151
-						<input value="' . $QSG->ID() . '"'
152
-                             . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' />
153
-						<a href="' . $edit_link . '" title="'
150
+					<p id="event-question-group-' . $QSG->ID().'">
151
+						<input value="' . $QSG->ID().'"'
152
+                             . ' type="checkbox" name="add_attendee_question_groups['.$QSG->ID().']"'.$checked.' />
153
+						<a href="' . $edit_link.'" title="'
154 154
                              . sprintf(
155 155
                                  esc_attr__('Edit %s Group', 'event_espresso'),
156 156
                                  $QSG->get('QSG_name')
157 157
                              )
158
-                             . '" target="_blank">' . $QSG->get('QSG_name') . '</a>
158
+                             . '" target="_blank">'.$QSG->get('QSG_name').'</a>
159 159
 					</p>';
160 160
                     if ($QSG->ID() === 2) {
161 161
                         $html .= '
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         $current_qgs = array_keys($current_qgs); // we just want the ids
200 200
 
201 201
         // now let's get the groups selected in the editor and update (IF we have data)
202
-        if (! empty($question_groups)) {
202
+        if ( ! empty($question_groups)) {
203 203
             foreach ($question_groups as $qgid) {
204 204
                 // add to event
205 205
                 if ($qgid) {
Please login to merge, or discard this patch.
core/admin/EE_Admin_List_Table.core.php 2 patches
Indentation   +834 added lines, -834 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (! class_exists('WP_List_Table')) {
4
-    require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
4
+	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
5 5
 }
6 6
 
7 7
 
@@ -20,847 +20,847 @@  discard block
 block discarded – undo
20 20
 abstract class EE_Admin_List_Table extends WP_List_Table
21 21
 {
22 22
 
23
-    /**
24
-     * holds the data that will be processed for the table
25
-     *
26
-     * @var array $_data
27
-     */
28
-    protected $_data;
29
-
30
-
31
-    /**
32
-     * This holds the value of all the data available for the given view (for all pages).
33
-     *
34
-     * @var int $_all_data_count
35
-     */
36
-    protected $_all_data_count;
37
-
38
-
39
-    /**
40
-     * Will contain the count of trashed items for the view label.
41
-     *
42
-     * @var int $_trashed_count
43
-     */
44
-    protected $_trashed_count;
45
-
46
-
47
-    /**
48
-     * This is what will be referenced as the slug for the current screen
49
-     *
50
-     * @var string $_screen
51
-     */
52
-    protected $_screen;
53
-
54
-
55
-    /**
56
-     * this is the EE_Admin_Page object
57
-     *
58
-     * @var EE_Admin_Page $_admin_page
59
-     */
60
-    protected $_admin_page;
61
-
62
-
63
-    /**
64
-     * The current view
65
-     *
66
-     * @var string $_view
67
-     */
68
-    protected $_view;
69
-
70
-
71
-    /**
72
-     * array of possible views for this table
73
-     *
74
-     * @var array $_views
75
-     */
76
-    protected $_views;
77
-
78
-
79
-    /**
80
-     * An array of key => value pairs containing information about the current table
81
-     * array(
82
-     *        'plural' => 'plural label',
83
-     *        'singular' => 'singular label',
84
-     *        'ajax' => false, //whether to use ajax or not
85
-     *        'screen' => null, //string used to reference what screen this is
86
-     *        (WP_List_table converts to screen object)
87
-     * )
88
-     *
89
-     * @var array $_wp_list_args
90
-     */
91
-    protected $_wp_list_args;
92
-
93
-    /**
94
-     * an array of column names
95
-     * array(
96
-     *    'internal-name' => 'Title'
97
-     * )
98
-     *
99
-     * @var array $_columns
100
-     */
101
-    protected $_columns;
102
-
103
-    /**
104
-     * An array of sortable columns
105
-     * array(
106
-     *    'internal-name' => 'orderby' //or
107
-     *    'internal-name' => array( 'orderby', true )
108
-     * )
109
-     *
110
-     * @var array $_sortable_columns
111
-     */
112
-    protected $_sortable_columns;
113
-
114
-    /**
115
-     * callback method used to perform AJAX row reordering
116
-     *
117
-     * @var string $_ajax_sorting_callback
118
-     */
119
-    protected $_ajax_sorting_callback;
120
-
121
-    /**
122
-     * An array of hidden columns (if needed)
123
-     * array('internal-name', 'internal-name')
124
-     *
125
-     * @var array $_hidden_columns
126
-     */
127
-    protected $_hidden_columns;
128
-
129
-    /**
130
-     * holds the per_page value
131
-     *
132
-     * @var int $_per_page
133
-     */
134
-    protected $_per_page;
135
-
136
-    /**
137
-     * holds what page number is currently being viewed
138
-     *
139
-     * @var int $_current_page
140
-     */
141
-    protected $_current_page;
142
-
143
-    /**
144
-     * the reference string for the nonce_action
145
-     *
146
-     * @var string $_nonce_action_ref
147
-     */
148
-    protected $_nonce_action_ref;
149
-
150
-    /**
151
-     * property to hold incoming request data (as set by the admin_page_core)
152
-     *
153
-     * @var array $_req_data
154
-     */
155
-    protected $_req_data;
156
-
157
-
158
-    /**
159
-     * yes / no array for admin form fields
160
-     *
161
-     * @var array $_yes_no
162
-     */
163
-    protected $_yes_no = array();
164
-
165
-    /**
166
-     * Array describing buttons that should appear at the bottom of the page
167
-     * Keys are strings that represent the button's function (specifically a key in _labels['buttons']),
168
-     * and the values are another array with the following keys
169
-     * array(
170
-     *    'route' => 'page_route',
171
-     *    'extra_request' => array('evt_id' => 1 ); //extra request vars that need to be included in the button.
172
-     * )
173
-     *
174
-     * @var array $_bottom_buttons
175
-     */
176
-    protected $_bottom_buttons = array();
177
-
178
-
179
-    /**
180
-     * Used to indicate what should be the primary column for the list table.
181
-     * If not present then falls back to what WP calculates
182
-     * as the primary column.
183
-     *
184
-     * @type string $_primary_column
185
-     */
186
-    protected $_primary_column = '';
187
-
188
-
189
-    /**
190
-     * Used to indicate whether the table has a checkbox column or not.
191
-     *
192
-     * @type bool $_has_checkbox_column
193
-     */
194
-    protected $_has_checkbox_column = false;
195
-
196
-
197
-    /**
198
-     * @param \EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table
199
-     */
200
-    public function __construct(EE_Admin_Page $admin_page)
201
-    {
202
-        $this->_admin_page = $admin_page;
203
-        $this->_req_data = $this->_admin_page->get_request_data();
204
-        $this->_view = $this->_admin_page->get_view();
205
-        $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
206
-        $this->_current_page = $this->get_pagenum();
207
-        $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();
208
-        $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso'));
209
-
210
-        $this->_per_page = $this->get_items_per_page($this->_screen . '_per_page', 20);
211
-
212
-        $this->_setup_data();
213
-        $this->_add_view_counts();
214
-
215
-        $this->_nonce_action_ref = $this->_view;
216
-
217
-        $this->_set_properties();
218
-
219
-        // set primary column
220
-        add_filter('list_table_primary_column', array($this, 'set_primary_column'));
221
-
222
-        // set parent defaults
223
-        parent::__construct($this->_wp_list_args);
224
-
225
-        $this->prepare_items();
226
-    }
227
-
228
-
229
-    /**
230
-     * _setup_data
231
-     * this method is used to setup the $_data, $_all_data_count, and _per_page properties
232
-     *
233
-     * @uses $this->_admin_page
234
-     * @return void
235
-     */
236
-    abstract protected function _setup_data();
237
-
238
-
239
-    /**
240
-     * set the properties that this class needs to be able to execute wp_list_table properly
241
-     * properties set:
242
-     * _wp_list_args = what the arguments required for the parent _wp_list_table.
243
-     * _columns = set the columns in an array.
244
-     * _sortable_columns = columns that are sortable (array).
245
-     * _hidden_columns = columns that are hidden (array)
246
-     * _default_orderby = the default orderby for sorting.
247
-     *
248
-     * @abstract
249
-     * @access protected
250
-     * @return void
251
-     */
252
-    abstract protected function _set_properties();
253
-
254
-
255
-    /**
256
-     * _get_table_filters
257
-     * We use this to assemble and return any filters that are associated with this table that help further refine what
258
-     * get's shown in the table.
259
-     *
260
-     * @abstract
261
-     * @access protected
262
-     * @return string
263
-     */
264
-    abstract protected function _get_table_filters();
265
-
266
-
267
-    /**
268
-     * this is a method that child class will do to add counts to the views array so when views are displayed the
269
-     * counts of the views is accurate.
270
-     *
271
-     * @abstract
272
-     * @access protected
273
-     * @return void
274
-     */
275
-    abstract protected function _add_view_counts();
276
-
277
-
278
-    /**
279
-     * _get_hidden_fields
280
-     * returns a html string of hidden fields so if any table filters are used the current view will be respected.
281
-     *
282
-     * @return string
283
-     */
284
-    protected function _get_hidden_fields()
285
-    {
286
-        $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : '';
287
-        $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;
288
-        // if action is STILL empty, then we set it to default
289
-        $action = empty($action) ? 'default' : $action;
290
-        $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n";
291
-        $field .= '<input type="hidden" name="route" value="' . $action . '" />' . "\n";/**/
292
-        $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n";
293
-
294
-        $bulk_actions = $this->_get_bulk_actions();
295
-        foreach ($bulk_actions as $bulk_action => $label) {
296
-            $field .= '<input type="hidden" name="' . $bulk_action . '_nonce"'
297
-                      . ' value="' . wp_create_nonce($bulk_action . '_nonce') . '" />' . "\n";
298
-        }
299
-
300
-        return $field;
301
-    }
302
-
303
-
304
-    /**
305
-     * _set_column_info
306
-     * we're using this to set the column headers property.
307
-     *
308
-     * @access protected
309
-     * @return void
310
-     */
311
-    protected function _set_column_info()
312
-    {
313
-        $columns = $this->get_columns();
314
-        $hidden = $this->get_hidden_columns();
315
-        $_sortable = $this->get_sortable_columns();
316
-
317
-        /**
318
-         * Dynamic hook allowing for adding sortable columns in this list table.
319
-         * Note that $this->screen->id is in the format
320
-         * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
321
-         * table it is: event-espresso_page_espresso_messages.
322
-         * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
323
-         * hook prefix ("event-espresso") will be different.
324
-         *
325
-         * @var array
326
-         */
327
-        $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen);
328
-
329
-        $sortable = array();
330
-        foreach ($_sortable as $id => $data) {
331
-            if (empty($data)) {
332
-                continue;
333
-            }
334
-            // fix for offset errors with WP_List_Table default get_columninfo()
335
-            if (is_array($data)) {
336
-                $_data[0] = key($data);
337
-                $_data[1] = isset($data[1]) ? $data[1] : false;
338
-            } else {
339
-                $_data[0] = $data;
340
-            }
341
-
342
-            $data = (array) $data;
343
-
344
-            if (! isset($data[1])) {
345
-                $_data[1] = false;
346
-            }
347
-
348
-            $sortable[ $id ] = $_data;
349
-        }
350
-        $primary = $this->get_primary_column_name();
351
-        $this->_column_headers = array($columns, $hidden, $sortable, $primary);
352
-    }
353
-
354
-
355
-    /**
356
-     * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814)
357
-     *
358
-     * @return string
359
-     */
360
-    protected function get_primary_column_name()
361
-    {
362
-        foreach (class_parents($this) as $parent) {
363
-            if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) {
364
-                return parent::get_primary_column_name();
365
-            }
366
-        }
367
-        return $this->_primary_column;
368
-    }
369
-
370
-
371
-    /**
372
-     * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814)
373
-     *
374
-     * @param EE_Base_Class $item
375
-     * @param string        $column_name
376
-     * @param string        $primary
377
-     * @return string
378
-     */
379
-    protected function handle_row_actions($item, $column_name, $primary)
380
-    {
381
-        foreach (class_parents($this) as $parent) {
382
-            if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) {
383
-                return parent::handle_row_actions($item, $column_name, $primary);
384
-            }
385
-        }
386
-        return '';
387
-    }
388
-
389
-
390
-    /**
391
-     * _get_bulk_actions
392
-     * This is a wrapper called by WP_List_Table::get_bulk_actions()
393
-     *
394
-     * @access protected
395
-     * @return array bulk_actions
396
-     */
397
-    protected function _get_bulk_actions()
398
-    {
399
-        $actions = array();
400
-        // the _views property should have the bulk_actions, so let's go through and extract them into a properly
401
-        // formatted array for the wp_list_table();
402
-        foreach ($this->_views as $view => $args) {
403
-            if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) {
404
-                // each bulk action will correspond with a admin page route, so we can check whatever the capability is
405
-                // for that page route and skip adding the bulk action if no access for the current logged in user.
406
-                foreach ($args['bulk_action'] as $route => $label) {
407
-                    if ($this->_admin_page->check_user_access($route, true)) {
408
-                        $actions[ $route ] = $label;
409
-                    }
410
-                }
411
-            }
412
-        }
413
-        return $actions;
414
-    }
415
-
416
-
417
-    /**
418
-     * Generate the table navigation above or below the table.
419
-     * Overrides the parent table nav in WP_List_Table so we can hide the bulk action div if there are no bulk actions.
420
-     *
421
-     * @since 4.9.44.rc.001
422
-     */
423
-    public function display_tablenav($which)
424
-    {
425
-        if ('top' === $which) {
426
-            wp_nonce_field('bulk-' . $this->_args['plural']);
427
-        }
428
-        ?>
23
+	/**
24
+	 * holds the data that will be processed for the table
25
+	 *
26
+	 * @var array $_data
27
+	 */
28
+	protected $_data;
29
+
30
+
31
+	/**
32
+	 * This holds the value of all the data available for the given view (for all pages).
33
+	 *
34
+	 * @var int $_all_data_count
35
+	 */
36
+	protected $_all_data_count;
37
+
38
+
39
+	/**
40
+	 * Will contain the count of trashed items for the view label.
41
+	 *
42
+	 * @var int $_trashed_count
43
+	 */
44
+	protected $_trashed_count;
45
+
46
+
47
+	/**
48
+	 * This is what will be referenced as the slug for the current screen
49
+	 *
50
+	 * @var string $_screen
51
+	 */
52
+	protected $_screen;
53
+
54
+
55
+	/**
56
+	 * this is the EE_Admin_Page object
57
+	 *
58
+	 * @var EE_Admin_Page $_admin_page
59
+	 */
60
+	protected $_admin_page;
61
+
62
+
63
+	/**
64
+	 * The current view
65
+	 *
66
+	 * @var string $_view
67
+	 */
68
+	protected $_view;
69
+
70
+
71
+	/**
72
+	 * array of possible views for this table
73
+	 *
74
+	 * @var array $_views
75
+	 */
76
+	protected $_views;
77
+
78
+
79
+	/**
80
+	 * An array of key => value pairs containing information about the current table
81
+	 * array(
82
+	 *        'plural' => 'plural label',
83
+	 *        'singular' => 'singular label',
84
+	 *        'ajax' => false, //whether to use ajax or not
85
+	 *        'screen' => null, //string used to reference what screen this is
86
+	 *        (WP_List_table converts to screen object)
87
+	 * )
88
+	 *
89
+	 * @var array $_wp_list_args
90
+	 */
91
+	protected $_wp_list_args;
92
+
93
+	/**
94
+	 * an array of column names
95
+	 * array(
96
+	 *    'internal-name' => 'Title'
97
+	 * )
98
+	 *
99
+	 * @var array $_columns
100
+	 */
101
+	protected $_columns;
102
+
103
+	/**
104
+	 * An array of sortable columns
105
+	 * array(
106
+	 *    'internal-name' => 'orderby' //or
107
+	 *    'internal-name' => array( 'orderby', true )
108
+	 * )
109
+	 *
110
+	 * @var array $_sortable_columns
111
+	 */
112
+	protected $_sortable_columns;
113
+
114
+	/**
115
+	 * callback method used to perform AJAX row reordering
116
+	 *
117
+	 * @var string $_ajax_sorting_callback
118
+	 */
119
+	protected $_ajax_sorting_callback;
120
+
121
+	/**
122
+	 * An array of hidden columns (if needed)
123
+	 * array('internal-name', 'internal-name')
124
+	 *
125
+	 * @var array $_hidden_columns
126
+	 */
127
+	protected $_hidden_columns;
128
+
129
+	/**
130
+	 * holds the per_page value
131
+	 *
132
+	 * @var int $_per_page
133
+	 */
134
+	protected $_per_page;
135
+
136
+	/**
137
+	 * holds what page number is currently being viewed
138
+	 *
139
+	 * @var int $_current_page
140
+	 */
141
+	protected $_current_page;
142
+
143
+	/**
144
+	 * the reference string for the nonce_action
145
+	 *
146
+	 * @var string $_nonce_action_ref
147
+	 */
148
+	protected $_nonce_action_ref;
149
+
150
+	/**
151
+	 * property to hold incoming request data (as set by the admin_page_core)
152
+	 *
153
+	 * @var array $_req_data
154
+	 */
155
+	protected $_req_data;
156
+
157
+
158
+	/**
159
+	 * yes / no array for admin form fields
160
+	 *
161
+	 * @var array $_yes_no
162
+	 */
163
+	protected $_yes_no = array();
164
+
165
+	/**
166
+	 * Array describing buttons that should appear at the bottom of the page
167
+	 * Keys are strings that represent the button's function (specifically a key in _labels['buttons']),
168
+	 * and the values are another array with the following keys
169
+	 * array(
170
+	 *    'route' => 'page_route',
171
+	 *    'extra_request' => array('evt_id' => 1 ); //extra request vars that need to be included in the button.
172
+	 * )
173
+	 *
174
+	 * @var array $_bottom_buttons
175
+	 */
176
+	protected $_bottom_buttons = array();
177
+
178
+
179
+	/**
180
+	 * Used to indicate what should be the primary column for the list table.
181
+	 * If not present then falls back to what WP calculates
182
+	 * as the primary column.
183
+	 *
184
+	 * @type string $_primary_column
185
+	 */
186
+	protected $_primary_column = '';
187
+
188
+
189
+	/**
190
+	 * Used to indicate whether the table has a checkbox column or not.
191
+	 *
192
+	 * @type bool $_has_checkbox_column
193
+	 */
194
+	protected $_has_checkbox_column = false;
195
+
196
+
197
+	/**
198
+	 * @param \EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table
199
+	 */
200
+	public function __construct(EE_Admin_Page $admin_page)
201
+	{
202
+		$this->_admin_page = $admin_page;
203
+		$this->_req_data = $this->_admin_page->get_request_data();
204
+		$this->_view = $this->_admin_page->get_view();
205
+		$this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
206
+		$this->_current_page = $this->get_pagenum();
207
+		$this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();
208
+		$this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso'));
209
+
210
+		$this->_per_page = $this->get_items_per_page($this->_screen . '_per_page', 20);
211
+
212
+		$this->_setup_data();
213
+		$this->_add_view_counts();
214
+
215
+		$this->_nonce_action_ref = $this->_view;
216
+
217
+		$this->_set_properties();
218
+
219
+		// set primary column
220
+		add_filter('list_table_primary_column', array($this, 'set_primary_column'));
221
+
222
+		// set parent defaults
223
+		parent::__construct($this->_wp_list_args);
224
+
225
+		$this->prepare_items();
226
+	}
227
+
228
+
229
+	/**
230
+	 * _setup_data
231
+	 * this method is used to setup the $_data, $_all_data_count, and _per_page properties
232
+	 *
233
+	 * @uses $this->_admin_page
234
+	 * @return void
235
+	 */
236
+	abstract protected function _setup_data();
237
+
238
+
239
+	/**
240
+	 * set the properties that this class needs to be able to execute wp_list_table properly
241
+	 * properties set:
242
+	 * _wp_list_args = what the arguments required for the parent _wp_list_table.
243
+	 * _columns = set the columns in an array.
244
+	 * _sortable_columns = columns that are sortable (array).
245
+	 * _hidden_columns = columns that are hidden (array)
246
+	 * _default_orderby = the default orderby for sorting.
247
+	 *
248
+	 * @abstract
249
+	 * @access protected
250
+	 * @return void
251
+	 */
252
+	abstract protected function _set_properties();
253
+
254
+
255
+	/**
256
+	 * _get_table_filters
257
+	 * We use this to assemble and return any filters that are associated with this table that help further refine what
258
+	 * get's shown in the table.
259
+	 *
260
+	 * @abstract
261
+	 * @access protected
262
+	 * @return string
263
+	 */
264
+	abstract protected function _get_table_filters();
265
+
266
+
267
+	/**
268
+	 * this is a method that child class will do to add counts to the views array so when views are displayed the
269
+	 * counts of the views is accurate.
270
+	 *
271
+	 * @abstract
272
+	 * @access protected
273
+	 * @return void
274
+	 */
275
+	abstract protected function _add_view_counts();
276
+
277
+
278
+	/**
279
+	 * _get_hidden_fields
280
+	 * returns a html string of hidden fields so if any table filters are used the current view will be respected.
281
+	 *
282
+	 * @return string
283
+	 */
284
+	protected function _get_hidden_fields()
285
+	{
286
+		$action = isset($this->_req_data['route']) ? $this->_req_data['route'] : '';
287
+		$action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;
288
+		// if action is STILL empty, then we set it to default
289
+		$action = empty($action) ? 'default' : $action;
290
+		$field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n";
291
+		$field .= '<input type="hidden" name="route" value="' . $action . '" />' . "\n";/**/
292
+		$field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n";
293
+
294
+		$bulk_actions = $this->_get_bulk_actions();
295
+		foreach ($bulk_actions as $bulk_action => $label) {
296
+			$field .= '<input type="hidden" name="' . $bulk_action . '_nonce"'
297
+					  . ' value="' . wp_create_nonce($bulk_action . '_nonce') . '" />' . "\n";
298
+		}
299
+
300
+		return $field;
301
+	}
302
+
303
+
304
+	/**
305
+	 * _set_column_info
306
+	 * we're using this to set the column headers property.
307
+	 *
308
+	 * @access protected
309
+	 * @return void
310
+	 */
311
+	protected function _set_column_info()
312
+	{
313
+		$columns = $this->get_columns();
314
+		$hidden = $this->get_hidden_columns();
315
+		$_sortable = $this->get_sortable_columns();
316
+
317
+		/**
318
+		 * Dynamic hook allowing for adding sortable columns in this list table.
319
+		 * Note that $this->screen->id is in the format
320
+		 * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
321
+		 * table it is: event-espresso_page_espresso_messages.
322
+		 * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
323
+		 * hook prefix ("event-espresso") will be different.
324
+		 *
325
+		 * @var array
326
+		 */
327
+		$_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen);
328
+
329
+		$sortable = array();
330
+		foreach ($_sortable as $id => $data) {
331
+			if (empty($data)) {
332
+				continue;
333
+			}
334
+			// fix for offset errors with WP_List_Table default get_columninfo()
335
+			if (is_array($data)) {
336
+				$_data[0] = key($data);
337
+				$_data[1] = isset($data[1]) ? $data[1] : false;
338
+			} else {
339
+				$_data[0] = $data;
340
+			}
341
+
342
+			$data = (array) $data;
343
+
344
+			if (! isset($data[1])) {
345
+				$_data[1] = false;
346
+			}
347
+
348
+			$sortable[ $id ] = $_data;
349
+		}
350
+		$primary = $this->get_primary_column_name();
351
+		$this->_column_headers = array($columns, $hidden, $sortable, $primary);
352
+	}
353
+
354
+
355
+	/**
356
+	 * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814)
357
+	 *
358
+	 * @return string
359
+	 */
360
+	protected function get_primary_column_name()
361
+	{
362
+		foreach (class_parents($this) as $parent) {
363
+			if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) {
364
+				return parent::get_primary_column_name();
365
+			}
366
+		}
367
+		return $this->_primary_column;
368
+	}
369
+
370
+
371
+	/**
372
+	 * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814)
373
+	 *
374
+	 * @param EE_Base_Class $item
375
+	 * @param string        $column_name
376
+	 * @param string        $primary
377
+	 * @return string
378
+	 */
379
+	protected function handle_row_actions($item, $column_name, $primary)
380
+	{
381
+		foreach (class_parents($this) as $parent) {
382
+			if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) {
383
+				return parent::handle_row_actions($item, $column_name, $primary);
384
+			}
385
+		}
386
+		return '';
387
+	}
388
+
389
+
390
+	/**
391
+	 * _get_bulk_actions
392
+	 * This is a wrapper called by WP_List_Table::get_bulk_actions()
393
+	 *
394
+	 * @access protected
395
+	 * @return array bulk_actions
396
+	 */
397
+	protected function _get_bulk_actions()
398
+	{
399
+		$actions = array();
400
+		// the _views property should have the bulk_actions, so let's go through and extract them into a properly
401
+		// formatted array for the wp_list_table();
402
+		foreach ($this->_views as $view => $args) {
403
+			if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) {
404
+				// each bulk action will correspond with a admin page route, so we can check whatever the capability is
405
+				// for that page route and skip adding the bulk action if no access for the current logged in user.
406
+				foreach ($args['bulk_action'] as $route => $label) {
407
+					if ($this->_admin_page->check_user_access($route, true)) {
408
+						$actions[ $route ] = $label;
409
+					}
410
+				}
411
+			}
412
+		}
413
+		return $actions;
414
+	}
415
+
416
+
417
+	/**
418
+	 * Generate the table navigation above or below the table.
419
+	 * Overrides the parent table nav in WP_List_Table so we can hide the bulk action div if there are no bulk actions.
420
+	 *
421
+	 * @since 4.9.44.rc.001
422
+	 */
423
+	public function display_tablenav($which)
424
+	{
425
+		if ('top' === $which) {
426
+			wp_nonce_field('bulk-' . $this->_args['plural']);
427
+		}
428
+		?>
429 429
         <div class="tablenav <?php echo esc_attr($which); ?>">
430 430
             <?php if ($this->_get_bulk_actions()) { ?>
431 431
                 <div class="alignleft actions bulkactions">
432 432
                     <?php $this->bulk_actions(); ?>
433 433
                 </div>
434 434
             <?php }
435
-            $this->extra_tablenav($which);
436
-            $this->pagination($which);
437
-            ?>
435
+			$this->extra_tablenav($which);
436
+			$this->pagination($which);
437
+			?>
438 438
 
439 439
             <br class="clear"/>
440 440
         </div>
441 441
         <?php
442
-    }
443
-
444
-
445
-    /**
446
-     * _filters
447
-     * This receives the filters array from children _get_table_filters() and assembles the string including the filter
448
-     * button.
449
-     *
450
-     * @access private
451
-     * @return string html showing filters
452
-     */
453
-    private function _filters()
454
-    {
455
-        $classname = get_class($this);
456
-        $filters = apply_filters(
457
-            "FHEE__{$classname}__filters",
458
-            (array) $this->_get_table_filters(),
459
-            $this,
460
-            $this->_screen
461
-        );
462
-
463
-        if (empty($filters)) {
464
-            return;
465
-        }
466
-        foreach ($filters as $filter) {
467
-            echo $filter;
468
-        }
469
-        // add filter button at end
470
-        echo '<input type="submit" class="button-secondary" value="'
471
-             . esc_html__('Filter', 'event_espresso')
472
-             . '" id="post-query-submit" />';
473
-        // add reset filters button at end
474
-        echo '<a class="button button-secondary"  href="'
475
-             . $this->_admin_page->get_current_page_view_url()
476
-             . '" style="display:inline-block">'
477
-             . esc_html__('Reset Filters', 'event_espresso')
478
-             . '</a>';
479
-    }
480
-
481
-
482
-    /**
483
-     * Callback for 'list_table_primary_column' WordPress filter
484
-     * If child EE_Admin_List_Table classes set the _primary_column property then that will be set as the primary
485
-     * column when class is instantiated.
486
-     *
487
-     * @see WP_List_Table::get_primary_column_name
488
-     * @param string $column_name
489
-     * @return string
490
-     */
491
-    public function set_primary_column($column_name)
492
-    {
493
-        return ! empty($this->_primary_column) ? $this->_primary_column : $column_name;
494
-    }
495
-
496
-
497
-    /**
498
-     *
499
-     */
500
-    public function prepare_items()
501
-    {
502
-
503
-        $this->_set_column_info();
504
-        // $this->_column_headers = $this->get_column_info();
505
-        $total_items = $this->_all_data_count;
506
-        $this->process_bulk_action();
507
-
508
-        $this->items = $this->_data;
509
-        $this->set_pagination_args(
510
-            array(
511
-                'total_items' => $total_items,
512
-                'per_page'    => $this->_per_page,
513
-                'total_pages' => ceil($total_items / $this->_per_page),
514
-            )
515
-        );
516
-    }
517
-
518
-
519
-    /**
520
-     * This column is the default for when there is no defined column method for a registered column.
521
-     * This can be overridden by child classes, but allows for hooking in for custom columns.
522
-     *
523
-     * @param EE_Base_Class $item
524
-     * @param string        $column_name The column being called.
525
-     * @return string html content for the column
526
-     */
527
-    public function column_default($item, $column_name)
528
-    {
529
-        /**
530
-         * Dynamic hook allowing for adding additional column content in this list table.
531
-         * Note that $this->screen->id is in the format
532
-         * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
533
-         * table it is: event-espresso_page_espresso_messages.
534
-         * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
535
-         * hook prefix ("event-espresso") will be different.
536
-         */
537
-        do_action(
538
-            'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id,
539
-            $item,
540
-            $this->_screen
541
-        );
542
-    }
543
-
544
-
545
-    /**
546
-     * Get a list of columns. The format is:
547
-     * 'internal-name' => 'Title'
548
-     *
549
-     * @since  3.1.0
550
-     * @access public
551
-     * @abstract
552
-     * @return array
553
-     */
554
-    public function get_columns()
555
-    {
556
-        /**
557
-         * Dynamic hook allowing for adding additional columns in this list table.
558
-         * Note that $this->screen->id is in the format
559
-         * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
560
-         * table it is: event-espresso_page_espresso_messages.
561
-         * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
562
-         * hook prefix ("event-espresso") will be different.
563
-         *
564
-         * @var array
565
-         */
566
-        $columns = apply_filters('FHEE_manage_' . $this->screen->id . '_columns', $this->_columns, $this->_screen);
567
-        return $columns;
568
-    }
569
-
570
-
571
-    /**
572
-     * Get an associative array ( id => link ) with the list
573
-     * of views available on this table.
574
-     *
575
-     * @since  3.1.0
576
-     * @access protected
577
-     * @return array
578
-     */
579
-    public function get_views()
580
-    {
581
-        return $this->_views;
582
-    }
583
-
584
-
585
-    /**
586
-     * Generate the views html.
587
-     */
588
-    public function display_views()
589
-    {
590
-        $views = $this->get_views();
591
-        $assembled_views = array();
592
-
593
-        if (empty($views)) {
594
-            return;
595
-        }
596
-        echo "<ul class='subsubsub'>\n";
597
-        foreach ($views as $view) {
598
-            $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;
599
-            if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) {
600
-                $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>"
601
-                                                    . '<a href="' . $view['url'] . '">' . $view['label'] . '</a>'
602
-                                                    . ' <span class="count">(' . $count . ')</span>';
603
-            }
604
-        }
605
-
606
-        echo ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views) . "</li>\n" : '';
607
-        echo "</ul>";
608
-    }
609
-
610
-
611
-    /**
612
-     * Generates content for a single row of the table
613
-     *
614
-     * @since  4.1
615
-     * @access public
616
-     * @param EE_Base_Class $item The current item
617
-     */
618
-    public function single_row($item)
619
-    {
620
-        $row_class = $this->_get_row_class($item);
621
-        echo '<tr class="' . esc_attr($row_class) . '">';
622
-        $this->single_row_columns($item);
623
-        echo '</tr>';
624
-    }
625
-
626
-
627
-    /**
628
-     * This simply sets up the row class for the table rows.
629
-     * Allows for easier overriding of child methods for setting up sorting.
630
-     *
631
-     * @param  EE_Base_Class $item the current item
632
-     * @return string
633
-     */
634
-    protected function _get_row_class($item)
635
-    {
636
-        static $row_class = '';
637
-        $row_class = ($row_class === '' ? 'alternate' : '');
638
-
639
-        $new_row_class = $row_class;
640
-
641
-        if (! empty($this->_ajax_sorting_callback)) {
642
-            $new_row_class .= ' rowsortable';
643
-        }
644
-
645
-        return $new_row_class;
646
-    }
647
-
648
-
649
-    /**
650
-     * @return array
651
-     */
652
-    public function get_sortable_columns()
653
-    {
654
-        return (array) $this->_sortable_columns;
655
-    }
656
-
657
-
658
-    /**
659
-     * @return string
660
-     */
661
-    public function get_ajax_sorting_callback()
662
-    {
663
-        return $this->_ajax_sorting_callback;
664
-    }
665
-
666
-
667
-    /**
668
-     * @return array
669
-     */
670
-    public function get_hidden_columns()
671
-    {
672
-        $user_id = get_current_user_id();
673
-        $has_default = get_user_option('default' . $this->screen->id . 'columnshidden', $user_id);
674
-        if (empty($has_default) && ! empty($this->_hidden_columns)) {
675
-            update_user_option($user_id, 'default' . $this->screen->id . 'columnshidden', true);
676
-            update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, true);
677
-        }
678
-        $ref = 'manage' . $this->screen->id . 'columnshidden';
679
-        return (array) get_user_option($ref, $user_id);
680
-    }
681
-
682
-
683
-    /**
684
-     * Generates the columns for a single row of the table.
685
-     * Overridden from wp_list_table so as to allow us to filter the column content for a given
686
-     * column.
687
-     *
688
-     * @since 3.1.0
689
-     * @param EE_Base_Class $item The current item
690
-     */
691
-    public function single_row_columns($item)
692
-    {
693
-        list($columns, $hidden, $sortable, $primary) = $this->get_column_info();
694
-
695
-        global $wp_version;
696
-        $use_hidden_class = version_compare($wp_version, '4.3-RC', '>=');
697
-
698
-        foreach ($columns as $column_name => $column_display_name) {
699
-
700
-            /**
701
-             * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns
702
-             * are hidden or not instead of using "display:none;".  This bit of code provides backward compat.
703
-             */
704
-            $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : '';
705
-            $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : '';
706
-
707
-            $classes = $column_name . ' column-' . $column_name . $hidden_class;
708
-            if ($primary === $column_name) {
709
-                $classes .= ' has-row-actions column-primary';
710
-            }
711
-
712
-            $data = ' data-colname="' . wp_strip_all_tags($column_display_name) . '"';
713
-
714
-            $class = "class='$classes'";
715
-
716
-            $attributes = "$class$style$data";
717
-
718
-            if ($column_name === 'cb') {
719
-                echo '<th scope="row" class="check-column">';
720
-                echo apply_filters(
721
-                    'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content',
722
-                    $this->column_cb($item),
723
-                    $item,
724
-                    $this
725
-                );
726
-                echo '</th>';
727
-            } elseif (method_exists($this, 'column_' . $column_name)) {
728
-                echo "<td $attributes>";
729
-                echo apply_filters(
730
-                    'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content',
731
-                    call_user_func(array($this, 'column_' . $column_name), $item),
732
-                    $item,
733
-                    $this
734
-                );
735
-                echo $this->handle_row_actions($item, $column_name, $primary);
736
-                echo "</td>";
737
-            } else {
738
-                echo "<td $attributes>";
739
-                echo apply_filters(
740
-                    'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content',
741
-                    $this->column_default($item, $column_name),
742
-                    $item,
743
-                    $column_name,
744
-                    $this
745
-                );
746
-                echo $this->handle_row_actions($item, $column_name, $primary);
747
-                echo "</td>";
748
-            }
749
-        }
750
-    }
751
-
752
-
753
-    /**
754
-     * Extra controls to be displayed between bulk actions and pagination
755
-     *
756
-     * @access public
757
-     * @param string $which
758
-     * @throws \EE_Error
759
-     */
760
-    public function extra_tablenav($which)
761
-    {
762
-        if ($which === 'top') {
763
-            $this->_filters();
764
-            echo $this->_get_hidden_fields();
765
-        } else {
766
-            echo '<div class="list-table-bottom-buttons alignleft actions">';
767
-            foreach ($this->_bottom_buttons as $type => $action) {
768
-                $route = isset($action['route']) ? $action['route'] : '';
769
-                $extra_request = isset($action['extra_request']) ? $action['extra_request'] : '';
770
-                echo $this->_admin_page->get_action_link_or_button(
771
-                    $route,
772
-                    $type,
773
-                    $extra_request,
774
-                    'button button-secondary',
775
-                    '',
776
-                    false
777
-                );
778
-            }
779
-            do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen);
780
-            echo '</div>';
781
-        }
782
-        // echo $this->_entries_per_page_dropdown;
783
-    }
784
-
785
-
786
-    /**
787
-     * Get an associative array ( option_name => option_title ) with the list
788
-     * of bulk actions available on this table.
789
-     *
790
-     * @since  3.1.0
791
-     * @access protected
792
-     * @return array
793
-     */
794
-    public function get_bulk_actions()
795
-    {
796
-        return (array) $this->_get_bulk_actions();
797
-    }
798
-
799
-    /**
800
-     * Processing bulk actions.
801
-     */
802
-    public function process_bulk_action()
803
-    {
804
-        // this is not used it is handled by the child EE_Admin_Page class (routes).  However, including here for
805
-        // reference in case there is a case where it gets used.
806
-    }
807
-
808
-
809
-    /**
810
-     * returns the EE admin page this list table is associated with
811
-     *
812
-     * @return EE_Admin_Page
813
-     */
814
-    public function get_admin_page()
815
-    {
816
-        return $this->_admin_page;
817
-    }
818
-
819
-
820
-    /**
821
-     * A "helper" function for all children to provide an html string of
822
-     * actions to output in their content.  It is preferable for child classes
823
-     * to use this method for generating their actions content so that it's
824
-     * filterable by plugins
825
-     *
826
-     * @param string        $action_container           what are the html container
827
-     *                                                  elements for this actions string?
828
-     * @param string        $action_class               What class is for the container
829
-     *                                                  element.
830
-     * @param string        $action_items               The contents for the action items
831
-     *                                                  container.  This is filtered before
832
-     *                                                  returned.
833
-     * @param string        $action_id                  What id (optional) is used for the
834
-     *                                                  container element.
835
-     * @param EE_Base_Class $item                       The object for the column displaying
836
-     *                                                  the actions.
837
-     * @return string The assembled action elements container.
838
-     */
839
-    protected function _action_string(
840
-        $action_items,
841
-        $item,
842
-        $action_container = 'ul',
843
-        $action_class = '',
844
-        $action_id = ''
845
-    ) {
846
-        $content = '';
847
-        $action_class = ! empty($action_class) ? ' class="' . $action_class . '"' : '';
848
-        $action_id = ! empty($action_id) ? ' id="' . $action_id . '"' : '';
849
-        $content .= ! empty($action_container) ? '<' . $action_container . $action_class . $action_id . '>' : '';
850
-        try {
851
-            $content .= apply_filters(
852
-                'FHEE__EE_Admin_List_Table___action_string__action_items',
853
-                $action_items,
854
-                $item,
855
-                $this
856
-            );
857
-        } catch (\Exception $e) {
858
-            if (WP_DEBUG) {
859
-                \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
860
-            }
861
-            $content .= $action_items;
862
-        }
863
-        $content .= ! empty($action_container) ? '</' . $action_container . '>' : '';
864
-        return $content;
865
-    }
442
+	}
443
+
444
+
445
+	/**
446
+	 * _filters
447
+	 * This receives the filters array from children _get_table_filters() and assembles the string including the filter
448
+	 * button.
449
+	 *
450
+	 * @access private
451
+	 * @return string html showing filters
452
+	 */
453
+	private function _filters()
454
+	{
455
+		$classname = get_class($this);
456
+		$filters = apply_filters(
457
+			"FHEE__{$classname}__filters",
458
+			(array) $this->_get_table_filters(),
459
+			$this,
460
+			$this->_screen
461
+		);
462
+
463
+		if (empty($filters)) {
464
+			return;
465
+		}
466
+		foreach ($filters as $filter) {
467
+			echo $filter;
468
+		}
469
+		// add filter button at end
470
+		echo '<input type="submit" class="button-secondary" value="'
471
+			 . esc_html__('Filter', 'event_espresso')
472
+			 . '" id="post-query-submit" />';
473
+		// add reset filters button at end
474
+		echo '<a class="button button-secondary"  href="'
475
+			 . $this->_admin_page->get_current_page_view_url()
476
+			 . '" style="display:inline-block">'
477
+			 . esc_html__('Reset Filters', 'event_espresso')
478
+			 . '</a>';
479
+	}
480
+
481
+
482
+	/**
483
+	 * Callback for 'list_table_primary_column' WordPress filter
484
+	 * If child EE_Admin_List_Table classes set the _primary_column property then that will be set as the primary
485
+	 * column when class is instantiated.
486
+	 *
487
+	 * @see WP_List_Table::get_primary_column_name
488
+	 * @param string $column_name
489
+	 * @return string
490
+	 */
491
+	public function set_primary_column($column_name)
492
+	{
493
+		return ! empty($this->_primary_column) ? $this->_primary_column : $column_name;
494
+	}
495
+
496
+
497
+	/**
498
+	 *
499
+	 */
500
+	public function prepare_items()
501
+	{
502
+
503
+		$this->_set_column_info();
504
+		// $this->_column_headers = $this->get_column_info();
505
+		$total_items = $this->_all_data_count;
506
+		$this->process_bulk_action();
507
+
508
+		$this->items = $this->_data;
509
+		$this->set_pagination_args(
510
+			array(
511
+				'total_items' => $total_items,
512
+				'per_page'    => $this->_per_page,
513
+				'total_pages' => ceil($total_items / $this->_per_page),
514
+			)
515
+		);
516
+	}
517
+
518
+
519
+	/**
520
+	 * This column is the default for when there is no defined column method for a registered column.
521
+	 * This can be overridden by child classes, but allows for hooking in for custom columns.
522
+	 *
523
+	 * @param EE_Base_Class $item
524
+	 * @param string        $column_name The column being called.
525
+	 * @return string html content for the column
526
+	 */
527
+	public function column_default($item, $column_name)
528
+	{
529
+		/**
530
+		 * Dynamic hook allowing for adding additional column content in this list table.
531
+		 * Note that $this->screen->id is in the format
532
+		 * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
533
+		 * table it is: event-espresso_page_espresso_messages.
534
+		 * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
535
+		 * hook prefix ("event-espresso") will be different.
536
+		 */
537
+		do_action(
538
+			'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id,
539
+			$item,
540
+			$this->_screen
541
+		);
542
+	}
543
+
544
+
545
+	/**
546
+	 * Get a list of columns. The format is:
547
+	 * 'internal-name' => 'Title'
548
+	 *
549
+	 * @since  3.1.0
550
+	 * @access public
551
+	 * @abstract
552
+	 * @return array
553
+	 */
554
+	public function get_columns()
555
+	{
556
+		/**
557
+		 * Dynamic hook allowing for adding additional columns in this list table.
558
+		 * Note that $this->screen->id is in the format
559
+		 * {sanitize_title($top_level_menu_label)}_page_{$espresso_admin_page_slug}.  So for the messages list
560
+		 * table it is: event-espresso_page_espresso_messages.
561
+		 * However, take note that if the top level menu label has been translated (i.e. "Event Espresso"). then the
562
+		 * hook prefix ("event-espresso") will be different.
563
+		 *
564
+		 * @var array
565
+		 */
566
+		$columns = apply_filters('FHEE_manage_' . $this->screen->id . '_columns', $this->_columns, $this->_screen);
567
+		return $columns;
568
+	}
569
+
570
+
571
+	/**
572
+	 * Get an associative array ( id => link ) with the list
573
+	 * of views available on this table.
574
+	 *
575
+	 * @since  3.1.0
576
+	 * @access protected
577
+	 * @return array
578
+	 */
579
+	public function get_views()
580
+	{
581
+		return $this->_views;
582
+	}
583
+
584
+
585
+	/**
586
+	 * Generate the views html.
587
+	 */
588
+	public function display_views()
589
+	{
590
+		$views = $this->get_views();
591
+		$assembled_views = array();
592
+
593
+		if (empty($views)) {
594
+			return;
595
+		}
596
+		echo "<ul class='subsubsub'>\n";
597
+		foreach ($views as $view) {
598
+			$count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;
599
+			if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) {
600
+				$assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>"
601
+													. '<a href="' . $view['url'] . '">' . $view['label'] . '</a>'
602
+													. ' <span class="count">(' . $count . ')</span>';
603
+			}
604
+		}
605
+
606
+		echo ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views) . "</li>\n" : '';
607
+		echo "</ul>";
608
+	}
609
+
610
+
611
+	/**
612
+	 * Generates content for a single row of the table
613
+	 *
614
+	 * @since  4.1
615
+	 * @access public
616
+	 * @param EE_Base_Class $item The current item
617
+	 */
618
+	public function single_row($item)
619
+	{
620
+		$row_class = $this->_get_row_class($item);
621
+		echo '<tr class="' . esc_attr($row_class) . '">';
622
+		$this->single_row_columns($item);
623
+		echo '</tr>';
624
+	}
625
+
626
+
627
+	/**
628
+	 * This simply sets up the row class for the table rows.
629
+	 * Allows for easier overriding of child methods for setting up sorting.
630
+	 *
631
+	 * @param  EE_Base_Class $item the current item
632
+	 * @return string
633
+	 */
634
+	protected function _get_row_class($item)
635
+	{
636
+		static $row_class = '';
637
+		$row_class = ($row_class === '' ? 'alternate' : '');
638
+
639
+		$new_row_class = $row_class;
640
+
641
+		if (! empty($this->_ajax_sorting_callback)) {
642
+			$new_row_class .= ' rowsortable';
643
+		}
644
+
645
+		return $new_row_class;
646
+	}
647
+
648
+
649
+	/**
650
+	 * @return array
651
+	 */
652
+	public function get_sortable_columns()
653
+	{
654
+		return (array) $this->_sortable_columns;
655
+	}
656
+
657
+
658
+	/**
659
+	 * @return string
660
+	 */
661
+	public function get_ajax_sorting_callback()
662
+	{
663
+		return $this->_ajax_sorting_callback;
664
+	}
665
+
666
+
667
+	/**
668
+	 * @return array
669
+	 */
670
+	public function get_hidden_columns()
671
+	{
672
+		$user_id = get_current_user_id();
673
+		$has_default = get_user_option('default' . $this->screen->id . 'columnshidden', $user_id);
674
+		if (empty($has_default) && ! empty($this->_hidden_columns)) {
675
+			update_user_option($user_id, 'default' . $this->screen->id . 'columnshidden', true);
676
+			update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, true);
677
+		}
678
+		$ref = 'manage' . $this->screen->id . 'columnshidden';
679
+		return (array) get_user_option($ref, $user_id);
680
+	}
681
+
682
+
683
+	/**
684
+	 * Generates the columns for a single row of the table.
685
+	 * Overridden from wp_list_table so as to allow us to filter the column content for a given
686
+	 * column.
687
+	 *
688
+	 * @since 3.1.0
689
+	 * @param EE_Base_Class $item The current item
690
+	 */
691
+	public function single_row_columns($item)
692
+	{
693
+		list($columns, $hidden, $sortable, $primary) = $this->get_column_info();
694
+
695
+		global $wp_version;
696
+		$use_hidden_class = version_compare($wp_version, '4.3-RC', '>=');
697
+
698
+		foreach ($columns as $column_name => $column_display_name) {
699
+
700
+			/**
701
+			 * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns
702
+			 * are hidden or not instead of using "display:none;".  This bit of code provides backward compat.
703
+			 */
704
+			$hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : '';
705
+			$style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : '';
706
+
707
+			$classes = $column_name . ' column-' . $column_name . $hidden_class;
708
+			if ($primary === $column_name) {
709
+				$classes .= ' has-row-actions column-primary';
710
+			}
711
+
712
+			$data = ' data-colname="' . wp_strip_all_tags($column_display_name) . '"';
713
+
714
+			$class = "class='$classes'";
715
+
716
+			$attributes = "$class$style$data";
717
+
718
+			if ($column_name === 'cb') {
719
+				echo '<th scope="row" class="check-column">';
720
+				echo apply_filters(
721
+					'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content',
722
+					$this->column_cb($item),
723
+					$item,
724
+					$this
725
+				);
726
+				echo '</th>';
727
+			} elseif (method_exists($this, 'column_' . $column_name)) {
728
+				echo "<td $attributes>";
729
+				echo apply_filters(
730
+					'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content',
731
+					call_user_func(array($this, 'column_' . $column_name), $item),
732
+					$item,
733
+					$this
734
+				);
735
+				echo $this->handle_row_actions($item, $column_name, $primary);
736
+				echo "</td>";
737
+			} else {
738
+				echo "<td $attributes>";
739
+				echo apply_filters(
740
+					'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content',
741
+					$this->column_default($item, $column_name),
742
+					$item,
743
+					$column_name,
744
+					$this
745
+				);
746
+				echo $this->handle_row_actions($item, $column_name, $primary);
747
+				echo "</td>";
748
+			}
749
+		}
750
+	}
751
+
752
+
753
+	/**
754
+	 * Extra controls to be displayed between bulk actions and pagination
755
+	 *
756
+	 * @access public
757
+	 * @param string $which
758
+	 * @throws \EE_Error
759
+	 */
760
+	public function extra_tablenav($which)
761
+	{
762
+		if ($which === 'top') {
763
+			$this->_filters();
764
+			echo $this->_get_hidden_fields();
765
+		} else {
766
+			echo '<div class="list-table-bottom-buttons alignleft actions">';
767
+			foreach ($this->_bottom_buttons as $type => $action) {
768
+				$route = isset($action['route']) ? $action['route'] : '';
769
+				$extra_request = isset($action['extra_request']) ? $action['extra_request'] : '';
770
+				echo $this->_admin_page->get_action_link_or_button(
771
+					$route,
772
+					$type,
773
+					$extra_request,
774
+					'button button-secondary',
775
+					'',
776
+					false
777
+				);
778
+			}
779
+			do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen);
780
+			echo '</div>';
781
+		}
782
+		// echo $this->_entries_per_page_dropdown;
783
+	}
784
+
785
+
786
+	/**
787
+	 * Get an associative array ( option_name => option_title ) with the list
788
+	 * of bulk actions available on this table.
789
+	 *
790
+	 * @since  3.1.0
791
+	 * @access protected
792
+	 * @return array
793
+	 */
794
+	public function get_bulk_actions()
795
+	{
796
+		return (array) $this->_get_bulk_actions();
797
+	}
798
+
799
+	/**
800
+	 * Processing bulk actions.
801
+	 */
802
+	public function process_bulk_action()
803
+	{
804
+		// this is not used it is handled by the child EE_Admin_Page class (routes).  However, including here for
805
+		// reference in case there is a case where it gets used.
806
+	}
807
+
808
+
809
+	/**
810
+	 * returns the EE admin page this list table is associated with
811
+	 *
812
+	 * @return EE_Admin_Page
813
+	 */
814
+	public function get_admin_page()
815
+	{
816
+		return $this->_admin_page;
817
+	}
818
+
819
+
820
+	/**
821
+	 * A "helper" function for all children to provide an html string of
822
+	 * actions to output in their content.  It is preferable for child classes
823
+	 * to use this method for generating their actions content so that it's
824
+	 * filterable by plugins
825
+	 *
826
+	 * @param string        $action_container           what are the html container
827
+	 *                                                  elements for this actions string?
828
+	 * @param string        $action_class               What class is for the container
829
+	 *                                                  element.
830
+	 * @param string        $action_items               The contents for the action items
831
+	 *                                                  container.  This is filtered before
832
+	 *                                                  returned.
833
+	 * @param string        $action_id                  What id (optional) is used for the
834
+	 *                                                  container element.
835
+	 * @param EE_Base_Class $item                       The object for the column displaying
836
+	 *                                                  the actions.
837
+	 * @return string The assembled action elements container.
838
+	 */
839
+	protected function _action_string(
840
+		$action_items,
841
+		$item,
842
+		$action_container = 'ul',
843
+		$action_class = '',
844
+		$action_id = ''
845
+	) {
846
+		$content = '';
847
+		$action_class = ! empty($action_class) ? ' class="' . $action_class . '"' : '';
848
+		$action_id = ! empty($action_id) ? ' id="' . $action_id . '"' : '';
849
+		$content .= ! empty($action_container) ? '<' . $action_container . $action_class . $action_id . '>' : '';
850
+		try {
851
+			$content .= apply_filters(
852
+				'FHEE__EE_Admin_List_Table___action_string__action_items',
853
+				$action_items,
854
+				$item,
855
+				$this
856
+			);
857
+		} catch (\Exception $e) {
858
+			if (WP_DEBUG) {
859
+				\EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
860
+			}
861
+			$content .= $action_items;
862
+		}
863
+		$content .= ! empty($action_container) ? '</' . $action_container . '>' : '';
864
+		return $content;
865
+	}
866 866
 }
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! class_exists('WP_List_Table')) {
4
-    require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
3
+if ( ! class_exists('WP_List_Table')) {
4
+    require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
5 5
 }
6 6
 
7 7
 
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
         $this->_view = $this->_admin_page->get_view();
205 205
         $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
206 206
         $this->_current_page = $this->get_pagenum();
207
-        $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();
207
+        $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view();
208 208
         $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso'));
209 209
 
210
-        $this->_per_page = $this->get_items_per_page($this->_screen . '_per_page', 20);
210
+        $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 20);
211 211
 
212 212
         $this->_setup_data();
213 213
         $this->_add_view_counts();
@@ -287,14 +287,14 @@  discard block
 block discarded – undo
287 287
         $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;
288 288
         // if action is STILL empty, then we set it to default
289 289
         $action = empty($action) ? 'default' : $action;
290
-        $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n";
291
-        $field .= '<input type="hidden" name="route" value="' . $action . '" />' . "\n";/**/
292
-        $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n";
290
+        $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n";
291
+        $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/
292
+        $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n";
293 293
 
294 294
         $bulk_actions = $this->_get_bulk_actions();
295 295
         foreach ($bulk_actions as $bulk_action => $label) {
296
-            $field .= '<input type="hidden" name="' . $bulk_action . '_nonce"'
297
-                      . ' value="' . wp_create_nonce($bulk_action . '_nonce') . '" />' . "\n";
296
+            $field .= '<input type="hidden" name="'.$bulk_action.'_nonce"'
297
+                      . ' value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n";
298 298
         }
299 299
 
300 300
         return $field;
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 
342 342
             $data = (array) $data;
343 343
 
344
-            if (! isset($data[1])) {
344
+            if ( ! isset($data[1])) {
345 345
                 $_data[1] = false;
346 346
             }
347 347
 
348
-            $sortable[ $id ] = $_data;
348
+            $sortable[$id] = $_data;
349 349
         }
350 350
         $primary = $this->get_primary_column_name();
351 351
         $this->_column_headers = array($columns, $hidden, $sortable, $primary);
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                 // for that page route and skip adding the bulk action if no access for the current logged in user.
406 406
                 foreach ($args['bulk_action'] as $route => $label) {
407 407
                     if ($this->_admin_page->check_user_access($route, true)) {
408
-                        $actions[ $route ] = $label;
408
+                        $actions[$route] = $label;
409 409
                     }
410 410
                 }
411 411
             }
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
     public function display_tablenav($which)
424 424
     {
425 425
         if ('top' === $which) {
426
-            wp_nonce_field('bulk-' . $this->_args['plural']);
426
+            wp_nonce_field('bulk-'.$this->_args['plural']);
427 427
         }
428 428
         ?>
429 429
         <div class="tablenav <?php echo esc_attr($which); ?>">
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
          * hook prefix ("event-espresso") will be different.
536 536
          */
537 537
         do_action(
538
-            'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id,
538
+            'AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id,
539 539
             $item,
540 540
             $this->_screen
541 541
         );
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
          *
564 564
          * @var array
565 565
          */
566
-        $columns = apply_filters('FHEE_manage_' . $this->screen->id . '_columns', $this->_columns, $this->_screen);
566
+        $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen);
567 567
         return $columns;
568 568
     }
569 569
 
@@ -597,13 +597,13 @@  discard block
 block discarded – undo
597 597
         foreach ($views as $view) {
598 598
             $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;
599 599
             if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) {
600
-                $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>"
601
-                                                    . '<a href="' . $view['url'] . '">' . $view['label'] . '</a>'
602
-                                                    . ' <span class="count">(' . $count . ')</span>';
600
+                $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>"
601
+                                                    . '<a href="'.$view['url'].'">'.$view['label'].'</a>'
602
+                                                    . ' <span class="count">('.$count.')</span>';
603 603
             }
604 604
         }
605 605
 
606
-        echo ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views) . "</li>\n" : '';
606
+        echo ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : '';
607 607
         echo "</ul>";
608 608
     }
609 609
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
     public function single_row($item)
619 619
     {
620 620
         $row_class = $this->_get_row_class($item);
621
-        echo '<tr class="' . esc_attr($row_class) . '">';
621
+        echo '<tr class="'.esc_attr($row_class).'">';
622 622
         $this->single_row_columns($item);
623 623
         echo '</tr>';
624 624
     }
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 
639 639
         $new_row_class = $row_class;
640 640
 
641
-        if (! empty($this->_ajax_sorting_callback)) {
641
+        if ( ! empty($this->_ajax_sorting_callback)) {
642 642
             $new_row_class .= ' rowsortable';
643 643
         }
644 644
 
@@ -670,12 +670,12 @@  discard block
 block discarded – undo
670 670
     public function get_hidden_columns()
671 671
     {
672 672
         $user_id = get_current_user_id();
673
-        $has_default = get_user_option('default' . $this->screen->id . 'columnshidden', $user_id);
673
+        $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id);
674 674
         if (empty($has_default) && ! empty($this->_hidden_columns)) {
675
-            update_user_option($user_id, 'default' . $this->screen->id . 'columnshidden', true);
676
-            update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, true);
675
+            update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', true);
676
+            update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, true);
677 677
         }
678
-        $ref = 'manage' . $this->screen->id . 'columnshidden';
678
+        $ref = 'manage'.$this->screen->id.'columnshidden';
679 679
         return (array) get_user_option($ref, $user_id);
680 680
     }
681 681
 
@@ -704,12 +704,12 @@  discard block
 block discarded – undo
704 704
             $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : '';
705 705
             $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : '';
706 706
 
707
-            $classes = $column_name . ' column-' . $column_name . $hidden_class;
707
+            $classes = $column_name.' column-'.$column_name.$hidden_class;
708 708
             if ($primary === $column_name) {
709 709
                 $classes .= ' has-row-actions column-primary';
710 710
             }
711 711
 
712
-            $data = ' data-colname="' . wp_strip_all_tags($column_display_name) . '"';
712
+            $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"';
713 713
 
714 714
             $class = "class='$classes'";
715 715
 
@@ -724,11 +724,11 @@  discard block
 block discarded – undo
724 724
                     $this
725 725
                 );
726 726
                 echo '</th>';
727
-            } elseif (method_exists($this, 'column_' . $column_name)) {
727
+            } elseif (method_exists($this, 'column_'.$column_name)) {
728 728
                 echo "<td $attributes>";
729 729
                 echo apply_filters(
730
-                    'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content',
731
-                    call_user_func(array($this, 'column_' . $column_name), $item),
730
+                    'FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content',
731
+                    call_user_func(array($this, 'column_'.$column_name), $item),
732 732
                     $item,
733 733
                     $this
734 734
                 );
@@ -844,9 +844,9 @@  discard block
 block discarded – undo
844 844
         $action_id = ''
845 845
     ) {
846 846
         $content = '';
847
-        $action_class = ! empty($action_class) ? ' class="' . $action_class . '"' : '';
848
-        $action_id = ! empty($action_id) ? ' id="' . $action_id . '"' : '';
849
-        $content .= ! empty($action_container) ? '<' . $action_container . $action_class . $action_id . '>' : '';
847
+        $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : '';
848
+        $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : '';
849
+        $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : '';
850 850
         try {
851 851
             $content .= apply_filters(
852 852
                 'FHEE__EE_Admin_List_Table___action_string__action_items',
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
             }
861 861
             $content .= $action_items;
862 862
         }
863
-        $content .= ! empty($action_container) ? '</' . $action_container . '>' : '';
863
+        $content .= ! empty($action_container) ? '</'.$action_container.'>' : '';
864 864
         return $content;
865 865
     }
866 866
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Admin_File_Uploader_Input.input.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -14,27 +14,27 @@
 block discarded – undo
14 14
 class EE_Admin_File_Uploader_Input extends EE_Form_Input_Base
15 15
 {
16 16
 
17
-    /**
18
-     * @param array $input_settings
19
-     * @throws InvalidArgumentException
20
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
21
-     * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
22
-     */
23
-    public function __construct($input_settings = array())
24
-    {
25
-        $this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy());
26
-        $this->_set_normalization_strategy(new EE_Text_Normalization());
27
-        $this->_add_validation_strategy(
28
-            LoaderFactory::getLoader()->getNew(
29
-                'EE_URL_Validation_Strategy',
30
-                array(
31
-                    isset($input_settings['validation_error_message'])
32
-                        ? $input_settings['validation_error_message']
33
-                        : null,
34
-                    false
35
-                )
36
-            )
37
-        );
38
-        parent::__construct($input_settings);
39
-    }
17
+	/**
18
+	 * @param array $input_settings
19
+	 * @throws InvalidArgumentException
20
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
21
+	 * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
22
+	 */
23
+	public function __construct($input_settings = array())
24
+	{
25
+		$this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy());
26
+		$this->_set_normalization_strategy(new EE_Text_Normalization());
27
+		$this->_add_validation_strategy(
28
+			LoaderFactory::getLoader()->getNew(
29
+				'EE_URL_Validation_Strategy',
30
+				array(
31
+					isset($input_settings['validation_error_message'])
32
+						? $input_settings['validation_error_message']
33
+						: null,
34
+					false
35
+				)
36
+			)
37
+		);
38
+		parent::__construct($input_settings);
39
+	}
40 40
 }
Please login to merge, or discard this patch.