Procedural File: _file.funcs.php
Source Location: /blogs/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:
nothing check_rename(
string &$newname, boolean $is_dir, boolean $allow_locked_filetypes
)
|
|
Check if file rename is acceptable
used when renaming a file, File settings
Parameters:
|
string |
&$newname: |
the new name |
|
boolean |
$is_dir: |
0 if directory |
|
boolean |
$allow_locked_filetypes: |
0 if permission denied |
API Tags:
| Return: | if the rename is acceptable, error message if not |
boolean cleardir_r(
$path
)
|
|
Clear contents of dorectory, but do not delete directory itself
Parameters:
API Tags:
| Return: | False on failure (may be only partial), true on success. |
file_controller_build_tabs [line 894]
void file_controller_build_tabs(
)
|
|
Controller helper
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_skins [line 178]
Get a list of available admin skins.
This checks if there's a _adminUI.class.php in there.
API Tags:
| Return: | List of directory names that hold admin skins or false, if the admin skins driectory does not exist. |
get_canonical_path [line 429]
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 632]
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 210]
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], [ $trailing_slash = 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. |
|
|
$trailing_slash: |
|
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), 'widthheight_assoc' (array with keys "width" and "height", else 'widthheight' (numeric array) |
API Tags:
is_absolute_pathname [line 850]
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_leading_slash [line 410]
string no_leading_slash(
string $path
)
|
|
Remove leading slash, if any.
Parameters:
no_trailing_slash [line 391]
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 598]
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. |
boolean rmdir_r(
string $path
)
|
|
Deletes a dir recursively, wiping out all subdirectories!!
Parameters:
API Tags:
sys_get_temp_dir [line 876]
string sys_get_temp_dir(
)
|
|
Define sys_get_temp_dir, if not available (PHP 5 >= 5.2.1)
API Tags:
Information Tags:
trailing_slash [line 372]
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 532]
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 478]
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 |