Changeset 27373
- Timestamp:
- 03/03/2014 04:20:12 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/import.php
r27036 r27373 75 75 echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful 76 76 } else { 77 uasort( $importers, create_function('$a, $b', 'return strnatcasecmp($a[0], $b[0]);'));77 uasort( $importers, '_uasort_by_first_member' ); 78 78 ?> 79 79 <table class="widefat importers"> -
trunk/src/wp-admin/includes/import.php
r25441 r27373 16 16 function get_importers() { 17 17 global $wp_importers; 18 if ( is_array($wp_importers) ) 19 uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);')); 18 if ( is_array( $wp_importers ) ) { 19 uasort( $wp_importers, '_uasort_by_first_member' ); 20 } 20 21 return $wp_importers; 22 } 23 24 /** 25 * Sorts a multidimensional array by first member of each top level member 26 * 27 * Used by uasort() as a callback, should not be used directly. 28 * 29 * @since 2.9.0 30 * @access private 31 * 32 * @param array $a 33 * @param array $b 34 * @return int 35 */ 36 function _uasort_by_first_member( $a, $b ) { 37 return strnatcasecmp( $a[0], $b[0] ); 21 38 } 22 39 -
trunk/src/wp-admin/includes/media.php
r27369 r27373 2256 2256 $form_class .= ' html-uploader'; 2257 2257 2258 $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0; 2259 if ( $_GET['paged'] < 1 ) 2260 $_GET['paged'] = 1; 2261 $start = ( $_GET['paged'] - 1 ) * 10; 2262 if ( $start < 1 ) 2263 $start = 0; 2264 add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) ); 2265 2266 list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); 2258 $q = $_GET; 2259 $q['posts_per_page'] = 10; 2260 $q = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0; 2261 if ( $q['paged'] < 1 ) { 2262 $q['paged'] = 1; 2263 } 2264 $q['offset'] = ( $q['paged'] - 1 ) * 10; 2265 if ( $q['offset'] < 1 ) { 2266 $q['offset'] = 0; 2267 } 2268 2269 list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query( $q ); 2267 2270 2268 2271 ?> -
trunk/src/wp-admin/includes/post.php
r27261 r27373 935 935 936 936 if ( isset($q['detached']) ) 937 add_filter('posts_where', '_edit_attachments_query_helper');937 $q['post_parent'] = 0; 938 938 939 939 wp( $q ); 940 940 941 if ( isset($q['detached']) )942 remove_filter('posts_where', '_edit_attachments_query_helper');943 944 941 return array($post_mime_types, $avail_post_mime_types); 945 }946 947 function _edit_attachments_query_helper($where) {948 global $wpdb;949 return $where .= " AND {$wpdb->posts}.post_parent < 1";950 942 } 951 943 -
trunk/src/wp-includes/category-template.php
r27329 r27373 623 623 624 624 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'; 629 626 } 630 627 … … 724 721 function _wp_object_count_sort_cb( $a, $b ) { 725 722 return ( $a->count > $b->count ); 723 } 724 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 */ 736 function _plugin_topic_count( $count, $tag, $args ) { 737 return sprintf( 1 == $count? $args['single_text'] : $args['multiple_text'], number_format_i18n( $count ) ); 726 738 } 727 739 -
trunk/tests/phpunit/tests/import/import.php
r27349 r27373 228 228 } 229 229 230 function test_ordering_of_importers() { 231 global $wp_importers; 232 $_wp_importers = $wp_importers; // Preserve global state 233 $wp_importers = array( 234 'xyz1' => array( 'xyz1' ), 235 'XYZ2' => array( 'XYZ2' ), 236 'abc2' => array( 'abc2' ), 237 'ABC1' => array( 'ABC1' ), 238 'def1' => array( 'def1' ), 239 ); 240 $this->assertEquals( array( 241 'ABC1' => array( 'ABC1' ), 242 'abc2' => array( 'abc2' ), 243 'def1' => array( 'def1' ), 244 'xyz1' => array( 'xyz1' ), 245 'XYZ2' => array( 'XYZ2' ), 246 ), get_importers() ); 247 $wp_importers = $_wp_importers; // Restore global state 248 } 249 230 250 // function test_menu_import 231 251 }
Note: See TracChangeset
for help on using the changeset viewer.