API - XOOPS 2.5.11 Beta 2
By monxoops.fr
FilterInput Class Reference
Inheritance diagram for FilterInput:

Public Member Functions

 process ($source)
 

Static Public Member Functions

static getInstance ( $tagsArray=array(), $attrArray=array(), $tagsMethod=0, $attrMethod=0, $xssAuto=1)
 
static clean ($source, $type='string')
 
 cleanVar ($source, $type='string')
 

Protected Member Functions

 __construct ( $tagsArray=array(), $attrArray=array(), $tagsMethod=0, $attrMethod=0, $xssAuto=1)
 
 remove ($source)
 
 filterTags ($source)
 
 filterAttr ($attrSet)
 
 decode ($source)
 

Protected Attributes

 $tagsArray
 
 $attrArray
 
 $tagsMethod
 
 $attrMethod
 
 $xssAuto
 
 $tagBlacklist
 
 $attrBlacklist = array('action', 'background', 'codebase', 'dynsrc', 'lowsrc')
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $tagsArray = array(),
  $attrArray = array(),
  $tagsMethod = 0,
  $attrMethod = 0,
  $xssAuto = 1 
)
protected

Constructor

Parameters
array$tagsArray- list of user-defined tags
array$attrArray- list of user-defined attributes
int$tagsMethod- 0 = allow just user-defined, 1 = allow all but user-defined
int$attrMethod- 0 = allow just user-defined, 1 = allow all but user-defined
int$xssAuto- 0 = only auto clean essentials, 1 = allow clean blacklisted tags/attr

Member Function Documentation

◆ clean()

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

Static method to be called by another php script. Clean the supplied input using the default filter

Parameters
mixed$sourceInput string/array-of-string to be 'cleaned'
string$typeReturn/cleaning type for the variable, one of (INTEGER, FLOAT, BOOLEAN, WORD, ALPHANUM, CMD, BASE64, STRING, ARRAY, PATH, USERNAME, WEBURL, EMAIL, IP)
Returns
mixed 'Cleaned' version of input parameter
Here is the caller graph for this function:

◆ cleanVar()

cleanVar (   $source,
  $type = 'string' 
)
static

Method to be called by another php script. Processes for XSS and specified bad code according to rules supplied when this instance was instantiated.

Parameters
mixed$sourceInput string/array-of-string to be 'cleaned'
string$typeReturn/cleaning type for the variable, one of (INTEGER, FLOAT, BOOLEAN, WORD, ALPHANUM, CMD, BASE64, STRING, ARRAY, PATH, USERNAME, WEBURL, EMAIL, IP)
Returns
mixed 'Cleaned' version of input parameter

◆ decode()

decode (   $source)
protected

Try to convert to plaintext

Parameters
String$sourcestring to decode
Returns
String $source decoded

◆ filterAttr()

filterAttr (   $attrSet)
protected

Internal method to strip a tag of certain attributes

Parameters
array$attrSetattributes
Returns
array $newSet stripped attributes

◆ filterTags()

filterTags (   $source)
protected

Internal method to strip a string of certain tags

Parameters
String$source- input string to be 'cleaned'
Returns
String $source - 'cleaned' version of input parameter

◆ getInstance()

static getInstance (   $tagsArray = array(),
  $attrArray = array(),
  $tagsMethod = 0,
  $attrMethod = 0,
  $xssAuto = 1 
)
static

Returns an input filter object, only creating it if it does not already exist.

This method must be invoked as: $filter = FilterInput::getInstance();

Parameters
array$tagsArraylist of user-defined tags
array$attrArraylist of user-defined attributes
int$tagsMethodWhiteList method = 0, BlackList method = 1
int$attrMethodWhiteList method = 0, BlackList method = 1
int$xssAutoOnly auto clean essentials = 0, Allow clean blacklisted tags/attr = 1
Returns
FilterInput object.

◆ process()

process (   $source)

Method to be called by another php script. Processes for XSS and any specified bad code.

Parameters
mixed$source- input string/array-of-string to be 'cleaned'
Returns
string $source - 'cleaned' version of input parameter

◆ remove()

remove (   $source)
protected

Internal method to iteratively remove all unwanted tags and attributes

Parameters
String$source- input string to be 'cleaned'
Returns
String $source - 'cleaned' version of input parameter

Field Documentation

◆ $attrArray

$attrArray
protected

◆ $attrBlacklist

$attrBlacklist = array('action', 'background', 'codebase', 'dynsrc', 'lowsrc')
protected

◆ $attrMethod

$attrMethod
protected

◆ $tagBlacklist

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

◆ $tagsArray

$tagsArray
protected

◆ $tagsMethod

$tagsMethod
protected

◆ $xssAuto

$xssAuto
protected

The documentation for this class was generated from the following file: