PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 1.1.2
ShopBuilder – WooCommerce Builder For Elementor v1.1.2
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Controllers / Admin / AdminInit.php

AdminInit.php in ShopBuilder – WooCommerce Builder For Elementor 1.1.2, at app/Controllers/Admin/AdminInit.php

121 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace RadiusTheme\SB\Controllers\Admin;
4
5 defined( 'ABSPATH' ) || exit();
6
7 use RadiusTheme\SB\Controllers\Admin\Ajax as Ajax;
8 use RadiusTheme\SB\Traits\SingletonTrait;
9
10 class AdminInit {
11 /**
12 * Parent Menu Page Slug
13 */
14 const MENU_PAGE_SLUG = 'rtsb';
15
16 /**
17 * Menu capability
18 */
19 const MENU_CAPABILITY = 'manage_options';
20
21 /**
22 * Parent Menu Hook
23 *
24 * @var string
25 */
26 static $parent_menu_hook = '';
27
28 private $menu_link_part;
29
30 use SingletonTrait;
31
32 public function __construct() {
33 $this->menu_link_part = admin_url( 'admin.php?page=rtsb' );
34 $this->remove_all_notices();
35 $this->init();
36 $this->ajax_actions();
37 $this->upgrade();
38 }
39
40 /**
41 * Admin Ajax hooks.
42 *
43 * @return void
44 */
45 public function ajax_actions() {
46 Ajax\DefaultTemplate::instance();
47 Ajax\ModalTemplate::instance();
48 Ajax\CreateTemplate::instance();
49 Ajax\AdminSettings::instance();
50 }
51
52 /**
53 * Upgrade Notice.
54 *
55 * @return void
56 */
57 public function upgrade() {
58 Notice\Upgrade::instance();
59 }
60
61 public function init() {
62 add_action( 'admin_menu', [ $this, 'add_menu' ], 25 );
63 PluginRow::instance();
64 }
65
66 public function add_menu() {
67 self::$parent_menu_hook = add_menu_page(
68 esc_html__( 'ShopBuilder', 'shopbuilder' ),
69 esc_html__( 'ShopBuilder', 'shopbuilder' ),
70 self::MENU_CAPABILITY,
71 self::MENU_PAGE_SLUG,
72 null,
73 RTSB_URL . '/assets/images/icon/shopbuilder-logo-white.svg',
74 '55.6'
75 );
76
77 add_submenu_page(
78 self::MENU_PAGE_SLUG,
79 esc_html__( 'Settings', 'shopbuilder' ),
80 esc_html__( 'Settings', 'shopbuilder' ),
81 self::MENU_CAPABILITY,
82 'rtsb-settings',
83 [ $this, 'settings_page' ],
84 );
85
86 // Remove Parent Submenu
87 remove_submenu_page( self::MENU_PAGE_SLUG, self::MENU_PAGE_SLUG );
88 }
89
90 function redirect_to_content() {
91 wp_redirect( admin_url( 'admin.php?page=rtsb-settings' ) );
92 }
93
94
95 public function settings_page() {
96 ?>
97 <div class="wrap rtsb-admin-wrap">
98 <div id="rtsb-admin-app"></div>
99 </div>
100 <?php
101 }
102
103 /**
104 * Remove admin notices
105 */
106 public function remove_all_notices() {
107 add_action(
108 'in_admin_header',
109 function () {
110 $screen = get_current_screen();
111 if ( 'shopbuilder_page_rtsb-settings' === $screen->base ) {
112 remove_all_actions( 'admin_notices' );
113 remove_all_actions( 'all_admin_notices' );
114 }
115 },
116 1000
117 );
118 }
119
120 }
121