Ecwid Ecommerce Shopping Cart - Version 6.10.11

Version Description

  • Mar 24, 2021 =
  • Improved compatibility with Oxygen Builder plugin. We noticed that the Ecwid plugin affected some settings on the Oxygen Builder editor page. We fixed it, now it works fine.
  • Improvements for the single product widgets added via the Ecwid shopping cart plugin. We enhanced the SEO structured product data for sidebar widgets to make them meet the latest Google recommendations.
  • Minor fixes and improvements.

See full changelog

Download this release

Release Info

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

Code changes from version 6.10.10 to 6.10.11

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.10
9
  Author URI: https://ecwid.to/ecwid-site
10
  License: GPLv2 or later
11
  */
@@ -50,7 +50,7 @@ if ( is_admin() ) {
50
 
51
  add_action( 'admin_init', 'ecwid_settings_api_init' );
52
  add_action( 'admin_init', 'ecwid_check_version' );
53
- add_action('wp_ajax_check_api_cache', 'ecwid_admin_check_api_cache');
54
 
55
  add_action( 'admin_enqueue_scripts', 'ecwid_common_admin_scripts' );
56
  add_action( 'admin_enqueue_scripts', 'ecwid_register_admin_styles' );
@@ -365,7 +365,8 @@ function ecwid_enqueue_frontend() {
365
  wp_enqueue_script('ecwid-historyjs-wa', ECWID_PLUGIN_URL . 'js/historywa.js');
366
  }
367
 
368
- if (!wp_script_is('jquery-ui-widget')) {
 
369
  wp_enqueue_script('jquery-ui-widget', includes_url() . 'js/jquery/ui/widget.min.js', array('jquery'));
370
  }
371
 
@@ -994,6 +995,10 @@ function ecwid_regular_cache_check()
994
  EcwidPlatform::clear_all_transients();
995
  update_option( 'ecwid_last_transients_check', time() );
996
  }
 
 
 
 
997
  }
998
  }
999
 
@@ -1598,11 +1603,8 @@ EOT;
1598
  add_option("ecwid_pb_defaultview", 'grid', '', 'yes');
1599
  add_option("ecwid_pb_searchview", 'list', '', 'yes');
1600
 
1601
- add_option("ecwid_mobile_catalog_link", '', '', 'yes');
1602
- add_option("ecwid_default_category_id", '', '', 'yes');
1603
-
1604
- add_option('ecwid_is_api_enabled', 'on', '', 'yes');
1605
- add_option('ecwid_api_check_time', 0, '', 'yes');
1606
 
1607
  add_option('ecwid_show_vote_message', true);
1608
 
@@ -1771,8 +1773,6 @@ function ecwid_uninstall() {
1771
  delete_option("ecwid_pb_searchview");
1772
  delete_option("ecwid_mobile_catalog_link");
1773
  delete_option("ecwid_default_category_id");
1774
- delete_option('ecwid_is_api_enabled');
1775
- delete_option('ecwid_api_check_time');
1776
  delete_option('ecwid_show_vote_message');
1777
  delete_option("ecwid_sso_secret_key");
1778
  delete_option("ecwid_installation_date");
@@ -2080,10 +2080,9 @@ function ecwid_settings_api_init() {
2080
  if ( isset( $_POST['ecwid_store_id'] ) ) {
2081
 
2082
  ecwid_update_store_id( $_POST['ecwid_store_id'] );
2083
- update_option('ecwid_is_api_enabled', 'off');
2084
- update_option('ecwid_api_check_time', 0);
2085
  update_option('ecwid_last_oauth_fail_time', 0);
2086
- update_option( 'ecwid_connected_via_legacy_page_time', time() );
2087
  }
2088
 
2089
 
@@ -2370,8 +2369,7 @@ function ecwid_admin_post_connect()
2370
 
2371
  if (isset($_GET['force_store_id'])) {
2372
  update_option('ecwid_store_id', $_GET['force_store_id']);
2373
- update_option('ecwid_is_api_enabled', 'off');
2374
- update_option('ecwid_api_check_time', 0);
2375
  update_option('ecwid_last_oauth_fail_time', 1);
2376
  wp_safe_redirect( Ecwid_Admin::get_dashboard_url() );
2377
  exit();
@@ -2987,8 +2985,7 @@ function ecwid_update_store_id( $new_store_id ) {
2987
  EcwidPlatform::cache_reset( 'nav_categories_posts' );
2988
 
2989
  update_option( 'ecwid_store_id', $new_store_id );
2990
- update_option( 'ecwid_is_api_enabled', 'off' );
2991
- update_option( 'ecwid_api_check_time', 0 );
2992
 
2993
  ecwid_invalidate_cache( true );
2994
  EcwidPlatform::cache_reset('all_categories');
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.11
9
  Author URI: https://ecwid.to/ecwid-site
10
  License: GPLv2 or later
11
  */
50
 
51
  add_action( 'admin_init', 'ecwid_settings_api_init' );
52
  add_action( 'admin_init', 'ecwid_check_version' );
53
+ add_action( 'wp_ajax_check_api_cache', 'ecwid_admin_check_api_cache' );
54
 
55
  add_action( 'admin_enqueue_scripts', 'ecwid_common_admin_scripts' );
56
  add_action( 'admin_enqueue_scripts', 'ecwid_register_admin_styles' );
365
  wp_enqueue_script('ecwid-historyjs-wa', ECWID_PLUGIN_URL . 'js/historywa.js');
366
  }
367
 
368
+ $version = get_bloginfo('version');
369
+ if ( !wp_script_is('jquery-ui-widget') && version_compare($version, '5.6') < 0 ) {
370
  wp_enqueue_script('jquery-ui-widget', includes_url() . 'js/jquery/ui/widget.min.js', array('jquery'));
371
  }
372
 
995
  EcwidPlatform::clear_all_transients();
996
  update_option( 'ecwid_last_transients_check', time() );
997
  }
998
+
999
+ if ( EcwidPlatform::is_need_clear_transients() ) {
1000
+ EcwidPlatform::clear_all_transients();
1001
+ }
1002
  }
1003
  }
