| @@ -1,11 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace ShopEngine; |
| 4 | 4 | |
| 5 | +defined('ABSPATH') || exit; | |
| 6 | + | |
| 5 | 7 | use ShopEngine\Compatibility\Conflicts\Manifest as Conflict_Manifest; |
| 6 | 8 | use ShopEngine\Core\Builders\Base; |
| 9 | +use ShopEngine\Compatibility\Migrations\LangMigration; | |
| 7 | 10 | use ShopEngine\Core\Query_Modifier; |
| 11 | +use ShopEngine\Core\Wc_Customizer\Register_Settings; | |
| 8 | 12 | use ShopEngine\Core\Template_Cpt; |
| 9 | 13 | use ShopEngine\Libs\License\License_Route; |
| 10 | 14 | use ShopEngine\Libs\Rating\Rating; |
| 11 | 15 | use ShopEngine\Libs\Updater\Init as Updater; |
| @@ -11,9 +15,8 @@ | ||
| 11 | 15 | use ShopEngine\Libs\Updater\Init as Updater; |
| 12 | 16 | use ShopEngine\Modules\Manifest as Module_Manifest; |
| 13 | 17 | use ShopEngine\Widgets\Manifest; |
| 14 | 18 | |
| 15 | -defined('ABSPATH') || exit; | |
| 16 | 19 | |
| 17 | 20 | /** |
| 18 | 21 | * Plugin final Class. |
| 19 | 22 | * Handles dynamically loading classes only when needed. Check Elementor Plugin, Woocomerce Plugin Loaded or Install. |
| @@ -30,11 +33,15 @@ | ||
| 30 | 33 | */ |
| 31 | 34 | public function __construct() { |
| 32 | 35 | // load autoload method |
| 33 | 36 | Autoloader::run(); |
| 37 | + add_action( 'wp_ajax_shopengine_admin_action', [\ShopEngine\Utils\Util::class, 'shopengine_admin_action'] ); | |
| 34 | 38 | } |
| 35 | 39 | |
| 36 | - | |
| 40 | + public function utils_url() | |
| 41 | + { | |
| 42 | + return $this->plugin_url() . 'utils/'; | |
| 43 | + } | |
| 37 | 44 | /** |
| 38 | 45 | * Public function init. |
| 39 | 46 | * call function for all |
| 40 | 47 | * |
| @@ -43,8 +50,11 @@ | ||
| 43 | 50 | public function init() { |
| 44 | 51 | |
| 45 | 52 | $error = false; |
| 46 | 53 | |
| 54 | + // init notice class | |
| 55 | + \Oxaim\Libs\Notice::init(); | |
| 56 | + | |
| 47 | 57 | // check woocommerce plugin |
| 48 | 58 | if(!did_action('woocommerce_loaded')) { |
| 49 | 59 | add_action('admin_notices', [$this, 'missing_woocommerce']); |
| 50 | 60 | |
| @@ -74,12 +84,14 @@ | ||
| 74 | 84 | |
| 75 | 85 | if($error) { |
| 76 | 86 | return; |
| 77 | 87 | } |
| 78 | - | |
| 88 | + | |
| 79 | 89 | add_filter("plugin_action_links_shopengine/shopengine.php", function ($links) { |
| 90 | + $free = esc_html__("Go To Shopengine","shopengine"); | |
| 91 | + $pro = esc_html__("Go To ShopenginePro","shopengine"); | |
| 80 | 92 | |
| 81 | - $custom_links[] = '<a href="'.admin_url('edit.php?post_type=shopengine-template#getting-started').'" target="_blank">' . esc_html__('Settings', 'shopengine') . '</a>'; | |
| 93 | + $custom_links[] = '<a title="' . $free . '" href="'.admin_url('edit.php?post_type=shopengine-template#getting-started').'" target="_blank">' . esc_html__('Settings', 'shopengine') . '</a>'; | |
| 82 | 94 | |
| 83 | 95 | foreach ($custom_links as $custom_link): |
| 84 | 96 | array_unshift($links, $custom_link); |
| 85 | 97 | endforeach; |
| @@ -84,14 +96,35 @@ | ||
| 84 | 96 | array_unshift($links, $custom_link); |
| 85 | 97 | endforeach; |
| 86 | 98 | |
| 87 | 99 | if (!is_plugin_active('shopengine-pro/shopengine-pro.php')) { |
| 88 | - $links[] = '<a href="https://wpmet.com/plugin/shopengine/pricing/" style="color:#FCB214;font-weight:700" target="_blank">' . esc_html__('Go Pro', 'shopengine') . '</a>'; | |
| 100 | + $links[] = '<a title="' . $pro . '" href="https://wpmet.com/plugin/shopengine/pricing/" style="color:#FCB214;font-weight:700" target="_blank" rel="noopener">' . esc_html__('Go Pro', 'shopengine') . '</a>'; | |
| 89 | 101 | } |
| 90 | 102 | return $links; |
| 91 | 103 | }); |
| 92 | 104 | |
| 105 | + if(\ShopEngine\Utils\Util::get_settings( 'shopengine_user_consent_for_banner', 'true' ) == 'true'){ | |
| 106 | + | |
| 107 | + /** | |
| 108 | + * EmailKit Global Class initialization | |
| 109 | + * | |
| 110 | + */ | |
| 111 | + if( !class_exists('EmailKit') && !did_action('edit_with_emailkit_loaded') && class_exists('\Wpmet\Libs\Emailkit') ) { | |
| 112 | + | |
| 113 | + new \Wpmet\Libs\Emailkit(); | |
| 114 | + } | |
| 115 | + | |
| 116 | + /** | |
| 117 | + * MetForm get free templates promotional class initialization | |
| 118 | + * | |
| 119 | + */ | |
| 120 | + if( !did_action('metform/after_load') && did_action('elementor/loaded') && class_exists('\Wpmet\Libs\Metform_Promo_Banner') ) { | |
| 121 | + | |
| 122 | + new \Wpmet\Libs\Metform_Promo_Banner(); | |
| 123 | + } | |
| 124 | + } | |
| 93 | 125 | |
| 126 | + | |
| 94 | 127 | /** |
| 95 | 128 | * Routes initialization |
| 96 | 129 | * |
| 97 | 130 | */ |
| @@ -104,45 +137,23 @@ | ||
| 104 | 137 | add_action('admin_init', function () { |
| 105 | 138 | if(class_exists('ShopEngine_Pro')) { |
| 106 | 139 | new Updater(); |
| 107 | 140 | } |
| 141 | + new \ShopEngine\Compatibility\Migrations\Direct_Checkout; | |
| 108 | 142 | }); |
| 109 | 143 | |
| 110 | 144 | |
| 111 | 145 | add_action('wp_loaded', function () { |
| 112 | - | |
| 113 | - if(isset($_REQUEST['preview']) && $_REQUEST['preview'] == 'true' && !empty($_REQUEST['preview_id'])) { | |
| 114 | - | |
| 115 | - $pid = (int)$_REQUEST['preview_id']; | |
| 116 | - | |
| 117 | - $po = get_post($pid); | |
| 118 | - | |
| 119 | - if($po->post_type === Template_Cpt::TYPE) { | |
| 120 | - | |
| 121 | - $template = \ShopEngine\Core\Builders\Templates::get_registered_template_data($pid); | |
| 122 | - | |
| 123 | - if(empty($template) || !isset($template['url'])) { | |
| 124 | - return; | |
| 125 | - } | |
| 126 | - | |
| 127 | - $param = [ | |
| 128 | - 'shopengine_template_id' => $pid, | |
| 129 | - 'preview_nonce' => wp_create_nonce('template_preview_' . $pid), | |
| 130 | - 'change_template' => '1', | |
| 131 | - ]; | |
| 132 | - | |
| 133 | - $url = \ShopEngine\Utils\Helper::add_to_url($template['url'], $param); | |
| 134 | - | |
| 135 | - wp_safe_redirect($url); | |
| 136 | - exit; | |
| 137 | - } | |
| 138 | - } | |
| 146 | + /** | |
| 147 | + * migrate data | |
| 148 | + */ | |
| 149 | + LangMigration::instance()->init(); | |
| 139 | 150 | }); |
| 140 | 151 | |
| 141 | 152 | // avoid themes for loading woocommerce functions |
| 142 | - $avoid_themes = ['avada', 'avada child']; | |
| 153 | + $avoid_themes = ['avada', 'woodmart', 'Avada', 'Woodmart']; | |
| 143 | 154 | |
| 144 | - if(!in_array(strtolower(wp_get_theme()), $avoid_themes)) { | |
| 155 | + if( !in_array(get_template(), $avoid_themes) ) { | |
| 145 | 156 | /** |
| 146 | 157 | * Ensuring woocommerce functions are loaded before theme is modifying those |
| 147 | 158 | * |
| 148 | 159 | */ |
| @@ -169,27 +180,152 @@ | ||
| 169 | 180 | add_theme_support('wc-product-gallery-lightbox'); |
| 170 | 181 | add_theme_support('wc-product-gallery-slider'); |
| 171 | 182 | } |
| 172 | 183 | |
| 184 | + | |
| 185 | + $filter_string = ''; // elementskit,metform-pro | |
| 186 | + $filter_string .= ((!in_array('elementskit/elementskit.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',elementskit'); | |
| 187 | + $filter_string .= (!class_exists('\MetForm\Plugin') ? '' : ',metform'); | |
| 188 | + $filter_string .= (!class_exists('\MetForm_Pro\Plugin') ? '' : ',metform-pro'); | |
| 189 | + | |
| 173 | 190 | #Registering new post-type & etc |
| 174 | 191 | Base::instance()->init(); |
| 192 | + | |
| 175 | 193 | |
| 176 | 194 | Rating::instance('shopengine') |
| 177 | 195 | ->set_plugin( 'ShopEngine', 'https://wpmet.com/wordpress.org/rating/shopengine' ) |
| 196 | + ->set_rating_url( 'https://wordpress.org/support/plugin/shopengine/reviews/#new-post' ) | |
| 178 | 197 | ->set_plugin_logo( 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061', 'width:150px !important' ) |
| 179 | - ->set_priority( 10 ) | |
| 198 | + ->set_priority( 11 ) | |
| 180 | 199 | ->set_first_appear_day( 7 ) |
| 181 | 200 | ->set_condition( true ) |
| 182 | 201 | ->call(); |
| 202 | + | |
| 203 | + if ( is_admin() && \ShopEngine\Utils\Util::get_settings( 'shopengine_user_consent_for_banner', 'true' ) == 'true' ) { | |
| 183 | 204 | |
| 205 | + /** | |
| 206 | + * Show WPMET stories widget in dashboard | |
| 207 | + */ | |
| 208 | + | |
| 209 | + \Wpmet\Libs\Stories::instance('shopengine') | |
| 210 | + | |
| 211 | + ->set_filter($filter_string) | |
| 212 | + ->set_plugin('ShopEngine', 'https://wpmet.com/plugin/shopengine/') | |
| 213 | + ->set_api_url('https://api.wpmet.com/public/stories/') | |
| 214 | + ->call(); | |
| 215 | + | |
| 216 | + // banner | |
| 217 | + \Wpmet\Libs\Banner::instance('shopengine') | |
| 218 | + ->set_filter(ltrim($filter_string, ',')) | |
| 219 | + ->set_api_url('https://api.wpmet.com/public/jhanda') | |
| 220 | + ->set_plugin_screens('edit-shopengine-template') | |
| 221 | + ->set_plugin_screens('edit-shopengine-template') | |
| 222 | + ->call(); | |
| 223 | + } | |
| 224 | + | |
| 225 | + add_action('init', function () { | |
| 226 | + $apps_img_path = \ShopEngine::plugin_url() . 'assets/images/apps-page/'; | |
| 227 | + /** | |
| 228 | + * Show our plugins menu for others wpmet plugins | |
| 229 | + */ | |
| 230 | + \ShopEngine\Wpmet\Libs\Plugins::instance()->init('shopengine') | |
| 231 | + ->set_parent_menu_slug('shopengine-settings') | |
| 232 | + ->set_submenu_name('Our Plugins') | |
| 233 | + ->set_section_title('Get More out of Your WooCommerce Website!') | |
| 234 | + ->set_section_description('Install other plugins from us and take your WooCommerce site to the next level for absolutely free!') | |
| 235 | + ->set_items_per_row(4) | |
| 236 | + ->set_plugins( | |
| 237 | + [ | |
| 238 | + 'elementskit-lite/elementskit-lite.php' => [ | |
| 239 | + 'name' => esc_html__('ElementsKit', 'shopengine'), | |
| 240 | + 'url' => 'https://wordpress.org/plugins/elementskit-lite/', | |
| 241 | + 'icon' => $apps_img_path. 'elementskit.gif', | |
| 242 | + 'desc' => esc_html__('All-in-one Elementor addon trusted by 1 Million+ users, makes your website builder process easier with ultimate freedom.', 'shopengine'), | |
| 243 | + 'docs' => 'https://wpmet.com/doc/elementskit/', | |
| 244 | + ], | |
| 245 | + 'getgenie/getgenie.php' => [ | |
| 246 | + 'name' => esc_html__('GetGenie', 'shopengine'), | |
| 247 | + 'url' => 'https://wordpress.org/plugins/getgenie/', | |
| 248 | + 'icon' => $apps_img_path.'getgenie.gif', | |
| 249 | + 'desc' => esc_html__('Your personal AI assistant for content and SEO. Write content that ranks on Google with NLP keywords and SERP analysis data.', 'shopengine'), | |
| 250 | + 'docs' => 'https://getgenie.ai/docs/', | |
| 251 | + ], | |
| 252 | + 'gutenkit-blocks-addon/gutenkit-blocks-addon.php' => [ | |
| 253 | + 'name' => esc_html__('GutenKit', 'shopengine'), | |
| 254 | + 'url' => 'https://wordpress.org/plugins/gutenkit-blocks-addon/', | |
| 255 | + 'icon' => $apps_img_path. 'guten-kit.png', | |
| 256 | + 'desc' => esc_html__('Gutenberg blocks, patterns, and templates that extend the page-building experience using the WordPress block editor.', 'shopengine'), | |
| 257 | + 'docs' => 'https://wpmet.com/doc/gutenkit/', | |
| 258 | + ], | |
| 259 | + 'metform/metform.php' => [ | |
| 260 | + 'name' => esc_html__('MetForm', 'shopengine'), | |
| 261 | + 'url' => 'https://wordpress.org/plugins/metform/', | |
| 262 | + 'icon' => $apps_img_path. 'metform.png', | |
| 263 | + 'desc' => esc_html__('Drag & drop form builder for Elementor to create contact forms, multi-step forms, and more — smoother, faster, and better!', 'shopengine'), | |
| 264 | + 'docs' => 'https://wpmet.com/doc/metform/', | |
| 265 | + ], | |
| 266 | + 'emailkit/EmailKit.php' => [ | |
| 267 | + 'name' => esc_html__('EmailKit', 'shopengine'), | |
| 268 | + 'url' => 'https://wordpress.org/plugins/emailkit/', | |
| 269 | + 'icon' => $apps_img_path . 'emailkit.png', | |
| 270 | + 'desc' => esc_html__('Advanced email customizer for WooCommerce and WordPress. Build, customize, and send emails from WordPress to boost your sales!', 'shopengine'), | |
| 271 | + 'docs' => 'https://wpmet.com/doc/emailkit/', | |
| 272 | + ], | |
| 273 | + 'wp-social/wp-social.php' => [ | |
| 274 | + 'name' => esc_html__('WP Social', 'shopengine'), | |
| 275 | + 'url' => 'https://wordpress.org/plugins/wp-social/', | |
| 276 | + 'icon' => $apps_img_path . 'wp-social.png', | |
| 277 | + 'desc' => esc_html__('Add social share, login, and engagement counter — unified solution for all social media with tons of different styles for your website.', 'shopengine'), | |
| 278 | + 'docs' => 'https://wpmet.com/doc/wp-social/', | |
| 279 | + ], | |
| 280 | + 'wp-ultimate-review/wp-ultimate-review.php' => [ | |
| 281 | + 'name' => esc_html__('WP Ultimate Review', 'shopengine'), | |
| 282 | + 'url' => 'https://wordpress.org/plugins/wp-ultimate-review/', | |
| 283 | + 'icon' => $apps_img_path . 'ultimate-review.png', | |
| 284 | + 'desc' => esc_html__('Collect and showcase reviews on your website to build brand credibility and social proof with the easiest solution.','shopengine'), | |
| 285 | + 'docs' => 'https://wpmet.com/doc/wp-ultimate-review/', | |
| 286 | + ], | |
| 287 | + 'wp-fundraising-donation/wp-fundraising.php' => [ | |
| 288 | + 'name' => esc_html__('FundEngine', 'shopengine'), | |
| 289 | + 'url' => 'https://wordpress.org/plugins/wp-fundraising-donation/', | |
| 290 | + 'icon' => $apps_img_path . 'fundengine.png', | |
| 291 | + 'desc' => esc_html__('Create fundraising, crowdfunding, and donation websites with PayPal and Stripe payment gateway integration.', 'shopengine'), | |
| 292 | + 'docs' => 'https://wpmet.com/doc/fundengine/', | |
| 293 | + ], | |
| 294 | + 'blocks-for-shopengine/shopengine-gutenberg-addon.php' => [ | |
| 295 | + 'name' => esc_html__('Blocks for ShopEngine', 'shopengine'), | |
| 296 | + 'url' => 'https://wordpress.org/plugins/blocks-for-shopengine/', | |
| 297 | + 'icon' => $apps_img_path. 'shopengine.gif', | |
| 298 | + 'desc' => esc_html__('All in one WooCommerce solution for Gutenberg! Build your WooCommerce pages in a block editor with full customization.', 'shopengine'), | |
| 299 | + 'docs' => 'https://wpmet.com/doc/shopengine/shopengine-gutenberg/', | |
| 300 | + ], | |
| 301 | + 'genie-image-ai/genie-image-ai.php' => [ | |
| 302 | + 'name' => esc_html__('Genie Image', 'shopengine'), | |
| 303 | + 'url' => 'https://wordpress.org/plugins/genie-image-ai/', | |
| 304 | + 'icon' => $apps_img_path . 'genie-image.png', | |
| 305 | + 'desc' => esc_html__('AI-powered text-to-image generator for WordPress with OpenAI’s DALL-E 2 technology to generate high-quality images in one click. | |
| 306 | + ', 'shopengine'), | |
| 307 | + 'docs' => 'https://getgenie.ai/docs/', | |
| 308 | + ], | |
| 309 | + ] | |
| 310 | + ) | |
| 311 | + ->call(); | |
| 312 | + | |
| 313 | + // working get instance of elementor widget | |
| 314 | + (new Manifest())->init(); | |
| 315 | + } ); | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + \ShopEngine\Core\MultiLanguage\Language::instance()->init(); | |
| 320 | + | |
| 184 | 321 | \ShopEngine\Core\Settings\Base::instance()->init(); |
| 185 | 322 | |
| 323 | + | |
| 186 | 324 | new Libs\Select_Api\Base(); |
| 187 | 325 | |
| 188 | 326 | (new Module_Manifest())->init(); |
| 189 | 327 | |
| 190 | - // working get instance of elementor widget | |
| 191 | - (new Manifest())->init(); | |
| 192 | 328 | |
| 193 | 329 | Query_Modifier::instance()->init(); |
| 194 | 330 | |
| 195 | 331 | (new Conflict_Manifest())->init(); |
| @@ -198,9 +334,9 @@ | ||
| 198 | 334 | add_action('get_header', [$this, 'shopengine_track_product_views']); |
| 199 | 335 | |
| 200 | 336 | // database migrations |
| 201 | 337 | // (new \ShopEngine\Compatibility\Migrations\Migration())->init(); |
| 202 | - (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init(); | |
| 338 | + // (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init(); | |
| 203 | 339 | |
| 204 | 340 | |
| 205 | 341 | // call service providers |
| 206 | 342 | |
| @@ -214,11 +350,12 @@ | ||
| 214 | 350 | } |
| 215 | 351 | |
| 216 | 352 | } |
| 217 | 353 | |
| 354 | + add_filter('script_loader_tag', [$this, 'filter_load_type'], 99, 3); | |
| 218 | 355 | |
| 219 | - | |
| 220 | - add_filter('script_loader_tag', [$this, 'filter_load_type'], 99, 3); | |
| 356 | + //it will register an option in customizer for woocommerce products catelog. It's related with our Arcive Products widget. | |
| 357 | + Register_Settings::instance()->init(); | |
| 221 | 358 | } |
| 222 | 359 | |
| 223 | 360 | |
| 224 | 361 | // add async and defer attributes to enqueued scripts |
| @@ -250,9 +387,9 @@ | ||
| 250 | 387 | $cookie_name = "shopengine_recent_viewed_product"; |
| 251 | 388 | |
| 252 | 389 | if(isset($_COOKIE[$cookie_name])) { |
| 253 | 390 | |
| 254 | - $cookie_ids = $_COOKIE[$cookie_name]; | |
| 391 | + $cookie_ids = sanitize_text_field(wp_unslash($_COOKIE[$cookie_name])); | |
| 255 | 392 | $product_ids = explode(',', $cookie_ids); |
| 256 | 393 | |
| 257 | 394 | if(!is_array($product_ids)) { |
| 258 | 395 | $product_ids = [$product_ids]; |
| @@ -288,12 +425,10 @@ | ||
| 288 | 425 | * Include public function |
| 289 | 426 | * |
| 290 | 427 | * @since 1.0.0 |
| 291 | 428 | */ |
| 292 | - public function js_css_public() { | |
| 293 | - wp_enqueue_style('shopengine-icon', \ShopEngine::plugin_url() . 'assets/css/shopengine-icon.css', false, \ShopEngine::version()); | |
| 294 | - wp_enqueue_style('shopengine-simple-scrollbar-css', \ShopEngine::plugin_url() . 'assets/css/simple-scrollbar.css', false, \ShopEngine::version()); | |
| 295 | - wp_enqueue_style('shopengine-public-css', \ShopEngine::plugin_url() . 'assets/css/public-style.css', false, \ShopEngine::version()); | |
| 429 | + public function js_css_public() { | |
| 430 | + wp_register_style('shopengine-public', \ShopEngine::plugin_url() . 'assets/css/shopengine-public.css', false, \ShopEngine::version()); | |
| 296 | 431 | |
| 297 | 432 | // Modal Stylesheet |
| 298 | 433 | wp_register_style('shopengine-modal-styles', \ShopEngine::plugin_url() . 'assets/css/shopengine-modal.css', false, \ShopEngine::version()); |
| 299 | 434 | |
| @@ -342,11 +477,11 @@ | ||
| 342 | 477 | |
| 343 | 478 | |
| 344 | 479 | public function missing_woocommerce() { |
| 345 | 480 | |
| 346 | - if(isset($_GET['activate'])) { | |
| 347 | - unset($_GET['activate']); | |
| 348 | - } | |
| 481 | + if(!current_user_can('manage_options')) { | |
| 482 | + return; | |
| 483 | + } | |
| 349 | 484 | |
| 350 | 485 | if(file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')) { |
| 351 | 486 | |
| 352 | 487 | $btn['label'] = esc_html__('Activate WooCommerce', 'shopengine'); |
| @@ -362,8 +497,9 @@ | ||
| 362 | 497 | [ |
| 363 | 498 | 'id' => 'missing-woo', |
| 364 | 499 | 'type' => 'error', |
| 365 | 500 | 'dismissible' => true, |
| 501 | + 'is_required' => true, | |
| 366 | 502 | 'btn' => $btn, |
| 367 | 503 | 'message' => sprintf(esc_html__('ShopEngine requires woocommerce Plugin, which is currently NOT RUNNING.', 'shopengine'), '4.1.0'), |
| 368 | 504 | ] |
| 369 | 505 | ); |
| @@ -371,11 +507,11 @@ | ||
| 371 | 507 | |
| 372 | 508 | |
| 373 | 509 | public function missing_elementor() { |
| 374 | 510 | |
| 375 | - if(isset($_GET['activate'])) { | |
| 376 | - unset($_GET['activate']); | |
| 377 | - } | |
| 511 | + if(!current_user_can('manage_options')) { | |
| 512 | + return; | |
| 513 | + } | |
| 378 | 514 | |
| 379 | 515 | if(file_exists(WP_PLUGIN_DIR . '/elementor/elementor.php')) { |
| 380 | 516 | |
| 381 | 517 | $btn['label'] = esc_html__('Activate Elementor', 'shopengine'); |
| @@ -386,15 +522,28 @@ | ||
| 386 | 522 | $btn['label'] = esc_html__('Install Elementor', 'shopengine'); |
| 387 | 523 | $btn['url'] = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=elementor'), 'install-plugin_elementor'); |
| 388 | 524 | } |
| 389 | 525 | |
| 526 | + if(file_exists(WP_PLUGIN_DIR . '/blocks-for-shopengine/shopengine-gutenberg-addon.php')) { | |
| 527 | + | |
| 528 | + $btn2['label'] = esc_html__('Activate Blocks for ShopEngine', 'shopengine'); | |
| 529 | + $btn2['url'] = wp_nonce_url('plugins.php?action=activate&plugin=blocks-for-shopengine/shopengine-gutenberg-addon.php&plugin_status=all&paged=1', 'activate-plugin_blocks-for-shopengine/shopengine-gutenberg-addon.php'); | |
| 530 | + | |
| 531 | + } else { | |
| 532 | + | |
| 533 | + $btn2['label'] = esc_html__('Install Blocks for ShopEngine', 'shopengine'); | |
| 534 | + $btn2['url'] = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=blocks-for-shopengine'), 'install-plugin_blocks-for-shopengine'); | |
| 535 | + } | |
| 536 | + | |
| 390 | 537 | Utils\Notice::push( |
| 391 | 538 | [ |
| 392 | 539 | 'id' => 'missing-elementor', |
| 393 | 540 | 'type' => 'error', |
| 541 | + 'is_required' => true, | |
| 394 | 542 | 'dismissible' => true, |
| 395 | 543 | 'btn' => $btn, |
| 396 | - 'message' => sprintf(esc_html__('ShopEngine requires Elementor version %1$s+, which is currently NOT RUNNING.', 'shopengine'), '3.0.0'), | |
| 544 | + 'btn2' => $btn2, | |
| 545 | + 'message' => esc_html__('To use ShopEngine, install Elementor (For the Elementor Builder) OR Blocks for ShopEngine (For Gutenberg Builder).', 'shopengine'), | |
| 397 | 546 | ] |
| 398 | 547 | ); |
| 399 | 548 | } |
| 400 | 549 | |
| @@ -399,8 +548,12 @@ | ||
| 399 | 548 | } |
| 400 | 549 | |
| 401 | 550 | |
| 402 | 551 | public function failed_elementor_version() { |
| 552 | + | |
| 553 | + if(!current_user_can('manage_options')) { | |
| 554 | + return; | |
| 555 | + } | |
| 403 | 556 | |
| 404 | 557 | $btn['label'] = esc_html__('Update Elementor', 'shopengine'); |
| 405 | 558 | $btn['url'] = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=elementor'), 'upgrade-plugin_elementor'); |
| 406 | 559 | |