WordPress.org

Make WordPress Core

Ticket #45056: plugins-active.patch

File plugins-active.patch, 1.4 KB (added by codente, 2 years ago)
  • wp-admin/plugin-editor.php

    diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php
    index ccdd832e86..402965e50c 100644
    a b if ( ! is_file( $real_file ) ) { 
    218218                <strong><label for="plugin"><?php _e( 'Select plugin to edit:' ); ?> </label></strong>
    219219                <select name="plugin" id="plugin">
    220220<?php
     221$p_active = '';
     222$p_notactive = '';
    221223foreach ( $plugins as $plugin_key => $a_plugin ) {
    222224        $plugin_name = $a_plugin['Name'];
     225        $active_p = is_plugin_active( $plugin_key );
    223226        if ( $plugin_key == $plugin ) {
    224227                $selected = " selected='selected'";
    225228        } else {
    foreach ( $plugins as $plugin_key => $a_plugin ) { 
    227230        }
    228231        $plugin_name = esc_attr( $plugin_name );
    229232        $plugin_key  = esc_attr( $plugin_key );
    230         echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>";
     233        if ( $active_p ) {
     234                $p_active .= "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>";
     235        } else {
     236                $p_notactive .= "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>";
     237        }
    231238}
     239echo $p_active ? sprintf( "\n\t<option disabled value=\"active-plugins\">%s</option>", __( 'Active' ) ) . $p_active : '';
     240echo $p_notactive ? sprintf( "\n\t<option disabled value=\"not-active-plugins\">%s</option>", __( 'Not Active' ) ) . $p_notactive : '';
    232241?>
    233242                </select>
    234243                <?php submit_button( __( 'Select' ), '', 'Submit', false ); ?>