Jeff PHP framework  0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
varFilters.php File Reference

PHP functions used a to work with strings. More...

Go to the source code of this file.

Functions

 cleanInput ($method, $name, $type, $opts=array())
 Sanitize user inputs.
 cleanInputArray ($method, $name, $type=null, $opts=array())
 Sanitize user array inputs.
 cleanVar ($var, $type, $opts=array())
 Clean variables.
 htmlInput ($string)
 Prepares a string which has to be inserted in an input field.
 htmlVar ($string)
 Filters text coming from database before rendering it in the html document.
 jsVar ($string)
 Javascript variable escaping.
 sanitizeHtml ($html)
 Sanitize html content.

Detailed Description

PHP functions used a to work with strings.

Author:
abidibo abidi.nosp@m.bo@g.nosp@m.mail..nosp@m.com
Version:
0.99
Date:
2011-2012

Definition in file varFilters.php.


Function Documentation

cleanInput ( method,
name,
type,
opts = array() 
)

Sanitize user inputs.

Parameters:
string$methodinput method ('get', 'post' or 'request')
string$nameinput name
string$typeinput type ('string', 'int', 'float', 'date', 'datetime', 'email', 'html')
array$optsassociative array of options:
  • escape: bool default true. Whether to escape input for db insertion or not
Returns:
the sanitized input

Definition at line 41 of file varFilters.php.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

cleanInputArray ( method,
name,
type = null,
opts = array() 
)

Sanitize user array inputs.

Parameters:
string$methodinput method ('get', 'post' or 'request')
string$nameinput name
string$typeinput array elements type ('string', 'int', 'float')
array$optsassociative array of options:
  • escape: bool default true. Whether to escape inputs for db insertion or not
Returns:
the sanitized array

Definition at line 110 of file varFilters.php.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

cleanVar ( var,
type,
opts = array() 
)

Clean variables.

Todo:
Not used by now, but should be implemented looking at cleanInput
Parameters:
mixed$varvariable to clean
string$typevariable type
array$optsassociative array of options
Returns:
cleaned var

Definition at line 26 of file varFilters.php.

+ Here is the caller graph for this function:

htmlInput ( string)

Prepares a string which has to be inserted in an input field.

Parameters:
string$stringstring to prepare
Returns:
prepared string

Definition at line 186 of file varFilters.php.

+ Here is the caller graph for this function:

htmlVar ( string)

Filters text coming from database before rendering it in the html document.

Todo:
maybe useful to strip dangerous tags to avoid XSS or similar if the db insertion sanitization process fails
Parameters:
string$stringstring to filter
Returns:
filtered string

Definition at line 176 of file varFilters.php.

+ Here is the caller graph for this function:

jsVar ( string)

Javascript variable escaping.

Escapes strings that has to be used as javascript variables

Parameters:
string$stringstring to escape
Returns:
escaped string

Definition at line 199 of file varFilters.php.

+ Here is the caller graph for this function:

sanitizeHtml ( html)

Sanitize html content.

Todo:
strip dangerous tags if needed, check user privileges or which tags are allowed for the input
Parameters:
string$htmlhtml string
Returns:
the sanitized string

Definition at line 158 of file varFilters.php.