/var-www-hotglue/hotglue.org-test/dev/util.inc.php File Reference

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)

Function Documentation

array_to_js ( container  ) 

convert an associative array to a javascript block

Parameters:
array $container container array
Returns:
string

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

Parameters:
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)

Parameters:
string $dir directory to check
string $fn file to look for
string $orig_fn first check this filename (optional)
Returns:
(basename) filename of identical file in $dir or false if there is none

Definition at line 78 of file util.inc.php.

dir_is_different ( a,
b 
)

check if two directories are different

Parameters:
string $a filename
string $b filename
Returns:
bool

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.

Parameters:
string $delimiter boundary string
string $string input string
Returns:
array

Definition at line 159 of file util.inc.php.

expl_whitesp ( s,
honor_quot = false 
)

explode a string splitting it by whitespace characters

Parameters:
string $s input string
bool $honor_quot don't split inside quotation marks
Returns:
array of strings

Definition at line 177 of file util.inc.php.

file_is_different ( a,
b 
)

check if two files are different

Parameters:
string $a filename
string $b filename
Returns:
bool

Definition at line 225 of file util.inc.php.

filext ( s  ) 

get the extension of a file

Parameters:
string $s filename
Returns:
string

Definition at line 244 of file util.inc.php.

http_digest_check ( users,
realm = '' 
)

check if the user is http digest authenticated

Parameters:
array $users array of possible users (usernames as keys, password as values)
string $realm realm (e.g. name of the site)
Return values:
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.

Parameters:
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.

Parameters:
int $code error code
bool $header_only only output the header and return
Returns:
bool true if successful (only if $header_only is true), false if not

Definition at line 265 of file util.inc.php.

is_url ( s  ) 

check if a string is a url

Parameters:
string $s
Returns:
bool

Definition at line 397 of file util.inc.php.

nl ( count = 1  ) 

return a number of newline characters

Parameters:
int $count count (one is default)
Returns:
string

Definition at line 413 of file util.inc.php.

pad ( s,
num,
chr = ' ' 
)

pad a string to have at least $num characters

Parameters:
string $s string to operate on
int $num number of characters desired
string $chr character to pad the string with
Returns:
string

Definition at line 431 of file util.inc.php.

quot ( s  ) 

return a string with double quotation marks wrapped around

Parameters:
string $s string
Returns:
string

Definition at line 446 of file util.inc.php.

rm_recursive ( f  ) 

delete a file or directory

Parameters:
string $f file name
Returns:
true if successful, false if not

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.

Parameters:
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

Parameters:
int $count count (one is default)
Returns:
string

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

Parameters:
string $dir destination directory
string $orig_fn original filename
Returns:
string (basename) proposed filename

Definition at line 546 of file util.inc.php.

var_dump_inl ( var  ) 

print human-readable information about a variable in inline format

Parameters:
mixed $var variable
Returns:
string

Definition at line 578 of file util.inc.php.

Generated on Wed Jul 11 19:43:16 2012 for hotglue by  doxygen 1.6.3