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 c64c07ea..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 */ @@ -1732,6 +1732,8 @@ function ecwid_uninstall() { EcwidPlatform::cache_reset('need_add_rewrite'); Ecwid_Store_Page::delete_page_from_nav_menus(); + + Ec_Store_Admin_Access::reset_all_access(); } function ecwid_abs_intval($value) { @@ -2162,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-ec-store-admin-access.php b/includes/class-ec-store-admin-access.php index 596b7a1c..a12b2d60 100644 --- a/includes/class-ec-store-admin-access.php +++ b/includes/class-ec-store-admin-access.php @@ -55,6 +55,15 @@ public static function get_users_with_manage_access() { return get_users( $args ); } + public static function get_users_with_grant_access() { + $args = array( + 'capability' => self::CAP_CAN_GRANT_ACCESS, + 'fields' => array( 'ID' ), + ); + + return get_users( $args ); + } + public static function has_scope( $user_id = null ) { $has_scope = false; @@ -88,11 +97,9 @@ public function can_grant_access() { return true; } - $args = array( - 'capability' => self::CAP_CAN_GRANT_ACCESS, - 'fields' => array( 'ID' ), - ); - if ( empty( get_users( $args ) ) && is_super_admin() ) { + $users = self::get_users_with_grant_access(); + + if ( empty( $users ) && is_super_admin() ) { return true; } @@ -113,17 +120,6 @@ public function hook_admin_get_capability( $cap ) { return $this->capability; } - $args = array( - 'meta_query' => array( //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query - array( - 'key' => 'wp_capabilities', - 'value' => self::CAP_MANAGE_CONTROL_PANEL . '";b:1', - 'compare' => 'LIKE', - ), - ), - 'fields' => array( 'ID' ), - ); - if ( ! empty( self::get_users_with_manage_access() ) ) { $cap = self::CAP_MANAGE_CONTROL_PANEL; } @@ -133,6 +129,28 @@ public function hook_admin_get_capability( $cap ) { return $cap; } + public static function reset_all_access() { + $users = self::get_users_with_manage_access(); + + if ( ! empty( $users ) ) { + foreach ( $users as $user ) { + $user = new WP_User( $user->ID ); + $user->remove_cap( self::CAP_MANAGE_CONTROL_PANEL ); + } + } + + $users = self::get_users_with_grant_access(); + + if ( ! empty( $users ) ) { + foreach ( $users as $user ) { + $user = new WP_User( $user->ID ); + $user->remove_cap( self::CAP_CAN_GRANT_ACCESS ); + } + } + + return true; + } + public function print_custom_user_profile_fields( $user ) { if ( ! $this->can_grant_access() ) { 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(); 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' ) ); 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. diff --git a/templates/debug.php b/templates/debug.php index 0ca68f3c..38933cbb 100644 --- a/templates/debug.php +++ b/templates/debug.php @@ -112,6 +112,59 @@ + +

Who can grant access to Control Panel

+
+

Required capability:

+ Ec_Store_Admin_Access::CAP_CAN_GRANT_ACCESS, + 'fields' => array( 'ID', 'user_nicename' ), + ); + $users = get_users( $args ); + if ( ! empty( $users ) ) { + echo ''; + } else { + echo 'No one found'; + } + ?> +
+

Who has an access to Control Panel

+
+

Required capability:

+ Ec_Store_Admin_Access::CAP_MANAGE_CONTROL_PANEL, + 'fields' => array( 'ID', 'user_nicename' ), + ); + $users = get_users( $args ); + if ( ! empty( $users ) ) { + echo ''; + } else { + echo 'No one found'; + } + ?> +
+ +