Ecwid Ecommerce Shopping Cart - Version 6.4.7

Version Description

  • Dec 14, 2018 =
  • - Compatibility fixes for Elementor and Gravity Forms. Thanks to a user report, we found a few glitches in how the Ecwid e-commerce plugin works with Elementor and Gravity Forms. All fixed the plugins should work fine together now
Download this release

Release Info

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

Code changes from version 6.4.6 to 6.4.7

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 Ecommerce
8
- Version: 6.4.6
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
@@ -90,7 +90,6 @@ if ( is_admin() ){
90
  add_action('wp_head', 'ecwid_print_inline_js_config');
91
  add_action('wp_head', 'ecwid_product_browser_url_in_head');
92
  add_filter( 'widget_meta_poweredby', 'ecwid_add_credits');
93
- add_filter('the_content', 'ecwid_content_started', 0);
94
  add_filter('body_class', 'ecwid_body_class');
95
  add_action('redirect_canonical', 'ecwid_redirect_canonical', 10, 2 );
96
  add_action('init', 'ecwid_check_api_cache');
@@ -100,7 +99,6 @@ add_action('admin_bar_menu', 'add_ecwid_admin_bar_node', 1000);
100
  if (get_option('ecwid_last_oauth_fail_time') > 0) {
101
  add_action('plugins_loaded', 'ecwid_test_oauth');
102
  }
103
- $ecwid_script_rendered = false; // controls single script.js on page
104
 
105
  require_once ECWID_PLUGIN_DIR . 'lib/ecwid_platform.php';
106
  require_once ECWID_PLUGIN_DIR . 'lib/ecwid_api_v3.php';
@@ -148,9 +146,6 @@ if ( strpos( $version, '5.0' ) === 0 || version_compare( $version, '5.0' ) > 0
148
  require_once ECWID_PLUGIN_DIR . 'includes/integrations/class-ecwid-integration-gutenberg.php';
149
  }
150
 
151
- $ecwid_script_rendered = false; // controls single script.js on page
152
-
153
-
154
  // Needs to be in both front-end and back-end to allow admin zone recognize the shortcode
155
  foreach (Ecwid_Shortcode_Base::get_store_shortcode_names() as $shortcode_name) {
156
  add_shortcode( $shortcode_name, 'ecwid_shortcode' );
@@ -1450,15 +1445,6 @@ function ecwid_add_credits($powered_by)
1450
  return $powered_by;
1451
  }
1452
 
1453
- function ecwid_content_started($content)
1454
- {
1455
- global $ecwid_script_rendered;
1456
-
1457
- $ecwid_script_rendered = false;
1458
-
1459
- return $content;
1460
- }
1461
-
1462
  function ecwid_wrap_shortcode_content($content, $name, $attrs)
1463
  {
1464
  $version = get_option('ecwid_plugin_version');
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.4.7
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
90
  add_action('wp_head', 'ecwid_print_inline_js_config');
91
  add_action('wp_head', 'ecwid_product_browser_url_in_head');
92
  add_filter( 'widget_meta_poweredby', 'ecwid_add_credits');
 
93
  add_filter('body_class', 'ecwid_body_class');
94
  add_action('redirect_canonical', 'ecwid_redirect_canonical', 10, 2 );
95
  add_action('init', 'ecwid_check_api_cache');
99
  if (get_option('ecwid_last_oauth_fail_time') > 0) {
100
  add_action('plugins_loaded', 'ecwid_test_oauth');
101
  }
 
102
 
103
  require_once ECWID_PLUGIN_DIR . 'lib/ecwid_platform.php';
104
  require_once ECWID_PLUGIN_DIR . 'lib/ecwid_api_v3.php';
146
  require_once ECWID_PLUGIN_DIR . 'includes/integrations/class-ecwid-integration-gutenberg.php';
147
  }
148
 
 
 
 
149
  // Needs to be in both front-end and back-end to allow admin zone recognize the shortcode
150
  foreach (Ecwid_Shortcode_Base::get_store_shortcode_names() as $shortcode_name) {
151
  add_shortcode( $shortcode_name, 'ecwid_shortcode' );
1445
  return $powered_by;
1446
  }
1447
 
 
 
 
 
 
 
 
 
 
1448
  function ecwid_wrap_shortcode_content($content, $name, $attrs)
1449
  {
1450
  $version = get_option('ecwid_plugin_version');
includes/class-ecwid-config.php CHANGED
@@ -100,66 +100,99 @@ class Ecwid_Config {
100
  public static function load_from_ini() {
101
 
102
  $filename = apply_filters('ecwid_config_ini_path', ECWID_PLUGIN_DIR . 'config.ini');
103
-
 
104
  if ( file_exists( $filename ) ) {
105
  $result = @parse_ini_file($filename);
106
  }
107
-
108
- if ( !@$result ) {
109
- $result = array();
 
 
 
 
 
 
 
 
110
  }
111
 
 
 
112
 
 
 
 
 
113
  $wl_config = array(
114
- self::IS_WL => 'wl_mode',
115
- self::BRAND => 'brand',
116
- self::CONTACT_US_URL => 'contact_us_url',
117
- self::KB_URL => 'kb_url',
118
  self::REGISTRATION_URL => 'registration_url',
119
- self::OAUTH_TOKEN_URL => 'oauth_token_url',
120
- self::OAUTH_AUTH_URL => 'oauth_authorize_url',
121
  );
122
-
 
 
 
 
 
 
 
123
  $common_config = array(
124
- self::OAUTH_APPID => 'oauth_appid',
125
  self::OAUTH_APPSECRET => 'oauth_appsecret',
126
- self::TOKEN => 'oauth_token',
127
- self::STORE_ID => 'store_id',
128
- self::CHANNEL_ID => 'channel_id',
129
- self::API_DOMAIN => 'api_domain',
130
  self::FRONTEND_DOMAIN => 'scriptjs_domain',
131
- self::CPANEL_DOMAIN => 'cp_domain',
132
- self::DEMO_STORE_ID => 'demo_store_id'
133
  );
134
-
 
 
 
 
 
 
 
 
 
 
 
135
  $empty_is_allowed = array(
136
  self::REGISTRATION_URL
137
  );
138
-
139
- $is_wl_enabled = @$result['wl_mode'];
140
 
141
  foreach ( $wl_config as $name => $ini_name ) {
142
 
143
- $value = @$result[$ini_name];
144
  if ( $is_wl_enabled && ( $value || in_array( $value, $empty_is_allowed ) ) ) {
145
- EcwidPlatform::set($name, @$result[$ini_name]);
146
  } else {
147
- EcwidPlatform::reset($name);
148
  }
149
  }
150
-
151
-
152
  if (
153
- isset( $result[self::TOKEN] ) && !isset( $result[self::STORE_ID] )
154
  ||
155
- !isset( $result[self::TOKEN] ) && isset( $result[self::STORE_ID] )
156
  ) {
157
- unset( $result[self::TOKEN] );
158
- unset( $result[self::STORE_ID] );
159
- }
160
-
161
  foreach ( $common_config as $name => $ini_name ) {
162
- $value = @$result[$ini_name];
163
  if ( $value ) {
164
  EcwidPlatform::set( $name, $value );
165
  } else {
@@ -169,13 +202,6 @@ class Ecwid_Config {
169
 
170
  ecwid_invalidate_cache( true );
171
  }
172
- public static function enqueue_styles() {
173
- if ( !self::is_wl() ) {
174
- return;
175
- }
176
-
177
- wp_enqueue_style( 'ecwid-wl', ECWID_PLUGIN_URL . 'css/wl.css', array( 'ecwid-admin-css' ), get_option( 'ecwid_plugin_version' ) );
178
- }
179
  }
180
 
181
  add_action( 'admin_enqueue_scripts', array( 'Ecwid_Config', 'enqueue_styles' ) );
100
  public static function load_from_ini() {
101
 
102
  $filename = apply_filters('ecwid_config_ini_path', ECWID_PLUGIN_DIR . 'config.ini');
103
+
104
+ $result = false;
105
  if ( file_exists( $filename ) ) {
106
  $result = @parse_ini_file($filename);
107
  }
108
+
109
+ if ( !$result ) {
110
+ return;
111
+ }
112
+
113
+ self::_apply_config( $result );
114
+ }
115
+
116
+ public static function enqueue_styles() {
117
+ if ( !self::is_wl() ) {
118
+ return;
119
  }
120
 
121
+ wp_enqueue_style( 'ecwid-wl', ECWID_PLUGIN_URL . 'css/wl.css', array( 'ecwid-admin-css' ), get_option( 'ecwid_plugin_version' ) );
122
+ }
123
 
124
+ /**
125
+ * @return array
126
+ */
127
+ protected static function _get_wl_config() {
128
  $wl_config = array(
129
+ self::IS_WL => 'wl_mode',
130
+ self::BRAND => 'brand',
131
+ self::CONTACT_US_URL => 'contact_us_url',
132
+ self::KB_URL => 'kb_url',
133
  self::REGISTRATION_URL => 'registration_url',
134
+ self::OAUTH_TOKEN_URL => 'oauth_token_url',
135
+ self::OAUTH_AUTH_URL => 'oauth_authorize_url',
136
  );
137
+
138
+ return $wl_config;
139
+ }
140
+
141
+ /**
142
+ * @return array
143
+ */
144
+ protected static function _get_common_config() {
145
  $common_config = array(
146
+ self::OAUTH_APPID => 'oauth_appid',
147
  self::OAUTH_APPSECRET => 'oauth_appsecret',
148
+ self::TOKEN => 'oauth_token',
149
+ self::STORE_ID => 'store_id',
150
+ self::CHANNEL_ID => 'channel_id',
151
+ self::API_DOMAIN => 'api_domain',
152
  self::FRONTEND_DOMAIN => 'scriptjs_domain',
153
+ self::CPANEL_DOMAIN => 'cp_domain',
154
+ self::DEMO_STORE_ID => 'demo_store_id'
155
  );
156
+
157
+ return $common_config;
158
+ }
159
+
160
+ /**
161
+ * @param $values
162
+ */
163
+ protected static function _apply_config( $values ) {
164
+ $wl_config = self::_get_wl_config();
165
+
166
+ $common_config = self::_get_common_config();
167
+
168
  $empty_is_allowed = array(
169
  self::REGISTRATION_URL
170
  );
171
+
172
+ $is_wl_enabled = @$values['wl_mode'];
173
 
174
  foreach ( $wl_config as $name => $ini_name ) {
175
 
176
+ $value = @$values[ $ini_name ];
177
  if ( $is_wl_enabled && ( $value || in_array( $value, $empty_is_allowed ) ) ) {
178
+ EcwidPlatform::set( $name, @$values[ $ini_name ] );
179
  } else {
180
+ EcwidPlatform::reset( $name );
181
  }
182
  }
183
+
184
+
185
  if (
186
+ isset( $values[ self::TOKEN ] ) && ! isset( $values[ self::STORE_ID ] )
187
  ||
188
+ ! isset( $values[ self::TOKEN ] ) && isset( $values[ self::STORE_ID ] )
189
  ) {
190
+ unset( $values[ self::TOKEN ] );
191
+ unset( $values[ self::STORE_ID ] );
192
+ }
193
+
194
  foreach ( $common_config as $name => $ini_name ) {
195
+ $value = @$values[ $ini_name ];
196
  if ( $value ) {
197
  EcwidPlatform::set( $name, $value );
198
  } else {
202
 
203
  ecwid_invalidate_cache( true );
204
  }
 
 
 
 
 
 
 
205
  }
206
 
207
  add_action( 'admin_enqueue_scripts', array( 'Ecwid_Config', 'enqueue_styles' ) );
includes/class-ecwid-stub-renderer.php CHANGED
@@ -6,7 +6,7 @@ abstract class Ecwid_Stub_Renderer {
6
  if ( $this->_should_apply() ) {
7
  add_filter( 'ecwid_shortcode_custom_renderer', array( $this, 'get_custom_renderer' ), 10, 2 );
8
  add_filter( 'ecwid_get_custom_widget_renderer', array( $this, 'get_custom_widget_renderer' ), 10, 3 );
9
- add_filter( 'ecwid_inline_js_config', array( $this, 'filter_inline_js_config' ) );
10
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
11
  }
12
  }
6
  if ( $this->_should_apply() ) {
7
  add_filter( 'ecwid_shortcode_custom_renderer', array( $this, 'get_custom_renderer' ), 10, 2 );
8
  add_filter( 'ecwid_get_custom_widget_renderer', array( $this, 'get_custom_widget_renderer' ), 10, 3 );
9
+ add_filter( 'ecwid_inline_js_config', array( $this, 'filter_inline_js_config' ), 10000 );
10
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
11
  }
12
  }
includes/integrations/class-ecwid-integration-gutenberg.php CHANGED
@@ -32,7 +32,7 @@ class Ecwid_Integration_Gutenberg {
32
  'render_callback' => array( $this, 'product_render_callback' ),
33
  ));
34
 
35
- add_action( 'in_admin_header', array( $this, 'add_popup' ) );
36
  }
37
 
38
  public function on_save_post( $post, $request, $creating ) {
@@ -264,12 +264,6 @@ JS;
264
 
265
  return $result;
266
  }
267
-
268
- public function add_popup() {
269
- $categories = ecwid_get_categories_for_selector();
270
-
271
- require ECWID_PLUGIN_DIR . '/templates/store-popup.php';
272
- }
273
 
274
  protected function _get_version_for_assets( $asset_file_path )
275
  {
32
  'render_callback' => array( $this, 'product_render_callback' ),
33
  ));
34
 
35
+ // add_filter( 'block_categories', array( $this, 'block_categories' ) );
36
  }
37
 
38
  public function on_save_post( $post, $request, $creating ) {
264
 
265
  return $result;
266
  }
 
 
 
 
 
 
267
 
268
  protected function _get_version_for_assets( $asset_file_path )
269
  {
js/admin-menu.js CHANGED
@@ -69,7 +69,7 @@ function ecwidApplyIframeAdminMenu($link, menu) {
69
  jQuery(this).parents('.opensub').removeClass('opensub');
70
 
71
  if ( !isOpen ) return true;
72
-
73
  return false;
74
  });
75
  }
@@ -186,4 +186,4 @@ jQuery(document).ready(function() {
186
  jQuery('#toplevel_page_ec-store > a').addClass('wp-has-current-submenu');
187
  }
188
  ecwidRefreshEcwidMenuItemSelection();
189
- });
69
  jQuery(this).parents('.opensub').removeClass('opensub');
70
 
71
  if ( !isOpen ) return true;
72
+
73
  return false;
74
  });
75
  }
186
  jQuery('#toplevel_page_ec-store > a').addClass('wp-has-current-submenu');
187
  }
188
  ecwidRefreshEcwidMenuItemSelection();
189
+ });
lib/ecwid_api_v3.php CHANGED
@@ -93,39 +93,39 @@ class Ecwid_Api_V3
93
  {
94
  $api = new Ecwid_Api_V3();
95
 
96
- $token = self::_load_token();
97
- if ( !$token ) {
98
- return self::set_api_status( self::API_STATUS_ERROR_TOKEN );
99
- }
100
-
101
  $profile = $api->get_store_profile();
102
 
103
  if ( $profile ) {
104
  return self::set_api_status( self::API_STATUS_OK );
105
- } else {
106
- $transports = stream_get_transports();
 
 
 
 
 
 
107
 
108
- $tls_fails = true;
109
 
110
- foreach ( $transports as $transport ) {
111
- $matches = array();
112
-
113
- $is_tls = preg_match( '!tlsv(.*)!', $transport, $matches );
114
-
115
- if ( $is_tls ) {
116
- if ( version_compare( $matches[1], '1.1', '>=' ) ) {
117
- $tls_fails = false;
118
- break;
119
- }
120
  }
121
  }
122
-
123
- if ( $tls_fails ) {
124
- return self::set_api_status( self::API_STATUS_ERROR_TLS );
125
- } else {
126
- return self::set_api_status( self::API_STATUS_ERROR_OTHER );
127
- }
128
  }
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
 
131
  public static function save_token($token)
93
  {
94
  $api = new Ecwid_Api_V3();
95
 
 
 
 
 
 
96
  $profile = $api->get_store_profile();
97
 
98
  if ( $profile ) {
99
  return self::set_api_status( self::API_STATUS_OK );
100
+ }
101
+
102
+ $transports = stream_get_transports();
103
+
104
+ $tls_fails = true;
105
+
106
+ foreach ( $transports as $transport ) {
107
+ $matches = array();
108
 
109
+ $is_tls = preg_match( '!tlsv(.*)!', $transport, $matches );
110
 
111
+ if ( $is_tls ) {
112
+ if ( version_compare( $matches[1], '1.1', '>=' ) ) {
113
+ $tls_fails = false;
114
+ break;
 
 
 
 
 
 
115
  }
116
  }
 
 
 
 
 
 
117
  }
118
+
119
+ if (-$tls_fails ) {
120
+ return self::set_api_status( self::API_STATUS_ERROR_TLS );
121
+ }
122
+
123
+ $token = self::_load_token();
124
+ if ( !$token ) {
125
+ return self::set_api_status( self::API_STATUS_ERROR_TOKEN );
126
+ }
127
+
128
+ return self::set_api_status( self::API_STATUS_ERROR_OTHER );
129
  }
130
 
131
  public static function save_token($token)
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Ecwid
3
  Tags: ecommerce, downloadable products, Facebook ecommerce, online store, paypal, product catalog, shop, shopping cart, store
4
  Requires at least: 3.7
5
  Tested up to: 5.0
6
- Stable tag: 6.4.6
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
@@ -150,6 +150,9 @@ You can use Ecwid’s built-in import tools to copy your store products from any
150
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
151
 
152
  == Changelog ==
 
 
 
153
  = 6.4.6 - Dec 7, 2018 =
154
  - Minor fixes & improvements.
155
 
3
  Tags: ecommerce, downloadable products, Facebook ecommerce, online store, paypal, product catalog, shop, shopping cart, store
4
  Requires at least: 3.7
5
  Tested up to: 5.0
6
+ Stable tag: 6.4.7
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
150
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
151
 
152
  == Changelog ==
153
+ = 6.4.7 - Dec 14, 2018 =
154
+ - - **Compatibility fixes for Elementor and Gravity Forms.** Thanks to a user report, we found a few glitches in how the Ecwid e-commerce plugin works with Elementor and Gravity Forms. All fixed — the plugins should work fine together now
155
+
156
  = 6.4.6 - Dec 7, 2018 =
157
  - Minor fixes & improvements.
158