Completed
Branch BUG/escape-localized-variables (bce518)
by
unknown
21:55 queued 09:07
created
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -924,7 +924,7 @@
 block discarded – undo
924 924
      * handles toggling the checkin status for the registration,
925 925
      *
926 926
      * @access protected
927
-     * @return int|void
927
+     * @return integer
928 928
      * @throws EE_Error
929 929
      * @throws InvalidArgumentException
930 930
      * @throws InvalidDataTypeException
Please login to merge, or discard this patch.
Indentation   +1210 added lines, -1210 removed lines patch added patch discarded remove patch
@@ -16,1267 +16,1267 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * This is used to hold the reports template data which is setup early in the request.
21
-     *
22
-     * @type array
23
-     */
24
-    protected $_reports_template_data = array();
19
+	/**
20
+	 * This is used to hold the reports template data which is setup early in the request.
21
+	 *
22
+	 * @type array
23
+	 */
24
+	protected $_reports_template_data = array();
25 25
 
26 26
 
27
-    /**
28
-     * Extend_Registrations_Admin_Page constructor.
29
-     *
30
-     * @param bool $routing
31
-     */
32
-    public function __construct($routing = true)
33
-    {
34
-        parent::__construct($routing);
35
-        if (! defined('REG_CAF_TEMPLATE_PATH')) {
36
-            define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
37
-            define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
38
-            define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
39
-        }
40
-    }
27
+	/**
28
+	 * Extend_Registrations_Admin_Page constructor.
29
+	 *
30
+	 * @param bool $routing
31
+	 */
32
+	public function __construct($routing = true)
33
+	{
34
+		parent::__construct($routing);
35
+		if (! defined('REG_CAF_TEMPLATE_PATH')) {
36
+			define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
37
+			define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
38
+			define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
39
+		}
40
+	}
41 41
 
42 42
 
43
-    /**
44
-     * Extending page configuration.
45
-     */
46
-    protected function _extend_page_config()
47
-    {
48
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
49
-        $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID'])
50
-            ? $this->_req_data['_REG_ID']
51
-            : 0;
52
-        $new_page_routes = array(
53
-            'reports'                      => array(
54
-                'func'       => '_registration_reports',
55
-                'capability' => 'ee_read_registrations',
56
-            ),
57
-            'registration_checkins'        => array(
58
-                'func'       => '_registration_checkin_list_table',
59
-                'capability' => 'ee_read_checkins',
60
-            ),
61
-            'newsletter_selected_send'     => array(
62
-                'func'       => '_newsletter_selected_send',
63
-                'noheader'   => true,
64
-                'capability' => 'ee_send_message',
65
-            ),
66
-            'delete_checkin_rows'          => array(
67
-                'func'       => '_delete_checkin_rows',
68
-                'noheader'   => true,
69
-                'capability' => 'ee_delete_checkins',
70
-            ),
71
-            'delete_checkin_row'           => array(
72
-                'func'       => '_delete_checkin_row',
73
-                'noheader'   => true,
74
-                'capability' => 'ee_delete_checkin',
75
-                'obj_id'     => $reg_id,
76
-            ),
77
-            'toggle_checkin_status'        => array(
78
-                'func'       => '_toggle_checkin_status',
79
-                'noheader'   => true,
80
-                'capability' => 'ee_edit_checkin',
81
-                'obj_id'     => $reg_id,
82
-            ),
83
-            'toggle_checkin_status_bulk'   => array(
84
-                'func'       => '_toggle_checkin_status',
85
-                'noheader'   => true,
86
-                'capability' => 'ee_edit_checkins',
87
-            ),
88
-            'event_registrations'          => array(
89
-                'func'       => '_event_registrations_list_table',
90
-                'capability' => 'ee_read_checkins',
91
-            ),
92
-            'registrations_checkin_report' => array(
93
-                'func'       => '_registrations_checkin_report',
94
-                'noheader'   => true,
95
-                'capability' => 'ee_read_registrations',
96
-            ),
97
-        );
98
-        $this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
99
-        $new_page_config = array(
100
-            'reports'               => array(
101
-                'nav'           => array(
102
-                    'label' => esc_html__('Reports', 'event_espresso'),
103
-                    'order' => 30,
104
-                ),
105
-                'help_tabs'     => array(
106
-                    'registrations_reports_help_tab' => array(
107
-                        'title'    => esc_html__('Registration Reports', 'event_espresso'),
108
-                        'filename' => 'registrations_reports',
109
-                    ),
110
-                ),
111
-                /*'help_tour' => array( 'Registration_Reports_Help_Tour' ),*/
112
-                'require_nonce' => false,
113
-            ),
114
-            'event_registrations'   => array(
115
-                'nav'           => array(
116
-                    'label'      => esc_html__('Event Check-In', 'event_espresso'),
117
-                    'order'      => 10,
118
-                    'persistent' => true,
119
-                ),
120
-                'help_tabs'     => array(
121
-                    'registrations_event_checkin_help_tab'                       => array(
122
-                        'title'    => esc_html__('Registrations Event Check-In', 'event_espresso'),
123
-                        'filename' => 'registrations_event_checkin',
124
-                    ),
125
-                    'registrations_event_checkin_table_column_headings_help_tab' => array(
126
-                        'title'    => esc_html__('Event Check-In Table Column Headings', 'event_espresso'),
127
-                        'filename' => 'registrations_event_checkin_table_column_headings',
128
-                    ),
129
-                    'registrations_event_checkin_filters_help_tab'               => array(
130
-                        'title'    => esc_html__('Event Check-In Filters', 'event_espresso'),
131
-                        'filename' => 'registrations_event_checkin_filters',
132
-                    ),
133
-                    'registrations_event_checkin_views_help_tab'                 => array(
134
-                        'title'    => esc_html__('Event Check-In Views', 'event_espresso'),
135
-                        'filename' => 'registrations_event_checkin_views',
136
-                    ),
137
-                    'registrations_event_checkin_other_help_tab'                 => array(
138
-                        'title'    => esc_html__('Event Check-In Other', 'event_espresso'),
139
-                        'filename' => 'registrations_event_checkin_other',
140
-                    ),
141
-                ),
142
-                'help_tour'     => array('Event_Checkin_Help_Tour'),
143
-                'qtips'         => array('Registration_List_Table_Tips'),
144
-                'list_table'    => 'EE_Event_Registrations_List_Table',
145
-                'metaboxes'     => array(),
146
-                'require_nonce' => false,
147
-            ),
148
-            'registration_checkins' => array(
149
-                'nav'           => array(
150
-                    'label'      => esc_html__('Check-In Records', 'event_espresso'),
151
-                    'order'      => 15,
152
-                    'persistent' => false,
153
-                    'url'        => '',
154
-                ),
155
-                'list_table'    => 'EE_Registration_CheckIn_List_Table',
156
-                // 'help_tour' => array( 'Checkin_Toggle_View_Help_Tour' ),
157
-                'metaboxes'     => array(),
158
-                'require_nonce' => false,
159
-            ),
160
-        );
161
-        $this->_page_config = array_merge($this->_page_config, $new_page_config);
162
-        $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
163
-        $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
164
-    }
43
+	/**
44
+	 * Extending page configuration.
45
+	 */
46
+	protected function _extend_page_config()
47
+	{
48
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
49
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID'])
50
+			? $this->_req_data['_REG_ID']
51
+			: 0;
52
+		$new_page_routes = array(
53
+			'reports'                      => array(
54
+				'func'       => '_registration_reports',
55
+				'capability' => 'ee_read_registrations',
56
+			),
57
+			'registration_checkins'        => array(
58
+				'func'       => '_registration_checkin_list_table',
59
+				'capability' => 'ee_read_checkins',
60
+			),
61
+			'newsletter_selected_send'     => array(
62
+				'func'       => '_newsletter_selected_send',
63
+				'noheader'   => true,
64
+				'capability' => 'ee_send_message',
65
+			),
66
+			'delete_checkin_rows'          => array(
67
+				'func'       => '_delete_checkin_rows',
68
+				'noheader'   => true,
69
+				'capability' => 'ee_delete_checkins',
70
+			),
71
+			'delete_checkin_row'           => array(
72
+				'func'       => '_delete_checkin_row',
73
+				'noheader'   => true,
74
+				'capability' => 'ee_delete_checkin',
75
+				'obj_id'     => $reg_id,
76
+			),
77
+			'toggle_checkin_status'        => array(
78
+				'func'       => '_toggle_checkin_status',
79
+				'noheader'   => true,
80
+				'capability' => 'ee_edit_checkin',
81
+				'obj_id'     => $reg_id,
82
+			),
83
+			'toggle_checkin_status_bulk'   => array(
84
+				'func'       => '_toggle_checkin_status',
85
+				'noheader'   => true,
86
+				'capability' => 'ee_edit_checkins',
87
+			),
88
+			'event_registrations'          => array(
89
+				'func'       => '_event_registrations_list_table',
90
+				'capability' => 'ee_read_checkins',
91
+			),
92
+			'registrations_checkin_report' => array(
93
+				'func'       => '_registrations_checkin_report',
94
+				'noheader'   => true,
95
+				'capability' => 'ee_read_registrations',
96
+			),
97
+		);
98
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
99
+		$new_page_config = array(
100
+			'reports'               => array(
101
+				'nav'           => array(
102
+					'label' => esc_html__('Reports', 'event_espresso'),
103
+					'order' => 30,
104
+				),
105
+				'help_tabs'     => array(
106
+					'registrations_reports_help_tab' => array(
107
+						'title'    => esc_html__('Registration Reports', 'event_espresso'),
108
+						'filename' => 'registrations_reports',
109
+					),
110
+				),
111
+				/*'help_tour' => array( 'Registration_Reports_Help_Tour' ),*/
112
+				'require_nonce' => false,
113
+			),
114
+			'event_registrations'   => array(
115
+				'nav'           => array(
116
+					'label'      => esc_html__('Event Check-In', 'event_espresso'),
117
+					'order'      => 10,
118
+					'persistent' => true,
119
+				),
120
+				'help_tabs'     => array(
121
+					'registrations_event_checkin_help_tab'                       => array(
122
+						'title'    => esc_html__('Registrations Event Check-In', 'event_espresso'),
123
+						'filename' => 'registrations_event_checkin',
124
+					),
125
+					'registrations_event_checkin_table_column_headings_help_tab' => array(
126
+						'title'    => esc_html__('Event Check-In Table Column Headings', 'event_espresso'),
127
+						'filename' => 'registrations_event_checkin_table_column_headings',
128
+					),
129
+					'registrations_event_checkin_filters_help_tab'               => array(
130
+						'title'    => esc_html__('Event Check-In Filters', 'event_espresso'),
131
+						'filename' => 'registrations_event_checkin_filters',
132
+					),
133
+					'registrations_event_checkin_views_help_tab'                 => array(
134
+						'title'    => esc_html__('Event Check-In Views', 'event_espresso'),
135
+						'filename' => 'registrations_event_checkin_views',
136
+					),
137
+					'registrations_event_checkin_other_help_tab'                 => array(
138
+						'title'    => esc_html__('Event Check-In Other', 'event_espresso'),
139
+						'filename' => 'registrations_event_checkin_other',
140
+					),
141
+				),
142
+				'help_tour'     => array('Event_Checkin_Help_Tour'),
143
+				'qtips'         => array('Registration_List_Table_Tips'),
144
+				'list_table'    => 'EE_Event_Registrations_List_Table',
145
+				'metaboxes'     => array(),
146
+				'require_nonce' => false,
147
+			),
148
+			'registration_checkins' => array(
149
+				'nav'           => array(
150
+					'label'      => esc_html__('Check-In Records', 'event_espresso'),
151
+					'order'      => 15,
152
+					'persistent' => false,
153
+					'url'        => '',
154
+				),
155
+				'list_table'    => 'EE_Registration_CheckIn_List_Table',
156
+				// 'help_tour' => array( 'Checkin_Toggle_View_Help_Tour' ),
157
+				'metaboxes'     => array(),
158
+				'require_nonce' => false,
159
+			),
160
+		);
161
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
162
+		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
163
+		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
164
+	}
165 165
 
166 166
 
167
-    /**
168
-     * Ajax hooks for all routes in this page.
169
-     */
170
-    protected function _ajax_hooks()
171
-    {
172
-        parent::_ajax_hooks();
173
-        add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
174
-    }
167
+	/**
168
+	 * Ajax hooks for all routes in this page.
169
+	 */
170
+	protected function _ajax_hooks()
171
+	{
172
+		parent::_ajax_hooks();
173
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
174
+	}
175 175
 
176 176
 
177
-    /**
178
-     * Global scripts for all routes in this page.
179
-     */
180
-    public function load_scripts_styles()
181
-    {
182
-        parent::load_scripts_styles();
183
-        // if newsletter message type is active then let's add filter and load js for it.
184
-        if (EEH_MSG_Template::is_mt_active('newsletter')) {
185
-            // enqueue newsletter js
186
-            wp_enqueue_script(
187
-                'ee-newsletter-trigger',
188
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
189
-                array('ee-dialog'),
190
-                EVENT_ESPRESSO_VERSION,
191
-                true
192
-            );
193
-            wp_enqueue_style(
194
-                'ee-newsletter-trigger-css',
195
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
196
-                array(),
197
-                EVENT_ESPRESSO_VERSION
198
-            );
199
-            // hook in buttons for newsletter message type trigger.
200
-            add_action(
201
-                'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',
202
-                array($this, 'add_newsletter_action_buttons'),
203
-                10
204
-            );
205
-        }
206
-    }
177
+	/**
178
+	 * Global scripts for all routes in this page.
179
+	 */
180
+	public function load_scripts_styles()
181
+	{
182
+		parent::load_scripts_styles();
183
+		// if newsletter message type is active then let's add filter and load js for it.
184
+		if (EEH_MSG_Template::is_mt_active('newsletter')) {
185
+			// enqueue newsletter js
186
+			wp_enqueue_script(
187
+				'ee-newsletter-trigger',
188
+				REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
189
+				array('ee-dialog'),
190
+				EVENT_ESPRESSO_VERSION,
191
+				true
192
+			);
193
+			wp_enqueue_style(
194
+				'ee-newsletter-trigger-css',
195
+				REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
196
+				array(),
197
+				EVENT_ESPRESSO_VERSION
198
+			);
199
+			// hook in buttons for newsletter message type trigger.
200
+			add_action(
201
+				'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',
202
+				array($this, 'add_newsletter_action_buttons'),
203
+				10
204
+			);
205
+		}
206
+	}
207 207
 
208 208
 
209
-    /**
210
-     * Scripts and styles for just the reports route.
211
-     */
212
-    public function load_scripts_styles_reports()
213
-    {
214
-        wp_register_script(
215
-            'ee-reg-reports-js',
216
-            REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
217
-            array('google-charts'),
218
-            EVENT_ESPRESSO_VERSION,
219
-            true
220
-        );
221
-        wp_enqueue_script('ee-reg-reports-js');
222
-        $this->_registration_reports_js_setup();
223
-    }
209
+	/**
210
+	 * Scripts and styles for just the reports route.
211
+	 */
212
+	public function load_scripts_styles_reports()
213
+	{
214
+		wp_register_script(
215
+			'ee-reg-reports-js',
216
+			REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
217
+			array('google-charts'),
218
+			EVENT_ESPRESSO_VERSION,
219
+			true
220
+		);
221
+		wp_enqueue_script('ee-reg-reports-js');
222
+		$this->_registration_reports_js_setup();
223
+	}
224 224
 
225 225
 
226
-    /**
227
-     * Register screen options for event_registrations route.
228
-     */
229
-    protected function _add_screen_options_event_registrations()
230
-    {
231
-        $this->_per_page_screen_option();
232
-    }
226
+	/**
227
+	 * Register screen options for event_registrations route.
228
+	 */
229
+	protected function _add_screen_options_event_registrations()
230
+	{
231
+		$this->_per_page_screen_option();
232
+	}
233 233
 
234 234
 
235
-    /**
236
-     * Register screen options for registration_checkins route
237
-     */
238
-    protected function _add_screen_options_registration_checkins()
239
-    {
240
-        $page_title = $this->_admin_page_title;
241
-        $this->_admin_page_title = esc_html__('Check-In Records', 'event_espresso');
242
-        $this->_per_page_screen_option();
243
-        $this->_admin_page_title = $page_title;
244
-    }
235
+	/**
236
+	 * Register screen options for registration_checkins route
237
+	 */
238
+	protected function _add_screen_options_registration_checkins()
239
+	{
240
+		$page_title = $this->_admin_page_title;
241
+		$this->_admin_page_title = esc_html__('Check-In Records', 'event_espresso');
242
+		$this->_per_page_screen_option();
243
+		$this->_admin_page_title = $page_title;
244
+	}
245 245
 
