Ecwid Ecommerce Shopping Cart - Version 6.10.6

Version Description

  • Sep 23, 2020 =
  • ompatibility with LiteSpeed cache plugin. We've fixed plugin compatibility issues. If you are using LightSpeed to speed up your WordPress site and Ecwid, they should work fine. If you see problems, please let us know.
  • Improved compatibility with themes that update site content without page reload (AJAX themes). Some users of such themes may have seen problems in the display of the storefront, we fixed that.
  • Minor fixes and improvements.

See full changelog

Download this release

Release Info

Developer Ecwid
Plugin Icon 128x128 Ecwid Ecommerce Shopping Cart
Version 6.10.6
Comparing to
See all releases

Code changes from version 6.10.5 to 6.10.6

ecwid-shopping-cart.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.ecwid.com?partner=wporg
5
  Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
6
  Text Domain: ecwid-shopping-cart
7
  Author: Ecwid Ecommerce
8
- Version: 6.10.5
9
  Author URI: https://ecwid.to/ecwid-site
10
  License: GPLv2 or later
11
  */
@@ -200,7 +200,8 @@ function ecwid_init_integrations()
200
  'polylang/polylang.php' => 'polylang',
201
  'wp-rocket/wp-rocket.php' => 'wprocket',
202
  'urbango-core/main.php' => 'urbango',
203
- 'seo-by-rank-math/rank-math.php' => 'rank-math'
 
204
  );
205
 
206
  $old_wordpress = version_compare( get_bloginfo( 'version' ), '5.0', '<' );
@@ -370,8 +371,6 @@ function ecwid_enqueue_frontend() {
370
 
371
  wp_enqueue_style('ecwid-css', ECWID_PLUGIN_URL . 'css/frontend.css',array(), get_option('ecwid_plugin_version'));
372
 
373
- $current_post = get_post();
374
-
375
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
376
  wp_localize_script( 'ecwid-frontend-js', 'ecwidParams', array(
377
  'useJsApiToOpenStoreCategoriesPages' => Ecwid_Nav_Menus::should_use_js_api_for_categories_menu(),
@@ -462,9 +461,9 @@ function ecwid_print_inline_js_config() {
462
  }
463
  }
464
 
465
- $js = apply_filters( 'ecwid_inline_js_config', $js );
466
 
467
- echo sprintf( '<script data-cfasync="false" type="text/javascript">%s</script>', $js );
468
  }
469
 
470
  add_action( 'ecwid_inline_js_config', 'ecwid_add_chameleon' );
@@ -613,7 +612,7 @@ function ecwid_backward_compatibility() {
613
  function ecwid_build_sitemap($callback)
614
  {
615
 
616
- if ( !Ecwid_Api_V3::is_available() || !ecwid_is_paid_account() || !ecwid_is_store_page_available() ) return;
617
 
618
  $page_id = Ecwid_Store_Page::get_current_store_page_id();
619
 
@@ -1028,6 +1027,7 @@ function ecwid_full_cache_reset()
1028
  $p = new Ecwid_Products();
1029
  $p->reset_dates();
1030
 
 
1031
  update_option( 'ecwid_last_api_cache_check', time() );
1032
  }
1033
 
@@ -2294,7 +2294,7 @@ function ecwid_get_iframe_src($time, $page)
2294
  $url .= '&hide_staff_accounts_header_menu=true';
2295
  $url .= '&hide_header=true';
2296
  $url .= '&set_dashboard_website_section_type=wordpress';
2297
- $url .= '&website_manage_url=' . admin_url( 'admin.php?page=ec-storefront-settings' );
2298
 
2299
  return $url;
2300
  } else {
5
  Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
6
  Text Domain: ecwid-shopping-cart
7
  Author: Ecwid Ecommerce
8
+ Version: 6.10.6
9
  Author URI: https://ecwid.to/ecwid-site
10
  License: GPLv2 or later
11
  */
200
  'polylang/polylang.php' => 'polylang',
201
  'wp-rocket/wp-rocket.php' => 'wprocket',
202
  'urbango-core/main.php' => 'urbango',
203
+ 'seo-by-rank-math/rank-math.php' => 'rank-math',
204
+ 'litespeed-cache/litespeed-cache.php' => 'litespeed-cache',
205
  );
206
 
207
  $old_wordpress = version_compare( get_bloginfo( 'version' ), '5.0', '<' );
371
 
372
  wp_enqueue_style('ecwid-css', ECWID_PLUGIN_URL . 'css/frontend.css',array(), get_option('ecwid_plugin_version'));
373
 
 
 
374
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
375
  wp_localize_script( 'ecwid-frontend-js', 'ecwidParams', array(
376
  'useJsApiToOpenStoreCategoriesPages' => Ecwid_Nav_Menus::should_use_js_api_for_categories_menu(),
461
  }
462
  }
463
 
464
+ $js = apply_filters( 'ecwid_inline_js_config', $js ) . PHP_EOL;
465
 
466
+ echo sprintf( '<script data-cfasync="false" data-no-optimize="1" type="text/javascript">%s</script>' . PHP_EOL , $js );
467
  }
