aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-06-13 20:17:31 +0200
committerHarald Eilertsen <haraldei@anduin.net>2024-06-16 08:56:20 +0200
commit66ea277045ef62106051f2614a116234ba4a302a (patch)
treea040339c806b9a830cfc71da647bdfb9f597faab
parentff018b975b47a57433b5f76634f9948164919e25 (diff)
downloadvolse-hubzilla-66ea277045ef62106051f2614a116234ba4a302a.tar.gz
volse-hubzilla-66ea277045ef62106051f2614a116234ba4a302a.tar.bz2
volse-hubzilla-66ea277045ef62106051f2614a116234ba4a302a.zip
Refactor is_local_url() and add api doc.
-rw-r--r--include/network.php15
1 files changed, 9 insertions, 6 deletions
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, '/');
}
/**