Changeset 10627
- Timestamp:
- 02/22/2009 08:05:11 PM (15 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/plugin.php
r10594 r10627 99 99 if ( $markup || $translate ) 100 100 $plugin_data = _get_plugin_data_markup_translate($plugin_data, $markup, $translate); 101 101 102 return $plugin_data; 102 103 } … … 139 140 140 141 return $plugin_data; 142 } 143 144 /** 145 * Get a list of a plugin's files. 146 * 147 * @since 2.8.0 148 * 149 * @param string $plugin Plugin ID 150 * @return array List of files relative to the plugin root. 151 */ 152 function get_plugin_files($plugin) { 153 $plugin_file = WP_PLUGIN_DIR . '/' . $plugin; 154 $dir = dirname($plugin_file); 155 $plugin_files = array($plugin); 156 if ( is_dir($dir) && $dir != WP_PLUGIN_DIR ) { 157 $plugins_dir = @ opendir( $dir ); 158 if ( $plugins_dir ) { 159 while (($file = readdir( $plugins_dir ) ) !== false ) { 160 if ( substr($file, 0, 1) == '.' ) 161 continue; 162 if ( is_dir( $dir . '/' . $file ) ) { 163 $plugins_subdir = @ opendir( $dir . '/' . $file ); 164 if ( $plugins_subdir ) { 165 while (($subfile = readdir( $plugins_subdir ) ) !== false ) { 166 if ( substr($subfile, 0, 1) == '.' ) 167 continue; 168 $plugin_files[] = plugin_basename("$dir/$file/$subfile"); 169 } 170 @closedir( $plugins_subdir ); 171 } 172 } else { 173 if ( plugin_basename("$dir/$file") != $plugin ) 174 $plugin_files[] = plugin_basename("$dir/$file"); 175 } 176 } 177 @closedir( $plugins_dir ); 178 } 179 } 180 181 return $plugin_files; 141 182 } 142 183 -
trunk/wp-admin/plugin-editor.php
r10614 r10627 13 13 $parent_file = 'plugins.php'; 14 14 15 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file' ));15 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'plugin')); 16 16 17 17 wp_admin_css( 'theme-editor' ); 18 18 19 19 $plugins = get_plugins(); 20 $plugin_files = array_keys($plugins); 20 21 if ( empty($plugin) ) { 22 $plugin = array_keys($plugins); 23 $plugin = $plugin[0]; 24 } 25 26 $plugin_files = get_plugin_files($plugin); 21 27 22 28 if (empty($file)) … … 116 122 <?php screen_icon(); ?> 117 123 <h2><?php echo wp_specialchars( $title ); ?></h2> 118 124 <div class="bordertitle"> 125 <form id="themeselector" action="plugin-editor.php" method="post"> 126 <strong><label for="theme"><?php _e('Select plugin to edit:'); ?> </label></strong> 127 <select name="plugin" id="plugin"> 128 <?php 129 foreach ($plugins as $plugin_key => $a_plugin) { 130 $plugin_name = $a_plugin['Name']; 131 if ($plugin_key == $plugin) $selected = " selected='selected'"; 132 else $selected = ''; 133 $plugin_name = attribute_escape($plugin_name); 134 echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>"; 135 } 136 ?> 137 </select> 138 <input type="submit" name="Submit" value="<?php _e('Select') ?>" class="button" /> 139 </form> 140 </div> 119 141 <div class="tablenav"> 120 142 <div class="alignleft"> 121 143 <big><?php 122 if ( is_plugin_active($ file) ) {144 if ( is_plugin_active($plugin) ) { 123 145 if ( is_writeable($real_file) ) 124 146 echo sprintf(__('Editing <strong>%s</strong> (active)'), $file); … … 139 161 <h3 id="bordertitle"><?php _e('Plugin Files'); ?></h3> 140 162 141 <h4><?php _e('Plugins'); ?></h4>142 163 <ul> 143 164 <?php foreach($plugin_files as $plugin_file) : ?> 144 <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo $plugin_file; ?> "><?php echo $plugins[$plugin_file]['Name'];?></a></li>165 <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo $plugin_file; ?>&plugin=<?php echo $plugin; ?>"><?php echo $plugin_file ?></a></li> 145 166 <?php endforeach; ?> 146 167 </ul> … … 152 173 <input type="hidden" name="action" value="update" /> 153 174 <input type="hidden" name="file" value="<?php echo $file ?>" /> 175 <input type="hidden" name="plugin" value="<?php echo $plugin ?>" /> 154 176 </div> 155 177 <?php if ( count( $functions ) ) : ?>
Note: See TracChangeset
for help on using the changeset viewer.