diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 90b835fb7a..2e75fb5c2c 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -260,7 +260,7 @@ function get_plugins($plugin_folder = '') { $wp_plugins[plugin_basename( $plugin_file )] = $plugin_data; } - uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' )); + uasort( $wp_plugins, '_sort_uname_callback' ); $cache_plugins[ $plugin_folder ] = $wp_plugins; wp_cache_set('plugins', $cache_plugins, 'plugins'); @@ -312,11 +312,21 @@ function get_mu_plugins() { if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php') <= 30 ) // silence is golden unset( $wp_plugins['index.php'] ); - uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' )); + uasort( $wp_plugins, '_sort_uname_callback' ); return $wp_plugins; } +/** + * Callback to sort array by a 'Name' key. + * + * @since 3.1.0 + * @access private + */ +function _sort_uname_callback( $a, $b ) { + return strnatcasecmp( $a['Name'], $b['Name'] ); +} + /** * Check the wp-content directory and retrieve all drop-ins with any plugin data. * @@ -353,7 +363,7 @@ function get_dropins() { $dropins[ $plugin_file ] = $plugin_data; } - uksort( $dropins, create_function( '$a, $b', 'return strnatcasecmp( $a, $b );' )); + uksort( $dropins, 'strnatcasecmp' ); return $dropins; } diff --git a/wp-admin/includes/widgets.php b/wp-admin/includes/widgets.php index 447ee46d43..b332b05a52 100644 --- a/wp-admin/includes/widgets.php +++ b/wp-admin/includes/widgets.php @@ -15,7 +15,7 @@ function wp_list_widgets() { global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls; $sort = $wp_registered_widgets; - usort( $sort, create_function( '$a, $b', 'return strnatcasecmp( $a["name"], $b["name"] );' ) ); + usort( $sort, '_sort_name_callback' ); $done = array(); foreach ( $sort as $widget ) { @@ -46,6 +46,16 @@ function wp_list_widgets() { } } +/** + * Callback to sort array by a 'name' key. + * + * @since 3.1.0 + * @access private + */ +function _sort_name_callback( $a, $b ) { + return strnatcasecmp( $a['name'], $b['name'] ); +} + /** * Show the widgets and their settings for a sidebar. * Used in the the admin widget config screen. diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index d2e6dceaae..94753a1dc7 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -677,7 +677,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) { $tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#'; $tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key; $tag_name = $tags[ $key ]->name; - $a[] = "$tag_name"; } @@ -702,6 +702,26 @@ function wp_generate_tag_cloud( $tags, $args = '' ) { return $return; } +/** + * Callback for comparing tags based on name + * + * @since 3.1.0 + * @access private + */ +function _wp_tag_cloud_name_sort_cb( $a, $b ) { + return strnatcasecmp( $a->name, $b->name ); +} + +/** + * Callback for comparing tags based on count + * + * @since 3.1.0 + * @access private + */ +function _wp_tag_cloud_count_sort_cb( $a, $b ) { + return ( $a->count > $b->count ); +} + // // Helper functions // diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index d15d744c1a..880f2c4d57 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -236,7 +236,7 @@ function wpautop($pee, $br = 1) { $pee = preg_replace('!
\s*(?' . $allblocks . '[^>]*>)!', "$1", $pee); $pee = preg_replace('!(?' . $allblocks . '[^>]*>)\s*
!', "$1", $pee); if ($br) { - $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '__autop_newline_preservation_helper', $pee); + $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee); $pee = preg_replace('|(?)\s*\n|', "