From 907019e813364af3fd026ccdab015fc18b44ca3c Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 25 Sep 2006 02:26:14 +0000 Subject: [PATCH] Post date fixes. Props mdawaffe. fixes #878 git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4236 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/import/rss.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/wp-admin/import/rss.php b/wp-admin/import/rss.php index e4a81673df..bd26980bce 100644 --- a/wp-admin/import/rss.php +++ b/wp-admin/import/rss.php @@ -40,19 +40,20 @@ class RSS_Import { preg_match('|(.*?)|is', $post, $post_title); $post_title = $wpdb->escape(trim($post_title[1])); - preg_match('|(.*?)|is', $post, $post_date); + preg_match('|(.*?)|is', $post, $post_date_gmt); - if ($post_date) { - $post_date = strtotime($post_date[1]); + if ($post_date_gmt) { + $post_date_gmt = strtotime($post_date_gmt[1]); } else { // if we don't already have something from pubDate - preg_match('|(.*?)|is', $post, $post_date); - $post_date = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date[1]); - $post_date = str_replace('T', ' ', $post_date); - $post_date = strtotime($post_date); + preg_match('|(.*?)|is', $post, $post_date_gmt); + $post_date_gmt = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date_gmt[1]); + $post_date_gmt = str_replace('T', ' ', $post_date_gmt); + $post_date_gmt = strtotime($post_date_gmt); } - $post_date = gmdate('Y-m-d H:i:s', $post_date); + $post_date_gmt = gmdate('Y-m-d H:i:s', $post_date_gmt); + $post_date = get_date_from_gmt( $post_date_gmt ); preg_match_all('|(.*?)|is', $post, $categories); $categories = $categories[1]; @@ -90,7 +91,7 @@ class RSS_Import { $post_author = 1; $post_status = 'publish'; - $this->posts[$index] = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status', 'guid', 'categories'); + $this->posts[$index] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'guid', 'categories'); $index++; } }