array_krsort (line 515)
Replacement function for krsort() function. Returns array
array
array_krsort
(array $array, [int $flag = SORT_REGULAR])
-
array
$array: Array that need to be sorted
-
int
$flag: Sort flag, described on sort() function documentation page
array_ksort (line 502)
Replacement function for ksort() function. Returns array
array
array_ksort
(array $array, [int $flag = SORT_REGULAR])
-
array
$array: Array that need to be sorted
-
int
$flag: Sort flag, described on sort() function documentation page
array_rsort (line 489)
Replacement function for rsort() function. Returns array
array
array_rsort
(array $array, [int $flag = SORT_REGULAR])
-
array
$array: Array that need to be sorted
-
int
$flag: Sort flag, described on sort() function documentation page
array_sort (line 476)
Replacement function for sort() function. Returns array
array
array_sort
(array $array, [int $flag = SORT_REGULAR])
-
array
$array: Array that need to be sorted
-
int
$flag: Sort flag, described on sort() function documentation page
delete_dir (line 200)
Remove specific directory
boolean
delete_dir
(string $dir)
-
string
$dir: Directory path
dir_size (line 176)
Return size of a specific dir in bytes
integer
dir_size
(string $dir)
download_contents (line 339)
SAVR 10/20/06 : force file download over SSL for IE
BIP 09/17/07 : inserted and tested for ProjectPier Was: function download_contents($content, $type, $name, $size, $force_download = false) {
void
download_contents
( $content, $type, $name, $size, [ $force_download = true])
-
$content
-
$type
-
$name
-
$size
-
$force_download
download_file (line 316)
Forward specific file to the browser. Download can be forced (dispolition: attachment) or passed as inline file
boolean
download_file
(string $path, [string $type = 'application/octet-stream'], [string $name = ''], [boolean $force_download = false])
-
string
$path: File path
-
string
$type: Serve file as this type
-
string
$name: If set use this name, else use filename (basename($path))
-
boolean
$force_download: Force download (add Disposition => attachement)
file_is_writable (line 33)
Check if specific file is writable
boolean
file_is_writable
(string $path)
folder_is_writable (line 9)
Check if specific folder is writable
boolean
folder_is_writable
(string $path)
force_mkdir (line 225)
Force creation of all dirs
null
force_mkdir
(void $path, [ $chmod = null])
get_files (line 78)
Return the files from specific directory. This function can filter result by file extension (accepted param is single extension or array of extensions)
array
get_files
(string $dir, [mixed $extension = null], [boolean $base_name_only = false])
-
string
$dir: Dir that need to be scaned
-
mixed
$extension: Singe or multiple file extensions that need to be mached. If null no check is performed...
-
boolean
$base_name_only: Return only filenames. If this option is set to false this function will return full paths.
get_file_extension (line 158)
Return file extension from specific path
string
get_file_extension
(string $path, [boolean $leading_dot = false])
-
string
$path: File path
-
boolean
$leading_dot: Include leading dot (or not...)
get_file_line (line 56)
Return specific line of specific file
string
get_file_line
(string $file, integer $line, [midex $default = null])
-
string
$file
-
integer
$line
-
midex
$default: Returned if file or line does not exists
get_unique_filename (line 279)
Check if file $in/$desired_filename exists and if it exists save it in $in/$desired_filename(x).exteionsion (X is inserted in front of the extension)
string
get_unique_filename
(string $in, string $desired_filename)
-
string
$in: Directory
-
string
$desired_filename
insert_before_file_extension (line 302)
Set something before file extension
null
insert_before_file_extension
( $filename, string $insert, string $in)
-
string
$in: Filename
-
string
$insert: Insert this
-
$filename
is_dir_empty (line 259)
This function will return true if $dir_path is empty
boolean
is_dir_empty
(string $dir_path)
sort_files (line 403)
This function is used for sorting list of files.
The most important thing about this function is $extractor. It is function name of function that will be used to extract data that we need for sorting
- filesize, file modification type, content-type... Anything. First param of
$extractor function must be filepath.
After the extract have all the data it need $sort_with function will be used to sort by the extracted data... First param of the $sort_with function must be array that need to be sorted. This function MUST RETURN SORTED ARRAY, cant use side effect...
Important = $sort_with must be key sorting function because this function saves extracted data into the array keys...
Examples:
sort_files($files, 'filemtime', 'krsort', SORT_NUMERIC) will sort all files by modification time and the freshest files will be at the top of the result
array
sort_files
( $files, string $extractor, [string $sort_with = 'array_ksort'], [mixed $sort_method = null], array $file)
-
array
$file: Array of filenames
-
string
$extractor: Function that will be used for extractiong specific file data (like file creation time or filesize)
-
string
$sort_with: Function that will be used to sort the array when we are done...
-
mixed
$sort_method: If this value is <> null that this will be passed to the sort functions as second param. I added it because there are great number of function that can use it to make a diffrence between string and int sorting...
-
$files