除去数组中的空值和签名参数

@param $para 签名参数组
return 去掉空值与签名参数后的新签名参数组
3649
public static function paraFilter($para)
    {
        $para_filter = array();
        while (list ($key, $val) = each($para)) {
            if (strtolower(trim($key)) === "sign" || trim($val) === "")
                continue;
            else
                $para_filter[$key] = $para[$key];
        }
        return $para_filter;
    }
1177989
public function getSignVeryfy($para_temp, $sign) {
        //除去待签名参数数组中的空值和签名参数
        $para_filter = HelperFunction::paraFilter($para_temp);

        //对待签名参数数组排序
        $para_sort   = HelperFunction::argSort($para_filter);

        //把数组所有元素，按照“参数=参数值”的模式用“&”字符拼接成字符串
        $prestr = HelperFunction::createLinkstring($para_sort);

        $isSgin = false;
        switch (strtoupper(trim($this->sign_type))) {
            case "MD5" :
                $isSgin = HelperFunction::md5Verify($prestr, $sign, $this->key);
                break;
            default :
                $isSgin = false;
        }

        return $isSgin;
    }
1130675
public function getQueryString(array $new_params = [])
    {
        $params = $_GET;
        if (!empty($this->input)) {
            $params[$this->getKey()] = $this->input;
        }
        if (!empty($new_params)) {
            if (empty($params[$this->getKey()])) {
                $params[$this->getKey()] = [];
            }
            foreach ($new_params as $key => $value) {
                $params[$this->getKey()][$key] = $value;
            }
        }
        return http_build_query($params);
    }
408381
public static function getCanonicalQueryString(array $parameters)
    {
        //没有参数，直接返回空串
        if (count($parameters) == 0) {
            return '';
        }

        $parameterStrings = array();
        foreach ($parameters as $k => $v) {
            //跳过Authorization字段
            if (strcasecmp('Authorization', $k) == 0) {
                continue;
            }
            if (!isset($k)) {
                throw new \InvalidArgumentException(
                    "parameter key should not be null"
                );
            }
            if (isset($v)) {
                //对于有值的，编码后放在=号两边
                $parameterStrings[] = AipHttpUtil::urlEncode($k)
                    . '=' . AipHttpUtil::urlEncode((string) $v);
            } else {
                //对于没有值的，只将key编码后放在=号的左边，右边留空
                $parameterStrings[] = AipHttpUtil::urlEncode($k) . '=';
            }
        }
        //按照字典序排序
        sort($parameterStrings);

        //使用'&'符号连接它们
        return implode('&', $parameterStrings);
    }
255921
private static function signString($params)
	{

		if( is_string($params) ) {
			return $params;
		}
		//拼原String
		$newparams = array();
		//保留需要参与签名的属性
		foreach ( $params as $key => $value ) {
			if ( !isset(self::$unSignKeyList[$key]) ) {
				$newparams[] = $value;
			}
		}
		return json_encode($newparams ,JSON_UNESCAPED_UNICODE);
	}
432833
function put($params)
    {
        if(isset($params['put']))
        {
            Error::info('SelectDB Error!','Params put() cannot call put()!');
        }
        //处理where条件
        if (isset($params['where']))
        {
            $wheres = $params['where'];
            if (is_array($wheres))
            {
                foreach ($wheres as $where)
                {
                    $this->_where($where);
                }
            }
            else
            {
                $this->_where($wheres);
            }
            unset($params['where']);
        }
        //处理orwhere条件
        if(isset($params['orwhere']))
        {
            $orwheres = $params['orwhere'];
            if(is_array($orwheres)) foreach($orwheres as $orwhere) $this->orwhere($orwhere);
            else $this->$orwheres($orwheres);
            unset($params['orwhere']);
        }
        //处理walk调用
        if (isset($params['walk']))
        {
            foreach($params['walk'] as $call)
            {
                list($key, $value) = each($call);
                if (strpos($key, '_') !== 0)
                {
                    $this->_call($key, $value);
                }
                else
                {
                    $this->extraParmas[substr($key, 1)] = $value;
                }
            }
            unset($params['walk']);
        }
        //处理其他参数
        foreach ($params as $key => $value)
        {
            if (strpos($key, '_') !== 0)
            {
                $this->_call($key, $value);
            }
            else
            {
                $this->extraParmas[substr($key, 1)] = $value;
            }
        }
    }
