From 2a526c5f689617b5b5edd410ef39704dedb1537b Mon Sep 17 00:00:00 2001 From: meteor Date: Thu, 5 Sep 2024 18:28:05 +0400 Subject: [PATCH 01/15] PLUGINS-6837 added added store connection reset handling --- includes/class-ecwid-admin-main-page.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/class-ecwid-admin-main-page.php b/includes/class-ecwid-admin-main-page.php index 915e6b12..90c53774 100644 --- a/includes/class-ecwid-admin-main-page.php +++ b/includes/class-ecwid-admin-main-page.php @@ -146,13 +146,21 @@ public function _do_integrated_admin_page( $page = self::PAGE_HASH_DASHBOARD ) { $result = $request->do_request( array( 'timeout' => 20 ) ); }//end if + $need_to_force_show_dashboard = false; + if ( $result['code'] == 403 ) { - Ecwid_Api_V3::save_token( '' ); + if ( get_option( EcwidPlatform::OPTION_ECWID_CHECK_API_RETRY_AFTER, 0 ) == 0 ) { + Ecwid_Api_V3::set_api_status( Ecwid_Api_V3::API_STATUS_ERROR_TOKEN ); + Ecwid_Api_V3::save_token( '' ); + } else { + update_option( EcwidPlatform::OPTION_ECWID_CHECK_API_RETRY_AFTER, time() + 5 * MINUTE_IN_SECONDS ); + $need_to_force_show_dashboard = true; + } } if ( empty( $result['code'] ) && empty( $result['data'] ) || $result['code'] == 500 ) { require_once ECWID_PLUGIN_DIR . 'templates/admin-timeout.php'; - } elseif ( $result['code'] != 200 ) { + } elseif ( $result['code'] != 200 && ! $need_to_force_show_dashboard ) { if ( ecwid_test_oauth( true ) ) { require_once ECWID_PLUGIN_DIR . 'templates/reconnect-sso.php'; } else { From 625481dc14b1dcb7bc06d9e6ab9e9c1ee153a550 Mon Sep 17 00:00:00 2001 From: meteor Date: Wed, 16 Oct 2024 23:11:18 +0400 Subject: [PATCH 02/15] PLUGINS-6949 --- CHANGELOG.txt | 4 ++++ ecwid-shopping-cart.php | 3 +-- readme.txt | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 70dc9124..e68e953a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,8 @@ == Changelog == += 6.12.21 - Oct 16, 2024 = +- Fixed issue with Single Sign On (SSO). Single Sign-On allows your customers to have a single login for both your WordPress site and your Ecwid store. If this feature is not working properly after latests release, please update your plugin. +- Internal improvements and optimizations. + = 6.12.20 - Oct 3, 2024 = - In the "Only featured products" mode, the "Store Home Page" ecommerce block was displayed incorrectly. We've fixed this. - Fixed an issue with the "Manage access to store control panel" feature where in some cases users couldn't have access to embedded store control panel. diff --git a/ecwid-shopping-cart.php b/ecwid-shopping-cart.php index 524608bf..7ef03a41 100644 --- a/ecwid-shopping-cart.php +++ b/ecwid-shopping-cart.php @@ -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.20 +Version: 6.12.21 Author URI: https://ecwid.to/ecwid-site License: GPLv2 or later */ @@ -2988,7 +2988,6 @@ function ecwid_update_store_id( $new_store_id ) { function ecwid_is_paid_account() { - return false; if ( Ecwid_Api_V3::is_available() ) { $api = new Ecwid_Api_V3(); diff --git a/readme.txt b/readme.txt index 13216cd7..466c0ea6 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Requires at least: 4.4 Tested up to: 6.6 -Stable tag: 6.12.20 +Stable tag: 6.12.21 Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available. @@ -153,6 +153,10 @@ You can use Ecwid’s built-in import tools to copy your store products from any * [Ecwid Help Center](http://help.ecwid.com "Ecwid Help") == Changelog == += 6.12.21 - Oct 16, 2024 = +- Fixed issue with Single Sign On (SSO). Single Sign-On allows your customers to have a single login for both your WordPress site and your Ecwid store. If this feature is not working properly after latests release, please update your plugin. +- Internal improvements and optimizations. + = 6.12.20 - Oct 3, 2024 = - In the "Only featured products" mode, the "Store Home Page" ecommerce block was displayed incorrectly. We've fixed this. - Fixed an issue with the "Manage access to store control panel" feature where in some cases users couldn't have access to embedded store control panel. From a96639766e233bcc8ea60310cefbf2ddfa28ebce Mon Sep 17 00:00:00 2001 From: meteor Date: Fri, 6 Sep 2024 09:44:56 +0400 Subject: [PATCH 03/15] PLUGINS-6932 added new pages to rewrite rules --- includes/class-ecwid-seo-links.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/includes/class-ecwid-seo-links.php b/includes/class-ecwid-seo-links.php index 9cc95641..a5fd0e92 100644 --- a/includes/class-ecwid-seo-links.php +++ b/includes/class-ecwid-seo-links.php @@ -162,20 +162,28 @@ public static function get_seo_links_patterns() { 'search', 'search\?.*', 'signin', + 'signOut', + 'signIn.*', + 'signOut.*', 'pages\/about', 'pages\/shipping-payment', 'pages\/returns', 'pages\/terms', 'pages\/privacy-policy', - 'signIn.*', 'resetPassword.*', 'checkoutAB.*', - 'downloadError.*', - 'orderFailure.*', 'checkoutCC.*', 'checkoutEC.*', 'checkoutAC.*', + 'downloadError.*', + 'checkoutResult.*', + 'checkoutWait.*', + 'orderFailure.*', 'FBAutofillCheckout.*', + 'pay.*', + 'repeat-order.*', + 'subscribe.*', + 'unsubscribe.*', ); } @@ -502,7 +510,17 @@ public static function is_noindex_page() { 'account', 'checkout', 'signin', + 'signOut', 'search', + 'pages', + 'downloadError', + 'checkoutResult', + 'checkoutWait', + 'orderFailure', + 'pay', + 'repeat-order', + 'subscribe', + 'unsubscribe', ); $home_url = home_url(); From 01781740cc49eefc835719195aec244de4399a16 Mon Sep 17 00:00:00 2001 From: meteor Date: Tue, 10 Sep 2024 11:03:09 +0400 Subject: [PATCH 04/15] PLUGINS-6936 removed legacy demo store using --- ecwid-shopping-cart.php | 12 ++---------- includes/class-ecwid-wp-dashboard-feed.php | 7 ------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/ecwid-shopping-cart.php b/ecwid-shopping-cart.php index fc7eaeef..413629db 100644 --- a/ecwid-shopping-cart.php +++ b/ecwid-shopping-cart.php @@ -2164,26 +2164,18 @@ function ecwid_get_demo_store_id() { $demo_stores = ecwid_get_demo_stores(); - $locale = get_locale(); - - if ( strpos( $locale, 'ru' ) === 0 ) { - return $demo_stores['locale_ru']; - } else { - return $demo_stores['locale_other']; - } + return $demo_stores['locale_other']; } function ecwid_get_demo_stores() { - return $demo_stores = array( + return array( 'legacy' => 1003, - 'locale_ru' => 13437191, 'locale_other' => 13433173 ); } function ecwid_get_demo_store_public_key() { $public_keys = array( - 13437191 => 'public_LRaZBiDigZCMJquHkRWDpdAt4HPmb4zH', 13433173 => 'public_9EYLuZ15kfKEHdpsuKMsqp9MZ2Umxtcp' ); diff --git a/includes/class-ecwid-wp-dashboard-feed.php b/includes/class-ecwid-wp-dashboard-feed.php index 49e876a1..3019cea6 100644 --- a/includes/class-ecwid-wp-dashboard-feed.php +++ b/includes/class-ecwid-wp-dashboard-feed.php @@ -25,13 +25,6 @@ public function dashboard_setup() { $media_url = 'https://www.ecwid.com/wp-json/wp/v2/media/'; $images_cdn = 'https://web-cdn.ecwid.com/wp-content/uploads/'; - $lang = ecwid_get_current_user_locale(); - if ( $lang === 'ru_RU' ) { - $url = 'https://www.ecwid.ru/wp-json/wp/v2/posts?per_page=3&categories=1'; - $media_url = 'https://www.ecwid.ru/wp-json/wp/v2/media/'; - $images_cdn = 'https://web-cdn.ecwid.com/wp-content/uploads/ru/'; - } - wp_enqueue_style( 'ecwid-dashboard-blog', ECWID_PLUGIN_URL . '/css/dashboard-blog.css', array(), get_option( 'ecwid_plugin_version' ) ); wp_enqueue_script( 'ecwid-dashboard-blog', ECWID_PLUGIN_URL . '/js/dashboard-blog.js', array( 'jquery' ), get_option( 'ecwid_plugin_version' ) ); From 537b68739013791b02bb6d1f3605c9bb22240814 Mon Sep 17 00:00:00 2001 From: meteor Date: Wed, 11 Sep 2024 11:55:49 +0400 Subject: [PATCH 05/15] v 6.12.19 release preparations --- .distignore | 1 + CHANGELOG.txt | 4 ++++ ecwid-shopping-cart.php | 2 +- readme.txt | 6 +++++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.distignore b/.distignore index a3904e6f..5a95456d 100644 --- a/.distignore +++ b/.distignore @@ -5,5 +5,6 @@ .distignore .gitignore +composer.json CHANGELOG.txt README.md \ No newline at end of file diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f547b006..def0228a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,8 @@ == Changelog == += 6.12.19 - Sep 11, 2024 = +- Fixed an issue with processing some store pages links. +- Internal improvements and optimizations. + = 6.12.18 - Aug 19, 2024 = - Improved compatibility with pages created using the Jetpack plugin. Now ecommerce blocks added to Portfolio and Testimonial pages work as well as on regular pages. - Fixed an issue with product option fields working on product pages. In some cases, product options were not clickable. We've fixed this. diff --git a/ecwid-shopping-cart.php b/ecwid-shopping-cart.php index 413629db..582f573d 100644 --- a/ecwid-shopping-cart.php +++ b/ecwid-shopping-cart.php @@ -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.18 +Version: 6.12.19 Author URI: https://ecwid.to/ecwid-site License: GPLv2 or later */ diff --git a/readme.txt b/readme.txt index 663447a5..1d37e06a 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Requires at least: 4.4 Tested up to: 6.6 -Stable tag: 6.12.18 +Stable tag: 6.12.19 Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available. @@ -153,6 +153,10 @@ You can use Ecwid’s built-in import tools to copy your store products from any * [Ecwid Help Center](http://help.ecwid.com "Ecwid Help") == Changelog == += 6.12.19 - Sep 11, 2024 = +- Fixed an issue with processing some store pages links. +- Internal improvements and optimizations. + = 6.12.18 - Aug 19, 2024 = - Improved compatibility with pages created using the Jetpack plugin. Now ecommerce blocks added to Portfolio and Testimonial pages work as well as on regular pages. - Fixed an issue with product option fields working on product pages. In some cases, product options were not clickable. We've fixed this. From 8d899d1e07094c15914da07c5a976c7696fdf28a Mon Sep 17 00:00:00 2001 From: meteor Date: Tue, 17 Sep 2024 17:21:18 +0400 Subject: [PATCH 06/15] PLUGINS-6894 fixed issue for only featured products mode --- includes/class-ecwid-product-browser.php | 2 -- includes/class-ecwid-static-page.php | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/includes/class-ecwid-product-browser.php b/includes/class-ecwid-product-browser.php index 96afbf62..32c5e32d 100644 --- a/includes/class-ecwid-product-browser.php +++ b/includes/class-ecwid-product-browser.php @@ -428,7 +428,6 @@ public static function get_attributes() { } if ( $api->is_store_feature_available( Ecwid_Api_V3::FEATURE_PRODUCT_SUBTITLES ) ) { - $attributes['product_list_subtitles_behavior'] = array( 'name' => 'product_list_subtitles_behavior', 'title' => __( 'Product subtitles', 'ecwid-shopping-cart' ), @@ -447,7 +446,6 @@ public static function get_attributes() { } return $attributes; - } protected static function _get_behaviors() { diff --git a/includes/class-ecwid-static-page.php b/includes/class-ecwid-static-page.php index e33f4dc4..5d8110c1 100644 --- a/includes/class-ecwid-static-page.php +++ b/includes/class-ecwid-static-page.php @@ -124,7 +124,7 @@ protected static function maybe_fetch_data() { $pb_attribures[ $param ] = array( 'name' => $param, 'is_storefront_api' => true, - 'type' => true, + 'type' => 'boolean', ); } } From dab931fb8dda82f2b5e2847bb22620e96f689c28 Mon Sep 17 00:00:00 2001 From: meteor Date: Wed, 18 Sep 2024 15:09:08 +0400 Subject: [PATCH 07/15] PLUGINS-6620 removed unused code --- ecwid-shopping-cart.php | 2 +- includes/class-ecwid-store-page.php | 41 ----- .../shortcodes/class-ecwid-shortcode-stub.php | 27 ---- lib/ecwid_catalog.php | 141 ------------------ lib/html-catalog-templates/category.php | 33 ---- lib/html-catalog-templates/product.php | 83 ----------- templates/ecwid-admin.php | 4 - 7 files changed, 1 insertion(+), 330 deletions(-) delete mode 100644 includes/shortcodes/class-ecwid-shortcode-stub.php delete mode 100755 lib/ecwid_catalog.php delete mode 100644 lib/html-catalog-templates/category.php delete mode 100644 lib/html-catalog-templates/product.php diff --git a/ecwid-shopping-cart.php b/ecwid-shopping-cart.php index 582f573d..878f44f7 100644 --- a/ecwid-shopping-cart.php +++ b/ecwid-shopping-cart.php @@ -108,7 +108,7 @@ require_once ECWID_PLUGIN_DIR . 'lib/ecwid_api_v3.php'; require_once ECWID_PLUGIN_DIR . 'includes/themes.php'; -require_once ECWID_PLUGIN_DIR . 'includes/oembed.php'; +// require_once ECWID_PLUGIN_DIR . 'includes/oembed.php'; require_once ECWID_PLUGIN_DIR . 'includes/widgets.php'; require_once ECWID_PLUGIN_DIR . 'includes/shortcodes.php'; require_once ECWID_PLUGIN_DIR . 'includes/kliken.php'; diff --git a/includes/class-ecwid-store-page.php b/includes/class-ecwid-store-page.php index 0f1af37e..570d220c 100644 --- a/includes/class-ecwid-store-page.php +++ b/includes/class-ecwid-store-page.php @@ -7,7 +7,6 @@ class Ecwid_Store_Page { const OPTION_LAST_STORE_PAGE_ID = 'ecwid_last_store_page_id'; const OPTION_FLUSH_REWRITES = 'ecwid_flush_rewrites'; const OPTION_REPLACE_TITLE = 'ecwid_replace_title'; - const WARMUP_ACTION = 'ecwid_warmup_store'; const META_STORE_DATA = 'ecwid_store'; @@ -398,45 +397,6 @@ protected static function _get_allowed_post_statuses() { return array( 'publish', 'private', 'draft' ); } - public static function warmup_store() { - $store_page = get_post( self::get_current_store_page_id() ); - - if ( ! $store_page ) { - return; - } - - $shortcodes = array(); - foreach ( Ecwid_Shortcode_Base::get_store_shortcode_names() as $shortcode_name ) { - $shortcodes[] = ecwid_find_shortcodes( $store_page->post_content, $shortcode_name ); - } - - if ( count( $shortcodes ) === 0 ) { - return; - } - - $shortcode_data = $shortcodes[0]; - - $category = 0; - - if ( isset( $shortcode_data[3] ) ) { - $attributes = shortcode_parse_atts( $shortcode_data[3] ); - - if ( ! $attributes ) { - return; - } - - $category = $attributes['default_category_id']; - } - - $page_url = get_permalink( $store_page ); - - include_once ECWID_PLUGIN_DIR . 'lib/ecwid_catalog.php'; - - $catalog = new EcwidCatalog( get_ecwid_store_id(), $page_url ); - - $catalog->warmup_store_page( intval( $category ) ); - } - public static $main_page_title = ''; // If you figure out a better place to put this the_title functionality, go ahead, move it =) @@ -631,7 +591,6 @@ public static function delete_page_from_nav_menus() { add_action( 'init', array( 'Ecwid_Store_Page', 'flush_rewrites' ) ); add_action( 'save_post', array( 'Ecwid_Store_Page', 'on_save_post' ) ); -add_action( 'wp_ajax_' . Ecwid_Store_Page::WARMUP_ACTION, array( 'Ecwid_Store_Page', 'warmup_store' ) ); add_action( 'update_option_page_on_front', array( 'Ecwid_Store_Page', 'schedule_flush_rewrites' ) ); add_action( 'display_post_states', array( 'Ecwid_Store_Page', 'display_post_states' ), 10, 2 ); diff --git a/includes/shortcodes/class-ecwid-shortcode-stub.php b/includes/shortcodes/class-ecwid-shortcode-stub.php deleted file mode 100644 index 12a95eb6..00000000 --- a/includes/shortcodes/class-ecwid-shortcode-stub.php +++ /dev/null @@ -1,27 +0,0 @@ -_get_html_class_name(); - $id = $this->get_html_id(); - return '
'; - } -} diff --git a/lib/ecwid_catalog.php b/lib/ecwid_catalog.php deleted file mode 100755 index e50e0405..00000000 --- a/lib/ecwid_catalog.php +++ /dev/null @@ -1,141 +0,0 @@ -store_id = intval( $store_id ); - $this->store_base_url = $store_base_url; - } - - public function warmup_store_page( $category_id ) { - $this->_get_data_for_category( $category_id, null ); - } - - public function get_product( $id ) { - $result = $this->_get_data_for_product( $id ); - - if ( ! $result ) { - return ''; - } - - ob_start(); - $product = $result->product; - $formats = $result->formats; - require __DIR__ . '/html-catalog-templates/product.php'; - - $return = ob_get_contents(); - ob_end_clean(); - - return $return; - } - - public function get_category( $id ) { - $offset = ( isset( $_GET['offset'] ) ) ? intval( $_GET['offset'] ) : 0; - $data = $this->_get_data_for_category( $id, $offset ); - - if ( ! $data ) { - return ''; - } - - $main_category = null; - if ( $id > 0 ) { - $main_category = $data->main_category; - } - $categories = $data->categories; - $products = $data->products; - $formats = $data->formats; - - ob_start(); - require __DIR__ . '/html-catalog-templates/category.php'; - - $return = ob_get_contents(); - ob_end_clean(); - - return $return; - } - - protected function _get_data_for_product( $id ) { - if ( Ecwid_Api_V3::is_available() ) { - $api = new Ecwid_Api_V3(); - - $product = Ecwid_Product::get_by_id( $id ); - - $profile = $api->get_store_profile(); - - if ( ! $profile ) { - return null; - } - - return (object) array( - 'product' => $product, - 'formats' => @$profile->formatsAndUnits, - ); - } - - return null; - } - - protected function _get_data_for_category( $id, $offset = 0 ) { - if ( Ecwid_Api_V3::is_available() ) { - $api = new Ecwid_Api_V3(); - - $main_category = null; - if ( $id > 0 ) { - $main_category = $api->get_category( $id ); - } - - $get_categories_params = array( - 'parent' => $id, - ); - if ( $offset && $offset > 0 ) { - $get_categories_params['offset'] = $offset; - } - $categories = $api->get_categories( $get_categories_params ); - - $get_products_params = array( - 'category' => $id, - ); - if ( $offset ) { - $get_products_params['offset'] = $offset; - } - $products = $api->search_products( $get_products_params ); - - $profile = $api->get_store_profile(); - - if ( is_null( $profile ) || ! isset( $categories->items ) || ! isset( $products->items ) ) { - return null; - } - - return (object) array( - 'main_category' => $main_category, - 'categories' => $categories->items, - 'products' => $products->items, - 'formats' => @$profile->formatsAndUnits, - ); - }//end if - - return null; - } - - public function parse_escaped_fragment( $escaped_fragment ) { - $fragment = urldecode( $escaped_fragment ); - $return = array(); - - if ( preg_match( '/^(\/~\/)([a-z]+)\/(.*)$/', $fragment, $matches ) ) { - parse_str( $matches[3], $return ); - $return['mode'] = $matches[2]; - } elseif ( preg_match( '!.*/(p|c)/([0-9]*)!', $fragment, $matches ) ) { - if ( count( $matches ) == 3 && in_array( $matches[1], array( 'p', 'c' ) ) ) { - $return = array( - 'mode' => 'p' == $matches[1] ? 'product' : 'category', - 'id' => $matches[2], - ); - } - } - - return $return; - } -} diff --git a/lib/html-catalog-templates/category.php b/lib/html-catalog-templates/category.php deleted file mode 100644 index 156ff2df..00000000 --- a/lib/html-catalog-templates/category.php +++ /dev/null @@ -1,33 +0,0 @@ - - - -

