PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.6.2
ShopBuilder – WooCommerce Builder For Elementor v2.6.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
← All changes | app/Controllers/Admin/AdminInit.php +52 -26 2.1.32.6.2 View file →
@@ -7,9 +7,8 @@
7 7 use RadiusTheme\SB\Controllers\Admin\Ajax as Ajax;
8 8 use RadiusTheme\SB\Helpers\Fns;
9 9 use RadiusTheme\SB\Traits\SingletonTrait;
10 10
11 -
12 11 class AdminInit {
13 12 /**
14 13 * Parent Menu Page Slug
15 14 */
@@ -26,15 +25,13 @@
26 25 * @var string
27 26 */
28 27 static $parent_menu_hook = '';
29 28
30 - //private $menu_link_part;
29 + // private $menu_link_part;
31 30
32 31 use SingletonTrait;
33 32
34 33 public function __construct() {
35 - // $this->menu_link_part = admin_url( 'admin.php?page=rtsb' );
36 - $this->remove_all_notices();
37 34 $this->init();
38 35 $this->ajax_actions();
39 36 $this->upgrade();
40 37 }
@@ -45,10 +42,12 @@
45 42 * @return void
46 43 */
47 44 public function ajax_actions() {
48 45 Ajax\DefaultTemplate::instance();
46 + if ( defined( 'ELEMENTOR_VERSION' ) ) { // Elementor Check.
47 + Ajax\CreateTemplate::instance();
48 + }
49 49 Ajax\ModalTemplate::instance();
50 - Ajax\CreateTemplate::instance();
51 50 Ajax\AdminSettings::instance();
52 51 }
53 52
54 53 /**
@@ -57,14 +56,15 @@
57 56 * @return void
58 57 */
59 58 public function upgrade() {
60 59 Notice\Upgrade::instance();
60 + Notice\BFDiscount::instance();
61 61 Notice\Review::instance();
62 - Notice\EarlyBirdDiscount::instance();
63 62 }
64 63
65 64 public function init() {
66 65 add_action( 'admin_menu', [ $this, 'add_menu' ], 25 );
66 + add_action( 'in_admin_header', [ $this, 'in_admin_header_functionality' ], 1000 );
67 67 PluginRow::instance();
68 68 }
69 69
70 70 public function add_menu() {
@@ -93,12 +93,18 @@
93 93 self::MENU_CAPABILITY,
94 94 'rtsb-get-help',
95 95 [ $this, 'get_help_page' ],
96 96 );
97 - do_action( 'rtsb/add/more/submenu', self::MENU_PAGE_SLUG, self::MENU_CAPABILITY );
97 + add_submenu_page(
98 + self::MENU_PAGE_SLUG,
99 + esc_html__( 'Themes & Apps', 'shopbuilder' ),
100 + esc_html__( 'Themes & Apps', 'shopbuilder' ),
101 + self::MENU_CAPABILITY,
102 + 'rtsb-themes',
103 + [ $this, 'get_themes_page' ],
104 + );
105 + do_action( 'rtsb/add/more/submenu', self::MENU_PAGE_SLUG, self::MENU_CAPABILITY );
98 106
99 -
100 -
101 107 // Remove Parent Submenu
102 108 remove_submenu_page( self::MENU_PAGE_SLUG, self::MENU_PAGE_SLUG );
103 109 }
104 110
@@ -108,11 +114,11 @@
108 114
109 115
110 116 public function settings_page() {
111 117 ?>
112 - <div class="wrap rtsb-admin-wrap">
113 - <div id="rtsb-admin-app"></div>
114 - </div>
118 + <div class="wrap rtsb-admin-wrap">
119 + <div id="rtsb-admin-app"></div>
120 + </div>
115 121 <?php
116 122 }
117 123
118 124 public function get_help_page() {
@@ -118,22 +124,42 @@
118 124 public function get_help_page() {
119 125 Fns::renderView( 'help' );
120 126 }
121 127
128 + public function get_themes_page() {
129 + Fns::renderView( 'themes' );
130 + }
131 +
122 132 /**
123 - * Remove admin notices
133 + * Admin Header
124 134 */
125 - public function remove_all_notices() {
126 - add_action(
127 - 'in_admin_header',
128 - function () {
129 - $screen = get_current_screen();
130 - if ( in_array( $screen->base, [ 'shopbuilder_page_rtsb-settings', 'shopbuilder_page_rtsb-license' ]) ) {
131 - remove_all_actions( 'admin_notices' );
132 - remove_all_actions( 'all_admin_notices' );
133 - }
134 - },
135 - 1000
136 - );
135 + public function in_admin_header_functionality() {
136 + $screen = get_current_screen();
137 + $isBuilderTemplate = 'edit-rtsb_builder' === $screen->id;
138 + $pages = [
139 + 'shopbuilder_page_rtsb-get-help',
140 + 'shopbuilder_page_rtsb-settings',
141 + 'shopbuilder_page_rtsb-license',
142 + 'shopbuilder_page_rtsb-themes',
143 + ];
144 + $isSettingsPage = in_array( $screen->base, $pages, true );
145 + if ( $isBuilderTemplate || $isSettingsPage ) {
146 + remove_all_actions( 'admin_notices' );
147 + remove_all_actions( 'all_admin_notices' );
148 + }
149 + if ( ! defined( 'ELEMENTOR_VERSION' ) && $isBuilderTemplate ) {
150 + ?>
151 + <div class='rtsb-message-for-elementor-missing'>
152 + <div class="rtsb-builder-notice-content">
153 + <?php
154 + echo sprintf(
155 + /* translators: %s: Elementor */
156 + esc_html__( 'To build your WooCommerce pages, please Install and Activate the %s Plugin.', 'shopbuilder' ),
157 + '<a href="' . esc_url( admin_url( 'plugin-install.php?s=elementor&tab=search&type=term' ) ) . '" target="_blank">' . esc_html__( 'Elementor Website Builder', 'shopbuilder' ) . '</a>'
158 + );
159 + ?>
160 + </div>
161 + </div>
162 + <?php
163 + }
137 164 }
138 -
139 165 }