Private Method Details |
log_message |
private void log_message( $message )
|
|
Logs specified message to PROJECT_LOG_FILE if defined.
|
Parameter |
|
|
$message |
|
|
No additional comments. |
|
Returns |
void |
|
phpx_assert |
private void phpx_assert( $condition, string $message, string $show )
|
|
PHP/Toolbox custom assertion check routine.
If condition is false then:
logs the message;
if show is true or SHOW_ASSERT_MESSAGES is defined then
echoes the message with span class assert;
otherwise, if FAILED_ASSERTION_URL is defined then redirects to it;
exits.
|
Parameter |
|
|
$condition |
|
|
No additional comments. |
|
|
string |
$message |
|
|
No additional comments. |
|
|
string |
$show |
|
|
No additional comments. |
|
Returns |
void |
See Also |
log_message() |
|
phpx_abort |
private void phpx_abort( string $message, string $show )
|
|
Logs the message and dies with it
if show is true.
|
Parameter |
|
string |
$message |
|
|
No additional comments. |
|
|
string |
$show |
|
|
No additional comments. |
|
Returns |
void |
|
phpx_debug |
private void phpx_debug( string $v, string $show )
|
|
Prints the variable data.
If show is false, it prints into html-comment.
|
Parameter |
|
string |
$v |
|
|
No additional comments. |
|
|
string |
$show |
|
|
No additional comments. |
|
Returns |
void |
|
ImgScale |
private string ImgScale( string $img_file, [ integer $MAX_W, integer $MAX_H ] )
|
|
Calculates scaled dimensions for the specified image.
|
Parameter |
|
|
|
integer |
$MAX_W |
= >>150<< |
|
- max image width. |
|
|
integer |
$MAX_H |
= >>150<< |
|
- max image height. |
|
Returns |
string - "width=$scaled_width height=$scaled_height". |
|
SmartViewer |
private string SmartViewer( string $text, string $src, [ string $wname, string $wparm ] )
|
|
Creates text 'button' to open child window
regardless to javascript availability.
|
Parameter |
|
string |
$text |
|
|
- link text. |
|
|
string |
$src |
|
|
- source document the link points to. |
|
|
string |
$wname |
= >>""<< |
|
- child window name. |
|
|
string |
$wparm |
= >>"width=200, height=100"<< |
|
- script window.open params. |
|
Returns |
string - html. |
|
input_check |
private void input_check( $name, $attr, string $value, string $key )
|
|
Checks if specified variable is set.
- If empty, returns "".
- Otherwise, if variable is a scalar, returns attr
when *any* value is assigned or matched to specified one.
- Otherwise, (variable *is* an array) and key isn't specified,
returns attr when the value is in array.
- Otherwise, (the key *is* specified),
checks if *any* value is assigned or matched to specified one.
|
Parameter |
|
|
$name |
|
|
No additional comments. |
|
|
|
$attr |
|
|
No additional comments. |
|
|
string |
$value |
|
|
No additional comments. |
|
|
string |
$key |
|
|
No additional comments. |
|
Returns |
void |
|
selected |
private string selected( $name, string $value, string $key )
|
|
Check if option selected.
|
Parameter |
|
|
$name |
|
|
No additional comments. |
|
|
string |
$value |
|
|
No additional comments. |
|
|
string |
$key |
|
|
No additional comments. |
|
Returns |
string - "selected" if there is variable matched. |
See Also |
input_check() |
|
checked |
private string checked( $name, string $value, string $key )
|
|
Check if box checked.
|
Parameter |
|
|
$name |
|
|
No additional comments. |
|
|
string |
$value |
|
|
No additional comments. |
|
|
string |
$key |
|
|
No additional comments. |
|
Returns |
string - "checked" if there is variable matched. |
See Also |
input_check() |
|
set_if_empty |
private bool set_if_empty( &$array, $key, $arg )
|
|
Sets the value to array item or object field if they are not set yet.
|
Parameter |
|
|
&$array |
|
|
No additional comments. |
|
|
|
$key |
|
|
No additional comments. |
|
|
|
$arg |
|
|
No additional comments. |
|
Returns |
bool - TRUE if value is really set. |
|
defValue |
private mixed defValue( &$value, $def )
|
|
Returns value or default.
|
Parameter |
|
|
&$value |
|
|
No additional comments. |
|
|
|
$def |
|
|
No additional comments. |
|
Returns |
mixed value or default |
|
concat_nonempty |
private void concat_nonempty( $arg, string $infix )
|
|
Concatenates *non-empty* args with infix.
concat_nonempty(array("a"=>1,"e"=>"","x"=>"eks","z"=>0))
yields "1,eks"
|
Parameter |
|
|
$arg |
|
|
No additional comments. |
|
|
string |
$infix |
|
|
No additional comments. |
|
Returns |
void |
|
concat_nonempty_sql |
private void concat_nonempty_sql( $arg, string $infix )
|
|
Concatenates *non-empty* args with infix
for use in SQL-statements.
concat_nonempty_sql(array("a"=>1,"e"=>"","x"=>array("eks","cross"),"z"=>0))
yields "a='1',e=null,x='eks,cross',z='0'"
|
Parameter |
|
|
$arg |
|
|
No additional comments. |
|
|
string |
$infix |
|
|
No additional comments. |
|
Returns |
void |
|
substitute |
private string substitute( array $subs, string $str, string $str2 )
|
|
substitutes subs/str or key=>value pairs in string
and returns result:
substitute (array("a"=>1,"b"=>2), "x:a; y:b") yields "x:1; y:2"
substitute ("1", "a", "x:a") yields "x:1"
note that this function doesn't use pcre
but is slower than preg_replace.
|
Parameter |
|
array |
$subs |
|
|
- key=>value pairs or just string to substitute. |
|
|
string |
$str |
|
|
- source string or substring to be substituted. |
|
|
string |
$str2 |
|
|
No additional comments. |
|
Returns |
string |
|
phpx_urlencode |
private void phpx_urlencode( $arg, integer $replacements )
|
|
Adds/replaces key=>value pairs to/in http-query strings.
-
phpx_urlencode("name=John Smyth&age=32")
yields "name=John+Smyth&age=32"
-
phpx_urlencode(array("name"=>"John Smyth","age"=>32),array("age"=>33))
yields "name=John+Smyth&age=33"
Use
echo "?", phpx_urlencode($HTTP_GET_VARS, array("age"=>33))
to correctly set 'get' parameter(s).
|
Parameter |
|
|
$arg |
|
|
No additional comments. |
|
|
integer |
$replacements |
|
|
No additional comments. |
|
Returns |
void |
See Also |
query_string() |
|
query_string |
private string query_string( array $args, [ integer $qstr ] )
|
|
Adds/replaces key=>value pairs in $QUERY_STRING
and returns result:
query_string (array("a"=>1,"b"=>2)) yields "a=1&b=2"
query_string (array("a"=>1,"b"=>2), "a=x") yields "a=1&b=2"
|
Parameter |
|
|
|
integer |
$qstr |
= >>0<< |
|
- it's used instead of default $QUERY_STRING global. |
|
Returns |
string |
See Also |
phpx_urlencode() |
|
collect_fields |
private string collect_fields( array $field_descr, [ string $arg, string $arg2 ] )
|
|
collects form field values from
global space (e.g. collect_fields(array("name"=>"term(name)"),"infix") ) or
specified array/object (e.g. collect_fields(array("name"=>"term(name)"),$record,"infix") )
and returns result:
collect_fields(array("a"=>"a='\$a'","b"=>"abs('\$b')),[$rec,]"&&") yields "a=1&&abs(2)"
|
Parameter |
|
array |
$field_descr |
|
|
- field descriptions, e.g. array("a"=>"a='\$a'", "b"=>"abs('\$b')) .
Note that they are eval'ed. |
|
|
string |
$arg |
= >>" "<< |
|
- fields are collected from it if it's specified. |
|
|
string |
$arg2 |
= >>" "<< |
|
- infix. |
|
Returns |
string |
|
collect_fields_sql |
private string collect_fields_sql( array $fields, array $array )
|
|
Collects fields to use in SQL-statement 'set' clause
from the global space or from the array if specified.
|
Parameter |
|
array |
$fields |
|
|
- field descriptions as
array(name[=>operator],...) .
Note, operator is eval'ed, e.g.
"abs(\$value)" leads the SQL apply
'abs' function to the value passed. |
|
|
array |
$array |
|
|
No additional comments. |
|
Returns |
string - e.g. "a='1',b=abs('-2'),c='1'+'-2'" |
|
extract_fields_sql |
private void extract_fields_sql( &$record )
|
|
Extracts values from the array into global namespace.
Nested arrays are converted into CSV-strings.
|
Parameter |
|
|
&$record |
|
|
No additional comments. |
|
Returns |
void |
|
UniqIdent |
private string UniqIdent( )
|
|
returns 18-xdigit fair unique string
|
Returns |
string |
|
WWW_Authenticate |
private void WWW_Authenticate( string $realm )
|
|
Forces basic authentication procedure.
|
Parameter |
|
string |
$realm |
|
|
- the realm as RFCxxx requires. |
|
Returns |
void |
|