Public Member Functions | |
setAllowCreateFolders ($flag) | |
open (array $args=array()) | |
dirsep () | |
getCleanPath ($path) | |
allowedPath ($haystackPath, $needlePath) | |
Protected Attributes | |
$_allowCreateFolders = false |
Definition at line 35 of file Abstract.php.
allowedPath | ( | $ | haystackPath, | |
$ | needlePath | |||
) |
Definition at line 114 of file Abstract.php.
00115 { 00116 return strpos($this->getCleanPath($haystackPath), $this->getCleanPath($needlePath)) === 0; 00117 }
dirsep | ( | ) |
Retrieve directory separator in context of io resource
Implements Varien_Io_Interface.
Reimplemented in Varien_Io_File.
Definition at line 68 of file Abstract.php.
getCleanPath | ( | $ | path | ) |
Definition at line 73 of file Abstract.php.
00074 { 00075 if (empty($path)) { 00076 return './'; 00077 } 00078 00079 $path = trim(preg_replace("/\\\\/", "/", (string)$path)); 00080 00081 if (!preg_match("/(\.\w{1,4})$/", $path) && !preg_match("/\?[^\\/]+$/", $path) && !preg_match("/\\/$/", $path)) { 00082 $path .= '/'; 00083 } 00084 00085 $matches = array(); 00086 $pattern = "/^(\\/|\w:\\/|https?:\\/\\/[^\\/]+\\/)?(.*)$/i"; 00087 preg_match_all($pattern, $path, $matches, PREG_SET_ORDER); 00088 00089 $pathTokR = $matches[0][1]; 00090 $pathTokP = $matches[0][2]; 00091 00092 $pathTokP = preg_replace(array("/^\\/+/", "/\\/+/"), array("", "/"), $pathTokP); 00093 00094 $pathParts = explode("/", $pathTokP); 00095 $realPathParts = array(); 00096 00097 for ($i = 0, $realPathParts = array(); $i < count($pathParts); $i++) { 00098 if ($pathParts[$i] == '.') { 00099 continue; 00100 } 00101 elseif ($pathParts[$i] == '..') { 00102 if ((isset($realPathParts[0]) && $realPathParts[0] != '..') || ($pathTokR != "")) { 00103 array_pop($realPathParts); 00104 continue; 00105 } 00106 } 00107 00108 array_push($realPathParts, $pathParts[$i]); 00109 } 00110 00111 return $pathTokR . implode('/', $realPathParts); 00112 }
Open a connection
array | $config |
Implements Varien_Io_Interface.
Reimplemented in Varien_Io_File, and Varien_Io_Ftp.
Definition at line 63 of file Abstract.php.
setAllowCreateFolders | ( | $ | flag | ) |
Allow automaticaly create non-existant directories
bool | $flag |
Reimplemented in Varien_Io_File.
Definition at line 51 of file Abstract.php.
$_allowCreateFolders = false [protected] |