From 32388b2a376dfe404d911a183b8b5148cf339d95 Mon Sep 17 00:00:00 2001 From: KuJoe Date: Thu, 12 Sep 2024 22:56:11 -0400 Subject: [PATCH] RSS Description config option added Gives the admin the config option to choose to replace the RSS description value with Meta Description instead of Body (default is the current setting of body, if nothing is selected defaults to body). --- lang/en_US.ini | 5 ++++- system/admin/views/config-reading.html.php | 21 ++++++++++++++++++++- system/configList.json | 3 ++- system/includes/functions.php | 16 ++++++++++++---- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/lang/en_US.ini b/lang/en_US.ini index 27ea9045..fbe88a37 100644 --- a/lang/en_US.ini +++ b/lang/en_US.ini @@ -317,4 +317,7 @@ msg_error_field_req_video = "Video field is required." msg_error_field_req_link = "Link field is required." msg_error_field_req_quote = "Quote field is required." msg_error_field_req_audio = "Audio field is required." -msg_error_field_req_feedurl = "You need to specify the feed url." \ No newline at end of file +msg_error_field_req_feedurl = "You need to specify the feed url." +rss_feeds_description_select = "RSS Description" +rss_description_body = "Post Body" +rss_description_meta = "Post Meta Description" diff --git a/system/admin/views/config-reading.html.php b/system/admin/views/config-reading.html.php index df7c157a..64d70973 100644 --- a/system/admin/views/config-reading.html.php +++ b/system/admin/views/config-reading.html.php @@ -27,7 +27,7 @@
- checked> + checked> @@ -134,6 +134,25 @@


+
+ +
+
+
+ checked> + +
+
+ checked> + +
+
+
+
diff --git a/system/configList.json b/system/configList.json index 2aba2d49..a82cc076 100644 --- a/system/configList.json +++ b/system/configList.json @@ -92,5 +92,6 @@ "autosave.enable", "mfa.state", "show.version", - "thumbnail.width" + "thumbnail.width", + "rss.description" ] \ No newline at end of file diff --git a/system/includes/functions.php b/system/includes/functions.php index ef862902..70262040 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -2992,6 +2992,7 @@ function generate_rss($posts, $data = null) $channel = new Channel(); $rssLength = config('rss.char'); $data = $data; + $rssDesc = config('rss.description'); if (is_null($data)) { $channel @@ -3009,12 +3010,19 @@ function generate_rss($posts, $data = null) if ($posts) { foreach ($posts as $p) { $img = get_image($p->body); - if (!empty($rssLength)) { - $body = shorten($p->body, $rssLength); + if ($rssDesc == "meta") { + if (!empty($rssLength)) { + $body = shorten($p->description, $rssLength); + } else { + $body = $p->description; + } } else { - $body = $p->body; + if (!empty($rssLength)) { + $body = shorten($p->body, $rssLength); + } else { + $body = $p->body; + } } - $item = new Item(); $item ->category(strip_tags($p->category));