Ecwid Ecommerce Shopping Cart - Version 5.8

Version Description

  • Feb 8, 2018 =
  • Improved OG tags support. OpenGraph (or OG) tags are special marks in site pages code, that are used to make better snippets when you share a page on Facebook, Twitter and other sites and social networks. We added OG tags to the products pages this will make your product title, description and image appear in a snippet/post when you share a link to that product.
  • Revamped Ecwid menu in WordPress admin backend. Historically, the Ecwid store management dashboard displayed navigation within the central page content when you open it in your Wordpress admin backend. So, you open the Ecwid menu in your WP admin and then navigate through your store admin pages within that general Ecwid page. Were improving this process: now the store admin navigation menu will be a part of the Wordpress native admin menu, so you will find products/sales/settings/promotions/apps and other sections right in the Wordpress left-hand navigation sidebar. This will align the Ecwid plugin navigation with the general Wordpress navigation and provide more natural way to find the right page of your store dashboard. Also, this will free some space in the page central area to make it more convenient to manage your store, especially on mobile devices. IMPORTANT: The change is now enabled for the new plugin users only. We will gradually roll it out to all of the plugin users in the upcoming updates.
  • Improved compatibility with Customizr theme (part 2). We continue improving the Ecwid online store plugin to work well with a popular Customizr theme and to make the store appearance and behavior fit the theme better. This is a continue of the improvements for Customizr that we released in the previous plugin update. If youre using the Customizr theme, please let us know what you think.
  • Several minor fixes and improvements. The Ecwid plugin is constantly updated with new features and tools. To see more updates, see our ecommerce blog.
Download this release

Release Info

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

Code changes from version 5.7.3 to 5.8

css/admin.css CHANGED
@@ -570,9 +570,145 @@ body[class*="_page_ecwid"] .ecwid-message {
570
  border-bottom-color:#666;
571
  }
572
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
  #adminmenu #toplevel_page_ec-store div.wp-menu-image:before {
574
  font-family: 'ecwid-plugin-icons' !important;
575
  content: "\e603";
576
  -webkit-font-smoothing: antialiased;
577
  -moz-osx-font-smoothing: grayscale;
578
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  border-bottom-color:#666;
571
  }
572
 
573
+
574
+ /****
575
+ 3d level menu
576
+ */
577
+
578
+ #adminmenu .wp-submenu li.ec-separator a,
579
+ #adminmenu #toplevel_page_ec-store .wp-submenu li a[href="admin.php?page"]
580
+ {
581
+ margin-top: 10px;
582
+ opacity: .5;
583
+ font-size: 0.9em;
584
+ text-transform: uppercase;
585
+ cursor: default;
586
+ }
587
+
588
  #adminmenu #toplevel_page_ec-store div.wp-menu-image:before {
589
  font-family: 'ecwid-plugin-icons' !important;
590
  content: "\e603";
591
  -webkit-font-smoothing: antialiased;
592
  -moz-osx-font-smoothing: grayscale;
593
+ }
594
+
595
+ #adminmenu #toplevel_page_ec-store .wp-submenu3 {
596
+ list-style: none;
597
+ position: absolute;
598
+ top: -1000em;
599
+ left: 160px;
600
+
601
+ overflow: visible;
602
+ word-wrap: break-word;
603
+
604
+ padding: 7px 0 8px;
605
+ z-index: 9999;
606
+ background-color: #41464b;
607
+ -webkit-box-shadow: 0 3px 5px rgba(0,0,0,.2);
608
+ box-shadow: 0 3px 5px rgba(0,0,0,.2);
609
+ }
610
+
611
+ #adminmenu #toplevel_page_ec-store .wp-submenu3 {
612
+ min-width: 160px;
613
+ width: auto;
614
+ }
615
+
616
+ @media only screen AND (max-width: 960px) {
617
+ #adminmenu #toplevel_page_ec-store .wp-submenu3 {
618
+ min-width: 150px;
619
+ left: 150px;
620
+ }
621
+ }
622
+
623
+ @media only screen AND (max-width: 960px) {
624
+ #adminmenu #toplevel_page_ec-store .wp-submenu3,
625
+ #adminmenu #toplevel_page_ec-store .wp-submenu {
626
+ min-width: 190px;
627
+ }
628
+
629
+ #adminmenu #toplevel_page_ec-store .wp-submenu3 {
630
+ left: 190px
631
+ }
632
+ }
633
+
634
+ #adminmenu #toplevel_page_ec-store .wp-not-current-submenu {
635
+ min-width: 160px;
636
+ width: auto;
637
+ }
638
+
639
+ @media only screen and (max-width: 960px) {
640
+ #adminmenu #toplevel_page_ec-store .wp-not-current-submenu {
641
+ min-width: initial;
642
+ } }
643
+
644
+ #adminmenu #toplevel_page_ec-store .opensub:not(.wp-has-current-submenu3) .wp-submenu3 {
645
+ top: -1px;
646
+ }
647
+
648
+ #adminmenu #toplevel_page_ec-store li {
649
+ position: relative;
650
+ overflow: visible;
651
+ }
652
+
653
+ #adminmenu #toplevel_page_ec-store .wp-submenu3 a {
654
+ color: #A5A8AD;
655
+ font-weight: 400;
656
+ }
657
+
658
+
659
+ #adminmenu #toplevel_page_ec-store .wp-submenu3 a.current {
660
+ color: #ffffff;
661
+ font-weight: 600;
662
+ }
663
+
664
+ #adminmenu #toplevel_page_ec-store .wp-submenu3 a:hover {
665
+ color: #00d2fc;
666
+ }
667
+
668
+
669
+ #adminmenu #toplevel_page_ec-store li.wp-has-submenu3:not(.wp-has-current-submenu3):hover:after,
670
+ #adminmenu #toplevel_page_ec-store li.wp-has-submenu3.opensub:not(.wp-has-current-submenu3):after
671
+ {
672
+ right: 0;
673
+ border: solid transparent;
674
+ content: " ";
675
+ height: 0;
676
+ width: 0;
677
+ position: absolute;
678
+ pointer-events: none;
679
+ border-width: 8px;
680
+ top: 10px;
681
+ z-index: 10000;
682
+ border-right-color: #41464b;
683
+ }
684
+
685
+ #adminmenu #toplevel_page_ec-store .wp-has-current-submenu3 .wp-submenu3 {
686
+ position: relative;
687
+ z-index: 3;
688
+ top: auto;
689
+ left: auto;
690
+ right: auto;
691
+ bottom: auto;
692
+ border: 0;
693
+ margin-top: 0;
694
+ -webkit-box-shadow: none;
695
+ box-shadow: none;
696
+ background-color: #41464b;
697
+ }
698
+ #adminmenu #toplevel_page_ec-store .wp-has-current-submenu3:last-child .wp-submenu3 {
699
+ margin-top: 4px;
700
+ margin-bottom: -8px;
701
+ }
702
+
703
+ #adminmenu #toplevel_page_ec-store .wp-has-current-submenu3 .wp-submenu3 > li > a {
704
+ padding-left: 20px;
705
+ }
706
+
707
+ #adminmenu #toplevel_page_ec-store .wp-has-submenu3.wp-has-current-submenu3 > a {
708
+ background: #0084bb;
709
+ color: #ffffff;
710
+ }
711
+
712
+ .ecwid-admin-iframe .update-nag {
713
+ display: none;
714
+ }
css/themes/customizr.css CHANGED
@@ -58,7 +58,15 @@
58
  line-height: normal;
59
  }
60
 
 
 
 
 
 
 
61
 
62
- html#ecwid_html body#ecwid_body.ecwid-shopping-cart input[type=radio]:checked::before {
63
- background-color:transparent !important;
 
 
64
  }
58
  line-height: normal;
59
  }
60
 
61
+ html#ecwid_html body#ecwid_body.ecwid-shopping-cart .ecwid input[type="radio"] {
62
+ position: relative;
63
+ padding: 0.5em;
64
+ border-width: 1px;
65
+ border-radius: .5em;
66
+ }
67
 
68
+ html#ecwid_html body#ecwid_body.ecwid-shopping-cart .ecwid input[type="checkbox"] {
69
+ position: relative;
70
+ padding: 0.5em;
71
+ border-width: 1px;
72
  }
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: 5.7.3
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
@@ -35,32 +35,6 @@ if ( ! defined('ECWID_SHORTCODES_DIR' ) ) {
35
  define( 'ECWID_SHORTCODES_DIR', ECWID_PLUGIN_DIR . 'includes/shortcodes' );
36
  }
37
 
38
- require_once ECWID_PLUGIN_DIR . 'includes/themes.php';
39
- require_once ECWID_PLUGIN_DIR . 'includes/oembed.php';
40
- require_once ECWID_PLUGIN_DIR . 'includes/widgets.php';
41
- require_once ECWID_PLUGIN_DIR . 'includes/shortcodes.php';
42
-
43
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-message-manager.php';
44
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-store-editor.php';
45
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-product-popup.php';
46
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-oauth.php';
47
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-products.php';
48
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-config.php';
49
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-admin.php';
50
-
51
- if ( is_admin() ) {
52
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-help-page.php';
53
- }
54
-
55
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-nav-menus.php';
56
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-ajax-defer-renderer.php';
57
-
58
- require_once ECWID_PLUGIN_DIR . 'lib/ecwid_platform.php';
59
- require_once ECWID_PLUGIN_DIR . 'lib/ecwid_api_v3.php';
60
- require_once ECWID_PLUGIN_DIR . 'lib/ecwid_product.php';
61
- require_once ECWID_PLUGIN_DIR . 'lib/ecwid_category.php';
62
-
63
-
64
  // Older versions of Google XML Sitemaps plugin generate it in admin, newer in site area, so the hook should be assigned in both of them
65
  add_action('sm_buildmap', 'ecwid_build_google_xml_sitemap');
66
 
