PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.8
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.8
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 +35 -20 6.5.2 → 6.8 View file →
@@ -14,8 +14,9 @@
14 14 public $items;
15 15
16 16 /**
17 17 * @since 4.07
18 + * @var int|bool
18 19 */
19 20 public $total_items = false;
20 21
21 22 /**
@@ -189,13 +190,11 @@
189 190
190 191 /**
191 192 * An internal method that sets all the necessary pagination arguments
192 193 *
193 - * @param array $args An associative array with information about the pagination
194 + * @param array $args An associative array with information about the pagination.
194 195 *
195 196 * @access protected
196 - *
197 - * @param array|string $args
198 197 */
199 198 protected function set_pagination_args( $args ) {
200 199 $args = wp_parse_args(
201 200 $args,
@@ -267,10 +266,10 @@
267 266 *
268 267 * @since 2.0.18
269 268 * @access public
270 269 *
271 - * @param string $text The search button text
272 - * @param string $input_id The search input id
270 + * @param string $text The search button text.
271 + * @param string $input_id The search input id.
273 272 */
274 273 public function search_box( $text, $input_id ) {
275 274 if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
276 275 return;
@@ -379,9 +378,9 @@
379 378
380 379 $two = '';
381 380 } else {
382 381 $two = '2';
383 - }
382 + }//end if
384 383
385 384 if ( empty( $this->_actions ) ) {
386 385 return;
387 386 }
@@ -465,10 +464,10 @@
465 464 *
466 465 * @since 2.0.18
467 466 * @access protected
468 467 *
469 - * @param array $actions The list of actions
470 - * @param bool $always_visible Whether the actions should be always visible
468 + * @param array $actions The list of actions.
469 + * @param bool $always_visible Whether the actions should be always visible.
471 470 *
472 471 * @return string
473 472 */
474 473 protected function row_actions( $actions, $always_visible = false ) {
@@ -548,9 +547,9 @@
548 547 * @since 2.0.18
549 548 * @access protected
550 549 *
551 550 * @param string $option
552 - * @param int $default
551 + * @param int $default
553 552 *
554 553 * @return int
555 554 */
556 555 protected function get_items_per_page( $option, $default = 20 ) {
@@ -832,9 +831,9 @@
832 831 * @return array
833 832 */
834 833 protected function get_column_info() {
835 834 // $_column_headers is already set / cached
836 - if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
835 + if ( is_array( $this->_column_headers ) ) {
837 836 // Back-compat for list tables that have been manually setting $_column_headers for horse reasons.
838 837 // In 4.3, we added a fourth argument for primary column.
839 838 $column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
840 839 foreach ( $this->_column_headers as $key => $value ) {
@@ -903,9 +902,9 @@
903 902 * @access public
904 903 *
905 904 * @staticvar int $cb_counter
906 905 *
907 - * @param bool $with_id Whether to set the id attribute or not
906 + * @param bool $with_id Whether to set the id attribute or not.
908 907 */
909 908 public function print_column_headers( $with_id = true ) {
910 909 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
911 910
@@ -976,9 +975,9 @@
976 975 // Hide the labels but show the border.
977 976 $column_display_name = '';
978 977 }
979 978 echo "<$tag $scope $id $class>$column_display_name</$tag>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
980 - }
979 + }//end foreach
981 980 }
982 981
983 982 /**
984 983 * Display the table
@@ -984,17 +983,19 @@
984 983 * Display the table
985 984 *
986 985 * @since 2.0.18
987 986 * @access public
987 + * @param array $args
988 988 */
989 - public function display() {
989 + public function display( $args = array() ) {
990 990 $singular = $this->_args['singular'];
991 991 $tbody_params = array();
992 992 if ( $singular ) {
993 993 $tbody_params['data-wp-lists'] = 'list:' . $singular;
994 994 }
995 -
996 - $this->display_tablenav( 'top' );
995 + if ( $this->should_display( $args, 'display-top-nav' ) ) {
996 + $this->display_tablenav( 'top' );
997 + }
997 998 ?>
998 999 <table class="wp-list-table <?php echo esc_attr( implode( ' ', $this->get_table_classes() ) ); ?>">
999 1000 <?php if ( $this->has_min_items( 1 ) ) { ?>
1000 1001 <thead>
@@ -1007,9 +1008,9 @@
1007 1008 <tbody id="the-list"<?php FrmAppHelper::array_to_html_params( $tbody_params, true ); ?>>
1008 1009 <?php $this->display_rows_or_placeholder(); ?>
1009 1010 </tbody>
1010 1011
1011 - <?php if ( $this->has_min_items( 1 ) ) { ?>
1012 + <?php if ( $this->has_min_items( 1 ) && $this->should_display( $args, 'display-bottom-headers' ) ) { ?>
1012 1013 <tfoot>
1013 1014 <tr>
1014 1015 <?php $this->print_column_headers( false ); ?>
1015 1016 </tr>
@@ -1016,12 +1017,26 @@
1016 1017 </tfoot>
1017 1018 <?php } ?>
1018 1019 </table>
1019 1020 <?php
1020 - $this->display_tablenav( 'bottom' );
1021 + if ( $this->should_display( $args, 'display-bottom-nav' ) ) {
1022 + $this->display_tablenav( 'bottom' );
1023 + }
1021 1024 }
1022 1025
1023 1026 /**
1027 + * Determines if a particular feature or element should be displayed.
1028 + *
1029 + * @param array $args An associative array of arguments.
1030 + * @param string $settings The specific setting key to check within the arguments array.
1031 + *
1032 + * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false.
1033 + */
1034 + protected function should_display( $args, $settings ) {
1035 + return ! isset( $args[ $settings ] ) || false !== $args[ $settings ];
1036 + }
1037 +
1038 + /**
1024 1039 * Get a list of CSS classes for the list table table tag.
1025 1040 *
1026 1041 * @since 2.0.18
1027 1042 * @access protected
@@ -1109,9 +1124,9 @@
1109 1124 *
1110 1125 * @since 2.0.18
1111 1126 * @access public
1112 1127 *
1113 - * @param object $item The current item
1128 + * @param object $item The current item.
1114 1129 */
1115 1130 public function single_row( $item ) {
1116 1131 echo '<tr>';
1117 1132 $this->single_row_columns( $item );
@@ -1123,9 +1138,9 @@
1123 1138 *
1124 1139 * @since 2.0.18
1125 1140 * @access protected
1126 1141 *
1127 - * @param object $item The current item
1142 + * @param object $item The current item.
1128 1143 */
1129 1144 protected function single_row_columns( $item ) {
1130 1145 list( $columns, $hidden,, $primary ) = $this->get_column_info();
1131 1146
@@ -1159,9 +1174,9 @@
1159 1174
1160 1175 echo $this->handle_row_actions( $item, $column_name, $primary ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1161 1176 echo '</td>';
1162 1177 }
1163 - }
1178 + }//end foreach
1164 1179 }
1165 1180
1166 1181 /**
1167 1182 * Generates and display row actions links for the list table.