Request Request(
&$Messages
)
|
|
Constructor.
Parameters:
void compile_cat_array(
[
$restrict_to_blog = 0], [
$cat_default = NULL], [
$catsel_default = array()]
)
|
|
Compiles the cat array from $cat (recursive + optional modifiers) and $catsel[] (non recursive)
and keeps those values available for future reference
Parameters:
|
|
$restrict_to_blog: |
|
|
|
$cat_default: |
|
|
|
$catsel_default: |
|
Get the value of a param.
Parameters:
API Tags:
| Return: | The value of the param, if set. NULL otherwise. |
void memorize_param(
$var,
$type,
$default, [
$value = NULL]
)
|
|
Memorize a parameter for automatic future use in regenerate_url()
Parameters:
|
|
$var: |
|
|
|
$type: |
|
|
|
$default: |
|
|
|
$value: |
|
mixed param(
string
$var, [string
$type = ''], [mixed
$default = ''], [boolean
$memorize = false], [boolean
$override = false], [boolean
$use_default = true], [mixed
$strict_typing = 'allow_empty']
)
|
|
Sets a parameter with values from the request or to provided default, except if param is already set!
Also removes magic quotes if they are set automatically by PHP. Also forces type. Priority order: POST, GET, COOKIE, DEFAULT.
Parameters:
|
string |
$var: |
Variable to set |
|
string |
$type: |
Force value type to one of: - integer
- float, double
- string (strips (HTML-)Tags, trims whitespace)
- array (TODO: array/integer , array/array/string )
- html (does nothing)
- '' (does nothing)
- '/^...$/' check regexp pattern match (string)
- boolean (will force type to boolean, but you can't use 'true' as a default since it has special meaning. There is no real reason to pass booleans on a URL though. Passing 0 and 1 as integers seems to be best practice).
Value type will be forced only if resulting value (probably from default then) is !== NULL |
|
mixed |
$default: |
Default value or TRUE if user input required |
|
boolean |
$memorize: |
Do we need to memorize this to regenerate the URL for this page? |
|
boolean |
$override: |
Override if variable already set |
|
boolean |
$use_default: |
Force setting of variable to default if no param is sent and var wasn't set before |
|
mixed |
$strict_typing: |
true will refuse illegal values, false will try to convert illegal to legal values, 'allow_empty' will refuse illegale values but will always accept empty values (This helps blocking dirty spambots or borked index bots. Saves a lot of processor time by killing invalid requests) |
API Tags:
| Return: | Final value of Variable, or false if we don't force setting and did not set |
void params(
array
$vars, [
$type = ''], [
$default = ''], [
$memorize = false], [
$override = false], [
$forceset = true]
)
|
|
Sets several similar parameters at once.
Parameters:
|
array |
$vars: |
|
|
|
$type: |
|
|
|
$default: |
|
|
|
$memorize: |
|
|
|
$override: |
|
|
|
$forceset: |
|
boolean params_check_at_least_one(
array
$vars, string
$err_msg, [string|NULL
$field_err_msg = NULL]
)
|
|
Parameters:
|
array |
$vars: |
of param names |
|
string |
$err_msg: |
error message |
|
string|NULL |
$field_err_msg: |
error message for form field ($err_msg gets used if === NULL). |
API Tags:
string param_action(
[mixed
$default = ''], [
$memorize = false]
)
|
|
Get the action from params.
If we got no "action" param, we'll check for an "actionArray" param ( <input type="submit" name="actionArray[real_action]" ...> ). And the real $action will be found in the first key... When there are multiple submit buttons, this is smarter than checking the value which is a translated string. When there is an image button, this allows to work around IE not sending the value (it only sends X & Y coords of the click).
Parameters:
|
mixed |
$default: |
Default to use. |
|
|
$memorize: |
|
string param_arrayindex(
string
$param_name, [mixed
$default = '']
)
|
|
Get the param from an array param's first index.
E.g., for "param[value]" as a submit button you can get the value with
.
Parameters:
|
string |
$param_name: |
Param name |
|
mixed |
$default: |
Default to use |
API Tags:
boolean|string param_check_date(
string
$var, string
$err_msg, [boolean
$required = false], [string
$date_format = NULL]
)
|
|
Check if param is an ISO date
Parameters:
|
string |
$var: |
param name |
|
string |
$err_msg: |
error message |
|
boolean |
$required: |
Is a non-empty date required? |
|
string |
$date_format: |
date format (php format) |
API Tags:
| Return: | false if not OK, ISO date if OK |
boolean|array param_check_date_format(
string
$var, string
$err_msg, [array|boolean
$func_params = array()]
)
|
|
Check if param is a valid date (format wise).
Parameters:
|
string |
$var: |
param name |
|
string |
$err_msg: |
error message |
|
array|boolean |
$func_params: |
Additional params: - 'required': Is non-empty date required? Default: true.
- 'date_pattern': Pattern for the date, using named capturing groups ('day', 'month', 'year').
Default: '#^(\d\d\d\d)-?(\d\d)-?(\d\d)$#' (accepts both ISO and "compact")
You can also use "Named Capturing Groups" and write it like this:
'#^(?P<year>\d\d\d\d)-(?P<month>\d\d)-(?P<day>\d\d)$#' (ISO).
This allows to use for example '#^(?P<day>\d\d)-(?P<month>\d\d)-(?P<year>\d\d\d\d)$#'
NOTE: "Named Capturing Groups" require PHP 4.3.3! If no named groups are given we'll use
(1 == year, 2 == month, 3 == day).
- 'field_err_msg': Error for the form field
|
API Tags:
| Return: | true if empty, but OK. False if not valid. Matching array if ok. |
| Deprecated: | won't handle locale date formats on PHP < 4.3.3 |
boolean param_check_email(
string
$var, [
$required = false]
)
|
|
Parameters:
|
string |
$var: |
param name |
|
|
$required: |
|
API Tags:
boolean param_check_not_empty(
string
$var, string
$err_msg, [string|NULL
$field_err_msg = NULL]
)
|
|
Parameters:
|
string |
$var: |
param name |
|
string |
$err_msg: |
error message |
|
string|NULL |
$field_err_msg: |
error message for form field ($err_msg gets used if === NULL). |
API Tags:
boolean param_check_number(
string
$var, string
$err_msg, [
$required = false]
)
|
|
Checks if the param is a decimal number (no float, e.g. 3.14).
Parameters:
|
string |
$var: |
param name |
|
string |
$err_msg: |
error message |
|
|
$required: |
|
API Tags:
boolean param_check_passwords(
string
$var1, string
$var2, [boolean
$required = false]
)
|
|
Parameters:
|
string |
$var1: |
param name |
|
string |
$var2: |
param name |
|
boolean |
$required: |
Is a password required? (non-empty) |
API Tags:
boolean param_check_phone(
string
$var, [
$required = false]
)
|
|
Parameters:
|
string |
$var: |
param name |
|
|
$required: |
|
API Tags:
boolean param_check_range(
string
$var, integer
$min, integer
$max, string
$err_msg, [
$required = true]
)
|
|
Checks if the param is a decimal number (no float, e.g. 3.14) in a given range.
Parameters:
|
string |
$var: |
param name |
|
integer |
$min: |
min value |
|
integer |
$max: |
max value |
|
string |
$err_msg: |
error message |
|
|
$required: |
|
API Tags:
boolean param_check_regexp(
string
$var, string
$err_msg, [string|NULL
$field_err_msg = NULL]
)
|
|
Check if the value of a param is a regular expression (syntax).
Parameters:
|
string |
$var: |
param name |
|
string |
$err_msg: |
error message |
|
string|NULL |
$field_err_msg: |
error message for form field ($err_msg gets used if === NULL). |
API Tags:
boolean param_check_url(
string
$var, string
&$uri_scheme
)
|
|
Parameters:
|
string |
$var: |
param name |
|
string |
&$uri_scheme: |
error message |
API Tags:
void param_child_select_value(
string
$var
)
|
|
set a parameter with the second part(X2) of the value from request ( X1-X2 )
Parameters:
|
string |
$var: |
Variable to set |
string param_combo(
string
$var, mixed
$default, boolean
$allow_none, [string
$err_msg = '']
)
|
|
Sets a combo parameter with values from the request, => the value of the select option and the input text value if new is selected Display an error if the new value is selected that the input text has a value
Parameters:
|
string |
$var: |
Variable to set |
|
mixed |
$default: |
Default value or TRUE if user input required |
|
boolean |
$allow_none: |
true: allows to select new without entring a value in the input combo text |
|
string |
$err_msg: |
error message |
API Tags:
| Return: | position status ID or 'new' or '' if new is seleted but not input text value |
string param_compact_date(
string
$var, [mixed
$default = ''], [boolean
$memorize = false], string
$err_msg, [boolean
$required = false]
)
|
|
Sets a date parameter with values from the request or to provided default, And check if param is a valid date (format wise).
Parameters:
|
string |
$var: |
Variable to set |
|
mixed |
$default: |
Default value or TRUE if user input required |
|
boolean |
$memorize: |
memorize ( see param() ) |
|
string |
$err_msg: |
error message |
|
boolean |
$required: |
'required': Is non-empty date required? Default: true. |
API Tags:
| Return: | the compact date value ( yyyymmdd ) |
void param_date(
$var,
$err_msg,
$required
)
|
|
Sets a date parameter by converting locale date (if valid) to ISO date.
If the date is not valid, it is set to the param unchanged (unconverted).
Parameters:
|
|
$var: |
|
|
|
$err_msg: |
|
|
|
$required: |
|
void param_error(
string
$var, string|NULL
$err_msg, [string|NULL
$field_err_msg = NULL]
)
|
|
Add an error for a variable, either to the Form's field and/or the global $Messages object.
Parameters:
|
string |
$var: |
param name |
|
string|NULL |
$err_msg: |
error message (by using NULL you can only add an error to the field, but not the $Message object) |
|
string|NULL |
$field_err_msg: |
error message for form field ($err_msg gets used if === NULL). |
void param_error_multiple(
array
$vars, string|NULL
$err_msg, [string|NULL
$field_err_msg = NULL]
)
|
|
Add an error for multiple variables, either to the Form's field and/or the global $Messages object.
Parameters:
|
array |
$vars: |
of param names |
|
string|NULL |
$err_msg: |
error message (by using NULL you can only add an error to the field, but not the $Message object) |
|
string|NULL |
$field_err_msg: |
error message for form fields ($err_msg gets used if === NULL). |
void param_extend(
string
$var, string
$var_ext_array, [boolean
$save_prefix = true]
)
|
|
Extend a parameter with an array of params.
Will be used for author/authorsel[], etc. Note: cannot be used for catsel[], because catsel is NON-recursive
Parameters:
|
string |
$var: |
Variable to extend |
|
string |
$var_ext_array: |
Name of array Variable to use as an extension |
|
boolean |
$save_prefix: |
Save non numeric prefix? |
boolean param_integer_range(
string
$var, integer
$min, integer
$max, string
$err_msg, [
$required = true]
)
|
|
Gets a param and makes sure it's a decimal number (no float, e.g. 3.14) in a given range.
Parameters:
|
string |
$var: |
param name |
|
integer |
$min: |
min value |
|
integer |
$max: |
max value |
|
string |
$err_msg: |
error message |
|
|
$required: |
|
API Tags:
boolean param_isFilename(
string
$var, string
$err_msg
)
|
|
Check if the value is a file name
Parameters:
|
string |
$var: |
param name |
|
string |
$err_msg: |
error message |
API Tags:
boolean param_string_not_empty(
string
$var, string
$err_msg, [string|NULL
$field_err_msg = NULL]
)
|
|
Parameters:
|
string |
$var: |
param name |
|
string |
$err_msg: |
error message |
|
string|NULL |
$field_err_msg: |
error message for form field ($err_msg gets used if === NULL). |
API Tags:
mixed param_time(
string
$var, [mixed
$default = ''], [boolean
$memorize = false], [boolean
$override = false], [boolean
$forceset = true]
)
|
|
Sets a time parameter with the value from the request of the var argument or of the concat of the var argument_h: var argument_mn: var argument_s , except if param is already set!
Parameters:
|
string |
$var: |
Variable to set |
|
mixed |
$default: |
Default value or TRUE if user input required |
|
boolean |
$memorize: |
Do we need to memorize this to regenerate the URL for this page? |
|
boolean |
$override: |
Override if variable already set |
|
boolean |
$forceset: |
Force setting of variable to default? |
API Tags:
| Return: | Final value of Variable, or false if we don't force setting and did not set |
void set_param(
$var,
$value
)
|
|
Set the value of a param (by force! :P)
Parameters:
integer validation_errors(
)
|
|
Check if there have been validation errors
We play it safe here and check for all kind of errors, not just those from this particlar class.
void _add_message_to_Log(
string
$var, string
$err_msg, [
$log_category = 'error']
)
|
|
This function is used by param_error() and param_error_multiple().
If $link_log_messages_to_field_IDs is true, it will link those parts of the error message that are not already links, to the html IDs of the fields with errors.
Parameters:
|
string |
$var: |
param name |
|
string |
$err_msg: |
error message |
|
|
$log_category: |
|
API Tags: