PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.3
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / admin / views / tool-bulk-editor.php

tool-bulk-editor.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.3, at admin/views/tool-bulk-editor.php

119 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Admin
6 * @since 1.5.0
7 */
8
9 if ( ! defined( 'WPSEO_VERSION' ) ) {
10 header( 'Status: 403 Forbidden' );
11 header( 'HTTP/1.1 403 Forbidden' );
12 exit();
13 }
14
15 /**
16 * Sanitizes the parameters that have been sent.
17 *
18 * @return array The sanitized fields.
19 */
20 function yoast_free_bulk_sanitize_input_fields() {
21 $possible_params = [
22 'type',
23 'paged',
24 'post_type_filter',
25 'post_status',
26 'order',
27 'orderby',
28 ];
29
30 $input_get = [];
31 foreach ( $possible_params as $param_name ) {
32 if ( isset( $_GET[ $param_name ] ) ) {
33 $input_get[ $param_name ] = sanitize_text_field( wp_unslash( $_GET[ $param_name ] ) );
34 }
35 }
36
37 return $input_get;
38 }
39
40 $yoast_free_input_fields = yoast_free_bulk_sanitize_input_fields();
41
42 // Verifies the nonce.
43 if ( ! empty( $yoast_free_input_fields ) ) {
44 check_admin_referer( 'bulk-editor-table', 'nonce' );
45 }
46
47 // If type is empty, fill it with value of first tab (title).
48 if ( ! isset( $yoast_free_input_fields['type'] ) ) {
49 $yoast_free_input_fields['type'] = 'title';
50 }
51
52 $yoast_bulk_editor_arguments = [
53 'input_fields' => $yoast_free_input_fields,
54 'nonce' => wp_create_nonce( 'bulk-editor-table' ),
55 ];
56
57 $wpseo_bulk_titles_table = new WPSEO_Bulk_Title_Editor_List_Table( $yoast_bulk_editor_arguments );
58 $wpseo_bulk_description_table = new WPSEO_Bulk_Description_List_Table( $yoast_bulk_editor_arguments );
59
60 $yoast_free_screen_reader_content = [
61 'heading_views' => __( 'Filter posts list', 'wordpress-seo' ),
62 'heading_pagination' => __( 'Posts list navigation', 'wordpress-seo' ),
63 'heading_list' => __( 'Posts list', 'wordpress-seo' ),
64 ];
65 get_current_screen()->set_screen_reader_content( $yoast_free_screen_reader_content );
66
67 if ( ! empty( $_REQUEST['_wp_http_referer'] ) && isset( $_SERVER['REQUEST_URI'] ) ) {
68 $request_uri = sanitize_file_name( wp_unslash( $_SERVER['REQUEST_URI'] ) );
69
70 wp_redirect(
71 remove_query_arg(
72 [ '_wp_http_referer', '_wpnonce' ],
73 $request_uri
74 )
75 );
76 exit;
77 }
78
79 /**
80 * Renders a bulk editor tab.
81 *
82 * @param WPSEO_Bulk_List_Table $table The table to render.
83 * @param string $id The id for the tab.
84 */
85 function wpseo_get_rendered_tab( $table, $id ) {
86 ?>
87 <div id="<?php echo esc_attr( $id ); ?>" class="wpseotab">
88 <?php
89 $table->show_page();
90 ?>
91 </div>
92 <?php
93 }
94
95 ?>
96 <script>
97 <?php /* phpcs:ignore WordPress.Security.EscapeOutput -- WPSEO_Utils::format_json_encode is safe. */ ?>
98 var wpseoBulkEditorNonce = <?php echo WPSEO_Utils::format_json_encode( wp_create_nonce( 'wpseo-bulk-editor' ) ); ?>;
99
100 // eslint-disable-next-line
101 var wpseo_bulk_editor_nonce = wpseoBulkEditorNonce;
102 </script>
103
104 <br/><br/>
105
106 <div class="wpseo_table_page">
107
108 <h2 class="nav-tab-wrapper" id="wpseo-tabs">
109 <a class="nav-tab" id="title-tab" href="#top#title"><?php esc_html_e( 'Title', 'wordpress-seo' ); ?></a>
110 <a class="nav-tab" id="description-tab"
111 href="#top#description"><?php esc_html_e( 'Description', 'wordpress-seo' ); ?></a>
112 </h2>
113
114 <div class="tabwrapper">
115 <?php wpseo_get_rendered_tab( $wpseo_bulk_titles_table, 'title' ); ?>
116 <?php wpseo_get_rendered_tab( $wpseo_bulk_description_table, 'description' ); ?>
117 </div>
118 </div>
119