Varien_Io_Abstract Class Reference

Inheritance diagram for Varien_Io_Abstract:

Varien_Io_Interface Varien_Io_File Varien_Io_Ftp Varien_Io_Sftp

List of all members.

Public Member Functions

 setAllowCreateFolders ($flag)
 open (array $args=array())
 dirsep ()
 getCleanPath ($path)
 allowedPath ($haystackPath, $needlePath)

Protected Attributes

 $_allowCreateFolders = false


Detailed Description

Definition at line 35 of file Abstract.php.


Member Function Documentation

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.

00069     {
00070         return '/';
00071     }

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 ( array args = array()  ) 

Open a connection

Parameters:
array $config
Returns:
bool

Implements Varien_Io_Interface.

Reimplemented in Varien_Io_File, and Varien_Io_Ftp.

Definition at line 63 of file Abstract.php.

00064     {
00065         return false;
00066     }

setAllowCreateFolders ( flag  ) 

Allow automaticaly create non-existant directories

Parameters:
bool $flag
Returns:
Varien_Io_Abstract

Reimplemented in Varien_Io_File.

Definition at line 51 of file Abstract.php.

00052     {
00053         $this->_allowCreateFolders = (bool)$flag;
00054         return $this;
00055     }


Member Data Documentation

$_allowCreateFolders = false [protected]

Reimplemented in Varien_Io_File.

Definition at line 43 of file Abstract.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:25:03 2009 for Magento by  doxygen 1.5.8