PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 1.0.2
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v1.0.2
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.2, at includes/Admin/Elementor/Better_Payment_EL_Integration.php

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