PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 0.0.5
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v0.0.5
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.php

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

97 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;
4
5 use Better_Payment\Lite\Admin\Better_Payment_Settings;
6 use Better_Payment\Lite\Admin\Elementor\Better_Payment_Widget;
7 use Better_Payment\Lite\Admin\Elementor\Widget;
8 use Better_Payment\Lite\Admin\Menu;
9 use Better_Payment\Lite\Classes\Better_Payment_Helper;
10 use Better_Payment\Lite\Classes\Export;
11
12 /**
13 * Exit if accessed directly
14 */
15 if (!defined('ABSPATH')) {
16 exit;
17 }
18
19 /**
20 * The admin class
21 *
22 * @since 0.0.1
23 */
24 class Admin extends Controller{
25
26 /**
27 * Initialize the class
28 *
29 * @since 0.0.1
30 */
31 public function __construct() {
32
33 }
34
35 public function init(){
36 if ( defined( 'ELEMENTOR_VERSION' ) ) {
37 new Better_Payment_Settings();
38 }
39
40 if (!did_action('elementor/loaded')) {
41 $notice = new Better_Payment_Helper();
42 $notice->elementor_not_loaded();
43 }
44
45 if (did_action('elementor/loaded')) {
46 add_filter('plugin_action_links', array($this, 'plugin_actions_links'), 10, 2);
47 }
48 }
49
50 /**
51 * Add settings page link on plugins page
52 *
53 * @param array $links
54 * @param string $file
55 *
56 * @return array
57 * @since 0.0.1
58 */
59 public function plugin_actions_links($links, $file) {
60 $better_payment_plugin = plugin_basename(__FILE__);
61
62 if ($file == $better_payment_plugin && current_user_can('manage_options')) {
63 $links[] = sprintf('<a href="%s">%s</a>', admin_url("admin.php?page=better-payment-settings"), __('Settings', 'better-payment'));
64 }
65
66 return $links;
67 }
68
69 /**
70 * Dispatch and bind actions
71 *
72 * @return void
73 * @since 0.0.1
74 */
75 public static function dispatch_actions( ) {
76 $menuObj = new Menu();
77 $menuObj->init();
78
79 $bpElementorWidgetObj = new Widget();
80
81 $bpExportObj = new Export();
82
83 // Handle select2 ajax search
84 add_action('wp_ajax_better_payment_select2_search_post', [$bpElementorWidgetObj, 'select2_ajax_posts_filter_autocomplete']);
85 add_action('wp_ajax_nopriv_better_payment_select2_search_post', [$bpElementorWidgetObj, 'select2_ajax_posts_filter_autocomplete']);
86
87 add_action('wp_ajax_better_payment_select2_get_title', [$bpElementorWidgetObj, 'select2_ajax_get_posts_value_titles']);
88 add_action('wp_ajax_nopriv_better_payment_select2_get_title', [$bpElementorWidgetObj, 'select2_ajax_get_posts_value_titles']);
89
90 // Elements
91 add_action('elementor/controls/controls_registered',[$bpElementorWidgetObj, 'register_controls']);
92
93 //Page: Transactions
94 add_action('wp_ajax_better-payment-transactions-export',[$bpExportObj, 'export_transactions']);
95 }
96 }
97