Completed
Branch ADMIN-REFRESH (e33cdc)
by
unknown
05:12 queued 02:39
created
caffeinated/admin/new/pricing/Price_Types_List_Table.class.php 2 patches
Indentation   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -13,257 +13,257 @@
 block discarded – undo
13 13
  */
14 14
 class Price_Types_List_Table extends EE_Admin_List_Table
15 15
 {
16
-    /**
17
-     * @var Pricing_Admin_Page
18
-     */
19
-    protected $_admin_page;
16
+	/**
17
+	 * @var Pricing_Admin_Page
18
+	 */
19
+	protected $_admin_page;
20 20
 
21 21
 
22
-    protected function _setup_data()
23
-    {
24
-        $trashed               = $this->_admin_page->get_view() == 'trashed';
25
-        $this->_data           = $this->_admin_page->get_price_types_overview_data($this->_per_page, false, $trashed);
26
-        $this->_all_data_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true);
27
-        $this->_trashed_count  = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, true);
28
-    }
22
+	protected function _setup_data()
23
+	{
24
+		$trashed               = $this->_admin_page->get_view() == 'trashed';
25
+		$this->_data           = $this->_admin_page->get_price_types_overview_data($this->_per_page, false, $trashed);
26
+		$this->_all_data_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true);
27
+		$this->_trashed_count  = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, true);
28
+	}
29 29
 
30 30
 
31
-    protected function _set_properties()
32
-    {
33
-        $this->_wp_list_args = [
34
-            'singular' => esc_html__('price type', 'event_espresso'),
35
-            'plural'   => esc_html__('price types', 'event_espresso'),
36
-            'ajax'     => true,
37
-            'screen'   => $this->_admin_page->get_current_screen()->id,
38
-        ];
31
+	protected function _set_properties()
32
+	{
33
+		$this->_wp_list_args = [
34
+			'singular' => esc_html__('price type', 'event_espresso'),
35
+			'plural'   => esc_html__('price types', 'event_espresso'),
36
+			'ajax'     => true,
37
+			'screen'   => $this->_admin_page->get_current_screen()->id,
38
+		];
39 39
 
40
-        $this->_columns = [
41
-            'cb'        => '<input type="checkbox" />', // Render a checkbox instead of text
42
-            'id'        => esc_html__('ID', 'event_espresso'),
43
-            'name'      => esc_html__('Name', 'event_espresso'),
44
-            'base_type' => '<div class="jst-cntr">' . esc_html__('Base Type', 'event_espresso') . '</div>',
45
-            'percent'   => '<div class="jst-cntr">'
46
-                           . sprintf(
47
-                               /* translators: 1: HTML new line, 2: open span tag, 3: close span tag */
48
-                               esc_html__('Applied %1$s as %2$s%%%3$s or %2$s$%3$s', 'event_espresso'),
49
-                               '',
50
-                               '<span class="big-text">',
51
-                               '</span>'
52
-                           )
53
-                           . '</div>',
54
-            'order'     => '<div class="jst-cntr">'
55
-                           . sprintf(
56
-                               /* translators: HTML new line */
57
-                               esc_html__('Order of %s Application', 'event_espresso'),
58
-                               ''
59
-                           )
60
-                           . '</div>',
61
-        ];
40
+		$this->_columns = [
41
+			'cb'        => '<input type="checkbox" />', // Render a checkbox instead of text
42
+			'id'        => esc_html__('ID', 'event_espresso'),
43
+			'name'      => esc_html__('Name', 'event_espresso'),
44
+			'base_type' => '<div class="jst-cntr">' . esc_html__('Base Type', 'event_espresso') . '</div>',
45
+			'percent'   => '<div class="jst-cntr">'
46
+						   . sprintf(
47
+							   /* translators: 1: HTML new line, 2: open span tag, 3: close span tag */
48
+							   esc_html__('Applied %1$s as %2$s%%%3$s or %2$s$%3$s', 'event_espresso'),
49
+							   '',
50
+							   '<span class="big-text">',
51
+							   '</span>'
52
+						   )
53
+						   . '</div>',
54
+			'order'     => '<div class="jst-cntr">'
55
+						   . sprintf(
56
+							   /* translators: HTML new line */
57
+							   esc_html__('Order of %s Application', 'event_espresso'),
58
+							   ''
59
+						   )
60
+						   . '</div>',
61
+		];
62 62
 
63
-        $this->_sortable_columns = [
64
-            // TRUE means its already sorted
65
-            'name' => ['name' => false],
66
-        ];
63
+		$this->_sortable_columns = [
64
+			// TRUE means its already sorted
65
+			'name' => ['name' => false],
66
+		];
67 67
 
68
-        $this->_hidden_columns = [];
69
-    }
68
+		$this->_hidden_columns = [];
69
+	}
70 70
 
71 71
 
72
-    protected function _get_table_filters()
73
-    {
74
-    }
72
+	protected function _get_table_filters()
73
+	{
74
+	}
75 75
 
76 76
 
77
-    protected function _add_view_counts()
78
-    {
79
-        $this->_views['all']['count'] = $this->_all_data_count;
80
-        if (
81
-            EE_Registry::instance()->CAP->current_user_can(
82
-                'ee_delete_default_price_types',
83
-                'pricing_trash_price_type'
84
-            )
85
-        ) {
86
-            $this->_views['trashed']['count'] = $this->_trashed_count;
87
-        }
88
-    }
77
+	protected function _add_view_counts()
78
+	{
79
+		$this->_views['all']['count'] = $this->_all_data_count;
80
+		if (
81
+			EE_Registry::instance()->CAP->current_user_can(
82
+				'ee_delete_default_price_types',
83
+				'pricing_trash_price_type'
84
+			)
85
+		) {
86
+			$this->_views['trashed']['count'] = $this->_trashed_count;
87
+		}
88
+	}
89 89
 
90 90
 
91
-    public function column_cb($item): string
92
-    {
93
-        if ($item->base_type() !== 1) {
94
-            return sprintf(
95
-                '<input type="checkbox" name="checkbox[%1$s]" />',
96
-                $item->ID()
97
-            );
98
-        }
99
-        return '';
100
-    }
91
+	public function column_cb($item): string
92
+	{
93
+		if ($item->base_type() !== 1) {
94
+			return sprintf(
95
+				'<input type="checkbox" name="checkbox[%1$s]" />',
96
+				$item->ID()
97
+			);
98
+		}
99
+		return '';
100
+	}
101 101
 
102 102
 
103
-    /**
104
-     * @param EE_Price_Type $item
105
-     * @return string
106
-     * @throws EE_Error
107
-     * @throws ReflectionException
108
-     */
109
-    public function column_id(EE_Price_Type $item): string
110
-    {
111
-        $content = $item->ID();
112
-        $content .= '  <span class="show-on-mobile-view-only">' . $item->name() . '</span>';
113
-        return $this->columnContent('id', $content, 'end');
114
-    }
103
+	/**
104
+	 * @param EE_Price_Type $item
105
+	 * @return string
106
+	 * @throws EE_Error
107
+	 * @throws ReflectionException
108
+	 */
109
+	public function column_id(EE_Price_Type $item): string
110
+	{
111
+		$content = $item->ID();
112
+		$content .= '  <span class="show-on-mobile-view-only">' . $item->name() . '</span>';
113
+		return $this->columnContent('id', $content, 'end');
114
+	}
115 115
 
116 116
 
117
-    public function column_name($item): string
118
-    {
117
+	public function column_name($item): string
118
+	{
119 119
 
120
-        // Build row actions
121
-        $actions   = [];
122
-        $name_link = $item->name();
123
-        // edit price link
124
-        if (
125
-            EE_Registry::instance()->CAP->current_user_can(
126
-                'ee_edit_default_price_type',
127
-                'pricing_edit_price_type',
128
-                $item->ID()
129
-            )
130
-        ) {
131
-            $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
132
-                [
133
-                    'action' => 'edit_price_type',
134
-                    'id'     => $item->ID(),
135
-                ],
136
-                PRICING_ADMIN_URL
137
-            );
120
+		// Build row actions
121
+		$actions   = [];
122
+		$name_link = $item->name();
123
+		// edit price link
124
+		if (
125
+			EE_Registry::instance()->CAP->current_user_can(
126
+				'ee_edit_default_price_type',
127
+				'pricing_edit_price_type',
128
+				$item->ID()
129
+			)
130
+		) {
131
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
132
+				[
133
+					'action' => 'edit_price_type',
134
+					'id'     => $item->ID(),
135
+				],
136
+				PRICING_ADMIN_URL
137
+			);
138 138
 
139
-            $name_link = '<a href="' . $edit_lnk_url . '" aria-label="'
140
-                         . sprintf(
141
-                             /* translators: The name of the price type */
142
-                             esc_attr__('Edit Price Type (%s)', 'event_espresso'),
143
-                             $item->name()
144
-                         )
145
-                         . '">'
146
-                         . stripslashes($item->name()) . '</a>';
139
+			$name_link = '<a href="' . $edit_lnk_url . '" aria-label="'
140
+						 . sprintf(
141
+							 /* translators: The name of the price type */
142
+							 esc_attr__('Edit Price Type (%s)', 'event_espresso'),
143
+							 $item->name()
144
+						 )
145
+						 . '">'
146
+						 . stripslashes($item->name()) . '</a>';
147 147
 
148
-            $actions['edit'] = '<a href="' . $edit_lnk_url . '" aria-label="'
149
-                               . sprintf(
150
-                                   /* translators: The name of the price type */
151
-                                   esc_attr__('Edit Price Type (%s)', 'event_espresso'),
152
-                                   $item->name()
153
-                               )
154
-                               . '">'
155
-                               . esc_html__('Edit', 'event_espresso') . '</a>';
156
-        }
148
+			$actions['edit'] = '<a href="' . $edit_lnk_url . '" aria-label="'
149
+							   . sprintf(
150
+								   /* translators: The name of the price type */
151
+								   esc_attr__('Edit Price Type (%s)', 'event_espresso'),
152
+								   $item->name()
153
+							   )
154
+							   . '">'
155
+							   . esc_html__('Edit', 'event_espresso') . '</a>';
156
+		}
157 157
 
158
-        if ($item->base_type() !== 1) {
159
-            if ($this->_view == 'all') {
160
-                // trash price link
161
-                if (
162
-                    EE_Registry::instance()->CAP->current_user_can(
163
-                        'ee_delete_default_price_type',
164
-                        'pricing_trash_price_type',
165
-                        $item->ID()
166
-                    )
167
-                ) {
168
-                    $trash_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
169
-                        [
170
-                            'action'   => 'trash_price_type',
171
-                            'id'       => $item->ID(),
172
-                            'noheader' => true,
173
-                        ],
174
-                        PRICING_ADMIN_URL
175
-                    );
176
-                    $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="'
177
-                                        . sprintf(
178
-                                            /* translators: The name of the price type */
179
-                                            esc_attr__('Move Price Type %s to Trash', 'event_espresso'),
180
-                                            $item->name()
181
-                                        )
182
-                                        . '">'
183
-                                        . esc_html__('Move to Trash', 'event_espresso') . '</a>';
184
-                }
185
-            } else {
186
-                // restore price link
187
-                if (
188
-                    EE_Registry::instance()->CAP->current_user_can(
189
-                        'ee_delete_default_price_type',
190
-                        'pricing_restore_price_type',
191
-                        $item->ID()
192
-                    )
193
-                ) {
194
-                    $restore_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
195
-                        [
196
-                            'action'   => 'restore_price_type',
197
-                            'id'       => $item->ID(),
198
-                            'noheader' => true,
199
-                        ],
200
-                        PRICING_ADMIN_URL
201
-                    );
202
-                    $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="'
203
-                                          . sprintf(
204
-                                              /* translators: The name of the price type */
205
-                                              esc_attr__('Restore Price Type (%s)', 'event_espresso'),
206
-                                              $item->name()
207
-                                          )
208
-                                          . '">'
209
-                                          . esc_html__('Restore', 'event_espresso') . '</a>';
210
-                }
211
-                // delete price link
212
-                if (
213
-                    EE_Registry::instance()->CAP->current_user_can(
214
-                        'ee_delete_default_price_type',
215
-                        'pricing_delete_price_type',
216
-                        $item->ID()
217
-                    )
218
-                ) {
219
-                    $delete_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
220
-                        [
221
-                            'action'   => 'delete_price_type',
222
-                            'id'       => $item->ID(),
223
-                            'noheader' => true,
224
-                        ],
225
-                        PRICING_ADMIN_URL
226
-                    );
227
-                    $actions['delete'] = '
158
+		if ($item->base_type() !== 1) {
159
+			if ($this->_view == 'all') {
160
+				// trash price link
161
+				if (
162
+					EE_Registry::instance()->CAP->current_user_can(
163
+						'ee_delete_default_price_type',
164
+						'pricing_trash_price_type',
165
+						$item->ID()
166
+					)
167
+				) {
168
+					$trash_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
169
+						[
170
+							'action'   => 'trash_price_type',
171
+							'id'       => $item->ID(),
172
+							'noheader' => true,
173
+						],
174
+						PRICING_ADMIN_URL
175
+					);
176
+					$actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="'
177
+										. sprintf(
178
+											/* translators: The name of the price type */
179
+											esc_attr__('Move Price Type %s to Trash', 'event_espresso'),
180
+											$item->name()
181
+										)
182
+										. '">'
183
+										. esc_html__('Move to Trash', 'event_espresso') . '</a>';
184
+				}
185
+			} else {
186
+				// restore price link
187
+				if (
188
+					EE_Registry::instance()->CAP->current_user_can(
189
+						'ee_delete_default_price_type',
190
+						'pricing_restore_price_type',
191
+						$item->ID()
192
+					)
193
+				) {
194
+					$restore_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
195
+						[
196
+							'action'   => 'restore_price_type',
197
+							'id'       => $item->ID(),
198
+							'noheader' => true,
199
+						],
200
+						PRICING_ADMIN_URL
201
+					);
202
+					$actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="'
203
+										  . sprintf(
204
+											  /* translators: The name of the price type */
205
+											  esc_attr__('Restore Price Type (%s)', 'event_espresso'),
206
+											  $item->name()
207
+										  )
208
+										  . '">'
209
+										  . esc_html__('Restore', 'event_espresso') . '</a>';
210
+				}
211
+				// delete price link
212
+				if (
213
+					EE_Registry::instance()->CAP->current_user_can(
214
+						'ee_delete_default_price_type',
215
+						'pricing_delete_price_type',
216
+						$item->ID()
217
+					)
218
+				) {
219
+					$delete_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
220
+						[
221
+							'action'   => 'delete_price_type',
222
+							'id'       => $item->ID(),
223
+							'noheader' => true,
224
+						],
225
+						PRICING_ADMIN_URL
226
+					);
227
+					$actions['delete'] = '
228 228
                         <a href="' . $delete_lnk_url . '" 
229 229
                             aria-label="' . sprintf(
230
-                            /* translators: The name of the price type */
231
-                            esc_attr__('Delete Price Type %s Permanently', 'event_espresso'),
232
-                            $item->name()
233
-                        ) . '"
230
+							/* translators: The name of the price type */
231
+							esc_attr__('Delete Price Type %s Permanently', 'event_espresso'),
232
+							$item->name()
233
+						) . '"
234 234
                         >
235 235
                             ' . esc_html__('Delete Permanently', 'event_espresso') . '
236 236
                         </a>';
237
-                }
238
-            }
239
-        }
237
+				}
238
+			}
239
+		}
240 240
 
241
-        // Return the name contents
242
-        return sprintf(
243
-            '%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
244
-            $name_link,
245
-            $item->ID(),
246
-            $this->row_actions($actions)
247
-        );
248
-    }
241
+		// Return the name contents
242
+		return sprintf(
243
+			'%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
244
+			$name_link,
245
+			$item->ID(),
246
+			$this->row_actions($actions)
247
+		);
248
+	}
249 249
 
250 250
 
251
-    public function column_base_type($item): string
252
-    {
253
-        return '<div class="jst-cntr">' . $item->base_type_name() . '</div>';
254
-    }
251
+	public function column_base_type($item): string
252
+	{
253
+		return '<div class="jst-cntr">' . $item->base_type_name() . '</div>';
254
+	}
255 255
 
256 256
 
257
-    public function column_percent($item): string
258
-    {
259
-        return '<div class="jst-cntr">'
260
-               . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign)
261
-               . '</div>';
262
-    }
257
+	public function column_percent($item): string
258
+	{
259
+		return '<div class="jst-cntr">'
260
+			   . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign)
261
+			   . '</div>';
262
+	}
263 263
 
264 264
 
265
-    public function column_order($item): string
266
-    {
267
-        return '<div class="jst-cntr">' . $item->order() . '</div>';
268
-    }
265
+	public function column_order($item): string
266
+	{
267
+		return '<div class="jst-cntr">' . $item->order() . '</div>';
268
+	}
269 269
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             'cb'        => '<input type="checkbox" />', // Render a checkbox instead of text
42 42
             'id'        => esc_html__('ID', 'event_espresso'),
43 43
             'name'      => esc_html__('Name', 'event_espresso'),
44
-            'base_type' => '<div class="jst-cntr">' . esc_html__('Base Type', 'event_espresso') . '</div>',
44
+            'base_type' => '<div class="jst-cntr">'.esc_html__('Base Type', 'event_espresso').'</div>',
45 45
             'percent'   => '<div class="jst-cntr">'
46 46
                            . sprintf(
47 47
                                /* translators: 1: HTML new line, 2: open span tag, 3: close span tag */
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     public function column_id(EE_Price_Type $item): string
110 110
     {
111 111
         $content = $item->ID();
112
-        $content .= '  <span class="show-on-mobile-view-only">' . $item->name() . '</span>';
112
+        $content .= '  <span class="show-on-mobile-view-only">'.$item->name().'</span>';
113 113
         return $this->columnContent('id', $content, 'end');
114 114
     }
115 115
 
@@ -136,23 +136,23 @@  discard block
 block discarded – undo
136 136
                 PRICING_ADMIN_URL
137 137
             );
138 138
 
139
-            $name_link = '<a href="' . $edit_lnk_url . '" aria-label="'
139
+            $name_link = '<a href="'.$edit_lnk_url.'" aria-label="'
140 140
                          . sprintf(
141 141
                              /* translators: The name of the price type */
142 142
                              esc_attr__('Edit Price Type (%s)', 'event_espresso'),
143 143
                              $item->name()
144 144
                          )
145 145
                          . '">'
146
-                         . stripslashes($item->name()) . '</a>';
146
+                         . stripslashes($item->name()).'</a>';
147 147
 
148
-            $actions['edit'] = '<a href="' . $edit_lnk_url . '" aria-label="'
148
+            $actions['edit'] = '<a href="'.$edit_lnk_url.'" aria-label="'
149 149
                                . sprintf(
150 150
                                    /* translators: The name of the price type */
151 151
                                    esc_attr__('Edit Price Type (%s)', 'event_espresso'),
152 152
                                    $item->name()
153 153
                                )
154 154
                                . '">'
155
-                               . esc_html__('Edit', 'event_espresso') . '</a>';
155
+                               . esc_html__('Edit', 'event_espresso').'</a>';
156 156
         }
157 157
 
158 158
         if ($item->base_type() !== 1) {
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                         $item->ID()
166 166
                     )
