X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/wordpress.git/blobdiff_plain/6c8f14c09105d0afa4c1574215c59b5021040e76..4713a14935b83517997f3c88f808eb41da55033d:/wp-admin/includes/import.php diff --git a/wp-admin/includes/import.php b/wp-admin/includes/import.php index 907bbb92..f01eb873 100644 --- a/wp-admin/includes/import.php +++ b/wp-admin/includes/import.php @@ -15,11 +15,28 @@ */ function get_importers() { global $wp_importers; - if ( is_array($wp_importers) ) - uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);')); + if ( is_array( $wp_importers ) ) { + uasort( $wp_importers, '_usort_by_first_member' ); + } return $wp_importers; } +/** + * Sorts a multidimensional array by first member of each top level member + * + * Used by uasort() as a callback, should not be used directly. + * + * @since 2.9.0 + * @access private + * + * @param array $a + * @param array $b + * @return int + */ +function _usort_by_first_member( $a, $b ) { + return strnatcasecmp( $a[0], $b[0] ); +} + /** * Register importer for WordPress. * @@ -108,9 +125,10 @@ function wp_get_popular_importers() { $popular_importers = get_site_transient( 'popular_importers_' . $locale ); if ( ! $popular_importers ) { - $url = add_query_arg( 'locale', get_locale(), 'http://api.wordpress.org/core/importers/1.0/' ); + $url = add_query_arg( 'locale', get_locale(), 'http://api.wordpress.org/core/importers/1.1/' ); $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() ); - $popular_importers = maybe_unserialize( wp_remote_retrieve_body( wp_remote_get( $url, $options ) ) ); + $response = wp_remote_get( $url, $options ); + $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true ); if ( is_array( $popular_importers ) ) set_site_transient( 'popular_importers_' . $locale, $popular_importers, 2 * DAY_IN_SECONDS );