Changeset 4236

Show
Ignore:
Timestamp:
09/25/06 02:26:14 (2 years ago)
Author:
ryan
Message:

Post date fixes. Props mdawaffe. fixes #878

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.0/wp-admin/import/rss.php

    r3374 r4236  
    4141            $post_title = $wpdb->escape(trim($post_title[1])); 
    4242 
    43             preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $post_date); 
     43            preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $post_date_gmt); 
    4444 
    45             if ($post_date) { 
    46                 $post_date = strtotime($post_date[1]); 
     45            if ($post_date_gmt) { 
     46                $post_date_gmt = strtotime($post_date_gmt[1]); 
    4747            } else { 
    4848                // if we don't already have something from pubDate 
    49                 preg_match('|<dc:date>(.*?)</dc:date>|is', $post, $post_date); 
    50                 $post_date = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date[1]); 
    51                 $post_date = str_replace('T', ' ', $post_date); 
    52                 $post_date = strtotime($post_date); 
     49                preg_match('|<dc:date>(.*?)</dc:date>|is', $post, $post_date_gmt); 
     50                $post_date_gmt = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date_gmt[1]); 
     51                $post_date_gmt = str_replace('T', ' ', $post_date_gmt); 
     52                $post_date_gmt = strtotime($post_date_gmt); 
    5353            } 
    5454 
    55             $post_date = gmdate('Y-m-d H:i:s', $post_date); 
     55            $post_date_gmt = gmdate('Y-m-d H:i:s', $post_date_gmt); 
     56            $post_date = get_date_from_gmt( $post_date_gmt ); 
    5657 
    5758            preg_match_all('|<category>(.*?)</category>|is', $post, $categories); 
     
    9192            $post_author = 1; 
    9293            $post_status = 'publish'; 
    93             $this->posts[$index] = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status', 'guid', 'categories'); 
     94            $this->posts[$index] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'guid', 'categories'); 
    9495            $index++; 
    9596        }