<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12270] trunk/wp-admin/import: Filter imported comments</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12270">12270</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2009-11-24 14:40:25 +0000 (Tue, 24 Nov 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Filter imported comments</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminimportbloggerphp">trunk/wp-admin/import/blogger.php</a></li>
<li><a href="#trunkwpadminimportdotclearphp">trunk/wp-admin/import/dotclear.php</a></li>
<li><a href="#trunkwpadminimportlivejournalphp">trunk/wp-admin/import/livejournal.php</a></li>
<li><a href="#trunkwpadminimporttextpatternphp">trunk/wp-admin/import/textpattern.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminimportbloggerphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/import/blogger.php (12269 => 12270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/import/blogger.php        2009-11-24 14:00:41 UTC (rev 12269)
+++ trunk/wp-admin/import/blogger.php        2009-11-24 14:40:25 UTC (rev 12270)
</span><span class="lines">@@ -622,6 +622,7 @@
</span><span class="cx">                 } else {
</span><span class="cx">                         $comment = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_date', 'comment_content');
</span><span class="cx"> 
</span><ins>+                        $comment = wp_filter_comment($comment);
</ins><span class="cx">                         $comment_id = wp_insert_comment($comment);
</span><span class="cx"> 
</span><span class="cx">                         $this-&gt;blogs[$importing_blog]['comments'][$entry-&gt;old_permalink] = $comment_id;
</span></span></pre></div>
<a id="trunkwpadminimportdotclearphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/import/dotclear.php (12269 => 12270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/import/dotclear.php        2009-11-24 14:00:41 UTC (rev 12269)
+++ trunk/wp-admin/import/dotclear.php        2009-11-24 14:40:25 UTC (rev 12270)
</span><span class="lines">@@ -413,11 +413,7 @@
</span><span class="cx">                                 $web = &quot;http://&quot;.$wpdb-&gt;escape($comment_site);
</span><span class="cx">                                 $message = $wpdb-&gt;escape(textconv ($comment_content));
</span><span class="cx"> 
</span><del>-                                if($cinfo = comment_exists($name, $comment_dt))
-                                {
-                                        // Update comments
-                                        $ret_id = wp_update_comment(array(
-                                                        'comment_ID'                =&gt; $cinfo,
</del><ins>+                                $comment = array(
</ins><span class="cx">                                                         'comment_post_ID'        =&gt; $comment_post_ID,
</span><span class="cx">                                                         'comment_author'        =&gt; $name,
</span><span class="cx">                                                         'comment_author_email'        =&gt; $email,
</span><span class="lines">@@ -426,23 +422,16 @@
</span><span class="cx">                                                         'comment_date'                =&gt; $comment_dt,
</span><span class="cx">                                                         'comment_date_gmt'        =&gt; $comment_dt,
</span><span class="cx">                                                         'comment_content'        =&gt; $message,
</span><del>-                                                        'comment_approved'        =&gt; $comment_approved)
-                                                        );
-                                }
-                                else
-                                {
</del><ins>+                                                        'comment_approved'        =&gt; $comment_approved);
+                                $comment = wp_filter_comment($comment);
+
+                                if ( $cinfo = comment_exists($name, $comment_dt) ) {
+                                        // Update comments
+                                        $comment['comment_ID'] = $cinfo;
+                                        $ret_id = wp_update_comment($comment);
+                                } else {
</ins><span class="cx">                                         // Insert comments
</span><del>-                                        $ret_id = wp_insert_comment(array(
-                                                        'comment_post_ID'        =&gt; $comment_post_ID,
-                                                        'comment_author'        =&gt; $name,
-                                                        'comment_author_email'        =&gt; $email,
-                                                        'comment_author_url'        =&gt; $web,
-                                                        'comment_author_IP'        =&gt; $comment_ip,
-                                                        'comment_date'                =&gt; $comment_dt,
-                                                        'comment_date_gmt'        =&gt; $comment_dt,
-                                                        'comment_content'        =&gt; $message,
-                                                        'comment_approved'        =&gt; $comment_approved)
-                                                        );
</del><ins>+                                        $ret_id = wp_insert_comment($comment);
</ins><span class="cx">                                 }
</span><span class="cx">                                 $dccm2wpcm[$comment_ID] = $ret_id;
</span><span class="cx">                         }
</span></span></pre></div>
<a id="trunkwpadminimportlivejournalphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/import/livejournal.php (12269 => 12270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/import/livejournal.php        2009-11-24 14:00:41 UTC (rev 12269)
+++ trunk/wp-admin/import/livejournal.php        2009-11-24 14:40:25 UTC (rev 12270)
</span><span class="lines">@@ -535,6 +535,7 @@
</span><span class="cx"> 
</span><span class="cx">                                 // Parse this comment into an array and insert
</span><span class="cx">                                 $comment = $this-&gt;parse_comment( $comment );
</span><ins>+                                $comment = wp_filter_comment( $comment );
</ins><span class="cx">                                 $id = wp_insert_comment( $comment );
</span><span class="cx"> 
</span><span class="cx">                                 // Clear cache
</span></span></pre></div>
<a id="trunkwpadminimporttextpatternphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/import/textpattern.php (12269 => 12270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/import/textpattern.php        2009-11-24 14:00:41 UTC (rev 12269)
+++ trunk/wp-admin/import/textpattern.php        2009-11-24 14:40:25 UTC (rev 12270)
</span><span class="lines">@@ -397,33 +397,24 @@
</span><span class="cx">                                 $web = $wpdb-&gt;escape($web);
</span><span class="cx">                                 $message = $wpdb-&gt;escape($message);
</span><span class="cx"> 
</span><del>-                                if($cinfo = comment_exists($name, $posted))
-                                {
</del><ins>+                                $comment = array(
+                                                        'comment_post_ID'        =&gt; $comment_post_ID,
+                                                        'comment_author'        =&gt; $name,
+                                                        'comment_author_IP'        =&gt; $ip,
+                                                        'comment_author_email'        =&gt; $email,
+                                                        'comment_author_url'        =&gt; $web,
+                                                        'comment_date'                =&gt; $posted,
+                                                        'comment_content'        =&gt; $message,
+                                                        'comment_approved'        =&gt; $comment_approved);
+                                $comment = wp_filter_comment($comment);
+
+                                if ( $cinfo = comment_exists($name, $posted) ) {
</ins><span class="cx">                                         // Update comments
</span><del>-                                        $ret_id = wp_update_comment(array(
-                                                'comment_ID'                        =&gt; $cinfo,
-                                                'comment_post_ID'                =&gt; $comment_post_ID,
-                                                'comment_author'                =&gt; $name,
-                                                'comment_author_email'        =&gt; $email,
-                                                'comment_author_url'        =&gt; $web,
-                                                'comment_date'                        =&gt; $posted,
-                                                'comment_content'                =&gt; $message,
-                                                'comment_approved'                =&gt; $comment_approved)
-                                                );
-                                }
-                                else
-                                {
</del><ins>+                                        $comment['comment_ID'] = $cinfo;
+                                        $ret_id = wp_update_comment($comment);
+                                } else {
</ins><span class="cx">                                         // Insert comments
</span><del>-                                        $ret_id = wp_insert_comment(array(
-                                                'comment_post_ID'                =&gt; $comment_post_ID,
-                                                'comment_author'                =&gt; $name,
-                                                'comment_author_email'        =&gt; $email,
-                                                'comment_author_url'        =&gt; $web,
-                                                'comment_author_IP'                =&gt; $ip,
-                                                'comment_date'                        =&gt; $posted,
-                                                'comment_content'                =&gt; $message,
-                                                'comment_approved'                =&gt; $comment_approved)
-                                                );
</del><ins>+                                        $ret_id = wp_insert_comment($comment);
</ins><span class="cx">                                 }
</span><span class="cx">                                 $txpcm2wpcm[$comment_ID] = $ret_id;
</span><span class="cx">                         }
</span></span></pre>
</div>
</div>

</body>
</html>