From 1d19b36493c705e9bb6d313c64ee5a5825558574 Mon Sep 17 00:00:00 2001 From: Roberto Guagliardo Date: Thu, 11 Dec 2025 21:13:25 +0000 Subject: [PATCH] fix: Update version to 1.2.1 in groq-ai-product-text.php and refactor version retrieval in SitiWebUpdater --- SitiWebUpdater.php | 27 +++++++++++++++++---------- groq-ai-product-text.php | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/SitiWebUpdater.php b/SitiWebUpdater.php index ed01a4a..fc78a5a 100644 --- a/SitiWebUpdater.php +++ b/SitiWebUpdater.php @@ -66,6 +66,14 @@ class SitiWebUpdater { } } + private function get_latest_version_from_response() { + if ( empty( $this->github_response['tag_name'] ) ) { + return null; + } + + return ltrim( $this->github_response['tag_name'], 'vV' ); + } + public function initialize() { add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'modify_transient' ), 10, 1 ); add_filter( 'plugins_api', array( $this, 'plugin_popup' ), 10, 3); @@ -88,15 +96,13 @@ class SitiWebUpdater { $this->get_repository_info(); // Get the repo info - if ( empty( $this->github_response ) || empty( $this->github_response['tag_name'] ) ) { + $latest_version = $this->get_latest_version_from_response(); + + if ( null === $latest_version ) { return $transient; } - if ( empty( $checked[ $this->basename ] ) ) { - return $transient; - } - - $out_of_date = version_compare( $this->github_response['tag_name'], $checked[ $this->basename ], 'gt' ); // Check if we're out of date + $out_of_date = version_compare( $latest_version, $checked[ $this->basename ], 'gt' ); // Check if we're out of date if( $out_of_date ) { @@ -108,7 +114,7 @@ class SitiWebUpdater { 'url' => $this->plugin["PluginURI"], 'slug' => $slug, 'package' => $new_files, - 'new_version' => $this->github_response['tag_name'] + 'new_version' => $latest_version ); $transient->response[$this->basename] = (object) $plugin; // Return it in response @@ -122,12 +128,13 @@ class SitiWebUpdater { public function plugin_popup( $result, $action, $args ) { if( ! empty( $args->slug ) ) { // If there is a slug - + if( $args->slug == current( explode( '/' , $this->basename ) ) ) { // And it's our slug $this->get_repository_info(); // Get our repo info + $latest_version = $this->get_latest_version_from_response(); - if ( empty( $this->github_response ) || empty( $this->github_response['tag_name'] ) ) { + if ( null === $latest_version ) { return $result; } @@ -141,7 +148,7 @@ class SitiWebUpdater { 'num_ratings' => '10823', 'downloaded' => '14249', 'added' => '2016-01-05', - 'version' => $this->github_response['tag_name'], + 'version' => $latest_version, 'author' => $this->plugin["AuthorName"], 'author_profile' => $this->plugin["AuthorURI"], 'last_updated' => $this->github_response['published_at'], diff --git a/groq-ai-product-text.php b/groq-ai-product-text.php index 75cb742..6615c1d 100644 --- a/groq-ai-product-text.php +++ b/groq-ai-product-text.php @@ -2,7 +2,7 @@ /** * Plugin Name: SitiAI Product Teksten * Description: Genereer productteksten met diverse AI-aanbieders rechtstreeks vanuit WooCommerce. - * Version: 1.2.0 + * Version: 1.2.1 * Author: SitiAI */