diff options
Diffstat (limited to 'feed.php')
-rw-r--r-- | feed.php | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -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> |