WordPress.org

Make WordPress Core

Changeset 11247


Ignore:
Timestamp:
05/10/09 06:56:27 (5 years ago)
Author:
azaozz
Message:

Sort widgets by name case insensitive, fixes #9766

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/widgets.php

    r11246 r11247  
    2020    global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls; 
    2121 
    22     $done = array(); 
    23     $sort = array_keys($wp_registered_widgets); 
    24     natcasesort($sort); ?> 
     22    $sort = $wp_registered_widgets; 
     23    usort( $sort, create_function( '$a, $b', 'return strnatcasecmp( $a["name"], $b["name"] );' ) ); 
     24    $done = array(); ?> 
    2525 
    2626    <div class="widget-holder"> 
     
    2828    <div id="widget-list"> 
    2929<?php 
    30     foreach ( $sort as $val ) { 
    31         $widget = $wp_registered_widgets[$val]; 
     30    foreach ( $sort as $widget ) { 
    3231        if ( in_array( $widget['callback'], $done, true ) ) // We already showed this multi-widget 
    3332            continue; 
Note: See TracChangeset for help on using the changeset viewer.