后台菜单钩子

@param array $data 菜单数组
@return array
519092
public function getManageMenu($data)
    {
        $data['content'] = [
            'name' => hst_lang('hstcms::public.content'),
            'ename' => 'content',
            'icon' => '',
            'url' => '',
            'parent' => 'system',
            'parents' => '',
            'level' => 2,
            'module' => 'hstcms'
        ];
        $data['manageHookIndex'] = [
            'name' => 'Hook',
            'ename' => 'manageHookIndex',
            'icon' => '',
            'url' => 'manageHookIndex',
            'parent' => 'system',
            'parents' => 'tool',
            'level' => 3,
            'module' => 'hstcms'
        ];
        $data['manageSms'] = [
            'name' => hst_lang('hstcms::manage.sms.service'),
            'ename' => 'manageSms',
            'icon' => '',
            'url' => 'manageSms',
            'parent' => 'system',
            'parents' => 'config',
            'level' => 3,
            'module' => 'hstcms'
        ];
        $data['manageAttach'] = [
            'name' => hst_lang('hstcms::manage.attach.service'),
            'ename' => 'manageAttach',
            'icon' => '',
            'url' => 'manageAttach',
            'parent' => 'system',
            'parents' => 'config',
            'level' => 3,
            'module' => 'hstcms'
        ];
        // $data['manageApi'] = [
        //     'name' => hst_lang('hstcms::manage.api.service'),
        //     'ename' => 'manageApi',
        //     'icon' => '',
        //     'url' => 'manageApi',
        //     'parent' => 'system',
        //     'parents' => 'tool',
        //     'level' => 3,
        //     'module' => 'hstcms'
        // ];
        $data['manageModules'] = [
            'name' => hst_lang('hstcms::manage.modules.manage'),
            'ename' => 'manageModules',
            'icon' => '',
            'url' => 'manageModules',
            'parent' => 'system',
            'parents' => 'tool',
            'level' => 3,
            'module' => 'hstcms'
        ];
        $data['manageCaches'] = [
            'name' => hst_lang('hstcms::manage.caches.manage'),
            'ename' => 'manageCaches',
            'icon' => '',
            'url' => 'manageCaches',
            'parent' => 'system',
            'parents' => 'tool',
            'level' => 3,
            'module' => 'hstcms'
        ];

        $data['manageCaptchaIndex'] = [
            'name' => hst_lang('hstcms::captcha.name'),
            'ename' => 'manageCaptchaIndex',
            'icon' => '',
            'url' => 'manageCaptchaIndex',
            'parent' => 'system',
            'parents' => 'config',
            'level' => 3,
            'module' => 'hstcms'
        ];
        $data['manageFormIndex'] = [
            'name' => hst_lang('hstcms::manage.form').hst_lang('hstcms::public.manage'),
            'ename' => 'manageFormIndex',
            'icon' => '',
            'url' => 'manageFormIndex',
            'parent' => 'system',
            'parents' => 'content',
            'level' => 3,
            'module' => 'hstcms'
        ];
        $data['manageSpecialIndex'] = [
            'name' => hst_lang('hstcms::manage.special.manage'),
            'ename' => 'manageSpecialIndex',
            'icon' => '',
            'url' => 'manageSpecialIndex',
            'parent' => 'system',
            'parents' => 'content',
            'level' => 3,
            'module' => 'hstcms'
        ];
        $data['manageAreaIndex'] = [
            'name' => hst_lang('hstcms::manage.area.manage'),
            'ename' => 'manageAreaIndex',
            'icon' => '',
            'url' => 'manageAreaIndex',
            'parent' => 'system',
            'parents' => 'config',
            'level' => 3,
            'module' => 'hstcms'
        ];
        $data['manageBlockIndex'] = [
            'name' => hst_lang('hstcms::manage.block'),
            'ename' => 'manageBlockIndex',
            'icon' => '',
            'url' => 'manageBlockIndex',
            'parent' => 'system',
            'parents' => 'content',
            'level' => 3,
            'module' => 'hstcms'
        ];
        return $data;
    }
1259186
private function recursiveTreeStrip(array $data)
    {
        if (count($data) === 1 && !empty($data[0]['children'])) {
            return $this->recursiveTreeStrip($data[0]['children']);
        }

        return $data;
    }
1010349
static function parseHeader($data)
    {
        $header = array();
        $header[0] = array();
        $meta = &$header[0];
        $parts = explode("\r\n\r\n", $data, 2);

        // parts[0] = HTTP头;
        // parts[1] = HTTP主体，GET请求没有body
        $headerLines = explode("\r\n", $parts[0]);

        // HTTP协议头,方法，路径，协议[RFC-2616 5.1]
        list($meta['method'], $meta['uri'], $meta['protocol']) = explode(' ', $headerLines[0], 3);

        //错误的HTTP请求
        if (empty($meta['method']) or empty($meta['uri']) or empty($meta['protocol']))
        {
            return false;
        }
        unset($headerLines[0]);
        //解析Header
        $header = array_merge($header, self::parseHeaderLine($headerLines));
        return $header;
    }
744103
public static function jsonUnserialize($data) {

		$report = null;

		if (!is_array($data)) {
			$data = (Array) json_decode($data, true);
		}

		if (count(array_intersect(['type', 'message', 'data'], array_keys($data))) == 3) {
			$report = new self($data['type'], $data['message'], $data['data']);
			if (isset($data['children']) && is_array($data['children'])) {
				foreach ($data['children'] as $child) {
					$report->add(static::jsonUnserialize($child));
				}
			}
		}

		return $report;
	}
98831
protected function extractClassData($data)
    {
        $classData = array();
        if (isset($data['class'])) {
            foreach ($data['class'] as $key => $value) {
                $classData['class_'.$key] = $value;
            }
        }
        return $classData;
    }
