From 66ea277045ef62106051f2614a116234ba4a302a Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 13 Jun 2024 20:17:31 +0200 Subject: Refactor is_local_url() and add api doc. --- include/network.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/network.php b/include/network.php index bb5bc1ce7..b3a3d715c 100644 --- a/include/network.php +++ b/include/network.php @@ -556,12 +556,15 @@ function z_dns_check($h,$check_mx = 0) { return((@dns_get_record($h,$opts) || filter_var($h, FILTER_VALIDATE_IP)) ? true : false); } -function is_local_url($url) { - if (str_starts_with($url, z_root()) || str_starts_with($url, '/')) { - return true; - } - - return false; +/** + * Returns whether an URL is local to the site, or not. + * + * @param string $url The URL to check + * + * @return bool True if the URL is local, false otherwise. + */ +function is_local_url(string $url): bool { + return str_starts_with($url, z_root()) || str_starts_with($url, '/'); } /** -- cgit v1.2.3