Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Tout Structures de données Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe InputFilter
+ Graphe d'héritage de InputFilter:

Fonctions membres publiques

 __construct ($tagsArray=array(), $attrArray=array(), $tagsMethod=self::ONLY_ALLOW_DEFINED_TAGS, $attrMethod=self::ONLY_ALLOW_DEFINED_ATTRIBUTES, $xssAuto=1)
 
 clean ($source, $type='string')
 

Fonctions membres publiques statiques

static checkAttribute ($attrSubSet)
 

Champs de données

const TAGS_WHITELIST = 0
 
const TAGS_BLACKLIST = 1
 
const ATTR_WHITELIST = 0
 
const ATTR_BLACKLIST = 1
 
const ONLY_ALLOW_DEFINED_TAGS = 0
 
const ONLY_BLOCK_DEFINED_TAGS = 1
 
const ONLY_ALLOW_DEFINED_ATTRIBUTES = 0
 
const ONLY_BLOCK_DEFINED_ATTRIBUTES = 1
 
 $tagsArray
 
 $attrArray
 
 $tagsMethod
 
 $attrMethod
 
 $xssAuto
 
 $tagBlacklist
 
 $attrBlacklist
 

Fonctions membres protégées

 remove ($source)
 
 cleanTags ($source)
 
 cleanAttributes ($attrSet)
 
 decode ($source)
 
 escapeAttributeValues ($source)
 
 stripCssExpressions ($source)
 

Attributs protégés statiques

static $instances = array()
 

Fonctions membres privées

 cleanInt ($source)
 
 cleanInteger ($source)
 
 cleanUint ($source)
 
 cleanFloat ($source)
 
 cleanDouble ($source)
 
 cleanBool ($source)
 
 cleanBoolean ($source)
 
 cleanWord ($source)
 
 cleanAlnum ($source)
 
 cleanCmd ($source)
 
 cleanBase64 ($source)
 
 cleanString ($source)
 
 cleanHtml ($source)
 
 cleanPath ($source)
 
 pathMatches (&$source, $rootPattern, $pathSeparatorPattern, $filePattern, $pathSeparator)
 
 cleanTrim ($source)
 
 cleanUsername ($source)
 

Attributs privés

 $blockedChars
 

Description détaillée

InputFilter is a class for filtering input from any data source

Forked from the php input filter library by: Daniel Morris dan@r.nosp@m.ootc.nosp@m.ube.c.nosp@m.om Original Contributors: Gianpaolo Racca, Ghislain Picard, Marco Wandschneider, Chris Tobin and Andrew Eddie.

Depuis
1.0

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $tagsArray = array(),
  $attrArray = array(),
  $tagsMethod = self::ONLY_ALLOW_DEFINED_TAGS,
  $attrMethod = self::ONLY_ALLOW_DEFINED_ATTRIBUTES,
  $xssAuto = 1 
)

Constructor for InputFilter class.

Paramètres
array$tagsArrayList of permitted HTML tags
array$attrArrayList of permitted HTML tag attributes
integer$tagsMethodMethod for filtering tags, should be one of the ONLY_*_DEFINED_TAGS constants
integer$attrMethodMethod for filtering attributes, should be one of the ONLY_*_DEFINED_ATTRIBUTES constants
integer$xssAutoOnly auto clean essentials = 0, Allow clean blocked tags/attributes = 1
Depuis
1.0

Références InputFilter\$attrArray, InputFilter\$attrMethod, InputFilter\$tagsArray, InputFilter\$tagsMethod, et InputFilter\$xssAuto.

Documentation des fonctions membres

◆ checkAttribute()

static checkAttribute (   $attrSubSet)
static

Function to determine if contents of an attribute are safe

Paramètres
array$attrSubSetA 2 element array for attribute's name, value
Renvoie
boolean True if bad code is detected
Depuis
1.0

Références ENT_QUOTES.

◆ clean()

clean (   $source,
  $type = 'string' 
)

Cleans the given input source based on the instance configuration and specified data type

