Commit b13d3e59 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V6.1.2: Fix issue with callbacks on PHP 5.3 (callbacks could only be strings...

V6.1.2: Fix issue with callbacks on PHP 5.3 (callbacks could only be strings when called as ->callback, so use call_user_func_array instead, which works on all PHP versions)
parent cb6d9d8e
......@@ -2,7 +2,7 @@ BASE=rules_shipping
BASE_ADV=rules_shipping_advanced
PLUGINTYPE=vmshipment
ZIPBASE=opentools_vm
VERSION=6.1.1
VERSION=6.1.2
PLUGINFILES=$(BASE).php $(BASE)_base.php $(BASE)_framework_joomla.php $(BASE).script.php $(BASE).xml index.html
PLUGINFILES_ADV=$(BASE_ADV).php $(BASE)_base.php $(BASE)_framework_joomla.php $(BASE_ADV).script.php $(BASE_ADV).xml index.html
......
......@@ -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();
......@@ -334,8 +334,9 @@ 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'], func_get_args());
}
}
protected function addPluginCartValues($cart, $products, $method, &$values) {
......@@ -535,7 +536,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);
}
......
......@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2013-2014, Reinhold Kainhofer</copyright>
<license>GPL v3+</license>
<version>6.1.1</version>
<version>6.1.2</version>
<description>OTSHIPMENT_RULES_DESC</description>
<files>
<filename plugin="rules_shipping">rules_shipping.php</filename>
......
......@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2013-2014, Reinhold Kainhofer</copyright>
<license>GPL v3+</license>
<version>6.1.1</version>
<version>6.1.2</version>
<description>OTSHIPMENT_RULES_ADV_DESC</description>
<files>
<filename plugin="rules_shipping_advanced">rules_shipping_advanced.php</filename>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment