Ecwid Ecommerce Shopping Cart - Version 6.4.3

Version Description

  • Nov 28, 2018 =
  • Minor fixes and improvements for the Ecwid ecommerce blocks in Gutenberg editor.
Download this release

Release Info

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

Code changes from version 6.4.2 to 6.4.3

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.2
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
@@ -1077,8 +1077,10 @@ function ecwid_ajax_crawling_fragment() {
1077
 
1078
  function ecwid_meta() {
1079
 
1080
- $is_ie = strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false
1081
- || strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident' ) !== false;
 
 
1082
 
1083
  if ( $is_ie || ( get_option( 'ecwid_hide_prefetch' ) == 'on' ) ) {
1084
  return;
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.3
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
1077
 
1078
  function ecwid_meta() {
1079
 
1080
+ $ua = @$_SERVER['HTTP_USER_AGENT'];
1081
+
1082
+ $is_ie = strpos( $ua, 'MSIE' ) !== false
1083
+ || strpos( $ua, 'Trident' ) !== false;
1084
 
1085
  if ( $is_ie || ( get_option( 'ecwid_hide_prefetch' ) == 'on' ) ) {
1086
  return;
includes/class-ecwid-admin-main-page.php CHANGED
@@ -12,10 +12,10 @@ class Ecwid_Admin_Main_Page
12
 
13
  public function do_page()
14
  {
15
- if ( $this->_is_forced_reconnect() ) {
16
  ecwid_update_store_id( ecwid_get_demo_store_id() );
17
  }
18
-
19
  $is_demo = ecwid_is_demo_store();
20
  $is_api_connection_ok = !Ecwid_Api_V3::connection_fails();
21
 
@@ -25,6 +25,7 @@ class Ecwid_Admin_Main_Page
25
  $this->_is_whitelabel_mode_with_no_registration()
26
  || $this->_is_oauth_error()
27
  || $this->_is_current_user_email_registered_at_ecwid()
 
28
  ) {
29
 
30
  $this->_do_simple_connect_page();
@@ -171,7 +172,12 @@ class Ecwid_Admin_Main_Page
171
  require_once ECWID_PLUGIN_DIR . 'templates/ecwid-admin.php';
172
  }
173
  }
174
-
 
 
 
 
 
175
  protected static function _get_upgrade_page_hash()
176
  {
177
  return 'billing:feature=sso&plan=ecwid_venture';
@@ -226,11 +232,6 @@ class Ecwid_Admin_Main_Page
226
  return $api->does_store_exist( $current_user->user_email );
227
  }
228
 
229
- protected function _is_forced_reconnect()
230
- {
231
- return isset( $_GET['reconnect'] );
232
- }
233
-
234
  protected function _is_connect_error()
235
  {
236
  return isset( $_GET['connection_error'] );
12
 
13
  public function do_page()
14
  {
15
+ if ( self::is_forced_reconnect() ) {
16
  ecwid_update_store_id( ecwid_get_demo_store_id() );
17
  }
18
+
19
  $is_demo = ecwid_is_demo_store();
20
  $is_api_connection_ok = !Ecwid_Api_V3::connection_fails();
21
 
25
  $this->_is_whitelabel_mode_with_no_registration()
26
  || $this->_is_oauth_error()
27
  || $this->_is_current_user_email_registered_at_ecwid()
28
+ || self::is_forced_reconnect()
29
  ) {
30
 
31
  $this->_do_simple_connect_page();
172
  require_once ECWID_PLUGIN_DIR . 'templates/ecwid-admin.php';
173
  }
174
  }
175
+
176
+ public static function is_forced_reconnect()
177
+ {
178
+ return isset( $_GET['reconnect'] );
179
+ }
180
+
181
  protected static function _get_upgrade_page_hash()
182
  {
183
  return 'billing:feature=sso&plan=ecwid_venture';
232
  return $api->does_store_exist( $current_user->user_email );
233
  }
234
 
 
 
 
 
 
235
  protected function _is_connect_error()
236
  {
237
  return isset( $_GET['connection_error'] );
includes/class-ecwid-admin.php CHANGED
@@ -36,6 +36,9 @@ class Ecwid_Admin {
36
  public function build_menu()
37
  {
38
  $is_newbie = ecwid_is_demo_store();
 
 
 
39
 
40
  $page = new Ecwid_Admin_Main_Page();
41
 
36
  public function build_menu()
37
  {
38
  $is_newbie = ecwid_is_demo_store();
39
+ if ( Ecwid_Admin_Main_Page::is_forced_reconnect() ) {
40
+ $is_newbie = true;
41
+ }
42
 
43
  $page = new Ecwid_Admin_Main_Page();
44
 
includes/class-ecwid-config.php CHANGED
@@ -117,7 +117,6 @@ class Ecwid_Config {
117
  self::CONTACT_US_URL => 'contact_us_url',
118
  self::KB_URL => 'kb_url',
119
  self::REGISTRATION_URL => 'registration_url',
120
- self::CHANNEL_ID => 'channel_id',
121
  self::OAUTH_TOKEN_URL => 'oauth_token_url',
122
  self::OAUTH_AUTH_URL => 'oauth_authorize_url',
123
  );
@@ -127,6 +126,7 @@ class Ecwid_Config {
127
  self::OAUTH_APPSECRET => 'oauth_appsecret',
128
  self::TOKEN => 'oauth_token',
129
  self::STORE_ID => 'store_id',
 
130
  self::API_DOMAIN => 'api_domain',
131
  self::FRONTEND_DOMAIN => 'scriptjs_domain',
132
  self::CPANEL_DOMAIN => 'cp_domain',
117
  self::CONTACT_US_URL => 'contact_us_url',
118
  self::KB_URL => 'kb_url',
119
  self::REGISTRATION_URL => 'registration_url',
 
120
  self::OAUTH_TOKEN_URL => 'oauth_token_url',
121
  self::OAUTH_AUTH_URL => 'oauth_authorize_url',
122
  );
126
  self::OAUTH_APPSECRET => 'oauth_appsecret',
127
  self::TOKEN => 'oauth_token',
128
  self::STORE_ID => 'store_id',
129
+ self::CHANNEL_ID => 'channel_id',
130
  self::API_DOMAIN => 'api_domain',
131
  self::FRONTEND_DOMAIN => 'scriptjs_domain',
132
  self::CPANEL_DOMAIN => 'cp_domain',
includes/class-ecwid-oauth.php CHANGED
@@ -104,19 +104,20 @@ class Ecwid_OAuth {
104
  $params['redirect_uri'] = admin_url( $base_admin_url );
105
 
106
  $params['grant_type'] = 'authorization_code';
107
-
108
  $request = Ecwid_HTTP::create_post( 'oauth_authorize', Ecwid_Config::get_oauth_token_url(), array(
109
  Ecwid_HTTP::POLICY_RETURN_VERBOSE
110
  ));
111
 
112
  $return = $request->do_request(array('body' => $params));
113
 
114
- if (is_array($return) && isset($return['data'])) {
115
- $result = json_decode($return['data']);
 
116
  }
117
 
118
  if (
119
- !is_array($return)
120
  || !isset( $result->store_id )
121
  || !isset( $result->scope )
122
  || !isset( $result->access_token )
104
  $params['redirect_uri'] = admin_url( $base_admin_url );
105
 
106
  $params['grant_type'] = 'authorization_code';
107
+
108
  $request = Ecwid_HTTP::create_post( 'oauth_authorize', Ecwid_Config::get_oauth_token_url(), array(
109
  Ecwid_HTTP::POLICY_RETURN_VERBOSE
110
  ));
111
 
112
  $return = $request->do_request(array('body' => $params));
113
 
114
+ $result = new stdClass();
115
+ if ( is_array( $return ) && isset( $return['data'] ) ) {
116
+ $result = json_decode( $return['data'] );
117
  }
118
 
119
  if (
120
+ !is_array( $return )
121
  || !isset( $result->store_id )
122
  || !isset( $result->scope )
123
  || !isset( $result->access_token )
includes/class-ecwid-static-home-page.php CHANGED
@@ -13,12 +13,17 @@ class Ecwid_Static_Home_Page {
13
  const CACHE_DATA = 'static_home_page_data';
14
  const PARAM_VALID_FROM = 'static_home_page_valid_from';
15
 
 
 
 
 
16
  public function __construct() {
17
 
18
  add_option( self::OPTION_IS_ENABLED );
19
 
20
  if ( !is_admin() ) {
21
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
 
22
  }
23
  }
24
 
@@ -32,13 +37,19 @@ class Ecwid_Static_Home_Page {
32
 
33
  if ( !$data || !is_array( $data->cssFiles ) || empty ( $data->cssFiles ) ) return;
34
 
35
- EcwidPlatform::enqueue_script( 'static-home-page' );
36
-
37
  foreach ( $data->cssFiles as $ind => $item ) {
38
- wp_enqueue_style( 'ecwid-static-home-page-' . $ind, $item );
39
  }
40
 
41
- wp_add_inline_script( 'ecwid-static-home-page', "window.ec.config.interactive = false;" );
 
 
 
 
 
 
42
  }
43
 
44
  public static function get_data_for_current_page()
@@ -68,6 +79,12 @@ class Ecwid_Static_Home_Page {
68
  protected static function _maybe_fetch_data()
69
  {
70
  $store_page_params = self::_get_store_page_params();
 
 
 
 
 
 
71
  $params = array();
72
 
73
  if ( Ecwid_Seo_Links::is_enabled() ) {
@@ -93,7 +110,11 @@ class Ecwid_Static_Home_Page {
93
  $url .= $name . '=' . urlencode( $value ) . '&';
94
  }
95
 
96
- $cached_data = EcwidPlatform::get_from_catalog_cache( $url );
 
 
 
 
97
 
98
  if ( $cached_data ) {
99
  return $cached_data;
@@ -101,13 +122,20 @@ class Ecwid_Static_Home_Page {
101
 
102
  $fetched_data = null;
103
 
104
- $fetched_data = EcwidPlatform::fetch_url( $url, array( 'timeout' => 3 ) );
105
-
 
 
 
 
 
 
 
106
 
107
  if ( $fetched_data && @$fetched_data['data'] ) {
108
 
109
  $fetched_data = @json_decode( $fetched_data['data'] );
110
- EcwidPlatform::store_in_catalog_cache( $url, $fetched_data );
111
 
112
  return $fetched_data;
113
  }
@@ -173,8 +201,6 @@ class Ecwid_Static_Home_Page {
173
  return false;
174
  }
175
 
176
- return false;
177
-
178
  if ( get_ecwid_store_id() > 15182050 && get_ecwid_store_id() % 10 == 0 ) {
179
  return true;
180
  }
@@ -195,27 +221,26 @@ class Ecwid_Static_Home_Page {
195
 
196
  $data = array_merge( $existing, $data );
197
 
198
- EcwidPlatform::store_in_catalog_cache(
199
- self::_get_store_page_data_key(),
200
- $data
201
- );
202
  }
203
 
204
  protected static function _get_store_page_params( ) {
205
- $params = EcwidPlatform::get_from_catalog_cache( self::_get_store_page_data_key() );
206
 
207
  if ( !empty( $params) ) return $params;
208
 
209
  return array();
210
  }
211
 
 
 
 
 
212
  protected static function _get_store_page_data_key()
213
  {
214
  $post = get_post();
215
- $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
216
- $lang = substr( $lang, 0, strpos( $lang, ';' ) );
217
 
218
- return get_ecwid_store_id() . '_' . $post->ID . '_' . $post->post_modified_gmt . '_' . $lang;
219
 
220
  }
221
  }
13
  const CACHE_DATA = 'static_home_page_data';
14
  const PARAM_VALID_FROM = 'static_home_page_valid_from';
15
 
16
+ const HANDLE_STATIC_PAGE = 'static-home-page';
17
+
18
+ protected $_has_theme_adjustments = false;
19
+
20
  public function __construct() {
21
 
22
  add_option( self::OPTION_IS_ENABLED );
23
 
24
  if ( !is_admin() ) {
25
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
26
+ add_action( Ecwid_Theme_Base::ACTION_APPLY_THEME, array( $this, 'apply_theme' ) );
27
  }
28
  }
29
 
37
 
38
  if ( !$data || !is_array( $data->cssFiles ) || empty ( $data->cssFiles ) ) return;
39
 
40
+ EcwidPlatform::enqueue_script( self::HANDLE_STATIC_PAGE );
41
+
42
  foreach ( $data->cssFiles as $ind => $item ) {
43
+ wp_enqueue_style( 'ecwid-' . self::HANDLE_STATIC_PAGE . '-' . $ind, $item );
44
  }
45
 
46
+ wp_add_inline_script( 'ecwid-' . self::HANDLE_STATIC_PAGE, "window.ec.config.interactive = false;" );
47
+ }
48
+
49
+ public function apply_theme( $theme ) {
50
+ if ( $theme ) {
51
+ $this->_has_theme_adjustments = true;
52
+ }
53
  }
54
 
55
  public static function get_data_for_current_page()
79
  protected static function _maybe_fetch_data()
80
  {
81
  $store_page_params = self::_get_store_page_params();
82
+
83
+
84
+ if ( isset( $store_page_params['default_category_id'] ) && $store_page_params['default_category_id'] ) {
85
+ return null;
86
+ }
87
+
88
  $params = array();
89
 
90
  if ( Ecwid_Seo_Links::is_enabled() ) {
110
  $url .= $name . '=' . urlencode( $value ) . '&';
111
  }
112
 
113
+ $accept_language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
114
+
115
+ $cache_key = $accept_language . "\n" . $url;
116
+
117
+ $cached_data = EcwidPlatform::get_from_catalog_cache( $cache_key );
118
 
119
  if ( $cached_data ) {
120
  return $cached_data;
122
 
123
  $fetched_data = null;
124
 
125
+ $fetched_data = EcwidPlatform::fetch_url(
126
+ $url,
127
+ array(
128
+ 'timeout' => 3,
129
+ 'headers' => array(
130
+ 'ACCEPT-LANGUAGE' => $accept_language
131
+ )
132
+ )
133
+ );
134
 
135
  if ( $fetched_data && @$fetched_data['data'] ) {
136
 
137
  $fetched_data = @json_decode( $fetched_data['data'] );
138
+ EcwidPlatform::store_in_catalog_cache( $cache_key, $fetched_data );
139
 
140
  return $fetched_data;
141
  }
201
  return false;
202
  }
203
 
 
 
204
  if ( get_ecwid_store_id() > 15182050 && get_ecwid_store_id() % 10 == 0 ) {
205
  return true;
206
  }
221
 
222
  $data = array_merge( $existing, $data );
223
 
224
+ EcwidPlatform::cache_set( self::_get_store_page_data_key(), $data );
 
 
 
225
  }
226
 
227
  protected static function _get_store_page_params( ) {
228
+ $params = EcwidPlatform::cache_get( self::_get_store_page_data_key(), array() );
229
 
230
  if ( !empty( $params) ) return $params;
231
 
232
  return array();
233
  }
234
 
235
+ protected static function _get_page_content_data_key( $url ) {
236
+ $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
237
+ }
238
+
239
  protected static function _get_store_page_data_key()
240
  {
241
  $post = get_post();
 
 
242
 
243
+ return get_ecwid_store_id() . '_' . $post->ID . '_' . $post->post_modified_gmt;
244
 
245
  }
246
  }
includes/shortcodes/class-ecwid-shortcode-productbrowser.php CHANGED
@@ -36,10 +36,23 @@ class Ecwid_Shortcode_ProductBrowser extends Ecwid_Shortcode_Base {
36
  return $default_render;
37
  }
38
 
39
- $code = '<div id="static-ecwid">' . htmlspecialchars_decode( $data->htmlCode ) . '</div>';
 
 
 
 
 
 
 
 
 
 
40
 
41
- $code .= '<div id="dynamic-ecwid">' . $default_render . '</div>';
42
 
 
 
 
 
43
  $code .= <<<HTML
44
  <script language="JavaScript">
45
  EcwidStaticPageLoader.processStaticHomePage('static-ecwid', 'dynamic-ecwid');
@@ -53,7 +66,7 @@ HTML;
53
  }
54
 
55
  public function render_placeholder( ) {
56
-
57
  $store_id = get_ecwid_store_id();
58
 
59
  $plain_content = '';
@@ -86,9 +99,11 @@ HTML;
86
 
87
  Ecwid_Static_Home_Page::save_store_page_params( $params );
88
  }
 
 
89
 
90
  $classname = $this->_get_html_class_name();
91
- $result = <<<HTML
92
  <div id="ecwid-store-$store_id" class="ecwid-shopping-cart-$classname" data-ecwid-default-category-id="$html_catalog_params[default_category_id]">
93
  <script>
94
  function createClass(name,rules){
36
  return $default_render;
37
  }
38
 
39
+ $code = '';
40
+ global $ecwid_current_theme;
41
+ if ( $ecwid_current_theme ) {
42
+
43
+ $code = <<<HTML
44
+ <script>
45
+ document.documentElement.id = 'ecwid_html';
46
+ document.body.id = 'ecwid_body';
47
+ </script>
48
+ HTML;
49
+ }
50
 
 
51
 
52
+ $code .= '<div id="static-ecwid">' . htmlspecialchars_decode( $data->htmlCode ) . '</div>';
53
+
54
+ $code .= '<div id="dynamic-ecwid">' . $default_render . '</div>';
55
+
56
  $code .= <<<HTML
57
  <script language="JavaScript">
58
  EcwidStaticPageLoader.processStaticHomePage('static-ecwid', 'dynamic-ecwid');
66
  }
67
 
68
  public function render_placeholder( ) {
69
+
70
  $store_id = get_ecwid_store_id();
71
 
72
  $plain_content = '';
99
 
100
  Ecwid_Static_Home_Page::save_store_page_params( $params );
101
  }
102
+
103
+ $result = '';
104
 
105
  $classname = $this->_get_html_class_name();
106
+ $result .= <<<HTML
107
  <div id="ecwid-store-$store_id" class="ecwid-shopping-cart-$classname" data-ecwid-default-category-id="$html_catalog_params[default_category_id]">
108
  <script>
109
  function createClass(name,rules){
includes/themes.php CHANGED
@@ -109,19 +109,22 @@ function ecwid_apply_theme($theme_name = null)
109
  return;
110
  }
111
 
 
 
112
  if ( in_array($theme_name, $custom_themes) ) {
113
  $theme_file = ECWID_THEMES_DIR . '/class-ecwid-theme-' . $theme_name . '.php';
114
  $theme_file = apply_filters( 'ecwid_get_theme_file', $theme_file );
115
  $theme_file = strtolower($theme_file);
116
 
117
  if ( !empty( $theme_file ) && is_file( $theme_file ) && is_readable( $theme_file ) ) {
118
- require_once( $theme_file );
119
  }
120
  } else if ( array_key_exists( $theme_name, $generic_themes ) ) {
121
- global $ecwid_current_theme;
122
 
123
  $ecwid_current_theme = Ecwid_Theme_Base::create( $theme_name, $generic_themes[$theme_name] );
124
  }
 
 
125
  }
126
 
127
  function ecwid_after_switch_theme()
109
  return;
110
  }
111
 
112
+ global $ecwid_current_theme;
113
+
114
  if ( in_array($theme_name, $custom_themes) ) {
115
  $theme_file = ECWID_THEMES_DIR . '/class-ecwid-theme-' . $theme_name . '.php';
116
  $theme_file = apply_filters( 'ecwid_get_theme_file', $theme_file );
117
  $theme_file = strtolower($theme_file);
118
 
119
  if ( !empty( $theme_file ) && is_file( $theme_file ) && is_readable( $theme_file ) ) {
120
+ $ecwid_current_theme = require_once( $theme_file );
121
  }
122
  } else if ( array_key_exists( $theme_name, $generic_themes ) ) {
 
123
 
124
  $ecwid_current_theme = Ecwid_Theme_Base::create( $theme_name, $generic_themes[$theme_name] );
125
  }
126
+
127
+ do_action( Ecwid_Theme_Base::ACTION_APPLY_THEME, $ecwid_current_theme );
128
  }
129
 
130
  function ecwid_after_switch_theme()
includes/themes/class-ecwid-theme-avada.php CHANGED
@@ -29,4 +29,4 @@ HTML;
29
  }
30
  }
31
 
32
- $ecwid_current_theme = new Ecwid_Theme_Avada();
29
  }
30
  }
31
 
32
+ return new Ecwid_Theme_Avada();
includes/themes/class-ecwid-theme-base.php CHANGED
@@ -5,6 +5,8 @@ class Ecwid_Theme_Base {
5
  const PROP_USE_JS_API_FOR_CATS_NAV_MENU = 'js-api-for-cats-nav-menu';
6
  const PROP_AJAX_DEFER_RENDERING = 'ajax-defer-rendering';
7
 
 
 
8
  public $has_advanced_layout = false;
9
 
10
  protected $adjust_pb_scroll = false;
5
  const PROP_USE_JS_API_FOR_CATS_NAV_MENU = 'js-api-for-cats-nav-menu';
6
  const PROP_AJAX_DEFER_RENDERING = 'ajax-defer-rendering';
7
 
8
+ const ACTION_APPLY_THEME = 'ecwid-apply-theme';
9
+
10
  public $has_advanced_layout = false;
11
 
12
  protected $adjust_pb_scroll = false;
includes/themes/class-ecwid-theme-boundless.php CHANGED
@@ -34,4 +34,4 @@ class Ecwid_Theme_Boundless extends Ecwid_Theme_Base
34
  }
35
  }
36
 
37
- $ecwid_current_theme = new Ecwid_Theme_Boundless();
34
  }
35
  }
36
 
37
+ return new Ecwid_Theme_Boundless();
includes/themes/class-ecwid-theme-bretheon.php CHANGED
@@ -33,4 +33,4 @@ class Ecwid_Theme_Bretheon extends Ecwid_Theme_Base
33
  }
34
  }
