Completed
Branch CAFEREL (9bc155)
by
unknown
07:16 queued 03:43
created
registration_form/Registration_Form_Questions_Admin_List_Table.class.php 1 patch
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -15,223 +15,223 @@
 block discarded – undo
15 15
  */
16 16
 class Registration_Form_Questions_Admin_List_Table extends EE_Admin_List_Table
17 17
 {
18
-    /**
19
-     * @var Registration_Form_Admin_Page $_admin_page
20
-     */
21
-    protected $_admin_page;
22
-
23
-    /**
24
-     * @var RegFormListTableUserCapabilities
25
-     */
26
-    protected $caps_handler;
27
-
28
-
29
-    public function __construct($admin_page)
30
-    {
31
-        $this->caps_handler = new RegFormListTableUserCapabilities(EE_Registry::instance()->CAP);
32
-        parent::__construct($admin_page);
33
-
34
-        if (! defined('REG_ADMIN_URL')) {
35
-            define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
36
-        }
37
-    }
38
-
39
-
40
-    /**
41
-     * @throws EE_Error
42
-     */
43
-    protected function _setup_data()
44
-    {
45
-        if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash') {
46
-            $this->_data = $this->_admin_page->get_trashed_questions($this->_per_page, $this->_current_page);
47
-        } else {
48
-            $this->_data = $this->_admin_page->get_questions($this->_per_page, $this->_current_page);
49
-        }
50
-        $this->_all_data_count = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true);
51
-    }
52
-
53
-
54
-    protected function _set_properties()
55
-    {
56
-        $this->_wp_list_args = [
57
-            'singular' => esc_html__('question', 'event_espresso'),
58
-            'plural'   => esc_html__('questions', 'event_espresso'),
59
-            'ajax'     => true, // for now,
60
-            'screen'   => $this->_admin_page->get_current_screen()->id,
61
-        ];
62
-
63
-        $this->_columns = [
64
-            'cb'           => '<input type="checkbox" />',
65
-            'id'           => esc_html__('ID', 'event_espresso'),
66
-            'display_text' => esc_html__('Question', 'event_espresso'),
67
-            'admin_label'  => esc_html__('Admin Label', 'event_espresso'),
68
-            'type'         => esc_html__('Type', 'event_espresso'),
69
-            'values'       => esc_html__('Values', 'event_espresso'),
70
-            'required'     => esc_html__('Req', 'event_espresso'),
71
-        ];
72
-
73
-        $this->_primary_column = 'id';
74
-
75
-        $this->_sortable_columns = [
76
-            'id'           => ['QST_ID' => false],
77
-            'display_text' => ['QST_display_text' => false],
78
-        ];
79
-
80
-        $this->_hidden_columns = [];
81
-    }
82
-
83
-
84
-    // not needed
85
-    protected function _get_table_filters()
86
-    {
87
-        return [];
88
-    }
89
-
90
-
91
-    /**
92
-     * @throws EE_Error
93
-     */
94
-    protected function _add_view_counts()
95
-    {
96
-        $this->_views['all']['count'] = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true);
97
-        if ($this->caps_handler->userCanTrashQuestions()) {
98
-            $this->_views['trash']['count'] = $this->_admin_page->get_trashed_questions(-1, $this->_current_page, true);
99
-        }
100
-    }
101
-
102
-
103
-    /**
104
-     * @param EE_Question $item
105
-     * @return string
106
-     * @throws EE_Error
107
-     * @throws ReflectionException
108
-     */
109
-    public function column_cb($item): string
110
-    {
111
-        $system_question      = $item->is_system_question();
112
-        $related_answer_count = $item->count_related('Answer');
113
-        $has_answers          = ! $system_question && $related_answer_count > 0 && $this->_view == 'trash';
114
-        $notice               = $has_answers
115
-            ? esc_html__(
116
-                'This question has answers attached to it from registrations that have the question.  It cannot be permanently deleted.',
117
-                'event_espresso'
118
-            )
119
-            : esc_html__('This question is a system question and cannot be trashed', 'event_espresso');
120
-
121
-        return $system_question || $has_answers
122
-            ? '
18
+	/**
19
+	 * @var Registration_Form_Admin_Page $_admin_page
20
+	 */
21
+	protected $_admin_page;
22
+
23
+	/**
24
+	 * @var RegFormListTableUserCapabilities
25
+	 */
26
+	protected $caps_handler;
27
+
28
+
29
+	public function __construct($admin_page)
30
+	{
31
+		$this->caps_handler = new RegFormListTableUserCapabilities(EE_Registry::instance()->CAP);
32
+		parent::__construct($admin_page);
33
+
34
+		if (! defined('REG_ADMIN_URL')) {
35
+			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
36
+		}
37
+	}
38
+
39
+
40
+	/**
41
+	 * @throws EE_Error
42
+	 */
43
+	protected function _setup_data()
44
+	{
45
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash') {
46
+			$this->_data = $this->_admin_page->get_trashed_questions($this->_per_page, $this->_current_page);
47
+		} else {
48
+			$this->_data = $this->_admin_page->get_questions($this->_per_page, $this->_current_page);
49
+		}
50
+		$this->_all_data_count = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true);
51
+	}
52
+
53
+
54
+	protected function _set_properties()
55
+	{
56
+		$this->_wp_list_args = [
57
+			'singular' => esc_html__('question', 'event_espresso'),
58
+			'plural'   => esc_html__('questions', 'event_espresso'),
59
+			'ajax'     => true, // for now,
60
+			'screen'   => $this->_admin_page->get_current_screen()->id,
61
+		];
62
+
63
+		$this->_columns = [
64
+			'cb'           => '<input type="checkbox" />',
65
+			'id'           => esc_html__('ID', 'event_espresso'),
66
+			'display_text' => esc_html__('Question', 'event_espresso'),
67
+			'admin_label'  => esc_html__('Admin Label', 'event_espresso'),
68
+			'type'         => esc_html__('Type', 'event_espresso'),
69
+			'values'       => esc_html__('Values', 'event_espresso'),
70
+			'required'     => esc_html__('Req', 'event_espresso'),
71
+		];
72
+
73
+		$this->_primary_column = 'id';
74
+
75
+		$this->_sortable_columns = [
76
+			'id'           => ['QST_ID' => false],
77
+			'display_text' => ['QST_display_text' => false],
78
+		];
79
+
80
+		$this->_hidden_columns = [];
81
+	}
82
+
83
+
84
+	// not needed
85
+	protected function _get_table_filters()
86
+	{
87
+		return [];
88
+	}
89
+
90
+
91
+	/**
92
+	 * @throws EE_Error
93
+	 */
94
+	protected function _add_view_counts()
95
+	{
96
+		$this->_views['all']['count'] = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, true);
97
+		if ($this->caps_handler->userCanTrashQuestions()) {
98
+			$this->_views['trash']['count'] = $this->_admin_page->get_trashed_questions(-1, $this->_current_page, true);
99
+		}
100
+	}
101
+
102
+
103
+	/**
104
+	 * @param EE_Question $item
105
+	 * @return string
106
+	 * @throws EE_Error
107
+	 * @throws ReflectionException
108
+	 */
109
+	public function column_cb($item): string
110
+	{
111
+		$system_question      = $item->is_system_question();
112
+		$related_answer_count = $item->count_related('Answer');
113
+		$has_answers          = ! $system_question && $related_answer_count > 0 && $this->_view == 'trash';
114
+		$notice               = $has_answers
115
+			? esc_html__(
116
+				'This question has answers attached to it from registrations that have the question.  It cannot be permanently deleted.',
117
+				'event_espresso'
118
+			)
119
+			: esc_html__('This question is a system question and cannot be trashed', 'event_espresso');
120
+
121
+		return $system_question || $has_answers
122
+			? '
123 123
             <span class="dashicons dashicons-lock ee-locked-entity ee-aria-tooltip"
124 124
                     aria-label="' . $notice . '"></span>
125 125
             ' . sprintf('<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID())
126
-            : sprintf('<input type="checkbox" class="QST_ID" name="checkbox[%1$d]" value="%1$d" />', $item->ID());
127
-    }
128
-
129
-
130
-    /**
131
-     * @param EE_Question $item
132
-     * @return string
133
-     * @throws EE_Error
134
-     * @throws ReflectionException
135
-     */
136
-    public function column_id(EE_Question $item): string
137
-    {
138
-        $content = '
126
+			: sprintf('<input type="checkbox" class="QST_ID" name="checkbox[%1$d]" value="%1$d" />', $item->ID());
127
+	}
128
+
129
+
130
+	/**
131
+	 * @param EE_Question $item
132
+	 * @return string
133
+	 * @throws EE_Error
134
+	 * @throws ReflectionException
135
+	 */
136
+	public function column_id(EE_Question $item): string
137
+	{
138
+		$content = '
139 139
             <span class="ee-entity-id">' . $item->ID() . '</span>
140 140
             <span class="show-on-mobile-view-only">
141 141
                 ' . $this->column_display_text($item, false) . '
142 142
             </span>';
143
-        return $this->columnContent('id', $content, 'end');
144
-    }
145
-
146
-
147
-    /**
148
-     * @param EE_Question $question
149
-     * @param bool        $prep_content
150
-     * @return string
151
-     * @throws EE_Error
152
-     * @throws ReflectionException
153
-     */
154
-    public function column_display_text(EE_Question $question, bool $prep_content = true): string
155
-    {
156
-        if ($this->caps_handler->userCanEditQuestion($question)) {
157
-            $content = $this->$this->getActionLink(
158
-                $this->getActionUrl($question, self::ACTION_EDIT),
159
-                $prep_content ? $question->display_text() : $question->admin_label(),
160
-                esc_attr__('Edit Question', 'event_espresso'),
161
-                'row-title'
162
-            );
163
-            $content .= $this->row_actions(
164
-                [
165
-                    'edit' => $this->getActionLink(
166
-                        $this->getActionUrl($question, self::ACTION_EDIT),
167
-                        esc_html__('Edit', 'event_espresso'),
168
-                        esc_attr__('Edit Question', 'event_espresso')
169
-                    ),
170
-                ]
171
-            );
172
-        } else {
173
-            $content = $question->display_text();
174
-        }
175
-
176
-        return $prep_content ? $this->columnContent('display_text', $content) : $content;
177
-    }
178
-
179
-
180
-    /**
181
-     * @param EE_Question $question
182
-     * @param string      $action
183
-     * @return string
184
-     * @throws EE_Error
185
-     * @throws ReflectionException
186
-     * @since $VID:$
187
-     */
188
-    protected function getActionUrl(EE_Question $question, string $action): string
189
-    {
190
-        if (! in_array($action, self::$actions)) {
191
-            throw new DomainException(esc_html__('Invalid Action', 'event_espresso'));
192
-        }
193
-        return EE_Admin_Page::add_query_args_and_nonce(
194
-            [
195
-                'action'   => $action === self::ACTION_DELETE ? "{$action}_questions" : "{$action}_question",
196
-                'QST_ID'   => $question->ID(),
197
-                'noheader' => $action !== self::ACTION_EDIT,
198
-            ],
199
-            EE_FORMS_ADMIN_URL
200
-        );
201
-    }
202
-
203
-
204
-    public function column_admin_label(EE_Question $item): string
205
-    {
206
-        return $this->columnContent('admin_label', $item->admin_label());
207
-    }
208
-
209
-
210
-    public function column_values(EE_Question $item): string
211
-    {
212
-        $optionNames = [];
213
-        $options     = $item->options();
214
-        if (empty($options)) {
215
-            $content = "N/A";
216
-        } else {
217
-            foreach ($options as $option) {
218
-                $optionNames[] = $option->value();
219
-            }
220
-            $content = implode(', ', $optionNames);
221
-        }
222
-        return $this->columnContent('values', $content);
223
-    }
224
-
225
-
226
-    public function column_type(EE_Question $item): string
227
-    {
228
-        return $this->columnContent('type', $item->type());
229
-    }
230
-
231
-
232
-    public function column_required(EE_Question $item): string
233
-    {
234
-        $content = $item->required() ? 'Yes' : '';
235
-        return $this->columnContent('required', $content);
236
-    }
143
+		return $this->columnContent('id', $content, 'end');
144
+	}
145
+
146
+
147
+	/**
148
+	 * @param EE_Question $question
149
+	 * @param bool        $prep_content
150
+	 * @return string
151
+	 * @throws EE_Error
152
+	 * @throws ReflectionException
153
+	 */
154
+	public function column_display_text(EE_Question $question, bool $prep_content = true): string
155
+	{
156
+		if ($this->caps_handler->userCanEditQuestion($question)) {
157
+			$content = $this->$this->getActionLink(
158
+				$this->getActionUrl($question, self::ACTION_EDIT),
159
+				$prep_content ? $question->display_text() : $question->admin_label(),
160
+				esc_attr__('Edit Question', 'event_espresso'),
161
+				'row-title'
162
+			);
163
+			$content .= $this->row_actions(
164
+				[
165
+					'edit' => $this->getActionLink(
166
+						$this->getActionUrl($question, self::ACTION_EDIT),
167
+						esc_html__('Edit', 'event_espresso'),
168
+						esc_attr__('Edit Question', 'event_espresso')
169
+					),
170
+				]
171
+			);
172
+		} else {
173
+			$content = $question->display_text();
174
+		}
175
+
176
+		return $prep_content ? $this->columnContent('display_text', $content) : $content;
177
+	}
178
+
179
+
180
+	/**
181
+	 * @param EE_Question $question
182
+	 * @param string      $action
183
+	 * @return string
184
+	 * @throws EE_Error
185
+	 * @throws ReflectionException
186
+	 * @since $VID:$
187
+	 */
188
+	protected function getActionUrl(EE_Question $question, string $action): string
189
+	{
190
+		if (! in_array($action, self::$actions)) {
191
+			throw new DomainException(esc_html__('Invalid Action', 'event_espresso'));
192
+		}
193
+		return EE_Admin_Page::add_query_args_and_nonce(
194
+			[
195
+				'action'   => $action === self::ACTION_DELETE ? "{$action}_questions" : "{$action}_question",
196
+				'QST_ID'   => $question->ID(),
197
+				'noheader' => $action !== self::ACTION_EDIT,
198
+			],
199
+			EE_FORMS_ADMIN_URL
200
+		);
201
+	}
202
+
203
+
204
+	public function column_admin_label(EE_Question $item): string
205
+	{
206
+		return $this->columnContent('admin_label', $item->admin_label());
207
+	}
208
+
209
+
210
+	public function column_values(EE_Question $item): string
211
+	{
212
+		$optionNames = [];
213
+		$options     = $item->options();
214
+		if (empty($options)) {
215
+			$content = "N/A";
216
+		} else {
217
+			foreach ($options as $option) {
218
+				$optionNames[] = $option->value();
219
+			}
220
+			$content = implode(', ', $optionNames);
221
+		}
222
+		return $this->columnContent('values', $content);
223
+	}
224
+
225
+
226
+	public function column_type(EE_Question $item): string
227
+	{
228
+		return $this->columnContent('type', $item->type());
229
+	}
230
+
231
+
232
+	public function column_required(EE_Question $item): string
233
+	{
234
+		$content = $item->required() ? 'Yes' : '';
235
+		return $this->columnContent('required', $content);
236
+	}
237 237
 }
Please login to merge, or discard this patch.
admin_pages/transactions/EE_Admin_Transactions_List_Table.class.php 1 patch
Indentation   +657 added lines, -657 removed lines patch added patch discarded remove patch
@@ -13,160 +13,160 @@  discard block
 block discarded – undo
13 13
  */
14 14
 class EE_Admin_Transactions_List_Table extends EE_Admin_List_Table
15 15
 {
16
-    /**
17
-     * @var SessionLifespan $session_lifespan
18
-     */
19
-    private $session_lifespan;
20
-
21
-    private $_status;
22
-
23
-
24
-    /**
25
-     * @param Transactions_Admin_Page $admin_page
26
-     * @param SessionLifespan         $lifespan
27
-     */
28
-    public function __construct(Transactions_Admin_Page $admin_page, SessionLifespan $lifespan)
29
-    {
30
-        parent::__construct($admin_page);
31
-        $this->session_lifespan = $lifespan;
32
-        $this->_status = $this->_admin_page->get_transaction_status_array();
33
-    }
34
-
35
-
36
-    /**
37
-     *_setup_data
38
-     */
39
-    protected function _setup_data()
40
-    {
41
-        $this->_data = $this->_admin_page->get_transactions($this->_per_page);
42
-        $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
43
-        $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, true, $status);
44
-    }
45
-
46
-
47
-    /**
48
-     *_set_properties
49
-     */
50
-    protected function _set_properties()
51
-    {
52
-        $this->_wp_list_args = array(
53
-            'singular' => esc_html__('transaction', 'event_espresso'),
54
-            'plural'   => esc_html__('transactions', 'event_espresso'),
55
-            'ajax'     => true,
56
-            'screen'   => $this->_admin_page->get_current_screen()->id,
57
-        );
58
-        $ID_column_name = esc_html__('ID', 'event_espresso');
59
-        $ID_column_name .= '<span class="show-on-mobile-view-only" style="float:none">';
60
-        $ID_column_name .= ' : ' . esc_html__('Transaction Date', 'event_espresso');
61
-        $ID_column_name .= '</span> ';
62
-        $this->_columns = array(
63
-            'id'        => $ID_column_name,
64
-            'TXN_timestamp' => esc_html__('Transaction Date', 'event_espresso'),
65
-            'event_name'    => esc_html__('Event', 'event_espresso'),
66
-            'ATT_fname'     => esc_html__('Primary Registrant', 'event_espresso'),
67
-            'TXN_paid'      => esc_html__('Paid', 'event_espresso'),
68
-            'TXN_total'     => esc_html__('Total', 'event_espresso'),
69
-            'actions' => $this->actionsColumnHeader(),
70
-        );
71
-
72
-        $this->_sortable_columns = array(
73
-            'id'        => array('TXN_ID' => false),
74
-            'event_name'    => array('event_name' => false),
75
-            'ATT_fname'     => array('ATT_fname' => false),
76
-            'TXN_timestamp' => array('TXN_timestamp' => true) // true means its already sorted
77
-        );
78
-
79
-        $this->_primary_column = 'TXN_ID';
80
-
81
-        $this->_hidden_columns = array();
82
-    }
83
-
84
-
85
-    /**
86
-     * This simply sets up the row class for the table rows.
87
-     * Allows for easier overriding of child methods for setting up sorting.
88
-     *
89
-     * @param EE_Transaction $transaction the current item
90
-     * @return string
91
-     * @throws EE_Error
92
-     * @throws ReflectionException
93
-     */
94
-    protected function _get_row_class($transaction)
95
-    {
96
-        $class = parent::_get_row_class($transaction);
97
-        // add status class
98
-        $class .= ' txn-status-' . $transaction->status_ID();
99
-        if ($this->_has_checkbox_column) {
100
-            $class .= ' has-checkbox-column';
101
-        }
102
-        return $class;
103
-    }
104
-
105
-
106
-    /**
107
-     * _get_table_filters
108
-     * We use this to assemble and return any filters that are associated with this table that help further refine what
109
-     * gets shown in the table.
110
-     *
111
-     * @abstract
112
-     * @return array
113
-     */
114
-    protected function _get_table_filters()
115
-    {
116
-        $start_date = isset($this->_req_data['txn-filter-start-date'])
117
-            ? wp_strip_all_tags($this->_req_data['txn-filter-start-date'])
118
-            : date('Y-m-d', strtotime('-10 year'));
119
-        $end_date = isset($this->_req_data['txn-filter-end-date'])
120
-            ? wp_strip_all_tags($this->_req_data['txn-filter-end-date'])
121
-            : date('Y-m-d', current_time('timestamp'));
122
-
123
-        return [
124
-            EEH_Form_Fields::text(
125
-                esc_html__('Display Transactions from', 'event_espresso'),
126
-                esc_html($start_date),
127
-                'txn-filter-start-date',
128
-                'txn-filter-start-date',
129
-                'ee-datepicker'
130
-            ),
131
-            EEH_Form_Fields::text(
132
-                esc_html__(' until ', 'event_espresso'),
133
-                esc_html($end_date),
134
-                'txn-filter-end-date',
135
-                'txn-filter-end-date',
136
-                'ee-datepicker'
137
-            )
138
-        ];
139
-    }
140
-
141
-
142
-    /**
143
-     *_add_view_counts
144
-     */
145
-    protected function _add_view_counts()
146
-    {
147
-        foreach ($this->_views as $view) {
148
-            $this->_views[ $view['slug'] ]['count'] = $this->_admin_page->get_transactions($this->_per_page, true, $view['slug']);
149
-        }
150
-    }
151
-
152
-
153
-    /**
154
-     *    column TXN_ID
155
-     *
156
-     * @param EE_Transaction $transaction
157
-     * @return string
158
-     * @throws EE_Error
159
-     */
160
-    public function column_id(EE_Transaction $transaction)
161
-    {
162
-        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
163
-            array(
164
-                'action' => 'view_transaction',
165
-                'TXN_ID' => $transaction->ID(),
166
-            ),
167
-            TXN_ADMIN_URL
168
-        );
169
-        $content = '
16
+	/**
17
+	 * @var SessionLifespan $session_lifespan
18
+	 */
19
+	private $session_lifespan;
20
+
21
+	private $_status;
22
+
23
+
24
+	/**
25
+	 * @param Transactions_Admin_Page $admin_page
26
+	 * @param SessionLifespan         $lifespan
27
+	 */
28
+	public function __construct(Transactions_Admin_Page $admin_page, SessionLifespan $lifespan)
29
+	{
30
+		parent::__construct($admin_page);
31
+		$this->session_lifespan = $lifespan;
32
+		$this->_status = $this->_admin_page->get_transaction_status_array();
33
+	}
34
+
35
+
36
+	/**
37
+	 *_setup_data
38
+	 */
39
+	protected function _setup_data()
40
+	{
41
+		$this->_data = $this->_admin_page->get_transactions($this->_per_page);
42
+		$status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
43
+		$this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, true, $status);
44
+	}
45
+
46
+
47
+	/**
48
+	 *_set_properties
49
+	 */
50
+	protected function _set_properties()
51
+	{
52
+		$this->_wp_list_args = array(
53
+			'singular' => esc_html__('transaction', 'event_espresso'),
54
+			'plural'   => esc_html__('transactions', 'event_espresso'),
55
+			'ajax'     => true,
56
+			'screen'   => $this->_admin_page->get_current_screen()->id,
57
+		);
58
+		$ID_column_name = esc_html__('ID', 'event_espresso');
59
+		$ID_column_name .= '<span class="show-on-mobile-view-only" style="float:none">';
60
+		$ID_column_name .= ' : ' . esc_html__('Transaction Date', 'event_espresso');
61
+		$ID_column_name .= '</span> ';
62
+		$this->_columns = array(
63
+			'id'        => $ID_column_name,
64
+			'TXN_timestamp' => esc_html__('Transaction Date', 'event_espresso'),
65
+			'event_name'    => esc_html__('Event', 'event_espresso'),
66
+			'ATT_fname'     => esc_html__('Primary Registrant', 'event_espresso'),
67
+			'TXN_paid'      => esc_html__('Paid', 'event_espresso'),
68
+			'TXN_total'     => esc_html__('Total', 'event_espresso'),
69
+			'actions' => $this->actionsColumnHeader(),
70
+		);
71
+
72
+		$this->_sortable_columns = array(
73
+			'id'        => array('TXN_ID' => false),
74
+			'event_name'    => array('event_name' => false),
75
+			'ATT_fname'     => array('ATT_fname' => false),
76
+			'TXN_timestamp' => array('TXN_timestamp' => true) // true means its already sorted
77
+		);
78
+
79
+		$this->_primary_column = 'TXN_ID';
80
+
81
+		$this->_hidden_columns = array();
82
+	}
83
+
84
+
85
+	/**
86
+	 * This simply sets up the row class for the table rows.
87
+	 * Allows for easier overriding of child methods for setting up sorting.
88
+	 *
89
+	 * @param EE_Transaction $transaction the current item
90
+	 * @return string
91
+	 * @throws EE_Error
92
+	 * @throws ReflectionException
93
+	 */
94
+	protected function _get_row_class($transaction)
95
+	{
96
+		$class = parent::_get_row_class($transaction);
97
+		// add status class
98
+		$class .= ' txn-status-' . $transaction->status_ID();
99
+		if ($this->_has_checkbox_column) {
100
+			$class .= ' has-checkbox-column';
101
+		}
102
+		return $class;
103
+	}
104
+
105
+
106
+	/**
107
+	 * _get_table_filters
108
+	 * We use this to assemble and return any filters that are associated with this table that help further refine what
109
+	 * gets shown in the table.
110
+	 *
111
+	 * @abstract
112
+	 * @return array
113
+	 */
114
+	protected function _get_table_filters()
115
+	{
116
+		$start_date = isset($this->_req_data['txn-filter-start-date'])
117
+			? wp_strip_all_tags($this->_req_data['txn-filter-start-date'])
118
+			: date('Y-m-d', strtotime('-10 year'));
119
+		$end_date = isset($this->_req_data['txn-filter-end-date'])
120
+			? wp_strip_all_tags($this->_req_data['txn-filter-end-date'])
121
+			: date('Y-m-d', current_time('timestamp'));
122
+
123
+		return [
124
+			EEH_Form_Fields::text(
125
+				esc_html__('Display Transactions from', 'event_espresso'),
126
+				esc_html($start_date),
127
+				'txn-filter-start-date',
128
+				'txn-filter-start-date',
129
+				'ee-datepicker'
130
+			),
131
+			EEH_Form_Fields::text(
132
+				esc_html__(' until ', 'event_espresso'),
133
+				esc_html($end_date),
134
+				'txn-filter-end-date',
135
+				'txn-filter-end-date',
136
+				'ee-datepicker'
137
+			)
138
+		];
139
+	}
140
+
141
+
142
+	/**
143
+	 *_add_view_counts
144
+	 */
145
+	protected function _add_view_counts()
146
+	{
147
+		foreach ($this->_views as $view) {
148
+			$this->_views[ $view['slug'] ]['count'] = $this->_admin_page->get_transactions($this->_per_page, true, $view['slug']);
149
+		}
150
+	}
151
+
152
+
153
+	/**
154
+	 *    column TXN_ID
155
+	 *
156
+	 * @param EE_Transaction $transaction
157
+	 * @return string
158
+	 * @throws EE_Error
159
+	 */
160
+	public function column_id(EE_Transaction $transaction)
161
+	{
162
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
163
+			array(
164
+				'action' => 'view_transaction',
165
+				'TXN_ID' => $transaction->ID(),
166
+			),
167
+			TXN_ADMIN_URL
168
+		);
169
+		$content = '
170 170
         <span class="ee-entity-id">
171 171
             <a  class="ee-aria-tooltip"
172 172
                 href="' . $view_lnk_url . '"
@@ -175,539 +175,539 @@  discard block
 block discarded – undo
175 175
                ' . $transaction->ID() . '
176 176
            </a>
177 177
         </span>';
178
-        // txn timestamp
179
-        $content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp($transaction) . '</span>';
180
-        return $this->columnContent('id', $content, 'end');
181
-    }
182
-
183
-
184
-    /**
185
-     * @param EE_Transaction $transaction
186
-     * @return string
187
-     * @throws EE_Error
188
-     * @throws InvalidArgumentException
189
-     * @throws InvalidDataTypeException
190
-     * @throws InvalidInterfaceException
191
-     */
192
-    protected function _get_txn_timestamp(EE_Transaction $transaction)
193
-    {
194
-        // is TXN less than 2 hours old ?
195
-        if (
196
-            ($transaction->failed() || $transaction->is_abandoned())
197
-            && $this->session_lifespan->expiration() < $transaction->datetime(false, true)
198
-        ) {
199
-            $timestamp = esc_html__('TXN in progress...', 'event_espresso');
200
-        } else {
201
-            $timestamp = $transaction->get_i18n_datetime('TXN_timestamp', 'M jS Y g:i a');
202
-        }
203
-        return $timestamp;
204
-    }
205
-
206
-
207
-    /**
208
-     *    column_cb
209
-     *
210
-     * @param EE_Transaction $transaction
211
-     * @return string
212
-     * @throws EE_Error
213
-     */
214
-    public function column_cb($transaction)
215
-    {
216
-        return sprintf(
217
-            '<input type="checkbox" name="%1$s[]" value="%2$s" />',
218
-            $this->_wp_list_args['singular'],
219
-            $transaction->ID()
220
-        );
221
-    }
222
-
223
-
224
-    /**
225
-     *    column_TXN_timestamp
226
-     *
227
-     * @param EE_Transaction $transaction
228
-     * @return string
229
-     * @throws EE_Error
230
-     * @throws ReflectionException
231
-     */
232
-    public function column_TXN_timestamp(EE_Transaction $transaction)
233
-    {
234
-        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
235
-            array(
236
-                'action' => 'view_transaction',
237
-                'TXN_ID' => $transaction->ID(),
238
-            ),
239
-            TXN_ADMIN_URL
240
-        );
241
-        $status        = esc_attr($transaction->status_ID());
242
-        $pretty_status = EEH_Template::pretty_status($status, false, 'sentence');
243
-        return '
178
+		// txn timestamp
179
+		$content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp($transaction) . '</span>';
180
+		return $this->columnContent('id', $content, 'end');
181
+	}
182
+
183
+
184
+	/**
185
+	 * @param EE_Transaction $transaction
186
+	 * @return string
187
+	 * @throws EE_Error
188
+	 * @throws InvalidArgumentException
189
+	 * @throws InvalidDataTypeException
190
+	 * @throws InvalidInterfaceException
191
+	 */
192
+	protected function _get_txn_timestamp(EE_Transaction $transaction)
193
+	{
194
+		// is TXN less than 2 hours old ?
195
+		if (
196
+			($transaction->failed() || $transaction->is_abandoned())
197
+			&& $this->session_lifespan->expiration() < $transaction->datetime(false, true)
198
+		) {
199
+			$timestamp = esc_html__('TXN in progress...', 'event_espresso');
200
+		} else {
201
+			$timestamp = $transaction->get_i18n_datetime('TXN_timestamp', 'M jS Y g:i a');
202
+		}
203
+		return $timestamp;
204
+	}
205
+
206
+
207
+	/**
208
+	 *    column_cb
209
+	 *
210
+	 * @param EE_Transaction $transaction
211
+	 * @return string
212
+	 * @throws EE_Error
213
+	 */
214
+	public function column_cb($transaction)
215
+	{
216
+		return sprintf(
217
+			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
218
+			$this->_wp_list_args['singular'],
219
+			$transaction->ID()
220
+		);
221
+	}
222
+
223
+
224
+	/**
225
+	 *    column_TXN_timestamp
226
+	 *
227
+	 * @param EE_Transaction $transaction
228
+	 * @return string
229
+	 * @throws EE_Error
230
+	 * @throws ReflectionException
231
+	 */
232
+	public function column_TXN_timestamp(EE_Transaction $transaction)
233
+	{
234
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
235
+			array(
236
+				'action' => 'view_transaction',
237
+				'TXN_ID' => $transaction->ID(),
238
+			),
239
+			TXN_ADMIN_URL
240
+		);
241
+		$status        = esc_attr($transaction->status_ID());
242
+		$pretty_status = EEH_Template::pretty_status($status, false, 'sentence');
243
+		return '
244 244
             <div class="ee-layout-row">
245 245
                 <span aria-label="' . $pretty_status . '"  class="ee-status-dot ee-status-bg--' . $status . ' ee-aria-tooltip"></span>
246 246
                 <a  href="' . $view_lnk_url . '"
247 247
                     class="row-title ee-status-color--' . $status . ' ee-aria-tooltip"
248 248
                     aria-label="' . esc_attr__('View Transaction Details for TXN #', 'event_espresso') . $transaction->ID(