1004
 
1603
  add_option("ecwid_pb_defaultview", 'grid', '', 'yes');
1604
  add_option("ecwid_pb_searchview", 'list', '', 'yes');
1605
 
1606
+ add_option("ecwid_mobile_catalog_link", '', '', 'yes');
1607
+ add_option("ecwid_default_category_id", '', '', 'yes');
 
 
 
1608
 
1609
  add_option('ecwid_show_vote_message', true);
1610
 
1773
  delete_option("ecwid_pb_searchview");
1774
  delete_option("ecwid_mobile_catalog_link");
1775
  delete_option("ecwid_default_category_id");
 
 
1776
  delete_option('ecwid_show_vote_message');
1777
  delete_option("ecwid_sso_secret_key");
1778
  delete_option("ecwid_installation_date");
2080
  if ( isset( $_POST['ecwid_store_id'] ) ) {
2081
 
2082
  ecwid_update_store_id( $_POST['ecwid_store_id'] );
2083
+ update_option('ecwid_api_check_retry_after', 0);
 
2084
  update_option('ecwid_last_oauth_fail_time', 0);
2085
+ update_option('ecwid_connected_via_legacy_page_time', time());
2086
  }
2087
 
2088
 
2369
 
2370
  if (isset($_GET['force_store_id'])) {
2371
  update_option('ecwid_store_id', $_GET['force_store_id']);
2372
+ update_option('ecwid_api_check_retry_after', 0);
 
2373
  update_option('ecwid_last_oauth_fail_time', 1);
2374
  wp_safe_redirect( Ecwid_Admin::get_dashboard_url() );
2375
  exit();
2985
  EcwidPlatform::cache_reset( 'nav_categories_posts' );
2986
 
2987
  update_option( 'ecwid_store_id', $new_store_id );
2988
+ update_option( 'ecwid_api_check_retry_after', 0 );
 
2989
 
2990
  ecwid_invalidate_cache( true );
2991
  EcwidPlatform::cache_reset('all_categories');
includes/class-ecwid-admin-main-page.php CHANGED
@@ -112,10 +112,6 @@ class Ecwid_Admin_Main_Page
112
  $page = sanitize_text_field( $_GET['ec-store-page'] );
113
  }
114
 
115
- if ( $page == self::PAGE_HASH_UPGRADE ) {
116
- update_option('ecwid_api_check_time', time() - ECWID_API_AVAILABILITY_CHECK_TIME + 10 * 60);
117
- }
118
-
119
  if ( $page == self::PAGE_HASH_DASHBOARD || $page == self::PAGE_HASH_COMPLETE_REGISTRATION ) {
120
  $show_reconnect = true;
121
  }
112
  $page = sanitize_text_field( $_GET['ec-store-page'] );
113
  }
114
 
 
 
 
 
115
  if ( $page == self::PAGE_HASH_DASHBOARD || $page == self::PAGE_HASH_COMPLETE_REGISTRATION ) {
116
  $show_reconnect = true;
117
  }