35
 
36
- $ecwid_current_theme = new Ecwid_Theme_Bretheon();
33
  }
34
  }
35
 
36
+ return new Ecwid_Theme_Bretheon();
includes/themes/class-ecwid-theme-central.php CHANGED
@@ -26,4 +26,4 @@ class Ecwid_Theme_Central extends Ecwid_Theme_Base
26
 
27
  }
28
 
29
- $ecwid_current_theme = new Ecwid_Theme_Central();
26
 
27
  }
28
 
29
+ return new Ecwid_Theme_Central();
includes/themes/class-ecwid-theme-envision.php CHANGED
@@ -31,4 +31,4 @@ class Ecwid_Theme_Envision extends Ecwid_Theme_Base
31
  }
32
  }
33
 
34
- $ecwid_current_theme = new Ecwid_Theme_Envision();
31
  }
32
  }
33
 
34
+ return new Ecwid_Theme_Envision();
includes/themes/class-ecwid-theme-genesis.php CHANGED
@@ -16,4 +16,4 @@ class Ecwid_Theme_Genesis extends Ecwid_Theme_Base
16
  }
17
  }
18
 
19
- $ecwid_current_theme = new Ecwid_Theme_Genesis();
16
  }
17
  }
18
 
19
+ return new Ecwid_Theme_Genesis();
includes/themes/class-ecwid-theme-mfupdate.php CHANGED
@@ -29,4 +29,4 @@ HTML;
29
  }
30
  }
31
 