name ); ?>

-description ): ?> -
description ); ?>
- - - - - - - - - - -id); ?> -
- - - name ); ?> - - - - defaultDisplayedPrice . ' ' . $formats->currency ); ?> - -
- - diff --git a/lib/html-catalog-templates/product.php b/lib/html-catalog-templates/product.php deleted file mode 100644 index b65ead17..00000000 --- a/lib/html-catalog-templates/product.php +++ /dev/null @@ -1,83 +0,0 @@ - -
- -

name ); ?>

-

sku ); ?>

- <?php echo esc_attr( $product->name  . ' ' . $product->sku); ?> -
seoDescription )&& !empty( $product->seoDescription ) ? wp_kses_post( $product->seoDescription ) : wp_kses_post( $product->description ); ?>
-
- currencyPrefix . $product->defaultDisplayedPrice . $formats->currencySuffix - ); - ?> - - quantity) || $product->quantity > 0): ?>In stock - -
- attributes ) && is_array( $product->attributes ) && !empty( $product->attributes) ): ?> -
- attributes as $attribute ): - ?>
name ) . ':'; - if ( isset( $attribute->internalName ) && $attribute->internalName == 'Brand' - || - isset( $attribute->type ) && $attribute->type == 'BRAND' - ): - ?>value ); ?>value ); - endif; - ?>
-
- - options) && is_array( $product->options ) && !empty( $product->options ) ): ?> - options as $option ): ?> -
- name ); ?> - type == 'TEXTAREA' ): - ?> - - type == 'SELECT' ): ?> - type == 'RADIO' ): - foreach ( $option->choices as $param ): ?> - %s (%s)', - esc_attr( $option->name ), - esc_attr( $param->text ), - esc_html( $param->text ), - esc_html( $param->priceModifier ) - ); ?> - - type == 'CHECKBOX'): foreach ( $option->choices as $param ): ?> - %s (%s)', - esc_attr( $option->name ), - esc_attr( $param->text ), - esc_html( $param->text ), - esc_html( $param->priceModifier ) - ); ?> - - - - -
- - galleryImages ) foreach ( $product->galleryImages as $image): - ?><?php echo esc_attr( isset( $image->alt ) ? $image->alt : $product->name ); ?> - -
\ No newline at end of file diff --git a/templates/ecwid-admin.php b/templates/ecwid-admin.php index bc757df0..b498620e 100644 --- a/templates/ecwid-admin.php +++ b/templates/ecwid-admin.php @@ -4,10 +4,6 @@ jQuery(document).ready(function() { jQuery('#ecwid-frame').attr('src', ''); ecwidSetPopupCentering('#ecwid-frame'); - - jQuery.ajax({ - url: ajaxurl + '?action=' - }); }); //]]> From c95c22493c1aa1fcc0a453dd0b048ca731f9ab1a Mon Sep 17 00:00:00 2001 From: meteor Date: Wed, 18 Sep 2024 17:40:32 +0400 Subject: [PATCH 08/15] PLUGINS-6620 optimized feature for oembed --- ecwid-shopping-cart.php | 3 +- includes/class-ec-store-oembed.php | 100 +++++++++++++++++++++++ includes/oembed.php | 123 ----------------------------- 3 files changed, 102 insertions(+), 124 deletions(-) create mode 100644 includes/class-ec-store-oembed.php delete mode 100644 includes/oembed.php diff --git a/ecwid-shopping-cart.php b/ecwid-shopping-cart.php index 878f44f7..c4a96be4 100644 --- a/ecwid-shopping-cart.php +++ b/ecwid-shopping-cart.php @@ -108,11 +108,11 @@ require_once ECWID_PLUGIN_DIR . 'lib/ecwid_api_v3.php'; require_once ECWID_PLUGIN_DIR . 'includes/themes.php'; -// require_once ECWID_PLUGIN_DIR . 'includes/oembed.php'; require_once ECWID_PLUGIN_DIR . 'includes/widgets.php'; require_once ECWID_PLUGIN_DIR . 'includes/shortcodes.php'; require_once ECWID_PLUGIN_DIR . 'includes/kliken.php'; +require_once ECWID_PLUGIN_DIR . 'includes/class-ec-store-oembed.php'; require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-message-manager.php'; require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-store-editor.php'; require_once ECWID_PLUGIN_DIR . 'includes/class-ecwid-product-popup.php'; @@ -2987,6 +2987,7 @@ function ecwid_update_store_id( $new_store_id ) { function ecwid_is_paid_account() { + return false; if ( Ecwid_Api_V3::is_available() ) { $api = new Ecwid_Api_V3(); diff --git a/includes/class-ec-store-oembed.php b/includes/class-ec-store-oembed.php new file mode 100644 index 00000000..27d532ce --- /dev/null +++ b/includes/class-ec-store-oembed.php @@ -0,0 +1,100 @@ +post_content; + $shortcodes = array(); + + foreach ( Ecwid_Shortcode_Base::get_store_shortcode_names() as $shortcode_name ) { + $shortcodes = ecwid_find_shortcodes( $post_content, $shortcode_name ); + if ( $shortcodes ) { + break; + } + } + + if ( ! $shortcodes || ! isset( $shortcodes[0] ) || ! isset( $shortcodes[0][3] ) ) { + return; + } + + $attributes = $shortcodes[0][3]; + if ( ! preg_match( '/default_category_id=.([\\d]*)./', $attributes, $matches ) ) { + return; + } + + $root_category_id = intval( $matches[1] ) <= 0 ? 0 : $matches[1]; + + $api = new Ecwid_Api_V3(); + + $categories = $api->get_categories( array( 'parent' => $root_category_id ) ); + + $max_items = 5; + + $items = array(); + + $see_more = false; + $result = ''; + if ( ! empty( $categories->items ) ) { + foreach ( $categories->items as $category ) { + $category = Ecwid_Category::get_by_id( $category->id ); + $items[ $category->link ] = $category->name; + if ( count( $items ) >= $max_items ) { + $see_more = true; + break; + } + } + } + + $api = new Ecwid_Api_V3(); + + $category = $api->get_category( $root_category_id ); + + if ( $category ) { + $trimmed = ecwid_trim_description( $category->description ); + $result .= '
' . ecwid_trim_description( $category->description ); + + $descr_length = function_exists( 'mb_strlen' ) ? mb_strlen( $category->description ) : strlen( $category->description ); + $trimmed_length = function_exists( 'mb_strlen' ) ? mb_strlen( $trimmed ) : strlen( $trimmed ); + + if ( $trimmed_length < $descr_length && $trimmed_length == ECWID_TRIMMED_DESCRIPTION_LENGTH ) { + $result .= '... ' . __( 'See more', 'ecwid-shopping-cart' ) . ''; + } + $result .= '
'; + } + + if ( ! $see_more ) { + $products = $api->search_products( array( 'category' => $root_category_id ) ); + + if ( $products->items ) { + foreach ( $products->items as $product ) { + $product = Ecwid_Product::get_by_id( $product->id ); + $items[ $product->link ] = $product->name; + if ( count( $items ) >= $max_items ) { + $see_more = true; + break; + } + } + } + } + + $result .= ''; + + return $result; + } +} + +add_filter( 'embed_content', 'Ec_Store_Oembed::print_content', 10, 1 ); diff --git a/includes/oembed.php b/includes/oembed.php deleted file mode 100644 index 4e343fda..00000000 --- a/includes/oembed.php +++ /dev/null @@ -1,123 +0,0 @@ -post_content; - $shortcodes = array(); - - foreach ( Ecwid_Shortcode_Base::get_store_shortcode_names() as $shortcode_name ) { - $shortcodes = ecwid_find_shortcodes( $post_content, $shortcode_name ); - if ( $shortcodes ) { - break; - } - } - - if ( ! $shortcodes || ! isset( $shortcodes[0] ) || ! isset( $shortcodes[0][3] ) ) { - return; - } - - $attributes = $shortcodes[0][3]; - if ( ! preg_match( '/default_category_id=.([\\d]*)./', $attributes, $matches ) ) { - return; - } - - $root_category_id = 0; - if ( ! is_numeric( $matches[1] ) ) { - return; - } elseif ( isset( $matches[1] ) ) { - $root_category_id = $matches[1]; - } - - $api = new Ecwid_Api_V3(); - - $categories = $api->get_categories( array( 'parent' => $root_category_id ) ); - - $max_items = 5; - - $items = array(); - - $see_more = false; - $result = ''; - if ( ! empty( $categories->items ) ) { - foreach ( $categories->items as $category ) { - $category = Ecwid_Category::get_by_id( $category->id ); - $items[ $category->link ] = $category->name; - if ( count( $items ) >= $max_items ) { - $see_more = true; - break; - } - } - } - - if ( ecwid_is_paid_account() ) { - $api = new Ecwid_Api_V3(); - - $category = $api->get_category( $root_category_id ); - - if ( $category ) { - $trimmed = ecwid_trim_description( $category->description ); - $result .= '
' . ecwid_trim_description( $category->description ); - - $descr_length = function_exists( 'mb_strlen' ) ? mb_strlen( $category->description ) : strlen( $category->description ); - $trimmed_length = function_exists( 'mb_strlen' ) ? mb_strlen( $trimmed ) : strlen( $trimmed ); - - if ( $trimmed_length < $descr_length && $trimmed_length == ECWID_TRIMMED_DESCRIPTION_LENGTH ) { - $result .= '... ' . __( 'See more', 'ecwid-shopping-cart' ) . ''; - } - $result .= '
'; - } - - if ( ! $see_more ) { - $products = $api->search_products( array( 'category' => $root_category_id ) ); - - if ( $products->items ) { - foreach ( $products->items as $product ) { - $product = Ecwid_Product::get_by_id( $product->id ); - $items[ $product->link ] = $product->name; - if ( count( $items ) >= $max_items ) { - $see_more = true; - break; - } - } - } - } - }//end if - - $result .= ''; - return $result; -} - -function _ecwid_find_category_in_horizontal_categories_tree( $categories, $root_id ) { - foreach ( $categories as $category ) { - if ( $category->id == $root_id ) { - return $category->sub; - } - - if ( ! is_null( $category->sub ) ) { - $result = _ecwid_find_category_in_horizontal_categories_tree( $category->sub, $root_id ); - if ( $result !== false ) { - return $result; - } - } - } - return false; -} From 78eafa22d26493391375abe1d8c1b49cb044f4cb Mon Sep 17 00:00:00 2001 From: meteor Date: Fri, 20 Sep 2024 22:06:38 +0400 Subject: [PATCH 09/15] PLUGINS-6938 fixed issue with access to embedded control panel --- includes/class-ec-store-admin-access.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/class-ec-store-admin-access.php b/includes/class-ec-store-admin-access.php index a12b2d60..d14144a4 100644 --- a/includes/class-ec-store-admin-access.php +++ b/includes/class-ec-store-admin-access.php @@ -41,10 +41,13 @@ public function save_custom_user_profile_fields( $user_id ) { } public static function get_users_with_manage_access() { + global $wpdb; + $table_prefix = $wpdb->prefix; + $args = array( 'meta_query' => array( //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query array( - 'key' => 'wp_capabilities', + 'key' => $table_prefix . 'capabilities', 'value' => self::CAP_MANAGE_CONTROL_PANEL . '";b:1', 'compare' => 'LIKE', ), From 3bf518fb3cf4ac06bbb681b49812a4f3e03fd0fb Mon Sep 17 00:00:00 2001 From: meteor Date: Tue, 1 Oct 2024 18:03:49 +0400 Subject: [PATCH 10/15] Added detect if we're running on the playground --- ecwid-shopping-cart.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ecwid-shopping-cart.php b/ecwid-shopping-cart.php index c4a96be4..1fc8927b 100644 --- a/ecwid-shopping-cart.php +++ b/ecwid-shopping-cart.php @@ -1638,10 +1638,11 @@ function ecwid_plugin_activation_redirect( $plugin ) { && count($_POST['checked']) > 1; $is_cli_running = Ecwid_Config::is_cli_running(); + $is_wp_playground = defined( 'IS_PLAYGROUND_PREVIEW' ) && IS_PLAYGROUND_PREVIEW; $is_newbie = ecwid_is_demo_store(); - if( !$is_cli_running && !$is_bulk_activation && $is_newbie && $plugin == plugin_basename( __FILE__ ) ) { + if( !$is_cli_running && $is_wp_playground && !$is_bulk_activation && $is_newbie && $plugin == plugin_basename( __FILE__ ) ) { wp_safe_redirect( Ecwid_Admin::get_dashboard_url() ); exit(); } From 1919f6ad7a2bc8b0d96040b61fe03198c3033188 Mon Sep 17 00:00:00 2001 From: meteor Date: Thu, 3 Oct 2024 13:34:09 +0400 Subject: [PATCH 11/15] PLUGINS-6944 detect if plugin running on the playground --- ecwid-shopping-cart.php | 2 +- includes/class-ecwid-config.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ecwid-shopping-cart.php b/ecwid-shopping-cart.php index 1fc8927b..6e0b62c5 100644 --- a/ecwid-shopping-cart.php +++ b/ecwid-shopping-cart.php @@ -1638,7 +1638,7 @@ function ecwid_plugin_activation_redirect( $plugin ) { && count($_POST['checked']) > 1; $is_cli_running = Ecwid_Config::is_cli_running(); - $is_wp_playground = defined( 'IS_PLAYGROUND_PREVIEW' ) && IS_PLAYGROUND_PREVIEW; + $is_wp_playground = Ecwid_Config::is_wp_playground_running(); $is_newbie = ecwid_is_demo_store(); diff --git a/includes/class-ecwid-config.php b/includes/class-ecwid-config.php index 4b26c8cb..3b4ee4a2 100644 --- a/includes/class-ecwid-config.php +++ b/includes/class-ecwid-config.php @@ -130,6 +130,10 @@ public static function is_cli_running() { return defined( 'WP_CLI' ) && WP_CLI; } + public static function is_wp_playground_running() { + return defined( 'IS_PLAYGROUND_PREVIEW' ) && IS_PLAYGROUND_PREVIEW; + } + public static function load_from_cli( $config ) { if ( ! $config ) { From fe4b7b05ffeb8c70e06c11e8175c592f1ed0b3be Mon Sep 17 00:00:00 2001 From: meteor Date: Thu, 3 Oct 2024 14:47:39 +0400 Subject: [PATCH 12/15] v 6.12.20 --- CHANGELOG.txt | 5 +++++ ecwid-shopping-cart.php | 2 +- readme.txt | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index def0228a..70dc9124 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,9 @@ == Changelog == += 6.12.20 - Oct 3, 2024 = +- In the "Only featured products" mode, the "Store Home Page" ecommerce block was displayed incorrectly. We've fixed this. +- Fixed an issue with the "Manage access to store control panel" feature where in some cases users couldn't have access to embedded store control panel. +- Internal improvements and optimizations. + = 6.12.19 - Sep 11, 2024 = - Fixed an issue with processing some store pages links. - Internal improvements and optimizations. diff --git a/ecwid-shopping-cart.php b/ecwid-shopping-cart.php index 6e0b62c5..4680bf4b 100644 --- a/ecwid-shopping-cart.php +++ b/ecwid-shopping-cart.php @@ -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.19 +Version: 6.12.20 Author URI: https://ecwid.to/ecwid-site License: GPLv2 or later */ diff --git a/readme.txt b/readme.txt index 1d37e06a..13216cd7 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Requires at least: 4.4 Tested up to: 6.6 -Stable tag: 6.12.19 +Stable tag: 6.12.20 Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available. @@ -153,6 +153,11 @@ You can use Ecwid’s built-in import tools to copy your store products from any * [Ecwid Help Center](http://help.ecwid.com "Ecwid Help") == Changelog == += 6.12.20 - Oct 3, 2024 = +- In the "Only featured products" mode, the "Store Home Page" ecommerce block was displayed incorrectly. We've fixed this. +- Fixed an issue with the "Manage access to store control panel" feature where in some cases users couldn't have access to embedded store control panel. +- Internal improvements and optimizations. + = 6.12.19 - Sep 11, 2024 = - Fixed an issue with processing some store pages links. - Internal improvements and optimizations. From bf9c5bfa3307dd91fd89e375c7bce68e34912174 Mon Sep 17 00:00:00 2001 From: meteor Date: Wed, 16 Oct 2024 09:39:24 +0400 Subject: [PATCH 13/15] PLUGINS-6944 fix for playground detecting --- ecwid-shopping-cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecwid-shopping-cart.php b/ecwid-shopping-cart.php index 4680bf4b..524608bf 100644 --- a/ecwid-shopping-cart.php +++ b/ecwid-shopping-cart.php @@ -1642,7 +1642,7 @@ function ecwid_plugin_activation_redirect( $plugin ) { $is_newbie = ecwid_is_demo_store(); - if( !$is_cli_running && $is_wp_playground && !$is_bulk_activation && $is_newbie && $plugin == plugin_basename( __FILE__ ) ) { + if( !$is_cli_running && !$is_wp_playground && !$is_bulk_activation && $is_newbie && $plugin == plugin_basename( __FILE__ ) ) { wp_safe_redirect( Ecwid_Admin::get_dashboard_url() ); exit(); } From c53bf46796b8706d7a202df10794fb3da2791a14 Mon Sep 17 00:00:00 2001 From: meteor Date: Wed, 16 Oct 2024 13:55:44 +0400 Subject: [PATCH 14/15] PLUGINS-6807 --- includes/class-ecwid-admin-main-page.php | 2 +- templates/debug.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/includes/class-ecwid-admin-main-page.php b/includes/class-ecwid-admin-main-page.php index 90c53774..d07053c1 100644 --- a/includes/class-ecwid-admin-main-page.php +++ b/includes/class-ecwid-admin-main-page.php @@ -148,7 +148,7 @@ public function _do_integrated_admin_page( $page = self::PAGE_HASH_DASHBOARD ) { $need_to_force_show_dashboard = false; - if ( $result['code'] == 403 ) { + if ( ! empty( $result ) && $result['code'] == 403 ) { if ( get_option( EcwidPlatform::OPTION_ECWID_CHECK_API_RETRY_AFTER, 0 ) == 0 ) { Ecwid_Api_V3::set_api_status( Ecwid_Api_V3::API_STATUS_ERROR_TOKEN ); Ecwid_Api_V3::save_token( '' ); diff --git a/templates/debug.php b/templates/debug.php index 38933cbb..afb2aa0a 100644 --- a/templates/debug.php +++ b/templates/debug.php @@ -78,6 +78,22 @@
Theme identification
+
+
Config URLs matching
+
+

