Make WordPress Core


Ignore:
Timestamp:
07/18/2014 08:48:28 PM (11 years ago)
Author:
nacin
Message:

Add 'Details' links to installed plugins.

Installed plugins that are up to date are now returned in the update-check API response.

props tellyworth.
see #17902.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r29206 r29226  
    109109            update_option( 'recently_activated', $recently_activated );
    110110        }
     111       
     112        $plugin_info = get_site_transient( 'update_plugins' );
    111113
    112114        foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
     115            // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide.
     116            if ( isset( $plugin_info->response[ $plugin_file ] ) ) {
     117                $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data );
     118            } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) {
     119                $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data );
     120            }
     121
    113122            // Filter into individual sections
    114123            if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) {
     
    345354            'deactivate' => '',
    346355            'activate' => '',
     356            'details' => '',
    347357            'edit' => '',
    348358            'delete' => '',
     
    393403                        $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
    394404                } // end if $is_active
     405               
    395406             } // end if $screen->in_admin( 'network' )
     407
     408            // Details link using API info, if available
     409            if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && isset( $plugin_data['slug'] ) ) {
     410                $actions['details'] = sprintf( '<a href="%s" class="thickbox" title="%s">%s</a>',
     411                    esc_url( self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] .
     412                        '&TB_iframe=true&width=600&height=550' ) ),
     413                    esc_attr( sprintf( __( 'More information about %s' ), $plugin_data['Name'] ) ),
     414                    __( 'Details' ) );
     415            }
    396416
    397417            if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
Note: See TracChangeset for help on using the changeset viewer.