array ( 'title' => 'xxx', 'content' => 'xxx', 'excerpt' => 'xxx', 'date' => 'xxx', 'link' => 'xxx', 'author' => 'xxx', 'comments' => 'xxx', )
$feeds->setSubTitle($config['description']); $posts = array_slice($context->index[$config['source']], 0, $config['recent']); foreach ($posts as $post) { $post = le_do_workflow('get_post', $config['source'], $post); $item = ['title' => $post['title'], 'link' => $post['permalink'], 'updated' => $post['date'], 'published' => $post['date'], 'author' => isset($config['author']) ? ['name' => $config['author'], 'url' => $config['url']] : NULL, 'content' => $post['content']]; foreach ($context->config['blocks'] as $type => $val) { if (isset($val['source']) && is_string($val['source'])) { continue; } if ('archive' != $type && !empty($post[$type])) { foreach ($post[$type] as $meta) { $item['category'][] = ['feeds_url' => $meta['url'], 'name' => $meta['name']]; } } } $feeds->addItem($item); } $target = $context->dir . '_target/' . $config['target']; $targetDir = dirname($target); if (!is_dir($targetDir)) { if (!mkdir($targetDir, 0755, true)) { le_fatal('feeds directory is not exists "%s"', $targetDir); } } file_put_contents($target, $feeds->generate()); }); // generate sitemap le_add_workflow('generate_sitemap', function () use($context) { $fp = fopen($context->dir . '_target/sitemap.xml', 'wb'); if (!$fp) { le_fatal('can not write sitemap.xml');