246 246
 
247
-    /**
248
-     * Set views property for event_registrations route.
249
-     */
250
-    protected function _set_list_table_views_event_registrations()
251
-    {
252
-        $this->_views = array(
253
-            'all' => array(
254
-                'slug'        => 'all',
255
-                'label'       => esc_html__('All', 'event_espresso'),
256
-                'count'       => 0,
257
-                'bulk_action' => ! isset($this->_req_data['event_id'])
258
-                    ? array()
259
-                    : array(
260
-                        'toggle_checkin_status_bulk' => esc_html__('Toggle Check-In', 'event_espresso'),
261
-                    ),
262
-            ),
263
-        );
264
-    }
247
+	/**
248
+	 * Set views property for event_registrations route.
249
+	 */
250
+	protected function _set_list_table_views_event_registrations()
251
+	{
252
+		$this->_views = array(
253
+			'all' => array(
254
+				'slug'        => 'all',
255
+				'label'       => esc_html__('All', 'event_espresso'),
256
+				'count'       => 0,
257
+				'bulk_action' => ! isset($this->_req_data['event_id'])
258
+					? array()
259
+					: array(
260
+						'toggle_checkin_status_bulk' => esc_html__('Toggle Check-In', 'event_espresso'),
261
+					),
262
+			),
263
+		);
264
+	}
265 265
 
266 266
 
267
-    /**
268
-     * Set views property for registration_checkins route.
269
-     */
270
-    protected function _set_list_table_views_registration_checkins()
271
-    {
272
-        $this->_views = array(
273
-            'all' => array(
274
-                'slug'        => 'all',
275
-                'label'       => esc_html__('All', 'event_espresso'),
276
-                'count'       => 0,
277
-                'bulk_action' => array('delete_checkin_rows' => esc_html__('Delete Check-In Rows', 'event_espresso')),
278
-            ),
279
-        );
280
-    }
267
+	/**
268
+	 * Set views property for registration_checkins route.
269
+	 */
270
+	protected function _set_list_table_views_registration_checkins()
271
+	{
272
+		$this->_views = array(
273
+			'all' => array(
274
+				'slug'        => 'all',
275
+				'label'       => esc_html__('All', 'event_espresso'),
276
+				'count'       => 0,
277
+				'bulk_action' => array('delete_checkin_rows' => esc_html__('Delete Check-In Rows', 'event_espresso')),
278
+			),
279
+		);
280
+	}
281 281
 
282 282
 
283
-    /**
284
-     * callback for ajax action.
285
-     *
286
-     * @since 4.3.0
287
-     * @return void (JSON)
288
-     * @throws EE_Error
289
-     * @throws InvalidArgumentException
290
-     * @throws InvalidDataTypeException
291
-     * @throws InvalidInterfaceException
292
-     */
293
-    public function get_newsletter_form_content()
294
-    {
295
-        // do a nonce check cause we're not coming in from an normal route here.
296
-        $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field(
297
-            $this->_req_data['get_newsletter_form_content_nonce']
298
-        ) : '';
299
-        $nonce_ref = 'get_newsletter_form_content_nonce';
300
-        $this->_verify_nonce($nonce, $nonce_ref);
301
-        // let's get the mtp for the incoming MTP_ ID
302
-        if (! isset($this->_req_data['GRP_ID'])) {
303
-            EE_Error::add_error(
304
-                esc_html__(
305
-                    'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).',
306
-                    'event_espresso'
307
-                ),
308
-                __FILE__,
309
-                __FUNCTION__,
310
-                __LINE__
311
-            );
312
-            $this->_template_args['success'] = false;
313
-            $this->_template_args['error'] = true;
314
-            $this->_return_json();
315
-        }
316
-        $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
317
-        if (! $MTPG instanceof EE_Message_Template_Group) {
318
-            EE_Error::add_error(
319
-                sprintf(
320
-                    esc_html__(
321
-                        'The GRP_ID given (%d) does not appear to have a corresponding row in the database.',
322
-                        'event_espresso'
323
-                    ),
324
-                    $this->_req_data['GRP_ID']
325
-                ),
326
-                __FILE__,
327
-                __FUNCTION__,
328
-                __LINE__
329
-            );
330
-            $this->_template_args['success'] = false;
331
-            $this->_template_args['error'] = true;
332
-            $this->_return_json();
333
-        }
334
-        $MTPs = $MTPG->context_templates();
335
-        $MTPs = $MTPs['attendee'];
336
-        $template_fields = array();
337
-        /** @var EE_Message_Template $MTP */
338
-        foreach ($MTPs as $MTP) {
339
-            $field = $MTP->get('MTP_template_field');
340
-            if ($field === 'content') {
341
-                $content = $MTP->get('MTP_content');
342
-                if (! empty($content['newsletter_content'])) {
343
-                    $template_fields['newsletter_content'] = $content['newsletter_content'];
344
-                }
345
-                continue;
346
-            }
347
-            $template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content');
348
-        }
349
-        $this->_template_args['success'] = true;
350
-        $this->_template_args['error'] = false;
351
-        $this->_template_args['data'] = array(
352
-            'batch_message_from'    => isset($template_fields['from'])
353
-                ? $template_fields['from']
354
-                : '',
355
-            'batch_message_subject' => isset($template_fields['subject'])
356
-                ? $template_fields['subject']
357
-                : '',
358
-            'batch_message_content' => isset($template_fields['newsletter_content'])
359
-                ? $template_fields['newsletter_content']
360
-                : '',
361
-        );
362
-        $this->_return_json();
363
-    }
283
+	/**
284
+	 * callback for ajax action.
285
+	 *
286
+	 * @since 4.3.0
287
+	 * @return void (JSON)
288
+	 * @throws EE_Error
289
+	 * @throws InvalidArgumentException
290
+	 * @throws InvalidDataTypeException
291
+	 * @throws InvalidInterfaceException
292
+	 */
293
+	public function get_newsletter_form_content()
294
+	{
295
+		// do a nonce check cause we're not coming in from an normal route here.
296
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field(
297
+			$this->_req_data['get_newsletter_form_content_nonce']
298
+		) : '';
299
+		$nonce_ref = 'get_newsletter_form_content_nonce';
300
+		$this->_verify_nonce($nonce, $nonce_ref);
301
+		// let's get the mtp for the incoming MTP_ ID
302
+		if (! isset($this->_req_data['GRP_ID'])) {
303
+			EE_Error::add_error(
304
+				esc_html__(
305
+					'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).',
306
+					'event_espresso'
307
+				),
308
+				__FILE__,
309
+				__FUNCTION__,
310
+				__LINE__
311
+			);
312
+			$this->_template_args['success'] = false;
313
+			$this->_template_args['error'] = true;
314
+			$this->_return_json();
315
+		}
316
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
317
+		if (! $MTPG instanceof EE_Message_Template_Group) {
318
+			EE_Error::add_error(
319
+				sprintf(
320
+					esc_html__(
321
+						'The GRP_ID given (%d) does not appear to have a corresponding row in the database.',
322
+						'event_espresso'
323
+					),
324
+					$this->_req_data['GRP_ID']
325
+				),
326
+				__FILE__,
327
+				__FUNCTION__,
328
+				__LINE__
329
+			);
330
+			$this->_template_args['success'] = false;
331
+			$this->_template_args['error'] = true;
332
+			$this->_return_json();
333
+		}
334
+		$MTPs = $MTPG->context_templates();
335
+		$MTPs = $MTPs['attendee'];
336
+		$template_fields = array();
337
+		/** @var EE_Message_Template $MTP */
338
+		foreach ($MTPs as $MTP) {
339
+			$field = $MTP->get('MTP_template_field');
340
+			if ($field === 'content') {
341
+				$content = $MTP->get('MTP_content');
342
+				if (! empty($content['newsletter_content'])) {
343
+					$template_fields['newsletter_content'] = $content['newsletter_content'];
344
+				}
345
+				continue;
346
+			}
347
+			$template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content');
348
+		}
349
+		$this->_template_args['success'] = true;
350
+		$this->_template_args['error'] = false;
351
+		$this->_template_args['data'] = array(
352
+			'batch_message_from'    => isset($template_fields['from'])
353
+				? $template_fields['from']
354
+				: '',
355
+			'batch_message_subject' => isset($template_fields['subject'])
356
+				? $template_fields['subject']
357
+				: '',
358
+			'batch_message_content' => isset($template_fields['newsletter_content'])
359
+				? $template_fields['newsletter_content']
360
+				: '',
361
+		);
362
+		$this->_return_json();
363
+	}
364 364
 
365 365
 
366
-    /**
367
-     * callback for AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons action
368
-     *
369
-     * @since 4.3.0
370
-     * @param EE_Admin_List_Table $list_table
371
-     * @return void
372
-     * @throws InvalidArgumentException
373
-     * @throws InvalidDataTypeException
374
-     * @throws InvalidInterfaceException
375
-     */
376
-    public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table)
377
-    {
378
-        if (! EE_Registry::instance()->CAP->current_user_can(
379
-            'ee_send_message',
380
-            'espresso_registrations_newsletter_selected_send'
381
-        )
382
-        ) {
383
-            return;
384
-        }
385
-        $routes_to_add_to = array(
386
-            'contact_list',
387
-            'event_registrations',
388
-            'default',
389
-        );
390
-        if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
391
-            if (($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id']))
392
-                || (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash')
393
-            ) {
394
-                echo '';
395
-            } else {
396
-                $button_text = sprintf(
397
-                    esc_html__('Send Batch Message (%s selected)', 'event_espresso'),
398
-                    '<span class="send-selected-newsletter-count">0</span>'
399
-                );
400
-                echo '<button id="selected-batch-send-trigger" class="button secondary-button">'
401
-                     . '<span class="dashicons dashicons-email "></span>'
402
-                     . $button_text
403
-                     . '</button>';
404
-                add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
405
-            }
406
-        }
407
-    }
366
+	/**
367
+	 * callback for AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons action
368
+	 *
369
+	 * @since 4.3.0
370
+	 * @param EE_Admin_List_Table $list_table
371
+	 * @return void
372
+	 * @throws InvalidArgumentException
373
+	 * @throws InvalidDataTypeException
374
+	 * @throws InvalidInterfaceException
375
+	 */
376
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table)
377
+	{
378
+		if (! EE_Registry::instance()->CAP->current_user_can(
379
+			'ee_send_message',
380
+			'espresso_registrations_newsletter_selected_send'
381
+		)
382
+		) {
383
+			return;
384
+		}
385
+		$routes_to_add_to = array(
386
+			'contact_list',
387
+			'event_registrations',
388
+			'default',
389
+		);
390
+		if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
391
+			if (($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id']))
392
+				|| (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash')
393
+			) {
394
+				echo '';
395
+			} else {
396
+				$button_text = sprintf(
397
+					esc_html__('Send Batch Message (%s selected)', 'event_espresso'),
398
+					'<span class="send-selected-newsletter-count">0</span>'
399
+				);
400
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button">'
401
+					 . '<span class="dashicons dashicons-email "></span>'
402
+					 . $button_text
403
+					 . '</button>';
404
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
405
+			}
406
+		}
407
+	}
408 408
 
409 409
 
410
-    /**
411
-     * @throws DomainException
412
-     * @throws EE_Error
413
-     * @throws InvalidArgumentException
414
-     * @throws InvalidDataTypeException
415
-     * @throws InvalidInterfaceException
416
-     */
417
-    public function newsletter_send_form_skeleton()
418
-    {
419
-        $list_table = $this->_list_table_object;
420
-        $codes = array();
421
-        // need to templates for the newsletter message type for the template selector.
422
-        $values[] = array('text' => esc_html__('Select Template to Use', 'event_espresso'), 'id' => 0);
423
-        $mtps = EEM_Message_Template_Group::instance()->get_all(
424
-            array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))
425
-        );
426
-        foreach ($mtps as $mtp) {
427
-            $name = $mtp->name();
428
-            $values[] = array(
429
-                'text' => empty($name) ? esc_html__('Global', 'event_espresso') : $name,
430
-                'id'   => $mtp->ID(),
431
-            );
432
-        }
433
-        // need to get a list of shortcodes that are available for the newsletter message type.
434
-        $shortcodes = EEH_MSG_Template::get_shortcodes(
435
-            'newsletter',
436
-            'email',
437
-            array(),
438
-            'attendee',
439
-            false
440
-        );
441
-        foreach ($shortcodes as $field => $shortcode_array) {
442
-            $available_shortcodes = array();
443
-            foreach ($shortcode_array as $shortcode => $shortcode_details) {
444
-                $field_id = $field === '[NEWSLETTER_CONTENT]'
445
-                    ? 'content'
446
-                    : $field;
447
-                $field_id = 'batch-message-' . strtolower($field_id);
448
-                $available_shortcodes[] = '<span class="js-shortcode-selection" data-value="'
449
-                                          . $shortcode
450
-                                          . '" data-linked-input-id="' . $field_id . '">'
451
-                                          . $shortcode
452
-                                          . '</span>';
453
-            }
454
-            $codes[ $field ] = implode(', ', $available_shortcodes);
455
-        }
456
-        $shortcodes = $codes;
457
-        $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
458
-        $form_template_args = array(
459
-            'form_action'       => admin_url('admin.php?page=espresso_registrations'),
460
-            'form_route'        => 'newsletter_selected_send',
461
-            'form_nonce_name'   => 'newsletter_selected_send_nonce',
462
-            'form_nonce'        => wp_create_nonce('newsletter_selected_send_nonce'),
463
-            'redirect_back_to'  => $this->_req_action,
464
-            'ajax_nonce'        => wp_create_nonce('get_newsletter_form_content_nonce'),
465
-            'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
466
-            'shortcodes'        => $shortcodes,
467
-            'id_type'           => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration',
468
-        );
469
-        EEH_Template::display_template($form_template, $form_template_args);
470
-    }
410
+	/**
411
+	 * @throws DomainException
412
+	 * @throws EE_Error
413
+	 * @throws InvalidArgumentException
414
+	 * @throws InvalidDataTypeException
415
+	 * @throws InvalidInterfaceException
416
+	 */
417
+	public function newsletter_send_form_skeleton()
418
+	{
419
+		$list_table = $this->_list_table_object;
420
+		$codes = array();
421
+		// need to templates for the newsletter message type for the template selector.
422
+		$values[] = array('text' => esc_html__('Select Template to Use', 'event_espresso'), 'id' => 0);
423
+		$mtps = EEM_Message_Template_Group::instance()->get_all(
424
+			array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))
425
+		);
426
+		foreach ($mtps as $mtp) {
427
+			$name = $mtp->name();
428
+			$values[] = array(
429
+				'text' => empty($name) ? esc_html__('Global', 'event_espresso') : $name,
430
+				'id'   => $mtp->ID(),
431
+			);
432
+		}
433
+		// need to get a list of shortcodes that are available for the newsletter message type.
434
+		$shortcodes = EEH_MSG_Template::get_shortcodes(
435
+			'newsletter',
436
+			'email',
437
+			array(),
438
+			'attendee',
439
+			false
440
+		);
441
+		foreach ($shortcodes as $field => $shortcode_array) {
442
+			$available_shortcodes = array();
443
+			foreach ($shortcode_array as $shortcode => $shortcode_details) {
444
+				$field_id = $field === '[NEWSLETTER_CONTENT]'
445
+					? 'content'
446
+					: $field;
447
+				$field_id = 'batch-message-' . strtolower($field_id);
448
+				$available_shortcodes[] = '<span class="js-shortcode-selection" data-value="'
449
+										  . $shortcode
450
+										  . '" data-linked-input-id="' . $field_id . '">'
451
+										  . $shortcode
452
+										  . '</span>';
453
+			}
454
+			$codes[ $field ] = implode(', ', $available_shortcodes);
455
+		}
456
+		$shortcodes = $codes;
457
+		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
458
+		$form_template_args = array(
459
+			'form_action'       => admin_url('admin.php?page=espresso_registrations'),
460
+			'form_route'        => 'newsletter_selected_send',
461
+			'form_nonce_name'   => 'newsletter_selected_send_nonce',
462
+			'form_nonce'        => wp_create_nonce('newsletter_selected_send_nonce'),
463
+			'redirect_back_to'  => $this->_req_action,
464
+			'ajax_nonce'        => wp_create_nonce('get_newsletter_form_content_nonce'),
465
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
466
+			'shortcodes'        => $shortcodes,
467
+			'id_type'           => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration',
468
+		);
469
+		EEH_Template::display_template($form_template, $form_template_args);
470
+	}
471 471
 
