Make WordPress Core


Ignore:
Timestamp:
07/17/2016 03:31:29 PM (8 years ago)
Author:
ocean90
Message:

Import: Enhance accessibility on the Import screen.

  • Remove title attributes.
  • Show "Install Now" and "Details" links if the importer isn't installed yet.
  • Show a "Run Importer" link if the importer is installed. It also handles activation if the plugin isn't activated.
  • Add aria-label attributes to each link.
  • Unify the importer descriptions to make them independent from the plugin state. The API was changed in [meta3690].
  • Adjust JavaScript callbacks for ajaxified importer installs.

Props afercia, swissspidy, ocean90.
See #24766.
Fixes #35191.

File:
1 edited

Legend:

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

    r34566 r38075  
    127127
    128128    $locale = get_locale();
    129     $popular_importers = get_site_transient( 'popular_importers_' . $locale );
     129    $cache_key = 'popular_importers_' . md5( $locale . $wp_version );
     130    $popular_importers = get_site_transient( $cache_key );
    130131
    131132    if ( ! $popular_importers ) {
    132         $url = add_query_arg( 'locale', get_locale(), 'http://api.wordpress.org/core/importers/1.1/' );
     133        $url = add_query_arg( array(
     134            'locale'  => get_locale(),
     135            'version' => $wp_version,
     136        ), 'http://api.wordpress.org/core/importers/1.1/' );
    133137        $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() );
    134138        $response = wp_remote_get( $url, $options );
    135139        $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true );
    136140
    137         if ( is_array( $popular_importers ) )
    138             set_site_transient( 'popular_importers_' . $locale, $popular_importers, 2 * DAY_IN_SECONDS );
    139         else
     141        if ( is_array( $popular_importers ) ) {
     142            set_site_transient( $cache_key, $popular_importers, 2 * DAY_IN_SECONDS );
     143        } else {
    140144            $popular_importers = false;
     145        }
    141146    }
    142147
     
    158163        'blogger' => array(
    159164            'name' => __( 'Blogger' ),
    160             'description' => __( 'Install the Blogger importer to import posts, comments, and users from a Blogger blog.' ),
     165            'description' => __( 'Import posts, comments, and users from a Blogger blog.' ),
    161166            'plugin-slug' => 'blogger-importer',
    162167            'importer-id' => 'blogger',
     
    164169        'wpcat2tag' => array(
    165170            'name' => __( 'Categories and Tags Converter' ),
    166             'description' => __( 'Install the category/tag converter to convert existing categories to tags or tags to categories, selectively.' ),
     171            'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ),
    167172            'plugin-slug' => 'wpcat2tag-importer',
    168173            'importer-id' => 'wp-cat2tag',
     
    170175        'livejournal' => array(
    171176            'name' => __( 'LiveJournal' ),
    172             'description' => __( 'Install the LiveJournal importer to import posts from LiveJournal using their API.' ),
     177            'description' => __( 'Import posts from LiveJournal using their API.' ),
    173178            'plugin-slug' => 'livejournal-importer',
    174179            'importer-id' => 'livejournal',
     
    176181        'movabletype' => array(
    177182            'name' => __( 'Movable Type and TypePad' ),
    178             'description' => __( 'Install the Movable Type importer to import posts and comments from a Movable Type or TypePad blog.' ),
     183            'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ),
    179184            'plugin-slug' => 'movabletype-importer',
    180185            'importer-id' => 'mt',
     
    182187        'opml' => array(
    183188            'name' => __( 'Blogroll' ),
    184             'description' => __( 'Install the blogroll importer to import links in OPML format.' ),
     189            'description' => __( 'Import links in OPML format.' ),
    185190            'plugin-slug' => 'opml-importer',
    186191            'importer-id' => 'opml',
     
    188193        'rss' => array(
    189194            'name' => __( 'RSS' ),
    190             'description' => __( 'Install the RSS importer to import posts from an RSS feed.' ),
     195            'description' => __( 'Import posts from an RSS feed.' ),
    191196            'plugin-slug' => 'rss-importer',
    192197            'importer-id' => 'rss',
     
    194199        'tumblr' => array(
    195200            'name' => __( 'Tumblr' ),
    196             'description' => __( 'Install the Tumblr importer to import posts & media from Tumblr using their API.' ),
     201            'description' => __( 'Import posts & media from Tumblr using their API.' ),
    197202            'plugin-slug' => 'tumblr-importer',
    198203            'importer-id' => 'tumblr',
     
    200205        'wordpress' => array(
    201206            'name' => 'WordPress',
    202             'description' => __( 'Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ),
     207            'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ),
    203208            'plugin-slug' => 'wordpress-importer',
    204209            'importer-id' => 'wordpress',
Note: See TracChangeset for help on using the changeset viewer.