pclib
2.8.8
Lightweight PHP framework
|
PClib constants, global functions and variables. More...
Functions | |
paramstr ($str, $param, $keepEmpty=false) | |
Placeholders in string $str will be replaced with values from $param array. More... | |
dump () | |
Dump variable(s) for debugging and stop application. More... | |
ddump () | |
Dump variable(s) for debugging to the debug log. More... | |
jdump () | |
Dump variable(s) for debugging to the javascript console. More... | |
pri ($id) | |
Return string "ID='$id'". More... | |
extractpath ($path, $format) | |
Return part of the filesystem path. More... | |
mkident ($s, $options='') | |
Convert string to identificator. More... | |
str_shift ($separ, &$str) | |
Similar to array_shift() but for string. More... | |
pcl_ident ($str) | |
Convert string to pcl identificator, valid for system purposes. More... | |
mimetype ($path) | |
Return mime-type of the file $path. More... | |
filedata ($path, $force_download=false, $filename=null) | |
Send file $path to output through php (so real path to file is hidden). More... | |
randomstr ($size, $characters='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') | |
Return string of size $size with random characters. | |
safe_session_start () | |
Configure session cookie for safe usage and call session_start(). | |
PClib constants, global functions and variables.
ddump | ( | ) |
Dump variable(s) for debugging to the debug log.
Usage: ddump($a,$b,...);
dump | ( | ) |
Dump variable(s) for debugging and stop application.
Usage: dump($a,$b,...);
extractpath | ( | $path, | |
$format | |||
) |
Return part of the filesystem path.
Format can use placeholders d directory, f filename, e extension. Example: extractpath($path, "%f.%e"); //return "filename.extension"
filedata | ( | $path, | |
$force_download = false , |
|||
$filename = null |
|||
) |
Send file $path to output through php (so real path to file is hidden).
You can force browser download dialog or show file name as $filename.
jdump | ( | ) |
Dump variable(s) for debugging to the javascript console.
Usage: jdump($a,$b,...);
mimetype | ( | $path | ) |
Return mime-type of the file $path.
It uses linux command 'file', so it works only on *nix with exec() allowed. On windows you can set array of extension => mime-type pairs into pclib.mimetypes config variable.
mkident | ( | $s, | |
$options = '' |
|||
) |
Convert string to identificator.
Convert characters to ascii and remove other characters. You can set words separator or convert to uppercase/lowercase.
string | $s | input text |
string | $options | ex: '' : camelcase, '-' : 'camel-case', '_U': CAMEL_CASE etc. |
paramstr | ( | $str, | |
$param, | |||
$keepEmpty = false |
|||
) |
Placeholders in string $str will be replaced with values from $param array.
Format is the same like for template file.
Ex: print paramstr("{A} is {B}", array('A' => 'pclib', 'B' => 'best'));
$param can be two-dimensional array of n-rows, each row is formated with string $str.
string | $str | string with {PARAM} parameters (placeholders) |
array | $param | associative array PARAM=>VALUE |
bool | $keepEmpty | Keep (don't delete) tags undefined in $param |
pcl_ident | ( | $str | ) |
Convert string to pcl identificator, valid for system purposes.
Reduce input text to alphanumeric characters plus underscore, dot and hyphen
string | $str | input text |
pri | ( | $id | ) |
Return string "ID='$id'".
Helper for db queries on primary key.
Ex: $db->select('PRODUCTS', pri($id));
str_shift | ( | $separ, | |
& | $str | ||
) |
Similar to array_shift() but for string.
Return beginning of the string to the separator $separ, shortening original $str