prefix(); $table = $pico.'_contents'; if (!MyDumpTool::tableExists($table)) { exit('pico('.$pico.') module not found'.PHP_EOL); } MyDumpTool::makeDirectory('public/modules/'.$pico); $moduleHandler = xoops_gethandler('module'); $module = $moduleHandler->getByDirname($pico); $moduleConfigHandler = xoops_gethandler('config'); $moduleConfig = $moduleConfigHandler->getConfigsByDirname($pico); $permObj = PicoPermission::getInstance(); $perms = $permObj->getPermissions($pico); $categoryHandler = new PicoCategoryHandler($pico, $perms); $contentHandler = new PicoContentHandler($pico); $cats = $categoryHandler->getAllCategories(); $confContents = []; $confCategories = []; $dataMap = []; $dataSeq = 1; foreach ($cats as $cat) { $catData = $cat->getData(); $modConfig = $cat->getOverriddenModConfig(); $link = pico_common_make_category_link4html($modConfig, $catData, $pico); MyDumpTool::decode($catData); $confCategories[] = [ 'id' => $catData['id'], 'title' => $catData['cat_title'], 'desc' => (string) $catData['cat_desc'], 'pid' => (int) $catData['pid'], 'weight' => (int) $catData['cat_weight'], 'link' => $link, ]; $contents = $contentHandler->getCategoryContents($cat); foreach ($contents as $content) { $data = $content->getData(); $link = pico_common_make_content_link4html($modConfig, $data); MyDumpTool::decode($data); $url = XOOPS_URL.'/modules/'.$pico.'/'.$link; $content_en = normalizeHtml(MyDumpTool::mlang($data['body_cached'], $url, 'en'), $url); $content_ja = normalizeHtml(MyDumpTool::mlang($data['body_cached'], $url, 'ja'), $url); $item = [ 'id' => $data['id'], 'title' => $data['subject_raw'], 'content' => [ 'en' => $content_en, 'ja' => $content_ja, ], ]; MyDumpTool::saveJson('public/modules/'.$pico.'/'.$data['id'].'.json', $item); $confContents[] = [ 'id' => $item['id'], 'title' => $data['subject_raw'], 'cat_id' => (int) $data['cat_id'], 'weight' => (int) $data['weight'], 'link' => $link, ]; } } $moduleinfo = [ 'name' => $module->get('name'), 'dirname' => $pico, 'message' => $moduleConfig['top_message'], 'show_menuinmoduletop' => (int) $moduleConfig['show_menuinmoduletop'], 'show_listasindex' => (int) $moduleConfig['show_listasindex'], 'show_breadcrumbs' => (int) $moduleConfig['show_breadcrumbs'], 'show_pagenavi' => (int) $moduleConfig['show_pagenavi'], ]; MyDumpTool::decode($moduleinfo); $config = [ 'module' => $moduleinfo, 'categories' => $confCategories, 'contents' => $confContents, ]; MyDumpTool::saveJson('public/modules/'.$pico.'/index.json', $config); }