class CRM_Utils_Rule

Class CRM_Utils_Rule

Methods

static bool
title($str, int $maxLength = 127)

No description

static bool
longTitle($str)

No description

static bool
variable($str)

No description

static bool
mysqlColumnNameOrAlias($str)

Validate that a string is a valid MySQL column name or alias.

static bool
mysqlOrderByDirection($str)

Validate that a string is ASC or DESC.

static bool
mysqlOrderBy($str)

Validate that a string is valid order by clause.

static bool
qfVariable($str)

No description

static bool
phone($phone)

No description

static bool
query($query)

No description

static bool
url($url)

No description

static bool
urlish($url)

No description

static bool
wikiURL($string)

No description

static bool
domain($domain)

No description

static null
date($value, null $default = NULL)

No description

static null|string
dateTime($value, null $default = NULL)

No description

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)

static bool
mysqlDate(string $date)

Check the validity of a date or datetime (timestamp) value which is in YYYYMMDD or YYYYMMDDHHMMSS format

static bool
integer($value)

No description

static bool
positiveInteger($value)

No description

static bool
numeric($value)

No description

static bool
numberOfDigit($value, $noOfDigit)

No description

static mixed
cleanMoney($value)

No description

static bool
money($value)

No description

static bool
string($value, int $maxLength)

No description

static bool
boolean($value)

No description

static bool
email($value)

No description

static bool
emailList($list)

No description

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

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

static bool
utf8File(array $elementValue)

Checks to make sure the uploaded file is in UTF-8, recodes if it's not

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

static bool
objectExists(string $value, array $options)

Check if there is a record with the same name in the db.

static bool
optionExists($value, $options)

No description

static bool
creditCardNumber($value, $type)

No description

static bool
cvv($value, $type)

No description

static bool
currencyCode($value)

No description

static bool
xssString($value)

No description

static bool
fileExists($path)

No description

static bool
settingPath(string $path)

Determine whether the value contains a valid reference to a directory.

static bool
validContact($value, null $actualElementValue = NULL)

No description

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

static bool
qfKey($key)

No description

static 
validDateRange(array $fields, $fieldName, $errors, $title)

Check if the values in the date range are in correct chronological order.

Details

at line 47
static bool title($str, int $maxLength = 127)

Parameters

$str
int $maxLength

Return Value

bool

at line 67
static bool longTitle($str)

Parameters

$str

Return Value

bool

at line 76
static bool variable($str)

Parameters

$str

Return Value

bool

at line 97
static bool mysqlColumnNameOrAlias($str)

Validate that a string is a valid MySQL column name or alias.

Parameters

$str

Return Value

bool

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.

Parameters

$str

Return Value

bool

at line 140
static bool mysqlOrderBy($str)

Validate that a string is valid order by clause.

Parameters

$str

Return Value

bool

at line 173
static bool qfVariable($str)

Parameters

$str

Return Value

bool

at line 194
static bool phone($phone)

Parameters

$phone

Return Value

bool

at line 212
static bool query($query)

Parameters

$query

Return Value

bool

at line 231
static bool url($url)

Parameters

$url

Return Value

bool

at line 244
static bool urlish($url)

Parameters

$url

Return Value

bool

at line 257
static bool wikiURL($string)

Parameters

$string

Return Value

bool

at line 267
static bool domain($domain)

Parameters

$domain

Return Value

bool

at line 281
static null date($value, null $default = NULL)

Parameters

$value
null $default

Return Value

null

at line 296
static null|string dateTime($value, null $default = NULL)

Parameters

$value
null $default

Return Value

null|string

at line 320
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)

Parameters

array $date
bool $monthRequired Check whether month is mandatory.

Return Value

bool true if valid date

at line 411
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 )

Parameters

string $date

Return Value

bool true if valid date

at line 429
static bool integer($value)

Parameters

$value

Return Value

bool

at line 462
static bool positiveInteger($value)

Parameters

$value

Return Value

bool

at line 485
static bool numeric($value)

Parameters

$value

Return Value

bool

at line 500
static bool numberOfDigit($value, $noOfDigit)

Parameters

$value
$noOfDigit

Return Value

bool

at line 509
static mixed cleanMoney($value)

Parameters

$value

Return Value

mixed

at line 557
static bool money($value)

Parameters

$value

Return Value

bool

at line 586
static bool string($value, int $maxLength)

Parameters

$value
int $maxLength

Return Value

bool

at line 600
static bool boolean($value)

Parameters

$value

Return Value

bool

at line 611
static bool email($value)

Parameters

$value

Return Value

bool

at line 620
static bool emailList($list)

Parameters

$list

Return Value

bool

at line 639
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

Parameters

$value

Return Value

bool

at line 655
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

Parameters

string $elementValue

Return Value

bool True if file has been uploaded, false otherwise

at line 672
static bool utf8File(array $elementValue)

Checks to make sure the uploaded file is in UTF-8, recodes if it's not

Parameters

array $elementValue

Return Value

bool Whether file has been uploaded properly and is now in UTF-8.

at line 702
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

Parameters

array $elementValue

Return Value

bool True if file has been uploaded, false otherwise

at line 722
static bool objectExists(string $value, array $options)

Check if there is a record with the same name in the db.

Parameters

string $value The value of the field we are checking.
array $options The daoName, fieldName (optional) and DomainID (optional).

Return Value

bool true if object exists

at line 737
static bool optionExists($value, $options)

Parameters

$value
$options

Return Value

bool

at line 747
static bool creditCardNumber($value, $type)

Parameters

$value
$type

Return Value

bool

at line 757
static bool cvv($value, $type)

Parameters

$value
$type

Return Value

bool

at line 766
static bool currencyCode($value)

Parameters

$value

Return Value

bool

at line 782
static bool xssString($value)

Parameters

$value

Return Value

bool

at line 798
static bool fileExists($path)

Parameters

$path

Return Value

bool

at line 811
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.

Parameters

string $path

Return Value

bool

at line 821
static bool validContact($value, null $actualElementValue = NULL)

Parameters

$value
null $actualElementValue

Return Value

bool

at line 839
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

Parameters

array $date

Return Value

bool true if valid date

at line 886
static bool qfKey($key)

Parameters

$key

Return Value

bool

at line 902
static validDateRange(array $fields, $fieldName, $errors, $title)

Check if the values in the date range are in correct chronological order.

Parameters

array $fields Fields of the form.
$fieldName Name of date range field.
$errors The error array.
$title Title of the date range to be displayed in the error message.