Class MOXMAN_Util_PathUtils
Inheritance | MOXMAN_Util_PathUtils |
---|
This class is an utility class for handling paths.
Public Methods
Method | Description | Defined By |
---|---|---|
combine() | Combines two paths into one path. | MOXMAN_Util_PathUtils |
getExtension() | Returns the extension of a specified file path. The return string will be forced to lowercase. Example of output for "my.doc" is "doc". | MOXMAN_Util_PathUtils |
getParent() | Returns the parent path of the specified path. An empty string will be returned when getting the parent of a root directory. | MOXMAN_Util_PathUtils |
getSitePaths() | GetSitePaths | MOXMAN_Util_PathUtils |
getTempDir() | Returns the configured temp dir or the system temp dir path. | MOXMAN_Util_PathUtils |
isChildOf() | Checks if the specified child is within the specified parent path. It will also return true if the child and parent is equal. | MOXMAN_Util_PathUtils |
toAbsolute() | Returns an absolute path from a relative path relative to where the root of the application is. | MOXMAN_Util_PathUtils |
toUnixPath() | Convert OS path into Unix style path. | MOXMAN_Util_PathUtils |
Method Details
Combines two paths into one path.
public static String combine ( $path1, $path2 ) | ||
$path1 | string | Path to be on the left side. |
$path2 | string | Path to be on the right side. |
return | String | Combined path string. |
---|
Returns the extension of a specified file path. The return string will be forced to lowercase. Example of output for "my.doc" is "doc".
public static String getExtension ( $path ) | ||
$path | string | Path to file to get the extension for. |
return | String | Lowercase extension for the specified file or empty string if it wasn't found. |
---|
Returns the parent path of the specified path. An empty string will be returned when getting the parent of a root directory.
public static String getParent ( $path ) | ||
$path | string | Parent path to get parent of. |
return | String | Parent path of the specified path. |
---|
GetSitePaths
public static Array getSitePaths ( $file = "", $script = "" ) | ||
$file | string | Site absolute path /var/www/dir/file |
$script | string | URL path. /dir/file |
return | Array | With wwwroot and prefix. |
---|
Returns the configured temp dir or the system temp dir path.
public static String getTempDir ( $config = null ) | ||
$config | MOXMAN_Util_Config | Optional config instance to get temp dir from. |
return | String | Temp dir path. |
---|
Checks if the specified child is within the specified parent path. It will also return true if the child and parent is equal.
public static Boolean isChildOf ( $child, $parent ) | ||
$child | string | Child path to check if it's inside the parent. |
$parent | string | Parent path to check if the child is in. |
return | Boolean | True/false if the child is within the parent. |
---|
Returns an absolute path from a relative path relative to where the root of the application is.
It will also convert any absolute path to unix style slashes like c:\ becomes c:/
public static String toAbsolute ( $base, $path ) | ||
$base | string | Base path to combine the relative path with. |
$path | string | Path to convert into an absolute path. |
return | String | Absolute file system path out of the relative path- |
---|
Convert OS path into Unix style path.
public static String toUnixPath ( $path ) | ||
$path | string | Path to convert into Unix style. |
return | String | Path converted into Unix style. |
---|