@@ -393,6 +393,7 @@ public function getDirectory ($key) {
393
393
*/
394
394
public function setPath ($ path ) {
395
395
$ this ->info ['path ' ] = array ();
396
+ $ this ->info ['file ' ] = null ;
396
397
397
398
foreach (explode ('/ ' , $ path ) as $ dir ) {
398
399
if ($ dir !== '' ) {
@@ -412,10 +413,10 @@ public function setPath ($path) {
412
413
* Return the url path
413
414
*/
414
415
public function getPath ($ file = false ) {
415
- $ path = isset ($ this ->info ['path ' ]) ? implode ('/ ' , $ this ->info ['path ' ]) : '' ;
416
+ $ path = isset ($ this ->info ['path ' ]) ? ' / ' . implode ('/ ' , $ this ->info ['path ' ]). ' / ' : '/ ' ;
416
417
417
418
if ($ file && !empty ($ this ->info ['file ' ])) {
418
- $ path .= ' / ' . $ this ->info ['file ' ];
419
+ $ path .= $ this ->info ['file ' ];
419
420
}
420
421
421
422
return $ path ;
@@ -515,13 +516,7 @@ private function buildUrl ($maintainCache = false) {
515
516
$ url .= $ this ->info ['host ' ];
516
517
}
517
518
518
- if (($ path = $ this ->getPath ())) {
519
- $ url .= '/ ' .$ path ;
520
- }
521
-
522
- if (isset ($ this ->info ['file ' ])) {
523
- $ url .= '/ ' .$ this ->info ['file ' ];
524
- }
519
+ $ url .= $ this ->getPath (true );
525
520
526
521
if (isset ($ this ->info ['query ' ])) {
527
522
$ url .= '? ' .http_build_query ($ this ->info ['query ' ]);
@@ -594,14 +589,6 @@ public function getAbsolute ($url) {
594
589
return $ this ->getScheme ().':// ' .$ this ->getHost ().$ url ;
595
590
}
596
591
597
- if ($ url [0 ] === '? ' ) {
598
- return $ this ->getScheme ().':// ' .$ this ->getHost ().'/ ' .$ this ->getPath ().$ url ;
599
- }
600
-
601
- $ path = $ this ->getPath ();
602
- $ path = !$ path ? '/ ' : "/ $ path/ " ;
603
-
604
- return $ this ->getScheme ().':// ' .$ this ->getHost ().$ path .$ url ;
592
+ return $ this ->getScheme ().':// ' .$ this ->getHost ().$ this ->getPath ().$ url ;
605
593
}
606
594
}
607
- ?>
0 commit comments