voku\helper\Bootup::filterRequestInputs PHP Méthode

filterRequestInputs() public static méthode

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
    public static function filterRequestInputs($normalization_form = 4, $leading_combining = '◌')
    {
        $a = array(&$_FILES, &$_ENV, &$_GET, &$_POST, &$_COOKIE, &$_SERVER, &$_REQUEST);
        /** @noinspection ReferenceMismatchInspection */
        foreach ($a[0] as &$r) {
            $a[] = array(&$r['name'], &$r['type']);
        }
        unset($r);
        unset($a[0]);
        $len = count($a) + 1;
        for ($i = 1; $i < $len; ++$i) {
            /** @noinspection ReferenceMismatchInspection */
            foreach ($a[$i] as &$r) {
                /** @noinspection ReferenceMismatchInspection */
                $s = $r;
                // $r is a reference, $s a copy
                if (is_array($s)) {
                    $a[$len++] =& $r;
                } else {
                    $r = self::filterString($s, $normalization_form, $leading_combining);
                }
            }
            unset($r);
            unset($a[$i]);
        }
    }

Usage Example

Exemple #1
0
 /**
  * check for UTF8-Support
  */
 public static function checkForSupport()
 {
     if (!isset(self::$support['mbstring'])) {
         self::$support['mbstring'] = self::mbstring_loaded();
         self::$support['iconv'] = self::iconv_loaded();
         self::$support['intl'] = self::intl_loaded();
         self::$support['pcre_utf8'] = self::pcre_utf8_support();
         Bootup::initAll();
         // Enables the portablity layer and configures PHP for UTF-8
         Bootup::filterRequestUri();
         // Redirects to an UTF-8 encoded URL if it's not already the case
         Bootup::filterRequestInputs();
         // Normalizes HTTP inputs to UTF-8 NFC
     }
 }
All Usage Examples Of voku\helper\Bootup::filterRequestInputs