return Env::blank($key, $strict);
}
+ public function hasAlnum($key)
+ {
+ $str = $this->s($key);
+ return preg_match('/[a-z0-9]/i', $str);
+ }
+
+ public function hasAlpha($key)
+ {
+ $str = $this->s($key);
+ return preg_match('/[a-z]/i', $str);
+ }
+
public function isOn($key)
{
return $this->has($key) && $this->t($key) == 'on';
new UFBF_Comment('free', 'Commentaire'),
new UFBF_Phone('phone_number', 'Téléphone'),
new UFBF_Networking('networking_address', 'networking_type', 'Networking et sites webs'),
+
+ new UFBF_Mentor('only_referent', 'Référent'),
);
parent::__construct($fields, $envprefix);
}
return $this->raise("Le champ %s est trop court (minimum {$this->minlength}).");
} else if (strlen($this->val) > $this->maxlength) {
return $this->raise("Le champ %s est trop long (maximum {$this->maxlength}).");
- } else if (preg_match(":[\]\[<>{}~/§_`|%$^=+]|\*\*:u", $this->val)) {
+ } else if (preg_match(":[\]\[<>{}~§_`|%$^=]|\*\*:u", $this->val)) {
return $this->raise('Le champ %s contient un caractère interdit rendant la recherche impossible.');
}
protected function check(UserFilterBuilder &$ufb)
{
- if ($ufb->blank($this->envfieldindex) && $ufb->blank($this->envfield)) {
+ if ($ufb->blank($this->envfieldindex) && !$ufb->hasAlnum($this->envfield)) {
$this->empty = true;
return true;
}
}
// }}}
+// {{{ class UFBF_Mentor
+class UFBF_Mentor extends UFBF_Bool
+{
+ protected function buildUFC(UserFilterBuilder &$ufb)
+ {
+ return new UFC_Mentor();
+ }
+}
+// }}}
+
// {{{ class UFBF_MentorCountry
class UFBF_MentorCountry extends UFBF_Text
{