32
- $ecwid_current_theme = new Ecwid_Theme_MFUpdate();
29
  }
30
  }
31
 
32
+ return new Ecwid_Theme_MFUpdate();
includes/themes/class-ecwid-theme-responsive.php CHANGED
@@ -78,5 +78,4 @@ class Ecwid_Theme_Responsive extends Ecwid_Theme_Base
78
 
79
  }
80
 
81
- global $ecwid_current_theme;
82
- $ecwid_current_theme = new Ecwid_Theme_Responsive();
78
 
79
  }
80
 
81
+ return new Ecwid_Theme_Responsive();
 
includes/themes/class-ecwid-theme-themify-music.php CHANGED
@@ -20,4 +20,4 @@ class Ecwid_Theme_Themify_Music extends Ecwid_Theme_Base
20
  }
21
  }
22
 
23
- $ecwid_current_theme = new Ecwid_Theme_Themify_Music();
20
  }
21
  }
22
 
23
+ return new Ecwid_Theme_Themify_Music();
includes/themes/class-ecwid-theme-trend.php CHANGED
@@ -110,4 +110,4 @@ HTML;
110
  }
111
  }
112
 
113
- $ecwid_current_theme = new Ecwid_Theme_Trend();
110
  }
111
  }
112
 
113
+ return new Ecwid_Theme_Trend();
includes/themes/class-ecwid-theme-twentyfifteen.php CHANGED
@@ -46,4 +46,4 @@ class Ecwid_Theme_2015 extends Ecwid_Theme_Base
46
  }
47
  }
48
 
49
- $ecwid_current_theme = new Ecwid_Theme_2015();
46
  }
47
  }
48
 
49
+ return new Ecwid_Theme_2015();
includes/themes/class-ecwid-theme-twentynineteen.php CHANGED
@@ -16,4 +16,4 @@ class Ecwid_Theme_2019 extends Ecwid_Theme_Base {
16
  }
17
  }
18
 
19
- $ecwid_current_theme = new Ecwid_Theme_2019();
16
  }
17
  }
18
 
19
+ return new Ecwid_Theme_2019();
includes/themes/class-ecwid-theme-twentyseventeen.php CHANGED
@@ -60,4 +60,4 @@ class Ecwid_Theme_2017 extends Ecwid_Theme_Base
60
  }
61
  }
62
 
63
- $ecwid_current_theme = new Ecwid_Theme_2017();
60
  }
61
  }
62
 
63
+ return new Ecwid_Theme_2017();
includes/themes/class-ecwid-theme-twentysixteen.php CHANGED
@@ -48,4 +48,4 @@ class Ecwid_Theme_2016 extends Ecwid_Theme_Base
48
  }
49
  }
50
 
51
- $ecwid_current_theme = new Ecwid_Theme_2016();
48
  }
49
  }
50
 
51
+ return new Ecwid_Theme_2016();
js/admin-menu.js CHANGED
@@ -180,4 +180,4 @@ jQuery(document).ready(function() {
180
  jQuery('#toplevel_page_ec-store > a').addClass('wp-has-current-submenu');
181
  }
182
  ecwidRefreshEcwidMenuItemSelection();
183
- });
180
  jQuery('#toplevel_page_ec-store > a').addClass('wp-has-current-submenu');
181
  }
182
  ecwidRefreshEcwidMenuItemSelection();