+ +

+

+

+
+
Affiliate Ref ID
From 9b175631a39cd495eab39a1cd1e9b61feb1ba955 Mon Sep 17 00:00:00 2001 From: meteor Date: Wed, 16 Oct 2024 23:11:18 +0400 Subject: [PATCH 15/15] PLUGINS-6949 --- CHANGELOG.txt | 4 ++++ ecwid-shopping-cart.php | 3 +-- readme.txt | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 70dc9124..e68e953a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,8 @@ == Changelog == += 6.12.21 - Oct 16, 2024 = +- Fixed issue with Single Sign On (SSO). Single Sign-On allows your customers to have a single login for both your WordPress site and your Ecwid store. If this feature is not working properly after latests release, please update your plugin. +- Internal improvements and optimizations. + = 6.12.20 - Oct 3, 2024 = - In the "Only featured products" mode, the "Store Home Page" ecommerce block was displayed incorrectly. We've fixed this. - Fixed an issue with the "Manage access to store control panel" feature where in some cases users couldn't have access to embedded store control panel. diff --git a/ecwid-shopping-cart.php b/ecwid-shopping-cart.php index 524608bf..7ef03a41 100644 --- a/ecwid-shopping-cart.php +++ b/ecwid-shopping-cart.php @@ -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.20 +Version: 6.12.21 Author URI: https://ecwid.to/ecwid-site License: GPLv2 or later */ @@ -2988,7 +2988,6 @@ function ecwid_update_store_id( $new_store_id ) { function ecwid_is_paid_account() { - return false; if ( Ecwid_Api_V3::is_available() ) { $api = new Ecwid_Api_V3(); diff --git a/readme.txt b/readme.txt index 13216cd7..466c0ea6 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Requires at least: 4.4 Tested up to: 6.6 -Stable tag: 6.12.20 +Stable tag: 6.12.21 Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available. @@ -153,6 +153,10 @@ You can use Ecwid’s built-in import tools to copy your store products from any * [Ecwid Help Center](http://help.ecwid.com "Ecwid Help") == Changelog == += 6.12.21 - Oct 16, 2024 = +- Fixed issue with Single Sign On (SSO). Single Sign-On allows your customers to have a single login for both your WordPress site and your Ecwid store. If this feature is not working properly after latests release, please update your plugin. +- Internal improvements and optimizations. + = 6.12.20 - Oct 3, 2024 = - In the "Only featured products" mode, the "Store Home Page" ecommerce block was displayed incorrectly. We've fixed this. - Fixed an issue with the "Manage access to store control panel" feature where in some cases users couldn't have access to embedded store control panel.