From e767bc7349f3dfcc17829592cd7b4a75b8697398 Mon Sep 17 00:00:00 2001 From: Alejandro Sosa Date: Wed, 27 Mar 2024 10:39:44 +0100 Subject: [PATCH] Release 1.1.4 --- README.md | 2 +- changelog.txt | 3 ++ docs/en/documentation.html | 5 +-- .../class-wc-wallee-subscription-admin.php | 4 ++- ...class-wc-wallee-subscription-migration.php | 31 +++++++++++++++++-- readme.txt | 6 ++-- woocommerce-wallee-subscription.php | 8 ++--- 7 files changed, 46 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9c21287..b542684 100644 --- a/README.md +++ b/README.md @@ -15,5 +15,5 @@ This repository contains the wallee Subscriptions addon that enables WooCommerce ## License -Please see the [license file](https://github.com/wallee-payment/woocommerce-subscription/blob/1.1.3/LICENSE) for more information. +Please see the [license file](https://github.com/wallee-payment/woocommerce-subscription/blob/1.1.4/LICENSE) for more information. diff --git a/changelog.txt b/changelog.txt index 129884d..5866826 100644 --- a/changelog.txt +++ b/changelog.txt @@ -77,3 +77,6 @@ Bug fix, if space_view_id is not set, it does not send it to the service portal. = 1.1.3 - December 6, 2023 = - [BugFix] Allow changing payment method for active subscriptions with latest woo-subscriptions += 1.1.4 - March 19, 2024 = +- [BugFix] Improved dependency detection: The plugin can now identify the base plugin even if the exact name varies slightly. + diff --git a/docs/en/documentation.html b/docs/en/documentation.html index 0ea0116..a6fad73 100644 --- a/docs/en/documentation.html +++ b/docs/en/documentation.html @@ -4,7 +4,8 @@ - + + Documentation @@ -22,7 +23,7 @@

Documentation

  • - + Source
  • diff --git a/includes/admin/class-wc-wallee-subscription-admin.php b/includes/admin/class-wc-wallee-subscription-admin.php index bcafc94..0c9ffe5 100644 --- a/includes/admin/class-wc-wallee-subscription-admin.php +++ b/includes/admin/class-wc-wallee-subscription-admin.php @@ -79,8 +79,10 @@ private function init_hooks() { * @return void */ public function handle_modules_active() { + // Gets the plugin's base full name. + $plugin_base_name = WC_Wallee_Subscription_Migration::get_base_plugin_name(); // Subscription plugin or base plugin not activated. - if ( ! is_plugin_active( 'woocommerce-subscriptions/woocommerce-subscriptions.php' ) || ! is_plugin_active( 'woo-wallee/woocommerce-wallee.php' ) ) { + if ( ! is_plugin_active( 'woocommerce-subscriptions/woocommerce-subscriptions.php' ) || ! is_plugin_active( $plugin_base_name ) ) { // Deactivate plugin. deactivate_plugins( WC_WALLEE_SUBSCRIPTION_PLUGIN_BASENAME ); add_action( diff --git a/includes/class-wc-wallee-subscription-migration.php b/includes/class-wc-wallee-subscription-migration.php index e855153..9549c4c 100644 --- a/includes/class-wc-wallee-subscription-migration.php +++ b/includes/class-wc-wallee-subscription-migration.php @@ -99,11 +99,14 @@ private static function check_requirements() { $errors = array(); - if ( ! is_plugin_active( 'woo-wallee/woocommerce-wallee.php' ) ) { + // Get the full name of the base plugin, which is a dependency. + $plugin_base_name = self::get_base_plugin_name(); + + if ( ! is_plugin_active( $plugin_base_name ) ) { /* translators: %s is replaced with "string" */ $errors[] = sprintf( __( 'wallee %s+ has to be active.', 'woo-wallee-subscription' ), WC_WALLEE_SUBSCRIPTION_REQUIRED_WALLEE_VERSION ); } else { - $base_module_data = get_plugin_data( WP_PLUGIN_DIR . '/woo-wallee/woocommerce-wallee.php', false, false ); + $base_module_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_base_name, false, false ); if ( version_compare( $base_module_data['Version'], WC_WALLEE_SUBSCRIPTION_REQUIRED_WALLEE_VERSION, '<' ) ) { /* translators: %s is replaced with "string" */ @@ -213,6 +216,30 @@ public static function check_version() { } } } + + /** + * Returns the full name of the base plugin, as installed in the system. + * This is needed because the full name can be different if installed from a zip file. + * + * @return string + */ + public static function get_base_plugin_name() { + static $base_name; + + if (!empty($base_name)) { + return $base_name; + } + + $plugins = array_keys(get_plugins()); + foreach ($plugins as $plugin) { + if (substr_count($plugin, 'woocommerce-wallee.php')) { + $base_name = $plugin; + break; + } + } + + return $base_name; + } } WC_Wallee_Subscription_Migration::init(); diff --git a/readme.txt b/readme.txt index de8558b..90eab5d 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: customwebgmbh Tags: woocommerce wallee, woocommerce, wallee, payment, e-commerce, webshop, psp, subscription, recurring payment, processing Requires at least: 4.7 Tested up to: 6.0.1 -Stable tag: 1.1.3 +Stable tag: 1.1.4 License: Apache 2 License URI: http://www.apache.org/licenses/LICENSE-2.0 @@ -49,5 +49,5 @@ Therefore, it is necessary that you install the this plugin as well. == Changelog == -= 1.1.3 - December 6, 2023 = -- [BugFix] Allow changing payment method for active subscriptions with latest woo-subscriptions += 1.1.4 - March 19, 2024 = +- [BugFix] Improved dependency detection: The plugin can now identify the base plugin even if the exact name varies slightly. diff --git a/woocommerce-wallee-subscription.php b/woocommerce-wallee-subscription.php index 2f9eeda..9b15a91 100644 --- a/woocommerce-wallee-subscription.php +++ b/woocommerce-wallee-subscription.php @@ -3,15 +3,15 @@ * Plugin Name: wallee Subscription * Plugin URI: https://wordpress.org/plugins/woo-wallee-subscription * Description: Addon to process WooCommerce Subscriptions with wallee - * Version: 1.1.3 + * Version: 1.1.4 * License: Apache2 * License URI: http://www.apache.org/licenses/LICENSE-2.0 * Author: wallee AG * Author URI: https://www.wallee.com * Requires at least: 4.7 - * Tested up to: 6.1 + * Tested up to: 6.4.2 * WC requires at least: 3.0.0 - * WC tested up to: 7.0.1 + * WC tested up to: 8.7.0 * * Text Domain: woo-wallee-subscription * Domain Path: /languages/ @@ -36,7 +36,7 @@ final class WooCommerce_Wallee_Subscription { * * @var string */ - private $version = '1.1.3'; + private $version = '1.1.4'; /** * The single instance of the class.