472 472
 
473
-    /**
474
-     * Handles sending selected registrations/contacts a newsletter.
475
-     *
476
-     * @since  4.3.0
477
-     * @return void
478
-     * @throws EE_Error
479
-     * @throws InvalidArgumentException
480
-     * @throws InvalidDataTypeException
481
-     * @throws InvalidInterfaceException
482
-     */
483
-    protected function _newsletter_selected_send()
484
-    {
485
-        $success = true;
486
-        // first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
487
-        if (empty($this->_req_data['newsletter_mtp_selected'])) {
488
-            EE_Error::add_error(
489
-                esc_html__(
490
-                    'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
491
-                    'event_espresso'
492
-                ),
493
-                __FILE__,
494
-                __FUNCTION__,
495
-                __LINE__
496
-            );
497
-            $success = false;
498
-        }
499
-        if ($success) {
500
-            // update Message template in case there are any changes
501
-            $Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
502
-                $this->_req_data['newsletter_mtp_selected']
503
-            );
504
-            $Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
505
-                ? $Message_Template_Group->context_templates()
506
-                : array();
507
-            if (empty($Message_Templates)) {
508
-                EE_Error::add_error(
509
-                    esc_html__(
510
-                        'Unable to retrieve message template fields from the db. Messages not sent.',
511
-                        'event_espresso'
512
-                    ),
513
-                    __FILE__,
514
-                    __FUNCTION__,
515
-                    __LINE__
516
-                );
517
-            }
518
-            // let's just update the specific fields
519
-            foreach ($Message_Templates['attendee'] as $Message_Template) {
520
-                if ($Message_Template instanceof EE_Message_Template) {
521
-                    $field = $Message_Template->get('MTP_template_field');
522
-                    $content = $Message_Template->get('MTP_content');
523
-                    $new_content = $content;
524
-                    switch ($field) {
525
-                        case 'from':
526
-                            $new_content = ! empty($this->_req_data['batch_message']['from'])
527
-                                ? $this->_req_data['batch_message']['from']
528
-                                : $content;
529
-                            break;
530
-                        case 'subject':
531
-                            $new_content = ! empty($this->_req_data['batch_message']['subject'])
532
-                                ? $this->_req_data['batch_message']['subject']
533
-                                : $content;
534
-                            break;
535
-                        case 'content':
536
-                            $new_content = $content;
537
-                            $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
538
-                                ? $this->_req_data['batch_message']['content']
539
-                                : $content['newsletter_content'];
540
-                            break;
541
-                        default:
542
-                            // continue the foreach loop, we don't want to set $new_content nor save.
543
-                            continue 2;
544
-                    }
545
-                    $Message_Template->set('MTP_content', $new_content);
546
-                    $Message_Template->save();
547
-                }
548
-            }
549
-            // great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
550
-            $id_type = ! empty($this->_req_data['batch_message']['id_type'])
551
-                ? $this->_req_data['batch_message']['id_type']
552
-                : 'registration';
553
-            // id_type will affect how we assemble the ids.
554
-            $ids = ! empty($this->_req_data['batch_message']['ids'])
555
-                ? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
556
-                : array();
557
-            $registrations_used_for_contact_data = array();
558
-            // using switch because eventually we'll have other contexts that will be used for generating messages.
559
-            switch ($id_type) {
560
-                case 'registration':
561
-                    $registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
562
-                        array(
563
-                            array(
564
-                                'REG_ID' => array('IN', $ids),
565
-                            ),
566
-                        )
567
-                    );
568
-                    break;
569
-                case 'contact':
570
-                    $registrations_used_for_contact_data = EEM_Registration::instance()
571
-                                                                           ->get_latest_registration_for_each_of_given_contacts(
572
-                                                                               $ids
573
-                                                                           );
574
-                    break;
575
-            }
576
-            do_action_ref_array(
577
-                'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations',
578
-                array(
579
-                    $registrations_used_for_contact_data,
580
-                    $Message_Template_Group->ID(),
581
-                )
582
-            );
583
-            // kept for backward compat, internally we no longer use this action.
584
-            // @deprecated 4.8.36.rc.002
585
-            $contacts = $id_type === 'registration'
586
-                ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
587
-                : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
588
-            do_action_ref_array(
589
-                'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
590
-                array(
591
-                    $contacts,
592
-                    $Message_Template_Group->ID(),
593
-                )
594
-            );
595
-        }
596
-        $query_args = array(
597
-            'action' => ! empty($this->_req_data['redirect_back_to'])
598
-                ? $this->_req_data['redirect_back_to']
599
-                : 'default',
600
-        );
601
-        $this->_redirect_after_action(false, '', '', $query_args, true);
602
-    }
473
+	/**
474
+	 * Handles sending selected registrations/contacts a newsletter.
475
+	 *
476
+	 * @since  4.3.0
477
+	 * @return void
478
+	 * @throws EE_Error
479
+	 * @throws InvalidArgumentException
480
+	 * @throws InvalidDataTypeException
481
+	 * @throws InvalidInterfaceException
482
+	 */
483
+	protected function _newsletter_selected_send()
484
+	{
485
+		$success = true;
486
+		// first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
487
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
488
+			EE_Error::add_error(
489
+				esc_html__(
490
+					'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
491
+					'event_espresso'
492
+				),
493
+				__FILE__,
494
+				__FUNCTION__,
495
+				__LINE__
496
+			);
497
+			$success = false;
498
+		}
499
+		if ($success) {
500
+			// update Message template in case there are any changes
501
+			$Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
502
+				$this->_req_data['newsletter_mtp_selected']
503
+			);
504
+			$Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
505
+				? $Message_Template_Group->context_templates()
506
+				: array();
507
+			if (empty($Message_Templates)) {
508
+				EE_Error::add_error(
509
+					esc_html__(
510
+						'Unable to retrieve message template fields from the db. Messages not sent.',
511
+						'event_espresso'
512
+					),
513
+					__FILE__,
514
+					__FUNCTION__,
515
+					__LINE__
516
+				);
517
+			}
518
+			// let's just update the specific fields
519
+			foreach ($Message_Templates['attendee'] as $Message_Template) {
520
+				if ($Message_Template instanceof EE_Message_Template) {
521
+					$field = $Message_Template->get('MTP_template_field');
522
+					$content = $Message_Template->get('MTP_content');
523
+					$new_content = $content;
524
+					switch ($field) {
525
+						case 'from':
526
+							$new_content = ! empty($this->_req_data['batch_message']['from'])
527
+								? $this->_req_data['batch_message']['from']
528
+								: $content;
529
+							break;
530
+						case 'subject':
531
+							$new_content = ! empty($this->_req_data['batch_message']['subject'])
532
+								? $this->_req_data['batch_message']['subject']
533
+								: $content;
534
+							break;
535
+						case 'content':
536
+							$new_content = $content;
537
+							$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
538
+								? $this->_req_data['batch_message']['content']
539
+								: $content['newsletter_content'];
540
+							break;
541
+						default:
542
+							// continue the foreach loop, we don't want to set $new_content nor save.
543
+							continue 2;
544
+					}
545
+					$Message_Template->set('MTP_content', $new_content);
546
+					$Message_Template->save();
547
+				}
548
+			}
549
+			// great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
550
+			$id_type = ! empty($this->_req_data['batch_message']['id_type'])
551
+				? $this->_req_data['batch_message']['id_type']
552
+				: 'registration';
553
+			// id_type will affect how we assemble the ids.
554
+			$ids = ! empty($this->_req_data['batch_message']['ids'])
555
+				? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
556
+				: array();
557
+			$registrations_used_for_contact_data = array();
558
+			// using switch because eventually we'll have other contexts that will be used for generating messages.
559
+			switch ($id_type) {
560
+				case 'registration':
561
+					$registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
562
+						array(
563
+							array(
564
+								'REG_ID' => array('IN', $ids),
565
+							),
566
+						)
567
+					);
568
+					break;
569
+				case 'contact':
570
+					$registrations_used_for_contact_data = EEM_Registration::instance()
571
+																		   ->get_latest_registration_for_each_of_given_contacts(
572
+																			   $ids
573
+																		   );
574
+					break;
575
+			}
576
+			do_action_ref_array(
577
+				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations',
578
+				array(
579
+					$registrations_used_for_contact_data,
580
+					$Message_Template_Group->ID(),
581
+				)
582
+			);
583
+			// kept for backward compat, internally we no longer use this action.
584
+			// @deprecated 4.8.36.rc.002
585
+			$contacts = $id_type === 'registration'
586
+				? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
587
+				: EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
588
+			do_action_ref_array(
589
+				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
590
+				array(
591
+					$contacts,
592
+					$Message_Template_Group->ID(),
593
+				)
594
+			);
595
+		}
596
+		$query_args = array(
597
+			'action' => ! empty($this->_req_data['redirect_back_to'])
598
+				? $this->_req_data['redirect_back_to']
599
+				: 'default',
600
+		);
601
+		$this->_redirect_after_action(false, '', '', $query_args, true);
602
+	}
603 603
 
604 604
 
605
-    /**
606
-     * This is called when javascript is being enqueued to setup the various data needed for the reports js.
607
-     * Also $this->{$_reports_template_data} property is set for later usage by the _registration_reports method.
608
-     */
609
-    protected function _registration_reports_js_setup()
610
-    {
611
-        $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_day_report();
612
-        $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_event_report();
613
-    }
605
+	/**
606
+	 * This is called when javascript is being enqueued to setup the various data needed for the reports js.
607
+	 * Also $this->{$_reports_template_data} property is set for later usage by the _registration_reports method.
608
+	 */
609
+	protected function _registration_reports_js_setup()
610
+	{
611
+		$this->_reports_template_data['admin_reports'][] = $this->_registrations_per_day_report();
612
+		$this->_reports_template_data['admin_reports'][] = $this->_registrations_per_event_report();
613
+	}
614 614
 
615 615
 
616
-    /**
617
-     *        generates Business Reports regarding Registrations
618
-     *
619
-     * @access protected
620
-     * @return void
621
-     * @throws DomainException
622
-     */
623
-    protected function _registration_reports()
624
-    {
625
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
626
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
627
-            $template_path,
628
-            $this->_reports_template_data,
629
-            true
630
-        );
631
-        // the final template wrapper
632
-        $this->display_admin_page_with_no_sidebar();
633
-    }
616
+	/**
617
+	 *        generates Business Reports regarding Registrations
618
+	 *
619
+	 * @access protected
620
+	 * @return void
621
+	 * @throws DomainException
622
+	 */
623
+	protected function _registration_reports()
624
+	{
625
+		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
626
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
627
+			$template_path,
628
+			$this->_reports_template_data,
629
+			true
630
+		);
631
+		// the final template wrapper
632
+		$this->display_admin_page_with_no_sidebar();
633
+	}
634 634
 
635 635
 
636
-    /**
637
-     * Generates Business Report showing total registrations per day.
638
-     *
639
-     * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
640
-     * @return string
641
-     * @throws EE_Error
642
-     * @throws InvalidArgumentException
643
-     * @throws InvalidDataTypeException
644
-     * @throws InvalidInterfaceException
645
-     */
646
-    private function _registrations_per_day_report($period = '-1 month')
647
-    {
648
-        $report_ID = 'reg-admin-registrations-per-day-report-dv';
649
-        $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
650
-        $results = (array) $results;
651
-        $regs = array();
652
-        $subtitle = '';
653
-        if ($results) {
654
-            $column_titles = array();
655
-            $tracker = 0;
656
-            foreach ($results as $result) {
657
-                $report_column_values = array();
658
-                foreach ($result as $property_name => $property_value) {
659
-                    $property_value = $property_name === 'Registration_REG_date' ? $property_value
660
-                        : (int) $property_value;
661
-                    $report_column_values[] = $property_value;
662
-                    if ($tracker === 0) {
663
-                        if ($property_name === 'Registration_REG_date') {
664
-                            $column_titles[] = esc_html__(
665
-                                'Date (only days with registrations are shown)',
666
-                                'event_espresso'
667
-                            );
668
-                        } else {
669
-                            $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
670
-                        }
671
-                    }
672
-                }
673
-                $tracker++;
674
-                $regs[] = $report_column_values;
675
-            }
676
-            // make sure the column_titles is pushed to the beginning of the array
677
-            array_unshift($regs, $column_titles);
678
-            // setup the date range.
679
-            $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
680
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
681
-            $ending_date = new DateTime("now", $DateTimeZone);
682
-            $subtitle = sprintf(
683
-                wp_strip_all_tags(
684
-                    _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso')
685
-                ),
686
-                $beginning_date->format('Y-m-d'),
687
-                $ending_date->format('Y-m-d')
688
-            );
689
-        }
690
-        $report_title = wp_strip_all_tags(__('Total Registrations per Day', 'event_espresso'));
691
-        $report_params = array(
692
-            'title'     => $report_title,
693
-            'subtitle'  => $subtitle,
694
-            'id'        => $report_ID,
695
-            'regs'      => $regs,
696
-            'noResults' => empty($regs),
697
-            'noRegsMsg' => sprintf(
698
-                wp_strip_all_tags(
699
-                    __(
700
-                        '%sThere are currently no registration records in the last month for this report.%s',
701
-                        'event_espresso'
702
-                    )
703
-                ),
704
-                '<h2>' . $report_title . '</h2><p>',
705
-                '</p>'
706
-            ),
707
-        );
708
-        wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
709
-        return $report_ID;
710
-    }
636
+	/**
637
+	 * Generates Business Report showing total registrations per day.
638
+	 *
639
+	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
640
+	 * @return string
641
+	 * @throws EE_Error
642
+	 * @throws InvalidArgumentException
643
+	 * @throws InvalidDataTypeException
644
+	 * @throws InvalidInterfaceException
645
+	 */
646
+	private function _registrations_per_day_report($period = '-1 month')
647
+	{
648
+		$report_ID = 'reg-admin-registrations-per-day-report-dv';
649
+		$results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
650
+		$results = (array) $results;
651
+		$regs = array();
652
+		$subtitle = '';
653
+		if ($results) {
654
+			$column_titles = array();
655
+			$tracker = 0;
656
+			foreach ($results as $result) {
657
+				$report_column_values = array();
658
+				foreach ($result as $property_name => $property_value) {
659
+					$property_value = $property_name === 'Registration_REG_date' ? $property_value
660
+						: (int) $property_value;
661
+					$report_column_values[] = $property_value;
662
+					if ($tracker === 0) {
663
+						if ($property_name === 'Registration_REG_date') {
664
+							$column_titles[] = esc_html__(
665
+								'Date (only days with registrations are shown)',
666
+								'event_espresso'
667
+							);
668
+						} else {
669
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
670
+						}
671
+					}
672
+				}
673
+				$tracker++;
674
+				$regs[] = $report_column_values;
675
+			}
676
+			// make sure the column_titles is pushed to the beginning of the array
677
+			array_unshift($regs, $column_titles);
678
+			// setup the date range.
679
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
680
+			$beginning_date = new DateTime("now " . $period, $DateTimeZone);
681
+			$ending_date = new DateTime("now", $DateTimeZone);
682
+			$subtitle = sprintf(
683
+				wp_strip_all_tags(
684
+					_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso')
685
+				),
686
+				$beginning_date->format('Y-m-d'),
687
+				$ending_date->format('Y-m-d')
688
+			);
689
+		}
690
+		$report_title = wp_strip_all_tags(__('Total Registrations per Day', 'event_espresso'));
691
+		$report_params = array(
692
+			'title'     => $report_title,
693
+			'subtitle'  => $subtitle,
694
+			'id'        => $report_ID,
695
+			'regs'      => $regs,
696
+			'noResults' => empty($regs),
697
+			'noRegsMsg' => sprintf(
698
+				wp_strip_all_tags(
699
+					__(
700
+						'%sThere are currently no registration records in the last month for this report.%s',
701
+						'event_espresso'
702
+					)
703
+				),
704
+				'<h2>' . $report_title . '</h2><p>',
705
+				'</p>'
706
+			),
707
+		);
708
+		wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
709
+		return $report_ID;
710
+	}
711 711
 
712 712
 