@@ -101,7 +75,7 @@ if ( is_admin() ){
101
  add_action('wp', 'ecwid_seo_ultimate_compatibility', 0);
102
  add_action('wp', 'ecwid_remove_default_canonical');
103
  add_filter('wp', 'ecwid_seo_compatibility_init', 0);
104
- add_filter('wp_title', 'ecwid_seo_title', 10000);
105
  add_filter('document_title_parts', 'ecwid_seo_title_parts');
106
  add_action('plugins_loaded', 'ecwid_minifier_compatibility', 0);
107
  add_action('wp_head', 'ecwid_meta_description', 0);
@@ -122,12 +96,6 @@ add_action('admin_bar_menu', 'add_ecwid_admin_bar_node', 1000);
122
  if (get_option('ecwid_last_oauth_fail_time') > 0) {
123
  add_action('plugins_loaded', 'ecwid_test_oauth');
124
  }
125
-
126
- // Needs to be in both front-end and back-end to allow admin zone recognize the shortcode
127
- foreach (Ecwid_Shortcode_Base::get_store_shortcode_names() as $shortcode_name) {
128
- add_shortcode( $shortcode_name, 'ecwid_shortcode' );
129
- }
130
-
131
  $ecwid_script_rendered = false; // controls single script.js on page
132
 
133
  require_once ECWID_PLUGIN_DIR . 'includes/themes.php';
@@ -140,17 +108,36 @@ require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-store-editor.php';
140
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-product-popup.php';
141
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-oauth.php';
142
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-products.php';
 
 
143
 
144
- if (is_admin()) {
145
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-help-page.php';
146
  }
147
 
148
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-nav-menus.php';
149
- require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-seo-links.php';
 
150
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-store-page.php';
151
 
 
 
 
 
 
 
 
 
 
152
  $ecwid_script_rendered = false; // controls single script.js on page
153
 
 
 
 
 
 
 
 
154
  function ecwid_init_integrations()
155
  {
156
  if ( !function_exists( 'get_plugins' ) ) { require_once ( ABSPATH . 'wp-admin/includes/plugin.php' ); }
@@ -329,7 +316,7 @@ function ecwid_enqueue_frontend() {
329
 
330
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
331
  wp_localize_script( 'ecwid-frontend-js', 'ecwidParams', array(
332
- 'useJsApiToOpenStoreCategoriesPages' => (bool)get_option( 'ecwid_use_js_api_to_open_store_categories_pages', false )
333
  ));
334
 
335
  if ( get_post() && get_post()->post_type == Ecwid_Products::POST_TYPE_PRODUCT ) {
@@ -631,13 +618,21 @@ function ecwid_check_version()
631
  // Since 5.4.2
632
  delete_option('ecwid_hide_appearance_menu');
633
 
634
- // Since 5.4.3?
635
  add_option( Ecwid_Widget_Floating_Shopping_Cart::OPTION_MOVE_INTO_BODY, '' );
636
 
637
- // Since 5.7.x?
638
- add_option( 'ecwid_use_js_api_to_open_store_categories_pages', false );
639
  delete_option( 'ecwid_use_js_api_to_open_store_pages' );
640
 
 
 
 
 
 
 
 
 
 
641
  Ecwid_Config::load_from_ini();
642
 
643
  add_option( 'force_scriptjs_render', false );
@@ -1130,15 +1125,7 @@ HTML;
1130
 
1131
  function ecwid_trim_description($description)
1132
  {
1133
- $description = strip_tags($description);
1134
- $description = html_entity_decode($description, ENT_NOQUOTES, 'UTF-8');
1135
-
1136
- $description = preg_replace('![\p{Z}\s]{1,}!u', ' ', $description);
1137
- $description = trim($description, " \t\xA0\n\r"); // Space, tab, non-breaking space, newline, carriage return
1138
- $description = mb_substr($description, 0, ECWID_TRIMMED_DESCRIPTION_LENGTH, 'UTF-8');
1139
- $description = htmlspecialchars($description, ENT_COMPAT, 'UTF-8');
1140
-
1141
- return $description;
1142
  }
1143
 
1144
  add_action( 'wp_ajax_ecwid_deactivate_feedback', 'ecwid_ajax_deactivate_feedback' );
@@ -1176,13 +1163,20 @@ function ecwid_get_title_separator()
1176
  return apply_filters('ecwid_title_separator', '|');
1177
  }
1178
 
1179
- function ecwid_seo_title($content) {
1180
 
1181
  $title = _ecwid_get_seo_title();
 
1182
  if (!empty($title)) {
1183
- $sep = ecwid_get_title_separator();
1184
-
1185
- return "$title $sep $content";
 
 
 
 
 
 
1186
  }
1187
 
1188
  return $content;
@@ -1682,11 +1676,13 @@ EOT;
1682
  add_action('in_admin_header', 'ecwid_disable_other_notices');
1683
  function ecwid_disable_other_notices() {
1684
 
1685
- $pages = array('toplevel_page_ec-store', 'toplevel_page_ec_store', 'admin_page_ecwid-help');
1686
-
1687
- if (!in_array(get_current_screen()->base, $pages)) return;
1688
-
1689
 
 
 
 
 
 
1690
  global $wp_filter;
1691
 
1692
  if (!$wp_filter || !isset($wp_filter['admin_notices']) || !class_exists('WP_Hook') || ! ( $wp_filter['admin_notices'] instanceof WP_Hook) ) {
@@ -1791,8 +1787,12 @@ function ecwid_get_update_params_options() {
1791
  'ecwid_disable_pb_url' => array(
1792
  'type' => 'bool'
1793
  ),
1794
- 'ecwid_use_js_api_to_open_store_categories_pages' => array(
1795
- 'type' => 'bool'
 
 
 
 
1796
  ),
1797
  Ecwid_Widget_Floating_Shopping_Cart::OPTION_DISPLAY_POSITION => array(
1798
  'values' => array(
@@ -1815,6 +1815,16 @@ function ecwid_get_update_params_options() {
1815
  ),
1816
  'force_scriptjs_render' => array(
1817
  'type' => 'bool'
 
 
 
 
 
 
 
 
 
 
1818
  )
1819
  );
1820
 
@@ -2196,7 +2206,11 @@ function ecwid_get_iframe_src($time, $page)
2196
  {
2197
  $url = ecwid_get_admin_sso_url($time, $page);
2198
  if ($url) {
2199
- return $url . '&inline&&min-height=700';
 
 
 
 
2200
  } else {
2201
  return false;
2202
  }
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: 5.8
9
  Author URI: http://www.ecwid.com?source=wporg
10
  */
11
 
35
  define( 'ECWID_SHORTCODES_DIR', ECWID_PLUGIN_DIR . 'includes/shortcodes' );
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  // Older versions of Google XML Sitemaps plugin generate it in admin, newer in site area, so the hook should be assigned in both of them
39
  add_action('sm_buildmap', 'ecwid_build_google_xml_sitemap');
40
 
75
  add_action('wp', 'ecwid_seo_ultimate_compatibility', 0);
76
  add_action('wp', 'ecwid_remove_default_canonical');
77
  add_filter('wp', 'ecwid_seo_compatibility_init', 0);
78
+ add_filter('wp_title', 'ecwid_seo_title', 10000, 3);
79
  add_filter('document_title_parts', 'ecwid_seo_title_parts');
80
  add_action('plugins_loaded', 'ecwid_minifier_compatibility', 0);
81
  add_action('wp_head', 'ecwid_meta_description', 0);
96
  if (get_option('ecwid_last_oauth_fail_time') > 0) {
97
  add_action('plugins_loaded', 'ecwid_test_oauth');
98
  }
 
 
 
 
 
 
99
  $ecwid_script_rendered = false; // controls single script.js on page
100
 
101
  require_once ECWID_PLUGIN_DIR . 'includes/themes.php';
108
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-product-popup.php';
109
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-oauth.php';
110
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-products.php';
111
+ require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-config.php';
112
+ require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-admin.php';
113
 
114
+ if ( is_admin() ) {
115
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-help-page.php';
116
  }
117
 
118
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-nav-menus.php';
119
+ require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-ajax-defer-renderer.php';
120
+
121
  require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-store-page.php';
122
 
123
+ require_once ECWID_PLUGIN_DIR . 'lib/ecwid_platform.php';
124
+ require_once ECWID_PLUGIN_DIR . 'lib/ecwid_api_v3.php';
125
+ require_once ECWID_PLUGIN_DIR . 'lib/ecwid_product.php';
126
+ require_once ECWID_PLUGIN_DIR . 'lib/ecwid_category.php';
127
+
128
+ require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-nav-menus.php';
129
+ require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-seo-links.php';
130
+ require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-html-meta.php';
131
+
132
  $ecwid_script_rendered = false; // controls single script.js on page
133
 
134
+
135
+ // Needs to be in both front-end and back-end to allow admin zone recognize the shortcode
136
+ foreach (Ecwid_Shortcode_Base::get_store_shortcode_names() as $shortcode_name) {
137
+ add_shortcode( $shortcode_name, 'ecwid_shortcode' );
138
+ }
139
+
140
+
141
  function ecwid_init_integrations()
142
  {
143
  if ( !function_exists( 'get_plugins' ) ) { require_once ( ABSPATH . 'wp-admin/includes/plugin.php' ); }
316
 
317
  wp_enqueue_script( 'ecwid-frontend-js', ECWID_PLUGIN_URL . 'js/frontend.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) );
318
  wp_localize_script( 'ecwid-frontend-js', 'ecwidParams', array(
319
+ 'useJsApiToOpenStoreCategoriesPages' => Ecwid_Nav_Menus::should_use_js_api_for_categories_menu()
320
  ));
321
 
322
  if ( get_post() && get_post()->post_type == Ecwid_Products::POST_TYPE_PRODUCT ) {
618
  // Since 5.4.2
619
  delete_option('ecwid_hide_appearance_menu');
620
 
621
+ // Since 5.4.3
622
  add_option( Ecwid_Widget_Floating_Shopping_Cart::OPTION_MOVE_INTO_BODY, '' );
623
 
624
+ // Since 5.7.3
 
625
  delete_option( 'ecwid_use_js_api_to_open_store_pages' );
626
 
627
+ // Since 5.7.4
628
+ update_option( 'ecwid_use_js_api_to_open_store_categories_pages', Ecwid_Nav_Menus::OPTVAL_USE_JS_API_FOR_CATS_MENU_AUTO );
629
+
630
+ // Since 5.8
631
+ add_option( Ecwid_Admin::OPTION_ENABLE_AUTO_MENUS, 'auto' );
632
+
633
+ // Since 5.8
634
+ add_option( 'ecwid_print_html_catalog', 'Y' );
635
+
636
  Ecwid_Config::load_from_ini();
637
 
638
  add_option( 'force_scriptjs_render', false );
1125
 
1126
  function ecwid_trim_description($description)
1127
  {
1128
+ return Ecwid_HTML_Meta::process_raw_description( $description, ECWID_TRIMMED_DESCRIPTION_LENGTH );
 
 
 
 
 
 
 
 
1129
  }
1130
 
1131
  add_action( 'wp_ajax_ecwid_deactivate_feedback', 'ecwid_ajax_deactivate_feedback' );
1163
  return apply_filters('ecwid_title_separator', '|');
1164
  }
1165
 
1166
+ function ecwid_seo_title( $content, $sep = '', $seplocation = 'right' ) {
1167
 
1168
  $title = _ecwid_get_seo_title();
1169
+
1170
  if (!empty($title)) {
1171
+
1172
+ if ( empty( $sep ) ) {
1173
+ $sep = ecwid_get_title_separator();
1174
+ }
1175
+
1176
+ if ( $seplocation == 'right' )
1177
+ return "$title $sep $content";
1178
+ else
1179
+ return "$content $sep $title";
1180
  }
1181
 
1182
  return $content;
1676
  add_action('in_admin_header', 'ecwid_disable_other_notices');
1677
  function ecwid_disable_other_notices() {
1678
 
1679
+ $pages = array('toplevel_page_' . Ecwid_Admin::ADMIN_SLUG, 'toplevel_page_ec_store', 'admin_page_ecwid-help');
 
 
 
1680
 
1681
+ $is_admin_subpage = strpos(get_current_screen()->base, 'admin_page_' . Ecwid_Admin::ADMIN_SLUG) !== false
1682
+ || strpos(get_current_screen()->base, 'admin_page_' . Ecwid_Admin::ADMIN_SLUG) !== false;
1683
+
1684
+ if (!$is_admin_subpage && !in_array(get_current_screen()->base, $pages)) return;
1685
+
1686
  global $wp_filter;
1687
 
1688
  if (!$wp_filter || !isset($wp_filter['admin_notices']) || !class_exists('WP_Hook') || ! ( $wp_filter['admin_notices'] instanceof WP_Hook) ) {
1787
  'ecwid_disable_pb_url' => array(
1788
  'type' => 'bool'
1789
  ),
1790
+ Ecwid_Nav_Menus::OPTION_USE_JS_API_FOR_CATS_MENU => array(
1791
+ 'values' => array(
1792
+ Ecwid_Nav_Menus::OPTVAL_USE_JS_API_FOR_CATS_MENU_TRUE,
1793
+ Ecwid_Nav_Menus::OPTVAL_USE_JS_API_FOR_CATS_MENU_FALSE,
1794
+ Ecwid_Nav_Menus::OPTVAL_USE_JS_API_FOR_CATS_MENU_AUTO
1795
+ )
1796
  ),
1797
  Ecwid_Widget_Floating_Shopping_Cart::OPTION_DISPLAY_POSITION => array(
1798
  'values' => array(
1815
  ),
1816
  'force_scriptjs_render' => array(
1817
  'type' => 'bool'
1818
+ ),
1819
+ Ecwid_Admin::OPTION_ENABLE_AUTO_MENUS => array(
1820
+ 'values' => array(
1821
+ Ecwid_Admin::OPTION_ENABLE_AUTO_MENUS_ON,
1822
+ Ecwid_Admin::OPTION_ENABLE_AUTO_MENUS_OFF,
1823
+ Ecwid_Admin::OPTION_ENABLE_AUTO_MENUS_AUTO
1824
+ )
1825
+ ),
1826
+ 'ecwid_print_html_catalog' => array(
1827
+ 'type' => 'bool'
1828
  )
1829
  );
1830
 
2206
  {
2207
  $url = ecwid_get_admin_sso_url($time, $page);
2208
  if ($url) {
2209
+ $url .= '&inline&min-height=700';
2210
+ if ( Ecwid_Admin::are_auto_menus_enabled() ) {
2211
+ $url .= '&hide_vertical_navigation_menu=true';
2212
+ }
2213
+ return $url;
2214
  } else {
2215
  return false;
2216
  }
includes/class-ecwid-admin.php CHANGED
@@ -3,20 +3,41 @@
3
  class Ecwid_Admin {
4
 
5
  const ADMIN_SLUG = 'ec-store';
 
 
 
 
 
6
 
7
  public function __construct()
8
  {
9
  if ( is_admin() ) {
10
  add_action( 'current_screen', array( $this, 'do_ec_redirect' ) );
11
- add_action('admin_menu', array( $this, 'build_menu' ) );
 
 
12
  }
13
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  public function build_menu()
16
  {
17
 
18
  $is_newbie = get_ecwid_store_id() == Ecwid_Config::get_demo_store_id();
19
-
20
  add_menu_page(
21
  sprintf(__('%s shopping cart settings', 'ecwid-shopping-cart'), Ecwid_Config::get_brand()),
22
  sprintf(__('%s', 'ecwid-shopping-cart'), Ecwid_Config::get_brand()),
@@ -32,43 +53,81 @@ class Ecwid_Admin {
32
  } else {
33
  $title = __('Dashboard', 'ecwid-shopping-cart');
34
  }
35
- add_submenu_page(
36
- self::ADMIN_SLUG,
37
- $title,
38
- $title,
39
- 'manage_options',
40
- self::ADMIN_SLUG,
41
- 'ecwid_general_settings_do_page'
42
- );
43
-
44
- global $ecwid_oauth;
45
- if (!$is_newbie && $ecwid_oauth->has_scope('allow_sso') && !self::disable_dashboard() ) {
46
  add_submenu_page(
47
  self::ADMIN_SLUG,
48
- __('Sales', 'ecwid-shopping-cart'),
49
- __('Sales', 'ecwid-shopping-cart'),
50
  'manage_options',
51
- self::ADMIN_SLUG . '-admin-orders',
52
- 'ecwid_admin_orders_do_page'
53
- );
54
-
55
-
56
- add_submenu_page(
57
  self::ADMIN_SLUG,
58
- __('Products', 'ecwid-shopping-cart'),
59
- __('Products', 'ecwid-shopping-cart'),
60
- 'manage_options',
61
- self::ADMIN_SLUG . '-admin-products',
62
- 'ecwid_admin_products_do_page'
63
  );
64
  }
65
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  if (!$is_newbie || (isset($_GET['page']) && $_GET['page'] == 'ecwid-advanced')) {
67
  add_submenu_page(
68
  self::ADMIN_SLUG,
69
  __('Advanced settings', 'ecwid-shopping-cart'),
70
  __('Advanced', 'ecwid-shopping-cart'),
71
- 'manage_options',
72
  self::ADMIN_SLUG . '-advanced',
73
  'ecwid_advanced_settings_do_page'
74
  );
@@ -107,6 +166,135 @@ class Ecwid_Admin {
107
  }
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  public function do_ec_redirect() {
111
 
112
  $screen = get_current_screen();
@@ -120,6 +308,10 @@ class Ecwid_Admin {
120
  exit();
121
  }
122
 
 
 
 
 
123
  static public function get_dashboard_url() {
124
  return admin_url( self::get_relative_dashboard_url() );
125
  }
@@ -127,6 +319,19 @@ class Ecwid_Admin {
127
  static public function get_relative_dashboard_url() {
128
  return 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG;
129
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  static public function disable_dashboard() {
132
  if ( !isset( $_GET['reconnect'] ) ) {
@@ -139,4 +344,4 @@ class Ecwid_Admin {
139
  }
140
  }
141
 
142
- $ecwid_admin = new Ecwid_Admin();
3
  class Ecwid_Admin {
4
 
5
  const ADMIN_SLUG = 'ec-store';
6
+ const AJAX_ACTION_UPDATE_MENU = 'ecwid_update_menu';
7
+ const OPTION_ENABLE_AUTO_MENUS = 'ecwid_enable_auto_menus';
8
+ const OPTION_ENABLE_AUTO_MENUS_ON = 'on';
9
+ const OPTION_ENABLE_AUTO_MENUS_OFF = 'off';
10
+ const OPTION_ENABLE_AUTO_MENUS_AUTO = 'auto';
11
 
12
  public function __construct()
13
  {
14
  if ( is_admin() ) {
15
  add_action( 'current_screen', array( $this, 'do_ec_redirect' ) );
16
+ add_action( 'admin_menu', array( $this, 'build_menu' ) );
17
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
18
+ add_action( 'wp_ajax_' . self::AJAX_ACTION_UPDATE_MENU, array( $this, 'ajax_update_menu' ) );
19
  }
20
  }
21
+
22
+ public function enqueue_scripts() {
23
+ $menu = self::_get_menus();
24
+
25
+ wp_enqueue_script( 'ecwid-admin-menu', ECWID_PLUGIN_URL . 'js/admin-menu.js', array(), get_option( 'ecwid_plugin_version' ) );
26
+
27
+ wp_localize_script( 'ecwid-admin-menu', 'ecwid_admin_menu', array(
28
+ 'dashboard' => __('Dashboard', 'ecwid-shopping-cart'),
29
+ 'dashboard_url' => Ecwid_Admin::get_relative_dashboard_url(),
30
+ 'menu' => self::are_auto_menus_enabled() ? $menu : array(),
31
+ 'baseSlug' => self::ADMIN_SLUG,
32
+ 'enableAutoMenus' => self::are_auto_menus_enabled()
33
+ ));
34
+ }
35
 
36
  public function build_menu()
37
  {
38
 
39
  $is_newbie = get_ecwid_store_id() == Ecwid_Config::get_demo_store_id();
40
+
41
  add_menu_page(
42
  sprintf(__('%s shopping cart settings', 'ecwid-shopping-cart'), Ecwid_Config::get_brand()),
43
  sprintf(__('%s', 'ecwid-shopping-cart'), Ecwid_Config::get_brand()),
53
  } else {
54
  $title = __('Dashboard', 'ecwid-shopping-cart');
55
  }
56
+ if ( !self::are_auto_menus_enabled() || !in_array( self::ADMIN_SLUG, $this->_get_menus() ) ) {
 
 
 
 
 
 
 
 
 
 
57
  add_submenu_page(
58
  self::ADMIN_SLUG,
59
+ $title,
60
+ $title,
61
  'manage_options',
 
 
 
 
 
 
62
  self::ADMIN_SLUG,
63
+ 'ecwid_general_settings_do_page'
 
 
 
 
64
  );
65
  }
66
+
67
+ global $ecwid_oauth;
68
+ if (!$is_newbie && $ecwid_oauth->has_scope('allow_sso') && !self::disable_dashboard() ) {
69
+
70
+ if ( !self::are_auto_menus_enabled() ){
71
+ add_submenu_page(
72
+ self::ADMIN_SLUG,
73
+ __('Sales', 'ecwid-shopping-cart'),
74
+ __('Sales', 'ecwid-shopping-cart'),
75
+ 'manage_options',
76
+ self::ADMIN_SLUG . '-admin-orders',
77
+ 'ecwid_admin_orders_do_page'
78
+ );
79
+ add_submenu_page(
80
+ self::ADMIN_SLUG,
81
+ __('Products', 'ecwid-shopping-cart'),
82
+ __('Products', 'ecwid-shopping-cart'),
83
+ 'manage_options',
84
+ self::ADMIN_SLUG . '-admin-products',
85
+ 'ecwid_admin_products_do_page'
86
+ );
87
+ } else {
88
+ $menu = $this->_get_menus();
89
+
90
+ foreach ( $menu as $item ) {
91
+ if ( @$item['slug'] ) {
92
+ add_submenu_page(
93
+ self::ADMIN_SLUG,
94
+ $item['title'],
95
+ $item['title'],
96
+ self::get_capability(),
97
+ $item['slug'],
98
+ array( $this, 'do_admin_page' )
99
+ );
100
+
101
+ if (@$item['children']) foreach ($item['children'] as $subitem) {
102
+ add_submenu_page(
103
+ null,
104
+ $subitem['title'],
105
+ $subitem['title'],
106
+ self::get_capability(),
107
+ $subitem['slug'],
108
+ array( $this, 'do_admin_page' )
109
+ );
110
+ }
111
+ } else {
112
+ add_submenu_page(
113
+ self::ADMIN_SLUG,
114
+ $item['title'],
115
+ $item['title'],
116
+ self::get_capability(),
117
+ '',
118
+ array( $this, 'do_admin_page' )
119
+ );
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
  if (!$is_newbie || (isset($_GET['page']) && $_GET['page'] == 'ecwid-advanced')) {
126
  add_submenu_page(
127
  self::ADMIN_SLUG,
128
  __('Advanced settings', 'ecwid-shopping-cart'),
129
  __('Advanced', 'ecwid-shopping-cart'),
130
+ self::get_capability(),
131
  self::ADMIN_SLUG . '-advanced',
132
  'ecwid_advanced_settings_do_page'
133
  );
166
  }
167
  }
168
 
169
+ public function do_admin_page()
170
+ {
171
+ $menus = $this->_get_menus();
172
+
173
+ $admin_prefix = self::ADMIN_SLUG . '-admin-';
174
+ $slug = get_current_screen()->base;
175
+ $slug = substr( get_current_screen()->base, strpos( $slug, $admin_prefix ) + strlen( $admin_prefix ) );
176
+
177
+ // Yeah, in some case there might be a collision between the wp slug and ecwid hash if some hashes collide into the same slug
178
+ ecwid_admin_do_page( $slug );
179
+ }
180
+
181
+ public function ajax_update_menu()
182
+ {
183
+ if (! current_user_can( self::get_capability() ) ) {
184
+ die();
185
+ }
186
+
187
+ if (!isset( $_POST['menu'] ) ) {
188
+ die();
189
+ }
190
+
191
+ EcwidPlatform::set( 'admin_menu', $_POST['menu'] );
192
+
193
+ echo json_encode( $this->_get_menus() );
194
+ die();
195
+ }
196
+
197
+ protected function _get_menus()
198
+ {
199
+ $menu = EcwidPlatform::get( 'admin_menu' );
200
+
201
+ if ( is_null( $menu ) ) {
202
+ $menu = $this->_get_default_menu();
203
+ }
204
+
205
+ $slugs = array();
206
+
207
+ $result = array();
208
+
209
+ foreach ( $menu as $item ) {
210
+
211
+ $menu_item = array();
212
+
213
+ if ( isset( $item['path'] ) && $item['path'] == 'dashboard' ) {
214
+ unset( $menu[$item['path']] );
215
+ continue;
216
+ }
217
+
218
+
219
+ $menu_item['title'] = stripslashes($item['title']);
220
+
221
+ if ( @$item['type'] != 'separator' ) {
222
+ $slug = $this->_slugify_ecwid_cp_hash( $item['path'], $item['title'], $slugs );
223
+ $menu_item['url'] = 'admin.php?page=' . $slug;
224
+ $menu_item['slug'] = $slug;
225
+ $menu_item['hash'] = $item['path'];
226
+ $slugs[] = $slug;
227
+ } else {
228
+ $menu_item['type'] = 'separator';
229
+ }
230
+
231
+ if ( @$item['items'] ) foreach ( $item['items'] as $item2 ) {
232
+
233
+ $slug2 = $this->_slugify_ecwid_cp_hash( $item2['path'], $item2['title'], $slugs );
234
+ $slugs[] = $slug2;
235
+ $item2['url'] = 'admin.php?page=' . $slug2;
236
+ $item2['slug'] = $slug2;
237
+ $item2['hash'] = $item2['path'];
238
+ $item2['title'] = stripslashes( $item2['title'] );
239
+
240
+ $menu_item['children'][] = $item2;
241
+ }
242
+
243
+ $result[] = $menu_item;
244
+ }
245
+
246
+ return $result;
247
+ }
248
+
249
+ protected function _slugify_ecwid_cp_hash( $hash, $title, $slugs ) {
250
+
251
+ if ( strpos( $hash, ':' ) === false && !in_array( self::ADMIN_SLUG . '-admin-' . $hash, $slugs ) ) {
252
+ $slug = $hash;
253
+ } else {
254
+ $match = array();
255
+
256
+ $slug = strtolower( $title );
257
+ $result = preg_match_all( '#[\p{L}0-9\-_]+#u', strtolower( $title ), $match );
258
+
259
+ if ( $result && count( @$match[0] ) > 0 ) {
260
+ $slug = implode('-', $match[0] );
261
+ }
262
+
263
+ $prefix = '';
264
+ while( in_array( $slug . $prefix, $slugs ) ) {
265
+ $prefix = intval( $prefix ) + 1;
266
+ }
267
+
268
+ if ( $prefix ) {
269
+ $slug .= $prefix;
270
+ }
271
+ }
272
+
273
+ $slug = self::ADMIN_SLUG . '-admin-' . $slug;
274
+
275
+ return $slug;
276
+ }
277
+
278
+ protected function _get_default_menu() {
279
+ static $default_menu = array();
280
+
281
+ if ( !empty( $default_menu ) ) return $default_menu;
282
+
283
+ $default_menu = array(
284
+ array(
285
+ 'title' => __( 'Sales', 'ecwid-shopping-cart' ),
286
+ 'path' => 'orders',
287
+ ),
288
+ array(
289
+ 'title' => __( 'Products', 'ecwid-shopping-cart' ),
290
+ 'path' => 'products'
291
+ )
292
+ );
293
+
294
+ return $default_menu;
295
+ }
296
+
297
+
298
  public function do_ec_redirect() {
299
 
300
  $screen = get_current_screen();
308
  exit();
309
  }
310
 
311
+ static public function get_capability() {
312
+ return 'manage_options';
313
+ }
314
+
315
  static public function get_dashboard_url() {
316
  return admin_url( self::get_relative_dashboard_url() );
317
  }
319
  static public function get_relative_dashboard_url() {
320
  return 'admin.php?page=' . Ecwid_Admin::ADMIN_SLUG;
321
  }
322
+
323
+ static public function are_auto_menus_enabled()
324
+ {
325
+ if ( get_option( self::OPTION_ENABLE_AUTO_MENUS ) == self::OPTION_ENABLE_AUTO_MENUS_OFF ) {
326
+ return false;
327
+ }
328
+
329
+ if ( get_option( self::OPTION_ENABLE_AUTO_MENUS ) == self::OPTION_ENABLE_AUTO_MENUS_ON ) {
330
+ return true;
331
+ }
332
+
333
+ return !ecwid_migrations_is_original_plugin_version_older_than( '5.8' );
334
+ }
335
 
336
  static public function disable_dashboard() {
337
  if ( !isset( $_GET['reconnect'] ) ) {
344
  }
345
  }
346
 
347
+ $ecwid_admin = new Ecwid_Admin();
includes/class-ecwid-html-meta.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Ecwid_HTML_Meta
4
+ {
5
+
6
+ protected $id;
7
+
8
+ protected function __construct($id)
9
+ {
10
+ $this->id = $id;
11
+ $this->_init();
12
+ }
13
+
14
+ public static function maybe_create()
15
+ {
16
+ $params = Ecwid_Seo_Links::maybe_extract_html_catalog_params();
17
+
18
+ if ( empty( $params ) ) return null;
19
+
20
+ $obj = null;
21
+
22
+ if ( $params['mode'] == 'product' ) {
23
+ $obj = new Ecwid_HTML_Meta_Product( $params['id'] );
24
+ } else if ( $params['mode'] == 'category' ) {
25
+
26
+ $obj = new Ecwid_HTML_Meta_Category( $params['id'] );
27
+ }
28
+
29
+ return $obj;
30
+ }
31
+
32
+ protected function _init()
33
+ {
34
+ add_action( 'wp_head', array( $this, 'wp_head' ) );
35
+ }
36
+
37
+ public function wp_head()
38
+ {
39
+ $this->_print_opengraph_tags();
40
+ $this->_print_twitter_tags();
41
+ }
42
+
43
+ protected function _print_opengraph_tags()
44
+ {
45
+ $og_tags = array(
46
+ 'locale' => get_locale(),
47
+ 'type' => 'article',
48
+ 'title' => $this->_get_title(),
49
+ 'description' => $this->_get_description( ECWID_TRIMMED_DESCRIPTION_LENGTH ),
50
+ 'url' => $this->_get_url(),
51
+ 'site_name' => $this->_get_site_name(),
52
+ 'image' => $this->_get_image_url()
53
+ );
54
+
55
+ $og_tags = apply_filters( 'ecwid_og_tags', $og_tags );
56
+
57
+ if (!empty($og_tags)) {
58
+ foreach ($og_tags as $tag => $value) {
59
+ if (!$value) continue;
60
+
61
+ echo sprintf(
62
+ '<meta property="og:%s" content="%s" />',
63
+ $tag,
64
+ esc_attr($value)
65
+ );
66
+ }
67
+ }
68
+ }
69
+
70
+ protected function _print_twitter_tags()
71
+ {
72
+ $twitter_tags = array(
73
+ 'card' => 'summary_large_image',
74
+ 'description' => $this->_get_description( ECWID_TRIMMED_DESCRIPTION_LENGTH ),
75
+ 'title' => $this->_get_title() . ' - ' . $this->_get_site_name(),
76
+ 'image' => $this->_get_image_url()
77
+ );
78
+
79
+ $twitter_tags = apply_filters( 'ecwid_twitter_tags', $twitter_tags );
80
+
81
+ if ( !empty( $twitter_tags ) ) {
82
+ foreach ($twitter_tags as $tag => $value) {
83
+ if (!$value) continue;
84
+
85
+ echo sprintf(
86
+ '<meta property="twitter:%s" content="%s" />',
87
+ $tag,
88
+ esc_attr( $value )
89
+ );
90
+ }
91
+ }
92
+ }
93
+
94
+ protected function _get_site_name()
95
+ {
96
+ return get_bloginfo( 'name' );
97
+ }
98
+
99
+ protected function _get_description( $length )
100
+ {
101
+ $raw = $this->_get_raw_description();
102
+
103
+ return self::process_raw_description( $raw, $length );
104
+ }
105
+
106
+ abstract protected function _get_title();
107
+
108
+ abstract protected function _get_raw_description();
109
+
110
+ abstract protected function _get_url();
111
+
112
+ abstract protected function _get_image_url();
113
+
114
+ // static only while ecwid_trim_description exists and meta functionality is not moved into this class
115
+ public static function process_raw_description( $description, $length = 0 ) {
116
+ $description = strip_tags( $description );
117
+ $description = html_entity_decode( $description, ENT_NOQUOTES, 'UTF-8' );
118
+
119
+ $description = preg_replace( '![\p{Z}\s]{1,}!u', ' ', $description );
120
+ $description = trim( $description, " \t\xA0\n\r" ); // Space, tab, non-breaking space, newline, carriage return
121
+ $description = mb_substr( $description, 0, $length ? $length : ECWID_TRIMMED_DESCRIPTION_LENGTH, 'UTF-8' );
122
+ $description = htmlspecialchars( $description, ENT_COMPAT, 'UTF-8' );
123
+
124
+ return $description;
125
+ }
126
+ }
127
+
128
+ class Ecwid_HTML_Meta_Product extends Ecwid_HTML_Meta {
129
+
130
+ protected $product;
131
+ protected function _init()
132
+ {
133
+ parent::_init();
134
+ $this->product = Ecwid_Product::get_by_id( $this->id );
135
+ }
136
+
137
+ protected function _get_title()
138
+ {
139
+ return @$this->product->title;
140
+ }
141
+
142
+ protected function _get_raw_description()
143
+ {
144
+ return @$this->product->description;
145
+ }
146
+
147
+ protected function _get_url()
148
+ {
149
+ return @$this->product->link;
150
+ }
151
+
152
+ protected function _get_image_url()
153
+ {
154
+ return @$this->product->hdThumbnailUrl ? @$this->product->hdThumbnailUrl : @$this->product->thumbnailUrl;
155
+ }
156
+ }
157
+
158
+ class Ecwid_HTML_Meta_Category extends Ecwid_HTML_Meta {
159
+
160
+ protected $category;
161
+ protected function _init()
162
+ {
163
+ parent::_init();
164
+ $this->category = Ecwid_Category::get_by_id( $this->id );
165
+ }
166
+
167
+
168
+ protected function _get_title()
169
+ {
170
+ return @$this->category->name;
171
+ }
172
+
173
+ protected function _get_raw_description()
174
+ {
175
+ return @$this->category->description;
176
+ }
177
+
178
+ protected function _get_url()
179
+ {
180
+ return @$this->category->link;
181
+ }
182
+
183
+ protected function _get_image_url()
184
+ {
185
+ return @$this->category->hdThumbnailUrl ? @$this->category->hdThumbnailUrl : @$this->category->thumbnailUrl;
186
+ }
187
+ }
188
+
189
+
190
+ add_action( 'init', array( 'Ecwid_HTML_Meta', 'maybe_create' ) );
includes/class-ecwid-integration-wpseo.php CHANGED
@@ -4,7 +4,9 @@ class Ecwid_Integration_WordPress_SEO_By_Yoast
4
  {
5
  // Store intermediate sitemap generation results here
6
  protected $sitemap = array();
7
-
 
 
8
  public function __construct()
9
  {
10
  add_action( 'wp', array( $this, 'disable_seo_on_escaped_fragment' ) );
@@ -16,12 +18,28 @@ class Ecwid_Integration_WordPress_SEO_By_Yoast
16
  if ( ecwid_is_applicable_escaped_fragment() || Ecwid_Seo_Links::is_product_browser_url() ) {
17
  add_filter( 'wpseo_title', 'ecwid_seo_title' );
18
  add_filter( 'wpseo_metadesc', '__return_false' );
 
 
 
 
 
 
 
19
  }
20
  }
21
 
22
  add_filter( 'ecwid_title_separator', array( $this, 'get_title_separator' ) );
23
  }
24
 
 
 
 
 
 
 
 
 
 
25
  // Disable titles, descriptions and canonical link on ecwid _escaped_fragment_ pages
26
  public function disable_seo_on_escaped_fragment()
27
  {
4
  {
5
  // Store intermediate sitemap generation results here
6
  protected $sitemap = array();
7
+ protected $_og_drop = array( 'title', 'description', 'image', 'type', 'url' );
8
+ protected $_twitter_drop = array( 'title', 'description', 'image', 'card_type' );
9
+
10
  public function __construct()
11
  {
12
  add_action( 'wp', array( $this, 'disable_seo_on_escaped_fragment' ) );
18
  if ( ecwid_is_applicable_escaped_fragment() || Ecwid_Seo_Links::is_product_browser_url() ) {
19
  add_filter( 'wpseo_title', 'ecwid_seo_title' );
20
  add_filter( 'wpseo_metadesc', '__return_false' );
21
+
22
+ add_filter( 'ecwid_og_tags', array( $this, 'filter_og_tags' ) );
23
+ foreach ( $this->_og_drop as $name ) {
24
+ add_filter( 'wpseo_og_' . "og_$name", '__return_empty_string' );
25
+ }
26
+
27
+ add_filter( 'wpseo_output_twitter_card', '__return_false' );
28
  }
29
  }
30
 
31
  add_filter( 'ecwid_title_separator', array( $this, 'get_title_separator' ) );
32
  }
33
 
34
+ public function filter_og_tags( $tags )
35
+ {
36
+ unset( $tags['locale'] );
37
+ unset( $tags['site_name'] );
38
+
39
+ return $tags;
40
+ }
41
+
42
+
43
  // Disable titles, descriptions and canonical link on ecwid _escaped_fragment_ pages
44
  public function disable_seo_on_escaped_fragment()
45
  {
includes/class-ecwid-nav-menus.php CHANGED
@@ -2,6 +2,12 @@
2
 
3
  class Ecwid_Nav_Menus {
4
 
 
 
 
 
 
 
5
  protected $item_types;
6
 
7
  public function __construct() {
@@ -39,6 +45,22 @@ class Ecwid_Nav_Menus {
39
  );
40
  }
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  static public function add_menu_on_activate( ) {
43
 
44
  $locations = get_nav_menu_locations();
@@ -151,10 +173,7 @@ class Ecwid_Nav_Menus {
151
  'items' => $this->get_nav_menu_items()
152
  ));
153
  }
154
-
155
- //- дефолтная категория
156
- //- посмотреть несколько тем
157
-
158
  public function process_menu_items($items)
159
  {
160
  if ( is_admin() || empty($items) ) {
2
 
3
  class Ecwid_Nav_Menus {
4
 
5
+ const OPTION_USE_JS_API_FOR_CATS_MENU = 'ecwid_use_js_api_to_open_store_categories_pages';
6
+ const OPTVAL_USE_JS_API_FOR_CATS_MENU_TRUE = 'on';
7
+ const OPTVAL_USE_JS_API_FOR_CATS_MENU_FALSE = 'off';
8
+ const OPTVAL_USE_JS_API_FOR_CATS_MENU_AUTO = 'auto';
9
+ const FILTER_USE_JS_API_FOR_CATS_MENU = 'ecwid_use_js_api_for_categories_menu';
10
+
11
  protected $item_types;
12
 
13
  public function __construct() {
45
  );
46
  }
47
 
48
+ public static function should_use_js_api_for_categories_menu()
49
+ {
50
+ $value = get_option( self::OPTION_USE_JS_API_FOR_CATS_MENU );
51
+
52
+ if ( $value == self::OPTVAL_USE_JS_API_FOR_CATS_MENU_TRUE ) {
53
+ return true;
54
+ }
55
+ if ( $value == self::OPTVAL_USE_JS_API_FOR_CATS_MENU_FALSE ) {
56
+ return false;
57
+ }
58
+
59
+ $value = apply_filters( self::FILTER_USE_JS_API_FOR_CATS_MENU, $value );
60
+
61
+ return $value == self::OPTVAL_USE_JS_API_FOR_CATS_MENU_TRUE;
62
+ }
63
+
64
  static public function add_menu_on_activate( ) {
65
 
66
  $locations = get_nav_menu_locations();
173
  'items' => $this->get_nav_menu_items()
174
  ));
175
  }
176
+
 
 
 
177
  public function process_menu_items($items)
178
  {
179
  if ( is_admin() || empty($items) ) {
includes/class-ecwid-seo-links.php CHANGED
@@ -264,7 +264,7 @@ JS;
264
  }
265
 
266
  public static function should_display_option() {
267
- return ecwid_migrations_is_original_plugin_version_older_than( '5.2' );
268
  }
269
 
270
  }
264
  }
265
 
266
  public static function should_display_option() {
267
+ return ecwid_migrations_is_original_plugin_version_older_than( '5.2' ) || !self::is_enabled();
268
  }
269
 
270
  }
includes/shortcodes/class-ecwid-shortcode-productbrowser.php CHANGED
@@ -41,7 +41,7 @@ class Ecwid_Shortcode_ProductBrowser extends Ecwid_Shortcode_Base {
41
 
42
  $html_catalog_params['default_category_id'] = @ (int)$this->_params['defaultCategoryId'];
43
 
44
- if ( $html_catalog_params !== false ) {
45
  $plain_content = $this->_build_html_catalog( $store_id, $html_catalog_params );
46
  }
47
 
41
 
42
  $html_catalog_params['default_category_id'] = @ (int)$this->_params['defaultCategoryId'];
43
 
44
+ if ( $html_catalog_params !== false && get_option( 'ecwid_print_html_catalog', 'Y' ) ) {
45
  $plain_content = $this->_build_html_catalog( $store_id, $html_catalog_params );
46
  }
47
 
includes/themes.php CHANGED
@@ -41,13 +41,13 @@ function ecwid_apply_theme($theme_name = null)
41
  'pixova-lite' => array( 'js', 'scroll' ),
42
  'accesspress-mag' => array( 'css' ),
43
  'attitude' => array( 'css-no-parent' ),
44
- 'customizr' => array( 'js', 'css-no-parent' ),
45
  'edin' => array( 'js' ),
46
  'evolve' => array( 'css-no-parent' ),
47
  'mantra' => array( 'css-no-parent' ),
48
  'pagelines' => array( 'js', 'scroll' ),
49
  'responsiveboat' => array( 'css' ),
50
- 'twentyfourteen' => array( 'css', 'scroll' ),
51
  'twentytwelve' => array( 'js', 'scroll' ),
52
  'sliding-door' => array( 'css-no-parent' ),
53
  'zerif-lite' => array( 'css-no-parent' ),
@@ -63,7 +63,10 @@ function ecwid_apply_theme($theme_name = null)
63
  'edge' => array( 'js', 'scroll' ),
64
  'newsmag' => array( 'css-no-parent'),
65
  'optimizer' => array( 'css' ),
66
- 'businesso' => array( 'css' )
 
 
 
67
  );
68
  $generic_themes = apply_filters('ecwid_generic_themes', $generic_themes);
69
 
41
  'pixova-lite' => array( 'js', 'scroll' ),
42
  'accesspress-mag' => array( 'css' ),
43
  'attitude' => array( 'css-no-parent' ),
44
+ 'customizr' => array( 'js', 'css-no-parent', Ecwid_Theme_Base::PROP_USE_JS_API_FOR_CATS_NAV_MENU ),
45
  'edin' => array( 'js' ),
46
  'evolve' => array( 'css-no-parent' ),
47
  'mantra' => array( 'css-no-parent' ),
48
  'pagelines' => array( 'js', 'scroll' ),
49
  'responsiveboat' => array( 'css' ),
50
+ 'twentyfourteen' => array( 'css', 'scroll', Ecwid_Theme_Base::PROP_USE_JS_API_FOR_CATS_NAV_MENU ),
51
  'twentytwelve' => array( 'js', 'scroll' ),
52
  'sliding-door' => array( 'css-no-parent' ),
53
  'zerif-lite' => array( 'css-no-parent' ),
63
  'edge' => array( 'js', 'scroll' ),
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
  );
71
  $generic_themes = apply_filters('ecwid_generic_themes', $generic_themes);
72
 
includes/themes/class-ecwid-theme-base.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  class Ecwid_Theme_Base {
4
 
 
 
5
  public $has_advanced_layout = false;
6
 
7
  protected $adjust_pb_scroll = false;
@@ -13,6 +15,7 @@ class Ecwid_Theme_Base {
13
  protected $css_parent = false;
14
 
15
  public $historyjs_html4mode = false;
 
16
 
17
  public static $instance = null;
18
 
@@ -47,9 +50,17 @@ class Ecwid_Theme_Base {
47
  $theme->historyjs_html4mode = true;
48
  }
49
 
 
 
 
 
50
  return $theme;
51
  }
52
 
 
 
 
 
53
  protected function add_js() {
54
  wp_enqueue_script(
55
  'ecwid-theme-js',
2
 
3
  class Ecwid_Theme_Base {
4
 
5
+ const PROP_USE_JS_API_FOR_CATS_NAV_MENU = 'js-api-for-cats-nav-menu';
6
+
7
  public $has_advanced_layout = false;
8
 
9
  protected $adjust_pb_scroll = false;
15
  protected $css_parent = false;
16
 
17
  public $historyjs_html4mode = false;
18
+ protected $use_js_api_for_cats_nav_menu = false;
19
 
20
  public static $instance = null;
21
 
50
  $theme->historyjs_html4mode = true;
51
  }
52
 
53
+ if (in_array( self::PROP_USE_JS_API_FOR_CATS_NAV_MENU, $props ) ) {
54
+ add_filter( Ecwid_Nav_Menus::FILTER_USE_JS_API_FOR_CATS_MENU, array( $theme, 'filter_use_js_api_for_cats_menu' ) );
55
+ }
56
+
57
  return $theme;
58
  }
59
 
60
+ public function filter_use_js_api_for_cats_menu( $value ) {
61
+ return Ecwid_Nav_Menus::OPTVAL_USE_JS_API_FOR_CATS_MENU_TRUE;
62
+ }
63
+
64
  protected function add_js() {
65
  wp_enqueue_script(
66
  'ecwid-theme-js',
includes/themes/class-ecwid-theme-twentyfifteen.php CHANGED
@@ -14,7 +14,9 @@ class Ecwid_Theme_2015 extends Ecwid_Theme_Base
14
  wp_enqueue_style( 'ecwid-theme', ECWID_PLUGIN_URL . 'css/themes/2015.css', array('twentyfifteen-style'), get_option('ecwid_plugin_version') );
15
  }
16
 
17
- add_action('ecwid_plugin_installed', array($this, 'on_ecwid_plugin_installed'));
 
 
18
  }
19
 
20
  public function on_ecwid_plugin_installed()
14
  wp_enqueue_style( 'ecwid-theme', ECWID_PLUGIN_URL . 'css/themes/2015.css', array('twentyfifteen-style'), get_option('ecwid_plugin_version') );
15
  }
16
 
17
+ add_action( 'ecwid_plugin_installed', array( $this, 'on_ecwid_plugin_installed' ) );
18
+ add_filter( Ecwid_Nav_Menus::FILTER_USE_JS_API_FOR_CATS_MENU, array( $this, 'filter_use_js_api_for_cats_menu' ) );
19
+
20
  }
21
 
22
  public function on_ecwid_plugin_installed()
includes/themes/class-ecwid-theme-twentyseventeen.php CHANGED
@@ -12,6 +12,7 @@ class Ecwid_Theme_2017 extends Ecwid_Theme_Base
12
  wp_enqueue_style( 'ecwid-theme', ECWID_PLUGIN_URL . 'css/themes/2017.css', array('twentyseventeen-style'), get_option('ecwid_plugin_version') );
13
  add_action( 'ecwid_plugin_installed', array( $this, 'on_ecwid_plugin_installed' ) );
14
  add_action( 'ecwid_chameleon_settings', array( $this, 'chameleon_settings' ) );
 
15
  }
16
 
17
  public function chameleon_settings( $chameleon ) {
12
  wp_enqueue_style( 'ecwid-theme', ECWID_PLUGIN_URL . 'css/themes/2017.css', array('twentyseventeen-style'), get_option('ecwid_plugin_version') );
13
  add_action( 'ecwid_plugin_installed', array( $this, 'on_ecwid_plugin_installed' ) );
14
  add_action( 'ecwid_chameleon_settings', array( $this, 'chameleon_settings' ) );
15
+ add_filter( Ecwid_Nav_Menus::FILTER_USE_JS_API_FOR_CATS_MENU, array( $this, 'filter_use_js_api_for_cats_menu' ) );
16
  }
17
 
18
  public function chameleon_settings( $chameleon ) {
includes/themes/class-ecwid-theme-twentysixteen.php CHANGED
@@ -15,7 +15,8 @@ class Ecwid_Theme_2016 extends Ecwid_Theme_Base
15
  if ( Ecwid_Store_Page::is_store_page() ) {
16
  wp_enqueue_style( 'ecwid-theme', ECWID_PLUGIN_URL . 'css/themes/2016.css', array('twentysixteen-style'), get_option('ecwid_plugin_version') );
17
  }
18
- add_action('ecwid_plugin_installed', array($this, 'on_ecwid_plugin_installed'));
 
19
  }
20
 
21
  public function on_ecwid_plugin_installed()
15
  if ( Ecwid_Store_Page::is_store_page() ) {
16
  wp_enqueue_style( 'ecwid-theme', ECWID_PLUGIN_URL . 'css/themes/2016.css', array('twentysixteen-style'), get_option('ecwid_plugin_version') );
17
  }
18
+ add_action( 'ecwid_plugin_installed', array( $this, 'on_ecwid_plugin_installed' ) );
19
+ add_filter( Ecwid_Nav_Menus::FILTER_USE_JS_API_FOR_CATS_MENU, array( $this, 'filter_use_js_api_for_cats_menu' ) );
20
  }
21
 
22
  public function on_ecwid_plugin_installed()
js/admin-menu.js ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ function ecwidRefreshEcwidMenuItemSelection(slug)
3
+ {
4
+ if (!slug) {
5
+ slug = ecwidGetCurrentMenuSlug();
6
+ }
7
+
8
+ if (!slug) return;
9
+
10
+ var parent = jQuery('li#toplevel_page_' + ecwid_admin_menu.baseSlug);
11
+ parent.addClass('wp-has-current-submenu').addClass('wp-menu-open');
12
+
13
+ var selector = 'a[data-ecwid-menu-slug="' + slug + '"]';
14
+
15
+ jQuery('.current', parent).removeClass('current');
16
+ jQuery('.wp-has-current-submenu3', parent).removeClass('wp-has-current-submenu3');
17
+
18
+ jQuery(selector, parent)
19
+ .addClass('current')
20
+ .closest('li')
21
+ .addClass('current')
22
+ .closest('.wp-has-submenu3').addClass('wp-has-current-submenu3');
23
+ }
24
+
25
+ function ecwidGetCurrentMenuSlug()
26
+ {
27
+ var query_parts = location.search.split('&');
28
+ var slug = null;
29
+ for (var i = 0; i < query_parts.length; i++) {
30
+ var param = query_parts[i];
31
+ if (i == 0 && param.startsWith('?')) {
32
+ param = param.substr(1);
33
+ }
34
+
35
+ ecwidPagePrefix = 'page=';
36
+
37
+ if (!param.startsWith(ecwidPagePrefix)) continue;
38
+
39
+ slug = param.substr(ecwidPagePrefix.length);
40
+ }
41
+
42
+ return slug;
43
+ }
44
+
45
+
46
+ function ecwidApplyIframeAdminMenu($link, menu) {
47
+ $link
48
+ .data('ecwid-menu', menu)
49
+ .attr('data-ecwid-menu-slug', menu.slug)
50
+ .click(function () {
51
+ var ecwidMenu = jQuery(this).data('ecwid-menu');
52
+
53
+ var link = jQuery(this).closest('li');
54
+ var is3dlevelMenuRoot = link.hasClass('wp-has-submenu3');
55
+ var isOpen = link.hasClass('wp-has-current-submenu3');
56
+
57
+
58
+ ecwidOpenAdminPage(ecwidMenu.hash);
59
+ history.pushState({}, null, ecwidMenu.url);
60
+
61
+ ecwidRefreshEcwidMenuItemSelection();
62
+
63
+ jQuery('#wpwrap.wp-responsive-open').removeClass('wp-responsive-open');
64
+ jQuery(this).parents('.opensub').removeClass('opensub');
65
+
66
+ return false;
67
+ });
68
+ }
69
+
70
+ function ecwidAddSubmenu(items, parent) {
71
+ var $parent = jQuery(parent);
72
+ var $parentListItem = $parent.closest('li');
73
+
74
+ var $parentList = jQuery('<ul class="wp-submenu3 wp-submenu3-wrap">');
75
+
76
+ $parentListItem.addClass('wp-has-submenu3');
77
+ $parentListItem.append($parentList);
78
+
79
+ if ($parentListItem.find('a').hasClass('current')) {
80
+ $parentListItem.addClass('wp-has-current-submenu3');
81
+ }
82
+
83
+ for (var i in items) {
84
+
85
+ var item = items[i];
86
+ var $link = jQuery('<a>').text(item.title).attr('href', item.url);
87
+
88
+ jQuery('<li>').append($link).appendTo($parentList);
89
+ ecwidApplyIframeAdminMenu($link, item);
90
+ }
91
+
92
+ $parent.closest('li').on('touchstart', function(e) {
93
+ var link = jQuery(this);
94
+
95
+ if (!link.hasClass('opensub') && link.hasClass('wp-has-submenu3')) {
96
+ link.addClass('opensub');
97
+ e.preventDefault();
98
+ return false;
99
+ }
100
+ }).mouseover(function () {
101
+ jQuery(this).addClass('opensub');
102
+ }).mouseout(function () {
103
+ jQuery(this).removeClass('opensub');
104
+ });
105
+ }
106
+
107
+ function ecwidAddMenuItems(items) {
108
+
109
+ var prevItem = jQuery('#toplevel_page_ec-store .wp-submenu-head + li');
110
+ for (var i in items) {
111
+
112
+ if (!items.hasOwnProperty(i)) continue;
113
+
114
+ var menuItem = items[i];
115
+
116
+ var listItem = jQuery('<li>').insertAfter(prevItem);
117
+ var a = jQuery('<a>').data('ecwid-url', menuItem.hash).text(menuItem.title).appendTo(listItem);
118
+ ecwidApplyIframeAdminMenu(a, menuItem);
119
+ listItem.attr('data-ecwid-dynamic-menu', 1);
120
+
121
+ if (menuItem.type == 'separator') {
122
+ listItem.addClass('ec-separator');
123
+ }
124
+ if (menuItem.children) {
125
+ ecwidAddSubmenu(menuItem.children, a);
126
+ }
127
+ prevItem = listItem;
128
+ }
129
+ }
130
+
131
+ jQuery(document).ready(function() {
132
+ if (jQuery('#ecwid-frame').length > 0) {
133
+ if (jQuery('div.update-nag').length > 0) {
134
+ jQuery('#ecwid-frame').addClass('has-wp-message');
135
+ }
136
+ }
137
+
138
+ window.ecwidOpenAdminPage = function (place) {
139
+ jQuery('#ecwid-frame')[0].contentWindow.postMessage(JSON.stringify({
140
+ ecwidAppNs: "ecwid-wp-plugin",
141
+ method: "openPage",
142
+ data: place
143
+ }), "*")
144
+ }
145
+
146
+
147
+ if ( ecwid_admin_menu.enableAutoMenus ) {
148
+
149
+ for (var i in ecwid_admin_menu.menu) {
150
+
151
+ var menu = ecwid_admin_menu.menu[i];
152
+
153
+ var $link = jQuery('li.toplevel_page_ec-store .wp-submenu a[href$="' + menu.url + '"]');
154
+ $link.closest('li').attr('data-ecwid-dynamic-menu', 1);
155
+ ecwidApplyIframeAdminMenu($link, menu);
156
+
157
+ if (menu.children) {
158
+ ecwidAddSubmenu(menu.children, $link);
159
+ }
160
+ }
161
+
162
+ var $link = jQuery('li.toplevel_page_ec-store .wp-submenu a[href="admin.php?page"]');
163
+ $link.closest('li').attr('data-ecwid-dynamic-menu', 1);
164
+ $link.click(function() { return false; });
165
+
166
+ var $link = jQuery('li.toplevel_page_ec-store .wp-submenu a[href="admin.php?page=ec-store"]');
167
+ ecwidApplyIframeAdminMenu($link, {slug:'ec-store', url: 'admin.php?page=ec-store', hash:'dashboard'});
168
+
169
+ }
170
+ ecwidRefreshEcwidMenuItemSelection();
171
+ });
js/admin.js CHANGED
@@ -12,7 +12,6 @@ jQuery(document).ready(function() {
12
  }), "*")
13
  }
14
 
15
-
16
  jQuery('#hide-vote-message').click(function() {
17
  jQuery('#hide-vote-message').addClass('hiding');
18
  jQuery.getJSON(
@@ -109,44 +108,6 @@ jQuery(document).ready(function() {
109
  return false;
110
  });
111
 
112
- var admin_pages = [
113
- {
114
- url: ecwid_params.dashboard_url,
115
- title: ecwid_params.dashboard,
116
- place: 'dashboard'
117
- },
118
- {
119
- url: ecwid_params.products_url,
120
- title: ecwid_params.products,
121
- place: 'products'
122
- },
123
- {
124
- url: ecwid_params.orders_url,
125
- title: ecwid_params.orders,
126
- place: 'orders'
127
- }
128
- ];
129
-
130
- if (jQuery('#ecwid-frame').length > 0) {
131
- if (jQuery('div.update-nag').length > 0) {
132
- jQuery('#ecwid-frame').addClass('has-wp-message');
133
- }
134
-
135
- for (var i = 0; i < admin_pages.length; i++) {
136
- jQuery('li.toplevel_page_ec-store .wp-submenu a[href$="' + admin_pages[i].url + '"]')
137
- .data('ecwid-menu', admin_pages[i])
138
- .click(function() {
139
- var ecwidMenu = jQuery(this).data('ecwid-menu');
140
- jQuery('.toplevel_page_ec-store *.current').removeClass('current');
141
- jQuery(this).addClass('current').closest('li').addClass('current');
142
-
143
- ecwidOpenAdminPage(ecwidMenu.place);
144
-
145
- return false;
146
- });
147
- }
148
- }
149
-
150
  jQuery('#ecwid-get-mobile-app').click(function() {
151
  ecwidOpenAdminPage('mobile');
152
 
@@ -156,6 +117,7 @@ jQuery(document).ready(function() {
156
  if (document.location.hash == 'mobile') {
157
  ecwidOpenAdminPage('mobile');
158
  }
 
159
  });
160
 
161
  prepareVerticalCategoriesWidget = function(element) {
@@ -207,5 +169,11 @@ prepareVerticalCategoriesWidget = function(element) {
207
  });
208
  });
209
 
 
 
 
 
 
 
210
  element.data('vcategoriesInitialized', true);
211
- }
12
  }), "*")
13
  }
14
 
 
15
  jQuery('#hide-vote-message').click(function() {
16
  jQuery('#hide-vote-message').addClass('hiding');
17
  jQuery.getJSON(
108
  return false;
109
  });
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  jQuery('#ecwid-get-mobile-app').click(function() {
112
  ecwidOpenAdminPage('mobile');
113
 
117
  if (document.location.hash == 'mobile') {
118
  ecwidOpenAdminPage('mobile');
119
  }
120
+
121
  });
122
 
123
  prepareVerticalCategoriesWidget = function(element) {
169
  });
170
  });
171
 
172
+ if (jQuery('#ecwid-frame').length > 0) {
173
+ if (jQuery('div.update-nag').length > 0) {
174
+ jQuery('#ecwid-frame').addClass('has-wp-message');
175
+ }
176
+ }
177
+
178
  element.data('vcategoriesInitialized', true);
179
+ }
lib/ecwid_platform.php CHANGED
@@ -91,39 +91,20 @@ class EcwidPlatform {
91
  {
92
  $default_timeout = 10;
93
 
94
- $ctx = stream_context_create(
95
- array(
96
- 'http'=> array(
97
- 'timeout' => $default_timeout
 
 
 
 
98
  )
99
  )
100
  );
101
 
102
- $use_file_get_contents = EcwidPlatform::cache_get('ecwid_fetch_url_use_file_get_contents', false);
103
-
104
- if ( $use_file_get_contents ) {
105
- $result = @file_get_contents($url, null, $ctx);
106
- } else {
107
- if (get_option('ecwid_http_use_stream', false)) {
108
- self::$http_use_streams = true;
109
- }
110
- $result = wp_remote_get( $url, array_merge(
111
- $options,
112
- array(
113
- 'timeout' => get_option( 'ecwid_remote_get_timeout', $default_timeout )
114
- )
115
- )
116
- );
117
-
118
- if (get_option('ecwid_http_use_stream', false)) {
119
- self::$http_use_streams = false;
120
- }
121
- if (!is_array($result)) {
122
- $result = @file_get_contents($url, null, $ctx);
123
- if (!empty($result)) {
124
- EcwidPlatform::cache_set('ecwid_fetch_url_use_file_get_contents', true, DAY_IN_SECONDS );
125
- }
126
- }
127
  }
128
 
129
  $return = array(
@@ -149,15 +130,6 @@ class EcwidPlatform {
149
  'data' => $result->get_error_data(),
150
  'message' => $result->get_error_message()
151
  );
152
-
153
- $get_contents = @file_get_contents($url, null, $ctx);
154
- if ($get_contents !== false) {
155
- $return = array(
156
- 'code' => 200,
157
- 'data' => $get_contents,
158
- 'is_file_get_contents' => true
159
- );
160
- }
161
  }
162
 
163
  return $return;
91
  {
92
  $default_timeout = 10;
93
 
94
+
95
+ if (get_option('ecwid_http_use_stream', false)) {
96
+ self::$http_use_streams = true;
97
+ }
98
+ $result = wp_remote_get( $url, array_merge(
99
+ $options,
100
+ array(
101
+ 'timeout' => get_option( 'ecwid_remote_get_timeout', $default_timeout )
102
  )
103
  )
104
  );
105
 
106
+ if (get_option('ecwid_http_use_stream', false)) {
107
+ self::$http_use_streams = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
 
110
  $return = array(
130
  'data' => $result->get_error_data(),
131
  'message' => $result->get_error_message()
132
  );
 
 
 
 
 
 
 
 
 
133
  }
134
 
135
  return $return;
lib/ecwid_product.php CHANGED
@@ -23,17 +23,12 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
23
 
24
  self::$products[$obj->id] = $obj;
25
  }
26
-
27
- protected static function _new_this() {
28
- return new Ecwid_Category();
29
- }
30
 
31
  public static function get_by_id( $id )
32
  {
33
-
34
  $p = new Ecwid_Product();
35
 
36
- if ( $product = $p->_get_from_local_object_cache($id) ) {
37
  return $product;
38
  }
39
 
@@ -49,7 +44,7 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
49
  $p->_data = $product_data;
50
  }
51
 
52
- $p->_put_into_local_object_cache($p);
53
 
54
 
55
  return $p;
@@ -57,20 +52,20 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
57
 
58
  public static function get_random_product()
59
  {
60
- $total = EcwidPlatform::get_from_products_cache('ecwid_total_products');
61
 
62
  $all_products = false;
63
 
64
- if ($total < 100 && $total > 0 && EcwidPlatform::get_from_products_cache('ecwid_all_products_request')) {
65
  $all_products = EcwidPlatform::get_from_products_cache(
66
- EcwidPlatform::get_from_products_cache('ecwid_all_products_request')
67
  );
68
  }
69
 
70
  if ( $all_products ) {
71
  $index = rand( 0, $total - 1 );
72
 
73
- $result = json_decode($all_products['data']);
74
 
75
  $random_product_id = $result->items[$index]->id;
76
  } else {
@@ -84,7 +79,7 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
84
  )
85
  );
86
 
87
- if (!@$result->items) {
88
  return null;
89
  }
90
 
@@ -98,13 +93,13 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
98
  {
99
  $p = new Ecwid_Product();
100
 
101
- if ( $product = $p->_get_from_local_object_cache($id) ) {
102
  return $product;
103
  }
104
 
105
  $product_data = $p->_get_from_cache( $id );
106
- if (!$product_data) {
107
- if ($fallback_object) {
108
  $product_data = $fallback_object;
109
  } else {
110
  $product_data = new stdClass();
@@ -145,7 +140,7 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
145
  return EcwidPlatform::get_from_products_cache( $this->_get_cache_key_by_id( $id ) );
146
  }
147
 
148
- protected function _load($id) {
149
 
150
  $data = null;
151
  if ( Ecwid_Api_V3::is_available() ) {
@@ -166,7 +161,7 @@ class Ecwid_Product extends Ecwid_Catalog_Entry
166
 
167
  protected function _persist() {
168
 
169
- if ( !property_exists($this->_data, 'id') ) {
170
  return;
171
  }
172
  EcwidPlatform::store_in_products_cache(
23
 
24
  self::$products[$obj->id] = $obj;
25
  }
 
 
 
 
26
 
27
  public static function get_by_id( $id )
28
  {
 
29
  $p = new Ecwid_Product();
30
 
31
+ if ( $product = $p->_get_from_local_object_cache( $id ) ) {
32
  return $product;
33
  }
34
 
44
  $p->_data = $product_data;
45
  }
46
 
47
+ $p->_put_into_local_object_cache( $p );
48
 
49
 
50
  return $p;
52
 
53
  public static function get_random_product()
54
  {
55
+ $total = EcwidPlatform::get_from_products_cache( 'ecwid_total_products' );
56
 
57
  $all_products = false;
58
 
59
+ if ( $total < 100 && $total > 0 && EcwidPlatform::get_from_products_cache( 'ecwid_all_products_request' ) ) {
60
  $all_products = EcwidPlatform::get_from_products_cache(
61
+ EcwidPlatform::get_from_products_cache( 'ecwid_all_products_request' )
62
  );
63
  }
64
 
65
  if ( $all_products ) {
66
  $index = rand( 0, $total - 1 );
67
 
68
+ $result = json_decode( $all_products['data'] );
69
 
70
  $random_product_id = $result->items[$index]->id;
71
  } else {
79
  )
80
  );
81
 
82
+ if ( !@$result->items ) {
83
  return null;
84
  }
85
 
93
  {
94
  $p = new Ecwid_Product();
95
 
96
+ if ( $product = $p->_get_from_local_object_cache( $id ) ) {
97
  return $product;
98
  }
99
 
100
  $product_data = $p->_get_from_cache( $id );
101
+ if ( !$product_data ) {
102
+ if ( $fallback_object ) {
103
  $product_data = $fallback_object;
104
  } else {
105
  $product_data = new stdClass();
140
  return EcwidPlatform::get_from_products_cache( $this->_get_cache_key_by_id( $id ) );
141
  }
142
 
143
+ protected function _load( $id ) {
144
 
145
  $data = null;
146
  if ( Ecwid_Api_V3::is_available() ) {
161
 
162
  protected function _persist() {
163
 
164
+ if ( !property_exists( $this->_data, 'id' ) ) {
165
  return;
166
  }
167
  EcwidPlatform::store_in_products_cache(
lib/ecwid_requests.php CHANGED
@@ -14,6 +14,7 @@ abstract class Ecwid_Http {
14
  protected $code;
15
  protected $message;
16
  protected $headers;
 
17
 
18
  const TRANSPORT_CHECK_EXPIRATION = 86400;
19
 
@@ -75,114 +76,21 @@ abstract class Ecwid_Http {
75
 
76
  public static function create_get($name, $url, $params) {
77
 
78
- $transport_class = self::_get_transport($name, $url, $params);
79
-
80
- if (!$transport_class) {
81
- $transport_class = self::_detect_get_transport($name, $url, $params);
82
- }
83
-
84
- if (empty($transport_class)) {
85
- return null;
86
- }
87
-
88
  $transport = new $transport_class($name, $url, $params);
89
 
90
  return $transport;
91
  }
92
 
93
  public static function create_post($name, $url, $params) {
94
- $transport_class = self::_post_transport($name, $url, $params);
95
-
96
- if (!$transport_class) {
97
- $transport_class = self::_detect_post_transport($name, $url, $params);
98
- }
99
-
100
- if (empty($transport_class)) {
101
- return null;
102
- }
103
-
104
  $transport = new $transport_class($name, $url, $params);
105
 
106
  return $transport;
107
  }
108
 
109
- protected static function _get_transport($name) {
110
- $data = EcwidPlatform::get('get_transport_' . $name);
111
-
112
- if (!empty($data) && @$data['use_default']) {
113
- return self::_get_default_transport();
114
- }
115
-
116
- $preferred = @$data['preferred'];
117
- if (!empty($preferred) && ( time() - @$data['last_check'] ) < self::TRANSPORT_CHECK_EXPIRATION ) {
118
- return $preferred;
119
- }
120
-
121
- return null;
122
- }
123
-
124
-
125
- protected static function _post_transport($name) {
126
- $data = EcwidPlatform::get('get_post_transport_' . $name);
127
-
128
- if (!empty($data) && @$data['use_default']) {
129
- return self::_post_default_transport();
130
- }
131
- $preferred = @$data['preferred'];
132
- if (!empty($preferred) && ( time() - @$data['last_check'] ) < self::TRANSPORT_CHECK_EXPIRATION ) {
133
- return $preferred;
134
- }
135
-
136
- return null;
137
- }
138
-
139
- protected static function _detect_get_transport($name, $url, $params) {
140
-
141
- foreach (self::_get_transports() as $transport_class) {
142
- $transport = new $transport_class($name, $url, $params);
143
-
144
- $result = $transport->do_request();
145
-
146
- if (!$transport->is_error) {
147
- self::_set_transport_for_request(
148
- $name,
149
- array(
150
- 'preferred' => $transport_class,
151
- 'last_check' => time()
152
- )
153
- );
154
-
155
- return $transport_class;
156
- }
157
- }
158
-
159
- return null;
160
- }
161
-
162
-
163
- protected static function _detect_post_transport($name, $url, $params) {
164
-
165
- foreach (self::_post_transports() as $transport_class) {
166
- $transport = new $transport_class($name, $url, $params);
167
-
168
- $result = $transport->do_request();
169
-
170
- if (!$transport->is_error) {
171
- self::_set_transport_for_request(
172
- $name,
173
- array(
174
- 'preferred' => $transport_class,
175
- 'last_check' => time()
176
- )
177
- );
178
-
179
- return $transport_class;
180
- }
181
- }
182
-
183
- return null;
184
- }
185
-
186
  protected static function _set_transport_for_request($name, $transport) {
187
  EcwidPlatform::set('get_transport_' . $name, $transport);
188
  }
@@ -191,22 +99,14 @@ abstract class Ecwid_Http {
191
  return EcwidPlatform::get('get_transport_' . $name);
192
  }
193
 
194
- protected static function _get_default_transport() {
195
  return 'Ecwid_HTTP_Get_WpRemoteGet';
196
  }
197
 
198
- protected static function _post_default_transport() {
199
  return 'Ecwid_HTTP_Post_WpRemotePost';
200
  }
201
-
202
- protected static function _get_transports() {
203
- return array('Ecwid_HTTP_Get_WpRemoteGet', 'Ecwid_HTTP_Get_Fopen');
204
- }
205
-
206
- protected static function _post_transports() {
207
- return array('Ecwid_HTTP_Post_WpRemotePost', 'Ecwid_HTTP_Post_Fopen');
208
- }
209
-
210
  protected function _trigger_error() {
211
  $this->is_error = true;
212
  $this->error = $this->raw_result;
@@ -311,70 +211,6 @@ class Ecwid_HTTP_Get_WpRemoteGet extends Ecwid_HTTP_Get {
311
  }
312
  }
313
 
314
- class Ecwid_HTTP_Get_Fopen extends Ecwid_HTTP_Get {
315
-
316
- protected function _do_request($url, $args) {
317
-
318
- $stream_context_args = array('http'=> array());
319
- if (@$args['timeout']) {
320
- $stream_context_args['http']['timeout'] = $args['timeout'];
321
- }
322
-
323
- $ctx = stream_context_create($stream_context_args);
324
- $handle = @fopen($url, 'r', null, $ctx);
325
-
326
- if (!$handle) {
327
- $this->_trigger_error();
328
-
329
- $last = error_get_last();
330
- $this->message = $last['message'];
331
-
332
- return null;
333
- }
334
-
335
- $this->raw_result = stream_get_contents($handle);
336
-
337
- $this->headers = $this->_get_meta($handle);
338
- $this->code = $this->headers['code'];
339
- $this->message = $this->headers['message'];
340
-
341
- return $this->raw_result;
342
- }
343
-
344
- protected function _get_meta($handle) {
345
- $meta = stream_get_meta_data($handle);
346
-
347
- $result = array();
348
-
349
- $headers = $meta['wrapper_data'];
350
- if (isset($headers['headers'])) {
351
- $headers = $headers['headers'];
352
- }
353
- foreach ($headers as $item) {
354
-
355
- if (!is_string($item)) {
356
- ecwid_log_error(@json_encode($item));
357
- continue;
358
- }
359
-
360
- $match = array();
361
- if (preg_match('|HTTP/\d\.\d\s+(\d+)\s+(.*)|',$item, $match)) {
362
- $result['code'] = $match[1];
363
- $result['message'] = $match[2];
364
- }
365
-
366
- $colon_pos = strpos($item, ':');
367
-
368
- if (!$colon_pos) continue;
369
-
370
- $name = substr($item, 0, $colon_pos);
371
- $result[strtolower($name)] = trim(substr($item, $colon_pos + 1));
372
- }
373
-
374
- return $result;
375
- }
376
- }
377
-
378
  abstract class Ecwid_HTTP_Post extends Ecwid_Http {
379
 
380
  }
@@ -401,81 +237,4 @@ class Ecwid_HTTP_Post_WpRemotePost extends Ecwid_Http_Post {
401
  return $this->raw_result['body'];
402
 
403
  }
404
- }
405
-
406
- class Ecwid_HTTP_Post_Fopen extends Ecwid_Http_Post {
407
- protected function _do_request($url, $args) {
408
-
409
- $stream_context_args = array(
410
- 'http'=> array(
411
- 'method' => 'POST',
412
- 'headers' => 'Content-Type: application/x-www-form-urlencoded\r\n'
413
- )
414
- );
415
- if (@$args['timeout']) {
416
- $stream_context_args['http']['timeout'] = $args['timeout'];
417
- }
418
-
419
- if (@$args['headers']) {
420
- $stream_context_args['http']['headers'] = $args['headers'];
421
- }
422
-
423
- if (@$args['body']) {
424
- $stream_context_args['http']['content'] = http_build_query($args['body']);
425
- }
426
-
427
-
428
- $ctx = stream_context_create($stream_context_args);
429
- $handle = @fopen($url, 'r', null, $ctx);
430
-
431
- if (!$handle) {
432
- $this->_trigger_error();
433
- $this->message = error_get_last();
434
-
435
- return null;
436
- }
437
-
438
- $this->raw_result = stream_get_contents($handle);
439
-
440
- $this->headers = $this->_get_meta($handle);
441
- $this->code = $this->headers['code'];
442
- $this->message = $this->headers['message'];
443
-
444
- return $this->raw_result;
445
- }
446
-
447
- protected function _get_meta($handle) {
448
- $meta = stream_get_meta_data($handle);
449
-
450
- $result = array();
451
-
452
- $headers = $meta['wrapper_data'];
453
- if (isset($headers['headers'])) {
454
- $headers = $headers['headers'];
455
- }
456
- foreach ($headers as $item) {
457
-
458
- if (!is_string($item)) {
459
- ecwid_log_error(@json_encode($item));
460
- continue;
461
- }
462
-
463
- $match = array();
464
- if (preg_match('|HTTP/\d\.\d\s+(\d+)\s+(.*)|',$item, $match)) {
465
- $result['code'] = $match[1];
466
- $result['message'] = $match[2];
467
- }
468
-
469
- $colon_pos = strpos($item, ':');
470
-
471
- if (!$colon_pos) continue;
472
-
473
- $name = substr($item, 0, $colon_pos);
474
- $result[strtolower($name)] = trim(substr($item, $colon_pos + 1));
475
- }
476
-
477
- return $result;
478
- }
479
-
480
-
481
- }
14
  protected $code;
15
  protected $message;
16
  protected $headers;
17
+ protected $error;
18
 
19
  const TRANSPORT_CHECK_EXPIRATION = 86400;
20
 
76
 
77
  public static function create_get($name, $url, $params) {
78
 
79
+ $transport_class = self::_get_transport();
80
+
 
 
 
 
 
 
 
 
81
  $transport = new $transport_class($name, $url, $params);
82
 
83
  return $transport;
84
  }
85
 
86
  public static function create_post($name, $url, $params) {
87
+ $transport_class = self::_post_transport();
88
+
 
 
 
 
 
 
 
 
89
  $transport = new $transport_class($name, $url, $params);
90
 
91
  return $transport;
92
  }
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  protected static function _set_transport_for_request($name, $transport) {
95
  EcwidPlatform::set('get_transport_' . $name, $transport);
96
  }
99
  return EcwidPlatform::get('get_transport_' . $name);
100
  }
101
 
102
+ protected static function _get_transport() {
103
  return 'Ecwid_HTTP_Get_WpRemoteGet';
104
  }
105
 
106
+ protected static function _post_transport() {
107
  return 'Ecwid_HTTP_Post_WpRemotePost';
108
  }
109
+
 
 
 
 
 
 
 
 
110
  protected function _trigger_error() {
111
  $this->is_error = true;
112
  $this->error = $this->raw_result;
211
  }
212
  }
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  abstract class Ecwid_HTTP_Post extends Ecwid_Http {
215
 
216
  }
237
  return $this->raw_result['body'];
238
 
239
  }
240
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.5
5
  Tested up to: 4.9
6
- Stable tag: 5.7.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
 
@@ -149,6 +149,12 @@ You can use Ecwid’s built-in import tools to copy your store products from any
149
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
150
 
151
  == Changelog ==
 
 
 
 
 
 
152
  = 5.7.3 - Jan 18, 2018 =
153
  - **Improved compatibility with Customizr theme.** We are inspecting how the plugin works with a popular “Customizr” theme and making the store appearance and behavior fit the theme better. This is the first part of improvements for Customizr, we will continue making it better in the future versions.
154
  - **Improvements in the way the plugin communicates with the Ecwid APIs.** We cleaned up the plugin code and improved its internal functions to make sure storefront and product widgets are using the newest Ecwid API and work more stable.
@@ -159,7 +165,7 @@ You can use Ecwid’s built-in import tools to copy your store products from any
159
  - **Fixed a couple of bugs on the Ecwid dashboard page.** The store control panel might not appear in the Wordpress backend for some users (especially it was likely to happen in Safari browser). We fixed it. So if you experienced that issue in your Wordpress admin backend, this update should fix it for you.
160
  - **Added fixes and layout improvements to make Ecwid e-commerce plugin compatible with “Abubize Business” and “Evolve Plus” Wordpress themes.** If you use one of those themes, you might notice layout issues on your store page caused by the theme styles overriding Ecwid styles. We fixed that. If you find any trouble in how Ecwid works with your theme, please let us know.
161
  - **Fixed an issue in the way Ecwid shortcode is rendered in the Wordpress page editor.** You might notice the Wordpress editor froze when you changed the "widgets" part of the Ecwid shortcode in the editor. For example, if you put a shortcode with categories widget only (without product browser). We fixed it — now you can adjust the shortcode as you wish. Note this problem only affected the Wordpress editor — neither your store nor your control panel were affected. So, if you don't customize the shortcode content, you can just ignore this, everything is working fine for you.
162
- - **Several minor fixes and improvements.** Ecwid is constantly updated with new cool ecommerce features. To see more updates and learn something new about selling online, see our see [our blog](https://www.ecwid.com/blog/ecwid-updates).
163
 
164
  = 5.7.1 =
165
  - **Fix for the “The requested product is not available” error message appeared in the version 5.7**. The issue was caused by the new “Default product” feature. Some users found that error message when adding their store to a new page in the plugin and specifying the default category for that page. Everything should work fine now.
3
  Tags: ecommerce, downloadable products, Facebook ecommerce, online store, paypal, product catalog, shop, shopping cart, store
4
  Requires at least: 3.5
5
  Tested up to: 4.9
6
+ Stable tag: 5.8
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
 
149
  * [Ecwid eCommerce Forums](https://www.ecwid.com/forums/forumdisplay.php?f=19)
150
 
151
  == Changelog ==
152
+ = 5.8 - Feb 8, 2018 =
153
+ - **Improved OG tags support.** OpenGraph (or OG) tags are special marks in site pages code, that are used to make better snippets when you share a page on Facebook, Twitter and other sites and social networks. We added OG tags to the products pages — this will make your product title, description and image appear in a snippet/post when you share a link to that product.
154
+ - **Revamped Ecwid menu in WordPress admin backend.** Historically, the Ecwid store management dashboard displayed navigation within the central page content when you open it in your Wordpress admin backend. So, you open the “Ecwid” menu in your WP admin and then navigate through your store admin pages within that general “Ecwid” page. We’re improving this process: now the store admin navigation menu will be a part of the Wordpress native admin menu, so you will find products/sales/settings/promotions/apps and other sections right in the Wordpress left-hand navigation sidebar. This will align the Ecwid plugin navigation with the general Wordpress navigation and provide more natural way to find the right page of your store dashboard. Also, this will free some space in the page central area to make it more convenient to manage your store, especially on mobile devices. IMPORTANT: The change is now enabled for the new plugin users only. We will gradually roll it out to all of the plugin users in the upcoming updates.
155
+ - **Improved compatibility with Customizr theme (part 2).** We continue improving the Ecwid online store plugin to work well with a popular “Customizr” theme and to make the store appearance and behavior fit the theme better. This is a continue of the improvements for Customizr that we released in the previous plugin update. If you’re using the Customizr theme, please let us know what you think.
156
+ - **Several minor fixes and improvements.** The Ecwid plugin is constantly updated with new features and tools. To see more updates, see [our ecommerce blog](https://www.ecwid.com/blog/ecwid-updates).
157
+
158
  = 5.7.3 - Jan 18, 2018 =
159
  - **Improved compatibility with Customizr theme.** We are inspecting how the plugin works with a popular “Customizr” theme and making the store appearance and behavior fit the theme better. This is the first part of improvements for Customizr, we will continue making it better in the future versions.
160
  - **Improvements in the way the plugin communicates with the Ecwid APIs.** We cleaned up the plugin code and improved its internal functions to make sure storefront and product widgets are using the newest Ecwid API and work more stable.
165
  - **Fixed a couple of bugs on the Ecwid dashboard page.** The store control panel might not appear in the Wordpress backend for some users (especially it was likely to happen in Safari browser). We fixed it. So if you experienced that issue in your Wordpress admin backend, this update should fix it for you.
166
  - **Added fixes and layout improvements to make Ecwid e-commerce plugin compatible with “Abubize Business” and “Evolve Plus” Wordpress themes.** If you use one of those themes, you might notice layout issues on your store page caused by the theme styles overriding Ecwid styles. We fixed that. If you find any trouble in how Ecwid works with your theme, please let us know.
167
  - **Fixed an issue in the way Ecwid shortcode is rendered in the Wordpress page editor.** You might notice the Wordpress editor froze when you changed the "widgets" part of the Ecwid shortcode in the editor. For example, if you put a shortcode with categories widget only (without product browser). We fixed it — now you can adjust the shortcode as you wish. Note this problem only affected the Wordpress editor — neither your store nor your control panel were affected. So, if you don't customize the shortcode content, you can just ignore this, everything is working fine for you.
168
+ - **Several minor fixes and improvements.** Ecwid is constantly updated with new cool ecommerce features. To see more updates and learn something new about selling online, see [our blog](https://www.ecwid.com/blog/ecwid-updates).
169
 
170
  = 5.7.1 =
171
  - **Fix for the “The requested product is not available” error message appeared in the version 5.7**. The issue was caused by the new “Default product” feature. Some users found that error message when adding their store to a new page in the plugin and specifying the default category for that page. Everything should work fine now.
templates/ecwid-admin.php CHANGED
@@ -1,4 +1,6 @@
1
  <script type='text/javascript'>//<![CDATA[
 
 
2
  jQuery(document).ready(function() {
3
  document.body.className += ' ecwid-no-padding';
4
  $ = jQuery;
@@ -9,13 +11,69 @@
9
 
10
  // Listen to message from child window
11
  eventer(messageEvent,function(e) {
12
- $('#ecwid-frame').css('height', e.data.height + 'px');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  },false);
14
 
15
  $('#ecwid-frame').attr('src', '<?php echo $iframe_src; ?>');
16
  ecwidSetPopupCentering('#ecwid-frame');
17
  });
18
  //]]>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  </script>
21
 
1
  <script type='text/javascript'>//<![CDATA[
2
+ jQuery(document.body).addClass('ecwid-admin-iframe');
3
+
4
  jQuery(document).ready(function() {
5
  document.body.className += ' ecwid-no-padding';
6
  $ = jQuery;
11
 
12
  // Listen to message from child window
13
  eventer(messageEvent,function(e) {
14
+ if (typeof e.data.height != 'undefined') {
15
+ $('#ecwid-frame').css('height', e.data.height + 'px');
16
+ } else if (
17
+ e.data.action
18
+ && e.data.action == 'navigationMenuUpdated'
19
+ && e.data.data && e.data.data.navigationMenuItems
20
+ && e.data.data.navigationMenuItems.length > 0
21
+ && ecwid_admin_menu.enableAutoMenus
22
+ ) {
23
+ jQuery.ajax({
24
+ 'url': ajaxurl + '?action=<?php echo Ecwid_Admin::AJAX_ACTION_UPDATE_MENU; ?>',
25
+ 'method': 'POST',
26
+ 'data': {
27
+ menu: e.data.data.navigationMenuItems
28
+ },
29
+ 'success': function(result) {
30
+ jQuery('li[data-ecwid-dynamic-menu]').remove();
31
+ ecwidAddMenuItems(jQuery.parseJSON(result));
32
+ ecwidRefreshEcwidMenuItemSelection();
33
+ }
34
+ });
35
+
36
+
37
+ //ecwidUpdateAdminMenus(e.data.data.navigationMenuItems);
38
+ }
39
  },false);
40
 
41
  $('#ecwid-frame').attr('src', '<?php echo $iframe_src; ?>');
42
  ecwidSetPopupCentering('#ecwid-frame');
43
  });
44
  //]]>
45
+
46
+ function ecwidUpdateAdminMenus(menus) {
47
+
48
+ var result = [];
49
+ for (var i = 0; i < menus.length; i++) {
50
+ var menu = menus[i];
51
+ if (menu.type == 'separator') {
52
+ continue;
53
+ }
54
+
55
+ var newItem = {};
56
+ newItem.title = menu.title;
57
+ newItem.slug = menu.path;
58
+
59
+ if (menu.items) {
60
+ newItem.children = [];
61
+ for (var j = 0; j < menu.items.length; j++) {
62
+ child = menu.items[j];
63
+ newItem.children[newItem.children.length] = {
64
+ 'title': child.title,
65
+ 'slug': child.path
66
+ };
67
+ }
68
+ }
69
+
70
+ result[result.length] = newItem;
71
+ }
72
+
73
+ jQuery('li[data-ecwid-dynamic-menu=1]').remove();
74
+
75
+ ecwidAddMenuItems(result);
76
+ }
77
 
78
  </script>
79