Make WordPress Core

Ticket #14424: 14424.diff

File 14424.diff, 3.8 KB (added by obenland, 11 years ago)
  • wp-admin/import.php

     
    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" cellspacing="0">
    8080
  • wp-admin/includes/media.php

     
    19921992        if ( get_user_setting('uploader') )
    19931993                $form_class .= ' html-uploader';
    19941994
    1995         $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
    1996         if ( $_GET['paged'] < 1 )
    1997                 $_GET['paged'] = 1;
    1998         $start = ( $_GET['paged'] - 1 ) * 10;
    1999         if ( $start < 1 )
    2000                 $start = 0;
    2001         add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) );
     1995        add_filter( 'post_limits', '_media_upload_pagination_offset' );
    20021996
    20031997        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
    20041998
     
    21402134}
    21412135
    21422136/**
     2137 * Returns a LIMIT clause to constrain the number of rows returned.
     2138 *
     2139 * @since 2.9.0
     2140 * @access private
     2141 *
     2142 * @return string The limit clause
     2143 */
     2144function _media_upload_pagination_offset() {
     2145        $_GET['paged'] = isset( $_GET['paged'] ) ? intval( $_GET['paged'] ) : 1;
     2146        $_GET['paged'] = max( $_GET['paged'], 1 );
     2147        $start         = absint( ( $_GET['paged'] - 1 ) * 10 );
     2148
     2149        return "LIMIT $start, 10";
     2150}
     2151
     2152/**
    21432153 * Creates the form for external url
    21442154 *
    21452155 * @since 2.7.0
  • 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
  • wp-includes/category-template.php

     
    614614        );
    615615
    616616        if ( !isset( $args['topic_count_text_callback'] ) && isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
    617                 $body = 'return sprintf (
    618                         _n(' . var_export($args['single_text'], true) . ', ' . var_export($args['multiple_text'], true) . ', $count),
    619                         number_format_i18n( $count ));';
    620                 $args['topic_count_text_callback'] = create_function('$count', $body);
     617                $args['topic_count_text_callback'] = '_plugin_topic_count';
    621618        }
    622619
    623620        $args = wp_parse_args( $args, $defaults );
     
    717714        return ( $a->count > $b->count );
    718715}
    719716
     717/**
     718 * Default text for tooltip for tag links
     719 *
     720 * @since 3.9.0
     721 * @access private
     722 *
     723 * @param integer $count Number of posts with that tag.
     724 * @param object  $tag   Tag object.
     725 * @param array   $args  Arguments for the tag cloud.
     726 * @return string Text for the tooltip of a tag link.
     727 */
     728function _plugin_topic_count( $count, $tag, $args ) {
     729        return sprintf( 1 == $count? $args['single_text'] : $args['multiple_text'], number_format_i18n( $count ) );
     730}
     731
    720732//
    721733// Helper functions
    722734//