713
-    /**
714
-     * Generates Business Report showing total registrations per event.
715
-     *
716
-     * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
717
-     * @return string
718
-     * @throws EE_Error
719
-     * @throws InvalidArgumentException
720
-     * @throws InvalidDataTypeException
721
-     * @throws InvalidInterfaceException
722
-     */
723
-    private function _registrations_per_event_report($period = '-1 month')
724
-    {
725
-        $report_ID = 'reg-admin-registrations-per-event-report-dv';
726
-        $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
727
-        $results = (array) $results;
728
-        $regs = array();
729
-        $subtitle = '';
730
-        if ($results) {
731
-            $column_titles = array();
732
-            $tracker = 0;
733
-            foreach ($results as $result) {
734
-                $report_column_values = array();
735
-                foreach ($result as $property_name => $property_value) {
736
-                    $property_value = $property_name === 'Registration_Event' ? wp_trim_words(
737
-                        $property_value,
738
-                        4,
739
-                        '...'
740
-                    ) : (int) $property_value;
741
-                    $report_column_values[] = $property_value;
742
-                    if ($tracker === 0) {
743
-                        if ($property_name === 'Registration_Event') {
744
-                            $column_titles[] = esc_html__('Event', 'event_espresso');
745
-                        } else {
746
-                            $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
747
-                        }
748
-                    }
749
-                }
750
-                $tracker++;
751
-                $regs[] = $report_column_values;
752
-            }
753
-            // make sure the column_titles is pushed to the beginning of the array
754
-            array_unshift($regs, $column_titles);
755
-            // setup the date range.
756
-            $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
757
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
758
-            $ending_date = new DateTime("now", $DateTimeZone);
759
-            $subtitle = sprintf(
760
-                wp_strip_all_tags(
761
-                    _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso')
762
-                ),
763
-                $beginning_date->format('Y-m-d'),
764
-                $ending_date->format('Y-m-d')
765
-            );
766
-        }
767
-        $report_title = wp_strip_all_tags(__('Total Registrations per Event', 'event_espresso'));
768
-        $report_params = array(
769
-            'title'     => $report_title,
770
-            'subtitle'  => $subtitle,
771
-            'id'        => $report_ID,
772
-            'regs'      => $regs,
773
-            'noResults' => empty($regs),
774
-            'noRegsMsg' => sprintf(
775
-                wp_strip_all_tags(
776
-                    __(
777
-                        '%sThere are currently no registration records in the last month for this report.%s',
778
-                        'event_espresso'
779
-                    )
780
-                ),
781
-                '<h2>' . $report_title . '</h2><p>',
782
-                '</p>'
783
-            ),
784
-        );
785
-        wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
786
-        return $report_ID;
787
-    }
713
+	/**
714
+	 * Generates Business Report showing total registrations per event.
715
+	 *
716
+	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
717
+	 * @return string
718
+	 * @throws EE_Error
719
+	 * @throws InvalidArgumentException
720
+	 * @throws InvalidDataTypeException
721
+	 * @throws InvalidInterfaceException
722
+	 */
723
+	private function _registrations_per_event_report($period = '-1 month')
724
+	{
725
+		$report_ID = 'reg-admin-registrations-per-event-report-dv';
726
+		$results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
727
+		$results = (array) $results;
728
+		$regs = array();
729
+		$subtitle = '';
730
+		if ($results) {
731
+			$column_titles = array();
732
+			$tracker = 0;
733
+			foreach ($results as $result) {
734
+				$report_column_values = array();
735
+				foreach ($result as $property_name => $property_value) {
736
+					$property_value = $property_name === 'Registration_Event' ? wp_trim_words(
737
+						$property_value,
738
+						4,
739
+						'...'
740
+					) : (int) $property_value;
741
+					$report_column_values[] = $property_value;
742
+					if ($tracker === 0) {
743
+						if ($property_name === 'Registration_Event') {
744
+							$column_titles[] = esc_html__('Event', 'event_espresso');
745
+						} else {
746
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
747
+						}
748
+					}
749
+				}
750
+				$tracker++;
751
+				$regs[] = $report_column_values;
752
+			}
753
+			// make sure the column_titles is pushed to the beginning of the array
754
+			array_unshift($regs, $column_titles);
755
+			// setup the date range.
756
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
757
+			$beginning_date = new DateTime("now " . $period, $DateTimeZone);
758
+			$ending_date = new DateTime("now", $DateTimeZone);
759
+			$subtitle = sprintf(
760
+				wp_strip_all_tags(
761
+					_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso')
762
+				),
763
+				$beginning_date->format('Y-m-d'),
764
+				$ending_date->format('Y-m-d')
765
+			);
766
+		}
767
+		$report_title = wp_strip_all_tags(__('Total Registrations per Event', 'event_espresso'));
768
+		$report_params = array(
769
+			'title'     => $report_title,
770
+			'subtitle'  => $subtitle,
771
+			'id'        => $report_ID,
772
+			'regs'      => $regs,
773
+			'noResults' => empty($regs),
774
+			'noRegsMsg' => sprintf(
775
+				wp_strip_all_tags(
776
+					__(
777
+						'%sThere are currently no registration records in the last month for this report.%s',
778
+						'event_espresso'
779
+					)
780
+				),
781
+				'<h2>' . $report_title . '</h2><p>',
782
+				'</p>'
783
+			),
784
+		);
785
+		wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
786
+		return $report_ID;
787
+	}
788 788
 
789 789
 
790
-    /**
791
-     * generates HTML for the Registration Check-in list table (showing all Check-ins for a specific registration)
792
-     *
793
-     * @access protected
794
-     * @return void
795
-     * @throws EE_Error
796
-     * @throws InvalidArgumentException
797
-     * @throws InvalidDataTypeException
798
-     * @throws InvalidInterfaceException
799
-     * @throws \EventEspresso\core\exceptions\EntityNotFoundException
800
-     */
801
-    protected function _registration_checkin_list_table()
802
-    {
803
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
804
-        $reg_id = isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : null;
805
-        /** @var EE_Registration $registration */
806
-        $registration = EEM_Registration::instance()->get_one_by_ID($reg_id);
807
-        $attendee = $registration->attendee();
808
-        $this->_admin_page_title .= $this->get_action_link_or_button(
809
-            'new_registration',
810
-            'add-registrant',
811
-            array('event_id' => $registration->event_ID()),
812
-            'add-new-h2'
813
-        );
814
-        $checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
815
-        $checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
816
-        $legend_items = array(
817
-            'checkin'  => array(
818
-                'class' => $checked_in->cssClasses(),
819
-                'desc'  => $checked_in->legendLabel(),
820
-            ),
821
-            'checkout' => array(
822
-                'class' => $checked_out->cssClasses(),
823
-                'desc'  => $checked_out->legendLabel(),
824
-            ),
825
-        );
826
-        $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
827
-        $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
828
-        /** @var EE_Datetime $datetime */
829
-        $datetime = EEM_Datetime::instance()->get_one_by_ID($dtt_id);
830
-        $datetime_label = '';
831
-        if ($datetime instanceof EE_Datetime) {
832
-            $datetime_label = $datetime->get_dtt_display_name(true);
833
-            $datetime_label .= ! empty($datetime_label)
834
-                ? ' (' . $datetime->get_dtt_display_name() . ')'
835
-                : $datetime->get_dtt_display_name();
836
-        }
837
-        $datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration
838
-            ? EE_Admin_Page::add_query_args_and_nonce(
839
-                array(
840
-                    'action'   => 'event_registrations',
841
-                    'event_id' => $registration->event_ID(),
842
-                    'DTT_ID'   => $dtt_id,
843
-                ),
844
-                $this->_admin_base_url
845
-            )
846
-            : '';
847
-        $datetime_link = ! empty($datetime_link)
848
-            ? '<a href="' . $datetime_link . '">'
849
-              . '<span id="checkin-dtt">'
850
-              . $datetime_label
851
-              . '</span></a>'
852
-            : $datetime_label;
853
-        $attendee_name = $attendee instanceof EE_Attendee
854
-            ? $attendee->full_name()
855
-            : '';
856
-        $attendee_link = $attendee instanceof EE_Attendee
857
-            ? $attendee->get_admin_details_link()
858
-            : '';
859
-        $attendee_link = ! empty($attendee_link)
860
-            ? '<a href="' . $attendee->get_admin_details_link() . '"'
861
-              . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">'
862
-              . '<span id="checkin-attendee-name">'
863
-              . $attendee_name
864
-              . '</span></a>'
865
-            : '';
866
-        $event_link = $registration->event() instanceof EE_Event
867
-            ? $registration->event()->get_admin_details_link()
868
-            : '';
869
-        $event_link = ! empty($event_link)
870
-            ? '<a href="' . $event_link . '"'
871
-              . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">'
872
-              . '<span id="checkin-event-name">'
873
-              . $registration->event_name()
874
-              . '</span>'
875
-              . '</a>'
876
-            : '';
877
-        $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
878
-            ? '<h2>' . sprintf(
879
-                esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'),
880
-                $attendee_link,
881
-                $datetime_link,
882
-                $event_link
883
-            ) . '</h2>'
884
-            : '';
885
-        $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
886
-            ? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : '';
887
-        $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
888
-            ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
889
-        $this->display_admin_list_table_page_with_no_sidebar();
890
-    }
790
+	/**
791
+	 * generates HTML for the Registration Check-in list table (showing all Check-ins for a specific registration)
792
+	 *
793
+	 * @access protected
794
+	 * @return void
795
+	 * @throws EE_Error
796
+	 * @throws InvalidArgumentException
797
+	 * @throws InvalidDataTypeException
798
+	 * @throws InvalidInterfaceException
799
+	 * @throws \EventEspresso\core\exceptions\EntityNotFoundException
800
+	 */
801
+	protected function _registration_checkin_list_table()
802
+	{
803
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
804
+		$reg_id = isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : null;
805
+		/** @var EE_Registration $registration */
806
+		$registration = EEM_Registration::instance()->get_one_by_ID($reg_id);
807
+		$attendee = $registration->attendee();
808
+		$this->_admin_page_title .= $this->get_action_link_or_button(
809
+			'new_registration',
810
+			'add-registrant',
811
+			array('event_id' => $registration->event_ID()),
812
+			'add-new-h2'
813
+		);
814
+		$checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
815
+		$checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
816
+		$legend_items = array(
817
+			'checkin'  => array(
818
+				'class' => $checked_in->cssClasses(),
819
+				'desc'  => $checked_in->legendLabel(),
820
+			),
821
+			'checkout' => array(
822
+				'class' => $checked_out->cssClasses(),
823
+				'desc'  => $checked_out->legendLabel(),
824
+			),
825
+		);
826
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
827
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
828
+		/** @var EE_Datetime $datetime */
829
+		$datetime = EEM_Datetime::instance()->get_one_by_ID($dtt_id);
830
+		$datetime_label = '';
831
+		if ($datetime instanceof EE_Datetime) {
832
+			$datetime_label = $datetime->get_dtt_display_name(true);
833
+			$datetime_label .= ! empty($datetime_label)
834
+				? ' (' . $datetime->get_dtt_display_name() . ')'
835
+				: $datetime->get_dtt_display_name();
836
+		}
837
+		$datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration
838
+			? EE_Admin_Page::add_query_args_and_nonce(
839
+				array(
840
+					'action'   => 'event_registrations',
841
+					'event_id' => $registration->event_ID(),
842
+					'DTT_ID'   => $dtt_id,
843
+				),
844
+				$this->_admin_base_url
845
+			)
846
+			: '';
847
+		$datetime_link = ! empty($datetime_link)
848
+			? '<a href="' . $datetime_link . '">'
849
+			  . '<span id="checkin-dtt">'
850
+			  . $datetime_label
851
+			  . '</span></a>'
852
+			: $datetime_label;
853
+		$attendee_name = $attendee instanceof EE_Attendee
854
+			? $attendee->full_name()
855
+			: '';
856
+		$attendee_link = $attendee instanceof EE_Attendee
857
+			? $attendee->get_admin_details_link()
858
+			: '';
859
+		$attendee_link = ! empty($attendee_link)
860
+			? '<a href="' . $attendee->get_admin_details_link() . '"'
861
+			  . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">'
862
+			  . '<span id="checkin-attendee-name">'
863
+			  . $attendee_name
864
+			  . '</span></a>'
865
+			: '';
866
+		$event_link = $registration->event() instanceof EE_Event
867
+			? $registration->event()->get_admin_details_link()
868
+			: '';
869
+		$event_link = ! empty($event_link)
870
+			? '<a href="' . $event_link . '"'
871
+			  . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">'
872
+			  . '<span id="checkin-event-name">'
873
+			  . $registration->event_name()
874
+			  . '</span>'
875
+			  . '</a>'
876
+			: '';
877
+		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
878
+			? '<h2>' . sprintf(
879
+				esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'),
880
+				$attendee_link,
881
+				$datetime_link,
882
+				$event_link
883
+			) . '</h2>'
884
+			: '';
885
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
886
+			? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : '';
887
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
888
+			? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
889
+		$this->display_admin_list_table_page_with_no_sidebar();
890
+	}
891 891
 
892 892
 
893
-    /**
894
-     * toggle the Check-in status for the given registration (coming from ajax)
895
-     *
896
-     * @return void (JSON)
897
-     * @throws EE_Error
898
-     * @throws InvalidArgumentException
899
-     * @throws InvalidDataTypeException
900
-     * @throws InvalidInterfaceException
901
-     */
902
-    public function toggle_checkin_status()
903
-    {
904
-        // first make sure we have the necessary data
905
-        if (! isset($this->_req_data['_regid'])) {
906
-            EE_Error::add_error(
907
-                esc_html__(
908
-                    'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax',
909
-                    'event_espresso'
910
-                ),
911
-                __FILE__,
912
-                __FUNCTION__,
913
-                __LINE__
914
-            );
915
-            $this->_template_args['success'] = false;
916
-            $this->_template_args['error'] = true;
917
-            $this->_return_json();
918
-        };
919
-        // do a nonce check cause we're not coming in from an normal route here.
920
-        $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce'])
921
-            : '';
922
-        $nonce_ref = 'checkin_nonce';
923
-        $this->_verify_nonce($nonce, $nonce_ref);
924
-        // beautiful! Made it this far so let's get the status.
925
-        $new_status = new CheckinStatusDashicon($this->_toggle_checkin_status());
926
-        // setup new class to return via ajax
927
-        $this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses();
928
-        $this->_template_args['success'] = true;
929
-        $this->_return_json();
930
-    }
893
+	/**
894
+	 * toggle the Check-in status for the given registration (coming from ajax)
895
+	 *
896
+	 * @return void (JSON)
897
+	 * @throws EE_Error
898
+	 * @throws InvalidArgumentException
899
+	 * @throws InvalidDataTypeException
900
+	 * @throws InvalidInterfaceException
901
+	 */
902
+	public function toggle_checkin_status()
903
+	{
904
+		// first make sure we have the necessary data
905
+		if (! isset($this->_req_data['_regid'])) {
906
+			EE_Error::add_error(
907
+				esc_html__(
908
+					'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax',
909
+					'event_espresso'
910
+				),
911
+				__FILE__,
912
+				__FUNCTION__,
913
+				__LINE__
914
+			);
915
+			$this->_template_args['success'] = false;
916
+			$this->_template_args['error'] = true;
917
+			$this->_return_json();
918
+		};
919
+		// do a nonce check cause we're not coming in from an normal route here.
920
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce'])
921
+			: '';
922
+		$nonce_ref = 'checkin_nonce';
923
+		$this->_verify_nonce($nonce, $nonce_ref);
924
+		// beautiful! Made it this far so let's get the status.
925
+		$new_status = new CheckinStatusDashicon($this->_toggle_checkin_status());
926
+		// setup new class to return via ajax
927
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses();
928
+		$this->_template_args['success'] = true;
929
+		$this->_return_json();
930
+	}
931 931
 
932 932
 
