Ecwid Ecommerce Shopping Cart - Version 6.3

Version Description

  • Sep 25, 2018 =
  • Compatibility with the popular WordPress page builders: Elementor, Divi, Beaver builder. The Ecwid e-commerce plugin has always been working great with the default WordPress editor to let you easily add a store or a single product to your site pages. In the recent updates, we also added the same functions to Gutenberg editor. In this update, we went further to make sure the most popular page builders are working fine with Ecwid. We added a lot of improvements and fixes to the plugin to make it work better with the Elementor, Beaver page builder and Divi editor. If you are using one of those page builders and having any problem editing your store page, please let us know so we can further improve it.
  • Avada, Bridge and Parallax One themes improved compatibility. Even though Ecwid is compatible with every WordPress theme by design, some slight fixes and improvements are sometimes needed to make storefront look better. Thats why we are always monitoring how Ecwid pages look and behave in WordPress ecommerce themes. In this update, we are rolling out a few minor improvements to the Ecwid layout for the Avada, Bridge and Parallax One WordPress themes.
  • Fix of a conflict with Master slider plugin. The Master slider plugin used to conflict with Ecwid plugin in the WordPress admin backend, which may cause some of the slider management pages look broken in the slider dashboard. Fixed.
  • Fix of a conflict with the Ultimate tables plugin. One more plugin conflicting issue is fixed: the Ultimate tables plugin used to affect the Ecwid dashboard layout in the WordPress admin backed. Now it is working fine.
  • Improvements for the WooCommerce import tool: options, variations and image gallery are now supported. In one of the recent update, we made it possible to import WooCommerce products to your Ecwid e-commerce store using a simple import wizard in the Ecwid plugin. In this version, weve made it more powerful so you can now import product gallery images, product options and variations to make the import easier and quicker.
  • Several fixes and improvements.
Download this release

Release Info

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

Code changes from version 6.2.4 to 6.3

Files changed (60) hide show
  1. css/settings.css +3 -1
  2. css/shortcode-stub.css +28 -0
  3. css/themes/parallax-one.css +3 -0
  4. css/widget-stub.css +29 -0
  5. ecwid-shopping-cart.php +78 -48
  6. includes/class-ecwid-admin-main-page.php +2 -2
  7. includes/class-ecwid-admin.php +2 -2
  8. includes/class-ecwid-config.php +9 -10
  9. includes/class-ecwid-html-meta.php +36 -18
  10. includes/class-ecwid-message-manager.php +11 -1
  11. includes/class-ecwid-products.php +5 -7
  12. includes/class-ecwid-seo-links.php +8 -1
  13. includes/class-ecwid-store-page.php +4 -1
  14. includes/class-ecwid-stub-renderer.php +82 -0
  15. includes/importer/class-ecwid-import.php +1 -25
  16. includes/importer/class-ecwid-importer-task.php +224 -7
  17. includes/importer/class-ecwid-importer.php +77 -33
  18. includes/importer/importer.php +1 -1
  19. includes/{class-ecwid-integration-above-the-fold.php → integrations/class-ecwid-integration-above-the-fold.php} +0 -0
  20. includes/{class-ecwid-integration-aiosp.php → integrations/class-ecwid-integration-aiosp.php} +0 -0
  21. includes/{class-ecwid-integration-autoptimize.php → integrations/class-ecwid-integration-autoptimize.php} +0 -0
  22. includes/integrations/class-ecwid-integration-beaver-builder.php +11 -0
  23. includes/{class-ecwid-integration-divibuilder.php → integrations/class-ecwid-integration-divibuilder.php} +7 -7
  24. includes/integrations/class-ecwid-integration-elementor.php +15 -0
  25. includes/{class-ecwid-integration-gutenberg.php → integrations/class-ecwid-integration-gutenberg.php} +0 -0
  26. includes/{class-ecwid-integration-wpbakery-composer.php → integrations/class-ecwid-integration-wpbakery-composer.php} +0 -0
  27. includes/{class-ecwid-integration-wpseo.php → integrations/class-ecwid-integration-wpseo.php} +0 -0
  28. includes/shortcodes.php +4 -20
  29. includes/shortcodes/class-ecwid-shortcode-base.php +30 -1
  30. includes/shortcodes/class-ecwid-shortcode-productbrowser.php +3 -3
  31. includes/shortcodes/class-ecwid-shortcode-stub.php +29 -0
  32. includes/themes.php +5 -3
  33. includes/themes/class-ecwid-theme-avada.php +32 -0
  34. includes/themes/class-ecwid-theme-base.php +4 -3
  35. includes/widgets/class-ecwid-widget-badge.php +13 -9
  36. includes/widgets/class-ecwid-widget-base.php +46 -0
  37. includes/widgets/class-ecwid-widget-floating-shopping-cart.php +7 -2
  38. includes/widgets/class-ecwid-widget-minicart-miniview.php +14 -17
  39. includes/widgets/class-ecwid-widget-minicart.php +13 -16
  40. includes/widgets/class-ecwid-widget-nsf-minicart.php +11 -12
  41. includes/widgets/class-ecwid-widget-products-base.php +16 -21
  42. includes/widgets/class-ecwid-widget-random-product.php +15 -20
  43. includes/widgets/class-ecwid-widget-random-products.php +0 -1
  44. includes/widgets/class-ecwid-widget-recently-viewed.php +0 -6
  45. includes/widgets/class-ecwid-widget-search.php +15 -18
  46. includes/widgets/class-ecwid-widget-store-link.php +11 -9
  47. includes/widgets/class-ecwid-widget-vcategories.php +14 -18
  48. includes/widgets/class-ecwid-widget-vertical-categories-list.php +13 -17
  49. js/admin-menu.js +3 -3
  50. js/gutenberg-store.js +42 -25
  51. js/importer.js +9 -6
  52. js/store-editor-gutenberg.js +1 -1
  53. js/store-editor-page.js +3 -3
  54. lib/ecwid_api_v3.php +48 -4
  55. lib/html-catalog-templates/category.php +2 -2
  56. readme.txt +9 -1
  57. templates/ecwid-admin.php +3 -3
  58. templates/importer/woo-main.tpl.php +3 -3
  59. templates/shortcode-stub.tpl.php +20 -0
  60. templates/widget-stub.tpl.php +20 -0
css/settings.css CHANGED
@@ -299,13 +299,15 @@ display: none;
299
  .ecwid-admin {
300
  margin-left: 20px;
301
  }
302
- .ecwid-admin .box {
303
  position: relative;
304
  margin-top: 25px;
305
 
306
  border: 1px solid #E5E5E5;
307
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
308
  background: #FFF;
 
 
309
  }
310
 
311
 
299
  .ecwid-admin {
300
  margin-left: 20px;
301
  }
302
+ .ecwid-admin div.box {
303
  position: relative;
304
  margin-top: 25px;
305
 
306
  border: 1px solid #E5E5E5;
307
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
308
  background: #FFF;
309
+
310
+ height: auto;
311
  }
312
 
313
 
css/shortcode-stub.css ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('//fonts.googleapis.com/css?family=Open+Sans:400,600,700,300&subset=latin,latin-ext,cyrillic');
2
+
3
+ .ecwid-shortcode-stub {
4
+ text-align: center;
5
+ font-size: 13px;
6
+ font-family: 'Open Sans';
7
+ padding: 1em;
8
+ background-color: #f8f9f9;
9
+ display: flex;
10
+ flex-direction: column;
11
+ justify-content: center;
12
+ min-height: 220px;
13
+ outline: 1px solid lightgray;
14
+ color: #32373c;
15
+ }
16
+
17
+ .ecwid-shortcode-stub > div {
18
+ display: flex;
19
+ justify-content: center;
20
+ }
21
+ .ecwid-shortcode-stub-header {
22
+ font-weight: 600;
23
+ }
24
+
25
+ .ecwid-shortcode-stub-header svg {
26
+ max-height: 20px;
27
+ margin-right: 1ch;
28
+ }
css/themes/parallax-one.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .ec-cart-widget[data-icon]:before {
2
+ content: "";
3
+ }
css/widget-stub.css ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('//fonts.googleapis.com/css?family=Open+Sans:400,600,700,300&subset=latin,latin-ext,cyrillic');
2
+
3
+ .ecwid-widget-stub {
4
+ text-align: center;
5
+ font-size: 13px;
6
+ font-family: 'Open Sans';
7
+ padding: 1em;
8
+ background-color: #f8f9f9;
9
+ display: flex;
10
+ flex-direction: column;
11
+ justify-content: center;
12
+ min-height: 100px;
13
+ outline: 1px solid lightgray;
14
+ color: #32373c;
15
+ }
16
+
17
+ .ecwid-widget-stub > div {
18
+ display: flex;
19
+ justify-content: center;
20
+ }
21
+ .ecwid-widget-stub-header {
22
+ font-weight: 600;
23
+ font-family: 'Open Sans';
24
+ }
25
+
26
+ .ecwid-widget-stub-header svg {
27
+ max-height: 20px;
28
+ margin-right: 1ch;
29
+ }
ecwid-shopping-cart.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.ecwid.com?source=wporg
5
  Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
6
  Text Domain: ecwid-shopping-cart
7
  Author: Ecwid Team
8
- Version: 6.2.4
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
@@ -162,17 +162,20 @@ function ecwid_init_integrations()
162
  'divi-builder/divi-builder.php' => 'divibuilder',
163
  'autoptimize/autoptimize.php' => 'autoptimize',
164
  'above-the-fold-optimization/abovethefold.php' => 'above-the-fold',
165
- 'js_composer/js_composer.php' => 'wpbakery-composer'
 
 
 
166
  );
167
 
168
 
169
- if (version_compare( phpversion(), '5.3', '>' ) ) {
170
  $integrations['gutenberg/gutenberg.php'] = 'gutenberg';
171
  }
172
 
173
  foreach ( $integrations as $plugin => $class ) {
174
  if ( is_plugin_active( $plugin ) ) {
175
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-integration-' . $class . '.php';
176
  }
177
  }
178
  }
@@ -371,28 +374,34 @@ function ecwid_enqueue_frontend() {
371
  }
372
 
373
  function ecwid_print_inline_js_config() {
374
- if ( is_plugin_active( 'shiftnav-pro/shiftnav.php' ) ) {
375
- add_action ('ecwid_print_inline_js_config', 'ecwid_disable_interactive' );
376
- }
377
-
378
- echo <<<HTML
379
- <script type="text/javascript">
380
  window.ec = window.ec || Object();
381
  window.ec.config = window.ec.config || Object();
382
  window.ec.config.enable_canonical_urls = true;
383
 
384
  HTML;
385
 
386
- do_action('ecwid_print_inline_js_config');
 
 
 
 
 
 
 
387
  echo '</script>';
388
  }
389
 
390
- function ecwid_disable_interactive() {
391
- echo "window.ec.config.interactive = false;\n";
392
  }
393
 
