This is an old revision of the document!
Table of Contents
Clean
Layer: Core · Source: lib/core/Clean.php:45 (lines 45–107)
class Clean
Clean class.
LICENSE: The MIT License (MIT)
Copyright © 2014 Detroit Studio s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Usage: If you want to clean simple string use cleanInput() function. $cleanString = Clean::cleanInput($dirtyString); If you want to clean array with various values use cleanArray() function. $cleanArray = Clean::cleanArray($dirtyArray);
Docblock Metadata
^ Tag ^ Value ^ | ''@author'' | Ľuboš Beran | | ''@license'' | MIT | | ''@version'' | 1.2 |
Inheritance
No parent, interface or trait. This is a root type.
Constants (0)
None.
Properties (0)
None declared.
Methods (2)
^ Visibility ^ Method ^ Summary ^ Line ^ | public static | ''cleanInput()'' | Function to escape all possible XSS attacks from string. | 54 | | public static | ''cleanArray()'' | Function to clean multi-dimensional array of posted data. | 98 |
cleanInput()
public static function cleanInput($data, $addslashes = false)
lines 54–88 (35)
Function to escape all possible XSS attacks from string.
^ Parameter ^ Type ^ Default ^ Description ^ | ''$data'' | ''(untyped)'' | //required// | String to escape | | ''$addslashes'' | ''(untyped)'' | ''false'' | If we want to use "addslashes" |
Returns: (none declared) — Clean string
cleanArray()
public static function cleanArray($data = array(), $addslashes = false)
lines 98–106 (9)
Function to clean multi-dimensional array of posted data.
Usage: Clean::cleanArray($_POST); (for example)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$data'' | ''(untyped)'' | ''array()'' | Array to escape | | ''$addslashes'' | ''(untyped)'' | ''false'' | Set true, if you can use addslashes function - extended security |
Returns: (none declared) — array
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