167 167
                 ) {
168
-                    $trash_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
168
+                    $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
169 169
                         [
170 170
                             'action'   => 'trash_price_type',
171 171
                             'id'       => $item->ID(),
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
                         ],
174 174
                         PRICING_ADMIN_URL
175 175
                     );
176
-                    $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="'
176
+                    $actions['trash'] = '<a href="'.$trash_lnk_url.'" aria-label="'
177 177
                                         . sprintf(
178 178
                                             /* translators: The name of the price type */
179 179
                                             esc_attr__('Move Price Type %s to Trash', 'event_espresso'),
180 180
                                             $item->name()
181 181
                                         )
182 182
                                         . '">'
183
-                                        . esc_html__('Move to Trash', 'event_espresso') . '</a>';
183
+                                        . esc_html__('Move to Trash', 'event_espresso').'</a>';
184 184
                 }
185 185
             } else {
186 186
                 // restore price link
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                         $item->ID()
192 192
                     )
193 193
                 ) {
194
-                    $restore_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
194
+                    $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
195 195
                         [
196 196
                             'action'   => 'restore_price_type',
197 197
                             'id'       => $item->ID(),
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
                         ],
200 200
                         PRICING_ADMIN_URL
201 201
                     );
202
-                    $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="'
202
+                    $actions['restore'] = '<a href="'.$restore_lnk_url.'" aria-label="'
203 203
                                           . sprintf(
204 204
                                               /* translators: The name of the price type */
205 205
                                               esc_attr__('Restore Price Type (%s)', 'event_espresso'),
206 206
                                               $item->name()
207 207
                                           )
208 208
                                           . '">'
209
-                                          . esc_html__('Restore', 'event_espresso') . '</a>';
209
+                                          . esc_html__('Restore', 'event_espresso').'</a>';
210 210
                 }
211 211
                 // delete price link
212 212
                 if (
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
                         $item->ID()
217 217
                     )
218 218
                 ) {
219
-                    $delete_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
219
+                    $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
220 220
                         [
221 221
                             'action'   => 'delete_price_type',
222 222
                             'id'       => $item->ID(),
@@ -225,14 +225,14 @@  discard block
 block discarded – undo
225 225
                         PRICING_ADMIN_URL
226 226
                     );
227 227
                     $actions['delete'] = '
228
-                        <a href="' . $delete_lnk_url . '" 
228
+                        <a href="' . $delete_lnk_url.'" 
229 229
                             aria-label="' . sprintf(
230 230
                             /* translators: The name of the price type */
231 231
                             esc_attr__('Delete Price Type %s Permanently', 'event_espresso'),
232 232
                             $item->name()
233
-                        ) . '"
233
+                        ).'"
234 234
                         >
235
-                            ' . esc_html__('Delete Permanently', 'event_espresso') . '
235
+                            ' . esc_html__('Delete Permanently', 'event_espresso').'
236 236
                         </a>';
237 237
                 }
238 238
             }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 
251 251
     public function column_base_type($item): string
252 252
     {
253
-        return '<div class="jst-cntr">' . $item->base_type_name() . '</div>';
253
+        return '<div class="jst-cntr">'.$item->base_type_name().'</div>';
254 254
     }
255 255
 
256 256
 
@@ -264,6 +264,6 @@  discard block
 block discarded – undo
264 264
 
265 265
     public function column_order($item): string
266 266
     {
267
-        return '<div class="jst-cntr">' . $item->order() . '</div>';
267
+        return '<div class="jst-cntr">'.$item->order().'</div>';
268 268
     }
269 269
 }
Please login to merge, or discard this patch.
registration_form/templates/question_groups_main_meta_box.template.php 2 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 assert(is_array($values));
18 18
 
19 19
 foreach ($all_questions as $unused_question) {
20
-    assert($unused_question);
21
-    assert($unused_question instanceof EE_Question);
20
+	assert($unused_question);
21
+	assert($unused_question instanceof EE_Question);
22 22
 }
23 23
 
24 24
 $question_order           = 0;
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 $disabled                          = ! empty($QSG_system) ? ' disabled="disabled"' : '';
29 29
 $id                                = ! empty($QST_system) ? '_disabled' : '';
30 30
 $required_question_group_questions = EEM_Question::instance()->required_system_questions_in_system_question_group(
31
-    $QSG_system
31
+	$QSG_system
32 32
 );
33 33
 $allowed_question_group_questions  = EEM_Question::instance()->allowed_system_questions_in_system_question_group(
34
-    $QSG_system
34
+	$QSG_system
35 35
 );
36 36
 ?>
37 37
 
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
                         <?php if (! empty($QSG_system)) { ?>
77 77
                             <p><span class="description" style="color:#D54E21;">
78 78
                             <?php esc_html_e(
79
-                                'System question group! This field cannot be changed.',
80
-                                'event_espresso'
81
-                            ) ?>
79
+								'System question group! This field cannot be changed.',
80
+								'event_espresso'
81
+							) ?>
82 82
                     </span><br /></p>
83 83
                         <?php } ?>
84 84
 
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
                     </th>
124 124
                     <td>
125 125
                         <?php echo EEH_Form_Fields::select_input(
126
-                            'QSG_show_group_name',
127
-                            $values,
128
-                            $question_group->show_group_name(),
129
-                            '',
130
-                            'ee-input--small'
131
-                        ); ?>
126
+							'QSG_show_group_name',
127
+							$values,
128
+							$question_group->show_group_name(),
129
+							'',
130
+							'ee-input--small'
131
+						); ?>
132 132
                         <p class="description">
133 133
                             <?php esc_html_e('Show Group Name on Registration Page?', 'event_espresso'); ?>
134 134
                         </p>
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
                     </th>
145 145
                     <td>
146 146
                         <?php echo EEH_Form_Fields::select_input(
147
-                            'QSG_show_group_desc',
148
-                            $values,
149
-                            $question_group->show_group_desc(),
150
-                            '',
151
-                            'ee-input--small'
152
-                        ); ?>
147
+							'QSG_show_group_desc',
148
+							$values,
149
+							$question_group->show_group_desc(),
150
+							'',
151
+							'ee-input--small'
152
+						); ?>
153 153
                         <p class="description"><?php
154
-                            esc_html_e(' Show Group Description on Registration Page?', 'event_espresso');
155
-                        ?></p>
154
+							esc_html_e(' Show Group Description on Registration Page?', 'event_espresso');
155
+						?></p>
156 156
                         <input type="hidden" name="QSG_system" value="<?php echo $question_group->system_group(); ?>">
157 157
                     </td>
158 158
                 </tr>
@@ -166,38 +166,38 @@  discard block
 block discarded – undo
166 166
         <div class="question-group-questions">
167 167
             <p class='ee-status-outline ee-status-bg--info'>
168 168
                 <?php
169
-                esc_html_e(
170
-                    'Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.',
171
-                    'event_espresso'
172
-                ); ?>
169
+				esc_html_e(
170
+					'Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.',
171
+					'event_espresso'
172
+				); ?>
173 173
             </p>
174 174
             <div>
175 175
                 <ul class="question-list-sortable">
176 176
                     <?php
177
-                    foreach ($all_questions as $question_ID => $question) {
178
-                        if (! $question instanceof EE_Question) {
179
-                            continue;
180
-                        }
181
-                        $checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : '';
182
-                        // disable questions from the personal information question group
183
-                        // is it required in the current question group? if so don't allow admins to remove it
184
-                        $disabled = in_array($question->system_ID(), $required_question_group_questions)
185
-                            ? 'disabled="disabled"'
186
-                            : '';
187
-                        // limit where system questions can appear
188
-                        if (
189
-                            $question->system_ID()
190
-                            && ! in_array($question->system_ID(), $allowed_question_group_questions)
191
-                        ) {
192
-                            // skip over system question not assigned to this group
193
-                            // except for the address system group cause we want the address questions to display
194
-                            // even if they aren't selected (but still not show the personal system questions).
195
-                            // The third condition checks if we're displaying a non system question group
196
-                            // and the question is a system question, then we skip
197
-                            // because for non-system question groups we only want to show non-system questions.
198
-                            continue;
199
-                        }
200
-                        ?>
177
+					foreach ($all_questions as $question_ID => $question) {
178
+						if (! $question instanceof EE_Question) {
179
+							continue;
180
+						}
181
+						$checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : '';
182
+						// disable questions from the personal information question group
183
+						// is it required in the current question group? if so don't allow admins to remove it
184
+						$disabled = in_array($question->system_ID(), $required_question_group_questions)
185
+							? 'disabled="disabled"'
186
+							: '';
187
+						// limit where system questions can appear
188
+						if (
189
+							$question->system_ID()
190
+							&& ! in_array($question->system_ID(), $allowed_question_group_questions)
191
+						) {
192
+							// skip over system question not assigned to this group
193
+							// except for the address system group cause we want the address questions to display
194
+							// even if they aren't selected (but still not show the personal system questions).
195
+							// The third condition checks if we're displaying a non system question group
196
+							// and the question is a system question, then we skip
197
+							// because for non-system question groups we only want to show non-system questions.
198
+							continue;
199
+						}
200
+						?>
201 201
                         <li class="ee-question-sortable">
202 202
                             <label for="question-<?php echo $question_ID ?>">
203 203
                                 <input id="question-<?php echo $question_ID; ?>"
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
                                     <?php echo $checked; ?>
209 209
                                 />
210 210
                                 <span class="question-text"><?php
211
-                                    echo trim($question->display_text())
212
-                                         . (95 <= strlen(trim($question->display_text()))
213
-                                            ? "&hellip;"
214
-                                            : '');
215
-                                                            ?>
211
+									echo trim($question->display_text())
212
+										 . (95 <= strlen(trim($question->display_text()))
213
+											? "&hellip;"
214
+											: '');
215
+															?>
216 216
                             </span>
217 217
                                 <input class="question-group-QGQ_order"
218 218
                                        name="question_orders[<?php echo $question_ID; ?>]"
@@ -221,40 +221,40 @@  discard block
 block discarded – undo
221 221
                                 >
222 222
                             </label>
223 223
                             <?php
224
-                            if (
225
-                                EE_Registry::instance()->CAP->current_user_can(
226
-                                    'ee_edit_question',
227
-                                    'espresso_registration_form_edit_question',
228
-                                    $question->ID()
229
-                                )
230
-                            ) {
231
-                                $edit_query_args = [
232
-                                    'action' => 'edit_question',
233
-                                    'QST_ID' => $question->ID(),
234
-                                ];
235
-                                $edit_link       = EE_Admin_Page::add_query_args_and_nonce(
236
-                                    $edit_query_args,
237
-                                    EE_FORMS_ADMIN_URL
238
-                                );
224
+							if (
225
+								EE_Registry::instance()->CAP->current_user_can(
226
+									'ee_edit_question',
227
+									'espresso_registration_form_edit_question',
228
+									$question->ID()
229
+								)
230
+							) {
231
+								$edit_query_args = [
232
+									'action' => 'edit_question',
233
+									'QST_ID' => $question->ID(),
234
+								];
235
+								$edit_link       = EE_Admin_Page::add_query_args_and_nonce(
236
+									$edit_query_args,
237
+									EE_FORMS_ADMIN_URL
238
+								);
239 239
 
240
-                                echo '
240
+								echo '
241 241
                                     <a href="' . $edit_link . '" 
242 242
                                         class="button button--small button--icon-only"
243 243
                                         target="_blank" 
244 244
                                         title="' . sprintf(
245
-                                        esc_attr__('Edit %s', 'event_espresso'),
246
-                                        $question->admin_label()
247
-                                    ) . '"
245
+										esc_attr__('Edit %s', 'event_espresso'),
246
+										$question->admin_label()
247
+									) . '"
248 248
                                     >
249 249
                                         <span class="dashicons dashicons-edit"></span>
250 250
                                     </a>';
251
-                            }
252
-                            ?>
251
+							}
252
+							?>
253 253
                         </li>
254 254
                         <?php
255
-                        $question_order++;
256
-                    }
257
-                    ?>
255
+						$question_order++;
256
+					}
257
+					?>
258 258
                 </ul>
259 259
             </div>
260 260
         </div>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                                type="text"
74 74
                                value="<?php $question_group->f('QSG_identifier') ?>"
75 75
                         >
76
-                        <?php if (! empty($QSG_system)) { ?>
76
+                        <?php if ( ! empty($QSG_system)) { ?>
77 77
                             <p><span class="description" style="color:#D54E21;">
78 78
                             <?php esc_html_e(
79 79
                                 'System question group! This field cannot be changed.',
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
                 <ul class="question-list-sortable">
176 176
                     <?php
177 177
                     foreach ($all_questions as $question_ID => $question) {
178
-                        if (! $question instanceof EE_Question) {
178
+                        if ( ! $question instanceof EE_Question) {
179 179
                             continue;
180 180
                         }
181
-                        $checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : '';
181
+                        $checked = isset($question_group_questions[$question_ID]) ? ' checked="checked"' : '';
182 182
                         // disable questions from the personal information question group
183 183
                         // is it required in the current question group? if so don't allow admins to remove it
184 184
                         $disabled = in_array($question->system_ID(), $required_question_group_questions)
@@ -232,19 +232,19 @@  discard block
 block discarded – undo
232 232
                                     'action' => 'edit_question',
233 233
                                     'QST_ID' => $question->ID(),
234 234
                                 ];
235
-                                $edit_link       = EE_Admin_Page::add_query_args_and_nonce(
235
+                                $edit_link = EE_Admin_Page::add_query_args_and_nonce(
236 236
                                     $edit_query_args,
237 237
                                     EE_FORMS_ADMIN_URL
238 238
                                 );
239 239
 
240 240
                                 echo '
241
-                                    <a href="' . $edit_link . '" 
241
+                                    <a href="' . $edit_link.'" 
242 242
                                         class="button button--small button--icon-only"
243 243
                                         target="_blank" 
244 244
                                         title="' . sprintf(
245 245
                                         esc_attr__('Edit %s', 'event_espresso'),
246 246
                                         $question->admin_label()
247
-                                    ) . '"
247
+                                    ).'"
248 248
                                     >
249 249
                                         <span class="dashicons dashicons-edit"></span>
250 250
                                     </a>';
Please login to merge, or discard this patch.
caffeinated/admin/extend/events/Extend_Events_Admin_List_Table.class.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
 class Extend_Events_Admin_List_Table extends Events_Admin_List_Table
13 13
 {
14 14
 
15
-    protected function _column_name_action_setup(EE_Event $event): array
16
-    {
17
-        $export_query_args = array(
18
-            'action' => 'export_events',
19
-            'EVT_ID' => $event->ID(),
20
-        );
21
-        $export_event_link = EE_Admin_Page::add_query_args_and_nonce($export_query_args, EVENTS_ADMIN_URL);
15
+	protected function _column_name_action_setup(EE_Event $event): array
16
+	{
17
+		$export_query_args = array(
18
+			'action' => 'export_events',
19
+			'EVT_ID' => $event->ID(),
20
+		);
21
+		$export_event_link = EE_Admin_Page::add_query_args_and_nonce($export_query_args, EVENTS_ADMIN_URL);
22 22
 
23
-        return parent::_column_name_action_setup($event);
24
-    }
23
+		return parent::_column_name_action_setup($event);
24
+	}
25 25
 }
Please login to merge, or discard this patch.
admin/extend/registrations/templates/newsletter-send-form.template.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
             <input type="hidden" name="batch_message[id_type]" value="<?php echo $id_type; ?>">
36 36
             <input id="newsletter-batch-ids" type="hidden" name="batch_message[ids]" value="">
37 37
             <h3 class="newsletter-send-form-title"><?php
38
-                printf(
39
-                    esc_html__('Sending batch message to %s people...', 'event_espresso'),
40
-                    '[NUMPEOPLE]'
41
-                ); ?></h3>
38
+				printf(
39
+					esc_html__('Sending batch message to %s people...', 'event_espresso'),
40
+					'[NUMPEOPLE]'
41
+				); ?></h3>
42 42
             <label for="batch-message-template-selector"><?php esc_html_e('Select Template:', 'event_espresso'); ?></label>
43 43
             <?php echo $template_selector; ?>
44 44
             <div class="batch-message-edit-fields" style="display:none;">
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
                     <div id="shortcode-container-subject"
61 61
                          class="shortcodes-info-container ee_shortcode_chooser_container" style="display:none">
62 62
                         <h4><?php esc_html_e(
63
-                            'Message Template Shortcodes for the "subject" field:',
64
-                            'event_espresso'
65
-                        ); ?></h4>
63
+							'Message Template Shortcodes for the "subject" field:',
64
+							'event_espresso'
65
+						); ?></h4>
66 66
                         <p><?php echo $shortcodes['Subject']; ?></p>
67 67
                     </div>
68 68
                     <input type="text" name="batch_message[subject]" id="batch-message-subject"
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
                     <div id="shortcode-container-content"
76 76
                          class="shortcodes-info-container ee_shortcode_chooser_container" style="display:none">
77 77
                         <h4><?php esc_html_e(
78
-                            'Message Template Shortcodes for the "content" field:',
79
-                            'event_espresso'
80
-                        ); ?></h4>
78
+							'Message Template Shortcodes for the "content" field:',
79
+							'event_espresso'
80
+						); ?></h4>
81 81
                         <p><?php echo $shortcodes['[NEWSLETTER_CONTENT]']; ?></p>
82 82
                     </div>
83 83
                     <textarea name="batch_message[content]" id="batch-message-content"
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
                 <input type="submit" class="batch-message-submit button button--primary alignright"
87 87
                        name="batch-message-submit" value="<?php esc_html_e('Send', 'event_espresso'); ?>">
88 88
                 <button class="batch-message-cancel button button--secondary alignright"><?php
89
-                    esc_html_e(
90
-                        'Cancel',
91
-                        'event_espresso'
92
-                    ); ?></button>
89
+					esc_html_e(
90
+						'Cancel',
91
+						'event_espresso'
92
+					); ?></button>
93 93
                 <div style="clear:both"></div>
94 94
             </div>
95 95
         </form>
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_EE_Registrations_List_Table.class.php 2 patches
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -13,116 +13,116 @@
 block discarded – undo
13 13
 class Extend_EE_Registrations_List_Table extends EE_Registrations_List_Table
14 14
 {
15 15
 
16
-    /**
17
-     * @param EE_Registration $registration
18
-     * @param bool            $prep_content
19
-     * @return string
20
-     * @throws EE_Error
21
-     * @throws ReflectionException
22
-     */
23
-    public function column__REG_date(EE_Registration $registration, bool $prep_content = true): string
24
-    {
25
-        $actions['check_in'] = '';
26
-        $date_linked = parent::column__REG_date($registration, false);
27
-        $actions = array();
16
+	/**
17
+	 * @param EE_Registration $registration
18
+	 * @param bool            $prep_content
19
+	 * @return string
20
+	 * @throws EE_Error
21
+	 * @throws ReflectionException
22
+	 */
23
+	public function column__REG_date(EE_Registration $registration, bool $prep_content = true): string
24
+	{
25
+		$actions['check_in'] = '';
26
+		$date_linked = parent::column__REG_date($registration, false);
27
+		$actions = array();
28 28
 
29
-        if (
30
-            $this->caps_handler->userCanReadRegistrationCheckins()
31
-            && $this->caps_handler->userCanReadRegistrationCheckin($registration)
32
-        ) {
33
-            $check_in_url = EE_Admin_Page::add_query_args_and_nonce(
34
-                [
35
-                    'action' => 'event_registrations',
36
-                    'event_id' => $registration->event_ID(),
37
-                ],
38
-                REG_ADMIN_URL
39
-            );
29
+		if (
30
+			$this->caps_handler->userCanReadRegistrationCheckins()
31
+			&& $this->caps_handler->userCanReadRegistrationCheckin($registration)
32
+		) {
33
+			$check_in_url = EE_Admin_Page::add_query_args_and_nonce(
34
+				[
35
+					'action' => 'event_registrations',
36
+					'event_id' => $registration->event_ID(),
37
+				],
38
+				REG_ADMIN_URL
39
+			);
40 40
 
41
-            $actions['check_in'] = '
41
+			$actions['check_in'] = '
42 42
             <a  class="ee-aria-tooltip ee-event-filter-link" 
43 43
                 href="' . $check_in_url . '"
44 44
                 aria-label="' . esc_attr__(
45
-                    'The Check-In List allows you to easily toggle check-in status for this event',
46
-                    'event_espresso'
47
-                ) . '"
45
+					'The Check-In List allows you to easily toggle check-in status for this event',
46
+					'event_espresso'
47
+				) . '"
48 48
             >
49 49
                 <span class="dashicons dashicons-groups dashicons--small"></span>'
50
-                . esc_html__('View Check-ins', 'event_espresso') . '
50
+				. esc_html__('View Check-ins', 'event_espresso') . '
51 51
             </a>';
52
-        }
52
+		}
53 53
 
54
-        $content = sprintf('%1$s %2$s', $date_linked, $this->row_actions($actions));
54
+		$content = sprintf('%1$s %2$s', $date_linked, $this->row_actions($actions));
55 55
 
56
-        return $prep_content ? $this->columnContent('_REG_date', $content) : $content;
57
-    }
56
+		return $prep_content ? $this->columnContent('_REG_date', $content) : $content;
57
+	}
58 58
 
