Ecwid Ecommerce Shopping Cart - Version 4.0.4

Version Description

  • Fixed an issue affecting site preview in Wordpress Customizer in some themes. Now the preview in the customizer tool should work fine.
Download this release

Release Info

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

Code changes from version 4.0.3 to 4.0.4

ecwid-shopping-cart.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.ecwid.com?source=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 Team
8
- Version: 4.0.3
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
@@ -16,6 +16,7 @@ register_uninstall_hook( __FILE__, 'ecwid_uninstall' );
16
  define("APP_ECWID_COM", 'app.ecwid.com');
17
  define("ECWID_DEMO_STORE_ID", 1003);
18
 
 
19
  if ( ! defined( 'ECWID_PLUGIN_DIR' ) ) {
20
  define( 'ECWID_PLUGIN_DIR', plugin_dir_path( realpath(__FILE__) ) );
21
  }
@@ -861,7 +862,7 @@ function ecwid_get_product_and_category($category_id, $product_id) {
861
 
862
  function ecwid_get_title_separator()
863
  {
864
- $sep = apply_filters('document_title_separator');
865
 
866
  if (!empty($sep)) {
867
  return $sep;
@@ -982,10 +983,10 @@ function ecwid_content_started($content)
982
 
983
  function ecwid_wrap_shortcode_content($content, $name, $attrs)
984
  {
985
- return "<!-- Ecwid shopping cart plugin v 4.0.3 --><!-- noptimize -->"
986
  . ecwid_get_scriptjs_code(@$attrs['lang'])
987
  . "<div class=\"ecwid-shopping-cart-$name\">$content</div>"
988
- . "<!-- /noptimize --><!-- END Ecwid Shopping Cart v 4.0.3 -->";
989
  }
990
 
991
  function ecwid_get_scriptjs_code($force_lang = null) {
@@ -1619,7 +1620,7 @@ function ecwid_nav_menu_items($items)
1619
 
1620
  if ( false == $categories ) {
1621
  $callback = 'ecwidcatscallback';
1622
- $result = EcwidPlatform::fetch_url('https://my.ecwid.com/categories.js?ownerid=' . get_ecwid_store_id() . '&callback=' . $callback);
1623
  $result = $result['data'];
1624
 
1625
  $prefix_length = strlen($callback . '(');
@@ -1658,7 +1659,11 @@ function ecwid_nav_menu_items($items)
1658
  $post->type = 'post';
1659
  $post->db_id = 0;
1660
  $post->title = $category->name;
 
1661
  $post->object = '';
 
 
 
1662
  $post->object_id = 0;
1663
  array_splice($items, $key + $counter, 0, array($post));
1664
  }
@@ -2831,7 +2836,9 @@ function ecwid_send_stats()
2831
  {
2832
  $storeid = get_ecwid_store_id();
2833
 
2834
- if ($storeid == ECWID_DEMO_STORE_ID) return;
 
 
2835
 
2836
  $last_stats_sent = get_option('ecwid_stats_sent_date');
2837
  if (!$last_stats_sent) {
@@ -2911,6 +2918,15 @@ function ecwid_gather_stats()
2911
  $stats['wp_install_date'] = $usage_stats['wp_install_date'];
2912
  $stats['plugin_install_date'] = $usage_stats['wp_install_date'];
2913
 
 
 
 
 
 
 
 
 
 
2914
  return $stats;
2915
  }
2916
 
@@ -2974,6 +2990,25 @@ function ecwid_gather_usage_stats()
2974
  return $usage_stats;
2975
  }
2976
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2977
  function ecwid_sidebar_widgets_init() {
2978
  register_widget('EcwidMinicartWidget');
2979
  register_widget('EcwidSearchWidget');
@@ -3151,6 +3186,10 @@ function ecwid_embed_svg($name) {
3151
  echo $code;
3152
  }
3153
 
 
 
 
 
3154
  /*
3155
  * Basically a copy of has_shortcode that returns the matched shortcode
3156
  */
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 Team
8
+ Version: 4.0.4
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
16
  define("APP_ECWID_COM", 'app.ecwid.com');
17
  define("ECWID_DEMO_STORE_ID", 1003);
18
 
19
+
20
  if ( ! defined( 'ECWID_PLUGIN_DIR' ) ) {
21
  define( 'ECWID_PLUGIN_DIR', plugin_dir_path( realpath(__FILE__) ) );
22
  }
862
 
863
  function ecwid_get_title_separator()
864
  {
865
+ $sep = apply_filters('document_title_separator', '|');
866
 
867
  if (!empty($sep)) {
868
  return $sep;
983
 
984
  function ecwid_wrap_shortcode_content($content, $name, $attrs)
985
  {
986
+ return "<!-- Ecwid shopping cart plugin v 4.0.4 --><!-- noptimize -->"
987
  . ecwid_get_scriptjs_code(@$attrs['lang'])
988
  . "<div class=\"ecwid-shopping-cart-$name\">$content</div>"
989
+ . "<!-- /noptimize --><!-- END Ecwid Shopping Cart v 4.0.4 -->";
990
  }
991
 
992
  function ecwid_get_scriptjs_code($force_lang = null) {
1620
 
1621
  if ( false == $categories ) {
1622
  $callback = 'ecwidcatscallback';
1623
+ $result = EcwidPlatform::fetch_url(ecwid_get_categories_js_url($callback));
1624
  $result = $result['data'];
1625
 
1626
  $prefix_length = strlen($callback . '(');
1659
  $post->type = 'post';
1660
  $post->db_id = 0;
1661
  $post->title = $category->name;
1662
+ $post->target = '';
1663
  $post->object = '';
1664
+ $post->attr_title = '';
1665
+ $post->description = '';
1666
+ $post->xfn = '';
1667
  $post->object_id = 0;
1668
  array_splice($items, $key + $counter, 0, array($post));
1669
  }
2836
  {
2837
  $storeid = get_ecwid_store_id();
2838
 
2839
+ if ($storeid == ECWID_DEMO_STORE_ID) {
2840
+ $storeid = 805056;
2841
+ }
2842
 
2843
  $last_stats_sent = get_option('ecwid_stats_sent_date');
2844
  if (!$last_stats_sent) {
2918
  $stats['wp_install_date'] = $usage_stats['wp_install_date'];
2919
  $stats['plugin_install_date'] = $usage_stats['wp_install_date'];
2920
 
2921
+ $checked = get_option('ecwid_checked_for_remote_connection_errors', null);
2922
+ if (is_null($checked) || $usage_stats['ecwid_remote_get_fails'] || $usage_stats['http_post_fails']) {
2923
+ $results = ecwid_check_for_remote_connection_errors();
2924
+ if (!empty($results)) {
2925
+ $stats = array_merge($stats, $results);
2926
+ }
2927
+ get_option('ecwid_checked_for_remote_connection_errors', empty($results));
2928
+ }
2929
+
2930
  return $stats;
2931
  }
2932
 
2990
  return $usage_stats;
2991
  }
2992
 
2993
+ function ecwid_check_for_remote_connection_errors()
2994
+ {
2995
+ global $ecwid_oauth;
2996
+
2997
+ $results = array();
2998
+ $results['https_get_error'] = wp_remote_get(ecwid_get_categories_js_url('abc'));
2999
+ $results['https_post_error'] = wp_remote_post($ecwid_oauth->get_test_post_url());
3000
+
3001
+ foreach ($results as $type => $value) {
3002
+ if (is_wp_error($value)) {
3003
+ $results[$type] = $value->get_error_message();
3004
+ } else {
3005
+ unset($results[$type]);
3006
+ }
3007
+ }
3008
+
3009
+ return $results;
3010
+ }
3011
+
3012
  function ecwid_sidebar_widgets_init() {
3013
  register_widget('EcwidMinicartWidget');
3014
  register_widget('EcwidSearchWidget');
3186
  echo $code;
3187
  }
3188
 
3189
+ function ecwid_get_categories_js_url($callback) {
3190
+ return 'https://my.ecwid.com/categories.js?ownerid=' . get_ecwid_store_id() . '&callback=' . $callback;
3191
+ }
3192
+
3193
  /*
3194
  * Basically a copy of has_shortcode that returns the matched shortcode
3195
  */
includes/class-ecwid-oauth.php CHANGED
@@ -37,11 +37,17 @@ class Ecwid_OAuth {
37
 
38
  public function test_post()
39
  {
40
- $return = wp_remote_post('https://my.ecwid.com/api/oauth/token');
41
 
42
  return is_array($return);
43
  }
44
 
 
 
 
 
 
 
45
  public function get_auth_dialog_url()
46
  {
47
  $action = 'ecwid_oauth';
37
 
38
  public function test_post()
39
  {
40
+ $return = wp_remote_post($this->get_test_post_url());
41
 
42
  return is_array($return);
43
  }
44
 
45
+ public function get_test_post_url()
46
+ {
47
+ return 'https://my.ecwid.com/api/oauth/token';
48
+ }
49
+
50
+
51
  public function get_auth_dialog_url()
52
  {
53
  $action = 'ecwid_oauth';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: ecwid
3
  Tags: ecwid, shopping cart, ecommerce, wordpress ecommerce, wp e-commerce, paypal, e-commerce, online store, store, shop, cart, online shop, shopping, digital goods, downloadable products, product catalog, ecomerce, products, facebook, f-commerce
4
  Requires at least: 3.5
5
  Tested up to: 4.4
6
- Stable tag: 4.0.3
7
 
8
  Ecwid is a full-featured shopping cart that can be added to any Wordpress site in less than 5 minutes. Start using Ecwid for free today.
9
 
@@ -107,6 +107,9 @@ http://codex.wordpress.org/Managing_Plugins#Installing_Plugins
107
  * [Ecwid site](http://www.ecwid.com/?source=wporg-plugin-site "Ecwid Site")
108
 
109
  == Changelog ==
 
 
 
110
  = 4.0.3 =
111
  - Fixes for a few warning messages appearing on some sites with the new version of the plugin (v4).
112
 
3
  Tags: ecwid, shopping cart, ecommerce, wordpress ecommerce, wp e-commerce, paypal, e-commerce, online store, store, shop, cart, online shop, shopping, digital goods, downloadable products, product catalog, ecomerce, products, facebook, f-commerce
4
  Requires at least: 3.5
5
  Tested up to: 4.4
6
+ Stable tag: 4.0.4
7
 
8
  Ecwid is a full-featured shopping cart that can be added to any Wordpress site in less than 5 minutes. Start using Ecwid for free today.
9
 
107
  * [Ecwid site](http://www.ecwid.com/?source=wporg-plugin-site "Ecwid Site")
108
 
109
  == Changelog ==
110
+ = 4.0.4 =
111
+ - Fixed an issue affecting site preview in Wordpress Customizer in some themes. Now the preview in the customizer tool should work fine.
112
+
113
  = 4.0.3 =
114
  - Fixes for a few warning messages appearing on some sites with the new version of the plugin (v4).
115