Methods summary
public static
callable
|
#
none( )
No validation - all inputs are valid.
No validation - all inputs are valid.
Returns
callable Validation function
|
public static
string|true
|
#
basic( string $cfg = null , array $opts,…, array $host,… )
Basic validation - this is used to perform the validation provided by the
validation options only. If the validation options pass (e.g. required ,
empty and optional ) then the validation will pass regardless of the
actual value.
Basic validation - this is used to perform the validation provided by the
validation options only. If the validation options pass (e.g. required ,
empty and optional ) then the validation will pass regardless of the
actual value.
Note that there are two helper short-cut methods that provide the same
function as this method, but are slightly shorter:
// Required:
Validate::required()
// is the same as
Validate::basic( $val, $data, array( "required" => true
);
// Optional, but not empty if given:
Validate::notEmpty()
// is the same as
Validate::basic( $val, $data, array( "empty" => false
);
Parameters
- $cfg
- $val The value to check for validity
- $opts,…
Validation options. No additional options are
available or required for this validation method.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
required( string $cfg = null , array $opts,…, array $host,… )
Required field - there must be a value and it must be a non-empty value
Required field - there must be a value and it must be a non-empty value
This is a helper short-cut method which is the same as:
Validate::basic( $val, $data, array( "required" => true
);
Parameters
- $cfg
- $val The value to check for validity
- $opts,…
Validation options. No additional options are
available or required for this validation method.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
callable
|
#
notEmpty( DataTables\Editor\ValidateOptions $cfg = null )
Optional field, but if given there must be a non-empty value
Optional field, but if given there must be a non-empty value
This is a helper short-cut method which is the same as:
Validate::basic( $val, $data, array( "empty" => false
);
Parameters
Returns
callable Validation function
|
public static
string|true
|
#
boolean( string $cfg = null , array $opts,…, array $host,… )
Validate an input as a boolean value.
Validate an input as a boolean value.
Parameters
- $cfg
- $val The value to check for validity
- $opts,…
Validation options. No additional options are
available or required for this validation method.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
numeric( string $decimal = ".", string[] $cfg = null , array $opts,…, array $host,… )
Check that any input is numeric.
Check that any input is numeric.
Parameters
- $decimal
- $val The value to check for validity
- $cfg
- $data The full data set submitted
- $opts,…
Validation options. Additional options:
* decimal : is available to indicate what character should be used
as the decimal
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
minNum( string $min, string[] $decimal = ".", integer|array $cfg = null , array $host,… )
Check for a numeric input and that it is greater than a given value.
Check for a numeric input and that it is greater than a given value.
Parameters
- $min
- $val The value to check for validity
- $decimal
- $data The full data set submitted
- $cfg
$opts Validation options. Additional options:
* min : indicate the minimum value. If only the default validation
options are required, this parameter can be given as an integer
value, which will be used as the minimum value.
* decimal : is available to indicate what character should be used
as the decimal
separator (default '.').
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
maxNum( string $max, string[] $decimal = ".", integer|array $cfg = null , array $host,… )
Check for a numeric input and that it is less than a given value.
Check for a numeric input and that it is less than a given value.
Parameters
- $max
- $val The value to check for validity
- $decimal
- $data The full data set submitted
- $cfg
$opts Validation options.
* max : indicate the maximum value. If only the default validation
options are required, this parameter can be given as an integer
value, which will be used as the maximum value.
* decimal : is available to indicate what character should be used
as the decimal
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
minMaxNum( string $min, string[] $max, integer|array $decimal = '.', array $cfg = null )
Check for a numeric input and that it is both greater and smaller than
given numbers.
Check for a numeric input and that it is both greater and smaller than
given numbers.
Parameters
- $min
- $val The value to check for validity
- $max
- $data The full data set submitted
- $decimal
$opts Validation options. Additional options:
* min : indicate the minimum value.
* max : indicate the maximum value.
* decimal : is available to indicate what character should be used
as the decimal
- $cfg
- $host Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
email( string $cfg = null , array $opts,…, array $host,… )
Validate an input as an e-mail address.
Validate an input as an e-mail address.
Parameters
- $cfg
- $val The value to check for validity
- $opts,…
Validation options. No additional options are
available or required for this validation method.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
minLen( string $min, string[] $cfg = null , integer|array $opts,…, array $host,… )
Validate a string has a minimum length.
Validate a string has a minimum length.
Parameters
- $min
- $val The value to check for validity
- $cfg
- $data The full data set submitted
- $opts,…
Validation options. The additional option of
min is available for this method to indicate the minimum string
length. If only the default validation options are required, this
parameter can be given as an integer value, which will be used as the
minimum string length.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
maxLen( string $max, string[] $cfg = null , integer|array $opts,…, array $host,… )
Validate a string does not exceed a maximum length.
Validate a string does not exceed a maximum length.
Parameters
- $max
- $val The value to check for validity
- $cfg
- $data The full data set submitted
- $opts,…
Validation options. The additional option of
max is available for this method to indicate the maximum string
length. If only the default validation options are required, this
parameter can be given as an integer value, which will be used as the
maximum string length.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
minMaxLen( string $min, string[] $max, integer|array $cfg = null , array $host,… )
Require a string with a certain minimum or maximum number of characters.
Require a string with a certain minimum or maximum number of characters.
Parameters
- $min
- $val The value to check for validity
- $max
- $data The full data set submitted
- $cfg
$opts Validation options. The additional options of
min and max are available for this method to indicate the minimum
and maximum string lengths, respectively.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
ip( string $cfg = null , array $opts,…, array $host,… )
Validate as an IP address.
Validate as an IP address.
Parameters
- $cfg
- $val The value to check for validity
- $opts,…
Validation options. No additional options are
available or required for this validation method.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
url( string $cfg = null , array $opts,…, array $host,… )
Validate as an URL address.
Validate as an URL address.
Parameters
- $cfg
- $val The value to check for validity
- $opts,…
Validation options. No additional options are
available or required for this validation method.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
xss( string $cfg = null , integer|array $opts,…, array $host,… )
Check if string could contain an XSS attack string
Check if string could contain an XSS attack string
Parameters
- $cfg
- $val The value to check for validity
- $opts,…
Validation options. The additional options of
db - database connection object, table - database table to use and
column - the column to check this value against as value, are also
available. These options are not required and if not given are
automatically derived from the Editor and Field instances.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
values( string $values, string[] $cfg = null , integer|array $opts,…, array $host,… )
Confirm that the value submitted is in a list of allowable values
Confirm that the value submitted is in a list of allowable values
Parameters
- $values
- $val The value to check for validity
- $cfg
- $data The full data set submitted
- $opts,…
Validation options. The additional options of
db - database connection object, table - database table to use and
column - the column to check this value against as value, are also
available. These options are not required and if not given are
automatically derived from the Editor and Field instances.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
noTags( string $cfg = null , integer|array $opts,…, array $host,… )
Check if there are any tags in the submitted value
Check if there are any tags in the submitted value
Parameters
- $cfg
- $val The value to check for validity
- $opts,…
Validation options. The additional options of
db - database connection object, table - database table to use and
column - the column to check this value against as value, are also
available. These options are not required and if not given are
automatically derived from the Editor and Field instances.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
dateFormat( string $format, string[] $cfg = null , array|string $opts,…, array $host,… )
Check that a valid date input is given
Check that a valid date input is given
Parameters
- $format
- $val The value to check for validity
- $cfg
- $data The full data set submitted
- $opts,…
If given as a string, then $opts is the date
format to check the validity of. If given as an array, then the
date format is in the 'format' parameter, and the return error
message in the 'message' parameter.
- $host,…
- Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
unique( string $cfg = null, string[] $column = null, integer|array $table = null, array $db = null )
Check that the given value is unique in the database
Check that the given value is unique in the database
Parameters
- $cfg
- $val The value to check for validity
- $column
- $data The full data set submitted
- $table
$opts Validation options. The additional options of
db - database connection object, table - database table to use and
column - the column to check this value against as value, are also
available. These options are not required and if not given are
automatically derived from the Editor and Field instances.
- $db
- $host Host information
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
string|true
|
#
dbValues( string $cfg = null, string[] $column = null, integer|array $table = null, array $db = null, $values = array() )
Check that the given value is a value that is available in a database -
i.e. a join primary key. This will attempt to automatically use the table
name and value column from the field's options method (under the
assumption that it will typically be used with a joined field), but the
table and field can also be specified via the options.
Check that the given value is a value that is available in a database -
i.e. a join primary key. This will attempt to automatically use the table
name and value column from the field's options method (under the
assumption that it will typically be used with a joined field), but the
table and field can also be specified via the options.
Parameters
- $cfg
- $val The value to check for validity
- $column
- $data The full data set submitted
- $table
$opts Validation options. The additional options of
db - database connection object, table - database table to use and
column - the column to check this value against as value, are also
available. These options are not required and if not given are
automatically derived from the Editor and Field instances.
- $db
- $host Host information
- $values
Returns
string|true true if the value is valid, a string with an error
message otherwise.
|
public static
|
#
fileExtensions( $extensions, $msg = "This file type cannot be uploaded." )
|
public static
|
#
fileSize( $size, $msg = "Uploaded file is too large." )
|
public static
|
|
public static
|
|