PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.6
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.6
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 27.6, at admin/pages/tools.php

91 lines 2.8 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 ];
45
46 echo '<p>';
47 printf(
48 /* translators: %1$s expands to Yoast SEO */
49 esc_html__( '%1$s comes with some very powerful built-in tools:', 'wordpress-seo' ),
50 'Yoast SEO',
51 );
52 echo '</p>';
53
54 echo '<ul class="ul-disc">';
55
56 $admin_url = admin_url( 'admin.php?page=wpseo_tools' );
57
58 foreach ( $tools as $slug => $tool ) {
59 $href = ( ! empty( $tool['href'] ) ) ? $admin_url . $tool['href'] : add_query_arg( [ 'tool' => $slug ], $admin_url );
60 $attr = ( ! empty( $tool['attr'] ) ) ? $tool['attr'] : '';
61
62 echo '<li>';
63 echo '<strong><a href="', esc_url( $href ), '" ', esc_attr( $attr ), '>', esc_html( $tool['title'] ), '</a></strong><br/>';
64 echo esc_html( $tool['desc'] );
65 echo '</li>';
66 }
67
68 /**
69 * WARNING: This hook is intended for internal use only.
70 * Don't use it in your code as it will be removed shortly.
71 */
72 do_action( 'wpseo_tools_overview_list_items_internal' );
73
74 echo '</ul>';
75 }
76 else {
77 echo '<a href="', esc_url( admin_url( 'admin.php?page=wpseo_tools' ) ), '">', esc_html__( '&laquo; Back to Tools page', 'wordpress-seo' ), '</a>';
78
79 $tool_pages = [ 'bulk-editor', 'import-export' ];
80
81 if ( WPSEO_Utils::allow_system_file_edit() === true && ! is_multisite() ) {
82 $tool_pages[] = 'file-editor';
83 }
84
85 if ( in_array( $tool_page, $tool_pages, true ) ) {
86 require_once WPSEO_PATH . 'admin/views/tool-' . $tool_page . '.php';
87 }
88 }
89
90 $yform->admin_footer( false );
91