|
3 | 3 | * Plugin installation and activation for WordPress themes. |
4 | 4 | * |
5 | 5 | * @package TGM-Plugin-Activation |
6 | | - * @version 2.3.5 |
| 6 | + * @version 2.3.6 |
7 | 7 | * @author Thomas Griffin <thomas@thomasgriffinmedia.com> |
8 | 8 | * @author Gary Jones <gamajo@gamajo.com> |
9 | 9 | * @copyright Copyright (c) 2012, Thomas Griffin |
@@ -445,14 +445,16 @@ protected function do_plugin_install() { |
445 | 445 | require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; // Need for plugins_api |
446 | 446 | require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; // Need for upgrade classes |
447 | 447 |
|
448 | | - $api = plugins_api( 'plugin_information', array( 'slug' => $plugin['slug'], 'fields' => array( 'sections' => false ) ) ); |
449 | | - |
450 | | - if ( is_wp_error( $api ) ) |
451 | | - wp_die( $this->strings['oops'] . var_dump( $api ) ); |
452 | | - |
453 | 448 | /** Set plugin source to WordPress API link if available */ |
454 | | - if ( isset( $plugin['source'] ) && 'repo' == $plugin['source'] && isset( $api->download_link ) ) |
455 | | - $plugin['source'] = $api->download_link; |
| 449 | + if ( isset( $plugin['source'] ) && 'repo' == $plugin['source'] ) { |
| 450 | + $api = plugins_api( 'plugin_information', array( 'slug' => $plugin['slug'], 'fields' => array( 'sections' => false ) ) ); |
| 451 | + |
| 452 | + if ( is_wp_error( $api ) ) |
| 453 | + wp_die( $this->strings['oops'] . var_dump( $api ) ); |
| 454 | + |
| 455 | + if ( isset( $api->download_link ) ) |
| 456 | + $plugin['source'] = $api->download_link; |
| 457 | + } |
456 | 458 |
|
457 | 459 | /** Set type, based on whether the source starts with http:// or https:// */ |
458 | 460 | $type = preg_match( '|^http(s)?://|', $plugin['source'] ) ? 'web' : 'upload'; |
|
0 commit comments