diff options
Diffstat (limited to 'src/phorkie/Tools.php')
| -rw-r--r-- | src/phorkie/Tools.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/phorkie/Tools.php b/src/phorkie/Tools.php index c6e4db5..d9b7637 100644 --- a/src/phorkie/Tools.php +++ b/src/phorkie/Tools.php @@ -21,6 +21,22 @@ class Tools return rmdir($path); } + /** + * Create a full URL with protocol and host name + * + * @param string $path Path to the file, with leading / + * + * @return string Full URL + */ + public static function fullUrl($path) + { + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) { + $prot = 'https'; + } else { + $prot = 'http'; + } + return $prot . '://' . $_SERVER['HTTP_HOST'] . $path; + } } ?>
\ No newline at end of file |
