Pull out old import remnant from when importers were shipped in core. Fixes #15844.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2f51b9be0d
commit
9a5d3d4155
|
@ -183,13 +183,9 @@ if ( isset($plugin_page) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Allow plugins to define importers as well
|
||||
if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) {
|
||||
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) {
|
||||
wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
|
||||
exit;
|
||||
}
|
||||
include(ABSPATH . "wp-admin/import/$importer.php");
|
||||
if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]) ) {
|
||||
wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
$parent_file = 'tools.php';
|
||||
|
@ -211,8 +207,7 @@ if ( isset($plugin_page) ) {
|
|||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
|
||||
// Make sure rules are flushed
|
||||
global $wp_rewrite;
|
||||
$wp_rewrite->flush_rules(false);
|
||||
flush_rewrite_rules(false);
|
||||
|
||||
exit();
|
||||
} else {
|
||||
|
|
|
@ -58,29 +58,11 @@ $parent_file = 'tools.php';
|
|||
|
||||
<?php
|
||||
|
||||
// Load all importers so that they can register.
|
||||
$import_loc = 'wp-admin/import';
|
||||
$import_root = ABSPATH . $import_loc;
|
||||
|
||||
if ( file_exists( $import_root ) ) {
|
||||
$imports_dir = opendir($import_root);
|
||||
if ($imports_dir) {
|
||||
while (($file = readdir($imports_dir)) !== false) {
|
||||
if ($file[0] == '.') {
|
||||
continue;
|
||||
} elseif (substr($file, -4) == '.php') {
|
||||
require_once($import_root . '/' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir( $imports_dir );
|
||||
}
|
||||
|
||||
$importers = get_importers();
|
||||
|
||||
// If a popular importer is not registered, create a dummy registration that links to the plugin installer.
|
||||
foreach ( $popular_importers as $pop_importer => $pop_data ) {
|
||||
if ( isset($importers[$pop_importer] ) )
|
||||
if ( isset( $importers[$pop_importer] ) )
|
||||
continue;
|
||||
if ( isset( $pop_data[3] ) && isset( $importers[ $pop_data[3] ] ) )
|
||||
continue;
|
||||
|
@ -88,7 +70,7 @@ foreach ( $popular_importers as $pop_importer => $pop_data ) {
|
|||
$importers[$pop_importer] = $popular_importers[$pop_importer];
|
||||
}
|
||||
|
||||
if (empty ($importers)) {
|
||||
if ( empty($importers) ) {
|
||||
echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
|
||||
} else {
|
||||
uasort($importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);'));
|
||||
|
|
Loading…
Reference in New Issue