Return to Snippet

Revision: 40359
at January 31, 2011 17:55 by ericmuyser


Initial Code
<?= '<?xml version="1.0" encoding="utf-8"?>' ?>
<rss version="2.0"
     xmlns:excerpt="http://wordpress.org/export/1.0/excerpt/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:dsq="http://www.disqus.com/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wp="http://wordpress.org/export/1.0/"
>
<?
  $list = Blog_Post::create()->find_all();
  $site_url = 'http://lemonstandapp.com/'; //site_url('/');
?>
<channel>
     <title>LemonStand</title>
     <link><?= $site_url ?></link>
     <description>LemonStand eCommerce</description>
     <pubDate>Wed, 08 Dec 2008 19:01:52 +0000</pubDate>
     <generator>http://wordpress.org/?v=3.0.3</generator>
     <language>en</language>
     <wp:wxr_version>1.0</wp:wxr_version>
     <wp:base_site_url><?= $site_url ?></wp:base_site_url>
     <wp:base_blog_url><?= $site_url ?>blog/</wp:base_blog_url>
     <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>
  <? foreach($list as $post): ?>
    <item>
      <title><?= h($post->title) ?></title>
      <link><?= $site_url ?>blog/post/<?= $post->url_title ?>/</link>
      <pubDate><?= date("D, j M Y G:i:s", strtotime($post->published_date)) ?> +0000</pubDate>
      <dc:creator><![CDATA[<?= Users_User::create()->find($post->created_user_id)->login ?>]] > </dc:creator>
      <category><![CDATA[<?= Blog_Category::create()->find($post->category_id)->name ?>]] > </category>
      <category domain="category" nicename="<?= Blog_Category::create()->find($post->category_id)->url_name ?>"><![CDATA[<?= Blog_Category::create()->find($post->category_id)->name ?>]] > </category>
      <guid isPermaLink="false"><?= $site_url ?>blog/post/<?= $post->url_title ?>/</guid>
      <description></description>
      <content:encoded><![CDATA[<?= $post->content ?>]] > </content:encoded>
      <excerpt:encoded><![CDATA[]] > </excerpt:encoded>
      <dsq:thread_identifier>post_<?= $post->id ?></dsq:thread_identifier>
      <wp:post_id><?= $post->id ?></wp:post_id>
      <wp:post_date><?= date("D, j M Y G:i:s", strtotime($post->created_at)) ?> +0000</wp:post_date>
      <wp:post_date_gmt><?= date("D, j M Y G:i:s", strtotime($post->created_at)) ?> +0000</wp:post_date_gmt>
      <wp:comment_status>open</wp:comment_status>
      <wp:ping_status>open</wp:ping_status>
      <wp:post_name><?= $post->url_title ?></wp:post_name>
      <wp:status>publish</wp:status>
      <wp:post_parent>0</wp:post_parent>
      <wp:menu_order>0</wp:menu_order>
      <wp:post_type>post</wp:post_type>
      <? foreach($post->approved_comments as $comment): ?>
      <?
      $author_email = $comment->author_email;
      $author_url = $comment->author_url;
     
      if($comment->author_name == "Danny Halarewich") {
        $author_email = "[email protected]";
        $author_url = "http://lemonstandapp.com/";
      }
      else if($comment->author_name == "Aleksey Bobkov") {
        $author_email = "[email protected]";
        $author_url = "http://lemonstandapp.com/";
      }
      ?>
        <wp:comment>
          <wp:comment_id><?= $comment->id ?></wp:comment_id>
          <wp:comment_author><![CDATA[<?= $comment->author_name ?>]] > </wp:comment_author>
          <wp:comment_author_email><?= $author_email ?></wp:comment_author_email>
          <wp:comment_author_url><?= $author_url ?></wp:comment_author_url>
          <wp:comment_author_IP><?= $comment->author_ip ?></wp:comment_author_IP>
          <wp:comment_date><?= date('Y-m-d H:i:s', strtotime($comment->created_at)) ?></wp:comment_date>
          <wp:comment_date_gmt><?= date('Y-m-d H:i:s', strtotime($comment->created_at)) ?></wp:comment_date_gmt>
          <wp:comment_content><![CDATA[<?= $comment->content ?>]] > </wp:comment_content>
          <wp:comment_approved>1</wp:comment_approved>
          <wp:comment_type></wp:comment_type>
          <wp:comment_parent>0</wp:comment_parent>
          <wp:comment_user_id>1</wp:comment_user_id>
        </wp:comment>
      <? endforeach ?>
    </item>
  <? endforeach ?>
</channel>
</rss>

Initial URL


Initial Description


Initial Title
ls export blog comments for disqus

Initial Tags


Initial Language
PHP