473588
function _check(&$data, $param)
    {
        foreach ($param as $k => $p)
        {
            if (!isset($data[$k]))
            {
                if (isset($p['require']) and $p['require'])
                {
                    self::raise('param require');
                }
                else
                {
                    continue;
                }
            }

            if (isset($p['type']))
            {
                $data[$k] = Validate::$p['type']($data[$k]);
                if ($data[$k] === false)
                {
                    self::raise();
                }

                //最小值参数
                if (isset($p['min']) and is_numeric($data[$k]) and $data[$k] < $p['min'])
                {
                    self::raise('num too small');
                }
                //最大值参数
                if (isset($p['max']) and is_numeric($data[$k]) and $data[$k] > $p['max'])
                {
                    self::raise('num too big');
                }

                //最小值参数
                if (isset($p['short']) and is_string($data[$k]) and mb_strlen($data[$k]) < $p['short'])
                {
                    self::raise('string too short');
                }
                //最大值参数
                if (isset($p['long']) and is_string($data[$k]) and mb_strlen($data[$k]) > $p['long'])
                {
                    self::raise('string too long');
                }

                //自定义的正则表达式
                if ($p['type'] == 'regx' and isset($p['regx']) and preg_match($p['regx'], $data[$k]) === false)
                {
                    self::raise();
                }
            }
        }
        //如果为拒绝模式，所有不在过滤参数$param中的键值都将被删除
        if ($this->mode == 'deny')
        {
            $allow = array_keys($param);
            $have = array_keys($data);
            foreach ($have as $ha)
            {
                if (!in_array($ha, $allow))
                {
                    unset($data[$ha]);
                }
            }
        }
    }
370670
private function buildRequestParameters($parameters)
    {
        if (NULL === $parameters || empty($parameters)) {
            return null;
        }

        if (is_string($parameters)) {
            return $parameters;
        }

        $paramOut = '';
        foreach ($parameters as $key=>$value) {
            $paramOut .= $key.'=';
            if (is_array($value)){
                $paramOut .= join(',', $value);
            }else{
                $paramOut .= $value;
            }
            $paramOut .= '&';
        }

        return $paramOut;
    }
1065496
private function paramVarsAlign($param, $previousParam)
	{
		$paramStringLength         = strlen($param['type']) + $param['type_space'];
		$previousParamStringLength = strlen($previousParam['type']) + $previousParam['type_space'];

		return $paramStringLength === $previousParamStringLength;
	}
337309
public function getParam($param = null)
    {
        if (null === $param) {
            return $this->_params;
        }

        return isset($this->_params[$param]) ? $this->_params[$param] : null;
    }
1194760
public function rename($params, $optParams = [])
    {
        return $this->sendRequest(['cloudId', 'publicId', 'newPublicId'], [
            'restAction' => 'update',
            'uri' => '/c/<cloudId>/o/<publicId>/rename/o/<newPublicId>',
            'params' => $params,
            'getParams' => $optParams,
        ], function ($response) use ($params) {
            if ($response->data && !isset($response->data['cloudId'])) {
                $response->data['cloudId'] = $this->client->getParam($params, 'cloudId');
            }

            return isset($response->data) ? new Image($response->data) : $response;
        });
    }
332131
public function formPost($url, $para, $method, $charset)
    {
        //待请求参数数组
        $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='".$url."' method='".$method."'>";
        while (list ($key, $val) = each ($para)) {
            $sHtml.= "<input type='hidden' name='".$key."' value='".$val."'/>";
        }

        //submit按钮控件请不要含有name属性
        $sHtml = $sHtml."<input type='submit' value='确认'></form>";

        $sHtml = $sHtml."<script>document.forms['alipaysubmit'].submit();</script>";

        return $sHtml;
    }
1038047
protected function namedParams(&$query, &$params)
    {
        if (!is_array($params)) {
            return;
        }

        $pattern = "a-zA-Z0-9_";

        if (!preg_match("/\?([" . $pattern . "]+)/", $query)) {
            return;
        }

        $oldParams = $params;
        $params = [];

        reset($oldParams);
        $this->modifyQuery($query, function($part) use(&$params, &$oldParams, $pattern) {
            return preg_replace_callback("/\?([" . $pattern . "]*)([^" . $pattern . "]|$)/", function($match) use(&$params, &$oldParams) {
                if ($key = $match[1]) {
                    $params[] = $oldParams[$key];
                } else {
                    $params[] = current($oldParams);
                    next($oldParams);
                }
                return "?" . $match[2];
            }, $part);
        });
    }
507968
public static function paraFilter($para, $isNew=false)
    {
        if (!$isNew) {
            unset($para['sign_type']);
        }
        $para_filter = array();
        while (list ($key, $val) = each ($para)) {
            if($key == "sign" || $val == "") {
                continue;
            } else {
                $para_filter[$key] = $para[$key];
            }
        }

        return $para_filter;
    }
168867
public static function buildQueryStr($params) {
        $arrTmp = array();
        foreach ($params as $k => $v){
            //参数为空不参与签名
            if(isset($v) && $v != ''){
                array_push($arrTmp, "$k=$v");
            }
        }
        return implode('&', $arrTmp);
    }
159164
public function paraFilter($para) 
    {
        $para_filter = array();
        foreach ($para as $key => $val) {
            if($key == "sign" || $key == "sign_type" || $val == "") continue;
            else    $para_filter[$key] = $para[$key];
        }
        return $para_filter;
    }
511907
public function popParam($name) {
		$v = NULL;
		if(isset($this->payload['params'][$name])) {
			$v = $this->payload['params'][$name];
		}
		unset($this->payload['params'][$name]);
		return $v;
	}