aspireupdate/includes/class-utilities.php
Namith Jawahar f57ff6a71d
Handling API Keys within the Plugin UI (#39)
* #33

Plugin Name Change

* #36

#36
#33
#26
#13

* AP_HOST Defaults

AP_HOST Defaults
2024-10-24 11:15:22 -04:00

26 lines
613 B
PHP

<?php
/**
* The Class for Miscellaneous Helper Functions.
*
* @package aspire-update
*/
namespace AspireUpdate;
/**
* The Class for Admin Settings Page and functions to access Settings Values.
*/
class Utilities {
/**
* Get the top level domain name from the site URL.
*
* @return string the top level 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 ) ) );
}
}