API Documentation
Table of Contents
Constants
- ISEMAIL_CFWS = 31
- ISEMAIL_CFWS_COMMENT = 17
- ISEMAIL_CFWS_FWS = 18
- ISEMAIL_COMPONENT_DOMAIN = 1
- ISEMAIL_COMPONENT_LITERAL = 2
- ISEMAIL_COMPONENT_LOCALPART = 0
- ISEMAIL_CONTEXT_COMMENT = 3
- ISEMAIL_CONTEXT_FWS = 4
- ISEMAIL_CONTEXT_QUOTEDPAIR = 6
- ISEMAIL_CONTEXT_QUOTEDSTRING = 5
- ISEMAIL_DEPREC = 63
- ISEMAIL_DEPREC_CFWS_NEAR_AT = 49
- ISEMAIL_DEPREC_COMMENT = 37
- ISEMAIL_DEPREC_CTEXT = 38
- ISEMAIL_DEPREC_FWS = 34
- ISEMAIL_DEPREC_LOCALPART = 33
- ISEMAIL_DEPREC_QP = 36
- ISEMAIL_DEPREC_QTEXT = 35
- ISEMAIL_DNSWARN = 7
- ISEMAIL_DNSWARN_NO_MX_RECORD = 5
- ISEMAIL_DNSWARN_NO_RECORD = 6
- ISEMAIL_ERR = 255
- ISEMAIL_ERR_ATEXT_AFTER_CFWS = 133
- ISEMAIL_ERR_ATEXT_AFTER_DOMLIT = 135
- ISEMAIL_ERR_ATEXT_AFTER_QS = 134
- ISEMAIL_ERR_BACKSLASHEND = 140
- ISEMAIL_ERR_CONSECUTIVEDOTS = 132
- ISEMAIL_ERR_CR_NO_LF = 150
- ISEMAIL_ERR_DOMAINHYPHENEND = 144
- ISEMAIL_ERR_DOMAINHYPHENSTART = 143
- ISEMAIL_ERR_DOT_END = 142
- ISEMAIL_ERR_DOT_START = 141
- ISEMAIL_ERR_EXPECTING_ATEXT = 137
- ISEMAIL_ERR_EXPECTING_CTEXT = 139
- ISEMAIL_ERR_EXPECTING_DTEXT = 129
- ISEMAIL_ERR_EXPECTING_QPAIR = 136
- ISEMAIL_ERR_EXPECTING_QTEXT = 138
- ISEMAIL_ERR_FWS_CRLF_END = 149
- ISEMAIL_ERR_FWS_CRLF_X2 = 148
- ISEMAIL_ERR_NODOMAIN = 131
- ISEMAIL_ERR_NOLOCALPART = 130
- ISEMAIL_ERR_UNCLOSEDCOMMENT = 146
- ISEMAIL_ERR_UNCLOSEDDOMLIT = 147
- ISEMAIL_ERR_UNCLOSEDQUOTEDSTR = 145
- ISEMAIL_RFC5321 = 15
- ISEMAIL_RFC5321_ADDRESSLITERAL = 12
- ISEMAIL_RFC5321_IPV6DEPRECATED = 13
- ISEMAIL_RFC5321_QUOTEDSTRING = 11
- ISEMAIL_RFC5321_TLD = 9
- ISEMAIL_RFC5321_TLDNUMERIC = 10
- ISEMAIL_RFC5322 = 127
- ISEMAIL_RFC5322_DOMAIN = 65
- ISEMAIL_RFC5322_DOMAIN_TOOLONG = 68
- ISEMAIL_RFC5322_DOMAINLITERAL = 70
- ISEMAIL_RFC5322_DOMLIT_OBSDTEXT = 71
- ISEMAIL_RFC5322_IPV6_2X2XCOLON = 73
- ISEMAIL_RFC5322_IPV6_BADCHAR = 74
- ISEMAIL_RFC5322_IPV6_COLONEND = 77
- ISEMAIL_RFC5322_IPV6_COLONSTRT = 76
- ISEMAIL_RFC5322_IPV6_GRPCOUNT = 72
- ISEMAIL_RFC5322_IPV6_MAXGRPS = 75
- ISEMAIL_RFC5322_LABEL_TOOLONG = 69
- ISEMAIL_RFC5322_LOCAL_TOOLONG = 67
- ISEMAIL_RFC5322_TOOLONG = 66
- ISEMAIL_STRING_AT = '@'
- ISEMAIL_STRING_BACKSLASH = '\\'
- ISEMAIL_STRING_CLOSEPARENTHESIS = ')'
- ISEMAIL_STRING_CLOSESQBRACKET = ']'
- ISEMAIL_STRING_COLON = ':'
- ISEMAIL_STRING_CR = "\r"
- ISEMAIL_STRING_DOT = '.'
- ISEMAIL_STRING_DOUBLECOLON = '::'
- ISEMAIL_STRING_DQUOTE = '"'
- ISEMAIL_STRING_HTAB = "\t"
- ISEMAIL_STRING_HYPHEN = '-'
- ISEMAIL_STRING_IPV6TAG = 'IPv6:'
- ISEMAIL_STRING_LF = "\n"
- ISEMAIL_STRING_OPENPARENTHESIS = '('
- ISEMAIL_STRING_OPENSQBRACKET = '['
- ISEMAIL_STRING_SP = ' '
- ISEMAIL_STRING_SPECIALS = '()<>[]:;@\,."'
- ISEMAIL_THRESHOLD = 16
- ISEMAIL_VALID = 0
- ISEMAIL_VALID_CATEGORY = 1
Functions
- verifier_generer_aide() : mixed
- is_email() : bool|int
- Check that an email address conforms to RFCs 5321, 5322 and others
- inc_verifier_dist() : string
- Fonction de base de l'API de vérification.
- verifier_lister_disponibles() : array<string|int, mixed>
- Liste toutes les vérifications possibles
- verifier_trier_par_titre() : int
- Fonction de callback pour uasort() Afin de trier selon le titre
- verifier_charger_infos() : array<string|int, mixed>
- Charger les informations contenues dans le yaml d'une vérification
- verifier_attribut_class_dist() : string
- Vérifie la validité d'un attribut class d'une balise HTML.
- verifier_code_postal_dist() : string
- Un code postal francais est compose de 5 chiffres http://fr.wikipedia.org/wiki/Code_postal_en_France a completer pour d'autre pays
- verifier_comparaison_champ_dist() : string
- Compare la valeur avec un autre champ du _request().
- verifier_couleur_dist() : string
- Vérifie la validité d'un code couleur
- verifier_date_dist() : string
- Une date au format JJ/MM/AAAA (avec séparateurs souples : espace / - .) Options : - format : permet de préciser le format de la date jma pour jour/mois/année (par défaut), mja (pour mois / jour / année), amj (année/mois/jour)
- normaliser_date_date_ou_datetime_dist() : mixed
- Convertir une date en date ou datetime (SQL) en fonction de 1. En priorité l'option sql de la saisie recu 2. A défaut en fonctions de l'option `heure`
- normaliser_date_date_dist() : mixed
- Convertir une date en date (SQL)
- normaliser_date_datetime_dist() : mixed
- Convertir une date en datetime
- normaliser_date_aucune_dist() : mixed
- verifier_date_format_spip2php() : string
- Convertir une description de format SPIP en description de format PHP
- verifier_decimal_dist() : string
- Vérifie qu'un nombre décimal cohérent peut être extrait de la valeur Options : - min : valeur minimale acceptée - max : valeur maximale acceptée
- verifier_email_dist() : string
- Vérifie la validité d'une adresse de courriel.
- verifier_email_rfc5322() : bool
- Changement de la RegExp d'origine
- verifier_email_de_maniere_stricte() : bool
- Version basique du contrôle des mails
- verifier_disponibilite_email() : bool
- Vérifier que le courriel à tester n'est pas déjà utilisé dans la table spip_auteurs
- verifier_entier_dist() : string
- Vérifie qu'un entier cohérent peut être extrait de la valeur Options : - min : valeur minimale acceptée - max : valeur maximale acceptée
- verifier_fichiers_dist() : string
- Vérifier une saisie d'envoi de fichiers
- verifier_fichier_mime() : string
- Vérifier le mime type d'une saisie d'envoi de fichiers
- verifier_fichier_mime_type_image_web() : array<string|int, mixed>
- Lister les mime_type d'image affichable
- verifier_fichier_taille() : string
- Vérifier la taille d'une saisie d'envoi de fichiers
- verifier_fichier_dimension_max() : string
- Vérifier la dimension d'une saisie d'envoi de fichiers
- verifier_iban_dist() : string
- Un numéro IBAN Options : - …
- normaliser_iban_dist() : mixed
- verifier_id_document_dist() : string
- Vérifie que la valeur correspond à un id_document valide
- verifier_id_objet_dist() : string
- Vérifie que la valeur correspond à un identifiant d'objet valide
- verifier_image_upload_dist() : string
- Vérifier un upload d'image unique
- verifier_image_upload_multiple_dist() : string
- Vérifier un upload d'image unique ou multiple
- verifier_isbn_dist() : string
- Validation d'un numéro ISBN
- verifier_password_dist() : string
- Vérifie les passwords
- verifier_regex_dist() : string
- Vérifié une valeur suivant une expression régulière.
- verifier_siren_siret_dist() : string
- Validation d'un SIREN ou d'un SIRET
- verifier_slug_dist() : string
- Vérifie la validité d'un slug
- verifier_taille_dist() : string
- Vérifier une taille minimale/maximale, pour un mot de passe par exemple
- verifier_telephone_dist() : string
- Vérifie un numéro de téléphone. Pour l'instant seulement avec le schéma français.
- verifier_telephone_prefixes_pays_dist() : mixed
- verifier_telephone_pays_patterns() : string
- Verification generique
- verifier_telephone_pays_ch_dist() : mixed
- verifier_telephone_pays_es_dist() : mixed
- verifier_telephone_pays_fr_dist() : mixed
- verifier_telephone_pays_be_dist() : mixed
- verifier_telephone_pays_lu_dist() : mixed
- verifier_url_dist() : string
- Vérification d'une URL
- verifier_url_protocole() : string
- Vérifier uniquement la présence d'un protocole
- verifier_php_filter() : string
- Vérifier la présence d'un protocole, puis utilise le filtre FILTER_VALIDATE_URL de PHP pour s'assurer que l'url est complète
- verifier_url_complet() : string
- Vérifier la présence d'un protocole et de la bonne syntaxe du reste de l'url
- filtre_verifier_lister_disponibles_dist() : array<string|int, mixed>
- Liste toutes les vérifications possibles
Constants
ISEMAIL_CFWS
public
mixed
ISEMAIL_CFWS
= 31
ISEMAIL_CFWS_COMMENT
public
mixed
ISEMAIL_CFWS_COMMENT
= 17
ISEMAIL_CFWS_FWS
public
mixed
ISEMAIL_CFWS_FWS
= 18
ISEMAIL_COMPONENT_DOMAIN
public
mixed
ISEMAIL_COMPONENT_DOMAIN
= 1
ISEMAIL_COMPONENT_LITERAL
public
mixed
ISEMAIL_COMPONENT_LITERAL
= 2
ISEMAIL_COMPONENT_LOCALPART
public
mixed
ISEMAIL_COMPONENT_LOCALPART
= 0
ISEMAIL_CONTEXT_COMMENT
public
mixed
ISEMAIL_CONTEXT_COMMENT
= 3
ISEMAIL_CONTEXT_FWS
public
mixed
ISEMAIL_CONTEXT_FWS
= 4
ISEMAIL_CONTEXT_QUOTEDPAIR
public
mixed
ISEMAIL_CONTEXT_QUOTEDPAIR
= 6
ISEMAIL_CONTEXT_QUOTEDSTRING
public
mixed
ISEMAIL_CONTEXT_QUOTEDSTRING
= 5
ISEMAIL_DEPREC
public
mixed
ISEMAIL_DEPREC
= 63
ISEMAIL_DEPREC_CFWS_NEAR_AT
public
mixed
ISEMAIL_DEPREC_CFWS_NEAR_AT
= 49
ISEMAIL_DEPREC_COMMENT
public
mixed
ISEMAIL_DEPREC_COMMENT
= 37
ISEMAIL_DEPREC_CTEXT
public
mixed
ISEMAIL_DEPREC_CTEXT
= 38
ISEMAIL_DEPREC_FWS
public
mixed
ISEMAIL_DEPREC_FWS
= 34
ISEMAIL_DEPREC_LOCALPART
public
mixed
ISEMAIL_DEPREC_LOCALPART
= 33
ISEMAIL_DEPREC_QP
public
mixed
ISEMAIL_DEPREC_QP
= 36
ISEMAIL_DEPREC_QTEXT
public
mixed
ISEMAIL_DEPREC_QTEXT
= 35
ISEMAIL_DNSWARN
public
mixed
ISEMAIL_DNSWARN
= 7
ISEMAIL_DNSWARN_NO_MX_RECORD
public
mixed
ISEMAIL_DNSWARN_NO_MX_RECORD
= 5
ISEMAIL_DNSWARN_NO_RECORD
public
mixed
ISEMAIL_DNSWARN_NO_RECORD
= 6
ISEMAIL_ERR
public
mixed
ISEMAIL_ERR
= 255
ISEMAIL_ERR_ATEXT_AFTER_CFWS
public
mixed
ISEMAIL_ERR_ATEXT_AFTER_CFWS
= 133
ISEMAIL_ERR_ATEXT_AFTER_DOMLIT
public
mixed
ISEMAIL_ERR_ATEXT_AFTER_DOMLIT
= 135
ISEMAIL_ERR_ATEXT_AFTER_QS
public
mixed
ISEMAIL_ERR_ATEXT_AFTER_QS
= 134
ISEMAIL_ERR_BACKSLASHEND
public
mixed
ISEMAIL_ERR_BACKSLASHEND
= 140
ISEMAIL_ERR_CONSECUTIVEDOTS
public
mixed
ISEMAIL_ERR_CONSECUTIVEDOTS
= 132
ISEMAIL_ERR_CR_NO_LF
public
mixed
ISEMAIL_ERR_CR_NO_LF
= 150
ISEMAIL_ERR_DOMAINHYPHENEND
public
mixed
ISEMAIL_ERR_DOMAINHYPHENEND
= 144
ISEMAIL_ERR_DOMAINHYPHENSTART
public
mixed
ISEMAIL_ERR_DOMAINHYPHENSTART
= 143
ISEMAIL_ERR_DOT_END
public
mixed
ISEMAIL_ERR_DOT_END
= 142
ISEMAIL_ERR_DOT_START
public
mixed
ISEMAIL_ERR_DOT_START
= 141
ISEMAIL_ERR_EXPECTING_ATEXT
public
mixed
ISEMAIL_ERR_EXPECTING_ATEXT
= 137
ISEMAIL_ERR_EXPECTING_CTEXT
public
mixed
ISEMAIL_ERR_EXPECTING_CTEXT
= 139
ISEMAIL_ERR_EXPECTING_DTEXT
public
mixed
ISEMAIL_ERR_EXPECTING_DTEXT
= 129
ISEMAIL_ERR_EXPECTING_QPAIR
public
mixed
ISEMAIL_ERR_EXPECTING_QPAIR
= 136
ISEMAIL_ERR_EXPECTING_QTEXT
public
mixed
ISEMAIL_ERR_EXPECTING_QTEXT
= 138
ISEMAIL_ERR_FWS_CRLF_END
public
mixed
ISEMAIL_ERR_FWS_CRLF_END
= 149
ISEMAIL_ERR_FWS_CRLF_X2
public
mixed
ISEMAIL_ERR_FWS_CRLF_X2
= 148
ISEMAIL_ERR_NODOMAIN
public
mixed
ISEMAIL_ERR_NODOMAIN
= 131
ISEMAIL_ERR_NOLOCALPART
public
mixed
ISEMAIL_ERR_NOLOCALPART
= 130
ISEMAIL_ERR_UNCLOSEDCOMMENT
public
mixed
ISEMAIL_ERR_UNCLOSEDCOMMENT
= 146
ISEMAIL_ERR_UNCLOSEDDOMLIT
public
mixed
ISEMAIL_ERR_UNCLOSEDDOMLIT
= 147
ISEMAIL_ERR_UNCLOSEDQUOTEDSTR
public
mixed
ISEMAIL_ERR_UNCLOSEDQUOTEDSTR
= 145
ISEMAIL_RFC5321
public
mixed
ISEMAIL_RFC5321
= 15
ISEMAIL_RFC5321_ADDRESSLITERAL
public
mixed
ISEMAIL_RFC5321_ADDRESSLITERAL
= 12
ISEMAIL_RFC5321_IPV6DEPRECATED
public
mixed
ISEMAIL_RFC5321_IPV6DEPRECATED
= 13
ISEMAIL_RFC5321_QUOTEDSTRING
public
mixed
ISEMAIL_RFC5321_QUOTEDSTRING
= 11
ISEMAIL_RFC5321_TLD
public
mixed
ISEMAIL_RFC5321_TLD
= 9
ISEMAIL_RFC5321_TLDNUMERIC
public
mixed
ISEMAIL_RFC5321_TLDNUMERIC
= 10
ISEMAIL_RFC5322
public
mixed
ISEMAIL_RFC5322
= 127
ISEMAIL_RFC5322_DOMAIN
public
mixed
ISEMAIL_RFC5322_DOMAIN
= 65
ISEMAIL_RFC5322_DOMAIN_TOOLONG
public
mixed
ISEMAIL_RFC5322_DOMAIN_TOOLONG
= 68
ISEMAIL_RFC5322_DOMAINLITERAL
public
mixed
ISEMAIL_RFC5322_DOMAINLITERAL
= 70
ISEMAIL_RFC5322_DOMLIT_OBSDTEXT
public
mixed
ISEMAIL_RFC5322_DOMLIT_OBSDTEXT
= 71
ISEMAIL_RFC5322_IPV6_2X2XCOLON
public
mixed
ISEMAIL_RFC5322_IPV6_2X2XCOLON
= 73
ISEMAIL_RFC5322_IPV6_BADCHAR
public
mixed
ISEMAIL_RFC5322_IPV6_BADCHAR
= 74
ISEMAIL_RFC5322_IPV6_COLONEND
public
mixed
ISEMAIL_RFC5322_IPV6_COLONEND
= 77
ISEMAIL_RFC5322_IPV6_COLONSTRT
public
mixed
ISEMAIL_RFC5322_IPV6_COLONSTRT
= 76
ISEMAIL_RFC5322_IPV6_GRPCOUNT
public
mixed
ISEMAIL_RFC5322_IPV6_GRPCOUNT
= 72
ISEMAIL_RFC5322_IPV6_MAXGRPS
public
mixed
ISEMAIL_RFC5322_IPV6_MAXGRPS
= 75
ISEMAIL_RFC5322_LABEL_TOOLONG
public
mixed
ISEMAIL_RFC5322_LABEL_TOOLONG
= 69
ISEMAIL_RFC5322_LOCAL_TOOLONG
public
mixed
ISEMAIL_RFC5322_LOCAL_TOOLONG
= 67
ISEMAIL_RFC5322_TOOLONG
public
mixed
ISEMAIL_RFC5322_TOOLONG
= 66
ISEMAIL_STRING_AT
public
mixed
ISEMAIL_STRING_AT
= '@'
ISEMAIL_STRING_BACKSLASH
public
mixed
ISEMAIL_STRING_BACKSLASH
= '\\'
ISEMAIL_STRING_CLOSEPARENTHESIS
public
mixed
ISEMAIL_STRING_CLOSEPARENTHESIS
= ')'
ISEMAIL_STRING_CLOSESQBRACKET
public
mixed
ISEMAIL_STRING_CLOSESQBRACKET
= ']'
ISEMAIL_STRING_COLON
public
mixed
ISEMAIL_STRING_COLON
= ':'
ISEMAIL_STRING_CR
public
mixed
ISEMAIL_STRING_CR
= "\r"
ISEMAIL_STRING_DOT
public
mixed
ISEMAIL_STRING_DOT
= '.'
ISEMAIL_STRING_DOUBLECOLON
public
mixed
ISEMAIL_STRING_DOUBLECOLON
= '::'
ISEMAIL_STRING_DQUOTE
public
mixed
ISEMAIL_STRING_DQUOTE
= '"'
ISEMAIL_STRING_HTAB
public
mixed
ISEMAIL_STRING_HTAB
= "\t"
ISEMAIL_STRING_HYPHEN
public
mixed
ISEMAIL_STRING_HYPHEN
= '-'
ISEMAIL_STRING_IPV6TAG
public
mixed
ISEMAIL_STRING_IPV6TAG
= 'IPv6:'
ISEMAIL_STRING_LF
public
mixed
ISEMAIL_STRING_LF
= "\n"
ISEMAIL_STRING_OPENPARENTHESIS
public
mixed
ISEMAIL_STRING_OPENPARENTHESIS
= '('
ISEMAIL_STRING_OPENSQBRACKET
public
mixed
ISEMAIL_STRING_OPENSQBRACKET
= '['
ISEMAIL_STRING_SP
public
mixed
ISEMAIL_STRING_SP
= ' '
ISEMAIL_STRING_SPECIALS
public
mixed
ISEMAIL_STRING_SPECIALS
= '()<>[]:;@\,."'
ISEMAIL_THRESHOLD
public
mixed
ISEMAIL_THRESHOLD
= 16
ISEMAIL_VALID
public
mixed
ISEMAIL_VALID
= 0
ISEMAIL_VALID_CATEGORY
public
mixed
ISEMAIL_VALID_CATEGORY
= 1
Functions
verifier_generer_aide()
verifier_generer_aide() : mixed
is_email()
Check that an email address conforms to RFCs 5321, 5322 and others
is_email(string $email[, bool $checkDNS = false ][, mixed $errorlevel = false ][, array<string|int, mixed> &$parsedata = [] ]) : bool|int
As of Version 3.0, we are now distinguishing clearly between a Mailbox as defined by RFC 5321 and an addr-spec as defined by RFC 5322. Depending on the context, either can be regarded as a valid email address. The RFC 5321 Mailbox specification is more restrictive (comments, white space and obsolete forms are not allowed)
Parameters
- $email : string
-
The email address to check
- $checkDNS : bool = false
-
If true then a DNS check for MX records will be made
- $errorlevel : mixed = false
-
Determines the boundary between valid and invalid addresses. Status codes above this number will be returned as-is, status codes below will be returned as ISEMAIL_VALID. Thus the calling program can simply look for ISEMAIL_VALID if it is only interested in whether an address is valid or not. The errorlevel will determine how "picky" is_email() is about the address.
If omitted or passed as false then is_email() will return true or false rather than an integer error or warning.
NB Note the difference between $errorlevel = false and $errorlevel = 0
- $parsedata : array<string|int, mixed> = []
-
If passed, returns the parsed address components
Return values
bool|intinc_verifier_dist()
Fonction de base de l'API de vérification.
inc_verifier_dist(mixed $valeur, string $type[, array<string|int, mixed> $options = null ][, array<string|int, mixed> &$valeur_normalisee = null ]) : string
Parameters
- $valeur : mixed
-
La valeur a verifier.
- $type : string
-
Le type de verification a appliquer.
- $options : array<string|int, mixed> = null
-
Un eventuel tableau d'options suivant le type.
- $valeur_normalisee : array<string|int, mixed> = null
-
Si des options de verification modifient la valeur entrante (normalisent), alors la valeur modifie sera stockee dans cette variable.
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_lister_disponibles()
Liste toutes les vérifications possibles
verifier_lister_disponibles([string $repertoire = 'verifier' ]) : array<string|int, mixed>
Parameters
- $repertoire : string = 'verifier'
-
Dans quel repertoire chercher les yaml.
Return values
array<string|int, mixed> —Retourne un tableau listant les vérifications et leurs options
verifier_trier_par_titre()
Fonction de callback pour uasort() Afin de trier selon le titre
verifier_trier_par_titre(array<string|int, mixed> $array1, array<string|int, mixed> $array2) : int
Parameters
- $array1 : array<string|int, mixed>
-
premier élèment
- $array2 : array<string|int, mixed>
-
second élèment
Return values
int —1,0,-1
verifier_charger_infos()
Charger les informations contenues dans le yaml d'une vérification
verifier_charger_infos(string $type_verif[, string $repertoire = 'verifier' ]) : array<string|int, mixed>
Parameters
- $type_verif : string
-
Le type de la vérification
- $repertoire : string = 'verifier'
-
Dans quel repertoire chercher les yaml.
Tags
Return values
array<string|int, mixed> —Un tableau contenant le YAML décodé
verifier_attribut_class_dist()
Vérifie la validité d'un attribut class d'une balise HTML.
verifier_attribut_class_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $valeur : string
-
La chaine à vérifier.
- $options : array<string|int, mixed> = []
-
Aucune option possible.
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_code_postal_dist()
Un code postal francais est compose de 5 chiffres http://fr.wikipedia.org/wiki/Code_postal_en_France a completer pour d'autre pays
verifier_code_postal_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
cf : http://fr.wikipedia.org/wiki/Codes_postaux
La regexp par défaut doit valider toutes les possibilités -* combinaisons de chiffres et de lettres et aussi tiret -* notations internationales cf : http://en.wikipedia.org/wiki/List_of_postal_codes#On_the_use_of_country_codes
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
pays => code pays
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_comparaison_champ_dist()
Compare la valeur avec un autre champ du _request().
verifier_comparaison_champ_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
Un éventuel tableau d'options.
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_couleur_dist()
Vérifie la validité d'un code couleur
verifier_couleur_dist(string $valeur[, array<string|int, mixed> $options = [] ][, null &$valeur_normalisee = null ]) : string
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
type => hexa,... normaliser => oui ou rien
- $valeur_normalisee : null = null
-
Si normalisation a faire, la variable sera rempli par la couleur normalisee.
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_date_dist()
Une date au format JJ/MM/AAAA (avec séparateurs souples : espace / - .) Options : - format : permet de préciser le format de la date jma pour jour/mois/année (par défaut), mja (pour mois / jour / année), amj (année/mois/jour)
verifier_date_dist(string|array<string|int, mixed> $valeur[, array<string|int, mixed> $options = [] ][, null &$valeur_normalisee = null ]) : string
Parameters
- $valeur : string|array<string|int, mixed>
-
La valeur à vérifier, en chaîne pour une date seule, en tableau contenant deux entrées "date" et "heure" si on veut aussi l'heure
- $options : array<string|int, mixed> = []
-
tableau d'options.
- $valeur_normalisee : null = null
-
Si normalisation a faire, la variable sera rempli par la date normalisee.
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
normaliser_date_date_ou_datetime_dist()
Convertir une date en date ou datetime (SQL) en fonction de 1. En priorité l'option sql de la saisie recu 2. A défaut en fonctions de l'option `heure`
normaliser_date_date_ou_datetime_dist(mixed $valeur, mixed $options, mixed &$erreur) : mixed
Parameters
- $valeur : mixed
- $options : mixed
- $erreur : mixed
normaliser_date_date_dist()
Convertir une date en date (SQL)
normaliser_date_date_dist(mixed $valeur, mixed $options, mixed &$erreur) : mixed
Parameters
- $valeur : mixed
- $options : mixed
- $erreur : mixed
normaliser_date_datetime_dist()
Convertir une date en datetime
normaliser_date_datetime_dist(mixed $valeur, mixed $options, mixed &$erreur) : mixed
Parameters
- $valeur : mixed
- $options : mixed
- $erreur : mixed
normaliser_date_aucune_dist()
normaliser_date_aucune_dist(mixed $valeur, mixed $options, mixed &$erreur) : mixed
Parameters
- $valeur : mixed
- $options : mixed
- $erreur : mixed
verifier_date_format_spip2php()
Convertir une description de format SPIP en description de format PHP
verifier_date_format_spip2php(string $format) : string
Parameters
- $format : string
Return values
stringverifier_decimal_dist()
Vérifie qu'un nombre décimal cohérent peut être extrait de la valeur Options : - min : valeur minimale acceptée - max : valeur maximale acceptée
verifier_decimal_dist(string $valeur[, array<string|int, mixed> $options = [] ][, mixed &$valeur_normalisee = null ]) : string
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
Si ce tableau associatif contient une valeur pour 'min' ou 'max', un contrôle supplémentaire sera effectué.
- $valeur_normalisee : mixed = null
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_email_dist()
Vérifie la validité d'une adresse de courriel.
verifier_email_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
Les contraintes du mail sont déterminées par le mode de validation En option, on contrôle aussi la disponibilité du mail dans la table des auteurs
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
Un éventuel tableau d'options.
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_email_rfc5322()
Changement de la RegExp d'origine
verifier_email_rfc5322(string $valeur) : bool
Respect de la RFC5322
Parameters
- $valeur : string
-
La valeur à vérifier
Tags
Return values
bool —Retourne true uniquement lorsque le mail est valide
verifier_email_de_maniere_stricte()
Version basique du contrôle des mails
verifier_email_de_maniere_stricte(string $valeur) : bool
Cette version impose des restrictions supplémentaires qui sont souvent utilisées pour des raison de simplification des adresses (ex. comptes utilisateurs lisibles, etc..)
Parameters
- $valeur : string
-
La valeur à vérifier
Return values
bool —Retourne true uniquement lorsque le mail est valide
verifier_disponibilite_email()
Vérifier que le courriel à tester n'est pas déjà utilisé dans la table spip_auteurs
verifier_disponibilite_email(string $valeur[, mixed $exclure_id_auteur = null ]) : bool
Parameters
- $valeur : string
-
La valeur à vérifier
- $exclure_id_auteur : mixed = null
Return values
bool —Retourne false lorsque le mail est déjà utilisé
verifier_entier_dist()
Vérifie qu'un entier cohérent peut être extrait de la valeur Options : - min : valeur minimale acceptée - max : valeur maximale acceptée
verifier_entier_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
Si ce tableau associatif contient une valeur pour 'min' ou 'max', un contrôle supplémentaire sera effectué.
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_fichiers_dist()
Vérifier une saisie d'envoi de fichiers
verifier_fichiers_dist(array<string|int, mixed>|bool $valeur, array<string|int, mixed> $options, array<string|int, mixed>|string &$erreurs_par_fichier) : string
Parameters
- $valeur : array<string|int, mixed>|bool
-
Le sous tableau de $_FILES à vérifier, $_FILES['logo'] par exemple Doit être un champ avec un ou plusieurs upload Si bool égal à true, cela signifie que le fichier avait déjà été vérifié, et qu'il est inutile de refaire la vérification.
- $options : array<string|int, mixed>
-
Options à vérifier :
- mime au choix 'pas_de_verification', 'image_web','tout_mime','specifique'
- mime_specifique (si l'option 'mime_specifique' est choisi ci-dessus)
- taille_max (en Kio)
- dimension_max, tableau contenant les dimension max:
- largeur (en px)
- hauteur (en px)
- autoriser_rotation : booléen à mettre à true (ou bien string égale à 'on') si on autorise une image qui tiendrait dans ces dimensions si on faisait une rotation de 90°
- on peut remplacer ce tableau par des strings directement dans $options:
- largeur_max
- hauteur_max
- autoriser_rotation
- $erreurs_par_fichier : array<string|int, mixed>|string
-
Si on vérifier un upload multiple, un tableau, passé par référence, qui contient le détail des erreurs fichier de $_FILES['fichier'] par fichier Si on vérifie un upload unique, une chaîne qui contiendra l'erreur du fichier.
Return values
stringverifier_fichier_mime()
Vérifier le mime type d'une saisie d'envoi de fichiers
verifier_fichier_mime(array<string|int, mixed> $valeur, int $cle, array<string|int, mixed> $options) : string
Parameters
- $valeur : array<string|int, mixed>
-
Le sous tableau de $_FILES à vérifier, $_FILES['logo'] par exemple Doit être un champ plusieurs uploads
- $cle : int
-
La clé du tableau qu'on vérifie
- $options : array<string|int, mixed>
-
Les options tels que passés à verifier_fichiers()
Return values
stringverifier_fichier_mime_type_image_web()
Lister les mime_type d'image affichable
verifier_fichier_mime_type_image_web() : array<string|int, mixed>
Return values
array<string|int, mixed>verifier_fichier_taille()
Vérifier la taille d'une saisie d'envoi de fichiers
verifier_fichier_taille(array<string|int, mixed> $valeur, int $cle, array<string|int, mixed> $options) : string
La taille est vérifiée en fonction du paramètre passé en option, sinon en fonction d'une constante:
- _IMG_MAX_SIZE si image web (sauf svg)
- _DOC_MAX_SIZE si pas jpg/png/gif ou si _IMG_MAX_SIZE n'est pas définie
Parameters
- $valeur : array<string|int, mixed>
-
Le sous tableau de
$_FILES
à vérifier,$_FILES['logo']
par exemple Doit être un champ plusieurs uploads - $cle : int
-
La clé du tableau qu'on vérifie
- $options : array<string|int, mixed>
-
Les options tels que passés à verifier_fichiers()
Return values
stringverifier_fichier_dimension_max()
Vérifier la dimension d'une saisie d'envoi de fichiers
verifier_fichier_dimension_max(array<string|int, mixed> $valeur, int $cle, array<string|int, mixed> $options) : string
Les dimensions sont vérifiées en fonction du paramètre passé en option, sinon en fonction des constantes:
- _IMG_MAX_WIDTH
- _IMG_MAX_HEIGHT
On suppose que le type mime a été vérifié auparavent
Parameters
- $valeur : array<string|int, mixed>
-
Le sous tableau de $_FILES à vérifier, $_FILES['logo'] par exemple Doit être un champ plusieurs uploads
- $cle : int
-
La clé du tableau qu'on vérifie
- $options : array<string|int, mixed>
-
Les options tels que passés à verifier_fichiers()
Return values
stringverifier_iban_dist()
Un numéro IBAN Options : - …
verifier_iban_dist(string|array<string|int, mixed> $valeur[, array<string|int, mixed> $options = [] ][, null &$valeur_normalisee = null ]) : string
Parameters
- $valeur : string|array<string|int, mixed>
-
La valeur à vérifier
- $options : array<string|int, mixed> = []
-
Tableau d'options
- $valeur_normalisee : null = null
-
Si normalisation a faire, la variable sera remplie par l'IBAN normalisé
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
normaliser_iban_dist()
normaliser_iban_dist(mixed $valeur, mixed $options, mixed &$erreur) : mixed
Parameters
- $valeur : mixed
- $options : mixed
- $erreur : mixed
verifier_id_document_dist()
Vérifie que la valeur correspond à un id_document valide
verifier_id_document_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_id_objet_dist()
Vérifie que la valeur correspond à un identifiant d'objet valide
verifier_id_objet_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_image_upload_dist()
Vérifier un upload d'image unique
verifier_image_upload_dist(array<string|int, mixed> $valeur, array<string|int, mixed> $options) : string
Cette fonction est depréciée, on utilisera de préférence la vérification 'fichiers', plus souple, et à laquelle la présente fonction renvoie.
Parameters
- $valeur : array<string|int, mixed>
-
Le sous tableau de $_FILES à vérifier, $_FILES['logo'] par exemple Doit être un champ avec un seul upload
- $options : array<string|int, mixed>
-
Options à vérifier :
- taille_max (en kio)
- largeur_max (en px)
- hauteur_max (en px)
Tags
Return values
stringverifier_image_upload_multiple_dist()
Vérifier un upload d'image unique ou multiple
verifier_image_upload_multiple_dist(array<string|int, mixed> $valeur[, array<string|int, mixed> $options = [] ][, null &$valeur_normalisee = null ]) : string
Cette fonction n'est conservée que pour compatibilité ascendant. Lui préferer la vérification 'fichiers', qui possède plus d'options, et qui est d'ailleurs appelée ici.
Parameters
- $valeur : array<string|int, mixed>
-
Le sous tableau de $_FILES à vérifier Peut être un champ avec plusieurs uploads
- $options : array<string|int, mixed> = []
-
Options à vérifier :
- taille_max (en kio)
- largeur_max (en px)
- hauteur_max (en px)
- $valeur_normalisee : null = null
-
Retourne un tableau des indexes de fichiers en erreur
Tags
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_isbn_dist()
Validation d'un numéro ISBN
verifier_isbn_dist(string $valeur[, mixed $options = [] ]) : string
d'après https://fr.wikipedia.org/wiki/Numéro_ISBN ISBN-13 : longeur totale 13 caracteres divises en 5 segments de la forme G - A - B - C - K G: 3 caracteres (978 ou 979) A: de 1 a 5 caracteres (code de la zone geographique) B: de 1 a 7 caracteres (code de l editeur) C: de 1 a 6 caracteres, completes eventuellement par des 0 afin que le total-G soit egal a 10 caracteres (code du livre) K: 1 caractere entre 0 et 9 (cle de controle calculee d apres les autres chiffres) ex: 978-2-1234-5680-3 ISBN-10 : longeur totale 10 caracteres divises en 4 segments de la forme A -B -C -K A, B, C : idem ISBN-13 K: 1 caractere entre 0 et 9, ou X (cle de controle calculee d apres les autres chiffres) ex: 2-1234-5680-X
Avec un numéro ISBN comportant des tirets, on pourrait utiliser une regex pour vérifier que chaque segment comporte le nombre adequat de caractères. Cependant ça ne permet pas d'indiquer précisement la nature de l'erreur. La regex au cas ou : "/^(97[89][- ]){0,1}[0-9]{1,5}[- ][0-9]{1,7}[- ][0-9]{1,6}[- ][0-9X]$/"
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : mixed = []
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_password_dist()
Vérifie les passwords
verifier_password_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
Options :
- match : Nom du champ avec lequel le password dois correspondre
- longueur : taille minimum du password. Si la longueur a pour valeur "spip", c'est la constante _PASS_LONGUEUR_MINI qui sera utilisée
Parameters
- $valeur : string
- $options : array<string|int, mixed> = []
Tags
Return values
stringverifier_regex_dist()
Vérifié une valeur suivant une expression régulière.
verifier_regex_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
Options :
- modele : chaine représentant l'expression
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
- 'modele' => chaine représentant l'expression
- 'negation' => si rempli et non null, vérifie que la valeur NE CORRESPOND PAS à l'expression
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_siren_siret_dist()
Validation d'un SIREN ou d'un SIRET
verifier_siren_siret_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
1/ Un SIREN comporte STRICTEMENT 9 caractères 1b/ Un SIRET comporte strictement 14 caractères 2/ Un siren/siret utilise une clef de controle "1-2" Un siren/siret est donc valide si la somme des chiffres pairs
- la somme du double de tous les chiffres impairs (16 = 1+6 = 7) est un multiple de 10
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
Indique s'il faut tester le SIREN ou le SIRET.
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_slug_dist()
Vérifie la validité d'un slug
verifier_slug_dist(string $valeur[, array<string|int, mixed> $options = [] ][, null &$valeur_normalisee = null ]) : string
Un slug est un court texte utilisé pour identifier une ressource. Il ne contient que des charactères alphanumérique ou un séparateur (par défaut, un underscore) Donc ni charactère accentué, ponctuation ou espace blanc.
Permet de normaliser la valeur, ou alternativement de ne faire qu'une suggestion dans le message d'erreur.
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
- (bool) normaliser : pour convertir automatiquement la chaîne au bon format.
- (bool) normaliser_suggerer : pour suggérer la chaîne normalisée au lieu de la modifier (alternative à l'option précédente).
- (string) separateur : un ou plusieurs charactères acceptés pour séparer les mots (sans espace), défaut = underscore Si multiples, on prend le 1er pour normaliser
- (int) longueur_maxi : nombre maximal de charactères, défaut = 60
- $valeur_normalisee : null = null
-
Si normalisation à faire, la variable sera remplie par la chaîne normalisée. Ex. : « Ô, toi, l’écureuil ! » devient « o_toi_l_ecureuil »
Tags
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_taille_dist()
Vérifier une taille minimale/maximale, pour un mot de passe par exemple
verifier_taille_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
Les éléments à vérifier (min, max, egal).
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_telephone_dist()
Vérifie un numéro de téléphone. Pour l'instant seulement avec le schéma français.
verifier_telephone_dist(string $valeur[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $valeur : string
-
La valeur à vérifier.
- $options : array<string|int, mixed> = []
-
pays
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_telephone_prefixes_pays_dist()
verifier_telephone_prefixes_pays_dist() : mixed
verifier_telephone_pays_patterns()
Verification generique
verifier_telephone_pays_patterns(array<string|int, mixed> $patterns, string $tel, string $message_erreur_defaut[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $patterns : array<string|int, mixed>
-
liste des regexp en fonction du format : fixe, mobile, all
- $tel : string
-
le numero a verifier
- $message_erreur_defaut : string
- $options : array<string|int, mixed> = []
Return values
stringverifier_telephone_pays_ch_dist()
verifier_telephone_pays_ch_dist(mixed $tel, mixed $message_erreur_defaut[, mixed $options = [] ]) : mixed
Parameters
- $tel : mixed
- $message_erreur_defaut : mixed
- $options : mixed = []
verifier_telephone_pays_es_dist()
verifier_telephone_pays_es_dist(mixed $tel, mixed $message_erreur_defaut[, mixed $options = [] ]) : mixed
Parameters
- $tel : mixed
- $message_erreur_defaut : mixed
- $options : mixed = []
verifier_telephone_pays_fr_dist()
verifier_telephone_pays_fr_dist(mixed $tel, mixed $message_erreur_defaut[, mixed $options = [] ]) : mixed
Parameters
- $tel : mixed
- $message_erreur_defaut : mixed
- $options : mixed = []
verifier_telephone_pays_be_dist()
verifier_telephone_pays_be_dist(mixed $tel, mixed $message_erreur_defaut[, mixed $options = [] ]) : mixed
Parameters
- $tel : mixed
- $message_erreur_defaut : mixed
- $options : mixed = []
verifier_telephone_pays_lu_dist()
verifier_telephone_pays_lu_dist(mixed $tel, mixed $message_erreur_defaut[, mixed $options = [] ]) : mixed
Parameters
- $tel : mixed
- $message_erreur_defaut : mixed
- $options : mixed = []
verifier_url_dist()
Vérification d'une URL
verifier_url_dist(string $url[, array<string|int, mixed> $options = [] ]) : string
Par défaut vérifie uniquement si un protocole de type web est présent (http ou https)
Parameters
- $url : string
-
L'url à vérifier.
- $options : array<string|int, mixed> = []
-
- mode :
- protocole_seul : vérifie la présence d'un protocole uniquement
- php_filter : vérifie la présence d'un protocole puis vérifie la conformité au moyen de la fonction native de PHP → filter_var + FILTER_VALIDATE_URL + drapeaux par défaut
- complet : vérifie la présence d'un protocole puis vérifie la syntaxe au moyen de tests maisons
- type_protocole :
- tous : tous ceux qui respectent un certain pattern
- web : http ou https
- mail : imap, pop3, smtp
- ftp : ftp ou sftp,
- exact : cf. option protocole
- protocole : nom du protocole (si type_protocole = exact)
- mode :
Return values
string —Retourne une chaine vide si c'est valide, sinon une chaine expliquant l'erreur.
verifier_url_protocole()
Vérifier uniquement la présence d'un protocole
verifier_url_protocole(string $url, string $type_protocole, string $protocole) : string
Parameters
- $url : string
-
L'url à vérifier
- $type_protocole : string
-
: tous, web (http ou https), mail (imap, pop3, smtp), ftp (ftp ou sftp), webcal (webcal, http, https), exact
- $protocole : string
-
: nom du protocole (si type_protocole=exact)
Return values
string —Retourne '' uniquement lorsque l'url est valide
verifier_php_filter()
Vérifier la présence d'un protocole, puis utilise le filtre FILTER_VALIDATE_URL de PHP pour s'assurer que l'url est complète
verifier_php_filter(string $url, string $type_protocole, string $protocole) : string
Parameters
- $url : string
-
L'url à vérifier
- $type_protocole : string
-
: tous, web (http ou https), mail (imap, pop3, smtp), ftp (ftp ou sftp), webcal (webcal, http, https), exact
- $protocole : string
-
: nom du protocole (si type_protocole=exact)
Return values
string —Retourne '' uniquement lorsque l'url est valide
verifier_url_complet()
Vérifier la présence d'un protocole et de la bonne syntaxe du reste de l'url
verifier_url_complet(string $url, string $type_protocole, string $protocole) : string
http://phpcentral.com/208-url-validation-in-php.html <http[s]|ftp> :// [user[:pass]@] hostname [port] [/path] [?getquery] [anchor]
Parameters
- $url : string
-
L'url à vérifier
- $type_protocole : string
-
: web (http ou https), mail (imap, pop3, smtp), ftp (ftp ou sftp), webcal (webcal, http, https), exact
- $protocole : string
-
: nom du protocole (si type_protocole=exact)
Return values
string —Retourne '' uniquement lorsque l'url est valide
filtre_verifier_lister_disponibles_dist()
Liste toutes les vérifications possibles
filtre_verifier_lister_disponibles_dist([string $repertoire = 'verifier' ]) : array<string|int, mixed>
Parameters
- $repertoire : string = 'verifier'
-
Dans quel repertoire chercher les yaml.
Tags
Return values
array<string|int, mixed> —Un tableau listant les vérifications et leurs options