Paramètres
string|string[]|object$source Input string/array-of-string/object to be 'cleaned'
string$typeThe return type for the variable: INT: An integer UINT: An unsigned integer FLOAT: A floating point number BOOLEAN: A boolean value WORD: A string containing A-Z or underscores only (not case sensitive) ALNUM: A string containing A-Z or 0-9 only (not case sensitive) CMD: A string containing A-Z, 0-9, underscores, periods or hyphens (not case sensitive) BASE64: A string containing A-Z, 0-9, forward slashes, plus or equals (not case sensitive) STRING: A fully decoded and sanitised string (default) HTML: A sanitised string ARRAY: An array PATH: A sanitised file path TRIM: A string trimmed from normal, non-breaking and multibyte spaces USERNAME: Do not use (use an application specific filter) RAW: The raw string is returned with no filtering unknown: An unknown filter will act like STRING. If the input is an array it will return an array of fully decoded and sanitised strings.
Renvoie
mixed 'Cleaned' version of the $source parameter
Depuis
1.0

Références $key, $type, $value, et InputFilter\cleanString().

◆ cleanAlnum()

cleanAlnum (   $source)
private

Alphanumerical filter

Paramètres
string$sourceThe string to be filtered
Renvoie
string The filtered string

◆ cleanAttributes()

cleanAttributes (   $attrSet)
protected

Internal method to strip a tag of disallowed attributes

Paramètres
array$attrSetArray of attribute pairs to filter
Renvoie
array Filtered array of attribute pairs
Depuis
1.0

Références $count, $i, elseif, et ENT_QUOTES.

Référencé par InputFilter\cleanTags().

◆ cleanBase64()

cleanBase64 (   $source)
private

Base64 filter

Paramètres
string$sourceThe string to be filtered
Renvoie
string The filtered string

◆ cleanBool()

cleanBool (   $source)
private

Boolean filter

Paramètres
string$sourceThe string to be filtered
Renvoie
boolean The filtered value

Référencé par InputFilter\cleanBoolean().

◆ cleanBoolean()

cleanBoolean (   $source)
private

Alias for cleanBool()

Paramètres
string$sourceThe string to be filtered
Renvoie
boolean The filtered value

Références InputFilter\cleanBool().

◆ cleanCmd()

cleanCmd (   $source)
private

Command filter

Paramètres
string$sourceThe string to be filtered
Renvoie
string The filtered string

◆ cleanDouble()

cleanDouble (   $source)
private

Alias for cleanFloat()

Paramètres
string$sourceThe string to be filtered
Renvoie
float The filtered value

Références InputFilter\cleanFloat().

◆ cleanFloat()

cleanFloat (   $source)
private

Float filter

Paramètres
string$sourceThe string to be filtered
Renvoie
float The filtered value

Référencé par InputFilter\cleanDouble().

◆ cleanHtml()

cleanHtml (   $source)
private

HTML filter

Paramètres
string$sourceThe string to be filtered
Renvoie
string The filtered string

◆ cleanInt()

cleanInt (   $source)
private

Integer filter

Paramètres
string$sourceThe string to be filtered
Renvoie
integer The filtered value

Référencé par InputFilter\cleanInteger().

◆ cleanInteger()

cleanInteger (   $source)
private

Alias for cleanInt()

Paramètres
string$sourceThe string to be filtered
Renvoie
integer The filtered value

Références InputFilter\cleanInt().

◆ cleanPath()

cleanPath (   $source)
private

Path filter

Paramètres
string$sourceThe string to be filtered
Renvoie
string The filtered string

Références InputFilter\pathMatches().

◆ cleanString()

cleanString (   $source)
private

String filter

Paramètres
string$sourceThe string to be filtered
Renvoie
string The filtered string

Références InputFilter\decode().

Référencé par InputFilter\clean().

◆ cleanTags()

cleanTags (   $source)
protected

Internal method to strip a string of disallowed tags

Paramètres
string$sourceInput string to be 'cleaned'
Renvoie
string 'Cleaned' version of input parameter
Depuis
1.0

Références $attr, $count, $i, InputFilter\cleanAttributes(), InputFilter\escapeAttributeValues(), et null.

Référencé par InputFilter\remove().

◆ cleanTrim()

cleanTrim (   $source)
private

Trim filter

Paramètres
string$sourceThe string to be filtered
Renvoie
string The filtered string

◆ cleanUint()

cleanUint (   $source)
private

Unsigned integer filter

Paramètres
string$sourceThe string to be filtered
Renvoie
integer The filtered value

◆ cleanUsername()

cleanUsername (   $source)
private

