<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: wordpress code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 17 May 2008 20:35:32 GMT</pubDate>
    <description>DZone Snippets: wordpress code</description>
    <item>
      <title>Perform Comment Recount for WordPress</title>
      <link>http://snippets.dzone.com/posts/show/5493</link>
      <description>Run from the command line and uncomment line #2 if your mysql adapter is installed via RubyGems. Fast as hell.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/ruby&lt;br /&gt;#require 'rubygems'&lt;br /&gt;require 'mysql'&lt;br /&gt; &lt;br /&gt;db = Mysql.real_connect("host", "username", "password", "database")&lt;br /&gt;ids = db.query("SELECT `ID` FROM `wp_posts` WHERE 1")&lt;br /&gt; &lt;br /&gt;ids.each_hash do |post|&lt;br /&gt;  id = post['ID']&lt;br /&gt;  num = 0&lt;br /&gt;  comments = db.query("SELECT COUNT(1) FROM `wp_comments` WHERE `comment_post_ID`='#{id}' AND `comment_approved`='1';")&lt;br /&gt;  comments.each {|x| num = x[0]}&lt;br /&gt;  up = db.query("UPDATE `wp_posts` SET `comment_count`='#{num}' WHERE `ID`='#{id}';")&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 14 May 2008 23:11:28 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5493</guid>
      <author>breakerjump (Josh)</author>
    </item>
    <item>
      <title>Display recent posts from a category</title>
      <link>http://snippets.dzone.com/posts/show/5485</link>
      <description>// No need of a plugin to do this&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt; &lt;?php&lt;br /&gt; global $post;&lt;br /&gt; $myposts = get_posts('numberposts=5&amp;category=4');&lt;br /&gt; foreach($myposts as $post) :&lt;br /&gt; setup_postdata($post);&lt;br /&gt; ?&gt;&lt;br /&gt; &lt;li&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;" title="&lt;?php the_title(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt; &lt;?php endforeach; ?&gt;&lt;br /&gt;&lt;/ul&gt;.&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 11 May 2008 20:25:24 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5485</guid>
      <author>fabricadecosas (ana m.)</author>
    </item>
    <item>
      <title>Transfer Wordpress MySQL database to new webhost</title>
      <link>http://snippets.dzone.com/posts/show/5361</link>
      <description>// Transfer Wordpress MySQL database to new webhost in 3 steps (assumes: A. files have already been copied over, B. database created on new server, C. database user created on new server, D. wp-config.php updated on new server)&lt;br /&gt;// 1. login to old host via ssh, run this command:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;mysqldump -h DB_HOST -u DB_USER -p DB_NAME &gt; dump.sql&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;// replace DB_HOST, DB_USER, &amp; DB_NAME with info from the local wp-config.php file&lt;br /&gt;// when asked for password, enter DB_PASSWORD from the local wp-config.php file&lt;br /&gt;&lt;br /&gt;// 2. copy dump.sql to your new host using sftp&lt;br /&gt;&lt;br /&gt;// 3. login go new host via ssh, run this command:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;mysql -h DB_HOST -u DB_USER -p DB_NAME &lt; dump.sql&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;// replace DB_HOST, DB_USER, &amp; DB_NAME with info from the local wp-config.php file&lt;br /&gt;// when asked for password, enter DB_PASSWORD from the local wp-config.php file&lt;br /&gt;&lt;br /&gt;// adopted from this page: http://technosailor.com/2007/04/06/wordpress-faq-how-do-i-move-my-blog-to-a-new-host/</description>
      <pubDate>Mon, 14 Apr 2008 07:54:58 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5361</guid>
      <author>SimonDorfman (Simon Dorfman)</author>
    </item>
    <item>
      <title>firefox not showing vertical scrollbars in blog</title>
      <link>http://snippets.dzone.com/posts/show/5161</link>
      <description>hey everyone,&lt;br /&gt;&lt;br /&gt;I'm new here and wondering if someone can help me out.  i have a couple wordpress blogs i've built for clients, and i'm occasionally getting a wierd behavior in Firefox Win/Mac:  sometimes even though there is plenty of content below the fold, no vertical scrollbar will show at all.  it only does this on firefox.&lt;br /&gt;&lt;br /&gt;here's an example  (must view in firefox):&lt;br /&gt;&lt;br /&gt;http://www.lorihedrickphotography.com/blog/&lt;br /&gt;&lt;br /&gt;and i've tried adding this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;html {&lt;br /&gt;height:101%;&lt;br /&gt;overflow-y:scroll;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;i looked at it with firebug, it validates.  i'm stumped!  any help would be greatly appreciated.&lt;br /&gt;&lt;br /&gt;-jared</description>
      <pubDate>Thu, 21 Feb 2008 20:40:24 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5161</guid>
      <author>jaredh123 (Jared Henderson)</author>
    </item>
    <item>
      <title>RSS output of a Prologue post</title>
      <link>http://snippets.dzone.com/posts/show/5053</link>
      <description>// This is how Prologue outputs a post&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;item&gt;&lt;br /&gt;		&lt;title&gt;&lt;/title&gt;&lt;br /&gt;		&lt;link&gt;http://localhost/wordpress/?p=3&lt;/link&gt;&lt;br /&gt;		&lt;comments&gt;http://localhost/wordpress/?p=3#comments&lt;/comments&gt;&lt;br /&gt;		&lt;pubDate&gt;Tue, 29 Jan 2008 23:54:15 +0000&lt;/pubDate&gt;&lt;br /&gt;&lt;br /&gt;		&lt;dc:creator&gt;admin&lt;/dc:creator&gt;&lt;br /&gt;		&lt;br /&gt;		&lt;category&gt;&lt;![CDATA[Uncategorized]]&gt;&lt;/category&gt;&lt;br /&gt;&lt;br /&gt;		&lt;category&gt;&lt;![CDATA[welcome]]&gt;&lt;/category&gt;&lt;br /&gt;&lt;br /&gt;		&lt;guid isPermaLink="false"&gt;http://localhost/wordpress/?p=3&lt;/guid&gt;&lt;br /&gt;		&lt;description&gt;&lt;![CDATA[Pretty cool, here&amp;#8217;s the Twitta!]]&gt;&lt;/description&gt;&lt;br /&gt;			&lt;br /&gt;                &lt;content:encoded&gt;&lt;![CDATA[&lt;p&gt;Pretty cool, here&amp;#8217;s the Twitta!&lt;/p&gt;]]&gt;&lt;/content:encoded&gt;&lt;br /&gt;			&lt;wfw:commentRss&gt;http://localhost/wordpress/?feed=rss2&amp;p=3&lt;/wfw:commentRss&gt;&lt;br /&gt;&lt;br /&gt;&lt;/item&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 30 Jan 2008 00:25:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5053</guid>
      <author>als (alex)</author>
    </item>
    <item>
      <title>Typo export to Wordpress WXR (script version)</title>
      <link>http://snippets.dzone.com/posts/show/4326</link>
      <description>I tried to use this method here: http://snippets.dzone.com/posts/show/3264 however my typo blog was too slow and it kept timing out (which is why we're switching to wordpress anyway...).  So I stole the code and hacked it up a bit so it could be run as a script.&lt;br /&gt;&lt;br /&gt;Put this in $RAILS_ROOT/script/wp_export.rb, and run it like:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;RAILS_ENV=production ./script/wp_export.rb &gt; out.wxr&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Import it with the "Import Wordpress" tool in your wordpress blog's admin interface.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env ruby&lt;br /&gt;require File.dirname(__FILE__) + '/../config/boot'&lt;br /&gt;require 'environment'&lt;br /&gt;&lt;br /&gt;require 'application'&lt;br /&gt;&lt;br /&gt;# we need a controller to generate html output&lt;br /&gt;class FakeController &lt; ApplicationController&lt;br /&gt;  include ActionView::Helpers::TextHelper&lt;br /&gt;  include ActionView::Helpers::TagHelper&lt;br /&gt;end&lt;br /&gt;fake_controller = FakeController.new&lt;br /&gt;&lt;br /&gt;articles = Article.find(:all)&lt;br /&gt;&lt;br /&gt;xml = Builder::XmlMarkup.new(:target =&gt; STDOUT, :indent =&gt; 2)&lt;br /&gt;&lt;br /&gt;xml.instruct! :xml, :version=&gt;"1.0", :encoding=&gt;"UTF-8"&lt;br /&gt;xml.rss 'version' =&gt; "2.0",&lt;br /&gt;        'xmlns:content' =&gt; "http://purl.org/rss/1.0/modules/content/",&lt;br /&gt;        'xmlns:wfw' =&gt; "http://wellformedweb.org/CommentAPI/",&lt;br /&gt;        'xmlns:dc' =&gt; "http://purl.org/dc/elements/1.1/",&lt;br /&gt;        'xmlns:wp' =&gt; "http://wordpress.org/export/1.0/" do&lt;br /&gt;  xml.channel do&lt;br /&gt;    xml.title "The Robot Co-op"&lt;br /&gt;    xml.link "http://www.robotcoop.com"&lt;br /&gt;    xml.language "en-us"&lt;br /&gt;    xml.ttl "40"&lt;br /&gt;    xml.description "Robot coop blog"&lt;br /&gt;&lt;br /&gt;    articles.each do |a|&lt;br /&gt;        xml.item do&lt;br /&gt;          xml.title a.title&lt;br /&gt;          xml.content(:encoded) { |x| x &lt;&lt; a.html(fake_controller, :all) }&lt;br /&gt;          xml.pubDate a.published_at.rfc2822&lt;br /&gt;          xml.guid "urn:uuid:{a.guid}", "isPermaLink" =&gt; "false"&lt;br /&gt;          author = a.user.name rescue a.author&lt;br /&gt;          xml.author author&lt;br /&gt;          xml.dc :creator, author&lt;br /&gt;          for category in a.categories&lt;br /&gt;            xml.category category.name&lt;br /&gt;          end&lt;br /&gt;          for tag in a.tags&lt;br /&gt;            xml.category tag.display_name&lt;br /&gt;          end&lt;br /&gt;          xml.wp :post_id, a.id&lt;br /&gt;          xml.wp :post_date, a.published_at.strftime("%Y-%m-%d %H:%M:%S")&lt;br /&gt;          xml.wp :comment_status, 'closed'&lt;br /&gt;          xml.wp :ping_status, 'closed'&lt;br /&gt;          xml.wp :post_name, a.permalink&lt;br /&gt;          xml.wp :status, 'publish'&lt;br /&gt;          xml.wp :post_parent, '0'&lt;br /&gt;          xml.wp :post_type, 'post'&lt;br /&gt;          for comment in a.comments&lt;br /&gt;            xml.wp(:comment) do&lt;br /&gt;              xml.wp :comment_id, comment.id&lt;br /&gt;              xml.wp :comment_author, comment.author&lt;br /&gt;              xml.wp :comment_author_email, comment.email&lt;br /&gt;              xml.wp :comment_author_url, comment.url&lt;br /&gt;              xml.wp :comment_author_IP, comment.ip&lt;br /&gt;              xml.wp :comment_date, comment.published_at.strftime("%Y-%m-%d %H:%M:%S")&lt;br /&gt;              xml.wp(:comment_content) { |x| x &lt;&lt; comment.body }&lt;br /&gt;              xml.wp :comment_approved, '1'&lt;br /&gt;              xml.wp :comment_parent, '0'&lt;br /&gt;            end&lt;br /&gt;          end&lt;br /&gt;       end&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 18 Jul 2007 23:41:54 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4326</guid>
      <author>laurelfan (Laurel Fan)</author>
    </item>
    <item>
      <title>Typo export to WordPress WXR</title>
      <link>http://snippets.dzone.com/posts/show/3264</link>
      <description>If you want to move from Typo to Wordpress, you can use this to export the strange Wordpress RSS file format (comments and all).&lt;br /&gt;&lt;br /&gt;Just add this to the XmlController :&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  def wp&lt;br /&gt;    @articles = Article.find( :all, :include =&gt; [:categories, :tags, :user, :blog])&lt;br /&gt;  end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And then add this file (app/views/xml/wp.rxml):&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;// insert code here..&lt;br /&gt;xml.instruct! :xml, :version=&gt;"1.0", :encoding=&gt;"UTF-8"&lt;br /&gt;&lt;br /&gt;xml.rss 'version' =&gt; "2.0", 'xmlns:content' =&gt; "http://purl.org/rss/1.0/modules/content/", 'xmlns:wfw' =&gt; "http://wellformedweb.org/CommentAPI/", 'xmlns:dc' =&gt; "http://purl.org/dc/elements/1.1/", 'xmlns:wp' =&gt; "http://wordpress.org/export/1.0/" do&lt;br /&gt;  xml.channel do&lt;br /&gt;    xml.title @feed_title&lt;br /&gt;    xml.link @link&lt;br /&gt;    xml.language "en-us"&lt;br /&gt;    xml.ttl "40"&lt;br /&gt;    xml.description this_blog.blog_subtitle&lt;br /&gt;&lt;br /&gt;    @articles.each do |a|&lt;br /&gt;        xml.item do&lt;br /&gt;          xml.title post_title(a)&lt;br /&gt;          xml.content(:encoded) { |x| x &lt;&lt; '&lt;![CDATA[' + a.full_html + ']]&gt;' }&lt;br /&gt;          xml.pubDate a.published_at.rfc2822&lt;br /&gt;          xml.guid "urn:uuid:#{a.guid}", "isPermaLink" =&gt; "false"&lt;br /&gt;          author = a.user.name rescue a.author&lt;br /&gt;          xml.author author&lt;br /&gt;          xml.dc :creator, author&lt;br /&gt;          for category in a.categories&lt;br /&gt;            xml.category category.name&lt;br /&gt;          end&lt;br /&gt;          for tag in a.tags&lt;br /&gt;            xml.category tag.display_name&lt;br /&gt;          end&lt;br /&gt;          xml.wp :post_id, a.id&lt;br /&gt;          xml.wp :post_date, a.published_at.strftime("%Y-%m-%d %H:%M:%S")&lt;br /&gt;          xml.wp :comment_status, 'closed'&lt;br /&gt;          xml.wp :ping_status, 'closed'&lt;br /&gt;          xml.wp :post_name, a.permalink&lt;br /&gt;          xml.wp :status, 'publish'&lt;br /&gt;          xml.wp :post_parent, '0'&lt;br /&gt;          xml.wp :post_type, 'post'&lt;br /&gt;          for comment in a.comments&lt;br /&gt;            xml.wp(:comment) do&lt;br /&gt;              xml.wp :comment_id, comment.id&lt;br /&gt;              xml.wp :comment_author, comment.author&lt;br /&gt;              xml.wp :comment_author_email, comment.email&lt;br /&gt;              xml.wp :comment_author_url, comment.url&lt;br /&gt;              xml.wp :comment_author_IP, comment.ip&lt;br /&gt;              xml.wp :comment_author_date, comment.published_at.strftime("%Y-%m-%d %H:%M:%S")&lt;br /&gt;              xml.wp(:comment_content) { |x| x &lt;&lt; comment.full_html }&lt;br /&gt;              xml.wp :comment_approved, '1'&lt;br /&gt;              xml.wp :comment_parent, '0'&lt;br /&gt;            end&lt;br /&gt;          end&lt;br /&gt;        end&lt;br /&gt;    end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then hit your typo blog at http://myblog/xml/wp and save the file to import through the WordPress interface.</description>
      <pubDate>Tue, 09 Jan 2007 23:52:47 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3264</guid>
      <author>schacon (Scott Chacon)</author>
    </item>
    <item>
      <title>Wordpress HTML Outline</title>
      <link>http://snippets.dzone.com/posts/show/2956</link>
      <description>// Basic HTML structure for a wordpress page&lt;br /&gt;&lt;code&gt;&lt;body&gt;&lt;br /&gt;	&lt;div id="wrap"&gt;&lt;br /&gt;		&lt;div id="top"&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;		&lt;div id="content" class="single"&gt;&lt;br /&gt;			&lt;div class="post-wrap" id="post-6"&gt;&lt;br /&gt;				&lt;h1 class="post-title"&gt;The Title Of Your Post&lt;/h1&gt;&lt;br /&gt;				&lt;div class="story-content"&gt;&lt;br /&gt;				&lt;/div&gt;&lt;br /&gt;				&lt;br /&gt;				&lt;div class="metawrap"&gt;&lt;br /&gt;				&lt;/div&gt;&lt;br /&gt;			&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;			&lt;div id="commentwrap"&gt;&lt;br /&gt;				&lt;h3 id="respond"&gt;Leave Your Comment&lt;/h3&gt;&lt;br /&gt;				&lt;form&gt;&lt;br /&gt;				&lt;/form&gt;&lt;br /&gt;			&lt;/div&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;		&lt;div id="side"&gt;&lt;br /&gt;			&lt;ul&gt;&lt;br /&gt;				&lt;li&gt;&lt;!-- One side bar item --&gt;&lt;/li&gt;&lt;br /&gt;			&lt;/ul&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;		&lt;div id="bottom"&gt;&lt;/div&gt;&lt;br /&gt;		&lt;br /&gt;	&lt;/div&gt;&lt;!-- end wrap --&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 02 Nov 2006 15:42:27 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2956</guid>
      <author>ianpurton ()</author>
    </item>
    <item>
      <title>Googleit WordPress Plugin</title>
      <link>http://snippets.dzone.com/posts/show/1911</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;/*&lt;br /&gt;Plugin Name: Googleit&lt;br /&gt;Plugin URI: http://lordrich.com/archives/2005/04/02/just-google-it/&lt;br /&gt;Description: Link to google for the current title.  Usage: google_it();&lt;br /&gt;Version: 0.1&lt;br /&gt;Author: Richard Kirkcaldy&lt;br /&gt;Author URI: http://lordrich.com&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;function google_it(){&lt;br /&gt;	$google = '&lt;a href="http://www.google.com/search?q='.get_the_title().'"&gt;Google It&lt;/a&gt;';&lt;br /&gt;	echo $google;&lt;br /&gt;	}&lt;br /&gt;?&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 13 Apr 2006 16:20:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1911</guid>
      <author>lordrich ()</author>
    </item>
    <item>
      <title>Feedwordpress mod</title>
      <link>http://snippets.dzone.com/posts/show/1889</link>
      <description>A simplified version of update-feeds.php from the Feedwordpress project.  This version doesn't bother checking for authentication as there's really no point.  It doesn't check whether it's being run at the commandline either, it simply assumes it is being called by wget as a cron job.  This is designed to be run with version 0.98&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;// Help us to pick out errors, if any.&lt;br /&gt;ini_set('error_reporting', E_ALL &amp; ~E_NOTICE);&lt;br /&gt;ini_set('display_errors', true);&lt;br /&gt;define('MAGPIE_DEBUG', true);&lt;br /&gt;&lt;br /&gt;// Are we running from a web request or from the command line?&lt;br /&gt;                $update_feeds_display = 'text/plain';&lt;br /&gt;                $update_feeds_invoke = 'post';&lt;br /&gt;                $update_feeds_verbose = false;&lt;br /&gt;&lt;br /&gt;require_once ('../wp-blog-header.php');&lt;br /&gt;&lt;br /&gt;function update_feeds_mention ($feed) {&lt;br /&gt;        global $update_feeds_display;&lt;br /&gt;&lt;br /&gt;        if ($update_feeds_display=='text/html') :&lt;br /&gt;                echo "&lt;li&gt;Updating &lt;cite&gt;".$feed['link/name']."&lt;/cite&gt; from &amp;lt;&lt;a href=\""&lt;br /&gt;                        .$feed['link/uri']."\"&gt;".$feed['link/uri']."&lt;/a&gt;&amp;gt; ...&lt;/li&gt;\n";&lt;br /&gt;        else :&lt;br /&gt;                echo "* Updating ".$feed['link/name']." from &lt;".$feed['link/uri']."&gt; ...\n";&lt;br /&gt;        endif;&lt;br /&gt;        flush();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;# -- Don't change these unless you know what you're doing...&lt;br /&gt;define ('RPC_MAGIC', 'tag:radgeek.com/projects/feedwordpress/'); // update all&lt;br /&gt;&lt;br /&gt;// Query secret word from database&lt;br /&gt;$rpc_secret = get_settings('feedwordpress_rpc_secret');&lt;br /&gt;&lt;br /&gt;header("Content-Type: {$update_feeds_display}; charset=utf-8");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        // Henceforward, we can proceed on the assumption that we have an authenticated user&lt;br /&gt;        $uri = (isset($_REQUEST['uri']) ? $_REQUEST['uri'] : RPC_MAGIC.$rpc_secret);&lt;br /&gt;&lt;br /&gt;        if ($update_feeds_display=='text/html') :&lt;br /&gt;                echo &lt;&lt;&lt;EOHTML&lt;br /&gt;&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;title&gt;update-feeds :: FeedWordPress&lt;/title&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;h1&gt;update-feeds: make FeedWordPress check for new syndicated content&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;EOHTML;&lt;br /&gt;        endif;&lt;br /&gt;&lt;br /&gt;$feedwordpress =&amp; new FeedWordPress;&lt;br /&gt;&lt;br /&gt;if ($update_feeds_display=='text/html' or $update_feeds_verbose) :&lt;br /&gt;        add_action('feedwordpress_check_feed', 'update_feeds_mention');&lt;br /&gt;endif;&lt;br /&gt;&lt;br /&gt;if ($update_feeds_display=='text/html') : // HTTP GET or HTTP POST: add some web niceties&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        echo "&lt;form action=\"\" method=\"POST\"&gt;\n";&lt;br /&gt;        echo "&lt;select name=\"uri\"&gt;\n";&lt;br /&gt;        echo "&lt;option value=\"".RPC_MAGIC.$rpc_secret."\"&gt;All feeds&lt;/option&gt;\n";&lt;br /&gt;        foreach ($feedwordpress-&gt;feeds as $feed) :&lt;br /&gt;                echo "&lt;option value=\"{$feed['link/uri']}\"";&lt;br /&gt;                if ($feed['link/uri']==$_REQUEST['uri']) : echo ' selected="selected"'; endif;&lt;br /&gt;                echo "&gt;{$feed['link/name']}&lt;/option&gt;\n";&lt;br /&gt;        endforeach;&lt;br /&gt;        echo "&lt;/select&gt; ";&lt;br /&gt;        echo "&lt;input type=\"submit\" name=\"update\" value=\"Update\" /&gt;\n";&lt;br /&gt;        echo "&lt;/form&gt;\n";&lt;br /&gt;endif;&lt;br /&gt;&lt;br /&gt;if ($update_feeds_invoke != 'get') : // Only do things with side-effects for HTTP POST or command l&lt;br /&gt;ine&lt;br /&gt;        if ($update_feeds_display == 'text/html') : echo "&lt;ul&gt;\n"; endif;&lt;br /&gt;        $delta = @$feedwordpress-&gt;update($uri);&lt;br /&gt;        if ($update_feeds_display == 'text/html') : echo "&lt;/ul&gt;\n"; endif;&lt;br /&gt;&lt;br /&gt;        if (is_null($delta)) :&lt;br /&gt;                if ($update_feeds_invoke == 'cmd') :&lt;br /&gt;                        $stderr = fopen('php://stderr', 'w');&lt;br /&gt;                        fputs($stderr, "update-feeds (".date('Y-m-d H:i:s')."): ERROR: I don't synd&lt;br /&gt;icate &lt;$uri&gt;\n");&lt;br /&gt;                elseif ($update_feeds_display == 'text/plain') :&lt;br /&gt;                        echo "update-feeds (".date('Y-m-d H:i:s')."): ERROR: I don't syndicate &lt;$ur&lt;br /&gt;i&gt;\n";&lt;br /&gt;                else :&lt;br /&gt;                        echo "&lt;p&gt;&lt;strong&gt;Error:&lt;/strong&gt; I don't syndicate &lt;a href=\"$uri\"&gt;$uri&lt;/a&lt;br /&gt;&gt;&lt;/p&gt;\n";&lt;br /&gt;                endif;&lt;br /&gt;        elseif ($update_feeds_display=='text/html' or $update_feeds_verbose) :&lt;br /&gt;                $mesg = array();&lt;br /&gt;                if (isset($delta['new'])) : $mesg[] = ' '.$delta['new'].' new posts were syndicated&lt;br /&gt;'; endif;&lt;br /&gt;                if (isset($delta['updated'])) : $mesg[] = ' '.$delta['updated'].' existing posts we&lt;br /&gt;re updated'; endif;&lt;br /&gt;                if ($update_feeds_display=='text/html') : echo "&lt;p&gt;"; endif;&lt;br /&gt;                echo "Update complete.".implode(' and', $mesg);&lt;br /&gt;                if ($update_feeds_display=='text/html') : echo "&lt;/p&gt;"; endif;&lt;br /&gt;                echo "\n"; flush();&lt;br /&gt;        endif;&lt;br /&gt;endif;&lt;br /&gt;&lt;br /&gt;if ($update_feeds_display=='text/html') : // HTTP GET or HTTP POST: close off web niceties&lt;br /&gt;        echo &lt;&lt;&lt;EOHTML&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="../wp-admin"&gt;&amp;larr; Return to WordPress Dashboard&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;EOHTML;&lt;br /&gt;endif;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 11 Apr 2006 20:22:45 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1889</guid>
      <author>lordrich ()</author>
    </item>
  </channel>
</rss>
