diff --git a/Makefile b/Makefile index ad5480626f766ceceb680f0c47d8e4d859077ea1..7922f1a93b8516419132511af8f9cee64a0ba983 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ BASE=shipping-by-rules PLATTFORM=woocommerce VENDOR=opentools -VERSION=1.2 +VERSION=1.2.1 DIR = $(shell pwd) SVNDIR=wordpress-plugin-svn diff --git a/library/rules_shipping_framework.php b/library/rules_shipping_framework.php index aa0ebb44b0099adac392463662dc6f25537e865e..73e9b6e49c110dd04d36a6f5158845208de7d40c 100644 --- a/library/rules_shipping_framework.php +++ b/library/rules_shipping_framework.php @@ -51,7 +51,7 @@ function is_equal($a, $b) { class RulesShippingFramework { static $_version = "0.1"; - protected $_callbacks = array(); + protected $callbacks = array(); // Store the parsed and possibly evaluated rules for each method (method ID is used as key) protected $rules = array(); protected $match = array(); @@ -294,7 +294,7 @@ class RulesShippingFramework { /** * Extract information about non-numerical zip codes (UK and Canada) from the postal code */ - protected function getAddressZIP ($zip) { + public function getAddressZIP ($zip) { $values = array(); // Postal code Check for UK postal codes: Use regexp to determine if ZIP structure matches and also to extract the parts. @@ -334,11 +334,14 @@ class RulesShippingFramework { /** Allow child classes to add additional variables for the rules or modify existing one */ protected function addCustomCartValues ($cart, $products, $method, &$values) { + // Pass all args through to the callback, if it exists if (isset($this->callbacks['addCustomCartValues'])) { - return $this->callbacks['addCustomCartValues']($cart, $products, $method, $values); + return call_user_func_array($this->callbacks['addCustomCartValues'], array($cart, $products, $method, &$values)/*func_get_args()*/); } + return $values; } protected function addPluginCartValues($cart, $products, $method, &$values) { + return $values; } public function getCartValues ($cart, $products, $method) { @@ -535,7 +538,8 @@ class RulesShippingFramework { protected function createMethodRule ($r, $countries, $ruleinfo) { if (isset($this->callbacks['initRule'])) { - return $this->callbacks['initRule']($this, $r, $countries, $ruleinfo); + return call_user_func_array($this->callbacks['initRule'], + array($this, $r, $countries, $ruleinfo)); } else { return new ShippingRule($this, $r, $countries, $ruleinfo); } @@ -554,7 +558,7 @@ class RulesShippingFramework { $rules1 = preg_split("/(\r\n|\n|\r)/", $rulestring); foreach ($rules1 as $r) { // Ignore empty lines - if (empty($r)) continue; + if (empty($r) || trim($r)=='') continue; $result[] = $this->createMethodRule ($r, $countries, $ruleinfo); } return $result; diff --git a/readme-adv.txt b/readme-adv.txt index 9b9e80d1eba65affd7e3c3de101cb1354c0a8cf9..97134fe04bcbab6a09f8128a9b905c7c91796b5f 100644 --- a/readme-adv.txt +++ b/readme-adv.txt @@ -3,7 +3,7 @@ Contributors: opentools Tags: WooCommerce, Shipment, Shipping Requires at least: 4.0 Tested up to: 4.4.1 -Stable tag: 1.1 +Stable tag: 1.2.1 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl.html diff --git a/readme.txt b/readme.txt index 8fe8bdddbdc0779d7deee8c07958c606f58b008c..993407f67408fe520eebb425fc1e35a629cc6540 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: opentools Tags: WooCommerce, Shipment, Shipping, Rules shipping Requires at least: 4.0 Tested up to: 4.4.2 -Stable tag: 1.2 +Stable tag: 1.2.1 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl.html @@ -69,6 +69,9 @@ Please see our support forum at http://open-tools.net/forum/. It might also be a == Changelog == += 1.2.1 = +* Fix for warning when a rule contained only spaces + = 1.2 = * Add support for "WC Vendors" and for "WooThemes Product Vendors" (new variable "Vendors", new function "evaluate_for_vendors") diff --git a/releases/opentools-woocommerce-advanced-shipping-by-rules_v1.2.1.zip b/releases/opentools-woocommerce-advanced-shipping-by-rules_v1.2.1.zip new file mode 100644 index 0000000000000000000000000000000000000000..6befca91929e85a21590e90cc1724806caf68fbe Binary files /dev/null and b/releases/opentools-woocommerce-advanced-shipping-by-rules_v1.2.1.zip differ diff --git a/releases/opentools-woocommerce-shipping-by-rules_v1.2.1.zip b/releases/opentools-woocommerce-shipping-by-rules_v1.2.1.zip new file mode 100644 index 0000000000000000000000000000000000000000..ed51c7184debbdd5af5447b6cddfa25b3a5e93ef Binary files /dev/null and b/releases/opentools-woocommerce-shipping-by-rules_v1.2.1.zip differ diff --git a/woocommerce-advanced-shipping-by-rules.php b/woocommerce-advanced-shipping-by-rules.php index db19ad1eb39ba352daf5c21bdda3ce84b680855c..114608749817bc1dd92c744c17186179a3d25d24 100644 --- a/woocommerce-advanced-shipping-by-rules.php +++ b/woocommerce-advanced-shipping-by-rules.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce Advanced Shipping By Rules * Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html * Description: Define Shipping cost by very general and flexible (text-based) rules. The advanced version also provides mathematical expressions and functions - * Version: 1.2 + * Version: 1.2.1 * Author: Open Tools, Reinhold Kainhofer * Author URI: http://open-tools.net * Text Domain: woocommerce-advanced-shipping-by-rules @@ -75,7 +75,7 @@ class WooCommerce_Shipping_By_Rules_Advanced { * @since 1.0.0 * @var string $version Plugin version number. */ - public $version = '1.2'; + public $version = '1.2.1'; /** diff --git a/woocommerce-shipping-by-rules.php b/woocommerce-shipping-by-rules.php index 84787834976c6065558ea4d0922b6228ccb2e26d..2fc6da686d68cd732423817e60a4cc32466a200d 100644 --- a/woocommerce-shipping-by-rules.php +++ b/woocommerce-shipping-by-rules.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce Shipping By Rules * Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html * Description: Define Shipping cost by very general and flexible (text-based) rules. - * Version: 1.2 + * Version: 1.2.1 * Author: Open Tools, Reinhold Kainhofer * Author URI: http://open-tools.net * Text Domain: woocommerce-shipping-by-rules @@ -48,7 +48,7 @@ class WooCommerce_Shipping_By_Rules { * @since 1.0.0 * @var string $version Plugin version number. */ - public $version = '1.2'; + public $version = '1.2.1'; /**