Changeset 1894
- Timestamp:
- 11/28/2004 12:33:04 AM (20 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r1887 r1894 733 733 } 734 734 735 function plugin_basename($file) { 736 return preg_replace('#^.*wp-content/plugins/#', '', $file); 737 } 738 735 739 function add_menu_page($page_title, $menu_title, $access_level, $file) { 736 740 global $menu; 737 741 738 $file = basename($file);742 $file = plugin_basename($file); 739 743 740 744 $menu[] = array($menu_title, $access_level, $file, $page_title); … … 744 748 global $submenu; 745 749 746 $file = basename($file);750 $file = plugin_basename($file); 747 751 748 752 $submenu[$parent][] = array($menu_title, $access_level, $file, $page_title); … … 885 889 if ($plugins_dir) { 886 890 while(($file = $plugins_dir->read()) !== false) { 887 if ( !preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file) ) 888 $plugin_files[] = $file; 891 if ( preg_match('|^\.+$|', $file) ) 892 continue; 893 if (is_dir($plugin_root . '/' . $file)) { 894 $plugins_subdir = @ dir($plugin_root . '/' . $file); 895 if ($plugins_subdir) { 896 while(($subfile = $plugins_subdir->read()) !== false) { 897 if ( preg_match('|^\.+$|', $subfile) ) 898 continue; 899 if ( preg_match('|\.php$|', $subfile) ) 900 $plugin_files[] = "$file/$subfile"; 901 } 902 } 903 } else { 904 if ( preg_match('|\.php$|', $file) ) 905 $plugin_files[] = $file; 906 } 889 907 } 890 908 } … … 903 921 } 904 922 905 $wp_plugins[ basename($plugin_file)] = $plugin_data;923 $wp_plugins[plugin_basename($plugin_file)] = $plugin_data; 906 924 } 907 925 -
trunk/wp-admin/admin.php
r1818 r1894 55 55 // Handle plugin admin pages. 56 56 if (isset($_GET['page'])) { 57 $plugin_page = basename($_GET['page']);57 $plugin_page = plugin_basename($_GET['page']); 58 58 if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page")) { 59 59 die(sprintf(__('Cannot load %s.'), $plugin_page)); -
trunk/wp-admin/plugin-editor.php
r1858 r1894 21 21 } 22 22 23 $plugins_dir = @ dir(ABSPATH . 'wp-content/plugins'); 24 if ($plugins_dir) { 25 while(($plug_file = $plugins_dir->read()) !== false) { 26 if ( !preg_match('|^\.+$|', $plug_file) && preg_match('|\.php$|', $plug_file) ) 27 $plugin_files[] = "wp-content/plugins/$plug_file"; 28 } 29 } 30 31 if (count($plugin_files)) { 32 natcasesort($plugin_files); 33 } 34 35 if (file_exists(ABSPATH . 'my-hacks.php')) { 36 $plugin_files[] = 'my-hacks.php'; 37 } 38 23 $plugins = get_plugins(); 24 $plugin_files = array_keys($plugins); 39 25 40 26 if (empty($file)) { … … 43 29 44 30 $file = validate_file_to_edit($file, $plugin_files); 45 $real_file = get_real_file_to_edit( $file);31 $real_file = get_real_file_to_edit("wp-content/plugins/$file"); 46 32 47 33 switch($action) { … … 105 91 <ul> 106 92 <?php foreach($plugin_files as $plugin_file) : ?> 107 <li><a href="plugin-editor.php?file=<?php echo "$plugin_file"; ?>"><?php echo get_file_description(basename($plugin_file)); ?></a></li>93 <li><a href="plugin-editor.php?file=<?php echo "$plugin_file"; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li> 108 94 <?php endforeach; ?> 109 95 </ul>
Note: See TracChangeset
for help on using the changeset viewer.