@@ -227,8 +227,6 @@ public static function output_inner( array $vars ) {
227227 /**
228228 * Returns the table filter controls. Safe for output.
229229 *
230- * @deprecated Use a React component instead.
231- *
232230 * @param string $name The name for the `data-` attributes that get filtered by this control.
233231 * @param (string|int)[] $values Option values for this control.
234232 * @param string $label Label text for the filter control.
@@ -245,65 +243,7 @@ public static function output_inner( array $vars ) {
245243 * @return string Markup for the table filter controls.
246244 */
247245 protected function build_filter ( $ name , $ values , $ label , $ args = array () ) {
248-
249- if ( empty ( $ values ) || ! is_array ( $ values ) ) {
250- return esc_html ( $ label ); // Return label text, without being marked up as a label element.
251- }
252-
253- if ( ! is_array ( $ args ) ) {
254- $ args = array (
255- 'highlight ' => $ args ,
256- );
257- }
258-
259- $ args = array_merge ( array (
260- 'highlight ' => '' ,
261- 'prepend ' => array (),
262- 'append ' => array (),
263- 'all ' => _x ( 'All ' , '"All" option for filters ' , 'query-monitor ' ),
264- ), $ args );
265-
266- $ core_val = __ ( 'WordPress Core ' , 'query-monitor ' );
267- $ core_key = array_search ( $ core_val , $ values , true );
268-
269- if ( 'component ' === $ name && count ( $ values ) > 1 && false !== $ core_key ) {
270- $ args ['append ' ][ $ core_val ] = $ core_val ;
271- $ args ['append ' ]['non-core ' ] = __ ( 'Non-WordPress Core ' , 'query-monitor ' );
272- unset( $ values [ $ core_key ] );
273- }
274-
275- $ filter_id = 'qm-filter- ' . $ this ->collector ->id . '- ' . $ name ;
276-
277- $ out = '<div class="qm-filter-container"> ' . "\n" ;
278- $ out .= '<label for=" ' . esc_attr ( $ filter_id ) . '"> ' . esc_html ( $ label ) . '</label> ' ;
279- $ out .= '<select id=" ' . esc_attr ( $ filter_id ) . '" class="qm-filter" data-filter=" ' . esc_attr ( $ name ) . '" data-highlight=" ' . esc_attr ( $ args ['highlight ' ] ) . '"> ' . "\n" ;
280- $ out .= '<option value=""> ' . esc_html ( $ args ['all ' ] ) . '</option> ' . "\n" ;
281-
282- if ( ! empty ( $ args ['prepend ' ] ) ) {
283- foreach ( $ args ['prepend ' ] as $ value => $ label ) {
284- $ out .= '<option value=" ' . esc_attr ( $ value ) . '"> ' . esc_html ( $ label ) . '</option> ' . "\n" ;
285- }
286- }
287-
288- foreach ( $ values as $ key => $ value ) {
289- if ( is_int ( $ key ) && $ key >= 0 ) {
290- $ out .= '<option value=" ' . esc_attr ( $ value ) . '"> ' . esc_html ( $ value ) . '</option> ' . "\n" ;
291- } else {
292- $ out .= '<option value=" ' . esc_attr ( $ key ) . '"> ' . esc_html ( $ value ) . '</option> ' . "\n" ;
293- }
294- }
295-
296- if ( ! empty ( $ args ['append ' ] ) ) {
297- foreach ( $ args ['append ' ] as $ value => $ label ) {
298- $ out .= '<option value=" ' . esc_attr ( $ value ) . '"> ' . esc_html ( $ label ) . '</option> ' . "\n" ;
299- }
300- }
301-
302- $ out .= '</select> ' . "\n" ;
303- $ out .= '</div> ' . "\n" ;
304-
305- return $ out ;
306-
246+ return esc_html ( $ label );
307247 }
308248
309249 /**
@@ -313,22 +253,7 @@ protected function build_filter( $name, $values, $label, $args = array() ) {
313253 * @return string Markup for the column sorter controls.
314254 */
315255 protected function build_sorter ( $ heading = '' ) {
316- $ out = '' ;
317- $ out .= '<span class="qm-th"> ' ;
318- $ out .= '<span class="qm-sort-heading"> ' ;
319-
320- if ( '# ' === $ heading ) {
321- $ out .= '<span class="qm-screen-reader-text"> ' . esc_html__ ( 'Sequence ' , 'query-monitor ' ) . '</span> ' ;
322- } elseif ( $ heading ) {
323- $ out .= esc_html ( $ heading );
324- }
325-
326- $ out .= '</span> ' ;
327- $ out .= '<button class="qm-sort-controls" aria-label=" ' . esc_attr__ ( 'Sort data by this column ' , 'query-monitor ' ) . '"> ' ;
328- $ out .= QueryMonitor::icon ( 'arrow-down ' );
329- $ out .= '</button> ' ;
330- $ out .= '</span> ' ;
331- return $ out ;
256+ return esc_html ( $ heading );
332257 }
333258
334259 /**
@@ -351,14 +276,7 @@ protected static function build_toggler() {
351276 * @return string
352277 */
353278 protected static function build_filter_trigger ( $ target , $ filter , $ value , $ label ) {
354- return sprintf (
355- '<button class="qm-filter-trigger" data-qm-target="%1$s" data-qm-filter="%2$s" data-qm-value="%3$s">%4$s%5$s</button> ' ,
356- esc_attr ( $ target ),
357- esc_attr ( $ filter ),
358- esc_attr ( $ value ),
359- $ label ,
360- QueryMonitor::icon ( 'filter ' )
361- );
279+ return esc_html ( $ value );
362280 }
363281
364282 /**
@@ -540,6 +458,4 @@ public static function get_file_path_map() {
540458 public static function has_clickable_links () {
541459 return false ;
542460 }
543-
544-
545461}
0 commit comments