249
-                    ) . '">
249
+					) . '">
250 250
                 ' . $this->_get_txn_timestamp($transaction) . '
251 251
                 </a>
252 252
             </div>';
253
-    }
254
-
255
-
256
-    /**
257
-     *    column_TXN_total
258
-     *
259
-     * @param EE_Transaction $transaction
260
-     * @return string
261
-     * @throws EE_Error
262
-     */
263
-    public function column_TXN_total(EE_Transaction $transaction)
264
-    {
265
-        if ($transaction->get('TXN_total') > 0) {
266
-            return '<span class="txn-pad-rght">'
267
-                   . apply_filters(
268
-                       'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total',
269
-                       $transaction->get_pretty('TXN_total'),
270
-                       $transaction
271
-                   )
272
-                   . '</span>';
273
-        } else {
274
-            return '<span class="txn-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>';
275
-        }
276
-    }
277
-
278
-
279
-    /**
280
-     *    column_TXN_paid
281
-     *
282
-     * @param EE_Transaction $transaction
283
-     * @return mixed|string
284
-     * @throws EE_Error
285
-     */
286
-    public function column_TXN_paid(EE_Transaction $transaction)
287
-    {
288
-        $transaction_total = $transaction->get('TXN_total');
289
-        $transaction_paid = $transaction->get('TXN_paid');
290
-
291
-        if (EEH_Money::compare_floats($transaction_total, 0, '>')) {
292
-            // monies owing
293
-            $span_class = 'txn-overview-part-payment-spn';
294
-            if (EEH_Money::compare_floats($transaction_paid, $transaction_total, '>=')) {
295
-                // paid in full
296
-                $span_class = 'txn-overview-full-payment-spn';
297
-            } elseif (EEH_Money::compare_floats($transaction_paid, 0, '==')) {
298
-                // no payments made
299
-                $span_class = 'txn-overview-no-payment-spn';
300
-            }
301
-        } else {
302
-            // transaction_total == 0 so this is a free event
303
-            $span_class = 'txn-overview-free-event-spn';
304
-        }
305
-
306
-        $payment_method = $transaction->payment_method();
307
-        $payment_method_name = $payment_method instanceof EE_Payment_Method
308
-            ? $payment_method->admin_name()
309
-            : esc_html__('Unknown', 'event_espresso');
310
-
311
-        $content = '<span class="' . $span_class . ' txn-pad-rght">'
312
-                   . $transaction->get_pretty('TXN_paid')
313
-                   . '</span>';
314
-        if ($transaction_paid > 0) {
315
-            $content .= ' <span class="ee-status-text-small">'
316
-                        . sprintf(
317
-                            esc_html__('...via %s', 'event_espresso'),
318
-                            $payment_method_name
319
-                        )
320
-                        . '</span>';
321
-        }
322
-        return "<div>{$content}</div>";
323
-    }
324
-
325
-
326
-    /**
327
-     *    column_ATT_fname
328
-     *
329
-     * @param EE_Transaction $transaction
330
-     * @return string
331
-     * @throws EE_Error
332
-     * @throws InvalidArgumentException
333
-     * @throws InvalidDataTypeException
334
-     * @throws InvalidInterfaceException
335
-     */
336
-    public function column_ATT_fname(EE_Transaction $transaction)
337
-    {
338
-        $primary_reg = $transaction->primary_registration();
339
-        $attendee = $primary_reg->get_first_related('Attendee');
340
-        if ($attendee instanceof EE_Attendee) {
341
-            $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
342
-                array(
343
-                    'action'  => 'view_registration',
344
-                    '_REG_ID' => $primary_reg->ID(),
345
-                ),
346
-                REG_ADMIN_URL
347
-            );
348
-            $content = EE_Registry::instance()->CAP->current_user_can(
349
-                'ee_read_registration',
350
-                'espresso_registrations_view_registration',
351
-                $primary_reg->ID()
352
-            )
353
-                ? '<a href="' . $edit_lnk_url . '"'
354
-                  . ' aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
355
-                  . $attendee->full_name()
356
-                  . '</a>'
357
-                : $attendee->full_name();
358
-            $content .= '<br>' . $attendee->email();
359
-            return $content;
360
-        }
361
-        return $transaction->failed() || $transaction->is_abandoned()
362
-            ? esc_html__('no contact record.', 'event_espresso')
363
-            : esc_html__(
364
-                'No contact record, because the transaction was abandoned or the registration process failed.',
365
-                'event_espresso'
366
-            );
367
-    }
368
-
369
-
370
-    /**
371
-     *    column_ATT_email
372
-     *
373
-     * @param EE_Transaction $transaction
374
-     * @return string
375
-     * @throws EE_Error
376
-     */
377
-    public function column_ATT_email(EE_Transaction $transaction)
378
-    {
379
-        $attendee = $transaction->primary_registration()->get_first_related('Attendee');
380
-        if (! empty($attendee)) {
381
-            return '<a href="mailto:' . $attendee->get('ATT_email') . '">'
382
-                   . $attendee->get('ATT_email')
383
-                   . '</a>';
384
-        } else {
385
-            return $transaction->failed() || $transaction->is_abandoned()
386
-                ? esc_html__('no contact record.', 'event_espresso')
387
-                : esc_html__(
388
-                    'No contact record, because the transaction was abandoned or the registration process failed.',
389
-                    'event_espresso'
390
-                );
391
-        }
392
-    }
393
-
394
-
395
-    /**
396
-     *    column_event_name
397
-     *
398
-     * @param EE_Transaction $transaction
399
-     * @return string
400
-     * @throws EE_Error
401
-     * @throws InvalidArgumentException
402
-     * @throws InvalidDataTypeException
403
-     * @throws InvalidInterfaceException
404
-     */
405
-    public function column_event_name(EE_Transaction $transaction)
406
-    {
407
-        $actions = array();
408
-        $event = $transaction->primary_registration()->get_first_related('Event');
409
-        if (! empty($event)) {
410
-            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(
411
-                array('action' => 'edit', 'post' => $event->ID()),
412
-                EVENTS_ADMIN_URL
413
-            );
414
-            $event_name = $event->get('EVT_name');
415
-
416
-            // filter this view by transactions for this event
417
-            $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(
418
-                array(
419
-                    'action' => 'default',
420
-                    'EVT_ID' => $event->ID(),
421
-                ),
422
-                TXN_ADMIN_URL
423
-            );
424
-            if (
425
-                empty($this->_req_data['EVT_ID'])
426
-                && EE_Registry::instance()->CAP->current_user_can(
427
-                    'ee_edit_event',
428
-                    'espresso_events_edit',
429
-                    $event->ID()
430
-                )
431
-            ) {
432
-                $actions['filter_by_event'] = '<a class="ee-aria-tooltip" href="' . $txn_by_event_lnk . '"'
433
-                                              . ' aria-label="' . esc_attr__(
434
-                                                  'Filter transactions by this event',
435
-                                                  'event_espresso'
436
-                                              ) . '">'
437
-                                              . esc_html__('View Transactions for this event', 'event_espresso')
438
-                                              . '</a>';
439
-            }
440
-
441
-            return sprintf(
442
-                '%1$s %2$s',
443
-                EE_Registry::instance()->CAP->current_user_can(
444
-                    'ee_edit_event',
445
-                    'espresso_events_edit',
446
-                    $event->ID()
447
-                )
448
-                    ? '<a class="ee-aria-tooltip" href="' . $edit_event_url . '"'
449
-                      . ' aria-label="'
450
-                      . sprintf(
451
-                          esc_attr__('Edit Event: %s', 'event_espresso'),
452
-                          $event->get('EVT_name')
453
-                      )
454
-                      . '">'
455
-                      . wp_trim_words(
456
-                          $event_name,
457
-                          30,
458
-                          '...'
459
-                      )
460
-                      . '</a>'
461
-                    : wp_trim_words($event_name, 30, '...'),
462
-                $this->row_actions($actions)
463
-            );
464
-        } else {
465
-            return esc_html__(
466
-                'The event associated with this transaction via the primary registration cannot be retrieved.',
467
-                'event_espresso'
468
-            );
469
-        }
470
-    }
471
-
472
-
473
-    /**
474
-     *    column_actions
475
-     *
476
-     * @param EE_Transaction $transaction
477
-     * @return string
478
-     * @throws EE_Error
479
-     */
480
-    public function column_actions(EE_Transaction $transaction)
481
-    {
482
-        return $this->actionsModalMenu(
483
-            $this->_action_string(
484
-                $this->get_transaction_details_link($transaction)
485
-                . $this->get_invoice_link($transaction)
486
-                . $this->get_receipt_link($transaction)
487
-                . $this->get_primary_registration_details_link($transaction)
488
-                . $this->get_send_payment_reminder_trigger_link($transaction)
489
-                . $this->get_payment_overview_link($transaction)
490
-                . $this->get_related_messages_link($transaction),
491
-                $transaction,
492
-                'div',
493
-                'txn-overview-actions ee-list-table-actions'
494
-            )
495
-        );
496
-    }
497
-
498
-
499
-    /**
500
-     * Get the transaction details link.
501
-     *
502
-     * @param EE_Transaction $transaction
503
-     * @return string
504
-     * @throws EE_Error
505
-     */
506
-    protected function get_transaction_details_link(EE_Transaction $transaction)
507
-    {
508
-        $url = EE_Admin_Page::add_query_args_and_nonce(
509
-            array(
510
-                'action' => 'view_transaction',
511
-                'TXN_ID' => $transaction->ID(),
512
-            ),
513
-            TXN_ADMIN_URL
514
-        );
515
-        return '
253
+	}
254
+
255
+
256
+	/**
257
+	 *    column_TXN_total
258
+	 *
259
+	 * @param EE_Transaction $transaction
260
+	 * @return string
261
+	 * @throws EE_Error
262
+	 */
263
+	public function column_TXN_total(EE_Transaction $transaction)
264
+	{
265
+		if ($transaction->get('TXN_total') > 0) {
266
+			return '<span class="txn-pad-rght">'
267
+				   . apply_filters(
268
+					   'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total',
269
+					   $transaction->get_pretty('TXN_total'),
270
+					   $transaction
271
+				   )
272
+				   . '</span>';
273
+		} else {
274
+			return '<span class="txn-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>';
275
+		}
276
+	}
277
+
278
+
279
+	/**
280
+	 *    column_TXN_paid
281
+	 *
282
+	 * @param EE_Transaction $transaction
283
+	 * @return mixed|string
284
+	 * @throws EE_Error
285
+	 */
286
+	public function column_TXN_paid(EE_Transaction $transaction)
287
+	{
288
+		$transaction_total = $transaction->get('TXN_total');
289
+		$transaction_paid = $transaction->get('TXN_paid');
290
+
291
+		if (EEH_Money::compare_floats($transaction_total, 0, '>')) {
292
+			// monies owing
293
+			$span_class = 'txn-overview-part-payment-spn';
294
+			if (EEH_Money::compare_floats($transaction_paid, $transaction_total, '>=')) {
295
+				// paid in full
296
+				$span_class = 'txn-overview-full-payment-spn';
297
+			} elseif (EEH_Money::compare_floats($transaction_paid, 0, '==')) {
298
+				// no payments made
299
+				$span_class = 'txn-overview-no-payment-spn';
300
+			}
301
+		} else {
302
+			// transaction_total == 0 so this is a free event
303
+			$span_class = 'txn-overview-free-event-spn';
304
+		}
305
+
306
+		$payment_method = $transaction->payment_method();
307
+		$payment_method_name = $payment_method instanceof EE_Payment_Method
308
+			? $payment_method->admin_name()
309
+			: esc_html__('Unknown', 'event_espresso');
310
+
311
+		$content = '<span class="' . $span_class . ' txn-pad-rght">'
312
+				   . $transaction->get_pretty('TXN_paid')
313
+				   . '</span>';
314
+		if ($transaction_paid > 0) {
315
+			$content .= ' <span class="ee-status-text-small">'
316
+						. sprintf(
317
+							esc_html__('...via %s', 'event_espresso'),
318
+							$payment_method_name
319
+						)
320
+						. '</span>';
321
+		}
322
+		return "<div>{$content}</div>";
323
+	}
324
+
325
+
326
+	/**
327
+	 *    column_ATT_fname
328
+	 *
329
+	 * @param EE_Transaction $transaction
330
+	 * @return string
331
+	 * @throws EE_Error
332
+	 * @throws InvalidArgumentException
333
+	 * @throws InvalidDataTypeException
334
+	 * @throws InvalidInterfaceException
335
+	 */
336
+	public function column_ATT_fname(EE_Transaction $transaction)
337
+	{
338
+		$primary_reg = $transaction->primary_registration();
339
+		$attendee = $primary_reg->get_first_related('Attendee');
340
+		if ($attendee instanceof EE_Attendee) {
341
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
342
+				array(
343
+					'action'  => 'view_registration',
344
+					'_REG_ID' => $primary_reg->ID(),
345
+				),
346
+				REG_ADMIN_URL
347
+			);
348
+			$content = EE_Registry::instance()->CAP->current_user_can(
349
+				'ee_read_registration',
350
+				'espresso_registrations_view_registration',
351
+				$primary_reg->ID()
352
+			)
353
+				? '<a href="' . $edit_lnk_url . '"'
354
+				  . ' aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '">'
355
+				  . $attendee->full_name()
356
+				  . '</a>'
357
+				: $attendee->full_name();
358
+			$content .= '<br>' . $attendee->email();
359
+			return $content;
360
+		}
361
+		return $transaction->failed() || $transaction->is_abandoned()
362
+			? esc_html__('no contact record.', 'event_espresso')
363
+			: esc_html__(
364
+				'No contact record, because the transaction was abandoned or the registration process failed.',
365
+				'event_espresso'
366
+			);
367
+	}
368
+
369
+
370
+	/**
371
+	 *    column_ATT_email
372
+	 *
373
+	 * @param EE_Transaction $transaction
374
+	 * @return string
375
+	 * @throws EE_Error
376
+	 */
377
+	public function column_ATT_email(EE_Transaction $transaction)
378
+	{
379
+		$attendee = $transaction->primary_registration()->get_first_related('Attendee');
380
+		if (! empty($attendee)) {
381
+			return '<a href="mailto:' . $attendee->get('ATT_email') . '">'
382
+				   . $attendee->get('ATT_email')
383
+				   . '</a>';
384
+		} else {
385
+			return $transaction->failed() || $transaction->is_abandoned()
386
+				? esc_html__('no contact record.', 'event_espresso')
387
+				: esc_html__(
388
+					'No contact record, because the transaction was abandoned or the registration process failed.',
389
+					'event_espresso'
390
+				);
391
+		}
392
+	}
393
+
394
+
395
+	/**
396
+	 *    column_event_name
397
+	 *
398
+	 * @param EE_Transaction $transaction
399
+	 * @return string
400
+	 * @throws EE_Error
401
+	 * @throws InvalidArgumentException
402
+	 * @throws InvalidDataTypeException
403
+	 * @throws InvalidInterfaceException
404
+	 */
405
+	public function column_event_name(EE_Transaction $transaction)
406
+	{
407
+		$actions = array();
408
+		$event = $transaction->primary_registration()->get_first_related('Event');
409
+		if (! empty($event)) {
410
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(
411
+				array('action' => 'edit', 'post' => $event->ID()),
412
+				EVENTS_ADMIN_URL
413
+			);
414
+			$event_name = $event->get('EVT_name');
415
+
416
+			// filter this view by transactions for this event
417
+			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(
418
+				array(
419
+					'action' => 'default',
420
+					'EVT_ID' => $event->ID(),
421
+				),
422
+				TXN_ADMIN_URL
423
+			);
424
+			if (
425
+				empty($this->_req_data['EVT_ID'])
426
+				&& EE_Registry::instance()->CAP->current_user_can(
427
+					'ee_edit_event',
428
+					'espresso_events_edit',
429
+					$event->ID()
430
+				)
431
+			) {
432
+				$actions['filter_by_event'] = '<a class="ee-aria-tooltip" href="' . $txn_by_event_lnk . '"'
433
+											  . ' aria-label="' . esc_attr__(
434
+												  'Filter transactions by this event',
435
+												  'event_espresso'
436
+											  ) . '">'
437
+											  . esc_html__('View Transactions for this event', 'event_espresso')
438
+											  . '</a>';
439
+			}
440
+
441
+			return sprintf(
442
+				'%1$s %2$s',
443
+				EE_Registry::instance()->CAP->current_user_can(
444
+					'ee_edit_event',
445
+					'espresso_events_edit',
446
+					$event->ID()
447
+				)
448
+					? '<a class="ee-aria-tooltip" href="' . $edit_event_url . '"'
449
+					  . ' aria-label="'
450
+					  . sprintf(
451
+						  esc_attr__('Edit Event: %s', 'event_espresso'),
452
+						  $event->get('EVT_name')
453
+					  )
454
+					  . '">'
455
+					  . wp_trim_words(
456
+						  $event_name,
457
+						  30,
458
+						  '...'
459
+					  )
460
+					  . '</a>'
461
+					: wp_trim_words($event_name, 30, '...'),
462
+				$this->row_actions($actions)
463
+			);
464
+		} else {
465
+			return esc_html__(
466
+				'The event associated with this transaction via the primary registration cannot be retrieved.',
467
+				'event_espresso'
468
+			);
469
+		}
470
+	}
471
+
472
+
473
+	/**
474
+	 *    column_actions
475
+	 *
476
+	 * @param EE_Transaction $transaction
477
+	 * @return string
478
+	 * @throws EE_Error
479
+	 */
480
+	public function column_actions(EE_Transaction $transaction)
481
+	{
482
+		return $this->actionsModalMenu(
483
+			$this->_action_string(
484
+				$this->get_transaction_details_link($transaction)
485
+				. $this->get_invoice_link($transaction)
486
+				. $this->get_receipt_link($transaction)
487
+				. $this->get_primary_registration_details_link($transaction)
488
+				. $this->get_send_payment_reminder_trigger_link($transaction)
489
+				. $this->get_payment_overview_link($transaction)
490
+				. $this->get_related_messages_link($transaction),
491
+				$transaction,
492
+				'div',
493
+				'txn-overview-actions ee-list-table-actions'
494
+			)
495
+		);
496
+	}
497
+
498
+
499
+	/**
500
+	 * Get the transaction details link.
501
+	 *
502
+	 * @param EE_Transaction $transaction
503
+	 * @return string
504
+	 * @throws EE_Error
505
+	 */
506
+	protected function get_transaction_details_link(EE_Transaction $transaction)
507
+	{
508
+		$url = EE_Admin_Page::add_query_args_and_nonce(
509
+			array(
510
+				'action' => 'view_transaction',
511
+				'TXN_ID' => $transaction->ID(),
512
+			),
513
+			TXN_ADMIN_URL
514
+		);
515
+		return '
516 516
 				<a class="ee-aria-tooltip button button--icon-only" href="' . $url . '"'
517
-               . ' aria-label="' . esc_attr__('View Transaction Details', 'event_espresso') . '" class="button button--icon-only">
517
+			   . ' aria-label="' . esc_attr__('View Transaction Details', 'event_espresso') . '" class="button button--icon-only">
518 518
 					<span class="dashicons dashicons-cart"></span>
519 519
 				</a>';
520
-    }
521
-
522
-
523
-    /**
524
-     * Get the invoice link for the given registration.
525
-     *
526
-     * @param EE_Transaction $transaction
527
-     * @return string
528
-     * @throws EE_Error
529
-     */
530
-    protected function get_invoice_link(EE_Transaction $transaction)
531
-    {
532
-        $registration = $transaction->primary_registration();
533
-        if ($registration instanceof EE_Registration) {
534
-            $url = $registration->invoice_url();
535
-            // only show invoice link if message type is active.
536
-            if (
537
-                $registration->attendee() instanceof EE_Attendee
538
-                && EEH_MSG_Template::is_mt_active('invoice')
539
-            ) {
540
-                return '
520
+	}
521
+
522
+
523
+	/**
524
+	 * Get the invoice link for the given registration.
525
+	 *
526
+	 * @param EE_Transaction $transaction
527
+	 * @return string
528
+	 * @throws EE_Error
529
+	 */
530
+	protected function get_invoice_link(EE_Transaction $transaction)
531
+	{
532
+		$registration = $transaction->primary_registration();
533
+		if ($registration instanceof EE_Registration) {
534
+			$url = $registration->invoice_url();
535
+			// only show invoice link if message type is active.
536
+			if (
537
+				$registration->attendee() instanceof EE_Attendee
538
+				&& EEH_MSG_Template::is_mt_active('invoice')
539
+			) {
540
+				return '
541 541
                     <a aria-label="' . esc_attr__('View Transaction Invoice', 'event_espresso') . '"'
542
-                       . ' target="_blank" href="' . $url . '" class="ee-aria-tooltip button button--icon-only">
542
+					   . ' target="_blank" href="' . $url . '" class="ee-aria-tooltip button button--icon-only">
543 543
                         <span class="dashicons dashicons-media-spreadsheet"></span>
544 544
                     </a>';
545
-            }
546
-        }
547
-        return '';
548
-    }
549
-
550
-
551
-    /**
552
-     * Get the receipt link for the transaction.
553
-     *
554
-     * @param EE_Transaction $transaction
555
-     * @return string
556
-     * @throws EE_Error
557
-     */
558
-    protected function get_receipt_link(EE_Transaction $transaction)
559
-    {
560
-        $registration = $transaction->primary_registration();
561
-        if ($registration instanceof EE_Registration) {
562
-            $url = $registration->receipt_url();
563
-            // only show receipt link if message type is active.
564
-            if (
565
-                $registration->attendee() instanceof EE_Attendee
566
-                && EEH_MSG_Template::is_mt_active('receipt')
567
-            ) {
568
-                return '
545
+			}
546
+		}
547
+		return '';
548
+	}
549
+
550
+
551
+	/**
552
+	 * Get the receipt link for the transaction.
553
+	 *
554
+	 * @param EE_Transaction $transaction
555
+	 * @return string
556
+	 * @throws EE_Error
557
+	 */
558
+	protected function get_receipt_link(EE_Transaction $transaction)
559
+	{
560
+		$registration = $transaction->primary_registration();
561
+		if ($registration instanceof EE_Registration) {
562
+			$url = $registration->receipt_url();
563
+			// only show receipt link if message type is active.
564
+			if (
565
+				$registration->attendee() instanceof EE_Attendee
566
+				&& EEH_MSG_Template::is_mt_active('receipt')
567
+			) {
568
+				return '
569 569
 				<a aria-label="' . esc_attr__('View Transaction Receipt', 'event_espresso') . '"'
570
-                       . ' target="_blank" href="' . $url . '" class="ee-aria-tooltip button button--icon-only">
570
+					   . ' target="_blank" href="' . $url . '" class="ee-aria-tooltip button button--icon-only">
571 571
 					<span class="dashicons dashicons-text-page"></span>
572 572
 				</a>';
573
-            }
574
-        }
575
-        return '';
576
-    }
577
-
578
-
579
-    /**
580
-     * Get the link to view the details for the primary registration.
581
-     *
582
-     * @param EE_Transaction $transaction
583
-     * @return string
584
-     * @throws EE_Error
585
-     * @throws InvalidArgumentException
586
-     * @throws InvalidDataTypeException
587
-     * @throws InvalidInterfaceException
588
-     */
589
-    protected function get_primary_registration_details_link(EE_Transaction $transaction)
590
-    {
591
-        $registration = $transaction->primary_registration();
592
-        if ($registration instanceof EE_Registration) {
593
-            $url = EE_Admin_Page::add_query_args_and_nonce(
594
-                array(
595
-                    'action'  => 'view_registration',
596
-                    '_REG_ID' => $registration->ID(),
597
-                ),
598
-                REG_ADMIN_URL
599
-            );
600
-            return EE_Registry::instance()->CAP->current_user_can(
601
-                'ee_read_registration',
602
-                'espresso_registrations_view_registration',
603
-                $registration->ID()
604
-            )
605
-                ? '
573
+			}
574
+		}
575
+		return '';
576
+	}
577
+
578
+
579
+	/**
580
+	 * Get the link to view the details for the primary registration.
581
+	 *
582
+	 * @param EE_Transaction $transaction
583
+	 * @return string
584
+	 * @throws EE_Error
585
+	 * @throws InvalidArgumentException
586
+	 * @throws InvalidDataTypeException
587
+	 * @throws InvalidInterfaceException
588
+	 */
589
+	protected function get_primary_registration_details_link(EE_Transaction $transaction)
590
+	{
591
+		$registration = $transaction->primary_registration();
592
+		if ($registration instanceof EE_Registration) {
593
+			$url = EE_Admin_Page::add_query_args_and_nonce(
594
+				array(
595
+					'action'  => 'view_registration',
596
+					'_REG_ID' => $registration->ID(),
597
+				),
598
+				REG_ADMIN_URL
599
+			);
600
+			return EE_Registry::instance()->CAP->current_user_can(
601
+				'ee_read_registration',
602
+				'espresso_registrations_view_registration',
603
+				$registration->ID()
604
+			)
605
+				? '
606 606
 					<a href="' . $url . '"
607 607
 					    aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '"
608 608
 					    class="ee-aria-tooltip button button--icon-only"
609 609
                     >
610 610
 						<span class="dashicons dashicons-clipboard"></span>
611 611
 					</a>'
612
-                : '';
613
-        }
614
-        return '';
615
-    }
616
-
617
-
618
-    /**
619
-     * Get send payment reminder trigger link
620
-     *
621
-     * @param EE_Transaction $transaction
622
-     * @return string
623
-     * @throws EE_Error
624
-     * @throws InvalidArgumentException
625
-     * @throws InvalidDataTypeException
626
-     * @throws InvalidInterfaceException
627
-     */
628
-    protected function get_send_payment_reminder_trigger_link(EE_Transaction $transaction)
629
-    {
630
-        $registration = $transaction->primary_registration();
631
-        if (
632
-            $registration instanceof EE_Registration
633
-            && $registration->attendee() instanceof EE_Attendee
634
-            && EEH_MSG_Template::is_mt_active('payment_reminder')
635
-            && ! in_array(
636
-                $transaction->status_ID(),
637
-                array(EEM_Transaction::complete_status_code, EEM_Transaction::overpaid_status_code),
638
-                true
639
-            )
640
-            && EE_Registry::instance()->CAP->current_user_can(
641
-                'ee_send_message',
642
-                'espresso_transactions_send_payment_reminder'
643
-            )
644
-        ) {
645
-            $url = EE_Admin_Page::add_query_args_and_nonce(
646
-                array(
647
-                    'action' => 'send_payment_reminder',
648
-                    'TXN_ID' => $transaction->ID(),
649
-                ),
650
-                TXN_ADMIN_URL
651
-            );
652
-            return '
612
+				: '';
613
+		}
614
+		return '';
615
+	}
616
+
617
+
618
+	/**
619
+	 * Get send payment reminder trigger link
620
+	 *
621
+	 * @param EE_Transaction $transaction
622
+	 * @return string
623
+	 * @throws EE_Error
624
+	 * @throws InvalidArgumentException
625
+	 * @throws InvalidDataTypeException
626
+	 * @throws InvalidInterfaceException
627
+	 */
628
+	protected function get_send_payment_reminder_trigger_link(EE_Transaction $transaction)
629
+	{
630
+		$registration = $transaction->primary_registration();
631
+		if (
632
+			$registration instanceof EE_Registration
633
+			&& $registration->attendee() instanceof EE_Attendee
634
+			&& EEH_MSG_Template::is_mt_active('payment_reminder')
635
+			&& ! in_array(
636
+				$transaction->status_ID(),
637
+				array(EEM_Transaction::complete_status_code, EEM_Transaction::overpaid_status_code),
638
+				true
639
+			)
640
+			&& EE_Registry::instance()->CAP->current_user_can(
641
+				'ee_send_message',
642
+				'espresso_transactions_send_payment_reminder'
643
+			)
644
+		) {
645
+			$url = EE_Admin_Page::add_query_args_and_nonce(
646
+				array(
647
+					'action' => 'send_payment_reminder',
648
+					'TXN_ID' => $transaction->ID(),
649
+				),
650
+				TXN_ADMIN_URL
651
+			);
652
+			return '
653 653
                 <a href="' . $url . '"
654 654
                     aria-label="' . esc_attr__('Send Payment Reminder', 'event_espresso') . '"
655 655
                     class="ee-aria-tooltip button button--icon-only"
656 656
                 >
657 657
                     <span class="dashicons dashicons-email-alt"></span>
658 658
                 </a>';
659
-        }
660
-        return '';
661
-    }
662
-
663
-
664
-    /**
665
-     * Get link to filtered view in the message activity list table of messages for this transaction.
666
-     *
667
-     * @param EE_Transaction $transaction
668
-     * @return string
669
-     * @throws EE_Error
670
-     * @throws InvalidArgumentException
671
-     * @throws InvalidDataTypeException
672
-     * @throws InvalidInterfaceException
673
-     */
674
-    protected function get_related_messages_link(EE_Transaction $transaction)
675
-    {
676
-        return EE_Registry::instance()->CAP->current_user_can(
677
-            'ee_read_global_messages',
678
-            'view_filtered_messages'
679
-        )
680
-            ? EEH_MSG_Template::get_message_action_link(
681
-                'see_notifications_for',
682
-                null,
683
-                array('TXN_ID' => $transaction->ID())
684
-            )
685
-            : '';
686
-    }
687
-
688
-
689
-    /**
690
-     * Return the link to make a payment on the frontend
691
-     *
692
-     * @param EE_Transaction $transaction
693
-     * @return string
694
-     * @throws EE_Error
695
-     */
696
-    protected function get_payment_overview_link(EE_Transaction $transaction)
697
-    {
698
-        $registration = $transaction->primary_registration();
699
-        if (
700
-            $registration instanceof EE_Registration
701
-            && $transaction->status_ID() !== EEM_Transaction::complete_status_code
702
-            && $registration->owes_monies_and_can_pay()
703
-        ) {
704
-            return '
659
+		}
660
+		return '';
661
+	}
662
+
663
+
664
+	/**
665
+	 * Get link to filtered view in the message activity list table of messages for this transaction.
666
+	 *
667
+	 * @param EE_Transaction $transaction
668
+	 * @return string
669
+	 * @throws EE_Error
670
+	 * @throws InvalidArgumentException
671
+	 * @throws InvalidDataTypeException
672
+	 * @throws InvalidInterfaceException
673
+	 */
674
+	protected function get_related_messages_link(EE_Transaction $transaction)
675
+	{
676
+		return EE_Registry::instance()->CAP->current_user_can(
677
+			'ee_read_global_messages',
678
+			'view_filtered_messages'
679
+		)
680
+			? EEH_MSG_Template::get_message_action_link(
681
+				'see_notifications_for',
682
+				null,
683
+				array('TXN_ID' => $transaction->ID())
684
+			)
685
+			: '';
686
+	}
687
+
688
+
689
+	/**
690
+	 * Return the link to make a payment on the frontend
691
+	 *
692
+	 * @param EE_Transaction $transaction
693
+	 * @return string
694
+	 * @throws EE_Error
695
+	 */
696
+	protected function get_payment_overview_link(EE_Transaction $transaction)
697
+	{
698
+		$registration = $transaction->primary_registration();
699
+		if (
700
+			$registration instanceof EE_Registration
701
+			&& $transaction->status_ID() !== EEM_Transaction::complete_status_code
702
+			&& $registration->owes_monies_and_can_pay()
703
+		) {
704
+			return '
705 705
                 <a aria-label="' . esc_attr__('Make Payment from the Frontend.', 'event_espresso') . '"'
706
-                   . ' target="_blank" href="' . $registration->payment_overview_url(true) . '"'
707
-                   . ' class="ee-aria-tooltip button button--icon-only">
706
+				   . ' target="_blank" href="' . $registration->payment_overview_url(true) . '"'
707
+				   . ' class="ee-aria-tooltip button button--icon-only">
708 708
                     <span class="dashicons dashicons-money"></span>
709 709
                 </a>';
710
-        }
711
-        return '';
712
-    }
710
+		}
711
+		return '';
712
+	}
713 713
 }
