Make WordPress Core

Ticket #58370: 58370.diff

File 58370.diff, 1.6 KB (added by nihar007, 20 months ago)
  • src/wp-admin/includes/plugin-install.php

    diff --git a/src/wp-admin/includes/plugin-install.php b/src/wp-admin/includes/plugin-install.php
    index 7d2c0fde71..5c85804b18 100644
    a b function install_plugin_information() { 
    899899                                echo '<a class="button button-primary right disabled">' . __( 'Latest Version Installed' ) . '</a>';
    900900                                break;
    901901                }
     902
     903                $installed_plugin = get_plugins( '/' . $api->slug );
     904        $key = array_keys( $installed_plugin );
     905        // Use the first plugin regardless of the name.
     906        // Could have issues for multiple plugins in one directory if they share different version numbers.
     907        $key = reset( $key );
     908
     909        $plugin_file = $api->slug . '/' . $key;
     910
     911        if ( is_network_admin() ) {
     912            $is_active  = is_plugin_active_for_network( $plugin_file );
     913        } else {
     914            $is_active  = is_plugin_active( $plugin_file );
     915        }
     916
     917        if ( !$is_active ) {
     918            echo sprintf(
     919                '<a href="%s" id="activate-%s" style="margin-right: 6px" class="button button-primary right" aria-label="%s" target="_parent">%s</a>',
     920                wp_nonce_url('plugins.php?action=activate&amp;plugin=' . urlencode($plugin_file) . '&amp;plugin_status=' . $status['status'] . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file),
     921                esc_attr($api->slug),
     922                /* translators: %s: Plugin name. */
     923                esc_attr(sprintf(_x('Activate %s', 'plugin'), $api->name)),
     924                __('Activate')
     925            );
     926        }
    902927        }
    903928        echo "</div>\n";
    904929