Skip to content

Commit

Permalink
updated to v2.3.6 to fix API error when installing a single plugin fr…
Browse files Browse the repository at this point in the history
…om an externally hosted source
  • Loading branch information
thomasgriffin committed Apr 23, 2012
1 parent 67ef217 commit 39e49f0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 6 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
=== TGM Plugin Activation ===
Contributors: Thomas Griffin (@jthomasgriffin / thomasgriffinmedia.com)
Gary Jones (Github: @GaryJones / Twitter: GaryJ)
Version: 2.3.5
Version: 2.3.6
Requires at least: 3.0.0
Tested up to: 3.3.1
Tested up to: 3.4-beta3

== Description ==

Expand Down Expand Up @@ -35,6 +35,10 @@ You can also follow project progress and updates on Twitter. Follow us here at h

== Changelog ==

= 2.3.6 =

* Fixed API error when clicking on the plugin install row action link for an externally hosted plugin

= 2.3.5 =

* Fixed nag message not working when nag_type string was not set (props @jeffsebring)
Expand Down
18 changes: 10 additions & 8 deletions tgm-plugin-activation/class-tgm-plugin-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin installation and activation for WordPress themes.
*
* @package TGM-Plugin-Activation
* @version 2.3.5
* @version 2.3.6
* @author Thomas Griffin <thomas@thomasgriffinmedia.com>
* @author Gary Jones <gamajo@gamajo.com>
* @copyright Copyright (c) 2012, Thomas Griffin
Expand Down Expand Up @@ -445,14 +445,16 @@ protected function do_plugin_install() {
require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; // Need for plugins_api
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; // Need for upgrade classes

$api = plugins_api( 'plugin_information', array( 'slug' => $plugin['slug'], 'fields' => array( 'sections' => false ) ) );

if ( is_wp_error( $api ) )
wp_die( $this->strings['oops'] . var_dump( $api ) );

/** Set plugin source to WordPress API link if available */
if ( isset( $plugin['source'] ) && 'repo' == $plugin['source'] && isset( $api->download_link ) )
$plugin['source'] = $api->download_link;
if ( isset( $plugin['source'] ) && 'repo' == $plugin['source'] ) {
$api = plugins_api( 'plugin_information', array( 'slug' => $plugin['slug'], 'fields' => array( 'sections' => false ) ) );

if ( is_wp_error( $api ) )
wp_die( $this->strings['oops'] . var_dump( $api ) );

if ( isset( $api->download_link ) )
$plugin['source'] = $api->download_link;
}

/** Set type, based on whether the source starts with http:// or https:// */
$type = preg_match( '|^http(s)?://|', $plugin['source'] ) ? 'web' : 'upload';
Expand Down
2 changes: 1 addition & 1 deletion tgm-plugin-activation/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @package TGM-Plugin-Activation
* @subpackage Example
* @version 2.3.5
* @version 2.3.6
* @author Thomas Griffin <thomas@thomasgriffinmedia.com>
* @author Gary Jones <gamajo@gamajo.com>
* @copyright Copyright (c) 2012, Thomas Griffin
Expand Down

0 comments on commit 39e49f0

Please sign in to comment.