Please login to merge, or discard this patch.
admin_pages/payments/Payment_Log_Admin_List_Table.class.php 2 patches
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -11,115 +11,115 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class Payment_Log_Admin_List_Table extends EE_Admin_List_Table
13 13
 {
14
-    /**
15
-     * @var Payments_Admin_Page $_admin_page
16
-     */
17
-    protected $_admin_page;
14
+	/**
15
+	 * @var Payments_Admin_Page $_admin_page
16
+	 */
17
+	protected $_admin_page;
18 18
 
19 19
 
20
-    /**
21
-     * @param EE_Admin_Page $admin_page
22
-     */
23
-    public function __construct($admin_page)
24
-    {
25
-        parent::__construct($admin_page);
26
-    }
20
+	/**
21
+	 * @param EE_Admin_Page $admin_page
22
+	 */
23
+	public function __construct($admin_page)
24
+	{
25
+		parent::__construct($admin_page);
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * _setup_data
31
-     *
32
-     * @return void
33
-     */
34
-    protected function _setup_data()
35
-    {
36
-        $this->_data = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page);
37
-        // if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash') {
38
-        //     $this->_data = $this->_admin_page->get_trashed_questions($this->_per_page, $this->_current_page, false);
39
-        // } else {
40
-        //     $this->_data = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, false);
41
-        // }
42
-        $this->_all_data_count = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, true);
43
-        add_action(
44
-            'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',
45
-            [$this, 'add_download_logs_checkbox']
46
-        );
47
-    }
29
+	/**
30
+	 * _setup_data
31
+	 *
32
+	 * @return void
33
+	 */
34
+	protected function _setup_data()
35
+	{
36
+		$this->_data = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page);
37
+		// if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash') {
38
+		//     $this->_data = $this->_admin_page->get_trashed_questions($this->_per_page, $this->_current_page, false);
39
+		// } else {
40
+		//     $this->_data = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, false);
41
+		// }
42
+		$this->_all_data_count = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, true);
43
+		add_action(
44
+			'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',
45
+			[$this, 'add_download_logs_checkbox']
46
+		);
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * add_download_logs_checkbox
52
-     * adds a checkbox to the bottom of the list table, instead of at the top with the rest of the filters
53
-     *
54
-     * @return void
55
-     */
56
-    public function add_download_logs_checkbox()
57
-    {
58
-        echo "<input type='submit' class='button--primary' id='download_results' name='download_results' value='"
59
-             . esc_html__('Download Results', 'event_espresso') . "'>";
60
-    }
50
+	/**
51
+	 * add_download_logs_checkbox
52
+	 * adds a checkbox to the bottom of the list table, instead of at the top with the rest of the filters
53
+	 *
54
+	 * @return void
55
+	 */
56
+	public function add_download_logs_checkbox()
57
+	{
58
+		echo "<input type='submit' class='button--primary' id='download_results' name='download_results' value='"
59
+			 . esc_html__('Download Results', 'event_espresso') . "'>";
60
+	}
61 61
 
62 62
 
63
-    /**
64
-     * _set_properties
65
-     *
66
-     * @return void
67
-     */
68
-    protected function _set_properties()
69
-    {
70
-        $this->_wp_list_args     = [
71
-            'singular' => esc_html__('payment log', 'event_espresso'),
72
-            'plural'   => esc_html__('payment logs', 'event_espresso'),
73
-            'ajax'     => true, // for now,
74
-            'screen'   => $this->_admin_page->get_current_screen()->id,
75
-        ];
76
-        $this->_columns          = [
77
-            'cb'       => '<input type="checkbox" />',
78
-            'id'       => esc_html__('ID', 'event_espresso'),
79
-            'LOG_time' => esc_html__('Time', 'event_espresso'),
80
-            'PMD_ID'   => esc_html__('Payment Method', 'event_espresso'),
81
-            'TXN_ID'   => esc_html__('Transaction ID', 'event_espresso'),
82
-        ];
83
-        $this->_sortable_columns = [
84
-            'LOG_time' => ['LOG_time' => true],
85
-        ];
86
-        $this->_hidden_columns   = [];
87
-    }
63
+	/**
64
+	 * _set_properties
65
+	 *
66
+	 * @return void
67
+	 */
68
+	protected function _set_properties()
69
+	{
70
+		$this->_wp_list_args     = [
71
+			'singular' => esc_html__('payment log', 'event_espresso'),
72
+			'plural'   => esc_html__('payment logs', 'event_espresso'),
73
+			'ajax'     => true, // for now,
74
+			'screen'   => $this->_admin_page->get_current_screen()->id,
75
+		];
76
+		$this->_columns          = [
77
+			'cb'       => '<input type="checkbox" />',
78
+			'id'       => esc_html__('ID', 'event_espresso'),
79
+			'LOG_time' => esc_html__('Time', 'event_espresso'),
80
+			'PMD_ID'   => esc_html__('Payment Method', 'event_espresso'),
81
+			'TXN_ID'   => esc_html__('Transaction ID', 'event_espresso'),
82
+		];
83
+		$this->_sortable_columns = [
84
+			'LOG_time' => ['LOG_time' => true],
85
+		];
86
+		$this->_hidden_columns   = [];
87
+	}
88 88
 
89 89
 
90
-    /**
91
-     * _get_table_filters
92
-     *
93
-     * @return array
94
-     * @throws EE_Error
95
-     * @throws ReflectionException
96
-     */
97
-    protected function _get_table_filters()
98
-    {
99
-        $filters = [];
100
-        // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
101
-        /** @var EE_Payment_Method[] $payment_methods */
102
-        $payment_methods      = EEM_Payment_Method::instance()->get_all();
103
-        $payment_method_names = [
104
-            ['id' => 'all', 'text' => esc_html__("All", 'event_espresso')],
105
-            ['id' => '0', 'text' => esc_html__("Unknown Payment Method", 'event_espresso')],
106
-        ];
107
-        foreach ($payment_methods as $payment_method) {
108
-            $payment_method_names[] = ['id' => $payment_method->ID(), 'text' => $payment_method->admin_name()];
109
-        }
110
-        $filters[]  = EEH_Form_Fields::select_input(
111
-            '_payment_method',
112
-            $payment_method_names,
113
-            $this->_req_data['_payment_method'] ?? 'all'
114
-        );
115
-        $start_date = isset($this->_req_data['payment-filter-start-date'])
116
-            ? wp_strip_all_tags($this->_req_data['payment-filter-start-date'])
117
-            : date('m/d/Y', strtotime('-6 months'));
118
-        $end_date   = isset($this->_req_data['payment-filter-end-date'])
119
-            ? wp_strip_all_tags($this->_req_data['payment-filter-end-date'])
120
-            : date('m/d/Y');
121
-        ob_start();
122
-        ?>
90
+	/**
91
+	 * _get_table_filters
92
+	 *
93
+	 * @return array
94
+	 * @throws EE_Error
95
+	 * @throws ReflectionException
96
+	 */
97
+	protected function _get_table_filters()
98
+	{
99
+		$filters = [];
100
+		// todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
101
+		/** @var EE_Payment_Method[] $payment_methods */
102
+		$payment_methods      = EEM_Payment_Method::instance()->get_all();
103
+		$payment_method_names = [
104
+			['id' => 'all', 'text' => esc_html__("All", 'event_espresso')],
105
+			['id' => '0', 'text' => esc_html__("Unknown Payment Method", 'event_espresso')],
106
+		];
107
+		foreach ($payment_methods as $payment_method) {
108
+			$payment_method_names[] = ['id' => $payment_method->ID(), 'text' => $payment_method->admin_name()];
109
+		}
110
+		$filters[]  = EEH_Form_Fields::select_input(
111
+			'_payment_method',
112
+			$payment_method_names,
113
+			$this->_req_data['_payment_method'] ?? 'all'
114
+		);
115
+		$start_date = isset($this->_req_data['payment-filter-start-date'])
116
+			? wp_strip_all_tags($this->_req_data['payment-filter-start-date'])
117
+			: date('m/d/Y', strtotime('-6 months'));
118
+		$end_date   = isset($this->_req_data['payment-filter-end-date'])
119
+			? wp_strip_all_tags($this->_req_data['payment-filter-end-date'])
120
+			: date('m/d/Y');
121
+		ob_start();
122
+		?>
123 123
         <label for="payment-filter-start-date">
124 124
             <?php esc_html_e('Display Transactions from ', 'event_espresso'); ?>
125 125
         </label>
@@ -141,157 +141,157 @@  discard block
 block discarded – undo
141 141
                size="15"
142 142
         />
143 143
         <?php
144
-        $filters[] = ob_get_clean();
145
-        return $filters;
146
-    }
144
+		$filters[] = ob_get_clean();
145
+		return $filters;
146
+	}
147 147
 
148 148
 
149
-    /**
150
-     * _add_view_counts
151
-     *
152
-     * @return void
153
-     */
154
-    protected function _add_view_counts()
155
-    {
156
-        $this->_views['all']['count'] = $this->_admin_page->get_payment_logs(
157
-            $this->_per_page,
158
-            $this->_current_page,
159
-            true
160
-        );
161
-    }
149
+	/**
150
+	 * _add_view_counts
151
+	 *
152
+	 * @return void
153
+	 */
154
+	protected function _add_view_counts()
155
+	{
156
+		$this->_views['all']['count'] = $this->_admin_page->get_payment_logs(
157
+			$this->_per_page,
158
+			$this->_current_page,
159
+			true
160
+		);
161
+	}
162 162
 
163 163
 
164
-    /**
165
-     * column_cb
166
-     *
167
-     * @param EE_Change_Log $item
168
-     * @return string
169
-     * @throws EE_Error
170
-     * @throws ReflectionException
171
-     */
172
-    public function column_cb($item)
173
-    {
174
-        return sprintf('<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID());
175
-    }
164
+	/**
165
+	 * column_cb
166
+	 *
167
+	 * @param EE_Change_Log $item
168
+	 * @return string
169
+	 * @throws EE_Error
170
+	 * @throws ReflectionException
171
+	 */
172
+	public function column_cb($item)
173
+	{
174
+		return sprintf('<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID());
175
+	}
176 176
 
177 177
 
178
-    /**
179
-     * column_id
180
-     *
181
-     * @param EE_Change_Log $item
182
-     * @return string
183
-     * @throws EE_Error
184
-     * @throws ReflectionException
185
-     */
186
-    public function column_id(EE_Change_Log $item)
187
-    {
188
-        $ID = absint($item->ID());
189
-        $url = esc_url_raw(
190
-            EE_Admin_Page::add_query_args_and_nonce(
191
-                [
192
-                        'action' => 'payment_log_details',
193
-                        'ID'     => $ID,
194
-                ],
195
-                EE_PAYMENTS_ADMIN_URL
196
-            )
197
-        );
198
-        $label = esc_attr__('View Payment Log Details', 'event_espresso');
199
-        $payment_log = "<a class='ee-aria-tooltip' aria-label='{$label}' href='$url'>{$ID}</a>";
200
-        $content = '
178
+	/**
179
+	 * column_id
180
+	 *
181
+	 * @param EE_Change_Log $item
182
+	 * @return string
183
+	 * @throws EE_Error
184
+	 * @throws ReflectionException
185
+	 */
186
+	public function column_id(EE_Change_Log $item)
187
+	{
188
+		$ID = absint($item->ID());
189
+		$url = esc_url_raw(
190
+			EE_Admin_Page::add_query_args_and_nonce(
191
+				[
192
+						'action' => 'payment_log_details',
193
+						'ID'     => $ID,
194
+				],
195
+				EE_PAYMENTS_ADMIN_URL
196
+			)
197
+		);
198
+		$label = esc_attr__('View Payment Log Details', 'event_espresso');
199
+		$payment_log = "<a class='ee-aria-tooltip' aria-label='{$label}' href='$url'>{$ID}</a>";
200
+		$content = '
201 201
             <span class="ee-entity-id">' . $payment_log . '</span>
202 202
             <span class="show-on-mobile-view-only">
203 203
                 <span>' . $this->column_LOG_time($item, false) . '</span>
204 204
                 &nbsp;
205 205
                 <span>' . $this->column_PMD_ID($item, false) . '</span>
206 206
             </span>';
207
-        return $this->columnContent('id', $content, 'end');
208
-    }
207
+		return $this->columnContent('id', $content, 'end');
208
+	}
209 209
 
210 210
 
211
-    /**
212
-     * column_LOG_time
213
-     *
214
-     * @param EE_Change_Log $item
215
-     * @param bool          $prep_content
216
-     * @return string
217
-     * @throws EE_Error
218
-     * @throws ReflectionException
219
-     */
220
-    public function column_LOG_time(EE_Change_Log $item, bool $prep_content = true): string
221
-    {
222
-        $content = $item->get_datetime('LOG_time');
223
-        return $prep_content ? $this->columnContent('LOG_time', $content) : $content;
224
-    }
211
+	/**
212
+	 * column_LOG_time
213
+	 *
214
+	 * @param EE_Change_Log $item
215
+	 * @param bool          $prep_content
216
+	 * @return string
217
+	 * @throws EE_Error
218
+	 * @throws ReflectionException
219
+	 */
220
+	public function column_LOG_time(EE_Change_Log $item, bool $prep_content = true): string
221
+	{
222
+		$content = $item->get_datetime('LOG_time');
223
+		return $prep_content ? $this->columnContent('LOG_time', $content) : $content;
224
+	}
225 225
 
226 226
 
227
-    /**
228
-     * column_PMD_ID
229
-     *
230
-     * @param EE_Change_Log $item
231
-     * @param bool          $prep_content
232
-     * @return string
233
-     * @throws EE_Error
234
-     */
235
-    public function column_PMD_ID(EE_Change_Log $item, bool $prep_content = true): string
236
-    {
237
-        $object = $item->object();
238
-        if ($object instanceof EE_Payment_Method) {
239
-            $content = $object->admin_name();
240
-        } elseif (
241
-            $object instanceof EE_Payment
242
-            && $object->payment_method() instanceof EE_Payment_Method
243
-        ) {
244
-            $content = $object->payment_method()->admin_name();
245
-        } elseif ($object instanceof EE_Transaction) {
246
-            $content = esc_html__('Unknown', 'event_espresso');
247
-        } else {
248
-            $content = esc_html__('No longer exists', 'event_espresso');
249
-        }
250
-        return $prep_content ? $this->columnContent('PMD_ID', $content) : $content;
251
-    }
227
+	/**
228
+	 * column_PMD_ID
229
+	 *
230
+	 * @param EE_Change_Log $item
231
+	 * @param bool          $prep_content
232
+	 * @return string
233
+	 * @throws EE_Error
234
+	 */
235
+	public function column_PMD_ID(EE_Change_Log $item, bool $prep_content = true): string
236
+	{
237
+		$object = $item->object();
238
+		if ($object instanceof EE_Payment_Method) {
239
+			$content = $object->admin_name();
240
+		} elseif (
241
+			$object instanceof EE_Payment
242
+			&& $object->payment_method() instanceof EE_Payment_Method
243
+		) {
244
+			$content = $object->payment_method()->admin_name();
245
+		} elseif ($object instanceof EE_Transaction) {
246
+			$content = esc_html__('Unknown', 'event_espresso');
247
+		} else {
248
+			$content = esc_html__('No longer exists', 'event_espresso');
249
+		}
250
+		return $prep_content ? $this->columnContent('PMD_ID', $content) : $content;
251
+	}
252 252
 
253 253
 
254
-    /**
255
-     * column_TXN_ID
256
-     *
257
-     * @param EE_Change_Log $item
258
-     * @return string
259
-     * @throws EE_Error
260
-     * @throws ReflectionException
261
-     */
262
-    public function column_TXN_ID(EE_Change_Log $item): string
263
-    {
264
-        $object = $item->object();
265
-        if ($object instanceof EE_Payment) {
266
-            $transaction_id = $object->TXN_ID();
267
-        } elseif ($object instanceof EE_Transaction) {
268
-            $transaction_id = $object->ID();
269
-        } else {
270
-            $transaction_id = null;
271
-        }
272
-        if (
273
-            $transaction_id
274
-            && EE_Registry::instance()->CAP->current_user_can(
275
-                'ee_read_transaction',
276
-                'espresso_transactions_view_transaction',
277
-                $transaction_id
278
-            )
279
-        ) {
280
-            $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
281
-                ['action' => 'view_transaction', 'TXN_ID' => $transaction_id],
282
-                TXN_ADMIN_URL
283
-            );
284
-            $content = '<a href="' . esc_url_raw($view_txn_lnk_url) . '"  '
285
-                   . 'aria-label="' . sprintf(
286
-                       esc_attr__('click to view transaction #%s', 'event_espresso'),
287
-                       $transaction_id
288
-                   ) . '">'
289
-                   . sprintf(esc_html__('view txn %s', 'event_espresso'), $transaction_id)
290
-                   . '</a>';
291
-        } else {
292
-            // No transaction id or use can not view the transaction.
293
-            $content = esc_html__('Unable to find transaction', 'event_espresso');
294
-        }
295
-        return $this->columnContent('TXN_ID', $content);
296
-    }
254
+	/**
255
+	 * column_TXN_ID
256
+	 *
257
+	 * @param EE_Change_Log $item
258
+	 * @return string
259
+	 * @throws EE_Error
260
+	 * @throws ReflectionException
261
+	 */
262
+	public function column_TXN_ID(EE_Change_Log $item): string
263
+	{
264
+		$object = $item->object();
265
+		if ($object instanceof EE_Payment) {
266
+			$transaction_id = $object->TXN_ID();
267
+		} elseif ($object instanceof EE_Transaction) {
268
+			$transaction_id = $object->ID();
269
+		} else {
270
+			$transaction_id = null;
271
+		}
272
+		if (
273
+			$transaction_id
274
+			&& EE_Registry::instance()->CAP->current_user_can(
275
+				'ee_read_transaction',
276
+				'espresso_transactions_view_transaction',
277
+				$transaction_id
278
+			)
279
+		) {
280
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
281
+				['action' => 'view_transaction', 'TXN_ID' => $transaction_id],
282
+				TXN_ADMIN_URL
283
+			);
284
+			$content = '<a href="' . esc_url_raw($view_txn_lnk_url) . '"  '
285
+				   . 'aria-label="' . sprintf(
286
+					   esc_attr__('click to view transaction #%s', 'event_espresso'),
287
+					   $transaction_id
288
+				   ) . '">'
289
+				   . sprintf(esc_html__('view txn %s', 'event_espresso'), $transaction_id)
290
+				   . '</a>';
291
+		} else {
292
+			// No transaction id or use can not view the transaction.
293
+			$content = esc_html__('Unable to find transaction', 'event_espresso');
294
+		}
295
+		return $this->columnContent('TXN_ID', $content);
296
+	}
297 297
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     public function add_download_logs_checkbox()
57 57
     {
58 58
         echo "<input type='submit' class='button--primary' id='download_results' name='download_results' value='"
59
-             . esc_html__('Download Results', 'event_espresso') . "'>";
59
+             . esc_html__('Download Results', 'event_espresso')."'>";
60 60
     }
61 61
 
62 62
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected function _set_properties()
69 69
     {
70
-        $this->_wp_list_args     = [
70
+        $this->_wp_list_args = [
71 71
             'singular' => esc_html__('payment log', 'event_espresso'),
72 72
             'plural'   => esc_html__('payment logs', 'event_espresso'),
73 73
             'ajax'     => true, // for now,
74 74
             'screen'   => $this->_admin_page->get_current_screen()->id,
75 75
         ];
76
-        $this->_columns          = [
76
+        $this->_columns = [
77 77
             'cb'       => '<input type="checkbox" />',
78 78
             'id'       => esc_html__('ID', 'event_espresso'),
79 79
             'LOG_time' => esc_html__('Time', 'event_espresso'),
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         foreach ($payment_methods as $payment_method) {
108 108
             $payment_method_names[] = ['id' => $payment_method->ID(), 'text' => $payment_method->admin_name()];
109 109
         }
110
-        $filters[]  = EEH_Form_Fields::select_input(
110
+        $filters[] = EEH_Form_Fields::select_input(
111 111
             '_payment_method',
112 112
             $payment_method_names,
113 113
             $this->_req_data['_payment_method'] ?? 'all'
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
         $label = esc_attr__('View Payment Log Details', 'event_espresso');
199 199
         $payment_log = "<a class='ee-aria-tooltip' aria-label='{$label}' href='$url'>{$ID}</a>";
200 200
         $content = '
201
-            <span class="ee-entity-id">' . $payment_log . '</span>
201
+            <span class="ee-entity-id">' . $payment_log.'</span>
202 202
             <span class="show-on-mobile-view-only">
203
-                <span>' . $this->column_LOG_time($item, false) . '</span>
203
+                <span>' . $this->column_LOG_time($item, false).'</span>
204 204
                 &nbsp;
205
-                <span>' . $this->column_PMD_ID($item, false) . '</span>
205
+                <span>' . $this->column_PMD_ID($item, false).'</span>
206 206
             </span>';
207 207
         return $this->columnContent('id', $content, 'end');
208 208
     }
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
                 ['action' => 'view_transaction', 'TXN_ID' => $transaction_id],
282 282
                 TXN_ADMIN_URL
283 283
             );
284
-            $content = '<a href="' . esc_url_raw($view_txn_lnk_url) . '"  '
285
-                   . 'aria-label="' . sprintf(
284
+            $content = '<a href="'.esc_url_raw($view_txn_lnk_url).'"  '
285
+                   . 'aria-label="'.sprintf(
286 286
                        esc_attr__('click to view transaction #%s', 'event_espresso'),
287 287
                        $transaction_id
288
-                   ) . '">'
288
+                   ).'">'
289 289
                    . sprintf(esc_html__('view txn %s', 'event_espresso'), $transaction_id)
290 290
                    . '</a>';
291 291
         } else {
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_List_Table.class.php 1 patch
Indentation   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -13,269 +13,269 @@
 block discarded – undo
13 13
  */
14 14
 class Venues_Admin_List_Table extends EE_Admin_List_Table
15 15
 {
16
-    /**
17
-     * @var Venues_Admin_Page $_admin_page
18
-     */
19
-    protected $_admin_page;
20
-
21
-
22
-    protected function _setup_data()
23
-    {
24
-        $this->_data           = $this->_admin_page->get_venues($this->_per_page);
25
-        $this->_all_data_count = $this->_admin_page->get_venues($this->_per_page, true);
26
-    }
27
-
28
-
29
-    protected function _set_properties()
30
-    {
31
-        $this->_wp_list_args = [
32
-            'singular' => esc_html__('Event Venue', 'event_espresso'),
33
-            'plural'   => esc_html__('Event Venues', 'event_espresso'),
34
-            'ajax'     => true, // for now,
35
-            'screen'   => $this->_admin_page->get_current_screen()->id,
36
-        ];
37
-
38
-        $this->_columns = [
39
-            'cb'       => '<input type="checkbox" />',
40
-            'id'       => esc_html__('ID', 'event_espresso'),
41
-            'name'     => esc_html__('Name', 'event_espresso'),
42
-            'address'  => esc_html__('Address', 'event_espresso'),
43
-            'city'     => esc_html__('City', 'event_espresso'),
44
-            'capacity' => esc_html__('Capacity', 'event_espresso'),
45
-            // 'shortcode' => esc_html__('Shortcode', 'event_espresso'),
46
-        ];
47
-
48
-        $this->_sortable_columns = [
49
-            'id'       => ['id' => true],
50
-            'name'     => ['name' => false],
51
-            'city'     => ['city' => false],
52
-            'capacity' => ['capacity' => false],
53
-        ];
54
-
55
-        $this->_hidden_columns = [];
56
-    }
57
-
58
-
59
-    // todo... add _venue_status in here (which we'll define a EE_Admin_CPT_List_Table for common properties)
60
-
61
-
62
-    /**
63
-     * @return array
64
-     */
65
-    protected function _get_table_filters()
66
-    {
67
-        return [];
68
-    }
69
-
70
-
71
-    /**
72
-     * @throws EE_Error
73
-     * @throws ReflectionException
74
-     */
75
-    protected function _add_view_counts()
76
-    {
77
-        $this->_views['all']['count'] = EEM_Venue::instance()->count();
78
-        if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
79
-            $this->_views['trash']['count'] = EEM_Venue::instance()->count_deleted();
80
-        }
81
-    }
82
-
83
-
84
-    /**
85
-     * @param EE_Venue|null $item
86
-     * @return string
87
-     * @throws EE_Error
88
-     * @throws ReflectionException
89
-     */
90
-    public function column_cb($item): string
91
-    {
92
-        return $item->count_related('Event') > 0 && $item->get('status') === 'trash'
93
-            ? '<span class="dashicons dashicons-lock"></span>'
94
-            : sprintf(
95
-                '<input type="checkbox" name="venue_id[]" value="%s" />',
96
-                $item->ID()
97
-            );
98
-    }
99
-
100
-
101
-    /**
102
-     * @param EE_Venue $venue
103
-     * @return string
104
-     * @throws EE_Error
105
-     * @throws ReflectionException
106
-     */
107
-    public function column_id(EE_Venue $venue): string
108
-    {
109
-        $content = '
16
+	/**
17
+	 * @var Venues_Admin_Page $_admin_page
18
+	 */
19
+	protected $_admin_page;
20
+
21
+
22
+	protected function _setup_data()
23
+	{
24
+		$this->_data           = $this->_admin_page->get_venues($this->_per_page);
25
+		$this->_all_data_count = $this->_admin_page->get_venues($this->_per_page, true);
26
+	}
27
+
28
+
29
+	protected function _set_properties()
30
+	{
31
+		$this->_wp_list_args = [
32
+			'singular' => esc_html__('Event Venue', 'event_espresso'),
33
+			'plural'   => esc_html__('Event Venues', 'event_espresso'),
34
+			'ajax'     => true, // for now,
35
+			'screen'   => $this->_admin_page->get_current_screen()->id,
36
+		];
37
+
38
+		$this->_columns = [
39
+			'cb'       => '<input type="checkbox" />',
40
+			'id'       => esc_html__('ID', 'event_espresso'),
41
+			'name'     => esc_html__('Name', 'event_espresso'),
42
+			'address'  => esc_html__('Address', 'event_espresso'),
43
+			'city'     => esc_html__('City', 'event_espresso'),
44
+			'capacity' => esc_html__('Capacity', 'event_espresso'),
45
+			// 'shortcode' => esc_html__('Shortcode', 'event_espresso'),
46
+		];
47
+
48
+		$this->_sortable_columns = [
49
+			'id'       => ['id' => true],
50
+			'name'     => ['name' => false],
51
+			'city'     => ['city' => false],
52
+			'capacity' => ['capacity' => false],
53
+		];
54
+
55
+		$this->_hidden_columns = [];
56
+	}
57
+
58
+
59
+	// todo... add _venue_status in here (which we'll define a EE_Admin_CPT_List_Table for common properties)
60
+
61
+
62
+	/**
63
+	 * @return array
64
+	 */
65
+	protected function _get_table_filters()
66
+	{
67
+		return [];
68
+	}
69
+
70
+
71
+	/**
72
+	 * @throws EE_Error
73
+	 * @throws ReflectionException
74
+	 */
75
+	protected function _add_view_counts()
76
+	{
77
+		$this->_views['all']['count'] = EEM_Venue::instance()->count();
78
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
79
+			$this->_views['trash']['count'] = EEM_Venue::instance()->count_deleted();
80
+		}
81
+	}
82
+
83
+
84
+	/**
85
+	 * @param EE_Venue|null $item
86
+	 * @return string
87
+	 * @throws EE_Error
88
+	 * @throws ReflectionException
89
+	 */
90
+	public function column_cb($item): string
91
+	{
92
+		return $item->count_related('Event') > 0 && $item->get('status') === 'trash'
93
+			? '<span class="dashicons dashicons-lock"></span>'
94
+			: sprintf(
95
+				'<input type="checkbox" name="venue_id[]" value="%s" />',
96
+				$item->ID()
97
+			);
98
+	}
99
+
100
+
101
+	/**
102
+	 * @param EE_Venue $venue
103
+	 * @return string
104
+	 * @throws EE_Error
105
+	 * @throws ReflectionException
106
+	 */
107
+	public function column_id(EE_Venue $venue): string
108
+	{
109
+		$content = '
110 110
             <span class="ee-entity-id">' . $venue->ID() . '</span>
111 111
             <span class="show-on-mobile-view-only">' . $this->column_name($venue, false) . '</span>';
112
-        return $this->columnContent('id', $content, 'end');
113
-    }
114
-
115
-
116
-    /**
117
-     * @param EE_Venue $venue
118
-     * @param bool     $prep_content
119
-     * @return string
120
-     * @throws EE_Error
121
-     * @throws ReflectionException
122
-     */
123
-    public function column_name(EE_Venue $venue, bool $prep_content = true): string
124
-    {
125
-        $edit_link = EE_Admin_Page::add_query_args_and_nonce(
126
-            [
127
-                'action' => 'edit',
128
-                'post'   => $venue->ID(),
129
-            ],
130
-            EE_VENUES_ADMIN_URL
131
-        );
132
-
133
-        $statuses = EEM_Venue::instance()->get_status_array();
134
-        $actions  = $prep_content ? $this->_column_name_action_setup($venue) : [];
135
-        $content  =
136
-            EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $venue->ID())
137
-                ? '<strong><a class="row-title" href="' . $edit_link . '">' . stripslashes_deep(
138
-                    $venue->name()
139
-                ) . '</a></strong>' : $venue->name();
140
-        $content  .= $venue->status() == 'draft' ? ' - <span class="post-state">' . $statuses['draft'] . '</span>' : '';
141
-
142
-        $content .= $prep_content ? $this->row_actions($actions) : '';
143
-        return $prep_content ? $this->columnContent('name', $content) : $content;
144
-    }
145
-
146
-
147
-    /**
148
-     * Used to setup the actions for the Venue name column
149
-     *
150
-     * @param EE_Venue $venue
151
-     * @return array()
152
-     * @throws EE_Error
153
-     * @throws ReflectionException
154
-     * @throws EE_Error
155
-     * @throws ReflectionException
156
-     */
157
-    protected function _column_name_action_setup(EE_Venue $venue): array
158
-    {
159
-        $actions = [];
160
-
161
-        if (EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $venue->ID())) {
162
-            $edit_query_args = [
163
-                'action' => 'edit',
164
-                'post'   => $venue->ID(),
165
-            ];
166
-            $edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL);
167
-            $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__(
168
-                'Edit Venue',
169
-                'event_espresso'
170
-            ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>';
171
-        }
172
-
173
-
174
-        switch ($venue->get('status')) {
175
-            case 'trash':
176
-                if (
177
-                    EE_Registry::instance()->CAP->current_user_can(
178
-                        'ee_delete_venue',
179
-                        'espresso_venues_restore_venue',
180
-                        $venue->ID()
181
-                    )
182
-                ) {
183
-                    $restore_venue_link = EE_Admin_Page::add_query_args_and_nonce(
184
-                        [
185
-                            'action' => 'restore_venue',
186
-                            'VNU_ID' => $venue->ID(),
187
-                        ],
188
-                        EE_VENUES_ADMIN_URL
189
-                    );
190
-
191
-                    $actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '" title="' . esc_attr__(
192
-                        'Restore from Trash',
193
-                        'event_espresso'
194
-                    ) . '">' . esc_html__('Restore from Trash', 'event_espresso') . '</a>';
195
-                }
196
-                if (
197
-                    $venue->count_related('Event') === 0
198
-                    && EE_Registry::instance()->CAP->current_user_can(
199
-                        'ee_delete_venue',
200
-                        'espresso_venues_delete_venue',
201
-                        $venue->ID()
202
-                    )
203
-                ) {
204
-                    $delete_venue_link = EE_Admin_Page::add_query_args_and_nonce(
205
-                        [
206
-                            'action' => 'delete_venue',
207
-                            'VNU_ID' => $venue->ID(),
208
-                        ],
209
-                        EE_VENUES_ADMIN_URL
210
-                    );
211
-
212
-                    $actions['delete permanently'] = '<a href="' . $delete_venue_link . '" title="' . esc_attr__(
213
-                        'Delete Permanently',
214
-                        'event_espresso'
215
-                    ) . '">' . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
216
-                }
217
-                break;
218
-            default:
219
-                $actions['view'] = '
112
+		return $this->columnContent('id', $content, 'end');
113
+	}
114
+
115
+
116
+	/**
117
+	 * @param EE_Venue $venue
118
+	 * @param bool     $prep_content
119
+	 * @return string
120
+	 * @throws EE_Error
121
+	 * @throws ReflectionException
122
+	 */
123
+	public function column_name(EE_Venue $venue, bool $prep_content = true): string
124
+	{
125
+		$edit_link = EE_Admin_Page::add_query_args_and_nonce(
126
+			[
127
+				'action' => 'edit',
128
+				'post'   => $venue->ID(),
129
+			],
130
+			EE_VENUES_ADMIN_URL
131
+		);
132
+
133
+		$statuses = EEM_Venue::instance()->get_status_array();
134
+		$actions  = $prep_content ? $this->_column_name_action_setup($venue) : [];
135
+		$content  =
136
+			EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $venue->ID())
137
+				? '<strong><a class="row-title" href="' . $edit_link . '">' . stripslashes_deep(
138
+					$venue->name()
139
+				) . '</a></strong>' : $venue->name();
140
+		$content  .= $venue->status() == 'draft' ? ' - <span class="post-state">' . $statuses['draft'] . '</span>' : '';
141
+
142
+		$content .= $prep_content ? $this->row_actions($actions) : '';
143
+		return $prep_content ? $this->columnContent('name', $content) : $content;
144
+	}
145
+
146
+
147
+	/**
148
+	 * Used to setup the actions for the Venue name column
149
+	 *
150
+	 * @param EE_Venue $venue
151
+	 * @return array()
152
+	 * @throws EE_Error
153
+	 * @throws ReflectionException
154
+	 * @throws EE_Error
155
+	 * @throws ReflectionException
156
+	 */
157
+	protected function _column_name_action_setup(EE_Venue $venue): array
158
+	{
159
+		$actions = [];
160
+
161
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $venue->ID())) {
162
+			$edit_query_args = [
163
+				'action' => 'edit',
164
+				'post'   => $venue->ID(),
165
+			];
166
+			$edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL);
167
+			$actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__(
168
+				'Edit Venue',
169
+				'event_espresso'
170
+			) . '">' . esc_html__('Edit', 'event_espresso') . '</a>';
171
+		}
172
+
173
+
174
+		switch ($venue->get('status')) {
175
+			case 'trash':
176
+				if (
177
+					EE_Registry::instance()->CAP->current_user_can(
178
+						'ee_delete_venue',
179
+						'espresso_venues_restore_venue',
180
+						$venue->ID()
181
+					)
182
+				) {
183
+					$restore_venue_link = EE_Admin_Page::add_query_args_and_nonce(
184
+						[
185
+							'action' => 'restore_venue',
186
+							'VNU_ID' => $venue->ID(),
187
+						],
188
+						EE_VENUES_ADMIN_URL
189
+					);
190
+
191
+					$actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '" title="' . esc_attr__(
192
+						'Restore from Trash',
193
+						'event_espresso'
194
+					) . '">' . esc_html__('Restore from Trash', 'event_espresso') . '</a>';
195
+				}
196
+				if (
197
+					$venue->count_related('Event') === 0
198
+					&& EE_Registry::instance()->CAP->current_user_can(
199
+						'ee_delete_venue',
200
+						'espresso_venues_delete_venue',
201
+						$venue->ID()
202
+					)
203
+				) {
204
+					$delete_venue_link = EE_Admin_Page::add_query_args_and_nonce(
205
+						[
206
+							'action' => 'delete_venue',
207
+							'VNU_ID' => $venue->ID(),
208
+						],
209
+						EE_VENUES_ADMIN_URL
210
+					);
211
+
212
+					$actions['delete permanently'] = '<a href="' . $delete_venue_link . '" title="' . esc_attr__(
213
+						'Delete Permanently',
214
+						'event_espresso'
215
+					) . '">' . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
216
+				}
217
+				break;
218
+			default:
219
+				$actions['view'] = '
220 220
                     <a  href="' . get_permalink($venue->ID()) . '"
221 221
                         title="' . esc_attr__('View Venue', 'event_espresso') . '"
222 222
                     >
223 223
                         ' . esc_html__('View', 'event_espresso') . '
224 224
                     </a>';
225
-                if (
226
-                    EE_Registry::instance()->CAP->current_user_can(
227
-                        'ee_delete_venue',
228
-                        'espresso_venues_trash_venue',
229
-                        $venue->ID()
230
-                    )
231
-                ) {
232
-                    $trash_venue_link = EE_Admin_Page::add_query_args_and_nonce(
233
-                        [
234
-                            'action' => 'trash_venue',
235
-                            'VNU_ID' => $venue->ID(),
236
-                        ],
237
-                        EE_VENUES_ADMIN_URL
238
-                    );
239
-
240
-                    $actions['move to trash'] = '<a href="' . $trash_venue_link . '" title="' . esc_attr__(
241
-                        'Trash Event',
242
-                        'event_espresso'
243
-                    ) . '">' . esc_html__('Trash', 'event_espresso') . '</a>';
244
-                }
245
-        }
246
-        return $actions;
247
-    }
248
-
249
-
250
-    public function column_address(EE_Venue $venue): string
251
-    {
252
-        return $this->columnContent('address', $venue->address());
253
-    }
254
-
255
-
256
-    public function column_city(EE_Venue $venue): string
257
-    {
258
-        return $this->columnContent('city', $venue->city());
259
-    }
260
-
261
-
262
-    /**
263
-     * @throws EE_Error
264
-     * @throws ReflectionException
265
-     */
266
-    public function column_capacity(EE_Venue $venue): string
267
-    {
268
-        return $this->columnContent('capacity', $venue->capacity());
269
-    }
270
-
271
-
272
-    /**
273
-     * @throws ReflectionException
274
-     * @throws EE_Error
275
-     */
276
-    public function column_shortcode(EE_Venue $venue): string
277
-    {
278
-        $content = '[ESPRESSO_VENUE id=' . $venue->ID() . ']';
279
-        return $this->columnContent('shortcode', $content);
280
-    }
225
+				if (
226
+					EE_Registry::instance()->CAP->current_user_can(
227
+						'ee_delete_venue',
228
+						'espresso_venues_trash_venue',
229
+						$venue->ID()
230
+					)
231
+				) {
232
+					$trash_venue_link = EE_Admin_Page::add_query_args_and_nonce(
233
+						[
234
+							'action' => 'trash_venue',
235
+							'VNU_ID' => $venue->ID(),
236
+						],
237
+						EE_VENUES_ADMIN_URL
238
+					);
239
+
240
+					$actions['move to trash'] = '<a href="' . $trash_venue_link . '" title="' . esc_attr__(
241
+						'Trash Event',
242
+						'event_espresso'
243
+					) . '">' . esc_html__('Trash', 'event_espresso') . '</a>';
244
+				}
245
+		}
246
+		return $actions;
247
+	}
248
+
249
+
250
+	public function column_address(EE_Venue $venue): string
251
+	{
252
+		return $this->columnContent('address', $venue->address());
253
+	}
254
+
255
+
256
+	public function column_city(EE_Venue $venue): string
257
+	{
258
+		return $this->columnContent('city', $venue->city());
259
+	}
260
+
261
+
262
+	/**
263
+	 * @throws EE_Error
264
+	 * @throws ReflectionException
265
+	 */
266
+	public function column_capacity(EE_Venue $venue): string
267
+	{
268
+		return $this->columnContent('capacity', $venue->capacity());
269
+	}
270
+
271
+
272
+	/**
273
+	 * @throws ReflectionException
274
+	 * @throws EE_Error
275
+	 */
276
+	public function column_shortcode(EE_Venue $venue): string
277
+	{
278
+		$content = '[ESPRESSO_VENUE id=' . $venue->ID() . ']';
279
+		return $this->columnContent('shortcode', $content);
280
+	}
281 281
 }
