Ejemplo n.º 1
0
 /**
  * check if data exists in additional data array. if first parameter is null will check if anything has been set yet
  * or if data array is empty. if first parameter is set will check if key exist in additional data array. use second
  * parameter to check for strict value - a value that is not null, not empty and not false. the key can be passed in
  * "." notation to check data in multidimensional array
  *
  * @error 14309
  * @param null|int|string $key expects the optional key to get data for
  * @param bool $strict expects boolean value to check for strict mode
  * @return bool
  */
 public function hasData($key = null, $strict = false)
 {
     if ($key !== null) {
         return xapp_array_isset($this->_data, $key, (bool) $strict) ? true : false;
     } else {
         return !empty($this->_data) ? true : false;
     }
 }
Ejemplo n.º 2
0
 /**
  * checks if the parameter passed in first argument exists in global arrays. if the second argument
  * is set will check only in global array with scope passed in this argument. e.g. "POST" will only
  * check in post array if parameter exists. if second parameter is not set will bubble through all
  * global variables until found in one of them or returns false if not found. the third parameter
  * activates the strict mode to check if value is a value
  *
  * @error 14412
  * @param string $name expects the parameter name
  * @param null|string $from expects optional scope value like "POST"
  * @param bool $strict expects boolean value whether to activate strict value check
  * @return bool
  */
 public function has($name, $from = null, $strict = false)
 {
     if ($from === null) {
         $from = true;
     }
     switch ($from) {
         case self::PARAMS:
             $return = xapp_array_isset($this->_params, $name, $strict);
             if ($return) {
                 return true;
             }
             if ($from !== true) {
                 break;
             }
         case self::RPC:
             if (isset($GLOBALS['_RPC'])) {
                 $return = (bool) $strict ? (bool) (array_key_exists($name, $GLOBALS['_RPC']) && xapp_is_value($GLOBALS['_RPC'][$name])) : array_key_exists($name, $GLOBALS['_RPC']);
             } else {
                 $return = false;
             }
             if ($return) {
                 return true;
             }
             if ($from !== true) {
                 break;
             }
         case self::POST:
             $return = (bool) $strict ? (bool) (array_key_exists($name, $_POST) && xapp_is_value($_POST[$name])) : array_key_exists($name, $_POST);
             if ($return) {
                 return true;
             }
             if ($from !== true) {
                 break;
             }
         case self::GET:
             $return = (bool) $strict ? (bool) (array_key_exists($name, $_GET) && xapp_is_value($_GET[$name])) : array_key_exists($name, $_GET);
             if ($return) {
                 return true;
             }
             if ($from !== true) {
                 break;
             }
         case self::COOKIE:
             $return = (bool) $strict ? (bool) (array_key_exists($name, $_COOKIE) && xapp_is_value($_COOKIE[$name])) : array_key_exists($name, $_COOKIE);
             if ($return) {
                 return true;
             }
             if ($from !== true) {
                 break;
             }
         case self::SERVER:
             $return = (bool) $strict ? (bool) (array_key_exists($name, $_SERVER) && xapp_is_value($_SERVER[$name])) : array_key_exists($name, $_SERVER);
             if ($return) {
                 return true;
             }
             if ($from !== true) {
                 break;
             }
         default:
             return false;
     }
     return false;
 }
Ejemplo n.º 3
0
 /**
  * checks if parameter key exists in data array in strict mode
  *
  * @error 14509
  * @param string $key expects name of parameter
  * @return bool
  */
 public function is($key)
 {
     return xapp_array_isset($this->_data, $key, true);
 }