PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/helpers/FrmListHelper.php +84 -196 6.266.7 View file →
@@ -7,17 +7,15 @@
7 7 /**
8 8 * The current list of items
9 9 *
10 10 * @since 2.0.18
11 - *
12 11 * @var array
12 + * @access public
13 13 */
14 14 public $items;
15 15
16 16 /**
17 17 * @since 4.07
18 - *
19 - * @var bool|int
20 18 */
21 19 public $total_items = false;
22 20
23 21 /**
@@ -23,10 +21,10 @@
23 21 /**
24 22 * Various information about the current table
25 23 *
26 24 * @since 2.0.18
27 - *
28 25 * @var array
26 + * @access protected
29 27 */
30 28 protected $_args;
31 29
32 30 /**
@@ -32,9 +30,8 @@
32 30 /**
33 31 * Various information needed for displaying the pagination
34 32 *
35 33 * @since 2.0.18
36 - *
37 34 * @var array
38 35 */
39 36 protected $_pagination_args = array();
40 37
@@ -41,10 +38,10 @@
41 38 /**
42 39 * The current screen
43 40 *
44 41 * @since 2.0.18
45 - *
46 - * @var \WP_Screen
42 + * @var object
43 + * @access protected
47 44 */
48 45 protected $screen;
49 46
50 47 /**
@@ -50,10 +47,10 @@
50 47 /**
51 48 * Cached bulk actions
52 49 *
53 50 * @since 2.0.18
54 - *
55 51 * @var array
52 + * @access private
56 53 */
57 54 private $_actions;
58 55
59 56 /**
@@ -59,10 +56,10 @@
59 56 /**
60 57 * Cached pagination output
61 58 *
62 59 * @since 2.0.18
63 - *
64 60 * @var string
61 + * @access private
65 62 */
66 63 private $_pagination;
67 64
68 65 /**
@@ -68,14 +65,15 @@
68 65 /**
69 66 * The view switcher modes.
70 67 *
71 68 * @since 2.0.18
72 - *
73 69 * @var array
70 + * @access protected
74 71 */
75 72 protected $modes = array();
76 73
77 74 /**
75 + *
78 76 * @var array
79 77 */
80 78 protected $params;
81 79
@@ -85,16 +83,10 @@
85 83 * @var array
86 84 */
87 85 protected $_column_headers;
88 86
89 - /**
90 - * @var array
91 - */
92 87 protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
93 88
94 - /**
95 - * @var array
96 - */
97 89 protected $compat_methods = array(
98 90 'set_pagination_args',
99 91 'get_views',
100 92 'get_bulk_actions',
@@ -112,12 +104,8 @@
112 104 );
113 105
114 106 /**
115 107 * Construct the table object
116 - *
117 - * @param array $args
118 - *
119 - * @return void
120 108 */
121 109 public function __construct( $args ) {
122 110 $args = wp_parse_args(
123 111 $args,
@@ -177,9 +165,9 @@
177 165 *
178 166 * @uses FrmListHelper::set_pagination_args()
179 167 *
180 168 * @since 2.0.18
181 - *
169 + * @access public
182 170 * @abstract
183 171 */
184 172 public function prepare_items() {
185 173 die( 'function FrmListHelper::prepare_items() must be over-ridden in a sub-class.' );
@@ -186,19 +174,15 @@
186 174 }
187 175
188 176 /**
189 177 * @since 3.0
190 - *
191 - * @param array $args
192 - *
193 - * @return array|string
194 178 */
195 179 protected function get_param( $args ) {
196 180 return FrmAppHelper::get_simple_request(
197 181 array(
198 182 'param' => $args['param'],
199 - 'default' => $args['default'] ?? '',
200 - 'sanitize' => $args['sanitize'] ?? 'sanitize_title',
183 + 'default' => isset( $args['default'] ) ? $args['default'] : '',
184 + 'sanitize' => isset( $args['sanitize'] ) ? $args['sanitize'] : 'sanitize_title',
201 185 'type' => 'request',
202 186 )
203 187 );
204 188 }
@@ -205,9 +189,13 @@
205 189
206 190 /**
207 191 * An internal method that sets all the necessary pagination arguments
208 192 *
209 - * @param array $args An associative array with information about the pagination.
193 + * @param array $args An associative array with information about the pagination
194 + *
195 + * @access protected
196 + *
197 + * @param array|string $args
210 198 */
211 199 protected function set_pagination_args( $args ) {
212 200 $args = wp_parse_args(
213 201 $args,
@@ -234,8 +222,9 @@
234 222 /**
235 223 * Access the pagination args.
236 224 *
237 225 * @since 2.0.18
226 + * @access public
238 227 *
239 228 * @param string $key Pagination argument to retrieve. Common values include 'total_items',
240 229 * 'total_pages', 'per_page', or 'infinite_scroll'.
241 230 *
@@ -254,8 +243,9 @@
254 243 /**
255 244 * Whether the table has items to display or not
256 245 *
257 246 * @since 2.0.18
247 + * @access public
258 248 *
259 249 * @return bool
260 250 */
261 251 public function has_items() {
@@ -265,8 +255,9 @@
265 255 /**
266 256 * Message to be displayed when there are no items
267 257 *
268 258 * @since 2.0.18
259 + * @access public
269 260 */
270 261 public function no_items() {
271 262 esc_html_e( 'No items found.', 'formidable' );
272 263 }
@@ -274,11 +265,12 @@
274 265 /**
275 266 * Display the search box.
276 267 *
277 268 * @since 2.0.18
269 + * @access public
278 270 *
279 - * @param string $text The search button text.
280 - * @param string $input_id The search input id.
271 + * @param string $text The search button text
272 + * @param string $input_id The search input id
281 273 */
282 274 public function search_box( $text, $input_id ) {
283 275 if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
284 276 return;
@@ -290,13 +282,8 @@
290 282
291 283 FrmAppHelper::show_search_box( compact( 'text', 'input_id' ) );
292 284 }
293 285
294 - /**
295 - * @param string $param_name
296 - *
297 - * @return void
298 - */
299 286 private function hidden_search_inputs( $param_name ) {
300 287 if ( ! empty( $_REQUEST[ $param_name ] ) ) {
301 288 $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) );
302 289 echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />';
@@ -307,8 +294,9 @@
307 294 * Get an associative array ( id => link ) with the list
308 295 * of views available on this table.
309 296 *
310 297 * @since 2.0.18
298 + * @access protected
311 299 *
312 300 * @return array
313 301 */
314 302 protected function get_views() {
@@ -318,8 +306,9 @@
318 306 /**
319 307 * Display the list of views available on this table.
320 308 *
321 309 * @since 2.0.18
310 + * @access public
322 311 */
323 312 public function views() {
324 313 $views = $this->get_views();
325 314 /**
@@ -338,9 +327,8 @@
338 327 return;
339 328 }
340 329
341 330 echo "<ul class='subsubsub'>\n";
342 -
343 331 foreach ( $views as $class => $view ) {
344 332 $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view;
345 333 }
346 334 echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -351,8 +339,9 @@
351 339 * Get an associative array ( option_name => option_title ) with the list
352 340 * of bulk actions available on this table.
353 341 *
354 342 * @since 2.0.18
343 + * @access protected
355 344 *
356 345 * @return array
357 346 */
358 347 protected function get_bulk_actions() {
@@ -362,8 +351,9 @@
362 351 /**
363 352 * Display the bulk actions dropdown.
364 353 *
365 354 * @since 2.0.18
355 + * @access protected
366 356 *
367 357 * @param string $which The location of the bulk actions: 'top' or 'bottom'.
368 358 * This is designated as optional for backwards-compatibility.
369 359 */
@@ -389,23 +379,22 @@
389 379
390 380 $two = '';
391 381 } else {
392 382 $two = '2';
393 - }//end if
383 + }
394 384
395 385 if ( empty( $this->_actions ) ) {
396 386 return;
397 387 }
398 388
399 - echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . esc_html__( 'Select bulk action', 'formidable' ) . '</label>';
389 + echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . esc_attr__( 'Select bulk action', 'formidable' ) . '</label>';
400 390 echo "<select name='action" . esc_attr( $two ) . "' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
401 - echo "<option value='-1' selected='selected'>" . esc_html__( 'Bulk Actions', 'formidable' ) . "</option>\n";
391 + echo "<option value='-1' selected='selected'>" . esc_attr__( 'Bulk Actions', 'formidable' ) . "</option>\n";
402 392
403 393 foreach ( $this->_actions as $name => $title ) {
404 394 $params = array(
405 395 'value' => $name,
406 396 );
407 -
408 397 if ( 'edit' === $name ) {
409 398 $params['class'] = 'hide-if-no-js';
410 399 }
411 400
@@ -419,21 +408,9 @@
419 408 if ( isset( $this->_actions['bulk_delete'] ) ) {
420 409 $verify = $this->confirm_bulk_delete();
421 410
422 411 if ( $verify ) {
423 - $confirm_delete_attributes = array(
424 - 'id' => 'confirm-bulk-delete-' . $which,
425 - 'class' => 'frm-hidden',
426 - 'tabindex' => '-1',
427 - 'aria-hidden' => 'true',
428 - 'href' => 'confirm-bulk-delete',
429 - 'data-loaded-from' => $this->loaded_from(),
430 - 'data-frmverify' => $verify,
431 - 'data-frmverify-btn' => 'frm-button-red',
432 - );
433 -
434 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
435 - echo '<a ' . FrmAppHelper::array_to_html_params( $confirm_delete_attributes ) . '></a>';
412 + echo "<a id='confirm-bulk-delete-" . esc_attr( $which ) . "' class='frm-hidden' href='confirm-bulk-delete' data-loaded-from='" . esc_attr( $this->loaded_from() ) . "' data-frmverify='" . esc_attr( $verify ) . "' data-frmverify-btn='frm-button-red'></a>";
436 413 }
437 414 }
438 415
439 416 submit_button( __( 'Apply', 'formidable' ), 'action', '', false, array( 'id' => "doaction$two" ) );
@@ -450,18 +427,18 @@
450 427 /**
451 428 * Get the current action selected from the bulk actions dropdown.
452 429 *
453 430 * @since 2.0.18
431 + * @access public
454 432 *
455 - * @return false|string The action name or False if no action was selected
433 + * @return string|false The action name or False if no action was selected
456 434 */
457 435 public function current_action() {
458 - if ( ! empty( $_REQUEST['filter_action'] ) ) {
436 + if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
459 437 return false;
460 438 }
461 439
462 440 $action = $this->get_bulk_action( 'action' );
463 -
464 441 if ( $action === false ) {
465 442 $action = $this->get_bulk_action( 'action2' );
466 443 }
467 444
@@ -467,13 +444,8 @@
467 444
468 445 return $action;
469 446 }
470 447
471 - /**
472 - * @param string $action_name
473 - *
474 - * @return false|string
475 - */
476 448 private function get_bulk_action( $action_name ) {
477 449 $action = false;
478 450 $action_param = $this->get_param(
479 451 array(
@@ -480,9 +452,8 @@
480 452 'param' => $action_name,
481 453 'sanitize' => 'sanitize_text_field',
482 454 )
483 455 );
484 -
485 456 if ( $action_param && - 1 != $action_param ) {
486 457 $action = $action_param;
487 458 }
488 459
@@ -492,11 +463,12 @@
492 463 /**
493 464 * Generate row actions div
494 465 *
495 466 * @since 2.0.18
467 + * @access protected
496 468 *
497 - * @param array $actions The list of actions.
498 - * @param bool $always_visible Whether the actions should be always visible.
469 + * @param array $actions The list of actions
470 + * @param bool $always_visible Whether the actions should be always visible
499 471 *
500 472 * @return string
501 473 */
502 474 protected function row_actions( $actions, $always_visible = false ) {
@@ -508,15 +480,13 @@
508 480 return '';
509 481 }
510 482
511 483 $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
512 -
513 484 foreach ( $actions as $action => $link ) {
514 - ++$i;
515 - $sep = $i === $action_count ? '' : ' | ';
485 + ++ $i;
486 + ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
516 487 $out .= "<span class='$action'>$link$sep</span>";
517 488 }
518 -
519 489 $out .= '</div>';
520 490
521 491 $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details', 'formidable' ) . '</span></button>';
522 492
@@ -526,8 +496,9 @@
526 496 /**
527 497 * Display a view switcher
528 498 *
529 499 * @since 2.0.18
500 + * @access protected
530 501 *
531 502 * @param string $current_mode
532 503 */
533 504 protected function view_switcher( $current_mode ) {
@@ -536,9 +507,8 @@
536 507 <div class="view-switch">
537 508 <?php
538 509 foreach ( $this->modes as $mode => $title ) {
539 510 $classes = array( 'view-' . $mode );
540 -
541 511 if ( $current_mode == $mode ) {
542 512 $classes[] = 'current';
543 513 }
544 514
@@ -557,8 +527,9 @@
557 527 /**
558 528 * Get the current page number
559 529 *
560 530 * @since 2.0.18
531 + * @access public
561 532 *
562 533 * @return int
563 534 */
564 535 public function get_pagenum() {
@@ -574,17 +545,17 @@
574 545 /**
575 546 * Get number of items to display on a single page
576 547 *
577 548 * @since 2.0.18
549 + * @access protected
578 550 *
579 551 * @param string $option
580 - * @param int $default
552 + * @param int $default
581 553 *
582 554 * @return int
583 555 */
584 556 protected function get_items_per_page( $option, $default = 20 ) {
585 557 $per_page = (int) get_user_option( $option );
586 -
587 558 if ( empty( $per_page ) || $per_page < 1 ) {
588 559 $per_page = $default;
589 560 }
590 561
@@ -607,8 +578,9 @@
607 578 /**
608 579 * Display the pagination.
609 580 *
610 581 * @since 2.0.18
582 + * @access protected
611 583 *
612 584 * @param string $which
613 585 */
614 586 protected function pagination( $which ) {
@@ -618,9 +590,8 @@
618 590
619 591 $total_items = $this->_pagination_args['total_items'];
620 592 $total_pages = $this->_pagination_args['total_pages'];
621 593 $infinite_scroll = false;
622 -
623 594 if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
624 595 $infinite_scroll = $this->_pagination_args['infinite_scroll'];
625 596 }
626 597
@@ -664,9 +635,8 @@
664 635 $current,
665 636 strlen( $total_pages )
666 637 );
667 638 }
668 -
669 639 $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
670 640
671 641 /* translators: %1$s: Current page number, %2$s: Total pages */
672 642 $page_links[] = $total_pages_before . sprintf( _x( '%1$s of %2$s', 'paging', 'formidable' ), $html_current_page, $html_total_pages ) . $total_pages_after;
@@ -689,15 +659,13 @@
689 659 )
690 660 );
691 661
692 662 $pagination_links_class = 'pagination-links';
693 -
694 663 if ( ! empty( $infinite_scroll ) ) {
695 664 $pagination_links_class = ' hide-if-js';
696 665 }
666 + $output .= "\n" . '<span class="' . esc_attr( $pagination_links_class ) . '">' . join( "\n", $page_links ) . '</span>';
697 667
698 - $output .= "\n" . '<span class="' . esc_attr( $pagination_links_class ) . '">' . implode( "\n", $page_links ) . '</span>';
699 -
700 668 if ( $total_pages ) {
701 669 $page_class = $total_pages < 2 ? ' one-page' : '';
702 670 } else {
703 671 $page_class = ' no-pages';
@@ -706,13 +674,8 @@
706 674
707 675 echo $this->_pagination; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
708 676 }
709 677
710 - /**
711 - * @param int $total_pages
712 - *
713 - * @return array
714 - */
715 678 private function disabled_pages( $total_pages ) {
716 679 $current = $this->get_pagenum();
717 680 $disable = array(
718 681 'first' => false,
@@ -737,13 +700,8 @@
737 700
738 701 return $disable;
739 702 }
740 703
741 - /**
742 - * @param string $link
743 - *
744 - * @return string
745 - */
746 704 private function link_label( $link ) {
747 705 $labels = array(
748 706 'first' => __( 'First page', 'formidable' ),
749 707 'last' => __( 'Last page', 'formidable' ),
@@ -759,13 +717,8 @@
759 717
760 718 return remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
761 719 }
762 720
763 - /**
764 - * @param array $atts
765 - *
766 - * @return string
767 - */
768 721 private function add_page_link( $atts ) {
769 722 if ( $atts['disabled'] ) {
770 723 $link = $this->add_disabled_link( $atts['arrow'] );
771 724 } else {
@@ -774,22 +727,12 @@
774 727
775 728 return $link;
776 729 }
777 730
778 - /**
779 - * @param string $label
780 - *
781 - * @return string
782 - */
783 731 private function add_disabled_link( $label ) {
784 732 return '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">' . $label . '</span>';
785 733 }
786 734
787 - /**
788 - * @param array $atts
789 - *
790 - * @return string
791 - */
792 735 private function add_active_link( $atts ) {
793 736 $url = esc_url( add_query_arg( 'paged', $atts['number'], $this->current_url() ) );
794 737 $label = $this->link_label( $atts['page'] );
795 738
@@ -810,8 +753,9 @@
810 753 *
811 754 * The second format will make the initial sorting order be descending
812 755 *
813 756 * @since 2.0.18
757 + * @access protected
814 758 *
815 759 * @return array
816 760 */
817 761 protected function get_sortable_columns() {
@@ -821,8 +765,9 @@
821 765 /**
822 766 * Gets the name of the default primary column.
823 767 *
824 768 * @since 4.3.0
769 + * @access protected
825 770 *
826 771 * @return string Name of the default primary column, in this case, an empty string.
827 772 */
828 773 protected function get_default_primary_column_name() {
@@ -846,8 +791,9 @@
846 791 /**
847 792 * Gets the name of the primary column.
848 793 *
849 794 * @since 4.3.0
795 + * @access protected
850 796 *
851 797 * @return string The name of the primary column.
852 798 */
853 799 protected function get_primary_column_name() {
@@ -880,18 +826,18 @@
880 826 /**
881 827 * Get a list of all, hidden and sortable columns, with filter applied
882 828 *
883 829 * @since 2.0.18
830 + * @access protected
884 831 *
885 832 * @return array
886 833 */
887 834 protected function get_column_info() {
888 835 // $_column_headers is already set / cached
889 - if ( is_array( $this->_column_headers ) ) {
836 + if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
890 837 // Back-compat for list tables that have been manually setting $_column_headers for horse reasons.
891 838 // In 4.3, we added a fourth argument for primary column.
892 839 $column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
893 -
894 840 foreach ( $this->_column_headers as $key => $value ) {
895 841 $column_headers[ $key ] = $value;
896 842 }
897 843
@@ -914,9 +860,8 @@
914 860 */
915 861 $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
916 862
917 863 $sortable = array();
918 -
919 864 foreach ( $_sortable as $id => $data ) {
920 865 if ( empty( $data ) ) {
921 866 continue;
922 867 }
@@ -921,9 +866,8 @@
921 866 continue;
922 867 }
923 868
924 869 $data = (array) $data;
925 -
926 870 if ( ! isset( $data[1] ) ) {
927 871 $data[1] = false;
928 872 }
929 873
@@ -940,14 +884,15 @@
940 884 /**
941 885 * Return number of visible columns
942 886 *
943 887 * @since 2.0.18
888 + * @access public
944 889 *
945 890 * @return int
946 891 */
947 892 public function get_column_count() {
948 893 list ( $columns, $hidden ) = $this->get_column_info();
949 - $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
894 + $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
950 895
951 896 return count( $columns ) - count( $hidden );
952 897 }
953 898
@@ -954,14 +899,13 @@
954 899 /**
955 900 * Print column headers, accounting for hidden and sortable columns.
956 901 *
957 902 * @since 2.0.18
903 + * @access public
958 904 *
959 905 * @staticvar int $cb_counter
960 906 *
961 - * @param bool $with_id Whether to set the id attribute or not.
962 - *
963 - * @return void
907 + * @param bool $with_id Whether to set the id attribute or not
964 908 */
965 909 public function print_column_headers( $with_id = true ) {
966 910 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
967 911
@@ -979,29 +923,25 @@
979 923 } else {
980 924 $current_order = 'asc';
981 925 }
982 926
983 - FrmAppController::apply_saved_sort_preference( $current_orderby, $current_order );
984 -
985 927 if ( ! empty( $columns['cb'] ) ) {
986 928 static $cb_counter = 1;
987 - $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'formidable' ) . '</label>';
988 - $columns['cb'] .= '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />';
989 - ++$cb_counter;
929 + $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'formidable' ) . '</label>';
930 + $columns['cb'] .= '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />';
931 + $cb_counter ++;
990 932 }
991 933
992 934 foreach ( $columns as $column_key => $column_display_name ) {
993 - $class = array( 'manage-column', "column-$column_key" );
994 - $aria_sort_attr = '';
995 - $order_text = '';
935 + $class = array( 'manage-column', "column-$column_key" );
996 936
997 937 if ( in_array( $column_key, $hidden ) ) {
998 938 $class[] = 'hidden';
999 939 }
1000 940
1001 - if ( 'cb' === $column_key ) {
941 + if ( 'cb' == $column_key ) {
1002 942 $class[] = 'check-column';
1003 - } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) {
943 + } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
1004 944 $class[] = 'num';
1005 945 }
1006 946
1007 947 if ( $column_key === $primary || $column_key === 'name' ) {
@@ -1011,17 +951,9 @@
1011 951 if ( isset( $sortable[ $column_key ] ) ) {
1012 952 list( $orderby, $desc_first ) = $sortable[ $column_key ];
1013 953
1014 954 if ( $current_orderby == $orderby ) {
1015 - // The sorted column. The `aria-sort` attribute must be set only on the sorted column.
1016 - if ( 'asc' === $current_order ) {
1017 - $order = 'desc';
1018 - $aria_sort_attr = ' aria-sort="ascending"';
1019 - } else {
1020 - $order = 'asc';
1021 - $aria_sort_attr = ' aria-sort="descending"';
1022 - }
1023 -
955 + $order = 'asc' == $current_order ? 'desc' : 'asc';
1024 956 $class[] = 'sorted';
1025 957 $class[] = $current_order;
1026 958 } else {
1027 959 $order = $desc_first ? 'desc' : 'asc';
@@ -1026,41 +958,19 @@
1026 958 } else {
1027 959 $order = $desc_first ? 'desc' : 'asc';
1028 960 $class[] = 'sortable';
1029 961 $class[] = $desc_first ? 'asc' : 'desc';
1030 -
1031 - /* translators: Hidden accessibility text. */
1032 - $asc_text = __( 'Sort ascending.', 'formidable' );
1033 - /* translators: Hidden accessibility text. */
1034 - $desc_text = __( 'Sort descending.', 'formidable' );
1035 - $order_text = 'asc' === $order ? $asc_text : $desc_text;
1036 - }//end if
1037 -
1038 - if ( '' !== $order_text ) {
1039 - $order_text = ' <span class="screen-reader-text">' . $order_text . '</span>';
1040 962 }
1041 963
1042 - $column_display_name = sprintf(
1043 - '<a href="%1$s">' .
1044 - '<span>%2$s</span>' .
1045 - '<span class="sorting-indicators">' .
1046 - '<span class="sorting-indicator asc" aria-hidden="true"></span>' .
1047 - '<span class="sorting-indicator desc" aria-hidden="true"></span>' .
1048 - '</span>' .
1049 - '%3$s' .
1050 - '</a>',
1051 - esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ),
1052 - $column_display_name,
1053 - $order_text
1054 - );
1055 - }//end if
964 + $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . esc_html( $column_display_name ) . '</span><span class="sorting-indicator"></span></a>';
965 + }
1056 966
1057 - $tag = 'cb' === $column_key ? 'td' : 'th';
1058 - $scope = 'th' === $tag ? 'scope="col"' : '';
967 + $tag = ( 'cb' === $column_key ) ? 'td' : 'th';
968 + $scope = ( 'th' === $tag ) ? 'scope="col"' : '';
1059 969 $id = $with_id ? "id='" . esc_attr( $column_key ) . "'" : '';
1060 970
1061 971 if ( ! empty( $class ) ) {
1062 - $class = "class='" . esc_attr( implode( ' ', $class ) ) . "'";
972 + $class = "class='" . esc_attr( join( ' ', $class ) ) . "'";
1063 973 }
1064 974
1065 975 if ( ! $this->has_min_items() && ! $with_id ) {
1066 976 // Hide the labels but show the border.
@@ -1065,10 +975,10 @@
1065 975 if ( ! $this->has_min_items() && ! $with_id ) {
1066 976 // Hide the labels but show the border.
1067 977 $column_display_name = '';
1068 978 }
1069 - echo "<$tag $scope $id $class $aria_sort_attr>$column_display_name</$tag>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1070 - }//end foreach
979 + echo "<$tag $scope $id $class>$column_display_name</$tag>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
980 + }
1071 981 }
1072 982
1073 983 /**
1074 984 * Display the table
@@ -1073,26 +983,18 @@
1073 983 /**
1074 984 * Display the table
1075 985 *
1076 986 * @since 2.0.18
1077 - *
1078 - * @param array $args
1079 - *
1080 - * @return void
987 + * @access public
1081 988 */
1082 - public function display( $args = array() ) {
989 + public function display() {
1083 990 $singular = $this->_args['singular'];
1084 991 $tbody_params = array();
1085 -
1086 992 if ( $singular ) {
1087 993 $tbody_params['data-wp-lists'] = 'list:' . $singular;
1088 994 }
1089 995
1090 - if ( $this->should_display( $args, 'display-top-nav' ) ) {
1091 - $this->display_tablenav( 'top' );
1092 - }
1093 - $this->screen->render_screen_reader_content( 'heading_list' );
1094 -
996 + $this->display_tablenav( 'top' );
1095 997 ?>
1096 998 <table class="wp-list-table <?php echo esc_attr( implode( ' ', $this->get_table_classes() ) ); ?>">
1097 999 <?php if ( $this->has_min_items( 1 ) ) { ?>
1098 1000 <thead>
@@ -1105,9 +1007,9 @@
1105 1007 <tbody id="the-list"<?php FrmAppHelper::array_to_html_params( $tbody_params, true ); ?>>
1106 1008 <?php $this->display_rows_or_placeholder(); ?>
1107 1009 </tbody>
1108 1010
1109 - <?php if ( $this->has_min_items( 1 ) && $this->should_display( $args, 'display-bottom-headers' ) ) { ?>
1011 + <?php if ( $this->has_min_items( 1 ) ) { ?>
1110 1012 <tfoot>
1111 1013 <tr>
1112 1014 <?php $this->print_column_headers( false ); ?>
1113 1015 </tr>
@@ -1114,29 +1016,16 @@
1114 1016 </tfoot>
1115 1017 <?php } ?>
1116 1018 </table>
1117 1019 <?php
1118 - if ( $this->should_display( $args, 'display-bottom-nav' ) ) {
1119 - $this->display_tablenav( 'bottom' );
1120 - }
1020 + $this->display_tablenav( 'bottom' );
1121 1021 }
1122 1022
1123 1023 /**
1124 - * Determines if a particular feature or element should be displayed.
1125 - *
1126 - * @param array $args An associative array of arguments.
1127 - * @param string $settings The specific setting key to check within the arguments array.
1128 - *
1129 - * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false.
1130 - */
1131 - protected function should_display( $args, $settings ) {
1132 - return ! isset( $args[ $settings ] ) || false !== $args[ $settings ];
1133 - }
1134 -
1135 - /**
1136 1024 * Get a list of CSS classes for the list table table tag.
1137 1025 *
1138 1026 * @since 2.0.18
1027 + * @access protected
1139 1028 *
1140 1029 * @return array List of CSS classes for the table tag.
1141 1030 */
1142 1031 protected function get_table_classes() {
@@ -1146,8 +1035,9 @@
1146 1035 /**
1147 1036 * Generate the table navigation above or below the table
1148 1037 *
1149 1038 * @since 2.0.18
1039 + * @access protected
1150 1040 *
1151 1041 * @param string $which
1152 1042 */
1153 1043 protected function display_tablenav( $which ) {
@@ -1152,9 +1042,8 @@
1152 1042 */
1153 1043 protected function display_tablenav( $which ) {
1154 1044 if ( 'top' === $which ) {
1155 1045 wp_nonce_field( 'bulk-' . $this->_args['plural'], '_wpnonce', false );
1156 -
1157 1046 if ( ! $this->has_min_items( 1 ) ) {
1158 1047 // Don't show bulk actions if no items.
1159 1048 return;
1160 1049 }
@@ -1182,12 +1071,8 @@
1182 1071 * Use this to exclude the footer labels and bulk items.
1183 1072 * When close together, it feels like duplicates.
1184 1073 *
1185 1074 * @since 4.07
1186 - *
1187 - * @param int $limit
1188 - *
1189 - * @return bool
1190 1075 */
1191 1076 protected function has_min_items( $limit = 5 ) {
1192 1077 return $this->has_items() && ( $this->total_items === false || $this->total_items >= $limit );
1193 1078 }
@@ -1195,8 +1080,9 @@
1195 1080 /**
1196 1081 * Extra controls to be displayed between bulk actions and pagination
1197 1082 *
1198 1083 * @since 2.0.18
1084 + * @access protected
1199 1085 *
1200 1086 * @param string $which
1201 1087 */
1202 1088 protected function extra_tablenav( $which ) {
@@ -1205,8 +1091,9 @@
1205 1091 /**
1206 1092 * Generate the tbody element for the list table.
1207 1093 *
1208 1094 * @since 2.0.18
1095 + * @access public
1209 1096 */
1210 1097 public function display_rows_or_placeholder() {
1211 1098 if ( $this->has_items() ) {
1212 1099 $this->display_rows();
@@ -1220,10 +1107,11 @@
1220 1107 /**
1221 1108 * Generates content for a single row of the table
1222 1109 *
1223 1110 * @since 2.0.18
1111 + * @access public
1224 1112 *
1225 - * @param object $item The current item.
1113 + * @param object $item The current item
1226 1114 */
1227 1115 public function single_row( $item ) {
1228 1116 echo '<tr>';
1229 1117 $this->single_row_columns( $item );
@@ -1233,10 +1121,11 @@
1233 1121 /**
1234 1122 * Generates the columns for a single row of the table
1235 1123 *
1236 1124 * @since 2.0.18
1125 + * @access protected
1237 1126 *
1238 - * @param object $item The current item.
1127 + * @param object $item The current item
1239 1128 */
1240 1129 protected function single_row_columns( $item ) {
1241 1130 list( $columns, $hidden,, $primary ) = $this->get_column_info();
1242 1131
@@ -1241,9 +1130,8 @@
1241 1130 list( $columns, $hidden,, $primary ) = $this->get_column_info();
1242 1131
1243 1132 foreach ( $columns as $column_name => $column_display_name ) {
1244 1133 $classes = "$column_name column-$column_name";
1245 -
1246 1134 if ( $primary === $column_name ) {
1247 1135 $classes .= ' has-row-actions column-primary';
1248 1136 }
1249 1137
@@ -1271,9 +1159,9 @@
1271 1159
1272 1160 echo $this->handle_row_actions( $item, $column_name, $primary ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1273 1161 echo '</td>';
1274 1162 }
1275 - }//end foreach
1163 + }
1276 1164 }
1277 1165
1278 1166 /**
1279 1167 * Generates and display row actions links for the list table.
@@ -1278,8 +1166,9 @@
1278 1166 /**
1279 1167 * Generates and display row actions links for the list table.
1280 1168 *
1281 1169 * @since 4.3.0
1170 + * @access protected
1282 1171 *
1283 1172 * @param object $item The item being acted upon.
1284 1173 * @param string $column_name Current column name.
1285 1174 * @param string $primary Primary column name.
@@ -1293,14 +1182,14 @@
1293 1182 /**
1294 1183 * Handle an incoming ajax request (called from admin-ajax.php)
1295 1184 *
1296 1185 * @since 2.0.18
1186 + * @access public
1297 1187 */
1298 1188 public function ajax_response() {
1299 1189 $this->prepare_items();
1300 1190
1301 1191 ob_start();
1302 -
1303 1192 if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1304 1193 $this->display_rows();
1305 1194 } else {
1306 1195 $this->display_rows_or_placeholder();
@@ -1316,9 +1205,8 @@
1316 1205 _n( '%s item', '%s items', $this->_pagination_args['total_items'], 'formidable' ),
1317 1206 number_format_i18n( $this->_pagination_args['total_items'] )
1318 1207 );
1319 1208 }
1320 -
1321 1209 if ( isset( $this->_pagination_args['total_pages'] ) ) {
1322 1210 $response['total_pages'] = $this->_pagination_args['total_pages'];
1323 1211 $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1324 1212 }
@@ -1328,9 +1216,9 @@
1328 1216
1329 1217 /**
1330 1218 * Send required variables to JavaScript land
1331 1219 *
1332 - * @return void
1220 + * @access public
1333 1221 */
1334 1222 public function _js_vars() {
1335 1223 $args = array(
1336 1224 'class' => get_class( $this ),