59 59
 
60
-    /**
61
-     * @param EE_Registration $registration
62
-     * @return string
63
-     * @throws EE_Error
64
-     * @throws InvalidArgumentException
65
-     * @throws InvalidDataTypeException
66
-     * @throws InvalidInterfaceException
67
-     * @throws ReflectionException
68
-     */
69
-    public function column_DTT_EVT_start(EE_Registration $registration): string
70
-    {
71
-        $remove_defaults = array('default_where_conditions' => 'none');
72
-        $ticket = $registration->ticket();
73
-        $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array();
74
-        $EVT_ID = $registration->event_ID();
75
-        $datetimes_for_display = array();
76
-        foreach ($datetimes as $datetime) {
77
-            $datetime_string = '<div class="ee-reg-list-dates-list-date">';
78
-            if ($this->caps_handler->userCanReadRegistrationCheckin($registration)) {
79
-                $checkins_url = EE_Admin_Page::add_query_args_and_nonce(
80
-                    [
81
-                        'action'   => 'event_registrations',
82
-                        'event_id' => $EVT_ID,
83
-                        'DTT_ID'   => $datetime->ID(),
84
-                    ],
85
-                    REG_ADMIN_URL
86
-                );
87
-                // open "a" tag and "href"
88
-                $datetime_string .= '
60
+	/**
61
+	 * @param EE_Registration $registration
62
+	 * @return string
63
+	 * @throws EE_Error
64
+	 * @throws InvalidArgumentException
65
+	 * @throws InvalidDataTypeException
66
+	 * @throws InvalidInterfaceException
67
+	 * @throws ReflectionException
68
+	 */
69
+	public function column_DTT_EVT_start(EE_Registration $registration): string
70
+	{
71
+		$remove_defaults = array('default_where_conditions' => 'none');
72
+		$ticket = $registration->ticket();
73
+		$datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array();
74
+		$EVT_ID = $registration->event_ID();
75
+		$datetimes_for_display = array();
76
+		foreach ($datetimes as $datetime) {
77
+			$datetime_string = '<div class="ee-reg-list-dates-list-date">';
78
+			if ($this->caps_handler->userCanReadRegistrationCheckin($registration)) {
79
+				$checkins_url = EE_Admin_Page::add_query_args_and_nonce(
80
+					[
81
+						'action'   => 'event_registrations',
82
+						'event_id' => $EVT_ID,
83
+						'DTT_ID'   => $datetime->ID(),
84
+					],
85
+					REG_ADMIN_URL
86
+				);
87
+				// open "a" tag and "href"
88
+				$datetime_string .= '
89 89
                     <a class="ee-aria-tooltip ee-status-color--' . $datetime->get_active_status() . '" 
90 90
                         href="' . $checkins_url . '"
91 91
                         aria-label="' . esc_attr__('View Checkins for this Event', 'event_espresso') . '"
92 92
                     >
93 93
                         ' . $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a') . '
94 94
                     </a>';
95
-            } else {
96
-                $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a');
97
-            }
98
-            // add a "View Registrations" link that filters list by event AND datetime
99
-            $filter_list_url = EE_Admin_Page::add_query_args_and_nonce(
100
-                ['event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()],
101
-                REG_ADMIN_URL
102
-            );
103
-            $datetime_string .= $this->row_actions(
104
-                array(
105
-                    'event_datetime_filter' => '
95
+			} else {
96
+				$datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a');
97
+			}
98
+			// add a "View Registrations" link that filters list by event AND datetime
99
+			$filter_list_url = EE_Admin_Page::add_query_args_and_nonce(
100
+				['event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()],
101
+				REG_ADMIN_URL
102
+			);
103
+			$datetime_string .= $this->row_actions(
104
+				array(
105
+					'event_datetime_filter' => '
106 106
                     <a class="ee-aria-tooltip ee-event-filter-link" 
107 107
                         href="' . $filter_list_url . '" 
108 108
                         aria-label="' . sprintf(
109
-                            esc_attr__(
110
-                                'Filter this list to only show registrations for this datetime %s',
111
-                                'event_espresso'
112
-                            ),
113
-                            $datetime->name()
114
-                        ) . '">
109
+							esc_attr__(
110
+								'Filter this list to only show registrations for this datetime %s',
111
+								'event_espresso'
112
+							),
113
+							$datetime->name()
114
+						) . '">
115 115
                         <span class="dashicons dashicons-groups dashicons--small"></span>
116 116
                     </a>',
117
-                )
118
-            );
119
-                        // ' . esc_html__('View Registrations', 'event_espresso') . '
120
-            $datetime_string .= '</div>';
121
-            $datetimes_for_display[] = $datetime_string;
122
-        }
123
-        return $this->columnContent(
124
-            'DTT_EVT_start',
125
-            $this->generateDisplayForDateTimes($datetimes_for_display)
126
-        );
127
-    }
117
+				)
118
+			);
119
+						// ' . esc_html__('View Registrations', 'event_espresso') . '
120
+			$datetime_string .= '</div>';
121
+			$datetimes_for_display[] = $datetime_string;
122
+		}
123
+		return $this->columnContent(
124
+			'DTT_EVT_start',
125
+			$this->generateDisplayForDateTimes($datetimes_for_display)
126
+		);
127
+	}
128 128
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 
41 41
             $actions['check_in'] = '
42 42
             <a  class="ee-aria-tooltip ee-event-filter-link" 
43
-                href="' . $check_in_url . '"
43
+                href="' . $check_in_url.'"
44 44
                 aria-label="' . esc_attr__(
45 45
                     'The Check-In List allows you to easily toggle check-in status for this event',
46 46
                     'event_espresso'
47
-                ) . '"
47
+                ).'"
48 48
             >
49 49
                 <span class="dashicons dashicons-groups dashicons--small"></span>'
50
-                . esc_html__('View Check-ins', 'event_espresso') . '
50
+                . esc_html__('View Check-ins', 'event_espresso').'
51 51
             </a>';
52 52
         }
53 53
 
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
                 );
87 87
                 // open "a" tag and "href"
88 88
                 $datetime_string .= '
89
-                    <a class="ee-aria-tooltip ee-status-color--' . $datetime->get_active_status() . '" 
90
-                        href="' . $checkins_url . '"
91
-                        aria-label="' . esc_attr__('View Checkins for this Event', 'event_espresso') . '"
89
+                    <a class="ee-aria-tooltip ee-status-color--' . $datetime->get_active_status().'" 
90
+                        href="' . $checkins_url.'"
91
+                        aria-label="' . esc_attr__('View Checkins for this Event', 'event_espresso').'"
92 92
                     >
93
-                        ' . $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a') . '
93
+                        ' . $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a').'
94 94
                     </a>';
95 95
             } else {
96 96
                 $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a');
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
                 array(
105 105
                     'event_datetime_filter' => '
106 106
                     <a class="ee-aria-tooltip ee-event-filter-link" 
107
-                        href="' . $filter_list_url . '" 
107
+                        href="' . $filter_list_url.'" 
108 108
                         aria-label="' . sprintf(
109 109
                             esc_attr__(
110 110
                                 'Filter this list to only show registrations for this datetime %s',
111 111
                                 'event_espresso'
112 112
                             ),
113 113
                             $datetime->name()
114
-                        ) . '">
114
+                        ).'">
115 115
                         <span class="dashicons dashicons-groups dashicons--small"></span>
116 116
                     </a>',
