ls export blog comments for disqus


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?= '<?xml version="1.0" encoding="utf-8"?>' ?>
  2. <rss version="2.0"
  3. xmlns:excerpt="http://wordpress.org/export/1.0/excerpt/"
  4. xmlns:content="http://purl.org/rss/1.0/modules/content/"
  5. xmlns:dsq="http://www.disqus.com/"
  6. xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  7. xmlns:dc="http://purl.org/dc/elements/1.1/"
  8. xmlns:wp="http://wordpress.org/export/1.0/"
  9. >
  10. <?
  11. $list = Blog_Post::create()->find_all();
  12. $site_url = 'http://lemonstandapp.com/'; //site_url('/');
  13. ?>
  14. <channel>
  15. <title>LemonStand</title>
  16. <link><?= $site_url ?></link>
  17. <description>LemonStand eCommerce</description>
  18. <pubDate>Wed, 08 Dec 2008 19:01:52 +0000</pubDate>
  19. <generator>http://wordpress.org/?v=3.0.3</generator>
  20. <language>en</language>
  21. <wp:wxr_version>1.0</wp:wxr_version>
  22. <wp:base_site_url><?= $site_url ?></wp:base_site_url>
  23. <wp:base_blog_url><?= $site_url ?>blog/</wp:base_blog_url>
  24. <wp:category><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Uncategorized]] > </wp:cat_name></wp:category>
  25. <? foreach($list as $post): ?>
  26. <item>
  27. <title><?= h($post->title) ?></title>
  28. <link><?= $site_url ?>blog/post/<?= $post->url_title ?>/</link>
  29. <pubDate><?= date("D, j M Y G:i:s", strtotime($post->published_date)) ?> +0000</pubDate>
  30. <dc:creator><![CDATA[<?= Users_User::create()->find($post->created_user_id)->login ?>]] > </dc:creator>
  31. <category><![CDATA[<?= Blog_Category::create()->find($post->category_id)->name ?>]] > </category>
  32. <category domain="category" nicename="<?= Blog_Category::create()->find($post->category_id)->url_name ?>"><![CDATA[<?= Blog_Category::create()->find($post->category_id)->name ?>]] > </category>
  33. <guid isPermaLink="false"><?= $site_url ?>blog/post/<?= $post->url_title ?>/</guid>
  34. <description></description>
  35. <content:encoded><![CDATA[<?= $post->content ?>]] > </content:encoded>
  36. <excerpt:encoded><![CDATA[]] > </excerpt:encoded>
  37. <dsq:thread_identifier>post_<?= $post->id ?></dsq:thread_identifier>
  38. <wp:post_id><?= $post->id ?></wp:post_id>
  39. <wp:post_date><?= date("D, j M Y G:i:s", strtotime($post->created_at)) ?> +0000</wp:post_date>
  40. <wp:post_date_gmt><?= date("D, j M Y G:i:s", strtotime($post->created_at)) ?> +0000</wp:post_date_gmt>
  41. <wp:comment_status>open</wp:comment_status>
  42. <wp:ping_status>open</wp:ping_status>
  43. <wp:post_name><?= $post->url_title ?></wp:post_name>
  44. <wp:status>publish</wp:status>
  45. <wp:post_parent>0</wp:post_parent>
  46. <wp:menu_order>0</wp:menu_order>
  47. <wp:post_type>post</wp:post_type>
  48. <? foreach($post->approved_comments as $comment): ?>
  49. <?
  50. $author_email = $comment->author_email;
  51. $author_url = $comment->author_url;
  52.  
  53. if($comment->author_name == "Danny Halarewich") {
  54. $author_email = "[email protected]";
  55. $author_url = "http://lemonstandapp.com/";
  56. }
  57. else if($comment->author_name == "Aleksey Bobkov") {
  58. $author_email = "[email protected]";
  59. $author_url = "http://lemonstandapp.com/";
  60. }
  61. ?>
  62. <wp:comment>
  63. <wp:comment_id><?= $comment->id ?></wp:comment_id>
  64. <wp:comment_author><![CDATA[<?= $comment->author_name ?>]] > </wp:comment_author>
  65. <wp:comment_author_email><?= $author_email ?></wp:comment_author_email>
  66. <wp:comment_author_url><?= $author_url ?></wp:comment_author_url>
  67. <wp:comment_author_IP><?= $comment->author_ip ?></wp:comment_author_IP>
  68. <wp:comment_date><?= date('Y-m-d H:i:s', strtotime($comment->created_at)) ?></wp:comment_date>
  69. <wp:comment_date_gmt><?= date('Y-m-d H:i:s', strtotime($comment->created_at)) ?></wp:comment_date_gmt>
  70. <wp:comment_content><![CDATA[<?= $comment->content ?>]] > </wp:comment_content>
  71. <wp:comment_approved>1</wp:comment_approved>
  72. <wp:comment_type></wp:comment_type>
  73. <wp:comment_parent>0</wp:comment_parent>
  74. <wp:comment_user_id>1</wp:comment_user_id>
  75. </wp:comment>
  76. <? endforeach ?>
  77. </item>
  78. <? endforeach ?>
  79. </channel>
  80. </rss>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.