| @@ -155,9 +155,9 @@ | ||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function display_rows() { |
| 158 | 158 | foreach ( $this->items as $item ) { |
| 159 | - echo "\n\t", $this->single_row( $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 159 | + echo "\n\t", $this->single_row( $item ); // WPCS: XSS ok. | |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| @@ -330,9 +330,9 @@ | ||
| 330 | 330 | echo "<ul class='subsubsub'>\n"; |
| 331 | 331 | foreach ( $views as $class => $view ) { |
| 332 | 332 | $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
| 333 | 333 | } |
| 334 | - echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 334 | + echo implode( " |</li>\n", $views ) . "</li>\n"; // WPCS: XSS ok. | |
| 335 | 335 | echo '</ul>'; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /** |
| @@ -390,18 +390,11 @@ | ||
| 390 | 390 | echo "<select name='action" . esc_attr( $two ) . "' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n"; |
| 391 | 391 | echo "<option value='-1' selected='selected'>" . esc_attr__( 'Bulk Actions', 'formidable' ) . "</option>\n"; |
| 392 | 392 | |
| 393 | 393 | foreach ( $this->_actions as $name => $title ) { |
| 394 | - $params = array( | |
| 395 | - 'value' => $name, | |
| 396 | - ); | |
| 397 | - if ( 'edit' === $name ) { | |
| 398 | - $params['class'] = 'hide-if-no-js'; | |
| 399 | - } | |
| 394 | + $class = 'edit' == $name ? ' class="hide-if-no-js"' : ''; | |
| 400 | 395 | |
| 401 | - echo "\t<option "; | |
| 402 | - FrmAppHelper::array_to_html_params( $params, true ); | |
| 403 | - echo '>' . esc_html( $title ) . '</option>' . "\n"; | |
| 396 | + echo "\t<option value='" . esc_attr( $name ) . "'$class>" . esc_html( $title ) . "</option>\n"; // WPCS: XSS ok. | |
| 404 | 397 | } |
| 405 | 398 | |
| 406 | 399 | echo "</select>\n"; |
| 407 | 400 | |
| @@ -408,9 +401,9 @@ | ||
| 408 | 401 | if ( isset( $this->_actions['bulk_delete'] ) ) { |
| 409 | 402 | $verify = $this->confirm_bulk_delete(); |
| 410 | 403 | |
| 411 | 404 | if ( $verify ) { |
| 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>"; | |
| 405 | + echo "<a id='confirm-bulk-delete-" . esc_attr( $which ) . "' class='frm-hidden' href='confirm-bulk-delete' data-frmcaution='" . esc_html__( 'Heads up', 'formidable' ) . "' data-frmverify='" . esc_attr( $verify ) . "'></a>"; | |
| 413 | 406 | } |
| 414 | 407 | } |
| 415 | 408 | |
| 416 | 409 | submit_button( __( 'Apply', 'formidable' ), 'action', '', false, array( 'id' => "doaction$two" ) ); |
| @@ -444,11 +437,11 @@ | ||
| 444 | 437 | |
| 445 | 438 | return $action; |
| 446 | 439 | } |
| 447 | 440 | |
| 448 | - private function get_bulk_action( $action_name ) { | |
| 441 | + private static function get_bulk_action( $action_name ) { | |
| 449 | 442 | $action = false; |
| 450 | - $action_param = $this->get_param( | |
| 443 | + $action_param = self::get_param( | |
| 451 | 444 | array( |
| 452 | 445 | 'param' => $action_name, |
| 453 | 446 | 'sanitize' => 'sanitize_text_field', |
| 454 | 447 | ) |
| @@ -671,9 +664,9 @@ | ||
| 671 | 664 | $page_class = ' no-pages'; |
| 672 | 665 | } |
| 673 | 666 | $this->_pagination = "<div class='tablenav-pages" . esc_attr( $page_class ) . "'>$output</div>"; |
| 674 | 667 | |
| 675 | - echo $this->_pagination; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 668 | + echo $this->_pagination; // WPCS: XSS ok. | |
| 676 | 669 | } |
| 677 | 670 | |
| 678 | 671 | private function disabled_pages( $total_pages ) { |
| 679 | 672 | $current = $this->get_pagenum(); |
| @@ -943,9 +936,9 @@ | ||
| 943 | 936 | } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) { |
| 944 | 937 | $class[] = 'num'; |
| 945 | 938 | } |
| 946 | 939 | |
| 947 | - if ( $column_key === $primary || $column_key === 'name' ) { | |
| 940 | + if ( $column_key === $primary ) { | |
| 948 | 941 | $class[] = 'column-primary'; |
| 949 | 942 | } |
| 950 | 943 | |
| 951 | 944 | if ( isset( $sortable[ $column_key ] ) ) { |
| @@ -975,9 +968,9 @@ | ||
| 975 | 968 | if ( ! $this->has_min_items() && ! $with_id ) { |
| 976 | 969 | // Hide the labels but show the border. |
| 977 | 970 | $column_display_name = ''; |
| 978 | 971 | } |
| 979 | - echo "<$tag $scope $id $class>$column_display_name</$tag>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 972 | + echo "<$tag $scope $id $class>$column_display_name</$tag>"; // WPCS: XSS ok. | |
| 980 | 973 | } |
| 981 | 974 | } |
| 982 | 975 | |
| 983 | 976 | /** |
| @@ -986,13 +979,9 @@ | ||
| 986 | 979 | * @since 2.0.18 |
| 987 | 980 | * @access public |
| 988 | 981 | */ |
| 989 | 982 | public function display() { |
| 990 | - $singular = $this->_args['singular']; | |
| 991 | - $tbody_params = array(); | |
| 992 | - if ( $singular ) { | |
| 993 | - $tbody_params['data-wp-lists'] = 'list:' . $singular; | |
| 994 | - } | |
| 983 | + $singular = $this->_args['singular']; | |
| 995 | 984 | |
| 996 | 985 | $this->display_tablenav( 'top' ); |
| 997 | 986 | ?> |
| 998 | 987 | <table class="wp-list-table <?php echo esc_attr( implode( ' ', $this->get_table_classes() ) ); ?>"> |
| @@ -1003,9 +992,9 @@ | ||
| 1003 | 992 | </tr> |
| 1004 | 993 | </thead> |
| 1005 | 994 | <?php } ?> |
| 1006 | 995 | |
| 1007 | - <tbody id="the-list"<?php FrmAppHelper::array_to_html_params( $tbody_params, true ); ?>> | |
| 996 | + <tbody id="the-list"<?php echo( $singular ? " data-wp-lists='list:" . esc_attr( $singular ) . "'" : '' ); // WPCS: XSS ok. ?>> | |
| 1008 | 997 | <?php $this->display_rows_or_placeholder(); ?> |
| 1009 | 998 | </tbody> |
| 1010 | 999 | |
| 1011 | 1000 | <?php if ( $this->has_min_items( 1 ) ) { ?> |
| @@ -1040,9 +1029,9 @@ | ||
| 1040 | 1029 | * |
| 1041 | 1030 | * @param string $which |
| 1042 | 1031 | */ |
| 1043 | 1032 | protected function display_tablenav( $which ) { |
| 1044 | - if ( 'top' === $which ) { | |
| 1033 | + if ( 'top' == $which ) { | |
| 1045 | 1034 | wp_nonce_field( 'bulk-' . $this->_args['plural'], '_wpnonce', false ); |
| 1046 | 1035 | if ( ! $this->has_min_items( 1 ) ) { |
| 1047 | 1036 | // Don't show bulk actions if no items. |
| 1048 | 1037 | return; |
| @@ -1138,27 +1127,32 @@ | ||
| 1138 | 1127 | if ( in_array( $column_name, $hidden ) ) { |
| 1139 | 1128 | $classes .= ' hidden'; |
| 1140 | 1129 | } |
| 1141 | 1130 | |
| 1142 | - $params = array( | |
| 1143 | - 'class' => $classes, | |
| 1144 | - // Comments column uses HTML in the display name with screen reader text. | |
| 1145 | - // Instead of using esc_attr(), we strip tags to get closer to a user-friendly string. | |
| 1146 | - 'data-colname' => $column_display_name, | |
| 1147 | - ); | |
| 1131 | + // Comments column uses HTML in the display name with screen reader text. | |
| 1132 | + // Instead of using esc_attr(), we strip tags to get closer to a user-friendly string. | |
| 1133 | + $data = 'data-colname="' . esc_attr( $column_display_name ) . '"'; | |
| 1148 | 1134 | |
| 1149 | - if ( 'cb' === $column_name ) { | |
| 1135 | + $attributes = 'class="' . esc_attr( $classes ) . '" ' . $data; | |
| 1136 | + | |
| 1137 | + if ( 'cb' == $column_name ) { | |
| 1150 | 1138 | echo '<th scope="row" class="check-column"></th>'; |
| 1139 | + } elseif ( method_exists( $this, '_column_' . $column_name ) ) { | |
| 1140 | + echo call_user_func( // WPCS: XSS ok. | |
| 1141 | + array( $this, '_column_' . $column_name ), | |
| 1142 | + $item, | |
| 1143 | + $classes, | |
| 1144 | + $data, | |
| 1145 | + $primary | |
| 1146 | + ); | |
| 1147 | + } elseif ( method_exists( $this, 'column_' . $column_name ) ) { | |
| 1148 | + echo "<td $attributes>"; // WPCS: XSS ok. | |
| 1149 | + echo call_user_func( array( $this, 'column_' . $column_name ), $item ); // WPCS: XSS ok. | |
| 1150 | + echo $this->handle_row_actions( $item, $column_name, $primary ); // WPCS: XSS ok. | |
| 1151 | + echo '</td>'; | |
| 1151 | 1152 | } else { |
| 1152 | - echo '<td '; | |
| 1153 | - FrmAppHelper::array_to_html_params( $params, true ); | |
| 1154 | - echo '>'; | |
| 1155 | - | |
| 1156 | - if ( method_exists( $this, 'column_' . $column_name ) ) { | |
| 1157 | - echo call_user_func( array( $this, 'column_' . $column_name ), $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1158 | - } | |
| 1159 | - | |
| 1160 | - echo $this->handle_row_actions( $item, $column_name, $primary ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1153 | + echo "<td $attributes>"; // WPCS: XSS ok. | |
| 1154 | + echo $this->handle_row_actions( $item, $column_name, $primary ); // WPCS: XSS ok. | |
| 1161 | 1155 | echo '</td>'; |
| 1162 | 1156 | } |
| 1163 | 1157 | } |
| 1164 | 1158 | } |
| @@ -1228,13 +1222,6 @@ | ||
| 1228 | 1222 | ), |
| 1229 | 1223 | ); |
| 1230 | 1224 | |
| 1231 | 1225 | printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) ); |
| 1232 | - } | |
| 1233 | - | |
| 1234 | - /** | |
| 1235 | - * @return string | |
| 1236 | - */ | |
| 1237 | - protected function loaded_from() { | |
| 1238 | - return ''; | |
| 1239 | 1226 | } |
| 1240 | 1227 | } |