requestString() public static method

Converts given (request) paramter to string
public static requestString ( mixed $value ) : string
$value mixed Value to convert
return string
Ejemplo n.º 1
0
 /**
  * Validates value according to given regular expression
  * Pattern and modifiers must be a valid for PCRE <b>and</b> JavaScript RegExp
  *
  * @param string $path   path to config
  * @param array  $values config values
  * @param string $regex  regular expression to match
  *
  * @return array
  */
 public static function validateByRegex($path, $values, $regex)
 {
     if (!isset($values[$path])) {
         return '';
     }
     $result = preg_match($regex, Util::requestString($values[$path]));
     return array($path => $result ? '' : __('Incorrect value!'));
 }
Ejemplo n.º 2
0
 /**
  * Copy items of an array to $_POST variable
  *
  * @param array  $post_values List of parameters
  * @param string $key         Array key
  *
  * @return void
  */
 private function _fillPostArrayParameters($post_values, $key)
 {
     foreach ($post_values as $v) {
         $v = Util::requestString($v);
         if ($v !== '') {
             $_POST[$key][] = $v;
         }
     }
 }