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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow plugins to define importers as well
|
if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]) ) {
|
||||||
if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) {
|
wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
|
||||||
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) {
|
exit;
|
||||||
wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
include(ABSPATH . "wp-admin/import/$importer.php");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent_file = 'tools.php';
|
$parent_file = 'tools.php';
|
||||||
|
@ -211,8 +207,7 @@ if ( isset($plugin_page) ) {
|
||||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||||
|
|
||||||
// Make sure rules are flushed
|
// Make sure rules are flushed
|
||||||
global $wp_rewrite;
|
flush_rewrite_rules(false);
|
||||||
$wp_rewrite->flush_rules(false);
|
|
||||||
|
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -58,29 +58,11 @@ $parent_file = 'tools.php';
|
||||||
|
|
||||||
<?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();
|
$importers = get_importers();
|
||||||
|
|
||||||
// If a popular importer is not registered, create a dummy registration that links to the plugin installer.
|
// 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 ) {
|
foreach ( $popular_importers as $pop_importer => $pop_data ) {
|
||||||
if ( isset($importers[$pop_importer] ) )
|
if ( isset( $importers[$pop_importer] ) )
|
||||||
continue;
|
continue;
|
||||||
if ( isset( $pop_data[3] ) && isset( $importers[ $pop_data[3] ] ) )
|
if ( isset( $pop_data[3] ) && isset( $importers[ $pop_data[3] ] ) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -88,7 +70,7 @@ foreach ( $popular_importers as $pop_importer => $pop_data ) {
|
||||||
$importers[$pop_importer] = $popular_importers[$pop_importer];
|
$importers[$pop_importer] = $popular_importers[$pop_importer];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty ($importers)) {
|
if ( empty($importers) ) {
|
||||||
echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
|
echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
|
||||||
} else {
|
} else {
|
||||||
uasort($importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);'));
|
uasort($importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);'));
|
||||||
|
|
Loading…
Reference in New Issue