utf8 alpha and alphanum
This commit is contained in:
parent
58959c6d00
commit
017fc2f1fc
@ -113,7 +113,7 @@ class Input extends Element{
|
||||
if(!empty($data)){
|
||||
if(isset($this->data['phone']) && $this->data['phone'] == true && !preg_match("#^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$#", $data))
|
||||
return 'incorrect';
|
||||
|
||||
|
||||
if(isset($this->data['number']) && $this->data['number'] == true && !ctype_digit($data))
|
||||
return 'non numérique';
|
||||
|
||||
@ -129,28 +129,28 @@ class Input extends Element{
|
||||
}
|
||||
if(isset($this->data['min']) && $data < $this->data['min'])
|
||||
return 'trop petit';
|
||||
|
||||
|
||||
if(isset($this->data['max']) && $data > $this->data['max'])
|
||||
return 'trop grand';
|
||||
|
||||
|
||||
if(isset($this->data['email']) && $this->data['email'] == true && !filter_var($data, FILTER_VALIDATE_EMAIL))
|
||||
return 'incorrect';
|
||||
|
||||
|
||||
if(isset($this->data['minlength']) && strlen($data) < $this->data['minlength'])
|
||||
return 'trop court';
|
||||
|
||||
|
||||
if(isset($this->data['maxlength']) && strlen($data) > $this->data['maxlength'])
|
||||
return 'trop long';
|
||||
|
||||
if(isset($this->data['alpha']) && !preg_match('#^[\p{L}'.$this->data['alpha'].']*$#', $data))
|
||||
|
||||
if(isset($this->data['alpha']) && !preg_match('#^[\p{L}\p{M}'.$this->data['alpha'].']*$#', $data))
|
||||
return 'non alphabétique';
|
||||
|
||||
if(isset($this->data['alphanum']) && !preg_match('#^[\p{L}\p{N}'.$this->data['alphanum'].']*$#', $data))
|
||||
|
||||
if(isset($this->data['alphanum']) && !preg_match('#^[\p{L}\p{M}\p{N}'.$this->data['alphanum'].']*$#', $data))
|
||||
return 'non alphanumérique';
|
||||
|
||||
|
||||
if(isset($this->data['regex']) && !preg_match('#'.$this->data['regex'].'#', $data))
|
||||
return 'incorrect';
|
||||
|
||||
|
||||
}
|
||||
return $parent;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user