LEPTON CMS 7.2.0
feel free to keep it strictly simple...
Loading...
Searching...
No Matches
LEPTON_request Class Reference

Public Member Functions

 setStrictLookInside (string $sNewValue='')
 
 testPostValues (array &$aValueList)
 
 testGetValues (array &$aValueList)
 
 testValues (array &$aValueList)
 
 get_request (string $aName="", string|int|array|float|bool|null $aDefault=null, string $type="", string|array $range="")
 
 filterValue (string|int|array|float|bool|null $return_value, string $type, string|int|array|float|bool|null $aDefault=null, string|array $range="")
 

Static Public Member Functions

static add_slash (string &$sText="")
 
static getRequest (string $sField="")
 
static getPageID ()
 

Data Fields

const USE_POST = "post"
 
const USE_GET = "get"
 
const USE_REQUEST = "request"
 
const USE_SESSION = "session"
 
const USE_SERVER = "server"
 
const ALLOWED_INSIDE
 
bool $error_mode = false
 
string $logFileName = "LEPTON_request.log"
 
string $logFilePath = "/temp/secure/"
 
array $errors = []
 

Static Public Attributes

static $instance
 

Protected Member Functions

 testType (string $name, string $expected, string $getTypeResult)
 
 writeInfoToLogfile (string $sMessage="")
 

Protected Attributes

string $strict_looking_inside = "post"
 

Detailed Description

This file is part of LEPTON Core, released under the GNU GPL Please see LICENSE and COPYING files in your package for details, specially for terms and warranties.

NOTICE:LEPTON CMS Package has several different licenses. Please see the individual license in the header of each single file or info.php of modules and templates.

Author
LEPTON Project

Definition at line 25 of file lepton_request.php.

Member Function Documentation

◆ add_slash()

static add_slash ( string & $sText = "")
static

Definition at line 339 of file lepton_request.php.

◆ filterValue()

filterValue ( string|int|array|float|bool|null $return_value,
string $type,
string|int|array|float|bool|null $aDefault = null,
string|array $range = "" )

LEPTOPN VII.1

Parameters
string | int | array | float | null$return_value
string$type
string | int | array | float | null$aDefault
string | array$range

Definition at line 546 of file lepton_request.php.

◆ get_request()

get_request ( string $aName = "",
string|int|array|float|bool|null $aDefault = null,
string $type = "",
string|array $range = "" )

Public function that looks for a value in the $_POST or $_GET super-variables. If it is found and the type match it is returned. If not, the given default value is returned. There are also optional settings for the situation, the value has to be in a given range, and/or the string has to be a given size.

Parameters
stringname Name of the value/key
mixeddefault (optional) The default of this value
stringtype (optional) The type of the value, see list below
arrayrange (optional) The settings for testing if the value is inside a range.

@retuns mixed the value

NOTICE: the range-settings have no effekt if the default-value is set to null.

Supported types are (quick-, short-, long-notation)

integer Any integer integer+ Any positive integer +0 integer- Any negative integer +0

string Any string string_clean Any string - HTML tags will be removed! string_chars Any String - but tags are converted via htmlspecialchars! string_allowed Any String - HTML tags are removed, exept the given one in "range"!

email Any mail adress array Any array (e.g. from a multible select)

Range got following keys/options

min     the minmium, as for integers the lowest number, as for strings the min. number of chars.
        default: 0;

max     the maximum, as for integers the heights number, as for strings the max. number of chars.
        default: 255;

use     what kind of use if the value is not inside the range, supported types are
        - default   use the given default value (integer, string, null)
        - min       however (value is less or more out of the range) use the min-value.
        - max       however (value is less or more out of the range) use the max-value.
        - near      if the value is less, use the min-value, if it is more, use the max-value.
        - fill      only for strings.
        - cut       only for strings.
                    default: 'default'

char    default: ' 'if #fill is used and the number of chars is less than the min-value,
        the string is 'filled' up with this char.
        default: ' ' (space|blank)

If one of the keys/options is missing, the default-settings are used. NOTICE: the range-settings have no effekt if the default-value is set to null.

Exceptions
Exception

Definition at line 270 of file lepton_request.php.

