summaryrefslogtreecommitdiff
path: root/feed.php
diff options
context:
space:
mode:
Diffstat (limited to 'feed.php')
-rw-r--r--feed.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/feed.php b/feed.php
index c8f51ef..f76377c 100644
--- a/feed.php
+++ b/feed.php
@@ -12,16 +12,14 @@
<link>https://www.53hor.net</link>
</image>
<?php
- if ($posts = glob('./posts/*.php')) {
- $early = true;
+ $posts = scandir('./posts', SCANDIR_SORT_DESCENDING);
+ $posts = array_filter($posts, fn ($post) => !empty($post) && $post != '.' && $post != '..');
- foreach (array_reverse($posts) as $post) {
- if (!empty($post) && $post != '.' && $post != '..') {
- $post_name = explode('/', $post)[2];
- include($post);
- printf('<item><link>https://www.53hor.net/posts/%s</link><title>%s</title></item>', $post_name, $title);
- }
- }
+ foreach ($posts as &$post) {
+ $title = str_replace('<h1>', '', fgets(fopen("./posts/$post", 'r')));
+ $title = str_replace('</h1>', '', $title);
+ $post = str_replace('.php', '', $post);
+ printf('<item><link>https://www.53hor.net/posts/%s</link><title>%s</title></item>', $post, $title);
}
?>
</channel>