PluginProbe
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets / 4.6.0
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets v4.6.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 +65 -42 2.5.04.6.0 View file →
@@ -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 *
@@ -86,9 +93,9 @@
86 93 array_unshift($links, $custom_link);
87 94 endforeach;
88 95
89 96 if (!is_plugin_active('shopengine-pro/shopengine-pro.php')) {
90 - $links[] = '<a title="' . $pro . '" href="https://wpmet.com/plugin/shopengine/pricing/" style="color:#FCB214;font-weight:700" target="_blank">' . esc_html__('Go Pro', 'shopengine') . '</a>';
97 + $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>';
91 98 }
92 99 return $links;
93 100 });
94 101
@@ -106,44 +113,21 @@
106 113 add_action('admin_init', function () {
107 114 if(class_exists('ShopEngine_Pro')) {
108 115 new Updater();
109 116 }
117 + new \ShopEngine\Compatibility\Migrations\Direct_Checkout;
110 118 });
111 119
112 120
113 121 add_action('wp_loaded', function () {
114 -
115 - if(isset($_REQUEST['preview']) && $_REQUEST['preview'] == 'true' && !empty($_REQUEST['preview_id'])) {
116 -
117 - $pid = (int)$_REQUEST['preview_id'];
118 -
119 - $po = get_post($pid);
120 -
121 - if($po->post_type === Template_Cpt::TYPE) {
122 -
123 - $template = \ShopEngine\Core\Builders\Templates::get_registered_template_data($pid);
124 -
125 - if(empty($template) || !isset($template['url'])) {
126 - return;
127 - }
128 -
129 - $param = [
130 - 'shopengine_template_id' => $pid,
131 - 'preview_nonce' => wp_create_nonce('template_preview_' . $pid),
132 - 'change_template' => '1',
133 - ];
134 -
135 - $url = \ShopEngine\Utils\Helper::add_to_url($template['url'], $param);
136 -
137 - wp_safe_redirect($url);
138 - exit;
139 - }
140 - }
122 + /**
123 + * migrate data
124 + */
125 + LangMigration::instance()->init();
141 126 });
142 127
143 128 // avoid themes for loading woocommerce functions
144 - $avoid_themes = ['avada', 'avada child'];
145 -
129 + $avoid_themes = ['avada', 'avada child', 'woodmart', 'woodmart child'];
146 130 if(!in_array(strtolower(wp_get_theme()), $avoid_themes)) {
147 131 /**
148 132 * Ensuring woocommerce functions are loaded before theme is modifying those
149 133 *
@@ -171,10 +155,17 @@
171 155 add_theme_support('wc-product-gallery-lightbox');
172 156 add_theme_support('wc-product-gallery-slider');
173 157 }
174 158
159 +
160 + $filter_string = ''; // elementskit,metform-pro
161 + $filter_string .= ((!in_array('elementskit/elementskit.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',elementskit');
162 + $filter_string .= (!class_exists('\MetForm\Plugin') ? '' : ',metform');
163 + $filter_string .= (!class_exists('\MetForm_Pro\Plugin') ? '' : ',metform-pro');
164 +
175 165 #Registering new post-type & etc
176 166 Base::instance()->init();
167 +
177 168
178 169 Rating::instance('shopengine')
179 170 ->set_plugin( 'ShopEngine', 'https://wpmet.com/wordpress.org/rating/shopengine' )
180 171 ->set_plugin_logo( 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061', 'width:150px !important' )
@@ -181,11 +172,36 @@
181 172 ->set_priority( 10 )
182 173 ->set_first_appear_day( 7 )
183 174 ->set_condition( true )
184 175 ->call();
176 +
177 + if ( is_admin() && \ShopEngine\Utils\Util::get_settings( 'shopengine_user_consent_for_banner', 'true' ) == 'true' ) {
185 178
179 + /**
180 + * Show WPMET stories widget in dashboard
181 + */
182 +
183 + \Wpmet\Libs\Stories::instance('shopengine')
184 +
185 + ->set_filter($filter_string)
186 + ->set_plugin('ShopEngine', 'https://wpmet.com/plugin/shopengine/')
187 + ->set_api_url('https://api.wpmet.com/public/stories/')
188 + ->call();
189 +
190 + // banner
191 + \Wpmet\Libs\Banner::instance('shopengine')
192 + ->set_filter(ltrim($filter_string, ','))
193 + ->set_api_url('https://api.wpmet.com/public/jhanda')
194 + ->set_plugin_screens('edit-shopengine-template')
195 + ->set_plugin_screens('edit-shopengine-template')
196 + ->call();
197 + }
198 +
199 + \ShopEngine\Core\MultiLanguage\Language::instance()->init();
200 +
186 201 \ShopEngine\Core\Settings\Base::instance()->init();
187 202
203 +
188 204 new Libs\Select_Api\Base();
189 205
190 206 (new Module_Manifest())->init();
191 207
@@ -200,9 +216,9 @@
200 216 add_action('get_header', [$this, 'shopengine_track_product_views']);
201 217
202 218 // database migrations
203 219 // (new \ShopEngine\Compatibility\Migrations\Migration())->init();
204 - (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init();
220 + // (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init();
205 221
206 222
207 223 // call service providers
208 224
@@ -216,11 +232,12 @@
216 232 }
217 233
218 234 }
219 235
236 + add_filter('script_loader_tag', [$this, 'filter_load_type'], 99, 3);
220 237
221 -
222 - add_filter('script_loader_tag', [$this, 'filter_load_type'], 99, 3);
238 + //it will register an option in customizer for woocommerce products catelog. It's related with our Arcive Products widget.
239 + Register_Settings::instance()->init();
223 240 }
224 241
225 242
226 243 // add async and defer attributes to enqueued scripts
@@ -252,9 +269,9 @@
252 269 $cookie_name = "shopengine_recent_viewed_product";
253 270
254 271 if(isset($_COOKIE[$cookie_name])) {
255 272
256 - $cookie_ids = $_COOKIE[$cookie_name];
273 + $cookie_ids = sanitize_text_field(wp_unslash($_COOKIE[$cookie_name]));
257 274 $product_ids = explode(',', $cookie_ids);
258 275
259 276 if(!is_array($product_ids)) {
260 277 $product_ids = [$product_ids];
@@ -342,11 +359,11 @@
342 359
343 360
344 361 public function missing_woocommerce() {
345 362
346 - if(isset($_GET['activate'])) {
347 - unset($_GET['activate']);
348 - }
363 + if(!current_user_can('manage_options')) {
364 + return;
365 + }
349 366
350 367 if(file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')) {
351 368
352 369 $btn['label'] = esc_html__('Activate WooCommerce', 'shopengine');
@@ -362,8 +379,9 @@
362 379 [
363 380 'id' => 'missing-woo',
364 381 'type' => 'error',
365 382 'dismissible' => true,
383 + 'is_required' => true,
366 384 'btn' => $btn,
367 385 'message' => sprintf(esc_html__('ShopEngine requires woocommerce Plugin, which is currently NOT RUNNING.', 'shopengine'), '4.1.0'),
368 386 ]
369 387 );
@@ -371,11 +389,11 @@
371 389
372 390
373 391 public function missing_elementor() {
374 392
375 - if(isset($_GET['activate'])) {
376 - unset($_GET['activate']);
377 - }
393 + if(!current_user_can('manage_options')) {
394 + return;
395 + }
378 396
379 397 if(file_exists(WP_PLUGIN_DIR . '/elementor/elementor.php')) {
380 398
381 399 $btn['label'] = esc_html__('Activate Elementor', 'shopengine');
@@ -390,8 +408,9 @@
390 408 Utils\Notice::push(
391 409 [
392 410 'id' => 'missing-elementor',
393 411 'type' => 'error',
412 + 'is_required' => true,
394 413 'dismissible' => true,
395 414 'btn' => $btn,
396 415 'message' => sprintf(esc_html__('ShopEngine requires Elementor version %1$s+, which is currently NOT RUNNING.', 'shopengine'), '3.0.0'),
397 416 ]
@@ -399,8 +418,12 @@
399 418 }
400 419
401 420
402 421 public function failed_elementor_version() {
422 +
423 + if(!current_user_can('manage_options')) {
424 + return;
425 + }
403 426
404 427 $btn['label'] = esc_html__('Update Elementor', 'shopengine');
405 428 $btn['url'] = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=elementor'), 'upgrade-plugin_elementor');
406 429