PluginProbe ʕ •ᴥ•ʔ
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.5
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 19.1 19.10 19.11 19.12 19.13 19.14 19.2 19.3 19.4 19.5 19.5.1 19.6 19.6.1 19.7 19.7.1 19.7.2 19.8 19.9 20.0 20.1 20.10 20.11 20.12 20.13 20.2 20.2.1 20.3 20.4 20.5 20.6 20.7 20.8 20.9 21.0 21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 21.8.1 21.9 21.9.1 22.0 22.1 22.2 22.3 22.4 22.5 22.6 22.7 22.8 22.9 23.0 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 23.9 24.0 24.1 24.2 24.3 24.4 24.5 24.6 24.7 24.8 24.8.1 24.9 25.0 25.1 25.2 25.3 25.3.1 25.4 25.5 25.6 25.7 25.8 25.9 26.0 26.1 26.1.1 26.2 26.3 26.4 26.5 26.6 26.7 26.8 26.9 27.0 27.1 27.1.1 27.2 27.3 27.4
wordpress-seo / admin / views / tool-import-export.php
wordpress-seo / admin / views Last commit date
form 5 years ago tabs 3 months ago class-yoast-feature-toggle.php 1 year ago class-yoast-feature-toggles.php 3 months ago class-yoast-input-select.php 2 years ago class-yoast-integration-toggles.php 3 months ago interface-yoast-form-element.php 8 years ago js-templates-primary-term.php 3 months ago paper-collapsible.php 3 months ago partial-notifications-errors.php 3 months ago partial-notifications-template.php 3 months ago partial-notifications-warnings.php 3 months ago redirects.php 10 months ago tool-bulk-editor.php 3 months ago tool-file-editor.php 3 months ago tool-import-export.php 1 year ago
tool-import-export.php
124 lines
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 $yform = Yoast_Form::get_instance();
15 $yoast_seo_import = false;
16
17 /**
18 * The import method is used to determine if there should be something imported.
19 *
20 * In case of POST the user is on the Yoast SEO import page and in case of the GET the user sees a notice from
21 * Yoast SEO that we can import stuff for that plugin.
22 */
23 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are only comparing the variable so no need to sanitize.
24 if ( isset( $_POST['import_external'] ) && wp_unslash( $_POST['import_external'] ) === __( 'Import', 'wordpress-seo' ) ) {
25 check_admin_referer( 'wpseo-import-plugins' );
26 if ( isset( $_POST['import_external_plugin'] ) && is_string( $_POST['import_external_plugin'] ) ) {
27 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are using the variable as a class name.
28 $yoast_seo_class = wp_unslash( $_POST['import_external_plugin'] );
29 if ( class_exists( $yoast_seo_class ) ) {
30 $yoast_seo_import = new WPSEO_Import_Plugin( new $yoast_seo_class(), 'import' );
31 }
32 }
33 }
34 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are only comparing the variable so no need to sanitize.
35 elseif ( isset( $_POST['clean_external'] ) && wp_unslash( $_POST['clean_external'] ) === __( 'Clean up', 'wordpress-seo' ) ) {
36 check_admin_referer( 'wpseo-clean-plugins' );
37 if ( isset( $_POST['clean_external_plugin'] ) && is_string( $_POST['clean_external_plugin'] ) ) {
38 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are using the variable as a class name.
39 $yoast_seo_class = wp_unslash( $_POST['clean_external_plugin'] );
40 if ( class_exists( $yoast_seo_class ) ) {
41 $yoast_seo_import = new WPSEO_Import_Plugin( new $yoast_seo_class(), 'cleanup' );
42 }
43 }
44 }
45 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are only comparing to an empty string.
46 elseif ( isset( $_POST['settings_import'] ) && wp_unslash( $_POST['settings_import'] ) !== '' ) {
47 $yoast_seo_import = new WPSEO_Import_Settings();
48 $yoast_seo_import->import();
49 }
50
51 /**
52 * Allow custom import actions.
53 *
54 * @param WPSEO_Import_Status $yoast_seo_import Contains info about the handled import.
55 */
56 $yoast_seo_import = apply_filters( 'wpseo_handle_import', $yoast_seo_import );
57
58 if ( $yoast_seo_import ) {
59
60 $yoast_seo_message = '';
61 if ( $yoast_seo_import->status instanceof WPSEO_Import_Status ) {
62 $yoast_seo_message = $yoast_seo_import->status->get_msg();
63 }
64
65 /**
66 * Allow customization of import/export message.
67 *
68 * @param string $yoast_seo_msg The message.
69 */
70 $yoast_seo_msg = apply_filters( 'wpseo_import_message', $yoast_seo_message );
71
72 if ( ! empty( $yoast_seo_msg ) ) {
73 $yoast_seo_status = 'error';
74 if ( $yoast_seo_import->status->status ) {
75 $yoast_seo_status = 'updated';
76 }
77
78 $yoast_seo_class = 'message ' . $yoast_seo_status;
79
80 echo '<div id="message" class="', esc_attr( $yoast_seo_status ), '"><p>', esc_html( $yoast_seo_msg ), '</p></div>';
81 }
82 }
83
84 $yoast_seo_tabs = [
85 'wpseo-import' => [
86 'label' => __( 'Import settings', 'wordpress-seo' ),
87 ],
88 'wpseo-export' => [
89 'label' => __( 'Export settings', 'wordpress-seo' ),
90 ],
91 'import-seo' => [
92 'label' => __( 'Import from other SEO plugins', 'wordpress-seo' ),
93 ],
94 ];
95
96 ?>
97 <br/><br/>
98
99 <h2 class="nav-tab-wrapper" id="wpseo-tabs">
100 <?php foreach ( $yoast_seo_tabs as $identifier => $tab ) : ?>
101 <a class="nav-tab" id="<?php echo esc_attr( $identifier . '-tab' ); ?>" href="<?php echo esc_url( '#top#' . $identifier ); ?>"><?php echo esc_html( $tab['label'] ); ?></a>
102 <?php endforeach; ?>
103
104 <?php
105 /**
106 * Allow adding a custom import tab header.
107 */
108 do_action( 'wpseo_import_tab_header' );
109 ?>
110 </h2>
111
112 <?php
113
114 foreach ( $yoast_seo_tabs as $identifier => $tab ) {
115 printf( '<div id="%s" class="wpseotab">', esc_attr( $identifier ) );
116 require_once WPSEO_PATH . 'admin/views/tabs/tool/' . $identifier . '.php';
117 echo '</div>';
118 }
119
120 /**
121 * Allow adding a custom import tab.
122 */
123 do_action( 'wpseo_import_tab_content' );
124