Index: /trunk/wp-admin/import.php =================================================================== --- /trunk/wp-admin/import.php (revision 14984) +++ /trunk/wp-admin/import.php (revision 14985) @@ -23,4 +23,21 @@ '
' . sprintf(__('Support Forums'), 'http://wordpress.org/support/') . '
' ); + +$popular_importers = array(); +if ( current_user_can('install_plugins') ) + $popular_importers = array( + 'blogger' => array( __('Blogger'), __('Install the Blogger importer to import posts, comments, and users from a Blogger blog.'), 'install' ), + 'wpcat2tag' => array(__('Categories and Tags Converter'), __('Install the category/tag converter to convert existing categories to tags or tags to categories, selectively.'), 'install', 'wp-cat2tag' ), + 'livejournal' => array( __( 'LiveJournal' ), __( 'Install the LiveJournal importer to import posts from LiveJournal using their API.' ), 'install' ), + 'movabletype' => array( __('Movable Type and TypePad'), __('Install the Movable Type importer to import posts and comments from a Movable Type or TypePad blog.'), 'install', 'mt' ), + 'opml' => array( __('Blogroll'), __('Install the blogroll importer to import links in OPML format.'), 'install' ), + 'rss' => array( __('RSS'), __('Install the RSS importer to import posts from an RSS feed.'), 'install' ), + 'wordpress' => array( 'WordPress', __('Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'), 'install' ) + ); + +if ( ! empty( $_GET['invalid'] ) && !empty($popular_importers[$_GET['invalid']][3]) ) { + wp_redirect("import.php?import=" . $popular_importers[$_GET['invalid']][3]); + exit; +} add_thickbox(); @@ -54,16 +71,4 @@ @closedir($imports_dir); -$popular_importers = array(); -if ( current_user_can('install_plugins') ) - $popular_importers = array( - 'blogger' => array( __('Blogger'), __('Install the Blogger importer to import posts, comments, and users from a Blogger blog.'), 'install' ), - 'wpcat2tag' => array(__('Categories and Tags Converter'), __('Install the category/tag converter to convert existing categories to tags or tags to categories, selectively.'), 'install', 'wp-cat2tag' ), - 'livejournal' => array( __( 'LiveJournal' ), __( 'Install the LiveJournal importer to import posts from LiveJournal using their API.' ), 'install' ), - 'movabletype' => array( __('Movable Type and TypePad'), __('Install the Movable Type importer to import posts and comments from a Movable Type or TypePad blog.'), 'install', 'mt' ), - 'opml' => array( __('Blogroll'), __('Install the blogroll importer to import links in OPML format.'), 'install' ), - 'rss' => array( __('RSS'), __('Install the RSS importer to import posts from an RSS feed.'), 'install' ), - 'wordpress' => array( 'WordPress', __('Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'), 'install' ) - ); - $importers = get_importers(); @@ -93,5 +98,5 @@ $plugin_slug = $id . '-importer'; $action = '' . $data[0] . ''; } else { Index: /trunk/wp-admin/includes/class-wp-upgrader.php =================================================================== --- /trunk/wp-admin/includes/class-wp-upgrader.php (revision 14984) +++ /trunk/wp-admin/includes/class-wp-upgrader.php (revision 14985) @@ -1262,12 +1262,19 @@ $plugin_file = $this->upgrader->plugin_info(); - $install_actions = array( - 'activate_plugin' => '' . __('Activate Plugin') . '', - ); + $install_actions = array(); + + $from = isset($_GET['from']) ? stripslashes($_GET['from']) : 'plugins'; + + if ( 'import' == $from ) + $install_actions['activate_plugin'] = '' . __('Activate Plugin & Run Importer') . ''; + else + $install_actions['activate_plugin'] = '' . __('Activate Plugin') . ''; if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) $install_actions['network_activate'] = '' . __('Network Activate') . ''; - if ( $this->type == 'web' ) + if ( 'import' == $from ) + $install_actions['importers_page'] = '' . __('Return to Importers') . ''; + else if ( $this->type == 'web' ) $install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . ''; else Index: /trunk/wp-admin/includes/plugin-install.php =================================================================== --- /trunk/wp-admin/includes/plugin-install.php (revision 14984) +++ /trunk/wp-admin/includes/plugin-install.php (revision 14985) @@ -474,4 +474,6 @@ } } + if ( isset($_GET['from']) ) + $url .= '&from=' . urlencode(stripslashes($_GET['from'])); return compact('status', 'url', 'version'); Index: /trunk/wp-admin/plugins.php =================================================================== --- /trunk/wp-admin/plugins.php (revision 14984) +++ /trunk/wp-admin/plugins.php (revision 14985) @@ -52,5 +52,5 @@ $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin, $network_wide); if ( is_wp_error( $result ) ) { - if ('unexpected_output' == $result->get_error_code()) { + if ( 'unexpected_output' == $result->get_error_code() ) { $redirect = 'plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin; wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); @@ -66,6 +66,9 @@ update_option('recently_activated', $recent); } - - wp_redirect("plugins.php?activate=true&plugin_status=$status&paged=$page"); // overrides the ?error=true one above + if ( isset($_GET['from']) && 'import' == $_GET['from'] ) { + wp_redirect("import.php?import=" . str_replace('-importer', '', dirname($plugin)) ); // overrides the ?error=true one above and redirects to the Imports page, striping the -importer suffix + } else { + wp_redirect("plugins.php?activate=true&plugin_status=$status&paged=$page"); // overrides the ?error=true one above + } exit; break; @@ -438,5 +441,5 @@ $total_dropins_plugins = count($dropins_plugins); -//Searching. +// Searching. if ( !empty($_GET['s']) ) { function _search_plugins_filter_callback($plugin) { Index: /trunk/wp-admin/update.php =================================================================== --- /trunk/wp-admin/update.php (revision 14984) +++ /trunk/wp-admin/update.php (revision 14985) @@ -111,4 +111,7 @@ $nonce = 'install-plugin_' . $plugin; $url = 'update.php?action=install-plugin&plugin=' . $plugin; + if ( isset($_GET['from']) ) + $url .= '&from=' . urlencode(stripslashes($_GET['from'])); + $type = 'web'; //Install plugin type, From Web or an Upload.