ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 {
16 
22  public static function normalizePath($path)
23  {
24  if ($path == "." || $path == "/" || $path == "") {
25  $path = "/";
26  } else {
27  $path = "/" . rtrim(ltrim(str_replace('//', '/', $path), "/"), "/");
28  }
29 
30  return $path;
31  }
32 
33 
40  public static function joinPaths($path1, $path2)
41  {
42  $path1 = ilCloudUtil::normalizePath($path1);
43  $path2 = ilCloudUtil::normalizePath($path2);
44 
45  return ilCloudUtil::normalizePath(str_replace('//', '/', $path1 . $path2));
46  }
47 
48 
57  public static function joinPathsAbsolute($path1, $path2)
58  {
59  $path = ilCloudUtil::normalizePath(str_replace('//', '/', $path1 . $path2));
60  if ($path == "/") {
61  return $path;
62  } else {
63  return "/" . ltrim($path, "/") . "/";
64  }
65  }
66 }
static joinPathsAbsolute($path1, $path2)
With trailing and leading slashes.
static joinPaths($path1, $path2)
Class ilCloudUtil.
static normalizePath($path)