Please login to merge, or discard this patch.
admin_pages/venues/Venue_Categories_Admin_List_Table.class.php 1 patch
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -13,137 +13,137 @@
 block discarded – undo
13 13
  */
14 14
 class Venue_Categories_Admin_List_Table extends EE_Admin_List_Table
15 15
 {
16
-    protected function _setup_data()
17
-    {
18
-        $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page);
19
-        $this->_all_data_count = $this->_admin_page->get_categories($this->_per_page, $this->_current_page, true);
20
-    }
21
-
22
-
23
-    protected function _set_properties()
24
-    {
25
-        $this->_wp_list_args = array(
26
-            'singular' => esc_html__('venue category', 'event_espresso'),
27
-            'plural'   => esc_html__('venue categories', 'event_espresso'),
28
-            'ajax'     => true, // for now,
29
-            'screen'   => $this->_admin_page->get_current_screen()->id,
30
-        );
31
-
32
-        $this->_columns = array(
33
-            'cb'    => '<input type="checkbox" />',
34
-            'id'    => esc_html__('ID', 'event_espresso'),
35
-            'name'  => esc_html__('Name', 'event_espresso'),
36
-            'count' => esc_html__('Venues', 'event_espresso'),
37
-        );
38
-
39
-        $this->_sortable_columns = array(
40
-            'id'    => array('Term.term_id' => true),
41
-            'name'  => array('Term.slug' => false),
42
-            'count' => array('term_count' => false),
43
-        );
44
-
45
-        $this->_hidden_columns = array();
46
-    }
47
-
48
-
49
-    // not needed
50
-    protected function _get_table_filters()
51
-    {
52
-        return [];
53
-    }
54
-
55
-
56
-    protected function _add_view_counts()
57
-    {
58
-        $this->_views['all']['count'] = $this->_all_data_count;
59
-    }
60
-
61
-
62
-    public function column_cb($item)
63
-    {
64
-        return sprintf('<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id'));
65
-    }
66
-
67
-
68
-    public function column_id($item)
69
-    {
70
-        $content = '<span class="ee-entity-id">' . $item->get('term_id') . '</span>';
71
-        $content .= '
16
+	protected function _setup_data()
17
+	{
18
+		$this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page);
19
+		$this->_all_data_count = $this->_admin_page->get_categories($this->_per_page, $this->_current_page, true);
20
+	}
21
+
22
+
23
+	protected function _set_properties()
24
+	{
25
+		$this->_wp_list_args = array(
26
+			'singular' => esc_html__('venue category', 'event_espresso'),
27
+			'plural'   => esc_html__('venue categories', 'event_espresso'),
28
+			'ajax'     => true, // for now,
29
+			'screen'   => $this->_admin_page->get_current_screen()->id,
30
+		);
31
+
32
+		$this->_columns = array(
33
+			'cb'    => '<input type="checkbox" />',
34
+			'id'    => esc_html__('ID', 'event_espresso'),
35
+			'name'  => esc_html__('Name', 'event_espresso'),
36
+			'count' => esc_html__('Venues', 'event_espresso'),
37
+		);
38
+
39
+		$this->_sortable_columns = array(
40
+			'id'    => array('Term.term_id' => true),
41
+			'name'  => array('Term.slug' => false),
42
+			'count' => array('term_count' => false),
43
+		);
44
+
45
+		$this->_hidden_columns = array();
46
+	}
47
+
48
+
49
+	// not needed
50
+	protected function _get_table_filters()
51
+	{
52
+		return [];
53
+	}
54
+
55
+
56
+	protected function _add_view_counts()
57
+	{
58
+		$this->_views['all']['count'] = $this->_all_data_count;
59
+	}
60
+
61
+
62
+	public function column_cb($item)
63
+	{
64
+		return sprintf('<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id'));
65
+	}
66
+
67
+
68
+	public function column_id($item)
69
+	{
70
+		$content = '<span class="ee-entity-id">' . $item->get('term_id') . '</span>';
71
+		$content .= '
72 72
             <span class="show-on-mobile-view-only">
73 73
                 ' . $this->column_name($item, false) . '
74 74
             </span>';
75
-        return $this->columnContent('id', $content, 'end');
76
-    }
77
-
78
-
79
-    public function column_name(EE_Term_Taxonomy $item, bool $prep_content = true): string
80
-    {
81
-        $VEN_CAT_ID = $item->get('term_id');
82
-        $edit_query_args = array(
83
-            'action'     => 'edit_category',
84
-            'VEN_CAT_ID' => $VEN_CAT_ID,
85
-        );
86
-
87
-        $delete_query_args = array(
88
-            'action'     => 'delete_category',
89
-            'VEN_CAT_ID' => $VEN_CAT_ID,
90
-        );
91
-
92
-        $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL);
93
-        $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL);
94
-
95
-        $term_name = $item->get_first_related('Term')->get('name');
96
-
97
-        $actions = array(
98
-            'edit' => '<a href="' . $edit_link . '" aria-label="' . sprintf(
99
-                /* translators: The name of the venue category */
100
-                esc_attr__(
101
-                    'Edit Category (%s)',
102
-                    'event_espresso'
103
-                ),
104
-                $term_name
105
-            ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>',
106
-        );
107
-
108
-
109
-        $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . sprintf(
110
-            /* translators: The name of the venue category */
111
-            esc_attr__(
112
-                'Delete Category (%s)',
113
-                'event_espresso'
114
-            ),
115
-            $term_name
116
-        ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>';
117
-
118
-        $content = '
75
+		return $this->columnContent('id', $content, 'end');
76
+	}
77
+
78
+
79
+	public function column_name(EE_Term_Taxonomy $item, bool $prep_content = true): string
80
+	{
81
+		$VEN_CAT_ID = $item->get('term_id');
82
+		$edit_query_args = array(
83
+			'action'     => 'edit_category',
84
+			'VEN_CAT_ID' => $VEN_CAT_ID,
85
+		);
86
+
87
+		$delete_query_args = array(
88
+			'action'     => 'delete_category',
89
+			'VEN_CAT_ID' => $VEN_CAT_ID,
90
+		);
91
+
92
+		$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL);
93
+		$delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL);
94
+
95
+		$term_name = $item->get_first_related('Term')->get('name');
96
+
97
+		$actions = array(
98
+			'edit' => '<a href="' . $edit_link . '" aria-label="' . sprintf(
99
+				/* translators: The name of the venue category */
100
+				esc_attr__(
101
+					'Edit Category (%s)',
102
+					'event_espresso'
103
+				),
104
+				$term_name
105
+			) . '">' . esc_html__('Edit', 'event_espresso') . '</a>',
106
+		);
107
+
108
+
109
+		$actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . sprintf(
110
+			/* translators: The name of the venue category */
111
+			esc_attr__(
112
+				'Delete Category (%s)',
113
+				'event_espresso'
114
+			),
115
+			$term_name
116
+		) . '">' . esc_html__('Delete', 'event_espresso') . '</a>';
117
+
118
+		$content = '
119 119
             <strong>
120 120
                 <a class="row-title" href="' . $edit_link . '">
121 121
                     ' . $item->get_first_related('Term')->get('name') . '
122 122
                 </a>
123 123
             </strong>';
124 124
 
125
-        $content .= $prep_content ? $this->row_actions($actions) : '';
126
-        return $prep_content ? $this->columnContent('name', $content) : $content;
127
-    }
125
+		$content .= $prep_content ? $this->row_actions($actions) : '';
126
+		return $prep_content ? $this->columnContent('name', $content) : $content;
127
+	}
128 128
 
129 129
 
130
-    public function column_shortcode(EE_Term_Taxonomy $item): string
131
-    {
132
-        $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]';
133
-        return $this->columnContent('shortcode', $content);
134
-    }
130
+	public function column_shortcode(EE_Term_Taxonomy $item): string
131
+	{
132
+		$content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]';
133
+		return $this->columnContent('shortcode', $content);
134
+	}
135 135
 
136 136
 