117 117
                 )
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 2 patches
Indentation   +595 added lines, -595 removed lines patch added patch discarded remove patch
@@ -12,350 +12,350 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class EE_Event_Registrations_List_Table extends EE_Admin_List_Table
14 14
 {
15
-    /**
16
-     * @var Extend_Registrations_Admin_Page
17
-     */
18
-    protected $_admin_page;
19
-
20
-    /**
21
-     * This property will hold the related Datetimes on an event IF the event id is included in the request.
22
-     *
23
-     * @var EE_Datetime[]
24
-     */
25
-    protected $_dtts_for_event = [];
26
-
27
-    /**
28
-     * The event if one is specified in the request
29
-     *
30
-     * @var EE_Event
31
-     */
32
-    protected $_evt = null;
33
-
34
-    /**
35
-     * The DTT_ID if the current view has a specified datetime.
36
-     *
37
-     * @var int $_cur_dtt_id
38
-     */
39
-    protected $_cur_dtt_id = 0;
40
-
41
-
42
-    /**
43
-     * EE_Event_Registrations_List_Table constructor.
44
-     *
45
-     * @param Registrations_Admin_Page $admin_page
46
-     */
47
-    public function __construct($admin_page)
48
-    {
49
-        parent::__construct($admin_page);
50
-    }
51
-
52
-
53
-    /**
54
-     * @throws EE_Error
55
-     */
56
-    protected function _setup_data()
57
-    {
58
-        $this->_data = $this->_view !== 'trash'
59
-            ? $this->_admin_page->get_event_attendees($this->_per_page)
60
-            : $this->_admin_page->get_event_attendees($this->_per_page, false, true);
61
-
62
-        $this->_all_data_count = $this->_view !== 'trash'
63
-            ? $this->_admin_page->get_event_attendees($this->_per_page, true)
64
-            : $this->_admin_page->get_event_attendees($this->_per_page, true, true);
65
-    }
66
-
67
-
68
-    /**
69
-     * @throws ReflectionException
70
-     * @throws EE_Error
71
-     */
72
-    protected function _set_properties()
73
-    {
74
-        $return_url = $this->getReturnUrl();
75
-        $evt_id     = $this->_req_data['event_id'] ?? null;
76
-
77
-        $this->_wp_list_args = [
78
-            'singular' => esc_html__('registrant', 'event_espresso'),
79
-            'plural'   => esc_html__('registrants', 'event_espresso'),
80
-            'ajax'     => true,
81
-            'screen'   => $this->_admin_page->get_current_screen()->id,
82
-        ];
83
-        $columns             = [];
84
-        $this->_columns      = [
85
-            '_REG_att_checked_in' => esc_html__('Check In', 'event_espresso'),
86
-            'ATT_name'            => esc_html__('Registrant', 'event_espresso'),
87
-            'ATT_email'           => esc_html__('Email Address', 'event_espresso'),
88
-            'Event'               => esc_html__('Event', 'event_espresso'),
89
-            'PRC_name'            => esc_html__('TKT Option', 'event_espresso'),
90
-            '_REG_final_price'    => esc_html__('Price', 'event_espresso'),
91
-            'TXN_paid'            => esc_html__('Paid', 'event_espresso'),
92
-            'TXN_total'           => esc_html__('Total', 'event_espresso'),
93
-        ];
94
-        // Add/remove columns when an event has been selected
95
-        if (! empty($evt_id)) {
96
-            // Render a checkbox column
97
-            $columns['cb']              = '<input type="checkbox" />';
98
-            $this->_has_checkbox_column = true;
99
-            // Remove the 'Event' column
100
-            unset($this->_columns['Event']);
101
-        }
102
-        $this->_columns        = array_merge($columns, $this->_columns);
103
-        $this->_primary_column = '_REG_att_checked_in';
104
-        if (
105
-            ! empty($evt_id)
106
-            && EE_Registry::instance()->CAP->current_user_can(
107
-                'ee_read_registrations',
108
-                'espresso_registrations_registrations_reports',
109
-                $evt_id
110
-            )
111
-        ) {
112
-            $this->_bottom_buttons = [
113
-                'report' => [
114
-                    'route'         => 'registrations_report',
115
-                    'extra_request' =>
116
-                        [
117
-                            'EVT_ID'     => $evt_id,
118
-                            'return_url' => $return_url,
119
-                        ],
120
-                ],
121
-            ];
122
-        }
123
-        $this->_bottom_buttons['report_filtered'] = [
124
-            'route'         => 'registrations_checkin_report',
125
-            'extra_request' => [
126
-                'use_filters' => true,
127
-                'filters'     => array_merge(
128
-                    [
129
-                        'EVT_ID' => $evt_id,
130
-                    ],
131
-                    array_diff_key(
132
-                        $this->_req_data,
133
-                        array_flip(
134
-                            [
135
-                                'page',
136
-                                'action',
137
-                                'default_nonce',
138
-                            ]
139
-                        )
140
-                    )
141
-                ),
142
-                'return_url'  => $return_url,
143
-            ],
144
-        ];
145
-        $this->_sortable_columns                  = [
146
-            /**
147
-             * Allows users to change the default sort if they wish.
148
-             * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
149
-             *
150
-             * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to
151
-             * change the sorts on any list table involving registration contacts.  If you want to only change the filter
152
-             * for a specific list table you can use the provided reference to this object instance.
153
-             */
154
-            'ATT_name' => [
155
-                'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
156
-                true,
157
-                $this,
158
-            ]
159
-                ? ['ATT_lname' => true]
160
-                : ['ATT_fname' => true],
161
-            'Event'    => ['Event.EVT_name' => false],
162
-        ];
163
-        $this->_hidden_columns                    = [];
164
-        $this->_evt                               = EEM_Event::instance()->get_one_by_ID($evt_id);
165
-        $this->_dtts_for_event                    =
166
-            $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : [];
167
-    }
168
-
169
-
170
-    /**
171
-     * @param EE_Registration $item
172
-     * @return string
173
-     */
174
-    protected function _get_row_class($item): string
175
-    {
176
-        $class = parent::_get_row_class($item);
177
-        if ($this->_has_checkbox_column) {
178
-            $class .= ' has-checkbox-column';
179
-        }
180
-        return $class;
181
-    }
182
-
183
-
184
-    /**
185
-     * @return array
186
-     * @throws EE_Error
187
-     * @throws ReflectionException
188
-     */
189
-    protected function _get_table_filters(): array
190
-    {
191
-        $filters        = $where = [];
192
-        $current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
193
-        if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
194
-            // this means we don't have an event so let's setup a filter dropdown for all the events to select
195
-            // note possible capability restrictions
196
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
197
-                $where['status**'] = ['!=', 'private'];
198
-            }
199
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
200
-                $where['EVT_wp_user'] = get_current_user_id();
201
-            }
202
-            $events   = EEM_Event::instance()->get_all(
203
-                [
204
-                    $where,
205
-                    'order_by' => ['Datetime.DTT_EVT_start' => 'DESC'],
206
-                ]
207
-            );
208
-            $events[] = [
209
-                'id'   => 0,
210
-                'text' => esc_html__(' - select an event - ', 'event_espresso'),
211
-            ];
212
-            $checked  = 'checked';
213
-            /** @var EE_Event $event */
214
-            foreach ($events as $event) {
215
-                // any registrations for this event?
216
-                if (! $event->get_count_of_all_registrations()) {
217
-                    continue;
218
-                }
219
-                $events[] = [
220
-                    'id'    => $event->ID(),
221
-                    'text'  => apply_filters(
222
-                        'FHEE__EE_Event_Registrations___get_table_filters__event_name',
223
-                        $event->get('EVT_name'),
224
-                        $event
225
-                    ),
226
-                    'class' => $event->is_expired() ? 'ee-expired-event' : '',
227
-                ];
228
-                if ($event->ID() === $current_EVT_ID && $event->is_expired()) {
229
-                    $checked = '';
230
-                }
231
-            }
232
-            $event_filter = '<div class="ee-event-filter">';
233
-            $event_filter .= '<label for="event_id">';
234
-            $event_filter .= esc_html__('Check-in Status for', 'event_espresso');
235
-            $event_filter .= '</label>&nbsp;&nbsp;';
236
-            $event_filter .= EEH_Form_Fields::select_input('event_id', $events, $current_EVT_ID);
237
-            $event_filter .= '<span class="ee-event-filter-toggle">';
238
-            $event_filter .= '<label for="js-ee-hide-expired-events">';
239
-            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '>&nbsp;&nbsp;';
240
-            $event_filter .= esc_html__('Hide Expired Events', 'event_espresso');
241
-            $event_filter .= '</label>';
242
-            $event_filter .= '</span>';
243
-            $event_filter .= '</div>';
244
-            $filters[]    = $event_filter;
245
-        }
246
-        if (! empty($this->_dtts_for_event)) {
247
-            // DTT datetimes filter
248
-            $this->_cur_dtt_id = $this->_req_data['DTT_ID'] ?? 0;
249
-            if (count($this->_dtts_for_event) > 1) {
250
-                $datetimes[0] = esc_html__('To toggle check-in status, select a datetime.', 'event_espresso');
251
-                foreach ($this->_dtts_for_event as $datetime) {
252
-                    $datetime_string              = $datetime->name();
253
-                    $datetime_string              = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
254
-                    $datetime_string              =
255
-                        $datetime->start_date_and_time() . ' - ' . $datetime->end_date_and_time() . $datetime_string;
256
-                    $datetimes[ $datetime->ID() ] = $datetime_string;
257
-                }
258
-                $input     = new EE_Select_Input(
259
-                    $datetimes,
260
-                    [
261
-                        'html_name' => 'DTT_ID',
262
-                        'html_id'   => 'DTT_ID',
263
-                        'default'   => $this->_cur_dtt_id,
264
-                    ]
265
-                );
266
-                $filters[] = $input->get_html_for_input();
267
-                $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
268
-            }
269
-        }
270
-        return $filters;
271
-    }
272
-
273
-
274
-    /**
275
-     * @throws EE_Error
276
-     * @throws ReflectionException
277
-     */
278
-    protected function _add_view_counts()
279
-    {
280
-        $this->_views['all']['count'] = $this->_get_total_event_attendees();
281
-    }
282
-
283
-
284
-    /**
285
-     * @return int
286
-     * @throws EE_Error
287
-     * @throws ReflectionException
288
-     */
289
-    protected function _get_total_event_attendees(): int
290
-    {
291
-        $EVT_ID       = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
292
-        $DTT_ID       = $this->_cur_dtt_id;
293
-        $query_params = [];
294
-        if ($EVT_ID) {
295
-            $query_params[0]['EVT_ID'] = $EVT_ID;
296
-        }
297
-        // if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
298
-        if ($DTT_ID) {
299
-            $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
300
-        }
301
-        $status_ids_array          = apply_filters(
302
-            'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
303
-            [EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved]
304
-        );
305
-        $query_params[0]['STS_ID'] = ['IN', $status_ids_array];
306
-        return EEM_Registration::instance()->count($query_params);
307
-    }
308
-
309
-
310
-    /**
311
-     * @param EE_Registration $item
312
-     * @return string
313
-     * @throws EE_Error
314
-     * @throws ReflectionException
315
-     */
316
-    public function column_cb($item): string
317
-    {
318
-        return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
319
-    }
320
-
321
-
322
-    /**
323
-     * column_REG_att_checked_in
324
-     *
325
-     * @param EE_Registration $registration
326
-     * @return string
327
-     * @throws EE_Error
328
-     * @throws InvalidArgumentException
329
-     * @throws InvalidDataTypeException
330
-     * @throws InvalidInterfaceException
331
-     * @throws ReflectionException
332
-     */
333
-    public function column__REG_att_checked_in(EE_Registration $registration): string
334
-    {
335
-        $attendee      = $registration->attendee();
336
-        $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
337
-
338
-        if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
339
-            $latest_related_datetime = $registration->get_latest_related_datetime();
340
-            if ($latest_related_datetime instanceof EE_Datetime) {
341
-                $this->_cur_dtt_id = $latest_related_datetime->ID();
342
-            }
343
-        }
344
-        $checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId(
345
-            $registration,
346
-            $this->_cur_dtt_id
347
-        );
348
-        $nonce                   = wp_create_nonce('checkin_nonce');
349
-        $toggle_active           = ! empty($this->_cur_dtt_id)
350
-                                   && EE_Registry::instance()->CAP->current_user_can(
351
-                                       'ee_edit_checkin',
352
-                                       'espresso_registrations_toggle_checkin_status',
353
-                                       $registration->ID()
354
-                                   )
355
-            ? ' clickable trigger-checkin'
356
-            : '';
357
-        $mobile_view_content     = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
358
-        return '
15
+	/**
16
+	 * @var Extend_Registrations_Admin_Page
17
+	 */
18
+	protected $_admin_page;
19
+
20
+	/**
21
+	 * This property will hold the related Datetimes on an event IF the event id is included in the request.
22
+	 *
23
+	 * @var EE_Datetime[]
24
+	 */
25
+	protected $_dtts_for_event = [];
26
+
27
+	/**
28
+	 * The event if one is specified in the request
29
+	 *
30
+	 * @var EE_Event
31
+	 */
32
+	protected $_evt = null;
33
+
34
+	/**
35
+	 * The DTT_ID if the current view has a specified datetime.
36
+	 *
37
+	 * @var int $_cur_dtt_id
38
+	 */
39
+	protected $_cur_dtt_id = 0;
40
+
41
+
42
+	/**
43
+	 * EE_Event_Registrations_List_Table constructor.
44
+	 *
45
+	 * @param Registrations_Admin_Page $admin_page
46
+	 */
47
+	public function __construct($admin_page)
48
+	{
49
+		parent::__construct($admin_page);
50
+	}
51
+
52
+
53
+	/**
54
+	 * @throws EE_Error
55
+	 */
56
+	protected function _setup_data()
57
+	{
58
+		$this->_data = $this->_view !== 'trash'
59
+			? $this->_admin_page->get_event_attendees($this->_per_page)
60
+			: $this->_admin_page->get_event_attendees($this->_per_page, false, true);
61
+
62
+		$this->_all_data_count = $this->_view !== 'trash'
63
+			? $this->_admin_page->get_event_attendees($this->_per_page, true)
64
+			: $this->_admin_page->get_event_attendees($this->_per_page, true, true);
65
+	}
66
+
67
+
68
+	/**
69
+	 * @throws ReflectionException
70
+	 * @throws EE_Error
71
+	 */
72
+	protected function _set_properties()
73
+	{
74
+		$return_url = $this->getReturnUrl();
75
+		$evt_id     = $this->_req_data['event_id'] ?? null;
76
+
77
+		$this->_wp_list_args = [
78
+			'singular' => esc_html__('registrant', 'event_espresso'),
79
+			'plural'   => esc_html__('registrants', 'event_espresso'),
80
+			'ajax'     => true,
81
+			'screen'   => $this->_admin_page->get_current_screen()->id,
82
+		];
83
+		$columns             = [];
84
+		$this->_columns      = [
85
+			'_REG_att_checked_in' => esc_html__('Check In', 'event_espresso'),
86
+			'ATT_name'            => esc_html__('Registrant', 'event_espresso'),
87
+			'ATT_email'           => esc_html__('Email Address', 'event_espresso'),
88
+			'Event'               => esc_html__('Event', 'event_espresso'),
89
+			'PRC_name'            => esc_html__('TKT Option', 'event_espresso'),
90
+			'_REG_final_price'    => esc_html__('Price', 'event_espresso'),
91
+			'TXN_paid'            => esc_html__('Paid', 'event_espresso'),
92
+			'TXN_total'           => esc_html__('Total', 'event_espresso'),
93
+		];
94
+		// Add/remove columns when an event has been selected
95
+		if (! empty($evt_id)) {
96
+			// Render a checkbox column
97
+			$columns['cb']              = '<input type="checkbox" />';
98
+			$this->_has_checkbox_column = true;
99
+			// Remove the 'Event' column
100
+			unset($this->_columns['Event']);
101
+		}
102
+		$this->_columns        = array_merge($columns, $this->_columns);
103
+		$this->_primary_column = '_REG_att_checked_in';
104
+		if (
105
+			! empty($evt_id)
106
+			&& EE_Registry::instance()->CAP->current_user_can(
107
+				'ee_read_registrations',
108
+				'espresso_registrations_registrations_reports',
109
+				$evt_id
110
+			)
111
+		) {
112
+			$this->_bottom_buttons = [
113
+				'report' => [
114
+					'route'         => 'registrations_report',
115
+					'extra_request' =>
116
+						[
117
+							'EVT_ID'     => $evt_id,
118
+							'return_url' => $return_url,
119
+						],
120
+				],
121
+			];
122
+		}
123
+		$this->_bottom_buttons['report_filtered'] = [
124
+			'route'         => 'registrations_checkin_report',
125
+			'extra_request' => [
126
+				'use_filters' => true,
127
+				'filters'     => array_merge(
128
+					[
129
+						'EVT_ID' => $evt_id,
130
+					],
131
+					array_diff_key(
132
+						$this->_req_data,
133
+						array_flip(
134
+							[
135
+								'page',
136
+								'action',
137
+								'default_nonce',
138
+							]
139
+						)
140
+					)
141
+				),
142
+				'return_url'  => $return_url,
143
+			],
144
+		];
145
+		$this->_sortable_columns                  = [
146
+			/**
147
+			 * Allows users to change the default sort if they wish.
148
+			 * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
149
+			 *
150
+			 * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to
151
+			 * change the sorts on any list table involving registration contacts.  If you want to only change the filter
152
+			 * for a specific list table you can use the provided reference to this object instance.
153
+			 */
154
+			'ATT_name' => [
155
+				'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
156
+				true,
157
+				$this,
158
+			]
159
+				? ['ATT_lname' => true]
160
+				: ['ATT_fname' => true],
161
+			'Event'    => ['Event.EVT_name' => false],
162
+		];
163
+		$this->_hidden_columns                    = [];
164
+		$this->_evt                               = EEM_Event::instance()->get_one_by_ID($evt_id);
165
+		$this->_dtts_for_event                    =
166
+			$this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : [];
167
+	}
168
+
169
+
170
+	/**
171
+	 * @param EE_Registration $item
172
+	 * @return string
173
+	 */
174
+	protected function _get_row_class($item): string
175
+	{
176
+		$class = parent::_get_row_class($item);
177
+		if ($this->_has_checkbox_column) {
178
+			$class .= ' has-checkbox-column';
179
+		}
180
+		return $class;
181
+	}
182
+
183
+
184
+	/**
185
+	 * @return array
186
+	 * @throws EE_Error
187
+	 * @throws ReflectionException
188
+	 */
189
+	protected function _get_table_filters(): array
190
+	{
191
+		$filters        = $where = [];
192
+		$current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
193
+		if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
194
+			// this means we don't have an event so let's setup a filter dropdown for all the events to select
195
+			// note possible capability restrictions
196
+			if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
197
+				$where['status**'] = ['!=', 'private'];
198
+			}
199
+			if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
200
+				$where['EVT_wp_user'] = get_current_user_id();
201
+			}
202
+			$events   = EEM_Event::instance()->get_all(
203
+				[
204
+					$where,
205
+					'order_by' => ['Datetime.DTT_EVT_start' => 'DESC'],
206
+				]
207
+			);
208
+			$events[] = [
209
+				'id'   => 0,
210
+				'text' => esc_html__(' - select an event - ', 'event_espresso'),
211
+			];
212
+			$checked  = 'checked';
213
+			/** @var EE_Event $event */
214
+			foreach ($events as $event) {
215
+				// any registrations for this event?
216
+				if (! $event->get_count_of_all_registrations()) {
217
+					continue;
218
+				}
219
+				$events[] = [
220
+					'id'    => $event->ID(),
221
+					'text'  => apply_filters(
222
+						'FHEE__EE_Event_Registrations___get_table_filters__event_name',
223
+						$event->get('EVT_name'),
224
+						$event
225
+					),
226
+					'class' => $event->is_expired() ? 'ee-expired-event' : '',
227
+				];
228
+				if ($event->ID() === $current_EVT_ID && $event->is_expired()) {
229
+					$checked = '';
230
+				}
231
+			}
232
+			$event_filter = '<div class="ee-event-filter">';
233
+			$event_filter .= '<label for="event_id">';
234
+			$event_filter .= esc_html__('Check-in Status for', 'event_espresso');
235
+			$event_filter .= '</label>&nbsp;&nbsp;';
236
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $events, $current_EVT_ID);
237
+			$event_filter .= '<span class="ee-event-filter-toggle">';
238
+			$event_filter .= '<label for="js-ee-hide-expired-events">';
239
+			$event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '>&nbsp;&nbsp;';
240
+			$event_filter .= esc_html__('Hide Expired Events', 'event_espresso');
241
+			$event_filter .= '</label>';
242
+			$event_filter .= '</span>';
243
+			$event_filter .= '</div>';
244
+			$filters[]    = $event_filter;
245
+		}
246
+		if (! empty($this->_dtts_for_event)) {
247
+			// DTT datetimes filter
248
+			$this->_cur_dtt_id = $this->_req_data['DTT_ID'] ?? 0;
249
+			if (count($this->_dtts_for_event) > 1) {
250
+				$datetimes[0] = esc_html__('To toggle check-in status, select a datetime.', 'event_espresso');
251
+				foreach ($this->_dtts_for_event as $datetime) {
252
+					$datetime_string              = $datetime->name();
253
+					$datetime_string              = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
254
+					$datetime_string              =
255
+						$datetime->start_date_and_time() . ' - ' . $datetime->end_date_and_time() . $datetime_string;
256
+					$datetimes[ $datetime->ID() ] = $datetime_string;
257
+				}
258
+				$input     = new EE_Select_Input(
259
+					$datetimes,
260
+					[
261
+						'html_name' => 'DTT_ID',
262
+						'html_id'   => 'DTT_ID',
263
+						'default'   => $this->_cur_dtt_id,
264
+					]
265
+				);
266
+				$filters[] = $input->get_html_for_input();
267
+				$filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
268
+			}
269
+		}
270
+		return $filters;
271
+	}
272
+
273
+
274
+	/**
275
+	 * @throws EE_Error
276
+	 * @throws ReflectionException
277
+	 */
278
+	protected function _add_view_counts()
279
+	{
280
+		$this->_views['all']['count'] = $this->_get_total_event_attendees();
281
+	}
282
+
283
+
284
+	/**
285
+	 * @return int
286
+	 * @throws EE_Error
287
+	 * @throws ReflectionException
288
+	 */
289
+	protected function _get_total_event_attendees(): int
290
+	{
291
+		$EVT_ID       = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
292
+		$DTT_ID       = $this->_cur_dtt_id;
293
+		$query_params = [];
294
+		if ($EVT_ID) {
295
+			$query_params[0]['EVT_ID'] = $EVT_ID;
296
+		}
297
+		// if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
298
+		if ($DTT_ID) {
299
+			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
300
+		}
301
+		$status_ids_array          = apply_filters(
302
+			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
303
+			[EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved]
304
+		);
305
+		$query_params[0]['STS_ID'] = ['IN', $status_ids_array];
306
+		return EEM_Registration::instance()->count($query_params);
307
+	}
308
+
309
+
310
+	/**
311
+	 * @param EE_Registration $item
312
+	 * @return string
313
+	 * @throws EE_Error
314
+	 * @throws ReflectionException
315
+	 */
316
+	public function column_cb($item): string
317
+	{
318
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
319
+	}
320
+
321
+
322
+	/**
323
+	 * column_REG_att_checked_in
324
+	 *
325
+	 * @param EE_Registration $registration
326
+	 * @return string
327
+	 * @throws EE_Error
328
+	 * @throws InvalidArgumentException
329
+	 * @throws InvalidDataTypeException
330
+	 * @throws InvalidInterfaceException
331
+	 * @throws ReflectionException
332
+	 */
333
+	public function column__REG_att_checked_in(EE_Registration $registration): string
334
+	{
335
+		$attendee      = $registration->attendee();
336
+		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
337
+
338
+		if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
339
+			$latest_related_datetime = $registration->get_latest_related_datetime();
340
+			if ($latest_related_datetime instanceof EE_Datetime) {
341
+				$this->_cur_dtt_id = $latest_related_datetime->ID();
342
+			}
343
+		}
344
+		$checkin_status_dashicon = CheckinStatusDashicon::fromRegistrationAndDatetimeId(
345
+			$registration,
346
+			$this->_cur_dtt_id
347
+		);
348
+		$nonce                   = wp_create_nonce('checkin_nonce');
349
+		$toggle_active           = ! empty($this->_cur_dtt_id)
350
+								   && EE_Registry::instance()->CAP->current_user_can(
351
+									   'ee_edit_checkin',
352
+									   'espresso_registrations_toggle_checkin_status',
353
+									   $registration->ID()
354
+								   )
355
+			? ' clickable trigger-checkin'
356
+			: '';
357
+		$mobile_view_content     = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
358
+		return '
359 359
         <button class="button button--secondary button--icon-only ' . $toggle_active . '"
360 360
                 data-_regid="' . $registration->ID() . '"
361 361
                 data-dttid="' . $this->_cur_dtt_id . '"
@@ -364,263 +364,263 @@  discard block
 block discarded – undo
364 364
             <span class="' . $checkin_status_dashicon->cssClasses() . '"></span>
365 365
         </button>
366 366
             '
367
-               . $mobile_view_content;
368
-    }
369
-
370
-
371
-    /**
372
-     * @param EE_Registration $registration
373
-     * @return string
374
-     * @throws EE_Error
375
-     * @throws ReflectionException
376
-     */
377
-    public function column_ATT_name(EE_Registration $registration): string
378
-    {
379
-        $attendee = $registration->attendee();
380
-        if (! $attendee instanceof EE_Attendee) {
381
-            return esc_html__('No contact record for this registration.', 'event_espresso');
382
-        }
383
-        // edit attendee link
384
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
385
-            ['action' => 'view_registration', '_REG_ID' => $registration->ID()],
386
-            REG_ADMIN_URL
387
-        );
388
-        $name_link    = '
367
+			   . $mobile_view_content;
368
+	}
369
+
370
+
371
+	/**
372
+	 * @param EE_Registration $registration
373
+	 * @return string
374
+	 * @throws EE_Error
375
+	 * @throws ReflectionException
376
+	 */
377
+	public function column_ATT_name(EE_Registration $registration): string
378
+	{
379
+		$attendee = $registration->attendee();
380
+		if (! $attendee instanceof EE_Attendee) {
381
+			return esc_html__('No contact record for this registration.', 'event_espresso');
382
+		}
383
+		// edit attendee link
384
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
385
+			['action' => 'view_registration', '_REG_ID' => $registration->ID()],
386
+			REG_ADMIN_URL
387
+		);
388
+		$name_link    = '
389 389
             <span class="ee-status-dot ee-status-bg--' . esc_attr($registration->status_ID()) . ' ee-aria-tooltip"
390 390
             aria-label="' . EEH_Template::pretty_status($registration->status_ID(), false, 'sentence') . '">
391 391
             </span>';
