WordPress.org

Make WordPress Core

Ticket #24122: #24122_fix_logic.diff

File #24122_fix_logic.diff, 1003 bytes (added by jayarjo, 7 years ago)
  • wp-admin/plugin-editor.php

    From 35c5d672685d57fd13c9ab9822baa1b699f100e2 Mon Sep 17 00:00:00 2001
    From: Davit Barbakadze <jayarjo@gmail.com>
    Date: Fri, 27 Jun 2014 15:03:55 +0400
    Subject: [PATCH] Straighten active plugin/file picking logic in
     plugin-editor.php.
    
    Address 24122.
    ---
     wp-admin/plugin-editor.php | 10 ++++------
     1 file changed, 4 insertions(+), 6 deletions(-)
    
    diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php
    index 1c24295..231be43 100644
    a b if ( empty( $plugins ) ) { 
    3636        exit;
    3737}
    3838
    39 if ( $file ) {
    40         $plugin = $file;
    41 } elseif ( empty( $plugin ) ) {
     39if ( empty( $plugin ) ) {
    4240        $plugin = array_keys($plugins);
    4341        $plugin = $plugin[0];
    4442}
    4543
    46 $plugin_files = get_plugin_files($plugin);
    47 
    4844if ( empty($file) )
    49         $file = $plugin_files[0];
     45        $file = $plugin;
     46
     47$plugin_files = get_plugin_files($file);
    5048
    5149$file = validate_file_to_edit($file, $plugin_files);
    5250$real_file = WP_PLUGIN_DIR . '/' . $file;