Skip to content

Commit

Permalink
PLUGINS-6905
Browse files Browse the repository at this point in the history
  • Loading branch information
meteor-ec committed Jun 21, 2024
1 parent 7d97ed6 commit 610df52
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion ecwid-shopping-cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Description: Ecwid by Lightspeed 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.
Text Domain: ecwid-shopping-cart
Author: Ecwid Ecommerce
Version: 6.12.13
Version: 6.12.14
Author URI: https://ecwid.to/ecwid-site
License: GPLv2 or later
*/
Expand Down
8 changes: 3 additions & 5 deletions includes/class-ecwid-static-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,11 @@ protected static function maybe_fetch_data() {
$cached_data = EcwidPlatform::get_from_static_pages_cache( $url );
if ( $cached_data ) {
$is_css_defined = ! empty( $dynamic_css );
$is_css_already_set = ! empty( $cached_data->isSetDynamicCss ); //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$is_css_already_set = in_array( $dynamic_css, $cached_data->cssFiles, true ); //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$is_home_page = Ecwid_Store_Page::is_store_home_page();

if ( $is_home_page && $is_css_defined && ! $is_css_already_set ) {
$cached_data->cssFiles = array( $dynamic_css ); //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$cached_data->isSetDynamicCss = true; //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$cached_data->cssFiles = array( $dynamic_css ); //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase

EcwidPlatform::store_in_static_pages_cache( $url, $cached_data );
}
Expand Down Expand Up @@ -213,8 +212,7 @@ protected static function get_static_snapshot( $url, $dynamic_css = '' ) {

//phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
if ( ! empty( $dynamic_css ) ) {
$fetched_data->cssFiles = array( $dynamic_css );
$fetched_data->isSetDynamicCss = true;
$fetched_data->cssFiles = array( $dynamic_css );
}

if ( ! empty( $fetched_data->htmlCode ) ) {
Expand Down
32 changes: 14 additions & 18 deletions includes/shortcodes/class-ecwid-shortcode-productbrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,21 @@ protected function get_dynamic_html_code( $is_default_render = true, $classname
}

protected function get_js_for_adding_html_id() {
global $ecwid_current_theme;
if ( $ecwid_current_theme ) {
ob_start();
?>
<!--noptimize-->
<script data-cfasync="false" data-no-optimize="1">
if( typeof document.documentElement.id == 'undefined' || document.documentElement.id === '' ) {
document.documentElement.id = 'ecwid_html';
}
ob_start();
?>
<!--noptimize-->
<script data-cfasync="false" data-no-optimize="1">
if( typeof document.documentElement.id == 'undefined' || document.documentElement.id === '' ) {
document.documentElement.id = 'ecwid_html';
}

if( typeof document.body.id == 'undefined' || document.body.id === '' ) {
document.body.id = 'ecwid_body';
}
</script>
<!--/noptimize-->
<?php
return ob_get_clean();
}
return '';
if( typeof document.body.id == 'undefined' || document.body.id === '' ) {
document.body.id = 'ecwid_body';
}
</script>
<!--/noptimize-->
<?php
return ob_get_clean();
}

protected function get_js_for_switch_dynamic( $static_container_id, $dynamic_container_id ) {
Expand Down
2 changes: 1 addition & 1 deletion js/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var ecwidSaveDynamicCss = function () {
if (typeof Ecwid != 'undefined') {
Ecwid.OnAPILoaded.add(function () {
if (typeof window.ec.cssLinkElement !== 'undefined') {
document.cookie = "ec_store_dynamic_css=" + window.ec.cssLinkElement.href;
document.cookie = 'ec_store_dynamic_css=' + window.ec.cssLinkElement.href;
}
});
}
Expand Down

0 comments on commit 610df52

Please sign in to comment.