137
-    public function column_count(EE_Term_Taxonomy $item): string
138
-    {
139
-        $args = array(
140
-            'action'   => 'default',
141
-            'category' => $item->get_first_related('Term')->ID(),
142
-        );
143
-        $content = '
137
+	public function column_count(EE_Term_Taxonomy $item): string
138
+	{
139
+		$args = array(
140
+			'action'   => 'default',
141
+			'category' => $item->get_first_related('Term')->ID(),
142
+		);
143
+		$content = '
144 144
         <a href="' . EE_Admin_Page::add_query_args_and_nonce($args, EE_VENUES_ADMIN_URL) . '">
145 145
             ' . $item->get('term_count') . '
146 146
         </a>';
147
-        return $this->columnContent('count', $content, 'end');
148
-    }
147
+		return $this->columnContent('count', $content, 'end');
148
+	}
149 149
 }
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 1 patch
Indentation   +1005 added lines, -1005 removed lines patch added patch discarded remove patch
@@ -15,574 +15,574 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class EE_Registrations_List_Table extends EE_Admin_List_Table
17 17
 {
18
-    /**
19
-     * @var Registrations_Admin_Page
20
-     */
21
-    protected $_admin_page;
22
-
23
-    /**
24
-     * @var RegistrationsListTableUserCapabilities
25
-     */
26
-    protected $caps_handler;
27
-
28
-    /**
29
-     * @var array
30
-     */
31
-    private $_status;
32
-
33
-    /**
34
-     * An array of transaction details for the related transaction to the registration being processed.
35
-     * This is set via the _set_related_details method.
36
-     *
37
-     * @var array
38
-     */
39
-    protected $_transaction_details = [];
40
-
41
-    /**
42
-     * An array of event details for the related event to the registration being processed.
43
-     * This is set via the _set_related_details method.
44
-     *
45
-     * @var array
46
-     */
47
-    protected $_event_details = [];
48
-
49
-
50
-    /**
51
-     * @param Registrations_Admin_Page $admin_page
52
-     */
53
-    public function __construct(Registrations_Admin_Page $admin_page)
54
-    {
55
-        $this->caps_handler = new RegistrationsListTableUserCapabilities(EE_Registry::instance()->CAP);
56
-        $req_data = $admin_page->get_request_data();
57
-        if (! empty($req_data['event_id'])) {
58
-            $extra_query_args = [];
59
-            foreach ($admin_page->get_views() as $view_details) {
60
-                $extra_query_args[ $view_details['slug'] ] = ['event_id' => $req_data['event_id']];
61
-            }
62
-            $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
63
-        }
64
-        parent::__construct($admin_page);
65
-        $this->_status = $this->_admin_page->get_registration_status_array();
66
-    }
67
-
68
-
69
-    /**
70
-     * @return void
71
-     * @throws EE_Error
72
-     */
73
-    protected function _setup_data()
74
-    {
75
-        $this->_data           = $this->_admin_page->get_registrations($this->_per_page);
76
-        $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true);
77
-    }
78
-
79
-
80
-    /**
81
-     * @return void
82
-     */
83
-    protected function _set_properties()
84
-    {
85
-        $return_url          = $this->getReturnUrl();
86
-        $req_data            = $this->_admin_page->get_request_data();
87
-
88
-        $this->_wp_list_args = [
89
-            'singular' => esc_html__('registration', 'event_espresso'),
90
-            'plural'   => esc_html__('registrations', 'event_espresso'),
91
-            'ajax'     => true,
92
-            'screen'   => $this->_admin_page->get_current_screen()->id,
93
-        ];
94
-
95
-        $EVT_ID = isset($req_data['event_id']) ? (int) $req_data['event_id'] : 0;
96
-
97
-        $DTT_ID = $req_data['DTT_ID'] ?? 0;
98
-        $DTT_ID = $req_data['datetime_id'] ?? $DTT_ID;
99
-        $DTT_ID = (int) $DTT_ID;
100
-
101
-        if ($EVT_ID) {
102
-            $this->_columns        = [
103
-                'cb'               => '<input type="checkbox" />', // Render a checkbox instead of text
104
-                'id'               => esc_html__('ID', 'event_espresso'),
105
-                'ATT_fname'        => esc_html__('Name', 'event_espresso'),
106
-                'ATT_email'        => esc_html__('Email', 'event_espresso'),
107
-                '_REG_date'        => esc_html__('Reg Date', 'event_espresso'),
108
-                'PRC_amount'       => esc_html__('TKT Price', 'event_espresso'),
109
-                '_REG_final_price' => esc_html__('Final Price', 'event_espresso'),
110
-                'TXN_total'        => esc_html__('Total Txn', 'event_espresso'),
111
-                'TXN_paid'         => esc_html__('Paid', 'event_espresso'),
112
-                'actions'          => $this->actionsColumnHeader(),
113
-            ];
114
-        } else {
115
-            $this->_columns        = [
116
-                'cb'               => '<input type="checkbox" />', // Render a checkbox instead of text
117
-                'id'               => esc_html__('ID', 'event_espresso'),
118
-                'ATT_fname'        => esc_html__('Name', 'event_espresso'),
119
-                '_REG_date'        => esc_html__('TXN Date', 'event_espresso'),
120
-                'event_name'       => esc_html__('Event', 'event_espresso'),
121
-                'DTT_EVT_start'    => esc_html__('Event Date', 'event_espresso'),
122
-                '_REG_final_price' => esc_html__('Price', 'event_espresso'),
123
-                '_REG_paid'        => esc_html__('Paid', 'event_espresso'),
124
-                'actions'          => $this->actionsColumnHeader(),
125
-            ];
126
-        }
127
-
128
-        $csv_report = RegistrationsCsvReportParams::getRequestParams($return_url, $req_data, $EVT_ID, $DTT_ID);
129
-        if (! empty($csv_report)) {
130
-            $this->_bottom_buttons['csv_reg_report'] = $csv_report;
131
-        }
132
-
133
-        $this->_primary_column   = 'id';
134
-        $this->_sortable_columns = [
135
-            '_REG_date'     => ['_REG_date' => true],   // true means its already sorted
136
-            /**
137
-             * Allows users to change the default sort if they wish.
138
-             * Returning a falsey on this filter will result in the default sort to be by firstname rather than last
139
-             * name.
140
-             */
141
-            'ATT_fname'     => [
142
-                'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
143
-                true,
144
-                $this,
145
-            ]
146
-                ? ['ATT_lname' => false]
147
-                : ['ATT_fname' => false],
148
-            'event_name'    => ['event_name' => false],
149
-            'DTT_EVT_start' => ['DTT_EVT_start' => false],
150
-            'id'            => ['REG_ID' => false],
151
-        ];
152
-        $this->_hidden_columns   = [];
153
-    }
154
-
155
-
156
-    /**
157
-     * This simply sets up the row class for the table rows.
158
-     * Allows for easier overriding of child methods for setting up sorting.
159
-     *
160
-     * @param EE_Registration $item the current item
161
-     * @return string
162
-     */
163
-    protected function _get_row_class($item): string
164
-    {
165
-        $class = parent::_get_row_class($item);
166
-        if ($this->_has_checkbox_column) {
167
-            $class .= ' has-checkbox-column';
168
-        }
169
-        return $class;
170
-    }
171
-
172
-
173
-    /**
174
-     * Set the $_transaction_details property if not set yet.
175
-     *
176
-     * @param EE_Registration $registration
177
-     * @throws EE_Error
178
-     * @throws InvalidArgumentException
179
-     * @throws ReflectionException
180
-     * @throws InvalidDataTypeException
181
-     * @throws InvalidInterfaceException
182
-     */
183
-    protected function _set_related_details(EE_Registration $registration)
184
-    {
185
-        $transaction                = $registration->get_first_related('Transaction');
186
-        $status                     = $transaction instanceof EE_Transaction
187
-            ? $transaction->status_ID()
188
-            : EEM_Transaction::failed_status_code;
189
-        $this->_transaction_details = [
190
-            'transaction' => $transaction,
191
-            'status'      => $status,
192
-            'id'          => $transaction instanceof EE_Transaction
193
-                ? $transaction->ID()
194
-                : 0,
195
-            'title_attr'  => sprintf(
196
-                esc_html__('View Transaction Details (%s)', 'event_espresso'),
197
-                EEH_Template::pretty_status($status, false, 'sentence')
198
-            ),
199
-        ];
200
-        try {
201
-            $event = $registration->event();
202
-        } catch (EntityNotFoundException $e) {
203
-            $event = null;
204
-        }
205
-        $status               = $event instanceof EE_Event
206
-            ? $event->get_active_status()
207
-            : EE_Datetime::inactive;
208
-        $this->_event_details = [
209
-            'event'      => $event,
210
-            'status'     => $status,
211
-            'id'         => $event instanceof EE_Event
212
-                ? $event->ID()
213
-                : 0,
214
-            'title_attr' => sprintf(
215
-                esc_html__('Edit Event (%s)', 'event_espresso'),
216
-                EEH_Template::pretty_status($status, false, 'sentence')
217
-            ),
218
-        ];
219
-    }
220
-
221
-
222
-    /**
223
-     * @return array
224
-     * @throws EE_Error
225
-     * @throws ReflectionException
226
-     */
227
-    protected function _get_table_filters()
228
-    {
229
-        $filters = [];
230
-        // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as
231
-        // methods.
232
-        $cur_date     = $this->_req_data['month_range'] ?? '';
233
-        $cur_category = $this->_req_data['EVT_CAT'] ?? -1;
234
-        $reg_status   = $this->_req_data['_reg_status'] ?? '';
235
-        $filters[]    = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
236
-        $filters[]    = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
237
-        $status       = [];
238
-        $status[]     = ['id' => 0, 'text' => esc_html__('Select Status', 'event_espresso')];
239
-        foreach ($this->_status as $key => $value) {
240
-            $status[] = ['id' => $key, 'text' => $value];
241
-        }
242
-        if ($this->_view !== 'incomplete') {
243
-            $filters[] = EEH_Form_Fields::select_input(
244
-                '_reg_status',
245
-                $status,
246
-                isset($this->_req_data['_reg_status'])
247
-                    ? strtoupper(sanitize_key($this->_req_data['_reg_status']))
248
-                    : ''
249
-            );
250
-        }
251
-        foreach (['event_id', 'datetime_id', 'ticket_id'] as $filter_key) {
252
-            if (isset($this->_req_data[ $filter_key ])) {
253
-                $filters[] = EEH_Form_Fields::hidden_input($filter_key, $this->_req_data[ $filter_key ], 'reg_' . $filter_key);
254
-            }
255
-        }
256
-        return $filters;
257
-    }
258
-
259
-
260
-    /**
261
-     * @return void
262
-     * @throws EE_Error
263
-     * @throws InvalidArgumentException
264
-     * @throws InvalidDataTypeException
265
-     * @throws InvalidInterfaceException
266
-     * @throws ReflectionException
267
-     */
268
-    protected function _add_view_counts()
269
-    {
270
-        $this->_views['all']['count']   = $this->_total_registrations();
271
-        $this->_views['month']['count'] = $this->_total_registrations_this_month();
272
-        $this->_views['today']['count'] = $this->_total_registrations_today();
273
-        if ($this->caps_handler->userCanTrashRegistrations()) {
274
-            $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
275
-            $this->_views['trash']['count']      = $this->_total_registrations('trash');
276
-        }
277
-    }
278
-
279
-
280
-    /**
281
-     * @param string $view
282
-     * @return int
283
-     * @throws EE_Error
284
-     * @throws ReflectionException
285
-     */
286
-    protected function _total_registrations(string $view = ''): int
287
-    {
288
-        $_where = [];
289
-        $EVT_ID = isset($this->_req_data['event_id'])
290
-            ? absint($this->_req_data['event_id'])
291
-            : false;
292
-        if ($EVT_ID) {
293
-            $_where['EVT_ID'] = $EVT_ID;
294
-        }
295
-        switch ($view) {
296
-            case 'trash':
297
-                return EEM_Registration::instance()->count_deleted([$_where]);
298
-            case 'incomplete':
299
-                $_where['STS_ID'] = EEM_Registration::status_id_incomplete;
300
-                break;
301
-            default:
302
-                $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete];
303
-        }
304
-        return EEM_Registration::instance()->count([$_where]);
305
-    }
306
-
307
-
308
-    /**
309
-     * @return int
310
-     * @throws EE_Error
311
-     * @throws ReflectionException
312
-     */
313
-    protected function _total_registrations_this_month(): int
314
-    {
315
-        $EVT_ID          = isset($this->_req_data['event_id'])
316
-            ? absint($this->_req_data['event_id'])
317
-            : false;
318
-        $_where          = $EVT_ID
319
-            ? ['EVT_ID' => $EVT_ID]
320
-            : [];
321
-        $this_year_r     = date('Y', current_time('timestamp'));
322
-        $time_start      = ' 00:00:00';
323
-        $time_end        = ' 23:59:59';
324
-        $this_month_r    = date('m', current_time('timestamp'));
325
-        $days_this_month = date('t', current_time('timestamp'));
326
-        // setup date query.
327
-        $beginning_string   = EEM_Registration::instance()->convert_datetime_for_query(
328
-            'REG_date',
329
-            $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
330
-            'Y-m-d H:i:s'
331
-        );
332
-        $end_string         = EEM_Registration::instance()->convert_datetime_for_query(
333
-            'REG_date',
334
-            $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
335
-            'Y-m-d H:i:s'
336
-        );
337
-        $_where['REG_date'] = [
338
-            'BETWEEN',
339
-            [
340
-                $beginning_string,
341
-                $end_string,
342
-            ],
343
-        ];
344
-        $_where['STS_ID']   = ['!=', EEM_Registration::status_id_incomplete];
345
-        return EEM_Registration::instance()->count([$_where]);
346
-    }
347
-
348
-
349
-    /**
350
-     * @return int
351
-     * @throws EE_Error
352
-     * @throws ReflectionException
353
-     */
354
-    protected function _total_registrations_today(): int
355
-    {
356
-        $EVT_ID             = isset($this->_req_data['event_id'])
357
-            ? absint($this->_req_data['event_id'])
358
-            : false;
359
-        $_where             = $EVT_ID
360
-            ? ['EVT_ID' => $EVT_ID]
361
-            : [];
362
-        $current_date       = date('Y-m-d', current_time('timestamp'));
363
-        $time_start         = ' 00:00:00';
364
-        $time_end           = ' 23:59:59';
365
-        $_where['REG_date'] = [
366
-            'BETWEEN',
367
-            [
368
-                EEM_Registration::instance()->convert_datetime_for_query(
369
-                    'REG_date',
370
-                    $current_date . $time_start,
371
-                    'Y-m-d H:i:s'
372
-                ),
373
-                EEM_Registration::instance()->convert_datetime_for_query(
374
-                    'REG_date',
375
-                    $current_date . $time_end,
376
-                    'Y-m-d H:i:s'
377
-                ),
378
-            ],
379
-        ];
380
-        $_where['STS_ID']   = ['!=', EEM_Registration::status_id_incomplete];
381
-        return EEM_Registration::instance()->count([$_where]);
382
-    }
383
-
384
-
385
-    /**
386
-     * @param EE_Registration $item
387
-     * @return string
388
-     * @throws EE_Error
389
-     * @throws InvalidArgumentException
390
-     * @throws InvalidDataTypeException
391
-     * @throws InvalidInterfaceException
392
-     * @throws ReflectionException
393
-     */
394
-    public function column_cb($item): string
395
-    {
396
-        /** checkbox/lock **/
397
-        $REG_ID        = $item->ID();
398
-        $transaction   = $item->get_first_related('Transaction');
399
-        $payment_count = $transaction instanceof EE_Transaction
400
-            ? $transaction->count_related('Payment')
401
-            : 0;
402
-
403
-        $content = '<input type="checkbox" name="_REG_ID[]" value="' . $REG_ID . '" />';
404
-        $content .= $payment_count > 0 || ! $this->caps_handler->userCanEditRegistration($item)
405
-            ? '<span class="ee-locked-entity dashicons dashicons-lock ee-aria-tooltip ee-aria-tooltip--big-box"
18
+	/**
19
+	 * @var Registrations_Admin_Page
20
+	 */
21
+	protected $_admin_page;
22
+
23
+	/**
24
+	 * @var RegistrationsListTableUserCapabilities
25
+	 */
26
+	protected $caps_handler;
27
+
28
+	/**
29
+	 * @var array
30
+	 */
31
+	private $_status;
32
+
33
+	/**
34
+	 * An array of transaction details for the related transaction to the registration being processed.
35
+	 * This is set via the _set_related_details method.
36
+	 *
37
+	 * @var array
38
+	 */
39
+	protected $_transaction_details = [];
40
+
41
+	/**
42
+	 * An array of event details for the related event to the registration being processed.
43
+	 * This is set via the _set_related_details method.
44
+	 *
45
+	 * @var array
46
+	 */
47
+	protected $_event_details = [];
48
+
49
+
50
+	/**
51
+	 * @param Registrations_Admin_Page $admin_page
52
+	 */
53
+	public function __construct(Registrations_Admin_Page $admin_page)
54
+	{
55
+		$this->caps_handler = new RegistrationsListTableUserCapabilities(EE_Registry::instance()->CAP);
56
+		$req_data = $admin_page->get_request_data();
57
+		if (! empty($req_data['event_id'])) {
58
+			$extra_query_args = [];
59
+			foreach ($admin_page->get_views() as $view_details) {
60
+				$extra_query_args[ $view_details['slug'] ] = ['event_id' => $req_data['event_id']];
61
+			}
62
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
63
+		}
64
+		parent::__construct($admin_page);
65
+		$this->_status = $this->_admin_page->get_registration_status_array();
66
+	}
67
+
68
+
69
+	/**
70
+	 * @return void
71
+	 * @throws EE_Error
72
+	 */
73
+	protected function _setup_data()
74
+	{
75
+		$this->_data           = $this->_admin_page->get_registrations($this->_per_page);
76
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true);
77
+	}
78
+
79
+
80
+	/**
81
+	 * @return void
82
+	 */
83
+	protected function _set_properties()
84
+	{
85
+		$return_url          = $this->getReturnUrl();
86
+		$req_data            = $this->_admin_page->get_request_data();
87
+
88
+		$this->_wp_list_args = [
89
+			'singular' => esc_html__('registration', 'event_espresso'),
90
+			'plural'   => esc_html__('registrations', 'event_espresso'),
91
+			'ajax'     => true,
92
+			'screen'   => $this->_admin_page->get_current_screen()->id,
93
+		];
94
+
95
+		$EVT_ID = isset($req_data['event_id']) ? (int) $req_data['event_id'] : 0;
96
+
97
+		$DTT_ID = $req_data['DTT_ID'] ?? 0;
98
+		$DTT_ID = $req_data['datetime_id'] ?? $DTT_ID;
99
+		$DTT_ID = (int) $DTT_ID;
100
+
101
+		if ($EVT_ID) {
102
+			$this->_columns        = [
103
+				'cb'               => '<input type="checkbox" />', // Render a checkbox instead of text
104
+				'id'               => esc_html__('ID', 'event_espresso'),
105
+				'ATT_fname'        => esc_html__('Name', 'event_espresso'),
106
+				'ATT_email'        => esc_html__('Email', 'event_espresso'),
107
+				'_REG_date'        => esc_html__('Reg Date', 'event_espresso'),
108
+				'PRC_amount'       => esc_html__('TKT Price', 'event_espresso'),
109
+				'_REG_final_price' => esc_html__('Final Price', 'event_espresso'),
110
+				'TXN_total'        => esc_html__('Total Txn', 'event_espresso'),
111
+				'TXN_paid'         => esc_html__('Paid', 'event_espresso'),
112
+				'actions'          => $this->actionsColumnHeader(),
113
+			];
114
+		} else {
115
+			$this->_columns        = [
116
+				'cb'               => '<input type="checkbox" />', // Render a checkbox instead of text
117
+				'id'               => esc_html__('ID', 'event_espresso'),
118
+				'ATT_fname'        => esc_html__('Name', 'event_espresso'),
119
+				'_REG_date'        => esc_html__('TXN Date', 'event_espresso'),
120
+				'event_name'       => esc_html__('Event', 'event_espresso'),
121
+				'DTT_EVT_start'    => esc_html__('Event Date', 'event_espresso'),
122
+				'_REG_final_price' => esc_html__('Price', 'event_espresso'),
123
+				'_REG_paid'        => esc_html__('Paid', 'event_espresso'),
124
+				'actions'          => $this->actionsColumnHeader(),
125
+			];
126
+		}
127
+
128
+		$csv_report = RegistrationsCsvReportParams::getRequestParams($return_url, $req_data, $EVT_ID, $DTT_ID);
129
+		if (! empty($csv_report)) {
130
+			$this->_bottom_buttons['csv_reg_report'] = $csv_report;
131
+		}
132
+
133
+		$this->_primary_column   = 'id';
134
+		$this->_sortable_columns = [
135
+			'_REG_date'     => ['_REG_date' => true],   // true means its already sorted
136
+			/**
137
+			 * Allows users to change the default sort if they wish.
138
+			 * Returning a falsey on this filter will result in the default sort to be by firstname rather than last
139
+			 * name.
140
+			 */
141
+			'ATT_fname'     => [
142
+				'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
143
+				true,
144
+				$this,
145
+			]
146
+				? ['ATT_lname' => false]
147
+				: ['ATT_fname' => false],
148
+			'event_name'    => ['event_name' => false],
149
+			'DTT_EVT_start' => ['DTT_EVT_start' => false],
150
+			'id'            => ['REG_ID' => false],
151
+		];
152
+		$this->_hidden_columns   = [];
153
+	}
154
+
155
+
156
+	/**
157
+	 * This simply sets up the row class for the table rows.
158
+	 * Allows for easier overriding of child methods for setting up sorting.
159
+	 *
160
+	 * @param EE_Registration $item the current item
161
+	 * @return string
162
+	 */
163
+	protected function _get_row_class($item): string
164
+	{
165
+		$class = parent::_get_row_class($item);
166
+		if ($this->_has_checkbox_column) {
167
+			$class .= ' has-checkbox-column';
168
+		}
169
+		return $class;
170
+	}
171
+
172
+
173
+	/**
174
+	 * Set the $_transaction_details property if not set yet.
175
+	 *
176
+	 * @param EE_Registration $registration
177
+	 * @throws EE_Error
178
+	 * @throws InvalidArgumentException
179
+	 * @throws ReflectionException
180
+	 * @throws InvalidDataTypeException
181
+	 * @throws InvalidInterfaceException
182
+	 */
183
+	protected function _set_related_details(EE_Registration $registration)
184
+	{
185
+		$transaction                = $registration->get_first_related('Transaction');
186
+		$status                     = $transaction instanceof EE_Transaction
187
+			? $transaction->status_ID()
188
+			: EEM_Transaction::failed_status_code;
189
+		$this->_transaction_details = [
190
+			'transaction' => $transaction,
191
+			'status'      => $status,
192
+			'id'          => $transaction instanceof EE_Transaction
193
+				? $transaction->ID()
194
+				: 0,
195
+			'title_attr'  => sprintf(
196
+				esc_html__('View Transaction Details (%s)', 'event_espresso'),
197
+				EEH_Template::pretty_status($status, false, 'sentence')
198
+			),
199
+		];
200
+		try {
201
+			$event = $registration->event();
202
+		} catch (EntityNotFoundException $e) {
203
+			$event = null;
204
+		}
205
+		$status               = $event instanceof EE_Event
206
+			? $event->get_active_status()
207
+			: EE_Datetime::inactive;
208
+		$this->_event_details = [
209
+			'event'      => $event,
210
+			'status'     => $status,
211
+			'id'         => $event instanceof EE_Event
212
+				? $event->ID()
213
+				: 0,
214
+			'title_attr' => sprintf(
215
+				esc_html__('Edit Event (%s)', 'event_espresso'),
216
+				EEH_Template::pretty_status($status, false, 'sentence')
217
+			),
218
+		];
219
+	}
220
+
221
+
222
+	/**
223
+	 * @return array
224
+	 * @throws EE_Error
225
+	 * @throws ReflectionException
226
+	 */
227
+	protected function _get_table_filters()
228
+	{
229
+		$filters = [];
230
+		// todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as
231
+		// methods.
232
+		$cur_date     = $this->_req_data['month_range'] ?? '';
233
+		$cur_category = $this->_req_data['EVT_CAT'] ?? -1;
234
+		$reg_status   = $this->_req_data['_reg_status'] ?? '';
235
+		$filters[]    = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
236
+		$filters[]    = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
237
+		$status       = [];
238
+		$status[]     = ['id' => 0, 'text' => esc_html__('Select Status', 'event_espresso')];
239
+		foreach ($this->_status as $key => $value) {
240
+			$status[] = ['id' => $key, 'text' => $value];
241
+		}
242
+		if ($this->_view !== 'incomplete') {
243
+			$filters[] = EEH_Form_Fields::select_input(
244
+				'_reg_status',
245
+				$status,
246
+				isset($this->_req_data['_reg_status'])
247
+					? strtoupper(sanitize_key($this->_req_data['_reg_status']))
248
+					: ''
249
+			);
250
+		}
251
+		foreach (['event_id', 'datetime_id', 'ticket_id'] as $filter_key) {
252
+			if (isset($this->_req_data[ $filter_key ])) {
253
+				$filters[] = EEH_Form_Fields::hidden_input($filter_key, $this->_req_data[ $filter_key ], 'reg_' . $filter_key);
254
+			}
255
+		}
256
+		return $filters;
257
+	}
258
+
259
+
260
+	/**
261
+	 * @return void
262
+	 * @throws EE_Error
263
+	 * @throws InvalidArgumentException
264
+	 * @throws InvalidDataTypeException
265
+	 * @throws InvalidInterfaceException
266
+	 * @throws ReflectionException
267
+	 */
268
+	protected function _add_view_counts()
269
+	{
270
+		$this->_views['all']['count']   = $this->_total_registrations();
271
+		$this->_views['month']['count'] = $this->_total_registrations_this_month();
272
+		$this->_views['today']['count'] = $this->_total_registrations_today();
273
+		if ($this->caps_handler->userCanTrashRegistrations()) {
274
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
275
+			$this->_views['trash']['count']      = $this->_total_registrations('trash');
276
+		}
277
+	}
278
+
279
+
280
+	/**
281
+	 * @param string $view
282
+	 * @return int
283
+	 * @throws EE_Error
284
+	 * @throws ReflectionException
285
+	 */
286
+	protected function _total_registrations(string $view = ''): int
287
+	{
288
+		$_where = [];
289
+		$EVT_ID = isset($this->_req_data['event_id'])
290
+			? absint($this->_req_data['event_id'])
291
+			: false;
292
+		if ($EVT_ID) {
293
+			$_where['EVT_ID'] = $EVT_ID;
294
+		}
295
+		switch ($view) {
296
+			case 'trash':
297
+				return EEM_Registration::instance()->count_deleted([$_where]);
298
+			case 'incomplete':
299
+				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
300
+				break;
301
+			default:
302
+				$_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete];
303
+		}
304
+		return EEM_Registration::instance()->count([$_where]);
305
+	}
306
+
307
+
308
+	/**
309
+	 * @return int
310
+	 * @throws EE_Error
311
+	 * @throws ReflectionException
312
+	 */
313
+	protected function _total_registrations_this_month(): int
314
+	{
315
+		$EVT_ID          = isset($this->_req_data['event_id'])
316
+			? absint($this->_req_data['event_id'])
317
+			: false;
318
+		$_where          = $EVT_ID
319
+			? ['EVT_ID' => $EVT_ID]
320
+			: [];
321
+		$this_year_r     = date('Y', current_time('timestamp'));
322
+		$time_start      = ' 00:00:00';
323
+		$time_end        = ' 23:59:59';
324
+		$this_month_r    = date('m', current_time('timestamp'));
325
+		$days_this_month = date('t', current_time('timestamp'));
326
+		// setup date query.
327
+		$beginning_string   = EEM_Registration::instance()->convert_datetime_for_query(
328
+			'REG_date',
329
+			$this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
330
+			'Y-m-d H:i:s'
331
+		);
332
+		$end_string         = EEM_Registration::instance()->convert_datetime_for_query(
333
+			'REG_date',
334
+			$this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
335
+			'Y-m-d H:i:s'
336
+		);
337
+		$_where['REG_date'] = [
338
+			'BETWEEN',
339
+			[
340
+				$beginning_string,
341
+				$end_string,
342
+			],
343
+		];
344
+		$_where['STS_ID']   = ['!=', EEM_Registration::status_id_incomplete];
345
+		return EEM_Registration::instance()->count([$_where]);
346
+	}
347
+
348
+
349
+	/**
350
+	 * @return int
351
+	 * @throws EE_Error
352
+	 * @throws ReflectionException
353
+	 */
354
+	protected function _total_registrations_today(): int
355
+	{
356
+		$EVT_ID             = isset($this->_req_data['event_id'])
357
+			? absint($this->_req_data['event_id'])
358
+			: false;
359
+		$_where             = $EVT_ID
360
+			? ['EVT_ID' => $EVT_ID]
361
+			: [];
362
+		$current_date       = date('Y-m-d', current_time('timestamp'));
363
+		$time_start         = ' 00:00:00';
364
+		$time_end           = ' 23:59:59';
365
+		$_where['REG_date'] = [
366
+			'BETWEEN',
367
+			[
368
+				EEM_Registration::instance()->convert_datetime_for_query(
369
+					'REG_date',
370
+					$current_date . $time_start,
371
+					'Y-m-d H:i:s'
372
+				),
373
+				EEM_Registration::instance()->convert_datetime_for_query(
374
+					'REG_date',
375
+					$current_date . $time_end,
376
+					'Y-m-d H:i:s'
377
+				),
378
+			],
379
+		];
380
+		$_where['STS_ID']   = ['!=', EEM_Registration::status_id_incomplete];
381
+		return EEM_Registration::instance()->count([$_where]);
382
+	}
383
+
384
+
385
+	/**
386
+	 * @param EE_Registration $item
387
+	 * @return string
388
+	 * @throws EE_Error
389
+	 * @throws InvalidArgumentException
390
+	 * @throws InvalidDataTypeException
391
+	 * @throws InvalidInterfaceException
392
+	 * @throws ReflectionException
393
+	 */
394
+	public function column_cb($item): string
395
+	{
396
+		/** checkbox/lock **/
397
+		$REG_ID        = $item->ID();
398
+		$transaction   = $item->get_first_related('Transaction');
399
+		$payment_count = $transaction instanceof EE_Transaction
400
+			? $transaction->count_related('Payment')
401
+			: 0;
402
+
403
+		$content = '<input type="checkbox" name="_REG_ID[]" value="' . $REG_ID . '" />';
404
+		$content .= $payment_count > 0 || ! $this->caps_handler->userCanEditRegistration($item)
405
+			? '<span class="ee-locked-entity dashicons dashicons-lock ee-aria-tooltip ee-aria-tooltip--big-box"
406 406
                     aria-label="' . $this->lockedRegMessage() . '"></span>'
407
-            : '';
408
-        return $this->columnContent('cb', $content, 'center');
409
-    }
410
-
411
-
412
-    private function lockedRegMessage(): string
413
-    {
414
-        return esc_html__(
415
-            'This lock-icon means that this registration cannot be trashed.  Registrations that belong to a transaction that has payments cannot be trashed.  If you wish to trash this registration then you must delete all payments attached to the related transaction first.',
416
-            'event_espresso'
417
-        );
418
-    }
419
-
420
-
421
-    /**
422
-     * @param EE_Registration $registration
423
-     * @return string
424
-     * @throws EE_Error
425
-     * @throws InvalidArgumentException
426
-     * @throws InvalidDataTypeException
427
-     * @throws InvalidInterfaceException
428
-     * @throws ReflectionException
429
-     */
430
-    public function column_id(EE_Registration $registration): string
431
-    {
432
-        $content = '<span class="ee-entity-id">' . $registration->ID() . '</span>';
433
-        $content .= '<span class="show-on-mobile-view-only">';
434
-        $content .= $this->column_ATT_fname($registration, false);
435
-        $content .= '</span>';
436
-
437
-        return $this->columnContent('id', $content, 'end');
438
-    }
439
-
440
-
441
-    /**
442
-     * @param EE_Registration $registration
443
-     * @param bool            $prep_content
444
-     * @return string
445
-     * @throws EE_Error
446
-     * @throws ReflectionException
447
-     */
448
-    public function column_ATT_fname(EE_Registration $registration, bool $prep_content = true): string
449
-    {
450
-
451
-        $status         = esc_attr($registration->status_ID());
452
-        $pretty_status  = EEH_Template::pretty_status($status, false, 'sentence');
453
-        $prime_reg_star = $registration->count() === 1
454
-            ? '<sup><span class="dashicons dashicons-star-filled gold-icon"></span></sup>'
455
-            : '';
456
-
457
-        $group_count = '
407
+			: '';
408
+		return $this->columnContent('cb', $content, 'center');
409
+	}
410
+
411
+
412
+	private function lockedRegMessage(): string
413
+	{
414
+		return esc_html__(
415
+			'This lock-icon means that this registration cannot be trashed.  Registrations that belong to a transaction that has payments cannot be trashed.  If you wish to trash this registration then you must delete all payments attached to the related transaction first.',
416
+			'event_espresso'
417
+		);
418
+	}
419
+
420
+
421
+	/**
422
+	 * @param EE_Registration $registration
423
+	 * @return string
424
+	 * @throws EE_Error
425
+	 * @throws InvalidArgumentException
426
+	 * @throws InvalidDataTypeException
427
+	 * @throws InvalidInterfaceException
428
+	 * @throws ReflectionException
429
+	 */
430
+	public function column_id(EE_Registration $registration): string
431
+	{
432
+		$content = '<span class="ee-entity-id">' . $registration->ID() . '</span>';
433
+		$content .= '<span class="show-on-mobile-view-only">';
434
+		$content .= $this->column_ATT_fname($registration, false);
435
+		$content .= '</span>';
436
+
437
+		return $this->columnContent('id', $content, 'end');
438
+	}
439
+
440
+
441
+	/**
442
+	 * @param EE_Registration $registration
443
+	 * @param bool            $prep_content
444
+	 * @return string
445
+	 * @throws EE_Error
446
+	 * @throws ReflectionException
447
+	 */
448
+	public function column_ATT_fname(EE_Registration $registration, bool $prep_content = true): string
449
+	{
450
+
451
+		$status         = esc_attr($registration->status_ID());
452
+		$pretty_status  = EEH_Template::pretty_status($status, false, 'sentence');
453
+		$prime_reg_star = $registration->count() === 1
454
+			? '<sup><span class="dashicons dashicons-star-filled gold-icon"></span></sup>'
455
+			: '';
456
+
457
+		$group_count = '
458 458
             <span class="reg-count-group-size" >
459 459
                 ' . sprintf(
460
-            esc_html__('(%1$s / %2$s)', 'event_espresso'),
461
-            $registration->count(),
462
-            $registration->group_size()
463
-        ) . '
460
+			esc_html__('(%1$s / %2$s)', 'event_espresso'),
461
+			$registration->count(),
462
+			$registration->group_size()
463
+		) . '
464 464
             </span >';
465 465
 
466
-        $content = '
466
+		$content = '
467 467
         <div class="ee-layout-row">
468 468
             <span aria-label="' . $pretty_status . '"
469 469
                   class="ee-status-dot ee-status-bg--' . $status . ' ee-aria-tooltip"
470 470
             ></span>
471 471
             ' . $this->viewRegistrationLink($registration, $status)
472
-                   . $prime_reg_star
473
-                   . $group_count . '
472
+				   . $prime_reg_star
473
+				   . $group_count . '
474 474
             <span class="spacer"></span>
475 475
             <span>
476 476
                 ' . sprintf(
477
-                       esc_html__('Reg Code: %s', 'event_espresso'),
478
-                       $registration->get('REG_code')
479
-                   ) . '
477
+					   esc_html__('Reg Code: %s', 'event_espresso'),
478
+					   $registration->get('REG_code')
479
+				   ) . '
480 480
             </span>
481 481
         </div>';
482 482
 
