comparison mgallery.php @ 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 dec931d9e860
comparison
equal deleted inserted replaced
4:014e1d6991a3 5:1bf73b49fc91
11 // Various utility functions 11 // Various utility functions
12 // 12 //
13 function mgGetImageURL() 13 function mgGetImageURL()
14 { 14 {
15 global $galImageURL, $galPath; 15 global $galImageURL, $galPath;
16 return $galImageURL.$galPath."/".implode("", func_get_args()); 16 return str_replace("//", "/", $galImageURL.$galPath."/".implode("", func_get_args()));
17 } 17 }
18 18
19 19
20 function mgGetURL($path, $image, $entities = TRUE) 20 function mgGetURL($path, $image, $entities = TRUE)
21 { 21 {
22 global $galBaseURL, $galCleanURLS; 22 global $galBaseURL, $galCleanURLS;
23 $amp = $entities ? "&amp;" : "&"; 23 $amp = $entities ? "&amp;" : "&";
24 24
25 if ($galCleanURLS) 25 if ($galCleanURLS)
26 { 26 {
27 return $galBaseURL.$path."/".($image !== FALSE ? $image : ""); 27 $url = $galBaseURL.$path."/".($image !== FALSE ? $image : "");
28 } 28 }
29 else 29 else
30 { 30 {
31 return 31 $url =
32 $galBaseURL.mgGetSetting("mgallery_php")."?path=". 32 $galBaseURL.mgGetSetting("mgallery_php")."?path=".
33 $path.($image !== FALSE ? $amp."image=".$image : ""); 33 $path.($image !== FALSE ? $amp."image=".$image : "");
34 } 34 }
35
36 return str_replace("//", "/", $url);
35 } 37 }
36 38
37 39
38 function mgGetNaviActive(&$galIndex, $index, $delta, &$res, &$url, $entities) 40 function mgGetNaviActive(&$galIndex, $index, $delta, &$res, &$url, $entities)
39 { 41 {