Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r4881 r4495  
    3131        fwrite($f, $newcontent);
    3232        fclose($f);
    33 
    34         // Deactivate so we can test it.
    35         $current = get_option('active_plugins');
    36         if ( in_array($file, $current) || isset($_POST['phperror']) ) {
    37             if ( in_array($file, $current) ) {
    38                 array_splice($current, array_search( $file, $current), 1 ); // Array-fu!
    39                 update_option('active_plugins', $current);
    40             }
    41             wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1"));
    42             exit();
    43         }
    4433        wp_redirect("plugin-editor.php?file=$file&a=te");
    4534    } else {
     
    5544    if ( !current_user_can('edit_plugins') )
    5645        wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');
    57 
    58     if ( $_GET['liveupdate'] ) {
    59         check_admin_referer('edit-plugin-test_' . $file);
    60         $current = get_option('active_plugins');
    61         $plugin = $file;
    62         if ( validate_file($plugin) )
    63             wp_die(__('Invalid plugin.'));
    64         if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
    65             wp_die(__('Plugin file does not exist.'));
    66         if (!in_array($plugin, $current)) {
    67             wp_redirect("plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error
    68             @include(ABSPATH . PLUGINDIR . '/' . $plugin);
    69             $current[] = $plugin;
    70             sort($current);
    71             update_option('active_plugins', $current);
    72         }
    73         wp_redirect("plugin-editor.php?file=$file&a=te");
    74     }
    7546
    7647    require_once('admin-header.php');
     
    9061<?php if (isset($_GET['a'])) : ?>
    9162 <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
    92 <?php elseif (isset($_GET['phperror'])) : ?>
    93  <div id="message" class="updated fade"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p></div>
    9463<?php endif; ?>
    9564 <div class="wrap">
    9665    <?php
    97     if ( in_array($file, (array) get_option('active_plugins')) ) {
    98         if (is_writeable($real_file)) {
    99             echo '<h2>' . sprintf(__('Editing <strong>%s</strong> (active)'), $file) . '</h2>';
    100         } else {
    101         echo '<h2>' . sprintf(__('Browsing <strong>%s</strong> (active)'), $file) . '</h2>';
    102         }
     66    if (is_writeable($real_file)) {
     67        echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
    10368    } else {
    104         if (is_writeable($real_file)) {
    105             echo '<h2>' . sprintf(__('Editing <strong>%s</strong> (inactive)'), $file) . '</h2>';
    106         } else {
    107         echo '<h2>' . sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file) . '</h2>';
    108         }
     69        echo '<h2>' . sprintf(__('Browsing <strong>%s</strong>'), $file) . '</h2>';
    10970    }
    11071    ?>
     
    13091        </div>
    13192<?php if ( is_writeable($real_file) ) : ?>
    132     <?php if ( in_array($file, (array) get_option('active_plugins')) ) { ?>
    133         <p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended.  If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
    134     <?php } ?>
    13593    <p class="submit">
    13694    <?php
    137         if ( isset($_GET['phperror']) )
    138             echo "<input type='hidden' name='phperror' value='1' /><input type='submit' name='submit' value='" . __('Update File and Attempt to Reactivate &raquo;') . "' tabindex='2' />";
    139         else
    140             echo "<input type='submit' name='submit' value='" . __('Update File &raquo;') . "' tabindex='2' />";
     95        echo "<input type='submit' name='submit' value='    " . __('Update File &raquo;') . "' tabindex='2' />";
    14196    ?>
    14297    </p>
Note: See TracChangeset for help on using the changeset viewer.