\FAASanitize

Summary

Methods
Properties
Constants
DataStorageFolder()
ClearMail()
ClearPhone()
IsoDate()
TimeToLocal()
CleanSolrSearch()
HtmlPurifyAvailable()
Html()
AsciiToken()
RelativeFileName()
FileName()
Email()
UnFormattedText()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$purifier
N/A

Properties

$purifier

$purifier :\HTMLPurifier

The html purify framework instance

Type

\HTMLPurifier—The instance

Methods

DataStorageFolder()

DataStorageFolder(string  $path,string  $base_path = FAA_PATHS_DATA_REAL): string

Clear a path

Cleanup path string and make sure it is located inside the data storage

Parameters

string $path

A possible folder or file path

string $base_path

Must be in this folder

Returns

string —

The sanitized path or false when matching failed

ClearMail()

ClearMail(  $num): string|array<mixed,string>

Remove the @ symbol

Parameters

$num

Returns

string|array<mixed,string>

ClearPhone()

ClearPhone(  $num): string|array<mixed,string>

Clear phone number

Parameters

$num

Returns

string|array<mixed,string>

IsoDate()

IsoDate(  $date = 'now'): string|null

Create iso date from utf date

Parameters

$date

Returns

string|null

TimeToLocal()

TimeToLocal(string|integer  $date,mixed|string  $time_zone = FAA_TIMEZONE,string  $format = 'Y-m-d H:i:s T'): string|\DateTime

Local time

Convert a UTC time to local time and return it formatted based on the given value

Parameters

string|integer $date

The UTC source date

mixed|string $time_zone

The time zone e.g. Europe/Berlin

string $format

The target format

Throws

Returns

string|\DateTime —

The formatted date in the locale time zone

CleanSolrSearch()

CleanSolrSearch(string|float|integer  $str): mixed

Escape search server (Solr) string

Escapes all control characters that are potentially used by Solr server

Parameters

string|float|integer $str

The string to escape, ma be a number

Returns

mixed —

The escaped string

HtmlPurifyAvailable()

HtmlPurifyAvailable(): boolean

Check if lib available

Test if the HTML purify library is available

Returns

boolean

Html()

Html(string  $string): string

Clear a html field with letters

Cleanup formatted html using html purifier, will recreate the whole html content thats given as argument

Parameters

string $string

A insecure string

Returns

string —

The sanitized utf8 html string

AsciiToken()

AsciiToken(string  $text,boolean  $clear = false): string

clear a text field with letters cleanup not formatted text using restrictive mode

Parameters

string $text

A insecure string

boolean $clear

When true remove potentially problematic characters

Returns

string —

The sanitized ascii letter string

RelativeFileName()

RelativeFileName(string  $text,boolean  $clear = false): string

clear a relative path cleanup path string and make sure it is has no evil letters

Parameters

string $text

A possible folder or file path

boolean $clear

When true remove potentially problematic characters

Returns

string —

The sanitized path or false when matching failed

FileName()

FileName(string  $text,boolean  $clear = false): string

clear a path cleanup path string and make sure it is has no evil letters

Parameters

string $text

A possible folder or file path

boolean $clear

When true remove potentially problematic characters

Returns

string —

The sanitized path or false when matching failed

Email()

Email(string  $string): string

filter possible email address cleanup path string and make sure its only valid email address content inside

Parameters

string $string

A possible email address

Returns

string —

The sanitized email address or false when matching failed

UnFormattedText()

UnFormattedText(string  $text,boolean  $clear = false): string

clear a text field with letters cleanup not formatted text

Parameters

string $text

A insecure string

boolean $clear

When true remove potentially problematic characters

Returns

string —

The sanitized utf8 string