validator.inc.php
Cloudrexx
Tags
Table of Contents
Functions
- contrexx_strip_tags() : string
- Wrapper for strip_tags() that complies with gpc_magic_quotes
- contrexx_addslashes() : string
- Wrapper for addslashes() that complies with gpc_magic_quotes
- contrexx_stripslashes() : string
- Wrapper for stripslashes() that complies with gpc_magic_quotes
- contrexx_stripslashes_recursive() : mixed
- Processes the argument like {@see contrexx_stripslashes()}, but also handles arrays
- preg_match_replace() : string
- Convenient match-and-replace-in-one function
- checkForSpider() : bool
- Checks whether the request comes from a known spider
- contrexx_raw2xhtml() : mixed
- Encodes raw strings or arrays thereof for use with [X]HTML
- contrexx_input2raw() : mixed
- Unescapes data from any request and returns a raw string or an array thereof.
- contrexx_input2int() : mixed
- Ensures that data from any request is limited to integer values
- contrexx_input2float() : mixed
- Ensures that data from any request is limited to float values
- contrexx_input2db() : mixed
- Unescapes data from any request and adds slashes for insertion into the database
- contrexx_input2xhtml() : mixed
- Unescapes data from any request and encodes it for use with [X]HTML
- contrexx_raw2db() : mixed
- Adds slashes to the given raw string or array thereof for insertion into the database.
- contrexx_raw2xml() : mixed
- Encodes a raw string or array thereof for use with XML
- contrexx_raw2encodedUrl() : mixed
- Encodes a raw string or array thereof for use as a href or src attribute value.
- contrexx_remove_script_tags() : mixed
- Removes script tags and their content from the given string or array thereof
- contrexx_xhtml2raw() : mixed
- Decode [X]HTML entities to raw plaintext string
- contrexx_html2plaintext() : mixed
- Extracts the plaintext out of a html code
Functions
contrexx_strip_tags()
Wrapper for strip_tags() that complies with gpc_magic_quotes
contrexx_strip_tags(string $string) : string
Parameters
- $string : string
Return values
string —$string (cleaned)
contrexx_addslashes()
Wrapper for addslashes() that complies with gpc_magic_quotes
contrexx_addslashes(string $string) : string
Parameters
- $string : string
Return values
string —cleaned
contrexx_stripslashes()
Wrapper for stripslashes() that complies with gpc_magic_quotes
contrexx_stripslashes(string $string) : string
Parameters
- $string : string
Return values
stringcontrexx_stripslashes_recursive()
Processes the argument like {@see contrexx_stripslashes()}, but also handles arrays
contrexx_stripslashes_recursive(mixed $param) : mixed
Recurses down into array parameters and applies contrexx_stripslashes() to any scalar value encountered.
Parameters
- $param : mixed
-
A scalar or array value
Return values
mixed —The parameter with magic slashes removed recursively, if any.
preg_match_replace()
Convenient match-and-replace-in-one function
preg_match_replace(string $pattern, string $replace, string $subject[, array<string|int, mixed> &$subpatterns = null ][, int $limit = -1 ][, int &$count = null ]) : string
Parameters are those of preg_match() and preg_replace() combined.
Parameters
- $pattern : string
-
The regex pattern to match
- $replace : string
-
The replacement string for matches
- $subject : string
-
The string to be matched/replaced on
- $subpatterns : array<string|int, mixed> = null
-
The optional array for the matches found
- $limit : int = -1
-
The optional limit for replacements
- $count : int = null
-
The optional counter for the replacements done
Return values
string —The resulting string
checkForSpider()
Checks whether the request comes from a known spider
checkForSpider() : bool
Return values
boolcontrexx_raw2xhtml()
Encodes raw strings or arrays thereof for use with [X]HTML
contrexx_raw2xhtml(mixed $raw) : mixed
Apply to raw strings and those taken from the database, or arrays of these, before writing the contents to the HTML response stream. Note that arrays may be nested, and all scalar (leaf) elements are treated the same way. Array keys are preserved.
Parameters
- $raw : mixed
-
The raw string or array
Tags
Return values
mixed —The HTML encoded string or array
contrexx_input2raw()
Unescapes data from any request and returns a raw string or an array thereof.
contrexx_input2raw(mixed $input) : mixed
Apply to any string or array taken from a get or post request, or from a cookie.
Parameters
- $input : mixed
-
The input string or array
Return values
mixed —The raw string or array
contrexx_input2int()
Ensures that data from any request is limited to integer values
contrexx_input2int(mixed $input) : mixed
Apply to any string or array taken from a get or post request, or from a cookie.
Parameters
- $input : mixed
-
The input string or array
Tags
Return values
mixed —The integer or array thereof
contrexx_input2float()
Ensures that data from any request is limited to float values
contrexx_input2float(mixed $input) : mixed
Apply to any string or array taken from a get or post request, or from a cookie.
Parameters
- $input : mixed
-
The input string or array
Tags
Return values
mixed —The float or array thereof
contrexx_input2db()
Unescapes data from any request and adds slashes for insertion into the database
contrexx_input2db(mixed $input) : mixed
Apply to any string or array taken from a get or post request, or from a cookie before inserting into the database.
Parameters
- $input : mixed
-
The input string or array
Return values
mixed —The unescaped slashed string or array
contrexx_input2xhtml()
Unescapes data from any request and encodes it for use with [X]HTML
contrexx_input2xhtml(mixed $input) : mixed
Apply to any string or array taken from a get or post request, or from a cookie before writing it to the HTML response stream.
Parameters
- $input : mixed
-
The input string or array
Return values
mixed —The unescaped HTML encoded string or array
contrexx_raw2db()
Adds slashes to the given raw string or array thereof for insertion into the database.
contrexx_raw2db(mixed $raw) : mixed
Parameters
- $raw : mixed
-
The raw string or array
Return values
mixed —The slashed string or array
contrexx_raw2xml()
Encodes a raw string or array thereof for use with XML
contrexx_raw2xml(mixed $raw) : mixed
Apply to raw strings and those taken from the database or arrays thereof before writing to the XML response stream.
Parameters
- $raw : mixed
-
The raw string or array
Return values
mixed —The XML encoded string or array
contrexx_raw2encodedUrl()
Encodes a raw string or array thereof for use as a href or src attribute value.
contrexx_raw2encodedUrl(mixed $source[, bool $encodeDash = false ]) : mixed
Apply to any raw string or array that is to be used as a link or image address in any tag attribute, such as a.href or img.src.
Parameters
- $source : mixed
-
The raw string or array
- $encodeDash : bool = false
-
Encode dashes ('-') if true. Defaults to false
Return values
mixed —The URL encoded string or array
contrexx_remove_script_tags()
Removes script tags and their content from the given string or array thereof
contrexx_remove_script_tags(mixed $raw) : mixed
Parameters
- $raw : mixed
-
The original string or array
Tags
Return values
mixed —The string or array with script tags removed
contrexx_xhtml2raw()
Decode [X]HTML entities to raw plaintext string
contrexx_xhtml2raw(mixed $xhtml) : mixed
Note that arrays may be nested, and all scalar (leaf) elements are treated the same way. Array keys are preserved.
Parameters
- $xhtml : mixed
-
The raw string or array
Tags
Return values
mixed —The raw decoded string or array
contrexx_html2plaintext()
Extracts the plaintext out of a html code
contrexx_html2plaintext(mixed $html) : mixed
Parameters
- $html : mixed
-
The html code as string or an array containing multiple html code strings
Return values
mixed —The plaintext of the provided html code