From f171e94191f0f374aea3ee4a0f575b1f97d26453 Mon Sep 17 00:00:00 2001 From: Torben Lundsgaard Date: Tue, 8 Oct 2024 21:58:55 +0200 Subject: [PATCH] Minor refactoring --- src/Common/Util.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Common/Util.php b/src/Common/Util.php index 2153b13..78324cb 100644 --- a/src/Common/Util.php +++ b/src/Common/Util.php @@ -364,8 +364,6 @@ public function get_data( string $endpoint, string $transient ): array { return $data; } - $url = $this->api_host . $this->api_namespace . $endpoint; - $url = add_query_arg( 'plugins', [ @@ -373,7 +371,7 @@ public function get_data( string $endpoint, string $transient ): array { 'cf7' => \is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ), 'edd' => ( \is_plugin_active( 'easy-digital-downloads/easy-digital-downloads.php' ) || \is_plugin_active( 'easy-digital-downloads-pro/easy-digital-downloads.php' ) ), ], - $url + $this->get_api_url( $endpoint ) ); $response = wp_remote_get( $url ); @@ -394,6 +392,17 @@ public function get_data( string $endpoint, string $transient ): array { return $data; } + /** + * Get API Url + * + * @param string $endpoint The endpoint. + * + * @return string The API Url. + */ + public function get_api_url( string $endpoint ): string { + return $this->api_host . $this->api_namespace . $endpoint; + } + /** * Normalize and hash a string. *