From ba078b4038eb90e81ad5bd908914e52fddd9c15f Mon Sep 17 00:00:00 2001 From: "Aaron J. St. Pierre" Date: Sun, 8 Jan 2017 17:45:02 +0000 Subject: [PATCH 1/7] Update to include new GFAPI class and remove deprecated class RGFormsModel --- gravity-forms-multi-currency.php | 6 +++--- readme.txt | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gravity-forms-multi-currency.php b/gravity-forms-multi-currency.php index 2b3e657..231379d 100644 --- a/gravity-forms-multi-currency.php +++ b/gravity-forms-multi-currency.php @@ -3,7 +3,7 @@ * Plugin Name: Gravity Forms Multi Currency * Plugin URI: https://github.com/ilanco/gravity-forms-multi-currency * Description: Per form currency for Gravity Forms. - * Version: 1.7.1 + * Version: 1.7.2 * Author: Ilan Cohen * Author URI: https://github.com/ilanco */ @@ -63,11 +63,11 @@ public function form_process() { $form_id = isset($_POST["gform_submit"]) ? $_POST["gform_submit"] : 0; if ($form_id) { - $form_info = RGFormsModel::get_form($form_id); + $form_info = GFAPI::get_form($form_id); $is_valid_form = $form_info && $form_info->is_active; if ($is_valid_form) { - $form = RGFormsModel::get_form_meta($form_id); + $form = GFAPI::get_form($form_id); if (isset($form['currency']) && $form['currency']) { $this->currency = $form['currency']; } diff --git a/readme.txt b/readme.txt index ebe949b..a542148 100644 --- a/readme.txt +++ b/readme.txt @@ -1,10 +1,11 @@ === Gravity Forms Multi Currency === -Contributors: ilanco +Contributors: ilanco, asp@p0v.net Donate link: https://www.gittip.com/ilanco/ Tags: gravity, forms, gravity forms, gravity form, currency, multiple Requires at least: 3.0.1 -Tested up to: 3.8.1 -Stable tag: 1.7.1 +Tested Wordpress Version to: 4.7 +Tested Gravity Forms Version to: 2.1.2 +Stable tag: 1.7.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -29,6 +30,10 @@ the value to the desired currency for this form. == Changelog == += 1.7.2 = + +Update calls to reference GFAPI instead of RGFormsModel (as it's deprecated). + = 1.7.1 = Fixed setting currency after upgrade to Gravity Forms 1.7.3 From 4c799435ad8eab23ed2e7b0906c5154fadf3b990 Mon Sep 17 00:00:00 2001 From: "Aaron J. St. Pierre" Date: Mon, 9 Jan 2017 13:48:52 +0000 Subject: [PATCH 2/7] Test changes using lastest vvv Add comments Add some basic debugging logic --- gravity-forms-multi-currency.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/gravity-forms-multi-currency.php b/gravity-forms-multi-currency.php index 231379d..ed7a1dd 100644 --- a/gravity-forms-multi-currency.php +++ b/gravity-forms-multi-currency.php @@ -16,7 +16,7 @@ if (!defined('ABSPATH')) die(false); -define('GF_MC_VERSION', '1.7.1'); +define('GF_MC_VERSION', '1.7.2'); define('GF_MC_MAINFILE', __FILE__); @@ -28,6 +28,8 @@ class GFMultiCurrency private $currency; + private $gf_mc_debug; + private function __construct() { if (!$this->is_gravityforms_supported()) { @@ -61,13 +63,27 @@ public static function init() public function form_process() { + // asp: setup way to dump the form_info; probably a better way to do this + $gf_mc_debug = 0; + $form_id = isset($_POST["gform_submit"]) ? $_POST["gform_submit"] : 0; + if ($form_id) { - $form_info = GFAPI::get_form($form_id); - $is_valid_form = $form_info && $form_info->is_active; + // asp: use new GFAPI class returns an array + $form_info = GFAPI::get_form( $form_id ); + + if ( $gf_mc_debug ) { + echo "form_id: $form_id
"; + echo 'is_active:' . $form_info['is_active'] . '
'; + echo '
' . var_export($form_info, true) . '
'; + } + + // asp: since the result is an array check for + // asp: is_active using array notation + $is_valid_form = $form_info && $form_info['is_active']; if ($is_valid_form) { - $form = GFAPI::get_form($form_id); + $form = GFAPI::get_form( $form_id ); if (isset($form['currency']) && $form['currency']) { $this->currency = $form['currency']; } From 477c1e717b5060060707f93645011bb0de85c863 Mon Sep 17 00:00:00 2001 From: "Aaron J. St. Pierre" Date: Mon, 9 Jan 2017 14:25:55 +0000 Subject: [PATCH 3/7] bump version in composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 27a5b03..8569265 100644 --- a/composer.json +++ b/composer.json @@ -2,5 +2,5 @@ "name" : "ilanco/gravity-forms-multi-currency", "description" : "Gravity Forms Multi Currency", "type" : "wordpress-plugin", - "version" : "1.7.1" + "version" : "1.7.2" } From ef82d76a55552d9740fa9179ef97d39d77b13796 Mon Sep 17 00:00:00 2001 From: "Aaron J. St. Pierre" Date: Mon, 9 Jan 2017 14:32:07 +0000 Subject: [PATCH 4/7] Change links to my fork for now --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8569265..4a18fd6 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name" : "ilanco/gravity-forms-multi-currency", + "name" : "aaronstpierre/gravity-forms-multi-currency", "description" : "Gravity Forms Multi Currency", "type" : "wordpress-plugin", "version" : "1.7.2" From 55de68fef20272bbdb245dc927389011c8fe098e Mon Sep 17 00:00:00 2001 From: "Aaron J. St. Pierre" Date: Mon, 9 Jan 2017 14:40:16 +0000 Subject: [PATCH 5/7] Add myself to list of authors --- gravity-forms-multi-currency.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gravity-forms-multi-currency.php b/gravity-forms-multi-currency.php index ed7a1dd..583cfca 100644 --- a/gravity-forms-multi-currency.php +++ b/gravity-forms-multi-currency.php @@ -1,11 +1,11 @@ - * Author URI: https://github.com/ilanco + * Author: Ilan Cohen , Aaron St. Pierre + * Author URI: https://github.com/ilanco, https://github.com/aaronstpierre */ if (defined('WP_DEBUG') && (WP_DEBUG == true)) { From bb895b9ac277fd19192f3734e4f2bda363f4b4bc Mon Sep 17 00:00:00 2001 From: "Aaron J. St. Pierre" Date: Mon, 9 Jan 2017 14:54:37 +0000 Subject: [PATCH 6/7] update author uri --- gravity-forms-multi-currency.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-forms-multi-currency.php b/gravity-forms-multi-currency.php index 583cfca..e7e3d50 100644 --- a/gravity-forms-multi-currency.php +++ b/gravity-forms-multi-currency.php @@ -5,7 +5,7 @@ * Description: Per form currency for Gravity Forms. * Version: 1.7.2 * Author: Ilan Cohen , Aaron St. Pierre - * Author URI: https://github.com/ilanco, https://github.com/aaronstpierre + * Author URI: https://github.com/aaronstpierre */ if (defined('WP_DEBUG') && (WP_DEBUG == true)) { From 044403093f872adb3691cca9201052e4c5d667cf Mon Sep 17 00:00:00 2001 From: "Aaron J. St. Pierre" Date: Sat, 22 Apr 2017 17:32:30 +0000 Subject: [PATCH 7/7] - Remove references to my name for pull acceptance by ilanco --- composer.json | 2 +- gravity-forms-multi-currency.php | 26 +++++++++++++------------- readme.txt | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 4a18fd6..8569265 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name" : "aaronstpierre/gravity-forms-multi-currency", + "name" : "ilanco/gravity-forms-multi-currency", "description" : "Gravity Forms Multi Currency", "type" : "wordpress-plugin", "version" : "1.7.2" diff --git a/gravity-forms-multi-currency.php b/gravity-forms-multi-currency.php index e7e3d50..abd9c1a 100644 --- a/gravity-forms-multi-currency.php +++ b/gravity-forms-multi-currency.php @@ -1,11 +1,11 @@ , Aaron St. Pierre - * Author URI: https://github.com/aaronstpierre + * Author: Ilan Cohen + * Author URI: https://github.com/ilanco */ if (defined('WP_DEBUG') && (WP_DEBUG == true)) { @@ -63,23 +63,23 @@ public static function init() public function form_process() { - // asp: setup way to dump the form_info; probably a better way to do this - $gf_mc_debug = 0; + // asp: setup way to dump the form_info; probably a better way to do this + $gf_mc_debug = 0; $form_id = isset($_POST["gform_submit"]) ? $_POST["gform_submit"] : 0; if ($form_id) { - // asp: use new GFAPI class returns an array + // asp: use new GFAPI class returns an array $form_info = GFAPI::get_form( $form_id ); - if ( $gf_mc_debug ) { - echo "form_id: $form_id
"; - echo 'is_active:' . $form_info['is_active'] . '
'; - echo '
' . var_export($form_info, true) . '
'; - } + if ( $gf_mc_debug ) { + echo "form_id: $form_id
"; + echo 'is_active:' . $form_info['is_active'] . '
'; + echo '
' . var_export($form_info, true) . '
'; + } - // asp: since the result is an array check for - // asp: is_active using array notation + // asp: since the result is an array check for + // asp: is_active using array notation $is_valid_form = $form_info && $form_info['is_active']; if ($is_valid_form) { diff --git a/readme.txt b/readme.txt index a542148..dde9b0f 100644 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,5 @@ === Gravity Forms Multi Currency === -Contributors: ilanco, asp@p0v.net +Contributors: ilanco Donate link: https://www.gittip.com/ilanco/ Tags: gravity, forms, gravity forms, gravity form, currency, multiple Requires at least: 3.0.1