Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Attributes

oxUtilsFile Class Reference

Inheritance diagram for oxUtilsFile:
Collaboration diagram for oxUtilsFile:

List of all members.

Public Member Functions

 __construct ()
 normalizeDir ($sDir)
 copyDir ($sSourceDir, $sTargetDir)
 deleteDir ($sSourceDir)
 readRemoteFileAsString ($sPath)
 processFiles ($oObject=null, $aFiles=array(), $blUseMasterImage=false)
 checkFile ($sFile)
 urlValidate ($sLink)
 handleUploadedFile ($aFileInfo, $sUploadPath)
 getImageDirByType ($sType)

Static Public Member Functions

static getInstance ()

Protected Member Functions

 _prepareImageName ($sValue, $sType, $blDemo, $sImagePath)
 _getImagePath ($sType)
 _getImageSize ($sImgType, $iImgNum, $sImgConf)
 _prepareImage ($sType, $sSource, $sTarget)
 _copyFile ($sSource, $sTarget)
 _moveImage ($sSource, $sTarget)
 _removeTempImage ($sImagePath)
 _getUniqueFileName ($sFilePath, $sFileName, $sFileExt, $sSufix="")

Protected Attributes

 $_iMaxPicImgCount = 12
 $_iMaxZoomImgCount = 12
 $_aTypeToPath
 $_aBadFiles = array( 'php', 'jsp', 'cgi', 'cmf', 'exe' )
 $_aAllowedFiles = array( 'gif', 'jpg', 'png', 'pdf' )

Static Private Attributes

static $_instance = null

Detailed Description

File manipulation utility class

Definition at line 6 of file oxutilsfile.php.


Constructor & Destructor Documentation

oxUtilsFile.__construct (  ) 

Class constructor, initailizes pictures count info (_iMaxPicImgCount/_iMaxZoomImgCount)

Returns:
null

Reimplemented from oxSuperCfg.

Definition at line 117 of file oxutilsfile.php.


Member Function Documentation

oxUtilsFile._copyFile ( sSource,
sTarget 
) [protected]

Copy file from source to target location

Parameters:
string $sSource file location
string $sTarget file location
Returns:
bool

Definition at line 402 of file oxutilsfile.php.

oxUtilsFile._getImagePath ( sType  )  [protected]

Returns image storage path

Parameters:
string $sType image type
Returns:
string

Definition at line 288 of file oxutilsfile.php.

oxUtilsFile._getImageSize ( sImgType,
iImgNum,
sImgConf 
) [protected]

Returns array of sizes which are used to resize images. If size is not defined - NULL will be returned

Parameters:
string $sImgType image type (TH, TC, ICO etc), can be useful for modules
int $iImgNum number of image (e.g. numper of ZOOM1 is 1)
string $sImgConf config parameter name, which keeps size info
Returns:
array | null

Definition at line 305 of file oxutilsfile.php.

oxUtilsFile._getUniqueFileName ( sFilePath,
sFileName,
sFileExt,
sSufix = "" 
) [protected]

Checks if file with same name does not exist, if exists - addes number prefix to file name Returns unique file name.

Parameters:
string $sFilePath file storage path/folder (e.g. /htdocs/out/img/)
string $sFileName name of file (e.g. picture1)
string $sFileExt file extension (e.g. gif)
string $sSufix file name sufix (e.g. _ico)
Returns:
string

Definition at line 668 of file oxutilsfile.php.

oxUtilsFile._moveImage ( sSource,
sTarget 
) [protected]

Moves image from source to target location

Parameters:
string $sSource image location
string $sTarget image copy location
Returns:
bool

Definition at line 427 of file oxutilsfile.php.

oxUtilsFile._prepareImage ( sType,
sSource,
sTarget 
) [protected]

Prepares (resizes anc copies) images according to its type. Returns preparation status

Parameters:
string $sType image type
string $sSource image location
string $sTarget image copy location
Returns:
array

Definition at line 337 of file oxutilsfile.php.

oxUtilsFile._prepareImageName ( sValue,
sType,
blDemo,
sImagePath 
) [protected]