includes/class-ecwid-oauth.php CHANGED
@@ -136,7 +136,6 @@ class Ecwid_OAuth {
136
  ecwid_update_store_id( $result->store_id );
137
 
138
  update_option( 'ecwid_oauth_scope', $result->scope );
139
- update_option( 'ecwid_api_check_time', 0 );
140
  update_option( 'ecwid_public_token', $result->public_token );
141
  update_option( self::OPTION_JUST_CONNECTED, true );
142
  EcwidPlatform::cache_reset( 'all_categories' );
@@ -163,8 +162,6 @@ class Ecwid_OAuth {
163
  {
164
  update_option( 'ecwid_store_id', ecwid_get_demo_store_id() );
165
  $this->api->save_token( '' );
166
- update_option( 'ecwid_is_api_enabled', 'off' );
167
- update_option( 'ecwid_api_check_time', 0 );
168
 
169
  wp_safe_redirect( Ecwid_Admin::get_dashboard_url() );
170
  exit;
136
  ecwid_update_store_id( $result->store_id );
137
 
138
  update_option( 'ecwid_oauth_scope', $result->scope );
 
139
  update_option( 'ecwid_public_token', $result->public_token );
140
  update_option( self::OPTION_JUST_CONNECTED, true );
141
  EcwidPlatform::cache_reset( 'all_categories' );
162
  {
163
  update_option( 'ecwid_store_id', ecwid_get_demo_store_id() );
164
  $this->api->save_token( '' );
 
 
165
 
166
  wp_safe_redirect( Ecwid_Admin::get_dashboard_url() );
167
  exit;
includes/widgets/class-ecwid-widget-products-base.php CHANGED
@@ -121,13 +121,14 @@ HTML;
121
  }
122
 
123
  $name = esc_html($product->name);
 
124
 
125
  echo <<<HTML
126
  <a class="product" href="$product->link" data-ecwid-page="product" data-ecwid-product-id="$product->id" alt="$name" title="$name">
127
  <div class="ecwid ecwid-SingleProduct ecwid-Product ecwid-Product-$product->id" data-single-product-link="$product->link" itemscope itemtype="http://schema.org/Product" data-single-product-id="$product->id">
128
  <div itemprop="image" data-force-image="$force_image"></div>
129
- <div class="ecwid-title" itemprop="name"></div>
130
- <div itemtype="http://schema.org/Offer" itemscope itemprop="offers"><div class="ecwid-productBrowser-price ecwid-price" itemprop="price"></div></div>
131
  </div>
132
  <!-- noptimize --><script type="text/javascript">xSingleProduct();</script><!-- /noptimize -->
133
  </a>
121
  }
122
 
123
  $name = esc_html($product->name);
124
+ $price = $product->price;
125
 
126
  echo <<<HTML
127
  <a class="product" href="$product->link" data-ecwid-page="product" data-ecwid-product-id="$product->id" alt="$name" title="$name">
128
  <div class="ecwid ecwid-SingleProduct ecwid-Product ecwid-Product-$product->id" data-single-product-link="$product->link" itemscope itemtype="http://schema.org/Product" data-single-product-id="$product->id">
129
  <div itemprop="image" data-force-image="$force_image"></div>
130
+ <div class="ecwid-title" itemprop="name" content="$name"></div>
131
+ <div itemtype="http://schema.org/Offer" itemscope itemprop="offers"><div class="ecwid-productBrowser-price ecwid-price" itemprop="price" content="$price"></div></div>
132
  </div>
133
  <!-- noptimize --><script type="text/javascript">xSingleProduct();</script><!-- /noptimize -->
134
  </a>
lib/ecwid_platform.php CHANGED
@@ -19,6 +19,8 @@ class EcwidPlatform {
19
 
20
  const OPTION_LOG_CACHE = 'ecwid_log_cache';
21
  const OPTION_ECWID_PLUGIN_DATA = 'ecwid_plugin_data';
 
 
22
 
23
  static public function get_store_id()
24
  {
@@ -229,13 +231,21 @@ class EcwidPlatform {
229
 
230
  static public function fetch_url($url, $options = array())
231
  {
232
- $default_timeout = 10;
233
 
 
 
 
 
 
 
 
234
 
235
  if (get_option('ecwid_http_use_stream', false)) {
236
  self::$http_use_streams = true;
237
  }
238
 
 
239
  $result = wp_remote_get( $url, array_merge(
240
  array(
241
  'timeout' => get_option( 'ecwid_remote_get_timeout', $default_timeout )
@@ -244,6 +254,15 @@ class EcwidPlatform {
244
  )
245
  );
246
 
 
 
 
 
 
 
 
 
 
247
  if (get_option('ecwid_http_use_stream', false)) {
248
  self::$http_use_streams = false;
249
  }
@@ -520,14 +539,32 @@ class EcwidPlatform {
520
  EcwidPlatform::set( self::FORCES_CATALOG_CACHE_RESET_VALID_FROM, $time );
521
  }
522
 
523
- public static function clear_all_transients() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
  global $wpdb;
525
 
526
  $sql = "
527
  DELETE
528
  FROM {$wpdb->options}
529
- WHERE option_name like '\_transient\_ecwid\_%'
530
- OR option_name like '\_transient\_timeout\_ecwid\_%'
531
  ";
532
 
533
  $wpdb->query($sql);
19
 
20
  const OPTION_LOG_CACHE = 'ecwid_log_cache';
21
  const OPTION_ECWID_PLUGIN_DATA = 'ecwid_plugin_data';
22
+
23
+ const TRANSIENTS_LIMIT = 30000;
24
 
25
  static public function get_store_id()
26
  {
231
 
232
  static public function fetch_url($url, $options = array())
233
  {
234
+ $api_check_retry_after = get_option('ecwid_api_check_retry_after', 0);
235
 
236
+ if( $api_check_retry_after > time() ) {
237
+ return array(
238
+ 'code' => '429',
239
+ 'data' => '',
240
+ 'message' => 'Too Many Requests'
241
+ );
242
+ }
243
 
244
  if (get_option('ecwid_http_use_stream', false)) {
245
  self::$http_use_streams = true;
246
  }
247
 
248
+ $default_timeout = 10;
249
  $result = wp_remote_get( $url, array_merge(
250
  array(
251
  'timeout' => get_option( 'ecwid_remote_get_timeout', $default_timeout )
254
  )
255
  );
256
 
257
+ if( wp_remote_retrieve_response_code($result) == '429' ) {
258
+
259
+ $retry_after = intval( wp_remote_retrieve_header($result, 'retry-after') );
260
+
261
+ if( $retry_after > 0 ) {
262
+ update_option( 'ecwid_api_check_retry_after', time() + $retry_after );
263
+ }
264
+ }
265
+
266
  if (get_option('ecwid_http_use_stream', false)) {
267
  self::$http_use_streams = false;
268
  }
539
  EcwidPlatform::set( self::FORCES_CATALOG_CACHE_RESET_VALID_FROM, $time );
540
  }
541
 
542
+ static public function is_need_clear_transients() {
543
+ global $wpdb;
544
+
545
+ $sql = "
546
+ SELECT COUNT(*)
547
+ FROM {$wpdb->options}
548
+ WHERE option_name LIKE '\_transient\_ecwid\_%'
549
+ ";
550
+
551
+ $count_transients = $wpdb->get_var($sql);
552
+
553
+ if( $count_transients >= self::TRANSIENTS_LIMIT ) {
554
+ return true;
555
+ }
556
+
557
+ return false;
558
+ }
559
+
560
+ static public function clear_all_transients() {
561
  global $wpdb;
562
 
563
  $sql = "
564
  DELETE
565
  FROM {$wpdb->options}
566
+ WHERE option_name LIKE '\_transient\_ecwid\_%'
567
+ OR option_name LIKE '\_transient\_timeout\_ecwid\_%'
568
  ";
569
 
570
  $wpdb->query($sql);
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.7
6
- Stable tag: 6.10.10
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
@@ -156,10 +156,9 @@ You can use Ecwid’s built-in import tools to copy your store products from any
156
 
157
  == Changelog ==
158
 
159
- = 6.10.10 - Mar 10, 2021 =
160
- - **WordPress 5.7 compatibility.** The new WordPress version is released. The Ecwid ecommerce shopping cart plugin is ready for the new release everything works well in your WordPress admin and storefront pages. Feel free to upgrade your site to WordPress 5.7.
161
- - **Improved compatibility with WP Rocket and SG Optimizer cache plugins**. If you have one of those plugins installed and noticed any issue, it should be fixed now. If you still see a problem, please let us know.
162
- - Improvements for the Ecwid ecommerce blocks in Gutenberg editor.
163
  - Minor fixes and improvements.
164
 
165
  [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.7
6
+ Stable tag: 6.10.11
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
156
 
157
  == Changelog ==
158
 
159
+ = 6.10.11 - Mar 24, 2021 =
160
+ - Improved compatibility with Oxygen Builder plugin. We noticed that the Ecwid plugin affected some settings on the Oxygen Builder editor page. We fixed it, now it works fine.
161
+ - Improvements for the single product widgets added via the Ecwid shopping cart plugin. We enhanced the SEO structured product data for sidebar widgets to make them meet the latest Google recommendations.
 
162
  - Minor fixes and improvements.
163
 
164
  [See full changelog](https://raw.githubusercontent.com/Ecwid/ecwid-wordpress-plugin/master/CHANGELOG.txt)