Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import/rss.php

    r4349 r3374  
    2020        return strtr($string, $trans_tbl);
    2121    }
    22 
     22   
    2323    function greet() {
    24         echo '<div class="narrow">';
    2524        echo '<p>'.__('Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>';
    2625        wp_import_upload_form("admin.php?import=rss&amp;step=1");
    27         echo '</div>';
    2826    }
    2927
    3028    function get_posts() {
    3129        global $wpdb;
    32 
     30       
    3331        set_magic_quotes_runtime(0);
    3432        $datalines = file($this->file); // Read the file into an array
     
    4139        foreach ($this->posts as $post) {
    4240            preg_match('|<title>(.*?)</title>|is', $post, $post_title);
    43             $post_title = str_replace(array('<![CDATA[', ']]>'), '', $wpdb->escape( trim($post_title[1]) ));
     41            $post_title = $wpdb->escape(trim($post_title[1]));
    4442
    45             preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $post_date_gmt);
     43            preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $post_date);
    4644
    47             if ($post_date_gmt) {
    48                 $post_date_gmt = strtotime($post_date_gmt[1]);
     45            if ($post_date) {
     46                $post_date = strtotime($post_date[1]);
    4947            } else {
    5048                // if we don't already have something from pubDate
    51                 preg_match('|<dc:date>(.*?)</dc:date>|is', $post, $post_date_gmt);
    52                 $post_date_gmt = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date_gmt[1]);
    53                 $post_date_gmt = str_replace('T', ' ', $post_date_gmt);
    54                 $post_date_gmt = strtotime($post_date_gmt);
     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);
    5553            }
    5654
    57             $post_date_gmt = gmdate('Y-m-d H:i:s', $post_date_gmt);
    58             $post_date = get_date_from_gmt( $post_date_gmt );
     55            $post_date = gmdate('Y-m-d H:i:s', $post_date);
    5956
    6057            preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
     
    9491            $post_author = 1;
    9592            $post_status = 'publish';
    96             $this->posts[$index] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'guid', 'categories');
     93            $this->posts[$index] = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status', 'guid', 'categories');
    9794            $index++;
    9895        }
     
    138135        $this->import_posts();
    139136        wp_import_cleanup($file['id']);
    140 
     137       
    141138        echo '<h3>';
    142139        printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
     
    151148
    152149        $this->header();
    153 
     150       
    154151        switch ($step) {
    155152            case 0 :
     
    160157                break;
    161158        }
    162 
     159       
    163160        $this->footer();
    164161    }
    165162
    166163    function RSS_Import() {
    167         // Nothing.
     164        // Nothing. 
    168165    }
    169166}
     
    171168$rss_import = new RSS_Import();
    172169
    173 register_importer('rss', __('RSS'), __('Import posts from an RSS feed'), array ($rss_import, 'dispatch'));
     170register_importer('rss', 'RSS', __('Import posts from an RSS feed'), array ($rss_import, 'dispatch'));
    174171?>
Note: See TracChangeset for help on using the changeset viewer.