| @@ -1,22 +1,37 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 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.6.3 | |
| 5 | + * Plugin URI: https://storekit.pro/ | |
| 6 | + * Description: Build online stores in WordPress with the powerful store builder addon for Elementor. Enjoy a wide range of customizations and easily build product grids, carousels, single product/page elements, checkouts and more. | |
| 7 | + * Version: 3.1.4 | |
| 8 | 8 | * Author: BdThemes |
| 9 | 9 | * Author URI: https://bdthemes.com/ |
| 10 | 10 | * Text Domain: ultimate-store-kit |
| 11 | 11 | * Domain Path: /languages |
| 12 | 12 | * License: GPL3 |
| 13 | - * Elementor requires at least: 3.0.0 | |
| 14 | - * Elementor tested up to: 3.21.8 | |
| 13 | + * Elementor requires at least: 4.0.0 | |
| 14 | + * Elementor tested up to: 4.2.4 | |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | + | |
| 18 | + | |
| 19 | +if (! defined('ABSPATH')) { | |
| 20 | + exit; // Exit if accessed directly | |
| 21 | +} | |
| 22 | + | |
| 23 | +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals -- BDTUSK_ / ultimate_store_kit_ / ultimate-store-kit- are this plugin's established public prefixes. | |
| 24 | + | |
| 25 | +// Check if vendor directory and autoload.php exist | |
| 26 | +$ultimate_store_kit_autoload_file = __DIR__ . '/vendor/autoload.php'; | |
| 27 | +if (file_exists($ultimate_store_kit_autoload_file)) { | |
| 28 | + // Load autoloader (vendor/autoload.php). | |
| 29 | + require_once $ultimate_store_kit_autoload_file; | |
| 30 | +} | |
| 31 | + | |
| 17 | 32 | // Some pre define value for easy use |
| 18 | -define('BDTUSK_VER', '1.6.3'); | |
| 33 | +define('BDTUSK_VER', '3.1.4'); | |
| 19 | 34 | define('BDTUSK__FILE__', __FILE__); |
| 20 | 35 | define('BDTUSK_PNAME', basename(dirname(BDTUSK__FILE__))); |
| 21 | 36 | define('BDTUSK_PBNAME', plugin_basename(BDTUSK__FILE__)); |
| 22 | 37 | define('BDTUSK_PATH', plugin_dir_path(BDTUSK__FILE__)); |
| @@ -28,32 +43,22 @@ | ||
| 28 | 43 | define('BDTUSK_ASSETS_URL', BDTUSK_URL . 'assets/'); |
| 29 | 44 | define('BDTUSK_ASSETS_PATH', BDTUSK_PATH . 'assets/'); |
| 30 | 45 | define('BDTUSK_MODULES_URL', BDTUSK_URL . 'modules/'); |
| 31 | 46 | define('BDTUSK_ADM_PATH', BDTUSK_PATH . 'admin/'); |
| 32 | -define('BDTUSK_ADM_ASSETS_URL', BDTUSK_URL . 'admin/assets/'); | |
| 47 | +define('BDTUSK_ADM_ASSETS_URL', BDTUSK_URL . 'includes/Admin/assets/'); | |
| 48 | +define('BDTUSK_BUILD_URL', BDTUSK_URL . 'build/'); | |
| 33 | 49 | |
| 34 | 50 | define('BDTUSK_TITLE', 'Ultimate Store Kit'); |
| 35 | 51 | |
| 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'); | |
| 52 | +if (! function_exists('ultimate_store_kit_is_pro_installed')) { | |
| 44 | 53 | |
| 54 | + function ultimate_store_kit_is_pro_installed() { | |
| 45 | 55 | |
| 46 | - | |
| 47 | -if (!function_exists('_is_usk_pro_installed')) { | |
| 48 | - | |
| 49 | - function _is_usk_pro_installed() { | |
| 50 | - | |
| 51 | - if (!function_exists('get_plugins')) { | |
| 56 | + if (! function_exists('get_plugins')) { | |
| 52 | 57 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 53 | 58 | } |
| 54 | 59 | |
| 55 | - $file_path = 'ultimate-store-kit-pro/ultimate-store-kit-pro.php'; | |
| 60 | + $file_path = 'ultimate-store-kit-pro/ultimate-store-kit-pro.php'; | |
| 56 | 61 | $installed_plugins = get_plugins(); |
| 57 | 62 | |
| 58 | 63 | return isset($installed_plugins[$file_path]); |
| 59 | 64 | } |
| @@ -58,17 +63,17 @@ | ||
| 58 | 63 | return isset($installed_plugins[$file_path]); |
| 59 | 64 | } |
| 60 | 65 | } |
| 61 | 66 | |
| 62 | -if (!function_exists('_is_usk_pro_activated')) { | |
| 67 | +if (! function_exists('ultimate_store_kit_is_pro_activated')) { | |
| 63 | 68 | |
| 64 | - function _is_usk_pro_activated() { | |
| 69 | + function ultimate_store_kit_is_pro_activated() { | |
| 65 | 70 | |
| 66 | - if (!function_exists('get_plugins')) { | |
| 71 | + if (! function_exists('get_plugins')) { | |
| 67 | 72 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 68 | 73 | } |
| 69 | 74 | |
| 70 | - $file_path = 'ultimate-store-kit-pro/ultimate-store-kit-pro.php'; | |
| 75 | + $file_path = 'ultimate-store-kit-pro/ultimate-store-kit-pro.php'; | |
| 71 | 76 | $installed_plugins = get_plugins(); |
| 72 | 77 | |
| 73 | 78 | if (is_plugin_active($file_path)) { |
| 74 | 79 | return true; |
| @@ -80,13 +85,13 @@ | ||
| 80 | 85 | |
| 81 | 86 | // Helper function here |
| 82 | 87 | require(dirname(__FILE__) . '/includes/helper.php'); |
| 83 | 88 | |
| 84 | -if (!_is_usk_pro_activated()) { | |
| 89 | +if (! ultimate_store_kit_is_pro_activated()) { | |
| 85 | 90 | require_once BDTUSK_INC_PATH . 'class-pro-widget-map.php'; |
| 86 | 91 | } |
| 87 | 92 | |
| 88 | -if (function_exists('usk_license_validation') && true !== usk_license_validation()) { | |
| 93 | +if (function_exists('ultimate_store_kit_license_validation') && true !== ultimate_store_kit_license_validation()) { | |
| 89 | 94 | require_once BDTUSK_INC_PATH . 'class-pro-widget-map.php'; |
| 90 | 95 | } |
| 91 | 96 | |
| 92 | 97 | require(dirname(__FILE__) . '/includes/utils.php'); |
| @@ -96,16 +101,15 @@ | ||
| 96 | 101 | * Plugin load here correctly |
| 97 | 102 | * Also loaded the language file from here |
| 98 | 103 | */ |
| 99 | 104 | function bdthemes_ultimate_store_kit_load_plugin() { |
| 100 | - load_plugin_textdomain('ultimate-store-kit', false, basename(dirname(__FILE__)) . '/languages'); | |
| 101 | 105 | |
| 102 | - if (!did_action('elementor/loaded')) { | |
| 106 | + if (! did_action('elementor/loaded')) { | |
| 103 | 107 | add_action('admin_notices', 'bdthemes_ultimate_store_kit_fail_load'); |
| 104 | 108 | return; |
| 105 | 109 | } |
| 106 | 110 | |
| 107 | - if ((!class_exists('Easy_Digital_Downloads')) && (!class_exists('woocommerce'))) { | |
| 111 | + if ((! class_exists('Easy_Digital_Downloads')) && (! class_exists('woocommerce'))) { | |
| 108 | 112 | add_action('admin_notices', 'bdthemes_ultimate_store_kit_dependencies_plugin_fail_load'); |
| 109 | 113 | return; |
| 110 | 114 | } |
| 111 | 115 | |
| @@ -113,11 +117,8 @@ | ||
| 113 | 117 | require(BDTUSK_INC_PATH . 'ultimate-store-kit-filters.php'); |
| 114 | 118 | |
| 115 | 119 | // Element pack widget and assets loader |
| 116 | 120 | require(BDTUSK_PATH . 'loader.php'); |
| 117 | - | |
| 118 | - // Notice class | |
| 119 | - require(BDTUSK_ADM_PATH . 'admin-notice.php'); | |
| 120 | 121 | } |
| 121 | 122 | add_action('plugins_loaded', 'bdthemes_ultimate_store_kit_load_plugin', 9); |
| 122 | 123 | |
| 123 | 124 | |
| @@ -131,20 +132,20 @@ | ||
| 131 | 132 | } |
| 132 | 133 | |
| 133 | 134 | $plugin = 'elementor/elementor.php'; |
| 134 | 135 | |
| 135 | - if (_is_dep_plugin_installed($plugin)) { | |
| 136 | - if (!current_user_can('activate_plugins')) { | |
| 136 | + if (ultimate_store_kit_is_dependency_plugin_installed($plugin)) { | |
| 137 | + if (! current_user_can('activate_plugins')) { | |
| 137 | 138 | return; |
| 138 | 139 | } |
| 139 | 140 | $activation_url = wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&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>' . esc_html__('Ops! Ultimate Store Kit not working because you need to activate the Elementor plugin first.', 'ultimate-store-kit') . '</p>'; | |
| 141 | 142 | $admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__('Activate Elementor Now', 'ultimate-store-kit')) . '</p>'; |
| 142 | 143 | } else { |
| 143 | - if (!current_user_can('install_plugins')) { | |
| 144 | + if (! current_user_can('install_plugins')) { | |
| 144 | 145 | return; |
| 145 | 146 | } |
| 146 | - $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=elementor'), 'install-plugin_elementor'); | |
| 147 | + $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=elementor'), 'install-plugin_elementor'); | |
| 147 | 148 | $admin_message = '<p>' . esc_html__('Ops! Ultimate Store Kit not working because you need to install the Elementor plugin', 'ultimate-store-kit') . '</p>'; |
| 148 | 149 | $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 | } |
| 150 | 151 | |
| @@ -161,65 +162,38 @@ | ||
| 161 | 162 | } |
| 162 | 163 | |
| 163 | 164 | $plugin = 'woocommerce/woocommerce.php'; |
| 164 | 165 | |
| 165 | - | |
| 166 | - | |
| 167 | - | |
| 168 | - | |
| 169 | - if (_is_dep_plugin_installed($plugin)) { | |
| 170 | - if (!current_user_can('activate_plugins')) { | |
| 166 | + if (ultimate_store_kit_is_dependency_plugin_installed($plugin)) { | |
| 167 | + if (! current_user_can('activate_plugins')) { | |
| 171 | 168 | return; |
| 172 | 169 | } |
| 170 | + $activation_url = wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin); | |
| 173 | 171 | $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>'; |
| 172 | + $admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__('Activate WooCommerce Now', 'ultimate-store-kit')) . '</p>'; | |
| 174 | 173 | } else { |
| 175 | - if (!current_user_can('install_plugins')) { | |
| 174 | + if (! current_user_can('install_plugins')) { | |
| 176 | 175 | return; |
| 177 | 176 | } |
| 177 | + $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=woocommerce'), 'install-plugin_woocommerce'); | |
| 178 | 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 | + $admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__('Install WooCommerce Now', 'ultimate-store-kit')) . '</p>'; | |
| 179 | 180 | } |
| 180 | 181 | |
| 181 | 182 | printf('<div class="error">%1$s</div>', wp_kses_post($admin_message)); |
| 182 | 183 | } |
| 183 | 184 | |
| 185 | +if (! function_exists('ultimate_store_kit_is_dependency_plugin_installed')) { | |
| 184 | 186 | |
| 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&plugin=' . $plugin . '&plugin_status=all&paged=1&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>', wp_kses_post($admin_message)); | |
| 213 | -} | |
| 214 | - | |
| 215 | -if (!function_exists('_is_dep_plugin_installed')) { | |
| 216 | - | |
| 217 | 187 | /** |
| 218 | 188 | * @plug_slug string plugins slug which you want to check installed or not |
| 219 | 189 | */ |
| 220 | - function _is_dep_plugin_installed($plugin_slug) { | |
| 221 | - $file_path = $plugin_slug; | |
| 190 | + function ultimate_store_kit_is_dependency_plugin_installed($plugin_slug) { | |
| 191 | + if (! function_exists('get_plugins')) { | |
| 192 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 193 | + } | |
| 194 | + | |
| 195 | + $file_path = $plugin_slug; | |
| 222 | 196 | $installed_plugins = get_plugins(); |
| 223 | 197 | |
| 224 | 198 | return isset($installed_plugins[$file_path]); |
| 225 | 199 | } |