KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.3KB

  1. <?php
  2. $config = Config::current();
  3. $trigger = Trigger::current();
  4. $theme = Theme::current();
  5. $title = (!empty($_GET['title'])) ? ": ".html_entity_decode($_GET['title']) : "" ;
  6. echo "<".'?xml version="1.0" encoding="utf-8"?'.">\r";
  7. ?>
  8. <feed xmlns="http://www.w3.org/2005/Atom">
  9. <title><?php echo $config->name.$title; ?></title>
  10. <?php if (!empty($config->description)): ?>
  11. <subtitle><?php echo fix($config->description); ?></subtitle>
  12. <?php endif; ?>
  13. <id><?php echo fix(self_url()); ?></id>
  14. <updated><?php echo date("c", $latest_timestamp); ?></updated>
  15. <link href="<?php echo fix(self_url(), true); ?>" rel="self" type="application/atom+xml" />
  16. <link href="<?php echo fix($config->url, true); ?>" />
  17. <generator uri="http://chyrp.net/" version="<?php echo CHYRP_VERSION; ?>">Chyrp</generator>
  18. <?php
  19. foreach ($posts as $post) {
  20. $updated = ($post->updated) ? $post->updated_at : $post->created_at ;
  21. $tagged = substr(strstr(url("id/".$post->id), "//"), 2);
  22. $tagged = str_replace("#", "/", $tagged);
  23. $tagged = preg_replace("/(".preg_quote(parse_url($post->url(), PHP_URL_HOST)).")/",
  24. "\\1,".when("Y-m-d", $updated).":",
  25. $tagged,
  26. 1);
  27. $url = $post->url();
  28. $title = $post->title();
  29. $trigger->filter($url, "feed_url", $post);
  30. if (!$post->user->no_results)
  31. $author = oneof($post->user->full_name, $post->user->login);
  32. else
  33. $author = __("Guest");
  34. ?>
  35. <entry>
  36. <title type="html"><?php echo fix(oneof($title, ucfirst($post->feather))); ?></title>
  37. <id>tag:<?php echo $tagged; ?></id>
  38. <updated><?php echo when("c", $updated); ?></updated>
  39. <published><?php echo when("c", $post->created_at); ?></published>
  40. <link rel="alternate" type="<?php echo $theme->type; ?>" href="<?php echo fix($url); ?>" />
  41. <author>
  42. <name><?php echo fix($author); ?></name>
  43. <?php if (!empty($post->user->website)): ?>
  44. <uri><?php echo fix($post->user->website); ?></uri>
  45. <?php endif; ?>
  46. </author>
  47. <content type="html"><?php echo fix($post->feed_content()); ?></content>
  48. <?php $trigger->call("feed_item", $post); ?>
  49. </entry>
  50. <?php
  51. }
  52. ?></feed>