参数数组转换成指定加密格式字符串

@param $param
@return string
351316
public static function setParams(&$param)
    {
        $arr_req = array();
        foreach($param as $key=>$value){
            if(is_array($value)) {
                $arr_req[] = "${key}=".implode("&",$value);
            } else {
                if ($value == '') {
                    continue;
                }
                $arr_req[] = "${key}=${value}";
            }
        }
        $str = implode("&",$arr_req);

        return $str;
    }
983318
protected function _buildDataAttrs(array $param = array())
    {
        $return = '';
        foreach ($param as $data => $val) {
            $dKey = 'data-' . trim($data);

            if (is_object($val)) {
                $val = (array) $val;
            }

            if (is_array($val)) {
                $val = str_replace('"', '\'', json_encode($val));
                $return .= $this->_buildAttr($dKey, $val);
                continue;
            }

            $return .= $this->_buildAttr($dKey, $val);
        }

        return $return;
    }
188594
public function find($param = null)
    {
        $bindParam = [];
        $where = '';
        if (is_array($param)) { //如果where是数组，则拼装where sql
            foreach ($param as $key => $value) {
                if (is_int($key)) {  //如果下标是数字，则不用下标拼装sql
                    $where .= $value . ' AND ';
                } else {
                    $where .= "$key=:$key AND ";
                    $bindParam[':' . $key] = $value;
                }
            }
            $where = 'WHERE ' . substr($where, 0, -4);
        } else { //如果$param是字符串 加 WHERE
            $where = empty($param) ? '': 'WHERE ' . $param;
        }
        $this->sql = "SELECT {$this->_fields} FROM {$this->_table} $where limit 1";
        $stmt = $this->execute($bindParam);
        return $stmt->fetch(\PDO::FETCH_ASSOC);
    }
85637
protected static function compileVar($param)
    {
        $result = '<<<<{var} error!!!>>>>';
        if (!empty($param)) {
            $parameters = self::parseParameters($param);
            if (isset($parameters['from'])) {
                $result = "<?php echo {$parameters['from']};?>";
                if (0 == strncasecmp('$this->widget[', $parameters['from'], 14)) {
                    $widget = substr($parameters['from'], 15, strpos($parameters['from'], ']') - 16);
                    unset($parameters['from']);
                    $result = self::initWidgetParameters($widget, $parameters) . $result;
                }
            }
        }

        return $result;
    }
1175758
public function route($param = null)
    {
        $route = call_user_func($this->getRouteResolver());

        if (is_null($route) || is_null($param)) {
            return $route;
        } else {
            return $route->parameter($param);
        }
    }
431423
private function initCommand($param)
    {
        if (!preg_match('/^[a-z]+:[a-z]+$/', $param)) {
            $this->options['command'] = $param;

            return;
        }
        
        $part = explode(':', $param);

        $this->options['command'] = $part[0];

        $this->options['action'] = $part[1];
    }
55829
private static Object getParam(final Object param) {
		final StringBuilder sb = new StringBuilder();
		if(param instanceof String){
			sb.append("'");
			sb.append((String)param);
			sb.append("'");
		}
		else if(param instanceof Boolean){
			sb.append(String.valueOf((Boolean)param));			
		}
        else if(param instanceof Integer){
            sb.append(String.valueOf((Integer)param));
        }
        else if(param instanceof DBRegExp){
            sb.append('/');
            sb.append(((DBRegExp) param).toString());
            sb.append('/');
        }
		
		return sb.toString();
	}
195616
protected static function compilePaging($param)
    {
        $parameters = self::parseParameters($param);
        $result = '';
        if (!empty($parameters['template']))
            $result .= "\$this->pagination->setTemplate(\$this->render('{$parameters['template']}'));\n?>";
        $link = 'null';
        if (!empty($parameters['link'])) {
            if ('$' != $parameters['link']{0})
                $parameters['link'] = '\'' . $parameters['link'] . '\'';
            $link = $parameters['link'];
        }
        $page = !empty($parameters['page']) ? $parameters['page'] : 'null';
        $total = !empty($parameters['total']) ? $parameters['total'] : 'null';
        $size = !empty($parameters['size']) ? $parameters['size'] : 'null';
        $result .= "<?php echo \$this->pagination->render({$link}, {$page}, {$total}, {$size});\n?>";

        return $result;
    }