933
-    /**
934
-     * handles toggling the checkin status for the registration,
935
-     *
936
-     * @access protected
937
-     * @return int|void
938
-     * @throws EE_Error
939
-     * @throws InvalidArgumentException
940
-     * @throws InvalidDataTypeException
941
-     * @throws InvalidInterfaceException
942
-     */
943
-    protected function _toggle_checkin_status()
944
-    {
945
-        // first let's get the query args out of the way for the redirect
946
-        $query_args = array(
947
-            'action'   => 'event_registrations',
948
-            'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
949
-            'DTT_ID'   => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null,
950
-        );
951
-        $new_status = false;
952
-        // bulk action check in toggle
953
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
954
-            // cycle thru checkboxes
955
-            while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
956
-                $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
957
-                $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
958
-            }
959
-        } elseif (isset($this->_req_data['_regid'])) {
960
-            // coming from ajax request
961
-            $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null;
962
-            $query_args['DTT_ID'] = $DTT_ID;
963
-            $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
964
-        } else {
965
-            EE_Error::add_error(
966
-                esc_html__('Missing some required data to toggle the Check-in', 'event_espresso'),
967
-                __FILE__,
968
-                __FUNCTION__,
969
-                __LINE__
970
-            );
971
-        }
972
-        if (defined('DOING_AJAX')) {
973
-            return $new_status;
974
-        }
975
-        $this->_redirect_after_action(false, '', '', $query_args, true);
976
-    }
933
+	/**
934
+	 * handles toggling the checkin status for the registration,
935
+	 *
936
+	 * @access protected
937
+	 * @return int|void
938
+	 * @throws EE_Error
939
+	 * @throws InvalidArgumentException
940
+	 * @throws InvalidDataTypeException
941
+	 * @throws InvalidInterfaceException
942
+	 */
943
+	protected function _toggle_checkin_status()
944
+	{
945
+		// first let's get the query args out of the way for the redirect
946
+		$query_args = array(
947
+			'action'   => 'event_registrations',
948
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
949
+			'DTT_ID'   => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null,
950
+		);
951
+		$new_status = false;
952
+		// bulk action check in toggle
953
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
954
+			// cycle thru checkboxes
955
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
956
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
957
+				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
958
+			}
959
+		} elseif (isset($this->_req_data['_regid'])) {
960
+			// coming from ajax request
961
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null;
962
+			$query_args['DTT_ID'] = $DTT_ID;
963
+			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
964
+		} else {
965
+			EE_Error::add_error(
966
+				esc_html__('Missing some required data to toggle the Check-in', 'event_espresso'),
967
+				__FILE__,
968
+				__FUNCTION__,
969
+				__LINE__
970
+			);
971
+		}
972
+		if (defined('DOING_AJAX')) {
973
+			return $new_status;
974
+		}
975
+		$this->_redirect_after_action(false, '', '', $query_args, true);
976
+	}
977 977
 
978 978
 
979
-    /**
980
-     * This is toggles a single Check-in for the given registration and datetime.
981
-     *
982
-     * @param  int $REG_ID The registration we're toggling
983
-     * @param  int $DTT_ID The datetime we're toggling
984
-     * @return int The new status toggled to.
985
-     * @throws EE_Error
986
-     * @throws InvalidArgumentException
987
-     * @throws InvalidDataTypeException
988
-     * @throws InvalidInterfaceException
989
-     */
990
-    private function _toggle_checkin($REG_ID, $DTT_ID)
991
-    {
992
-        /** @var EE_Registration $REG */
993
-        $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
994
-        $new_status = $REG->toggle_checkin_status($DTT_ID);
995
-        if ($new_status !== false) {
996
-            EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
997
-        } else {
998
-            EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__);
999
-            $new_status = false;
1000
-        }
1001
-        return $new_status;
1002
-    }
979
+	/**
980
+	 * This is toggles a single Check-in for the given registration and datetime.
981
+	 *
982
+	 * @param  int $REG_ID The registration we're toggling
983
+	 * @param  int $DTT_ID The datetime we're toggling
984
+	 * @return int The new status toggled to.
985
+	 * @throws EE_Error
986
+	 * @throws InvalidArgumentException
987
+	 * @throws InvalidDataTypeException
988
+	 * @throws InvalidInterfaceException
989
+	 */
990
+	private function _toggle_checkin($REG_ID, $DTT_ID)
991
+	{
992
+		/** @var EE_Registration $REG */
993
+		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
994
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
995
+		if ($new_status !== false) {
996
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
997
+		} else {
998
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__);
999
+			$new_status = false;
1000
+		}
1001
+		return $new_status;
1002
+	}
1003 1003
 
1004 1004
 
1005
-    /**
1006
-     * Takes care of deleting multiple EE_Checkin table rows
1007
-     *
1008
-     * @access protected
1009
-     * @return void
1010
-     * @throws EE_Error
1011
-     * @throws InvalidArgumentException
1012
-     * @throws InvalidDataTypeException
1013
-     * @throws InvalidInterfaceException
1014
-     */
1015
-    protected function _delete_checkin_rows()
1016
-    {
1017
-        $query_args = array(
1018
-            'action'  => 'registration_checkins',
1019
-            'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1020
-            '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1021
-        );
1022
-        $errors = 0;
1023
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1024
-            while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
1025
-                if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
1026
-                    $errors++;
1027
-                }
1028
-            }
1029
-        } else {
1030
-            EE_Error::add_error(
1031
-                esc_html__(
1032
-                    'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!',
1033
-                    'event_espresso'
1034
-                ),
1035
-                __FILE__,
1036
-                __FUNCTION__,
1037
-                __LINE__
1038
-            );
1039
-            $this->_redirect_after_action(false, '', '', $query_args, true);
1040
-        }
1041
-        if ($errors > 0) {
1042
-            EE_Error::add_error(
1043
-                sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors),
1044
-                __FILE__,
1045
-                __FUNCTION__,
1046
-                __LINE__
1047
-            );
1048
-        } else {
1049
-            EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
1050
-        }
1051
-        $this->_redirect_after_action(false, '', '', $query_args, true);
1052
-    }
1005
+	/**
1006
+	 * Takes care of deleting multiple EE_Checkin table rows
1007
+	 *
1008
+	 * @access protected
1009
+	 * @return void
1010
+	 * @throws EE_Error
1011
+	 * @throws InvalidArgumentException
1012
+	 * @throws InvalidDataTypeException
1013
+	 * @throws InvalidInterfaceException
1014
+	 */
1015
+	protected function _delete_checkin_rows()
1016
+	{
1017
+		$query_args = array(
1018
+			'action'  => 'registration_checkins',
1019
+			'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1020
+			'_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1021
+		);
1022
+		$errors = 0;
1023
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1024
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
1025
+				if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
1026
+					$errors++;
1027
+				}
1028
+			}
1029
+		} else {
1030
+			EE_Error::add_error(
1031
+				esc_html__(
1032
+					'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!',
1033
+					'event_espresso'
1034
+				),
1035
+				__FILE__,
1036
+				__FUNCTION__,
1037
+				__LINE__
1038
+			);
1039
+			$this->_redirect_after_action(false, '', '', $query_args, true);
1040
+		}
1041
+		if ($errors > 0) {
1042
+			EE_Error::add_error(
1043
+				sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors),
1044
+				__FILE__,
1045
+				__FUNCTION__,
1046
+				__LINE__
1047
+			);
1048
+		} else {
1049
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
1050
+		}
1051
+		$this->_redirect_after_action(false, '', '', $query_args, true);
1052
+	}
1053 1053
 
1054 1054
 
1055
-    /**
1056
-     * Deletes a single EE_Checkin row
1057
-     *
1058
-     * @return void
1059
-     * @throws EE_Error
1060
-     * @throws InvalidArgumentException
1061
-     * @throws InvalidDataTypeException
1062
-     * @throws InvalidInterfaceException
1063
-     */
1064
-    protected function _delete_checkin_row()
1065
-    {
1066
-        $query_args = array(
1067
-            'action'  => 'registration_checkins',
1068
-            'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1069
-            '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1070
-        );
1071
-        if (! empty($this->_req_data['CHK_ID'])) {
1072
-            if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
1073
-                EE_Error::add_error(
1074
-                    esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'),
1075
-                    __FILE__,
1076
-                    __FUNCTION__,
1077
-                    __LINE__
1078
-                );
1079
-            } else {
1080
-                EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
1081
-            }
1082
-        } else {
1083
-            EE_Error::add_error(
1084
-                esc_html__(
1085
-                    'In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code',
1086
-                    'event_espresso'
1087
-                ),
1088
-                __FILE__,
1089
-                __FUNCTION__,
1090
-                __LINE__
1091
-            );
1092
-        }
1093
-        $this->_redirect_after_action(false, '', '', $query_args, true);
1094
-    }
1055
+	/**
1056
+	 * Deletes a single EE_Checkin row
1057
+	 *
1058
+	 * @return void
1059
+	 * @throws EE_Error
1060
+	 * @throws InvalidArgumentException
1061
+	 * @throws InvalidDataTypeException
1062
+	 * @throws InvalidInterfaceException
1063
+	 */
1064
+	protected function _delete_checkin_row()
1065
+	{
1066
+		$query_args = array(
1067
+			'action'  => 'registration_checkins',
1068
+			'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1069
+			'_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1070
+		);
1071
+		if (! empty($this->_req_data['CHK_ID'])) {
1072
+			if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
1073
+				EE_Error::add_error(
1074
+					esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'),
1075
+					__FILE__,
1076
+					__FUNCTION__,
1077
+					__LINE__
1078
+				);
1079
+			} else {
1080
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
1081
+			}
1082
+		} else {
1083
+			EE_Error::add_error(
1084
+				esc_html__(
1085
+					'In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code',
1086
+					'event_espresso'
1087
+				),
1088
+				__FILE__,
1089
+				__FUNCTION__,
1090
+				__LINE__
1091
+			);
1092
+		}
1093
+		$this->_redirect_after_action(false, '', '', $query_args, true);
1094
+	}
1095 1095
 
1096 1096
 
1097
-    /**
1098
-     *        generates HTML for the Event Registrations List Table
1099
-     *
1100
-     * @access protected
1101
-     * @return void
1102
-     * @throws EE_Error
1103
-     * @throws InvalidArgumentException
1104
-     * @throws InvalidDataTypeException
1105
-     * @throws InvalidInterfaceException
1106
-     */
1107
-    protected function _event_registrations_list_table()
1108
-    {
1109
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1110
-        $this->_admin_page_title .= isset($this->_req_data['event_id'])
1111
-            ? $this->get_action_link_or_button(
1112
-                'new_registration',
1113
-                'add-registrant',
1114
-                array('event_id' => $this->_req_data['event_id']),
1115
-                'add-new-h2',
1116
-                '',
1117
-                false
1118
-            )
1119
-            : '';
1120
-        $checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
1121
-        $checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
1122
-        $checked_never = new CheckinStatusDashicon(EE_Checkin::status_checked_never);
1123
-        $legend_items = array(
1124
-            'star-icon'        => array(
1125
-                'class' => 'dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8',
1126
-                'desc'  => esc_html__('This Registrant is the Primary Registrant', 'event_espresso'),
1127
-            ),
1128
-            'checkin'          => array(
1129
-                'class' => $checked_in->cssClasses(),
1130
-                'desc'  => $checked_in->legendLabel(),
1131
-            ),
1132
-            'checkout'         => array(
1133
-                'class' => $checked_out->cssClasses(),
1134
-                'desc'  => $checked_out->legendLabel(),
1135
-            ),
1136
-            'nocheckinrecord'  => array(
1137
-                'class' => $checked_never->cssClasses(),
1138
-                'desc'  => $checked_never->legendLabel(),
1139
-            ),
1140
-            'approved_status'  => array(
1141
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1142
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1143
-            ),
1144
-            'cancelled_status' => array(
1145
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1146
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1147
-            ),
1148
-            'declined_status'  => array(
1149
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1150
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1151
-            ),
1152
-            'not_approved'     => array(
1153
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1154
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1155
-            ),
1156
-            'pending_status'   => array(
1157
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1158
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1159
-            ),
1160
-            'wait_list'        => array(
1161
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1162
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1163
-            ),
1164
-        );
1165
-        $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
1166
-        $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
1167
-        /** @var EE_Event $event */
1168
-        $event = EEM_Event::instance()->get_one_by_ID($event_id);
1169
-        $this->_template_args['before_list_table'] = $event instanceof EE_Event
1170
-            ? '<h2>' . sprintf(
1171
-                esc_html__('Viewing Registrations for Event: %s', 'event_espresso'),
1172
-                EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1173
-            ) . '</h2>'
1174
-            : '';
1175
-        // need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on
1176
-        // the event.
1177
-        $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0;
1178
-        $datetime = null;
1179
-        if ($event instanceof EE_Event) {
1180
-            $datetimes_on_event = $event->datetimes();
1181
-            if (count($datetimes_on_event) === 1) {
1182
-                $datetime = reset($datetimes_on_event);
1183
-            }
1184
-        }
1185
-        $datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
1186
-        if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') {
1187
-            $this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5);
1188
-            $this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1189
-            $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1190
-            $this->_template_args['before_list_table'] .= $datetime->name();
1191
-            $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1192
-            $this->_template_args['before_list_table'] .= '</span></h2>';
1193
-        }
1194
-        // if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status
1195
-        // column represents
1196
-        if (! $datetime instanceof EE_Datetime) {
1197
-            $this->_template_args['before_list_table'] .= '<br><p class="description">'
1198
-                                                          . esc_html__(
1199
-                                                              'In this view, the check-in status represents the latest check-in record for the registration in that row.',
1200
-                                                              'event_espresso'
1201
-                                                          )
1202
-                                                          . '</p>';
1203
-        }
1204
-        $this->display_admin_list_table_page_with_no_sidebar();
1205
-    }
1097
+	/**
1098
+	 *        generates HTML for the Event Registrations List Table
1099
+	 *
1100
+	 * @access protected
1101
+	 * @return void
1102
+	 * @throws EE_Error
1103
+	 * @throws InvalidArgumentException
1104
+	 * @throws InvalidDataTypeException
1105
+	 * @throws InvalidInterfaceException
1106
+	 */
1107
+	protected function _event_registrations_list_table()
1108
+	{
1109
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1110
+		$this->_admin_page_title .= isset($this->_req_data['event_id'])
1111
+			? $this->get_action_link_or_button(
1112
+				'new_registration',
1113
+				'add-registrant',
1114
+				array('event_id' => $this->_req_data['event_id']),
1115
+				'add-new-h2',
1116
+				'',
1117
+				false
1118
+			)
1119
+			: '';
1120
+		$checked_in = new CheckinStatusDashicon(EE_Checkin::status_checked_in);
1121
+		$checked_out = new CheckinStatusDashicon(EE_Checkin::status_checked_out);
1122
+		$checked_never = new CheckinStatusDashicon(EE_Checkin::status_checked_never);
1123
+		$legend_items = array(
1124
+			'star-icon'        => array(
1125
+				'class' => 'dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8',
1126
+				'desc'  => esc_html__('This Registrant is the Primary Registrant', 'event_espresso'),
1127
+			),
1128
+			'checkin'          => array(
1129
+				'class' => $checked_in->cssClasses(),
1130
+				'desc'  => $checked_in->legendLabel(),
1131
+			),
1132
+			'checkout'         => array(
1133
+				'class' => $checked_out->cssClasses(),
1134
+				'desc'  => $checked_out->legendLabel(),
1135
+			),
1136
+			'nocheckinrecord'  => array(
1137
+				'class' => $checked_never->cssClasses(),
1138
+				'desc'  => $checked_never->legendLabel(),
1139
+			),
1140
+			'approved_status'  => array(
1141
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1142
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1143
+			),
1144
+			'cancelled_status' => array(
1145
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1146
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1147
+			),
1148
+			'declined_status'  => array(
1149
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1150
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1151
+			),
1152
+			'not_approved'     => array(
1153
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1154
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1155
+			),
1156
+			'pending_status'   => array(
1157
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1158
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1159
+			),
1160
+			'wait_list'        => array(
1161
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1162
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1163
+			),
1164
+		);
1165
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
1166
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
1167
+		/** @var EE_Event $event */
1168
+		$event = EEM_Event::instance()->get_one_by_ID($event_id);
1169
+		$this->_template_args['before_list_table'] = $event instanceof EE_Event
1170
+			? '<h2>' . sprintf(
1171
+				esc_html__('Viewing Registrations for Event: %s', 'event_espresso'),
1172
+				EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1173
+			) . '</h2>'
1174
+			: '';
1175
+		// need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on
1176
+		// the event.
1177
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0;
1178
+		$datetime = null;
1179
+		if ($event instanceof EE_Event) {
1180
+			$datetimes_on_event = $event->datetimes();
1181
+			if (count($datetimes_on_event) === 1) {
1182
+				$datetime = reset($datetimes_on_event);
1183
+			}
1184
+		}
1185
+		$datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
1186
+		if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') {
1187
+			$this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5);
1188
+			$this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1189
+			$this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1190
+			$this->_template_args['before_list_table'] .= $datetime->name();
1191
+			$this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1192
+			$this->_template_args['before_list_table'] .= '</span></h2>';
1193
+		}
1194
+		// if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status
1195
+		// column represents
1196
+		if (! $datetime instanceof EE_Datetime) {
1197
+			$this->_template_args['before_list_table'] .= '<br><p class="description">'
1198
+														  . esc_html__(
1199
+															  'In this view, the check-in status represents the latest check-in record for the registration in that row.',
1200
+															  'event_espresso'
1201
+														  )
1202
+														  . '</p>';
1203
+		}
1204
+		$this->display_admin_list_table_page_with_no_sidebar();
1205
+	}
1206 1206
 
