PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 1.0.1
ShopBuilder – WooCommerce Builder For Elementor v1.0.1
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.0.1, at app/Controllers/Admin/AdminInit.php

120 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 }
64
65 public function add_menu() {
66 self::$parent_menu_hook = add_menu_page(
67 esc_html__( 'ShopBuilder', 'shopbuilder' ),
68 esc_html__( 'ShopBuilder', 'shopbuilder' ),
69 self::MENU_CAPABILITY,
70 self::MENU_PAGE_SLUG,
71 null,
72 RTSB_URL . '/assets/images/icon/shopbuilder-logo-white.svg',
73 '55.6'
74 );
75
76 add_submenu_page(
77 self::MENU_PAGE_SLUG,
78 esc_html__( 'Settings', 'shopbuilder' ),
79 esc_html__( 'Settings', 'shopbuilder' ),
80 self::MENU_CAPABILITY,
81 'rtsb-settings',
82 [ $this, 'settings_page' ],
83 );
84
85 // Remove Parent Submenu
86 remove_submenu_page( self::MENU_PAGE_SLUG, self::MENU_PAGE_SLUG );
87 }
88
89 function redirect_to_content() {
90 wp_redirect( admin_url( 'admin.php?page=rtsb-settings' ) );
91 }
92
93
94 public function settings_page() {
95 ?>
96 <div class="wrap rtsb-admin-wrap">
97 <div id="rtsb-admin-app"></div>
98 </div>
99 <?php
100 }
101
102 /**
103 * Remove admin notices
104 */
105 public function remove_all_notices() {
106 add_action(
107 'in_admin_header',
108 function () {
109 $screen = get_current_screen();
110 if ( 'shopbuilder_page_rtsb-settings' === $screen->base ) {
111 remove_all_actions( 'admin_notices' );
112 remove_all_actions( 'all_admin_notices' );
113 }
114 },
115 1000
116 );
117 }
118
119 }
120