Nicer message for an uninstalled/invalid importer. see #13566.

git-svn-id: http://svn.automattic.com/wordpress/trunk@14970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-05-27 02:03:06 +00:00
parent 6f17332d8c
commit 5f66aba55e
2 changed files with 6 additions and 4 deletions

View File

@ -160,14 +160,13 @@ if ( isset($plugin_page) ) {
if ( ! current_user_can('import') ) if ( ! current_user_can('import') )
wp_die(__('You are not allowed to import.')); wp_die(__('You are not allowed to import.'));
if ( validate_file($importer) ) { if ( validate_file($importer) )
wp_die(__('Invalid importer.')); wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
}
// Allow plugins to define importers as well // Allow plugins to define importers as well
if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) { if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) {
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
wp_die(__('Cannot load importer.')); wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
include(ABSPATH . "wp-admin/import/$importer.php"); include(ABSPATH . "wp-admin/import/$importer.php");
} }

View File

@ -31,6 +31,9 @@ $parent_file = 'tools.php';
<div class="wrap"> <div class="wrap">
<?php screen_icon(); ?> <?php screen_icon(); ?>
<h2><?php echo esc_html( $title ); ?></h2> <h2><?php echo esc_html( $title ); ?></h2>
<?php if ( ! empty( $_GET['invalid'] ) ) : ?>
<div class="error"><p><strong><?php _e('ERROR:')?></strong> <?php printf( __('The <strong>%s</strong> importer is invalid or is not installed.'), esc_html( $_GET['invalid'] ) ); ?></p></div>
<?php endif; ?>
<p><?php _e('If you have posts or comments in another system, WordPress can import those into this site. To get started, choose a system to import from below:'); ?></p> <p><?php _e('If you have posts or comments in another system, WordPress can import those into this site. To get started, choose a system to import from below:'); ?></p>
<?php <?php