Prepares image file name

Parameters:
object $sValue uploadable file name
string $sType image type
object $blDemo if true = whecks if file type is defined in oxutilsfile._aAllowedFiles
string $sImagePath final image file location
Returns:
string

Definition at line 245 of file oxutilsfile.php.

oxUtilsFile._removeTempImage ( sImagePath  )  [protected]

Removes temporary created image. Returns deletion state

Parameters:
string $sImagePath temporary image path
Returns:
bool

Definition at line 451 of file oxutilsfile.php.

oxUtilsFile.checkFile ( sFile  ) 

Checks if passed file exists and may be opened for reading. Returns true on success.

Parameters:
string $sFile Name of file to check
Returns:
bool

Definition at line 548 of file oxutilsfile.php.

oxUtilsFile.copyDir ( sSourceDir,
sTargetDir 
)

Copies directory tree for creating a new shop.

Parameters:
string $sSourceDir Source directory
string $sTargetDir Target directory
Returns:
null

Definition at line 152 of file oxutilsfile.php.

oxUtilsFile.deleteDir ( sSourceDir  ) 

Deletes directory tree.

Parameters:
string $sSourceDir Path to directory
Returns:
null

Definition at line 188 of file oxutilsfile.php.

oxUtilsFile.getImageDirByType ( sType  ) 

Returns image storage path

Parameters:
string $sType image type
Returns:
string

Definition at line 695 of file oxutilsfile.php.

static oxUtilsFile.getInstance (  )  [static]

Returns object instance

Returns:
oxUtilsFile

Definition at line 95 of file oxutilsfile.php.

oxUtilsFile.handleUploadedFile ( aFileInfo,
sUploadPath 
)

Handles uploaded path. Returns new URL to the file

Parameters:
array $aFileInfo Global $_FILE parameter info
string $sUploadPath RELATIVE (to config sShopDir parameter) path for uploaded file to be copied
Exceptions:
oxException if file is not valid
Returns:
string

Definition at line 615 of file oxutilsfile.php.

oxUtilsFile.normalizeDir ( sDir  ) 

Normalizes dir by adding missing trailing slash

Parameters:
string $sDir Directory
Returns:
string

Definition at line 135 of file oxutilsfile.php.

oxUtilsFile.processFiles ( oObject = null,
aFiles = array(),
blUseMasterImage = false 
)

Uploaded file processor (filters, etc), sets configuration parameters to passed object and returns it.

Parameters:
object $oObject object, that parameters are modified according to passed files
array $aFiles name of files to process
bool $blUseMasterImage use master image as source for processing
Returns:
object

Definition at line 466 of file oxutilsfile.php.

oxUtilsFile.readRemoteFileAsString ( sPath  ) 

Reads remote stored file. Returns contents of file.

Parameters:
string $sPath Remote file path & name
Returns:
string

Definition at line 219 of file oxutilsfile.php.

oxUtilsFile.urlValidate ( sLink  ) 

Checks if given URL is accessible (HTTP-Code: 200)

Parameters:
string $sLink given link
Returns:
boolean

Definition at line 578 of file oxutilsfile.php.


Member Data Documentation

oxUtilsFile.$_aAllowedFiles = array( 'gif', 'jpg', 'png', 'pdf' ) [protected]

Definition at line 89 of file oxutilsfile.php.

oxUtilsFile.$_aBadFiles = array( 'php', 'jsp', 'cgi', 'cmf', 'exe' ) [protected]

Definition at line 81 of file oxutilsfile.php.

oxUtilsFile.$_aTypeToPath [protected]

Definition at line 34 of file oxutilsfile.php.

oxUtilsFile.$_iMaxPicImgCount = 12 [protected]

Definition at line 20 of file oxutilsfile.php.

oxUtilsFile.$_iMaxZoomImgCount = 12 [protected]

Definition at line 27 of file oxutilsfile.php.

oxUtilsFile.$_instance = null [static, private]

Definition at line 13 of file oxutilsfile.php.


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