From 39e49f0cfc925437d6f057537971715c83a738f5 Mon Sep 17 00:00:00 2001 From: Thomas Griffin Date: Mon, 23 Apr 2012 13:27:44 -0400 Subject: [PATCH] updated to v2.3.6 to fix API error when installing a single plugin from an externally hosted source --- README | 8 ++++++-- .../class-tgm-plugin-activation.php | 18 ++++++++++-------- tgm-plugin-activation/example.php | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README b/README index 0be7af7e..1ab47007 100644 --- a/README +++ b/README @@ -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 == @@ -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) diff --git a/tgm-plugin-activation/class-tgm-plugin-activation.php b/tgm-plugin-activation/class-tgm-plugin-activation.php index 0fd2d5cc..f75d2f3a 100755 --- a/tgm-plugin-activation/class-tgm-plugin-activation.php +++ b/tgm-plugin-activation/class-tgm-plugin-activation.php @@ -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 * @author Gary Jones * @copyright Copyright (c) 2012, Thomas Griffin @@ -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'; diff --git a/tgm-plugin-activation/example.php b/tgm-plugin-activation/example.php index 47491a1e..2214f197 100755 --- a/tgm-plugin-activation/example.php +++ b/tgm-plugin-activation/example.php @@ -8,7 +8,7 @@ * * @package TGM-Plugin-Activation * @subpackage Example - * @version 2.3.5 + * @version 2.3.6 * @author Thomas Griffin * @author Gary Jones * @copyright Copyright (c) 2012, Thomas Griffin