392
-        $name_link    .= EE_Registry::instance()->CAP->current_user_can(
393
-            'ee_edit_contacts',
394
-            'espresso_registrations_edit_attendee'
395
-        )
396
-            ? '<a class="ee-aria-tooltip" href="' . $edit_lnk_url . '" aria-label="' . esc_attr__(
397
-                'View Registration Details',
398
-                'event_espresso'
399
-            ) . '">'
400
-              . $registration->attendee()->full_name()
401
-              . '</a>'
402
-            : $registration->attendee()->full_name();
403
-        $name_link    .= $registration->count() === 1
404
-            ? '&nbsp;<sup><div class="dashicons dashicons-star-filled gold-icon"></div></sup>	'
405
-            : '';
406
-        // add group details
407
-        $name_link .= '&nbsp;' . sprintf(
408
-            esc_html__('(%s of %s)', 'event_espresso'),
409
-            $registration->count(),
410
-            $registration->group_size()
411
-        );
412
-        // add regcode
413
-        $link      = EE_Admin_Page::add_query_args_and_nonce(
414
-            ['action' => 'view_registration', '_REG_ID' => $registration->ID()],
415
-            REG_ADMIN_URL
416
-        );
417
-        $name_link .= '<br>';
418
-        $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can(
419
-            'ee_read_registration',
420
-            'view_registration',
421
-            $registration->ID()
422
-        )
423
-            ? '<a class="ee-aria-tooltip" href="' . $link . '" aria-label="' . esc_attr__(
424
-                'View Registration Details',
425
-                'event_espresso'
426
-            ) . '">'
427
-              . $registration->reg_code()
428
-              . '</a>'
429
-            : $registration->reg_code();
430
-        // status
431
-        // $name_link               .= '<br><span class="ee-status-text-small">';
432
-        // $name_link               .= EEH_Template::pretty_status($registration->status_ID(), false, 'sentence');
433
-        // $name_link               .= '</span>';
434
-        $actions                 = [];
435
-        $DTT_ID                  = $this->_cur_dtt_id;
436
-        $latest_related_datetime =
437
-            empty($DTT_ID) && ! empty($this->_req_data['event_id'])
438
-                ? $registration->get_latest_related_datetime()
439
-                : null;
440
-        $DTT_ID                  = $latest_related_datetime instanceof EE_Datetime
441
-            ? $latest_related_datetime->ID()
442
-            : $DTT_ID;
443
-        if (
444
-            ! empty($DTT_ID)
445
-            && EE_Registry::instance()->CAP->current_user_can(
446
-                'ee_read_checkins',
447
-                'espresso_registrations_registration_checkins'
448
-            )
449
-        ) {
450
-            $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
451
-                ['action' => 'registration_checkins', '_REG_ID' => $registration->ID(), 'DTT_ID' => $DTT_ID],
452
-                REG_ADMIN_URL
453
-            );
454
-            // get the timestamps for this registration's checkins, related to the selected datetime
455
-            $timestamps = $registration->get_many_related('Checkin', [['DTT_ID' => $DTT_ID]]);
456
-            if (! empty($timestamps)) {
457
-                // get the last timestamp
458
-                $last_timestamp = end($timestamps);
459
-                // checked in or checked out?
460
-                $checkin_status = $last_timestamp->get('CHK_in')
461
-                    ? esc_html__('Checked In', 'event_espresso')
462
-                    : esc_html__('Checked Out', 'event_espresso');
463
-                // get timestamp string
464
-                $timestamp_string   = $last_timestamp->get_datetime('CHK_timestamp');
465
-                $actions['checkin'] = '<a class="ee-aria-tooltip" href="' . $checkin_list_url . '" aria-label="'
466
-                                      . esc_attr__(
467
-                                          'View this registrant\'s check-ins/checkouts for the datetime',
468
-                                          'event_espresso'
469
-                                      ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
470
-            }
471
-        }
472
-        return (! empty($DTT_ID) && ! empty($timestamps))
473
-            ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
474
-            : $name_link;
475
-    }
476
-
477
-
478
-    /**
479
-     * @param EE_Registration $registration
480
-     * @return string
481
-     * @throws EE_Error
482
-     * @throws EE_Error
483
-     */
484
-    public function column_ATT_email(EE_Registration $registration): string
485
-    {
486
-        $attendee = $registration->attendee();
487
-        return $attendee instanceof EE_Attendee ? $attendee->email() : '';
488
-    }
489
-
490
-
491
-    /**
492
-     * @param EE_Registration $registration
493
-     * @return bool|string
494
-     * @throws EE_Error
495
-     * @throws ReflectionException
496
-     */
497
-    public function column_Event(EE_Registration $registration)
498
-    {
499
-        try {
500
-            $event            = $this->_evt instanceof EE_Event ? $this->_evt : $registration->event();
501
-            $checkin_link_url = EE_Admin_Page::add_query_args_and_nonce(
502
-                ['action' => 'event_registrations', 'event_id' => $event->ID()],
503
-                REG_ADMIN_URL
504
-            );
505
-            $event_label      = EE_Registry::instance()->CAP->current_user_can(
506
-                'ee_read_checkins',
507
-                'espresso_registrations_registration_checkins'
508
-            ) ? '<a class="ee-aria-tooltip" href="' . $checkin_link_url . '" aria-label="'
509
-                . esc_attr__(
510
-                    'View Checkins for this Event',
511
-                    'event_espresso'
512
-                ) . '">' . $event->name() . '</a>' : $event->name();
513
-        } catch (EntityNotFoundException $e) {
514
-            $event_label = esc_html__('Unknown', 'event_espresso');
515
-        }
516
-        return $event_label;
517
-    }
518
-
519
-
520
-    /**
521
-     * @param EE_Registration $registration
522
-     * @return string
523
-     * @throws EE_Error
524
-     * @throws ReflectionException
525
-     */
526
-    public function column_PRC_name(EE_Registration $registration): string
527
-    {
528
-        return $registration->ticket() instanceof EE_Ticket
529
-            ? $registration->ticket()->name()
530
-            : esc_html__(
531
-                "Unknown",
532
-                "event_espresso"
533
-            );
534
-    }
535
-
536
-
537
-    /**
538
-     * column_REG_final_price
539
-     *
540
-     * @param EE_Registration $registration
541
-     * @return string
542
-     * @throws EE_Error
543
-     */
544
-    public function column__REG_final_price(EE_Registration $registration): string
545
-    {
546
-        return '<span class="reg-pad-rght">' . ' ' . $registration->pretty_final_price() . '</span>';
547
-    }
548
-
549
-
550
-    /**
551
-     * column_TXN_paid
552
-     *
553
-     * @param EE_Registration $registration
554
-     * @return string
555
-     * @throws EE_Error
556
-     * @throws ReflectionException
557
-     */
558
-    public function column_TXN_paid(EE_Registration $registration): string
559
-    {
560
-        if ($registration->count() === 1) {
561
-            if ($registration->transaction()->paid() >= $registration->transaction()->total()) {
562
-                return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
563
-            } else {
564
-                $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
565
-                    ['action' => 'view_transaction', 'TXN_ID' => $registration->transaction_ID()],
566
-                    TXN_ADMIN_URL
567
-                );
568
-                return EE_Registry::instance()->CAP->current_user_can(
569
-                    'ee_read_transaction',
570
-                    'espresso_transactions_view_transaction'
571
-                ) ? '
392
+		$name_link    .= EE_Registry::instance()->CAP->current_user_can(
393
+			'ee_edit_contacts',
394
+			'espresso_registrations_edit_attendee'
395
+		)
396
+			? '<a class="ee-aria-tooltip" href="' . $edit_lnk_url . '" aria-label="' . esc_attr__(
397
+				'View Registration Details',
398
+				'event_espresso'
399
+			) . '">'
400
+			  . $registration->attendee()->full_name()
401
+			  . '</a>'
402
+			: $registration->attendee()->full_name();
403
+		$name_link    .= $registration->count() === 1
404
+			? '&nbsp;<sup><div class="dashicons dashicons-star-filled gold-icon"></div></sup>	'
405
+			: '';
406
+		// add group details
407
+		$name_link .= '&nbsp;' . sprintf(
408
+			esc_html__('(%s of %s)', 'event_espresso'),
409
+			$registration->count(),
410
+			$registration->group_size()
411
+		);
412
+		// add regcode
413
+		$link      = EE_Admin_Page::add_query_args_and_nonce(
414
+			['action' => 'view_registration', '_REG_ID' => $registration->ID()],
415
+			REG_ADMIN_URL
416
+		);
417
+		$name_link .= '<br>';
418
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can(
419
+			'ee_read_registration',
420
+			'view_registration',
421
+			$registration->ID()
422
+		)
423
+			? '<a class="ee-aria-tooltip" href="' . $link . '" aria-label="' . esc_attr__(
424
+				'View Registration Details',
425
+				'event_espresso'
426
+			) . '">'
427
+			  . $registration->reg_code()
428
+			  . '</a>'
429
+			: $registration->reg_code();
430
+		// status
431
+		// $name_link               .= '<br><span class="ee-status-text-small">';
432
+		// $name_link               .= EEH_Template::pretty_status($registration->status_ID(), false, 'sentence');
433
+		// $name_link               .= '</span>';
434
+		$actions                 = [];
435
+		$DTT_ID                  = $this->_cur_dtt_id;
436
+		$latest_related_datetime =
437
+			empty($DTT_ID) && ! empty($this->_req_data['event_id'])
438
+				? $registration->get_latest_related_datetime()
439
+				: null;
440
+		$DTT_ID                  = $latest_related_datetime instanceof EE_Datetime
441
+			? $latest_related_datetime->ID()
442
+			: $DTT_ID;
443
+		if (
444
+			! empty($DTT_ID)
445
+			&& EE_Registry::instance()->CAP->current_user_can(
446
+				'ee_read_checkins',
447
+				'espresso_registrations_registration_checkins'
448
+			)
449
+		) {
450
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
451
+				['action' => 'registration_checkins', '_REG_ID' => $registration->ID(), 'DTT_ID' => $DTT_ID],
452
+				REG_ADMIN_URL
453
+			);
454
+			// get the timestamps for this registration's checkins, related to the selected datetime
455
+			$timestamps = $registration->get_many_related('Checkin', [['DTT_ID' => $DTT_ID]]);
456
+			if (! empty($timestamps)) {
457
+				// get the last timestamp
458
+				$last_timestamp = end($timestamps);
459
+				// checked in or checked out?
460
+				$checkin_status = $last_timestamp->get('CHK_in')
461
+					? esc_html__('Checked In', 'event_espresso')
462
+					: esc_html__('Checked Out', 'event_espresso');
463
+				// get timestamp string
464
+				$timestamp_string   = $last_timestamp->get_datetime('CHK_timestamp');
465
+				$actions['checkin'] = '<a class="ee-aria-tooltip" href="' . $checkin_list_url . '" aria-label="'
466
+									  . esc_attr__(
467
+										  'View this registrant\'s check-ins/checkouts for the datetime',
468
+										  'event_espresso'
469
+									  ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
470
+			}
471
+		}
472
+		return (! empty($DTT_ID) && ! empty($timestamps))
473
+			? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
474
+			: $name_link;
475
+	}
476
+
477
+
478
+	/**
479
+	 * @param EE_Registration $registration
480
+	 * @return string
481
+	 * @throws EE_Error
482
+	 * @throws EE_Error
483
+	 */
484
+	public function column_ATT_email(EE_Registration $registration): string
485
+	{
486
+		$attendee = $registration->attendee();
487
+		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
488
+	}
489
+
490
+
491
+	/**
492
+	 * @param EE_Registration $registration
493
+	 * @return bool|string
494
+	 * @throws EE_Error
495
+	 * @throws ReflectionException
496
+	 */
497
+	public function column_Event(EE_Registration $registration)
498
+	{
499
+		try {
500
+			$event            = $this->_evt instanceof EE_Event ? $this->_evt : $registration->event();
501
+			$checkin_link_url = EE_Admin_Page::add_query_args_and_nonce(
502
+				['action' => 'event_registrations', 'event_id' => $event->ID()],
503
+				REG_ADMIN_URL
504
+			);
505
+			$event_label      = EE_Registry::instance()->CAP->current_user_can(
506
+				'ee_read_checkins',
507
+				'espresso_registrations_registration_checkins'
508
+			) ? '<a class="ee-aria-tooltip" href="' . $checkin_link_url . '" aria-label="'
509
+				. esc_attr__(
510
+					'View Checkins for this Event',
511
+					'event_espresso'
512
+				) . '">' . $event->name() . '</a>' : $event->name();
513
+		} catch (EntityNotFoundException $e) {
514
+			$event_label = esc_html__('Unknown', 'event_espresso');
515
+		}
516
+		return $event_label;
517
+	}
518
+
519
+
520
+	/**
521
+	 * @param EE_Registration $registration
522
+	 * @return string
523
+	 * @throws EE_Error
524
+	 * @throws ReflectionException
525
+	 */
526
+	public function column_PRC_name(EE_Registration $registration): string
527
+	{
528
+		return $registration->ticket() instanceof EE_Ticket
529
+			? $registration->ticket()->name()
530
+			: esc_html__(
531
+				"Unknown",
532
+				"event_espresso"
533
+			);
534
+	}
535
+
536
+
537
+	/**
538
+	 * column_REG_final_price
539
+	 *
540
+	 * @param EE_Registration $registration
541
+	 * @return string
542
+	 * @throws EE_Error
543
+	 */
544
+	public function column__REG_final_price(EE_Registration $registration): string
545
+	{
546
+		return '<span class="reg-pad-rght">' . ' ' . $registration->pretty_final_price() . '</span>';
547
+	}
548
+
549
+
550
+	/**
551
+	 * column_TXN_paid
552
+	 *
553
+	 * @param EE_Registration $registration
554
+	 * @return string
555
+	 * @throws EE_Error
556
+	 * @throws ReflectionException
557
+	 */
558
+	public function column_TXN_paid(EE_Registration $registration): string
559
+	{
560
+		if ($registration->count() === 1) {
561
+			if ($registration->transaction()->paid() >= $registration->transaction()->total()) {
562
+				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
563
+			} else {
564
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
565
+					['action' => 'view_transaction', 'TXN_ID' => $registration->transaction_ID()],
566
+					TXN_ADMIN_URL
567
+				);
568
+				return EE_Registry::instance()->CAP->current_user_can(
569
+					'ee_read_transaction',
570
+					'espresso_transactions_view_transaction'
571
+				) ? '
572 572
 				<span class="reg-pad-rght">
573 573
 					<a class="ee-aria-tooltip ee-status-color--'
574
-                    . $registration->transaction()->status_ID()
575
-                    . '" href="'
576
-                    . $view_txn_lnk_url
577
-                    . '"  aria-label="'
578
-                    . esc_attr__('View Transaction', 'event_espresso')
579
-                    . '">
574
+					. $registration->transaction()->status_ID()
575
+					. '" href="'
576
+					. $view_txn_lnk_url
577
+					. '"  aria-label="'
578
+					. esc_attr__('View Transaction', 'event_espresso')
579
+					. '">
580 580
 						'
581
-                    . $registration->transaction()->pretty_paid()
582
-                    . '
581
+					. $registration->transaction()->pretty_paid()
582
+					. '
583 583
 					</a>
584 584
 				<span>' : '<span class="reg-pad-rght">' . $registration->transaction()->pretty_paid() . '</span>';
585
-            }
586
-        } else {
587
-            return '<span class="reg-pad-rght"></span>';
588
-        }
589
-    }
590
-
591
-
592
-    /**
593
-     *        column_TXN_total
594
-     *
595
-     * @param EE_Registration $registration
596
-     * @return string
597
-     * @throws EE_Error
598
-     * @throws ReflectionException
599
-     */
600
-    public function column_TXN_total(EE_Registration $registration): string
601
-    {
602
-        $txn          = $registration->transaction();
603
-        $view_txn_url = add_query_arg(['action' => 'view_transaction', 'TXN_ID' => $txn->ID()], TXN_ADMIN_URL);
604
-        if ($registration->get('REG_count') === 1) {
605
-            $line_total_obj = $txn->total_line_item();
606
-            $txn_total      = $line_total_obj instanceof EE_Line_Item
607
-                ? $line_total_obj->get_pretty('LIN_total')
608
-                : esc_html__(
609
-                    'View Transaction',
610
-                    'event_espresso'
611
-                );
612
-            return EE_Registry::instance()->CAP->current_user_can(
613
-                'ee_read_transaction',
614
-                'espresso_transactions_view_transaction'
615
-            ) ? '<a class="ee-aria-tooltip" href="'
616
-                . $view_txn_url
617
-                . '" aria-label="'
618
-                . esc_attr__('View Transaction', 'event_espresso')
619
-                . '"><span class="reg-pad-rght">'
620
-                . $txn_total
621
-                . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
622
-        } else {
623
-            return '<span class="reg-pad-rght"></span>';
624
-        }
625
-    }
585
+			}
586
+		} else {
587
+			return '<span class="reg-pad-rght"></span>';
588
+		}
589
+	}
590
+
591
+
592
+	/**
593
+	 *        column_TXN_total
594
+	 *
595
+	 * @param EE_Registration $registration
596
+	 * @return string
597
+	 * @throws EE_Error
598
+	 * @throws ReflectionException
599
+	 */
600
+	public function column_TXN_total(EE_Registration $registration): string
601
+	{
602
+		$txn          = $registration->transaction();
603
+		$view_txn_url = add_query_arg(['action' => 'view_transaction', 'TXN_ID' => $txn->ID()], TXN_ADMIN_URL);
604
+		if ($registration->get('REG_count') === 1) {
605
+			$line_total_obj = $txn->total_line_item();
606
+			$txn_total      = $line_total_obj instanceof EE_Line_Item
607
+				? $line_total_obj->get_pretty('LIN_total')
608
+				: esc_html__(
609
+					'View Transaction',
610
+					'event_espresso'
611
+				);
612
+			return EE_Registry::instance()->CAP->current_user_can(
613
+				'ee_read_transaction',
614
+				'espresso_transactions_view_transaction'
615
+			) ? '<a class="ee-aria-tooltip" href="'
616
+				. $view_txn_url
617
+				. '" aria-label="'
618
+				. esc_attr__('View Transaction', 'event_espresso')
619
+				. '"><span class="reg-pad-rght">'
620
+				. $txn_total
621
+				. '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
622
+		} else {
623
+			return '<span class="reg-pad-rght"></span>';
624
+		}
625
+	}
626 626
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             'TXN_total'           => esc_html__('Total', 'event_espresso'),
93 93
         ];
94 94
         // Add/remove columns when an event has been selected
95
-        if (! empty($evt_id)) {
95
+        if ( ! empty($evt_id)) {
96 96
             // Render a checkbox column
97 97
             $columns['cb']              = '<input type="checkbox" />';
98 98
             $this->_has_checkbox_column = true;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 'return_url'  => $return_url,
143 143
             ],
144 144
         ];
