| @@ -74,16 +74,16 @@ | ||
| 74 | 74 | $sync_history = ! $indices_missing ? IndexHelper::factory()->get_sync_history() : []; |
| 75 | 75 | |
| 76 | 76 | $data = [ |
| 77 | 77 | 'apiUrl' => rest_url( 'elasticpress/v1/sync' ), |
| 78 | - 'autoIndex' => isset( $_GET['do_sync'] ) && ( ! defined( 'EP_DASHBOARD_SYNC' ) || EP_DASHBOARD_SYNC ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 78 | + 'autoIndex' => Utils\isset_do_sync_parameter() && ( ! defined( 'EP_DASHBOARD_SYNC' ) || EP_DASHBOARD_SYNC ), | |
| 79 | 79 | 'indexMeta' => Utils\get_indexing_status(), |
| 80 | - 'indexables' => array_map( fn( $indexable) => [ $indexable->slug, $indexable->labels['plural'] ], $indexables ), | |
| 80 | + 'indexables' => array_map( fn( $indexable ) => [ $indexable->slug, $indexable->labels['plural'] ], $indexables ), | |
| 81 | 81 | 'isEpio' => Utils\is_epio(), |
| 82 | 82 | 'nonce' => wp_create_nonce( 'wp_rest' ), |
| 83 | 83 | 'postTypes' => array_map( fn( $post_type ) => [ $post_type, get_post_type_object( $post_type )->labels->name ], $post_types ), |
| 84 | 84 | 'syncHistory' => $sync_history, |
| 85 | - 'syncTrigger' => ! empty( $_GET['do_sync'] ) ? sanitize_text_field( wp_unslash( $_GET['do_sync'] ) ) : null, // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 85 | + 'syncTrigger' => Utils\isset_do_sync_parameter() ? sanitize_text_field( wp_unslash( $_GET['do_sync'] ) ) : null, // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 86 | 86 | ]; |
| 87 | 87 | |
| 88 | 88 | wp_localize_script( 'ep_sync_scripts', 'epDash', $data ); |
| 89 | 89 | } |