Ticket #61752: plugin-theme-editor-alpha-order.patch
| File plugin-theme-editor-alpha-order.patch, 2.0 KB (added by , 6 weeks ago) |
|---|
-
src/wp-admin/theme-editor.php
98 98 } 99 99 } 100 100 101 // Move functions.php and style.css to the top. 102 if ( isset( $allowed_files['functions.php'] ) ) { 103 $allowed_files = array( 'functions.php' => $allowed_files['functions.php'] ) + $allowed_files; 104 } 105 if ( isset( $allowed_files['style.css'] ) ) { 106 $allowed_files = array( 'style.css' => $allowed_files['style.css'] ) + $allowed_files; 107 } 101 ksort( $allowed_files ); 108 102 109 103 if ( empty( $file ) ) { 110 104 $relative_file = 'style.css'; -
src/wp-admin/includes/misc.php
364 364 * @param array $allowed_files List of theme file paths. 365 365 * @return array Tree structure for listing theme files. 366 366 */ 367 function _wp_sort_file_tree( $tree ) { 368 if ( ! is_array( $tree ) ) { 369 return $tree; 370 } 371 372 $folders = array(); 373 $files = array(); 374 375 foreach ( $tree as $key => $value ) { 376 if ( is_array( $value ) ) { 377 $folders[ $key ] = _wp_sort_file_tree( $value ); 378 } else { 379 $files[ $key ] = $value; 380 } 381 } 382 383 ksort( $folders ); 384 ksort( $files ); 385 386 return $folders + $files; 387 } 388 367 389 function wp_make_theme_file_tree( $allowed_files ) { 368 390 $tree_list = array(); 369 391 … … 378 400 $last_dir = $file_name; 379 401 } 380 402 381 return $tree_list;403 return _wp_sort_file_tree( $tree_list ); 382 404 } 383 405 384 406 /** … … 483 505 $last_dir = $plugin_file; 484 506 } 485 507 486 return $tree_list;508 return _wp_sort_file_tree( $tree_list ); 487 509 } 488 510 489 511 /** … … 1080 1102 ); 1081 1103 } 1082 1104 1083 echo '<script >var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ";</script>\n";1105 echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ";</script>\n"; 1084 1106 } 1085 1107 1086 1108 /**