PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 0.0.4
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v0.0.4
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.4, at includes/Admin.php

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