From deb20fdfca35c64066fe4e375099350dc77ea408 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 22 May 2023 15:18:52 -0500 Subject: initial commit --- _functions/loadRSS.php | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 _functions/loadRSS.php (limited to '_functions/loadRSS.php') diff --git a/_functions/loadRSS.php b/_functions/loadRSS.php new file mode 100644 index 0000000..1deb969 --- /dev/null +++ b/_functions/loadRSS.php @@ -0,0 +1,51 @@ +Blog' . $GLOBALS['fullDomain'] . 'Lorem ipsum dolor sit amet...Copyright 20xx - 20xx, My Nameen-ushttps://cyber.harvard.edu/rss/index.htmlMon, 04 Jan 2021 00:00:00 CST60Blog'.$GLOBALS['fullDomain'].''; + + // Loop through the JSON object + foreach ($data as $postObject) { + // Only load published posts + if ($postObject->published == 'Yes') { + // Parse the markdown to HTML + include_once('_functions/parseMarkdown.php'); + $fileLink = str_replace($GLOBALS['fullDomain'] . '/post/', '', $postObject->link); + $fileName = 'posts/' . $postObject->id . '-' . str_replace('.html', '.md', $fileLink); + $securedHTML = parseMarkdown($fileName); + + if ($rssCounter == 0) { + $rssContents .= '' . date_format(date_create($postObject->created), 'D, d M Y H:i:s T') . ''; + $rssCounter = $rssCounter + 1; + } + + $rssContents .= + '' . + str_replace(['&', '<', '>'], ['&', '<', '>'], $postObject->title) . + '' . + str_replace(['&', '<', '>'], ['&', '<', '>'], $postObject->author) . + '' . + str_replace(['&', '<', '>'], ['&', '<', '>'], $postObject->author) . + '' . + str_replace(['&', '<', '>'], ['&', '<', '>'], $postObject->link) . + '' . + date_format(date_create($postObject->created), 'D, d M Y H:i:s T') . + '' . + str_replace(['&', '<', '>'], ['&', '<', '>'], $postObject->link) . + 'description . + ']]>'; + } + } + $rssContents .= ''; + return $rssContents; +} \ No newline at end of file -- cgit v1.2.3-70-g09d2