<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"
><channel><title>Muddled Ramblings and Half-Baked Ideas &#187; Haloscan</title> <atom:link href="http://muddledramblings.com/tag/haloscan/feed/" rel="self" type="application/rss+xml" /><link>http://muddledramblings.com</link> <description>A blog about a geek trying to make a living as a writer</description> <lastBuildDate>Sun, 05 Feb 2012 19:57:11 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator><itunes:summary>A blog about a geek trying to make a living as a writer</itunes:summary> <itunes:author>Jerry Seeger</itunes:author> <itunes:explicit>no</itunes:explicit> <itunes:image href="http://s3.amazonaws.com/muddlebucket/wp-content/uploads/iTunes/iTunes_img.jpg" /> <itunes:owner> <itunes:name>Jerry Seeger</itunes:name> <itunes:email>vikingjs+tunes@mac.com</itunes:email> </itunes:owner> <managingEditor>vikingjs+tunes@mac.com (Jerry Seeger)</managingEditor> <itunes:subtitle>A blog about a geek trying to make a living as a writer</itunes:subtitle> <itunes:keywords>short story, spoken</itunes:keywords> <image><title>Muddled Ramblings and Half-Baked Ideas &#187; Haloscan</title> <url>http://muddledramblings.com/wp-content/plugins/powerpress/rss_default.jpg</url><link>http://muddledramblings.com</link> </image> <itunes:category text="Arts"> <itunes:category text="Literature" /> </itunes:category> <item><title>Haloscan comments to WordPress &#8211; the nitty gritty.</title><link>http://muddledramblings.com/rumblings-from-the-secret-labs/haloscan-comments-to-wordpress-the-nitty-gritty/</link> <comments>http://muddledramblings.com/rumblings-from-the-secret-labs/haloscan-comments-to-wordpress-the-nitty-gritty/#comments</comments> <pubDate>Fri, 05 Feb 2010 21:41:00 +0000</pubDate> <dc:creator>Jerry</dc:creator> <category><![CDATA[Rumblings from the Secret Labs]]></category> <category><![CDATA[code]]></category> <category><![CDATA[Haloscan]]></category> <category><![CDATA[php]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://muddledramblings.com/?p=7970</guid> <description><![CDATA[... or, what I did last night.]]></description> <content:encoded><![CDATA[<p>As I mentioned in the previous episode, I recently had to move more than 8000 comments from my old comment system, Haloscan, and import them into WordPress. Haloscan served me well back in the day, but they are going away, and all my more recent comments are in the WordPress system anyway. Nice to have them all in one place.</p><p>The process turned out to be pretty easy. I found a script for importing comments from a different system, modified it, modified it some more, found a fundamental problem with it, fixed that, and in the end not much of code remained from the example, except the part where the WordPress logo is displayed on the screen. I assume that part came from the code the guy copied to make the code that I copied.</p><p>Along the way I learned a couple of things. PHP is a pretty flexible language, but running a loop that sets up 8500 data structures and runs 25500 database queries exposes PHP&#8217;s primary weakness: memory management. The whiz kids who invented PHP designed it for a load/compile/execute/exit-and-clean-up flow. Memory allocated during execution is cleaned up when the program is done running (usually when the Web page is delivered). When you try to do heavy lifting with PHP, you have to start paying attention to getting your memory back before the traditional clean-up time.</p><p>The code I started with did a direct database query to add the comment to the comments table, but that got things out of sync with other tables. (The posts table keeps track of the number of comments that apply to it, presumably for performance reasons.) I dug into the core WordPress code and found the method <em>they</em> call to post comments, and I made my code call that function. I have no idea what all the bookkeeping chores are that function does, and really I don&#8217;t care as long as they get done.</p><p>I didn&#8217;t worry about performance too much at first (after all, it only has to run once), but one of the database queries I did was really expensive (scanning all the posts for a specific set of characters). Even running on my local server it was slow, and I knew that if I tried something like that on my actual Web host alarms would go off and they&#8217;d shut me down for a while. I did a little optimization on that front, and it was enough.</p><p>The following script has some Muddle-specific code in it, but it might come in handy for others who need to move Haloscan comments to a new system. The part that parses Haloscan XML is pretty generic and would work for anyone, the part that saves the comments might be useful as a guide as well. The main difference others will have to deal with is where to get proper post_id based on the thread field in the XML. In my case I had a link in each blog episode back to the Haloscan thread.</p><p>The HTML bit in the middle of the file is not essential; but it puts a nice WordPress logo on the screen when the script starts up. I inherited that from the <a
href="http://afewthought.blogspot.com/2005/10/howto-import-comments-from-blogsome-to.html">script I started with</a>.</p><p><strong>NOTE:</strong> While this script has code in it specific to me, I am available to customize it for others who need to move their code from Haloscan into another environment, or, for that matter, from any structured source into WordPress. Drop me a line!</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'../wp-config.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;There doesn't seem to be a wp-config.php file. You must install WordPress before you import any comments.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'../wp-config.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> saveCommentToWP<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbRef</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$postThreads</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//echo &quot;here's where the comment save happens &lt;br/&gt;&lt;br /&gt;&quot;;</span>
    <span style="color: #000088;">$thread</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'thread'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$postID</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$postThreads</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$thread</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$postThreads</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$thread</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM wp_posts WHERE post_content LIKE '%&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$thread</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;%' AND post_status='publish'&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$postID</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dbRef</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_var</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$postThreads</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$thread</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$postID</span> ? <span style="color: #000088;">$postID</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$postThreads</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$thread</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;br /&gt;Thread <span style="color: #006699; font-weight: bold;">$thread</span> has no post!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">else</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;Thread <span style="color: #006699; font-weight: bold;">$thread</span>&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>       <span style="color: #666666; font-style: italic;">// got to have real-time updates!</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$postID</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$postID</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$userId</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'vikingjs@mac.com'</span> ? <span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//set up the data the way wp_insert_comment expects it.</span>
        <span style="color: #000088;">$wp_commentData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_post_ID'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$postID</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_id'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$userId</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_parent'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_author_IP'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ip'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_agent'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Haloscan'</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_date'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'datetime'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_date_gmt'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'datetime'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_approved'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'1'</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_content'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'text'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_author'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_author_email'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$wp_commentData</span> <span style="color: #339933;">=</span> wp_filter_comment<span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$comment_ID</span> <span style="color: #339933;">=</span> wp_insert_comment<span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//echo (&quot;&lt;strong&gt;saved comment $comment_ID&lt;/strong&gt;&quot;);</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// try to reclaim some memory</span>
    <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_commentData</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Content-Type: text/html; charset=utf-8'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;title&gt;WordPress &amp;rsaquo; Import Comments from RSS&lt;/title&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;style media=&quot;screen&quot; type=&quot;text/css&quot;&gt;
    body {
        font-family: Georgia, &quot;Times New Roman&quot;, Times, serif;
        margin-left: 20%;
        margin-right: 20%;
    }
    #logo {
        margin: 0;
        padding: 0;
        background-image: url(http://wordpress.org/images/logo.png);
        background-repeat: no-repeat;
        height: 60px;
        border-bottom: 4px solid #333;
    }
    #logo a {
        display: block;
        text-decoration: none;
        text-indent: -100em;
        height: 60px;
    }
    p {
        line-height: 140%;
    }
    &lt;/style&gt;
