| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPSEO plugin file. |
| 4 |
* |
| 5 |
* @package WPSEO\Admin\Views |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'WPSEO_VERSION' ) ) { |
| 9 |
header( 'Status: 403 Forbidden' ); |
| 10 |
header( 'HTTP/1.1 403 Forbidden' ); |
| 11 |
exit(); |
| 12 |
} |
| 13 |
|
| 14 |
// Determine if we have plugins we can import from. If so, load that tab. Otherwise, load an empty tab. |
| 15 |
$import_check = new WPSEO_Import_Plugins_Detector(); |
| 16 |
$import_check->detect(); |
| 17 |
if ( count( $import_check->needs_import ) === 0 ) { |
| 18 |
echo '<h2>', esc_html__( 'Import from other SEO plugins', 'wordpress-seo' ), '</h2>'; |
| 19 |
echo '<p>'; |
| 20 |
printf( |
| 21 |
/* translators: %s expands to Yoast SEO */ |
| 22 |
esc_html__( '%s did not detect any plugin data from plugins it can import from.', 'wordpress-seo' ), |
| 23 |
'Yoast SEO', |
| 24 |
); |
| 25 |
echo '</p>'; |
| 26 |
|
| 27 |
return; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Creates a select box given a name and plugins array. |
| 32 |
* |
| 33 |
* @param string $name Name field for the select field. |
| 34 |
* @param array $plugins An array of plugins and classes. |
| 35 |
* |
| 36 |
* @return void |
| 37 |
*/ |
| 38 |
function wpseo_import_external_select( $name, $plugins ) { |
| 39 |
esc_html_e( 'Plugin: ', 'wordpress-seo' ); |
| 40 |
echo '<select name="', esc_attr( $name ), '">'; |
| 41 |
foreach ( $plugins as $class => $plugin ) { |
| 42 |
/* translators: %s is replaced with the name of the plugin we're importing from. */ |
| 43 |
echo '<option value="' . esc_attr( $class ) . '">' . esc_html( $plugin ) . '</option>'; |
| 44 |
} |
| 45 |
echo '</select>'; |
| 46 |
} |
| 47 |
|
| 48 |
?> |
| 49 |
<h2><?php esc_html_e( 'Import from other SEO plugins', 'wordpress-seo' ); ?></h2> |
| 50 |
<p> |
| 51 |
<?php esc_html_e( 'We\'ve detected data from one or more SEO plugins on your site. Please follow the following steps to import that data:', 'wordpress-seo' ); ?> |
| 52 |
</p> |
| 53 |
|
| 54 |
<div class="tab-block"> |
| 55 |
<h3><?php esc_html_e( 'Step 1: Create a backup', 'wordpress-seo' ); ?></h3> |
| 56 |
<p> |
| 57 |
<?php esc_html_e( 'Please make a backup of your database before starting this process.', 'wordpress-seo' ); ?> |
| 58 |
</p> |
| 59 |
</div> |
| 60 |
|
| 61 |
<div class="tab-block"> |
| 62 |
<h3><?php esc_html_e( 'Step 2: Import', 'wordpress-seo' ); ?></h3> |
| 63 |
<p class="yoast-import-explanation"> |
| 64 |
<?php |
| 65 |
printf( |
| 66 |
/* translators: 1: expands to Yoast SEO */ |
| 67 |
esc_html__( 'This will import the post metadata like SEO titles and descriptions into your %1$s metadata. It will only do this when there is no existing %1$s metadata yet. The original data will remain in place.', 'wordpress-seo' ), |
| 68 |
'Yoast SEO', |
| 69 |
); |
| 70 |
?> |
| 71 |
</p> |
| 72 |
<form action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#import-seo' ) ); ?>" |
| 73 |
method="post" accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>"> |
| 74 |
<?php |
| 75 |
wp_nonce_field( 'wpseo-import-plugins', '_wpnonce', true, true ); |
| 76 |
wpseo_import_external_select( 'import_external_plugin', $import_check->needs_import ); |
| 77 |
?> |
| 78 |
<?php |
| 79 |
|
| 80 |
/** |
| 81 |
* WARNING: This hook is intended for internal use only. |
| 82 |
* Don't use it in your code as it will be removed shortly. |
| 83 |
*/ |
| 84 |
do_action( 'wpseo_import_other_plugins_internal' ); |
| 85 |
|
| 86 |
?> |
| 87 |
<input type="submit" class="button button-primary" name="import_external" |
| 88 |
value="<?php esc_attr_e( 'Import', 'wordpress-seo' ); ?>" /> |
| 89 |
</form> |
| 90 |
</div> |
| 91 |
|
| 92 |
<div class="tab-block"> |
| 93 |
<h3><?php esc_html_e( 'Step 3: Check your data', 'wordpress-seo' ); ?></h3> |
| 94 |
<p> |
| 95 |
<?php esc_html_e( 'Please check your posts and pages and see if the metadata was successfully imported.', 'wordpress-seo' ); ?> |
| 96 |
</p> |
| 97 |
</div> |
| 98 |
|
| 99 |
<div class="tab-block"> |
| 100 |
<h3><?php esc_html_e( 'Step 4: Go through the first time configuration', 'wordpress-seo' ); ?></h3> |
| 101 |
<p> |
| 102 |
<?php |
| 103 |
$ftc_page = 'admin.php?page=wpseo_dashboard#/first-time-configuration'; |
| 104 |
printf( |
| 105 |
/* translators: 1: Link start tag to the First time configuration tab in the General page, 2: Link closing tag. */ |
| 106 |
esc_html__( 'You should finish the %1$sfirst time configuration%2$s to make sure your SEO data has been optimized and you’ve set the essential Yoast SEO settings for your site.', 'wordpress-seo' ), |
| 107 |
'<a href="' . esc_url( admin_url( $ftc_page ) ) . '">', |
| 108 |
'</a>', |
| 109 |
); |
| 110 |
?> |
| 111 |
</p> |
| 112 |
</div> |
| 113 |
|
| 114 |
<div class="tab-block"> |
| 115 |
<h3><?php esc_html_e( 'Step 5: Clean up', 'wordpress-seo' ); ?></h3> |
| 116 |
<p class="yoast-cleanup-explanation"> |
| 117 |
<?php esc_html_e( 'Once you\'re certain your site is OK, you can clean up. This will remove all the original data.', 'wordpress-seo' ); ?> |
| 118 |
</p> |
| 119 |
<form action="<?php echo esc_url( admin_url( 'admin.php?page=wpseo_tools&tool=import-export#top#import-seo' ) ); ?>" |
| 120 |
method="post" accept-charset="<?php echo esc_attr( get_bloginfo( 'charset' ) ); ?>"> |
| 121 |
<?php |
| 122 |
wp_nonce_field( 'wpseo-clean-plugins', '_wpnonce', true, true ); |
| 123 |
wpseo_import_external_select( 'clean_external_plugin', $import_check->needs_import ); |
| 124 |
?> |
| 125 |
<input type="submit" class="button button-primary" name="clean_external" |
| 126 |
value="<?php esc_attr_e( 'Clean', 'wordpress-seo' ); ?>"/> |
| 127 |
</form> |
| 128 |
</div> |
| 129 |
|