WebOrbiton

Code

Publisium

A modern, fast CMS for building article and blog websites.

Version history

Version 1.0.0.9 2026-10-01

Browse files
Files changed2
Lines added+20
Lines removed-3
rss.php Modified +19 -2
⋮ 33 unchanged lines ⋮
  }
  
  $articlesStatement = $db->prepare(
-     "SELECT a.id, a.title, a.slug, a.excerpt, a.published_at, a.category_id, c.name AS category_name FROM articles a LEFT JOIN categories c ON c.id = a.category_id WHERE a.status = 'published'"
+     "SELECT a.id, a.title, a.slug, a.excerpt, a.published_at, a.cover_image_path, a.category_id, c.name AS category_name FROM articles a LEFT JOIN categories c ON c.id = a.category_id WHERE a.status = 'published'"
      . ($category !== null ? ' AND a.category_id = :category_id' : '')
      . Languages::articleFilterSql('a') . " ORDER BY a.published_at DESC LIMIT 30"
  );
⋮ 3 unchanged lines ⋮
  header('Content-Type: application/rss+xml; charset=utf-8');
  
  echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
- echo '<rss version="2.0"><channel>' . "\n";
+ echo '<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel>' . "\n";
  echo '<title>' . htmlspecialchars($category !== null ? $category['name'] . ' - ' . $settings['site_name'] : $settings['site_name']) . '</title>' . "\n";
  $channelLanguage = Languages::current();
  $channelLink = $channelLanguage === '' ? rtrim((string) Config::get('APP_URL', ''), '/') . SiteFront::homeUrl('') : rtrim((string) Config::get('APP_URL', ''), '/') . Languages::homeUrl($channelLanguage);
⋮ 7 unchanged lines ⋮
  $channelDescription = $category !== null && !empty($category['description']) ? (string) $category['description'] : $settings['site_description'];
  echo '<description>' . htmlspecialchars($channelDescription) . '</description>' . "\n";
  
+ if ($settings['site_logo_url'] !== '') {
+     echo '<image>';
+     echo '<url>' . htmlspecialchars(SiteFront::absoluteUrl($settings['site_logo_url'])) . '</url>';
+     echo '<title>' . htmlspecialchars($settings['site_name']) . '</title>';
+     echo '<link>' . htmlspecialchars($channelLink) . '</link>';
+     echo '</image>' . "\n";
+ }
+ 
+ $imageTypes = ['jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'gif' => 'image/gif', 'webp' => 'image/webp', 'avif' => 'image/avif'];
+ 
  foreach ($articles as $article) {
      $url = rtrim(Config::get('APP_URL', ''), '/') . SiteFront::articleUrl($article['slug']);
      echo '<item>';
⋮ 5 unchanged lines ⋮
          echo '<category>' . htmlspecialchars((string) $article['category_name']) . '</category>';
      }
      echo '<pubDate>' . htmlspecialchars(date(DATE_RSS, strtotime($article['published_at']))) . '</pubDate>';
+     if (!empty($article['cover_image_path'])) {
+         $coverUrl = SiteFront::absoluteUrl((string) $article['cover_image_path']);
+         $coverExtension = strtolower(pathinfo((string) parse_url($coverUrl, PHP_URL_PATH), PATHINFO_EXTENSION));
+         $coverType = isset($imageTypes[$coverExtension]) ? ' type="' . $imageTypes[$coverExtension] . '"' : '';
+         echo '<media:content url="' . htmlspecialchars($coverUrl, ENT_QUOTES) . '" medium="image"' . $coverType . '/>';
+         echo '<media:thumbnail url="' . htmlspecialchars($coverUrl, ENT_QUOTES) . '"/>';
+     }
      echo '</item>' . "\n";
  }
  
⋮ 2 unchanged lines ⋮
version.txt Modified +1 -1
- 1.0.0.8
+ 1.0.0.9