Opened 13 years ago
Closed 13 years ago
#22634 closed defect (bug) (duplicate)
Plugin Editor ignores &plugin= variable
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | minor | Version: | 3.4.2 |
| Component: | Plugins | Keywords: | |
| Focuses: | Cc: |
Description
When a plugin is chosen and subsequently a file belonging to that plugin, a link is followed with the ?file=xx/zz&plugin=xx variables.
The plugin has the following code:
if ( isset($_REQUEST['file']) )
$plugin = stripslashes($_REQUEST['file']);
if ( empty($plugin) ) {
$plugin = array_keys($plugins);
$plugin = $plugin[0];
}
$plugin_files = get_plugin_files($plugin);
if ( empty($file) )
$file = $plugin_files[0];
else
$file = stripslashes($file);
The result is :
- The plugin select box is reset to the first plugin
- The '(active)'/'(inactive)' text does not correspond to the chosen plugin any more.
I think the code should be changed into the following:
if ( isset($_REQUEST['plugin']) )
$plugin = stripslashes($_REQUEST['plugin']);
if ( isset($_REQUEST['file']) )
$file = stripslashes($_REQUEST['file']);
if ( empty($plugin) || !in_array($plugin, array_keys($plugins)) ) {
$plugin = array_keys($plugins);
$plugin = $plugin[0];
$file = "";
}
$plugin_files = get_plugin_files($plugin);
if ( empty($file) || !in_array($file, $plugin_files) )
$file = $plugin_files[0];
I'd attach a diff, if I'd only know how to create one :-)
Change History (5)
#3
@
13 years ago
Yes, you're right. The plugin editor should be changed so $plugin points to the plugin (or main plugin file), and $file to the file within the plugin. The class class-wp-plugins-list-table should still also be changed ('?plugin=') to reflect the change in the editor.
Note: See
TracTickets for help on using
tickets.
In addition, in
wp-admin/includes/class-wp-plugins-list-table, line 374, the parameter
should be changed to