@param      $key
@param null $default
@param bool $htmlEntities 是否使用htmlspecialchars处理

@return null|string
554235
public function post($key, $default = null, $htmlEntities = false)
    {
        if (!isset($_POST[$key])) {
            return $default;
        }

        return is_null($_POST[$key]) ? $default
            : $this->_escape($_POST[$key], $htmlEntities);
    }
220415
public static function htmlentities($string, $preserve_encoded_entities = false)
    {
        if ($preserve_encoded_entities) {
            // @codeCoverageIgnoreStart
            if (defined('HHVM_VERSION')) {
                $translation_table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
            } else {
                $translation_table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, self::mbInternalEncoding());
            }
            // @codeCoverageIgnoreEnd

            $translation_table[chr(38)] = '&';
            return preg_replace('/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/', '&amp;', strtr($string, $translation_table));
        }

        return htmlentities($string, ENT_QUOTES, self::mbInternalEncoding());
    }
217150
public function get(string $key,string $default=null)
  {
    $keys = explode('.',$key);
    $val = $this->confValues;

    for ($i=0; $i<count($keys); $i++) {
      $val = ( $val[ $keys[$i] ] ?? null);
      if (is_null($val)) break;
    }

    return $val ?? $default;
  }
401114
protected static function htmlentitiesSansTags(&$str, $charsets)
    {
        $return = '';
        $os_oc = 0;
        while (preg_match('#<!--|-->|</?[^>]+>#is', $str, $m_oc, PREG_OFFSET_CAPTURE, $os_oc)) {
            $tag    = $m_oc[0][0];
            $os_tag = $m_oc[0][1];
            $strSegment = substr($str, $os_oc, $os_tag-$os_oc);
            if (!in_array(trim($strSegment), array('', '0'), true)) {
                foreach ($charsets as $charset) {
                    // change: was call_user_func_array
                    $strEntityfied = @htmlentities($strSegment, ENT_COMPAT, $charset);
                    if (!empty($strEntityfied)) {
                        #$debug->log('success with '.$charset);
                        break;
                    }
                }
                if (empty($strEntityfied)) {
                    $strEntityfied = $strSegment;
                }
                $strSegment = preg_replace('/&amp;(#\d+;|[a-zA-Z]+;)/', '&\\1', $strEntityfied);
                $strSegment = str_replace(
                    array_keys(self::$htmlentitiesMore),
                    array_values(self::$htmlentitiesMore),
                    $strSegment
                );
            }
            $return .= $strSegment.$tag;
            $os_oc = $os_tag + strlen($tag);
        }
        $str = substr($str, $os_oc);
        return $return;
    }
410381
public static function data($key=null,$default=null){
    if (null===static::$body){
      $json = (false !== stripos(empty($_SERVER['HTTP_CONTENT_TYPE'])?'':$_SERVER['HTTP_CONTENT_TYPE'],'json'))
           || (false !== stripos(empty($_SERVER['CONTENT_TYPE'])?'':$_SERVER['CONTENT_TYPE'],'json'));
      if ($json) {
        static::$body = json_decode(file_get_contents("php://input"));
      } else {
       if (empty($_POST)) {
          static::$body = file_get_contents("php://input");
        } else {
          static::$body = (object)$_POST;
        }
      }
    }
    return $key ? (isset(static::$body->$key) ? static::$body->$key : (is_callable($default)?call_user_func($default):$default))  : static::$body;
  }
646164
public function getPayload(string $key, $default = null)
    {
        if ($this->payload === null) {
            $contentType = $this->getHeader('Content-Type', '');
            if (!$contentType) {
                $contentType = $this->getHeader('Content-type');
            }

            if ($contentType) {
                $contentTypeParts = preg_split('/\s*[;,]\s*/', $contentType);
                $contentType = $contentTypeParts[0];
                $contentType = strtolower($contentType);
                if (isset($this->bodyParsers[$contentType])) {
                    $parser = $this->bodyParsers[$contentType];
                    $this->payload = $parser($this->body);
                }
            }
        }

        return $this->payload[$key] ?? $default;
    }
