WordPress.org

Making WordPress.org

Changeset 3690


Ignore:
Timestamp:
07/16/16 15:42:29 (9 months ago)
Author:
ocean90
Message:

Importers API: Add support for a version parameter.

#core35191 is going to change the layout of the Importer screen. It uses new strings to make the description consistent with the plugin state.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/core/importers/1.0/index.php

    r83 r3690  
    11<?php 
    22 
    3 $popular_importers = wporg_api_get_popular_importers(); 
    4 # unset( $popular_importers['tumblr'] ); 
     3$version = ''; 
     4if ( isset( $_REQUEST['version'] ) ) { // Introduced in WordPress 4.6. 
     5    $version = str_replace( '-src', '', $_REQUEST['version'] ); 
     6} 
     7 
     8if ( version_compare( $version, '4.6-beta', '>=' ) ) { 
     9    $popular_importers = wporg_api_get_popular_importers_46(); 
     10} else { 
     11    $popular_importers = wporg_api_get_popular_importers(); 
     12} 
    513 
    614$response = array( 'importers' => $popular_importers, 'translated' => false ); 
     
    917function __( $string ) { return $string; } 
    1018 
    11 // This function is synced in wp-admin/includes/import.php. 
     19// This function is synced in wp-admin/includes/import.php of >= 4.6 
     20function wporg_api_get_popular_importers_46() { 
     21    return array( 
     22        // slug => name, description, plugin slug, and register_importer() slug 
     23        'blogger' => array( 
     24            'name' => __( 'Blogger' ), 
     25            'description' => __( 'Import posts, comments, and users from a Blogger blog.' ), 
     26            'plugin-slug' => 'blogger-importer', 
     27            'importer-id' => 'blogger', 
     28        ), 
     29        'wpcat2tag' => array( 
     30            'name' => __( 'Categories and Tags Converter' ), 
     31            'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ), 
     32            'plugin-slug' => 'wpcat2tag-importer', 
     33            'importer-id' => 'wp-cat2tag', 
     34        ), 
     35        'livejournal' => array( 
     36            'name' => __( 'LiveJournal' ), 
     37            'description' => __( 'Import posts from LiveJournal using their API.' ), 
     38            'plugin-slug' => 'livejournal-importer', 
     39            'importer-id' => 'livejournal', 
     40        ), 
     41        'movabletype' => array( 
     42            'name' => __( 'Movable Type and TypePad' ), 
     43            'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ), 
     44            'plugin-slug' => 'movabletype-importer', 
     45            'importer-id' => 'mt', 
     46        ), 
     47        'opml' => array( 
     48            'name' => __( 'Blogroll' ), 
     49            'description' => __( 'Import links in OPML format.' ), 
     50            'plugin-slug' => 'opml-importer', 
     51            'importer-id' => 'opml', 
     52        ), 
     53        'rss' => array( 
     54            'name' => __( 'RSS' ), 
     55            'description' => __( 'Import posts from an RSS feed.' ), 
     56            'plugin-slug' => 'rss-importer', 
     57            'importer-id' => 'rss', 
     58        ), 
     59        'tumblr' => array( 
     60            'name' => __( 'Tumblr' ), 
     61            'description' => __( 'Import posts &amp; media from Tumblr using their API.' ), 
     62            'plugin-slug' => 'tumblr-importer', 
     63            'importer-id' => 'tumblr', 
     64        ), 
     65        'wordpress' => array( 
     66            'name' => 'WordPress', 
     67            'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ), 
     68            'plugin-slug' => 'wordpress-importer', 
     69            'importer-id' => 'wordpress', 
     70        ), 
     71    ); 
     72} 
    1273 
     74// This function is synced in wp-admin/includes/import.php of <= 4.5 
    1375function wporg_api_get_popular_importers() { 
    1476    return array( 
     
    64126    ); 
    65127} 
    66  
Note: See TracChangeset for help on using the changeset viewer.