483
-        $url_params = ['_REG_ID' => $registration->ID()];
484
-        if (isset($this->_req_data['event_id'])) {
485
-            $url_params['event_id'] = $registration->event_ID();
486
-        }
487
-        // trash/restore/delete actions
488
-        $actions = $this->trashRegistrationLink($registration, $url_params);
489
-        $actions = $this->restoreRegistrationLink($registration, $url_params, $actions);
490
-        $actions = $this->deleteRegistrationLink($registration, $url_params, $actions);
491
-
492
-        $content = sprintf('%1$s %2$s', $content, $this->row_actions($actions));
493
-
494
-        return $prep_content ? $this->columnContent('ATT_fname', $content) : $content;
495
-    }
496
-
497
-
498
-    /**
499
-     * @param EE_Registration $registration
500
-     * @param bool            $prep_content
501
-     * @return string
502
-     * @throws EE_Error
503
-     * @throws ReflectionException
504
-     */
505
-    public function column__REG_date(EE_Registration $registration, bool $prep_content = true): string
506
-    {
507
-        $this->_set_related_details($registration);
508
-        // Build row actions
509
-        $content = $this->caps_handler->userCanViewTransaction()
510
-            ? '<a class="ee-aria-tooltip ee-status-color--' . $this->_transaction_details['status'] . '" href="'
511
-              . $this->viewTransactionUrl()
512
-              . '" aria-label="'
513
-              . esc_attr($this->_transaction_details['title_attr'])
514
-              . '">'
515
-              . $registration->get_i18n_datetime('REG_date', 'M jS Y g:i a')
516
-              . '</a>'
517
-            : $registration->get_i18n_datetime('REG_date');
518
-
519
-        return $prep_content ? $this->columnContent('_REG_date', $content) : $content;
520
-    }
521
-
522
-
523
-    /**
524
-     * @param EE_Registration $registration
525
-     * @return string
526
-     * @throws EE_Error
527
-     * @throws InvalidArgumentException
528
-     * @throws InvalidDataTypeException
529
-     * @throws InvalidInterfaceException
530
-     * @throws ReflectionException
531
-     */
532
-    public function column_event_name(EE_Registration $registration): string
533
-    {
534
-        $this->_set_related_details($registration);
535
-        $EVT_ID     = $registration->event_ID();
536
-        $event_name = $registration->event_name();
537
-        $event_name = $event_name ?: esc_html__("No Associated Event", 'event_espresso');
538
-        $event_name = wp_trim_words($event_name, 30, '...');
539
-        $edit_event = $this->editEventLink($EVT_ID, $event_name);
540
-        $actions['event_filter'] = $this->eventFilterLink($EVT_ID, $event_name);
541
-        $content = sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
542
-
543
-        return $this->columnContent('event_name', $content);
544
-    }
545
-
546
-
547
-    /**
548
-     * @param EE_Registration $registration
549
-     * @return string
550
-     * @throws EE_Error
551
-     * @throws InvalidArgumentException
552
-     * @throws InvalidDataTypeException
553
-     * @throws InvalidInterfaceException
554
-     * @throws ReflectionException
555
-     */
556
-    public function column_DTT_EVT_start(EE_Registration $registration): string
557
-    {
558
-        $datetime_strings = [];
559
-        $ticket           = $registration->ticket();
560
-        if ($ticket instanceof EE_Ticket) {
561
-            $remove_defaults = ['default_where_conditions' => 'none'];
562
-            $datetimes       = $ticket->datetimes($remove_defaults);
563
-            foreach ($datetimes as $datetime) {
564
-                $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a');
565
-            }
566
-            $content = $this->generateDisplayForDatetimes($datetime_strings);
567
-        } else {
568
-            $content = esc_html__('There is no ticket on this registration', 'event_espresso');
569
-        }
570
-        return $this->columnContent('DTT_EVT_start', $content);
571
-    }
572
-
573
-
574
-    /**
575
-     * Receives an array of datetime strings to display and converts them to the html container for the column.
576
-     *
577
-     * @param array $datetime_strings
578
-     * @return string
579
-     */
580
-    public function generateDisplayForDatetimes(array $datetime_strings): string
581
-    {
582
-        // get first item for initial visibility
583
-        $content = (string) array_shift($datetime_strings);
584
-        if (! empty($datetime_strings)) {
585
-            $content .= '
483
+		$url_params = ['_REG_ID' => $registration->ID()];
484
+		if (isset($this->_req_data['event_id'])) {
485
+			$url_params['event_id'] = $registration->event_ID();
486
+		}
487
+		// trash/restore/delete actions
488
+		$actions = $this->trashRegistrationLink($registration, $url_params);
489
+		$actions = $this->restoreRegistrationLink($registration, $url_params, $actions);
490
+		$actions = $this->deleteRegistrationLink($registration, $url_params, $actions);
491
+
492
+		$content = sprintf('%1$s %2$s', $content, $this->row_actions($actions));
493
+
494
+		return $prep_content ? $this->columnContent('ATT_fname', $content) : $content;
495
+	}
496
+
497
+
498
+	/**
499
+	 * @param EE_Registration $registration
500
+	 * @param bool            $prep_content
501
+	 * @return string
502
+	 * @throws EE_Error
503
+	 * @throws ReflectionException
504
+	 */
505
+	public function column__REG_date(EE_Registration $registration, bool $prep_content = true): string
506
+	{
507
+		$this->_set_related_details($registration);
508
+		// Build row actions
509
+		$content = $this->caps_handler->userCanViewTransaction()
510
+			? '<a class="ee-aria-tooltip ee-status-color--' . $this->_transaction_details['status'] . '" href="'
511
+			  . $this->viewTransactionUrl()
512
+			  . '" aria-label="'
513
+			  . esc_attr($this->_transaction_details['title_attr'])
514
+			  . '">'
515
+			  . $registration->get_i18n_datetime('REG_date', 'M jS Y g:i a')
516
+			  . '</a>'
517
+			: $registration->get_i18n_datetime('REG_date');
518
+
519
+		return $prep_content ? $this->columnContent('_REG_date', $content) : $content;
520
+	}
521
+
522
+
523
+	/**
524
+	 * @param EE_Registration $registration
525
+	 * @return string
526
+	 * @throws EE_Error
527
+	 * @throws InvalidArgumentException
528
+	 * @throws InvalidDataTypeException
529
+	 * @throws InvalidInterfaceException
530
+	 * @throws ReflectionException
531
+	 */
532
+	public function column_event_name(EE_Registration $registration): string
533
+	{
534
+		$this->_set_related_details($registration);
535
+		$EVT_ID     = $registration->event_ID();
536
+		$event_name = $registration->event_name();
537
+		$event_name = $event_name ?: esc_html__("No Associated Event", 'event_espresso');
538
+		$event_name = wp_trim_words($event_name, 30, '...');
539
+		$edit_event = $this->editEventLink($EVT_ID, $event_name);
540
+		$actions['event_filter'] = $this->eventFilterLink($EVT_ID, $event_name);
541
+		$content = sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
542
+
543
+		return $this->columnContent('event_name', $content);
544
+	}
545
+
546
+
547
+	/**
548
+	 * @param EE_Registration $registration
549
+	 * @return string
550
+	 * @throws EE_Error
551
+	 * @throws InvalidArgumentException
552
+	 * @throws InvalidDataTypeException
553
+	 * @throws InvalidInterfaceException
554
+	 * @throws ReflectionException
555
+	 */
556
+	public function column_DTT_EVT_start(EE_Registration $registration): string
557
+	{
558
+		$datetime_strings = [];
559
+		$ticket           = $registration->ticket();
560
+		if ($ticket instanceof EE_Ticket) {
561
+			$remove_defaults = ['default_where_conditions' => 'none'];
562
+			$datetimes       = $ticket->datetimes($remove_defaults);
563
+			foreach ($datetimes as $datetime) {
564
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a');
565
+			}
566
+			$content = $this->generateDisplayForDatetimes($datetime_strings);
567
+		} else {
568
+			$content = esc_html__('There is no ticket on this registration', 'event_espresso');
569
+		}
570
+		return $this->columnContent('DTT_EVT_start', $content);
571
+	}
572
+
573
+
574
+	/**
575
+	 * Receives an array of datetime strings to display and converts them to the html container for the column.
576
+	 *
577
+	 * @param array $datetime_strings
578
+	 * @return string
579
+	 */
580
+	public function generateDisplayForDatetimes(array $datetime_strings): string
581
+	{
582
+		// get first item for initial visibility
583
+		$content = (string) array_shift($datetime_strings);
584
+		if (! empty($datetime_strings)) {
585
+			$content .= '
586 586
                 <div class="ee-registration-event-datetimes-container-wrap">
587 587
                     <button aria-label="' . esc_attr__('Click to view all dates', 'event_espresso') . '"
588 588
                           class="ee-aria-tooltip button button--secondary button--tiny button--icon-only ee-js ee-more-datetimes-toggle"
@@ -593,539 +593,539 @@  discard block
 block discarded – undo
593 593
                         ' . implode("", $datetime_strings) . '
594 594
                     </div>
595 595
                 </div>';
596
-        }
597
-        return $content;
598
-    }
599
-
600
-
601
-    /**
602
-     * @param EE_Registration $registration
603
-     * @return string
604
-     * @throws EE_Error
605
-     * @throws InvalidArgumentException
606
-     * @throws InvalidDataTypeException
607
-     * @throws InvalidInterfaceException
608
-     * @throws ReflectionException
609
-     */
610
-    public function column_ATT_email(EE_Registration $registration): string
611
-    {
612
-        $attendee = $registration->get_first_related('Attendee');
613
-        $content  = ! $attendee instanceof EE_Attendee
614
-            ? esc_html__('No attached contact record.', 'event_espresso')
615
-            : $attendee->email();
616
-        return $this->columnContent('ATT_email', $content);
617
-    }
618
-
619
-
620
-    /**
621
-     * @param EE_Registration $registration
622
-     * @return string
623
-     */
624
-    public function column__REG_count(EE_Registration $registration): string
625
-    {
626
-        $content =
627
-            sprintf(esc_html__('%1$s / %2$s', 'event_espresso'), $registration->count(), $registration->group_size());
628
-        return $this->columnContent('_REG_count', $content);
629
-    }
630
-
631
-
632
-    /**
633
-     * @param EE_Registration $registration
634
-     * @return string
635
-     * @throws EE_Error
636
-     * @throws ReflectionException
637
-     */
638
-    public function column_PRC_amount(EE_Registration $registration): string
639
-    {
640
-        $ticket   = $registration->ticket();
641
-        $req_data = $this->_admin_page->get_request_data();
642
-
643
-        $content = isset($req_data['event_id']) && $ticket instanceof EE_Ticket
644
-            ? '<div class="TKT_name">' . $ticket->name() . '</div>'
645
-            : '';
646
-
647
-        $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM';
648
-        $content        .= $registration->final_price() > 0
649
-            ? '<span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '">
596
+		}
597
+		return $content;
598
+	}
599
+
600
+
601
+	/**
602
+	 * @param EE_Registration $registration
603
+	 * @return string
604
+	 * @throws EE_Error
605
+	 * @throws InvalidArgumentException
606
+	 * @throws InvalidDataTypeException
607
+	 * @throws InvalidInterfaceException
608
+	 * @throws ReflectionException
609
+	 */
610
+	public function column_ATT_email(EE_Registration $registration): string
611
+	{
612
+		$attendee = $registration->get_first_related('Attendee');
613
+		$content  = ! $attendee instanceof EE_Attendee
614
+			? esc_html__('No attached contact record.', 'event_espresso')
615
+			: $attendee->email();
616
+		return $this->columnContent('ATT_email', $content);
617
+	}
618
+
619
+
620
+	/**
621
+	 * @param EE_Registration $registration
622
+	 * @return string
623
+	 */
624
+	public function column__REG_count(EE_Registration $registration): string
625
+	{
626
+		$content =
627
+			sprintf(esc_html__('%1$s / %2$s', 'event_espresso'), $registration->count(), $registration->group_size());
628
+		return $this->columnContent('_REG_count', $content);
629
+	}
630
+
631
+
632
+	/**
633
+	 * @param EE_Registration $registration
634
+	 * @return string
635
+	 * @throws EE_Error
636
+	 * @throws ReflectionException
637
+	 */
638
+	public function column_PRC_amount(EE_Registration $registration): string
639
+	{
640
+		$ticket   = $registration->ticket();
641
+		$req_data = $this->_admin_page->get_request_data();
642
+
643
+		$content = isset($req_data['event_id']) && $ticket instanceof EE_Ticket
644
+			? '<div class="TKT_name">' . $ticket->name() . '</div>'
645
+			: '';
646
+
647
+		$payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM';
648
+		$content        .= $registration->final_price() > 0
649
+			? '<span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '">
650 650
                 ' . $registration->pretty_final_price() . '
651 651
                </span>'
652
-            // free event
653
-            : '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>';
654
-
655
-        return $this->columnContent('PRC_amount', $content, 'end');
656
-    }
657
-
658
-
659
-    /**
660
-     * @param EE_Registration $registration
661
-     * @return string
662
-     * @throws EE_Error
663
-     * @throws ReflectionException
664
-     */
665
-    public function column__REG_final_price(EE_Registration $registration): string
666
-    {
667
-        $ticket   = $registration->ticket();
668
-        $req_data = $this->_admin_page->get_request_data();
669
-        $content  = isset($req_data['event_id']) || ! $ticket instanceof EE_Ticket
670
-            ? ''
671
-            : '<span class="TKT_name ee-status-color--'
672
-              . $ticket->ticket_status()
673
-              . '">'
674
-              . $ticket->name()
675
-              . '</span> ';
676
-
677
-        $content .= '
652
+			// free event
653
+			: '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>';
654
+
655
+		return $this->columnContent('PRC_amount', $content, 'end');
656
+	}
657
+
658
+
659
+	/**
660
+	 * @param EE_Registration $registration
661
+	 * @return string
662
+	 * @throws EE_Error
663
+	 * @throws ReflectionException
664
+	 */
665
+	public function column__REG_final_price(EE_Registration $registration): string
666
+	{
667
+		$ticket   = $registration->ticket();
668
+		$req_data = $this->_admin_page->get_request_data();
669
+		$content  = isset($req_data['event_id']) || ! $ticket instanceof EE_Ticket
670
+			? ''
671
+			: '<span class="TKT_name ee-status-color--'
672
+			  . $ticket->ticket_status()
673
+			  . '">'
674
+			  . $ticket->name()
675
+			  . '</span> ';
676
+
677
+		$content .= '
678 678
             <span class="reg-overview-paid-event-spn">
679 679
                 ' . $registration->pretty_final_price() . '
680 680
             </span>';
681
-        return $this->columnContent('_REG_final_price', $content, 'end');
682
-    }
683
-
684
-
685
-    /**
686
-     * @param EE_Registration $registration
687
-     * @return string
688
-     * @throws EE_Error
689
-     */
690
-    public function column__REG_paid(EE_Registration $registration): string
691
-    {
692
-        $payment_method      = $registration->payment_method();
693
-        $payment_method_name = $payment_method instanceof EE_Payment_Method
694
-            ? $payment_method->admin_name()
695
-            : esc_html__('Unknown', 'event_espresso');
696
-
697
-        $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM';
698
-        $content        = '
681
+		return $this->columnContent('_REG_final_price', $content, 'end');
682
+	}
683
+
684
+
685
+	/**
686
+	 * @param EE_Registration $registration
687
+	 * @return string
688
+	 * @throws EE_Error
689
+	 */
690
+	public function column__REG_paid(EE_Registration $registration): string
691
+	{
692
+		$payment_method      = $registration->payment_method();
693
+		$payment_method_name = $payment_method instanceof EE_Payment_Method
694
+			? $payment_method->admin_name()
695
+			: esc_html__('Unknown', 'event_espresso');
696
+
697
+		$payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM';
698
+		$content        = '
699 699
             <span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '">
700 700
                 ' . $registration->pretty_paid() . '
701 701
             </span>';
702
-        if ($registration->paid() > 0) {
703
-            $content .= '<span class="ee-status-text-small">'
704
-                        . sprintf(
705
-                            esc_html__('...via %s', 'event_espresso'),
706
-                            $payment_method_name
707
-                        )
708
-                        . '</span>';
709
-        }
710
-        return $this->columnContent('_REG_paid', $content, 'end');
711
-    }
712
-
713
-
714
-    /**
715
-     * @param EE_Registration $registration
716
-     * @return string
717
-     * @throws EE_Error
718
-     * @throws EntityNotFoundException
719
-     * @throws InvalidArgumentException
720
-     * @throws InvalidDataTypeException
721
-     * @throws InvalidInterfaceException
722
-     * @throws ReflectionException
723
-     */
724
-    public function column_TXN_total(EE_Registration $registration): string
725
-    {
726
-        if ($registration->transaction()) {
727
-            $content = $this->caps_handler->userCanViewTransaction()
728
-                ? '
702
+		if ($registration->paid() > 0) {
703
+			$content .= '<span class="ee-status-text-small">'
704
+						. sprintf(
705
+							esc_html__('...via %s', 'event_espresso'),
706
+							$payment_method_name
707
+						)
708
+						. '</span>';
709
+		}
710
+		return $this->columnContent('_REG_paid', $content, 'end');
711
+	}
712
+
713
+
714
+	/**
715
+	 * @param EE_Registration $registration
716
+	 * @return string
717
+	 * @throws EE_Error
718
+	 * @throws EntityNotFoundException
719
+	 * @throws InvalidArgumentException
720
+	 * @throws InvalidDataTypeException
721
+	 * @throws InvalidInterfaceException
722
+	 * @throws ReflectionException
723
+	 */
724
+	public function column_TXN_total(EE_Registration $registration): string
725
+	{
726
+		if ($registration->transaction()) {
727
+			$content = $this->caps_handler->userCanViewTransaction()
728
+				? '
729 729
                     <a class="ee-aria-tooltip ee-status-color--' . $registration->transaction()->status_ID() . '"
730 730
                         href="' . $this->viewTransactionUrl() . '"
731 731
                         aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '"
732 732
                     >
733 733
                         ' . $registration->transaction()->pretty_total() . '
734 734
                     </a>'
735
-                : $registration->transaction()->pretty_total();
736
-        } else {
737
-            $content = esc_html__("None", "event_espresso");
738
-        }
739
-        return $this->columnContent('TXN_total', $content, 'end');
740
-    }
741
-
742
-
743
-    /**
744
-     * @param EE_Registration $registration
745
-     * @return string
746
-     * @throws EE_Error
747
-     * @throws EntityNotFoundException
748
-     * @throws InvalidArgumentException
749
-     * @throws InvalidDataTypeException
750
-     * @throws InvalidInterfaceException
751
-     * @throws ReflectionException
752
-     */
753
-    public function column_TXN_paid(EE_Registration $registration): string
754
-    {
755
-        $content = '&nbsp;';
756
-        $align   = 'end';
757
-        if ($registration->count() === 1) {
758
-            $transaction = $registration->transaction()
759
-                ? $registration->transaction()
760
-                : EE_Transaction::new_instance();
761
-            if ($transaction->paid() >= $transaction->total()) {
762
-                $align   = 'center';
763
-                $content = '<span class="dashicons dashicons-yes green-icon"></span>';
764
-            } else {
765
-                $content = $this->caps_handler->userCanViewTransaction()
766
-                    ? '
735
+				: $registration->transaction()->pretty_total();
736
+		} else {
737
+			$content = esc_html__("None", "event_espresso");
738
+		}
739
+		return $this->columnContent('TXN_total', $content, 'end');
740
+	}
741
+
742
+
743
+	/**
744
+	 * @param EE_Registration $registration
745
+	 * @return string
746
+	 * @throws EE_Error
747
+	 * @throws EntityNotFoundException
748
+	 * @throws InvalidArgumentException
749
+	 * @throws InvalidDataTypeException
750
+	 * @throws InvalidInterfaceException
751
+	 * @throws ReflectionException
752
+	 */
753
+	public function column_TXN_paid(EE_Registration $registration): string
754
+	{
755
+		$content = '&nbsp;';
756
+		$align   = 'end';
757
+		if ($registration->count() === 1) {
758
+			$transaction = $registration->transaction()
759
+				? $registration->transaction()
760
+				: EE_Transaction::new_instance();
761
+			if ($transaction->paid() >= $transaction->total()) {
762
+				$align   = 'center';
763
+				$content = '<span class="dashicons dashicons-yes green-icon"></span>';
764
+			} else {
765
+				$content = $this->caps_handler->userCanViewTransaction()
766
+					? '
767 767
                     <a class="ee-aria-tooltip ee-status-color--' . $transaction->status_ID() . '"
768 768
                         href="' . $this->viewTransactionUrl() . '"
769 769
                         aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '"
770 770
                     >
771 771
                         ' . $registration->transaction()->pretty_paid() . '
772 772
                     </a>'
773
-                    : $registration->transaction()->pretty_paid();
774
-            }
775
-        }
776
-        return $this->columnContent('TXN_paid', $content, $align);
777
-    }
778
-
779
-
780
-    /**
781
-     * @param EE_Registration $registration
782
-     * @return string
783
-     * @throws EE_Error
784
-     * @throws InvalidArgumentException
785
-     * @throws InvalidDataTypeException
786
-     * @throws InvalidInterfaceException
787
-     * @throws ReflectionException
788
-     */
789
-    public function column_actions(EE_Registration $registration): string
790
-    {
791
-        $attendee = $registration->attendee();
792
-        $this->_set_related_details($registration);
793
-
794
-        // Build and filter row actions
795
-        $actions = apply_filters(
796
-            'FHEE__EE_Registrations_List_Table__column_actions__actions',
797
-            [
798
-                'view_lnk'               => $this->viewRegistrationAction($registration),
799
-                'edit_lnk'               => $this->editContactAction($registration, $attendee),
800
-                'resend_reg_lnk'         => $this->resendRegistrationMessageAction($registration, $attendee),
801
-                'view_txn_lnk'           => $this->viewTransactionAction(),
802
-                'dl_invoice_lnk'         => $this->viewTransactionInvoiceAction($registration, $attendee),
803
-                'filtered_messages_link' => $this->viewNotificationsAction($registration),
804
-            ],
805
-            $registration,
806
-            $this
807
-        );
808
-
809
-        $content = $this->_action_string(
810
-            implode('', $actions),
811
-            $registration,
812
-            'div',
813
-            'reg-overview-actions ee-list-table-actions'
814
-        );
815
-
816
-        return $this->columnContent('actions', $this->actionsModalMenu($content));
817
-    }
818
-
819
-
820
-    /**
821
-     * @throws EE_Error
822
-     * @throws ReflectionException
823
-     */
824
-    private function viewRegistrationUrl(EE_Registration $registration): string
825
-    {
826
-        return EE_Admin_Page::add_query_args_and_nonce(
827
-            [
828
-                'action'  => 'view_registration',
829
-                '_REG_ID' => $registration->ID(),
830
-            ],
831
-            REG_ADMIN_URL
832
-        );
833
-    }
834
-
835
-
836
-    /**
837
-     * @throws EE_Error
838
-     * @throws ReflectionException
839
-     */
840
-    private function viewRegistrationLink(
841
-        EE_Registration $registration,
842
-        string $status
843
-    ): string {
844
-        $attendee      = $registration->attendee();
845
-        $attendee_name = $attendee instanceof EE_Attendee
846
-            ? $attendee->full_name()
847
-            : '';
848
-        return $this->caps_handler->userCanReadRegistration($registration)
849
-            ? '
773
+					: $registration->transaction()->pretty_paid();
774
+			}
775
+		}
776
+		return $this->columnContent('TXN_paid', $content, $align);
777
+	}
778
+
779
+
780
+	/**
781
+	 * @param EE_Registration $registration
782
+	 * @return string
783
+	 * @throws EE_Error
784
+	 * @throws InvalidArgumentException
785
+	 * @throws InvalidDataTypeException
786
+	 * @throws InvalidInterfaceException
787
+	 * @throws ReflectionException
788
+	 */
789
+	public function column_actions(EE_Registration $registration): string
790
+	{
791
+		$attendee = $registration->attendee();
792
+		$this->_set_related_details($registration);
793
+
794
+		// Build and filter row actions
795
+		$actions = apply_filters(
796
+			'FHEE__EE_Registrations_List_Table__column_actions__actions',
797
+			[
798
+				'view_lnk'               => $this->viewRegistrationAction($registration),
799
+				'edit_lnk'               => $this->editContactAction($registration, $attendee),
800
+				'resend_reg_lnk'         => $this->resendRegistrationMessageAction($registration, $attendee),
801
+				'view_txn_lnk'           => $this->viewTransactionAction(),
802
+				'dl_invoice_lnk'         => $this->viewTransactionInvoiceAction($registration, $attendee),
803
+				'filtered_messages_link' => $this->viewNotificationsAction($registration),
804
+			],
805
+			$registration,
806
+			$this
807
+		);
808
+
809
+		$content = $this->_action_string(
810
+			implode('', $actions),
811
+			$registration,
812
+			'div',
813
+			'reg-overview-actions ee-list-table-actions'
814
+		);
815
+
816
+		return $this->columnContent('actions', $this->actionsModalMenu($content));
817
+	}
818
+
819
+
820
+	/**
821
+	 * @throws EE_Error
822
+	 * @throws ReflectionException
823
+	 */
824
+	private function viewRegistrationUrl(EE_Registration $registration): string
825
+	{
826
+		return EE_Admin_Page::add_query_args_and_nonce(
827
+			[
828
+				'action'  => 'view_registration',
829
+				'_REG_ID' => $registration->ID(),
830
+			],
831
+			REG_ADMIN_URL
832
+		);
833
+	}
834
+
835
+
836
+	/**
837
+	 * @throws EE_Error
838
+	 * @throws ReflectionException
839
+	 */
840
+	private function viewRegistrationLink(
841
+		EE_Registration $registration,
842
+		string $status
843
+	): string {
844
+		$attendee      = $registration->attendee();
845
+		$attendee_name = $attendee instanceof EE_Attendee
846
+			? $attendee->full_name()
847
+			: '';
848
+		return $this->caps_handler->userCanReadRegistration($registration)
849
+			? '
850 850
             <a  href="' . $this->viewRegistrationUrl($registration) . '"
851 851
                 class="row-title ee-status-color--' . $status . ' ee-aria-tooltip"
852 852
                 aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '"
853 853
             >
854 854
                 ' . $attendee_name . '
855 855
             </a>'
856
-            : $attendee_name;
857
-    }
858
-
859
-
860
-    /**
861
-     * @throws EE_Error
862
-     * @throws ReflectionException
863
-     */
864
-    private function viewRegistrationAction(EE_Registration $registration): string
865
-    {
866
-        return $this->caps_handler->userCanReadRegistration($registration)
867
-            ? '
856
+			: $attendee_name;
857
+	}
858
+
859
+
860
+	/**
861
+	 * @throws EE_Error
862
+	 * @throws ReflectionException
863
+	 */
864
+	private function viewRegistrationAction(EE_Registration $registration): string
865
+	{
866
+		return $this->caps_handler->userCanReadRegistration($registration)
867
+			? '
868 868
             <a  href="' . $this->viewRegistrationUrl($registration) . '"
869 869
                 class="ee-aria-tooltip button button--icon-only"
870 870
                 aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '"
871 871
             >
872 872
                 <span class="dashicons dashicons-clipboard"></span>
873 873
             </a>'
874
-            : '';
875
-    }
876
-
877
-
878
-    private function editContactAction(EE_Registration $registration, ?EE_Attendee $attendee = null): string
879
-    {
880
-
881
-        if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanEditContacts()) {
882
-            $edit_link_url = EE_Admin_Page::add_query_args_and_nonce(
883
-                [
884
-                    'action' => 'edit_attendee',
885
-                    'post'   => $registration->attendee_ID(),
886
-                ],
887
-                REG_ADMIN_URL
888
-            );
889
-            return '
874
+			: '';
875
+	}
876
+
877
+
878
+	private function editContactAction(EE_Registration $registration, ?EE_Attendee $attendee = null): string
879
+	{
880
+
881
+		if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanEditContacts()) {
882
+			$edit_link_url = EE_Admin_Page::add_query_args_and_nonce(
883
+				[
884
+					'action' => 'edit_attendee',
885
+					'post'   => $registration->attendee_ID(),
886
+				],
887
+				REG_ADMIN_URL
888
+			);
889
+			return '
890 890
                 <a href="' . $edit_link_url . '"
891 891
                    aria-label="' . esc_attr__('Edit Contact Details', 'event_espresso') . '"
892 892
                    class="ee-aria-tooltip button button--secondary button--icon-only"
893 893
                 >
894 894
                     <span class="dashicons dashicons-admin-users"></span>
895 895
                 </a>';
896
-        }
897
-        return '';
898
-    }
899
-
900
-
901
-    /**
902
-     * @throws EE_Error
903
-     * @throws ReflectionException
904
-     */
905
-    private function resendRegistrationMessageAction(
906
-        EE_Registration $registration,
907
-        ?EE_Attendee $attendee = null
908
-    ): string {
909
-        if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanResendMessage($registration)) {
910
-            $resend_reg_link_url = EE_Admin_Page::add_query_args_and_nonce(
911
-                [
912
-                    'action'  => 'resend_registration',
913
-                    '_REG_ID' => $registration->ID(),
914
-                ],
915
-                REG_ADMIN_URL,
916
-                true
917
-            );
918
-            return '
896
+		}
897
+		return '';
898
+	}
899
+
900
+
901
+	/**
902
+	 * @throws EE_Error
903
+	 * @throws ReflectionException
904
+	 */
905
+	private function resendRegistrationMessageAction(
906
+		EE_Registration $registration,
907
+		?EE_Attendee $attendee = null
908
+	): string {
909
+		if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanResendMessage($registration)) {
910
+			$resend_reg_link_url = EE_Admin_Page::add_query_args_and_nonce(
911
+				[
912
+					'action'  => 'resend_registration',
913
+					'_REG_ID' => $registration->ID(),
914
+				],
915
+				REG_ADMIN_URL,
916
+				true
917
+			);
918
+			return '
919 919
 			    <a href="' . $resend_reg_link_url . '" aria-label="'
920
-                                         . esc_attr__('Resend Registration Details', 'event_espresso')
921
-                                         . '" class="ee-aria-tooltip button button--icon-only">
920
+										 . esc_attr__('Resend Registration Details', 'event_espresso')
921
+										 . '" class="ee-aria-tooltip button button--icon-only">
922 922
 			        <span class="dashicons dashicons-email-alt"></span>
923 923
 			    </a>';
924
-        }
925
-        return '';
926
-    }
927
-
928
-
929
-    private function viewTransactionUrl(): string
930
-    {
931
-        return EE_Admin_Page::add_query_args_and_nonce(
932
-            [
933
-                    'action' => 'view_transaction',
934
-                    'TXN_ID' => $this->_transaction_details['id'],
935
-                ],
936
-            TXN_ADMIN_URL
937
-        );
938
-    }
939
-
940
-
941
-    private function viewTransactionAction(): string
942
-    {
943
-        if ($this->caps_handler->userCanViewTransaction()) {
944
-            return '
924
+		}
925
+		return '';
926
+	}
927
+
928
+
929
+	private function viewTransactionUrl(): string
930
+	{
931
+		return EE_Admin_Page::add_query_args_and_nonce(
932
+			[
933
+					'action' => 'view_transaction',
934
+					'TXN_ID' => $this->_transaction_details['id'],
935
+				],
936
+			TXN_ADMIN_URL
937
+		);
938
+	}
939
+
940
+
941
+	private function viewTransactionAction(): string
942
+	{
943
+		if ($this->caps_handler->userCanViewTransaction()) {
944
+			return '
945 945
                 <a class="ee-aria-tooltip button button--icon-only"
946 946
                    href="' . $this->viewTransactionUrl() . '"
947 947
                    aria-label="' . $this->_transaction_details['title_attr'] . '"
948 948
                 >
949 949
                     <span class="dashicons dashicons-cart"></span>
950 950
                 </a>';
951
-        }
952
-        return '';
953
-    }
954
-
955
-
956
-    /**
957
-     * @throws EE_Error
958
-     * @throws ReflectionException
959
-     */
960
-    private function viewTransactionInvoiceAction(
961
-        EE_Registration $registration,
962
-        ?EE_Attendee $attendee = null
963
-    ): string {
964
-        // only show invoice link if message type is active.
965
-        if (
966
-            $attendee instanceof EE_Attendee
967
-            && $registration->is_primary_registrant()
968
-            && EEH_MSG_Template::is_mt_active('invoice')
969
-        ) {
970
-            return '
951
+		}
952
+		return '';
953
+	}
954
+
955
+
956
+	/**
957
+	 * @throws EE_Error
958
+	 * @throws ReflectionException
959
+	 */
960
+	private function viewTransactionInvoiceAction(
961
+		EE_Registration $registration,
962
+		?EE_Attendee $attendee = null
963
+	): string {
964
+		// only show invoice link if message type is active.
965
+		if (
966
+			$attendee instanceof EE_Attendee
967
+			&& $registration->is_primary_registrant()
968
+			&& EEH_MSG_Template::is_mt_active('invoice')
969
+		) {
970
+			return '
971 971
                 <a aria-label="' . esc_attr__('View Transaction Invoice', 'event_espresso')
972
-                                         . '" target="_blank" href="' . $registration->invoice_url() . '" class="ee-aria-tooltip button button--icon-only">
972
+										 . '" target="_blank" href="' . $registration->invoice_url() . '" class="ee-aria-tooltip button button--icon-only">
973 973
                     <span class="dashicons dashicons-media-spreadsheet"></span>
974 974
                 </a>';
975
-        }
976
-        return '';
977
-    }
978
-
979
-
980
-    /**
981
-     * @throws ReflectionException
982
-     * @throws EE_Error
983
-     */
984
-    private function viewNotificationsAction(EE_Registration $registration): string
985
-    {
986
-        // message list table link (filtered by REG_ID
987
-        return $this->caps_handler->userCanReadGlobalMessages()
988
-            ? EEH_MSG_Template::get_message_action_link(
989
-                'see_notifications_for',
990
-                null,
991
-                ['_REG_ID' => $registration->ID()]
992
-            )
993
-            : '';
994
-    }
995
-
996
-
997
-    /**
998
-     * @throws EE_Error
999
-     * @throws ReflectionException
1000
-     */
1001
-    private function trashRegistrationLink(
1002
-        EE_Registration $registration,
1003
-        array $url_params
1004
-    ): array {
1005
-        $actions = [];
1006
-        // can't trash what's already trashed
1007
-        if ($this->_view === 'trash') {
1008
-            return $actions;
1009
-        }
1010
-
1011
-        // check caps
1012
-        if (! $this->caps_handler->userCanTrashRegistration($registration)) {
1013
-            return $actions;
1014
-        }
1015
-
1016
-        // don't delete registrations that have payments applied
1017
-        $transaction   = $registration->get_first_related('Transaction');
1018
-        $payment_count = $transaction instanceof EE_Transaction
1019
-            ? $transaction->count_related('Payment')
1020
-            : 0;
1021
-
1022
-        if ($payment_count > 0) {
1023
-            return $actions;
1024
-        }
1025
-
1026
-        $url_params['action'] = 'trash_registrations';
1027
-        $trash_link_url       = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1028
-        $actions['trash']     = '
975
+		}
976
+		return '';
977
+	}
978
+
979
+
980
+	/**
981
+	 * @throws ReflectionException
982
+	 * @throws EE_Error
983
+	 */
984
+	private function viewNotificationsAction(EE_Registration $registration): string
985
+	{
986
+		// message list table link (filtered by REG_ID
987
+		return $this->caps_handler->userCanReadGlobalMessages()
988
+			? EEH_MSG_Template::get_message_action_link(
989
+				'see_notifications_for',
990
+				null,
991
+				['_REG_ID' => $registration->ID()]
992
+			)
993
+			: '';
994
+	}
995
+
996
+
997
+	/**
998
+	 * @throws EE_Error
999
+	 * @throws ReflectionException
1000
+	 */
1001
+	private function trashRegistrationLink(
1002
+		EE_Registration $registration,
1003
+		array $url_params
1004
+	): array {
1005
+		$actions = [];
1006
+		// can't trash what's already trashed
1007
+		if ($this->_view === 'trash') {
1008
+			return $actions;
1009
+		}
1010
+
1011
+		// check caps
1012
+		if (! $this->caps_handler->userCanTrashRegistration($registration)) {
1013
+			return $actions;
1014
+		}
1015
+
1016
+		// don't delete registrations that have payments applied
1017
+		$transaction   = $registration->get_first_related('Transaction');
1018
+		$payment_count = $transaction instanceof EE_Transaction
1019
+			? $transaction->count_related('Payment')
1020
+			: 0;
1021
+
1022
+		if ($payment_count > 0) {
1023
+			return $actions;
1024
+		}
1025
+
1026
+		$url_params['action'] = 'trash_registrations';
1027
+		$trash_link_url       = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1028
+		$actions['trash']     = '
1029 1029
             <a class="ee-aria-tooltip"
1030 1030
                 href="' . $trash_link_url . '"
1031 1031
                 aria-label="' . esc_attr__('Trash Registration', 'event_espresso') . '"
1032 1032
             >
1033 1033
                 ' . esc_html__('Trash', 'event_espresso') . '
1034 1034
             </a>';
1035
-        return $actions;
1036
-    }
1037
-
1038
-
1039
-    /**
1040
-     * @throws EE_Error
1041
-     * @throws ReflectionException
1042
-     */
1043
-    private function restoreRegistrationLink(
1044
-        EE_Registration $registration,
1045
-        array $url_params,
1046
-        array $actions
1047
-    ): array {
1048
-        // can't restore what's not trashed
1049
-        if ($this->_view !== 'trash') {
1050
-            return $actions;
1051
-        }
1052
-
1053
-        // restore registration link
1054
-        if ($this->caps_handler->userCanRestoreRegistration($registration)) {
1055
-            $url_params['action'] = 'restore_registrations';
1056
-            $restore_link_url     = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1057
-            $actions['restore']   = '
1035
+		return $actions;
1036
+	}
1037
+
1038
+
1039
+	/**
1040
+	 * @throws EE_Error
1041
+	 * @throws ReflectionException
1042
+	 */
1043
+	private function restoreRegistrationLink(
1044
+		EE_Registration $registration,
1045
+		array $url_params,
1046
+		array $actions
1047
+	): array {
1048
+		// can't restore what's not trashed
1049
+		if ($this->_view !== 'trash') {
1050
+			return $actions;
1051
+		}
1052
+
1053
+		// restore registration link
1054
+		if ($this->caps_handler->userCanRestoreRegistration($registration)) {
1055
+			$url_params['action'] = 'restore_registrations';
1056
+			$restore_link_url     = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1057
+			$actions['restore']   = '
1058 1058
                 <a class="ee-aria-tooltip"
1059 1059
                     href="' . $restore_link_url . '"
1060 1060
                     aria-label="' . esc_attr__('Restore Registration', 'event_espresso') . '"
1061 1061
                 >
1062 1062
                     ' . esc_html__('Restore', 'event_espresso') . '
1063 1063
                 </a>';
1064
-        }
1065
-
1066
-        return $actions;
1067
-    }
1068
-
1069
-
1070
-    /**
1071
-     * @throws EE_Error
1072
-     * @throws ReflectionException
1073
-     */
1074
-    private function deleteRegistrationLink(
1075
-        EE_Registration $registration,
1076
-        array $url_params,
1077
-        array $actions
1078
-    ): array {
1079
-        if ($this->_view === 'trash' && $this->caps_handler->userCanDeleteRegistration($registration)) {
1080
-            $url_params['action'] = 'delete_registrations';
1081
-            $delete_link_url      = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1082
-            $actions['delete']    = '
1064
+		}
1065
+
1066
+		return $actions;
1067
+	}
1068
+
1069
+
1070
+	/**
1071
+	 * @throws EE_Error
1072
+	 * @throws ReflectionException
1073
+	 */
1074
+	private function deleteRegistrationLink(
1075
+		EE_Registration $registration,
1076
+		array $url_params,
1077
+		array $actions
1078
+	): array {
1079
+		if ($this->_view === 'trash' && $this->caps_handler->userCanDeleteRegistration($registration)) {
1080
+			$url_params['action'] = 'delete_registrations';
1081
+			$delete_link_url      = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1082
+			$actions['delete']    = '
1083 1083
                 <a class="ee-aria-tooltip"
1084 1084
                     href="' . $delete_link_url . '"
1085 1085
                     aria-label="' . esc_attr__('Delete Registration Permanently', 'event_espresso') . '"
1086 1086
                 >
1087 1087
                     ' . esc_html__('Delete', 'event_espresso') . '
1088 1088
                 </a>';
1089
-        }
1090
-        return $actions;
1091
-    }
1092
-
1093
-
1094
-    private function editEventLink(int $EVT_ID, string $event_name): string
1095
-    {
1096
-        if (! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) {
1097
-            return $event_name;
1098
-        }
1099
-        $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(
1100
-            ['action' => 'edit', 'post' => $EVT_ID],
1101
-            EVENTS_ADMIN_URL
1102
-        );
1103
-        return '
1089
+		}
1090
+		return $actions;
1091
+	}
1092
+
1093
+
1094
+	private function editEventLink(int $EVT_ID, string $event_name): string
1095
+	{
1096
+		if (! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) {
1097
+			return $event_name;
1098
+		}
1099
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(
1100
+			['action' => 'edit', 'post' => $EVT_ID],
1101
+			EVENTS_ADMIN_URL
1102
+		);
1103
+		return '
1104 1104
             <a class="ee-aria-tooltip ee-status-color--' . $this->_event_details['status'] . '"
1105 1105
                 href="' . $edit_event_url . '"
1106 1106
                 aria-label="' . esc_attr($this->_event_details['title_attr']) . '"
1107 1107
             >
1108 1108
                 ' . $event_name . '
1109 1109
             </a>';
1110
-    }
1110
+	}
1111 1111
 
1112 1112
 
1113
-    private function eventFilterLink(int $EVT_ID, string $event_name): string
1114
-    {
1115
-        if (!$EVT_ID) {
1116
-            return '';
1117
-        }
1118
-        $event_filter_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL);
1119
-        return '
1113
+	private function eventFilterLink(int $EVT_ID, string $event_name): string
1114
+	{
1115
+		if (!$EVT_ID) {
1116
+			return '';
1117
+		}
1118
+		$event_filter_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL);
1119
+		return '
1120 1120
             <a  class="ee-aria-tooltip ee-event-filter-link"
1121 1121
                 href="' . $event_filter_url . '"
1122 1122
                 aria-label="' . sprintf(
1123
-                    esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
1124
-                    $event_name
1125
-                ) . '"
1123
+					esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
1124
+					$event_name
1125
+				) . '"
1126 1126
             >
1127 1127
                 <span class="dashicons dashicons-groups dashicons--small"></span>'
1128
-                . esc_html__('View Registrations', 'event_espresso') . '
1128
+				. esc_html__('View Registrations', 'event_espresso') . '
1129 1129
             </a>';
