| @@ -1,226 +1,200 @@ | ||
| 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.0 | |
| 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.15.2 | |
| 15 | - */ | |
| 16 | - | |
| 17 | -// Some pre define value for easy use | |
| 18 | -define('BDTUSK_VER', '1.5.0'); | |
| 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&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>' . 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&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>', $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 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Plugin Name: Ultimate Store Kit | |
| 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 | + * 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: 4.0.0 | |
| 14 | + * Elementor tested up to: 4.2.4 | |
| 15 | + */ | |
| 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 | + | |
| 32 | +// Some pre define value for easy use | |
| 33 | +define('BDTUSK_VER', '3.1.4'); | |
| 34 | +define('BDTUSK__FILE__', __FILE__); | |
| 35 | +define('BDTUSK_PNAME', basename(dirname(BDTUSK__FILE__))); | |
| 36 | +define('BDTUSK_PBNAME', plugin_basename(BDTUSK__FILE__)); | |
| 37 | +define('BDTUSK_PATH', plugin_dir_path(BDTUSK__FILE__)); | |
| 38 | +define('BDTUSK_URL', plugins_url('/', BDTUSK__FILE__)); | |
| 39 | +define('BDTUSK_MODULES_PATH', BDTUSK_PATH . 'modules/'); | |
| 40 | +define('BDTUSK_INC_PATH', BDTUSK_PATH . 'includes/'); | |
| 41 | +define('BDTUSK_ADMIN_PATH', BDTUSK_PATH . 'admin/'); | |
| 42 | +define('BDTUSK_ADMIN_URL', BDTUSK_URL . 'admin/'); | |
| 43 | +define('BDTUSK_ASSETS_URL', BDTUSK_URL . 'assets/'); | |
| 44 | +define('BDTUSK_ASSETS_PATH', BDTUSK_PATH . 'assets/'); | |
| 45 | +define('BDTUSK_MODULES_URL', BDTUSK_URL . 'modules/'); | |
| 46 | +define('BDTUSK_ADM_PATH', BDTUSK_PATH . 'admin/'); | |
| 47 | +define('BDTUSK_ADM_ASSETS_URL', BDTUSK_URL . 'includes/Admin/assets/'); | |
| 48 | +define('BDTUSK_BUILD_URL', BDTUSK_URL . 'build/'); | |
| 49 | + | |
| 50 | +define('BDTUSK_TITLE', 'Ultimate Store Kit'); | |
| 51 | + | |
| 52 | +if (! function_exists('ultimate_store_kit_is_pro_installed')) { | |
| 53 | + | |
| 54 | + function ultimate_store_kit_is_pro_installed() { | |
| 55 | + | |
| 56 | + if (! function_exists('get_plugins')) { | |
| 57 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 58 | + } | |
| 59 | + | |
| 60 | + $file_path = 'ultimate-store-kit-pro/ultimate-store-kit-pro.php'; | |
| 61 | + $installed_plugins = get_plugins(); | |
| 62 | + | |
| 63 | + return isset($installed_plugins[$file_path]); | |
| 64 | + } | |
| 65 | +} | |
| 66 | + | |
| 67 | +if (! function_exists('ultimate_store_kit_is_pro_activated')) { | |
| 68 | + | |
| 69 | + function ultimate_store_kit_is_pro_activated() { | |
| 70 | + | |
| 71 | + if (! function_exists('get_plugins')) { | |
| 72 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 73 | + } | |
| 74 | + | |
| 75 | + $file_path = 'ultimate-store-kit-pro/ultimate-store-kit-pro.php'; | |
| 76 | + $installed_plugins = get_plugins(); | |
| 77 | + | |
| 78 | + if (is_plugin_active($file_path)) { | |
| 79 | + return true; | |
| 80 | + } | |
| 81 | + | |
| 82 | + return false; | |
| 83 | + } | |
| 84 | +} | |
| 85 | + | |
| 86 | +// Helper function here | |
| 87 | +require(dirname(__FILE__) . '/includes/helper.php'); | |
| 88 | + | |
| 89 | +if (! ultimate_store_kit_is_pro_activated()) { | |
| 90 | + require_once BDTUSK_INC_PATH . 'class-pro-widget-map.php'; | |
| 91 | +} | |
| 92 | + | |
| 93 | +if (function_exists('ultimate_store_kit_license_validation') && true !== ultimate_store_kit_license_validation()) { | |
| 94 | + require_once BDTUSK_INC_PATH . 'class-pro-widget-map.php'; | |
| 95 | +} | |
| 96 | + | |
| 97 | +require(dirname(__FILE__) . '/includes/utils.php'); | |
| 98 | + | |
| 99 | + | |
| 100 | +/** | |
| 101 | + * Plugin load here correctly | |
| 102 | + * Also loaded the language file from here | |
| 103 | + */ | |
| 104 | +function bdthemes_ultimate_store_kit_load_plugin() { | |
| 105 | + | |
| 106 | + if (! did_action('elementor/loaded')) { | |
| 107 | + add_action('admin_notices', 'bdthemes_ultimate_store_kit_fail_load'); | |
| 108 | + return; | |
| 109 | + } | |
| 110 | + | |
| 111 | + if ((! class_exists('Easy_Digital_Downloads')) && (! class_exists('woocommerce'))) { | |
| 112 | + add_action('admin_notices', 'bdthemes_ultimate_store_kit_dependencies_plugin_fail_load'); | |
| 113 | + return; | |
| 114 | + } | |
| 115 | + | |
| 116 | + // Widgets filters here | |
| 117 | + require(BDTUSK_INC_PATH . 'ultimate-store-kit-filters.php'); | |
| 118 | + | |
| 119 | + // Element pack widget and assets loader | |
| 120 | + require(BDTUSK_PATH . 'loader.php'); | |
| 121 | +} | |
| 122 | +add_action('plugins_loaded', 'bdthemes_ultimate_store_kit_load_plugin', 9); | |
| 123 | + | |
| 124 | + | |
| 125 | +/** | |
| 126 | + * Check Elementor installed and activated correctly | |
| 127 | + */ | |
| 128 | +function bdthemes_ultimate_store_kit_fail_load() { | |
| 129 | + $screen = get_current_screen(); | |
| 130 | + if (isset($screen->parent_file) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id) { | |
| 131 | + return; | |
| 132 | + } | |
| 133 | + | |
| 134 | + $plugin = 'elementor/elementor.php'; | |
| 135 | + | |
| 136 | + if (ultimate_store_kit_is_dependency_plugin_installed($plugin)) { | |
| 137 | + if (! current_user_can('activate_plugins')) { | |
| 138 | + return; | |
| 139 | + } | |
| 140 | + $activation_url = wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin); | |
| 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>'; | |
| 142 | + $admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__('Activate Elementor Now', 'ultimate-store-kit')) . '</p>'; | |
| 143 | + } else { | |
| 144 | + if (! current_user_can('install_plugins')) { | |
| 145 | + return; | |
| 146 | + } | |
| 147 | + $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=elementor'), 'install-plugin_elementor'); | |
| 148 | + $admin_message = '<p>' . esc_html__('Ops! Ultimate Store Kit not working because you need to install the Elementor plugin', 'ultimate-store-kit') . '</p>'; | |
| 149 | + $admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__('Install Elementor Now', 'ultimate-store-kit')) . '</p>'; | |
| 150 | + } | |
| 151 | + | |
| 152 | + printf('<div class="error">%1$s</div>', wp_kses_post($admin_message)); | |
| 153 | +} | |
| 154 | + | |
| 155 | +/** | |
| 156 | + * Check Woocommerce installed and activated correctly | |
| 157 | + */ | |
| 158 | +function bdthemes_ultimate_store_kit_dependencies_plugin_fail_load() { | |
| 159 | + $screen = get_current_screen(); | |
| 160 | + if (isset($screen->parent_file) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id) { | |
| 161 | + return; | |
| 162 | + } | |
| 163 | + | |
| 164 | + $plugin = 'woocommerce/woocommerce.php'; | |
| 165 | + | |
| 166 | + if (ultimate_store_kit_is_dependency_plugin_installed($plugin)) { | |
| 167 | + if (! current_user_can('activate_plugins')) { | |
| 168 | + return; | |
| 169 | + } | |
| 170 | + $activation_url = wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin); | |
| 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>'; | |
| 173 | + } else { | |
| 174 | + if (! current_user_can('install_plugins')) { | |
| 175 | + return; | |
| 176 | + } | |
| 177 | + $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=woocommerce'), 'install-plugin_woocommerce'); | |
| 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>'; | |
| 180 | + } | |
| 181 | + | |
| 182 | + printf('<div class="error">%1$s</div>', wp_kses_post($admin_message)); | |
| 183 | +} | |
| 184 | + | |
| 185 | +if (! function_exists('ultimate_store_kit_is_dependency_plugin_installed')) { | |
| 186 | + | |
| 187 | + /** | |
| 188 | + * @plug_slug string plugins slug which you want to check installed or not | |
| 189 | + */ | |
| 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; | |
| 196 | + $installed_plugins = get_plugins(); | |
| 197 | + | |
| 198 | + return isset($installed_plugins[$file_path]); | |
| 199 | + } | |
| 200 | +} | |