X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/fa11948979fd6a4ea5705dc613b239699a459db3..1132430022383fdf47fa6cb9377300fd885297aa:/wp-admin/includes/import.php?ds=sidebyside diff --git a/wp-admin/includes/import.php b/wp-admin/includes/import.php index 590a54f5..ab8e8e3d 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. * @@ -88,7 +105,10 @@ function wp_import_handle_upload() { // Save the data $id = wp_insert_attachment( $object, $file ); - // schedule a cleanup for one day from now in case of failed import or missing wp_import_cleanup() call + /* + * Schedule a cleanup for one day from now in case of failed + * import or missing wp_import_cleanup() call. + */ wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) ); return array( 'file' => $file, 'id' => $id ); @@ -102,7 +122,7 @@ function wp_import_handle_upload() { * @return array Importers with metadata for each. */ function wp_get_popular_importers() { - include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version + include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version $locale = get_locale(); $popular_importers = get_site_transient( 'popular_importers_' . $locale );