PluginProbe
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets / 4.9.0
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets v4.9.0
4.9.5 4.9.4 4.9.3 4.9.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 All 85 releases
← All changes | plugin.php +243 -51 2.3.04.9.0 View file →
@@ -1,19 +1,23 @@
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;
12 16 use ShopEngine\Modules\Manifest as Module_Manifest;
17 +use ShopEngine\Utils\Feedback\Plugin_Unsubscribe;
13 18 use ShopEngine\Widgets\Manifest;
14 19
15 -defined('ABSPATH') || exit;
16 20
17 21 /**
18 22 * Plugin final Class.
19 23 * Handles dynamically loading classes only when needed. Check Elementor Plugin, Woocomerce Plugin Loaded or Install.
@@ -30,11 +34,15 @@
30 34 */
31 35 public function __construct() {
32 36 // load autoload method
33 37 Autoloader::run();
38 + add_action( 'wp_ajax_shopengine_admin_action', [\ShopEngine\Utils\Util::class, 'shopengine_admin_action'] );
34 39 }
35 40
36 -
41 + public function utils_url()
42 + {
43 + return $this->plugin_url() . 'utils/';
44 + }
37 45 /**
38 46 * Public function init.
39 47 * call function for all
40 48 *
@@ -43,8 +51,11 @@
43 51 public function init() {
44 52
45 53 $error = false;
46 54
55 + // init notice class
56 + \Oxaim\Libs\Notice::init();
57 +
47 58 // check woocommerce plugin
48 59 if(!did_action('woocommerce_loaded')) {
49 60 add_action('admin_notices', [$this, 'missing_woocommerce']);
50 61
@@ -75,11 +86,15 @@
75 86 if($error) {
76 87 return;
77 88 }
78 89
90 +
91 +
79 92 add_filter("plugin_action_links_shopengine/shopengine.php", function ($links) {
93 + $free = esc_html__("Go To Shopengine","shopengine");
94 + $pro = esc_html__("Go To ShopenginePro","shopengine");
80 95
81 - $custom_links[] = '<a href="'.admin_url('edit.php?post_type=shopengine-template#getting-started').'" target="_blank">' . esc_html__('Settings', 'shopengine') . '</a>';
96 + $custom_links[] = '<a title="' . $free . '" href="'.admin_url('edit.php?post_type=shopengine-template#getting-started').'" target="_blank">' . esc_html__('Settings', 'shopengine') . '</a>';
82 97
83 98 foreach ($custom_links as $custom_link):
84 99 array_unshift($links, $custom_link);
85 100 endforeach;
@@ -84,20 +99,43 @@
84 99 array_unshift($links, $custom_link);
85 100 endforeach;
86 101
87 102 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>';
103 + $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 104 }
90 105 return $links;
91 106 });
92 107
108 + if(\ShopEngine\Utils\Util::get_settings( 'shopengine_user_consent_for_banner', 'true' ) == 'true'){
109 +
110 + /**
111 + * EmailKit Global Class initialization
112 + *
113 + */
114 + if( !class_exists('EmailKit') && !did_action('edit_with_emailkit_loaded') && class_exists('\Wpmet\Libs\Emailkit') ) {
115 +
116 + new \Wpmet\Libs\Emailkit();
117 + }
118 +
119 + /**
120 + * MetForm get free templates promotional class initialization
121 + *
122 + */
123 + if( !did_action('metform/after_load') && did_action('elementor/loaded') && class_exists('\Wpmet\Libs\Metform_Promo_Banner') ) {
124 +
125 + new \Wpmet\Libs\Metform_Promo_Banner();
126 + }
127 + }
93 128
129 +
94 130 /**
95 131 * Routes initialization
96 132 *
97 133 */
98 134 new License_Route();
99 -
135 +
136 + // Initialize deactivation feedback modal
137 + new \ShopEngine\Utils\Feedback\Plugin_Unsubscribe();
100 138 /**
101 139 * Run pro plugin updater here....
102 140 *
103 141 */
@@ -104,45 +142,23 @@
104 142 add_action('admin_init', function () {
105 143 if(class_exists('ShopEngine_Pro')) {
106 144 new Updater();
107 145 }
146 + new \ShopEngine\Compatibility\Migrations\Direct_Checkout;
108 147 });
109 148
110 149
111 150 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 - }
151 + /**
152 + * migrate data
153 + */
154 + LangMigration::instance()->init();
139 155 });
140 156
141 157 // avoid themes for loading woocommerce functions
142 - $avoid_themes = ['avada', 'avada child'];
158 + $avoid_themes = ['avada', 'woodmart', 'Avada', 'Woodmart'];
143 159
144 - if(!in_array(strtolower(wp_get_theme()), $avoid_themes)) {
160 + if( !in_array(get_template(), $avoid_themes) ) {
145 161 /**
146 162 * Ensuring woocommerce functions are loaded before theme is modifying those
147 163 *
148 164 */
@@ -155,11 +171,27 @@
155 171 new \ShopEngine\Core\Elementor_Controls\Init();
156 172
157 173 //Loading the scripts and styles
158 174 add_action('elementor/editor/after_enqueue_styles', [$this, 'js_css_elementor']);
175 +
176 + // Register widgets immediately after elementor is loaded with higher priority
177 + if(is_plugin_active('related-products-manager-woocommerce/related-products-manager-for-woocommerce.php')) {
178 +
179 + add_action('elementor/widgets/register', function() {
180 + (new Manifest())->init();
181 + }, 5); // Priority 5 to load early
182 + }
183 +
159 184 }
160 185
186 + // Cart validation compatibility with WC Min Max Quantity plugin
161 187
188 + if ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'woo-min-max-quantity-step-control-single/wcmmq.php' ) ) {
189 +
190 + add_filter( 'wcmmq_cart_validation_check', [ $this, 'shopengine_wcmmq_cart_validation_compat' ], 10, 2 );
191 + }
192 +
193 +
162 194 //Loading public scripts and styles
163 195 add_action('wp_enqueue_scripts', [$this, 'js_css_public']);
164 196
165 197 //woocommece theme support
@@ -169,27 +201,152 @@
169 201 add_theme_support('wc-product-gallery-lightbox');
170 202 add_theme_support('wc-product-gallery-slider');
171 203 }
172 204
205 +
206 + $filter_string = ''; // elementskit,metform-pro
207 + $filter_string .= ((!in_array('elementskit/elementskit.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',elementskit');
208 + $filter_string .= (!class_exists('\MetForm\Plugin') ? '' : ',metform');
209 + $filter_string .= (!class_exists('\MetForm_Pro\Plugin') ? '' : ',metform-pro');
210 +
173 211 #Registering new post-type & etc
174 212 Base::instance()->init();
213 +
175 214
176 215 Rating::instance('shopengine')
177 216 ->set_plugin( 'ShopEngine', 'https://wpmet.com/wordpress.org/rating/shopengine' )
217 + ->set_rating_url( 'https://wordpress.org/support/plugin/shopengine/reviews/#new-post' )
178 218 ->set_plugin_logo( 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061', 'width:150px !important' )
179 - ->set_priority( 10 )
219 + ->set_priority( 11 )
180 220 ->set_first_appear_day( 7 )
181 221 ->set_condition( true )
182 222 ->call();
223 +
224 + if ( is_admin() && \ShopEngine\Utils\Util::get_settings( 'shopengine_user_consent_for_banner', 'true' ) == 'true' ) {
183 225
226 + /**
227 + * Show WPMET stories widget in dashboard
228 + */
229 +
230 + \Wpmet\Libs\Stories::instance('shopengine')
231 +
232 + ->set_filter($filter_string)
233 + ->set_plugin('ShopEngine', 'https://wpmet.com/plugin/shopengine/')
234 + ->set_api_url('https://api.wpmet.com/public/stories/')
235 + ->call();
236 +
237 + // banner
238 + \Wpmet\Libs\Banner::instance('shopengine')
239 + ->set_filter(ltrim($filter_string, ','))
240 + ->set_api_url('https://api.wpmet.com/public/jhanda')
241 + ->set_plugin_screens('edit-shopengine-template')
242 + ->set_plugin_screens('edit-shopengine-template')
243 + ->call();
244 + }
245 +
246 + add_action('init', function () {
247 + $apps_img_path = \ShopEngine::plugin_url() . 'assets/images/apps-page/';
248 + /**
249 + * Show our plugins menu for others wpmet plugins
250 + */
251 + \ShopEngine\Wpmet\Libs\Plugins::instance()->init('shopengine')
252 + ->set_parent_menu_slug('shopengine-settings')
253 + ->set_submenu_name('Our Plugins')
254 + ->set_section_title('Get More out of Your WooCommerce Website!')
255 + ->set_section_description('Install other plugins from us and take your WooCommerce site to the next level for absolutely free!')
256 + ->set_items_per_row(4)
257 + ->set_plugins(
258 + [
259 + 'elementskit-lite/elementskit-lite.php' => [
260 + 'name' => esc_html__('ElementsKit', 'shopengine'),
261 + 'url' => 'https://wordpress.org/plugins/elementskit-lite/',
262 + 'icon' => $apps_img_path. 'elementskit.gif',
263 + 'desc' => esc_html__('All-in-one Elementor addon trusted by 1 Million+ users, makes your website builder process easier with ultimate freedom.', 'shopengine'),
264 + 'docs' => 'https://wpmet.com/doc/elementskit/',
265 + ],
266 + 'getgenie/getgenie.php' => [
267 + 'name' => esc_html__('GetGenie', 'shopengine'),
268 + 'url' => 'https://wordpress.org/plugins/getgenie/',
269 + 'icon' => $apps_img_path.'getgenie.gif',
270 + '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'),
271 + 'docs' => 'https://getgenie.ai/docs/',
272 + ],
273 + 'gutenkit-blocks-addon/gutenkit-blocks-addon.php' => [
274 + 'name' => esc_html__('GutenKit', 'shopengine'),
275 + 'url' => 'https://wordpress.org/plugins/gutenkit-blocks-addon/',
276 + 'icon' => $apps_img_path. 'guten-kit.png',
277 + 'desc' => esc_html__('Gutenberg blocks, patterns, and templates that extend the page-building experience using the WordPress block editor.', 'shopengine'),
278 + 'docs' => 'https://wpmet.com/doc/gutenkit/',
279 + ],
280 + 'metform/metform.php' => [
281 + 'name' => esc_html__('MetForm', 'shopengine'),
282 + 'url' => 'https://wordpress.org/plugins/metform/',
283 + 'icon' => $apps_img_path. 'metform.png',
284 + 'desc' => esc_html__('Drag & drop form builder for Elementor to create contact forms, multi-step forms, and more — smoother, faster, and better!', 'shopengine'),
285 + 'docs' => 'https://wpmet.com/doc/metform/',
286 + ],
287 + 'emailkit/EmailKit.php' => [
288 + 'name' => esc_html__('EmailKit', 'shopengine'),
289 + 'url' => 'https://wordpress.org/plugins/emailkit/',
290 + 'icon' => $apps_img_path . 'emailkit.png',
291 + 'desc' => esc_html__('Advanced email customizer for WooCommerce and WordPress. Build, customize, and send emails from WordPress to boost your sales!', 'shopengine'),
292 + 'docs' => 'https://wpmet.com/doc/emailkit/',
293 + ],
294 + 'wp-social/wp-social.php' => [
295 + 'name' => esc_html__('WP Social', 'shopengine'),
296 + 'url' => 'https://wordpress.org/plugins/wp-social/',
297 + 'icon' => $apps_img_path . 'wp-social.png',
298 + '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'),
299 + 'docs' => 'https://wpmet.com/doc/wp-social/',
300 + ],
301 + 'wp-ultimate-review/wp-ultimate-review.php' => [
302 + 'name' => esc_html__('WP Ultimate Review', 'shopengine'),
303 + 'url' => 'https://wordpress.org/plugins/wp-ultimate-review/',
304 + 'icon' => $apps_img_path . 'ultimate-review.png',
305 + 'desc' => esc_html__('Collect and showcase reviews on your website to build brand credibility and social proof with the easiest solution.','shopengine'),
306 + 'docs' => 'https://wpmet.com/doc/wp-ultimate-review/',
307 + ],
308 + 'wp-fundraising-donation/wp-fundraising.php' => [
309 + 'name' => esc_html__('FundEngine', 'shopengine'),
310 + 'url' => 'https://wordpress.org/plugins/wp-fundraising-donation/',
311 + 'icon' => $apps_img_path . 'fundengine.png',
312 + 'desc' => esc_html__('Create fundraising, crowdfunding, and donation websites with PayPal and Stripe payment gateway integration.', 'shopengine'),
313 + 'docs' => 'https://wpmet.com/doc/fundengine/',
314 + ],
315 + 'blocks-for-shopengine/shopengine-gutenberg-addon.php' => [
316 + 'name' => esc_html__('Blocks for ShopEngine', 'shopengine'),
317 + 'url' => 'https://wordpress.org/plugins/blocks-for-shopengine/',
318 + 'icon' => $apps_img_path. 'shopengine.gif',
319 + 'desc' => esc_html__('All in one WooCommerce solution for Gutenberg! Build your WooCommerce pages in a block editor with full customization.', 'shopengine'),
320 + 'docs' => 'https://wpmet.com/doc/shopengine/shopengine-gutenberg/',
321 + ],
322 + 'genie-image-ai/genie-image-ai.php' => [
323 + 'name' => esc_html__('Genie Image', 'shopengine'),
324 + 'url' => 'https://wordpress.org/plugins/genie-image-ai/',
325 + 'icon' => $apps_img_path . 'genie-image.png',
326 + '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.
327 + ', 'shopengine'),
328 + 'docs' => 'https://getgenie.ai/docs/',
329 + ],
330 + ]
331 + )
332 + ->call();
333 +
334 + // working get instance of elementor widget
335 + (new Manifest())->init();
336 + } );
337 +
338 +
339 +
340 + \ShopEngine\Core\MultiLanguage\Language::instance()->init();
341 +
184 342 \ShopEngine\Core\Settings\Base::instance()->init();
185 343
344 +
186 345 new Libs\Select_Api\Base();
187 346
188 347 (new Module_Manifest())->init();
189 348
190 - // working get instance of elementor widget
191 - (new Manifest())->init();
192 349
193 350 Query_Modifier::instance()->init();
194 351
195 352 (new Conflict_Manifest())->init();
@@ -198,9 +355,9 @@
198 355 add_action('get_header', [$this, 'shopengine_track_product_views']);
199 356
200 357 // database migrations
201 358 // (new \ShopEngine\Compatibility\Migrations\Migration())->init();
202 - (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init();
359 + // (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init();
203 360
204 361
205 362 // call service providers
206 363
@@ -214,14 +371,33 @@
214 371 }
215 372
216 373 }
217 374
375 + add_filter('script_loader_tag', [$this, 'filter_load_type'], 99, 3);
218 376
377 + //it will register an option in customizer for woocommerce products catelog. It's related with our Arcive Products widget.
378 + Register_Settings::instance()->init();
379 + }
219 380
220 - add_filter('script_loader_tag', [$this, 'filter_load_type'], 99, 3);
381 + public function shopengine_wcmmq_cart_validation_compat( $check, $request ) {
382 +
383 + $cart_widget_flag = isset( $_REQUEST['shopengine_cart_widget'] )
384 + ? sanitize_text_field( wp_unslash( $_REQUEST['shopengine_cart_widget'] ) )
385 + : '';
386 + $cart_widget_nonce = isset( $_REQUEST['shopengine_cart_widget_nonce'] )
387 + ? sanitize_text_field( wp_unslash( $_REQUEST['shopengine_cart_widget_nonce'] ) )
388 + : '';
389 +
390 + if ( $cart_widget_flag === '1' && wp_verify_nonce( $cart_widget_nonce, 'shopengine_cart_widget' ) ) {
391 + return false; // Skip WC MMQ validation for verified ShopEngine cart widget requests
392 + }
393 + return $check; // Proceed with normal validation for other requests
221 394 }
222 395
223 396
397 +
398 +
399 +
224 400 // add async and defer attributes to enqueued scripts
225 401 public function filter_load_type($tag, $handle, $src) {
226 402
227 403 if(strpos($handle, '-async') !== false) {
@@ -250,9 +426,9 @@
250 426 $cookie_name = "shopengine_recent_viewed_product";
251 427
252 428 if(isset($_COOKIE[$cookie_name])) {
253 429
254 - $cookie_ids = $_COOKIE[$cookie_name];
430 + $cookie_ids = sanitize_text_field(wp_unslash($_COOKIE[$cookie_name]));
255 431 $product_ids = explode(',', $cookie_ids);
256 432
257 433 if(!is_array($product_ids)) {
258 434 $product_ids = [$product_ids];
@@ -288,12 +464,10 @@
288 464 * Include public function
289 465 *
290 466 * @since 1.0.0
291 467 */
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());
468 + public function js_css_public() {
469 + wp_register_style('shopengine-public', \ShopEngine::plugin_url() . 'assets/css/shopengine-public.css', false, \ShopEngine::version());
296 470
297 471 // Modal Stylesheet
298 472 wp_register_style('shopengine-modal-styles', \ShopEngine::plugin_url() . 'assets/css/shopengine-modal.css', false, \ShopEngine::version());
299 473
@@ -342,11 +516,11 @@
342 516
343 517
344 518 public function missing_woocommerce() {
345 519
346 - if(isset($_GET['activate'])) {
347 - unset($_GET['activate']);
348 - }
520 + if(!current_user_can('manage_options')) {
521 + return;
522 + }
349 523
350 524 if(file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')) {
351 525
352 526 $btn['label'] = esc_html__('Activate WooCommerce', 'shopengine');
@@ -362,8 +536,9 @@
362 536 [
363 537 'id' => 'missing-woo',
364 538 'type' => 'error',
365 539 'dismissible' => true,
540 + 'is_required' => true,
366 541 'btn' => $btn,
367 542 'message' => sprintf(esc_html__('ShopEngine requires woocommerce Plugin, which is currently NOT RUNNING.', 'shopengine'), '4.1.0'),
368 543 ]
369 544 );
@@ -371,11 +546,11 @@
371 546
372 547
373 548 public function missing_elementor() {
374 549
375 - if(isset($_GET['activate'])) {
376 - unset($_GET['activate']);
377 - }
550 + if(!current_user_can('manage_options')) {
551 + return;
552 + }
378 553
379 554 if(file_exists(WP_PLUGIN_DIR . '/elementor/elementor.php')) {
380 555
381 556 $btn['label'] = esc_html__('Activate Elementor', 'shopengine');
@@ -386,15 +561,28 @@
386 561 $btn['label'] = esc_html__('Install Elementor', 'shopengine');
387 562 $btn['url'] = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=elementor'), 'install-plugin_elementor');
388 563 }
389 564
565 + if(file_exists(WP_PLUGIN_DIR . '/blocks-for-shopengine/shopengine-gutenberg-addon.php')) {
566 +
567 + $btn2['label'] = esc_html__('Activate Blocks for ShopEngine', 'shopengine');
568 + $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');
569 +
570 + } else {
571 +
572 + $btn2['label'] = esc_html__('Install Blocks for ShopEngine', 'shopengine');
573 + $btn2['url'] = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=blocks-for-shopengine'), 'install-plugin_blocks-for-shopengine');
574 + }
575 +
390 576 Utils\Notice::push(
391 577 [
392 578 'id' => 'missing-elementor',
393 579 'type' => 'error',
580 + 'is_required' => true,
394 581 'dismissible' => true,
395 582 'btn' => $btn,
396 - 'message' => sprintf(esc_html__('ShopEngine requires Elementor version %1$s+, which is currently NOT RUNNING.', 'shopengine'), '3.0.0'),
583 + 'btn2' => $btn2,
584 + 'message' => esc_html__('To use ShopEngine, install Elementor (For the Elementor Builder) OR Blocks for ShopEngine (For Gutenberg Builder).', 'shopengine'),
397 585 ]
398 586 );
399 587 }
400 588
@@ -399,8 +587,12 @@
399 587 }
400 588
401 589
402 590 public function failed_elementor_version() {
591 +
592 + if(!current_user_can('manage_options')) {
593 + return;
594 + }
403 595
404 596 $btn['label'] = esc_html__('Update Elementor', 'shopengine');
405 597 $btn['url'] = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=elementor'), 'upgrade-plugin_elementor');
406 598