From 1dd2e8f0d1215272c0c62a28b8de0b3815f677b9 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 7 Oct 2005 17:43:43 +0000 Subject: [PATCH] Blogger updates from skeltoac. * No more SSL * No more fopen wrappers required (all CURL) * Better FTP handling * Better duplicate handling * Strings marked for translation * Post IDs are cronological * Coffee stays fresher longer. fixes #1737 git-svn-id: http://svn.automattic.com/wordpress/trunk@2939 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/import/blogger.php | 306 ++++++++++++++++++------------------ 1 file changed, 154 insertions(+), 152 deletions(-) diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index b43c0b56a..2067efa8f 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -1,31 +1,18 @@ -
-
- -

Are you looking for %title%? It is temporarily out of service. Please try again in an hour. Meanwhile, discover a better blogging tool.

- -<$BlogArchiveName$>
-
-
- -<$BlogItemDateTime$>|W|P|<$BlogItemAuthorNickname$>|W|P|<$BlogItemBody$>|W|P|<$BlogItemNumber$>|W|P|<$BlogItemTitle$>|W|P|<$BlogItemAuthorEmail$><$BlogCommentDateTime$>|W|P|<$BlogCommentAuthor$>|W|P|<$BlogCommentBody$> -'; // Shows the welcome screen and the magic iframe. function greet() { - echo '
'; - echo '

'.__('Import Blogger').'

'; - _e("

Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.

-

Before you get started, you may want to back up your Blogger template by copying and pasting it into a text file on your computer. This script has to modify your template and other Blogger settings so it can get your posts and comments. It should restore everything afterwards but if you have put a lot of work into your template, it would be a good idea to make your own backup first.

-

When you are ready to begin, enter your Blogger username and password below and click Start. Do not close this window until the process is complete.

"); - echo ""; - echo "

Reset this importer

"; - echo '
'; + $title = __('Import Blogger'); + $welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.'); + $noiframes = __('This feature requires iframe support.'); + $warning = __('This will delete everything saved by the Blogger importer except your posts and comments. Are you sure you want to do this?'); + $reset = __('Reset this importer'); + echo "

$title

$welcome

$reset

\n"; } // Deletes saved data and redirect. @@ -37,7 +24,10 @@ class Blogger_Import { // Generates a string that will make the page reload in a specified interval. function refresher($msec) { - return "\n\n"; + if ( $msec ) + return "\n\n\n"; + else + return "\n\n\n"; } // Returns associative array of code, header, cookies, body. Based on code from php.net. @@ -66,8 +56,9 @@ class Blogger_Import { // Prints a form for the user to enter Blogger creds. function login_form($text='') { - echo "

Log in to Blogger

\n

$text

\n"; - die("
"); + echo '

' . __('Log in to Blogger') . "

\n$text\n"; + echo '
' . __('Username') . ':
' . __('Password') . ':
'; + die; } // Sends creds to Blogger, returns the session cookies an array of headers. @@ -78,7 +69,7 @@ class Blogger_Import { curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$params); curl_setopt($ch, CURLOPT_URL,$_url); - curl_setopt($ch, CURLOPT_USERAGENT, 'Developing Blogger Exporter'); + curl_setopt($ch, CURLOPT_USERAGENT, 'Blogger Exporter'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_HEADER,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); @@ -86,6 +77,8 @@ class Blogger_Import { $response = $this->parse_response($response); + sleep(1); + return $response['cookies']; } @@ -96,8 +89,8 @@ class Blogger_Import { curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_USERAGENT, 'Blogger Exporter'); curl_setopt($ch, CURLOPT_HEADER,1); if (is_array($header)) curl_setopt($ch, CURLOPT_HTTPHEADER, $header); $response = curl_exec ($ch); @@ -124,13 +117,12 @@ class Blogger_Import { } if ($user && $pass) $params .= "username=$user&password=$pass"; $params = trim($params,'&'); - //echo addslashes(print_r(array('url'=>$url,'header'=>$header,'params'=>$params),1)); $ch = curl_init(); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$params); if ($user && $pass) curl_setopt($ch, CURLOPT_USERPWD,"{$user}:{$pass}"); curl_setopt($ch, CURLOPT_URL,$url); - curl_setopt($ch, CURLOPT_USERAGENT, 'Developing Blogger Exporter'); + curl_setopt($ch, CURLOPT_USERAGENT, 'Blogger Exporter'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER,$parse); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); @@ -149,7 +141,7 @@ class Blogger_Import { // Prints the list of blogs for import. function show_blogs() { global $import; - echo "

Selecting a Blog

\n