256982
protected function findLineages($data) {
		if (preg_match_all("/".$this->lineageMatch."/",$data,$matches)) {
			return array_unique($matches[$this->lineageMatchKey]);
		}
		return array();
	}
1283792
protected function asArray($data)
	{
		$array = array();

		if (is_object($data))
		{
			$data = get_object_vars($data);
		}

		foreach ($data as $k => $v)
		{
			if (is_object($v) || is_array($v))
			{
				$array[$k] = $this->asArray($v);
			}
			else
			{
				$array[$k] = $v;
			}
		}

		return $array;
	}
174188
public function parseMulitpartData($data)
    {
        $multipartData = [];
        foreach($data as $name => $contents) {
            $name = strtolower($name);
            if ($name !== 'file') {
                $multipartData[] = [
                    'name' => $name,
                    'contents' => $contents
                ];
            }
        }
        return $multipartData;
    }
303380
protected function parseSet($data) {
        foreach ($data as $key=>$val){
            if(is_array($val) && 'exp' == $val[0]){
                $set[]  =   $this->parseKey($key).'='.$val[1];
            }elseif(is_null($val)){
                $set[]  =   $this->parseKey($key).'=NULL';
            }elseif(is_scalar($val)) {// 过滤非标量数据
                if(0===strpos($val,':') && in_array($val,array_keys($this->bind)) ){
                    $set[]  =   $this->parseKey($key).'='.$this->escapeString($val);
                }else{
                    $name   =   count($this->bind);
                    $set[]  =   $this->parseKey($key).'=:'.$name;
                    $this->bindParam($name,$val);
                }
            }
        }
        return ' SET '.implode(',',$set);
    }
1268796
public function getChartData(array $data = []) : array
    {
        $chartData = parent::getChartData($data);

        $chartData["options"]["dataChart"]["type"] = $this->type;

        return $chartData;
    }
50817
private function parseSockData($data)
    {
        $return = [];

        $lines = (array) explode("\n", trim($data));

        foreach ($lines as $line) {
            if (preg_match('/(\w+)\s*:\s*([-+]?[\d\.]+)/i', $line, $match) == 1) {
                $return[] = array(
                    'path' => 'N/A',
                    'name' => $match[1],
                    'temp' => $match[2],
                    'unit' => '', // TODO
                );
            }
        }

        return $return;
    }
563252
public function transform($data)
    {
        $output = $data;
        if (is_array($data)) {
            $output = "<ul>";
            foreach ($data as $item) {
                $output .= "<li>" . $this->transform($item) . "</li>";
            }
            $output .= "</ul>";
        }

        return $output;
    }
313110
protected function arrayDotKeysFlattern(array $data)
    {
        foreach ($data as $name => $values) {
            if ($this->isIterable($values)) {
                foreach ($values as $key => $key_value) {
                    $data["$name.$key"] = $values[$key];
                }
                unset($data[$name]);
            }
        }
        return $data;
    }
391893
public function readFromArray(array $data) : array
    {
        foreach($data as $key => $value)
        {
            if (is_string($value)){
                $value = $this->macro_processor->process($value);
                $data[$key] = $value;
            }
            else if(is_array($value)){
                $data[$key] = $this->readFromArray($value);
            }
        }
        return $data;
    }
310102
public function toArray(array $data = [])
    {
        return array_filter(array_merge([
            'start' => $this->start,
            'range' => $this->range,
            'sort' => $this->sort,
            'sortDir' => $this->sortDirection,
            'search' => $this->search,
            'searchNotes' => $this->searchNotes,
            'condition' => $this->condition ? json_encode($this->condition) : null
        ], $data), function ($value) {
            return $value !== null;
        });
    }
919715
public function find($data = null)
    {
        $key = '';
        if ($data instanceof MongoQuery) {
            return $data->find();
        } elseif ($data instanceof \Closure) {
            call_user_func_array($data, [ & $this]);
            $data = null;
        }
        // 分析查询表达式
        $options = $this->parseExpress();
        $pk      = $this->getPk();
        if (!is_null($data)) {
            // AR模式分析主键条件
            $this->parsePkWhere($data, $options);
        } elseif (!empty($options['cache']) && true === $options['cache']['key'] && is_string($pk) && isset($options['where']['$and'][$pk])) {
            $key = $this->getCacheKey($options['where']['$and'][$pk], $options);
        }

        $options['limit'] = 1;

        // 生成查询SQL
        $query = $this->builder->select($options);
        if (is_string($pk)) {
            if (!is_array($data)) {
                if (isset($key) && strpos($key, '|')) {
                    list($a, $val) = explode('|', $key);
                    unset($a);
                    $item[$pk]     = $val;
                } else {
                    $item[$pk] = $data;
                }
                $data = $item;
            }
        }
        $options['data'] = $data;
        // 事件回调
        if ($result = $this->trigger('before_find', $options)) {
        } else {
            // 执行查询
            $readPreference = isset($options['readPreference']) ? $options['readPreference'] : null;
            $resultSet      = $this->query($options['table'], $query, $readPreference, $options['fetch_cursor'], $options['typeMap']);

            if ($resultSet instanceof Cursor) {
                // 返回MongoDB\Driver\Cursor对象
                return $resultSet;
            }
            $result = isset($resultSet[0]) ? $resultSet[0] : null;
        }
        return $result;
    }
113026
public function process(array $data)
    {
        $processedData = [
            'meta' => Hash::get($data, 'meta'),
            'data' => []
        ];
        $processedData['meta']['type'] = 'Module';
        $processedData['meta']['title'] = $this->name();
        unset($data['meta']);
        foreach ($data as $attr => $value) {
            $processedData['data'][$attr] = $value;
        }
        return $processedData;
    }