Markdown::readAllPostInfo PHP Method

readAllPostInfo() private method

读取所有博客的信息
private readAllPostInfo ( $mdfiles, $postPath )
    private function readAllPostInfo($mdfiles, $postPath)
    {
        foreach ($mdfiles as $idx => $fileProp) {
            $fileName = $fileProp['name'];
            //非markdown文件,不处理,直接过滤
            if (!$this->checkFileExt($fileName)) {
                continue;
            }
            $mtime = date("Y-m-d H:i:s", $fileProp['date']);
            $ctime = date("Y-m-d H:i:s", $fileProp['cdate']);
            $serverPath = str_replace("\\", "/", $fileProp['server_path']);
            $relativePath = str_replace($postPath, "", $serverPath);
            $sitePath = $this->changeFileExt($relativePath);
            $siteURL = "blog/" . $this->changeFileExt($relativePath);
            $siteURL = $this->urlencodeFileName($siteURL);
            $blogId = md5($siteURL);
            $siteURL = $this->baseurl . $siteURL;
            $blog = array("blogId" => $blogId, "fileName" => $fileName, "serverPath" => $serverPath, "sitePath" => $sitePath, "mtime" => $mtime, "ctime" => $ctime, "siteURL" => $siteURL);
            //读取自定义博客属性信息
            $blogProp = $this->readPostBaseInfo($serverPath);
            //没有title的博客不处理
            if (empty($blogProp['title'])) {
                continue;
            }
            //草稿状态的不处理
            if ($blogProp['status'] == "draft") {
                continue;
            }
            $btime = strtotime($ctime);
            if (empty($blogProp['date'])) {
                $blogProp['date'] = date("Y-m-d", $btime);
            }
            //按显示日期归档
            $atime = strtotime($blogProp['date']);
            $month = date("Y-m", $atime);
            $yearMonthId = date("Ym", $atime);
            $monthObj = array("id" => $yearMonthId, "name" => $month, "url" => $this->baseurl . "archive/" . $yearMonthId . ".html");
            if (!$this->checkObjInArr($monthObj, "yearMonths")) {
                array_unshift($this->yearMonths, $monthObj);
            }
            $blog = array_merge($blog, $blogProp);
            array_push($this->blogs, $blog);
        }
        $this->sortBlogs($this->blogs, 'date');
        $this->sortYearMonths();
        //缓存全局数据
        $this->globalDataCacheWrite();
    }