diff --git a/give.php b/give.php index 90819819a0..cd1679e378 100644 --- a/give.php +++ b/give.php @@ -6,7 +6,7 @@ * Description: The most robust, flexible, and intuitive way to accept donations on WordPress. * Author: GiveWP * Author URI: https://givewp.com/ - * Version: 3.0.1 + * Version: 3.0.3 * Requires at least: 6.0 * Requires PHP: 7.2 * Text Domain: give @@ -391,7 +391,7 @@ private function setup_constants() { // Plugin version. if (!defined('GIVE_VERSION')) { - define('GIVE_VERSION', '3.0.1'); + define('GIVE_VERSION', '3.0.2'); } // Plugin Root File. diff --git a/includes/admin/settings/class-settings-gateways.php b/includes/admin/settings/class-settings-gateways.php index c8b23161de..8abbbf9bf6 100644 --- a/includes/admin/settings/class-settings-gateways.php +++ b/includes/admin/settings/class-settings-gateways.php @@ -368,7 +368,8 @@ static function ($value, $key) { $gateways, give()->gateways->getPaymentGateways(2) ) - ) + ), + 2 ); // v3 gateways are gateways that are registered with updated gateway registration API. diff --git a/includes/forms/template.php b/includes/forms/template.php index a10df84666..db650f8d48 100644 --- a/includes/forms/template.php +++ b/includes/forms/template.php @@ -1703,8 +1703,7 @@ class="give-cancel-login give-checkout-register-cancel give-btn button" name="gi * @since 1.0 */ function give_payment_mode_select( $form_id, $args ) { - - $gateways = give_get_enabled_payment_gateways( $form_id ); + $gateways = give_get_enabled_payment_gateways($form_id, 2); $id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : ''; /** diff --git a/includes/gateways/functions.php b/includes/gateways/functions.php index 8236479608..1d473fbeb7 100644 --- a/includes/gateways/functions.php +++ b/includes/gateways/functions.php @@ -23,10 +23,8 @@ * @param int|null $version * @return array $gateways All the available gateways */ -function give_get_payment_gateways($version = 2) +function give_get_payment_gateways($version = null) { - $suffix = $version === 3 ? '_v3' : ''; - // Default, built-in gateways $gateways = apply_filters( 'give_payment_gateways', @@ -43,7 +41,14 @@ function give_get_payment_gateways($version = 2) } }); - $gatewayLabels = give_get_option('gateways_label' . $suffix, []); + $gatewayLabels = []; + if (!$version || $version === 2) { + $gatewayLabels = array_merge($gatewayLabels, (array)give_get_option('gateways_label', [])); + } + + if (!$version || $version === 3) { + $gatewayLabels = array_merge($gatewayLabels, (array)give_get_option('gateways_label_v3', [])); + } // Replace payment gateway checkout label with admin defined checkout label. if ($gatewayLabels) { @@ -67,12 +72,20 @@ function give_get_payment_gateways($version = 2) * @param int|null $version * @return array $gateway_list All the available gateways */ -function give_get_enabled_payment_gateways($form_id = 0, $version = 2) +function give_get_enabled_payment_gateways($form_id = 0, $version = null) { - $suffix = $version === 3 ? '_v3' : ''; $gateways = give_get_payment_gateways($version); - $enabled = $_POST['gateways' . $suffix] ?? give_get_option('gateways' . $suffix); + $enabled = []; + if (!$version || $version === 2) { + $gatewaysFromPostRequest = isset($_POST['gateways']) ? (array)$_POST['gateways'] : null; + $enabled = array_merge($enabled, $gatewaysFromPostRequest ?? (array)give_get_option('gateways', [])); + } + + if (!$version || $version === 3) { + $gatewaysFromPostRequest = isset($_POST['gateways_v3']) ? (array)$_POST['gateways_v3'] : null; + $enabled = array_merge($enabled, $gatewaysFromPostRequest ?? (array)give_get_option('gateways_v3', [])); + } $gateway_list = []; @@ -91,7 +104,7 @@ function give_get_enabled_payment_gateways($form_id = 0, $version = 2) /** * Checks whether a specified gateway is activated. * - * @unlreased add $version param + * @since 3.0.2 add $version param * @since 1.0 * * @param string $gateway Name of the gateway to check for @@ -110,7 +123,7 @@ function give_is_gateway_active($gateway, $version = 2) /** * Gets the default payment gateway selected from the Give Settings * - * @unlreased add $version param + * @since 3.0.2 add $version param * @since 1.0 * * @param int|null $form_id int ID of the Give Form @@ -345,19 +358,32 @@ function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish /** * Returns a ordered list of all available gateways. * - * @unlreased add $version param + * @since 3.0.2 add $version param * @since 1.4.5 * * @param array $gateways List of payment gateways * @param int|null $version * @return array $gateways All the available gateways */ -function give_get_ordered_payment_gateways($gateways, $version = 2) +function give_get_ordered_payment_gateways($gateways, $version = null) { - $suffix = $version === 3 ? '_v3' : ''; - // Get gateways setting. - $gateways_setting = $_POST['gateways' . $suffix] ?? give_get_option('gateways' . $suffix); + $gateways_setting = []; + if (!$version || $version === 2) { + $gatewaysFromPostRequest = isset($_POST['gateways']) ? (array)$_POST['gateways'] : null; + $gateways_setting = array_merge( + $gateways_setting, + $gatewaysFromPostRequest ?? (array)give_get_option('gateways', []) + ); + } + + if (!$version || $version === 3) { + $gatewaysFromPostRequest = isset($_POST['gateways_v3']) ? (array)$_POST['gateways_v3'] : null; + $gateways_setting = array_merge( + $gateways_setting, + $gatewaysFromPostRequest ?? (array)give_get_option('gateways_v3', []) + ); + } // Return from here if we do not have gateways setting. if ( empty( $gateways_setting ) ) { @@ -369,8 +395,7 @@ function give_get_ordered_payment_gateways($gateways, $version = 2) // Reorder gateways array foreach ( $gateways_setting as $gateway_key => $value ) { - - $new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : ''; + $new_gateway_value = $gateways[$gateway_key] ?? ''; unset( $gateways[ $gateway_key ] ); if ( ! empty( $new_gateway_value ) ) { @@ -381,9 +406,10 @@ function give_get_ordered_payment_gateways($gateways, $version = 2) /** * Filter payment gateways order. * + * @since 3.0.2 add $version param * @since 1.7 * * @param array $gateways All the available gateways */ - return apply_filters('give_payment_gateways_order' . $suffix, $gateways); + return apply_filters('give_payment_gateways_order', $gateways, $version); } diff --git a/readme.txt b/readme.txt index 1a23b29b40..a11e776855 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: donation, donate, recurring donations, fundraising, crowdfunding Requires at least: 6.0 Tested up to: 6.4 Requires PHP: 7.2 -Stable tag: 3.0.1 +Stable tag: 3.0.3 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -262,6 +262,13 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri 10. Use almost any payment gateway integration with GiveWP through our add-ons or by creating your own add-on. == Changelog == += 3.0.2: October 19th, 2023 = +<<<<<<<<< Temporary merge branch 1 +* Fix: Stripe per-form settings are included when migrating a form to the Visual Donation Form Builder +========= +* Fix: Gateways are properly separated in the settings page and Global Settings for Fee Recovery shows all gateways when you select per gateway + +>>>>>>>>> Temporary merge branch 2 = 3.0.1: October 17th, 2023 = * Fix: Resolved a conflict with Matomo plugin that was causing a fatal error diff --git a/src/DonationForms/FormPage/TemplateHandler.php b/src/DonationForms/FormPage/TemplateHandler.php index c809e30105..8f286371d1 100644 --- a/src/DonationForms/FormPage/TemplateHandler.php +++ b/src/DonationForms/FormPage/TemplateHandler.php @@ -2,8 +2,12 @@ namespace Give\DonationForms\FormPage; +use Give\Helpers\Form\Utils; use WP_Post as Post; +/** + * @since 3.0.0 + */ class TemplateHandler { /** @@ -22,6 +26,9 @@ public function __construct( $post, string $formPageTemplatePath ) $this->formPageTemplatePath = $formPageTemplatePath; } + /** + * @since 3.0.0 + */ public function handle($template) { return $this->isNextGenForm() @@ -29,10 +36,14 @@ public function handle($template) : $template; } + /** + * @since 3.0.3 Use isV3Form() method instead of 'post_content' to check if the form is built with Visual Builder + * @since 3.0.0 + */ protected function isNextGenForm(): bool { return $this->post - && $this->post->post_content - &&'give_forms' === $this->post->post_type; + && Utils::isV3Form($this->post->ID) + && 'give_forms' === $this->post->post_type; } } diff --git a/src/DonationForms/Repositories/DonationFormRepository.php b/src/DonationForms/Repositories/DonationFormRepository.php index 35d1d606e6..4e2dc185d5 100644 --- a/src/DonationForms/Repositories/DonationFormRepository.php +++ b/src/DonationForms/Repositories/DonationFormRepository.php @@ -19,6 +19,7 @@ use Give\Framework\PaymentGateways\PaymentGateway; use Give\Framework\PaymentGateways\PaymentGatewayRegister; use Give\Framework\Support\Facades\DateTime\Temporal; +use Give\Helpers\Form\Utils; use Give\Helpers\Hooks; use Give\Log\Log; @@ -477,13 +478,12 @@ function ($value, Closure $fail, string $key, array $values) use ($formId) { } /** + * @since 3.0.3 Use isV3Form() method instead of 'post_content' to check if it's a legacy form * @since 3.0.0 */ public function isLegacyForm(int $formId): bool { - $form = DB::table('posts')->select(['post_content', 'data'])->where('ID', $formId)->get(); - - return empty($form->data); + return ! Utils::isV3Form($formId); } /** diff --git a/src/FormBuilder/Routes/EditFormRoute.php b/src/FormBuilder/Routes/EditFormRoute.php index 9122287d43..a72aaff071 100644 --- a/src/FormBuilder/Routes/EditFormRoute.php +++ b/src/FormBuilder/Routes/EditFormRoute.php @@ -3,6 +3,7 @@ namespace Give\FormBuilder\Routes; use Give\FormBuilder\FormBuilderRouteBuilder; +use Give\Helpers\Form\Utils; /** * Route to edit an existing form @@ -10,6 +11,7 @@ class EditFormRoute { /** + * @since 3.0.3 Use isV3Form() method instead of 'post_content' to check if the form is built with Visual Builder * @since 3.0.0 * * @return void @@ -18,7 +20,7 @@ public function __invoke() { if (isset($_GET['post'], $_GET['action']) && 'edit' === $_GET['action']) { $post = get_post(abs($_GET['post'])); - if ('give_forms' === $post->post_type && $post->post_content) { + if ('give_forms' === $post->post_type && Utils::isV3Form($post->ID)) { wp_redirect(FormBuilderRouteBuilder::makeEditFormRoute($post->ID)); exit(); } diff --git a/src/FormBuilder/ViewModels/FormBuilderViewModel.php b/src/FormBuilder/ViewModels/FormBuilderViewModel.php index 3eea00928e..b3fa40ea25 100644 --- a/src/FormBuilder/ViewModels/FormBuilderViewModel.php +++ b/src/FormBuilder/ViewModels/FormBuilderViewModel.php @@ -87,12 +87,18 @@ public function isRecurringEnabled(): bool /** * @since 3.0.0 */ - public function getGoalTypeOption(string $value, string $label, string $description): array + public function getGoalTypeOption( + string $value, + string $label, + string $description, + bool $isCurrency = false + ): array { return [ 'value' => $value, 'label' => $label, 'description' => $description, + 'isCurrency' => $isCurrency, ]; } @@ -105,7 +111,8 @@ public function getGoalTypeOptions(): array $this->getGoalTypeOption( GoalType::AMOUNT, __('Amount Raised', 'give'), - __('The total amount raised for the form', 'give') + __('The total amount raised for the form', 'give'), + true ), $this->getGoalTypeOption( GoalType::DONATIONS, @@ -124,7 +131,8 @@ public function getGoalTypeOptions(): array $this->getGoalTypeOption( GoalType::AMOUNT_FROM_SUBSCRIPTIONS, __('Subscription Amount Raised', 'give'), - __('The total amount raised for the form through subscriptions', 'give') + __('The total amount raised for the form through subscriptions', 'give'), + true ), $this->getGoalTypeOption( GoalType::SUBSCRIPTIONS, diff --git a/src/FormBuilder/resources/js/form-builder/src/App.tsx b/src/FormBuilder/resources/js/form-builder/src/App.tsx index 2a2897cfe0..fbbc5a739f 100644 --- a/src/FormBuilder/resources/js/form-builder/src/App.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/App.tsx @@ -3,7 +3,6 @@ import BlockEditorContainer from './containers/BlockEditorContainer'; import {FormStateProvider} from './stores/form-state'; import {Storage} from './common'; import defaultBlocks from './blocks.json'; -import Feedback from '@givewp/form-builder/feedback'; import {BlockInstance} from '@wordpress/blocks'; import './App.scss'; import FormBuilderErrorBoundary from '@givewp/form-builder/errors/FormBuilderErrorBounday'; @@ -55,7 +54,6 @@ export default function App() { - diff --git a/src/FormBuilder/resources/js/form-builder/src/blocks/elements/paragraph/Edit.tsx b/src/FormBuilder/resources/js/form-builder/src/blocks/elements/paragraph/Edit.tsx index 927f34493e..5f9a9b85a0 100644 --- a/src/FormBuilder/resources/js/form-builder/src/blocks/elements/paragraph/Edit.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/blocks/elements/paragraph/Edit.tsx @@ -1,7 +1,6 @@ import {BlockEditProps} from '@wordpress/blocks'; -import {RichText, InspectorControls} from '@wordpress/block-editor'; +import {RichText} from '@wordpress/block-editor'; import {__} from '@wordpress/i18n'; -import {PanelBody, PanelRow, TextareaControl, TextControl} from "@wordpress/components"; export default function Edit({attributes, setAttributes}: BlockEditProps) { const {content} = attributes; @@ -15,17 +14,6 @@ export default function Edit({attributes, setAttributes}: BlockEditProps) { onChange={(content) => setAttributes({content})} placeholder={__('Enter some text', 'give')} /> - - - - setAttributes({content})} - /> - - - ); } diff --git a/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts b/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts index 557ff8a253..d15ace1536 100644 --- a/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts +++ b/src/FormBuilder/resources/js/form-builder/src/common/getWindowData.ts @@ -14,6 +14,7 @@ type GoalTypeOption = { value: string; label: string; description: string; + isCurrency: boolean; }; /** diff --git a/src/FormBuilder/resources/js/form-builder/src/containers/HeaderContainer.tsx b/src/FormBuilder/resources/js/form-builder/src/containers/HeaderContainer.tsx index 8bafdfa08a..d8825f8c64 100644 --- a/src/FormBuilder/resources/js/form-builder/src/containers/HeaderContainer.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/containers/HeaderContainer.tsx @@ -2,7 +2,7 @@ import React, {useState} from 'react'; import {EditIcon, GiveIcon} from '../components/icons'; import {drawerRight, moreVertical, external} from '@wordpress/icons'; import {setFormSettings, setTransferState, useFormState, useFormStateDispatch} from '../stores/form-state'; -import {Button, Dropdown, MenuGroup, MenuItem, TextControl} from '@wordpress/components'; +import {Button, Dropdown, ExternalLink, Icon, MenuGroup, MenuItem, TextControl} from '@wordpress/components'; import {__} from '@wordpress/i18n'; import {Header} from '../components'; import {getWindowData, Storage} from '../common'; @@ -198,7 +198,7 @@ const HeaderContainer = ({ }} renderContent={({onClose}) => (
- + { // @ts-ignore @@ -231,6 +231,15 @@ const HeaderContainer = ({ )} + + + {__('Submit Feedback', 'give')} + +
)} /> diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/Container.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/Container.tsx deleted file mode 100644 index 81c70c4438..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/Container.tsx +++ /dev/null @@ -1,18 +0,0 @@ -const Container = ({children}) => { - return ( -
- {children} -
- ) -} - -export default Container; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackButton.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackButton.tsx deleted file mode 100644 index 2d345de51b..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackButton.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import {Button} from '@wordpress/components'; -import FeedbackIcon from './FeedbackIcon'; - -const FeedbackButton = (props) => { - return ( - - ); -}; - -export default FeedbackButton; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackIcon.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackIcon.tsx deleted file mode 100644 index 743afd9098..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/FeedbackIcon.tsx +++ /dev/null @@ -1,21 +0,0 @@ -const FeedbackIcon = () => { - return ( - - - - - ); -}; - -export default FeedbackIcon; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/index.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/index.tsx deleted file mode 100644 index 18676b01f1..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/index.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import React, {useEffect, useState} from 'react'; -import {__} from '@wordpress/i18n'; -import Container from './Container'; -import FeedbackButton from './FeedbackButton'; - -import {Container as PopupContainer, Content as PopupContent, Header as PopupHeader} from './popup'; -import {ExternalLink} from '@wordpress/components'; - -const feedbackUrl = 'https://docs.givewp.com/nextgenfeedback'; - -const HIDE_FEEDBACK = 'givewpNextGenHideFeedback'; - -const Feedback = () => { - const [hidden, setHidden] = useState(false); - const closeCallback = () => { - setHidden(true); - localStorage.setItem(HIDE_FEEDBACK, 'true'); - }; - - useEffect(() => { - setHidden(!!localStorage.getItem(HIDE_FEEDBACK)); - }, []); - - // @ts-ignore - return ( - - {!hidden && ( - - - -
- - {__( - 'Let us know what you think about the form builder to help improve the product experience.', - 'give' - )} - -
-
- - {__('Provide Feedback', 'give')} - -
-
-
- )} - setHidden(!hidden)}>{__('Feedback', 'give')} -
- ); -}; - -export default Feedback; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/CloseIcon.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/CloseIcon.tsx deleted file mode 100644 index 186bcd2ccc..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/CloseIcon.tsx +++ /dev/null @@ -1,9 +0,0 @@ -const CloseIcon = (props) => { - return ( - - - - ); -}; - -export default CloseIcon; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Container.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Container.tsx deleted file mode 100644 index 2d20d9c6c8..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Container.tsx +++ /dev/null @@ -1,22 +0,0 @@ -const Container = ({children}) => { - return ( -
- {children} -
- ); -} - -export default Container; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Content.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Content.tsx deleted file mode 100644 index 6d6b5cd8d8..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Content.tsx +++ /dev/null @@ -1,18 +0,0 @@ -const Content = ({children}) => { - return ( -
- {children} -
- ); -} - -export default Content; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Header.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Header.tsx deleted file mode 100644 index 755c625cc3..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/Header.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import {Button, Icon} from '@wordpress/components'; -import CloseIcon from './CloseIcon'; -import HeaderIcon from './HeaderIcon'; - -const Header = ({title, closeCallback}) => { - return ( -
-
- - {title} -
-
- ); -}; - -export default Header; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/HeaderIcon.tsx b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/HeaderIcon.tsx deleted file mode 100644 index 2b2e6233c8..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/HeaderIcon.tsx +++ /dev/null @@ -1,11 +0,0 @@ -const HeaderIcon = (props) => { - return ( - - - - - - ) -} - -export default HeaderIcon; diff --git a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/index.ts b/src/FormBuilder/resources/js/form-builder/src/feedback/popup/index.ts deleted file mode 100644 index 65a0f0cae9..0000000000 --- a/src/FormBuilder/resources/js/form-builder/src/feedback/popup/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Container from './Container' -import Header from './Header' -import Content from './Content' - -export { - Container, - Header, - Content, -} diff --git a/src/FormBuilder/resources/js/form-builder/src/settings/donation-goal/index.tsx b/src/FormBuilder/resources/js/form-builder/src/settings/donation-goal/index.tsx index 4304686b89..c31b5b18af 100644 --- a/src/FormBuilder/resources/js/form-builder/src/settings/donation-goal/index.tsx +++ b/src/FormBuilder/resources/js/form-builder/src/settings/donation-goal/index.tsx @@ -10,6 +10,7 @@ import { } from '@wordpress/components'; import debounce from 'lodash.debounce'; import {getFormBuilderWindowData} from '@givewp/form-builder/common/getWindowData'; +import {CurrencyControl} from '@givewp/form-builder/components/CurrencyControl'; const {goalTypeOptions} = getFormBuilderWindowData(); @@ -69,12 +70,21 @@ const DonationGoalSettings = () => { /> - dispatch(setFormSettings({goalAmount})), 100)} - /> + {selectedGoalType.isCurrency ? ( + dispatch(setFormSettings({goalAmount})), 500)} + /> + ) : ( + dispatch(setFormSettings({goalAmount}))} + /> + )} )} diff --git a/src/FormBuilder/resources/js/form-builder/src/styles/_block-editor.scss b/src/FormBuilder/resources/js/form-builder/src/styles/_block-editor.scss index 1e959c3eed..6134d4d67c 100644 --- a/src/FormBuilder/resources/js/form-builder/src/styles/_block-editor.scss +++ b/src/FormBuilder/resources/js/form-builder/src/styles/_block-editor.scss @@ -214,4 +214,6 @@ background-color: white; } - +.givewp-support-link.components-external-link > svg { + display: none; /* Hide included icon, in favor of menu item icon. */ +} diff --git a/src/FormMigration/FormMetaDecorator.php b/src/FormMigration/FormMetaDecorator.php index dcadd39fc8..b37410d2fe 100644 --- a/src/FormMigration/FormMetaDecorator.php +++ b/src/FormMigration/FormMetaDecorator.php @@ -448,6 +448,7 @@ public function getFormFieldsPlacement(): string } /** + * @since 3.0.2 set correct $gatewayId to be used in getMeta calls * @since 3.0.0 */ public function getFeeRecoverySettings(): array @@ -476,15 +477,19 @@ public function getFeeRecoverySettings(): array if ($gateways) { foreach (array_keys($gateways) as $gatewayId) { + $v3GatewayId = $gatewayId; if (array_key_exists($gatewayId, $gatewaysMap)) { - $gatewayId = $gatewaysMap[$gatewayId]; + $v3GatewayId = $gatewaysMap[$gatewayId]; } - $perGatewaySettings[$gatewayId] = [ + $perGatewaySettings[$v3GatewayId] = [ 'enabled' => $this->getMeta('_form_gateway_fee_enable_' . $gatewayId) === 'enabled', - 'feePercentage' => (float)$this->getMeta('_form_gateway_fee_percentage_' . $gatewayId), - 'feeBaseAmount' => (float)$this->getMeta('_form_gateway_fee_base_amount_' . $gatewayId), - 'maxFeeAmount' => (float)$this->getMeta('_form_gateway_fee_maximum_fee_amount_' . $gatewayId), + 'feePercentage' => (float)$this->getMeta('_form_gateway_fee_percentage_' . $gatewayId, 2.9), + 'feeBaseAmount' => (float)$this->getMeta('_form_gateway_fee_base_amount_' . $gatewayId, 0.30), + 'maxFeeAmount' => (float)$this->getMeta( + '_form_gateway_fee_maximum_fee_amount_' . $gatewayId, + give_format_decimal(['amount' => '0.00']) + ), ]; } } diff --git a/src/MultiFormGoals/ProgressBar/Model.php b/src/MultiFormGoals/ProgressBar/Model.php index de4f7a1bf5..22b1b87db2 100644 --- a/src/MultiFormGoals/ProgressBar/Model.php +++ b/src/MultiFormGoals/ProgressBar/Model.php @@ -38,6 +38,7 @@ public function __construct(array $args) /** * Get forms associated with Progress Bar * + * @since 3.0.3 Return empty array instead of false * @since 2.9.0 */ public function getForms(): array @@ -78,7 +79,7 @@ public function getForms(): array return $query->posts; } else { - return false; + return []; } }