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 +80 -49 2.2.24.6.0 View file →
@@ -1,18 +1,22 @@
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;
14 +use ShopEngine\Libs\Rating\Rating;
10 15 use ShopEngine\Libs\Updater\Init as Updater;
11 16 use ShopEngine\Modules\Manifest as Module_Manifest;
12 17 use ShopEngine\Widgets\Manifest;
13 18
14 -defined('ABSPATH') || exit;
15 19
16 20 /**
17 21 * Plugin final Class.
18 22 * Handles dynamically loading classes only when needed. Check Elementor Plugin, Woocomerce Plugin Loaded or Install.
@@ -29,11 +33,15 @@
29 33 */
30 34 public function __construct() {
31 35 // load autoload method
32 36 Autoloader::run();
37 + add_action( 'wp_ajax_shopengine_admin_action', [\ShopEngine\Utils\Util::class, 'shopengine_admin_action'] );
33 38 }
34 39
35 -
40 + public function utils_url()
41 + {
42 + return $this->plugin_url() . 'utils/';
43 + }
36 44 /**
37 45 * Public function init.
38 46 * call function for all
39 47 *
@@ -73,12 +81,14 @@
73 81
74 82 if($error) {
75 83 return;
76 84 }
77 -
85 +
78 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");
79 89
80 - $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>';
81 91
82 92 foreach ($custom_links as $custom_link):
83 93 array_unshift($links, $custom_link);
84 94 endforeach;
@@ -83,9 +93,9 @@
83 93 array_unshift($links, $custom_link);
84 94 endforeach;
85 95
86 96 if (!is_plugin_active('shopengine-pro/shopengine-pro.php')) {
87 - $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>';
88 98 }
89 99 return $links;
90 100 });
91 101
@@ -103,44 +113,21 @@
103 113 add_action('admin_init', function () {
104 114 if(class_exists('ShopEngine_Pro')) {
105 115 new Updater();
106 116 }
117 + new \ShopEngine\Compatibility\Migrations\Direct_Checkout;
107 118 });
108 119
109 120
110 121 add_action('wp_loaded', function () {
111 -
112 - if(isset($_REQUEST['preview']) && $_REQUEST['preview'] == 'true' && !empty($_REQUEST['preview_id'])) {
113 -
114 - $pid = (int)$_REQUEST['preview_id'];
115 -
116 - $po = get_post($pid);
117 -
118 - if($po->post_type === Template_Cpt::TYPE) {
119 -
120 - $template = \ShopEngine\Core\Builders\Templates::get_registered_template_data($pid);
121 -
122 - if(empty($template) || !isset($template['url'])) {
123 - return;
124 - }
125 -
126 - $param = [
127 - 'shopengine_template_id' => $pid,
128 - 'preview_nonce' => wp_create_nonce('template_preview_' . $pid),
129 - 'change_template' => '1',
130 - ];
131 -
132 - $url = \ShopEngine\Utils\Helper::add_to_url($template['url'], $param);
133 -
134 - wp_safe_redirect($url);
135 - exit;
136 - }
137 - }
122 + /**
123 + * migrate data
124 + */
125 + LangMigration::instance()->init();
138 126 });
139 127
140 128 // avoid themes for loading woocommerce functions
141 - $avoid_themes = ['avada', 'avada child'];
142 -
129 + $avoid_themes = ['avada', 'avada child', 'woodmart', 'woodmart child'];
143 130 if(!in_array(strtolower(wp_get_theme()), $avoid_themes)) {
144 131 /**
145 132 * Ensuring woocommerce functions are loaded before theme is modifying those
146 133 *
@@ -168,14 +155,53 @@
168 155 add_theme_support('wc-product-gallery-lightbox');
169 156 add_theme_support('wc-product-gallery-slider');
170 157 }
171 158
172 -
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
169 + Rating::instance('shopengine')
170 + ->set_plugin( 'ShopEngine', 'https://wpmet.com/wordpress.org/rating/shopengine' )
171 + ->set_plugin_logo( 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061', 'width:150px !important' )
172 + ->set_priority( 10 )
173 + ->set_first_appear_day( 7 )
174 + ->set_condition( true )
175 + ->call();
176 +
177 + if ( is_admin() && \ShopEngine\Utils\Util::get_settings( 'shopengine_user_consent_for_banner', 'true' ) == 'true' ) {
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 +
176 201 \ShopEngine\Core\Settings\Base::instance()->init();
177 202
203 +
178 204 new Libs\Select_Api\Base();
179 205
180 206 (new Module_Manifest())->init();
181 207
@@ -190,9 +216,9 @@
190 216 add_action('get_header', [$this, 'shopengine_track_product_views']);
191 217
192 218 // database migrations
193 219 // (new \ShopEngine\Compatibility\Migrations\Migration())->init();
194 - (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init();
220 + // (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init();
195 221
196 222
197 223 // call service providers
198 224
@@ -206,11 +232,12 @@
206 232 }
207 233
208 234 }
209 235
236 + add_filter('script_loader_tag', [$this, 'filter_load_type'], 99, 3);
210 237
211 -
212 - 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();
213 240 }
214 241
215 242
216 243 // add async and defer attributes to enqueued scripts
@@ -242,9 +269,9 @@
242 269 $cookie_name = "shopengine_recent_viewed_product";
243 270
244 271 if(isset($_COOKIE[$cookie_name])) {
245 272
246 - $cookie_ids = $_COOKIE[$cookie_name];
273 + $cookie_ids = sanitize_text_field(wp_unslash($_COOKIE[$cookie_name]));
247 274 $product_ids = explode(',', $cookie_ids);
248 275
249 276 if(!is_array($product_ids)) {
250 277 $product_ids = [$product_ids];
@@ -280,12 +307,10 @@
280 307 * Include public function
281 308 *
282 309 * @since 1.0.0
283 310 */
284 - public function js_css_public() {
285 - wp_enqueue_style('shopengine-icon', \ShopEngine::plugin_url() . 'assets/css/shopengine-icon.css', false, \ShopEngine::version());
286 - wp_enqueue_style('shopengine-simple-scrollbar-css', \ShopEngine::plugin_url() . 'assets/css/simple-scrollbar.css', false, \ShopEngine::version());
287 - 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());
288 313
289 314 // Modal Stylesheet
290 315 wp_register_style('shopengine-modal-styles', \ShopEngine::plugin_url() . 'assets/css/shopengine-modal.css', false, \ShopEngine::version());
291 316
@@ -334,11 +359,11 @@
334 359
335 360
336 361 public function missing_woocommerce() {
337 362
338 - if(isset($_GET['activate'])) {
339 - unset($_GET['activate']);
340 - }
363 + if(!current_user_can('manage_options')) {
364 + return;
365 + }
341 366
342 367 if(file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')) {
343 368
344 369 $btn['label'] = esc_html__('Activate WooCommerce', 'shopengine');
@@ -354,8 +379,9 @@
354 379 [
355 380 'id' => 'missing-woo',
356 381 'type' => 'error',
357 382 'dismissible' => true,
383 + 'is_required' => true,
358 384 'btn' => $btn,
359 385 'message' => sprintf(esc_html__('ShopEngine requires woocommerce Plugin, which is currently NOT RUNNING.', 'shopengine'), '4.1.0'),
360 386 ]
361 387 );
@@ -363,11 +389,11 @@
363 389
364 390
365 391 public function missing_elementor() {
366 392
367 - if(isset($_GET['activate'])) {
368 - unset($_GET['activate']);
369 - }
393 + if(!current_user_can('manage_options')) {
394 + return;
395 + }
370 396
371 397 if(file_exists(WP_PLUGIN_DIR . '/elementor/elementor.php')) {
372 398
373 399 $btn['label'] = esc_html__('Activate Elementor', 'shopengine');
@@ -382,8 +408,9 @@
382 408 Utils\Notice::push(
383 409 [
384 410 'id' => 'missing-elementor',
385 411 'type' => 'error',
412 + 'is_required' => true,
386 413 'dismissible' => true,
387 414 'btn' => $btn,
388 415 'message' => sprintf(esc_html__('ShopEngine requires Elementor version %1$s+, which is currently NOT RUNNING.', 'shopengine'), '3.0.0'),
389 416 ]
@@ -391,8 +418,12 @@
391 418 }
392 419
393 420
394 421 public function failed_elementor_version() {
422 +
423 + if(!current_user_can('manage_options')) {
424 + return;
425 + }
395 426
396 427 $btn['label'] = esc_html__('Update Elementor', 'shopengine');
397 428 $btn['url'] = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=elementor'), 'upgrade-plugin_elementor');
398 429