1130
-    }
1130
+	}
1131 1131
 }
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Attendee_Contact_List_Table.class.php 1 patch
Indentation   +386 added lines, -386 removed lines patch added patch discarded remove patch
@@ -12,412 +12,412 @@
 block discarded – undo
12 12
  */
13 13
 class EE_Attendee_Contact_List_Table extends EE_Admin_List_Table
14 14
 {
15
-    /**
16
-     * @var Registrations_Admin_Page
17
-     */
18
-    protected $_admin_page;
19
-
20
-
21
-    /**
22
-     * Initial setup of data (called by parent).
23
-     *
24
-     * @throws EE_Error
25
-     */
26
-    protected function _setup_data()
27
-    {
28
-        $this->_data = $this->_view !== 'trash'
29
-            ? $this->_admin_page->get_attendees($this->_per_page)
30
-            : $this->_admin_page->get_attendees($this->_per_page, false, true);
31
-
32
-        $this->_all_data_count = $this->_view !== 'trash'
33
-            ? $this->_admin_page->get_attendees($this->_per_page, true)
34
-            : $this->_admin_page->get_attendees($this->_per_page, true, true);
35
-    }
36
-
37
-
38
-    /**
39
-     * Initial setup of properties.
40
-     */
41
-    protected function _set_properties()
42
-    {
43
-        $this->_wp_list_args = [
44
-            'singular' => esc_html__('attendee', 'event_espresso'),
45
-            'plural'   => esc_html__('attendees', 'event_espresso'),
46
-            'ajax'     => true,
47
-            'screen'   => $this->_admin_page->get_current_screen()->id,
48
-        ];
49
-
50
-        $this->_columns = [
51
-            'cb'                 => '<input type="checkbox" />', // Render a checkbox instead of text
52
-            'id'                 => esc_html__('ID', 'event_espresso'),
53
-            'ATT_fname'          => esc_html__('First Name', 'event_espresso'),
54
-            'ATT_lname'          => esc_html__('Last Name', 'event_espresso'),
55
-            'ATT_email'          => esc_html__('Email Address', 'event_espresso'),
56
-            'Registration_Count' => esc_html__('# Reg', 'event_espresso'),
57
-            'ATT_phone'          => esc_html__('Phone', 'event_espresso'),
58
-            'ATT_address'        => esc_html__('Address', 'event_espresso'),
59
-            'ATT_city'           => esc_html__('City', 'event_espresso'),
60
-            'STA_ID'             => esc_html__('State/Province', 'event_espresso'),
61
-            'CNT_ISO'            => esc_html__('Country', 'event_espresso'),
62
-        ];
63
-
64
-        $this->_sortable_columns = [
65
-            'id'                 => ['id' => false],
66
-            'ATT_lname'          => ['ATT_lname' => true], // true means its already sorted
67
-            'ATT_fname'          => ['ATT_fname' => false],
68
-            'ATT_email'          => ['ATT_email' => false],
69
-            'Registration_Count' => ['Registration_Count' => false],
70
-            'ATT_city'           => ['ATT_city' => false],
71
-            'STA_ID'             => ['STA_ID' => false],
72
-            'CNT_ISO'            => ['CNT_ISO' => false],
73
-        ];
74
-
75
-        $this->_hidden_columns = [
76
-            'ATT_phone',
77
-            'ATT_address',
78
-            'ATT_city',
79
-            'STA_ID',
80
-            'CNT_ISO',
81
-        ];
82
-    }
83
-
84
-
85
-    /**
86
-     * Initial setup of filters
87
-     *
88
-     * @return array
89
-     */
90
-    protected function _get_table_filters()
91
-    {
92
-        return [];
93
-    }
94
-
95
-
96
-    /**
97
-     * Initial setup of counts for views
98
-     *
99
-     * @throws InvalidArgumentException
100
-     * @throws InvalidDataTypeException
101
-     * @throws InvalidInterfaceException
102
-     * @throws EE_Error
103
-     * @throws EE_Error
104
-     */
105
-    protected function _add_view_counts()
106
-    {
107
-        $this->_views['in_use']['count'] = $this->_admin_page->get_attendees($this->_per_page, true);
108
-        if (
109
-            EE_Registry::instance()->CAP->current_user_can(
110
-                'ee_delete_contacts',
111
-                'espresso_registrations_delete_registration'
112
-            )
113
-        ) {
114
-            $this->_views['trash']['count'] = $this->_admin_page->get_attendees($this->_per_page, true, true);
115
-        }
116
-    }
117
-
118
-
119
-    /**
120
-     * Get count of attendees.
121
-     *
122
-     * @return int
123
-     * @throws EE_Error
124
-     * @throws InvalidArgumentException
125
-     * @throws InvalidDataTypeException
126
-     * @throws InvalidInterfaceException
127
-     * @throws ReflectionException
128
-     */
129
-    protected function _get_attendees_count(): int
130
-    {
131
-        return EEM_Attendee::instance()->count();
132
-    }
133
-
134
-
135
-    /**
136
-     * Checkbox column
137
-     *
138
-     * @param EE_Attendee $item Unable to typehint this method because overrides parent.
139
-     * @return string
140
-     * @throws EE_Error
141
-     * @throws ReflectionException
142
-     */
143
-    public function column_cb($item): string
144
-    {
145
-        if (! $item instanceof EE_Attendee) {
146
-            return '';
147
-        }
148
-        return sprintf(
149
-            '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />',
150
-            $item->ID()
151
-        );
152
-    }
153
-
154
-
155
-    /**
156
-     * @param EE_Attendee|null $attendee
157
-     * @return string
158
-     * @throws EE_Error
159
-     * @throws ReflectionException
160
-     */
161
-    public function column_id(?EE_Attendee $attendee): string
162
-    {
163
-        $content = '
15
+	/**
16
+	 * @var Registrations_Admin_Page
17
+	 */
18
+	protected $_admin_page;
19
+
20
+
21
+	/**
22
+	 * Initial setup of data (called by parent).
23
+	 *
24
+	 * @throws EE_Error
25
+	 */
26
+	protected function _setup_data()
27
+	{
28
+		$this->_data = $this->_view !== 'trash'
29
+			? $this->_admin_page->get_attendees($this->_per_page)
30
+			: $this->_admin_page->get_attendees($this->_per_page, false, true);
31
+
32
+		$this->_all_data_count = $this->_view !== 'trash'
33
+			? $this->_admin_page->get_attendees($this->_per_page, true)
34
+			: $this->_admin_page->get_attendees($this->_per_page, true, true);
35
+	}
36
+
37
+
38
+	/**
39
+	 * Initial setup of properties.
40
+	 */
41
+	protected function _set_properties()
42
+	{
43
+		$this->_wp_list_args = [
44
+			'singular' => esc_html__('attendee', 'event_espresso'),
45
+			'plural'   => esc_html__('attendees', 'event_espresso'),
46
+			'ajax'     => true,
47
+			'screen'   => $this->_admin_page->get_current_screen()->id,
48
+		];
49
+
50
+		$this->_columns = [
51
+			'cb'                 => '<input type="checkbox" />', // Render a checkbox instead of text
52
+			'id'                 => esc_html__('ID', 'event_espresso'),
53
+			'ATT_fname'          => esc_html__('First Name', 'event_espresso'),
54
+			'ATT_lname'          => esc_html__('Last Name', 'event_espresso'),
55
+			'ATT_email'          => esc_html__('Email Address', 'event_espresso'),
56
+			'Registration_Count' => esc_html__('# Reg', 'event_espresso'),
57
+			'ATT_phone'          => esc_html__('Phone', 'event_espresso'),
58
+			'ATT_address'        => esc_html__('Address', 'event_espresso'),
59
+			'ATT_city'           => esc_html__('City', 'event_espresso'),
60
+			'STA_ID'             => esc_html__('State/Province', 'event_espresso'),
61
+			'CNT_ISO'            => esc_html__('Country', 'event_espresso'),
62
+		];
63
+
64
+		$this->_sortable_columns = [
65
+			'id'                 => ['id' => false],
66
+			'ATT_lname'          => ['ATT_lname' => true], // true means its already sorted
67
+			'ATT_fname'          => ['ATT_fname' => false],
68
+			'ATT_email'          => ['ATT_email' => false],
69
+			'Registration_Count' => ['Registration_Count' => false],
70
+			'ATT_city'           => ['ATT_city' => false],
71
+			'STA_ID'             => ['STA_ID' => false],
72
+			'CNT_ISO'            => ['CNT_ISO' => false],
73
+		];
74
+
75
+		$this->_hidden_columns = [
76
+			'ATT_phone',
77
+			'ATT_address',
78
+			'ATT_city',
79
+			'STA_ID',
80
+			'CNT_ISO',
81
+		];
82
+	}
83
+
84
+
85
+	/**
86
+	 * Initial setup of filters
87
+	 *
88
+	 * @return array
89
+	 */
90
+	protected function _get_table_filters()
91
+	{
92
+		return [];
93
+	}
94
+
95
+
96
+	/**
97
+	 * Initial setup of counts for views
98
+	 *
99
+	 * @throws InvalidArgumentException
100
+	 * @throws InvalidDataTypeException
101
+	 * @throws InvalidInterfaceException
102
+	 * @throws EE_Error
103
+	 * @throws EE_Error
104
+	 */
105
+	protected function _add_view_counts()
106
+	{
107
+		$this->_views['in_use']['count'] = $this->_admin_page->get_attendees($this->_per_page, true);
108
+		if (
109
+			EE_Registry::instance()->CAP->current_user_can(
110
+				'ee_delete_contacts',
111
+				'espresso_registrations_delete_registration'
112
+			)
113
+		) {
114
+			$this->_views['trash']['count'] = $this->_admin_page->get_attendees($this->_per_page, true, true);
115
+		}
116
+	}
117
+
118
+
119
+	/**
120
+	 * Get count of attendees.
121
+	 *
122
+	 * @return int
123
+	 * @throws EE_Error
124
+	 * @throws InvalidArgumentException
125
+	 * @throws InvalidDataTypeException
126
+	 * @throws InvalidInterfaceException
127
+	 * @throws ReflectionException
128
+	 */
129
+	protected function _get_attendees_count(): int
130
+	{
131
+		return EEM_Attendee::instance()->count();
132
+	}
133
+
134
+
135
+	/**
136
+	 * Checkbox column
137
+	 *
138
+	 * @param EE_Attendee $item Unable to typehint this method because overrides parent.
139
+	 * @return string
140
+	 * @throws EE_Error
141
+	 * @throws ReflectionException
142
+	 */
143
+	public function column_cb($item): string
144
+	{
145
+		if (! $item instanceof EE_Attendee) {
146
+			return '';
147
+		}
148
+		return sprintf(
149
+			'<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />',
150
+			$item->ID()
151
+		);
152
+	}
153
+
154
+
155
+	/**
156
+	 * @param EE_Attendee|null $attendee
157
+	 * @return string
158
+	 * @throws EE_Error
159
+	 * @throws ReflectionException
160
+	 */
161
+	public function column_id(?EE_Attendee $attendee): string
162
+	{
163
+		$content = '
164 164
             <span class="ee-entity-id">' . $attendee->ID() . '</span>
165 165
             <span class="show-on-mobile-view-only">
166 166
                 ' . $this->editAttendeeLink($attendee->ID(), $attendee->full_name()) . '
167 167
             </span>';
168
-        return $this->columnContent('id', $content, 'end');
169
-    }
170
-
171
-
172
-    /**
173
-     * ATT_lname column
174
-     *
175
-     * @param EE_Attendee $attendee
176
-     * @return string
177
-     * @throws EE_Error
178
-     * @throws ReflectionException
179
-     */
180
-    public function column_ATT_lname(EE_Attendee $attendee): string
181
-    {
182
-        // edit attendee link
183
-        $content = $this->editAttendeeLink($attendee->ID(), $attendee->lname());
184
-        return $this->columnContent('ATT_lname', $content);
185
-    }
186
-
187
-
188
-    /**
189
-     * @param int    $ID
190
-     * @param string $attendee_name
191
-     * @return string
192
-     * @since   $VID:$
193
-     */
194
-    private function editAttendeeLink(int $ID, string $attendee_name): string
195
-    {
196
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
197
-            [
198
-                'action' => 'edit_attendee',
199
-                'post'   => $ID,
200
-            ],
201
-            REG_ADMIN_URL
202
-        );
203
-        return EE_Registry::instance()->CAP->current_user_can(
204
-            'ee_edit_contacts',
205
-            'espresso_registrations_edit_attendee'
206
-        )
207
-            ? '
168
+		return $this->columnContent('id', $content, 'end');
169
+	}
170
+
171
+
172
+	/**
173
+	 * ATT_lname column
174
+	 *
175
+	 * @param EE_Attendee $attendee
176
+	 * @return string
177
+	 * @throws EE_Error
178
+	 * @throws ReflectionException
179
+	 */
180
+	public function column_ATT_lname(EE_Attendee $attendee): string
181
+	{
182
+		// edit attendee link
183
+		$content = $this->editAttendeeLink($attendee->ID(), $attendee->lname());
184
+		return $this->columnContent('ATT_lname', $content);
185
+	}
186
+
187
+
188
+	/**
189
+	 * @param int    $ID
190
+	 * @param string $attendee_name
191
+	 * @return string
192
+	 * @since   $VID:$
193
+	 */
194
+	private function editAttendeeLink(int $ID, string $attendee_name): string
195
+	{
196
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
197
+			[
198
+				'action' => 'edit_attendee',
199
+				'post'   => $ID,
200
+			],
201
+			REG_ADMIN_URL
202
+		);
203
+		return EE_Registry::instance()->CAP->current_user_can(
204
+			'ee_edit_contacts',
205
+			'espresso_registrations_edit_attendee'
206
+		)
207
+			? '
208 208
             <a  href="' . $edit_lnk_url . '"
209 209
                 class="ee-aria-tooltip"
210 210
                 aria-label="' . esc_attr__('Edit Contact', 'event_espresso') . '"
211 211
             >
212 212
                 ' . $attendee_name . '
213 213
             </a>'
214
-            : $attendee_name;
215
-    }
216
-
217
-
218
-    /**
219
-     * ATT_fname column
220
-     *
221
-     * @param EE_Attendee $attendee
222
-     * @return string
223
-     * @throws InvalidArgumentException
224
-     * @throws InvalidDataTypeException
225
-     * @throws InvalidInterfaceException
226
-     * @throws EE_Error
227
-     * @throws ReflectionException
228
-     * @throws ReflectionException
229
-     * @throws ReflectionException
230
-     * @throws ReflectionException
231
-     */
232
-    public function column_ATT_fname(EE_Attendee $attendee): string
233
-    {
234
-        // Build row actions
235
-        $actions = [];
236
-        // edit attendee link
237
-        if (
238
-            EE_Registry::instance()->CAP->current_user_can(
239
-                'ee_edit_contacts',
240
-                'espresso_registrations_edit_attendee'
241
-            )
242
-        ) {
243
-            $actions['edit'] = $this->editAttendeeLink(
244
-                $attendee->ID(),
245
-                esc_html__('Edit Contact', 'event_espresso')
246
-            );
247
-        }
248
-
249
-        if ($this->_view === 'in_use') {
250
-            // trash attendee link
251
-            if (
252
-                EE_Registry::instance()->CAP->current_user_can(
253
-                    'ee_delete_contacts',
254
-                    'espresso_registrations_trash_attendees'
255
-                )
256
-            ) {
257
-                $trash_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
258
-                    [
259
-                        'action' => 'trash_attendee',
260
-                        'ATT_ID' => $attendee->ID(),
261
-                    ],
262
-                    REG_ADMIN_URL
263
-                );
264
-                $actions['trash'] = '
214
+			: $attendee_name;
215
+	}
216
+
217
+
218
+	/**
219
+	 * ATT_fname column
220
+	 *
221
+	 * @param EE_Attendee $attendee
222
+	 * @return string
223
+	 * @throws InvalidArgumentException
224
+	 * @throws InvalidDataTypeException
225
+	 * @throws InvalidInterfaceException
226
+	 * @throws EE_Error
227
+	 * @throws ReflectionException
228
+	 * @throws ReflectionException
229
+	 * @throws ReflectionException
230
+	 * @throws ReflectionException
231
+	 */
232
+	public function column_ATT_fname(EE_Attendee $attendee): string
233
+	{
234
+		// Build row actions
235
+		$actions = [];
236
+		// edit attendee link
237
+		if (
238
+			EE_Registry::instance()->CAP->current_user_can(
239
+				'ee_edit_contacts',
240
+				'espresso_registrations_edit_attendee'
241
+			)
242
+		) {
243
+			$actions['edit'] = $this->editAttendeeLink(
244
+				$attendee->ID(),
245
+				esc_html__('Edit Contact', 'event_espresso')
246
+			);
247
+		}
248
+
249
+		if ($this->_view === 'in_use') {
250
+			// trash attendee link
251
+			if (
252
+				EE_Registry::instance()->CAP->current_user_can(
253
+					'ee_delete_contacts',
254
+					'espresso_registrations_trash_attendees'
255
+				)
256
+			) {
257
+				$trash_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
258
+					[
259
+						'action' => 'trash_attendee',
260
+						'ATT_ID' => $attendee->ID(),
261
+					],
262
+					REG_ADMIN_URL
263
+				);
264
+				$actions['trash'] = '
265 265
                     <a  href="' . $trash_lnk_url . '"
266 266
                         class="ee-aria-tooltip"
267 267
                         aria-label="' . esc_attr__('Move Contact to Trash', 'event_espresso') . '"
268 268
                     >
269 269
                         ' . esc_html__('Trash', 'event_espresso') . '
270 270
                     </a>';
271
-            }
272
-        } else {
273
-            if (
274
-                EE_Registry::instance()->CAP->current_user_can(
275
-                    'ee_delete_contacts',
276
-                    'espresso_registrations_restore_attendees'
277
-                )
278
-            ) {
279
-                // restore attendee link
280
-                $restore_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
281
-                    [
282
-                        'action' => 'restore_attendees',
283
-                        'ATT_ID' => $attendee->ID(),
284
-                    ],
285
-                    REG_ADMIN_URL
286
-                );
287
-                $actions['restore'] = '
271
+			}
272
+		} else {
273
+			if (
274
+				EE_Registry::instance()->CAP->current_user_can(
275
+					'ee_delete_contacts',
276
+					'espresso_registrations_restore_attendees'
277
+				)
278
+			) {
279
+				// restore attendee link
280
+				$restore_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
281
+					[
282
+						'action' => 'restore_attendees',
283
+						'ATT_ID' => $attendee->ID(),
284
+					],
285
+					REG_ADMIN_URL
286
+				);
287
+				$actions['restore'] = '
288 288
                     <a  href="' . $restore_lnk_url . '"
289 289
                         class="ee-aria-tooltip"
290 290
                         aria-label="' . esc_attr__('Restore Contact', 'event_espresso') . '"
291 291
                     >
292 292
                         ' . esc_html__('Restore', 'event_espresso') . '
293 293
                     </a>';
294
-            }
295
-        }
296
-
297
-        $name_link    = $this->editAttendeeLink($attendee->ID(), $attendee->fname());
298
-
299
-        // Return the name contents
300
-        $content = sprintf('%1$s %2$s', $name_link, $this->row_actions($actions));
301
-        return $this->columnContent('ATT_fname', $content);
302
-    }
303
-
304
-
305
-    /**
306
-     * Email Column
307
-     *
308
-     * @param EE_Attendee $attendee
309
-     * @return string
310
-     * @throws EE_Error
311
-     */
312
-    public function column_ATT_email(EE_Attendee $attendee): string
313
-    {
314
-        $content = '<a href="mailto:' . $attendee->email() . '">' . $attendee->email() . '</a>';
315
-        return $this->columnContent('ATT_email', $content);
316
-    }
317
-
318
-
319
-    /**
320
-     * Column displaying count of registrations attached to Attendee.
321
-     *
322
-     * @param EE_Attendee $attendee
323
-     * @return string
324
-     * @throws EE_Error
325
-     * @throws ReflectionException
326
-     */
327
-    public function column_Registration_Count(EE_Attendee $attendee): string
328
-    {
329
-        $link = EEH_URL::add_query_args_and_nonce(
330
-            [
331
-                'action' => 'default',
332
-                'ATT_ID' => $attendee->ID(),
333
-            ],
334
-            REG_ADMIN_URL
335
-        );
336
-        $content = '<a href="' . $link . '">' . $attendee->getCustomSelect('Registration_Count') . '</a>';
337
-        return $this->columnContent('Registration_Count', $content, 'end');
338
-    }
339
-
340
-
341
-    /**
342
-     * ATT_address column
343
-     *
344
-     * @param EE_Attendee $attendee
345
-     * @return string
346
-     * @throws EE_Error
347
-     */
348
-    public function column_ATT_address(EE_Attendee $attendee): string
349
-    {
350
-        return $this->columnContent('ATT_address', $attendee->address());
351
-    }
352
-
353
-
354
-    /**
355
-     * ATT_city column
356
-     *
357
-     * @param EE_Attendee $attendee
358
-     * @return string
359
-     * @throws EE_Error
360
-     */
361
-    public function column_ATT_city(EE_Attendee $attendee): string
362
-    {
363
-        return $this->columnContent('ATT_city', $attendee->city());
364
-    }
365
-
366
-
367
-    /**
368
-     * State Column
369
-     *
370
-     * @param EE_Attendee $attendee
371
-     * @return string
372
-     * @throws EE_Error
373
-     * @throws InvalidArgumentException
374
-     * @throws InvalidDataTypeException
375
-     * @throws InvalidInterfaceException
376
-     * @throws ReflectionException
377
-     */
378
-    public function column_STA_ID(EE_Attendee $attendee): string
379
-    {
380
-        $states = EEM_State::instance()->get_all_states();
381
-        $state  = isset($states[ $attendee->state_ID() ])
382
-            ? $states[ $attendee->state_ID() ]->get('STA_name')
383
-            : $attendee->state_ID();
384
-        $content = ! is_numeric($state) ? $state : '';
385
-        return $this->columnContent('STA_ID', $content);
386
-    }
387
-
388
-
389
-    /**
390
-     * Country Column
391
-     *
392
-     * @param EE_Attendee $attendee
393
-     * @return string
394
-     * @throws EE_Error
395
-     * @throws InvalidArgumentException
396
-     * @throws InvalidDataTypeException
397
-     * @throws InvalidInterfaceException
398
-     * @throws ReflectionException
399
-     * @throws ReflectionException
400
-     */
401
-    public function column_CNT_ISO(EE_Attendee $attendee): string
402
-    {
403
-        $countries = EEM_Country::instance()->get_all_countries();
404
-        $country   = isset($countries[ $attendee->country_ID() ])
405
-            ? $countries[ $attendee->country_ID() ]->get('CNT_name')
406
-            : $attendee->country_ID();
407
-        $content = ! is_numeric($country) ? $country : '';
408
-        return $this->columnContent('CNT_ISO', $content);
409
-    }
410
-
411
-
412
-    /**
413
-     * Phone Number column
414
-     *
415
-     * @param EE_Attendee $attendee
416
-     * @return string
417
-     * @throws EE_Error
418
-     */
419
-    public function column_ATT_phone(EE_Attendee $attendee): string
420
-    {
421
-        return $this->columnContent('ATT_phone', $attendee->phone());
422
-    }
294
+			}
295
+		}
296
+
297
+		$name_link    = $this->editAttendeeLink($attendee->ID(), $attendee->fname());
298
+
299
+		// Return the name contents
300
+		$content = sprintf('%1$s %2$s', $name_link, $this->row_actions($actions));
301
+		return $this->columnContent('ATT_fname', $content);
302
+	}
303
+
304
+
305
+	/**
306
+	 * Email Column
307
+	 *
308
+	 * @param EE_Attendee $attendee
309
+	 * @return string
310
+	 * @throws EE_Error
311
+	 */
312
+	public function column_ATT_email(EE_Attendee $attendee): string
313
+	{
314
+		$content = '<a href="mailto:' . $attendee->email() . '">' . $attendee->email() . '</a>';
315
+		return $this->columnContent('ATT_email', $content);
316
+	}
317
+
318
+
319
+	/**
320
+	 * Column displaying count of registrations attached to Attendee.
321
+	 *
322
+	 * @param EE_Attendee $attendee
323
+	 * @return string
324
+	 * @throws EE_Error
325
+	 * @throws ReflectionException
326
+	 */
327
+	public function column_Registration_Count(EE_Attendee $attendee): string
328
+	{
329
+		$link = EEH_URL::add_query_args_and_nonce(
330
+			[
331
+				'action' => 'default',
332
+				'ATT_ID' => $attendee->ID(),
333
+			],
334
+			REG_ADMIN_URL
335
+		);
336
+		$content = '<a href="' . $link . '">' . $attendee->getCustomSelect('Registration_Count') . '</a>';
337
+		return $this->columnContent('Registration_Count', $content, 'end');
338
+	}
339
+
340
+
341
+	/**
342
+	 * ATT_address column
343
+	 *
344
+	 * @param EE_Attendee $attendee
345
+	 * @return string
346
+	 * @throws EE_Error
347
+	 */
348
+	public function column_ATT_address(EE_Attendee $attendee): string
349
+	{
350
+		return $this->columnContent('ATT_address', $attendee->address());
351
+	}
352
+
353
+
354
+	/**
355
+	 * ATT_city column
356
+	 *
357
+	 * @param EE_Attendee $attendee
358
+	 * @return string
359
+	 * @throws EE_Error
360
+	 */
361
+	public function column_ATT_city(EE_Attendee $attendee): string
362
+	{
363
+		return $this->columnContent('ATT_city', $attendee->city());
364
+	}
365
+
366
+
367
+	/**
368
+	 * State Column
369
+	 *
370
+	 * @param EE_Attendee $attendee
371
+	 * @return string
372
+	 * @throws EE_Error
373
+	 * @throws InvalidArgumentException
374
+	 * @throws InvalidDataTypeException
375
+	 * @throws InvalidInterfaceException
376
+	 * @throws ReflectionException
377
+	 */
378
+	public function column_STA_ID(EE_Attendee $attendee): string
379
+	{
380
+		$states = EEM_State::instance()->get_all_states();
381
+		$state  = isset($states[ $attendee->state_ID() ])
382
+			? $states[ $attendee->state_ID() ]->get('STA_name')
383
+			: $attendee->state_ID();
384
+		$content = ! is_numeric($state) ? $state : '';
385
+		return $this->columnContent('STA_ID', $content);
386
+	}
387
+
388
+
389
+	/**
390
+	 * Country Column
391
+	 *
392
+	 * @param EE_Attendee $attendee
393
+	 * @return string
394
+	 * @throws EE_Error
395
+	 * @throws InvalidArgumentException
396
+	 * @throws InvalidDataTypeException
397
+	 * @throws InvalidInterfaceException
398
+	 * @throws ReflectionException
399
+	 * @throws ReflectionException
400
+	 */
401
+	public function column_CNT_ISO(EE_Attendee $attendee): string
402
+	{
403
+		$countries = EEM_Country::instance()->get_all_countries();
404
+		$country   = isset($countries[ $attendee->country_ID() ])
405
+			? $countries[ $attendee->country_ID() ]->get('CNT_name')
406
+			: $attendee->country_ID();
407
+		$content = ! is_numeric($country) ? $country : '';
408
+		return $this->columnContent('CNT_ISO', $content);
409
+	}
410
+
411
+
412
+	/**
413
+	 * Phone Number column
414
+	 *
415
+	 * @param EE_Attendee $attendee
416
+	 * @return string
417
+	 * @throws EE_Error
418
+	 */
419
+	public function column_ATT_phone(EE_Attendee $attendee): string
420
+	{
421
+		return $this->columnContent('ATT_phone', $attendee->phone());
422
+	}
423 423
 }
Please login to merge, or discard this patch.
admin_pages/messages/EE_Message_List_Table.class.php 1 patch
Indentation   +430 added lines, -430 removed lines patch added patch discarded remove patch
@@ -10,440 +10,440 @@
 block discarded – undo
10 10
  */
11 11
 class EE_Message_List_Table extends EE_Admin_List_Table
