From 729f854706a323fe26618fc6e4157f32e4a47d54 Mon Sep 17 00:00:00 2001 From: Leo Fajardo Date: Thu, 18 Jul 2024 00:25:37 +0800 Subject: [PATCH] [plugin-information-dialog] Try to fetch data from WP only when the plugin is actually WP.org-compliant. --- includes/class-fs-plugin-updater.php | 14 ++++++++++++-- start.php | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/includes/class-fs-plugin-updater.php b/includes/class-fs-plugin-updater.php index 867ea078..dc233da4 100755 --- a/includes/class-fs-plugin-updater.php +++ b/includes/class-fs-plugin-updater.php @@ -651,7 +651,7 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) { $slug = $this->_fs->get_slug(); - if ( $this->_fs->is_org_repo_compliant() && $this->_fs->is_freemium() ) { + if ( $this->can_fetch_data_from_wp_org() ) { if ( ! isset( $this->_translation_updates ) ) { $this->_translation_updates = array(); @@ -908,6 +908,16 @@ static function _fetch_plugin_info_from_repository( $action, $args ) { return $res; } + /** + * Returns true if the product can fetch data from WordPress.org. + * + * @author Leo Fajardo (@leorw) + * @since 2.7.4 + */ + private function can_fetch_data_from_wp_org() { + return ( $this->_fs->is_org_repo_compliant() && $this->_fs->is_freemium() ); + } + /** * Fetches module translation updates from wordpress.org. * @@ -1092,7 +1102,7 @@ function plugins_api_filter( $data, $action = '', $args = null ) { } $plugin_in_repo = false; - if ( ! $is_addon ) { + if ( ! $is_addon && $this->can_fetch_data_from_wp_org() ) { // Try to fetch info from .org repository. $data = self::_fetch_plugin_info_from_repository( $action, $args ); diff --git a/start.php b/start.php index a18aa348..896a815f 100644 --- a/start.php +++ b/start.php @@ -15,7 +15,7 @@ * * @var string */ - $this_sdk_version = '2.7.3.2'; + $this_sdk_version = '2.7.3.3'; #region SDK Selection Logic --------------------------------------------------------------------