Jeremy Newman : add announcement image to news posts in RSS

Jeremy Newman jnewman at wine.codeweavers.com
Fri Nov 21 13:03:30 CST 2014


Module: website
Branch: master
Commit: 01c47b79b720bd60578b58f347b970e817805416
URL:    http://source.winehq.org/git/website.git/?a=commit;h=01c47b79b720bd60578b58f347b970e817805416

Author: Jeremy Newman <jnewman at codeweavers.com>
Date:   Fri Nov 21 13:01:38 2014 -0600

add announcement image to news posts in RSS

---

 include/plugins/news.php              | 14 +++++++-------
 templates/global/xml/rss.template     | 10 +++++-----
 templates/global/xml/rss_row.template |  7 ++++++-
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/include/plugins/news.php b/include/plugins/news.php
index b8c4da8..aae63d2 100644
--- a/include/plugins/news.php
+++ b/include/plugins/news.php
@@ -30,10 +30,10 @@ switch (true)
         switch ($ogmode)
         {
             case 'wwn':
-                $html->meta_og['image'] = "http://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-world-wine-news.png";
+                $html->meta_og['image'] = "https://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-world-wine-news.png";
                 break;
             default:
-                $html->meta_og['image'] = "http://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-announcement.png";
+                $html->meta_og['image'] = "https://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-announcement.png";
         }
 
         // add page title
@@ -70,7 +70,7 @@ switch (true)
         header('Expires: 0');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Content-Type: application/xml');
-        header('Content-Disposition: inline; filename="winehq_news.xml";');   
+        header('Content-Disposition: inline; filename="winehq_news.xml";');
         $rss_rows = "";
         $c = 0;
         foreach ($news as $key => $item)
@@ -101,7 +101,7 @@ switch (true)
             // display row
             $rss_row = array(
                                 'item_title' => strip_tags($vars['title']),
-                                'item_desc'  => htmlentities($vars['body']),
+                                'item_desc'  => $vars['body'],
                                 'item_link'  => $vars['link'],
                                 'item_guid'  => $config->base_url.'?news='.$item,
                                 'item_date'  => date("r", strtotime($vars['date']))
@@ -111,9 +111,9 @@ switch (true)
         unset($c);
         $rss = array(
                         'rss_date'  => date("r", $top_date),
-                        'rss_title' => $config->site_name.' News',
-                        'rss_link'  => "{$config->base_url}news/rss",
-                        'rss_img'   => "{$config->base_url}images/classic_top_logo.png",
+                        'rss_title' => "{$config->site_name News",
+                        'rss_link'  => "{$config->base_url}news/rss/",
+                        'rss_img'   => "https://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-announcement.png",
                         'rss_desc'  => 'News and information about Wine',
                         'rss_crt'   => '(C) '.$config->site_name.' '.date("Y", time()),
                         'rss_rows' => $rss_rows
diff --git a/templates/global/xml/rss.template b/templates/global/xml/rss.template
index daa2c73..92c68a9 100644
--- a/templates/global/xml/rss.template
+++ b/templates/global/xml/rss.template
@@ -4,11 +4,11 @@
 <rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
     <channel>
         <title>{$rss_title}</title>
-		<image>
-			<url>{$rss_img}</url>
-			<title>{$rss_title}</title>
-			<link>{$rss_link}</link>
-		</image>
+        <image>
+            <url>{$rss_img}</url>
+            <title>{$rss_title}</title>
+            <link>{$rss_link}</link>
+        </image>
         <link>{$rss_link}</link>
         <description>{$rss_desc}</description>
         <language>en</language>
diff --git a/templates/global/xml/rss_row.template b/templates/global/xml/rss_row.template
index 23949c5..16b50d1 100644
--- a/templates/global/xml/rss_row.template
+++ b/templates/global/xml/rss_row.template
@@ -1,7 +1,12 @@
 
         <item>
             <title>{$item_title}</title>
-	        <description>{$item_desc}</description>
+            <description>
+            <![CDATA[
+                <img src="https://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-announcement.png" alt=""><br>
+                {$item_desc}
+            ]]>
+            </description>
             <link>{$item_link}</link>
             <guid>{$item_guid}</guid>
             <pubDate>{$item_date}</pubDate>




More information about the wine-cvs mailing list