Ticket #17902: 17902-plugin-details-link-3.diff
File 17902-plugin-details-link-3.diff, 5.9 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/class-wp-plugin-install-list-table.php
13 13 return current_user_can('install_plugins'); 14 14 } 15 15 16 /** 17 * Return a list of slugs of installed plugins, if known. 18 */ 19 public function get_installed_plugin_stubs() { 20 $slugs = array(); 21 22 // Use the transient data from the updates API to determine the slugs of known installed plugins. 23 // This code might be better placed elsewhere, perhaps even within get_plugins(). 24 $plugin_info = get_site_transient('update_plugins'); 25 if ( isset( $plugin_info->no_update ) ) { 26 foreach ( $plugin_info->no_update as $plugin ) { 27 $slugs[] = $plugin->slug; 28 } 29 } 30 if ( isset( $plugin_info->response ) ) { 31 foreach ( $plugin_info->response as $plugin ) { 32 $slugs[] = $plugin->slug; 33 } 34 } 35 return $slugs; 36 } 37 16 38 public function prepare_items() { 17 39 include( ABSPATH . 'wp-admin/includes/plugin-install.php' ); 18 40 … … 62 84 if ( empty( $tab ) || ( !isset( $tabs[ $tab ] ) && !in_array( $tab, (array) $nonmenu_tabs ) ) ) 63 85 $tab = key( $tabs ); 64 86 65 $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => array( 'last_updated' => true, 'downloaded' => true ) ); 66 87 $args = array( 'page' => $paged, 'per_page' => $per_page, 88 'fields' => array( 'last_updated' => true, 'downloaded' => true ), 89 // Send the locale and installed plugin slugs to the API so it can provide context-sensitive results. 90 'locale' => get_locale(), 91 'installed_plugins' => $this->get_installed_plugin_stubs(), 92 ); 93 67 94 switch ( $tab ) { 68 95 case 'search': 69 96 $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; -
wp-admin/includes/class-wp-plugins-list-table.php
108 108 unset( $recently_activated[$key] ); 109 109 update_option( 'recently_activated', $recently_activated ); 110 110 } 111 112 $plugin_info = get_site_transient( 'update_plugins' ); 111 113 112 114 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 113 122 // Filter into individual sections 114 123 if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { 115 124 // On the non-network screen, filter out network-only plugins as long as they're not individually activated … … 344 353 $actions = array( 345 354 'deactivate' => '', 346 355 'activate' => '', 356 'details' => '', 347 357 'edit' => '', 348 358 'delete' => '', 349 359 ); … … 392 402 if ( ! is_multisite() && current_user_can('delete_plugins') ) 393 403 $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>'; 394 404 } // end if $is_active 405 395 406 } // end if $screen->in_admin( 'network' ) 396 407 408 // Extra data from the updates API, if available 409 if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && isset( $plugin_data['slug'] ) ) { 410 $actions['details'] = '<a href="' . self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . 411 '&TB_iframe=true&width=600&height=550' ) . '" class="thickbox" title="' . 412 esc_attr( sprintf( __( 'More information about %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Details' ) . '</a>'; 413 } 414 397 415 if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) 398 416 $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>'; 399 417 } // end if $context -
wp-includes/update.php
277 277 'plugins' => json_encode( $to_send ), 278 278 'translations' => json_encode( $translations ), 279 279 'locale' => json_encode( $locales ), 280 'all' => json_encode( true ), 280 281 ), 281 282 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) 282 283 ); … … 286 287 } 287 288 288 289 $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/'; 290 289 291 if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) 290 292 $url = set_url_scheme( $url, 'https' ); 291 293 … … 303 305 $plugin = (object) $plugin; 304 306 } 305 307 unset( $plugin ); 308 foreach ( $response['no_update'] as &$plugin ) { 309 $plugin = (object) $plugin; 310 } 311 unset( $plugin ); 306 312 307 313 if ( is_array( $response ) ) { 308 314 $new_option->response = $response['plugins']; 309 315 $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']; 310 318 } else { 311 319 $new_option->response = array(); 312 320 $new_option->translations = array(); 321 $new_option->no_update = array(); 313 322 } 314 323 315 324 set_site_transient( 'update_plugins', $new_option );