Make WordPress Core

Ticket #17902: 17902-plugin-details-link.diff

File 17902-plugin-details-link.diff, 3.8 KB (added by tellyworth, 11 years ago)
  • wp-admin/includes/class-wp-plugins-list-table.php

     
    108108                                        unset( $recently_activated[$key] );
    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 ) ) {
    115124                                // On the non-network screen, filter out network-only plugins as long as they're not individually activated
     
    344353                $actions = array(
    345354                        'deactivate' => '',
    346355                        'activate' => '',
     356                        'details' => '',
    347357                        'edit' => '',
    348358                        'delete' => '',
    349359                );
     
    392402                                        if ( ! is_multisite() && current_user_can('delete_plugins') )
    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                               
     406                                // Extra data from the updates API, if available
     407                                if ( isset( $plugin_data['slug'] ) ) {
     408                                        $actions['details'] = '<a href="' . self_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin_data['slug'] .
     409                                                                '&amp;TB_iframe=true&amp;width=600&amp;height=550' ) . '" class="thickbox" title="' .
     410                                                                esc_attr( sprintf( __( 'More information about %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Details' ) . '</a>';
     411                                }
     412                               
    395413                         } // end if $screen->in_admin( 'network' )
    396414
    397415                        if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
  • wp-includes/update.php

     
    277277                        'plugins'      => json_encode( $to_send ),
    278278                        'translations' => json_encode( $translations ),
    279279                        'locale'       => json_encode( $locales ),
     280                        'all'          => json_encode( true ),
    280281                ),
    281282                'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
    282283        );
     
    286287        }
    287288
    288289        $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
     290
    289291        if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
    290292                $url = set_url_scheme( $url, 'https' );
    291293
     
    303305                $plugin = (object) $plugin;
    304306        }
    305307        unset( $plugin );
     308        foreach ( $response['no_update'] as &$plugin ) {
     309                $plugin = (object) $plugin;
     310        }
     311        unset( $plugin );
    306312
    307313        if ( is_array( $response ) ) {
    308314                $new_option->response = $response['plugins'];
    309315                $new_option->translations = $response['translations'];
     316                // TODO: Perhaps better to store no_update in a separate transient with an expiry?
     317                $new_option->no_update = $response['no_update'];
    310318        } else {
    311319                $new_option->response = array();
    312320                $new_option->translations = array();
     321                $new_option->no_update = array();
    313322        }
    314323
    315324        set_site_transient( 'update_plugins', $new_option );