Handymail_Secure

Handymail - Secure class.

This class handles secure form element specific validation & Filtering

package

HandyMail

author

I.G Laghidze developer@firewind.co.uk

Methods

Recursively checks if a submission is alphanumeric.

alphanumeric(string|array $input) : boolean
static
access

private

Arguments

$input

string|array

The submitted field input.

Response

boolean

True if validation passes, false upon failure.

Applies the specified input filters to the supplied input and returns the modified string.

apply_filters(string $input, array $filters) : string
static

Arguments

$input

string

The input string.

$filters

array

An array of filters to be parsed.

Response

string

The modified input string.

Applies the specified validation rules to the input.

apply_validation(string $input, string $id, array &$fields, array $rules) : array
static

Arguments

$input

string

The submitted field input.

$id

string

The field ID.

$fields

array

Reference array of defined field objects.

$rules

array

Array of rules

Response

array

An array of errors. If empty, validation has passed.

Recursively runs escape_html() on the submitted input.

escape_html(string|array $input) : string|array
static
access

private

Arguments

$input

string|array

The submitted field input.

Response

string|array

The filtered field input with escaped html tags.

Recursively checks for forbidden keywords in supplied input.

forbidden(string|array $input, array $keys) : boolean
static

Arguments

$input

string|array

The submitted field input.

$keys

array

An array of forbidden keywords.

Response

boolean

If false, no forbidden keywords found - otherwise returns an array of forbidden keywords (evaluating to boolean true). IMPORTANT that false is good here.

Recursively hashes the submitted input.

hash_input(string|array $input) : string|array
static
access

private

Arguments

$input

string|array

The submitted field input.

Response

string|array

The hashed field input.

Recursively checks if the length of the submission is within the defined limit.

limit(string|array $input, integer $limit) : boolean
static
access

private

Arguments

$input

string|array

The submitted field input.

$limit

integer

The maximum number of permitted characters.

Response

boolean

True if validation passes, false upon failure.

Recursively runs a check to see if submitted inputs match the specified value.

match(string|array $input,  $match) : boolean
static
access

private

Arguments

$input

string|array

The submitted field input.

$match

Response

boolean

True if matched, false upon failure.

Recursively runs nl2br() on the submitted field input. Extremely useful for textarea fields, but runs on all.

nl2br_recursive(string|array $input) : string|array
static
access

private

Arguments

$input

string|array

The submitted field input.

Response

string|array

The modified field input.

Recursively checks if a submission is numeric only.

numeric(string|array $input) : boolean
static
access

private

Arguments

$input

string|array

The submitted field input.

Response

boolean

True if validation passes, false upon failure.

Validation checks if a submission is not empty.

required(string|array $input) : boolean
static
access

private

Arguments

$input

string|array

The submitted field input.

Response

boolean

True if not empty, false if empty.

Recursively runs strip_html on the submitted input.

strip_html(string|array $input) : string|array
static
access

private

Arguments

$input

string|array

The submitted field input.

Response

string|array

The filtered field input with stripped HTML tags.

Recursively trims the submitted input of all whitespace left and right.

trim_input(string|array $input) : string|array
static
access

private

Arguments

$input

string|array

The submitted field input.

Response

string|array

The trimmed field input.

Recursively checks if a submission has a valid email entry.

valid_email(string|array $input) : boolean
static
access

private

Arguments

$input

string|array

The submitted field input.

Response

boolean

True if validation passes, false upon failure.