CRM_Utils_Rule
class CRM_Utils_Rule
Class CRM_Utils_Rule
Methods
No description
No description
No description
Validate that a string is a valid MySQL column name or alias.
Validate that a string is ASC or DESC.
Validate that a string is valid order by clause.
No description
No description
No description
No description
No description
No description
No description
No description
No description
Check the validity of the date (in qf format) note that only a year is valid, or a mon-year is also valid in addition to day-mon-year. The date specified has to be beyond today. (i.e today or later)
Check the validity of a date or datetime (timestamp) value which is in YYYYMMDD or YYYYMMDDHHMMSS format
No description
No description
No description
No description
Test whether $value is alphanumeric.
No description
Strict validation of 6-digit hex color notation per html5
Strip thousand separator from a money string.
No description
No description
No description
No description
No description
allow between 4-6 digits as postal code since india needs 6 and US needs 5 (or if u disregard the first 0, 4 (thanx excel!) FIXME: we need to figure out how to localize such rules
See how file rules are written in HTML/QuickForm/file.php Checks to make sure the uploaded file is ascii
Checks to make sure the uploaded file is in UTF-8, recodes if it's not
See how file rules are written in HTML/QuickForm/file.php Checks to make sure the uploaded file is html
Check if there is a record with the same name in the db.
No description
No description
No description
No description
No description
Validate json string for xss
No description
Determine whether the value contains a valid reference to a directory.
No description
Check the validity of the date (in qf format) note that only a year is valid, or a mon-year is also valid in addition to day-mon-year
No description
Check if the values in the date range are in correct chronological order.
No description
Validate array recursively checking keys and values.
Details
at line 47
static bool
title($str, int $maxLength = 127)
at line 67
static bool
longTitle($str)
at line 76
static bool
variable($str)
at line 97
static bool
mysqlColumnNameOrAlias($str)
Validate that a string is a valid MySQL column name or alias.
at line 126
static bool
mysqlOrderByDirection($str)
Validate that a string is ASC or DESC.
Empty string should be treated as invalid and ignored => default = ASC.
at line 140
static bool
mysqlOrderBy($str)
Validate that a string is valid order by clause.
at line 173
static bool
qfVariable($str)
at line 194
static bool
phone($phone)
at line 212
static bool
query($query)
at line 231
static bool
url($url)
at line 248
static bool
urlish($url)
at line 261
static bool
wikiURL($string)
at line 271
static bool
domain($domain)
at line 285
static null
date($value, null $default = NULL)
at line 300
static null|string
dateTime($value, null $default = NULL)
at line 324
static bool
currentDate(array $date, bool $monthRequired = TRUE)
Check the validity of the date (in qf format) note that only a year is valid, or a mon-year is also valid in addition to day-mon-year. The date specified has to be beyond today. (i.e today or later)
at line 415
static bool
mysqlDate(string $date)
Check the validity of a date or datetime (timestamp) value which is in YYYYMMDD or YYYYMMDDHHMMSS format
Uses PHP checkdate() - params are ( int $month, int $day, int $year )
at line 433
static bool
integer($value)
at line 466
static bool
positiveInteger($value)
at line 489
static bool
commaSeparatedIntegers($value)
at line 505
static bool
numeric($value)
at line 531
static bool
alphanumeric($value)
Test whether $value is alphanumeric.
Underscores and dashes are also allowed!
This is the type of string you could expect to see in URL parameters
like ?mode=live
vs ?mode=test
. This function exists so that we can be
strict about what we accept for such values, thus mitigating against
potential security issues.
at line 541
static bool
numberOfDigit($value, $noOfDigit)
at line 551
static bool
color($value)
Strict validation of 6-digit hex color notation per html5
at line 566
static string
cleanMoney(string $value)
Strip thousand separator from a money string.
Note that this should be done at the form layer. Once we are processing money at the BAO or processor layer we should be working with something that is already in a normalised format.
at line 614
static bool
money($value)
at line 646
static bool
string($value, int $maxLength = 0)
at line 660
static bool
boolean($value)
at line 671
static bool
email($value)
at line 680
static bool
emailList($list)
at line 699
static bool
postalCode($value)
allow between 4-6 digits as postal code since india needs 6 and US needs 5 (or if u disregard the first 0, 4 (thanx excel!) FIXME: we need to figure out how to localize such rules
at line 715
static bool
asciiFile(string $elementValue)
See how file rules are written in HTML/QuickForm/file.php Checks to make sure the uploaded file is ascii
at line 732
static bool
utf8File(array $elementValue)
Checks to make sure the uploaded file is in UTF-8, recodes if it's not
at line 762
static bool
htmlFile(array $elementValue)
See how file rules are written in HTML/QuickForm/file.php Checks to make sure the uploaded file is html
at line 782
static bool
objectExists(string $value, array $options)
Check if there is a record with the same name in the db.
at line 797
static bool
optionExists($value, $options)
at line 807
static bool
creditCardNumber($value, $type)
at line 817
static bool
cvv($value, $type)
at line 826
static bool
currencyCode($value)
at line 842
static bool
xssString($value)
at line 861
static bool
json(string $value)
Validate json string for xss
at line 877
static bool
fileExists($path)
at line 890
static bool
settingPath(string $path)
Determine whether the value contains a valid reference to a directory.
Paths stored in the setting system may be absolute -- or may be relative to the default data directory.
at line 900
static bool
validContact($value, null $actualElementValue = NULL)
at line 918
static bool
qfDate(array $date)
Check the validity of the date (in qf format) note that only a year is valid, or a mon-year is also valid in addition to day-mon-year
at line 965
static bool
qfKey($key)
at line 981
static
validDateRange(array $fields, $fieldName, $errors, $title)
Check if the values in the date range are in correct chronological order.
at line 994
static bool
checkExtensionKeyIsValid(string $key = NULL)
at line 1007
static protected bool
arrayValue(array $array)
Validate array recursively checking keys and values.