diff --git a/wp-admin/import.php b/wp-admin/import.php
index 2284308ddd..dc44c523ef 100644
--- a/wp-admin/import.php
+++ b/wp-admin/import.php
@@ -74,7 +74,7 @@ foreach ( $popular_importers as $pop_importer => $pop_data ) {
if ( empty( $importers ) ) {
echo '
' . __('No importers are available.') . '
'; // TODO: make more helpful
} else {
- uasort($importers, create_function('$a, $b', 'return strnatcasecmp($a[0], $b[0]);'));
+ uasort( $importers, '_uasort_by_first_member' );
?>
diff --git a/wp-admin/includes/import.php b/wp-admin/includes/import.php
index 590a54f527..b5c987229f 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, '_uasort_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 _uasort_by_first_member( $a, $b ) {
+ return strnatcasecmp( $a[0], $b[0] );
+}
+
/**
* Register importer for WordPress.
*
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 776f310a35..57ed3595fa 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -2255,15 +2255,18 @@ function media_upload_library_form($errors) {
if ( get_user_setting('uploader') )
$form_class .= ' html-uploader';
- $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
- if ( $_GET['paged'] < 1 )
- $_GET['paged'] = 1;
- $start = ( $_GET['paged'] - 1 ) * 10;
- if ( $start < 1 )
- $start = 0;
- add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) );
+ $q = $_GET;
+ $q['posts_per_page'] = 10;
+ $q = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
+ if ( $q['paged'] < 1 ) {
+ $q['paged'] = 1;
+ }
+ $q['offset'] = ( $q['paged'] - 1 ) * 10;
+ if ( $q['offset'] < 1 ) {
+ $q['offset'] = 0;
+ }
- list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
+ list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query( $q );
?>
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index 98d32d3150..9754c3dbf8 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -934,21 +934,13 @@ function wp_edit_attachments_query( $q = false ) {
unset($q['post_mime_type']);
if ( isset($q['detached']) )
- add_filter('posts_where', '_edit_attachments_query_helper');
+ $q['post_parent'] = 0;
wp( $q );
- if ( isset($q['detached']) )
- remove_filter('posts_where', '_edit_attachments_query_helper');
-
return array($post_mime_types, $avail_post_mime_types);
}
-function _edit_attachments_query_helper($where) {
- global $wpdb;
- return $where .= " AND {$wpdb->posts}.post_parent < 1";
-}
-
/**
* Returns the list of classes to be used by a metabox
*
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index 1733f4077a..3ed78380a6 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -622,10 +622,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
);
if ( !isset( $args['topic_count_text_callback'] ) && isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
- $body = 'return sprintf (
- _n(' . var_export($args['single_text'], true) . ', ' . var_export($args['multiple_text'], true) . ', $count),
- number_format_i18n( $count ));';
- $args['topic_count_text_callback'] = create_function('$count', $body);
+ $args['topic_count_text_callback'] = '_plugin_topic_count';
}
$args = wp_parse_args( $args, $defaults );
@@ -725,6 +722,21 @@ function _wp_object_count_sort_cb( $a, $b ) {
return ( $a->count > $b->count );
}
+/**
+ * Default text for tooltip for tag links
+ *
+ * @since 3.9.0
+ * @access private
+ *
+ * @param integer $count Number of posts with that tag.
+ * @param object $tag Tag object.
+ * @param array $args Arguments for the tag cloud.
+ * @return string Text for the tooltip of a tag link.
+ */
+function _plugin_topic_count( $count, $tag, $args ) {
+ return sprintf( 1 == $count? $args['single_text'] : $args['multiple_text'], number_format_i18n( $count ) );
+}
+
//
// Helper functions
//