145
-        $this->_sortable_columns                  = [
145
+        $this->_sortable_columns = [
146 146
             /**
147 147
              * Allows users to change the default sort if they wish.
148 148
              * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
         if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
194 194
             // this means we don't have an event so let's setup a filter dropdown for all the events to select
195 195
             // note possible capability restrictions
196
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
196
+            if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
197 197
                 $where['status**'] = ['!=', 'private'];
198 198
             }
199
-            if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
199
+            if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
200 200
                 $where['EVT_wp_user'] = get_current_user_id();
201 201
             }
202
-            $events   = EEM_Event::instance()->get_all(
202
+            $events = EEM_Event::instance()->get_all(
203 203
                 [
204 204
                     $where,
205 205
                     'order_by' => ['Datetime.DTT_EVT_start' => 'DESC'],
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
                 'id'   => 0,
210 210
                 'text' => esc_html__(' - select an event - ', 'event_espresso'),
211 211
             ];
212
-            $checked  = 'checked';
212
+            $checked = 'checked';
213 213
             /** @var EE_Event $event */
214 214
             foreach ($events as $event) {
215 215
                 // any registrations for this event?
216
-                if (! $event->get_count_of_all_registrations()) {
216
+                if ( ! $event->get_count_of_all_registrations()) {
217 217
                     continue;
218 218
                 }
219 219
                 $events[] = [
@@ -236,26 +236,26 @@  discard block
 block discarded – undo
236 236
             $event_filter .= EEH_Form_Fields::select_input('event_id', $events, $current_EVT_ID);
237 237
             $event_filter .= '<span class="ee-event-filter-toggle">';
238 238
             $event_filter .= '<label for="js-ee-hide-expired-events">';
239
-            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '>&nbsp;&nbsp;';
239
+            $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'>&nbsp;&nbsp;';
240 240
             $event_filter .= esc_html__('Hide Expired Events', 'event_espresso');
241 241
             $event_filter .= '</label>';
242 242
             $event_filter .= '</span>';
243 243
             $event_filter .= '</div>';
244
-            $filters[]    = $event_filter;
244
+            $filters[] = $event_filter;
245 245
         }
246
-        if (! empty($this->_dtts_for_event)) {
246
+        if ( ! empty($this->_dtts_for_event)) {
247 247
             // DTT datetimes filter
248 248
             $this->_cur_dtt_id = $this->_req_data['DTT_ID'] ?? 0;
249 249
             if (count($this->_dtts_for_event) > 1) {
250 250
                 $datetimes[0] = esc_html__('To toggle check-in status, select a datetime.', 'event_espresso');
251 251
                 foreach ($this->_dtts_for_event as $datetime) {
252 252
                     $datetime_string              = $datetime->name();
253
-                    $datetime_string              = ! empty($datetime_string) ? ' (' . $datetime_string . ')' : '';
253
+                    $datetime_string              = ! empty($datetime_string) ? ' ('.$datetime_string.')' : '';
254 254
                     $datetime_string              =
255
-                        $datetime->start_date_and_time() . ' - ' . $datetime->end_date_and_time() . $datetime_string;
256
-                    $datetimes[ $datetime->ID() ] = $datetime_string;
255
+                        $datetime->start_date_and_time().' - '.$datetime->end_date_and_time().$datetime_string;
256
+                    $datetimes[$datetime->ID()] = $datetime_string;
257 257
                 }
258
-                $input     = new EE_Select_Input(
258
+                $input = new EE_Select_Input(
259 259
                     $datetimes,
260 260
                     [
261 261
                         'html_name' => 'DTT_ID',
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                     ]
265 265
                 );
266 266
                 $filters[] = $input->get_html_for_input();
267
-                $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
267
+                $filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">';
268 268
             }
269 269
         }
270 270
         return $filters;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         if ($DTT_ID) {
299 299
             $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
300 300
         }
301
-        $status_ids_array          = apply_filters(
301
+        $status_ids_array = apply_filters(
302 302
             'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
303 303
             [EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved]
304 304
         );
@@ -354,14 +354,14 @@  discard block
 block discarded – undo
354 354
                                    )
355 355
             ? ' clickable trigger-checkin'
356 356
             : '';
357
-        $mobile_view_content     = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
357
+        $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
358 358
         return '
359
-        <button class="button button--secondary button--icon-only ' . $toggle_active . '"
360
-                data-_regid="' . $registration->ID() . '"
361
-                data-dttid="' . $this->_cur_dtt_id . '"
362
-                data-nonce="' . $nonce . '"
359
+        <button class="button button--secondary button--icon-only ' . $toggle_active.'"
360
+                data-_regid="' . $registration->ID().'"
361
+                data-dttid="' . $this->_cur_dtt_id.'"
362
+                data-nonce="' . $nonce.'"
363 363
         >   
364
-            <span class="' . $checkin_status_dashicon->cssClasses() . '"></span>
364
+            <span class="' . $checkin_status_dashicon->cssClasses().'"></span>
365 365
         </button>
366 366
             '
367 367
                . $mobile_view_content;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     public function column_ATT_name(EE_Registration $registration): string
378 378
     {
379 379
         $attendee = $registration->attendee();
380
-        if (! $attendee instanceof EE_Attendee) {
380
+        if ( ! $attendee instanceof EE_Attendee) {
381 381
             return esc_html__('No contact record for this registration.', 'event_espresso');
382 382
         }
383 383
         // edit attendee link
@@ -385,32 +385,32 @@  discard block
 block discarded – undo
385 385
             ['action' => 'view_registration', '_REG_ID' => $registration->ID()],
386 386
             REG_ADMIN_URL
387 387
         );
388
-        $name_link    = '
389
-            <span class="ee-status-dot ee-status-bg--' . esc_attr($registration->status_ID()) . ' ee-aria-tooltip"
390
-            aria-label="' . EEH_Template::pretty_status($registration->status_ID(), false, 'sentence') . '">
388
+        $name_link = '
389
+            <span class="ee-status-dot ee-status-bg--' . esc_attr($registration->status_ID()).' ee-aria-tooltip"
390
+            aria-label="' . EEH_Template::pretty_status($registration->status_ID(), false, 'sentence').'">
391 391
             </span>';
392
-        $name_link    .= EE_Registry::instance()->CAP->current_user_can(
392
+        $name_link .= EE_Registry::instance()->CAP->current_user_can(
393 393
             'ee_edit_contacts',
394 394
             'espresso_registrations_edit_attendee'
395 395
         )
396
-            ? '<a class="ee-aria-tooltip" href="' . $edit_lnk_url . '" aria-label="' . esc_attr__(
396
+            ? '<a class="ee-aria-tooltip" href="'.$edit_lnk_url.'" aria-label="'.esc_attr__(
397 397
                 'View Registration Details',
398 398
                 'event_espresso'
399
-            ) . '">'
399
+            ).'">'
400 400
               . $registration->attendee()->full_name()
401 401
               . '</a>'
402 402
             : $registration->attendee()->full_name();
403
-        $name_link    .= $registration->count() === 1
403
+        $name_link .= $registration->count() === 1
404 404
             ? '&nbsp;<sup><div class="dashicons dashicons-star-filled gold-icon"></div></sup>	'
405 405
             : '';
406 406
         // add group details
407
-        $name_link .= '&nbsp;' . sprintf(
407
+        $name_link .= '&nbsp;'.sprintf(
408 408
             esc_html__('(%s of %s)', 'event_espresso'),
409 409
             $registration->count(),
410 410
             $registration->group_size()
411 411
         );
412 412
         // add regcode
413
-        $link      = EE_Admin_Page::add_query_args_and_nonce(
413
+        $link = EE_Admin_Page::add_query_args_and_nonce(
414 414
             ['action' => 'view_registration', '_REG_ID' => $registration->ID()],
415 415
             REG_ADMIN_URL
416 416
         );
@@ -420,10 +420,10 @@  discard block
 block discarded – undo
420 420
             'view_registration',
421 421
             $registration->ID()
422 422
         )
423
-            ? '<a class="ee-aria-tooltip" href="' . $link . '" aria-label="' . esc_attr__(
423
+            ? '<a class="ee-aria-tooltip" href="'.$link.'" aria-label="'.esc_attr__(
424 424
                 'View Registration Details',
425 425
                 'event_espresso'
426
-            ) . '">'
426
+            ).'">'
427 427
               . $registration->reg_code()
428 428
               . '</a>'
429 429
             : $registration->reg_code();
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
             empty($DTT_ID) && ! empty($this->_req_data['event_id'])
438 438
                 ? $registration->get_latest_related_datetime()
439 439
                 : null;
440
-        $DTT_ID                  = $latest_related_datetime instanceof EE_Datetime
440
+        $DTT_ID = $latest_related_datetime instanceof EE_Datetime
441 441
             ? $latest_related_datetime->ID()
442 442
             : $DTT_ID;
443 443
         if (
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
             );
454 454
             // get the timestamps for this registration's checkins, related to the selected datetime
455 455
             $timestamps = $registration->get_many_related('Checkin', [['DTT_ID' => $DTT_ID]]);
456
-            if (! empty($timestamps)) {
456
+            if ( ! empty($timestamps)) {
457 457
                 // get the last timestamp
458 458
                 $last_timestamp = end($timestamps);
459 459
                 // checked in or checked out?
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
                     : esc_html__('Checked Out', 'event_espresso');
463 463
                 // get timestamp string
464 464
                 $timestamp_string   = $last_timestamp->get_datetime('CHK_timestamp');
465
-                $actions['checkin'] = '<a class="ee-aria-tooltip" href="' . $checkin_list_url . '" aria-label="'
465
+                $actions['checkin'] = '<a class="ee-aria-tooltip" href="'.$checkin_list_url.'" aria-label="'
466 466
                                       . esc_attr__(
467 467
                                           'View this registrant\'s check-ins/checkouts for the datetime',
468 468
                                           'event_espresso'
469
-                                      ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
469
+                                      ).'">'.$checkin_status.': '.$timestamp_string.'</a>';
470 470
             }
471 471
         }
472
-        return (! empty($DTT_ID) && ! empty($timestamps))
472
+        return ( ! empty($DTT_ID) && ! empty($timestamps))
473 473
             ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true))
474 474
             : $name_link;
475 475
     }
@@ -502,14 +502,14 @@  discard block
 block discarded – undo
502 502
                 ['action' => 'event_registrations', 'event_id' => $event->ID()],
503 503
                 REG_ADMIN_URL
504 504
             );
505
-            $event_label      = EE_Registry::instance()->CAP->current_user_can(
505
+            $event_label = EE_Registry::instance()->CAP->current_user_can(
506 506
                 'ee_read_checkins',
507 507
                 'espresso_registrations_registration_checkins'
508
-            ) ? '<a class="ee-aria-tooltip" href="' . $checkin_link_url . '" aria-label="'
508
+            ) ? '<a class="ee-aria-tooltip" href="'.$checkin_link_url.'" aria-label="'
509 509
                 . esc_attr__(
510 510
                     'View Checkins for this Event',
511 511
                     'event_espresso'
512
-                ) . '">' . $event->name() . '</a>' : $event->name();
512
+                ).'">'.$event->name().'</a>' : $event->name();
513 513
         } catch (EntityNotFoundException $e) {
514 514
             $event_label = esc_html__('Unknown', 'event_espresso');
515 515
         }
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
      */
544 544
     public function column__REG_final_price(EE_Registration $registration): string
545 545
     {
546
-        return '<span class="reg-pad-rght">' . ' ' . $registration->pretty_final_price() . '</span>';
546
+        return '<span class="reg-pad-rght">'.' '.$registration->pretty_final_price().'</span>';
547 547
     }
548 548
 
549 549
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
                     . $registration->transaction()->pretty_paid()
582 582
                     . '
583 583
 					</a>
584
-				<span>' : '<span class="reg-pad-rght">' . $registration->transaction()->pretty_paid() . '</span>';
584
+				<span>' : '<span class="reg-pad-rght">'.$registration->transaction()->pretty_paid().'</span>';
585 585
             }
586 586
         } else {
587 587
             return '<span class="reg-pad-rght"></span>';
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
                 . esc_attr__('View Transaction', 'event_espresso')
619 619
                 . '"><span class="reg-pad-rght">'
620 620
                 . $txn_total
621
-                . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
621
+                . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
622 622
         } else {
623 623
             return '<span class="reg-pad-rght"></span>';
624 624
         }
Please login to merge, or discard this patch.
registration_form/templates/questions_main_meta_box.template.php 2 patches
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -26,21 +26,21 @@  discard block
 block discarded – undo
26 26
 $has_answers = $question->has_answers();
27 27
 
28 28
 if ($QST_system === 'country') {
29
-    // already escaped
30
-    echo EEH_HTML::div(
31
-        EEH_HTML::h4(
32
-            '<span class="dashicons dashicons-info"></span>'
33
-            . esc_html__('Did you know...', 'event_espresso')
34
-        ) .
35
-        EEH_HTML::p(
36
-            esc_html__(
37
-                'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.',
38
-                'event_espresso'
39
-            )
40
-        ),
41
-        '',
42
-        'ee-info-box'
43
-    );
29
+	// already escaped
30
+	echo EEH_HTML::div(
31
+		EEH_HTML::h4(
32
+			'<span class="dashicons dashicons-info"></span>'
33
+			. esc_html__('Did you know...', 'event_espresso')
34
+		) .
35
+		EEH_HTML::p(
36
+			esc_html__(
37
+				'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.',
38
+				'event_espresso'
39
+			)
40
+		),
41
+		'',
42
+		'ee-info-box'
43
+	);
44 44
 }
45 45
 ?>
46 46
 
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
                     </th>
77 77
                     <td>
78 78
                         <?php
79
-                        $id            = ! empty($QST_system) ? '_disabled' : '';
80
-                        $disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : '';
81
-                        ?>
79
+						$id            = ! empty($QST_system) ? '_disabled' : '';
80
+						$disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : '';
81
+						?>
82 82
                         <input class='regular-text'
83 83
                                id="QST_admin_label<?php echo $id; // escape not needed ?>"
84 84
                                name="QST_admin_label<?php echo $id; // escape not needed ?>"
@@ -120,30 +120,30 @@  discard block
 block discarded – undo
120 120
                     </th>
121 121
                     <td>
122 122
                         <?php
123
-                        $id            = ! empty($QST_system) ? '_disabled' : '';
124
-                        $disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : '';
125
-                        $admin_only    = $question->get('QST_admin_only');
126
-                        $checked       = ! empty($admin_only) ? ' checked="checked"' : '';
127
-                        ?>
123
+						$id            = ! empty($QST_system) ? '_disabled' : '';
124
+						$disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : '';
125
+						$admin_only    = $question->get('QST_admin_only');
126
+						$checked       = ! empty($admin_only) ? ' checked="checked"' : '';
127
+						?>
128 128
                         <input class="QST_admin_only"
129 129
                                id="QST_admin_only<?php echo $id; // escape not needed ?>"
130 130
                                name="QST_admin_only<?php echo $id; // escape not needed ?>"
131 131
                                type="checkbox"
132 132
                                value="1"
133 133
                             <?php
134
-                            echo $disabled_attr; // escape not needed
135
-                            echo $checked; // escape not needed
136
-                            ?>
134
+							echo $disabled_attr; // escape not needed
135
+							echo $checked; // escape not needed
136
+							?>
137 137
                         />
138 138
                         <br />
139 139
                         <p class="description">
140 140
                             <?php
141
-                            if (! empty($QST_system)) { ?>
141
+							if (! empty($QST_system)) { ?>
142 142
                                 <span class="description" style="color:#D54E21;">
143 143
                                     <?php esc_html_e(
144
-                                        'System question! This field cannot be changed.',
145
-                                        'event_espresso'
146
-                                    ); ?>
144
+										'System question! This field cannot be changed.',
145
+										'event_espresso'
146
+									); ?>
147 147
                                 </span>
148 148
                             <?php } ?>
149 149
                         </p>
@@ -159,44 +159,44 @@  discard block
 block discarded – undo
159 159
                     </th>
160 160
                     <td>
161 161
                         <?php
162
-                        $disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone;
163
-                        if ($disabled) {
164
-                            $disabled_attr = 'disabled="disabled"';
165
-                            $id            = '_disabled';
166
-                        } else {
167
-                            $disabled_attr = '';
168
-                            $id            = '';
169
-                        }
162
+						$disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone;
163
+						if ($disabled) {
164
+							$disabled_attr = 'disabled="disabled"';
165
+							$id            = '_disabled';
166
+						} else {
167
+							$disabled_attr = '';
168
+							$id            = '';
169
+						}
170 170
 
171
-                        // Only display Confirm email for
172
-                        if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) {
173
-                            unset($question_types[ EEM_Question::QST_type_email_confirm ]);
174
-                        }
171
+						// Only display Confirm email for
172
+						if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) {
173
+							unset($question_types[ EEM_Question::QST_type_email_confirm ]);
174
+						}
175 175
 
176
-                        echo EEH_Form_Fields::select_input(
177
-                            'QST_type' . $id,
178
-                            $question_types,
179
-                            $question->type(),
180
-                            'id="QST_type' . $id . '"' . $disabled_attr
181
-                        ); // already escaped
182
-                        if ($disabled) { ?>
176
+						echo EEH_Form_Fields::select_input(
177
+							'QST_type' . $id,
178
+							$question_types,
179
+							$question->type(),
180
+							'id="QST_type' . $id . '"' . $disabled_attr
181
+						); // already escaped
182
+						if ($disabled) { ?>
183 183
                             <input id='QST_type'
184 184
                                    name="QST_type"
185 185
                                    type="hidden"
186 186
                                    value="<?php echo $question->type(); ?>"
187 187
                             />
188 188
                             <?php
189
-                            $explanatory_text = esc_html__(
190
-                                'System question! This field cannot be changed.',
191
-                                'event_espresso'
192
-                            );
193
-                        } else {
194
-                            $explanatory_text = esc_html__(
195
-                                'Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.',
196
-                                'event_espresso'
197
-                            );
198
-                        }
199
-                        if ($disabled || $has_answers) { ?>
189
+							$explanatory_text = esc_html__(
190
+								'System question! This field cannot be changed.',
191
+								'event_espresso'
192
+							);
193
+						} else {
194
+							$explanatory_text = esc_html__(
195
+								'Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.',
196
+								'event_espresso'
197
+							);
198
+						}
199
+						if ($disabled || $has_answers) { ?>
200 200
                             <p>
201 201
                                 <span class="description" style="color:#D54E21;">
202 202
                                     <?php echo esc_html($explanatory_text); ?>
@@ -226,21 +226,21 @@  discard block
 block discarded – undo
226 226
                         <p>
227 227
                             <span class="description">
228 228
                                 <?php esc_html_e(
229
-                                    'Maximum number of characters allowed when answering this question',
230
-                                    'event_espresso'
231
-                                ); ?>
229
+									'Maximum number of characters allowed when answering this question',
230
+									'event_espresso'
231
+								); ?>
232 232
                             </span>
233 233
                         </p>
234 234
                         <?php if ($QST_system) { ?>
235 235
                         <p>
236 236
                             <span class="description" style="color:#D54E21;">
237 237
                                 <?php printf(
238
-                                    esc_html__(
239
-                                        'System question! The maximum number of characters that can be used for this question is %1$s',
240
-                                        'event_espresso'
241
-                                    ),
242
-                                    $max_max
243
-                                ); ?>
238
+									esc_html__(
239
+										'System question! The maximum number of characters that can be used for this question is %1$s',
240
+										'event_espresso'
241
+									),
242
+									$max_max
243
+								); ?>
244 244
                             </span>
245 245
                         </p>
246 246
                         <?php } ?>
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
                                     </th>
263 263
                                     <th class="option-desc-header">
264 264
                                         <?php esc_html_e(
265
-                                            'Description (optional, only shown on registration form)',
266
-                                            'event_espresso'
267
-                                        ) ?>
265
+											'Description (optional, only shown on registration form)',
266
+											'event_espresso'
267
+										) ?>
268 268
                                     </th>
269 269
                                     <th>
270 270
                                     </th>
@@ -299,14 +299,14 @@  discard block
 block discarded – undo
299 299
                                 </tr>
300 300
 
301 301
                                 <?php
302
-                                $count            = 0;
303
-                                $question_options = $question->options();
304
-                                if (! empty($question_options)) {
305
-                                    foreach ($question_options as $option_id => $option) {
306
-                                        $disabled_attr = $has_answers || $option->get('QSO_system')
307
-                                            ? ' disabled="disabled"'
308
-                                            : '';
309
-                                        ?>
302
+								$count            = 0;
303
+								$question_options = $question->options();
304
+								if (! empty($question_options)) {
305
+									foreach ($question_options as $option_id => $option) {
306
+										$disabled_attr = $has_answers || $option->get('QSO_system')
307
+											? ' disabled="disabled"'
308
+											: '';
309
+										?>
310 310
                                         <tr class="question-option ee-options-sortable">
311 311
                                             <td class="option-value-cell">
312 312
                                                 <input type="hidden"
@@ -343,21 +343,21 @@  discard block
 block discarded – undo
343 343
                                     </span>
344 344
                                             </td>
345 345
                                             <?php
346
-                                            echo EEH_Form_Fields::hidden_input(
347
-                                                "question_options[{$count}][QST_ID])",
348
-                                                $option->question_ID()
349
-                                            ); // already escaped
350
-                                            echo EEH_Form_Fields::hidden_input(
351
-                                                "question_options[{$count}][QSO_ID])",
352
-                                                $option->ID()
353
-                                            ); // already escaped
354
-                                            $count++;
355
-                                            ?>
346
+											echo EEH_Form_Fields::hidden_input(
347
+												"question_options[{$count}][QST_ID])",
348
+												$option->question_ID()
349
+											); // already escaped
350
+											echo EEH_Form_Fields::hidden_input(
351
+												"question_options[{$count}][QSO_ID])",
352
+												$option->ID()
353
+											); // already escaped
354
+											$count++;
355
+											?>
356 356
                                         </tr>
357 357
                                         <?php
358
-                                    }
359
-                                } else {
360
-                                    ?>
358
+									}
359
+								} else {
360
+									?>
361 361
                                     <tr class="question-option ee-options-sortable">
362 362
                                         <td class="option-value-cell">
363 363
                                             <input type="hidden"
@@ -381,8 +381,8 @@  discard block
 block discarded – undo
381 381
                                         </td>
382 382
                                     </tr>
383 383
                                     <?php
384
-                                }
385
-                                ?>
384
+								}
385
+								?>
386 386
                                 <tr style="display:none">
