Procedural File: _file.funcs.php
Source Location: /qp_inc/files/model/_file.funcs.php
Functions
string bytesreadable(
integer $bytes, [boolean $htmlabbr = true]
)
|
|
Converts bytes to readable bytes/kb/mb/gb, like "12.45mb"
Parameters:
|
integer |
$bytes: |
bytes |
|
boolean |
$htmlabbr: |
use HTML <abbr> tags |
API Tags:
Clear contents of dorectory, but do not delete directory itself
Parameters:
void fnmatch(
$pattern, $string
)
|
|
A replacement for fnmatch() which needs PHP 4.3 and a POSIX compliant system (Windows is not).
Parameters:
Information Tags:
get_admin_templates [line 171]
array get_admin_templates(
)
|
|
Get a list of available admin templates.
This checks if there's a _adminUI.class.php in there.
API Tags:
| Return: | List of directory names that hold admin templates or false, if the admin templates directory does not exist. |
get_canonical_path [line 386]
string get_canonical_path(
string $ads_path
)
|
|
Returns canonicalized pathname of a directory + ending slash
Parameters:
|
string |
$ads_path: |
absolute path to be reduced ending with slash |
API Tags:
| Return: | absolute reduced path, slash terminated or NULL if the path could not get canonicalized. |
get_directory_tree [line 556]
string get_directory_tree(
[FileRoot $Root = NULL], [string $ads_full_path = NULL], [boolean $ads_selected_full_path = NULL], [string $radios = false], [ $rds_rel_path = NULL], [ $is_recursing = false]
)
|
|
Get the directories of the supplied path as a radio button tree.
Parameters:
|
FileRoot |
$Root: |
A single root or NULL for all available. |
|
string |
$ads_full_path: |
the root path to use |
|
boolean |
$ads_selected_full_path: |
add radio buttons ? |
|
string |
$radios: |
used by recursion |
|
|
$rds_rel_path: |
|
|
|
$is_recursing: |
|
Information Tags:
| Todo: | fp> Make a DirTree class (those static hacks suck) |
get_dirsize_recursive [line 220]
void get_dirsize_recursive(
string $path
)
|
|
Get size of a directory, including anything (especially subdirs) in there.
Parameters:
|
string |
$path: |
the dir's full path |
false|array get_filenames(
string $path, [boolean $inc_files = true], [boolean $inc_dirs = true], [boolean $flat = true], [boolean $recurse = true], [boolean $basename = false]
)
|
|
Get an array of all directories (and optionally files) of a given directory, either flat (one-dimensional array) or multi-dimensional (then dirs are the keys and hold subdirs/files).
Note: there is no ending slash on dir names returned.
Parameters:
|
string |
$path: |
the path to start |
|
boolean |
$inc_files: |
include files (not only directories) |
|
boolean |
$inc_dirs: |
include directories (not the directory itself!) |
|
boolean |
$flat: |
flat (return an one-dimension-array) |
|
boolean |
$recurse: |
Recurse into subdirectories? |
|
boolean |
$basename: |
Get the basename only. |
API Tags:
| Return: | false if the first directory could not be accessed, array of entries otherwise |
mixed imgsize(
string $path, [string $param = 'widthheight']
)
|
|
Get the size of an image file
Parameters:
|
string |
$path: |
absolute file path |
|
string |
$param: |
what property/format to get: 'width', 'height', 'widthxheight', 'type', 'string' (as for img tags), else 'widthheight' (array) |
API Tags:
is_absolute_pathname [line 758]
boolean is_absolute_pathname(
$path
)
|
|
Is the given path absolute (non-relative)?
Parameters:
boolean mkdir_r(
string $dirName, [integer $chmod = NULL]
)
|
|
Create a directory recursively.
NOTE: this can be done with the "recursive" param in PHP5
Parameters:
|
string |
$dirName: |
directory name |
|
integer |
$chmod: |
permissions |
Information Tags:
| Todo: | dh> simpletests for this (especially for open_basedir) |
no_trailing_slash [line 367]
string no_trailing_slash(
string $path
)
|
|
Remove trailing slash, if present
Parameters:
|
string |
$path: |
the path/url |
API Tags:
| Return: | the path/url without trailing slash |
rel_path_to_base [line 522]
string rel_path_to_base(
string $path
)
|
|
Return the path without the leading $basepath, or if not below $basepath, just the basename of it.
Do not use this for file handling. JUST for displaying! (DEBUG MESSAGE added)
Parameters:
API Tags:
| Return: | Relative path or even base name. NOTE: when $debug, the real path gets appended. |
void rmdir_r(
string $path
)
|
|
Deletes a dir recursively, wiping out all subdirectories!!
Parameters:
trailing_slash [line 348]
string trailing_slash(
string $path
)
|
|
Add a trailing slash, if none present
Parameters:
|
string |
$path: |
the path/url |
API Tags:
| Return: | the path/url with trailing slash |
validate_dirname [line 486]
nothing validate_dirname(
string $dirname
)
|
|
Check for valid dirname (no path allowed). ( MB )
Parameters:
|
string |
$dirname: |
dirname to test |
API Tags:
| Return: | if the dirname is valid according to the regular expression, error message if not |
| Uses: | $Settings - or $force_regexp_dirname form _advanced.php |
validate_filename [line 432]
nothing validate_filename(
string $filename, [boolean $allow_locked_filetypes = false]
)
|
|
Check for valid filename and extension of the filename (no path allowed). (MB)
Parameters:
|
string |
$filename: |
filename to test |
|
boolean |
$allow_locked_filetypes: |
|
API Tags:
| Return: | if the filename is valid according to the regular expression and the extension too, error message if not |
| Uses: | $FiletypeCache, - $settings or $force_regexp_filename form _advanced.php |
|
|