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 / better-payment.php

better-payment.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 1.0.2, at better-payment.php

176 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Better Payment
5 * Description: Make instant payment with one click through Better Payment. It offers seamless integrations with Elementor and allows you to get payment through PayPal and Stripe and other popular gateways.
6 * Plugin URI: https://wpdeveloper.com/
7 * Author: WPDeveloper
8 * Version: 1.0.2
9 * Author URI: https://wpdeveloper.com/
10 * Text Domain: better-payment
11 * Domain Path: /languages
12 */
13
14 if (!defined('ABSPATH')) {
15 exit;
16 } // Exit if accessed directly
17
18 require_once __DIR__ . '/vendor/autoload.php';
19
20 /**
21 * The plugin main class
22 *
23 * @since 0.0.1
24 */
25 final class Better_Payment {
26
27 /**
28 * Plugin version
29 *
30 * @var string
31 * @since 0.0.1
32 */
33 const version = '1.0.2';
34
35 /**
36 * Class construcotr
37 *
38 * @since 0.0.1
39 */
40 private function __construct() {
41 $this->define_constants();
42
43 register_activation_hook(__FILE__, [$this, 'activate']);
44
45 add_action('plugins_loaded', [$this, 'init_plugin']);
46 }
47
48 /**
49 * Initialize a singleton instance
50 *
51 * @return \Better_Payment
52 * @since 0.0.1
53 */
54 public static function init() {
55 static $instance = false;
56
57 if (!$instance) {
58 $instance = new self();
59 }
60
61 return $instance;
62 }
63
64 /**
65 * Define the required plugin constants
66 *
67 * @return void
68 * @since 0.0.1
69 */
70 public function define_constants() {
71 define('BETTER_PAYMENT_VERSION', self::version);
72 define('BETTER_PAYMENT_FILE', __FILE__);
73 define('BETTER_PAYMENT_BASENAME', plugin_basename(__FILE__));
74 define('BETTER_PAYMENT_PATH', __DIR__);
75 define('BETTER_PAYMENT_URL', plugins_url('', BETTER_PAYMENT_FILE));
76 define('BETTER_PAYMENT_ASSETS', BETTER_PAYMENT_URL . '/assets');
77 define('BETTER_PAYMENT_ASSETS_PATH', BETTER_PAYMENT_PATH . '/assets');
78 define('BETTER_PAYMENT_DEV_ASSETS', BETTER_PAYMENT_URL . '/bpbuild');
79 define('BETTER_PAYMENT_DEV_ASSETS_PATH', BETTER_PAYMENT_PATH . '/bpbuild');
80 define('BETTER_PAYMENT_INCLUDES_PATH', BETTER_PAYMENT_PATH . '/includes');
81 define('BETTER_PAYMENT_ADMIN_PATH', BETTER_PAYMENT_INCLUDES_PATH . '/Admin');
82 define('BETTER_PAYMENT_ADMIN_VIEWS_PATH', BETTER_PAYMENT_ADMIN_PATH . '/views');
83 }
84
85 /**
86 * Do stuff upon plugin activation
87 *
88 * @return void
89 * @since 0.0.1
90 */
91 public function activate() {
92 $installer = new Better_Payment\Lite\Installer();
93 $installer->run();
94 }
95
96 /**
97 * Initialize the plugin
98 *
99 * @return void
100 * @since 0.0.1
101 */
102 public function init_plugin() {
103 new Better_Payment\Lite\Assets();
104
105 if (defined('DOING_AJAX') && DOING_AJAX) {
106 new Better_Payment\Lite\Ajax();
107 }
108
109 if (is_admin()) {
110 $adminObj = new Better_Payment\Lite\Admin();
111 $adminObj->init();
112 } else {
113 new Better_Payment\Lite\Frontend();
114 }
115
116 new Better_Payment\Lite\API();
117
118 if (defined('ELEMENTOR_VERSION')) {
119 new Better_Payment\Lite\Classes\Better_Payment_Actions();
120 $el_integration = new Better_Payment\Lite\Admin\Elementor\Better_Payment_EL_Integration();
121 $el_integration->init();
122
123 Better_Payment\Lite\Admin\Better_Payment_Settings::save_default_settings();
124 }
125 }
126 }
127
128 /**
129 * Initializes the main plugin
130 *
131 * @return \Better_Payment
132 * @since 0.0.1
133 */
134
135 Better_Payment::init();
136
137 /**
138 * Plugin migrator
139 *
140 * @since 0.0.2
141 */
142 function better_payment_migrator() {
143 Better_Payment\Lite\Classes\Better_Payment_Migrator::migrator();
144 }
145
146
147 /**
148 * On wp load
149 *
150 * @return void
151 * @since 0.0.1
152 */
153 add_action('wp_loaded', function () {
154 if (get_option('better_payment_version') != BETTER_PAYMENT_VERSION) {
155 better_payment_migrator();
156 update_option('better_payment_version', BETTER_PAYMENT_VERSION);
157 }
158
159 $setup_wizard = get_option('better_payment_setup_wizard');
160
161 if ($setup_wizard == 'redirect') {
162 Better_Payment\Lite\Admin\Better_Payment_Setup_Wizard::redirect();
163 }
164
165 if ($setup_wizard == 'init') {
166 new Better_Payment\Lite\Admin\Better_Payment_Setup_Wizard();
167 }
168 });
169
170 /**
171 * Dispatch actions
172 *
173 * @since 0.0.1
174 */
175 \Better_Payment\Lite\Admin::dispatch_actions();
176