183
+ });
js/gutenberg/blocks.build.js CHANGED
@@ -1 +1 @@
1
- !function(e){function t(n){if(l[n])return l[n].exports;var r=l[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var l={};t.m=e,t.c=l,t.d=function(e,l,n){t.o(e,l)||Object.defineProperty(e,l,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var l=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(l,"a",l),l},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});l(1),l(5)},function(e,t,l){"use strict";function n(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var r=l(2),o=(l.n(r),l(3)),a=(l.n(o),l(4)),i=wp.i18n,c=i.__,s=(i._x,a.a,wp.blocks),m=(s.BlockControls,s.registerBlockType),p=wp.editor,u=p.InspectorControls,d=(p.AlignmentToolbar,p.withColors,wp.components),w=d.PanelBody,h=d.PanelRow,g=d.ToggleControl,_=d.ButtonGroup,f=d.Button,E=(d.IconButton,d.BaseControl),v=d.Toolbar,y=(d.Dropdown,d.ColorPalette),b=d.ColorIndicator,x=wp.compose.withState;wp.element.Fragment;m("ecwid/store-block",{title:EcwidGutenbergParams.storeBlockTitle,icon:wp.element.createElement("svg",{className:"dashicon",viewBox:"0 0 20 20",width:"20",height:"20"},wp.element.createElement("path",{d:EcwidGutenbergParams.storeIcon})),category:"common",attributes:EcwidGutenbergStoreBlockParams.attributes,description:c("Add storefront (product listing)","ecwid-shopping-cart"),supports:{customClassName:!1,className:!1,html:!1,multiple:!1},edit:function(e){function t(e,t,l){return wp.element.createElement(g,{label:l,checked:e.attributes[t],onChange:function(){return e.setAttributes(n({},t,!e.attributes[t]))}})}function l(e,t,l,r){return wp.element.createElement(E,{label:l},wp.element.createElement(v,{controls:r.map(function(l){return{icon:a.a[l.icon],title:l.title,isActive:e.attributes[t]===l.value,className:"ecwid-toolbar-icon",onClick:function(){return e.setAttributes(n({},t,l.value))}}})}))}function r(e,t,l,r){return wp.element.createElement(E,{label:l},wp.element.createElement("select",{onChange:function(l){e.setAttributes(n({},t,l.target.value))}},r.map(function(l){return wp.element.createElement("option",{value:l.value,selected:e.attributes[t]==l.value},l.title)})))}function o(e,t,l){return wp.element.createElement(E,{label:l},wp.element.createElement("input",{type:"text",value:e.attributes[t],onChange:function(l){e.setAttributes(n({},t,l.target.value))}}))}function i(e,t,l,r){return wp.element.createElement(E,{label:l},wp.element.createElement(_,null,r.map(function(l){return wp.element.createElement(f,{isDefault:!0,isButton:!0,isPrimary:C[t]==l.value,onClick:function(){return e.setAttributes(n({},t,l.value))}},l.title)})))}function s(e,t){return wp.element.createElement(E,{label:e},wp.element.createElement("div",{dangerouslySetInnerHTML:{__html:t}}))}function m(e,n,a){var c=EcwidGutenbergStoreBlockParams.attributes[n];return"undefined"===typeof a&&(a=c.type),"default_category_id"===a&&(a=c.values&&c.values.length>1?"select":"textbox"),"buttonGroup"===a?i(e,c.name,c.title,c.values):"toolbar"===a?l(e,c.name,c.title,c.values):"select"===a?r(e,c.name,c.title,c.values):"colorPalette"===a?p(e,c.name,c.title):"text"===a?s(c.title,c.message):"textbox"===a?o(e,c.name,c.title):t(e,c.name,c.title)}function p(e,t,l){var r=wp.element.createElement("span",null,l,wp.element.createElement(b,{colorValue:C[t]}));return wp.element.createElement(E,{label:r,className:"ec-store-color-picker"},wp.element.createElement(y,{value:C[t],colors:P,onChange:function(l){return e.setAttributes(n({},t,l))}}))}function d(e){function t(e){o(function(t){return{manual:"manual",color:e}}),i.setAttributes(n({},a,e))}var l=e.manual,r=e.color,o=e.setState,a=arguments[0].name,i=arguments[0].props,s=EcwidGutenbergStoreBlockParams.attributes[a].title,m=null===l&&null!==i.attributes[a]&&""!==i.attributes[a]||"manual"===l;m?null!==r&&i.setAttributes(n({},a,r)):i.setAttributes(n({},a,null));var p=i.attributes[a],u=wp.element.createElement("span",null,s,null!==p&&wp.element.createElement(b,{colorValue:C[a]}));return wp.element.createElement(E,{label:u,className:"ec-store-color-picker"},wp.element.createElement("select",{onChange:function(e){return o(function(e){return{manual:event.target.value,color:e.color}})}},wp.element.createElement("option",{value:"auto",selected:!m},c("Detect automatically","ecwid-shopping-cart")),wp.element.createElement("option",{value:"manual",selected:m},c("Set manually","ecwid-shopping-cart"))),m&&wp.element.createElement(y,{value:p,colors:P,onChange:t}))}function k(e){var t=e.count,l=e.setState;return wp.element.createElement("div",null,wp.element.createElement("button",{onClick:function(){return l(function(e){return{count:e.count+1}})}},"text ",t," ",arguments[0].color))}var C=e.attributes;e.setAttributes({widgets:""});var B=wp.element.createElement("div",{className:"ec-store-block ec-store-block-product-browser"},wp.element.createElement("div",{className:"ec-store-block-header"},wp.element.createElement("svg",{className:"dashicon",viewBox:"0 0 20 20",width:"20",height:"20"},wp.element.createElement("path",{d:EcwidGutenbergParams.storeIcon})),EcwidGutenbergParams.isDemoStore&&c("Demo store","ecwid-shopping-cart"),!EcwidGutenbergParams.isDemoStore&&EcwidGutenbergStoreBlockParams.storeBlockTitle),EcwidGutenbergParams.isDemoStore&&wp.element.createElement("div",null,wp.element.createElement("a",{className:"button button-primary",href:"admin.php?page=ec-store"},c("Set up your store","ecwid-shopping-cart")))),P=[{name:c("Pale pink"),slug:"pale-pink",color:"#f78da7"},{name:c("Vivid red"),slug:"vivid-red",color:"#cf2e2e"},{name:c("Luminous vivid orange"),slug:"luminous-vivid-orange",color:"#ff6900"},{name:c("Luminous vivid amber"),slug:"luminous-vivid-amber",color:"#fcb900"},{name:c("Light green cyan"),slug:"light-green-cyan",color:"#7bdcb5"},{name:c("Vivid green cyan"),slug:"vivid-green-cyan",color:"#00d084"},{name:c("Pale cyan blue"),slug:"pale-cyan-blue",color:"#8ed1fc"},{name:c("Vivid cyan blue"),slug:"vivid-cyan-blue",color:"#0693e3"},{name:c("Very light gray"),slug:"very-light-gray",color:"#eeeeee"},{name:c("Cyan bluish gray"),slug:"cyan-bluish-gray",color:"#abb8c3"},{name:c("Very dark gray"),slug:"very-dark-gray",color:"#313131"}],S=x({manual:null,color:null})(d),G=(x({count:0})(k),s("",c('To improve the look and feel of your store and manage your storefront appearance here, please enable the \u201cNext-gen look and feel of the product list on the storefront\u201d option in your store dashboard (\u201c<a href="admin.php?page=ec-store&ec-store-page=whatsnew">Settings \u2192 What\u2019s New</a>\u201d).',"ecwid-shopping-cart"))),N=s(c("Display cart icon","ecwid-shopping-cart"),EcwidGutenbergParams.customizeMinicartText),O=(s("",c('To improve the look and feel of your product page and manage your its appearance here, please enable the \u201cNext-gen look and feel of the product page on the storefront\u201d option in your store dashboard (\u201c<a href="admin.php?page=ec-store&ec-store-page=whatsnew">Settings \u2192 What\u2019s New</a>\u201d).',"ecwid-shopping-cart")),EcwidGutenbergStoreBlockParams.is_new_product_list),z=EcwidGutenbergStoreBlockParams.is_new_details_page,L=EcwidGutenbergStoreBlockParams.attributes.default_category_id&&EcwidGutenbergStoreBlockParams.attributes.default_category_id.values&&EcwidGutenbergStoreBlockParams.attributes.default_category_id.values.length>0;return[B,wp.element.createElement(u,null,L&&wp.element.createElement(w,{title:c("Category List Appearance","ecwid-shopping-cart"),initialOpen:!1},O&&m(e,"product_list_category_title_behavior","select"),O&&"SHOW_TEXT_ONLY"!==C.product_list_category_title_behavior&&m(e,"product_list_category_image_size","buttonGroup"),O&&"SHOW_TEXT_ONLY"!==C.product_list_category_title_behavior&&m(e,"product_list_category_image_aspect_ratio","toolbar"),!O&&G),wp.element.createElement(w,{title:c("Product List Appearance","ecwid-shopping-cart"),initialOpen:!1},O&&m(e,"product_list_show_product_images","toggle"),O&&C.product_list_show_product_images&&m(e,"product_list_image_size","buttonGroup"),O&&C.product_list_show_product_images&&m(e,"product_list_image_aspect_ratio","toolbar"),O&&m(e,"product_list_product_info_layout","toolbar"),O&&m(e,"product_list_title_behavior","select"),O&&m(e,"product_list_price_behavior","select"),O&&m(e,"product_list_sku_behavior","select"),O&&m(e,"product_list_buybutton_behavior","select"),O&&m(e,"product_list_show_additional_image_on_hover","toggle"),O&&m(e,"product_list_show_frame","toggle"),!O&&G),wp.element.createElement(w,{title:c("Product Page Appearance","ecwid-shopping-cart"),initialOpen:!1},z&&m(e,"product_details_layout","select"),z&&("TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT"==C.product_details_layout||"TWO_COLUMNS_SIDEBAR_ON_THE_LEFT"==C.product_details_layout)&&m(e,"show_description_under_image","toggle"),z&&m(e,"product_details_gallery_layout","toolbar"),z&&wp.element.createElement(h,null,wp.element.createElement("label",{className:"ec-store-inspector-subheader"},c("Product sidebar content","ecwid-shopping-cart"))),z&&m(e,"product_details_show_product_name","toggle"),z&&m(e,"product_details_show_breadcrumbs","toggle"),z&&m(e,"product_details_show_product_sku","toggle"),z&&m(e,"product_details_show_product_price","toggle"),z&&m(e,"product_details_show_qty","toggle"),z&&m(e,"product_details_show_number_of_items_in_stock","toggle"),z&&m(e,"product_details_show_in_stock_label","toggle"),z&&m(e,"product_details_show_wholesale_prices","toggle"),z&&m(e,"product_details_show_share_buttons","toggle"),!z&&G),L&&wp.element.createElement(w,{title:c("Store Front Page","ecwid-shopping-cart"),initialOpen:!1},m(e,"default_category_id","default_category_id")),wp.element.createElement(w,{title:c("Store Navigation","ecwid-shopping-cart"),initialOpen:!1},m(e,"show_categories","toggle"),m(e,"show_search","toggle"),m(e,"show_breadcrumbs","toggle"),O&&m(e,"show_footer_menu","toggle"),m(e,"show_signin_link","toggle"),m(e,"product_list_show_sort_viewas_options","toggle"),N),wp.element.createElement(w,{title:c("Color settings","ecwid-shopping-cart"),initialOpen:!1},wp.element.createElement(S,{props:e,name:"chameleon_color_button"}),wp.element.createElement(S,{props:e,name:"chameleon_color_foreground"}),wp.element.createElement(S,{props:e,name:"chameleon_color_price"}),wp.element.createElement(S,{props:e,name:"chameleon_color_link"}),wp.element.createElement(S,{props:e,name:"chameleon_color_background"})))]},save:function(e){var t=["productbrowser"];e.attributes.show_categories&&(t[t.length]="categories"),e.attributes.show_search&&(t[t.length]="search");var l={widgets:t.join(" "),default_category_id:e.attributes.default_category_id};return new wp.shortcode({tag:EcwidGutenbergParams.storeShortcodeName,attrs:l,type:"single"}).string()},deprecated:[{attributes:{widgets:{type:"string"},categories_per_row:{type:"integer"},grid:{type:"string"},list:{type:"integer"},table:{type:"integer"},default_category_id:{type:"integer"},default_product_id:{type:"integer"},category_view:{type:"string"},search_view:{type:"string"},minicart_layout:{type:"string"}},save:function(e){return null}},{attributes:{widgets:{type:"string",default:"productbrowser"},default_category_id:{type:"integer",default:0}},migrate:function(e){return{widgets:e.widgets,default_category_id:e.default_category_id}},save:function(e){for(var t={},l=["widgets","default_category_id"],n=0;n<l.length;n++)t[l[n]]=e.attributes[l[n]];return t.default_product_id=0,new wp.shortcode({tag:EcwidGutenbergParams.storeShortcodeName,attrs:t,type:"single"}).string()}},{save:function(e){return"[ecwid]"}},{save:function(e){return'[ecwid widgets="productbrowser" default_category_id="0" default_product_id="0"]'}}],transforms:{from:[{type:"shortcode",tag:["ecwid","ec_store"],attributes:{default_category_id:{type:"integer",shortcode:function(e){return e.default_category_id}},show_categories:{type:"boolean",shortcode:function(e){return-1!==e.named.widgets.indexOf("categories")}},show_search:{type:"boolean",shortcode:function(e){return-1!==e.named.widgets.indexOf("search")}}},priority:10}]}})},function(e,t){},function(e,t){},function(e,t,l){"use strict";l.d(t,"a",function(){return n});var n={store:wp.element.createElement("svg",{version:"1.1",x:"0px",y:"0px",viewBox:"0 0 20 20","enable-background":"new 0 0 20 20"},wp.element.createElement("path",{fill:"#555d66",d:"M15.32,15.58c-0.37,0-0.66,0.3-0.66,0.67c0,0.37,0.3,0.67,0.66,0.67c0.37,0,0.67-0.3,0.67-0.67 C15.98,15.88,15.69,15.58,15.32,15.58z M15.45,0H4.55C2.04,0,0,2.04,0,4.55v10.91C0,17.97,2.04,20,4.55,20h10.91c2.51,0,4.55-2.04,4.55-4.55V4.55 C20,2.04,17.96,0,15.45,0z M12.97,4.94C13.54,4.94,14,5.4,14,5.96s-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03 C11.95,5.4,12.41,4.94,12.97,4.94z M12.97,8.02c0.57,0,1.03,0.46,1.03,1.03c0,0.57-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03 C11.95,8.48,12.41,8.02,12.97,8.02z M9.98,4.94c0.57,0,1.03,0.46,1.03,1.03s-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03 C8.95,5.4,9.41,4.94,9.98,4.94z M9.98,8.02c0.57,0,1.03,0.46,1.03,1.03s-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03 C8.95,8.48,9.41,8.02,9.98,8.02z M7.03,4.94c0.57,0,1.03,0.46,1.03,1.03S7.6,6.99,7.03,6.99C6.46,6.99,6,6.53,6,5.96 C6,5.4,6.46,4.94,7.03,4.94z M7.03,8.02c0.57,0,1.03,0.46,1.03,1.03s-0.46,1.03-1.03,1.03C6.46,10.08,6,9.62,6,9.05 C6,8.48,6.46,8.02,7.03,8.02z M4.6,18.02c-1.02,0-1.86-0.83-1.86-1.86c0-1.03,0.83-1.86,1.86-1.86c1.03,0,1.86,0.83,1.86,1.86 C6.45,17.19,5.62,18.02,4.6,18.02z M15.32,18.1c-1.02,0-1.86-0.83-1.86-1.86c0-1.03,0.83-1.86,1.86-1.86c1.03,0,1.86,0.83,1.86,1.86 C17.17,17.27,16.34,18.1,15.32,18.1z M18.48,2.79l-1.92,7.14c-0.51,1.91-2.03,3.1-4,3.1H7.2c-1.91,0-3.26-1.09-3.84-2.91L1.73,5 C1.7,4.9,1.72,4.79,1.78,4.71c0.06-0.09,0.16-0.14,0.27-0.14l0.31,0c0.75,0,1.41,0.49,1.64,1.2l1.2,3.76 c0.32,1.02,1.26,1.7,2.33,1.7h4.81c1.1,0,2.08-0.74,2.36-1.81l1.55-5.78c0.2-0.75,0.89-1.28,1.67-1.28h0.24 c0.1,0,0.2,0.05,0.26,0.13C18.48,2.58,18.5,2.68,18.48,2.79z M4.6,15.5c-0.37,0-0.66,0.3-0.66,0.67c0,0.37,0.3,0.67,0.66,0.67c0.37,0,0.67-0.3,0.67-0.67 S4.96,15.5,4.6,15.5z"})),product:wp.element.createElement("svg",{version:"1.1",x:"0px",y:"0px",viewBox:"0 0 20 20","enable-background":"new 0 0 20 20"},wp.element.createElement("path",{fill:"#231F20",d:"M16.43,5.12c-0.13-1.19-0.15-1.19-1.35-1.33c-0.21-0.02-0.21-0.02-0.43-0.05c-0.01,0.06,0.06,0.78,0.14,1.13 c0.57,0.37,0.87,0.98,0.87,1.71c0,1.14-0.93,2.07-2.07,2.07s-2.07-0.93-2.07-2.07c0-0.54,0.09-0.97,0.55-1.4 c-0.06-0.61-0.19-1.54-0.18-1.64C10.14,3.46,8.72,3.46,8.58,3.6l-8.17,8.13c-0.56,0.55-0.56,1.43,0,1.97l5.54,5.93 c0.56,0.55,1.46,0.55,2.01,0l8.67-8.14C17.04,11.09,16.68,7.14,16.43,5.12z M16.06,0.04c-1.91,0-3.46,1.53-3.46,3.41c0,0.74,0.4,3.09,0.44,3.28c0.07,0.34,0.52,0.56,0.86,0.49 C14,7.19,14.07,7.15,14.12,7.1c0.24-0.11,0.32-0.39,0.25-0.68c-0.09-0.45-0.39-2.44-0.39-2.94c0-1.16,0.94-2.09,2.11-2.09 c1.24,0,2.11,0.96,2.11,2.34c0,2.43-0.31,4.23-0.32,4.26c-0.1,0.17-0.1,0.38-0.03,0.55c0.03,0.17,0.13,0.31,0.28,0.4 c0.1,0.06,0.22,0.09,0.33,0.09c0.21,0,0.42-0.1,0.54-0.3c0.06-0.09,0.52-2.17,0.52-5.03C19.52,1.61,18.04,0.04,16.06,0.04z"})),aspect169:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"9",y:"14",width:"22",height:"12",rx:"2"}))),aspect916:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"}," ",wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"14",y:"9",width:"12",height:"22",rx:"2"}))),aspect11:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"12",y:"12",width:"16",height:"16",rx:"2"}))),aspect34:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"12",y:"10",width:"16",height:"20",rx:"2"}))),aspect43:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"10",y:"12",width:"20",height:"16",rx:"2"}))),textalignleft:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"13",y:"13",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"16",width:"9",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"19",width:"13",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"22",width:"9",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"25",width:"14",height:"2"}))),textaligncenter:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"13",y:"13",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"16",y:"16",width:"8",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"14",y:"19",width:"12",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"16",y:"22",width:"8",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"25",width:"14",height:"2"}))),textalignright:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"13",y:"13",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"18",y:"16",width:"9",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"14",y:"19",width:"13",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"18",y:"22",width:"9",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"25",width:"14",height:"2"}))),textalignjustify:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",zoomAndPan:"1.5",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"13",y:"13",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"16",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"19",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"22",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"25",width:"14",height:"2"}))),productLayout3Columns:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",transform:"translate(13.000000, 19.500000) rotate(-270.000000) translate(-13.000000, -19.500000) ",x:"3.5",y:"16.5",width:"19",height:"6",rx:"1"}),wp.element.createElement("rect",{fill:"#000000",x:"18",y:"10",width:"5",height:"19"}),wp.element.createElement("rect",{fill:"#000000",x:"25",y:"10",width:"5",height:"8"}),wp.element.createElement("rect",{fill:"#000000",x:"25",y:"19",width:"5",height:"10"}))),productLayout2ColumnsLeft:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"17",y:"10",width:"13",height:"19",rx:"1"}),wp.element.createElement("rect",{fill:"#000000",x:"10",y:"10",width:"5",height:"5"}),wp.element.createElement("rect",{fill:"#000000",x:"10",y:"17",width:"5",height:"12"}))),productLayout2ColumnsRight:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("g",{transform:"translate(10.000000, 10.000000)",fill:"#000000"},wp.element.createElement("rect",{x:"0",y:"0",width:"13",height:"19",rx:"1"}),wp.element.createElement("rect",{x:"15",y:"0",width:"5",height:"5"}),wp.element.createElement("rect",{x:"15",y:"7",width:"5",height:"12"})))),productLayout2ColumnsBottom:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("g",{transform:"translate(10.000000, 10.000000)",fill:"#000000"},wp.element.createElement("rect",{x:"0",y:"0",width:"13",height:"12",rx:"1"}),wp.element.createElement("rect",{x:"15",y:"0",width:"5",height:"12"}),wp.element.createElement("rect",{x:"0",y:"14",width:"20",height:"5"})))),galleryLayoutVertical:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("g",{transform:"translate(20.000000, 20.500000) rotate(-180.000000) translate(-20.000000, -20.500000) translate(10.000000, 11.000000)",fill:"#000000","fill-rule":"nonzero"},wp.element.createElement("rect",{x:"0",y:"0",width:"13",height:"19",rx:"1"}),wp.element.createElement("rect",{x:"15",y:"0",width:"5",height:"6"}),wp.element.createElement("rect",{x:"15",y:"14",width:"5",height:"5"}),wp.element.createElement("rect",{x:"15",y:"7",width:"5",height:"6"})))),galleryLayoutHorizontal:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("g",{transform:"translate(19.500000, 20.000000) rotate(-270.000000) translate(-19.500000, -20.000000) translate(9.500000, 10.500000)",fill:"#000000","fill-rule":"nonzero"},wp.element.createElement("rect",{x:"0",y:"-1.13686838e-13",width:"13",height:"19",rx:"1"}),wp.element.createElement("rect",{x:"15",y:"-1.13686838e-13",width:"5",height:"6"}),wp.element.createElement("rect",{x:"15",y:"7",width:"5",height:"5"}),wp.element.createElement("rect",{x:"15",y:"13",width:"5",height:"6"})))),galleryLayoutFeed:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("g",{transform:"translate(20.500000, 12.500000) rotate(-270.000000) translate(-20.500000, -12.500000) translate(14.000000, 3.000000)",fill:"#000000","fill-rule":"nonzero"},wp.element.createElement("rect",{x:"0",y:"0",width:"13",height:"19",rx:"1"})),wp.element.createElement("g",{transform:"translate(20.500000, 27.500000) rotate(-270.000000) translate(-20.500000, -27.500000) translate(14.000000, 18.000000)",fill:"#000000","fill-rule":"nonzero"},wp.element.createElement("rect",{x:"0",y:"0",width:"13",height:"19",rx:"1"}))))}},function(e,t,l){"use strict";var n=l(6),r=(l.n(n),l(7)),o=(l.n(r),wp.i18n.__);(0,wp.blocks.registerBlockType)("cgb/block-my-block2",{title:o("my-block - CGB Block"),icon:"shield",category:"common",keywords:[o("my-block \u2014 CGB Block"),o("CGB Example"),o("create-guten-block")],edit:function(e){return wp.element.createElement("div",{className:e.className},wp.element.createElement("p",null,"\u2014 Hello from the backend."),wp.element.createElement("p",null,"CGB BLOCK: ",wp.element.createElement("code",null,"my-block")," is a new Gutenberg block"),wp.element.createElement("p",null,"It was created via"," ",wp.element.createElement("code",null,wp.element.createElement("a",{href:"https://github.com/ahmadawais/create-guten-block"},"create-guten-block")),"."))},save:function(e){return wp.element.createElement("div",null,wp.element.createElement("p",null,"\u2014 Hello from the frontend."),wp.element.createElement("p",null,"CGB BLOCK: ",wp.element.createElement("code",null,"my-block")," is a new Gutenberg block."),wp.element.createElement("p",null,"It was created via"," ",wp.element.createElement("code",null,wp.element.createElement("a",{href:"https://github.com/ahmadawais/create-guten-block"},"create-guten-block")),"."))}})},function(e,t){},function(e,t){}]);
1
+ !function(e){function t(n){if(l[n])return l[n].exports;var r=l[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var l={};t.m=e,t.c=l,t.d=function(e,l,n){t.o(e,l)||Object.defineProperty(e,l,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var l=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(l,"a",l),l},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});l(1),l(5)},function(e,t,l){"use strict";function n(e,t,l){return t in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}var r=l(2),o=(l.n(r),l(3)),a=(l.n(o),l(4)),i=wp.i18n,c=i.__,s=(i._x,a.a,wp.blocks),m=(s.BlockControls,s.registerBlockType),p=wp.editor,u=p.InspectorControls,d=(p.AlignmentToolbar,p.withColors,wp.components),w=d.PanelBody,h=d.PanelRow,g=d.ToggleControl,_=d.ButtonGroup,f=d.Button,E=(d.IconButton,d.BaseControl),v=d.Toolbar,y=(d.Dropdown,d.ColorPalette),b=d.ColorIndicator,x=wp.compose.withState;wp.element.Fragment;m("ecwid/store-block",{title:EcwidGutenbergParams.storeBlockTitle,icon:wp.element.createElement("svg",{className:"dashicon",viewBox:"0 0 20 20",width:"20",height:"20"},wp.element.createElement("path",{d:EcwidGutenbergParams.storeIcon})),category:"common",attributes:EcwidGutenbergStoreBlockParams.attributes,description:c("Add storefront (product listing)","ecwid-shopping-cart"),supports:{customClassName:!1,className:!1,html:!1,multiple:!1},edit:function(e){function t(e,t,l){return wp.element.createElement(g,{label:l,checked:e.attributes[t],onChange:function(){return e.setAttributes(n({},t,!e.attributes[t]))}})}function l(e,t,l,r){return wp.element.createElement(E,{label:l},wp.element.createElement(v,{controls:r.map(function(l){return{icon:a.a[l.icon],title:l.title,isActive:e.attributes[t]===l.value,className:"ecwid-toolbar-icon",onClick:function(){return e.setAttributes(n({},t,l.value))}}})}))}function r(e,t,l,r){return wp.element.createElement(E,{label:l},wp.element.createElement("select",{onChange:function(l){e.setAttributes(n({},t,l.target.value))}},r.map(function(l){return wp.element.createElement("option",{value:l.value,selected:e.attributes[t]==l.value},l.title)})))}function o(e,t,l){return wp.element.createElement(E,{label:l},wp.element.createElement("input",{type:"text",value:e.attributes[t],onChange:function(l){e.setAttributes(n({},t,l.target.value))}}))}function i(e,t,l,r){return wp.element.createElement(E,{label:l},wp.element.createElement(_,null,r.map(function(l){return wp.element.createElement(f,{isDefault:!0,isButton:!0,isPrimary:C[t]==l.value,onClick:function(){return e.setAttributes(n({},t,l.value))}},l.title)})))}function s(e,t){return wp.element.createElement(E,{label:e},wp.element.createElement("div",{dangerouslySetInnerHTML:{__html:t}}))}function m(e,n,a){var c=EcwidGutenbergStoreBlockParams.attributes[n];return"undefined"===typeof a&&(a=c.type),"default_category_id"===a&&(a=c.values&&c.values.length>1?"select":"textbox"),"buttonGroup"===a?i(e,c.name,c.title,c.values):"toolbar"===a?l(e,c.name,c.title,c.values):"select"===a?r(e,c.name,c.title,c.values):"colorPalette"===a?p(e,c.name,c.title):"text"===a?s(c.title,c.message):"textbox"===a?o(e,c.name,c.title):t(e,c.name,c.title)}function p(e,t,l){var r=wp.element.createElement("span",null,l,wp.element.createElement(b,{colorValue:C[t]}));return wp.element.createElement(E,{label:r,className:"ec-store-color-picker"},wp.element.createElement(y,{value:C[t],colors:P,onChange:function(l){return e.setAttributes(n({},t,l))}}))}function d(e){function t(e){o(function(t){return{manual:"manual",color:e}}),i.setAttributes(n({},a,e))}var l=e.manual,r=e.color,o=e.setState,a=arguments[0].name,i=arguments[0].props,s=EcwidGutenbergStoreBlockParams.attributes[a].title,m=null===l&&null!==i.attributes[a]&&""!==i.attributes[a]||"manual"===l;m?null!==r&&i.setAttributes(n({},a,r)):i.setAttributes(n({},a,null));var p=i.attributes[a],u=wp.element.createElement("span",null,s,null!==p&&wp.element.createElement(b,{colorValue:C[a]}));return wp.element.createElement(E,{label:u,className:"ec-store-color-picker"},wp.element.createElement("select",{onChange:function(e){return o(function(e){return{manual:event.target.value,color:e.color}})}},wp.element.createElement("option",{value:"auto",selected:!m},c("Detect automatically","ecwid-shopping-cart")),wp.element.createElement("option",{value:"manual",selected:m},c("Set manually","ecwid-shopping-cart"))),m&&wp.element.createElement(y,{value:p,colors:P,onChange:t}))}function k(e){var t=e.count,l=e.setState;return wp.element.createElement("div",null,wp.element.createElement("button",{onClick:function(){return l(function(e){return{count:e.count+1}})}},"text ",t," ",arguments[0].color))}var C=e.attributes;e.setAttributes({widgets:""});var B=wp.element.createElement("div",{className:"ec-store-block ec-store-block-product-browser"},wp.element.createElement("div",{className:"ec-store-block-header"},wp.element.createElement("svg",{className:"dashicon",viewBox:"0 0 20 20",width:"20",height:"20"},wp.element.createElement("path",{d:EcwidGutenbergParams.storeIcon})),EcwidGutenbergParams.isDemoStore&&c("Demo store","ecwid-shopping-cart"),!EcwidGutenbergParams.isDemoStore&&EcwidGutenbergStoreBlockParams.storeBlockTitle),EcwidGutenbergParams.isDemoStore&&wp.element.createElement("div",null,wp.element.createElement("a",{className:"button button-primary",href:"admin.php?page=ec-store"},c("Set up your store","ecwid-shopping-cart")))),P=[{name:c("Pale pink"),slug:"pale-pink",color:"#f78da7"},{name:c("Vivid red"),slug:"vivid-red",color:"#cf2e2e"},{name:c("Luminous vivid orange"),slug:"luminous-vivid-orange",color:"#ff6900"},{name:c("Luminous vivid amber"),slug:"luminous-vivid-amber",color:"#fcb900"},{name:c("Light green cyan"),slug:"light-green-cyan",color:"#7bdcb5"},{name:c("Vivid green cyan"),slug:"vivid-green-cyan",color:"#00d084"},{name:c("Pale cyan blue"),slug:"pale-cyan-blue",color:"#8ed1fc"},{name:c("Vivid cyan blue"),slug:"vivid-cyan-blue",color:"#0693e3"},{name:c("Very light gray"),slug:"very-light-gray",color:"#eeeeee"},{name:c("Cyan bluish gray"),slug:"cyan-bluish-gray",color:"#abb8c3"},{name:c("Very dark gray"),slug:"very-dark-gray",color:"#313131"}],S=x({manual:null,color:null})(d),G=(x({count:0})(k),s("",c('To improve the look and feel of your store and manage your storefront appearance here, please enable the \u201cNext-gen look and feel of the product list on the storefront\u201d option in your store dashboard (\u201c<a href="admin.php?page=ec-store&ec-store-page=whatsnew">Settings \u2192 What\u2019s New</a>\u201d).',"ecwid-shopping-cart"))),N=s(c("Display cart icon","ecwid-shopping-cart"),EcwidGutenbergParams.customizeMinicartText),O=(s("",c('To improve the look and feel of your product page and manage your its appearance here, please enable the \u201cNext-gen look and feel of the product page on the storefront\u201d option in your store dashboard (\u201c<a href="admin.php?page=ec-store&ec-store-page=whatsnew">Settings \u2192 What\u2019s New</a>\u201d).',"ecwid-shopping-cart")),EcwidGutenbergStoreBlockParams.is_new_product_list),z=EcwidGutenbergStoreBlockParams.is_new_details_page,L=EcwidGutenbergStoreBlockParams.attributes.default_category_id&&EcwidGutenbergStoreBlockParams.attributes.default_category_id.values&&EcwidGutenbergStoreBlockParams.attributes.default_category_id.values.length>0;return[B,wp.element.createElement(u,null,L&&wp.element.createElement(w,{title:c("Category List Appearance","ecwid-shopping-cart"),initialOpen:!1},O&&m(e,"product_list_category_title_behavior","select"),O&&"SHOW_TEXT_ONLY"!==C.product_list_category_title_behavior&&m(e,"product_list_category_image_size","buttonGroup"),O&&"SHOW_TEXT_ONLY"!==C.product_list_category_title_behavior&&m(e,"product_list_category_image_aspect_ratio","toolbar"),!O&&G),wp.element.createElement(w,{title:c("Product List Appearance","ecwid-shopping-cart"),initialOpen:!1},O&&m(e,"product_list_show_product_images","toggle"),O&&C.product_list_show_product_images&&m(e,"product_list_image_size","buttonGroup"),O&&C.product_list_show_product_images&&m(e,"product_list_image_aspect_ratio","toolbar"),O&&m(e,"product_list_product_info_layout","toolbar"),O&&m(e,"product_list_title_behavior","select"),O&&m(e,"product_list_price_behavior","select"),O&&m(e,"product_list_sku_behavior","select"),O&&m(e,"product_list_buybutton_behavior","select"),O&&m(e,"product_list_show_additional_image_on_hover","toggle"),O&&m(e,"product_list_show_frame","toggle"),!O&&G),wp.element.createElement(w,{title:c("Product Page Appearance","ecwid-shopping-cart"),initialOpen:!1},z&&m(e,"product_details_layout","select"),z&&("TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT"==C.product_details_layout||"TWO_COLUMNS_SIDEBAR_ON_THE_LEFT"==C.product_details_layout)&&m(e,"show_description_under_image","toggle"),z&&m(e,"product_details_gallery_layout","toolbar"),z&&wp.element.createElement(h,null,wp.element.createElement("label",{className:"ec-store-inspector-subheader"},c("Product sidebar content","ecwid-shopping-cart"))),z&&m(e,"product_details_show_product_name","toggle"),z&&m(e,"product_details_show_breadcrumbs","toggle"),z&&m(e,"product_details_show_product_sku","toggle"),z&&m(e,"product_details_show_product_price","toggle"),z&&m(e,"product_details_show_qty","toggle"),z&&m(e,"product_details_show_number_of_items_in_stock","toggle"),z&&m(e,"product_details_show_in_stock_label","toggle"),z&&m(e,"product_details_show_wholesale_prices","toggle"),z&&m(e,"product_details_show_share_buttons","toggle"),!z&&G),L&&wp.element.createElement(w,{title:c("Store Front Page","ecwid-shopping-cart"),initialOpen:!1},m(e,"default_category_id","default_category_id")),wp.element.createElement(w,{title:c("Store Navigation","ecwid-shopping-cart"),initialOpen:!1},m(e,"show_categories","toggle"),m(e,"show_search","toggle"),m(e,"show_breadcrumbs","toggle"),O&&m(e,"show_footer_menu","toggle"),m(e,"show_signin_link","toggle"),m(e,"product_list_show_sort_viewas_options","toggle"),N),wp.element.createElement(w,{title:c("Color settings","ecwid-shopping-cart"),initialOpen:!1},wp.element.createElement(S,{props:e,name:"chameleon_color_button"}),wp.element.createElement(S,{props:e,name:"chameleon_color_foreground"}),wp.element.createElement(S,{props:e,name:"chameleon_color_price"}),wp.element.createElement(S,{props:e,name:"chameleon_color_link"}),wp.element.createElement(S,{props:e,name:"chameleon_color_background"})))]},save:function(e){var t=["productbrowser"];e.attributes.show_categories&&(t[t.length]="categories"),e.attributes.show_search&&(t[t.length]="search");var l={widgets:t.join(" "),default_category_id:e.attributes.default_category_id};return new wp.shortcode({tag:EcwidGutenbergParams.storeShortcodeName,attrs:l,type:"single"}).string()},deprecated:[{attributes:{widgets:{type:"string"},categories_per_row:{type:"integer"},grid:{type:"string"},list:{type:"integer"},table:{type:"integer"},default_category_id:{type:"integer"},default_product_id:{type:"integer"},category_view:{type:"string"},search_view:{type:"string"},minicart_layout:{type:"string"}},save:function(e){return null}},{attributes:{widgets:{type:"string",default:"productbrowser"},default_category_id:{type:"integer",default:0}},migrate:function(e){return{widgets:e.widgets,default_category_id:e.default_category_id}},save:function(e){for(var t={},l=["widgets","default_category_id"],n=0;n<l.length;n++)t[l[n]]=e.attributes[l[n]];return t.default_product_id=0,new wp.shortcode({tag:EcwidGutenbergParams.storeShortcodeName,attrs:t,type:"single"}).string()}},{save:function(e){return"[ecwid]"}},{save:function(e){return'[ecwid widgets="productbrowser" default_category_id="0" default_product_id="0"]'}}],transforms:{from:[{type:"shortcode",tag:["ecwid","ec_store"],attributes:{default_category_id:{type:"integer",shortcode:function(e){return e.default_category_id}},show_categories:{type:"boolean",shortcode:function(e){return-1!==e.named.widgets.indexOf("categories")}},show_search:{type:"boolean",shortcode:function(e){return-1!==e.named.widgets.indexOf("search")}}},priority:10}]}})},function(e,t){},function(e,t){},function(e,t,l){"use strict";l.d(t,"a",function(){return n});var n={store:wp.element.createElement("svg",{version:"1.1",x:"0px",y:"0px",viewBox:"0 0 20 20","enable-background":"new 0 0 20 20"},wp.element.createElement("path",{fill:"#555d66",d:"M15.32,15.58c-0.37,0-0.66,0.3-0.66,0.67c0,0.37,0.3,0.67,0.66,0.67c0.37,0,0.67-0.3,0.67-0.67 C15.98,15.88,15.69,15.58,15.32,15.58z M15.45,0H4.55C2.04,0,0,2.04,0,4.55v10.91C0,17.97,2.04,20,4.55,20h10.91c2.51,0,4.55-2.04,4.55-4.55V4.55 C20,2.04,17.96,0,15.45,0z M12.97,4.94C13.54,4.94,14,5.4,14,5.96s-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03 C11.95,5.4,12.41,4.94,12.97,4.94z M12.97,8.02c0.57,0,1.03,0.46,1.03,1.03c0,0.57-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03 C11.95,8.48,12.41,8.02,12.97,8.02z M9.98,4.94c0.57,0,1.03,0.46,1.03,1.03s-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03 C8.95,5.4,9.41,4.94,9.98,4.94z M9.98,8.02c0.57,0,1.03,0.46,1.03,1.03s-0.46,1.03-1.03,1.03c-0.57,0-1.03-0.46-1.03-1.03 C8.95,8.48,9.41,8.02,9.98,8.02z M7.03,4.94c0.57,0,1.03,0.46,1.03,1.03S7.6,6.99,7.03,6.99C6.46,6.99,6,6.53,6,5.96 C6,5.4,6.46,4.94,7.03,4.94z M7.03,8.02c0.57,0,1.03,0.46,1.03,1.03s-0.46,1.03-1.03,1.03C6.46,10.08,6,9.62,6,9.05 C6,8.48,6.46,8.02,7.03,8.02z M4.6,18.02c-1.02,0-1.86-0.83-1.86-1.86c0-1.03,0.83-1.86,1.86-1.86c1.03,0,1.86,0.83,1.86,1.86 C6.45,17.19,5.62,18.02,4.6,18.02z M15.32,18.1c-1.02,0-1.86-0.83-1.86-1.86c0-1.03,0.83-1.86,1.86-1.86c1.03,0,1.86,0.83,1.86,1.86 C17.17,17.27,16.34,18.1,15.32,18.1z M18.48,2.79l-1.92,7.14c-0.51,1.91-2.03,3.1-4,3.1H7.2c-1.91,0-3.26-1.09-3.84-2.91L1.73,5 C1.7,4.9,1.72,4.79,1.78,4.71c0.06-0.09,0.16-0.14,0.27-0.14l0.31,0c0.75,0,1.41,0.49,1.64,1.2l1.2,3.76 c0.32,1.02,1.26,1.7,2.33,1.7h4.81c1.1,0,2.08-0.74,2.36-1.81l1.55-5.78c0.2-0.75,0.89-1.28,1.67-1.28h0.24 c0.1,0,0.2,0.05,0.26,0.13C18.48,2.58,18.5,2.68,18.48,2.79z M4.6,15.5c-0.37,0-0.66,0.3-0.66,0.67c0,0.37,0.3,0.67,0.66,0.67c0.37,0,0.67-0.3,0.67-0.67 S4.96,15.5,4.6,15.5z"})),product:wp.element.createElement("svg",{version:"1.1",x:"0px",y:"0px",viewBox:"0 0 20 20","enable-background":"new 0 0 20 20"},wp.element.createElement("path",{fill:"#231F20",d:"M16.43,5.12c-0.13-1.19-0.15-1.19-1.35-1.33c-0.21-0.02-0.21-0.02-0.43-0.05c-0.01,0.06,0.06,0.78,0.14,1.13 c0.57,0.37,0.87,0.98,0.87,1.71c0,1.14-0.93,2.07-2.07,2.07s-2.07-0.93-2.07-2.07c0-0.54,0.09-0.97,0.55-1.4 c-0.06-0.61-0.19-1.54-0.18-1.64C10.14,3.46,8.72,3.46,8.58,3.6l-8.17,8.13c-0.56,0.55-0.56,1.43,0,1.97l5.54,5.93 c0.56,0.55,1.46,0.55,2.01,0l8.67-8.14C17.04,11.09,16.68,7.14,16.43,5.12z M16.06,0.04c-1.91,0-3.46,1.53-3.46,3.41c0,0.74,0.4,3.09,0.44,3.28c0.07,0.34,0.52,0.56,0.86,0.49 C14,7.19,14.07,7.15,14.12,7.1c0.24-0.11,0.32-0.39,0.25-0.68c-0.09-0.45-0.39-2.44-0.39-2.94c0-1.16,0.94-2.09,2.11-2.09 c1.24,0,2.11,0.96,2.11,2.34c0,2.43-0.31,4.23-0.32,4.26c-0.1,0.17-0.1,0.38-0.03,0.55c0.03,0.17,0.13,0.31,0.28,0.4 c0.1,0.06,0.22,0.09,0.33,0.09c0.21,0,0.42-0.1,0.54-0.3c0.06-0.09,0.52-2.17,0.52-5.03C19.52,1.61,18.04,0.04,16.06,0.04z"})),aspect169:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"9",y:"14",width:"22",height:"12",rx:"2"}))),aspect916:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"}," ",wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"14",y:"9",width:"12",height:"22",rx:"2"}))),aspect11:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"12",y:"12",width:"16",height:"16",rx:"2"}))),aspect34:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"12",y:"10",width:"16",height:"20",rx:"2"}))),aspect43:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"10",y:"12",width:"20",height:"16",rx:"2"}))),textalignleft:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"13",y:"13",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"16",width:"9",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"19",width:"13",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"22",width:"9",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"25",width:"14",height:"2"}))),textaligncenter:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"13",y:"13",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"16",y:"16",width:"8",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"14",y:"19",width:"12",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"16",y:"22",width:"8",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"25",width:"14",height:"2"}))),textalignright:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"13",y:"13",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"18",y:"16",width:"9",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"14",y:"19",width:"13",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"18",y:"22",width:"9",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"25",width:"14",height:"2"}))),textalignjustify:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",zoomAndPan:"1.5",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"13",y:"13",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"16",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"19",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"22",width:"14",height:"2"}),wp.element.createElement("rect",{fill:"#000000",x:"13",y:"25",width:"14",height:"2"}))),productLayout3Columns:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",transform:"translate(13.000000, 19.500000) rotate(-270.000000) translate(-13.000000, -19.500000) ",x:"3.5",y:"16.5",width:"19",height:"6",rx:"1"}),wp.element.createElement("rect",{fill:"#000000",x:"18",y:"10",width:"5",height:"19"}),wp.element.createElement("rect",{fill:"#000000",x:"25",y:"10",width:"5",height:"8"}),wp.element.createElement("rect",{fill:"#000000",x:"25",y:"19",width:"5",height:"10"}))),productLayout2ColumnsLeft:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("rect",{fill:"#000000",x:"17",y:"10",width:"13",height:"19",rx:"1"}),wp.element.createElement("rect",{fill:"#000000",x:"10",y:"10",width:"5",height:"5"}),wp.element.createElement("rect",{fill:"#000000",x:"10",y:"17",width:"5",height:"12"}))),productLayout2ColumnsRight:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("g",{transform:"translate(10.000000, 10.000000)",fill:"#000000"},wp.element.createElement("rect",{x:"0",y:"0",width:"13",height:"19",rx:"1"}),wp.element.createElement("rect",{x:"15",y:"0",width:"5",height:"5"}),wp.element.createElement("rect",{x:"15",y:"7",width:"5",height:"12"})))),productLayout2ColumnsBottom:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("g",{transform:"translate(10.000000, 10.000000)",fill:"#000000"},wp.element.createElement("rect",{x:"0",y:"0",width:"13",height:"12",rx:"1"}),wp.element.createElement("rect",{x:"15",y:"0",width:"5",height:"12"}),wp.element.createElement("rect",{x:"0",y:"14",width:"20",height:"5"})))),galleryLayoutHorizontal:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("g",{transform:"translate(20.000000, 20.500000) rotate(-180.000000) translate(-20.000000, -20.500000) translate(10.000000, 11.000000)",fill:"#000000","fill-rule":"nonzero"},wp.element.createElement("rect",{x:"0",y:"0",width:"13",height:"19",rx:"1"}),wp.element.createElement("rect",{x:"15",y:"0",width:"5",height:"6"}),wp.element.createElement("rect",{x:"15",y:"14",width:"5",height:"5"}),wp.element.createElement("rect",{x:"15",y:"7",width:"5",height:"6"})))),galleryLayoutVertical:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("g",{transform:"translate(19.500000, 20.000000) rotate(-270.000000) translate(-19.500000, -20.000000) translate(9.500000, 10.500000)",fill:"#000000","fill-rule":"nonzero"},wp.element.createElement("rect",{x:"0",y:"-1.13686838e-13",width:"13",height:"19",rx:"1"}),wp.element.createElement("rect",{x:"15",y:"-1.13686838e-13",width:"5",height:"6"}),wp.element.createElement("rect",{x:"15",y:"7",width:"5",height:"5"}),wp.element.createElement("rect",{x:"15",y:"13",width:"5",height:"6"})))),galleryLayoutFeed:wp.element.createElement("svg",{width:"40px",height:"40px",viewBox:"0 0 40 40",version:"1.1"},wp.element.createElement("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},wp.element.createElement("g",{transform:"translate(20.500000, 12.500000) rotate(-270.000000) translate(-20.500000, -12.500000) translate(14.000000, 3.000000)",fill:"#000000","fill-rule":"nonzero"},wp.element.createElement("rect",{x:"0",y:"0",width:"13",height:"19",rx:"1"})),wp.element.createElement("g",{transform:"translate(20.500000, 27.500000) rotate(-270.000000) translate(-20.500000, -27.500000) translate(14.000000, 18.000000)",fill:"#000000","fill-rule":"nonzero"},wp.element.createElement("rect",{x:"0",y:"0",width:"13",height:"19",rx:"1"}))))}},function(e,t,l){"use strict";var n=l(6),r=(l.n(n),l(7)),o=(l.n(r),wp.i18n.__);(0,wp.blocks.registerBlockType)("cgb/block-my-block2",{title:o("my-block - CGB Block"),icon:"shield",category:"common",keywords:[o("my-block \u2014 CGB Block"),o("CGB Example"),o("create-guten-block")],edit:function(e){return wp.element.createElement("div",{className:e.className},wp.element.createElement("p",null,"\u2014 Hello from the backend."),wp.element.createElement("p",null,"CGB BLOCK: ",wp.element.createElement("code",null,"my-block")," is a new Gutenberg block"),wp.element.createElement("p",null,"It was created via"," ",wp.element.createElement("code",null,wp.element.createElement("a",{href:"https://github.com/ahmadawais/create-guten-block"},"create-guten-block")),"."))},save:function(e){return wp.element.createElement("div",null,wp.element.createElement("p",null,"\u2014 Hello from the frontend."),wp.element.createElement("p",null,"CGB BLOCK: ",wp.element.createElement("code",null,"my-block")," is a new Gutenberg block."),wp.element.createElement("p",null,"It was created via"," ",wp.element.createElement("code",null,wp.element.createElement("a",{href:"https://github.com/ahmadawais/create-guten-block"},"create-guten-block")),"."))}})},function(e,t){},function(e,t){}]);
js/static-home-page.js CHANGED
@@ -2,6 +2,7 @@ var EcwidStaticPageLoader = {
2
  isTouchDevice: false,
3
  staticId: null,
4
  dynamicId: null,
 
5
 
6
  find: function (selector) {
7
  return document.querySelector(selector);
@@ -19,7 +20,7 @@ var EcwidStaticPageLoader = {
19
  return Array.prototype.forEach.call(elements, fn);
20
  },
21
 
22
- isRootCategory: function () {
23
  return window.location.hash === '' || window.location.hash.indexOf("#!/c/0/") !== -1;
24
  },
25
 
@@ -31,9 +32,10 @@ var EcwidStaticPageLoader = {
31
  }
32
  },
33
 
34
- processStaticHomePage: function (staticId, dynamicId) {
35
  this.staticId = staticId;
36
  this.dynamicId = dynamicId;
 
37
 
38
  this.onDocumentReady(function () {
39
  if (!!('ontouchstart' in window)) {
@@ -41,7 +43,7 @@ var EcwidStaticPageLoader = {
41
  document.body.classList.add('touchable');
42
  }
43
 
44
- if (!EcwidStaticPageLoader.isRootCategory()) {
45
  EcwidStaticPageLoader.hideStorefront();
46
  EcwidStaticPageLoader.switchToDynamicMode();
47
  return;
@@ -73,7 +75,10 @@ var EcwidStaticPageLoader = {
73
  // if we've already switched to dynamic, we don't need to dispatch this event anymore
74
  return;
75
  }
76
- if (openedPage.type == "CATEGORY" && openedPage.categoryId == 0) {
 
 
 
77
  // we don't need to dispatch root category loading,
78
  // since our static contents covers it for the first time
79
  return;
@@ -110,6 +115,27 @@ var EcwidStaticPageLoader = {
110
  });
111
  }
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  var trackOrdersLink = EcwidStaticPageLoader.findAll('#' + this.staticId + ' .footer__link--track-order');
114
  if (trackOrdersLink.length > 0) {
115
  EcwidStaticPageLoader.forEach(trackOrdersLink, function (element) {
@@ -142,7 +168,7 @@ var EcwidStaticPageLoader = {
142
  if (pagerButtonLinks.length > 0) {
143
  EcwidStaticPageLoader.forEach(pagerButtonLinks, function (element) {
144
  EcwidStaticPageLoader.addStaticClickEvent(element, EcwidStaticPageLoader.openEcwidPage('category', {
145
- 'id': 0,
146
  'page': 2
147
  }));
148
  });
@@ -153,7 +179,7 @@ var EcwidStaticPageLoader = {
153
  EcwidStaticPageLoader.forEach(pagerNumberLinks, function (element) {
154
  var pageNumber = element.getAttribute('data-page-number');
155
  EcwidStaticPageLoader.addStaticClickEvent(element, EcwidStaticPageLoader.openEcwidPage('category', {
156
- 'id': 0,
157
  'page': pageNumber
158
  }));
159
  });
2
  isTouchDevice: false,
3
  staticId: null,
4
  dynamicId: null,
5
+ defaultCategoryId: null,
6
 
7
  find: function (selector) {
8
  return document.querySelector(selector);
20
  return Array.prototype.forEach.call(elements, fn);
21
  },
22
 
23
+ isRootCaregory: function () {
24
  return window.location.hash === '' || window.location.hash.indexOf("#!/c/0/") !== -1;
25
  },
26
 
32
  }
33
  },
34
 
35
+ processStaticHomePage: function (staticId, dynamicId, defaultCategoryId) {
36
  this.staticId = staticId;
37
  this.dynamicId = dynamicId;
38
+ this.defaultCategoryId = defaultCategoryId;
39
 
40
  this.onDocumentReady(function () {
41
  if (!!('ontouchstart' in window)) {
43
  document.body.classList.add('touchable');
44
  }
45
 
46
+ if (!EcwidStaticPageLoader.isRootCaregory()) {
47
  EcwidStaticPageLoader.hideStorefront();
48
  EcwidStaticPageLoader.switchToDynamicMode();
49
  return;
75
  // if we've already switched to dynamic, we don't need to dispatch this event anymore
76
  return;
77
  }
78
+ if (openedPage.type == "CATEGORY"
79
+ && openedPage.categoryId == EcwidStaticPageLoader.defaultCategoryId
80
+ && openedPage.offset == 0
81
+ && openedPage.sort == 'normal') {
82
  // we don't need to dispatch root category loading,
83
  // since our static contents covers it for the first time
84
  return;
115
  });
116
  }
117
 
118
+
119
+ var breadcrumbsLinks = EcwidStaticPageLoader.find('#' + this.staticId + ' .ec-breadcrumbs a');
120
+ if (breadcrumbsLinks && breadcrumbsLinks.length > 0) {
121
+ EcwidStaticPageLoader.forEach(breadcrumbsLinks, function (element) {
122
+ var categoryId = element.getAttribute('data-category-id');
123
+ if (categoryId !== EcwidStaticPageLoader.defaultCategoryId) {
124
+ EcwidStaticPageLoader.addStaticClickEvent(element, EcwidStaticPageLoader.openEcwidPage('category', {'id': categoryId}));
125
+ }
126
+ });
127
+ }
128
+
129
+ var orderByOptions = EcwidStaticPageLoader.find('#' + this.staticId + ' .grid__sort select');
130
+ if (orderByOptions != null) {
131
+ orderByOptions.onchange = function (e) {
132
+ EcwidStaticPageLoader.openEcwidPage('category', {
133
+ 'id': EcwidStaticPageLoader.defaultCategoryId,
134
+ 'sort': orderByOptions.value
135
+ }).bind(this)(e);
136
+ }
137
+ }
138
+
139
  var trackOrdersLink = EcwidStaticPageLoader.findAll('#' + this.staticId + ' .footer__link--track-order');
140
  if (trackOrdersLink.length > 0) {
141
  EcwidStaticPageLoader.forEach(trackOrdersLink, function (element) {
168
  if (pagerButtonLinks.length > 0) {
169
  EcwidStaticPageLoader.forEach(pagerButtonLinks, function (element) {
170
  EcwidStaticPageLoader.addStaticClickEvent(element, EcwidStaticPageLoader.openEcwidPage('category', {
171
+ 'id': EcwidStaticPageLoader.defaultCategoryId,
172
  'page': 2
173
  }));
174
  });
179
  EcwidStaticPageLoader.forEach(pagerNumberLinks, function (element) {
180
  var pageNumber = element.getAttribute('data-page-number');
181
  EcwidStaticPageLoader.addStaticClickEvent(element, EcwidStaticPageLoader.openEcwidPage('category', {
182
+ 'id': EcwidStaticPageLoader.defaultCategoryId,
183
  'page': pageNumber
184
  }));
185
  });
lib/ecwid_api_v3.php CHANGED
@@ -92,14 +92,13 @@ class Ecwid_Api_V3
92
  public static function check_api_status()
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
 
104
  if ( $profile ) {
105
  return self::set_api_status( self::API_STATUS_OK );
@@ -131,11 +130,15 @@ class Ecwid_Api_V3
131
 
132
  public static function save_token($token)
133
  {
134
- EcwidPlatform::init_crypt( true );
135
-
136
- $value = base64_encode( EcwidPlatform::encrypt( $token ) );
137
-
138
- update_option( self::TOKEN_OPTION_NAME, $value );
 
 
 
 
139
  self::reset_api_status();
140
  }
141
 
@@ -434,6 +437,9 @@ class Ecwid_Api_V3
434
  $query['redirect_uri'] = $redirect_uri;
435
  $query['response_type'] = 'code';
436
  $query['scope'] = $scope;
 
 
 
437
 
438
  foreach ($query as $key => $value) {
439
  $query[$key] = urlencode($value);
@@ -485,7 +491,6 @@ class Ecwid_Api_V3
485
 
486
  public function get_store_profile() {
487
 
488
-
489
  $profile = EcwidPlatform::cache_get( self::PROFILE_CACHE_NAME );
490
 
491
  if ( $profile ) {
@@ -500,9 +505,10 @@ class Ecwid_Api_V3
500
 
501
  $url = $this->build_request_url($url, $params);
502
  $result = EcwidPlatform::fetch_url($url);
503
-
504
  if ( @$result['code'] == '403' ) {
505
  self::set_api_status( self::API_STATUS_ERROR_TOKEN );
 
506
  return false;
507
  }
508
 
92
  public static function check_api_status()
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 );
130
 
131
  public static function save_token($token)
132
  {
133
+ if (!$token) {
134
+ update_option( self::TOKEN_OPTION_NAME, '' );
135
+ } else {
136
+ EcwidPlatform::init_crypt( true );
137
+
138
+ $value = base64_encode( EcwidPlatform::encrypt( $token ) );
139
+
140
+ update_option( self::TOKEN_OPTION_NAME, $value );
141
+ }
142
  self::reset_api_status();
143
  }
144
 
437
  $query['redirect_uri'] = $redirect_uri;
438
  $query['response_type'] = 'code';
439
  $query['scope'] = $scope;
440
+ if ( Ecwid_Config::get_channel_id() ) {
441
+ $query['partner'] = Ecwid_Config::get_channel_id();
442
+ }
443
 
444
  foreach ($query as $key => $value) {
445
  $query[$key] = urlencode($value);
491
 
492
  public function get_store_profile() {
493
 
 
494
  $profile = EcwidPlatform::cache_get( self::PROFILE_CACHE_NAME );
495
 
496
  if ( $profile ) {
505
 
506
  $url = $this->build_request_url($url, $params);
507
  $result = EcwidPlatform::fetch_url($url);
508
+
509
  if ( @$result['code'] == '403' ) {
510
  self::set_api_status( self::API_STATUS_ERROR_TOKEN );
511
+ Ecwid_Api_V3::save_token('');
512
  return false;
513
  }
514
 
lib/ecwid_platform.php CHANGED
@@ -191,7 +191,7 @@ class EcwidPlatform {
191
  return $result;
192
  }
193
 
194
- static public function cache_set($name, $value, $expires_after)
195
  {
196
  self::cache_log_record( 'set', array( 'name' => $name, 'value' => $value, 'expires' => $expires_after ) );
197
  set_transient('ecwid_' . $name, $value, $expires_after);
@@ -322,15 +322,19 @@ class EcwidPlatform {
322
  }
323
 
324
  static public function reset( $name ) {
 
 
 
 
325
  $options = get_option( self::OPTION_ECWID_PLUGIN_DATA );
326
 
327
- if ( !is_array( $options ) || !array_key_exists($name, $options)) {
328
  return;
329
  }
330
 
331
- unset($options[$name]);
332
-
333
- update_option( self::OPTION_ECWID_PLUGIN_DATA, $options );
334
 
335
  }
336
 
191
  return $result;
192
  }
193
 
194
+ static public function cache_set($name, $value, $expires_after = 0)
195
  {
196
  self::cache_log_record( 'set', array( 'name' => $name, 'value' => $value, 'expires' => $expires_after ) );
197
  set_transient('ecwid_' . $name, $value, $expires_after);
322
  }
323
 
324
  static public function reset( $name ) {
325
+ if ( !self::$ecwid_plugin_data ) {
326
+ self::$ecwid_plugin_data = get_option( self::OPTION_ECWID_PLUGIN_DATA );
327
+ }
328
+
329
  $options = get_option( self::OPTION_ECWID_PLUGIN_DATA );
330
 
331
+ if ( !is_array( self::$ecwid_plugin_data ) || !array_key_exists( $name, self::$ecwid_plugin_data ) ) {
332
  return;
333
  }
334
 
335
+ unset( self::$ecwid_plugin_data[$name] );
336
+
337
+ update_option( self::OPTION_ECWID_PLUGIN_DATA, self::$ecwid_plugin_data );
338
 
339
  }
340
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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: 4.9
6
- Stable tag: 6.4.2
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
@@ -149,14 +149,17 @@ You can use Ecwid’s built-in import tools to copy your store products from any
149
  * [Ecwid Help Center](http://help.ecwid.com/?source=wporg-plugin-site "Ecwid Help")
150
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
151
 
152
- == Changelog ==
 
 
 
153
  = 6.4.2 - Nov 21, 2018 =
154
  - **Speedup for the store main page.** We're working on making Ecwid stores load faster on WordPress sites. This update brings a set of loading speed improvements for some part of the stores. We will gradually roll out these enhancements to all users. No actions required from your side — your store will get all of the improvements in this or upcoming releases. But if you ever noticed your store loading slowly, please contact us so we can help you enable this new feature on your site right now.
155
  - **Fixed an issue in the plugin settings menu on [Wordpress.com](http://wordpress.com).** Ecwid e-commerce plugin works on Wordpress.com sites as well. In the admin backend of [WordPress.com](http://wordpress.com) sites, the plugin menu didn't look well — some of the styles and colors were broken. We fixed it, now the plugin admin backend should work fine on both [Wordpress.org](http://wordpress.org) and Wordpress.com installations.
156
  - Minor fixes and improvements.
157
 
158
  = 6.4.1 - Nov 13, 2018 =
159
- - **WordPress v 5.0 compatibility.** This update brings compatibility with the upcoming WordPress version. In particular, we made sure Ecwid e-commerce stores looks good with the new Twenty Nineteenth theme. Also, we polished the Ecwid online store block in the new WordPress editor (Gutenberg) to make sure you can add a product listing to any site page and customize its appearance including colors, product grid layout, store navigation controls, product page appearance and more.
160
 
161
 
162
  = 6.4 - Oct 25, 2018 =
2
  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.3
7
 
8
  Powerful, easy to use ecommerce shopping cart. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available.
9
 
149
  * [Ecwid Help Center](http://help.ecwid.com/?source=wporg-plugin-site "Ecwid Help")
150
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
151
 
152
+ == Changelog ==
153
+ = 6.4.3 - Nov 28, 2018 =
154
+ - Minor fixes and improvements for the Ecwid ecommerce blocks in Gutenberg editor.
155
+
156
  = 6.4.2 - Nov 21, 2018 =
157
  - **Speedup for the store main page.** We're working on making Ecwid stores load faster on WordPress sites. This update brings a set of loading speed improvements for some part of the stores. We will gradually roll out these enhancements to all users. No actions required from your side — your store will get all of the improvements in this or upcoming releases. But if you ever noticed your store loading slowly, please contact us so we can help you enable this new feature on your site right now.
158
  - **Fixed an issue in the plugin settings menu on [Wordpress.com](http://wordpress.com).** Ecwid e-commerce plugin works on Wordpress.com sites as well. In the admin backend of [WordPress.com](http://wordpress.com) sites, the plugin menu didn't look well — some of the styles and colors were broken. We fixed it, now the plugin admin backend should work fine on both [Wordpress.org](http://wordpress.org) and Wordpress.com installations.
159
  - Minor fixes and improvements.
160
 
161
  = 6.4.1 - Nov 13, 2018 =
162
+ - WordPress v 5.0 compatibility. This update brings compatibility with the upcoming WordPress version. In particular, we made sure Ecwid e-commerce stores looks good with the new Twenty Nineteenth theme. Also, we polished the Ecwid online store block in the new WordPress editor (Gutenberg) to make sure you can add a product listing to any site page and customize its appearance including colors, product grid layout, store navigation controls, product page appearance and more.
163
 
164
 
165
  = 6.4 - Oct 25, 2018 =
templates/admin/legacy-connect.tpl.php CHANGED
@@ -35,10 +35,10 @@
35
  <?php printf( __('Create a new %s account which you will use to manage your store and inventory. The registration is free.', 'ecwid-shopping-cart'), Ecwid_Config::get_brand() ); ?>
36
  </div>
37
  <div class="ecwid-account-buttons">
38
- <a class="pure-button pure-button-secondary" target="_blank" href="https://my.ecwid.com/cp/?partner=wporg#register">
39
  <?php _e('Create new account', 'ecwid-shopping-cart'); ?>
40
  </a>
41
- <a class="pure-button pure-button-secondary" target="_blank" href="https://my.ecwid.com/cp/?partner=wporg">
42
  <?php _e('I already have an account, sign in', 'ecwid-shopping-cart'); ?>
43
  </a>
44
  </div>
35
  <?php printf( __('Create a new %s account which you will use to manage your store and inventory. The registration is free.', 'ecwid-shopping-cart'), Ecwid_Config::get_brand() ); ?>
36
  </div>
37
  <div class="ecwid-account-buttons">
38
+ <a class="pure-button pure-button-secondary" target="_blank" href="<?php echo ecwid_get_register_link(); ?>">
39
  <?php _e('Create new account', 'ecwid-shopping-cart'); ?>
40
  </a>
41
+ <a class="pure-button pure-button-secondary" target="_blank" href="https://<?php echo Ecwid_Config::get_cpanel_domain(); ?>">
42
  <?php _e('I already have an account, sign in', 'ecwid-shopping-cart'); ?>
43
  </a>
44
  </div>
templates/debug.php CHANGED
@@ -1,6 +1,5 @@
1
  <div class="ecwid-debug">
2
  <?php
3
- return;
4
  $all_plugins = get_plugins();
5
 
6
  $active_plugins = get_option('active_plugins');
1
  <div class="ecwid-debug">
2
  <?php
 
3
  $all_plugins = get_plugins();
4
 
5
  $active_plugins = get_option('active_plugins');