◆ getPageID()

static getPageID ( )
static

Definition at line 498 of file lepton_request.php.

◆ getRequest()

static getRequest ( string $sField = "")
static

Definition at line 467 of file lepton_request.php.

◆ setStrictLookInside()

setStrictLookInside ( string $sNewValue = '')

Definition at line 91 of file lepton_request.php.

◆ testGetValues()

testGetValues ( array & $aValueList)

Testing a list of values against the $_GET array and returns a linear list of the results. This method is similar to testPostValues

Parameters
arrayAn array with an assoc. subarray for the 'keys' to test for.
// a simple list of values to test agains $_GET
$aLookUp = array(
'page_id' => array('type' => 'integer+', 'default' => null),
'section_id' => array('type' => 'integer+', 'default' => null),
'hello_text' => array('type' => 'string', 'default' => ''),
'content' => array('type' => 'string_chars', 'default' => ""),
'text' => array('type' => 'string_clean', 'default' => ""),
'input' => array('type' => 'string_allowed', 'default' => "", 'range' => array('h1','h2','h3') )
);
Returns
array The results as an assoc. array.

Definition at line 170 of file lepton_request.php.

◆ testPostValues()

testPostValues ( array & $aValueList)

Testing a list of values against the $_POST array and returns a linear list of the results.

Parameters
arrayAn array with an assoc. subarray for the 'keys' to test for.
// a simple list of values to test agains $_POST
$aLookUp = [
'page_id' => ['type' => 'integer+', 'default' => null],
'section_id' => ['type' => 'integer+', 'default' => null],
'hello_text' => ['type' => 'string', 'default' => ''],
'content' => ['type' => 'string_chars', 'default' => ""],
'text' => ['type' => 'string_clean', 'default' => ""],
'input' => ['type' => 'string_allowed', 'default' => "", 'range' =>['h1','h2','h3'] ]
];
Returns
array The results as an assoc. array.

Definition at line 130 of file lepton_request.php.

◆ testType()

testType ( string $name,
string $expected,
string $getTypeResult )
protected

Definition at line 854 of file lepton_request.php.

◆ testValues()

testValues ( array & $aValueList)

Same as above but not force to an entry like e.g. $_GET or $_POST

Parameters
arrayAn array with an assoc. subarray for the 'keys' to test for.
Returns
array The results as an assoc. array.

Definition at line 195 of file lepton_request.php.

◆ writeInfoToLogfile()

writeInfoToLogfile ( string $sMessage = "")
protected

Definition at line 882 of file lepton_request.php.

Field Documentation

◆ $error_mode

bool $error_mode = false

By default we are not collecting any errors

Since
0.1.0 @type bool @default false

Definition at line 63 of file lepton_request.php.

◆ $errors

array $errors = []

Public var that holds the errors in an array.

Since
0.1.0 @type array @default empty array

Definition at line 89 of file lepton_request.php.

◆ $instance

$instance
static

Definition at line 43 of file lepton_request.php.

◆ $logFileName

string $logFileName = "LEPTON_request.log"

The name of the log file of the request errors.

@type string @access public

Definition at line 71 of file lepton_request.php.

◆ $logFilePath

string $logFilePath = "/temp/secure/"

The default path for the (error-) log file.

@type string @access public

Definition at line 79 of file lepton_request.php.

◆ $strict_looking_inside

string $strict_looking_inside = "post"
protected

Public var to handle the way the class should look for the value; supported types are 'post', 'get' or 'request'

@type string @default "post"

Definition at line 53 of file lepton_request.php.

◆ ALLOWED_INSIDE

const ALLOWED_INSIDE

◆ USE_GET

const USE_GET = "get"

Definition at line 30 of file lepton_request.php.

◆ USE_POST

const USE_POST = "post"

Definition at line 29 of file lepton_request.php.

◆ USE_REQUEST

const USE_REQUEST = "request"

Definition at line 31 of file lepton_request.php.

◆ USE_SERVER

const USE_SERVER = "server"

Definition at line 33 of file lepton_request.php.

◆ USE_SESSION

const USE_SESSION = "session"

Definition at line 32 of file lepton_request.php.


The documentation for this class was generated from the following file: