| @@ -380,15 +380,18 @@ | ||
| 380 | 380 | $post_type = 'post'; |
| 381 | 381 | $source_name = 'post_type'; |
| 382 | 382 | $paged = absint( $_POST['page'] ?? 1 ); |
| 383 | 383 | if ( ! empty( $_POST['post_type'] ) ) { |
| 384 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 384 | 385 | $post_type = sanitize_text_field( $_POST['post_type'] ); |
| 385 | 386 | } |
| 386 | 387 | |
| 387 | 388 | if ( ! empty( $_POST['source_name'] ) ) { |
| 389 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 388 | 390 | $source_name = sanitize_text_field( $_POST['source_name'] ); |
| 389 | 391 | } |
| 390 | 392 | |
| 393 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 391 | 394 | $search = ! empty( $_POST['search'] ) ? sanitize_text_field( $_POST['search'] ) : ''; |
| 392 | 395 | $results = $post_list = []; |
| 393 | 396 | switch ( $source_name ) { |
| 394 | 397 | case 'taxonomy': |
| @@ -456,13 +459,14 @@ | ||
| 456 | 459 | if ( empty( $_POST['id'] ) ) { |
| 457 | 460 | wp_send_json_error( [] ); |
| 458 | 461 | } |
| 459 | 462 | |
| 463 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 460 | 464 | if ( empty( array_filter( $_POST['id'] ) ) ) { |
| 461 | 465 | wp_send_json_error( [] ); |
| 462 | 466 | } |
| 463 | 467 | $ids = array_map( 'intval', $_POST['id'] ); |
| 464 | - $source_name = ! empty( $_POST['source_name'] ) ? sanitize_text_field( $_POST['source_name'] ) : ''; | |
| 468 | + $source_name = ! empty( $_POST['source_name'] ) ? sanitize_text_field( $_POST['source_name'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 465 | 469 | |
| 466 | 470 | switch ( $source_name ) { |
| 467 | 471 | case 'taxonomy': |
| 468 | 472 | $args = [ |
| @@ -471,9 +475,11 @@ | ||
| 471 | 475 | 'order' => 'ASC', |
| 472 | 476 | 'include' => implode( ',', $ids ), |
| 473 | 477 | ]; |
| 474 | 478 | |
| 479 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 475 | 480 | if ( $_POST['post_type'] !== 'all' ) { |
| 481 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 476 | 482 | $args['taxonomy'] = sanitize_text_field( $_POST['post_type'] ); |
| 477 | 483 | } |
| 478 | 484 | |
| 479 | 485 | $response = wp_list_pluck( get_terms( $args ), 'name', 'term_id' ); |
| @@ -491,9 +497,9 @@ | ||
| 491 | 497 | break; |
| 492 | 498 | default: |
| 493 | 499 | $post_info = get_posts( |
| 494 | 500 | [ |
| 495 | - 'post_type' => sanitize_text_field( $_POST['post_type'] ), | |
| 501 | + 'post_type' => sanitize_text_field( $_POST['post_type'] ), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 496 | 502 | 'include' => implode( ',', $ids ), |
| 497 | 503 | ] |
| 498 | 504 | ); |
| 499 | 505 | $response = wp_list_pluck( $post_info, 'post_title', 'ID' ); |