diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-04-17 10:19:46 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-04-17 10:19:46 +0200 |
| commit | 992170d966b238ce17504f1c347a501d46d50082 (patch) | |
| tree | 683dab89f5543c29ef3b52f7e87de264d6087ff4 /src/phorkie/Tools.php | |
| parent | a4a47e2f9bd26259f0f6256a9652a39836c56a4d (diff) | |
| download | phorkie-992170d966b238ce17504f1c347a501d46d50082.tar.gz phorkie-992170d966b238ce17504f1c347a501d46d50082.zip | |
use anonymous image
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 |
