对模板变量使用函数
格式 {$varname|function1|function2=arg1,arg2}
@access public
@param string $name 变量名
@param array $varArray  函数列表
@return string
763056
public function parseVarFunction($name,$varArray){
        //对变量使用函数
        $length = count($varArray);
        //取得模板禁止使用函数列表
        $template_deny_funs = explode(',',C('TMPL_DENY_FUNC_LIST'));
        for($i=0;$i<$length ;$i++ ){
            $args = explode('=',$varArray[$i],2);
            //模板函数过滤
            $fun = trim($args[0]);
            switch($fun) {
            case 'default':  // 特殊模板函数
                $name = '(isset('.$name.') && ('.$name.' !== ""))?('.$name.'):'.$args[1];
                break;
            default:  // 通用模板函数
                if(!in_array($fun,$template_deny_funs)){
                    if(isset($args[1])){
                        if(strstr($args[1],'###')){
                            $args[1] = str_replace('###',$name,$args[1]);
                            $name = "$fun($args[1])";
                        }else{
                            $name = "$fun($name,$args[1])";
                        }
                    }else if(!empty($args[0])){
                        $name = "$fun($name)";
                    }
                }
            }
        }
        return $name;
    }
626534
public static function getFunction(string $name)
    {
        return isset(self::$functions[$name]) ? self::$functions[$name] : null;
    }
1138597
protected function getEnvName($name)
    {
        if (is_array($name)) {
            return array_map(array($this, __METHOD__), $name);
        } else {
            $prefix = $this->envVariablePrefix;
            if (!empty($prefix)) {
                $prefix .= '_';
            }

            return strtoupper($prefix . $name);
        }
    }
1350619
public function parseAttr($str, $name, $alias = '')
    {
        $regex  = '/\s+(?>(?P<name>[\w-]+)\s*)=(?>\s*)([\"\'])(?P<value>(?:(?!\\2).)*)\\2/is';
        $result = [];

        if (preg_match_all($regex, $str, $matches)) {
            foreach ($matches['name'] as $key => $val) {
                $result[$val] = $matches['value'][$key];
            }

            if (!isset($this->tags[$name])) {
                // 检测是否存在别名定义
                foreach ($this->tags as $key => $val) {
                    if (isset($val['alias'])) {
                        $array = (array) $val['alias'];
                        if (in_array($name, explode(',', $array[0]))) {
                            $tag           = $val;
                            $type          = !empty($array[1]) ? $array[1] : 'type';
                            $result[$type] = $name;
                            break;
                        }
                    }
                }
            } else {
                $tag = $this->tags[$name];
                // 设置了标签别名
                if (!empty($alias) && isset($tag['alias'])) {
                    $type          = !empty($tag['alias'][1]) ? $tag['alias'][1] : 'type';
                    $result[$type] = $alias;
                }
            }

            if (!empty($tag['must'])) {
                $must = explode(',', $tag['must']);
                foreach ($must as $name) {
                    if (!isset($result[$name])) {
                        throw new Exception('tag attr must:' . $name);
                    }
                }
            }
        } else {
            // 允许直接使用表达式的标签
            if (!empty($this->tags[$name]['expression'])) {
                static $_taglibs;
                if (!isset($_taglibs[$name])) {
                    $_taglibs[$name][0] = strlen($this->tpl->config('taglib_begin_origin') . $name);
                    $_taglibs[$name][1] = strlen($this->tpl->config('taglib_end_origin'));
                }
                $result['expression'] = substr($str, $_taglibs[$name][0], -$_taglibs[$name][1]);
                // 清除自闭合标签尾部/
                $result['expression'] = rtrim($result['expression'], '/');
                $result['expression'] = trim($result['expression']);
            } elseif (empty($this->tags[$name]) || !empty($this->tags[$name]['attr'])) {
                throw new Exception('tag error:' . $name);
            }
        }

        return $result;
    }
939622
public static function getVar($name,$default,$vartype=''){
		switch($vartype){
			case 'post':
				return self::getVarPost($name,$default);
			case 'get':
				return self::getVarGet($name,$default);
			case 'cookie':
				return self::getVarCookie($name,$default);
				}
		$v=self::getVarGet($name,NULL);
		if($v===NULL){
			$v=self::getVarPost($name,NULL);
			}
		if(($v===NULL)||($v===false)){
			return $default;
			}
		return $v;
		}
239105
private function getStringName(array $name) : string
    {
        $names = array_reduce(array_keys($name), function (array $carry, $key) use ($name) : array {
            $carry[] .= $key . '=' . $name[(string) $key];

            return $carry;
        }, []);

        return implode(',', $names);
    }