1207
-    /**
1208
-     * Download the registrations check-in report (same as the normal registration report, but with different where
1209
-     * conditions)
1210
-     *
1211
-     * @return void ends the request by a redirect or download
1212
-     */
1213
-    public function _registrations_checkin_report()
1214
-    {
1215
-        $this->_registrations_report_base('_get_checkin_query_params_from_request');
1216
-    }
1207
+	/**
1208
+	 * Download the registrations check-in report (same as the normal registration report, but with different where
1209
+	 * conditions)
1210
+	 *
1211
+	 * @return void ends the request by a redirect or download
1212
+	 */
1213
+	public function _registrations_checkin_report()
1214
+	{
1215
+		$this->_registrations_report_base('_get_checkin_query_params_from_request');
1216
+	}
1217 1217
 
1218
-    /**
1219
-     * Gets the query params from the request, plus adds a where condition for the registration status,
1220
-     * because on the checkin page we only ever want to see approved and pending-approval registrations
1221
-     *
1222
-     * @param array $request
1223
-     * @param int   $per_page
1224
-     * @param bool  $count
1225
-     * @return array
1226
-     * @throws EE_Error
1227
-     */
1228
-    protected function _get_checkin_query_params_from_request(
1229
-        $request,
1230
-        $per_page = 10,
1231
-        $count = false
1232
-    ) {
1233
-        $query_params = $this->_get_registration_query_parameters($request, $per_page, $count);
1234
-        // unlike the regular registrations list table,
1235
-        $status_ids_array = apply_filters(
1236
-            'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
1237
-            array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
1238
-        );
1239
-        $query_params[0]['STS_ID'] = array('IN', $status_ids_array);
1240
-        return $query_params;
1241
-    }
1218
+	/**
1219
+	 * Gets the query params from the request, plus adds a where condition for the registration status,
1220
+	 * because on the checkin page we only ever want to see approved and pending-approval registrations
1221
+	 *
1222
+	 * @param array $request
1223
+	 * @param int   $per_page
1224
+	 * @param bool  $count
1225
+	 * @return array
1226
+	 * @throws EE_Error
1227
+	 */
1228
+	protected function _get_checkin_query_params_from_request(
1229
+		$request,
1230
+		$per_page = 10,
1231
+		$count = false
1232
+	) {
1233
+		$query_params = $this->_get_registration_query_parameters($request, $per_page, $count);
1234
+		// unlike the regular registrations list table,
1235
+		$status_ids_array = apply_filters(
1236
+			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
1237
+			array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
1238
+		);
1239
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
1240
+		return $query_params;
1241
+	}
1242 1242
 
1243 1243
 
1244
-    /**
1245
-     * Gets registrations for an event
1246
-     *
1247
-     * @param int    $per_page
1248
-     * @param bool   $count whether to return count or data.
1249
-     * @param bool   $trash
1250
-     * @param string $orderby
1251
-     * @return EE_Registration[]|int
1252
-     * @throws EE_Error
1253
-     * @throws InvalidArgumentException
1254
-     * @throws InvalidDataTypeException
1255
-     * @throws InvalidInterfaceException
1256
-     */
1257
-    public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = 'ATT_fname')
1258
-    {
1259
-        // normalize some request params that get setup by the parent `get_registrations` method.
1260
-        $request = $this->_req_data;
1261
-        $request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
1262
-        $request['order'] = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
1263
-        if ($trash) {
1264
-            $request['status'] = 'trash';
1265
-        }
1266
-        $query_params = $this->_get_checkin_query_params_from_request($request, $per_page, $count);
1267
-        /**
1268
-         * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1269
-         *
1270
-         * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
1271
-         * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
1272
-         *                             or if you have the development copy of EE you can view this at the path:
1273
-         *                             /docs/G--Model-System/model-query-params.md
1274
-         */
1275
-        $query_params['group_by'] = '';
1244
+	/**
1245
+	 * Gets registrations for an event
1246
+	 *
1247
+	 * @param int    $per_page
1248
+	 * @param bool   $count whether to return count or data.
1249
+	 * @param bool   $trash
1250
+	 * @param string $orderby
1251
+	 * @return EE_Registration[]|int
1252
+	 * @throws EE_Error
1253
+	 * @throws InvalidArgumentException
1254
+	 * @throws InvalidDataTypeException
1255
+	 * @throws InvalidInterfaceException
1256
+	 */
1257
+	public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = 'ATT_fname')
1258
+	{
1259
+		// normalize some request params that get setup by the parent `get_registrations` method.
1260
+		$request = $this->_req_data;
1261
+		$request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
1262
+		$request['order'] = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
1263
+		if ($trash) {
1264
+			$request['status'] = 'trash';
1265
+		}
1266
+		$query_params = $this->_get_checkin_query_params_from_request($request, $per_page, $count);
1267
+		/**
1268
+		 * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1269
+		 *
1270
+		 * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
1271
+		 * @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
1272
+		 *                             or if you have the development copy of EE you can view this at the path:
1273
+		 *                             /docs/G--Model-System/model-query-params.md
1274
+		 */
1275
+		$query_params['group_by'] = '';
1276 1276
 
1277
-        return $count
1278
-            ? EEM_Registration::instance()->count($query_params)
1279
-            /** @type EE_Registration[] */
1280
-            : EEM_Registration::instance()->get_all($query_params);
1281
-    }
1277
+		return $count
1278
+			? EEM_Registration::instance()->count($query_params)
1279
+			/** @type EE_Registration[] */
1280
+			: EEM_Registration::instance()->get_all($query_params);
1281
+	}
1282 1282
 }
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
     public function __construct($routing = true)
