| @@ -16,8 +16,11 @@ | ||
| 16 | 16 | * @var bool|int |
| 17 | 17 | */ |
| 18 | 18 | public $total_items = 0; |
| 19 | 19 | |
| 20 | + /** | |
| 21 | + * @param array $args | |
| 22 | + */ | |
| 20 | 23 | public function __construct( $args ) { |
| 21 | 24 | parent::__construct( $args ); |
| 22 | 25 | $this->screen->set_screen_reader_content( |
| 23 | 26 | array( |
| @@ -88,12 +91,11 @@ | ||
| 88 | 91 | */ |
| 89 | 92 | protected function get_entry_items( &$s_query, &$join_form_in_query ) { |
| 90 | 93 | global $per_page; |
| 91 | 94 | $s_query = $this->get_search_query( $join_form_in_query ); |
| 92 | - $order = $this->get_order_by(); | |
| 93 | 95 | $limit = $this->get_limit( $per_page ); |
| 94 | 96 | |
| 95 | - return FrmEntry::getAll( $s_query, $order, $limit, true, $join_form_in_query ); | |
| 97 | + return FrmEntry::getAll( $s_query, $this->get_order_by(), $limit, true, $join_form_in_query ); | |
| 96 | 98 | } |
| 97 | 99 | |
| 98 | 100 | /** |
| 99 | 101 | * @since 6.5.4 |
| @@ -205,10 +207,22 @@ | ||
| 205 | 207 | 'sanitize' => 'sanitize_text_field', |
| 206 | 208 | ) |
| 207 | 209 | ); |
| 208 | 210 | |
| 209 | - if ( $s ) { | |
| 210 | - esc_html_e( 'No Entries Found', 'formidable' ); | |
| 211 | + if ( $s !== '' ) { | |
| 212 | + $current_url = set_url_scheme( | |
| 213 | + 'http://' . FrmAppHelper::get_server_value( 'HTTP_HOST' ) . FrmAppHelper::get_server_value( 'REQUEST_URI' ) | |
| 214 | + ); | |
| 215 | + $clear_url = remove_query_arg( 's', $current_url ); | |
| 216 | + | |
| 217 | + echo '<p>'; | |
| 218 | + printf( | |
| 219 | + /* translators: %1$s: Start link HTML, %2$s: End link HTML */ | |
| 220 | + esc_html__( 'No entries match your search. %1$sClear search%2$s', 'formidable' ), | |
| 221 | + '<a href="' . esc_url( $clear_url ) . '">', | |
| 222 | + '</a>' | |
| 223 | + ); | |
| 224 | + echo '</p>'; | |
| 211 | 225 | return; |
| 212 | 226 | } |
| 213 | 227 | |
| 214 | 228 | $form_id = $this->params['form']; |
| @@ -252,8 +266,9 @@ | ||
| 252 | 266 | $utm = array( |
| 253 | 267 | 'campaign' => 'spam-protection', |
| 254 | 268 | 'content' => 'entries-list-spam-protection', |
| 255 | 269 | ); |
| 270 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 256 | 271 | ?> |
| 257 | 272 | <p> |
| 258 | 273 | <?php esc_html_e( 'Getting spam form submissions?', 'formidable' ); ?> |
| 259 | 274 | <a href="<?php echo esc_url( FrmAppHelper::admin_upgrade_link( $utm, 'knowledgebase/add-spam-protection/' ) ); ?>" target="_blank"> |
| @@ -260,8 +275,9 @@ | ||
| 260 | 275 | <?php esc_html_e( 'Learn how to prevent them.', 'formidable' ); ?> |
| 261 | 276 | </a> |
| 262 | 277 | </p> |
| 263 | 278 | <?php |
| 279 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 264 | 280 | } |
| 265 | 281 | parent::display_tablenav( $which ); |
| 266 | 282 | } |
| 267 | 283 | |
| @@ -272,20 +288,22 @@ | ||
| 272 | 288 | */ |
| 273 | 289 | protected function extra_tablenav( $which ) { |
| 274 | 290 | $form_id = FrmAppHelper::simple_get( 'form', 'absint' ); |
| 275 | 291 | |
| 276 | - if ( $which === 'top' && ! $form_id ) { | |
| 277 | - echo '<div class="alignleft actions">'; | |
| 292 | + if ( $which !== 'top' || $form_id ) { | |
| 293 | + return; | |
| 294 | + } | |
| 278 | 295 | |
| 279 | - // Override the referrer to prevent it from being used for the screen options. | |
| 280 | - echo '<input type="hidden" name="_wp_http_referer" value="" />'; | |
| 296 | + echo '<div class="alignleft actions">'; | |
| 281 | 297 | |
| 282 | - echo '<label for="form" class="screen-reader-text">' . esc_html__( 'Filter by form', 'formidable' ) . '</label>'; | |
| 298 | + // Override the referrer to prevent it from being used for the screen options. | |
| 299 | + echo '<input type="hidden" name="_wp_http_referer" value="" />'; | |
| 283 | 300 | |
| 284 | - FrmFormsHelper::forms_dropdown( 'form', $form_id, array( 'blank' => __( 'View all forms', 'formidable' ) ) ); | |
| 285 | - submit_button( __( 'Filter', 'formidable' ), 'filter_action action', '', false, array( 'id' => 'post-query-submit' ) ); | |
| 286 | - echo '</div>'; | |
| 287 | - } | |
| 301 | + echo '<label for="form" class="screen-reader-text">' . esc_html__( 'Filter by form', 'formidable' ) . '</label>'; | |
| 302 | + | |
| 303 | + FrmFormsHelper::forms_dropdown( 'form', $form_id, array( 'blank' => __( 'View all forms', 'formidable' ) ) ); | |
| 304 | + submit_button( __( 'Filter', 'formidable' ), 'filter_action action', '', false, array( 'id' => 'post-query-submit' ) ); | |
| 305 | + echo '</div>'; | |
| 288 | 306 | } |
| 289 | 307 | |
| 290 | 308 | /** |
| 291 | 309 | * Gets the name of the primary column in the Entries screen |
| @@ -291,9 +309,9 @@ | ||
| 291 | 309 | * Gets the name of the primary column in the Entries screen |
| 292 | 310 | * |
| 293 | 311 | * @since 2.0.14 |
| 294 | 312 | * |
| 295 | - * @return string $primary_column | |
| 313 | + * @return string Primary column. | |
| 296 | 314 | */ |
| 297 | 315 | protected function get_primary_column_name() { |
| 298 | 316 | $columns = get_column_headers( $this->screen ); |
| 299 | 317 | $hidden = get_hidden_columns( $this->screen ); |
| @@ -324,10 +342,10 @@ | ||
| 324 | 342 | return sprintf( __( 'Entry %d', 'formidable' ), $item->id ); |
| 325 | 343 | } |
| 326 | 344 | |
| 327 | 345 | /** |
| 328 | - * @param object $item | |
| 329 | - * @param string $style | |
| 346 | + * @param stdClass $item | |
| 347 | + * @param string $style | |
| 330 | 348 | * |
| 331 | 349 | * @return string |
| 332 | 350 | */ |
| 333 | 351 | public function single_row( $item, $style = '' ) { |
| @@ -357,9 +375,9 @@ | ||
| 357 | 375 | $class .= ' column-primary'; |
| 358 | 376 | } |
| 359 | 377 | |
| 360 | 378 | if ( in_array( $column_name, $hidden, true ) ) { |
| 361 | - $class .= ' frm_hidden'; | |
| 379 | + $class .= ' hidden'; | |
| 362 | 380 | } elseif ( ! $action_col && ! in_array( $column_name, $action_columns, true ) ) { |
| 363 | 381 | $action_col = $column_name; |
| 364 | 382 | } |
| 365 | 383 | |
| @@ -481,9 +499,9 @@ | ||
| 481 | 499 | * @return string |
| 482 | 500 | */ |
| 483 | 501 | private function maybe_fix_column_name( $column_name ) { |
| 484 | 502 | if ( str_starts_with( $column_name, '0_' ) ) { |
| 485 | - $column_name = substr( $column_name, 2 ); | |
| 503 | + return substr( $column_name, 2 ); | |
| 486 | 504 | } |
| 487 | 505 | return $column_name; |
| 488 | 506 | } |
| 489 | 507 | |
| @@ -494,13 +512,13 @@ | ||
| 494 | 512 | * |
| 495 | 513 | * @return void |
| 496 | 514 | */ |
| 497 | 515 | private function get_actions( &$actions, $item, $view_link ) { |
| 498 | - $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>'; | |
| 516 | + $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . esc_html__( 'View', 'formidable' ) . '</a>'; | |
| 499 | 517 | |
| 500 | 518 | if ( current_user_can( 'frm_delete_entries' ) ) { |
| 501 | 519 | $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form']; |
| 502 | - $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" data-frmverify="' . esc_attr__( 'Permanently delete this entry?', 'formidable' ) . '" data-frmverify-btn="frm-button-red">' . __( 'Delete', 'formidable' ) . '</a>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 520 | + $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" data-frmverify="' . esc_attr__( 'Permanently delete this entry?', 'formidable' ) . '" data-frmverify-btn="frm-button-red">' . esc_html__( 'Delete', 'formidable' ) . '</a>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 503 | 521 | } |
| 504 | 522 | |
| 505 | 523 | $actions = apply_filters( 'frm_row_actions', $actions, $item ); |
| 506 | 524 | } |