+ if ( is_plugin_active( $status['file'] ) ) {
+ $action_links[] = '<button type="button" class="button button-disabled" disabled="disabled">' . _x( 'Active', 'plugin' ) . '</button>';
+ } elseif ( current_user_can( 'activate_plugins' ) ) {
+ $button_text = __( 'Activate' );
+ /* translators: %s: Plugin name */
+ $button_label = _x( 'Activate %s', 'plugin' );
+ $activate_url = add_query_arg( array(
+ '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
+ 'action' => 'activate',
+ 'plugin' => $status['file'],
+ ), network_admin_url( 'plugins.php' ) );
+
+ if ( is_network_admin() ) {
+ $button_text = __( 'Network Activate' );
+ /* translators: %s: Plugin name */
+ $button_label = _x( 'Network Activate %s', 'plugin' );
+ $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
+ }
+
+ $action_links[] = sprintf(
+ '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>',
+ esc_url( $activate_url ),
+ esc_attr( sprintf( $button_label, $plugin['name'] ) ),
+ $button_text
+ );
+ } else {
+ $action_links[] = '<button type="button" class="button button-disabled" disabled="disabled">' . _x( 'Installed', 'plugin' ) . '</button>';
+ }