ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilCloudUtil.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
15{
20 public static function normalizePath($path)
21 {
22 if ($path == "." || $path == "/" || $path == "") {
23 $path = "/";
24 } else {
25 $path = "/" . rtrim(ltrim(str_replace('//', '/', $path), "/"), "/");
26 }
27
28 return $path;
29 }
30
36 public static function joinPaths($path1, $path2)
37 {
38 $path1 = ilCloudUtil::normalizePath($path1);
39 $path2 = ilCloudUtil::normalizePath($path2);
40 return ilCloudUtil::normalizePath(str_replace('//', '/', $path1 . $path2));
41 }
42
49 public static function joinPathsAbsolute($path1, $path2)
50 {
51 $path = ilCloudUtil::normalizePath(str_replace('//', '/', $path1 . $path2));
52 if ($path == "/") {
53 return $path;
54 } else {
55 return "/" . ltrim($path, "/") . "/";
56 }
57 }
58}
An exception for terminatinating execution or to throw for unit testing.
Class ilCloudUtil.
static normalizePath($path)
static joinPathsAbsolute($path1, $path2)
With trailing and leading slashes.
static joinPaths($path1, $path2)