-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomanche.php
More file actions
50 lines (33 loc) · 1.09 KB
/
comanche.php
File metadata and controls
50 lines (33 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
include('src/Utility.php');
include('src/Site.php');
include('src/Post.php');
$site = new Site();
$post_files = glob("md/*");
foreach ($post_files as $file_name) {
$file_content = Post::readFileContent($file_name);
$post = new Post($file_name, $file_content);
$post->setPostMetadata();
$post->setPostContent();
$post->setPostHtml($site);
$path = 'site/' . $post->file_name . '/index.html';
$post->writeFileContent($path, $post->html);
$site->posts[] = $post;
}
function sortByDate($a, $b) {
if ($a->date == $b->date) {
return 0;
}
return ($a->date > $b->date) ? -1 : 1;
}
uasort($site->posts, 'sortByDate');
$index_posts = array_slice($site->posts, 0, $site->front_page_count);
$site->setIndexHtml($index_posts);
$site->writeFileContent('site/index.html', $site->html);
$site->setArchiveHtml();
$site->writeFileContent('site/archive/index.html', $site->archive_html);
$site->setRssXml();
$site->writeFileContent('site/rss.xml', $site->xml);
$site->setSitemapTxt();
$site->writeFileContent('site/sitemap.txt', $site->sitemap);
$site->cleanSiteFolder();