33 33
     {
34 34
         parent::__construct($routing);
35
-        if (! defined('REG_CAF_TEMPLATE_PATH')) {
36
-            define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
37
-            define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
38
-            define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
35
+        if ( ! defined('REG_CAF_TEMPLATE_PATH')) {
36
+            define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/');
37
+            define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/');
38
+            define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/');
39 39
         }
40 40
     }
41 41
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     protected function _extend_page_config()
47 47
     {
48
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
48
+        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';
49 49
         $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID'])
50 50
             ? $this->_req_data['_REG_ID']
51 51
             : 0;
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
             // enqueue newsletter js
186 186
             wp_enqueue_script(
187 187
                 'ee-newsletter-trigger',
188
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
188
+                REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js',
189 189
                 array('ee-dialog'),
190 190
                 EVENT_ESPRESSO_VERSION,
191 191
                 true
192 192
             );
193 193
             wp_enqueue_style(
194 194
                 'ee-newsletter-trigger-css',
195
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
195
+                REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css',
196 196
                 array(),
197 197
                 EVENT_ESPRESSO_VERSION
198 198
             );
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     {
214 214
         wp_register_script(
215 215
             'ee-reg-reports-js',
216
-            REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
216
+            REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js',
217 217
             array('google-charts'),
218 218
             EVENT_ESPRESSO_VERSION,
219 219
             true
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
         $nonce_ref = 'get_newsletter_form_content_nonce';
300 300
         $this->_verify_nonce($nonce, $nonce_ref);
301 301
         // let's get the mtp for the incoming MTP_ ID
302
-        if (! isset($this->_req_data['GRP_ID'])) {
302
+        if ( ! isset($this->_req_data['GRP_ID'])) {
303 303
             EE_Error::add_error(
304 304
                 esc_html__(
305 305
                     'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).',
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             $this->_return_json();
315 315
         }
316 316
         $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
317
-        if (! $MTPG instanceof EE_Message_Template_Group) {
317
+        if ( ! $MTPG instanceof EE_Message_Template_Group) {
318 318
             EE_Error::add_error(
319 319
                 sprintf(
320 320
                     esc_html__(
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
             $field = $MTP->get('MTP_template_field');
340 340
             if ($field === 'content') {
341 341
                 $content = $MTP->get('MTP_content');
342
-                if (! empty($content['newsletter_content'])) {
342
+                if ( ! empty($content['newsletter_content'])) {
343 343
                     $template_fields['newsletter_content'] = $content['newsletter_content'];
344 344
                 }
345 345
                 continue;
346 346
             }
347
-            $template_fields[ $MTP->get('MTP_template_field') ] = $MTP->get('MTP_content');
347
+            $template_fields[$MTP->get('MTP_template_field')] = $MTP->get('MTP_content');
348 348
         }
349 349
         $this->_template_args['success'] = true;
350 350
         $this->_template_args['error'] = false;
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      */
376 376
     public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table)
377 377
     {
378
-        if (! EE_Registry::instance()->CAP->current_user_can(
378
+        if ( ! EE_Registry::instance()->CAP->current_user_can(
379 379
             'ee_send_message',
380 380
             'espresso_registrations_newsletter_selected_send'
381 381
         )
@@ -444,17 +444,17 @@  discard block
 block discarded – undo
444 444
                 $field_id = $field === '[NEWSLETTER_CONTENT]'
445 445
                     ? 'content'
446 446
                     : $field;
447
-                $field_id = 'batch-message-' . strtolower($field_id);
447
+                $field_id = 'batch-message-'.strtolower($field_id);
448 448
                 $available_shortcodes[] = '<span class="js-shortcode-selection" data-value="'
449 449
                                           . $shortcode
450
-                                          . '" data-linked-input-id="' . $field_id . '">'
450
+                                          . '" data-linked-input-id="'.$field_id.'">'
451 451
                                           . $shortcode
452 452
                                           . '</span>';
453 453
             }
454
-            $codes[ $field ] = implode(', ', $available_shortcodes);
454
+            $codes[$field] = implode(', ', $available_shortcodes);
455 455
         }
456 456
         $shortcodes = $codes;
457
-        $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
457
+        $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';
458 458
         $form_template_args = array(
459 459
             'form_action'       => admin_url('admin.php?page=espresso_registrations'),
460 460
             'form_route'        => 'newsletter_selected_send',
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
      */
623 623
     protected function _registration_reports()
624 624
     {
625
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
625
+        $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
626 626
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
627 627
             $template_path,
628 628
             $this->_reports_template_data,
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
             array_unshift($regs, $column_titles);
678 678
             // setup the date range.
679 679
             $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
680
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
680
+            $beginning_date = new DateTime("now ".$period, $DateTimeZone);
681 681
             $ending_date = new DateTime("now", $DateTimeZone);
682 682
             $subtitle = sprintf(
683 683
                 wp_strip_all_tags(
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
                         'event_espresso'
702 702
                     )
703 703
                 ),
704
-                '<h2>' . $report_title . '</h2><p>',
704
+                '<h2>'.$report_title.'</h2><p>',
705 705
                 '</p>'
706 706
             ),
707 707
         );
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
             array_unshift($regs, $column_titles);
755 755
             // setup the date range.
756 756
             $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
757
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
757
+            $beginning_date = new DateTime("now ".$period, $DateTimeZone);
758 758
             $ending_date = new DateTime("now", $DateTimeZone);
759 759
             $subtitle = sprintf(
760 760
                 wp_strip_all_tags(
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
                         'event_espresso'
779 779
                     )
780 780
                 ),
781
-                '<h2>' . $report_title . '</h2><p>',
781
+                '<h2>'.$report_title.'</h2><p>',
782 782
                 '</p>'
783 783
             ),
784 784
         );
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
         if ($datetime instanceof EE_Datetime) {
832 832
             $datetime_label = $datetime->get_dtt_display_name(true);
833 833
             $datetime_label .= ! empty($datetime_label)
834
-                ? ' (' . $datetime->get_dtt_display_name() . ')'
834
+                ? ' ('.$datetime->get_dtt_display_name().')'
835 835
                 : $datetime->get_dtt_display_name();
836 836
         }
837 837
         $datetime_link = ! empty($dtt_id) && $registration instanceof EE_Registration
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
             )
846 846
             : '';
847 847
         $datetime_link = ! empty($datetime_link)
848
-            ? '<a href="' . $datetime_link . '">'
848
+            ? '<a href="'.$datetime_link.'">'
849 849
               . '<span id="checkin-dtt">'
850 850
               . $datetime_label
851 851
               . '</span></a>'
@@ -857,8 +857,8 @@  discard block
 block discarded – undo
857 857
             ? $attendee->get_admin_details_link()
858 858
             : '';
859 859
         $attendee_link = ! empty($attendee_link)
860
-            ? '<a href="' . $attendee->get_admin_details_link() . '"'
861
-              . ' title="' . esc_html__('Click for attendee details', 'event_espresso') . '">'
860
+            ? '<a href="'.$attendee->get_admin_details_link().'"'
861
+              . ' title="'.esc_html__('Click for attendee details', 'event_espresso').'">'
862 862
               . '<span id="checkin-attendee-name">'
863 863
               . $attendee_name
864 864
               . '</span></a>'
@@ -867,25 +867,25 @@  discard block
 block discarded – undo
867 867
             ? $registration->event()->get_admin_details_link()
868 868
             : '';
869 869
         $event_link = ! empty($event_link)
870
-            ? '<a href="' . $event_link . '"'
871
-              . ' title="' . esc_html__('Click here to edit event.', 'event_espresso') . '">'
870
+            ? '<a href="'.$event_link.'"'
871
+              . ' title="'.esc_html__('Click here to edit event.', 'event_espresso').'">'
872 872
               . '<span id="checkin-event-name">'
873 873
               . $registration->event_name()
874 874
               . '</span>'
875 875
               . '</a>'
876 876
             : '';
877 877
         $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
878
-            ? '<h2>' . sprintf(
878
+            ? '<h2>'.sprintf(
879 879
                 esc_html__('Displaying check in records for %1$s for %2$s at the event, %3$s', 'event_espresso'),
880 880
                 $attendee_link,
881 881
                 $datetime_link,
882 882
                 $event_link
883
-            ) . '</h2>'
883
+            ).'</h2>'
884 884
             : '';
885 885
         $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
886
-            ? '<input type="hidden" name="_REG_ID" value="' . $reg_id . '">' : '';
886
+            ? '<input type="hidden" name="_REG_ID" value="'.$reg_id.'">' : '';
887 887
         $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
888
-            ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
888
+            ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';
889 889
         $this->display_admin_list_table_page_with_no_sidebar();
890 890
     }
891 891
 
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
     public function toggle_checkin_status()
903 903
     {
904 904
         // first make sure we have the necessary data
905
-        if (! isset($this->_req_data['_regid'])) {
905
+        if ( ! isset($this->_req_data['_regid'])) {
906 906
             EE_Error::add_error(
907 907
                 esc_html__(
908 908
                     'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax',
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
         // beautiful! Made it this far so let's get the status.
925 925
         $new_status = new CheckinStatusDashicon($this->_toggle_checkin_status());
926 926
         // setup new class to return via ajax
927
-        $this->_template_args['admin_page_content'] = 'clickable trigger-checkin ' . $new_status->cssClasses();
927
+        $this->_template_args['admin_page_content'] = 'clickable trigger-checkin '.$new_status->cssClasses();
928 928
         $this->_template_args['success'] = true;
929 929
         $this->_return_json();
930 930
     }
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
         );
951 951
         $new_status = false;
952 952
         // bulk action check in toggle
953
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
953
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
954 954
             // cycle thru checkboxes
955 955
             while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
956 956
                 $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
@@ -1020,9 +1020,9 @@  discard block
 block discarded – undo
1020 1020
             '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1021 1021
         );
1022 1022
         $errors = 0;
1023
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1023
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1024 1024
             while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
1025
-                if (! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
1025
+                if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
1026 1026
                     $errors++;
1027 1027
                 }
1028 1028
             }
@@ -1068,8 +1068,8 @@  discard block
 block discarded – undo
1068 1068
             'DTT_ID'  => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
1069 1069
             '_REG_ID' => isset($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0,
1070 1070
         );
1071
-        if (! empty($this->_req_data['CHK_ID'])) {
1072
-            if (! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
1071
+        if ( ! empty($this->_req_data['CHK_ID'])) {
1072
+            if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
1073 1073
                 EE_Error::add_error(
1074 1074
                     esc_html__('Something went wrong and this check-in record was not deleted', 'event_espresso'),
1075 1075
                     __FILE__,
@@ -1138,27 +1138,27 @@  discard block
 block discarded – undo
1138 1138
                 'desc'  => $checked_never->legendLabel(),
1139 1139
             ),
1140 1140
             'approved_status'  => array(
1141
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1141
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
1142 1142
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1143 1143
             ),
1144 1144
             'cancelled_status' => array(
1145
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1145
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
1146 1146
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1147 1147
             ),
1148 1148
             'declined_status'  => array(
1149
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1149
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
1150 1150
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1151 1151
             ),
1152 1152
             'not_approved'     => array(
1153
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1153
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
1154 1154
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1155 1155
             ),
1156 1156
             'pending_status'   => array(
1157
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1157
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
1158 1158
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1159 1159
             ),
1160 1160
             'wait_list'        => array(
1161
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1161
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
1162 1162
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1163 1163
             ),
1164 1164
         );
@@ -1167,10 +1167,10 @@  discard block
 block discarded – undo
1167 1167
         /** @var EE_Event $event */
1168 1168
         $event = EEM_Event::instance()->get_one_by_ID($event_id);
1169 1169
         $this->_template_args['before_list_table'] = $event instanceof EE_Event
1170
-            ? '<h2>' . sprintf(
1170
+            ? '<h2>'.sprintf(
1171 1171
                 esc_html__('Viewing Registrations for Event: %s', 'event_espresso'),
1172 1172
                 EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1173
-            ) . '</h2>'
1173
+            ).'</h2>'
1174 1174
             : '';
1175 1175
         // need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on
1176 1176
         // the event.
@@ -1188,12 +1188,12 @@  discard block
 block discarded – undo
1188 1188
             $this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1189 1189
             $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1190 1190
             $this->_template_args['before_list_table'] .= $datetime->name();
1191
-            $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1191
+            $this->_template_args['before_list_table'] .= ' ( '.$datetime->date_and_time_range().' )';
1192 1192
             $this->_template_args['before_list_table'] .= '</span></h2>';
1193 1193
         }
1194 1194
         // if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status
1195 1195
         // column represents
1196
-        if (! $datetime instanceof EE_Datetime) {
1196
+        if ( ! $datetime instanceof EE_Datetime) {
1197 1197
             $this->_template_args['before_list_table'] .= '<br><p class="description">'
1198 1198
                                                           . esc_html__(
1199 1199
                                                               'In this view, the check-in status represents the latest check-in record for the registration in that row.',
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Button_Display_Strategy.strategy.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -12,32 +12,32 @@
 block discarded – undo
12 12
 class EE_Button_Display_Strategy extends EE_Display_Strategy_Base
13 13
 {
14 14
 
15
-    /**
16
-     * @return string of html to display the input
17
-     */
18
-    public function display()
19
-    {
20
-        $default_value = $this->_input->get_default();
21
-        if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) {
22
-            $default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value);
23
-        }
24
-        $html = $this->_opening_tag('button');
25
-        $html .= $this->_attributes_string(
26
-            array_merge(
27
-                $this->_standard_attributes_array(),
28
-                array(
29
-                    'value' => $default_value,
30
-                )
31
-            )
32
-        );
33
-        if ($this->_input instanceof EE_Button_Input) {
34
-            $button_content = $this->_input->button_content();
35
-        } else {
36
-            $button_content = $this->_input->get_default();
37
-        }
38
-        $html .= '>';
39
-        $html .= $button_content;
40
-        $html .= $this->_closing_tag();
41
-        return $html;
42
-    }
15
+	/**
16
+	 * @return string of html to display the input
17
+	 */
18
+	public function display()
19
+	{
20
+		$default_value = $this->_input->get_default();
21
+		if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) {
22
+			$default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value);
23
+		}
24
+		$html = $this->_opening_tag('button');
25
+		$html .= $this->_attributes_string(
26
+			array_merge(
27
+				$this->_standard_attributes_array(),
28
+				array(
29
+					'value' => $default_value,
30
+				)
31
+			)
32
+		);
33
+		if ($this->_input instanceof EE_Button_Input) {
34
+			$button_content = $this->_input->button_content();
35
+		} else {
36
+			$button_content = $this->_input->get_default();
37
+		}
38
+		$html .= '>';
39
+		$html .= $button_content;
40
+		$html .= $this->_closing_tag();
41
+		return $html;
42
+	}
43 43
 }
Please login to merge, or discard this patch.
core/domain/DomainFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments)
42 42
     {
43
-        if (! isset($arguments[0], $arguments[1])) {
43
+        if ( ! isset($arguments[0], $arguments[1])) {
44 44
             throw new InvalidArgumentException(
45 45
                 esc_html__(
46 46
                     'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class',
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             );
50 50
         }
51 51
         $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments);
52
-        if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) {
52
+        if ( ! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) {
53 53
             throw new DomainException(
54 54
                 sprintf(
55 55
                     esc_html__(
Please login to merge, or discard this patch.
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -28,63 +28,63 @@
 block discarded – undo
28 28
 class DomainFactory
29 29
 {
30 30
 
31
-    /**
32
-     * @param FullyQualifiedName $domain_fqcn   [required] Fully Qualified Class Name for the Domain class
33
-     * @param array $arguments                  [required] array of arguments to be passed to the Domain class
34
-     *                                          constructor. Must at least include the following two value objects:
35
-     *                                          array(
36
-     *                                              EventEspresso\core\domain\values\FilePath $plugin_file
37
-     *                                              EventEspresso\core\domain\values\Version $version
38
-     *                                          )
39
-     * @return mixed
40
-     * @throws DomainException
41
-     * @throws InvalidArgumentException
42
-     * @throws InvalidDataTypeException
43
-     * @throws InvalidInterfaceException
44
-     */
45
-    public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments)
46
-    {
47
-        if (! isset($arguments[0], $arguments[1])) {
48
-            throw new InvalidArgumentException(
49
-                esc_html__(
50
-                    'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class',
51
-                    'event_espresso'
52
-                )
53
-            );
54
-        }
55
-        $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments);
56
-        if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) {
57
-            throw new DomainException(
58
-                sprintf(
59
-                    esc_html__(
60
-                        'The requested Domain class "%1$s" could not be loaded.',
61
-                        'event_espresso'
62
-                    ),
63
-                    $domain_fqcn
64
-                )
65
-            );
66
-        }
67
-        return $domain;
68
-    }
31
+	/**
32
+	 * @param FullyQualifiedName $domain_fqcn   [required] Fully Qualified Class Name for the Domain class
33
+	 * @param array $arguments                  [required] array of arguments to be passed to the Domain class
34
+	 *                                          constructor. Must at least include the following two value objects:
35
+	 *                                          array(
36
+	 *                                              EventEspresso\core\domain\values\FilePath $plugin_file
37
+	 *                                              EventEspresso\core\domain\values\Version $version
38
+	 *                                          )
39
+	 * @return mixed
40
+	 * @throws DomainException
41
+	 * @throws InvalidArgumentException
42
+	 * @throws InvalidDataTypeException
43
+	 * @throws InvalidInterfaceException
44
+	 */
45
+	public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments)
46
+	{
47
+		if (! isset($arguments[0], $arguments[1])) {
48
+			throw new InvalidArgumentException(
49
+				esc_html__(
50
+					'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class',
51
+					'event_espresso'
52
+				)
53
+			);
54
+		}
55
+		$domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments);
56
+		if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) {
57
+			throw new DomainException(
58
+				sprintf(
59
+					esc_html__(
60
+						'The requested Domain class "%1$s" could not be loaded.',
61
+						'event_espresso'
62
+					),
63
+					$domain_fqcn
64
+				)
65
+			);
66
+		}
67
+		return $domain;
68
+	}
69 69
 
70 70
 
71
-    /**
72
-     * @return Domain
73
-     * @throws DomainException
74
-     * @throws InvalidArgumentException
75
-     * @throws InvalidDataTypeException
76
-     * @throws InvalidFilePathException
77
-     * @throws InvalidInterfaceException
78
-     */
79
-    public static function getEventEspressoCoreDomain()
80
-    {
81
-        $domain = new Domain(
82
-            new FilePath(EVENT_ESPRESSO_MAIN_FILE),
83
-            Version::fromString(espresso_version())
84
-        );
85
-        LoaderFactory::getLoader()->share('EventEspresso\core\domain\Domain', $domain);
86
-        return $domain;
87
-    }
71
+	/**
72
+	 * @return Domain
73
+	 * @throws DomainException
74
+	 * @throws InvalidArgumentException
75
+	 * @throws InvalidDataTypeException
76
+	 * @throws InvalidFilePathException
77
+	 * @throws InvalidInterfaceException
78
+	 */
79
+	public static function getEventEspressoCoreDomain()
80
+	{
81
+		$domain = new Domain(
82
+			new FilePath(EVENT_ESPRESSO_MAIN_FILE),
83
+			Version::fromString(espresso_version())
84
+		);
85
+		LoaderFactory::getLoader()->share('EventEspresso\core\domain\Domain', $domain);
86
+		return $domain;
87
+	}
88 88
 }
89 89
 
90 90
 
Please login to merge, or discard this patch.
core/domain/values/FilePath.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -20,42 +20,42 @@
 block discarded – undo
20 20
 class FilePath
21 21
 {
22 22
 
23
-    /**
24
-     * @var string file_path
25
-     */
26
-    private $file_path;
27
-
28
-
29
-    /**
30
-     * FilePath constructor.
31
-     *
32
-     * @param string $file_path
33
-     * @throws InvalidDataTypeException
34
-     * @throws InvalidFilePathException
35
-     */
36
-    public function __construct($file_path)
37
-    {
38
-        if (! is_string($file_path)) {
39
-            throw new InvalidDataTypeException(
40
-                '$file_path',
41
-                $file_path,
42
-                'string'
43
-            );
44
-        }
45
-        if (! is_readable($file_path)) {
46
-            throw new InvalidFilePathException($file_path);
47
-        }
48
-        $this->file_path = $file_path;
49
-    }
50
-
51
-
52
-    /**
53
-     * @return string
54
-     */
55
-    public function __toString()
56
-    {
57
-        return $this->file_path;
58
-    }
23
+	/**
24
+	 * @var string file_path
25
+	 */
26
+	private $file_path;
27
+
28
+
29
+	/**
30
+	 * FilePath constructor.
31
+	 *
32
+	 * @param string $file_path
33
+	 * @throws InvalidDataTypeException
34
+	 * @throws InvalidFilePathException
35
+	 */
36
+	public function __construct($file_path)
37
+	{
38
+		if (! is_string($file_path)) {
39
+			throw new InvalidDataTypeException(
40
+				'$file_path',
41
+				$file_path,
42
+				'string'
43
+			);
44
+		}
45
+		if (! is_readable($file_path)) {
46
+			throw new InvalidFilePathException($file_path);
47
+		}
48
+		$this->file_path = $file_path;
49
+	}
50
+
51
+
52
+	/**
53
+	 * @return string
54
+	 */
55
+	public function __toString()
56
+	{
57
+		return $this->file_path;
58
+	}
59 59
 
60 60
 
61 61
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@
 block discarded – undo
35 35
      */
36 36
     public function __construct($file_path)
37 37
     {
38
-        if (! is_string($file_path)) {
38
+        if ( ! is_string($file_path)) {
39 39
             throw new InvalidDataTypeException(
40 40
                 '$file_path',
41 41
                 $file_path,
42 42
                 'string'
43 43
             );
44 44
         }
45
-        if (! is_readable($file_path)) {
45
+        if ( ! is_readable($file_path)) {
46 46
             throw new InvalidFilePathException($file_path);
47 47
         }
48 48
         $this->file_path = $file_path;
Please login to merge, or discard this patch.
core/domain/values/FullyQualifiedName.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@
 block discarded – undo
37 37
      */
38 38
     public function __construct($fully_qualified_name)
39 39
     {
40
-        if (! is_string($fully_qualified_name)) {
40
+        if ( ! is_string($fully_qualified_name)) {
41 41
             throw new InvalidDataTypeException(
42 42
                 '$fully_qualified_name',
43 43
                 $fully_qualified_name,
44 44
                 'string'
45 45
             );
46 46
         }
47
-        if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
47
+        if ( ! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
48 48
             if (strpos($fully_qualified_name, 'Interface') !== false) {
49 49
                 throw new InvalidInterfaceException($fully_qualified_name);
50 50
             }
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -21,54 +21,54 @@
 block discarded – undo
21 21
 class FullyQualifiedName
22 22
 {
23 23
 
24
-    /**
25
-     * @var string $fully_qualified_name
26
-     */
27
-    private $fully_qualified_name;
24
+	/**
25
+	 * @var string $fully_qualified_name
26
+	 */
27
+	private $fully_qualified_name;
28 28
 
29 29
 
30
-    /**
31
-     * FullyQualifiedName constructor.
32
-     *
33
-     * @param string $fully_qualified_name
34
-     * @throws InvalidClassException
35
-     * @throws InvalidInterfaceException
36
-     * @throws InvalidDataTypeException
37
-     */
38
-    public function __construct($fully_qualified_name)
39
-    {
40
-        if (! is_string($fully_qualified_name)) {
41
-            throw new InvalidDataTypeException(
42
-                '$fully_qualified_name',
43
-                $fully_qualified_name,
44
-                'string'
45
-            );
46
-        }
47
-        if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
48
-            if (strpos($fully_qualified_name, 'Interface') !== false) {
49
-                throw new InvalidInterfaceException($fully_qualified_name);
50
-            }
51
-            throw new InvalidClassException($fully_qualified_name);
52
-        }
53
-        $this->fully_qualified_name = $fully_qualified_name;
54
-    }
30
+	/**
31
+	 * FullyQualifiedName constructor.
32
+	 *
33
+	 * @param string $fully_qualified_name
34
+	 * @throws InvalidClassException
35
+	 * @throws InvalidInterfaceException
36
+	 * @throws InvalidDataTypeException
37
+	 */
38
+	public function __construct($fully_qualified_name)
39
+	{
40
+		if (! is_string($fully_qualified_name)) {
41
+			throw new InvalidDataTypeException(
42
+				'$fully_qualified_name',
43
+				$fully_qualified_name,
44
+				'string'
45
+			);
46
+		}
47
+		if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
48
+			if (strpos($fully_qualified_name, 'Interface') !== false) {
49
+				throw new InvalidInterfaceException($fully_qualified_name);
50
+			}
51
+			throw new InvalidClassException($fully_qualified_name);
52
+		}
53
+		$this->fully_qualified_name = $fully_qualified_name;
54
+	}
55 55
 
56 56
 
57
-    /**
58
-     * @return string
59
-     */
60
-    public function string()
61
-    {
62
-        return $this->fully_qualified_name;
63
-    }
57
+	/**
58
+	 * @return string
59
+	 */
60
+	public function string()
61
+	{
62
+		return $this->fully_qualified_name;
63
+	}
64 64
 
65 65
 
66
-    /**
67
-     * @return string
68
-     */
69
-    public function __toString()
70
-    {
71
-        return $this->fully_qualified_name;
72
-    }
66
+	/**
67
+	 * @return string
68
+	 */
69
+	public function __toString()
70
+	{
71
+		return $this->fully_qualified_name;
72
+	}
73 73
 
74 74
 }
Please login to merge, or discard this patch.
core/domain/entities/contexts/RequestTypeContext.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
     public function __construct($slug, $description)
92 92
     {
93 93
         parent::__construct($slug, $description);
94
-        if (! in_array($this->slug(), $this->validRequestTypes(), true)) {
94
+        if ( ! in_array($this->slug(), $this->validRequestTypes(), true)) {
95 95
             throw new InvalidArgumentException(
96 96
                 sprintf(
97 97
                     esc_html__(
Please login to merge, or discard this patch.
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -16,155 +16,155 @@
 block discarded – undo
16 16
 class RequestTypeContext extends Context
17 17
 {
18 18
 
19
-    /**
20
-     * indicates that the current request involves some form of activation
21
-     */
22
-    const ACTIVATION = 'activation-request';
23
-
24
-    /**
25
-     * indicates that the current request is for the admin but is not being made via AJAX
26
-     */
27
-    const ADMIN = 'non-ajax-admin-request';
28
-
29
-    /**
30
-     * indicates that the current request is for the admin AND is being made via AJAX
31
-     */
32
-    const AJAX_ADMIN = 'admin-ajax-request';
33
-
34
-    /**
35
-     * indicates that the current request is for the frontend AND is being made via AJAX
36
-     */
37
-    const AJAX_FRONT = 'frontend-ajax-request';
38
-
39
-    /**
40
-     * indicates that the current request is for the WP Heartbeat
41
-     */
42
-    const AJAX_HEARTBEAT = 'admin-ajax-heartbeat';
43
-
44
-    /**
45
-     * indicates that the current request is being made via AJAX, but is NOT for EE
46
-     */
47
-    const AJAX_OTHER = 'other-ajax-request';
48
-
49
-    /**
50
-     * indicates that the current request is for the EE REST API
51
-     */
52
-    const API = 'rest-api';
53
-
54
-    /**
55
-     * indicates that the current request is from the command line
56
-     */
57
-    const CLI = 'command-line';
58
-
59
-    /**
60
-     * indicates that the current request is for a WP_Cron
61
-     */
62
-    const CRON = 'wp-cron';
63
-
64
-    /**
65
-     * indicates that the current request is for a feed (ie: RSS)
66
-     */
67
-    const FEED = 'feed-request';
68
-
69
-    /**
70
-     * indicates that the current request is for the frontend but is not being made via AJAX
71
-     */
72
-    const FRONTEND = 'non-ajax-frontend-request';
73
-
74
-    /**
75
-     * indicates that the current request is for content that is to be displayed within an iframe
76
-     */
77
-    const IFRAME = 'iframe-request';
78
-
79
-    /**
80
-     * indicates that the current request is for the WP REST API
81
-     */
82
-    const WP_API = 'wp-rest-api';
83
-
84
-    /**
85
-     * indicates that the current request is a loopback sent from WP core to test for errors
86
-     */
87
-    const WP_SCRAPE = 'wordpress-scrape';
88
-
89
-    /**
90
-     * @var boolean $is_activation
91
-     */
92
-    private $is_activation = false;
93
-
94
-    /**
95
-     * @var array $valid_request_types
96
-     */
97
-    private $valid_request_types = array();
98
-
99
-
100
-    /**
101
-     * RequestTypeContext constructor.
102
-     *
103
-     * @param string $slug
104
-     * @param string $description
105
-     * @throws InvalidArgumentException
106
-     */
107
-    public function __construct($slug, $description)
108
-    {
109
-        parent::__construct($slug, $description);
110
-        if (! in_array($this->slug(), $this->validRequestTypes(), true)) {
111
-            throw new InvalidArgumentException(
112
-                sprintf(
113
-                    esc_html__(
114
-                        'The RequestTypeContext slug must be one of the following values: %1$s %2$s',
115
-                        'event_espresso'
116
-                    ),
117
-                    var_export($this->validRequestTypes(), true)
118
-                )
119
-            );
120
-        }
121
-    }
122
-
123
-
124
-    /**
125
-     * @return array
126
-     */
127
-    public function validRequestTypes()
128
-    {
129
-        if (empty($this->valid_request_types)) {
130
-            $this->valid_request_types = apply_filters(
131
-                'FHEE__EventEspresso_core_domain_entities_contexts_RequestTypeContext__validRequestTypes',
132
-                array(
133
-                    RequestTypeContext::ACTIVATION,
134
-                    RequestTypeContext::ADMIN,
135
-                    RequestTypeContext::AJAX_ADMIN,
136
-                    RequestTypeContext::AJAX_FRONT,
137
-                    RequestTypeContext::AJAX_HEARTBEAT,
138
-                    RequestTypeContext::AJAX_OTHER,
139
-                    RequestTypeContext::API,
140
-                    RequestTypeContext::CLI,
141
-                    RequestTypeContext::CRON,
142
-                    RequestTypeContext::FEED,
143
-                    RequestTypeContext::FRONTEND,
144
-                    RequestTypeContext::IFRAME,
145
-                    RequestTypeContext::WP_API,
146
-                    RequestTypeContext::WP_SCRAPE,
147
-                )
148
-            );
149
-        }
150
-        return $this->valid_request_types;
151
-    }
152
-
153
-
154
-    /**
155
-     * @return bool
156
-     */
157
-    public function isActivation()
158
-    {
159
-        return $this->is_activation;
160
-    }
161
-
162
-
163
-    /**
164
-     * @param bool $is_activation
165
-     */
166
-    public function setIsActivation($is_activation)
167
-    {
168
-        $this->is_activation = filter_var($is_activation, FILTER_VALIDATE_BOOLEAN);
169
-    }
19
+	/**
20
+	 * indicates that the current request involves some form of activation
21
+	 */
22
+	const ACTIVATION = 'activation-request';
23
+
24
+	/**
25
+	 * indicates that the current request is for the admin but is not being made via AJAX
26
+	 */
27
+	const ADMIN = 'non-ajax-admin-request';
28
+
29
+	/**
30
+	 * indicates that the current request is for the admin AND is being made via AJAX
31
+	 */
32
+	const AJAX_ADMIN = 'admin-ajax-request';
33
+
34
+	/**
35
+	 * indicates that the current request is for the frontend AND is being made via AJAX
36
+	 */
37
+	const AJAX_FRONT = 'frontend-ajax-request';
38
+
39
+	/**
40
+	 * indicates that the current request is for the WP Heartbeat
41
+	 */
42
+	const AJAX_HEARTBEAT = 'admin-ajax-heartbeat';
43
+
44
+	/**
45
+	 * indicates that the current request is being made via AJAX, but is NOT for EE
46
+	 */
47
+	const AJAX_OTHER = 'other-ajax-request';
48
+
49
+	/**
50
+	 * indicates that the current request is for the EE REST API
51
+	 */
52
+	const API = 'rest-api';
53
+
54
+	/**
55
+	 * indicates that the current request is from the command line
56
+	 */
57
+	const CLI = 'command-line';
58
+
59
+	/**
60
+	 * indicates that the current request is for a WP_Cron
61
+	 */
62
+	const CRON = 'wp-cron';
63
+
64
+	/**
65
+	 * indicates that the current request is for a feed (ie: RSS)
66
+	 */
67
+	const FEED = 'feed-request';
68
+
69
+	/**
70
+	 * indicates that the current request is for the frontend but is not being made via AJAX
71
+	 */
72
+	const FRONTEND = 'non-ajax-frontend-request';
73
+
74
+	/**
75
+	 * indicates that the current request is for content that is to be displayed within an iframe
76
+	 */
77
+	const IFRAME = 'iframe-request';
78
+
79
+	/**
80
+	 * indicates that the current request is for the WP REST API
81
+	 */
82
+	const WP_API = 'wp-rest-api';
83
+
84
+	/**
85
+	 * indicates that the current request is a loopback sent from WP core to test for errors
86
+	 */
87
+	const WP_SCRAPE = 'wordpress-scrape';
88
+
89
+	/**
90
+	 * @var boolean $is_activation
91
+	 */
92
+	private $is_activation = false;
93
+
94
+	/**
95
+	 * @var array $valid_request_types
96
+	 */
97
+	private $valid_request_types = array();
98
+
99
+
100
+	/**
101
+	 * RequestTypeContext constructor.
102
+	 *
103
+	 * @param string $slug
104
+	 * @param string $description
105
+	 * @throws InvalidArgumentException
106
+	 */
107
+	public function __construct($slug, $description)
108
+	{
109
+		parent::__construct($slug, $description);
110
+		if (! in_array($this->slug(), $this->validRequestTypes(), true)) {
111
+			throw new InvalidArgumentException(
112
+				sprintf(
113
+					esc_html__(
114
+						'The RequestTypeContext slug must be one of the following values: %1$s %2$s',
115
+						'event_espresso'
116
+					),
117
+					var_export($this->validRequestTypes(), true)
118
+				)
119
+			);
120
+		}
121
+	}
122
+
123
+
124
+	/**
125
+	 * @return array
126
+	 */
127
+	public function validRequestTypes()
128
+	{
129
+		if (empty($this->valid_request_types)) {
130
+			$this->valid_request_types = apply_filters(
131
+				'FHEE__EventEspresso_core_domain_entities_contexts_RequestTypeContext__validRequestTypes',
132
+				array(
133
+					RequestTypeContext::ACTIVATION,
134
+					RequestTypeContext::ADMIN,
135
+					RequestTypeContext::AJAX_ADMIN,
136
+					RequestTypeContext::AJAX_FRONT,
137
+					RequestTypeContext::AJAX_HEARTBEAT,
138
+					RequestTypeContext::AJAX_OTHER,
139
+					RequestTypeContext::API,
140
+					RequestTypeContext::CLI,
141
+					RequestTypeContext::CRON,
142
+					RequestTypeContext::FEED,
143
+					RequestTypeContext::FRONTEND,
144
+					RequestTypeContext::IFRAME,
145
+					RequestTypeContext::WP_API,
146
+					RequestTypeContext::WP_SCRAPE,
147
+				)
148
+			);
149
+		}
150
+		return $this->valid_request_types;
151
+	}
152
+
153
+
154
+	/**
155
+	 * @return bool
156
+	 */
157
+	public function isActivation()
158
+	{
159
+		return $this->is_activation;
160
+	}
161
+
162
+
163
+	/**
164
+	 * @param bool $is_activation
165
+	 */
166
+	public function setIsActivation($is_activation)
167
+	{
168
+		$this->is_activation = filter_var($is_activation, FILTER_VALIDATE_BOOLEAN);
169
+	}
170 170
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Simple_HTML_Field.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@
 block discarded – undo
11 11
 
12 12
 
13 13
 
14
-    /**
15
-     * removes all tags which a WP Post wouldn't allow in its content normally
16
-     *
17
-     * @param string $value
18
-     * @return string
19
-     */
20
-    public function prepare_for_set($value)
21
-    {
22
-        return parent::prepare_for_set(wp_kses("$value", EEH_HTML::get_simple_tags()));
23
-    }
14
+	/**
15
+	 * removes all tags which a WP Post wouldn't allow in its content normally
16
+	 *
17
+	 * @param string $value
18
+	 * @return string
19
+	 */
20
+	public function prepare_for_set($value)
21
+	{
22
+		return parent::prepare_for_set(wp_kses("$value", EEH_HTML::get_simple_tags()));
23
+	}
24 24
 }
Please login to merge, or discard this patch.
core/db_classes/EE_WP_User.class.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
      */
52 52
     public function wp_user_obj()
53 53
     {
54
-        if (! $this->_wp_user_obj) {
54
+        if ( ! $this->_wp_user_obj) {
55 55
             $this->_wp_user_obj = get_user_by('ID', $this->ID());
56 56
         }
57 57
         return $this->_wp_user_obj;
Please login to merge, or discard this patch.
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -11,91 +11,91 @@
 block discarded – undo
11 11
 class EE_WP_User extends EE_Base_Class implements EEI_Admin_Links
12 12
 {
13 13
 
14
-    /**
15
-     * @var WP_User
16
-     */
17
-    protected $_wp_user_obj;
14
+	/**
15
+	 * @var WP_User
16
+	 */
17
+	protected $_wp_user_obj;
18 18
 
19
-    /**
20
-     * @param array $props_n_values
21
-     * @return EE_WP_User|mixed
22
-     */
23
-    public static function new_instance($props_n_values = array())
24
-    {
25
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__);
26
-        return $has_object ? $has_object : new self($props_n_values);
27
-    }
19
+	/**
20
+	 * @param array $props_n_values
21
+	 * @return EE_WP_User|mixed
22
+	 */
23
+	public static function new_instance($props_n_values = array())
24
+	{
25
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
26
+		return $has_object ? $has_object : new self($props_n_values);
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * @param array $props_n_values
32
-     * @return EE_WP_User
33
-     */
34
-    public static function new_instance_from_db($props_n_values = array())
35
-    {
36
-        return new self($props_n_values, true);
37
-    }
30
+	/**
31
+	 * @param array $props_n_values
32
+	 * @return EE_WP_User
33
+	 */
34
+	public static function new_instance_from_db($props_n_values = array())
35
+	{
36
+		return new self($props_n_values, true);
37
+	}
38 38
 
39
-    /**
40
-     * Return a normal WP_User object (caches the object for future calls)
41
-     *
42
-     * @return WP_User
43
-     */
44
-    public function wp_user_obj()
45
-    {
46
-        if (! $this->_wp_user_obj) {
47
-            $this->_wp_user_obj = get_user_by('ID', $this->ID());
48
-        }
49
-        return $this->_wp_user_obj;
50
-    }
39
+	/**
40
+	 * Return a normal WP_User object (caches the object for future calls)
41
+	 *
42
+	 * @return WP_User
43
+	 */
44
+	public function wp_user_obj()
45
+	{
46
+		if (! $this->_wp_user_obj) {
47
+			$this->_wp_user_obj = get_user_by('ID', $this->ID());
48
+		}
49
+		return $this->_wp_user_obj;
50
+	}
51 51
 
52
-    /**
53
-     * Return the link to the admin details for the object.
54
-     *
55
-     * @return string
56
-     */
57
-    public function get_admin_details_link()
58
-    {
59
-        return $this->get_admin_edit_link();
60
-    }
52
+	/**
53
+	 * Return the link to the admin details for the object.
54
+	 *
55
+	 * @return string
56
+	 */
57
+	public function get_admin_details_link()
58
+	{
59
+		return $this->get_admin_edit_link();
60
+	}
61 61
 
62
-    /**
63
-     * Returns the link to the editor for the object.  Sometimes this is the same as the details.
64
-     *
65
-     * @return string
66
-     */
67
-    public function get_admin_edit_link()
68
-    {
69
-        return esc_url(
70
-            add_query_arg(
71
-                'wp_http_referer',
72
-                urlencode(
73
-                    wp_unslash(
74
-                        $_SERVER['REQUEST_URI']
75
-                    )
76
-                ),
77
-                get_edit_user_link($this->ID())
78
-            )
79
-        );
80
-    }
62
+	/**
63
+	 * Returns the link to the editor for the object.  Sometimes this is the same as the details.
64
+	 *
65
+	 * @return string
66
+	 */
67
+	public function get_admin_edit_link()
68
+	{
69
+		return esc_url(
70
+			add_query_arg(
71
+				'wp_http_referer',
72
+				urlencode(
73
+					wp_unslash(
74
+						$_SERVER['REQUEST_URI']
75
+					)
76
+				),
77
+				get_edit_user_link($this->ID())
78
+			)
79
+		);
80
+	}
81 81
 
82
-    /**
83
-     * Returns the link to a settings page for the object.
84
-     *
85
-     * @return string
86
-     */
87
-    public function get_admin_settings_link()
88
-    {
89
-        return $this->get_admin_edit_link();
90
-    }
82
+	/**
83
+	 * Returns the link to a settings page for the object.
84
+	 *
85
+	 * @return string
86
+	 */
87
+	public function get_admin_settings_link()
88
+	{
89
+		return $this->get_admin_edit_link();
90
+	}
91 91
 
92
-    /**
93
-     * Returns the link to the "overview" for the object (typically the "list table" view).
94
-     *
95
-     * @return string
96
-     */
97
-    public function get_admin_overview_link()
98
-    {
99
-        return admin_url('users.php');
100
-    }
92
+	/**
93
+	 * Returns the link to the "overview" for the object (typically the "list table" view).
94
+	 *
95
+	 * @return string
96
+	 */
97
+	public function get_admin_overview_link()
98
+	{
99
+		return admin_url('users.php');
100
+	}
101 101
 }
Please login to merge, or discard this patch.
core/interfaces/EEI_Request_Decorator.interface.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,24 +9,24 @@
 block discarded – undo
9 9
 interface EEI_Request_Decorator
10 10
 {
11 11
 
12
-    /**
13
-     * converts a Request to a Response
14
-     * can perform their logic either before or after the core application has run like so:
15
-     *    public function handle_request( EE_Request $request, EE_Response $response ) {
16
-     *        $this->request = $request;
17
-     *        $this->response = $response;
18
-     *      // logic performed BEFORE core app has run
19
-     *      $this->process_request_stack( $this->request, $this->response );
20
-     *      // logic performed AFTER core app has run
21
-     *      return $response;
22
-     *    }
23
-     *
24
-     * @deprecated 4.9.53
25
-     * @param    EE_Request $request
26
-     * @param    EE_Response   $response
27
-     * @return    EE_Response
28
-     */
29
-    public function handle_request(EE_Request $request, EE_Response $response);
12
+	/**
13
+	 * converts a Request to a Response
14
+	 * can perform their logic either before or after the core application has run like so:
15
+	 *    public function handle_request( EE_Request $request, EE_Response $response ) {
16
+	 *        $this->request = $request;
17
+	 *        $this->response = $response;
18
+	 *      // logic performed BEFORE core app has run
19
+	 *      $this->process_request_stack( $this->request, $this->response );
20
+	 *      // logic performed AFTER core app has run
21
+	 *      return $response;
22
+	 *    }
23
+	 *
24
+	 * @deprecated 4.9.53
25
+	 * @param    EE_Request $request
26
+	 * @param    EE_Response   $response
27
+	 * @return    EE_Response
28
+	 */
29
+	public function handle_request(EE_Request $request, EE_Response $response);
30 30
 
31 31
 
32 32
 }
Please login to merge, or discard this patch.