PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 1.5.2
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v1.5.2
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
ultimate-store-kit / ultimate-store-kit.php

ultimate-store-kit.php in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 1.5.2, at ultimate-store-kit.php

227 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Ultimate Store Kit
5 * Plugin URI: https://bdthemes.com/ultimate-store-kit/
6 * Description: <a href="https://bdthemes.com/ultimate-store-kit/">Ultimate Store Kit</a> is a packed of elementor widgets. This plugin gives you extra widgets features for elementor page builder plugin that help you to build an ecommerce website with woocommerce.
7 * Version: 1.5.2
8 * Author: BdThemes
9 * Author URI: https://bdthemes.com/
10 * Text Domain: ultimate-store-kit
11 * Domain Path: /languages
12 * License: GPL3
13 * Elementor requires at least: 3.0.0
14 * Elementor tested up to: 3.18.3
15 */
16
17 // Some pre define value for easy use
18 define('BDTUSK_VER', '1.5.2');
19 define('BDTUSK__FILE__', __FILE__);
20 define('BDTUSK_PNAME', basename(dirname(BDTUSK__FILE__)));
21 define('BDTUSK_PBNAME', plugin_basename(BDTUSK__FILE__));
22 define('BDTUSK_PATH', plugin_dir_path(BDTUSK__FILE__));
23 define('BDTUSK_URL', plugins_url('/', BDTUSK__FILE__));
24 define('BDTUSK_MODULES_PATH', BDTUSK_PATH . 'modules/');
25 define('BDTUSK_INC_PATH', BDTUSK_PATH . 'includes/');
26 define('BDTUSK_ADMIN_PATH', BDTUSK_PATH . 'admin/');
27 define('BDTUSK_ADMIN_URL', BDTUSK_URL . 'admin/');
28 define('BDTUSK_ASSETS_URL', BDTUSK_URL . 'assets/');
29 define('BDTUSK_ASSETS_PATH', BDTUSK_PATH . 'assets/');
30 define('BDTUSK_MODULES_URL', BDTUSK_URL . 'modules/');
31 define('BDTUSK_ADM_PATH', BDTUSK_PATH . 'admin/');
32 define('BDTUSK_ADM_ASSETS_URL', BDTUSK_URL . 'admin/assets/');
33
34 define('BDTUSK_TITLE', 'Ultimate Store Kit');
35
36 /**
37 * The code that runs during plugin activation.
38 */
39 // function bdthemes_ultimate_store_kit_activate_plugin() {
40 // require_once plugin_dir_path(__FILE__) . 'includes/ultimate-store-kit-activator.php';
41 // Ultimate_Store_Kit_Activator::activate();
42 // }
43 // register_activation_hook(__FILE__, 'bdthemes_ultimate_store_kit_activate_plugin');
44
45
46
47 if (!function_exists('_is_usk_pro_installed')) {
48
49 function _is_usk_pro_installed() {
50
51 if (!function_exists('get_plugins')) {
52 require_once ABSPATH . 'wp-admin/includes/plugin.php';
53 }
54
55 $file_path = 'ultimate-store-kit-pro/ultimate-store-kit-pro.php';
56 $installed_plugins = get_plugins();
57
58 return isset($installed_plugins[$file_path]);
59 }
60 }
61
62 if (!function_exists('_is_usk_pro_activated')) {
63
64 function _is_usk_pro_activated() {
65
66 if (!function_exists('get_plugins')) {
67 require_once ABSPATH . 'wp-admin/includes/plugin.php';
68 }
69
70 $file_path = 'ultimate-store-kit-pro/ultimate-store-kit-pro.php';
71 $installed_plugins = get_plugins();
72
73 if (is_plugin_active($file_path)) {
74 return true;
75 }
76
77 return false;
78 }
79 }
80
81 // Helper function here
82 require(dirname(__FILE__) . '/includes/helper.php');
83
84 if (!_is_usk_pro_activated()) {
85 require_once BDTUSK_INC_PATH . 'class-pro-widget-map.php';
86 }
87
88 if (function_exists('usk_license_validation') && true !== usk_license_validation()) {
89 require_once BDTUSK_INC_PATH . 'class-pro-widget-map.php';
90 }
91
92 require(dirname(__FILE__) . '/includes/utils.php');
93
94
95 /**
96 * Plugin load here correctly
97 * Also loaded the language file from here
98 */
99 function bdthemes_ultimate_store_kit_load_plugin() {
100 load_plugin_textdomain('ultimate-store-kit', false, basename(dirname(__FILE__)) . '/languages');
101
102 if (!did_action('elementor/loaded')) {
103 add_action('admin_notices', 'bdthemes_ultimate_store_kit_fail_load');
104 return;
105 }
106
107 if ((!class_exists('Easy_Digital_Downloads')) && (!class_exists('woocommerce'))) {
108 add_action('admin_notices', 'bdthemes_ultimate_store_kit_dependencies_plugin_fail_load');
109 return;
110 }
111
112 // Widgets filters here
113 require(BDTUSK_INC_PATH . 'ultimate-store-kit-filters.php');
114
115 // Element pack widget and assets loader
116 require(BDTUSK_PATH . 'loader.php');
117
118 // Notice class
119 require(BDTUSK_ADM_PATH . 'admin-notice.php');
120 }
121 add_action('plugins_loaded', 'bdthemes_ultimate_store_kit_load_plugin', 9);
122
123
124 /**
125 * Check Elementor installed and activated correctly
126 */
127 function bdthemes_ultimate_store_kit_fail_load() {
128 $screen = get_current_screen();
129 if (isset($screen->parent_file) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id) {
130 return;
131 }
132
133 $plugin = 'elementor/elementor.php';
134
135 if (_is_dep_plugin_installed($plugin)) {
136 if (!current_user_can('activate_plugins')) {
137 return;
138 }
139 $activation_url = wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin);
140 $admin_message = '<p>' . esc_html__('Ops! Ultimate Store Kit not working because you need to activate the Elementor plugin first.', 'ultimate-store-kit') . '</p>';
141 $admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__('Activate Elementor Now', 'ultimate-store-kit')) . '</p>';
142 } else {
143 if (!current_user_can('install_plugins')) {
144 return;
145 }
146 $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=elementor'), 'install-plugin_elementor');
147 $admin_message = '<p>' . esc_html__('Ops! Ultimate Store Kit not working because you need to install the Elementor plugin', 'ultimate-store-kit') . '</p>';
148 $admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__('Install Elementor Now', 'ultimate-store-kit')) . '</p>';
149 }
150
151 printf('<div class="error">%1$s</div>', $admin_message);
152 }
153
154 /**
155 * Check Woocommerce installed and activated correctly
156 */
157 function bdthemes_ultimate_store_kit_dependencies_plugin_fail_load() {
158 $screen = get_current_screen();
159 if (isset($screen->parent_file) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id) {
160 return;
161 }
162
163 $plugin = 'woocommerce/woocommerce.php';
164
165
166
167
168
169 if (_is_dep_plugin_installed($plugin)) {
170 if (!current_user_can('activate_plugins')) {
171 return;
172 }
173 $admin_message = '<p>' . esc_html__('Ops! Ultimate Store Kit not working because you need to activate a eCommerce plugin like WooCommerce or Easy Digital Downloads first.', 'ultimate-store-kit') . '</p>';
174 } else {
175 if (!current_user_can('install_plugins')) {
176 return;
177 }
178 $admin_message = '<p>' . esc_html__('Ops! Ultimate Store Kit not working because you need to install a eCommerce plugin like WooCommerce or Easy Digital Download first.', 'ultimate-store-kit') . '</p>';
179 }
180
181 printf('<div class="error">%1$s</div>', $admin_message);
182 }
183
184
185 /**
186 * Check Woocommerce installed and activated correctly
187 */
188 function bdthemes_ultimate_store_kit_easy_digital_downloads_fail_load() {
189 $screen = get_current_screen();
190 if (isset($screen->parent_file) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id) {
191 return;
192 }
193
194 $plugin = 'easy-digital-downloads/easy-digital-downloads.php';
195
196 if (_is_dep_plugin_installed($plugin)) {
197 if (!current_user_can('activate_plugins')) {
198 return;
199 }
200 $activation_url = wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin);
201 $admin_message = '<p>' . esc_html__('Ops! Ultimate Store Kit not working because you need to activate the Easy Digital Donwlaods plugin first.', 'ultimate-store-kit') . '</p>';
202 $admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__('Activate Easy Digital Donwlaods Now', 'ultimate-store-kit')) . '</p>';
203 } else {
204 if (!current_user_can('install_plugins')) {
205 return;
206 }
207 $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=easy-digital-downloads'), 'install-plugin_easy_digital_downloads');
208 $admin_message = '<p>' . esc_html__('Ops! Ultimate Store Kit not working because you need to install the Easy Digital Downloads plugin', 'ultimate-store-kit') . '</p>';
209 $admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__('Install Easy Digital Downloads Now', 'ultimate-store-kit')) . '</p>';
210 }
211
212 printf('<div class="error">%1$s</div>', $admin_message);
213 }
214
215 if (!function_exists('_is_dep_plugin_installed')) {
216
217 /**
218 * @plug_slug string plugins slug which you want to check installed or not
219 */
220 function _is_dep_plugin_installed($plugin_slug) {
221 $file_path = $plugin_slug;
222 $installed_plugins = get_plugins();
223
224 return isset($installed_plugins[$file_path]);
225 }
226 }
227