12 12
 {
13
-    /**
14
-     * @return Messages_Admin_Page
15
-     */
16
-    public function get_admin_page()
17
-    {
18
-        return $this->_admin_page;
19
-    }
20
-
21
-
22
-    protected function _setup_data()
23
-    {
24
-        $this->_data = $this->_get_messages($this->_per_page, $this->_view);
25
-        $this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true);
26
-    }
27
-
28
-
29
-    protected function _set_properties()
30
-    {
31
-        $this->_wp_list_args = array(
32
-            'singular' => esc_html__('Message', 'event_espresso'),
33
-            'plural'   => esc_html__('Messages', 'event_espresso'),
34
-            'ajax'     => true,
35
-            'screen'   => $this->get_admin_page()->get_current_screen()->id,
36
-        );
37
-
38
-        $this->_columns = array(
39
-            'cb'           => '<input type="checkbox" />',
40
-            'id'           => esc_html__('ID', 'event_espresso'),
41
-            'to'           => esc_html__('To', 'event_espresso'),
42
-            'context'      => esc_html__('Recipient', 'event_espresso'),
43
-            'message_type' => esc_html__('Message Type', 'event_espresso'),
44
-            'messenger'    => esc_html__('Messenger', 'event_espresso'),
45
-            'from'         => esc_html__('From', 'event_espresso'),
46
-            'modified'     => esc_html__('Modified', 'event_espresso'),
47
-            'actions'      => $this->actionsColumnHeader(),
48
-        );
49
-
50
-        $this->_sortable_columns = array(
51
-            'modified'     => array('MSG_modified' => true),
52
-            'message_type' => array('MSG_message_type' => false),
53
-            'messenger'    => array('MSG_messenger' => false),
54
-            'to'           => array('MSG_to' => false),
55
-            'from'         => array('MSG_from' => false),
56
-            'context'      => array('MSG_context' => false),
57
-            'id'           => array('MSG_ID', false),
58
-        );
59
-
60
-        $this->_primary_column = 'to';
61
-
62
-        $this->_hidden_columns = array(
63
-            'id',
64
-        );
65
-    }
66
-
67
-
68
-    /**
69
-     * This simply sets up the row class for the table rows.
70
-     * Allows for easier overriding of child methods for setting up sorting.
71
-     *
72
-     * @param  object $item the current item
73
-     * @return string
74
-     */
75
-    protected function _get_row_class($item)
76
-    {
77
-        $class = parent::_get_row_class($item);
78
-        // add status class
79
-        $class .= ' msg-status-' . $item->STS_ID();
80
-        if ($this->_has_checkbox_column) {
81
-            $class .= ' has-checkbox-column';
82
-        }
83
-        return $class;
84
-    }
85
-
86
-
87
-    /**
88
-     * _get_table_filters
89
-     * We use this to assemble and return any filters that are associated with this table that help further refine what
90
-     * gets shown in the table.
91
-     *
92
-     * @abstract
93
-     * @access protected
94
-     * @return array
95
-     */
96
-    protected function _get_table_filters()
97
-    {
98
-        $filters = array();
99
-
100
-        // get select_inputs
101
-        $select_inputs = array(
102
-            $this->_get_messengers_dropdown_filter(),
103
-            $this->_get_message_types_dropdown_filter(),
104
-            $this->_get_contexts_for_message_types_dropdown_filter(),
105
-        );
106
-
107
-        // set filters to select inputs if they aren't empty
108
-        foreach ($select_inputs as $select_input) {
109
-            if ($select_input) {
110
-                $filters[] = $select_input;
111
-            }
112
-        }
113
-        return $filters;
114
-    }
115
-
116
-
117
-    protected function _add_view_counts()
118
-    {
119
-        foreach ($this->_views as $view => $args) {
120
-            $this->_views[ $view ]['count'] = $this->_get_messages($this->_per_page, $view, true, true);
121
-        }
122
-    }
123
-
124
-
125
-    /**
126
-     * @param EE_Message $message
127
-     * @return string   checkbox
128
-     * @throws EE_Error
129
-     */
130
-    public function column_cb($message)
131
-    {
132
-        return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID());
133
-    }
134
-
135
-
136
-    /**
137
-     * @param EE_Message $message
138
-     * @return string
139
-     * @throws \EE_Error
140
-     */
141
-    public function column_id(EE_Message $message)
142
-    {
143
-        return $this->columnContent('id', $message->ID(), 'center');
144
-    }
145
-
146
-
147
-    /**
148
-     * @param EE_Message $message
149
-     * @return string    The recipient of the message
150
-     * @throws \EE_Error
151
-     */
152
-    public function column_to(EE_Message $message)
153
-    {
154
-        $delete_url = EEH_URL::add_query_args_and_nonce(
155
-            [
156
-                'page'   => 'espresso_messages',
157
-                'action' => 'delete_ee_message',
158
-                'MSG_ID' => $message->ID(),
159
-            ],
160
-            admin_url('admin.php')
161
-        );
162
-        $actions = [
163
-            'delete' => '<a href="' . $delete_url . '">' . esc_html__('Delete', 'event_espresso') . '</a>'
164
-        ];
165
-        $status = esc_attr($message->STS_ID());
166
-        $pretty_status = EEH_Template::pretty_status($status, false, 'sentence');
167
-        return '
13
+	/**
14
+	 * @return Messages_Admin_Page
15
+	 */
16
+	public function get_admin_page()
17
+	{
18
+		return $this->_admin_page;
19
+	}
20
+
21
+
22
+	protected function _setup_data()
23
+	{
24
+		$this->_data = $this->_get_messages($this->_per_page, $this->_view);
25
+		$this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true);
26
+	}
27
+
28
+
29
+	protected function _set_properties()
30
+	{
31
+		$this->_wp_list_args = array(
32
+			'singular' => esc_html__('Message', 'event_espresso'),
33
+			'plural'   => esc_html__('Messages', 'event_espresso'),
34
+			'ajax'     => true,
35
+			'screen'   => $this->get_admin_page()->get_current_screen()->id,
36
+		);
37
+
38
+		$this->_columns = array(
39
+			'cb'           => '<input type="checkbox" />',
40
+			'id'           => esc_html__('ID', 'event_espresso'),
41
+			'to'           => esc_html__('To', 'event_espresso'),
42
+			'context'      => esc_html__('Recipient', 'event_espresso'),
43
+			'message_type' => esc_html__('Message Type', 'event_espresso'),
44
+			'messenger'    => esc_html__('Messenger', 'event_espresso'),
45
+			'from'         => esc_html__('From', 'event_espresso'),
46
+			'modified'     => esc_html__('Modified', 'event_espresso'),
47
+			'actions'      => $this->actionsColumnHeader(),
48
+		);
49
+
50
+		$this->_sortable_columns = array(
51
+			'modified'     => array('MSG_modified' => true),
52
+			'message_type' => array('MSG_message_type' => false),
53
+			'messenger'    => array('MSG_messenger' => false),
54
+			'to'           => array('MSG_to' => false),
55
+			'from'         => array('MSG_from' => false),
56
+			'context'      => array('MSG_context' => false),
57
+			'id'           => array('MSG_ID', false),
58
+		);
59
+
60
+		$this->_primary_column = 'to';
61
+
62
+		$this->_hidden_columns = array(
63
+			'id',
64
+		);
65
+	}
66
+
67
+
68
+	/**
69
+	 * This simply sets up the row class for the table rows.
70
+	 * Allows for easier overriding of child methods for setting up sorting.
71
+	 *
72
+	 * @param  object $item the current item
73
+	 * @return string
74
+	 */
75
+	protected function _get_row_class($item)
76
+	{
77
+		$class = parent::_get_row_class($item);
78
+		// add status class
79
+		$class .= ' msg-status-' . $item->STS_ID();
80
+		if ($this->_has_checkbox_column) {
81
+			$class .= ' has-checkbox-column';
82
+		}
83
+		return $class;
84
+	}
85
+
86
+
87
+	/**
88
+	 * _get_table_filters
89
+	 * We use this to assemble and return any filters that are associated with this table that help further refine what
90
+	 * gets shown in the table.
91
+	 *
92
+	 * @abstract
93
+	 * @access protected
94
+	 * @return array
95
+	 */
96
+	protected function _get_table_filters()
97
+	{
98
+		$filters = array();
99
+
100
+		// get select_inputs
101
+		$select_inputs = array(
102
+			$this->_get_messengers_dropdown_filter(),
103
+			$this->_get_message_types_dropdown_filter(),
104
+			$this->_get_contexts_for_message_types_dropdown_filter(),
105
+		);
106
+
107
+		// set filters to select inputs if they aren't empty
108
+		foreach ($select_inputs as $select_input) {
109
+			if ($select_input) {
110
+				$filters[] = $select_input;
111
+			}
112
+		}
113
+		return $filters;
114
+	}
115
+
116
+
117
+	protected function _add_view_counts()
118
+	{
119
+		foreach ($this->_views as $view => $args) {
120
+			$this->_views[ $view ]['count'] = $this->_get_messages($this->_per_page, $view, true, true);
121
+		}
122
+	}
123
+
124
+
125
+	/**
126
+	 * @param EE_Message $message
127
+	 * @return string   checkbox
128
+	 * @throws EE_Error
129
+	 */
130
+	public function column_cb($message)
131
+	{
132
+		return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID());
133
+	}
134
+
135
+
136
+	/**
137
+	 * @param EE_Message $message
138
+	 * @return string
139
+	 * @throws \EE_Error
140
+	 */
141
+	public function column_id(EE_Message $message)
142
+	{
143
+		return $this->columnContent('id', $message->ID(), 'center');
144
+	}
145
+
146
+
147
+	/**
148
+	 * @param EE_Message $message
149
+	 * @return string    The recipient of the message
150
+	 * @throws \EE_Error
151
+	 */
152
+	public function column_to(EE_Message $message)
153
+	{
154
+		$delete_url = EEH_URL::add_query_args_and_nonce(
155
+			[
156
+				'page'   => 'espresso_messages',
157
+				'action' => 'delete_ee_message',
158
+				'MSG_ID' => $message->ID(),
159
+			],
160
+			admin_url('admin.php')
161
+		);
162
+		$actions = [
163
+			'delete' => '<a href="' . $delete_url . '">' . esc_html__('Delete', 'event_espresso') . '</a>'
164
+		];
165
+		$status = esc_attr($message->STS_ID());
166
+		$pretty_status = EEH_Template::pretty_status($status, false, 'sentence');
167
+		return '
168 168
         <div class="ee-layout-row">
169 169
             <span class="row-title ee-status-color--' . $status . ' ee-aria-tooltip" aria-label="' . $pretty_status . '">
170 170
                 <span class="ee-status-dot ee-status-bg--' . $status . '"></span>
171 171
                 ' . esc_html($message->to()) . '
172 172
             </span>
173 173
         </div>' . $this->row_actions($actions);
174
-    }
175
-
176
-
177
-    /**
178
-     * @param EE_Message $message
179
-     * @return string   The sender of the message
180
-     */
181
-    public function column_from(EE_Message $message)
182
-    {
183
-        return esc_html($message->from());
184
-    }
185
-
186
-
187
-    /**
188
-     * @param EE_Message $message
189
-     * @return string  The messenger used to send the message.
190
-     */
191
-    public function column_messenger(EE_Message $message)
192
-    {
193
-        return ucwords($message->messenger_label());
194
-    }
195
-
196
-
197
-    /**
198
-     * @param EE_Message $message
199
-     * @return string  The message type used to generate the message.
200
-     */
201
-    public function column_message_type(EE_Message $message)
202
-    {
203
-        return ucwords($message->message_type_label());
204
-    }
205
-
206
-
207
-    /**
208
-     * @param EE_Message $message
209
-     * @return string  The context the message was generated for.
210
-     */
211
-    public function column_context(EE_Message $message)
212
-    {
213
-        return $message->context_label();
214
-    }
215
-
216
-
217
-    /**
218
-     * @param EE_Message $message
219
-     * @return string    The timestamp when this message was last modified.
220
-     */
221
-    public function column_modified(EE_Message $message)
222
-    {
223
-        return $message->modified();
224
-    }
225
-
226
-
227
-    /**
228
-     * @param EE_Message $message
229
-     * @return string   Actions that can be done on the current message.
230
-     */
231
-    public function column_actions(EE_Message $message)
232
-    {
233
-        $action_links = array(
234
-            'view'                => EEH_MSG_Template::get_message_action_link('view', $message),
235
-            'error'               => EEH_MSG_Template::get_message_action_link('error', $message),
236
-            'generate_now'        => EEH_MSG_Template::get_message_action_link('generate_now', $message),
237
-            'send_now'            => EEH_MSG_Template::get_message_action_link('send_now', $message),
238
-            'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message),
239
-            'view_transaction'    => EEH_MSG_Template::get_message_action_link('view_transaction', $message),
240
-        );
241
-        $content = '';
242
-        switch ($message->STS_ID()) {
243
-            case EEM_Message::status_sent:
244
-                $content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction'];
245
-                break;
246
-            case EEM_Message::status_idle:
247
-            case EEM_Message::status_resend:
248
-                $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction'];
249
-                break;
250
-            case EEM_Message::status_retry:
251
-                $content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction'];
252
-                break;
253
-            case EEM_Message::status_failed:
254
-            case EEM_Message::status_debug_only:
255
-                $content = $action_links['error'] . $action_links['view_transaction'];
256
-                break;
257
-            case EEM_Message::status_incomplete:
258
-                $content = $action_links['generate_now'] . $action_links['view_transaction'];
259
-                break;
260
-        }
261
-        return $this->actionsModalMenu($content);
262
-    }
263
-
264
-
265
-    /**
266
-     * Retrieve the EE_Message objects for the list table.
267
-     *
268
-     * @param int    $perpage The number of items per page
269
-     * @param string $view    The view items are being retrieved for
270
-     * @param bool   $count   Whether to just return a count or not.
271
-     * @param bool   $all     Disregard any paging info (no limit on data returned).
272
-     * @return int|EE_Message[]
273
-     * @throws \EE_Error
274
-     */
275
-    protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false)
276
-    {
277
-
278
-        $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
279
-            ? $this->_req_data['paged']
280
-            : 1;
281
-
282
-        $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
283
-            ? $this->_req_data['perpage']
284
-            : $perpage;
285
-
286
-        $offset = ($current_page - 1) * $per_page;
287
-        $limit = $all || $count ? null : array($offset, $per_page);
288
-        $query_params = array(
289
-            'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'],
290
-            'order'    => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'],
291
-            'limit'    => $limit,
292
-        );
293
-
294
-        /**
295
-         * Any filters coming in from other routes?
296
-         */
297
-        if (isset($this->_req_data['filterby'])) {
298
-            $query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params());
299
-            if (! $count) {
300
-                $query_params['group_by'] = 'MSG_ID';
301
-            }
302
-        }
303
-
304
-        // view conditionals
305
-        if ($view !== 'all' && $count && $all) {
306
-            $query_params[0]['AND*view_conditional'] = array(
307
-                'STS_ID' => strtoupper($view),
308
-            );
309
-        }
310
-
311
-        if (! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') {
312
-            $query_params[0]['AND*view_conditional'] = $this->_req_data === EEM_Message::status_failed
313
-                ? array(
314
-                    'STS_ID' => array(
315
-                        'IN',
316
-                        array(EEM_Message::status_failed, EEM_Message::status_messenger_executing),
317
-                    ),
318
-                )
319
-                : array('STS_ID' => strtoupper($this->_req_data['status']));
320
-        }
321
-
322
-        if (! $all && ! empty($this->_req_data['s'])) {
323
-            $search_string = '%' . $this->_req_data['s'] . '%';
324
-            $query_params[0]['OR'] = array(
325
-                'MSG_to'      => array('LIKE', $search_string),
326
-                'MSG_from'    => array('LIKE', $search_string),
327
-                'MSG_subject' => array('LIKE', $search_string),
328
-                'MSG_content' => array('LIKE', $search_string),
329
-            );
330
-        }
331
-
332
-        // account for debug only status.  We don't show Messages with the EEM_Message::status_debug_only to clients when
333
-        // the messages system is in debug mode.
334
-        // Note: for backward compat with previous iterations, this is necessary because there may be EEM_Message::status_debug_only
335
-        // messages in the database.
336
-        if (! EEM_Message::debug()) {
337
-            $query_params[0]['AND*debug_only_conditional'] = array(
338
-                'STS_ID' => array('!=', EEM_Message::status_debug_only),
339
-            );
340
-        }
341
-
342
-        // account for filters
343
-        if (
344
-            ! $all
345
-            && isset($this->_req_data['ee_messenger_filter_by'])
346
-            && $this->_req_data['ee_messenger_filter_by'] !== 'none_selected'
347
-        ) {
348
-            $query_params[0]['AND*messenger_filter'] = array(
349
-                'MSG_messenger' => $this->_req_data['ee_messenger_filter_by'],
350
-            );
351
-        }
352
-        if (
353
-            ! $all
354
-            && ! empty($this->_req_data['ee_message_type_filter_by'])
355
-            && $this->_req_data['ee_message_type_filter_by'] !== 'none_selected'
356
-        ) {
357
-            $query_params[0]['AND*message_type_filter'] = array(
358
-                'MSG_message_type' => $this->_req_data['ee_message_type_filter_by'],
359
-            );
360
-        }
361
-
362
-        if (
363
-            ! $all
364
-            && ! empty($this->_req_data['ee_context_filter_by'])
365
-            && $this->_req_data['ee_context_filter_by'] !== 'none_selected'
366
-        ) {
367
-            $query_params[0]['AND*context_filter'] = array(
368
-                'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by'])),
369
-            );
370
-        }
371
-
372
-        return $count
373
-            /** @type int */
374
-            ? EEM_Message::instance()->count($query_params, null, true)
375
-            /** @type EE_Message[] */
376
-            : EEM_Message::instance()->get_all($query_params);
377
-    }
378
-
379
-
380
-    /**
381
-     * Generate dropdown filter select input for messengers.
382
-     *
383
-     * @return string
384
-     */
385
-    protected function _get_messengers_dropdown_filter()
386
-    {
387
-        $messenger_options = array();
388
-        $active_messages_grouped_by_messenger = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger'));
389
-
390
-        // setup array of messenger options
391
-        foreach ($active_messages_grouped_by_messenger as $active_message) {
392
-            if ($active_message instanceof EE_Message) {
393
-                $messenger_options[ $active_message->messenger() ] = ucwords($active_message->messenger_label());
394
-            }
395
-        }
396
-        return $this->get_admin_page()->get_messengers_select_input($messenger_options);
397
-    }
398
-
399
-
400
-    /**
401
-     * Generate dropdown filter select input for message types
402
-     *
403
-     * @return string
404
-     */
405
-    protected function _get_message_types_dropdown_filter()
406
-    {
407
-        $message_type_options = array();
408
-        $active_messages_grouped_by_message_type = EEM_Message::instance()->get_all(
409
-            array('group_by' => 'MSG_message_type')
410
-        );
411
-
412
-        // setup array of message type options
413
-        foreach ($active_messages_grouped_by_message_type as $active_message) {
414
-            if ($active_message instanceof EE_Message) {
415
-                $message_type_options[ $active_message->message_type() ] = ucwords(
416
-                    $active_message->message_type_label()
417
-                );
418
-            }
419
-        }
420
-        return $this->get_admin_page()->get_message_types_select_input($message_type_options);
421
-    }
422
-
423
-
424
-    /**
425
-     * Generate dropdown filter select input for message type contexts
426
-     *
427
-     * @return string
428
-     */
429
-    protected function _get_contexts_for_message_types_dropdown_filter()
430
-    {
431
-        $context_options = array();
432
-        $active_messages_grouped_by_context = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context'));
433
-
434
-        // setup array of context options
435
-        foreach ($active_messages_grouped_by_context as $active_message) {
436
-            if ($active_message instanceof EE_Message) {
437
-                $message_type = $active_message->message_type_object();
438
-                if ($message_type instanceof EE_message_type) {
439
-                    foreach ($message_type->get_contexts() as $context => $context_details) {
440
-                        if (isset($context_details['label'])) {
441
-                            $context_options[ $context ] = $context_details['label'];
442
-                        }
443
-                    }
444
-                }
445
-            }
446
-        }
447
-        return $this->get_admin_page()->get_contexts_for_message_types_select_input($context_options);
448
-    }
174
+	}
175
+
176
+
177
+	/**
178
+	 * @param EE_Message $message
179
+	 * @return string   The sender of the message
180
+	 */
181
+	public function column_from(EE_Message $message)
182
+	{
183
+		return esc_html($message->from());
184
+	}
185
+
186
+
187
+	/**
188
+	 * @param EE_Message $message
189
+	 * @return string  The messenger used to send the message.
190
+	 */
191
+	public function column_messenger(EE_Message $message)
192
+	{
193
+		return ucwords($message->messenger_label());
194
+	}
195
+
196
+
197
+	/**
198
+	 * @param EE_Message $message
199
+	 * @return string  The message type used to generate the message.
200
+	 */
201
+	public function column_message_type(EE_Message $message)
202
+	{
203
+		return ucwords($message->message_type_label());
204
+	}
205
+
206
+
207
+	/**
208
+	 * @param EE_Message $message
209
+	 * @return string  The context the message was generated for.
210
+	 */
211
+	public function column_context(EE_Message $message)
212
+	{
213
+		return $message->context_label();
214
+	}
215
+
216
+
217
+	/**
218
+	 * @param EE_Message $message
219
+	 * @return string    The timestamp when this message was last modified.
220
+	 */
221
+	public function column_modified(EE_Message $message)
222
+	{
223
+		return $message->modified();
224
+	}
225
+
226
+
227
+	/**
228
+	 * @param EE_Message $message
229
+	 * @return string   Actions that can be done on the current message.
230
+	 */
231
+	public function column_actions(EE_Message $message)
232
+	{
233
+		$action_links = array(
234
+			'view'                => EEH_MSG_Template::get_message_action_link('view', $message),
235
+			'error'               => EEH_MSG_Template::get_message_action_link('error', $message),
236
+			'generate_now'        => EEH_MSG_Template::get_message_action_link('generate_now', $message),
237
+			'send_now'            => EEH_MSG_Template::get_message_action_link('send_now', $message),
238
+			'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message),
239
+			'view_transaction'    => EEH_MSG_Template::get_message_action_link('view_transaction', $message),
240
+		);
241
+		$content = '';
242
+		switch ($message->STS_ID()) {
243
+			case EEM_Message::status_sent:
244
+				$content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction'];
245
+				break;
246
+			case EEM_Message::status_idle:
247
+			case EEM_Message::status_resend:
248
+				$content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction'];
249
+				break;
250
+			case EEM_Message::status_retry:
251
+				$content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction'];
252
+				break;
253
+			case EEM_Message::status_failed:
254
+			case EEM_Message::status_debug_only:
255
+				$content = $action_links['error'] . $action_links['view_transaction'];
256
+				break;
257
+			case EEM_Message::status_incomplete:
258
+				$content = $action_links['generate_now'] . $action_links['view_transaction'];
259
+				break;
260
+		}
261
+		return $this->actionsModalMenu($content);
262
+	}
263
+
264
+
265
+	/**
266
+	 * Retrieve the EE_Message objects for the list table.
267
+	 *
268
+	 * @param int    $perpage The number of items per page
269
+	 * @param string $view    The view items are being retrieved for
270
+	 * @param bool   $count   Whether to just return a count or not.
271
+	 * @param bool   $all     Disregard any paging info (no limit on data returned).
272
+	 * @return int|EE_Message[]
273
+	 * @throws \EE_Error
274
+	 */
275
+	protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false)
276
+	{
277
+
278
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
279
+			? $this->_req_data['paged']
280
+			: 1;
281
+
282
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
283
+			? $this->_req_data['perpage']
284
+			: $perpage;
285
+
286
+		$offset = ($current_page - 1) * $per_page;
287
+		$limit = $all || $count ? null : array($offset, $per_page);
288
+		$query_params = array(
289
+			'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'],
290
+			'order'    => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'],
291
+			'limit'    => $limit,
292
+		);
293
+
294
+		/**
295
+		 * Any filters coming in from other routes?
296
+		 */
297
+		if (isset($this->_req_data['filterby'])) {
298
+			$query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params());
299
+			if (! $count) {
300
+				$query_params['group_by'] = 'MSG_ID';
301
+			}
302
+		}
303
+
304
+		// view conditionals
305
+		if ($view !== 'all' && $count && $all) {
306
+			$query_params[0]['AND*view_conditional'] = array(
307
+				'STS_ID' => strtoupper($view),
308
+			);
309
+		}
310
+
311
+		if (! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') {
312
+			$query_params[0]['AND*view_conditional'] = $this->_req_data === EEM_Message::status_failed
313
+				? array(
314
+					'STS_ID' => array(
315
+						'IN',
316
+						array(EEM_Message::status_failed, EEM_Message::status_messenger_executing),
317
+					),
318
+				)
319
+				: array('STS_ID' => strtoupper($this->_req_data['status']));
320
+		}
321
+
322
+		if (! $all && ! empty($this->_req_data['s'])) {
323
+			$search_string = '%' . $this->_req_data['s'] . '%';
324
+			$query_params[0]['OR'] = array(
325
+				'MSG_to'      => array('LIKE', $search_string),
326
+				'MSG_from'    => array('LIKE', $search_string),
327
+				'MSG_subject' => array('LIKE', $search_string),
328
+				'MSG_content' => array('LIKE', $search_string),
329
+			);
330
+		}
331
+
332
+		// account for debug only status.  We don't show Messages with the EEM_Message::status_debug_only to clients when
333
+		// the messages system is in debug mode.
334
+		// Note: for backward compat with previous iterations, this is necessary because there may be EEM_Message::status_debug_only
335
+		// messages in the database.
336
+		if (! EEM_Message::debug()) {
337
+			$query_params[0]['AND*debug_only_conditional'] = array(
338
+				'STS_ID' => array('!=', EEM_Message::status_debug_only),
339
+			);
340
+		}
341
+
342
+		// account for filters
343
+		if (
344
+			! $all
345
+			&& isset($this->_req_data['ee_messenger_filter_by'])
346
+			&& $this->_req_data['ee_messenger_filter_by'] !== 'none_selected'
347
+		) {
348
+			$query_params[0]['AND*messenger_filter'] = array(
349
+				'MSG_messenger' => $this->_req_data['ee_messenger_filter_by'],
350
+			);
351
+		}
352
+		if (
353
+			! $all
354
+			&& ! empty($this->_req_data['ee_message_type_filter_by'])
355
+			&& $this->_req_data['ee_message_type_filter_by'] !== 'none_selected'
356
+		) {
357
+			$query_params[0]['AND*message_type_filter'] = array(
358
+				'MSG_message_type' => $this->_req_data['ee_message_type_filter_by'],
359
+			);
360
+		}
361
+
362
+		if (
363
+			! $all
364
+			&& ! empty($this->_req_data['ee_context_filter_by'])
365
+			&& $this->_req_data['ee_context_filter_by'] !== 'none_selected'
366
+		) {
367
+			$query_params[0]['AND*context_filter'] = array(
368
+				'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by'])),
369
+			);
370
+		}
371
+
372
+		return $count
373
+			/** @type int */
374
+			? EEM_Message::instance()->count($query_params, null, true)
375
+			/** @type EE_Message[] */
376
+			: EEM_Message::instance()->get_all($query_params);
377
+	}
378
+
379
+
380
+	/**
381
+	 * Generate dropdown filter select input for messengers.
382
+	 *
383
+	 * @return string
384
+	 */
385
+	protected function _get_messengers_dropdown_filter()
386
+	{
387
+		$messenger_options = array();
388
+		$active_messages_grouped_by_messenger = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger'));
389
+
390
+		// setup array of messenger options
391
+		foreach ($active_messages_grouped_by_messenger as $active_message) {
392
+			if ($active_message instanceof EE_Message) {
393
+				$messenger_options[ $active_message->messenger() ] = ucwords($active_message->messenger_label());
394
+			}
395
+		}
396
+		return $this->get_admin_page()->get_messengers_select_input($messenger_options);
397
+	}
398
+
399
+
400
+	/**
401
+	 * Generate dropdown filter select input for message types
402
+	 *
403
+	 * @return string
404
+	 */
405
+	protected function _get_message_types_dropdown_filter()
406
+	{
407
+		$message_type_options = array();
408
+		$active_messages_grouped_by_message_type = EEM_Message::instance()->get_all(
409
+			array('group_by' => 'MSG_message_type')
410
+		);
411
+
412
+		// setup array of message type options
413
+		foreach ($active_messages_grouped_by_message_type as $active_message) {
414
+			if ($active_message instanceof EE_Message) {
415
+				$message_type_options[ $active_message->message_type() ] = ucwords(
416
+					$active_message->message_type_label()
417
+				);
418
+			}
419
+		}
420
+		return $this->get_admin_page()->get_message_types_select_input($message_type_options);
421
+	}
422
+
423
+
424
+	/**
425
+	 * Generate dropdown filter select input for message type contexts
426
+	 *
427
+	 * @return string
428
+	 */
429
+	protected function _get_contexts_for_message_types_dropdown_filter()
430
+	{
431
+		$context_options = array();
432
+		$active_messages_grouped_by_context = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context'));
433
+
434
+		// setup array of context options
435
+		foreach ($active_messages_grouped_by_context as $active_message) {
436
+			if ($active_message instanceof EE_Message) {
437
+				$message_type = $active_message->message_type_object();
438
+				if ($message_type instanceof EE_message_type) {
439
+					foreach ($message_type->get_contexts() as $context => $context_details) {
440
+						if (isset($context_details['label'])) {
441
+							$context_options[ $context ] = $context_details['label'];
442
+						}
443
+					}
444
+				}
445
+			}
446
+		}
447
+		return $this->get_admin_page()->get_contexts_for_message_types_select_input($context_options);
448
+	}
449 449
 }
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -37,120 +37,120 @@
 block discarded – undo
37 37
  * @since           4.0
38 38
  */
39 39
 if (function_exists('espresso_version')) {
40
-    if (! function_exists('espresso_duplicate_plugin_error')) {
41
-        /**
42
-         *    espresso_duplicate_plugin_error
43
-         *    displays if more than one version of EE is activated at the same time.
44
-         */
45
-        function espresso_duplicate_plugin_error()
46
-        {
47
-            ?>
40
+	if (! function_exists('espresso_duplicate_plugin_error')) {
41
+		/**
42
+		 *    espresso_duplicate_plugin_error
43
+		 *    displays if more than one version of EE is activated at the same time.
44
+		 */
45
+		function espresso_duplicate_plugin_error()
46
+		{
47
+			?>
48 48
             <div class="error">
49 49
                 <p>
50 50
                     <?php
51
-                    echo esc_html__(
52
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
53
-                        'event_espresso'
54
-                    ); ?>
51
+					echo esc_html__(
52
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
53
+						'event_espresso'
54
+					); ?>
55 55
                 </p>
56 56
             </div>
57 57
             <?php
58
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
59
-        }
60
-    }
61
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
58
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
59
+		}
60
+	}
61
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
62 62
 } else {
63
-    define('EE_MIN_PHP_VER_REQUIRED', '7.4.0');
64
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
65
-        /**
66
-         * espresso_minimum_php_version_error
67
-         *
68
-         * @return void
69
-         */
70
-        function espresso_minimum_php_version_error()
71
-        {
72
-            ?>
63
+	define('EE_MIN_PHP_VER_REQUIRED', '7.4.0');
64
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
65
+		/**
66
+		 * espresso_minimum_php_version_error
67
+		 *
68
+		 * @return void
69
+		 */
70
+		function espresso_minimum_php_version_error()
71
+		{
72
+			?>
73 73
             <div class="error">
74 74
                 <p>
75 75
                     <?php
76
-                    printf(
77
-                        esc_html__(
78
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
79
-                            'event_espresso'
80
-                        ),
81
-                        EE_MIN_PHP_VER_REQUIRED,
82
-                        PHP_VERSION,
83
-                        '<br/>',
84
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
85
-                    );
86
-                    ?>
76
+					printf(
77
+						esc_html__(
78
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
79
+							'event_espresso'
80
+						),
81
+						EE_MIN_PHP_VER_REQUIRED,
82
+						PHP_VERSION,
83
+						'<br/>',
84
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
85
+					);
86
+					?>
87 87
                 </p>
88 88
             </div>
89 89
             <?php
90
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
91
-        }
90
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
91
+		}
92 92
 
93
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
94
-    } else {
95
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
93
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
94
+	} else {
95
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
96 96
 
97
-        require_once __DIR__ . '/vendor/autoload.php';
98
-        require_once __DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php';
97
+		require_once __DIR__ . '/vendor/autoload.php';
98
+		require_once __DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php';
99 99
 
100
-        /**
101
-         * espresso_version
102
-         * Returns the plugin version
103
-         *
104
-         * @return string
105
-         */
106
-        function espresso_version()
107
-        {
108
-            return apply_filters('FHEE__espresso__espresso_version', '5.0.0.rc.012');
109
-        }
100
+		/**
101
+		 * espresso_version
102
+		 * Returns the plugin version
103
+		 *
104
+		 * @return string
105
+		 */
106
+		function espresso_version()
107
+		{
108
+			return apply_filters('FHEE__espresso__espresso_version', '5.0.0.rc.012');
109
+		}
110 110
 
111
-        /**
112
-         * espresso_plugin_activation
113
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
114
-         */
115
-        function espresso_plugin_activation()
116
-        {
117
-            update_option('ee_espresso_activation', true);
118
-            // Run WP GraphQL activation callback
119
-            graphql_activation_callback();
120
-        }
111
+		/**
112
+		 * espresso_plugin_activation
113
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
114
+		 */
115
+		function espresso_plugin_activation()
116
+		{
117
+			update_option('ee_espresso_activation', true);
118
+			// Run WP GraphQL activation callback
119
+			graphql_activation_callback();
120
+		}
121 121
 
122
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
122
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
123 123
 
124
-        /**
125
-         * espresso_plugin_deactivation
126
-         */
127
-        function espresso_plugin_deactivation()
128
-        {
129
-            // Run WP GraphQL deactivation callback
130
-            graphql_deactivation_callback();
131
-        }
132
-        register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
124
+		/**
125
+		 * espresso_plugin_deactivation
126
+		 */
127
+		function espresso_plugin_deactivation()
128
+		{
129
+			// Run WP GraphQL deactivation callback
130
+			graphql_deactivation_callback();
131
+		}
132
+		register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
133 133
 
134
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
135
-        bootstrap_espresso();
136
-    }
134
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
135
+		bootstrap_espresso();
136
+	}
137 137
 }
138 138
 
139 139
 if (! function_exists('espresso_deactivate_plugin')) {
140
-    /**
141
-     *    deactivate_plugin
142
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
143
-     *
144
-     * @access public
145
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
146
-     * @return    void
147
-     */
148
-    function espresso_deactivate_plugin($plugin_basename = '')
149
-    {
150
-        if (! function_exists('deactivate_plugins')) {
151
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
152
-        }
153
-        unset($_GET['activate'], $_REQUEST['activate']);
154
-        deactivate_plugins($plugin_basename);
155
-    }
140
+	/**
141
+	 *    deactivate_plugin
142
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
143
+	 *
144
+	 * @access public
145
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
146
+	 * @return    void
147
+	 */
148
+	function espresso_deactivate_plugin($plugin_basename = '')
149
+	{
150
+		if (! function_exists('deactivate_plugins')) {
151
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
152
+		}
153
+		unset($_GET['activate'], $_REQUEST['activate']);
154
+		deactivate_plugins($plugin_basename);
155
+	}
156 156
 }
Please login to merge, or discard this patch.