From 91de460db842318ae74ba8b6efae6c1251e8272e Mon Sep 17 00:00:00 2001 From: Namith Jawahar <48271037+namithj@users.noreply.github.com> Date: Fri, 29 Nov 2024 08:22:59 +0530 Subject: [PATCH 1/3] Use the full domain name Use the full domain name instead of attempting to extract the top level TLD --- composer.lock | 10 +++++----- includes/class-admin-settings.php | 2 +- includes/class-utilities.php | 13 +++++-------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/composer.lock b/composer.lock index 84cc1c4..30d6c69 100644 --- a/composer.lock +++ b/composer.lock @@ -12,12 +12,12 @@ "source": { "type": "git", "url": "https://github.com/afragen/autoloader.git", - "reference": "ec56498d42f0694d3ad1207a496bf69cbb0ebc2f" + "reference": "ab30ab542c48fe3ecd26c3bda28fef544f04b401" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/afragen/autoloader/zipball/ec56498d42f0694d3ad1207a496bf69cbb0ebc2f", - "reference": "ec56498d42f0694d3ad1207a496bf69cbb0ebc2f", + "url": "https://api.github.com/repos/afragen/autoloader/zipball/ab30ab542c48fe3ecd26c3bda28fef544f04b401", + "reference": "ab30ab542c48fe3ecd26c3bda28fef544f04b401", "shasum": "" }, "require": { @@ -43,9 +43,9 @@ ], "support": { "issues": "https://github.com/afragen/autoloader/issues", - "source": "https://github.com/afragen/autoloader/tree/master" + "source": "https://github.com/afragen/autoloader/tree/3.0.0" }, - "time": "2024-11-10T22:55:51+00:00" + "time": "2024-11-27T02:42:42+00:00" }, { "name": "afragen/translations-updater", diff --git a/includes/class-admin-settings.php b/includes/class-admin-settings.php index c82a113..4158eb6 100644 --- a/includes/class-admin-settings.php +++ b/includes/class-admin-settings.php @@ -324,7 +324,7 @@ public function admin_enqueue_scripts( $hook ) { [ 'ajax_url' => network_admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'aspireupdate-ajax' ), - 'domain' => Utilities::get_top_level_domain(), + 'domain' => Utilities::get_site_domain(), 'line_ending' => PHP_EOL, 'unexpected_error' => esc_html__( 'Unexpected Error', 'aspireupdate' ), ] diff --git a/includes/class-utilities.php b/includes/class-utilities.php index 4fe4bdf..28917f1 100644 --- a/includes/class-utilities.php +++ b/includes/class-utilities.php @@ -11,17 +11,14 @@ * The Class for Admin Settings Page and functions to access Settings Values. */ class Utilities { - /** - * Get the top level domain name from the site URL. + * Get the domain name from the site URL. * - * @return string the top level domain name. + * @return string the domain name. */ - public static function get_top_level_domain() { - $site_url = get_site_url(); - $domain_name = wp_parse_url( $site_url, PHP_URL_HOST ); - $domain_parts = explode( '.', $domain_name ); - return sanitize_text_field( implode( '.', array_slice( $domain_parts, -2 ) ) ); + public static function get_site_domain() { + $site_url = get_site_url(); + return wp_parse_url( $site_url, PHP_URL_HOST ); } /** From eaa9b9a97bb0c0872be506a19880bfda28e9b27e Mon Sep 17 00:00:00 2001 From: Namith Jawahar <48271037+namithj@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:30:39 +0530 Subject: [PATCH 2/3] network_site_url instead of get_site_url network_site_url instead of get_site_url --- includes/class-utilities.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-utilities.php b/includes/class-utilities.php index 28917f1..0de84c8 100644 --- a/includes/class-utilities.php +++ b/includes/class-utilities.php @@ -17,7 +17,7 @@ class Utilities { * @return string the domain name. */ public static function get_site_domain() { - $site_url = get_site_url(); + $site_url = network_site_url(); return wp_parse_url( $site_url, PHP_URL_HOST ); } From 8a7607dcd57269d79bfc8f0d0a50cc1eb9a09a1e Mon Sep 17 00:00:00 2001 From: Colin Stewart <79332690+costdev@users.noreply.github.com> Date: Sat, 30 Nov 2024 13:18:09 +0000 Subject: [PATCH 3/3] Capitalize return description. Signed-off-by: Colin Stewart <79332690+costdev@users.noreply.github.com> --- includes/class-utilities.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-utilities.php b/includes/class-utilities.php index 0de84c8..e152c68 100644 --- a/includes/class-utilities.php +++ b/includes/class-utilities.php @@ -14,7 +14,7 @@ class Utilities { /** * Get the domain name from the site URL. * - * @return string the domain name. + * @return string The domain name. */ public static function get_site_domain() { $site_url = network_site_url();