387 387
                                     <td colspan="3">
388 388
                                         <?php echo EEH_Form_Fields::hidden_input("question_options_count", $count); // already escaped ?>
@@ -401,16 +401,16 @@  discard block
 block discarded – undo
401 401
 
402 402
                         <p class="description">
403 403
                             <?php esc_html_e(
404
-                                'Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.',
405
-                                'event_espresso'
406
-                            ) ?>
404
+								'Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.',
405
+								'event_espresso'
406
+							) ?>
407 407
                         </p>
408 408
                         <?php if ($has_answers) : ?>
409 409
                             <p class="description" style="color:#D54E21;">
410 410
                                 <?php esc_html_e(
411
-                                    'Answer values that are uneditable are this way because there are registrations in the database that have answers for this question.  If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes.  This will ensure that the existing registrations that chose the original answer will preserve that answer.',
412
-                                    'event_espresso'
413
-                                ); ?>
411
+									'Answer values that are uneditable are this way because there are registrations in the database that have answers for this question.  If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes.  This will ensure that the existing registrations that chose the original answer will preserve that answer.',
412
+									'event_espresso'
413
+								); ?>
414 414
                             </p>
415 415
 
416 416
                         <?php endif; ?>
@@ -426,41 +426,41 @@  discard block
 block discarded – undo
426 426
                     </th>
427 427
                     <td>
428 428
                         <?php
429
-                        $system_required   = ['fname', 'email'];
430
-                        $disabled_attr     = in_array($QST_system, $system_required) ? ' disabled="disabled"' : '';
431
-                        $required_on       = $question->get('QST_admin_only');
432
-                        $show_required_msg = $required_on ? '' : ' display:none;';
433
-                        $disabled_attr     = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : '';
434
-                        $id                =
435
-                            ! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : '';
436
-                        $requiredOptions   = [
437
-                            ['text' => esc_html__('Optional', 'event_espresso'), 'id' => 0],
438
-                            ['text' => esc_html__('Required', 'event_espresso'), 'id' => 1],
439
-                        ];
440
-                        echo EEH_Form_Fields::select_input(
441
-                            'QST_required' . $id,
442
-                            $requiredOptions,
443
-                            $question->required(),
444
-                            'id="QST_required' . $id . '"' . $disabled_attr,
445
-                            'ee-input--small'
446
-                        ); // already escaped
447
-                        ?>
429
+						$system_required   = ['fname', 'email'];
430
+						$disabled_attr     = in_array($QST_system, $system_required) ? ' disabled="disabled"' : '';
431
+						$required_on       = $question->get('QST_admin_only');
432
+						$show_required_msg = $required_on ? '' : ' display:none;';
433
+						$disabled_attr     = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : '';
434
+						$id                =
435
+							! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : '';
436
+						$requiredOptions   = [
437
+							['text' => esc_html__('Optional', 'event_espresso'), 'id' => 0],
438
+							['text' => esc_html__('Required', 'event_espresso'), 'id' => 1],
439
+						];
440
+						echo EEH_Form_Fields::select_input(
441
+							'QST_required' . $id,
442
+							$requiredOptions,
443
+							$question->required(),
444
+							'id="QST_required' . $id . '"' . $disabled_attr,
445
+							'ee-input--small'
446
+						); // already escaped
447
+						?>
448 448
                         <p>
449 449
                             <span id="required_toggled_on" class="description"
450 450
                                   style="color:#D54E21;<?php echo $show_required_msg; ?>"
451 451
                             >
452 452
                                 <?php esc_html_e(
453
-                                    'Required is set to optional, and this field is disabled, because the question is Admin-Only.',
454
-                                    'event_espresso'
455
-                                ) ?>
453
+									'Required is set to optional, and this field is disabled, because the question is Admin-Only.',
454
+									'event_espresso'
455
+								) ?>
456 456
                             </span
457 457
                         </p>
458 458
                         <p>
459 459
                             <span id="required_toggled_off" class="description" style="color:#D54E21; display: none;">
460 460
                                 <?php esc_html_e(
461
-                                    'Required option field is no longer disabled because the question is not Admin-Only',
462
-                                    'event_espresso'
463
-                                ) ?>
461
+									'Required option field is no longer disabled because the question is not Admin-Only',
462
+									'event_espresso'
463
+								) ?>
464 464
                             </span>
465 465
                         </p>
466 466
                         <?php if (! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?>
@@ -497,8 +497,8 @@  discard block
 block discarded – undo
497 497
                     </td>
498 498
                 </tr>
499 499
                 <?php
500
-                do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question);
501
-                ?>
500
+				do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question);
501
+				?>
502 502
             </tbody>
503 503
         </table>
