PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.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 / pages / tools.php

tools.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.3, at admin/pages/tools.php

100 lines 3.0 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 */
7
8 if ( ! defined( 'WPSEO_VERSION' ) ) {
9 header( 'Status: 403 Forbidden' );
10 header( 'HTTP/1.1 403 Forbidden' );
11 exit();
12 }
13
14 $tool_page = '';
15
16 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
17 if ( isset( $_GET['tool'] ) && is_string( $_GET['tool'] ) ) {
18 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
19 $tool_page = sanitize_text_field( wp_unslash( $_GET['tool'] ) );
20 }
21
22 $yform = Yoast_Form::get_instance();
23 $yform->admin_header( false );
24
25 if ( $tool_page === '' ) {
26
27 $tools = [];
28
29 $tools['import-export'] = [
30 'title' => __( 'Import and Export', 'wordpress-seo' ),
31 'desc' => __( 'Import settings from other SEO plugins and export your settings for re-use on (another) site.', 'wordpress-seo' ),
32 ];
33
34 if ( WPSEO_Utils::allow_system_file_edit() === true && ! is_multisite() ) {
35 $tools['file-editor'] = [
36 'title' => __( 'File editor', 'wordpress-seo' ),
37 'desc' => __( 'This tool allows you to quickly change important files for your SEO, like your robots.txt and, if you have one, your .htaccess file.', 'wordpress-seo' ),
38 ];
39 }
40
41 $tools['bulk-editor'] = [
42 'title' => __( 'Bulk editor', 'wordpress-seo' ),
43 'desc' => __( 'This tool allows you to quickly change titles and descriptions of your posts and pages without having to go into the editor for each page.', 'wordpress-seo' ),
44 'url' => admin_url( 'admin.php?page=wpseo_page_bulk_edit' ),
45 ];
46
47 echo '<p>';
48 printf(
49 /* translators: %1$s expands to Yoast SEO */
50 esc_html__( '%1$s comes with some very powerful built-in tools:', 'wordpress-seo' ),
51 'Yoast SEO',
52 );
53 echo '</p>';
54
55 echo '<ul class="ul-disc">';
56
57 $admin_url = admin_url( 'admin.php?page=wpseo_tools' );
58
59 foreach ( $tools as $slug => $tool ) {
60 if ( ! empty( $tool['url'] ) ) {
61 $href = $tool['url'];
62 }
63 elseif ( ! empty( $tool['href'] ) ) {
64 $href = $admin_url . $tool['href'];
65 }
66 else {
67 $href = add_query_arg( [ 'tool' => $slug ], $admin_url );
68 }
69 $attr = ( ! empty( $tool['attr'] ) ) ? $tool['attr'] : '';
70
71 echo '<li>';
72 echo '<strong><a href="', esc_url( $href ), '" ', esc_attr( $attr ), '>', esc_html( $tool['title'] ), '</a></strong><br/>';
73 echo esc_html( $tool['desc'] );
74 echo '</li>';
75 }
76
77 /**
78 * WARNING: This hook is intended for internal use only.
79 * Don't use it in your code as it will be removed shortly.
80 */
81 do_action( 'wpseo_tools_overview_list_items_internal' );
82
83 echo '</ul>';
84 }
85 else {
86 echo '<a href="', esc_url( admin_url( 'admin.php?page=wpseo_tools' ) ), '">', esc_html__( '&laquo; Back to Tools page', 'wordpress-seo' ), '</a>';
87
88 $tool_pages = [ 'import-export' ];
89
90 if ( WPSEO_Utils::allow_system_file_edit() === true && ! is_multisite() ) {
91 $tool_pages[] = 'file-editor';
92 }
93
94 if ( in_array( $tool_page, $tool_pages, true ) ) {
95 require_once WPSEO_PATH . 'admin/views/tool-' . $tool_page . '.php';
96 }
97 }
98
99 $yform->admin_footer( false );
100