Public Member Functions | |
__construct ($path) | |
getFilesName (&$files) | |
getFileName (&$files=null) | |
getFilesPaths (&$paths) | |
getFilePath (&$path=null) | |
useFilter ($useFilter) | |
getFilesObj (&$objs) | |
getDirsName (&$dirs) | |
getDirName () | |
setFilesFilter ($filter) | |
addFilter ($filter) | |
getExtension () | |
getName () | |
renderFilter () | |
toArray (&$arr) | |
toXml (&$xml, $recursionLevel=0, $addOpenTag=true, $rootName='Struct') | |
Static Public Member Functions | |
static | getExt ($fileName) |
Protected Attributes | |
$_filename | |
$_path | |
$_filter | |
$_isCorrect = true | |
$filtered |
Definition at line 6 of file Object.php.
__construct | ( | $ | path | ) |
Constructor
string | $path - path to directory |
Definition at line 19 of file Object.php.
00020 { 00021 parent::__construct($path); 00022 $this->_path=$path; 00023 $this->_filename=basename($path); 00024 }
addFilter | ( | $ | filter | ) |
set file filter
array | $filter - array of filter |
Definition at line 139 of file Object.php.
getDirName | ( | ) |
nothing
array | &$dirs - array of dirs |
Definition at line 119 of file Object.php.
00120 { 00121 return Varien_Directory_Collection::lastDir($this->_path); 00122 }
getDirsName | ( | &$ | dirs | ) |
nothing
array | &$dirs - array of dirs |
Implements IFactory.
Definition at line 109 of file Object.php.
00110 { 00111 return Varien_Directory_Collection::getLastDir($this->_path); 00112 }
static getExt | ( | $ | fileName | ) | [static] |
get extension of file
string | $fileName - name of file |
Definition at line 158 of file Object.php.
00159 { 00160 if($fileName === ''){ 00161 $path_parts = pathinfo($this->_filename); 00162 } else { 00163 $path_parts = pathinfo($fileName); 00164 } 00165 if(isset($path_parts["extension"])) 00166 return $path_parts["extension"]; 00167 else 00168 return ''; 00169 }
getExtension | ( | ) |
get extension of file
Definition at line 148 of file Object.php.
00149 { 00150 return self::getExt($this->_filename); 00151 }
getFileName | ( | &$ | files = null |
) |
add file name to array
array | &$files - array of files |
Definition at line 41 of file Object.php.
00042 { 00043 if($this->_isCorrect){ 00044 if($files===null) 00045 return $this->_filename; 00046 $files[] = $this->_filename; 00047 } 00048 }
getFilePath | ( | &$ | path = null |
) |
add file path to array
array | &$paths - array of paths |
Definition at line 67 of file Object.php.
00068 { 00069 if($this->_isCorrect){ 00070 if($path===null) 00071 return $this->_path; 00072 $paths[] = $this->_path; 00073 } 00074 }
getFilesName | ( | &$ | files | ) |
add file name to array
array | &$files - array of files |
Implements IFactory.
Definition at line 31 of file Object.php.
00032 { 00033 $this->getFileName(&$files); 00034 }
getFilesObj | ( | &$ | objs | ) |
add file object to array
array | &$objs - array of gile objects |
Implements IFactory.
Definition at line 97 of file Object.php.
getFilesPaths | ( | &$ | paths | ) |
add file path to array
array | &$paths - array of paths |
Implements IFactory.
Definition at line 55 of file Object.php.
getName | ( | ) |
get name of file
Definition at line 175 of file Object.php.
00176 { 00177 return basename($this->_filename,'.'.$this->getExtension()); 00178 }
renderFilter | ( | ) |
render filters
Definition at line 184 of file Object.php.
00185 { 00186 #print_r($this->_filter); 00187 if(isset($this->_filter) && count($this->_filter)>0 && $this->filtered==false){ 00188 $this->filtered = true; 00189 if(isset($this->_filter['extension'])){ 00190 $filter = $this->_filter['extension']; 00191 if($filter!=null){ 00192 if(is_array($filter)){ 00193 if(!in_array($this->getExtension(),$filter)){ 00194 $this->_isCorrect = false; 00195 } 00196 } else { 00197 if($this->getExtension()!=$filter){ 00198 $this->_isCorrect = false; 00199 } 00200 } 00201 } 00202 } 00203 if(isset($this->_filter['name'])){ 00204 $filter = $this->_filter['name']; 00205 if($filter!=null){ 00206 if(is_array($filter)){ 00207 if(!in_array($this->getName(),$filter)){ 00208 $this->_isCorrect = false; 00209 } 00210 } else { 00211 if($this->getName()!=$filter){ 00212 $this->_isCorrect = false; 00213 } 00214 } 00215 } 00216 } 00217 00218 if(isset($this->_filter['regName'])){ 00219 $filter = $this->_filter['regName']; 00220 00221 if($filter!=null){ 00222 foreach ($filter as $value) { 00223 if(!preg_match($value,$this->getName())){ 00224 $this->_isCorrect = false; 00225 } 00226 } 00227 00228 } 00229 } 00230 } 00231 }
setFilesFilter | ( | $ | filter | ) |
set file filter
array | $filter - array of filter |
Definition at line 129 of file Object.php.
00130 { 00131 $this->addFilter($filter); 00132 }
toArray | ( | &$ | arr | ) |
add to array file name
array | &$arr -export array |
Implements IFactory.
Definition at line 238 of file Object.php.
00239 { 00240 if($this->_isCorrect){ 00241 $arr['files_in_dirs'][] = $this->_filename; 00242 } 00243 }
toXml | ( | &$ | xml, | |
$ | recursionLevel = 0 , |
|||
$ | addOpenTag = true , |
|||
$ | rootName = 'Struct' | |||
) |
add to xml file name
array | &$xml -export xml | |
int | $recursionLevel - level of recursion | |
bool | $addOpenTag - nothing | |
string | $rootName - nothing |
Implements IFactory.
Definition at line 253 of file Object.php.
00254 { 00255 if($this->_isCorrect){ 00256 $xml .=str_repeat("\t",$recursionLevel+2).'<fileName>'.$this->_filename.'</fileName>'."\n"; 00257 } 00258 }
useFilter | ( | $ | useFilter | ) |
use filter
bool | $useFilter - use or not filter |
Implements IFactory.
Definition at line 81 of file Object.php.
00082 { 00083 if($useFilter){ 00084 $this->renderFilter(); 00085 } else { 00086 $this->_isCorrect = true; 00087 $this->filtered = false; 00088 } 00089 00090 }
$_filename [protected] |
Definition at line 7 of file Object.php.
$_filter [protected] |
Definition at line 9 of file Object.php.
$_isCorrect = true [protected] |
Definition at line 10 of file Object.php.
$_path [protected] |
Definition at line 8 of file Object.php.
$filtered [protected] |
Definition at line 11 of file Object.php.