&lt;/head&gt;&lt;body&gt; 
&lt;h1 id=&quot;logo&quot;&gt;&lt;a href=&quot;http://wordpress.org/&quot;&gt;WordPress&lt;/a&gt;&lt;/h1&gt; 
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Bring in the data</span>
<span style="color: #000088;">$reader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XMLReader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">open</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'export-8.xml'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$postThreads</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$thread</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//echo &quot;&lt;br /&gt;read node type: &quot;.$reader-&gt;nodeType.';     '.$reader-&gt;name.': '.$reader-&gt;value;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeType</span> <span style="color: #339933;">==</span> XMLReader<span style="color: #339933;">::</span><span style="color: #004000;">ELEMENT</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'thread'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$thread</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$thread</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeType</span> <span style="color: #339933;">==</span> XMLReader<span style="color: #339933;">::</span><span style="color: #004000;">ELEMENT</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #666666; font-style: italic;">// begin building comment</span>
                <span style="color: #000088;">$comment</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thread'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$thread</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeType</span> <span style="color: #339933;">==</span> XMLReader<span style="color: #339933;">::</span><span style="color: #004000;">END_ELEMENT</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeType</span> <span style="color: #339933;">==</span> XMLReader<span style="color: #339933;">::</span><span style="color: #004000;">ELEMENT</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$property</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">;</span>
                        <span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// assumes text element following element tag has the data</span>
                        <span style="color: #000088;">$comment</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$property</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">value</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                    <span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                saveCommentToWP<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">,</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">,</span> <span style="color: #000088;">$postThreads</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>]]></content:encoded> <wfw:commentRss>http://muddledramblings.com/rumblings-from-the-secret-labs/haloscan-comments-to-wordpress-the-nitty-gritty/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>In with the Old</title><link>http://muddledramblings.com/rumblings-from-the-secret-labs/in-with-the-old/</link> <comments>http://muddledramblings.com/rumblings-from-the-secret-labs/in-with-the-old/#comments</comments> <pubDate>Fri, 05 Feb 2010 09:27:56 +0000</pubDate> <dc:creator>Jerry</dc:creator> <category><![CDATA[Rumblings from the Secret Labs]]></category> <category><![CDATA[geek]]></category> <category><![CDATA[Haloscan]]></category> <category><![CDATA[iBlog]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://muddledramblings.com/?p=7968</guid> <description><![CDATA[I got a message today that Haloscan is closing down. That is the service that provided refreshingly spam-free comments on my old blog. A year ago I finally abandoned iBlog for WordPress, and I&#8217;m glad I did. At the time, however, I didn&#8217;t want to tackle moving the old comments over into the new system. [...]]]></description> <content:encoded><![CDATA[<p>I got a message today that Haloscan is closing down. That is the service that provided refreshingly spam-free comments on my old blog. A year ago I finally abandoned iBlog for WordPress, and I&#8217;m glad I did. At the time, however, I didn&#8217;t want to tackle moving the old comments over into the new system. In my conversion I embedded a link into each of the old episodes to the legacy comment system, and left it at that.</p><p>It is fortunate I found out about Haloscan when I did. Another week and 8500 comments would have been lost forever. That&#8217;s a big part of the underlayer of this blog, the part people sink gradually into as they hang around more, and they realize that this isn&#8217;t just about me. There are some pretty interesting conversations, observations, poems, and even stories in those comments. With the timer running I set to work to get the comments out of Haloscan and into WordPress.</p><p>The move turned out to be pretty straightforward. (Simpler, perhaps, than it had been to put the links into the posts.) I&#8217;ll go into the technical details in an episode tomorrow, but for now, why don&#8217;t you pop into the archives for 2004 or so and find an old episode with good comments? Maybe you&#8217;ll find something interesting someone said once. Maybe you&#8217;ll see the name of someone you haven&#8217;t thought of in a while. Maybe you&#8217;ll see something you want to comment on, even.</p> ]]></content:encoded> <wfw:commentRss>http://muddledramblings.com/rumblings-from-the-secret-labs/in-with-the-old/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Content Delivery Network via Amazon Web Services: S3: muddlebucket.s3.amazonaws.com

Served from: muddledramblings.com @ 2012-02-08 12:51:07 -->
