* @return int
*/
public static function unixTime($string) {
- if (empty($string)) {
+ if (!$string) {
return 0;
}
$parsedDate = date_parse($string);
- return mktime(CRM_Utils_Array::value('hour', $parsedDate),
- CRM_Utils_Array::value('minute', $parsedDate),
+ return mktime($parsedDate['hour'],
+ $parsedDate['minute'],
59,
- CRM_Utils_Array::value('month', $parsedDate),
- CRM_Utils_Array::value('day', $parsedDate),
- CRM_Utils_Array::value('year', $parsedDate)
+ $parsedDate['month'],
+ $parsedDate['day'],
+ $parsedDate['year']
);
}
return self::url(
$p,
- CRM_Utils_Array::value('q', $params),
- CRM_Utils_Array::value('a', $params, FALSE),
- CRM_Utils_Array::value('f', $params),
- CRM_Utils_Array::value('h', $params, TRUE),
- CRM_Utils_Array::value('fe', $params, FALSE),
- CRM_Utils_Array::value('fb', $params, FALSE)
+ $params['q'] ?? NULL,
+ $params['a'] ?? FALSE,
+ $params['f'] ?? NULL,
+ $params['h'] ?? TRUE,
+ $params['fe'] ?? FALSE,
+ $params['fb'] ?? FALSE
);
}
public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
- $name = CRM_Utils_Array::value('name', $params);
- $email = CRM_Utils_Array::value('mail', $params);
+ $name = $params['name'] ?? NULL;
+ $email = $params['mail'] ?? NULL;
//don't allow the special characters and min. username length is two
//regex \\ to match a single backslash would become '/\\\\/'
$isNotValid = (bool) preg_match('/[\<|\>|\"|\'|\%|\;|\(|\)|\&|\\\\|\/]/im', $name);
$sessionVar = $params['sessionVar'] ?? NULL;
$type = $params['type'] ?? NULL;
$default = $params['default'] ?? NULL;
- $abort = CRM_Utils_Array::value('abort', $params, FALSE);
+ $abort = $params['abort'] ?? FALSE;
$value = NULL;
$value = CRM_Utils_Request::retrieve(