504 504
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         EEH_HTML::h4(
32 32
             '<span class="dashicons dashicons-info"></span>'
33 33
             . esc_html__('Did you know...', 'event_espresso')
34
-        ) .
34
+        ).
35 35
         EEH_HTML::p(
36 36
             esc_html__(
37 37
                 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.',
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                                type="hidden"
93 93
                                value="<?php echo $question->get('QST_order'); ?>"
94 94
                         />
95
-                        <?php if (! empty($QST_system)) { ?>
95
+                        <?php if ( ! empty($QST_system)) { ?>
96 96
                             <input id='QST_admin_label'
97 97
                                    name="QST_admin_label"
98 98
                                    type="hidden"
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                         <?php } ?>
102 102
                         <br />
103 103
                         <p class="description">
104
-                            <?php if (! empty($QST_system)) { ?>
104
+                            <?php if ( ! empty($QST_system)) { ?>
105 105
                                 <span class="description" style="color:#D54E21;">
106 106
                                 <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso') ?>
107 107
                         </span>
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                         <br />
139 139
                         <p class="description">
140 140
                             <?php
141
-                            if (! empty($QST_system)) { ?>
141
+                            if ( ! empty($QST_system)) { ?>
142 142
                                 <span class="description" style="color:#D54E21;">
143 143
                                     <?php esc_html_e(
144 144
                                         'System question! This field cannot be changed.',
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 
171 171
                         // Only display Confirm email for
172 172
                         if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) {
173
-                            unset($question_types[ EEM_Question::QST_type_email_confirm ]);
173
+                            unset($question_types[EEM_Question::QST_type_email_confirm]);
174 174
                         }
175 175
 
176 176
                         echo EEH_Form_Fields::select_input(
177
-                            'QST_type' . $id,
177
+                            'QST_type'.$id,
178 178
                             $question_types,
179 179
                             $question->type(),
180
-                            'id="QST_type' . $id . '"' . $disabled_attr
180
+                            'id="QST_type'.$id.'"'.$disabled_attr
181 181
                         ); // already escaped
182 182
                         if ($disabled) { ?>
183 183
                             <input id='QST_type'
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
                     </th>
217 217
                     <td>
218 218
                         <input id="QST_max"
219
-                            <?php echo $max_max === EE_INF ? '' : 'max="' . esc_attr($max_max) . '"'; ?>
219
+                            <?php echo $max_max === EE_INF ? '' : 'max="'.esc_attr($max_max).'"'; ?>
220 220
                                min="1"
221 221
                                name="QST_max"
222 222
                                type="number"
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                                 <?php
302 302
                                 $count            = 0;
303 303
                                 $question_options = $question->options();
304
-                                if (! empty($question_options)) {
304
+                                if ( ! empty($question_options)) {
305 305
                                     foreach ($question_options as $option_id => $option) {
306 306
                                         $disabled_attr = $has_answers || $option->get('QSO_system')
307 307
                                             ? ' disabled="disabled"'
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                                                 />
336 336
                                             </td>
337 337
                                             <td>
338
-                                                <?php if (! $option->system()) { ?>
338
+                                                <?php if ( ! $option->system()) { ?>
339 339
                                                     <span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item">
340 340
                                         </span>
341 341
                                                 <?php } ?>
@@ -438,10 +438,10 @@  discard block
 block discarded – undo
438 438
                             ['text' => esc_html__('Required', 'event_espresso'), 'id' => 1],
439 439
                         ];
440 440
                         echo EEH_Form_Fields::select_input(
441
-                            'QST_required' . $id,
441
+                            'QST_required'.$id,
442 442
                             $requiredOptions,
443 443
                             $question->required(),
444
-                            'id="QST_required' . $id . '"' . $disabled_attr,
444
+                            'id="QST_required'.$id.'"'.$disabled_attr,
445 445
                             'ee-input--small'
446 446
                         ); // already escaped
447 447
                         ?>
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
                                 ) ?>
464 464
                             </span>
465 465
                         </p>
466
-                        <?php if (! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?>
466
+                        <?php if ( ! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?>
467 467
                             <input id="QST_required"
468 468
                                    name="QST_required"
469 469
                                    type='hidden'
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Template_List_Table.class.php 1 patch
Indentation   +375 added lines, -375 removed lines patch added patch discarded remove patch
@@ -11,379 +11,379 @@
 block discarded – undo
11 11
 class Messages_Template_List_Table extends EE_Admin_List_Table
12 12
 {
13 13
 
14
-    /**
15
-     * @var Messages_Admin_Page
16
-     */
17
-    protected $_admin_page;
18
-
19
-
20
-    /**
21
-     * @return Messages_Admin_Page
22
-     */
23
-    public function get_admin_page()
24
-    {
25
-        return $this->_admin_page;
26
-    }
27
-
28
-
29
-    /**
30
-     * Setup data object
31
-     *
32
-     * @throws EE_Error
33
-     */
34
-    protected function _setup_data()
35
-    {
36
-        $this->_data           = $this->get_admin_page()->get_message_templates(
37
-            $this->_per_page,
38
-            $this->_view
39
-        );
40
-        $this->_all_data_count = $this->get_admin_page()->get_message_templates(
41
-            $this->_per_page,
42
-            $this->_view,
43
-            true,
44
-            true
45
-        );
46
-    }
47
-
48
-
49
-    /**
50
-     * Set internal properties
51
-     */
52
-    protected function _set_properties()
53
-    {
54
-        $this->_wp_list_args = [
55
-            'singular' => esc_html__('Message Template Group', 'event_espresso'),
56
-            'plural'   => esc_html__('Message Template', 'event_espresso'),
57
-            'ajax'     => true, // for now,
58
-            'screen'   => $this->get_admin_page()->get_current_screen()->id,
59
-        ];
60
-        $this->_columns      = [
61
-            // 'cb' => '<input type="checkbox" />', //no deleting default (global) templates!
62
-            'message_type' => esc_html__('Message Type', 'event_espresso'),
63
-            'messenger'    => esc_html__('Messenger', 'event_espresso'),
64
-            'recipients'   => esc_html__('Recipients', 'event_espresso'),
65
-            'description'  => esc_html__('Description', 'event_espresso'),
66
-        ];
67
-
68
-        $this->_sortable_columns = [
69
-            'messenger' => ['MTP_messenger' => true],
70
-        ];
71
-
72
-        $this->_hidden_columns = [];
73
-    }
74
-
75
-
76
-    /**
77
-     * Overriding the single_row method from parent to verify whether the $item has an accessible
78
-     * message_type or messenger object before generating the row.
79
-     *
80
-     * @param EE_Message_Template_Group $item
81
-     * @return void
82
-     * @throws EE_Error
83
-     */
84
-    public function single_row($item)
85
-    {
86
-        if (
87
-            ! $item->message_type_obj() instanceof EE_message_type
88
-            || ! $item->messenger_obj() instanceof EE_messenger
89
-        ) {
90
-            return;
91
-        }
92
-
93
-        parent::single_row($item);
94
-    }
95
-
96
-
97
-    /**
98
-     * @return array
99
-     * @throws EE_Error
100
-     */
101
-    protected function _get_table_filters()
102
-    {
103
-        $filters = [];
104
-
105
-        // get select inputs
106
-        $select_inputs = [
107
-            $this->_get_messengers_dropdown_filter(),
108
-            $this->_get_message_types_dropdown_filter(),
109
-        ];
110
-
111
-        // set filters to select inputs if they aren't empty
112
-        foreach ($select_inputs as $select_input) {
113
-            if ($select_input) {
114
-                $filters[] = $select_input;
115
-            }
116
-        }
117
-        return $filters;
118
-    }
119
-
120
-
121
-    /**
122
-     * We're just removing the search box for message templates, not needed.
123
-     *
124
-     * @param string $text
125
-     * @param string $input_id
126
-     * @return string ;
127
-     */
128
-    public function search_box($text, $input_id)
129
-    {
130
-        return '';
131
-    }
132
-
133
-
134
-    /**
135
-     * Add counts to the _views property
136
-     *
137
-     * @throws EE_Error
138
-     */
139
-    protected function _add_view_counts()
140
-    {
141
-        foreach ($this->_views as $view => $args) {
142
-            $this->_views[ $view ]['count'] = $this->get_admin_page()->get_message_templates(
143
-                $this->_per_page,
144
-                $view,
145
-                true,
146
-                true
147
-            );
148
-        }
149
-    }
150
-
151
-
152
-    /**
153
-     * @param EE_Message_Template_Group $item
154
-     * @return string
155
-     */
156
-    public function column_cb($item)
157
-    {
158
-        return '';
159
-    }
160
-
161
-
162
-    /**
163
-     * @param EE_Message_Template_Group $item
164
-     * @return string
165
-     * @throws EE_Error
166
-     */
167
-    public function column_description($item)
168
-    {
169
-        return '<p>' . $item->message_type_obj()->description . '</p>';
170
-    }
171
-
172
-
173
-    /**
174
-     * @param EE_Message_Template_Group $item
175
-     * @return string
176
-     * @throws EE_Error
177
-     * @throws ReflectionException
178
-     */
179
-    public function column_messenger($item)
180
-    {
181
-        // Return the name contents
182
-        return sprintf(
183
-            '%1$s <span style="color:silver">(id:%2$s)</span>',
184
-            /* $1%s */
185
-            ucwords($item->messenger_obj()->label['singular']),
186
-            /* $2%s */
187
-            $item->GRP_ID()
188
-        );
189
-    }
190
-
191
-
192
-    /**
193
-     * @param EE_Message_Template_Group $item
194
-     * @return string
195
-     * @throws EE_Error
196
-     * @throws ReflectionException
197
-     */
198
-    public function column_recipients($item)
199
-    {
200
-        // Return the name contents
201
-        return $this->_get_context_links($item) . $this->row_actions($this->_get_actions_for_messenger_column($item));
202
-    }
203
-
204
-
205
-    /**
206
-     * column_message_type
207
-     *
208
-     * @param EE_Message_Template_Group $item message info for the row
209
-     * @return string message_type name
210
-     * @throws EE_Error
211
-     */
212
-    public function column_message_type($item)
213
-    {
214
-        return ucwords($item->message_type_obj()->label['singular']);
215
-    }
216
-
217
-
218
-    /**
219
-     * Generate dropdown filter select input for messengers
220
-     *
221
-     * @param bool $global
222
-     * @return string
223
-     * @throws EE_Error
224
-     */
225
-    protected function _get_messengers_dropdown_filter($global = true)
226
-    {
227
-        $messenger_options                                   = [];
228
-        $active_message_template_groups_grouped_by_messenger = EEM_Message_Template_Group::instance()->get_all(
229
-            [
230
-                [
231
-                    'MTP_is_active' => true,
232
-                    'MTP_is_global' => $global,
233
-                ],
234
-                'group_by' => 'MTP_messenger',
235
-            ]
236
-        );
237
-
238
-        foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) {
239
-            if ($active_message_template_group instanceof EE_Message_Template_Group) {
240
-                $messenger                            = $active_message_template_group->messenger_obj();
241
-                $messenger_name                       = $active_message_template_group->messenger();
242
-                $messenger_label                      = $messenger instanceof EE_messenger
243
-                    ? $messenger->label['singular']
244
-                    : $messenger_name;
245
-                $messenger_options[ $messenger_name ] = ucwords($messenger_label);
246
-            }
247
-        }
248
-        return $this->get_admin_page()->get_messengers_select_input($messenger_options);
249
-    }
250
-
251
-
252
-    /**
253
-     * Generate dropdown filter select input for message types
254
-     *
255
-     * @param bool $global
256
-     * @return string
257
-     * @throws EE_Error
258
-     */
259
-    protected function _get_message_types_dropdown_filter($global = true)
260
-    {
261
-        $message_type_options                                   = [];
262
-        $active_message_template_groups_grouped_by_message_type = EEM_Message_Template_Group::instance()->get_all(
263
-            [
264
-                [
265
-                    'MTP_is_active' => true,
266
-                    'MTP_is_global' => $global,
267
-                ],
268
-                'group_by' => 'MTP_message_type',
269
-            ]
270
-        );
271
-
272
-        foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) {
273
-            if ($active_message_template_group instanceof EE_Message_Template_Group) {
274
-                $message_type                               = $active_message_template_group->message_type_obj();
275
-                $message_type_name                          = $active_message_template_group->message_type();
276
-                $message_type_label                         = $message_type instanceof EE_message_type
277
-                    ? $message_type->label['singular']
278
-                    : $message_type_name;
279
-                $message_type_options[ $message_type_name ] = ucwords($message_type_label);
280
-            }
281
-        }
282
-        return $this->get_admin_page()->get_message_types_select_input($message_type_options);
283
-    }
284
-
285
-
286
-    /**
287
-     * Return the edit url for the message template group.
288
-     *
289
-     * @param EE_Message_Template_Group $item
290
-     * @return string
291
-     * @throws EE_Error
292
-     * @throws ReflectionException
293
-     */
294
-    protected function _get_edit_url(EE_Message_Template_Group $item)
295
-    {
296
-        $edit_url = '';
297
-        // edit link but only if item isn't trashed.
298
-        if (
299
-            ! $item->get('MTP_deleted')
300
-            && EE_Registry::instance()->CAP->current_user_can(
301
-                'ee_edit_message',
302
-                'espresso_messages_edit_message_template',
303
-                $item->ID()
304
-            )
305
-        ) {
306
-            $edit_url = EE_Admin_Page::add_query_args_and_nonce(
307
-                [
308
-                    'action' => 'edit_message_template',
309
-                    'id'     => $item->GRP_ID(),
310
-                ],
311
-                EE_MSG_ADMIN_URL
312
-            );
313
-        }
314
-        return $edit_url;
315
-    }
316
-
317
-
318
-    /**
319
-     * Get the context link string for the messenger column.
320
-     *
321
-     * @param EE_Message_Template_Group $item
322
-     * @return string
323
-     * @throws EE_Error
324
-     * @throws ReflectionException
325
-     */
326
-    protected function _get_context_links(EE_Message_Template_Group $item)
327
-    {
328
-        // first check if we even show the context links or not.
329
-        if (
330
-            ! EE_Registry::instance()->CAP->current_user_can(
331
-                'ee_edit_message',
332
-                'espresso_messages_edit_message_template',
333
-                $item->ID()
334
-            )
335
-            || $item->get('MTP_deleted')
336
-        ) {
337
-            return '';
338
-        }
339
-        // we want to display the contexts in here, so we need to set them up
340
-        // $c_label           = $item->context_label();
341
-        $c_configs         = $item->contexts_config();
342
-        $context_array     = [];
343
-        $context_templates = $item->context_templates();
344
-        foreach ($context_templates as $context => $template_fields) {
345
-            $mtp_to          = ! empty($template_fields['to'])
346
-                               && $template_fields['to'] instanceof EE_Message_Template
347
-                ? $template_fields['to']->get('MTP_content')
348
-                : null;
349
-            $inactive_class  = (empty($mtp_to) && ! empty($template_fields['to']))
350
-                               || ! $item->is_context_active($context)
351
-                ? ' mtp-inactive'
352
-                : '';
353
-            $context_title   = ucwords($c_configs[ $context ]['label']);
354
-            $edit_link       = EE_Admin_Page::add_query_args_and_nonce(
355
-                [
356
-                    'action'  => 'edit_message_template',
357
-                    'id'      => $item->GRP_ID(),
358
-                    'context' => $context,
359
-                ],
360
-                EE_MSG_ADMIN_URL
361
-            );
362
-            $label = sprintf(
363
-                esc_attr__('Edit message content for the %1$s', 'event_espresso'),
364
-                $context_title
365
-            );
366
-            $context_array[] = '<a href="' . $edit_link . '"'
367
-                               . ' class="' . "{$item->message_type()}-{$context}-edit-link{$inactive_class}" . ' ee-aria-tooltip"'
368
-                               . ' aria-label="' . $label . '">'
369
-                               . $context_title
370
-                               . '</a>';
371
-        }
372
-
373
-        return implode(' | ', $context_array);
374
-    }
375
-
376
-
377
-    /**
378
-     * Returns the actions for the messenger column.
379
-     *
380
-     * Note: Children classes may override this, so do not remove it.
381
-     *
382
-     * @param EE_Message_Template_Group $item
383
-     * @return array
384
-     */
385
-    protected function _get_actions_for_messenger_column(EE_Message_Template_Group $item)
386
-    {
387
-        return [];
388
-    }
14
+	/**
15
+	 * @var Messages_Admin_Page
16
+	 */
17
+	protected $_admin_page;
18
+
19
+
20
+	/**
21
+	 * @return Messages_Admin_Page
22
+	 */
23
+	public function get_admin_page()
24
+	{
25
+		return $this->_admin_page;
26
+	}
27
+
28
+
29
+	/**
30
+	 * Setup data object
31
+	 *
32
+	 * @throws EE_Error
33
+	 */
34
+	protected function _setup_data()
35
+	{
36
+		$this->_data           = $this->get_admin_page()->get_message_templates(
37
+			$this->_per_page,
38
+			$this->_view
39
+		);
40
+		$this->_all_data_count = $this->get_admin_page()->get_message_templates(
41
+			$this->_per_page,
42
+			$this->_view,
43
+			true,
44
+			true
45
+		);
46
+	}
47
+
48
+
49
+	/**
50
+	 * Set internal properties
51
+	 */
52
+	protected function _set_properties()
53
+	{
54
+		$this->_wp_list_args = [
55
+			'singular' => esc_html__('Message Template Group', 'event_espresso'),
56
+			'plural'   => esc_html__('Message Template', 'event_espresso'),
57
+			'ajax'     => true, // for now,
58
+			'screen'   => $this->get_admin_page()->get_current_screen()->id,
59
+		];
60
+		$this->_columns      = [
61
+			// 'cb' => '<input type="checkbox" />', //no deleting default (global) templates!
62
+			'message_type' => esc_html__('Message Type', 'event_espresso'),
63
+			'messenger'    => esc_html__('Messenger', 'event_espresso'),
64
+			'recipients'   => esc_html__('Recipients', 'event_espresso'),
65
+			'description'  => esc_html__('Description', 'event_espresso'),
66
+		];
67
+
68
+		$this->_sortable_columns = [
69
+			'messenger' => ['MTP_messenger' => true],
70
+		];
71
+
72
+		$this->_hidden_columns = [];
73
+	}
74
+
75
+
76
+	/**
77
+	 * Overriding the single_row method from parent to verify whether the $item has an accessible
78
+	 * message_type or messenger object before generating the row.
79
+	 *
80
+	 * @param EE_Message_Template_Group $item
81
+	 * @return void
82
+	 * @throws EE_Error
83
+	 */
84
+	public function single_row($item)
85
+	{
86
+		if (
87
+			! $item->message_type_obj() instanceof EE_message_type
88
+			|| ! $item->messenger_obj() instanceof EE_messenger
89
+		) {
90
+			return;
91
+		}
92
+
93
+		parent::single_row($item);
94
+	}
95
+
96
+
97
+	/**
98
+	 * @return array
99
+	 * @throws EE_Error
100
+	 */
101
+	protected function _get_table_filters()
102
+	{
103
+		$filters = [];
104
+
105
+		// get select inputs
106
+		$select_inputs = [
107
+			$this->_get_messengers_dropdown_filter(),
108
+			$this->_get_message_types_dropdown_filter(),
109
+		];
110
+
111
+		// set filters to select inputs if they aren't empty
112
+		foreach ($select_inputs as $select_input) {
113
+			if ($select_input) {
114
+				$filters[] = $select_input;
115
+			}
116
+		}
117
+		return $filters;
118
+	}
119
+
120
+
121
+	/**
122
+	 * We're just removing the search box for message templates, not needed.
123
+	 *
124
+	 * @param string $text
125
+	 * @param string $input_id
126
+	 * @return string ;
127
+	 */
128
+	public function search_box($text, $input_id)
129
+	{
130
+		return '';
131
+	}
132
+
133
+
134
+	/**
135
+	 * Add counts to the _views property
136
+	 *
137
+	 * @throws EE_Error
138
+	 */
139
+	protected function _add_view_counts()
140
+	{
141
+		foreach ($this->_views as $view => $args) {
142
+			$this->_views[ $view ]['count'] = $this->get_admin_page()->get_message_templates(
143
+				$this->_per_page,
144
+				$view,
145
+				true,
146
+				true
147
+			);
148
+		}
149
+	}
150
+
151
+
152
+	/**
153
+	 * @param EE_Message_Template_Group $item
154
+	 * @return string
155
+	 */
156
+	public function column_cb($item)
157
+	{
158
+		return '';
159
+	}
160
+
161
+
162
+	/**
163
+	 * @param EE_Message_Template_Group $item
164
+	 * @return string
165
+	 * @throws EE_Error
166
+	 */
167
+	public function column_description($item)
168
+	{
169
+		return '<p>' . $item->message_type_obj()->description . '</p>';
170
+	}
171
+
172
+
173
+	/**
174
+	 * @param EE_Message_Template_Group $item
175
+	 * @return string
176
+	 * @throws EE_Error
177
+	 * @throws ReflectionException
178
+	 */
179
+	public function column_messenger($item)
180
+	{
181
+		// Return the name contents
182
+		return sprintf(
183
+			'%1$s <span style="color:silver">(id:%2$s)</span>',
184
+			/* $1%s */
185
+			ucwords($item->messenger_obj()->label['singular']),
186
+			/* $2%s */
187
+			$item->GRP_ID()
188
+		);
189
+	}
190
+
191
+
192
+	/**
193
+	 * @param EE_Message_Template_Group $item
194
+	 * @return string
195
+	 * @throws EE_Error
196
+	 * @throws ReflectionException
197
+	 */
198
+	public function column_recipients($item)
199
+	{
200
+		// Return the name contents
201
+		return $this->_get_context_links($item) . $this->row_actions($this->_get_actions_for_messenger_column($item));
202
+	}
203
+
204
+
205
+	/**
206
+	 * column_message_type
207
+	 *
208
+	 * @param EE_Message_Template_Group $item message info for the row
209
+	 * @return string message_type name
210
+	 * @throws EE_Error
211
+	 */
212
+	public function column_message_type($item)
213
+	{
214
+		return ucwords($item->message_type_obj()->label['singular']);
215
+	}
216
+
217
+
218
+	/**
219
+	 * Generate dropdown filter select input for messengers
220
+	 *
221
+	 * @param bool $global
222
+	 * @return string
223
+	 * @throws EE_Error
224
+	 */
225
+	protected function _get_messengers_dropdown_filter($global = true)
226
+	{
227
+		$messenger_options                                   = [];
228
+		$active_message_template_groups_grouped_by_messenger = EEM_Message_Template_Group::instance()->get_all(
229
+			[
230
+				[
231
+					'MTP_is_active' => true,
232
+					'MTP_is_global' => $global,
233
+				],
234
+				'group_by' => 'MTP_messenger',
235
+			]
236
+		);
237
+
238
+		foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) {
239
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
240
+				$messenger                            = $active_message_template_group->messenger_obj();
241
+				$messenger_name                       = $active_message_template_group->messenger();
242
+				$messenger_label                      = $messenger instanceof EE_messenger
243
+					? $messenger->label['singular']
244
+					: $messenger_name;
245
+				$messenger_options[ $messenger_name ] = ucwords($messenger_label);
246
+			}
247
+		}
248
+		return $this->get_admin_page()->get_messengers_select_input($messenger_options);
249
+	}
250
+
251
+
252
+	/**
253
+	 * Generate dropdown filter select input for message types
254
+	 *
255
+	 * @param bool $global
256
+	 * @return string
257
+	 * @throws EE_Error
258
+	 */
259
+	protected function _get_message_types_dropdown_filter($global = true)
260
+	{
261
+		$message_type_options                                   = [];
262
+		$active_message_template_groups_grouped_by_message_type = EEM_Message_Template_Group::instance()->get_all(
263
+			[
264
+				[
265
+					'MTP_is_active' => true,
266
+					'MTP_is_global' => $global,
267
+				],
268
+				'group_by' => 'MTP_message_type',
269
+			]
270
+		);
271
+
272
+		foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) {
273
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
274
+				$message_type                               = $active_message_template_group->message_type_obj();
275
+				$message_type_name                          = $active_message_template_group->message_type();
276
+				$message_type_label                         = $message_type instanceof EE_message_type
277
+					? $message_type->label['singular']
278
+					: $message_type_name;
279
+				$message_type_options[ $message_type_name ] = ucwords($message_type_label);
280
+			}
281
+		}
282
+		return $this->get_admin_page()->get_message_types_select_input($message_type_options);
283
+	}
284
+
285
+
286
+	/**
287
+	 * Return the edit url for the message template group.
288
+	 *
289
+	 * @param EE_Message_Template_Group $item
290
+	 * @return string
291
+	 * @throws EE_Error
292
+	 * @throws ReflectionException
293
+	 */
294
+	protected function _get_edit_url(EE_Message_Template_Group $item)
295
+	{
296
+		$edit_url = '';
297
+		// edit link but only if item isn't trashed.
298
+		if (
299
+			! $item->get('MTP_deleted')
300
+			&& EE_Registry::instance()->CAP->current_user_can(
301
+				'ee_edit_message',
302
+				'espresso_messages_edit_message_template',
303
+				$item->ID()
304
+			)
305
+		) {
306
+			$edit_url = EE_Admin_Page::add_query_args_and_nonce(
307
+				[
308
+					'action' => 'edit_message_template',
309
+					'id'     => $item->GRP_ID(),
310
+				],
311
+				EE_MSG_ADMIN_URL
312
+			);
313
+		}
314
+		return $edit_url;
315
+	}
316
+
317
+
318
+	/**
319
+	 * Get the context link string for the messenger column.
320
+	 *
321
+	 * @param EE_Message_Template_Group $item
322
+	 * @return string
323
+	 * @throws EE_Error
324
+	 * @throws ReflectionException
325
+	 */
326
+	protected function _get_context_links(EE_Message_Template_Group $item)
327
+	{
328
+		// first check if we even show the context links or not.
329
+		if (
330
+			! EE_Registry::instance()->CAP->current_user_can(
331
+				'ee_edit_message',
332
+				'espresso_messages_edit_message_template',
333
+				$item->ID()
334
+			)
335
+			|| $item->get('MTP_deleted')
336
+		) {
337
+			return '';
338
+		}
339
+		// we want to display the contexts in here, so we need to set them up
340
+		// $c_label           = $item->context_label();
341
+		$c_configs         = $item->contexts_config();
342
+		$context_array     = [];
343
+		$context_templates = $item->context_templates();
344
+		foreach ($context_templates as $context => $template_fields) {
345
+			$mtp_to          = ! empty($template_fields['to'])
346
+							   && $template_fields['to'] instanceof EE_Message_Template
347
+				? $template_fields['to']->get('MTP_content')
348
+				: null;
349
+			$inactive_class  = (empty($mtp_to) && ! empty($template_fields['to']))
350
+							   || ! $item->is_context_active($context)
351
+				? ' mtp-inactive'
352
+				: '';
353
+			$context_title   = ucwords($c_configs[ $context ]['label']);
354
+			$edit_link       = EE_Admin_Page::add_query_args_and_nonce(
355
+				[
356
+					'action'  => 'edit_message_template',
357
+					'id'      => $item->GRP_ID(),
358
+					'context' => $context,
359
+				],
360
+				EE_MSG_ADMIN_URL
361
+			);
362
+			$label = sprintf(
363
+				esc_attr__('Edit message content for the %1$s', 'event_espresso'),
364
+				$context_title
365
+			);
366
+			$context_array[] = '<a href="' . $edit_link . '"'
367
+							   . ' class="' . "{$item->message_type()}-{$context}-edit-link{$inactive_class}" . ' ee-aria-tooltip"'
368
+							   . ' aria-label="' . $label . '">'
369
+							   . $context_title
370
+							   . '</a>';
371
+		}
372
+
373
+		return implode(' | ', $context_array);
374
+	}
375
+
376
+
377
+	/**
378
+	 * Returns the actions for the messenger column.
379
+	 *
380
+	 * Note: Children classes may override this, so do not remove it.
381
+	 *
382
+	 * @param EE_Message_Template_Group $item
383
+	 * @return array
384
+	 */
385
+	protected function _get_actions_for_messenger_column(EE_Message_Template_Group $item)
386
+	{
387
+		return [];
388
+	}
389 389
 }
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_data_reset_and_delete.template.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
             <?php esc_html_e('Reset Ticket and Datetime Reserved Counts', 'event_espresso'); ?>
21 21
         </h4>
22 22
         <p><?php esc_html_e(
23
-            'Use this to reset the counts for ticket and datetime reservations.',
24
-            'event_espresso'
25
-        ); ?></p>
23
+			'Use this to reset the counts for ticket and datetime reservations.',
24
+			'event_espresso'
25
+		); ?></p>
26 26
         <div class="ee-admin-button-row"><?php echo $reset_reservations_button; // already escaped ?></div>
27 27
     </div>
28 28
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
         </h4>
36 36
         <p>
37 37
             <?php esc_html_e(
38
-                'Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities.  Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.',
39
-                'event_espresso'
40
-            ); ?>
38
+				'Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities.  Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.',
39
+				'event_espresso'
40
+			); ?>
41 41
         </p>
42 42
         <div class="ee-admin-button-row"><?php echo $reset_capabilities_button; // already escaped ?></div>
43 43
     </div>
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
         </h4>
50 50
         <p>
51 51
             <?php esc_html_e(
52
-                ' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.',
53
-                'event_espresso'
54
-            ); ?>
52
+				' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.',
53
+				'event_espresso'
54
+			); ?>
55 55
         </p>
56 56
         <p>
57 57
             <?php esc_html_e(
58
-                'Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.',
59
-                'event_espresso'
60
-            ); ?>
58
+				'Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.',
59
+				'event_espresso'
60
+			); ?>
61 61
         </p>
62 62
         <div class="ee-admin-button-row">
63 63
             <a class="button button--caution ee-confirm" href="<?php echo esc_url_raw($reset_db_url);
64
-            ?>"
64
+			?>"
65 65
             >
66 66
                 <?php esc_html_e('Reset Event Espresso Tables', 'event_espresso'); ?>
67 67
             </a>
@@ -75,64 +75,64 @@  discard block
 block discarded – undo
75 75
         </h4>
76 76
         <p>
77 77
             <?php esc_html_e(
78
-                ' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.',
79
-                'event_espresso'
80
-            ); ?>
78
+				' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.',
79
+				'event_espresso'
80
+			); ?>
81 81
         </p>
82 82
         <p>
83 83
             <?php esc_html_e(
84
-                'If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.',
85
-                'event_espresso'
86
-            ); ?>
84
+				'If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.',
85
+				'event_espresso'
86
+			); ?>
87 87
         </p>
88 88
         <p class="ee-important-notice">
89 89
             <?php printf(
90
-                esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'),
91
-                '&nbsp;<em>',
92
-                '</em>'
93
-            ); ?>
90
+				esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'),
91
+				'&nbsp;<em>',
92
+				'</em>'
93
+			); ?>
94 94
             <br />
95 95
         </p>
96 96
         <ol>
97 97
             <li>
98 98
                 <?php printf(
99
-                    esc_html__(
100
-                        'First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.',
101
-                        'event_espresso'
102
-                    ),
103
-                    '<strong>',
104
-                    '</strong>'
105
-                ); ?>
99
+					esc_html__(
100
+						'First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.',
101
+						'event_espresso'
102
+					),
103
+					'<strong>',
104
+					'</strong>'
105
+				); ?>
106 106
             </li>
107 107
             <li>
108 108
                 <?php printf(
109
-                    esc_html__(
110
-                        'Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s',
111
-                        'event_espresso'
112
-                    ),
113
-                    '<strong>',
114
-                    '</strong>'
115
-                ); ?>
109
+					esc_html__(
110
+						'Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s',
111
+						'event_espresso'
112
+					),
113
+					'<strong>',
114
+					'</strong>'
115
+				); ?>
116 116
             </li>
117 117
             <li>
118 118
                 <?php printf(
119
-                    esc_html__(
120
-                        'Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s',
121
-                        'event_espresso'
122
-                    ),
123
-                    '<strong>',
124
-                    '</strong>'
125
-                ); ?>
119
+					esc_html__(
120
+						'Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s',
121
+						'event_espresso'
122
+					),
123
+					'<strong>',
124
+					'</strong>'
125
+				); ?>
126 126
             </li>
127 127
             <li>
128 128
                 <?php printf(
129
-                    esc_html__(
130
-                        'Note: Event Espresso 4 categories are %snot%s deleted by this script',
131
-                        'event_espresso'
132
-                    ),
133
-                    '<strong>',
134
-                    '</strong>'
135
-                ); ?>
129
+					esc_html__(
130
+						'Note: Event Espresso 4 categories are %snot%s deleted by this script',
131
+						'event_espresso'
132
+					),
133
+					'<strong>',
134
+					'</strong>'
135
+				); ?>
136 136
                 <br>
137 137
                 <a href="<?php echo esc_url_raw(admin_url('edit-tags.php?taxonomy=espresso_event_categories')); ?>">
138 138
                     <?php esc_html_e('You can go here to delete Event Espresso categories', 'event_espresso'); ?>
Please login to merge, or discard this patch.