private function processSource($sourceInfo) {/*{{{*/ if( empty($sourceInfo['tpl']) || empty($sourceInfo['data']) || empty($sourceInfo['res'])) return false; foreach ($sourceInfo['data'] as $dataName => $dataFiles) { $resDataPath = $this->resPath.$dataName."/"; if (isset($sourceInfo['res']['subset']) && $sourceInfo['res']['subset']) { $resDataPath = $this->resPath.$dataName."_".$sourceInfo['res']['subset']."/"; } XString::clearDir($resDataPath); foreach($dataFiles as $num => $dataFile) { $resData = $this->wrap($sourceInfo['tpl'],$dataFile); $resDataFile = $resDataPath.$num.".".$sourceInfo['res']['extension']; XString::write2file($resData, $resDataFile); $this->myEcho(" 写入 $resDataFile \n"); } } }/*}}}*/
public function generateIndexBySource($className) {/*{{{*/ $configs = BeanFinder::get('configs'); if(isset(self::$classList[$className])) { $tplList = $this->returnTemplatesFromSource($className); foreach ($tplList as $tpl) { $className = str_replace("_".$this->getSuffix($tpl), '', $tpl); $dataPath = $configs->resPath.strtolower($className); $xmlData = "<?xml version='1.0' encoding='$this->charset'?><sddindex>"; if (is_dir($dataPath)) { $handle = opendir($dataPath); while (false !== ($file = readdir($handle))) { if (preg_match('/[0-9]/',$file)) { $xmlData .= '<sdd><loc>'.$configs->baseUrl.$className."/".$file.'</loc><lastmod>'.XDateTime::now().'</lastmod></sdd>'; } } $xmlData .= '</sddindex>'; $file = $dataPath."/index.xml"; XString::write2file($xmlData, $file); closedir($handle); echo "目录文件".$file."生成\n"; } } } }/*}}}*/