Mercurial > hg > mgallery
changeset 5:1bf73b49fc91
Beautify the generated URLs by removing occurences of duplicate forward
slash //.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 15 May 2015 16:33:30 +0300 |
parents | 014e1d6991a3 |
children | 405a02586fc2 |
files | mgallery.php |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mgallery.php Fri May 15 16:29:38 2015 +0300 +++ b/mgallery.php Fri May 15 16:33:30 2015 +0300 @@ -13,7 +13,7 @@ function mgGetImageURL() { global $galImageURL, $galPath; - return $galImageURL.$galPath."/".implode("", func_get_args()); + return str_replace("//", "/", $galImageURL.$galPath."/".implode("", func_get_args())); } @@ -24,14 +24,16 @@ if ($galCleanURLS) { - return $galBaseURL.$path."/".($image !== FALSE ? $image : ""); + $url = $galBaseURL.$path."/".($image !== FALSE ? $image : ""); } else { - return + $url = $galBaseURL.mgGetSetting("mgallery_php")."?path=". $path.($image !== FALSE ? $amp."image=".$image : ""); } + + return str_replace("//", "/", $url); }