From 992170d966b238ce17504f1c347a501d46d50082 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 17 Apr 2012 10:19:46 +0200 Subject: use anonymous image --- src/phorkie/Tools.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/phorkie/Tools.php') 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 -- cgit v1.2.3