PluginProbe
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets / 4.6.1
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets v4.6.1
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 +72 -49 2.4.04.6.1 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 *
@@ -74,12 +81,14 @@
74 81
75 82 if($error) {
76 83 return;
77 84 }
78 -
85 +
79 86 add_filter("plugin_action_links_shopengine/shopengine.php", function ($links) {
87 + $free = esc_html__("Go To Shopengine","shopengine");
88 + $pro = esc_html__("Go To ShopenginePro","shopengine");
80 89
81 - $custom_links[] = '<a href="'.admin_url('edit.php?post_type=shopengine-template#getting-started').'" target="_blank">' . esc_html__('Settings', 'shopengine') . '</a>';
90 + $custom_links[] = '<a title="' . $free . '" href="'.admin_url('edit.php?post_type=shopengine-template#getting-started').'" target="_blank">' . esc_html__('Settings', 'shopengine') . '</a>';
82 91
83 92 foreach ($custom_links as $custom_link):
84 93 array_unshift($links, $custom_link);
85 94 endforeach;
@@ -84,9 +93,9 @@
84 93 array_unshift($links, $custom_link);
85 94 endforeach;
86 95
87 96 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>';
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>';
89 98 }
90 99 return $links;
91 100 });
92 101
@@ -104,44 +113,21 @@
104 113 add_action('admin_init', function () {
105 114 if(class_exists('ShopEngine_Pro')) {
106 115 new Updater();
107 116 }
117 + new \ShopEngine\Compatibility\Migrations\Direct_Checkout;
108 118 });
109 119
110 120
111 121 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 - }
122 + /**
123 + * migrate data
124 + */
125 + LangMigration::instance()->init();
139 126 });
140 127
141 128 // avoid themes for loading woocommerce functions
142 - $avoid_themes = ['avada', 'avada child'];
143 -
129 + $avoid_themes = ['avada', 'avada child', 'woodmart', 'woodmart child'];
144 130 if(!in_array(strtolower(wp_get_theme()), $avoid_themes)) {
145 131 /**
146 132 * Ensuring woocommerce functions are loaded before theme is modifying those
147 133 *
@@ -169,21 +155,53 @@
169 155 add_theme_support('wc-product-gallery-lightbox');
170 156 add_theme_support('wc-product-gallery-slider');
171 157 }
172 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 +
173 165 #Registering new post-type & etc
174 166 Base::instance()->init();
167 +
175 168
176 169 Rating::instance('shopengine')
177 170 ->set_plugin( 'ShopEngine', 'https://wpmet.com/wordpress.org/rating/shopengine' )
178 171 ->set_plugin_logo( 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061', 'width:150px !important' )
179 - ->set_priority( 10 )
172 + ->set_priority( 11 )
180 173 ->set_first_appear_day( 7 )
181 174 ->set_condition( true )
182 175 ->call();
176 +
177 + if ( is_admin() && \ShopEngine\Utils\Util::get_settings( 'shopengine_user_consent_for_banner', 'true' ) == 'true' ) {
183 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 +
184 201 \ShopEngine\Core\Settings\Base::instance()->init();
185 202
203 +
186 204 new Libs\Select_Api\Base();
187 205
188 206 (new Module_Manifest())->init();
189 207
@@ -198,9 +216,9 @@
198 216 add_action('get_header', [$this, 'shopengine_track_product_views']);
199 217
200 218 // database migrations
201 219 // (new \ShopEngine\Compatibility\Migrations\Migration())->init();
202 - (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init();
220 + // (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init();
203 221
204 222
205 223 // call service providers
206 224
@@ -214,11 +232,12 @@
214 232 }
215 233
216 234 }
217 235
236 + add_filter('script_loader_tag', [$this, 'filter_load_type'], 99, 3);
218 237
219 -
220 - 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();
221 240 }
222 241
223 242
224 243 // add async and defer attributes to enqueued scripts
@@ -250,9 +269,9 @@
250 269 $cookie_name = "shopengine_recent_viewed_product";
251 270
252 271 if(isset($_COOKIE[$cookie_name])) {
253 272
254 - $cookie_ids = $_COOKIE[$cookie_name];
273 + $cookie_ids = sanitize_text_field(wp_unslash($_COOKIE[$cookie_name]));
255 274 $product_ids = explode(',', $cookie_ids);
256 275
257 276 if(!is_array($product_ids)) {
258 277 $product_ids = [$product_ids];
@@ -288,12 +307,10 @@
288 307 * Include public function
289 308 *
290 309 * @since 1.0.0
291 310 */
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());
311 + public function js_css_public() {
312 + wp_register_style('shopengine-public', \ShopEngine::plugin_url() . 'assets/css/shopengine-public.css', false, \ShopEngine::version());
296 313
297 314 // Modal Stylesheet
298 315 wp_register_style('shopengine-modal-styles', \ShopEngine::plugin_url() . 'assets/css/shopengine-modal.css', false, \ShopEngine::version());
299 316
@@ -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