Table des matières
wash
Date de publication: le jeudi 31 mars 2011 à 21h31
Dernière modification: par Pascal BOYER le jeudi 31 mars 2011 à 22h18
versions 3.9, 3.10, 4.x
Summary / Résumé
Returns an HTML-safe version of the input string.
Renvoie une version HTML propre (nettoyée de tout code malicieux) de la chaîne de caractères passée en entrée.
Usage / Utilisation
input|wash( [type] )
Parameters / Paramètres
|
Name Nom | Type | Description |
Required Requis |
|---|---|---|---|
| type |
string Chaîne de caractères |
The type of text that should be washed. Le type de texte à nettoyer |
No Non |
Returns / Renvoie
An HTML-safe version of the input string.
Renvoie une version HTML propre (nettoyée de tout code malicieux) de la chaîne de caractères passée en entrée.
Description
This operator translates the input string into an HTML friendly version. It will take care of converting bogus characters to HTML-friendly replacements. The "type" parameter can be used to specify the washing type, it can be set to either "xhtml" or "email" (the default is "xthml"). E-mail washing can be controlled using the setting of the [WashSettings] configuration block of "template.ini". All strings that may break the HTML should always be washed using this operator.
Cet opérateur traduit la chaîne de caractères passée en entrée en une version HTML correcte. Il prend soin de convertir les faux (ou dangereux) caractères en leur équivalents HTML. Le paramètre optionnel type permet de spécifier le type de nettoyage et peut prendre les valeurs xhtml (valeur par défaut) ou email. Le nettoyage de type email est contrôlé par les paramètres de la section [WashSettings] du fichier de configuration template.ini (ou par l'une de ses surcharges). Toutes les chaînes de caractères risquant de corrompre le code HTML devraient être nettoyées par cet opérateur.
Exemple 1
{'Bogus & stuff <'|wash()}
The following output will be produced: "Bogus & stuff <".
La sortie suivante sera produite: Bogus & stuff <
Exemple 2
{'hello@example.com'|wash( 'email' )}
The following output will be produced:
La sortie suivante sera produite:
hello<span class="spamfilter">SPAMFILTER</span>@example.com
Exemple 3
{'hello@example.com'|wash( 'email' )}
If a configuration override for "template.ini" exists and contains...
Si une surcharge du fichier template.ini existe et contient:
[WashSettings] EmailDotText=[dot] EmailAtText=[at]
...the following output will be produced: "hello[at]example[dot]com".
alors la sortie suivante sera produite: hello[at]example[dot]com














