Make WordPress Core

Ticket #31002: 31002.2.diff

File 31002.2.diff, 1.3 KB (added by jtsternberg, 9 years ago)
  • src/wp-admin/includes/class-wp-plugin-install-list-table.php

     
    467467                                                break;
    468468                                        case 'latest_installed':
    469469                                        case 'newer_installed':
    470                                                 $action_links[] = '<span class="button button-disabled">' . _x( 'Installed', 'plugin' ) . '</span>';
     470                                                $plugins = get_plugins( '/' . $plugin['slug'] );
     471                                                $plugin_file = '';
     472
     473                                                if ( ! empty( $plugins ) ) {
     474                                                        $plugin_file = $plugin['slug'] . '/' . key( $plugins );
     475                                                }
     476
     477                                                if ( $plugin_file && ! is_plugin_active( $plugin_file ) ) {
     478
     479                                                        $activate_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file );
     480                                                        $action_links[] = sprintf( '<a class="button" href="%s" title="%s" target="_parent">%s</a>', esc_url( $activate_url ), esc_attr__( 'Activate this plugin' ), _x( 'Activate', 'plugin' ) );
     481                                                } else {
     482                                                        $action_links[] = sprintf( '<span class="button button-disabled" title="%s">%s</span>', esc_attr__( 'This plugin is already installed and is up to date' ), _x( 'Installed', 'plugin' ) );
     483                                                }
    471484                                                break;
    472485                                }
    473486                        }