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.

56 lines
2.4KB

  1. <?php
  2. $config = Config::current();
  3. $trigger = Trigger::current();
  4. $split_locale = explode("_", $config->locale);
  5. fallback($comments, Comment::find(array("limit" => 20,
  6. "where" => array("status != 'spam'",
  7. "status != 'denied'"))));
  8. fallback($title, _f("Comments at &#8220;%s&#8221;", array(fix($config->name)), "comments"));
  9. $latest_timestamp = 0;
  10. foreach ($comments as $comment)
  11. if (strtotime($comment->created_at) > $latest_timestamp)
  12. $latest_timestamp = strtotime($comment->created_at);
  13. echo "<".'?xml version="1.0" encoding="utf-8"?'.">\r";
  14. ?>
  15. <feed xmlns="http://www.w3.org/2005/Atom">
  16. <title><?php echo $title; ?></title>
  17. <id><?php echo fix(self_url()); ?></id>
  18. <updated><?php echo date("c", $latest_timestamp); ?></updated>
  19. <link href="<?php echo fix(self_url(), true); ?>" rel="self" type="application/atom+xml" />
  20. <generator uri="http://chyrp.net/" version="<?php echo CHYRP_VERSION; ?>">Chyrp</generator>
  21. <?php
  22. foreach ($comments as $comment) {
  23. $trigger->call("feed_comment", $comment);
  24. $updated = ($comment->updated) ? $comment->updated_at : $comment->created_at ;
  25. $tagged = substr(strstr(url("id/".$comment->post->id)."#comment_".$comment->id, "//"), 2);
  26. $tagged = str_replace("#", "/", $tagged);
  27. $tagged = preg_replace("/(".preg_quote(parse_url($comment->post->url(), PHP_URL_HOST)).")/", "\\1,".when("Y-m-d", $updated).":", $tagged, 1);
  28. ?>
  29. <entry xml:base="<?php echo $comment->post->url()."#comment_".$comment->id; ?>">
  30. <title type="html"><?php echo fix($comment->post->title()); ?></title>
  31. <id>tag:<?php echo $tagged; ?></id>
  32. <updated><?php echo when("c", $updated); ?></updated>
  33. <published><?php echo when("c", $comment->created_at); ?></published>
  34. <link href="<?php echo $comment->post->url()."#comment_".$comment->id; ?>" />
  35. <author>
  36. <name><?php echo fix($comment->author); ?></name>
  37. <?php if (!empty($comment->author_url)): ?>
  38. <uri><?php echo fix($comment->author_url); ?></uri>
  39. <?php endif; ?>
  40. </author>
  41. <content type="html">
  42. <?php echo fix($comment->body); ?>
  43. </content>
  44. <?php $trigger->call("comments_feed_item", $comment->id); ?>
  45. </entry>
  46. <?php
  47. }
  48. ?></feed>