Public Member Functions | |
getRealPath ($source) | |
copyDir ($source_dir, $target_dir, $filter=null, $type=null) | |
copyFile ($source, $target, $force= 'Y') | |
readFile ($filename) | |
writeFile ($filename, $buff, $mode="w") | |
removeFile ($filename) | |
rename ($source, $target) | |
moveFile ($source, $target) | |
moveDir ($source_dir, $target_dir) | |
readDir ($path, $filter= '', $to_lower=FALSE, $concat_prefix=FALSE) | |
makeDir ($path_string) | |
removeDir ($path) | |
removeBlankDir ($path) | |
removeFilesInDir ($path) | |
filesize ($size) | |
getRemoteResource ($url, $body=null, $timeout=3, $method= 'GET', $content_type=null, $headers=array(), $cookies=array(), $post_data=array(), $request_config=array()) | |
getRemoteFile ($url, $target_filename, $body=null, $timeout=3, $method= 'GET', $content_type=null, $headers=array(), $cookies=array(), $post_data=array(), $request_config=array()) | |
returnBytes ($val) | |
checkMemoryLoadImage (&$imageInfo) | |
createImageFile ($source_file, $target_file, $resize_width=0, $resize_height=0, $target_type= '', $thumbnail_type= 'crop', $thumbnail_transparent=FALSE) | |
readIniFile ($filename) | |
writeIniFile ($filename, $arr) | |
_makeIniBuff ($arr) | |
openFile ($filename, $mode) | |
hasContent ($filename) | |
exists ($filename) | |
isDir ($path) | |
isWritableDir ($path) | |
Static Public Member Functions | |
static | clearStatCache ($target, $include=false) |
static | invalidateOpcache ($target, $force=true) |
Contains methods for accessing file system
Definition at line 9 of file FileHandler.class.php.
FileHandler::_makeIniBuff | ( | $arr | ) |
Make array to ini string
array | $arr | Array |
Definition at line 1032 of file FileHandler.class.php.
FileHandler::checkMemoryLoadImage | ( | & | $imageInfo | ) |
Check available memory to load image file
array | $imageInfo | Image info retrieved by getimagesize function |
Definition at line 727 of file FileHandler.class.php.
|
static |
Clears file status cache
string | array | $target | filename or directory |
boolean | $include | include files in the directory |
Definition at line 1146 of file FileHandler.class.php.
FileHandler::copyDir | ( | $source_dir, | |
$target_dir, | |||
$filter = null , |
|||
$type = null |
|||
) |
Copy a directory to target
If target directory does not exist, this function creates it
string | $source_dir | Path of source directory |
string | $target_dir | Path of target dir |
string | $filter | Regex to filter files. If file matches this regex, the file is not copied. |
string | $type | If set as 'force'. Even if the file exists in target, the file is copied. |
Definition at line 39 of file FileHandler.class.php.
FileHandler::copyFile | ( | $source, | |
$target, | |||
$force = 'Y' |
|||
) |
Copy a file to target
string | $source | Path of source file |
string | $target | Path of target file |
string | $force | Y: overwrite |
Definition at line 104 of file FileHandler.class.php.
FileHandler::createImageFile | ( | $source_file, | |
$target_file, | |||
$resize_width = 0 , |
|||
$resize_height = 0 , |
|||
$target_type = '' , |
|||
$thumbnail_type = 'crop' , |
|||
$thumbnail_transparent = FALSE |
|||
) |
Moves an image file (resizing is possible)
string | $source_file | Path of the source file |
string | $target_file | Path of the target file |
int | $resize_width | Width to resize |
int | $resize_height | Height to resize |
string | $target_type | If $target_type is set (gif, jpg, png, bmp), result image will be saved as target type |
string | $thumbnail_type | Thumbnail type(crop, ratio) |
bool | $thumbnail_transparent | If $target_type is png, set background set transparent color |
Definition at line 765 of file FileHandler.class.php.
FileHandler::exists | ( | $filename | ) |
Check file exists.
string | $filename | Target file name |
Definition at line 1095 of file FileHandler.class.php.
FileHandler::filesize | ( | $size | ) |
Makes file size byte into KB, MB according to the size
int | $size | Number of the size |
Definition at line 480 of file FileHandler.class.php.
FileHandler::getRealPath | ( | $source | ) |
Changes path of target file, directory into absolute path
string | $source | path to change into absolute path |
Definition at line 18 of file FileHandler.class.php.
FileHandler::getRemoteFile | ( | $url, | |
$target_filename, | |||
$body = null , |
|||
$timeout = 3 , |
|||
$method = 'GET' , |
|||
$content_type = null , |
|||
$headers = array() , |
|||
$cookies = array() , |
|||
$post_data = array() , |
|||
$request_config = array() |
|||
) |
Retrieves remote file, then stores it into target path.
string | $url | The address of the target file |
string | $target_filename | The location to store |
string | $body | HTTP request body |
string | $timeout | Connection timeout |
string | $method | GET/POST |
string | $content_type | Content type header of HTTP request |
string[] | $headers Headers key value array. |
Definition at line 676 of file FileHandler.class.php.
FileHandler::getRemoteResource | ( | $url, | |
$body = null , |
|||
$timeout = 3 , |
|||
$method = 'GET' , |
|||
$content_type = null , |
|||
$headers = array() , |
|||
$cookies = array() , |
|||
$post_data = array() , |
|||
$request_config = array() |
|||
) |
Return remote file's content via HTTP
If the target is moved (when return code is 300~399), this function follows the location specified response header.
string | $url | The address of the target file |
string | $body | HTTP request body |
int | $timeout | Connection timeout |
string | $method | GET/POST |
string | $content_type | Content type header of HTTP request |
string[] | $headers Headers key value array. | |
string[] | $cookies Cookies key value array. | |
string | $post_data | Request arguments array for POST method |
Definition at line 520 of file FileHandler.class.php.
FileHandler::hasContent | ( | $filename | ) |
Check whether the given file has the content.
string | $filename | Target file name |
Definition at line 1084 of file FileHandler.class.php.
|
static |
Invalidates a cached script of OPcache
string | array | $target | filename or directory |
boolean | $force | force |
Definition at line 1170 of file FileHandler.class.php.
FileHandler::isDir | ( | $path | ) |
Check it is dir
string | $dir | Target dir path |
Definition at line 1107 of file FileHandler.class.php.
FileHandler::isWritableDir | ( | $path | ) |
Check is writable dir
string | $path | Target dir path |
Definition at line 1119 of file FileHandler.class.php.
FileHandler::makeDir | ( | $path_string | ) |
Creates a directory
This function creates directories recursively, which means that if ancestors of the target directory does not exist, they will be created too.
string | $path_string | Path of target directory |
Definition at line 282 of file FileHandler.class.php.
FileHandler::moveDir | ( | $source_dir, | |
$target_dir | |||
) |
Move a directory
This function just wraps rename function.
string | $source_dir | Path of source directory |
string | $target_dir | Path of target directory |
Definition at line 214 of file FileHandler.class.php.
FileHandler::moveFile | ( | $source, | |
$target | |||
) |
Move a file
string | $source | Path of source file |
string | $target | Path of target file |
Definition at line 195 of file FileHandler.class.php.
FileHandler::openFile | ( | $filename, | |
$mode | |||
) |
Returns a file object
If the directory of the file does not exist, create it.
string | $filename | Target file name |
string | $mode | File mode for fopen |
Definition at line 1069 of file FileHandler.class.php.
FileHandler::readDir | ( | $path, | |
$filter = '' , |
|||
$to_lower = FALSE , |
|||
$concat_prefix = FALSE |
|||
) |
Return list of the files in the path
The array does not contain files, such as '.', '..', and files starting with '.'
string | $path | Path of target directory |
string | $filter | If specified, return only files matching with the filter |
bool | $to_lower | If TRUE, file names will be changed into lower case. |
bool | $concat_prefix | If TRUE, return file name as absolute path |
Definition at line 230 of file FileHandler.class.php.
FileHandler::readFile | ( | $filename | ) |
Returns the content of the file
string | $filename | Path of target file |
Definition at line 127 of file FileHandler.class.php.
FileHandler::readIniFile | ( | $filename | ) |
Reads ini file, and puts result into array
string | $filename | Path of the ini file |
Definition at line 985 of file FileHandler.class.php.
FileHandler::removeBlankDir | ( | $path | ) |
Remove a directory only if it is empty
string | $path | Path of the target directory |
Definition at line 404 of file FileHandler.class.php.
FileHandler::removeDir | ( | $path | ) |
Remove all files under the path
string | $path | Path of the target directory |
Definition at line 363 of file FileHandler.class.php.
FileHandler::removeFile | ( | $filename | ) |
Remove a file
string | $filename | path of target file |
Definition at line 169 of file FileHandler.class.php.
FileHandler::removeFilesInDir | ( | $path | ) |
Remove files in the target directory
This function keeps the directory structure.
string | $path | Path of the target directory |
Definition at line 438 of file FileHandler.class.php.
FileHandler::rename | ( | $source, | |
$target | |||
) |
Rename a file
In order to move a file, use this function.
string | $source | Path of source file |
string | $target | Path of target file |
Definition at line 183 of file FileHandler.class.php.
FileHandler::returnBytes | ( | $val | ) |
Convert size in string into numeric value
$val | Size in string (ex., 10, 10K, 10M, 10G ) |
Definition at line 706 of file FileHandler.class.php.
FileHandler::writeFile | ( | $filename, | |
$buff, | |||
$mode = "w" |
|||
) |
Write $buff into the specified file
string | $filename | Path of target file |
string | $buff | Content to be written |
string | $mode | a(append) / w(write) |
Definition at line 145 of file FileHandler.class.php.
FileHandler::writeIniFile | ( | $filename, | |
$arr | |||
) |
Write array into ini file
$ini['key1'] = 'value1';<br/> $ini['key2'] = 'value2';<br/> $ini['section']['key1_in_section'] = 'value1_in_section';<br/> $ini['section']['key2_in_section'] = 'value2_in_section';<br/> self::writeIniFile('exmple.ini', $ini);
string | $filename | Target ini file name |
array | $arr | Array |
Definition at line 1016 of file FileHandler.class.php.