1124180
public function htmlEntitiesDecode($flags = ENT_HTML5, string $encoding = 'UTF-8') : Manipulator
    {
        return new static(html_entity_decode($this->string, $flags, $encoding));
    }
948471
public static function getStr(string $key, ?string $default = null): ?string
    {
        $value = ini_get($key);

        return $value === false || $value === '' ? $default : $value;
    }
889702
public static function htmlspecialcharsDeep($data, $ignoreKeys = array(), $flag = ENT_NOQUOTES){
		if(is_array($data)) {
			foreach ($data as $key => $val) {
				if (is_array($val) && !in_array($key, $ignoreKeys)) {
					$data[$key] = htmlspecialcharsDeep($val, $ignoreKeys);
				} else if (!is_array($val)) {
					$data[$key]	= htmlspecialchars($val, $flag);
				}
			}
		} else {
			$data = htmlspecialchars_decode($data, $flag);
			$data = htmlspecialchars($data, $flag);
		}

		return $data;
	}
770260
public static function secureData($data, string $type, bool $htmlentities)
    {
        $currentClass = get_called_class();
        
        if (is_array($data)) {
            foreach ($data as $key => $val) {
                unset($data[$key]);

                $key = $currentClass::secureData($key, gettype($key), true);
                $val = $currentClass::secureData($val, $type, $htmlentities);

                $data[$key] = $val;
            }

            return $data;
        }

        try {
            return $currentClass::secureKnownType($data, $type);
        } catch (Exception $ex) {
            if ($ex->getCode() !== self::ERR_SECURE_KNOWN_TYPE_FILTER_NOT_MANAGED) {
                throw new Exception($ex->getMessage(), $ex->getCode());
            }
            //Else : Use securise like if it's a text type
        }

        return $currentClass::secureUnknownType($data, $type, $htmlentities);
    }
1302872
public function getBodyParam(string $key, $default = null) 
  {
    if (is_array($this->parsedBody) || $this->parsedBody instanceof \ArrayAccess) {
      return $this->parsedBody[$key] ?? $default;
    }

    return $default;
  }
405601
public function defaultRender($entity)
    {
        $joinEntity = $this->getJoinEntity($entity);

        if ($joinEntity === null) {
            return null;
        }

        if ($joinEntity instanceof \Traversable) {
            $html = '';
            foreach ($joinEntity as $e) {
                $html .= '<span class="label label-primary">' . $this->getJoinEntityValue($e) . '</span>&nbsp;';
            }
            return $html;
        }

        return $this->getJoinEntityValue($joinEntity);
    }
1258734
public function header(string $key, $default = null)
  {
    return $this->header->has($key) ? $this->header->get($key) : $default;
  }
45778
public function find($key, $default = null)
    {
        if ($key instanceof Mappable) {
            $key = $this->getEntityKey($key);
        }

        return array_first($this->items, function ($entity, $itemKey) use ($key) {
            return $this->getEntityKey($entity) == $key;
        }, $default);
    }
41326
public static function input($key=null,$default=null){
    return $key ? (isset($_REQUEST[$key]) ? new Structure($_REQUEST[$key]) : (is_callable($default)?call_user_func($default):$default))  : new Structure($_REQUEST[$key]);
  }
854854
public static function html($key, int $ttl = null, array $tags = [])
    {
        if ($content = self::get($key)) {
            echo $content;
            return null;
        }

        ob_start();
        return new HtmlCache(self::getCacheService(), self::key($key), $ttl, $tags);
    }
247634
public static function get($key = null, $default = null)
    {
        // 无参数时获取所有
        if (empty($key)) {
            return self::$_content;
        }

        $key = strtolower($key);
        return Cml::doteToArr($key, self::$_content['normal'], $default);
    }