432681
public function get($param) {
        global $CFG, $USER;
        $this->cleanup($this->ttl);
        $filename = 'u'.$USER->id.'_'.md5(serialize($param));
        if(file_exists($this->dir.$filename)) {
            $lasttime = filemtime($this->dir.$filename);
            if (time()-$lasttime > $this->ttl) {
                return false;
            } else {
                $fp = fopen($this->dir.$filename, 'r');
                $size = filesize($this->dir.$filename);
                $content = fread($fp, $size);
                return unserialize($content);
            }
        }
        return false;
    }
916459
private function paramCommentsAlign($param, $previousParam)
	{
		$paramLength = strlen($param['type']) + $param['type_space'] + strlen($param['var']) + $param['var_space'];
		$prevLength  = strlen($previousParam['type']) + $previousParam['type_space'] + strlen($previousParam['var']) + $previousParam['var_space'];

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

		return $paramStringLength === $previousParamStringLength;
	}
1051436
public static function title($param = null)
    {

        if (is_integer($param)) {
            $param = array(
                'amount' => $param
            );
        }

        if (!is_array($param)) {
            $param = array();
        }

        $defParam = array(
            'amount' => 30,
            'what' => 'bytes',
            'start' => 'yes',
            'lang' => 'en'
        );

        $param = array_merge($defParam, $param);

        $json = Utils::getJSON('http://json-lipsum.appspot.com/?' . http_build_query($param));

        if (isset($json->lipsum)) {
            return $json->lipsum;
        } else {
            return 'Error Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
        }

    }
1047618
public static function get_config_param( $id, $param ) {
		if ( ! isset( self::$config[ $id ] ) || ! isset( self::$config[ $id ][ $param ] ) ) {
			return '';
		}
		return self::$config[ $id ][ $param ];
	}
1273020
public static function getParameter($param)
    {
        $lexer = new Lexer('(' . $param . ')');

        // A dummy parser is used for error reporting.
        $param = ParameterDefinition::parse(new Parser(), $lexer->list);

        if (empty($param[0])) {
            return [
                '',
                '',
                '',
                '',
                '',
            ];
        }

        $param = $param[0];

        $options = [];
        foreach ($param->type->options->options as $opt) {
            $options[] = is_string($opt) ? $opt : $opt['value'];
        }

        return [
            empty($param->inOut) ? '' : $param->inOut,
            $param->name,
            $param->type->name,
            implode(',', $param->type->parameters),
            implode(' ', $options),
        ];
    }
45410
protected static function compileInclude($param)
    {
        $result = '<<<<{include} error!!!>>>>';
        $parameters = self::parseParameters($param);
        if (isset($parameters['file'])) {
            if ('$' != $parameters['file']{0})
                $parameters['file'] = '\'' . $parameters['file'] . '\'';
            $result = "<?php \$this->display({$parameters['file']});?>";
        }

        return $result;
    }
699807
public function init($param)
    {

        if (empty($param)) return false;

        $this->header = '';

        $param_list = new ParamList();
        foreach ($param as $key => $value) {
            if (property_exists($this, $key)) $this->$key = $value;
            elseif (property_exists($param_list, strtolower(str_replace('-', '_', $key)))) {
                if (is_string($value)) {
                    $this->header[] = new SingleParam($key, $value);
                } elseif (is_array($value)) {
                    $this->header[] = new MultiParam($key, $value);
                }
            }

        }


        return true;
    }
1087910
public function param($param, $help, $required = false)
    {
        $options = array();

        $options['name'] = $param;
        if ($required) {
            $options['help'] = '<' . $param . '> ' . $help;
            $options['required'] = true;
        } else {
            $options['help'] = '[' . $param . '] ' . $help;
            $options['required'] = false;
        }

        $this->setParam($options);
    }