Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r15132 r17183  
    1010require_once('./admin.php');
    1111
     12if ( is_multisite() && ! is_network_admin() ) {
     13    wp_redirect( network_admin_url( 'plugin-editor.php' ) );
     14    exit();
     15}
     16
    1217if ( !current_user_can('edit_plugins') )
    1318    wp_die( __('You do not have sufficient permissions to edit plugins for this site.') );
     
    6873            exit;
    6974        }
    70         wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto");
    71     } else {
    72         wp_redirect("plugin-editor.php?file=$file&scrollto=$scrollto");
     75        wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
     76    } else {
     77        wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") );
    7378    }
    7479    exit;
     
    8590            wp_die( $error );
    8691
    87         if ( ! is_plugin_active($file) )
     92        if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) )
    8893            activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
    8994
    90         wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto");
     95        wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
    9196        exit;
    9297    }
     
    112117        '<p>' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don&#8217;t forget to save your changes (Update File) when you&#8217;re finished.') . '</p>' .
    113118        '<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Lookup takes you to a web page about that particular function.') . '</p>' .
    114         '<p>' . __('If you want to make changes but don&#8217;t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit a plugin or start from scratch, check out the links below.') . '</p>' .
     119        '<p>' . __('If you want to make changes but don&#8217;t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '</p>' .
     120        ( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' ) .
    115121        '<p><strong>' . __('For more information:') . '</strong></p>' .
    116122        '<p>' . __('<a href="http://codex.wordpress.org/Plugins_Editor_SubPanel" target="_blank">Documentation on Editing Plugins</a>') . '</p>' .
     123        '<p>' . __('<a href="http://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>') . '</p>' .
    117124        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    118125    );
    119126
    120     require_once('./admin-header.php');
     127    require_once(ABSPATH . 'wp-admin/admin-header.php');
    121128
    122129    update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
     
    137144    }
    138145
    139     $content = htmlspecialchars( $content );
     146    $content = esc_textarea( $content );
    140147    ?>
    141148<?php if (isset($_GET['a'])) : ?>
     
    186193?>
    187194        </select>
    188         <input type="submit" name="Submit" value="<?php esc_attr_e('Select') ?>" class="button" />
     195        <?php submit_button( __( 'Select' ), 'button', 'Submit', false ); ?>
    189196    </form>
    190197</div>
     
    230237    <p class="submit">
    231238    <?php
    232         if ( isset($_GET['phperror']) )
    233             echo "<input type='hidden' name='phperror' value='1' /><input type='submit' name='submit' class='button-primary' value='" . esc_attr__('Update File and Attempt to Reactivate') . "' tabindex='2' />";
    234         else
    235             echo "<input type='submit' name='submit' class='button-primary' value='" . esc_attr__('Update File') . "' tabindex='2' />";
     239        if ( isset($_GET['phperror']) ) {
     240            echo "<input type='hidden' name='phperror' value='1' />";
     241            submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false, array( 'tabindex' => '2' ) );
     242        } else {
     243            submit_button( __( 'Update File' ), 'primary', 'submit', false, array( 'tabindex' => '2' ) );
     244        }
    236245    ?>
    237246    </p>
     
    253262    break;
    254263}
    255 include("./admin-footer.php");
     264include(ABSPATH . "wp-admin/admin-footer.php");
Note: See TracChangeset for help on using the changeset viewer.