PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 1.0.0
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v1.0.0
2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 All 68 releases
better-payment / includes / Admin / Elementor / Better_Payment_EL_Integration.php

Better_Payment_EL_Integration.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 1.0.0, at includes/Admin/Elementor/Better_Payment_EL_Integration.php

81 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Better_Payment\Lite\Admin\Elementor;
4
5 use Better_Payment\Lite\Admin\Elementor\Form_Actions\Better_Payment_Payment_Amount_Field;
6 use Better_Payment\Lite\Admin\Elementor\Form_Actions\Better_Payment_Payment_Amount_Integration;
7 use Better_Payment\Lite\Admin\Elementor\Form_Actions\Better_Payment_Paypal_Integration;
8 use Better_Payment\Lite\Admin\Elementor\Form_Actions\Better_Payment_Stripe_Integration;
9 use Better_Payment\Lite\Classes\Better_Payment_Handler;
10
11 /**
12 * Exit if accessed directly
13 */
14 if (!defined('ABSPATH')) {
15 exit;
16 }
17
18 /**
19 * The elementor integration class
20 *
21 * @since 0.0.1
22 */
23 class Better_Payment_EL_Integration {
24
25 private $payment_amount = 'payment_amount';
26
27 /**
28 * Init
29 *
30 * @since 0.0.1
31 */
32 public function init() {
33 add_action( 'elementor/widgets/register', array( $this, 'register_widget' ) );
34 add_action( 'elementor/widgets/register', [ $this, 'elementor_form_integration' ], 10 );
35 add_action( 'elementor-pro/forms/pre_render', [ $this, 'elementor_pro_form_response' ], 10, 2 );
36 }
37
38 /**
39 * Register widget
40 *
41 * @since 0.0.1
42 */
43 public function register_widget( $widgets_manager ) {
44 $widgets_manager->register_widget_type( new Better_Payment_Widget() );
45 }
46
47 /**
48 * Elementor form integration
49 *
50 * @since 0.0.1
51 */
52 public function elementor_form_integration() {
53 if(!defined('ELEMENTOR_PRO_VERSION')){
54 return false;
55 }
56
57 wp_enqueue_style( 'better-payment-common-style' );
58
59 \ElementorPro\Modules\Forms\Module::instance()->add_form_action( 'better-payment', new Better_Payment_Payment_Amount_Integration() );
60 \ElementorPro\Modules\Forms\Module::instance()->add_form_action( 'PayPal', new Better_Payment_Paypal_Integration() );
61 \ElementorPro\Modules\Forms\Module::instance()->add_form_action( 'Stripe', new Better_Payment_Stripe_Integration() );
62 \ElementorPro\Modules\Forms\Module::instance()->add_form_field_type( 'payment_amount', new Better_Payment_Payment_Amount_Field() );
63 }
64
65 /**
66 * Elementor pro form response
67 *
68 * @since 0.0.1
69 */
70 public function elementor_pro_form_response( $settings, $obj ) {
71 wp_enqueue_style( 'better-payment-el' );
72 $response = Better_Payment_Handler::manage_response( $settings, $obj->get_id() );
73 if ( $response ) {
74 $obj->add_render_attribute( 'form', 'style', 'display:none' );
75 return false;
76 }
77 }
78
79 }
80
81