[wp-cvs] wordpress/wp-admin import-rss.php,1.9,1.10
Matthew Mullenweg
saxmatt at users.sourceforge.net
Tue Feb 1 10:04:04 GMT 2005
Update of /cvsroot/cafelog/wordpress/wp-admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16976/wp-admin
Modified Files:
import-rss.php
Log Message:
Preserve GUIDs in imports
Index: import-rss.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/import-rss.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** import-rss.php 14 Dec 2004 08:58:11 -0000 1.9
--- import-rss.php 1 Feb 2005 10:04:01 -0000 1.10
***************
*** 111,114 ****
--- 111,118 ----
endif;
+ preg_match('|<guid.+?>(.*?)</guid>|is', $post, $guid);
+ if ($guid) $guid = addslashes( trim($guid[1]) );
+ else $guid = '';
+
preg_match('|<content:encoded>(.*?)</content:encoded>|is', $post, $content);
$content = str_replace( array('<![CDATA[', ']]>'), '', addslashes( trim($content[1]) ) );
***************
*** 138,144 ****
$wpdb->query("INSERT INTO $wpdb->posts
! (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name)
VALUES
! ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')");
$post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
if (!$post_id) die("couldn't get post ID");
--- 142,148 ----
$wpdb->query("INSERT INTO $wpdb->posts
! (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name, guid)
VALUES
! ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name', '$guid')");
$post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
if (!$post_id) die("couldn't get post ID");
More information about the cvs
mailing list