Make WordPress Core


Ignore:
Timestamp:
05/27/2010 11:04:08 AM (14 years ago)
Author:
dd32
Message:

Add Importer support to Plugin Install workflow, Offers to Activate Plugin & Run installer, and returning to Imports upon successful Importer Plugin Installation. See #13566

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import.php

    r14970 r14985  
    2323    '<p>' . sprintf(__('<a href="%s">Support Forums</a>'), 'http://wordpress.org/support/') . '</p>'
    2424);
     25
     26$popular_importers = array();
     27if ( current_user_can('install_plugins') )
     28    $popular_importers = array(
     29        'blogger' => array( __('Blogger'), __('Install the Blogger importer to import posts, comments, and users from a Blogger blog.'), 'install' ),
     30        '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' ),
     31        'livejournal' => array( __( 'LiveJournal' ), __( 'Install the LiveJournal importer to import posts from LiveJournal using their API.' ), 'install' ),
     32        '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' ),
     33        'opml' => array( __('Blogroll'), __('Install the blogroll importer to import links in OPML format.'), 'install' ),
     34        'rss' => array( __('RSS'), __('Install the RSS importer to import posts from an RSS feed.'), 'install' ),
     35        'wordpress' => array( 'WordPress', __('Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'), 'install' )
     36    );
     37
     38if ( ! empty( $_GET['invalid'] ) && !empty($popular_importers[$_GET['invalid']][3]) ) {
     39    wp_redirect("import.php?import=" . $popular_importers[$_GET['invalid']][3]);
     40    exit;
     41}
    2542
    2643add_thickbox();
     
    5471@closedir($imports_dir);
    5572
    56 $popular_importers = array();
    57 if ( current_user_can('install_plugins') )
    58     $popular_importers = array(
    59         'blogger' => array( __('Blogger'), __('Install the Blogger importer to import posts, comments, and users from a Blogger blog.'), 'install' ),
    60         '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' ),
    61         'livejournal' => array( __( 'LiveJournal' ), __( 'Install the LiveJournal importer to import posts from LiveJournal using their API.' ), 'install' ),
    62         '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' ),
    63         'opml' => array( __('Blogroll'), __('Install the blogroll importer to import links in OPML format.'), 'install' ),
    64         'rss' => array( __('RSS'), __('Install the RSS importer to import posts from an RSS feed.'), 'install' ),
    65         'wordpress' => array( 'WordPress', __('Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'), 'install' )
    66     );
    67 
    6873$importers = get_importers();
    6974
     
    9398            $plugin_slug = $id . '-importer';
    9499            $action = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin_slug .
    95                                     '&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox" title="' .
     100                                    '&amp;from=import&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox" title="' .
    96101                                    esc_attr__('Install importer') . '">' . $data[0] . '</a>';
    97102        } else {
Note: See TracChangeset for help on using the changeset viewer.