1102361
public static function getParam($name)
    {
        if ($param = static::getCont()->hasParameter($name)) {
            return static::getCont()->getParameter($name);
        }

        if (strpos($name, '.') !== false) {
            $parts = explode('.', $name, 2);
            $data = static::getCont()->getParameter($parts[0]);
            $data = UtilArray::cascadeGet($data, $parts[1]);
            if ($data) {
                return $data;
            }
        }

        return static::getCont()->getParameter($name);
    }
99514
protected function format($name, array $args = null)
    {
        $result = ['name' => $name];
        if ($args !== null) {
            $result['args'] = $args;
        }

        return $result;
    }
608011
public static function remove($name)
	{
		$names = parseCfgName($name);
		if (isset($names[1]))
		{
			// 删除数据
			$first = array_shift($names);
			$obj = self::getInstance($first);
			return $obj->remove($name);
		}
		else
		{
			// 删除配置分组
			unset(self::$instances['Config'][$name]);
			return true;
		}
	}
1201879
public static function assoc($arr, $name, $type = null)
    {
        $ret = [];
        if (empty($arr)) {
            return $ret;
        }
        if ($type == self::GETTER) {
            $method = 'get' . $name;
            foreach ($arr as $elem) {
                $ret[$elem->$method()] = $elem;
            }
        } elseif ($type == self::OBJ) {
            foreach ($arr as $elem) {
                $ret[$elem->$name] = $elem;
            }
        } else {
            foreach ($arr as $elem) {
                $ret[$elem[$name]] = $elem;
            }
        }
        return $ret;
    }
311998
public function meta(string $name = ''): array
    {
        // 取得查询结果
        $this->disableCache();
        $meta = $this->getMeta($name);

        // 对结果进行修正
        $ret = [];
        foreach ($meta as $field) {
            $name = $field['COLUMN_NAME'];
            $ret[$name] = $this->metaColumns($field);
        }
        return $ret;
    }
932151
public function get($name, $default = false) {
        $value = $this->handler->get($name);
        if (is_null($value)) {
            return $default;
        }
        $jsonData = json_decode($value, true);
        // 检测是否为JSON数据 true 返回JSON解析数组, false返回源数据
        return (null === $jsonData) ? $value : $jsonData;
    }
1319227
public function get($name = '', $prefix = null) {
        $prefix = !is_null($prefix) ? $prefix : $this->prefix;
        if ('' == $name) {
            // 获取全部的session
            $value = $prefix ? (!empty($_SESSION[$prefix]) ? $_SESSION[$prefix] : []) : $_SESSION;
        }
        elseif ($prefix) {
            // 获取session
            if (strpos($name, '.')) {
                list($name1, $name2) = explode('.', $name);
                $value = isset($_SESSION[$prefix][$name1][$name2]) ? $_SESSION[$prefix][$name1][$name2] : null;
            }
            else {
                $value = isset($_SESSION[$prefix][$name]) ? $_SESSION[$prefix][$name] : null;
            }
        }
        else {
            if (strpos($name, '.')) {
                list($name1, $name2) = explode('.', $name);
                $value = isset($_SESSION[$name1][$name2]) ? $_SESSION[$name1][$name2] : null;
            }
            else {
                $value = isset($_SESSION[$name]) ? $_SESSION[$name] : null;
            }
        }
        return $value;
    }
1213077
public function except(array $name) {
        $var = [];
        
        foreach ($this->_requests as $k => $v) {
            if (!in_array($k, $name)) {
                $var[$k] = $v;
            }
        }
        
        return $var;
    }
943838
public function _get_filter_name($function_name)
    {
        if (is_array($function_name)) {
            $_class_name = (is_object($function_name[0]) ?
            get_class($function_name[0]) : $function_name[0]);

            return $_class_name . '_' . $function_name[1];
        } else {
            return $function_name;
        }
    }
566044
public function VarIndexByName( $name )
	{
		foreach ( array_reverse( $this->_slots, true ) as $k => /** @var NameSlot $nameSlot */ $nameSlot )
		{
			// if ( $nameSlot->name == $name->__toString() )
			if ( (string)$nameSlot->name == (string)$name )
			{
				return $nameSlot->id;
			}
		}
		throw XPath2Exception::withErrorCodeAndParam( "XPST0008", Resources::XPST0008, $name->__toString() );

		// for ( $k = count( $this->_slots ) - 1; $k >= 0; $k-- )
		// {
		// 	/** @var NameSlot $nameSlot */
		// 	$nameSlot = $this->_slots[ $k ];
		// 	if ( $nameSlot->name == $name->__toString() )
		// 	{
		// 		return $nameSlot->id;
		// 	}
		// }
		// throw XPath2Exception::withErrorCodeAndParam( "XPST0008", Resources::XPST0008, $name->__toString() );
	}
184322
public function get($name = ''){
            if(false === $var = xcache_get($name)){
                xcache_set($name, $var = parent::get($name));
            }

            return $var;
        }