PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 1.3.2
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v1.3.2
4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / core / settings / base.php
shopengine / core / settings Last commit date
screens 4 years ago action.php 4 years ago api.php 4 years ago base.php 4 years ago
base.php
184 lines
1 <?php
2
3 namespace ShopEngine\Core\Settings;
4
5 use ShopEngine\Core\PageTemplates\Page_Templates;
6 use ShopEngine\Core\Template_Cpt;
7 use ShopEngine\Traits\Singleton;
8
9 defined('ABSPATH') || exit;
10
11 class Base {
12 use Singleton;
13
14 private $menu_link_part;
15
16
17 /**
18 *
19 * @since 1.0.0
20 *
21 */
22 public function init() {
23 new Api();
24
25 $this->menu_link_part = admin_url('edit.php?post_type=' . \ShopEngine\Core\Template_Cpt::TYPE);
26
27 // check permission for manage user
28 if(current_user_can('manage_options')) {
29 add_action('admin_menu', [$this, 'menu_getting_started']);
30 add_action('admin_menu', [$this, 'menu_others'], 100);
31 }
32
33 add_action('admin_enqueue_scripts', function(){
34
35 if(isset($_REQUEST['post_type']) && $_REQUEST['post_type'] === \ShopEngine\Core\Template_Cpt::TYPE) {
36
37 if(function_exists('wc_get_products') && !\ShopEngine\Core\Builders\Templates::has_simple_product()) {
38
39 \ShopEngine\Core\Builders\Templates::create_wc_simple_product();
40 }
41 }
42
43 }, 0);
44
45 add_action('admin_head', [ $this, 'admin_head_enqueue_scripts']);
46 add_action('admin_enqueue_scripts', [$this, 'js_css_admin']);
47 add_action('admin_footer', [$this, 'content']);
48 }
49
50 public function admin_head_enqueue_scripts() {
51 echo "<script>
52 jQuery(document).ready( function($) {
53 $('.toplevel_page_shopengine-settings').find('.wp-first-item').css({display:'none'});
54 $('.shopengine_pro_aware').parent().attr('target','_blank');
55 });
56 </script>";
57 }
58
59 public function js_css_admin() {
60
61 wp_enqueue_style('shopengine-admin-style-common', \ShopEngine::plugin_url() . 'assets/css/admin-style-common.css', false, \ShopEngine::version());
62
63 // get screen id
64 $screen = get_current_screen();
65
66 $cptName = \ShopEngine\Core\Template_Cpt::TYPE;
67
68 $dashboardPage = 'toplevel_page_shopengine-settings';
69
70 if(in_array($screen->id, ['edit-' . $cptName, 'shopengine_page_mt-form-settings', $dashboardPage])) {
71
72 wp_enqueue_script('htm', \ShopEngine::plugin_url() . 'assets/js/htm.js', null, \ShopEngine::version(), true);
73
74 wp_enqueue_script('shopengine-admin-js', \ShopEngine::plugin_url() . 'assets/js/app.js', array('htm', 'jquery', 'wp-element'), \ShopEngine::version(), true);
75
76 // page template lists
77 $page_templates = Page_Templates::instance()->getTemplates() ;
78
79 wp_localize_script('shopengine-admin-js', 'shopengine_admin_var', [
80 'version' => \ShopEngine::version(),
81 'package_type' => \ShopEngine::package_type(),
82 'license_status' => \ShopEngine::license_status(),
83 'license_activated_message' => sprintf( esc_html__('Congratulations! Your product is activated for "%s"', 'shopengine'), parse_url(home_url(), PHP_URL_HOST)),
84 'cpt' => $cptName,
85 'resturl' => get_rest_url(),
86 'adminurl' => get_admin_url(),
87 'siteurl' => get_option('siteurl'),
88 'rest_nonce' => wp_create_nonce('wp_rest'),
89 'plugin_url' => \ShopEngine::plugin_url(),
90 'pricing_page' => \ShopEngine::landing_page(),
91 'form_prefix' => \ShopEngine::SHOPENGINE_PREFIX,
92 'template_types' => json_encode($page_templates),
93 ]);
94
95 wp_enqueue_style('shopengine-admin-style', \ShopEngine::plugin_url() . 'assets/css/admin-style.css', false, \ShopEngine::version());
96 }
97
98 if($screen->id == 'edit-shopengine-entry' || $screen->id == 'shopengine-entry') {
99 wp_enqueue_style('shopengine-ui', \ShopEngine::plugin_url() . 'assets/css/design-ui.css', false, \ShopEngine::version());
100 wp_enqueue_script('shopengine-entry-script', \ShopEngine::plugin_url() . 'assets/js/admin-entry-script.js', array(), \ShopEngine::version(), true);
101 }
102
103 }
104
105
106 function menu_getting_started() {
107 add_menu_page(
108 esc_html__('ShopEngine', 'shopengine'),
109 esc_html__('ShopEngine', 'shopengine'),
110 'manage_options',
111 'shopengine-settings',
112 [$this, 'redirect_to_content'],
113 \ShopEngine::plugin_url() . 'assets/images/icons/shopengine_icon_white.svg',
114 '58.7'
115 );
116
117 add_submenu_page(
118 'shopengine-settings',
119 esc_html__('Getting Started', 'shopengine'),
120 esc_html__('Getting Started', 'shopengine'),
121 'manage_options',
122 $this->menu_link_part . '#getting-started'
123 );
124 }
125
126 public function menu_others(){
127 add_submenu_page(
128 'shopengine-settings',
129 esc_html__('Modules', 'shopengine'),
130 esc_html__('Modules', 'shopengine'),
131 'manage_options',
132 $this->menu_link_part . '#shopengine-modules'
133 );
134
135 add_submenu_page(
136 'shopengine-settings',
137 esc_html__('Widgets', 'shopengine'),
138 esc_html__('Widgets', 'shopengine'),
139 'manage_options',
140 $this->menu_link_part . '#shopengine-widgets'
141 );
142
143 add_submenu_page(
144 'shopengine-settings',
145 esc_html__('Get Help', 'shopengine'),
146 esc_html__('Get Help', 'shopengine'),
147 'manage_options',
148 $this->menu_link_part . '#shopengine-get-help'
149 );
150
151 // license activation & go premium menu links
152 if(\ShopEngine::package_type() != 'free'){ // is pro
153 add_submenu_page(
154 'shopengine-settings',
155 '<span style="color: #49dd85;" class="shopengine_pro_license pro">'.esc_html__('License', 'shopengine').'</span>',
156 '<span style="color: #49dd85;" class="shopengine_pro_license pro">'.esc_html__('License', 'shopengine').'</span>',
157 'manage_options',
158 $this->menu_link_part . '#shopengine-license'
159 );
160 }else{ // is free
161 add_submenu_page(
162 'shopengine-settings',
163 '<span style="color: #f9b015;" class="shopengine_pro_aware pro">'.esc_html__('Upgrade to Premium', 'shopengine').'</span>',
164 '<span style="color: #f9b015;" class="shopengine_pro_aware pro">'.esc_html__('Upgrade to Premium', 'shopengine').'</span>',
165 'manage_options',
166 \ShopEngine::landing_page()
167 );
168 }
169 }
170
171 function redirect_to_content() {
172 wp_redirect($this->menu_link_part . '#getting-started');
173 }
174
175 function content() {
176 $screen = get_current_screen();
177
178 if($screen->id == 'edit-' . Template_Cpt::TYPE) {
179 include_once \ShopEngine::plugin_dir() . 'core/settings/screens/default.php';
180 }
181 }
182
183 }
184