WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/22/2009 08:05:11 PM (9 years ago)
Author:
ryan
Message:

Allow editing all of a plugin's files. see #6732

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/plugin-editor.php

    r10614 r10627  
    1313$parent_file = 'plugins.php';
    1414
    15 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
     15wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'plugin'));
    1616
    1717wp_admin_css( 'theme-editor' );
    1818
    1919$plugins = get_plugins();
    20 $plugin_files = array_keys($plugins);
     20
     21if ( empty($plugin) ) {
     22    $plugin = array_keys($plugins);
     23    $plugin = $plugin[0];
     24}
     25
     26$plugin_files = get_plugin_files($plugin);
    2127
    2228if (empty($file))
     
    116122<?php screen_icon(); ?>
    117123<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>
    119141<div class="tablenav">
    120142<div class="alignleft">
    121143<big><?php
    122     if ( is_plugin_active($file) ) {
     144    if ( is_plugin_active($plugin) ) {
    123145        if ( is_writeable($real_file) )
    124146            echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
     
    139161    <h3 id="bordertitle"><?php _e('Plugin Files'); ?></h3>
    140162
    141     <h4><?php _e('Plugins'); ?></h4>
    142163    <ul>
    143164<?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>
    145166<?php endforeach; ?>
    146167    </ul>
     
    152173        <input type="hidden" name="action" value="update" />
    153174        <input type="hidden" name="file" value="<?php echo $file ?>" />
     175        <input type="hidden" name="plugin" value="<?php echo $plugin ?>" />
    154176        </div>
    155177        <?php if ( count( $functions ) ) : ?>
Note: See TracChangeset for help on using the changeset viewer.