Username filter

Paramètres
string$sourceThe string to be filtered
Renvoie
string The filtered string

◆ cleanWord()

cleanWord (   $source)
private

Word filter

Paramètres
string$sourceThe string to be filtered
Renvoie
string The filtered string

◆ decode()

decode (   $source)
protected

Try to convert to plaintext

Paramètres
string$sourceThe source string.
Renvoie
string Plaintext string
Depuis
1.0
Obsolète:
This method will be removed once support for PHP 5.3 is discontinued.

Références ENT_QUOTES.

Référencé par InputFilter\cleanString().

◆ escapeAttributeValues()

escapeAttributeValues (   $source)
protected

Escape < > and " inside attribute values

Paramètres
string$sourceThe source string.
Renvoie
string Filtered string
Depuis
1.0

Références InputFilter\stripCssExpressions().

Référencé par InputFilter\cleanTags().

◆ pathMatches()

pathMatches ( $source,
  $rootPattern,
  $pathSeparatorPattern,
  $filePattern,
  $pathSeparator 
)
private

Fix a path, if and only if it matches the provided patterns.

If a path matches but is longer than 4095 bytes, it is cleared.

Paramètres
string$sourceThe path as provided; it gets cleaned in place, if possible.
string$rootPatternThe pattern to identify an absolute path (e.g., '/' on Linux, 'C:\' on Windows),
string$pathSeparatorPatternThe pattern for valid path separators
string$filePatternThe pattern for valid file and directory names
string$pathSeparatorThe native path separator
Renvoie
boolean

Référencé par InputFilter\cleanPath().

◆ remove()

remove (   $source)
protected

Internal method to iteratively remove all unwanted tags and attributes

Paramètres
string$sourceInput string to be 'cleaned'
Renvoie
string 'Cleaned' version of input parameter
Depuis
1.0

Références InputFilter\cleanTags().

◆ stripCssExpressions()

stripCssExpressions (   $source)
protected

Remove CSS Expressions in the form of <property>:expression(...)

Paramètres
string$sourceThe source string.
Renvoie
string Filtered string
Depuis
1.0

Référencé par InputFilter\escapeAttributeValues().

Documentation des champs

◆ $attrArray

$attrArray

Référencé par InputFilter\__construct().

◆ $attrBlacklist

$attrBlacklist
Valeur initiale :
= array(
'action',
'background',
'codebase',
'dynsrc',
'formaction',
'lowsrc',
)

◆ $attrMethod

$attrMethod

Référencé par InputFilter\__construct().

◆ $blockedChars

$blockedChars
private
Valeur initiale :
= array(
'&tab;',
'&space;',
'&colon;',
'&column;',
)

◆ $instances

$instances = array()
staticprotected

◆ $tagBlacklist

$tagBlacklist
Valeur initiale :
= array(
'applet',
'body',
'bgsound',
'base',
'basefont',
'canvas',
'embed',
'frame',
'frameset',
'head',
'html',
'id',
'iframe',
'ilayer',
'layer',
'link',
'meta',
'name',
'object',
'script',
'style',
'title',
'xml',
)

◆ $tagsArray

$tagsArray

Référencé par InputFilter\__construct().

◆ $tagsMethod

$tagsMethod

Référencé par InputFilter\__construct().

◆ $xssAuto

$xssAuto

Référencé par InputFilter\__construct().

◆ ATTR_BLACKLIST

const ATTR_BLACKLIST = 1

◆ ATTR_WHITELIST

const ATTR_WHITELIST = 0

◆ ONLY_ALLOW_DEFINED_ATTRIBUTES

const ONLY_ALLOW_DEFINED_ATTRIBUTES = 0

◆ ONLY_ALLOW_DEFINED_TAGS

const ONLY_ALLOW_DEFINED_TAGS = 0

◆ ONLY_BLOCK_DEFINED_ATTRIBUTES

const ONLY_BLOCK_DEFINED_ATTRIBUTES = 1

◆ ONLY_BLOCK_DEFINED_TAGS

const ONLY_BLOCK_DEFINED_TAGS = 1

◆ TAGS_BLACKLIST

const TAGS_BLACKLIST = 1

◆ TAGS_WHITELIST

const TAGS_WHITELIST = 0

La documentation de cette classe a été générée à partir du fichier suivant :