Make WordPress Core

Ticket #14424: 14424.2.diff

File 14424.2.diff, 4.1 KB (added by markjaquith, 8 years ago)

refresh

  • src/wp-admin/import.php

    foreach ( $popular_importers as $pop_importer => $pop_data ) { 
    7474if ( empty( $importers ) ) {
    7575        echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful
    7676} else {
    77         uasort($importers, create_function('$a, $b', 'return strnatcasecmp($a[0], $b[0]);'));
     77        uasort( $importers, '_uasort_importers_by_name' );
    7878?>
    7979<table class="widefat importers">
    8080
  • src/wp-admin/includes/import.php

     
    1616function get_importers() {
    1717        global $wp_importers;
    1818        if ( is_array($wp_importers) )
    19                 uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);'));
     19                uasort( $wp_importers, '_uasort_importers_by_name' );
    2020        return $wp_importers;
    2121}
    2222
    2323/**
     24 * Sort importers by name.
     25 *
     26 * Used by uasort() as a callback, should not be used directly.
     27 *
     28 * @since 2.9.0
     29 * @access private
     30 *
     31 * @param array $a
     32 * @param array $b
     33 * @return int
     34 */
     35function _uasort_importers_by_name( $a, $b ) {
     36        return strnatcasecmp( $a[0], $b[0] );
     37}
     38
     39/**
    2440 * Register importer for WordPress.
    2541 *
    2642 * @since 2.0.0
  • src/wp-admin/includes/media.php

    function media_upload_library_form($errors) { 
    22602260        if ( get_user_setting('uploader') )
    22612261                $form_class .= ' html-uploader';
    22622262
    2263         $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
    2264         if ( $_GET['paged'] < 1 )
    2265                 $_GET['paged'] = 1;
    2266         $start = ( $_GET['paged'] - 1 ) * 10;
    2267         if ( $start < 1 )
    2268                 $start = 0;
    2269         add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) );
     2263        add_filter( 'post_limits', '_media_upload_pagination_offset' );
    22702264
    22712265        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
    22722266
    jQuery(function($){ 
    24172411}
    24182412
    24192413/**
     2414 * Returns a LIMIT clause to constrain the number of rows returned.
     2415 *
     2416 * @since 2.9.0
     2417 * @access private
     2418 *
     2419 * @return string The limit clause
     2420 */
     2421function _media_upload_pagination_offset() {
     2422        $_GET['paged'] = isset( $_GET['paged'] ) ? intval( $_GET['paged'] ) : 1;
     2423        $_GET['paged'] = max( $_GET['paged'], 1 );
     2424        $start         = absint( ( $_GET['paged'] - 1 ) * 10 );
     2425
     2426        return "LIMIT $start, 10";
     2427}
     2428
     2429/**
    24202430 * Creates the form for external url
    24212431 *
    24222432 * @since 2.7.0
  • src/wp-includes/category-template.php

    function wp_generate_tag_cloud( $tags, $args = '' ) { 
    622622        );
    623623
    624624        if ( !isset( $args['topic_count_text_callback'] ) && isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
    625                 $body = 'return sprintf (
    626                         _n(' . var_export($args['single_text'], true) . ', ' . var_export($args['multiple_text'], true) . ', $count),
    627                         number_format_i18n( $count ));';
    628                 $args['topic_count_text_callback'] = create_function('$count', $body);
     625                $args['topic_count_text_callback'] = '_plugin_topic_count';
    629626        }
    630627
    631628        $args = wp_parse_args( $args, $defaults );
    function _wp_object_count_sort_cb( $a, $b ) { 
    725722        return ( $a->count > $b->count );
    726723}
    727724
     725/**
     726 * Default text for tooltip for tag links
     727 *
     728 * @since 3.9.0
     729 * @access private
     730 *
     731 * @param integer $count Number of posts with that tag.
     732 * @param object  $tag   Tag object.
     733 * @param array   $args  Arguments for the tag cloud.
     734 * @return string Text for the tooltip of a tag link.
     735 */
     736function _plugin_topic_count( $count, $tag, $args ) {
     737        return sprintf( 1 == $count? $args['single_text'] : $args['multiple_text'], number_format_i18n( $count ) );
     738}
     739
    728740//
    729741// Helper functions
    730742//