PHP Class voku\helper\Bootup

this is a bootstrap for the polyfills (iconv / intl / mbstring / normalizer / xml)
ファイルを表示 Open project: voku/portable-utf8 Class Usage Examples

Public Methods

Method Description
filterRequestInputs ( integer $normalization_form = 4, string $leading_combining = '◌' ) filter request inputs
filterRequestUri ( string | null $uri = null, boolean $exit = true ) : mixed Filter current REQUEST_URI .
filterString ( string $s, integer $normalization_form = 4, string $leading_combining = '◌' ) : string Normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed.
get_random_bytes ( integer $length ) : string | false Get random bytes via "random_bytes()" (+ polyfill).
initAll ( ) bootstrap
is_php ( string $version ) : boolean Determines if the current version of PHP is equal to or greater than the supplied value.

Method Details

filterRequestInputs() public static method

Ensures inputs are well formed UTF-8 When not, assumes Windows-1252 and converts to UTF-8 Tests only values, not keys
public static filterRequestInputs ( integer $normalization_form = 4, string $leading_combining = '◌' )
$normalization_form integer
$leading_combining string

filterRequestUri() public static method

Filter current REQUEST_URI .
public static filterRequestUri ( string | null $uri = null, boolean $exit = true ) : mixed
$uri string | null

If null is set, then the server REQUEST_URI will be used.

$exit boolean
return mixed

filterString() public static method

Normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed.
public static filterString ( string $s, integer $normalization_form = 4, string $leading_combining = '◌' ) : string
$s string
$normalization_form integer
$leading_combining string
return string

get_random_bytes() public static method

Get random bytes via "random_bytes()" (+ polyfill).
public static get_random_bytes ( integer $length ) : string | false
$length integer Output length
return string | false false on error

initAll() public static method

bootstrap
public static initAll ( )

is_php() public static method

Determines if the current version of PHP is equal to or greater than the supplied value.
public static is_php ( string $version ) : boolean
$version string
return boolean

Return true if the current version is $version or higher