PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.6
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.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 / views / tool-import-export.php

tool-import-export.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.6, at admin/views/tool-import-export.php

123 lines 3.4 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 $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 if ( filter_input( INPUT_POST, 'import' ) || filter_input( INPUT_GET, 'import' ) ) {
24 check_admin_referer( 'wpseo-import' );
25
26 $yoast_seo_post_wpseo = filter_input( INPUT_POST, 'wpseo', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
27 $yoast_seo_action = 'import';
28 }
29 elseif ( filter_input( INPUT_POST, 'import_external' ) ) {
30 check_admin_referer( 'wpseo-import-plugins' );
31
32 $yoast_seo_class = filter_input( INPUT_POST, 'import_external_plugin' );
33 if ( class_exists( $yoast_seo_class ) ) {
34 $yoast_seo_import = new WPSEO_Import_Plugin( new $yoast_seo_class(), 'import' );
35 }
36 }
37 elseif ( filter_input( INPUT_POST, 'clean_external' ) ) {
38 check_admin_referer( 'wpseo-clean-plugins' );
39
40 $yoast_seo_class = filter_input( INPUT_POST, 'clean_external_plugin' );
41 if ( class_exists( $yoast_seo_class ) ) {
42 $yoast_seo_import = new WPSEO_Import_Plugin( new $yoast_seo_class(), 'cleanup' );
43 }
44 }
45 elseif ( filter_input( INPUT_POST, 'settings_import' ) ) {
46 $yoast_seo_import = new WPSEO_Import_Settings();
47 $yoast_seo_import->import();
48 }
49
50 /**
51 * Allow custom import actions.
52 *
53 * @api WPSEO_Import_Status $yoast_seo_import Contains info about the handled import.
54 */
55 $yoast_seo_import = apply_filters( 'wpseo_handle_import', $yoast_seo_import );
56
57 if ( $yoast_seo_import ) {
58
59 $yoast_seo_message = '';
60 if ( $yoast_seo_import->status instanceof WPSEO_Import_Status ) {
61 $yoast_seo_message = $yoast_seo_import->status->get_msg();
62 }
63
64 /**
65 * Allow customization of import/export message.
66 *
67 * @api string $yoast_seo_msg The message.
68 */
69 $yoast_seo_msg = apply_filters( 'wpseo_import_message', $yoast_seo_message );
70
71 if ( ! empty( $yoast_seo_msg ) ) {
72 $yoast_seo_status = 'error';
73 if ( $yoast_seo_import->status->status ) {
74 $yoast_seo_status = 'updated';
75 }
76
77 $yoast_seo_class = 'message ' . $yoast_seo_status;
78
79 echo '<div id="message" class="', esc_attr( $yoast_seo_status ), '"><p>', esc_html( $yoast_seo_msg ), '</p></div>';
80 }
81 }
82
83 $yoast_seo_tabs = [
84 'wpseo-import' => [
85 'label' => __( 'Import settings', 'wordpress-seo' ),
86 ],
87 'wpseo-export' => [
88 'label' => __( 'Export settings', 'wordpress-seo' ),
89 ],
90 'import-seo' => [
91 'label' => __( 'Import from other SEO plugins', 'wordpress-seo' ),
92 ],
93 ];
94
95 ?>
96 <br/><br/>
97
98 <h2 class="nav-tab-wrapper" id="wpseo-tabs">
99 <?php foreach ( $yoast_seo_tabs as $identifier => $tab ) : ?>
100 <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>
101 <?php endforeach; ?>
102
103 <?php
104 /**
105 * Allow adding a custom import tab header.
106 */
107 do_action( 'wpseo_import_tab_header' );
108 ?>
109 </h2>
110
111 <?php
112
113 foreach ( $yoast_seo_tabs as $identifier => $tab ) {
114 printf( '<div id="%s" class="wpseotab">', esc_attr( $identifier ) );
115 require_once WPSEO_PATH . 'admin/views/tabs/tool/' . $identifier . '.php';
116 echo '</div>';
117 }
118
119 /**
120 * Allow adding a custom import tab.
121 */
122 do_action( 'wpseo_import_tab_content' );
123