468
 
469
  add_action( 'ecwid_inline_js_config', 'ecwid_add_chameleon' );
612
  function ecwid_build_sitemap($callback)
613
  {
614
 
615
+ if ( !Ecwid_Api_V3::is_available() || !ecwid_is_store_page_available() ) return;
616
 
617
  $page_id = Ecwid_Store_Page::get_current_store_page_id();
618
 
1027
  $p = new Ecwid_Products();
1028
  $p->reset_dates();
1029
 
1030
+ update_option( Ecwid_Api_V3::OPTION_API_STATUS, Ecwid_Api_V3::API_STATUS_OK );
1031
  update_option( 'ecwid_last_api_cache_check', time() );
1032
  }
1033
 
2294
  $url .= '&hide_staff_accounts_header_menu=true';
2295
  $url .= '&hide_header=true';
2296
  $url .= '&set_dashboard_website_section_type=wordpress';
2297
+ $url .= '&website_manage_url=' . urlencode( admin_url( 'admin.php?page=ec-storefront-settings' ) );
2298
 
2299
  return $url;
2300
  } else {
includes/class-ecwid-ajax-defer-renderer.php CHANGED
@@ -61,7 +61,14 @@ class Ecwid_Ajax_Defer_Renderer {
61
  $option_value = get_option( self::OPTION_DEFER_RENDERING );
62
 
63
  if ( $option_value == self::AUTO ) {
64
- $filter_results = apply_filters( self::FILTER_ENABLED, false );
 
 
 
 
 
 
 
65
 
66
  return $filter_results;
67
  } else if ( $option_value == self::ALWAYS_ON ) {
@@ -70,6 +77,11 @@ class Ecwid_Ajax_Defer_Renderer {
70
  return false;
71
  }
72
  }
 
 
 
 
 
73
 
74
  public function get_custom_renderer() {
75
  return array($this, 'render_shortcode');
61
  $option_value = get_option( self::OPTION_DEFER_RENDERING );
62
 
63
  if ( $option_value == self::AUTO ) {
64
+
65
+ $filter_results = false;
66
+
67
+ if( self::is_ajax_request() ) {
68
+ $filter_results = true;
69
+ }
70
+
71
+ $filter_results = apply_filters( self::FILTER_ENABLED, $filter_results );
72
 
73
  return $filter_results;
74
  } else if ( $option_value == self::ALWAYS_ON ) {
77
  return false;
78
  }
79
  }
80
+
81
+ public static function is_ajax_request() {
82
+ return !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
83
+ }
84
+
85
 
86
  public function get_custom_renderer() {
87
  return array($this, 'render_shortcode');
includes/class-ecwid-seo-links.php CHANGED
@@ -109,7 +109,7 @@ class Ecwid_Seo_Links {
109
  $redirect = Ecwid_Store_Page::get_category_url( $params['id'] );
110
  }
111
 
112
- if ($redirect) {
113
  wp_safe_redirect( $redirect, 301 );
114
  exit;
115
  }
@@ -220,18 +220,26 @@ class Ecwid_Seo_Links {
220
  $url = str_replace( ':443', '', $url );
221
  }
222
 
223
- $result = <<<JS
224
- window.ec.config.storefrontUrls = window.ec.config.storefrontUrls || {};
225
- window.ec.config.storefrontUrls.cleanUrls = true;
226
- window.ec.config.baseUrl = '$url';
227
- window.ec.storefront = window.ec.storefront || {};
228
- window.ec.storefront.sharing_button_link = "DIRECT_PAGE_URL";
 
229
  JS;
230
  $config .= $result;
231
 
232
  return $config;
233
  }
234
 
 
 
 
 
 
 
 
235
  public static function is_404_seo_link() {
236
 
237
  if ( ! self::is_product_browser_url() ) {
109
  $redirect = Ecwid_Store_Page::get_category_url( $params['id'] );
110
  }
111
 
112
+ if( isset($redirect) ) {
113
  wp_safe_redirect( $redirect, 301 );
114
  exit;
115
  }
220
  $url = str_replace( ':443', '', $url );
221
  }
222
 
223
+ $result = self::get_js_config_storefront_urls();
224
+
225
+ $result .= <<<JS
226
+ window.ec.config.baseUrl = '$url';
227
+ window.ec.storefront = window.ec.storefront || {};
228
+ window.ec.storefront.sharing_button_link = "DIRECT_PAGE_URL";
229
+
230
  JS;
231
  $config .= $result;
232
 
233
  return $config;
234
  }
235
 
236
+ public static function get_js_config_storefront_urls() {
237
+ return <<<JS
238
+ window.ec.config.storefrontUrls = window.ec.config.storefrontUrls || {};
239
+ window.ec.config.storefrontUrls.cleanUrls = true;
240
+ JS;
241
+ }
242
+
243
  public static function is_404_seo_link() {
244
 
245
  if ( ! self::is_product_browser_url() ) {
includes/class-ecwid-static-page.php CHANGED
@@ -330,6 +330,10 @@ class Ecwid_Static_Page {
330
  if ( !EcwidPlatform::is_catalog_cache_trusted() ) {
331
  return false;
332
  }
 
 
 
 
333
 
334
  if ( get_option( self::OPTION_IS_ENABLED ) == self::OPTION_VALUE_ENABLED ) {
335
  return true;
330
  if ( !EcwidPlatform::is_catalog_cache_trusted() ) {
331
  return false;
332
  }
333
+
334
+ if( Ecwid_Ajax_Defer_Renderer::is_ajax_request() ) {
335
+ return false;
336
+ }
337
 
338
  if ( get_option( self::OPTION_IS_ENABLED ) == self::OPTION_VALUE_ENABLED ) {
339
  return true;
includes/integrations/class-ecwid-integration-litespeed-cache.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ecwid_Integration_LitespeedCache
3
+ {
4
+ public function __construct()
5
+ {
6
+ add_filter( 'litespeed_optimize_js_excludes', array( $this, 'hook_js_exclude' ) );
7
+ add_filter( 'litespeed_optimize_css_excludes', array( $this, 'hook_css_exclude' ) );
8
+ }
9
+
10
+ public function hook_css_exclude($exclude) {
11
+
12
+ $exclude[] = 'ecwid-shopping-cart/css/fonts.css';
13
+
14
+ return $exclude;
15
+ }
16
+
17
+ public function hook_js_exclude($exclude) {
18
+ $exclude[] = Ecwid_Static_Page::HANDLE_STATIC_PAGE . '.js';
19
+ $exclude[] = 'script.js?' . EcwidPlatform::get_store_id();
20
+
21
+ return $exclude;
22
+ }
23
+ }
24
+
25
+ $ecwid_integration_litespeed_cache = new Ecwid_Integration_LitespeedCache();
includes/integrations/class-ecwid-integration-wpml.php CHANGED
@@ -69,7 +69,12 @@ class Ecwid_Integration_WPML
69
 
70
  public function add_inline_js_config( $js ) {
71
  if( is_array( $this->hreflang_items ) ) {
72
- $js .= 'window.ec.config.storefrontUrls.enableHreflangTags = true;';
 
 
 
 
 
73
  $js .= 'window.ec.config.storefrontUrls.internationalPages = {';
74
 
75
  foreach( $this->hreflang_items as $lang => $url ) {
69
 
70
  public function add_inline_js_config( $js ) {
71
  if( is_array( $this->hreflang_items ) ) {
72
+
73
+ if( !Ecwid_Store_Page::is_store_page() ) {
74
+ $js .= Ecwid_Seo_Links::get_js_config_storefront_urls();
75
+ }
76
+
77
+ $js .= 'window.ec.config.storefrontUrls.enableHreflangTags = true;' . PHP_EOL;
78
  $js .= 'window.ec.config.storefrontUrls.internationalPages = {';
79
 
80
  foreach( $this->hreflang_items as $lang => $url ) {
includes/shortcodes/class-ecwid-shortcode-base.php CHANGED
@@ -107,7 +107,7 @@ abstract class Ecwid_Shortcode_Base {
107
  $function = $this->get_ecwid_widget_function_name();
108
 
109
  return <<<HTML
110
- <script data-cfasync="false" type="text/javascript"> $function($params_string);</script>
111
  HTML;
112
  }
113
 
107
  $function = $this->get_ecwid_widget_function_name();
108
 
109
  return <<<HTML
110
+ <script data-cfasync="false" data-no-optimize="1" type="text/javascript"> $function($params_string);</script>
111
  HTML;
112
  }
113
 
includes/shortcodes/class-ecwid-shortcode-productbrowser.php CHANGED
@@ -49,7 +49,7 @@ class Ecwid_Shortcode_ProductBrowser extends Ecwid_Shortcode_Base {
49
  if ( $ecwid_current_theme ) {
50
 
51
  $code = <<<HTML
52
- <script data-cfasync="false" >
53
  if( typeof document.documentElement.id == 'undefined' || document.documentElement.id === '' ) {
54
  document.documentElement.id = 'ecwid_html';
55
  }
@@ -77,7 +77,7 @@ HTML;
77
 
78
  $js_code = Ecwid_Static_Page::get_js_code();
79
  if( !empty( $js_code ) ) {
80
- $code .= sprintf('<script data-cfasync="false" type="text/javascript">%s</script>', $js_code) . PHP_EOL;
81
  }
82
 
83
  return $code;
@@ -85,7 +85,7 @@ HTML;
85
 
86
  protected function _get_js_switch_dynamic( $static_container_id, $dynamic_container_id ) {
87
  return <<<HTML
88
- <script data-cfasync="false" type="text/javascript">
89
  window.ec.storefront = window.ec.storefront || {};
90
  window.ec.storefront.staticPages = window.ec.storefront.staticPages || Object();
91
 
@@ -100,7 +100,7 @@ HTML;
100
 
101
  protected function _get_js_hide_static( $html_selector ) {
102
  return <<<HTML
103
- <script data-cfasync="false" type="text/javascript">
104
  function createClass(name,rules){
105
  var style = document.createElement('style');
106
  style.type = 'text/css';
49
  if ( $ecwid_current_theme ) {
50
 
51
  $code = <<<HTML
52
+ <script data-cfasync="false" data-no-optimize="1">
53
  if( typeof document.documentElement.id == 'undefined' || document.documentElement.id === '' ) {
54
  document.documentElement.id = 'ecwid_html';
55
  }
77
 
78
  $js_code = Ecwid_Static_Page::get_js_code();
79
  if( !empty( $js_code ) ) {
80
+ $code .= sprintf('<script data-cfasync="false" data-no-optimize="1" type="text/javascript">%s</script>', $js_code) . PHP_EOL;
81
  }
82
 
83
  return $code;
85
 
86
  protected function _get_js_switch_dynamic( $static_container_id, $dynamic_container_id ) {
87
  return <<<HTML
88
+ <script data-cfasync="false" data-no-optimize="1" type="text/javascript">
89
  window.ec.storefront = window.ec.storefront || {};
90
  window.ec.storefront.staticPages = window.ec.storefront.staticPages || Object();
91
 
100
 
101
  protected function _get_js_hide_static( $html_selector ) {
102
  return <<<HTML
103
+ <script data-cfasync="false" data-no-optimize="1" type="text/javascript">
104
  function createClass(name,rules){
105
  var style = document.createElement('style');
106
  style.type = 'text/css';
js/static-page.js CHANGED
@@ -197,7 +197,7 @@
197
  }
198
 
199
  function ecwidLoaded() {
200
- return !!Ecwid && !!Ecwid.OnAPILoaded && !!Ecwid.OnAPILoaded.add;
201
  }
202
 
203
  if (ecwidLoaded()) {
197
  }
198
 
199
  function ecwidLoaded() {
200
+ return typeof Ecwid != 'undefined' && !!Ecwid && !!Ecwid.OnAPILoaded && !!Ecwid.OnAPILoaded.add;
201
  }
202
 
203
  if (ecwidLoaded()) {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Ecwid
3
  Tags: ecommerce, e-commerce, storefront, online store, sell
4
  Requires at least: 3.7
5
  Tested up to: 5.5
6
- Stable tag: 6.10.5
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
@@ -154,8 +154,9 @@ You can use Ecwid’s built-in import tools to copy your store products from any
154
 
155
  == Changelog ==
156
 
157
- = 6.10.5 - Aug 27, 2020 =
158
- - **Fixes for the Open Graph title tags (og:title and twitter:title tags).** When you shared a link to a page of your store in social networks, the link preview could have a wrong title, we fixed it.
159
- - **Improved automatic cleanup of the plugin cache.** The Ecwid plugin stores your products data on cloud servers, so the plugin shouldn't take a lot of space on your site server. However some users observed a database table overflow with the plugin cache. That happens in rare cases when the plugin data is not cleaned up properly by Wordpress. We improved automatic cleanup of the plugin cache. The problem should be solved now.
 
160
 
161
  [See full changelog](https://raw.githubusercontent.com/Ecwid/ecwid-wordpress-plugin/master/CHANGELOG.txt)
3
  Tags: ecommerce, e-commerce, storefront, online store, sell
4
  Requires at least: 3.7
5
  Tested up to: 5.5
6
+ Stable tag: 6.10.6
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
154
 
155
  == Changelog ==
156
 
157
+ = 6.10.6 - Sep 23, 2020 =
158
+ - Сompatibility with LiteSpeed cache plugin. We've fixed plugin compatibility issues. If you are using LightSpeed to speed up your WordPress site and Ecwid, they should work fine. If you see problems, please let us know.
159
+ - Improved compatibility with themes that update site content without page reload (AJAX themes). Some users of such themes may have seen problems in the display of the storefront, we fixed that.
160
+ - Minor fixes and improvements.
161
 
162
  [See full changelog](https://raw.githubusercontent.com/Ecwid/ecwid-wordpress-plugin/master/CHANGELOG.txt)