394
- add_action( 'ecwid_print_inline_js_config', 'ecwid_add_chameleon' );
395
- function ecwid_add_chameleon() {
 
396
 
397
  $colors = array();
398
  foreach (array('foreground', 'background', 'link', 'price', 'button') as $kind) {
@@ -403,7 +412,7 @@ function ecwid_add_chameleon() {
403
  }
404
 
405
  if ( !get_option( 'ecwid_use_chameleon' ) && empty( $colors ) ) {
406
- return;
407
  }
408
 
409
  if ( empty( $colors ) ) {
@@ -430,12 +439,13 @@ function ecwid_add_chameleon() {
430
  $chameleon['font'] = $font;
431
  }
432
 
433
- echo <<<JS
434
  window.ec.config.chameleon = window.ec.config.chameleon || Object();
435
  window.ec.config.chameleon.font = $chameleon[font];
436
  window.ec.config.chameleon.colors = $chameleon[colors];
437
  JS;
438
 
 
439
  }
440
 
441
  function ecwid_load_textdomain() {
@@ -851,36 +861,49 @@ function ecwid_admin_check_api_cache()
851
  $last_cache = get_option('ecwid_last_api_cache_check');
852
 
853
  if (time() - $last_cache > MINUTE_IN_SECONDS * 5 ) {
854
- ecwid_invalidate_cache();
855
  }
 
 
856
  }
857
 
858
  function ecwid_invalidate_cache( $full_reset = false)
859
  {
860
- Ecwid_Api_V3::reset_api_status();
861
-
862
  if ( $full_reset ) {
863
- EcwidPlatform::invalidate_categories_cache_from(time());
864
- EcwidPlatform::invalidate_products_cache_from(time());
865
- EcwidPlatform::cache_reset( Ecwid_Api_V3::PROFILE_CACHE_NAME );
866
- EcwidPlatform::cache_reset('all_categories');
867
-
868
  return;
869
  }
 
 
 
870
 
 
 
871
  if (Ecwid_Api_V3::is_available()) {
872
  $api = new Ecwid_Api_V3();
873
 
874
  $stats = $api->get_store_update_stats();
875
 
876
- if ($stats) {
877
- EcwidPlatform::invalidate_products_cache_from(strtotime($stats->productsUpdated));
878
- EcwidPlatform::invalidate_categories_cache_from(strtotime($stats->categoriesUpdated));
879
- update_option('ecwid_last_api_cache_check', time());
880
  }
881
  }
882
  }
883
 
 
 
 
 
 
 
 
 
 
 
 
 
884
  function add_ecwid_admin_bar_node() {
885
  global $wp_admin_bar;
886
 
@@ -1547,9 +1570,16 @@ function _ecwid_get_single_product_widget_parts_v2($attributes) {
1547
 
1548
  function ecwid_shortcode($attributes)
1549
  {
1550
- if ( isset( $_GET['fl_builder'] ) ) {
1551
- return '<div>Here goes the store </div>';
 
 
 
 
 
 
1552
  }
 
1553
  $defaults = ecwid_get_default_pb_size();
1554
 
1555
  $attributes = shortcode_atts(
@@ -1653,8 +1683,16 @@ function ecwid_store_activate() {
1653
  $shortcode = Ecwid_Shortcode_Base::get_current_store_shortcode_name();
1654
 
1655
  $content = <<<EOT
1656
- [$shortcode widgets="productbrowser search" grid="$defaults[grid_rows],$defaults[grid_columns]" list="$defaults[list_rows]" table="$defaults[table_rows]" default_category_id="0" category_view="grid" search_view="grid" minicart_layout="MiniAttachToProductBrowser" ]
 
 
 
 
 
 
1657
  EOT;
 
 
1658
  add_option("ecwid_store_page_id", '', '', 'yes');
1659
 
1660
  add_option("ecwid_store_id", ecwid_get_demo_store_id(), '', 'yes');
@@ -1993,7 +2031,8 @@ function ecwid_register_admin_styles($hook_suffix) {
1993
 
1994
  if (isset($_GET['page']) && strpos($_GET['page'], 'ec-store') === 0) {
1995
 
1996
- if ( ecwid_is_demo_store( get_option('ecwid_store_id' ) ) ) {
 
1997
 
1998
  // Open dashboard for the first time, ecwid store id is set to demo => need landing styles/scripts
1999
  wp_enqueue_script('ecwid-landing-js', ECWID_PLUGIN_URL . 'js/landing.js', array(), get_option('ecwid_plugin_version'));
@@ -2002,14 +2041,9 @@ function ecwid_register_admin_styles($hook_suffix) {
2002
  'isWL' => Ecwid_Config::is_wl()
2003
  )
2004
  );
2005
- if (ecwid_use_old_landing()) {
2006
-
2007
- wp_enqueue_style('ecwid-landing-css', ECWID_PLUGIN_URL . 'css/landing_old.css', array(), get_option('ecwid_plugin_version'), 'all');
2008
- } else {
2009
-
2010
- wp_enqueue_style('ecwid-landing-css', ECWID_PLUGIN_URL . 'css/landing.css', array(), get_option('ecwid_plugin_version'), 'all');
2011
- }
2012
- wp_enqueue_style('ecwid-landing-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,300', array(), get_option('ecwid_plugin_version'));
2013
  } else {
2014
  // We already connected and disconnected the store, no need for fancy landing
2015
  wp_enqueue_script('ecwid-connect-js', ECWID_PLUGIN_URL . 'js/dashboard.js', array(), get_option('ecwid_plugin_version'));
@@ -2018,7 +2052,7 @@ function ecwid_register_admin_styles($hook_suffix) {
2018
  }
2019
 
2020
  function ecwid_register_settings_styles($hook_suffix) {
2021
-
2022
  if ( ($hook_suffix != 'post.php' && $hook_suffix != 'post-new.php') && strpos( $hook_suffix, Ecwid_Admin::ADMIN_SLUG ) === false) return;
2023
 
2024
  wp_enqueue_style('ecwid-settings-css', ECWID_PLUGIN_URL . 'css/settings.css', array(), get_option('ecwid_plugin_version'), 'all');
@@ -2500,7 +2534,7 @@ function ecwid_admin_post_connect()
2500
  wp_redirect( $ecwid_oauth->get_auth_dialog_url() );
2501
  }
2502
  } else if (!isset($_GET['reconnect'])) {
2503
- wp_redirect(Ecwid_Admin::get_dashboard_url() . '&oauth=no&connection_error');
2504
  } else {
2505
  wp_redirect(Ecwid_Admin::get_dashboard_url() . '&reconnect&connection_error');
2506
  }
@@ -2553,7 +2587,7 @@ function ecwid_get_categories_for_selector() {
2553
  $offset = 100;
2554
 
2555
  $page = 0;
2556
- while ( $categories->count + $offset * $page > $categories->total ) {
2557
  $page++;
2558
  $categories = $api->get_categories( array( 'offset' => $offset * $page, 'hidden_categories' => true ) );
2559
 
@@ -3106,10 +3140,6 @@ function ecwid_embed_svg($name) {
3106
  echo $code;
3107
  }
3108
 
3109
- function ecwid_use_old_landing() {
3110
- return version_compare(get_bloginfo('version'), '3.7') < 0;
3111
- }
3112
-
3113
  /*
3114
  * Basically a copy of has_shortcode that returns the matched shortcode
3115
  */
5
  Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
6
  Text Domain: ecwid-shopping-cart
7
  Author: Ecwid Team
8
+ Version: 6.3
9
  Author URI: https://ecwid.to/ecwid-site
10
  */
11
 
162
  'divi-builder/divi-builder.php' => 'divibuilder',
163
  'autoptimize/autoptimize.php' => 'autoptimize',
164
  'above-the-fold-optimization/abovethefold.php' => 'above-the-fold',
165
+ 'js_composer/js_composer.php' => 'wpbakery-composer',
166
+ 'beaver-builder-lite-version/fl-builder.php' => 'beaver-builder',
167
+ 'elementor/elementor.php' => 'elementor'
168
+
169
  );
170
 
171
 
172
+ if (version_compare( phpversion(), '5.4', '>=' ) ) {
173
  $integrations['gutenberg/gutenberg.php'] = 'gutenberg';
174
  }
175
 
176
  foreach ( $integrations as $plugin => $class ) {
177
  if ( is_plugin_active( $plugin ) ) {
178
+ require_once ECWID_PLUGIN_DIR . 'includes/integrations/class-ecwid-integration-' . $class . '.php';
179
  }
180
  }
181
  }
374
  }
375
 
376
  function ecwid_print_inline_js_config() {
377
+
378
+ echo '<script type="text/javascript">';
379
+
380
+ $js = <<<HTML
 
 
381
  window.ec = window.ec || Object();
382
  window.ec.config = window.ec.config || Object();
383
  window.ec.config.enable_canonical_urls = true;
384
 
385
  HTML;
386
 
387
+ if ( is_plugin_active( 'shiftnav-pro/shiftnav.php' ) ) {
388
+ $js = ecwid_disable_interactive( $js );
389
+ }
390
+
391
+ $js = apply_filters( 'ecwid_inline_js_config', $js );
392
+
393
+ echo $js;
394
+
395
  echo '</script>';
396
  }
397
 
398
+ function ecwid_disable_interactive( $js ) {
399
+ return $js . "\nwindow.ec.config.interactive = false;\n";
400
  }
401
 
402
+ add_action( 'ecwid_inline_js_config', 'ecwid_add_chameleon' );
403
+
404
+ function ecwid_add_chameleon( $js ) {
405
 
406
  $colors = array();
407
  foreach (array('foreground', 'background', 'link', 'price', 'button') as $kind) {
412
  }
413
 
414
  if ( !get_option( 'ecwid_use_chameleon' ) && empty( $colors ) ) {
415
+ return $js;
416
  }
417
 
418
  if ( empty( $colors ) ) {
439
  $chameleon['font'] = $font;
440
  }
441
 
442
+ $js .= <<<JS
443
  window.ec.config.chameleon = window.ec.config.chameleon || Object();
444
  window.ec.config.chameleon.font = $chameleon[font];
445
  window.ec.config.chameleon.colors = $chameleon[colors];
446
  JS;
447
 
448
+ return $js;
449
  }
450
 
451
  function ecwid_load_textdomain() {
861
  $last_cache = get_option('ecwid_last_api_cache_check');
862
 
863
  if (time() - $last_cache > MINUTE_IN_SECONDS * 5 ) {
864
+ Ecwid_Api_V3::reset_api_status();
865
  }
866
+
867
+ ecwid_regular_cache_check();
868
  }
869
 
870
  function ecwid_invalidate_cache( $full_reset = false)
871
  {
 
 
872
  if ( $full_reset ) {
873
+ ecwid_full_cache_reset();
 
 
 
 
874
  return;
875
  }
876
+
877
+ ecwid_regular_cache_check();
878
+ }
879
 
880
+ function ecwid_regular_cache_check()
881
+ {
882
  if (Ecwid_Api_V3::is_available()) {
883
  $api = new Ecwid_Api_V3();
884
 
885
  $stats = $api->get_store_update_stats();
886
 
887
+ if ( $stats ) {
888
+ EcwidPlatform::invalidate_products_cache_from( strtotime( $stats->productsUpdated ) );
889
+ EcwidPlatform::invalidate_categories_cache_from( strtotime( $stats->categoriesUpdated ) );
890
+ update_option( 'ecwid_last_api_cache_check', time() );
891
  }
892
  }
893
  }
894
 
895
+ function ecwid_full_cache_reset()
896
+ {
897
+ Ecwid_Api_V3::reset_api_status();
898
+
899
+ EcwidPlatform::invalidate_categories_cache_from( time() );
900
+ EcwidPlatform::invalidate_products_cache_from( time() );
901
+ EcwidPlatform::cache_reset( Ecwid_Api_V3::PROFILE_CACHE_NAME );
902
+ EcwidPlatform::cache_reset( 'all_categories' );
903
+
904
+ update_option( 'ecwid_last_api_cache_check', time() );
905
+ }
906
+
907
  function add_ecwid_admin_bar_node() {
908
  global $wp_admin_bar;
909
 
1570
 
1571
  function ecwid_shortcode($attributes)
1572
  {
1573
+ $custom_renderer = apply_filters( 'ecwid_shortcode_custom_renderer', null );
1574
+
1575
+ if ( $custom_renderer ) {
1576
+
1577
+ $result = call_user_func( $custom_renderer, array( 'attributes' => $attributes ) );
1578
+ if ( $result ) {
1579
+ return $result;
1580
+ }
1581
  }
1582
+
1583
  $defaults = ecwid_get_default_pb_size();
1584
 
1585
  $attributes = shortcode_atts(
1683
  $shortcode = Ecwid_Shortcode_Base::get_current_store_shortcode_name();
1684
 
1685
  $content = <<<EOT
1686
+ [$shortcode widgets="productbrowser" default_category_id="0" default_product_id="0"]
1687
+ EOT;
1688
+
1689
+ $content = <<<EOT
1690
+ <!-- wp:ecwid/store-block {"widgets":"productbrowser","default_category_id":0,"default_product_id":0} -->
1691
+ $content
1692
+ <!-- /wp:ecwid/store-block -->
1693
  EOT;
1694
+
1695
+
1696
  add_option("ecwid_store_page_id", '', '', 'yes');
1697
 
1698
  add_option("ecwid_store_id", ecwid_get_demo_store_id(), '', 'yes');
2031
 
2032
  if (isset($_GET['page']) && strpos($_GET['page'], 'ec-store') === 0) {
2033
 
2034
+ // Can't really remember why it checks against the raw version, not the sanitized one; consider refactoring
2035
+ if ( ecwid_is_demo_store( get_option('ecwid_store_id' ) ) || !get_option( 'ecwid_store_id' ) ) {
2036
 
2037
  // Open dashboard for the first time, ecwid store id is set to demo => need landing styles/scripts
2038
  wp_enqueue_script('ecwid-landing-js', ECWID_PLUGIN_URL . 'js/landing.js', array(), get_option('ecwid_plugin_version'));
2041
  'isWL' => Ecwid_Config::is_wl()
2042
  )
2043
  );
2044
+
2045
+ wp_enqueue_style('ecwid-landing-css', ECWID_PLUGIN_URL . 'css/landing.css', array(), get_option('ecwid_plugin_version'), 'all');
2046
+ wp_enqueue_style('ecwid-landing-fonts', 'https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,300', array(), get_option('ecwid_plugin_version'));
 
 
 
 
 
2047
  } else {
2048
  // We already connected and disconnected the store, no need for fancy landing
2049
  wp_enqueue_script('ecwid-connect-js', ECWID_PLUGIN_URL . 'js/dashboard.js', array(), get_option('ecwid_plugin_version'));
2052
  }
2053
 
2054
  function ecwid_register_settings_styles($hook_suffix) {
2055
+
2056
  if ( ($hook_suffix != 'post.php' && $hook_suffix != 'post-new.php') && strpos( $hook_suffix, Ecwid_Admin::ADMIN_SLUG ) === false) return;
2057
 
2058
  wp_enqueue_style('ecwid-settings-css', ECWID_PLUGIN_URL . 'css/settings.css', array(), get_option('ecwid_plugin_version'), 'all');
2534
  wp_redirect( $ecwid_oauth->get_auth_dialog_url() );
2535
  }
2536
  } else if (!isset($_GET['reconnect'])) {
2537
+ wp_redirect(Ecwid_Admin::get_dashboard_url() . '&oauth=no');
2538
  } else {
2539
  wp_redirect(Ecwid_Admin::get_dashboard_url() . '&reconnect&connection_error');
2540
  }
2587
  $offset = 100;
2588
 
2589
  $page = 0;
2590
+ while ( $categories->count + $offset * $page < $categories->total ) {
2591
  $page++;
2592
  $categories = $api->get_categories( array( 'offset' => $offset * $page, 'hidden_categories' => true ) );
2593
 
3140
  echo $code;
3141
  }
3142
 
 
 
 
 
3143
  /*
3144
  * Basically a copy of has_shortcode that returns the matched shortcode
3145
  */
includes/class-ecwid-admin-main-page.php CHANGED
@@ -12,7 +12,7 @@ class Ecwid_Admin_Main_Page
12
  public function do_page()
13
  {
14
  if ( $this->_is_forced_reconnect() ) {
15
- ecwid_update_store_id(0);
16
  if (! ecwid_process_oauth_params() ) {
17
  wp_redirect( 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG );
18
  }
@@ -212,7 +212,7 @@ class Ecwid_Admin_Main_Page
212
  }
213
 
214
  protected function _is_current_user_email_registered_at_ecwid()
215
- {
216
  $api = new Ecwid_Api_V3();
217
  $current_user = wp_get_current_user();
218
 
12
  public function do_page()
13
  {
14
  if ( $this->_is_forced_reconnect() ) {
15
+ ecwid_update_store_id( ecwid_get_demo_store_id() );
16
  if (! ecwid_process_oauth_params() ) {
17
  wp_redirect( 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG );
18
  }
212
  }
213
 
214
  protected function _is_current_user_email_registered_at_ecwid()
215
+ {
216
  $api = new Ecwid_Api_V3();
217
  $current_user = wp_get_current_user();
218
 
includes/class-ecwid-admin.php CHANGED
@@ -123,7 +123,7 @@ class Ecwid_Admin {
123
  }
124
  }
125
 
126
- if ( Ecwid_Api_V3::is_available() && !$is_newbie || (isset($_GET['page']) && $_GET['page'] == 'ecwid-advanced')) {
127
  add_submenu_page(
128
  self::ADMIN_SLUG,
129
  __('Advanced settings', 'ecwid-shopping-cart'),
@@ -171,7 +171,7 @@ class Ecwid_Admin {
171
  __( 'Store', 'ecwid-shopping-cart' ),
172
  __( 'Store', 'ecwid-shopping-cart' ),
173
  self::get_capability(),
174
- 'admin.php?page=' . self::ADMIN_SLUG . '-admin-general-settings'
175
  );
176
 
177
  add_users_page(
123
  }
124
  }
125
 
126
+ if ( !$is_newbie || ( isset($_GET['page']) && $_GET['page'] == 'ec-store-advanced' ) ) {
127
  add_submenu_page(
128
  self::ADMIN_SLUG,
129
  __('Advanced settings', 'ecwid-shopping-cart'),
171
  __( 'Store', 'ecwid-shopping-cart' ),
172
  __( 'Store', 'ecwid-shopping-cart' ),
173
  self::get_capability(),
174
+ 'admin.php?page=' . self::ADMIN_SLUG . '-admin-store-profile'
175
  );
176
 
177
  add_users_page(
includes/class-ecwid-config.php CHANGED
@@ -149,16 +149,15 @@ class Ecwid_Config {
149
  }
150
  }
151
 
152
- if ( $is_wl_enabled ) {
153
- if (
154
- isset( $result[self::TOKEN] ) && !isset( $result[self::STORE_ID] )
155
- ||
156
- !isset( $result[self::TOKEN] ) && isset( $result[self::STORE_ID] )
157
- ) {
158
- unset( $result[self::TOKEN] );
159
- unset( $result[self::STORE_ID] );
160
- }
161
- }
162
 
163
  foreach ( $common_config as $name => $ini_name ) {
164
  $value = @$result[$ini_name];
149
  }
150
  }
151
 
152
+
153
+ if (
154
+ isset( $result[self::TOKEN] ) && !isset( $result[self::STORE_ID] )
155
+ ||
156
+ !isset( $result[self::TOKEN] ) && isset( $result[self::STORE_ID] )
157
+ ) {
158
+ unset( $result[self::TOKEN] );
159
+ unset( $result[self::STORE_ID] );
160
+ }
 
161
 
162
  foreach ( $common_config as $name => $ini_name ) {
163
  $value = @$result[$ini_name];
includes/class-ecwid-html-meta.php CHANGED
@@ -38,23 +38,23 @@ abstract class Ecwid_HTML_Meta
38
  return $obj;
39
  }
40
 
41
- // static only while ecwid_trim_description exists and meta functionality is not moved into this class
42
- public static function process_raw_description( $description, $length = 0 ) {
43
- $description = strip_tags( $description );
44
- $description = html_entity_decode( $description, ENT_NOQUOTES, 'UTF-8' );
45
-
46
- $description = preg_replace( '![\p{Z}\s]{1,}!u', ' ', $description );
47
- $description = trim( $description, " \t\xA0\n\r" ); // Space, tab, non-breaking space, newline, carriage return
48
-
49
- if ( function_exists( 'mb_substr' ) ) {
50
- $description = mb_substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH, 'UTF-8' );
51
- } else {
52
- $description = substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH );
53
- }
54
- $description = htmlspecialchars( $description, ENT_COMPAT, 'UTF-8' );
55
-
56
- return $description;
57
- }
58
  }
59
 
60
  abstract class Ecwid_HTML_Meta_Catalog_Entry extends Ecwid_HTML_Meta {
@@ -144,6 +144,24 @@ abstract class Ecwid_HTML_Meta_Catalog_Entry extends Ecwid_HTML_Meta {
144
  abstract protected function _get_url();
145
 
146
  abstract protected function _get_image_url();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
 
149
  class Ecwid_HTML_Meta_Product extends Ecwid_HTML_Meta_Catalog_Entry {
@@ -214,4 +232,4 @@ class Ecwid_HTML_Meta_Noindex extends Ecwid_HTML_Meta {
214
  }
215
  }
216
 
217
- add_action( 'wp', array( 'Ecwid_HTML_Meta', 'maybe_create' ) );
38
  return $obj;
39
  }
40
 
41
+ // static only while ecwid_trim_description exists and meta functionality is not moved into this class
42
+ public static function process_raw_description( $description, $length = 0 ) {
43
+ $description = strip_tags( $description );
44
+ $description = html_entity_decode( $description, ENT_NOQUOTES, 'UTF-8' );
45
+
46
+ $description = preg_replace( '![\p{Z}\s]{1,}!u', ' ', $description );
47
+ $description = trim( $description, " \t\xA0\n\r" ); // Space, tab, non-breaking space, newline, carriage return
48
+
49
+ if ( function_exists( 'mb_substr' ) ) {
50
+ $description = mb_substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH, 'UTF-8' );
51
+ } else {
52
+ $description = substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH );
53
+ }
54
+ $description = htmlspecialchars( $description, ENT_COMPAT, 'UTF-8' );
55
+
56
+ return $description;
57
+ }
58
  }
59
 
60
  abstract class Ecwid_HTML_Meta_Catalog_Entry extends Ecwid_HTML_Meta {
144
  abstract protected function _get_url();
145
 
146
  abstract protected function _get_image_url();
147
+
148
+ // static only while ecwid_trim_description exists and meta functionality is not moved into this class
149
+ public static function process_raw_description( $description, $length = 0 ) {
150
+ $description = strip_tags( $description );
151
+ $description = html_entity_decode( $description, ENT_NOQUOTES, 'UTF-8' );
152
+
153
+ $description = preg_replace( '![\p{Z}\s]{1,}!u', ' ', $description );
154
+ $description = trim( $description, " \t\xA0\n\r" ); // Space, tab, non-breaking space, newline, carriage return
155
+
156
+ if ( function_exists( 'mb_substr' ) ) {
157
+ $description = mb_substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH, 'UTF-8' );
158
+ } else {
159
+ $description = substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH );
160
+ }
161
+ $description = htmlspecialchars( $description, ENT_COMPAT, 'UTF-8' );
162
+
163
+ return $description;
164
+ }
165
  }
166
 
167
  class Ecwid_HTML_Meta_Product extends Ecwid_HTML_Meta_Catalog_Entry {
232
  }
233
  }
234
 
235
+ add_action( 'wp', array( 'Ecwid_HTML_Meta', 'maybe_create' ) );
includes/class-ecwid-message-manager.php CHANGED
@@ -337,7 +337,17 @@ HTML
337
  case 'no_token':
338
  $no_token = Ecwid_Api_V3::get_token() == false;
339
  $is_not_demo = !ecwid_is_demo_store();
340
- return $no_token && $is_not_demo && !$is_ecwid_menu;
 
 
 
 
 
 
 
 
 
 
341
 
342
  case self::MSG_WOO_IMPORT_ONBOARDING:
343
  if ( !class_exists( 'Ecwid_Importer' ) ) {
337
  case 'no_token':
338
  $no_token = Ecwid_Api_V3::get_token() == false;
339
  $is_not_demo = !ecwid_is_demo_store();
340
+ return
341
+ $no_token
342
+ && $is_not_demo
343
+ && !$is_ecwid_menu
344
+ && in_array(
345
+ Ecwid_Api_V3::get_api_status(),
346
+ array(
347
+ Ecwid_Api_V3::API_STATUS_OK,
348
+ Ecwid_Api_V3::API_STATUS_ERROR_TOKEN
349
+ )
350
+ );
351
 
352
  case self::MSG_WOO_IMPORT_ONBOARDING:
353
  if ( !class_exists( 'Ecwid_Importer' ) ) {
includes/class-ecwid-products.php CHANGED
@@ -161,12 +161,6 @@ class Ecwid_Products {
161
  return '';
162
  }
163
 
164
- $url = get_post_meta( $post_id, '_ecwid_seo_url', true );
165
-
166
- if ( $url ) {
167
- return $url;
168
- }
169
-
170
  $ecwid_product_id = get_post_meta( $post_id, 'ecwid_id', true );
171
 
172
  $url = Ecwid_Store_Page::get_product_url_from_api( $ecwid_product_id );
@@ -490,7 +484,7 @@ class Ecwid_Products {
490
  $meta = array(
491
  '_price' => $product->defaultDisplayedPrice,
492
  '_regular_price' => $product->defaultDisplayedPrice,
493
- 'image' => $product->imageUrl,
494
  'ecwid_id' => $product->id,
495
  '_sku' => $product->sku,
496
  '_visibility' => 'visible',
@@ -625,6 +619,10 @@ class Ecwid_Products {
625
  }
626
 
627
  protected function _upload_product_thumbnail( $product, $post_id ) {
 
 
 
 
628
  $file = download_url( $product->imageUrl );
629
 
630
  if (is_wp_error($file)) return;
161
  return '';
162
  }
163
 
 
 
 
 
 
 
164
  $ecwid_product_id = get_post_meta( $post_id, 'ecwid_id', true );
165
 
166
  $url = Ecwid_Store_Page::get_product_url_from_api( $ecwid_product_id );
484
  $meta = array(
485
  '_price' => $product->defaultDisplayedPrice,
486
  '_regular_price' => $product->defaultDisplayedPrice,
487
+ 'image' => @$product->imageUrl,
488
  'ecwid_id' => $product->id,
489
  '_sku' => $product->sku,
490
  '_visibility' => 'visible',
619
  }
620
 
621
  protected function _upload_product_thumbnail( $product, $post_id ) {
622
+
623
+ if ( !@$product->imageUrl ) {
624
+ return;
625
+ }
626
  $file = download_url( $product->imageUrl );
627
 
628
  if (is_wp_error($file)) return;
includes/class-ecwid-seo-links.php CHANGED
@@ -24,7 +24,7 @@ class Ecwid_Seo_Links {
24
  add_action( 'template_redirect', array( $this, 'redirect_escaped_fragment' ) );
25
  add_filter( 'get_shortlink', array( $this, 'get_shortlink' ) );
26
 
27
- add_action( 'ecwid_print_inline_js_config', array( $this, 'add_js_config') );
28
 
29
  add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', array( $this, 'is_post_slug_bad'), 10, 4 );
30
  add_filter( 'wp_unique_post_slug_is_bad_flat_slug', array( $this, 'is_post_slug_bad' ), 10, 2 );
@@ -281,6 +281,10 @@ JS;
281
  }
282
 
283
  public function are_base_urls_ok() {
 
 
 
 
284
  $all_base_urls = $this->_build_all_base_urls();
285
 
286
  $flattened = array();
@@ -310,6 +314,9 @@ JS;
310
  }
311
 
312
  $rules = get_option( 'rewrite_rules' );
 
 
 
313
  foreach ( $flattened as $link ) {
314
  $link = trim( $link, '/' );
315
 
24
  add_action( 'template_redirect', array( $this, 'redirect_escaped_fragment' ) );
25
  add_filter( 'get_shortlink', array( $this, 'get_shortlink' ) );
26
 
27
+ add_action( 'ecwid_inline_js_config', array( $this, 'add_js_config') );
28
 
29
  add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', array( $this, 'is_post_slug_bad'), 10, 4 );
30
  add_filter( 'wp_unique_post_slug_is_bad_flat_slug', array( $this, 'is_post_slug_bad' ), 10, 2 );
281
  }
282
 
283
  public function are_base_urls_ok() {
284
+ if (! self::is_feature_available() ) {
285
+ return true;
286
+ }
287
+
288
  $all_base_urls = $this->_build_all_base_urls();
289
 
290
  $flattened = array();
314
  }
315
 
316
  $rules = get_option( 'rewrite_rules' );
317
+
318
+ if ( empty( $rules ) ) return false;
319
+
320
  foreach ( $flattened as $link ) {
321
  $link = trim( $link, '/' );
322
 
includes/class-ecwid-store-page.php CHANGED
@@ -254,7 +254,10 @@ class Ecwid_Store_Page {
254
  {
255
  $pages = self::get_store_pages_array();
256
  foreach ( $pages as $ind => $page ) {
257
- if ( $page != self::get_current_store_page_id() && get_post($page)->post_type == 'post' ) {
 
 
 
258
  unset( $pages[$ind] );
259
  }
260
  }
254
  {
255
  $pages = self::get_store_pages_array();
256
  foreach ( $pages as $ind => $page ) {
257
+
258
+ $post = get_post($page);
259
+
260
+ if ( $page != self::get_current_store_page_id() && $post && $post->post_type == 'post' ) {
261
  unset( $pages[$ind] );
262
  }
263
  }
includes/class-ecwid-stub-renderer.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Ecwid_Stub_Renderer {
4
+ public function __construct()
5
+ {
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
+ }
13
+
14
+ public function get_custom_renderer() {
15
+ return array( $this, 'render_shortcode' );
16
+ }
17
+
18
+ public function get_custom_widget_renderer() {
19
+ return array( $this, 'render_widget' );
20
+ }
21
+
22
+ public function render_shortcode( $args ) {
23
+
24
+ if ( $args instanceof Ecwid_Shortcode_Product ) {
25
+ ob_start();
26
+
27
+ $message = __( 'Product', 'ecwid-shopping-cart' );
28
+
29
+ require ECWID_TEMPLATES_DIR . '/shortcode-stub.tpl.php';
30
+
31
+ $contents = ob_get_contents();
32
+ ob_end_clean();
33
+
34
+ return $contents;
35
+ } else if ( is_array( $args ) ) {
36
+ ob_start();
37
+
38
+ $message = __( 'Your store will be shown here', 'ecwid-shopping-cart' );
39
+
40
+ require ECWID_TEMPLATES_DIR . '/shortcode-stub.tpl.php';
41
+
42
+ $contents = ob_get_contents();
43
+ ob_end_clean();
44
+
45
+ return $contents;
46
+ }
47
+
48
+ return false;
49
+ }
50
+
51
+ public function render_widget( $widget, $args, $instance ) {
52
+
53
+ if ( is_array( $args ) ) {
54
+ ob_start();
55
+
56
+ $message = $widget->name;
57
+ require ECWID_TEMPLATES_DIR . '/widget-stub.tpl.php';
58
+
59
+ $contents = ob_get_contents();
60
+ ob_end_clean();
61
+
62
+ return $contents;
63
+ }
64
+
65
+ return false;
66
+ }
67
+
68
+ abstract protected function _should_apply();
69
+
70
+ public function enqueue_scripts() {
71
+ EcwidPlatform::enqueue_style( 'shortcode-stub' );
72
+ EcwidPlatform::enqueue_style( 'widget-stub' );
73
+ }
74
+
75
+ public function filter_inline_js_config( $js ) {
76
+ if ( $this->_should_apply() ) {
77
+ return "";
78
+ }
79
+
80
+ return $js;
81
+ }
82
+ }
includes/importer/class-ecwid-import.php CHANGED
@@ -55,7 +55,7 @@ class Ecwid_Import
55
  $ecwid_categories = $api->get_categories(array('limit' => 1));
56
  $result['ecwid_total_categories'] = $ecwid_categories->total;
57
 
58
- $result['allow_delete_demo'] = self::allow_delete_demo_products();
59
 
60
  $count = wp_count_posts( 'product' );
61
 
@@ -72,28 +72,4 @@ class Ecwid_Import
72
 
73
  return $result;
74
  }
75
-
76
- public static function allow_delete_demo_products()
77
- {
78
- $result = false;
79
-
80
- $api = new Ecwid_Api_V3();
81
-
82
- $demo_products = $api->get_products( array( 'createdFrom' => Ecwid_Importer::DEMO_CREATE_FROM, 'createdTo' => Ecwid_Importer::DEMO_CREATE_TO + 1 ) );
83
- if ( $demo_products->total <= 10 ) {
84
- $result = true;
85
- foreach ( $demo_products->items as $product ) {
86
- if ( !self::_is_demo_product( $product ) ) {
87
- $result = false;
88
- break;
89
- }
90
- }
91
- }
92
-
93
- return $result;
94
- }
95
-
96
- protected static function _is_demo_product( $product_data ) {
97
- return strpos( $product_data->originalImage->url, '/default-store/' ) > 0;
98
- }
99
  }
55
  $ecwid_categories = $api->get_categories(array('limit' => 1));
56
  $result['ecwid_total_categories'] = $ecwid_categories->total;
57
 
58
+ $result['allow_delete_demo'] = count( Ecwid_Importer::get_ecwid_demo_products() > 0 );
59
 
60
  $count = wp_count_posts( 'product' );
61
 
72
 
73
  return $result;
74
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
includes/importer/class-ecwid-importer-task.php CHANGED
@@ -22,7 +22,16 @@ abstract class Ecwid_Importer_Task
22
  return $tasks;
23
  }
24
 
25
- $names = array( 'Create_Category', 'Create_Product', 'Upload_Product_Image', 'Upload_Category_Image', 'Delete_Products' );
 
 
 
 
 
 
 
 
 
26
 
27
  foreach ( $names as $name ) {
28
  $class_name = 'Ecwid_Importer_Task_' . $name;
@@ -91,13 +100,15 @@ class Ecwid_Importer_Task_Create_Product extends Ecwid_Importer_Task
91
 
92
  $ecwid_product_id = null;
93
  $result = null;
 
 
94
  if ( $exporter->get_setting( Ecwid_Importer::SETTING_UPDATE_BY_SKU ) ) {
95
  $products = $api->get_products( array( 'sku' => $data['sku'] ) );
96
 
97
  if ( $products->total > 0 ) {
98
- $ecwid_product_id = $products->items[0]->id;
99
- $result = $api->update_product( $data, $ecwid_product_id );
100
- $exporter->save_ecwid_product_id( $woo_id, $ecwid_product_id );
101
  }
102
  }
103
 
@@ -113,9 +124,9 @@ class Ecwid_Importer_Task_Create_Product extends Ecwid_Importer_Task
113
 
114
  if ( $result['response']['code'] == '200' ) {
115
  $result_object = json_decode( $result['body'] );
116
-
117
- update_post_meta( $woo_id, 'ecwid_product_id', $ecwid_product_id );
118
- $exporter->save_ecwid_product_id( $woo_id, $ecwid_product_id );
119
 
120
  $return['status'] = 'success';
121
  $return['data'] = $result_object;
@@ -141,6 +152,14 @@ class Ecwid_Importer_Task_Create_Product extends Ecwid_Importer_Task
141
  $default_attributes = $product->get_default_attributes();
142
  $result['options'] = array();
143
  foreach ( $attributes as $name => $attribute ) {
 
 
 
 
 
 
 
 
144
  $option = array( 'type' => 'SELECT', 'name' => $name, 'required' => true, 'choices' => array() );
145
  foreach ( $attribute as $option_name ) {
146
  $choice = array( 'text' => $option_name, 'priceModifier' => 0, 'priceModifierType' => 'ABSOLUTE' );
@@ -198,6 +217,67 @@ class Ecwid_Importer_Task_Delete_Products extends Ecwid_Importer_Task
198
  }
199
  }
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  class Ecwid_Importer_Task_Upload_Category_Image extends Ecwid_Importer_Task
202
  {
203
  public static $type = 'upload_category_image';
@@ -300,6 +380,142 @@ class Ecwid_Importer_Task_Upload_Product_Image extends Ecwid_Importer_Task
300
  }
301
  }
302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  class Ecwid_Importer_Task_Create_Category extends Ecwid_Importer_Task
304
  {
305
  public static $type = 'create_category';
@@ -334,6 +550,7 @@ class Ecwid_Importer_Task_Create_Category extends Ecwid_Importer_Task
334
  if ( $result['response']['code'] == '200' ) {
335
  $exporter->save_ecwid_category( $category_data['woo_id'], $ecwid_category_id );
336
  update_term_meta( $category_data['woo_id'], 'ecwid_category_id', $ecwid_category_id );
 
337
  $return['status'] = 'success';
338
  $return['data'] = json_decode( $result['body'] );
339
  } else {
22
  return $tasks;
23
  }
24
 
25
+ $names = array(
26
+ 'Create_Category',
27
+ 'Create_Product',
28
+ 'Upload_Product_Image',
29
+ 'Upload_Category_Image',
30
+ 'Delete_Products',
31
+ 'Create_Product_Variation',
32
+ 'Upload_Product_Variation_Image',
33
+ 'Upload_Product_Gallery_Image'
34
+ );
35
 
36
  foreach ( $names as $name ) {
37
  $class_name = 'Ecwid_Importer_Task_' . $name;
100
 
101
  $ecwid_product_id = null;
102
  $result = null;
103
+ $ecwid_id = null;
104
+
105
  if ( $exporter->get_setting( Ecwid_Importer::SETTING_UPDATE_BY_SKU ) ) {
106
  $products = $api->get_products( array( 'sku' => $data['sku'] ) );
107
 
108
  if ( $products->total > 0 ) {
109
+ $ecwid_id = $products->items[0]->id;
110
+ $result = $api->update_product( $data, $ecwid_id );
111
+ $exporter->save_ecwid_product_id( $woo_id, $ecwid_id );
112
  }
113
  }
114
 
124
 
125
  if ( $result['response']['code'] == '200' ) {
126
  $result_object = json_decode( $result['body'] );
127
+
128
+ update_post_meta( $woo_id, '_ecwid_product_id', $ecwid_id ? $ecwid_id : $result_object->id );
129
+ $exporter->save_ecwid_product_id( $woo_id, $ecwid_id ? $ecwid_id : $result_object->id );
130
 
131
  $return['status'] = 'success';
132
  $return['data'] = $result_object;
152
  $default_attributes = $product->get_default_attributes();
153
  $result['options'] = array();
154
  foreach ( $attributes as $name => $attribute ) {
155
+
156
+ $atts = $product->get_attributes();
157
+ $tax_attribute = $atts[strtolower($name)]->get_taxonomy_object();
158
+
159
+ if ($tax_attribute) {
160
+ $name = $tax_attribute->attribute_label;
161
+ }
162
+
163
  $option = array( 'type' => 'SELECT', 'name' => $name, 'required' => true, 'choices' => array() );
164
  foreach ( $attribute as $option_name ) {
165
  $choice = array( 'text' => $option_name, 'priceModifier' => 0, 'priceModifierType' => 'ABSOLUTE' );
217
  }
218
  }
219
 
220
+ class Ecwid_Importer_Task_Upload_Product_Variation_Image extends Ecwid_Importer_Task
221
+ {
222
+ public static $type = 'upload_product_variation_image';
223
+
224
+ public function execute( Ecwid_Importer $exporter, $data ) {
225
+ $api = new Ecwid_Api_V3();
226
+
227
+ $product_id = get_post_meta( $data['product_id'], '_ecwid_product_id', true );
228
+ $variation_id = get_post_meta( $data['variation_id'], '_ecwid_variation_id', true );
229
+
230
+ $file = get_attached_file ( get_post_thumbnail_id( $data['variation_id'] ) );
231
+
232
+ if ( !$product_id ) {
233
+ return array(
234
+ 'status' => 'error',
235
+ 'data' => 'skipped',
236
+ 'message' => 'parent product was not imported. data:' . var_export($data, true)
237
+ );
238
+ }
239
+
240
+ if ( !$variation_id ) {
241
+ return array(
242
+ 'status' => 'error',
243
+ 'data' => 'skipped',
244
+ 'message' => 'parent variation was not imported. data:' . var_export($data, true)
245
+ );
246
+ }
247
+
248
+ $data = array(
249
+ 'productId' => $product_id,
250
+ 'variationId' => $variation_id,
251
+ 'data' => file_get_contents( $file )
252
+ );
253
+
254
+ $result = $api->upload_product_variation_image( $data );
255
+
256
+ $return = array(
257
+ 'type' => self::$type
258
+ );
259
+ if ( $result['response']['code'] == '200' ) {
260
+ $result_object = json_decode( $result['body'] );
261
+
262
+ $return['status'] = 'success';
263
+ $return['data'] = $result_object;
264
+ } else {
265
+ $return['status'] = 'error';
266
+ $return['data'] = $result;
267
+ }
268
+
269
+ return $return;
270
+ }
271
+
272
+ public static function build($data) {
273
+ return array(
274
+ 'type' => self::$type,
275
+ 'product_id' => $data['product_id'],
276
+ 'variation_id' => $data['variation_id']
277
+ );
278
+ }
279
+ }
280
+
281
  class Ecwid_Importer_Task_Upload_Category_Image extends Ecwid_Importer_Task
282
  {
283
  public static $type = 'upload_category_image';
380
  }
381
  }
382
 
383
+ class Ecwid_Importer_Task_Upload_Product_Gallery_Image extends Ecwid_Importer_Task
384
+ {
385
+ public static $type = 'upload_product_gallery_image';
386
+
387
+ public function execute( Ecwid_Importer $exporter, $product_data ) {
388
+ $api = new Ecwid_Api_V3();
389
+
390
+ $file = get_attached_file( $product_data['image_id'] );
391
+
392
+ $product_id = get_post_meta( $product_data['product_id'], '_ecwid_product_id', true );
393
+
394
+ if ( !$product_id ) {
395
+ return array(
396
+ 'status' => 'error',
397
+ 'data' => 'skipped',
398
+ 'message' => 'Parent product was not imported'
399
+ );
400
+ }
401
+
402
+ $data = array(
403
+ 'productId' => $product_id,
404
+ 'data' => file_get_contents( $file )
405
+ );
406
+
407
+ $result = $api->upload_product_gallery_image( $data );
408
+
409
+ $return = array(
410
+ 'type' => self::$type
411
+ );
412
+ if ( $result['response']['code'] == '200' ) {
413
+ $result_object = json_decode( $result['body'] );
414
+
415
+ $return['status'] = 'success';
416
+ $return['data'] = $result_object;
417
+ } else {
418
+ $return['status'] = 'error';
419
+ $return['data'] = $result;
420
+ }
421
+
422
+ return $return;
423
+ }
424
+
425
+ public static function build($data) {
426
+ return array(
427
+ 'type' => self::$type,
428
+ 'product_id' => $data['product_id'],
429
+ 'image_id' => $data['image_id']
430
+ );
431
+ }
432
+ }
433
+
434
+ class Ecwid_Importer_Task_Create_Product_Variation extends Ecwid_Importer_Task
435
+ {
436
+ public static $type = 'create_variation';
437
+
438
+ public function execute( Ecwid_Importer $exporter, $data ) {
439
+ $api = new Ecwid_Api_V3();
440
+
441
+ $p = wc_get_product( $data['woo_id'] );
442
+ $attributes = $p->get_attributes();
443
+ $vars = $p->get_available_variations();
444
+
445
+ $variation_data = array(
446
+ 'productId' => $exporter->get_ecwid_product_id( $data['woo_id'] ),
447
+ 'options' => array()
448
+ );
449
+
450
+ foreach ( $vars as $var ) {
451
+ if ( $var['variation_id'] != $data['var_id'] ) {
452
+ continue;
453
+ }
454
+
455
+ foreach ($attributes as $internal_name => $attribute) {
456
+ $tax_attribute = $attribute->get_taxonomy_object();
457
+
458
+ $name = '';
459
+ if ( $tax_attribute ) {
460
+ $name = $tax_attribute->attribute_label;
461
+ } else {
462
+ $name = $attribute->get_name();
463
+ }
464
+
465
+ $value = $var['attributes']['attribute_' . strtolower($internal_name)];
466
+
467
+ $variation_data['options'][] = array(
468
+ 'name' => $name,
469
+ 'value' => $value
470
+ );
471
+ }
472
+
473
+ $variation_data['price'] = $var['display_price'];
474
+ if ($var['weight']) {
475
+ $variation_data['weight'] = $var['weight'];
476
+ }
477
+ if ($var['max_qty']) {
478
+ $variation_data['quantity'] = $var['max_qty'];
479
+ }
480
+
481
+ if ( $var['sku'] != $p->sku ) {
482
+ $variation_data['sku'] = $var['sku'];
483
+ }
484
+
485
+ break;
486
+ }
487
+
488
+ $result = $api->create_product_variation(
489
+ $variation_data
490
+ );
491
+
492
+ $return = array(
493
+ 'type' => self::$type
494
+ );
495
+ if ( $result['response']['code'] == '200' ) {
496
+ $result_object = json_decode( $result['body'] );
497
+
498
+ update_post_meta( $data['var_id'], '_ecwid_variation_id', $result_object->id );
499
+
500
+ $return['status'] = 'success';
501
+ $return['data'] = $result_object;
502
+ } else {
503
+ $return['status'] = 'error';
504
+ $return['data'] = $result;
505
+ }
506
+
507
+ return $return;
508
+ }
509
+
510
+ public static function build($data) {
511
+ return array(
512
+ 'type' => self::$type,
513
+ 'woo_id' => $data['woo_id'],
514
+ 'var_id' => $data['var_id']
515
+ );
516
+ }
517
+ }
518
+
519
  class Ecwid_Importer_Task_Create_Category extends Ecwid_Importer_Task
520
  {
521
  public static $type = 'create_category';
550
  if ( $result['response']['code'] == '200' ) {
551
  $exporter->save_ecwid_category( $category_data['woo_id'], $ecwid_category_id );
552
  update_term_meta( $category_data['woo_id'], 'ecwid_category_id', $ecwid_category_id );
553
+
554
  $return['status'] = 'success';
555
  $return['data'] = json_decode( $result['body'] );
556
  } else {
includes/importer/class-ecwid-importer.php CHANGED
@@ -11,6 +11,8 @@ class Ecwid_Importer
11
  const OPTION_STATUS = 'ecwid_importer_status';
12
  const OPTION_WOO_CATALOG_IMPORTED = 'ecwid_imported_from_woo';
13
  const OPTION_SETTINGS = 'ecwid_importer_settings';
 
 
14
  const TICK_LENGTH = 5;
15
 
16
  const SETTING_UPDATE_BY_SKU = 'update-by-sku';
@@ -28,7 +30,7 @@ class Ecwid_Importer
28
  update_option( self::OPTION_PRODUCTS, array() );
29
  update_option( self::OPTION_TASKS, array() );
30
  update_option( self::OPTION_STATUS, array() );
31
-
32
  $this->_start();
33
 
34
  $api = new Ecwid_Api_V3();
@@ -175,19 +177,11 @@ class Ecwid_Importer
175
  protected function _build_tasks()
176
  {
177
  $tasks = array();
178
-
179
- if ( $this->get_setting( self::SETTING_DELETE_DEMO ) && Ecwid_Import::allow_delete_demo_products() ) {
180
- $products = self::get_ecwid_demo_products();
181
-
182
- $ids = array();
183
- foreach ( $products->items as $item ) {
184
- $ids[] = $item->id;
185
- }
186
-
187
- $tasks[] = Ecwid_Importer_Task_Delete_Products::build( $ids );
188
  }
189
-
190
-
191
  $categories = $this->gather_categories();
192
 
193
  foreach ( @$categories as $category ) {
@@ -196,7 +190,7 @@ class Ecwid_Importer
196
  $tasks[] = Ecwid_Importer_Task_Upload_Category_Image::build( $category );
197
  }
198
  }
199
-
200
  $products = $this->gather_products();
201
 
202
  foreach ( $products as $product ) {
@@ -205,14 +199,45 @@ class Ecwid_Importer
205
  if ( $product['has_image'] ) {
206
  $tasks[] = Ecwid_Importer_Task_Upload_Product_Image::build( $product );
207
  }
208
- /*
209
- if ( $product['has_gallery_images'] ) {
210
- foreach ( $product->gallery_images as $image ) {
211
- $tasks[] = $this->_build_upload_product_gallery_image_task( $product, $image );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  }
213
  }
214
- */ }
215
-
 
 
 
 
 
 
 
 
 
 
 
216
  $this->_set_tasks($tasks);
217
  }
218
 
@@ -316,7 +341,20 @@ class Ecwid_Importer
316
  {
317
  $api = new Ecwid_Api_V3();
318
 
319
- $ecwid_products = $api->get_products( array( 'limit' => 1 ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  return $ecwid_products->total;
321
  }
322
 
@@ -332,15 +370,20 @@ class Ecwid_Importer
332
  {
333
  $ecwid_products = self::get_ecwid_demo_products();
334
 
335
- return $ecwid_products->total;
336
  }
337
 
338
  public static function get_ecwid_demo_products() {
339
- $api = new Ecwid_Api_V3();
340
-
341
- $ecwid_products = $api->get_products( array( 'createdFrom' => self::DEMO_CREATE_FROM, 'createdTo' => self::DEMO_CREATE_TO ) );
342
-
343
- return $ecwid_products;
 
 
 
 
 
344
  }
345
 
346
 
@@ -376,14 +419,15 @@ class Ecwid_Importer
376
 
377
  public function gather_products()
378
  {
379
- $products = get_posts( array( 'post_type' => 'product', 'posts_per_page' => 2500 ) );
380
-
381
  $return = array();
382
- foreach ($products as $product) {
 
383
  $return[] = array(
384
- 'woo_id' => $product->ID,
385
- 'has_image' => get_post_thumbnail_id( $product->ID ),
386
- 'has_gallery_images' => false
387
  );
388
  }
389
 
11
  const OPTION_STATUS = 'ecwid_importer_status';
12
  const OPTION_WOO_CATALOG_IMPORTED = 'ecwid_imported_from_woo';
13
  const OPTION_SETTINGS = 'ecwid_importer_settings';
14
+ const OPTION_DEMO_PRODUCTS = 'woo_importer_demo_products';
15
+
16
  const TICK_LENGTH = 5;
17
 
18
  const SETTING_UPDATE_BY_SKU = 'update-by-sku';
30
  update_option( self::OPTION_PRODUCTS, array() );
31
  update_option( self::OPTION_TASKS, array() );
32
  update_option( self::OPTION_STATUS, array() );
33
+
34
  $this->_start();
35
 
36
  $api = new Ecwid_Api_V3();
177
  protected function _build_tasks()
178
  {
179
  $tasks = array();
180
+ /*
181
+ if ( $this->get_setting( self::SETTING_DELETE_DEMO ) && self::count_ecwid_demo_products() ) {
182
+ $tasks[] = Ecwid_Importer_Task_Delete_Products::build( self::get_ecwid_demo_products() );
 
 
 
 
 
 
 
183
  }
184
+
 
185
  $categories = $this->gather_categories();
186
 
187
  foreach ( @$categories as $category ) {
190
  $tasks[] = Ecwid_Importer_Task_Upload_Category_Image::build( $category );
191
  }
192
  }
193
+ */
194
  $products = $this->gather_products();
195
 
196
  foreach ( $products as $product ) {
199
  if ( $product['has_image'] ) {
200
  $tasks[] = Ecwid_Importer_Task_Upload_Product_Image::build( $product );
201
  }
202
+
203
+ $p = wc_get_product( $product['woo_id'] );
204
+
205
+ if ( $p instanceof WC_Product_Variable ) {
206
+
207
+ $vars = $p->get_available_variations();
208
+
209
+ foreach ( $vars as $var ) {
210
+
211
+ $tasks[] = Ecwid_Importer_Task_Create_Product_Variation::build(
212
+ array(
213
+ 'woo_id' => $product['woo_id'],
214
+ 'var_id' => $var['variation_id']
215
+ )
216
+ );
217
+
218
+ if ( $var['image_id'] != $p->get_image_id() ) {
219
+ $tasks[] = Ecwid_Importer_Task_Upload_Product_Variation_Image::build(
220
+ array(
221
+ 'product_id' => $product['woo_id'],
222
+ 'variation_id' => $var['variation_id']
223
+ )
224
+ );
225
+ }
226
  }
227
  }
228
+
229
+ if ( $product['gallery_images'] ) {
230
+ foreach ( $product['gallery_images'] as $image ) {
231
+ $tasks[] = Ecwid_Importer_Task_Upload_Product_Gallery_Image::build(
232
+ array(
233
+ 'product_id' => $product['woo_id'],
234
+ 'image_id' => $image
235
+ )
236
+ );
237
+ }
238
+ }
239
+ }
240
+
241
  $this->_set_tasks($tasks);
242
  }
243
 
341
  {
342
  $api = new Ecwid_Api_V3();
343
 
344
+ $max = 100;
345
+ $ecwid_products = $api->get_products( array( 'limit' => $max ) );
346
+
347
+ if ( $ecwid_products->total <= $max ) {
348
+ $demo = array();
349
+ foreach ( $ecwid_products->items as $item ) {
350
+ if ( $item->isSampleProduct ) {
351
+ $demo[] = $item->id;
352
+ }
353
+ }
354
+
355
+ EcwidPlatform::set( self::OPTION_DEMO_PRODUCTS, $demo );
356
+ }
357
+
358
  return $ecwid_products->total;
359
  }
360
 
370
  {
371
  $ecwid_products = self::get_ecwid_demo_products();
372
 
373
+ return count( $ecwid_products );
374
  }
375
 
376
  public static function get_ecwid_demo_products() {
377
+
378
+ // Actual gathering happens in count_ecwid_products
379
+ // TODO: fix this discrapency
380
+ $demo_products = EcwidPlatform::get( self::OPTION_DEMO_PRODUCTS, array() );
381
+
382
+ if ( is_array( $demo_products ) ) {
383
+ return $demo_products;
384
+ }
385
+
386
+ return array();
387
  }
388
 
389
 
419
 
420
  public function gather_products()
421
  {
422
+ $products = get_posts( array( 'post_type' => 'product', 'posts_per_page' => 2500, 'fields' => 'ids' ) );
423
+
424
  $return = array();
425
+ foreach ($products as $id ) {
426
+ $p = wc_get_product( $id );
427
  $return[] = array(
428
+ 'woo_id' => $id,
429
+ 'has_image' => get_post_thumbnail_id( $id ),
430
+ 'gallery_images' => $p->get_gallery_image_ids()
431
  );
432
  }
433
 
includes/importer/importer.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- if (version_compare( phpversion(), '5.3', '>' ) ) {
4
  $oauth = new Ecwid_OAuth();
5
 
6
  if ( $oauth->has_scope( Ecwid_OAuth::SCOPE_READ_CATALOG ) ) {
1
  <?php
2
 
3
+ if (version_compare( phpversion(), '5.6', '>=' ) ) {
4
  $oauth = new Ecwid_OAuth();
5
 
6
  if ( $oauth->has_scope( Ecwid_OAuth::SCOPE_READ_CATALOG ) ) {
includes/{class-ecwid-integration-above-the-fold.php → integrations/class-ecwid-integration-above-the-fold.php} RENAMED
File without changes
includes/{class-ecwid-integration-aiosp.php → integrations/class-ecwid-integration-aiosp.php} RENAMED
File without changes
includes/{class-ecwid-integration-autoptimize.php → integrations/class-ecwid-integration-autoptimize.php} RENAMED
File without changes
includes/integrations/class-ecwid-integration-beaver-builder.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once ECWID_PLUGIN_DIR . '/includes/class-ecwid-stub-renderer.php';
4
+
5
+ class Ecwid_Integration_Beaver_Builder extends Ecwid_Stub_Renderer {
6
+ protected function _should_apply() {
7
+ return isset( $_GET['fl_builder'] );
8
+ }
9
+ }
10
+
11
+ $__ecwid_integration_beaver_builder = new Ecwid_Integration_Beaver_Builder();
includes/{class-ecwid-integration-divibuilder.php → integrations/class-ecwid-integration-divibuilder.php} RENAMED
@@ -2,16 +2,16 @@
2
 
3
  class Ecwid_Integration_Divibuilder {
4
  public function __construct() {
5
- if (is_admin()) {
6
- add_action('admin_init', 'ecwid_create_divi_module' );
7
- add_action('admin_enqueue_style', array($this, 'enqueue_style'));
8
  } else {
9
- add_action('wp', 'ecwid_create_divi_module' );
10
  }
11
  }
12
 
13
  public function enqueue_style() {
14
- wp_enqueue_style('ecwid-divi', ECWID_PLUGIN_URL . '/css/divibuilder.css', array('et_pb_admin_css'));
15
  }
16
  }
17
 
@@ -22,7 +22,7 @@ function ecwid_create_divi_module() {
22
  if ( class_exists( 'ET_Builder_Module' ) && ! class_exists( 'ET_Builder_Module_Ecwid' ) ) {
23
  class ET_Builder_Module_Ecwid extends ET_Builder_Module {
24
  function init() {
25
- $this->name = __( 'Ecwid', 'et_builder' );
26
  $this->slug = 'et_pb_ecwid';
27
  $this->use_row_content = TRUE;
28
  $this->decode_entities = TRUE;
@@ -42,7 +42,7 @@ function ecwid_create_divi_module() {
42
  'type' => 'text',
43
  'option_category' => 'basic_option',
44
  'description' => __( 'Here you can create the content that will be used within the module.', 'et_builder' ),
45
- 'default' => '[ecwid widgets="productbrowser minicart categories search" grid="3,3" list="10" table="20" default_category_id="0" category_view="grid" search_view="grid" minicart_layout="MiniAttachToProductBrowser" ]'
46
 
47
  ),
48
  'admin_label' => array(
2
 
3
  class Ecwid_Integration_Divibuilder {
4
  public function __construct() {
5
+ if ( is_admin() ) {
6
+ add_action( 'admin_init', 'ecwid_create_divi_module' );
7
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ) );
8
  } else {
9
+ add_action( 'wp', 'ecwid_create_divi_module' );
10
  }
11
  }
12
 
13
  public function enqueue_style() {
14
+ wp_enqueue_style('ecwid-divi', ECWID_PLUGIN_URL . '/css/divibuilder.css' );
15
  }
16
  }
17
 
22
  if ( class_exists( 'ET_Builder_Module' ) && ! class_exists( 'ET_Builder_Module_Ecwid' ) ) {
23
  class ET_Builder_Module_Ecwid extends ET_Builder_Module {
24
  function init() {
25
+ $this->name = sprintf( __( '%s Store', 'ecwid-shopping-cart' ), Ecwid_Config::get_brand() );
26
  $this->slug = 'et_pb_ecwid';
27
  $this->use_row_content = TRUE;
28
  $this->decode_entities = TRUE;
42
  'type' => 'text',
43
  'option_category' => 'basic_option',
44
  'description' => __( 'Here you can create the content that will be used within the module.', 'et_builder' ),
45
+ 'default' => '[' . Ecwid_Shortcode_Base::get_current_store_shortcode_name() .' widgets="productbrowser" default_category_id="0"]'
46
 
47
  ),
48
  'admin_label' => array(
includes/integrations/class-ecwid-integration-elementor.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once ECWID_PLUGIN_DIR . '/includes/class-ecwid-stub-renderer.php';
4
+
5
+ class Ecwid_Integration_Elementor extends Ecwid_Stub_Renderer {
6
+ protected function _should_apply() {
7
+ return @$_REQUEST['action'] == 'elementor_ajax' || @$_REQUEST['action'] == 'elementor' || isset( $_GET['elementor-preview'] );
8
+ }
9
+
10
+ public function enqueue_scripts() {
11
+ parent::enqueue_scripts();
12
+ }
13
+ }
14
+
15
+ $__ecwid_integration_elementor = new Ecwid_Integration_Elementor();
includes/{class-ecwid-integration-gutenberg.php → integrations/class-ecwid-integration-gutenberg.php} RENAMED
File without changes
includes/{class-ecwid-integration-wpbakery-composer.php → integrations/class-ecwid-integration-wpbakery-composer.php} RENAMED
File without changes
includes/{class-ecwid-integration-wpseo.php → integrations/class-ecwid-integration-wpseo.php} RENAMED
File without changes
includes/shortcodes.php CHANGED
@@ -15,30 +15,14 @@ add_shortcode('ecwid_searchbox', 'ecwid_searchbox_shortcode');
15
  add_shortcode('ec_product', 'ecwid_render_shortcode');
16
 
17
  function ecwid_render_shortcode($params, $content = '', $name) {
18
- $names = array('productbrowser', 'minicart', 'search', 'categories', 'product');
19
-
20
-
21
- $expected_prefix = 'ecwid_';
22
- if ( Ecwid_Config::is_wl() ) {
23
- $expected_prefix = 'ec_';
24
- }
25
-
26
- $prefix = substr( $name, 0, strlen( $expected_prefix ) );
27
-
28
- if ( $prefix != $expected_prefix ) return '';
29
-
30
- $base = substr( $name, strlen( $expected_prefix ) );
31
-
32
- if ( in_array( $base, $names ) ) {
33
- $classname = 'Ecwid_Shortcode_' . $base;
34
-
35
- $shortcode = new $classname($params);
36
-
37
  return $shortcode->render( array( 'legacy' => true ) );
38
  }
39
  }
40
 
41
-
42
  function ecwid_searchbox_shortcode($params, $content = '', $name) {
43
 
44
  $shortcode = new Ecwid_Shortcode_Search($params);
15
  add_shortcode('ec_product', 'ecwid_render_shortcode');
16
 
17
  function ecwid_render_shortcode($params, $content = '', $name) {
18
+
19
+ $shortcode = Ecwid_Shortcode_Base::get_shortcode_object( $name, $params );
20
+
21
+ if ( $shortcode ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  return $shortcode->render( array( 'legacy' => true ) );
23
  }
24
  }
25
 
 
26
  function ecwid_searchbox_shortcode($params, $content = '', $name) {
27
 
28
  $shortcode = new Ecwid_Shortcode_Search($params);
includes/shortcodes/class-ecwid-shortcode-base.php CHANGED
@@ -42,17 +42,46 @@ abstract class Ecwid_Shortcode_Base {
42
  return 'ecwid';
43
  }
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  public function wrap_code($code) {
46
 
47
  $version = get_option('ecwid_plugin_version');
48
 
49
  $shortcode_content = ecwid_get_scriptjs_code($this->_lang) . $code;
50
 
 
 
51
  $shortcode_content = "<!-- Ecwid shopping cart plugin v $version -->"
52
  . $shortcode_content
53
  . "<!-- END Ecwid Shopping Cart v $version -->";
54
 
55
- return apply_filters('ecwid_shortcode_content', $shortcode_content);
56
  }
57
 
58
  public function render() {
42
  return 'ecwid';
43
  }
44
 
45
+ public static function get_shortcode_object( $name, $params )
46
+ {
47
+ $names = array( 'productbrowser', 'minicart', 'search', 'categories', 'product' );
48
+
49
+ $expected_prefix = 'ecwid_';
50
+ if ( Ecwid_Config::is_wl() ) {
51
+ $expected_prefix = 'ec_';
52
+ }
53
+
54
+ $prefix = substr( $name, 0, strlen( $expected_prefix ) );
55
+
56
+ if ( $prefix != $expected_prefix ) return '';
57
+
58
+ $base = substr( $name, strlen( $expected_prefix ) );
59
+
60
+ if ( in_array( $base, $names ) ) {
61
+ $class = 'Ecwid_Shortcode_' . $base;
62
+
63
+ $class = apply_filters( 'ecwid_get_shortcode_class', $class, $name );
64
+ $shortcode = new $class( $params );
65
+
66
+ return $shortcode;
67
+ }
68
+
69
+ return null;
70
+ }
71
+
72
  public function wrap_code($code) {
73
 
74
  $version = get_option('ecwid_plugin_version');
75
 
76
  $shortcode_content = ecwid_get_scriptjs_code($this->_lang) . $code;
77
 
78
+ $shortcode_content = apply_filters('ecwid_shortcode_content', $shortcode_content);
79
+
80
  $shortcode_content = "<!-- Ecwid shopping cart plugin v $version -->"
81
  . $shortcode_content
82
  . "<!-- END Ecwid Shopping Cart v $version -->";
83
 
84
+ return $shortcode_content;
85
  }
86
 
87
  public function render() {
includes/shortcodes/class-ecwid-shortcode-productbrowser.php CHANGED
@@ -38,7 +38,7 @@ class Ecwid_Shortcode_ProductBrowser extends Ecwid_Shortcode_Base {
38
  $plain_content = '';
39
 
40
  $html_catalog_params = false;
41
-
42
  if ( Ecwid_Api_V3::is_available() ) {
43
 
44
  if (ecwid_should_display_escaped_fragment_catalog()) {
@@ -131,7 +131,7 @@ HTML;
131
  $plain_content .= '<script data-cfasync="false" type="text/javascript"> document.location = "' . esc_js($url) . '";</script>';
132
  }
133
  }
134
-
135
  return $plain_content;
136
  }
137
 
@@ -225,4 +225,4 @@ HTML;
225
 
226
  return $ecwid_default_category_id;
227
  }
228
- }
38
  $plain_content = '';
39
 
40
  $html_catalog_params = false;
41
+
42
  if ( Ecwid_Api_V3::is_available() ) {
43
 
44
  if (ecwid_should_display_escaped_fragment_catalog()) {
131
  $plain_content .= '<script data-cfasync="false" type="text/javascript"> document.location = "' . esc_js($url) . '";</script>';
132
  }
133
  }
134
+
135
  return $plain_content;
136
  }
137
 
225
 
226
  return $ecwid_default_category_id;
227
  }
228
+ }
includes/shortcodes/class-ecwid-shortcode-stub.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once ECWID_SHORTCODES_DIR . '/class-ecwid-shortcode-base.php';
4
+
5
+ class Ecwid_Shortcode_Stub extends Ecwid_Shortcode_Base {
6
+
7
+ protected function _process_params( $params = array() ) {
8
+ }
9
+
10
+ public static function get_shortcode_name() {
11
+ return 'categories';
12
+ }
13
+
14
+ public function get_ecwid_widget_function_name() {
15
+ return '';
16
+ }
17
+
18
+ public function render_widget() {
19
+
20
+ }
21
+
22
+ public function render_placeholder() {
23
+ $classname = $this->_get_html_class_name();
24
+ $id = $this->get_html_id();
25
+ return <<<HTML
26
+ <div class="ecwid-shopping-cart-$classname"><div id="$id"></div></div>
27
+ HTML;
28
+ }
29
+ }
includes/themes.php CHANGED
@@ -64,10 +64,11 @@ function ecwid_apply_theme($theme_name = null)
64
  'newsmag' => array( 'css-no-parent'),
65
  'optimizer' => array( 'css' ),
66
  'businesso' => array( 'css' ),
67
- 'Avada' => array( Ecwid_Theme_Base::PROP_USE_JS_API_FOR_CATS_NAV_MENU ),
68
  'flatsome' => array( Ecwid_Theme_Base::PROP_USE_JS_API_FOR_CATS_NAV_MENU ),
69
  'Divi' => array( Ecwid_Theme_Base::PROP_USE_JS_API_FOR_CATS_NAV_MENU ),
70
- 'themify-music' => array( Ecwid_Theme_Base::PROP_AJAX_DEFER_RENDERING )
 
 
71
  );
72
  $generic_themes = apply_filters('ecwid_generic_themes', $generic_themes);
73
 
@@ -83,7 +84,8 @@ function ecwid_apply_theme($theme_name = null)
83
  'trend',
84
  'Boundless',
85
  'twentyseventeen',
86
- 'themify-music'
 
87
  );
88
 
89
  $custom_themes = apply_filters( 'ecwid_custom_themes', $custom_themes );
64
  'newsmag' => array( 'css-no-parent'),
65
  'optimizer' => array( 'css' ),
66
  'businesso' => array( 'css' ),
 
67
  'flatsome' => array( Ecwid_Theme_Base::PROP_USE_JS_API_FOR_CATS_NAV_MENU ),
68
  'Divi' => array( Ecwid_Theme_Base::PROP_USE_JS_API_FOR_CATS_NAV_MENU ),
69
+ 'themify-music' => array( Ecwid_Theme_Base::PROP_AJAX_DEFER_RENDERING ),
70
+ 'bridge' => array( Ecwid_Theme_Base::PROP_AJAX_DEFER_RENDERING ),
71
+ 'Parallax-One' => array( 'css' )
72
  );
73
  $generic_themes = apply_filters('ecwid_generic_themes', $generic_themes);
74
 
84
  'trend',
85
  'Boundless',
86
  'twentyseventeen',
87
+ 'themify-music',
88
+ 'avada'
89
  );
90
 
91
  $custom_themes = apply_filters( 'ecwid_custom_themes', $custom_themes );
includes/themes/class-ecwid-theme-avada.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once ECWID_THEMES_DIR . '/class-ecwid-theme-base.php';
4
+
5
+ class Ecwid_Theme_Avada extends Ecwid_Theme_Base
6
+ {
7
+ protected $name = 'Avada';
8
+
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+
13
+ add_filter( Ecwid_Nav_Menus::FILTER_USE_JS_API_FOR_CATS_MENU, array( $this, 'filter_use_js_api_for_cats_menu' ) );
14
+ add_filter( 'ecwid_shortcode_content', array( $this, 'shortcode_content' ) );
15
+ }
16
+
17
+ public function shortcode_content( $content )
18
+ {
19
+ $content .= <<<HTML
20
+ <script type="text/javascript">
21
+ Ecwid.OnPageLoaded.add( function() {
22
+ if (typeof niceScrollReInit == 'function') {
23
+ niceScrollReInit();
24
+ }
25
+ }
26
+ );</script>
27
+ HTML;
28
+ return $content;
29
+ }
30
+ }
31
+
32
+ $ecwid_current_theme = new Ecwid_Theme_Avada();
includes/themes/class-ecwid-theme-base.php CHANGED
@@ -86,17 +86,18 @@ class Ecwid_Theme_Base {
86
 
87
  protected function add_css( $parent = null ) {
88
 
 
89
  if (is_null($parent)) {
90
- $parent = array( $this->name . '-style' );
91
  } else if (empty($parent)) {
92
  $parent = array();
93
  } else {
94
  $parent = array( $parent );
95
  }
96
-
97
  wp_enqueue_style(
98
  'ecwid-theme-css',
99
- ECWID_PLUGIN_URL . 'css/themes/' . $this->name . '.css',
100
  $parent,
101
  get_option('ecwid_plugin_version')
102
  );
86
 
87
  protected function add_css( $parent = null ) {
88
 
89
+ $name = strtolower( $this->name );
90
  if (is_null($parent)) {
91
+ $parent = array( $name . '-style' );
92
  } else if (empty($parent)) {
93
  $parent = array();
94
  } else {
95
  $parent = array( $parent );
96
  }
97
+
98
  wp_enqueue_style(
99
  'ecwid-theme-css',
100
+ ECWID_PLUGIN_URL . 'css/themes/' . $name . '.css',
101
  $parent,
102
  get_option('ecwid_plugin_version')
103
  );
includes/widgets/class-ecwid-widget-badge.php CHANGED
@@ -1,11 +1,15 @@
1
  <?php
2
 
3
- class Ecwid_Widget_Badge extends WP_Widget {
 
 
4
 
5
  var $url_template = "https://dj925myfyz5v.cloudfront.net/badges/%s.png";
6
  var $available_badges;
7
 
8
  function __construct() {
 
 
9
  $widget_ops = array('classname' => 'widget_ecwid_badge', 'description' => __("Do you like Ecwid and want to help it grow? You can add this fancy 'Powered by Ecwid' badge on your site to show your visitors that you're a proud user of Ecwid.", 'ecwid-shopping-cart') );
10
  parent::__construct('ecwidbadge', __('Ecwid Badge', 'ecwid-shopping-cart'), $widget_ops);
11
 
@@ -72,20 +76,21 @@ class Ecwid_Widget_Badge extends WP_Widget {
72
  )
73
  );
74
  }
75
-
76
- function widget($args, $instance)
77
- {
78
- extract($args);
79
 
80
  if (!isset($instance['badge_id']) || !array_key_exists($instance['badge_id'], $this->available_badges)) {
81
  return;
82
  }
 
83
  $badge = $this->available_badges[$instance['badge_id']];
84
  $url = sprintf($this->url_template, $badge['name']);
85
 
86
- echo $before_widget;
 
 
87
 
88
- echo <<<HTML
89
  <div>
90
  <a target="_blank" rel="nofollow" href="http://www.ecwid.com?source=wporg-badge">
91
  <img src="$url" width="$badge[width]" height="$badge[height]" alt="$badge[alt]" />
@@ -93,9 +98,8 @@ class Ecwid_Widget_Badge extends WP_Widget {
93
  </div>
94
  HTML;
95
 
96
- echo $after_widget;
97
  }
98
-
99
  function update($new_instance, $old_instance){
100
  $instance = $old_instance;
101
  $instance['badge_id'] =
1
  <?php
2
 
3
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
4
+
5
+ class Ecwid_Widget_Badge extends Ecwid_Widget_Base {
6
 
7
  var $url_template = "https://dj925myfyz5v.cloudfront.net/badges/%s.png";
8
  var $available_badges;
9
 
10
  function __construct() {
11
+ $this->_hide_title = true;
12
+
13
  $widget_ops = array('classname' => 'widget_ecwid_badge', 'description' => __("Do you like Ecwid and want to help it grow? You can add this fancy 'Powered by Ecwid' badge on your site to show your visitors that you're a proud user of Ecwid.", 'ecwid-shopping-cart') );
14
  parent::__construct('ecwidbadge', __('Ecwid Badge', 'ecwid-shopping-cart'), $widget_ops);
15
 
76
  )
77
  );
78
  }
79
+
80
+ protected function _render_widget_content( $args, $instance ) {
 
 
81
 
82
  if (!isset($instance['badge_id']) || !array_key_exists($instance['badge_id'], $this->available_badges)) {
83
  return;
84
  }
85
+
86
  $badge = $this->available_badges[$instance['badge_id']];
87
  $url = sprintf($this->url_template, $badge['name']);
88
 
89
+ if (!isset($instance['badge_id']) || !array_key_exists($instance['badge_id'], $this->available_badges)) {
90
+ return;
91
+ }
92
 
93
+ return <<<HTML
94
  <div>
95
  <a target="_blank" rel="nofollow" href="http://www.ecwid.com?source=wporg-badge">
96
  <img src="$url" width="$badge[width]" height="$badge[height]" alt="$badge[alt]" />
98
  </div>
99
  HTML;
100
 
 
101
  }
102
+
103
  function update($new_instance, $old_instance){
104
  $instance = $old_instance;
105
  $instance['badge_id'] =
includes/widgets/class-ecwid-widget-base.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Ecwid_Widget_Base extends WP_Widget {
4
+
5
+ protected $_hide_title = false;
6
+
7
+ abstract protected function _render_widget_content( $args, $instance );
8
+
9
+ public function widget( $args, $instance ) {
10
+
11
+ $before_widget = $before_title = $after_title = $after_widget = '';
12
+ extract($args);
13
+
14
+ $renderer = apply_filters( 'ecwid_get_custom_widget_renderer', null );
15
+
16
+ if ( !is_null( $renderer ) ) {
17
+ $content = call_user_func_array( $renderer, array( $this, $args, $instance ) );
18
+ } else {
19
+ $content = $this->_render_widget_content( $args, $instance );
20
+ }
21
+
22
+ if ( empty($content ) ) {
23
+ return;
24
+ }
25
+
26
+ echo $before_widget;
27
+ if ( !$this->_hide_title ) {
28
+
29
+ $title = '&nbsp;';
30
+ if ( isset( $instance['title'] ) && !empty( $instance['title'] ) ) {
31
+ $title = $instance['title'];
32
+ }
33
+
34
+ $title = apply_filters( 'widget_title', $title );
35
+
36
+
37
+ if ( $title ) {
38
+ echo $before_title . $title . $after_title;
39
+ }
40
+ }
41
+
42
+ echo $content;
43
+
44
+ echo $after_widget;
45
+ }
46
+ }
includes/widgets/class-ecwid-widget-floating-shopping-cart.php CHANGED
@@ -1,5 +1,9 @@
1
  <?php
2
- class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
 
 
 
 
3
  static $was_enqueued = false;
4
 
5
  static protected $positions = array(
@@ -55,7 +59,8 @@ class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
55
  return $classes;
56
  }
57
 
58
- public function widget($args, $instance) {
 
59
  }
60
 
61
  public function render() {
1
  <?php
2
+
3
+
4
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
5
+
6
+ class Ecwid_Widget_Floating_Shopping_Cart extends Ecwid_Widget_Base {
7
  static $was_enqueued = false;
8
 
9
  static protected $positions = array(
59
  return $classes;
60
  }
61
 
62
+ protected function _render_widget_content( $args, $instance ) {
63
+ return '';
64
  }
65
 
66
  public function render() {
includes/widgets/class-ecwid-widget-minicart-miniview.php CHANGED
@@ -1,32 +1,29 @@
1
  <?php
2
- class Ecwid_Widget_Minicart_Miniview extends WP_Widget {
 
 
 
3
 
4
  function __construct() {
5
  $widget_ops = array('classname' => 'widget_ecwid_minicart_miniview', 'description' => __("Adds a compact cart widget for customer to see the products they added to the cart.", 'ecwid-shopping-cart') );
6
  parent::__construct('ecwidminicart_miniview', __('Shopping Cart Mini (deprecated)', 'ecwid-shopping-cart'), $widget_ops);
7
  }
8
 
9
- function widget($args, $instance) {
10
- extract($args);
11
- $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
12
-
13
- echo $before_widget;
14
-
15
- if ( $title )
16
- echo $before_title . $title . $after_title;
17
 
 
18
 
19
- echo '<div>';
20
- echo '<!-- noptimize -->';
21
 
22
- echo ecwid_get_scriptjs_code();
23
- echo ecwid_get_product_browser_url_script();
24
- echo '<script data-cfasync="false" type="text/javascript"> xMinicart("style=left:10px","layout=Mini"); </script>';
25
 
26
- echo '<!-- /noptimize -->';
27
- echo '</div>';
28
 
29
- echo $after_widget;
30
  }
31
 
32
  function update($new_instance, $old_instance){
1
  <?php
2
+
3
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
4
+
5
+ class Ecwid_Widget_Minicart_Miniview extends Ecwid_Widget_Base {
6
 
7
  function __construct() {
8
  $widget_ops = array('classname' => 'widget_ecwid_minicart_miniview', 'description' => __("Adds a compact cart widget for customer to see the products they added to the cart.", 'ecwid-shopping-cart') );
9
  parent::__construct('ecwidminicart_miniview', __('Shopping Cart Mini (deprecated)', 'ecwid-shopping-cart'), $widget_ops);
10
  }
11
 
12
+ function _render_widget_content( $args, $instance ) {
 
 
 
 
 
 
 
13
 
14
+ $html = '';
15
 
16
+ $html .= '<div>';
17
+ $html .= '<!-- noptimize -->';
18
 
19
+ $html .= ecwid_get_scriptjs_code();
20
+ $html .= ecwid_get_product_browser_url_script();
21
+ $html .= '<script data-cfasync="false" type="text/javascript"> xMinicart("style=left:10px","layout=Mini"); </script>';
22
 
23
+ $html .= '<!-- /noptimize -->';
24
+ $html .= '</div>';
25
 
26
+ return $html;
27
  }
28
 
29
  function update($new_instance, $old_instance){
includes/widgets/class-ecwid-widget-minicart.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
- class Ecwid_Widget_Minicart extends WP_Widget {
 
 
 
3
 
4
  function __construct() {
5
  $widget_ops = array('classname' => 'widget_ecwid_minicart', 'description' => __("Adds a cart widget for customer to see the products they added to the cart.", 'ecwid-shopping-cart') );
@@ -7,26 +10,20 @@ class Ecwid_Widget_Minicart extends WP_Widget {
7
 
8
  }
9
 
10
- function widget($args, $instance) {
11
- extract($args);
12
- $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
13
-
14
- echo $before_widget;
15
-
16
- if ( $title )
17
- echo $before_title . $title . $after_title;
18
 
 
19
  echo '<div>';
20
 
21
- echo '<!-- noptimize -->';
22
- echo ecwid_get_scriptjs_code();
23
- echo ecwid_get_product_browser_url_script();
24
- echo '<script data-cfasync="false" type="text/javascript"> xMinicart("style="); </script>';
25
 
26
- echo '<!-- /noptimize -->';
27
- echo '</div>';
28
 
29
- echo $after_widget;
30
  }
31
 
32
  function update($new_instance, $old_instance){
1
  <?php
2
+
3
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
4
+
5
+ class Ecwid_Widget_Minicart extends Ecwid_Widget_Base {
6
 
7
  function __construct() {
8
  $widget_ops = array('classname' => 'widget_ecwid_minicart', 'description' => __("Adds a cart widget for customer to see the products they added to the cart.", 'ecwid-shopping-cart') );
10
 
11
  }
12
 
13
+ function _render_widget_content( $args, $instance ) {
 
 
 
 
 
 
 
14
 
15
+ $html = '';
16
  echo '<div>';
17
 
18
+ $html .= '<!-- noptimize -->';
19
+ $html .= ecwid_get_scriptjs_code();
20
+ $html .= ecwid_get_product_browser_url_script();
21
+ $html .= '<script data-cfasync="false" type="text/javascript"> xMinicart("style="); </script>';
22
 
23
+ $html .= '<!-- /noptimize -->';
24
+ $html .= '</div>';
25
 
26
+ return $html;
27
  }
28
 
29
  function update($new_instance, $old_instance){
includes/widgets/class-ecwid-widget-nsf-minicart.php CHANGED
@@ -1,7 +1,9 @@
1
  <?php
2
 
 
 
3
  // nsf stands for new storefront I guess
4
- class Ecwid_Widget_NSF_Minicart extends WP_Widget {
5
 
6
  protected $__idbase;
7
 
@@ -19,7 +21,7 @@ class Ecwid_Widget_NSF_Minicart extends WP_Widget {
19
 
20
  }
21
 
22
- function widget($args, $instance) {
23
  extract($args);
24
 
25
  $instance = wp_parse_args( (array) $instance, array(
@@ -29,20 +31,17 @@ class Ecwid_Widget_NSF_Minicart extends WP_Widget {
29
  self::FIELD_FIXED_SHAPE => 'RECT'
30
  ) );
31
 
32
- $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
33
-
34
- echo $before_widget;
35
-
36
- if ( $title )
37
- echo $before_title . $title . $after_title;
38
-
39
- echo '<div>';
40
 
 
41
  require 'nsf-minicart.tpl.php';
 
 
42
 
43
- echo '</div>';
44
 
45
- echo $after_widget;
46
  }
47
 
48
  function update($new_instance, $old_instance) {
1
  <?php
2
 
3
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
4
+
5
  // nsf stands for new storefront I guess
6
+ class Ecwid_Widget_NSF_Minicart extends Ecwid_Widget_Base {
7
 
8
  protected $__idbase;
9
 
21
 
22
  }
23
 
24
+ function _render_widget_content( $args, $instance ) {
25
  extract($args);
26
 
27
  $instance = wp_parse_args( (array) $instance, array(
31
  self::FIELD_FIXED_SHAPE => 'RECT'
32
  ) );
33
 
34
+ $html = '';
35
+ $html .= '<div>';
 
 
 
 
 
 
36
 
37
+ ob_start();
38
  require 'nsf-minicart.tpl.php';
39
+ $html .= ob_get_contents();
40
+ ob_end_clean();
41
 
42
+ $html .= '</div>';
43
 
44
+ return $html;
45
  }
46
 
47
  function update($new_instance, $old_instance) {
includes/widgets/class-ecwid-widget-products-base.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
 
3
- class Ecwid_Widget_Products_List_Base extends WP_Widget {
 
 
4
 
5
  protected $_max = 10;
6
  protected $_min = 1;
@@ -15,6 +17,8 @@ class Ecwid_Widget_Products_List_Base extends WP_Widget {
15
 
16
  protected $_widget_class = 'productsList';
17
 
 
 
18
  public function __construct() {
19
 
20
  $id_base = str_replace('_', '', $this->_widget_name);
@@ -53,37 +57,28 @@ class Ecwid_Widget_Products_List_Base extends WP_Widget {
53
  }
54
  }
55
 
56
- function widget($args, $instance) {
57
 
58
  $this->_args = $args;
59
  $this->_instance = $instance;
60
 
61
- // for the sake of phpstorm sanity about undefined vars
62
- $before_widget = $before_title = $after_title = $after_widget = '';
63
- extract($args);
64
-
65
- $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
66
-
67
- echo $before_widget;
68
-
69
- if ( $title ) {
70
- echo $before_title . $title . $after_title;
71
- }
72
-
73
- echo '<!-- noptimize -->' . ecwid_get_scriptjs_code() . '<!-- /noptimize -->';
74
 
75
- echo '<div class="' . $this->_class_name . '" data-ecwid-max="' . $instance['number_of_products'] . '">';
76
 
77
  $counter = 1;
78
  $ids = array();
79
 
80
- $this->_print_widget_content($instance);
81
- echo '</div>';
 
 
82
 
83
- echo $after_widget;
84
  }
85
 
86
- protected function _print_widget_content()
87
  {
88
  $products = $this->_get_products();
89
 
@@ -191,7 +186,7 @@ HTML;
191
  }
192
 
193
  function is_valid_number_of_products($num) {
194
- return is_numeric($num) && $num <= $this->max && $num >= $this->min;
195
  }
196
 
197
  protected function _get_form_fields()
1
  <?php
2
 
3
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
4
+
5
+ abstract class Ecwid_Widget_Products_List_Base extends Ecwid_Widget_Base {
6
 
7
  protected $_max = 10;
8
  protected $_min = 1;
17
 
18
  protected $_widget_class = 'productsList';
19
 
20
+ abstract protected function _get_products();
21
+
22
  public function __construct() {
23
 
24
  $id_base = str_replace('_', '', $this->_widget_name);
57
  }
58
  }
59
 
60
+ function _render_widget_content( $args, $instance ) {
61
 
62
  $this->_args = $args;
63
  $this->_instance = $instance;
64
 
65
+ $html = '';
66
+ $html .= '<!-- noptimize -->' . ecwid_get_scriptjs_code() . '<!-- /noptimize -->';
 
 
 
 
 
 
 
 
 
 
 
67
 
68
+ $html .= '<div class="' . $this->_class_name . '" data-ecwid-max="' . $instance['number_of_products'] . '">';
69
 
70
  $counter = 1;
71
  $ids = array();
72
 
73
+ ob_start();
74
+ $this->_print_widget_content( $instance );
75
+ $html .= ob_get_contents();
76
+ ob_end_clean();
77
 
78
+ return $html;
79
  }
80
 
81
+ protected function _print_widget_content( $instance )
82
  {
83
  $products = $this->_get_products();
84
 
186
  }
187
 
188
  function is_valid_number_of_products($num) {
189
+ return is_numeric($num) && $num <= $this->_max && $num >= $this->_min;
190
  }
191
 
192
  protected function _get_form_fields()
includes/widgets/class-ecwid-widget-random-product.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
- class Ecwid_Widget_Random_Product extends WP_Widget {
 
 
 
3
 
4
  function __construct() {
5
  $widget_ops = array('classname' => 'widget_ecwid_random_product', 'description' => __("Displays a random product from your store to attract customer attention.", 'ecwid-shopping-cart') );
@@ -7,17 +10,14 @@ class Ecwid_Widget_Random_Product extends WP_Widget {
7
 
8
  }
9
 
10
- function widget($args, $instance) {
11
- extract($args);
12
- $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
13
-
14
  $product = Ecwid_Product::get_random_product();
15
 
16
  if (! $product ) {
17
- return;
18
  }
19
 
20
- $name = esc_attr($product->name);
21
 
22
  $url = $product->link;
23
 
@@ -35,22 +35,17 @@ class Ecwid_Widget_Random_Product extends WP_Widget {
35
  <script type="text/javascript">xProduct()</script>
36
  HTML;
37
 
38
-
39
- echo $before_widget;
40
-
41
- if ( $title )
42
- echo $before_title . $title . $after_title;
43
-
44
- echo '<div>';
45
 
46
- echo '<!-- noptimize -->';
47
- echo ecwid_get_scriptjs_code();
48
- echo $content;
49
 
50
- echo '<!-- /noptimize -->';
51
- echo '</div>';
52
 
53
- echo $after_widget;
54
  }
55
 
56
  function update($new_instance, $old_instance){
1
  <?php
2
+
3
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
4
+
5
+ class Ecwid_Widget_Random_Product extends Ecwid_Widget_Base {
6
 
7
  function __construct() {
8
  $widget_ops = array('classname' => 'widget_ecwid_random_product', 'description' => __("Displays a random product from your store to attract customer attention.", 'ecwid-shopping-cart') );
10
 
11
  }
12
 
13
+ function _render_widget_content( $args, $instance ) {
 
 
 
14
  $product = Ecwid_Product::get_random_product();
15
 
16
  if (! $product ) {
17
+ return '';
18
  }
19
 
20
+ $name = esc_attr( $product->name );
21
 
22
  $url = $product->link;
23
 
35
  <script type="text/javascript">xProduct()</script>
36
  HTML;
37
 
38
+ $html = '';
39
+ $html .= '<div>';
 
 
 
 
 
40
 
41
+ $html .= '<!-- noptimize -->';
42
+ $html .= ecwid_get_scriptjs_code();
43
+ $html .= $content;
44
 
45
+ $html .= '<!-- /noptimize -->';
46
+ $html .= '</div>';
47
 
48
+ return $html;
49
  }
50
 
51
  function update($new_instance, $old_instance){
includes/widgets/class-ecwid-widget-random-products.php CHANGED
@@ -1,6 +1,5 @@
1
  <?php
2
 
3
-
4
  require_once dirname(__FILE__) . '/class-ecwid-widget-products-base.php';
5
 
6
  class Ecwid_Widget_Random_Products extends Ecwid_Widget_Products_List_Base {
1
  <?php
2
 
 
3
  require_once dirname(__FILE__) . '/class-ecwid-widget-products-base.php';
4
 
5
  class Ecwid_Widget_Random_Products extends Ecwid_Widget_Products_List_Base {
includes/widgets/class-ecwid-widget-recently-viewed.php CHANGED
@@ -66,12 +66,6 @@ class Ecwid_Widget_Recently_Viewed extends Ecwid_Widget_Products_List_Base {
66
 
67
  return array_reverse($recently_viewed->products);
68
  }
69
-
70
- protected function _print_widget_content()
71
- {
72
- parent::_print_widget_content();
73
- $products = $this->_get_products();
74
- }
75
 
76
  protected function _print_no_products()
77
  {
66
 
67
  return array_reverse($recently_viewed->products);
68
  }
 
 
 
 
 
 
69
 
70
  protected function _print_no_products()
71
  {
includes/widgets/class-ecwid-widget-search.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
- class Ecwid_Widget_Search extends WP_Widget {
 
 
 
3
 
4
  static public function is_active_widget() {
5
  return is_active_widget(false, false, 'ecwidsearch');
@@ -10,28 +13,22 @@ class Ecwid_Widget_Search extends WP_Widget {
10
  parent::__construct('ecwidsearch', __('Product Search', 'ecwid-shopping-cart'), $widget_ops);
11
  }
12
 
13
- function widget($args, $instance) {
14
- extract($args);
15
- $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
16
-
17
- echo $before_widget;
18
-
19
- if ( $title )
20
- echo $before_title . $title . $after_title;
21
-
22
- echo '<div>';
23
- echo '<!-- noptimize -->';
24
 
25
- echo ecwid_get_scriptjs_code();
26
- echo ecwid_get_product_browser_url_script();
27
 
28
  $code = ecwid_get_search_js_code();
29
- echo '<script data-cfasync="false" type="text/javascript"> ' . $code . ' </script>';
30
 
31
- echo '<!-- /noptimize -->';
32
- echo '</div>';
33
 
34
- echo $after_widget;
35
  }
36
 
37
  function update($new_instance, $old_instance){
1
  <?php
2
+
3
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
4
+
5
+ class Ecwid_Widget_Search extends Ecwid_Widget_Base {
6
 
7
  static public function is_active_widget() {
8
  return is_active_widget(false, false, 'ecwidsearch');
13
  parent::__construct('ecwidsearch', __('Product Search', 'ecwid-shopping-cart'), $widget_ops);
14
  }
15
 
16
+ function _render_widget_content( $args, $instance ) {
17
+
18
+ $html = '';
19
+ $html .= '<div>';
20
+ $html .= '<!-- noptimize -->';
 
 
 
 
 
 
21
 
22
+ $html .= ecwid_get_scriptjs_code();
23
+ $html .= ecwid_get_product_browser_url_script();
24
 
25
  $code = ecwid_get_search_js_code();
26
+ $html .= '<script data-cfasync="false" type="text/javascript"> ' . $code . ' </script>';
27
 
28
+ $html .= '<!-- /noptimize -->';
29
+ $html .= '</div>';
30
 
31
+ return $html;
32
  }
33
 
34
  function update($new_instance, $old_instance){
includes/widgets/class-ecwid-widget-store-link.php CHANGED
@@ -1,21 +1,23 @@
1
  <?php
2
- class Ecwid_Widget_Store_Link extends WP_Widget {
 
 
 
3
 
4
  function __construct() {
 
5
  $widget_ops = array('classname' => 'widget_ecwid_store_link', 'description' => __('Displays a link to the store page in sidebar for customer to quickly access your store from any page on the site.', 'ecwid-shopping-cart'));
6
  parent::__construct('ecwidstorelink', __('Store Page Link', 'ecwid-shopping-cart'), $widget_ops);
7
  }
8
 
9
- function widget($args, $instance) {
10
- extract($args);
11
- echo $before_widget;
12
-
13
- echo '<div>';
14
 
15
- echo '<a href="' . Ecwid_Store_Page::get_store_url() . '" data-ecwid-page="/">' . $instance['label'] . '</a>';
16
- echo '</div>';
17
 
18
- echo $after_widget;
19
  }
20
 
21
  function update($new_instance, $old_instance){
1
  <?php
2
+
3
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
4
+
5
+ class Ecwid_Widget_Store_Link extends Ecwid_Widget_Base {
6
 
7
  function __construct() {
8
+ $this->_hide_title = true;
9
  $widget_ops = array('classname' => 'widget_ecwid_store_link', 'description' => __('Displays a link to the store page in sidebar for customer to quickly access your store from any page on the site.', 'ecwid-shopping-cart'));
10
  parent::__construct('ecwidstorelink', __('Store Page Link', 'ecwid-shopping-cart'), $widget_ops);
11
  }
12
 
13
+ function _render_widget_content( $args, $instance ) {
14
+
15
+ $html = '<div>';
 
 
16
 
17
+ $html .= '<a href="' . Ecwid_Store_Page::get_store_url() . '" data-ecwid-page="/">' . $instance['label'] . '</a>';
18
+ $html .= '</div>';
19
 
20
+ return $html;
21
  }
22
 
23
  function update($new_instance, $old_instance){
includes/widgets/class-ecwid-widget-vcategories.php CHANGED
@@ -1,31 +1,27 @@
1
  <?php
2
- class Ecwid_Widget_VCategories extends WP_Widget {
 
 
 
3
 
4
  function __construct() {
5
  $widget_ops = array('classname' => 'widget_ecwid_vcategories', 'description' => __('Adds vertical categories block to let the customer navigate your store.', 'ecwid-shopping-cart'));
6
  parent::__construct('ecwidvcategories', __('Store Categories', 'ecwid-shopping-cart'), $widget_ops);
7
  }
8
 
9
- function widget($args, $instance) {
10
- extract($args);
11
- $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
12
-
13
- echo $before_widget;
14
-
15
- if ( $title )
16
- echo $before_title . $title . $after_title;
17
-
18
- echo '<div>';
19
- echo '<!-- noptimize -->';
20
 
21
- echo ecwid_get_scriptjs_code();
22
- echo ecwid_get_product_browser_url_script();
23
- echo '<script data-cfasync="false" type="text/javascript"> xVCategories("style="); </script>';
24
 
25
- echo '<!-- /noptimize -->';
26
- echo '</div>';
27
 
28
- echo $after_widget;
29
  }
30
 
31
  function update($new_instance, $old_instance){
1
  <?php
2
+
3
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
4
+
5
+ class Ecwid_Widget_VCategories extends Ecwid_Widget_Base {
6
 
7
  function __construct() {
8
  $widget_ops = array('classname' => 'widget_ecwid_vcategories', 'description' => __('Adds vertical categories block to let the customer navigate your store.', 'ecwid-shopping-cart'));
9
  parent::__construct('ecwidvcategories', __('Store Categories', 'ecwid-shopping-cart'), $widget_ops);
10
  }
11
 
12
+ function _render_widget_content( $args, $instance ) {
13
+
14
+ $html = '<div>';
15
+ $html .= '<!-- noptimize -->';
 
 
 
 
 
 
 
16
 
17
+ $html .= ecwid_get_scriptjs_code();
18
+ $html .= ecwid_get_product_browser_url_script();
19
+ $html .= '<script data-cfasync="false" type="text/javascript"> xVCategories("style="); </script>';
20
 
21
+ $html .= '<!-- /noptimize -->';
22
+ $html .= '</div>';
23
 
24
+ return $html;
25
  }
26
 
27
  function update($new_instance, $old_instance){
includes/widgets/class-ecwid-widget-vertical-categories-list.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
- class Ecwid_Widget_Vertical_Categories_List extends WP_Widget {
 
 
 
3
 
4
  /**
5
  * Sets up a new Meta widget instance.
@@ -12,39 +15,32 @@ class Ecwid_Widget_Vertical_Categories_List extends WP_Widget {
12
  parent::__construct( 'ecwidvcategorieslist', __('Store Root Categories', 'ecwid-shopping-cart' ), $widget_ops);
13
  }
14
 
15
- public function widget( $args, $instance ) {
16
 
17
  $api = new Ecwid_Api_V3();
18
 
19
  $result = $api->get_categories(array( 'parent' => 0 ) );
20
 
21
- if ( !$result || empty( $result->items ) ) return;
22
 
23
  $categories = $result->items;
24
  usort( $categories, Ecwid_Category::usort_callback() );
25
 
26
- /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
27
- $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Browse by Category', 'ecwid-shopping-cart' ) : $instance['title'], $instance, $this->id_base );
28
-
29
- echo $args['before_widget'];
30
- if ( $title ) {
31
- echo $args['before_title'] . $title . $args['after_title'];
32
- }
33
-
34
- echo '<ul>';
35
 
36
  foreach ($categories as $category) {
37
  $category = Ecwid_Category::get_by_id( $category->id );
38
- echo '<li>';
39
- echo '<a href="' . $category->link
40
  . '" data-ecwid-page="category" data-ecwid-category-id="' . $category->id . '">'
41
  . $category->name
42
  . '</a>';
43
- echo '</li>';
44
  }
45
 
46
- echo '</ul>';
47
- echo $args['after_widget'];
 
48
  }
49
 
50
  /**
1
  <?php
2
+
3
+ require_once ECWID_PLUGIN_DIR . '/includes/widgets/class-ecwid-widget-base.php';
4
+
5
+ class Ecwid_Widget_Vertical_Categories_List extends Ecwid_Widget_Base {
6
 
7
  /**
8
  * Sets up a new Meta widget instance.
15
  parent::__construct( 'ecwidvcategorieslist', __('Store Root Categories', 'ecwid-shopping-cart' ), $widget_ops);
16
  }
17
 
18
+ public function _render_widget_content( $args, $instance ) {
19
 
20
  $api = new Ecwid_Api_V3();
21
 
22
  $result = $api->get_categories(array( 'parent' => 0 ) );
23
 
24
+ if ( !$result || empty( $result->items ) ) return "";
25
 
26
  $categories = $result->items;
27
  usort( $categories, Ecwid_Category::usort_callback() );
28
 
29
+ $html = '<ul>';
 
 
 
 
 
 
 
 
30
 
31
  foreach ($categories as $category) {
32
  $category = Ecwid_Category::get_by_id( $category->id );
33
+ $html .= '<li>';
34
+ $html .= '<a href="' . $category->link
35
  . '" data-ecwid-page="category" data-ecwid-category-id="' . $category->id . '">'
36
  . $category->name
37
  . '</a>';
38
+ $html .= '</li>';
39
  }
40
 
41
+ $html .= '</ul>';
42
+
43
+ return $html;
44
  }
45
 
46
  /**
js/admin-menu.js CHANGED
@@ -85,7 +85,7 @@ function ecwidAddSubmenu(items, parent) {
85
  $parentListItem.addClass('wp-has-current-submenu3');
86
  }
87
 
88
- for (var i in items) {
89
 
90
  var item = items[i];
91
  var $link = jQuery('<a>').text(item.title).attr('href', item.url);
@@ -112,7 +112,7 @@ function ecwidAddSubmenu(items, parent) {
112
  function ecwidAddMenuItems(items) {
113
 
114
  var prevItem = jQuery('#toplevel_page_ec-store .wp-submenu-head + li');
115
- for (var i in items) {
116
 
117
  if (!items.hasOwnProperty(i)) continue;
118
 
@@ -151,7 +151,7 @@ jQuery(document).ready(function() {
151
 
152
  if ( ecwid_admin_menu.enableAutoMenus ) {
153
 
154
- for (var i in ecwid_admin_menu.menu) {
155
 
156
  var menu = ecwid_admin_menu.menu[i];
157
 
85
  $parentListItem.addClass('wp-has-current-submenu3');
86
  }
87
 
88
+ for (var i = 0; i < items.length; i++) {
89
 
90
  var item = items[i];
91
  var $link = jQuery('<a>').text(item.title).attr('href', item.url);
112
  function ecwidAddMenuItems(items) {
113
 
114
  var prevItem = jQuery('#toplevel_page_ec-store .wp-submenu-head + li');
115
+ for (var i = 0; i < items.length; i++) {
116
 
117
  if (!items.hasOwnProperty(i)) continue;
118
 
151
 
152
  if ( ecwid_admin_menu.enableAutoMenus ) {
153
 
154
+ for (var i = 0; i < ecwid_admin_menu.menu.length; i++) {
155
 
156
  var menu = ecwid_admin_menu.menu[i];
157
 
js/gutenberg-store.js CHANGED
@@ -16,28 +16,27 @@
16
  }));
17
  }
18
 
 
 
 
 
 
 
 
 
 
 
19
  var ecwidStoreParams = {
20
  title: EcwidGutenbergParams.storeBlockTitle,
21
  icon: getIcon(),
22
  category: 'common',
23
- attributes: {
24
- widgets: { type: 'string' },
25
- categories_per_row: { type: 'integer' },
26
- grid: { type: 'string' },
27
- list: { type: 'integer' },
28
- table: { type: 'integer' },
29
- default_category_id: { type: 'integer' },
30
- default_product_id: { type: 'integer' },
31
- category_view: { type: 'string' },
32
- search_view: { type: 'string' },
33
- minicart_layout: {type: 'string' }
34
- },
35
  supports: {
36
  customClassName: false,
37
  className: false,
38
- html: false
 
39
  },
40
- useOnce: true,
41
 
42
  edit: function( props ) {
43
 
@@ -51,27 +50,45 @@
51
  el( 'button', { className: 'button ecwid-block-button', onClick: function() { ecwid_open_store_popup( props ); } }, EcwidGutenbergParams.editAppearance )
52
  )
53
  );
54
-
55
- return el( 'div', { className: 'ecwid-store-block' },
56
- el( 'button', { className: 'button button-primary ecwid-block-button', onClick: function() { ecwid_open_store_popup( props ); } }, i18n.__( 'Edit Appearance' ) )
57
- );
58
  },
59
  save: function( props ) {
60
-
61
- return false;
 
 
 
 
62
 
63
  var shortcode = new wp.shortcode({
64
  'tag': EcwidGutenbergParams.storeShortcodeName,
65
- 'attrs': props.attributes,
66
  'type': 'single'
67
  });
68
 
69
- return wp.blocks.serialize(
70
- wp.blocks.createBlock(EcwidGutenbergParams.storeBlock, props),
71
- el( element.RawHTML, null, shortcode.string() )
72
- );
73
  },
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  transforms: {
76
  from: [{
77
  type: 'shortcode',
16
  }));
17
  }
18
 
19
+ EcwidGutenbergParams.attributes = {
20
+ widgets: { type: 'string', default: 'productbrowser' },
21
+ default_category_id: { type: 'integer', default: 0 },
22
+ default_product_id: { type: 'integer', default: 0 }
23
+ };
24
+
25
+ // Cuz save knows nothing about the original params object, and I need to know the exact original attributes order
26
+ // Cuz their validation routine sucks and does not allow a tiny little difference between expected and actual block content
27
+ EcwidGutenbergParams.ownAttributes = Object.assign({}, EcwidGutenbergParams.attributes);
28
+
29
  var ecwidStoreParams = {
30
  title: EcwidGutenbergParams.storeBlockTitle,
31
  icon: getIcon(),
32
  category: 'common',
33
+ attributes: EcwidGutenbergParams.attributes,
 
 
 
 
 
 
 
 
 
 
 
34
  supports: {
35
  customClassName: false,
36
  className: false,
37
+ html: false,
38
+ multiple: false
39
  },
 
40
 
41
  edit: function( props ) {
42
 
50
  el( 'button', { className: 'button ecwid-block-button', onClick: function() { ecwid_open_store_popup( props ); } }, EcwidGutenbergParams.editAppearance )
51
  )
52
  );
 
 
 
 
53
  },
54
  save: function( props ) {
55
+ var shortcodeAttributes = {};
56
+ for ( var i in EcwidGutenbergParams.ownAttributes ) {
57
+ if ( EcwidGutenbergParams.ownAttributes.hasOwnProperty(i) ) {
58
+ shortcodeAttributes[i] = props.attributes[i];
59
+ }
60
+ }
61
 
62
  var shortcode = new wp.shortcode({
63
  'tag': EcwidGutenbergParams.storeShortcodeName,
64
+ 'attrs': shortcodeAttributes,
65
  'type': 'single'
66
  });
67
 
68
+ return shortcode.string();
 
 
 
69
  },
70
 
71
+ deprecated: [
72
+ {
73
+ attributes: {
74
+ widgets: { type: 'string' },
75
+ categories_per_row: { type: 'integer' },
76
+ grid: { type: 'string' },
77
+ list: { type: 'integer' },
78
+ table: { type: 'integer' },
79
+ default_category_id: { type: 'integer' },
80
+ default_product_id: { type: 'integer' },
81
+ category_view: { type: 'string' },
82
+ search_view: { type: 'string' },
83
+ minicart_layout: {type: 'string' }
84
+ },
85
+
86
+ save: function( props ) {
87
+ return null;
88
+ },
89
+ }
90
+ ],
91
+
92
  transforms: {
93
  from: [{
94
  type: 'shortcode',
js/importer.js CHANGED
@@ -150,12 +150,13 @@ jQuery(document).ready(function() {
150
  }
151
  };
152
 
153
- jQuery('#ecwid-importer-woo-go').click(startWooImport);
154
-
155
- jQuery('.ecwid-importer .errors .btn-details').click(function() {
156
- jQuery('.ecwid-importer .errors .details').toggle();
157
- });
158
-
 
159
  if (window.location.hash.indexOf('start') != -1) {
160
 
161
  var params = location.hash.split('&');
@@ -170,6 +171,8 @@ jQuery(document).ready(function() {
170
  }
171
  }
172
 
 
 
173
  startWooImport();
174
  }
175
  });
150
  }
151
  };
152
 
153
+ jQuery('#ecwid-importer-woo-go').click(startWooImport);
154
+
155
+ jQuery('.ecwid-importer .errors .btn-details').click(function() {
156
+ jQuery('.ecwid-importer .errors .details').toggle();
157
+ });
158
+
159
+
160
  if (window.location.hash.indexOf('start') != -1) {
161
 
162
  var params = location.hash.split('&');
171
  }
172
  }
173
 
174
+ window.location.hash = '';
175
+
176
  startWooImport();
177
  }
178
  });
js/store-editor-gutenberg.js CHANGED
@@ -173,7 +173,7 @@ buildParams = function(attributes) {
173
 
174
  var widgets = attributes.widgets;
175
  if (typeof widgets == 'undefined') {
176
- widgets = "productbrowser search minicart";
177
  }
178
 
179
  widgets = widgets.split(/[^a-z^A-Z^0-9^-^_]/);
173
 
174
  var widgets = attributes.widgets;
175
  if (typeof widgets == 'undefined') {
176
+ widgets = "productbrowser";
177
  }
178
 
179
  widgets = widgets.split(/[^a-z^A-Z^0-9^-^_]/);
js/store-editor-page.js CHANGED
@@ -62,7 +62,7 @@ jQuery(document).ready(function() {
62
 
63
  var widgets = attributes.widgets;
64
  if (typeof widgets == 'undefined') {
65
- widgets = "productbrowser search";
66
  }
67
 
68
  widgets = widgets.split(/[^a-z^A-Z^0-9^-^_]/);
@@ -80,7 +80,7 @@ jQuery(document).ready(function() {
80
  'grid_columns': grid[2],
81
  'default_category_id': attributes.default_category_id,
82
  'default_product_id': attributes.default_product_id,
83
- 'minicart_layout': 'attachToCategories'
84
  };
85
 
86
  }
@@ -91,7 +91,7 @@ jQuery(document).ready(function() {
91
  */
92
  getDefaultParams = function() {
93
  return {
94
- 'show_search': true,
95
  'show_minicart': false,
96
  'show_categories': false,
97
  'categories_per_row': 3,
62
 
63
  var widgets = attributes.widgets;
64
  if (typeof widgets == 'undefined') {
65
+ widgets = "productbrowser";
66
  }
67
 
68
  widgets = widgets.split(/[^a-z^A-Z^0-9^-^_]/);
80
  'grid_columns': grid[2],
81
  'default_category_id': attributes.default_category_id,
82
  'default_product_id': attributes.default_product_id,
83
+ 'minicart_layout': 'MiniAttachToProductBrowser'
84
  };
85
 
86
  }
91
  */
92
  getDefaultParams = function() {
93
  return {
94
+ 'show_search': false,
95
  'show_minicart': false,
96
  'show_categories': false,
97
  'categories_per_row': 3,
lib/ecwid_api_v3.php CHANGED
@@ -30,7 +30,8 @@ class Ecwid_Api_V3
30
  }
31
 
32
  const FEATURE_NEW_PRODUCT_LIST = 'NEW_PRODUCT_LIST';
33
-
 
34
  public $store_id = null;
35
 
36
  protected static $profile = null;
@@ -228,6 +229,11 @@ class Ecwid_Api_V3
228
  }
229
 
230
  public function get_product( $product_id ) {
 
 
 
 
 
231
  $params = array('token');
232
 
233
  if ( !isset( $params['baseUrl'] ) ) {
@@ -476,6 +482,7 @@ class Ecwid_Api_V3
476
 
477
  public function get_store_profile() {
478
 
 
479
  $profile = EcwidPlatform::cache_get( self::PROFILE_CACHE_NAME );
480
 
481
  if ( $profile ) {
@@ -490,14 +497,14 @@ class Ecwid_Api_V3
490
 
491
  $url = $this->build_request_url($url, $params);
492
  $result = EcwidPlatform::fetch_url($url);
493
-
494
  if ( @$result['code'] == '403' ) {
495
  self::set_api_status( self::API_STATUS_ERROR_TOKEN );
496
  return false;
497
  }
498
 
499
  if ( self::get_api_status() == self::API_STATUS_OK && ( @$result['code'] != '200' || empty($result['data'] ) ) ) {
500
- update_option('ecwid_error_log', var_export( $result, true ) );
501
  self::set_api_status( self::API_STATUS_UNDEFINED );
502
  return false;
503
  }
@@ -654,6 +661,18 @@ class Ecwid_Api_V3
654
  return $result;
655
  }
656
 
 
 
 
 
 
 
 
 
 
 
 
 
657
  public function update_product( $params, $product_id ) {
658
  $request_params = array(
659
  'token'
@@ -777,6 +796,31 @@ class Ecwid_Api_V3
777
  return $result;
778
  }
779
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
  protected function _do_post( $url, $data, $raw = false ) {
781
  $result = wp_remote_post( $url,
782
  array(
@@ -849,4 +893,4 @@ class Ecwid_Api_V3
849
  }
850
  }
851
  }
852
- }
30
  }
31
 
32
  const FEATURE_NEW_PRODUCT_LIST = 'NEW_PRODUCT_LIST';
33
+ const FEATURE_VARIATIONS = 'COMBINATIONS';
34
+
35
  public $store_id = null;
36
 
37
  protected static $profile = null;
229
  }
230
 
231
  public function get_product( $product_id ) {
232
+
233
+ if ( !$product_id ) {
234
+ return false;
235
+ }
236
+
237
  $params = array('token');
238
 
239
  if ( !isset( $params['baseUrl'] ) ) {
482
 
483
  public function get_store_profile() {
484
 
485
+
486
  $profile = EcwidPlatform::cache_get( self::PROFILE_CACHE_NAME );
487
 
488
  if ( $profile ) {
497
 
498
  $url = $this->build_request_url($url, $params);
499
  $result = EcwidPlatform::fetch_url($url);
500
+
501
  if ( @$result['code'] == '403' ) {
502
  self::set_api_status( self::API_STATUS_ERROR_TOKEN );
503
  return false;
504
  }
505
 
506
  if ( self::get_api_status() == self::API_STATUS_OK && ( @$result['code'] != '200' || empty($result['data'] ) ) ) {
507
+ ecwid_log_error( var_export( $result, true ) );
508
  self::set_api_status( self::API_STATUS_UNDEFINED );
509
  return false;
510
  }
661
  return $result;
662
  }
663
 
664
+ public function create_product_variation( $params ) {
665
+ $request_params = array(
666
+ 'token'
667
+ );
668
+
669
+ $url = $this->build_request_url( $this->_products_api_url . '/' . $params['productId'] . '/combinations', $request_params );
670
+
671
+ $result = $this->_do_post( $url, $params );
672
+
673
+ return $result;
674
+ }
675
+
676
  public function update_product( $params, $product_id ) {
677
  $request_params = array(
678
  'token'
796
  return $result;
797
  }
798
 
799
+ public function upload_product_gallery_image( $params )
800
+ {
801
+ $request_params = array(
802
+ 'token'
803
+ );
804
+ $url = $this->build_request_url( $this->_products_api_url . '/' . $params['productId'] . '/gallery', $request_params );
805
+
806
+ $result = $this->_do_post( $url, $params['data'], true );
807
+
808
+ return $result;
809
+ }
810
+
811
+
812
+ public function upload_product_variation_image( $params )
813
+ {
814
+ $request_params = array(
815
+ 'token'
816
+ );
817
+ $url = $this->build_request_url( $this->_products_api_url . '/' . $params['productId'] . '/combinations/' . $params['variationId'] . '/image', $request_params );
818
+
819
+ $result = $this->_do_post( $url, $params['data'], true );
820
+
821
+ return $result;
822
+ }
823
+
824
  protected function _do_post( $url, $data, $raw = false ) {
825
  $result = wp_remote_post( $url,
826
  array(
893
  }
894
  }
895
  }
896
+ }
lib/html-catalog-templates/category.php CHANGED
@@ -10,7 +10,7 @@
10
 
11
  <?php if ( $categories ): foreach ( $categories as $category ): ?>
12
  <div class="category-<?php echo $category->id; ?>">
13
- <a href="<?php echo Ecwid_Store_Page::get_category_url( $category->id ); ?>">
14
  <?php echo EcwidPlatform::esc_html( $category->name ); ?>
15
  </a>
16
  </div>
@@ -21,7 +21,7 @@
21
  <?php $product = Ecwid_Product::get_by_id($product->id); ?>
22
  <div class="product-<?php echo $product->id; ?>">
23
  <span class="product-name">
24
- <a href="<?php echo $product->link; ?>">
25
  <?php echo EcwidPlatform::esc_html( $product->name ); ?>
26
  </a>
27
  </span>
10
 
11
  <?php if ( $categories ): foreach ( $categories as $category ): ?>
12
  <div class="category-<?php echo $category->id; ?>">
13
+ <a href="<?php $cat = Ecwid_Category::get_by_id( $category->id ); echo $cat->get_link( $this->store_base_url ); ?>">
14
  <?php echo EcwidPlatform::esc_html( $category->name ); ?>
15
  </a>
16
  </div>
21
  <?php $product = Ecwid_Product::get_by_id($product->id); ?>
22
  <div class="product-<?php echo $product->id; ?>">
23
  <span class="product-name">
24
+ <a href="<?php echo $product->get_link( $this->store_base_url ); ?>">
25
  <?php echo EcwidPlatform::esc_html( $product->name ); ?>
26
  </a>
27
  </span>
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: 4.9
6
- Stable tag: 6.2.4
7
 
8
  Powerful, easy to use ecommerce shopping cart. Bank level PCI DSS Level 1 security. iPhone & Android apps. Superb support. Free plan available.
9
 
@@ -151,6 +151,14 @@ You can use Ecwid’s built-in import tools to copy your store products from any
151
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
152
 
153
  == Changelog ==
 
 
 
 
 
 
 
 
154
  = 6.2.4 - Aug 17, 2018 =
155
  - Fixed an issue with the SEO content of product and categories pages. In the previous update, there was a bug affecting hidden SEO content of the store pages. It’s now fixed — everything should work fine both for human visitors and search crawlers.
156
 
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.3
7
 
8
  Powerful, easy to use ecommerce shopping cart. Bank level PCI DSS Level 1 security. iPhone & Android apps. Superb support. Free plan available.
9
 
151
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
152
 
153
  == Changelog ==
154
+ = 6.3 - Sep 25, 2018 =
155
+ - **Compatibility with the popular WordPress page builders: Elementor, Divi, Beaver builder.** The Ecwid e-commerce plugin has always been working great with the default WordPress editor to let you easily add a store or a single product to your site pages. In the recent updates, we also added the same functions to Gutenberg editor. In this update, we went further to make sure the most popular page builders are working fine with Ecwid. We added a lot of improvements and fixes to the plugin to make it work better with the Elementor, Beaver page builder and Divi editor. If you are using one of those page builders and having any problem editing your store page, please let us know so we can further improve it.
156
+ - **Avada, Bridge and Parallax One themes improved compatibility.** Even though Ecwid is compatible with every WordPress theme by design, some slight fixes and improvements are sometimes needed to make storefront look better. That’s why we are always monitoring how Ecwid pages look and behave in WordPress ecommerce themes. In this update, we are rolling out a few minor improvements to the Ecwid layout for the Avada, Bridge and Parallax One WordPress themes.
157
+ - **Fix of a conflict with Master slider plugin.** The Master slider plugin used to conflict with Ecwid plugin in the WordPress admin backend, which may cause some of the slider management pages look broken in the slider dashboard. Fixed.
158
+ - **Fix of a conflict with the Ultimate tables plugin.** One more plugin conflicting issue is fixed: the Ultimate tables plugin used to affect the Ecwid dashboard layout in the WordPress admin backed. Now it is working fine.
159
+ - **Improvements for the WooCommerce import tool: options, variations and image gallery are now supported.** In one of the recent update, we made it possible to import WooCommerce products to your Ecwid e-commerce store using a simple import wizard in the Ecwid plugin. In this version, we’ve made it more powerful so you can now import product gallery images, product options and variations to make the import easier and quicker.
160
+ - **Several fixes and improvements.**
161
+
162
  = 6.2.4 - Aug 17, 2018 =
163
  - Fixed an issue with the SEO content of product and categories pages. In the previous update, there was a bug affecting hidden SEO content of the store pages. It’s now fixed — everything should work fine both for human visitors and search crawlers.
164
 
templates/ecwid-admin.php CHANGED
@@ -31,7 +31,7 @@
31
  ecwidAddMenuItems(jQuery.parseJSON(result));
32
  ecwidRefreshEcwidMenuItemSelection();
33
  if (typeof wpResponsive == 'object' && wpResponsive.activate) {
34
- wpResponsive.trigger(); // prevent 'sticky-menu' from being applied incorrectly
35
  }
36
  }
37
  });
@@ -40,8 +40,8 @@
40
  //ecwidUpdateAdminMenus(e.data.data.navigationMenuItems);
41
  }
42
 
43
- if (typeof wpResponsive == 'object' && wpResponsive.trigger) {
44
- wpResponsive.trigger(); // prevent 'sticky-menu' from being applied incorrectly
45
  }
46
  },false);
47
 
31
  ecwidAddMenuItems(jQuery.parseJSON(result));
32
  ecwidRefreshEcwidMenuItemSelection();
33
  if (typeof wpResponsive == 'object' && wpResponsive.activate) {
34
+ wpResponsive.activate(); // prevent 'sticky-menu' from being applied incorrectly
35
  }
36
  }
37
  });
40
  //ecwidUpdateAdminMenus(e.data.data.navigationMenuItems);
41
  }
42
 
43
+ if (typeof wpResponsive == 'object' && wpResponsive.activate) {
44
+ wpResponsive.activate(); // prevent 'sticky-menu' from being applied incorrectly
45
  }
46
  },false);
47
 
templates/importer/woo-main.tpl.php CHANGED
@@ -38,16 +38,16 @@
38
  ?>
39
  </p>
40
 
 
41
  <h2><?php _e( 'Import settings.', 'ecwid-shopping-cart' ); ?></h2>
42
- <?php if ( Ecwid_Import::allow_delete_demo_products() && Ecwid_Importer::count_ecwid_demo_products() < Ecwid_Importer::count_ecwid_products() ): ?>
43
  <p>
44
  <label><input type="checkbox" class="import-settings" name="<?php echo Ecwid_Importer::SETTING_DELETE_DEMO; ?>"><?php _e( 'Remove demo products', 'ecwid-shopping-cart' ); ?></label>
45
  </p>
46
- <?php endif; ?>
47
  <p>
48
  <label><input type="checkbox" class="import-settings" name="<?php echo Ecwid_Importer::SETTING_UPDATE_BY_SKU; ?>"><?php _e( 'Overwrite existing products with matching SKU', 'ecwid-shopping-cart' ); ?></label>
49
  </p>
50
-
 
51
  <div class="importer-state importer-state-woo-initial">
52
  <?php require __DIR__ . '/woo-initial.tpl.php'; ?>
53
  </div>
38
  ?>
39
  </p>
40
 
41
+ <?php if ( count( Ecwid_Importer::get_ecwid_demo_products() ) > 0 && Ecwid_Importer::count_ecwid_demo_products() < Ecwid_Importer::count_ecwid_products() ): ?>
42
  <h2><?php _e( 'Import settings.', 'ecwid-shopping-cart' ); ?></h2>
 
43
  <p>
44
  <label><input type="checkbox" class="import-settings" name="<?php echo Ecwid_Importer::SETTING_DELETE_DEMO; ?>"><?php _e( 'Remove demo products', 'ecwid-shopping-cart' ); ?></label>
45
  </p>
 
46
  <p>
47
  <label><input type="checkbox" class="import-settings" name="<?php echo Ecwid_Importer::SETTING_UPDATE_BY_SKU; ?>"><?php _e( 'Overwrite existing products with matching SKU', 'ecwid-shopping-cart' ); ?></label>
48
  </p>
49
+ <?php endif; ?>
50
+
51
  <div class="importer-state importer-state-woo-initial">
52
  <?php require __DIR__ . '/woo-initial.tpl.php'; ?>
53
  </div>
templates/shortcode-stub.tpl.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="ecwid-shortcode-stub">
2
+ <div class="ecwid-shortcode-stub-header"><svg aria-hidden="true" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" class="dashicon" width="20" height="20" viewBox="0 0 20 20"><path 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
3
+ 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
4
+ 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
5
+ 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
6
+ 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
7
+ 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
8
+ 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
9
+ 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
10
+ 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
11
+ 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
12
+ 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
13
+ 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
14
+ 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
15
+ 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
16
+ S4.96,15.5,4.6,15.5z"></path></svg>
17
+
18
+ <?php echo $message; ?>
19
+ </div>
20
+ </div>
templates/widget-stub.tpl.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="ecwid-widget-stub">
2
+ <div class="ecwid-widget-stub-header"><svg aria-hidden="true" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" class="dashicon" width="20" height="20" viewBox="0 0 20 20"><path 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
3
+ 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
4
+ 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
5
+ 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
6
+ 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
7
+ 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
8
+ 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
9
+ 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
10
+ 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
11
+ 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
12
+ 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
13
+ 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
14
+ 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
15
+ 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
16
+ S4.96,15.5,4.6,15.5z"></path></svg>
17
+
18
+ <?php echo $message; ?>
19
+ </div>
20
+ </div>