Go to the source code of this file.
Functions | |
array_to_js ($container) | |
array_unique_element (&$a, $key) | |
dir_has_same_file ($dir, $fn, $orig_fn= '') | |
dir_is_different ($a, $b) | |
expl ($delimiter, $string) | |
expl_whitesp ($s, $honor_quot=false) | |
file_is_different ($a, $b) | |
filext ($s) | |
http_error ($code, $header_only=false) | |
http_digest_check ($users, $realm= '') | |
http_digest_prompt ($realm= '') | |
is_url ($s) | |
nl ($count=1) | |
pad ($s, $num, $chr= ' ') | |
quot ($s) | |
rm_recursive ($f) | |
serve_file ($fn, $dl, $mime= '') | |
tab ($count=1) | |
unique_filename ($dir, $orig_fn) | |
var_dump_inl ($var) |
array_to_js | ( | $ | container | ) |
convert an associative array to a javascript block
array | $container container array |
Definition at line 18 of file util.inc.php.
array_unique_element | ( | &$ | a, | |
$ | key | |||
) |
make an array off associative array unique in a certain key-value
array | &$a reference to array | |
mixed | $key key whose value we compare |
Definition at line 51 of file util.inc.php.
dir_has_same_file | ( | $ | dir, | |
$ | fn, | |||
$ | orig_fn = '' | |||
) |
check if a directory already contains a file (based on its content)
string | $dir directory to check | |
string | $fn file to look for | |
string | $orig_fn first check this filename (optional) |
Definition at line 78 of file util.inc.php.
dir_is_different | ( | $ | a, | |
$ | b | |||
) |
check if two directories are different
string | $a filename | |
string | $b filename |
Definition at line 117 of file util.inc.php.
expl | ( | $ | delimiter, | |
$ | string | |||
) |
split a string by string
like php's explode() but handles empty strings better.
string | $delimiter boundary string | |
string | $string input string |
Definition at line 159 of file util.inc.php.
expl_whitesp | ( | $ | s, | |
$ | honor_quot = false | |||
) |
explode a string splitting it by whitespace characters
string | $s input string | |
bool | $honor_quot don't split inside quotation marks |
Definition at line 177 of file util.inc.php.
file_is_different | ( | $ | a, | |
$ | b | |||
) |
check if two files are different
string | $a filename | |
string | $b filename |
Definition at line 225 of file util.inc.php.
filext | ( | $ | s | ) |
get the extension of a file
string | $s filename |
Definition at line 244 of file util.inc.php.
http_digest_check | ( | $ | users, | |
$ | realm = '' | |||
) |
check if the user is http digest authenticated
array | $users array of possible users (usernames as keys, password as values) | |
string | $realm realm (e.g. name of the site) |
0 | authenticated | |
-1 | user did not request authentication | |
-2 | parts of the response are missing | |
-3 | unknown username | |
-4 | invalid password |
Definition at line 303 of file util.inc.php.
http_digest_prompt | ( | $ | realm = '' |
) |
prompt the user for http digest authentication
make sure the script stops execution after calling this function.
string | $realm realm (e.g. name of the site) |
Definition at line 383 of file util.inc.php.
http_error | ( | $ | code, | |
$ | header_only = false | |||
) |
return a http error message to the client
if $header_only is false (the default), the function doesn't return if successful.
int | $code error code | |
bool | $header_only only output the header and return |
Definition at line 265 of file util.inc.php.
is_url | ( | $ | s | ) |
check if a string is a url
string | $s |
Definition at line 397 of file util.inc.php.
nl | ( | $ | count = 1 |
) |
return a number of newline characters
int | $count count (one is default) |
Definition at line 413 of file util.inc.php.
pad | ( | $ | s, | |
$ | num, | |||
$ | chr = ' ' | |||
) |
pad a string to have at least $num characters
string | $s string to operate on | |
int | $num number of characters desired | |
string | $chr character to pad the string with |
Definition at line 431 of file util.inc.php.
quot | ( | $ | s | ) |
return a string with double quotation marks wrapped around
string | $s string |
Definition at line 446 of file util.inc.php.
rm_recursive | ( | $ | f | ) |
delete a file or directory
string | $f file name |
Definition at line 458 of file util.inc.php.
serve_file | ( | $ | fn, | |
$ | dl, | |||
$ | mime = '' | |||
) |
serve a file to the client
this function only returns on errors.
string | $fn filename | |
bool | $dl download file | |
string | $mime mime type |
Definition at line 491 of file util.inc.php.
tab | ( | $ | count = 1 |
) |
return a number of tab characters
int | $count count (one is default) |
Definition at line 529 of file util.inc.php.
unique_filename | ( | $ | dir, | |
$ | orig_fn | |||
) |
find a unique filename for copying a file to destination directory
string | $dir destination directory | |
string | $orig_fn original filename |
Definition at line 546 of file util.inc.php.
var_dump_inl | ( | $ | var | ) |
print human-readable information about a variable in inline format
mixed | $var variable |
Definition at line 578 of file util.inc.php.