diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index c200fba114..0495a7ade3 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -1,663 +1,663 @@ -

$title

$welcome

"; - if ( function_exists('curl_init') ) - echo "

$reset

"; - else - echo "

$incompat

"; - echo "\n"; - } - - // Deletes saved data and redirect. - function restart() { - delete_option('import-blogger'); - header("Location: admin.php?import=blogger"); - die(); - } - - // Generates a string that will make the page reload in a specified interval. - function refresher($msec) { - 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. - function parse_response($this_response) { - // Split response into header and body sections - list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2); - $response_header_lines = explode("\r\n", $response_headers); - - // First line of headers is the HTTP response code - $http_response_line = array_shift($response_header_lines); - if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; } - - // put the rest of the headers in an array - $response_header_array = array(); - foreach($response_header_lines as $header_line) { - list($header,$value) = explode(': ', $header_line, 2); - $response_header_array[$header] .= $value."\n"; - } - - $cookie_array = array(); - $cookies = explode("\n", $response_header_array["Set-Cookie"]); - foreach($cookies as $this_cookie) { array_push($cookie_array, "Cookie: ".$this_cookie); } - - return array("code" => $response_code, "header" => $response_header_array, "cookies" => $cookie_array, "body" => $response_body); - } - - // Prints a form for the user to enter Blogger creds. - function login_form($text='') { - echo '

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

\n$text\n"; - echo '
' . __('Username') . ':
' . __('Password') . ':
'; - die; - } - - // Sends creds to Blogger, returns the session cookies an array of headers. - function login_blogger($user, $pass) { - $_url = 'http://www.blogger.com/login.do'; - $params = "username=$user&password=$pass"; - $ch = curl_init(); - curl_setopt($ch, CURLOPT_POST,1); - curl_setopt($ch, CURLOPT_POSTFIELDS,$params); - curl_setopt($ch, CURLOPT_URL,$_url); - 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); - $response = curl_exec ($ch); - - $response = $this->parse_response($response); - - sleep(1); - - return $response['cookies']; - } - - // Requests page from Blogger, returns the response array. - function get_blogger($url, $header = '', $user=false, $pass=false) { - $ch = curl_init(); - if ($user && $pass) curl_setopt($ch, CURLOPT_USERPWD,"{$user}:{$pass}"); - curl_setopt($ch, CURLOPT_URL,$url); - curl_setopt($ch, CURLOPT_TIMEOUT, 10); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - 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); - - $response = $this->parse_response($response); - $response['url'] = $url; - - if (curl_errno($ch)) { - print curl_error($ch); - } else { - curl_close($ch); - } - - return $response; - } - - // Posts data to Blogger, returns response array. - function post_blogger($url, $header = false, $paramary = false, $parse=true) { - $params = ''; - if ( is_array($paramary) ) { - foreach($paramary as $key=>$value) - if($key && $value != '') - $params.=$key."=".urlencode(stripslashes($value))."&"; - } - if ($user && $pass) $params .= "username=$user&password=$pass"; - $params = trim($params,'&'); - $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, 'Blogger Exporter'); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt($ch, CURLOPT_HEADER,$parse); - curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); - if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header); - $response = curl_exec ($ch); - - if ($parse) { - $response = $this->parse_response($response); - $response['url'] = $url; - return $response; - } - - return $response; - } - - // Prints the list of blogs for import. - function show_blogs() { - global $import; - echo '

' . __('Selecting a Blog') . "

\n\n"); - } - - // Publishes. - function publish_blogger($i, $text) { - $head = $this->refresher(2000) . "

$text

\n"; - if ( ! strstr($this->import['blogs'][$_GET['blog']]['publish'][$i], 'http') ) { - // First call. Start the publish process with a fresh set of cookies. - $this->import['cookies'] = $this->login_blogger($this->import['user'], $this->import['pass']); - update_option('import-blogger', $this->import); - $paramary = array('blogID' => $_GET['blog'], 'all' => '1', 'republishAll' => 'Republish Entire Blog', 'publish' => '1', 'redirectUrl' => "/publish.do?blogID={$_GET['blog']}&inprogress=true"); - - $response = $this->post_blogger("http://www.blogger.com/publish.do?blogID={$_GET['blog']}", $this->import['cookies'], $paramary); - if ( $response['code'] == '302' ) { - $url = str_replace('publish.g', 'publish-body.g', $response['header']['Location']); - $this->import['blogs'][$_GET['blog']]['publish'][$i] = $url; - update_option('import-blogger', $this->import); - $response = $this->get_blogger($url, $this->import['cookies']); - preg_match('#

.*

#U', $response['body'], $matches); - $progress = $matches[0]; - die($head . $progress); - } else { - $this->import['blogs'][$_GET['blog']]['publish'][$i] = false; - update_option('import-blogger', $this->import); - die($head); - } - } else { - // Subsequent call. Keep checking status until Blogger reports publish complete. - $url = $this->import['blogs'][$_GET['blog']]['publish'][$i]; - $response = $this->get_blogger($url, $this->import['cookies']); - if ( preg_match('#

.*

#U', $response['body'], $matches) ) { - $progress = $matches[0]; - if ( strstr($progress, '100%') ) { - $this->set_next_step($i); - $progress .= '

'.__('Moving on...').'

'; - } - die($head . $progress); - } else { - $this->import['blogs'][$_GET['blog']]['publish'][$i] = false; - update_option('import-blogger', $this->import); - die("$head

" . __('Trying again...') . '

'); - } - } - } - - // Sets next step, saves options - function set_next_step($step) { - $this->import['blogs'][$_GET['blog']]['nextstep'] = $step; - update_option('import-blogger', $this->import); - } - - // Redirects to next step - function do_next_step() { - header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}"); - die(); - } - - // Step 0: Do Blogger login, get blogid/title pairs. - function do_login() { - if ( ( ! $this->import['user'] && ! is_array($this->import['cookies']) ) ) { - // The user must provide a Blogger username and password. - if ( ! ( $_POST['user'] && $_POST['pass'] ) ) { - $this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:

  1. Back up your Blogger template.
  2. Back up any other Blogger settings you might need later.
  3. Log out of Blogger
  4. Log in here with your Blogger username and password.
  5. On the next screen, click one of your Blogger blogs.
  6. Do not close this window or navigate away until the process is complete.
')); - } - - // Try logging in. If we get an array of cookies back, we at least connected. - $this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']); - if ( !is_array( $this->import['cookies'] ) ) { - $this->login_form("Login failed. Please enter your credentials again."); - } - - // Save the password so we can log the browser in when it's time to publish. - $this->import['pass'] = $_POST['pass']; - $this->import['user'] = $_POST['user']; - - // Get the Blogger welcome page and scrape the blog numbers and names from it - $response = $this->get_blogger('http://www.blogger.com/home', $this->import['cookies']); - if (! stristr($response['body'], 'signed in as') ) $this->login_form("Login failed. Please re-enter your username and password."); - $blogsary = array(); - preg_match_all('#posts\.g\?blogID=(\d+)">([^<]+)#U', $response['body'], $blogsary); - if ( ! count( $blogsary[1] < 1 ) ) - die(__('No blogs found for this user.')); - $this->import['blogs'] = array(); - $template = '


'.__('Are you looking for %title%? It is temporarily out of service. Please try again in a few minutes. 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$>'; - foreach ( $blogsary[1] as $key => $id ) { - // Define the required Blogger options. - $blog_opts = array( - 'blog-options-basic' => false, - 'blog-options-archiving' => array('archiveFrequency' => 'm'), - 'blog-publishing' => array('publishMode'=>'0', 'blogID' => "$id", 'subdomain' => mt_rand().mt_rand(), 'pingWeblogs' => 'false'), - 'blog-formatting' => array('timeStampFormat' => '0', 'encoding'=>'UTF-8', 'convertLineBreaks'=>'false', 'floatAlignment'=>'false'), - 'blog-comments' => array('commentsTimeStampFormat' => '0'), - 'template-edit' => array( 'templateText' => str_replace('%title%', trim($blogsary[2][$key]), $template) ) - ); - - // Build the blog options array template - foreach ($blog_opts as $blog_opt => $modify) - $new_opts["$blog_opt"] = array('backup'=>false, 'modify' => $modify, 'error'=>false); - - $this->import['blogs']["$id"] = array( - 'id' => $id, - 'title' => trim($blogsary[2][$key]), - 'options' => $new_opts, - 'url' => false, - 'publish_cookies' => false, - 'published' => false, - 'archives' => false, - 'lump_authors' => false, - 'newusers' => array(), - 'nextstep' => 2 - ); - } - update_option('import-blogger', $this->import); - header("Location: admin.php?import=blogger&noheader=true&step=1"); - } - die(); - } - - // Step 1: Select one of the blogs belonging to the user logged in. - function select_blog() { - if ( is_array($this->import['blogs']) ) { - $this->show_blogs(); - die(); - } else { - $this->restart(); - } - } - - // Step 2: Backup the Blogger options pages, updating some of them. - function backup_settings() { - $output.= "

Backing up Blogger options

\n"; - $form = false; - foreach ($this->import['blogs'][$_GET['blog']]['options'] as $blog_opt => $optary) { - if ( $blog_opt == $_GET['form'] ) { - // Save the posted form data - $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['backup'] = $_POST; - update_option('import-blogger',$this->import); - - // Post the modified form data to Blogger - if ( $optary['modify'] ) { - $posturl = "http://www.blogger.com/{$blog_opt}.do"; - $headers = array_merge($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'], $this->import['cookies']); - if ( 'blog-publishing' == $blog_opt ) { - if ( $_POST['publishMode'] > 0 ) { - $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode=0", $headers); - if ( $response['code'] >= 400 ) - die('

'.__('Failed attempt to change publish mode from FTP to BlogSpot.').'

' . addslashes(print_r($headers, 1)) . addslashes(print_r($response, 1)) . '
'); - $this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $optary['modify']['subdomain'] . '.blogspot.com/'; - sleep(2); - } else { - $this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $_POST['subdomain'] . '.blogspot.com/'; - update_option('import-blogger', $this->import); - $output .= "

$blog_opt

\n"; - continue; - } - $paramary = $optary['modify']; - } else { - $paramary = array_merge($_POST, $optary['modify']); - } - $response = $this->post_blogger($posturl, $headers, $paramary); - if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') ) - die('

'.__('Error on form submission. Retry or reset the importer.').'

' . addslashes(print_r($response, 1))); - } - $output .= "

$blog_opt

\n"; - } elseif ( is_array($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['backup']) ) { - // This option set has already been backed up. - $output .= "

$blog_opt

\n"; - } elseif ( ! $form ) { - // This option page needs to be downloaded and given to the browser for submission back to this script. - $response = $this->get_blogger("http://www.blogger.com/{$blog_opt}.g?blogID={$_GET['blog']}", $this->import['cookies']); - $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'] = $response['cookies']; - update_option('import-blogger',$this->import); - $body = $response['body']; - $body = preg_replace("|\]*>|ms","",$body); - $body = preg_replace("|/?{$blog_opt}.do|","admin.php?import=blogger&noheader=true&step=2&blog={$_GET['blog']}&form={$blog_opt}",$body); - $body = str_replace("name='submit'","name='supermit'",$body); - $body = str_replace('name="submit"','name="supermit"',$body); - $body = str_replace('','',str_replace('','',$body)); - $form = "
"; - $form.= $body; - $form.= "
"; - $output.= "

$blog_opt in progress, please wait...

\n"; - } else { - $output.= "

$blog_opt

\n"; - } - } - if ( $form ) - die($output . $form); - - $this->set_next_step(4); - $this->do_next_step(); - } - - // Step 3: Cancelled :-) - - // Step 4: Publish with the new template and settings. - function publish_blog() { - $this->publish_blogger(5, __('Publishing with new template and options')); - } - - // Step 5: Get the archive URLs from the new blog. - function get_archive_urls() { - $bloghtml = $this->get_blogger($this->import['blogs'][$_GET['blog']]['url']); - if (! strstr($bloghtml['body'], 'import['blogs'][$_GET['blog']]['archives'][$archive] = false; - } - $this->set_next_step(6); - $this->do_next_step(); - } - - // Step 6: Get each monthly archive, import it, mark it done. - function get_archive() { - global $wpdb; - $output = '

'.__('Importing Blogger archives into WordPress').'

'; - $did_one = false; - $post_array = $posts = array(); - foreach ( $this->import['blogs'][$_GET['blog']]['archives'] as $url => $status ) { - $archivename = substr(basename($url),0,7); - if ( $status || $did_one ) { - $foo = 'bar'; - // Do nothing. - } else { - // Import the selected month - $postcount = 0; - $skippedpostcount = 0; - $commentcount = 0; - $skippedcommentcount = 0; - $status = __('in progress...'); - $this->import['blogs'][$_GET['blog']]['archives']["$url"] = $status; - update_option('import-blogger', $import); - $archive = $this->get_blogger($url); - if ( $archive['code'] > 200 ) - continue; - $posts = explode('', $archive['body']); - for ($i = 1; $i < count($posts); $i = $i + 1) { - $postparts = explode('', $posts[$i]); - $postinfo = explode('|W|P|', $postparts[0]); - $post_date = $postinfo[0]; - $post_content = $postinfo[2]; - // Don't try to re-use the original numbers - // because the new, longer numbers are too - // big to handle as ints. - //$post_number = $postinfo[3]; - $post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3]; - $post_author_name = $wpdb->escape(trim($postinfo[1])); - $post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org'; - - if ( $this->lump_authors ) { - // Ignore Blogger authors. Use the current user_ID for all posts imported. - $post_author = $GLOBALS['user_ID']; - } else { - // Add a user for each new author encountered. - if (! username_exists($post_author_name) ) { - $user_login = $wpdb->escape($post_author_name); - $user_email = $wpdb->escape($post_author_email); - $user_password = substr(md5(uniqid(microtime())), 0, 6); - $result = wp_create_user( $user_login, $user_password, $user_email ); - $status.= "Registered user $user_login. "; - $this->import['blogs'][$_GET['blog']]['newusers'][] = $user_login; - } - $userdata = get_userdatabylogin( $post_author_name ); - $post_author = $userdata->ID; - } - $post_date = explode(' ', $post_date); - $post_date_Ymd = explode('/', $post_date[0]); - $postyear = $post_date_Ymd[2]; - $postmonth = zeroise($post_date_Ymd[0], 2); - $postday = zeroise($post_date_Ymd[1], 2); - $post_date_His = explode(':', $post_date[1]); - $posthour = zeroise($post_date_His[0], 2); - $postminute = zeroise($post_date_His[1], 2); - $postsecond = zeroise($post_date_His[2], 2); - - if (($post_date[2] == 'PM') && ($posthour != '12')) - $posthour = $posthour + 12; - else if (($post_date[2] == 'AM') && ($posthour == '12')) - $posthour = '00'; - - $post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond"; - - $post_content = addslashes($post_content); - $post_content = str_replace(array('
','
','
','
','
','
'), "\n", $post_content); // the XHTML touch... ;) - - $post_title = addslashes($post_title); - - $post_status = 'publish'; - - if ( $ID = post_exists($post_title, '', $post_date) ) { - $post_array[$i]['ID'] = $ID; - $skippedpostcount++; - } else { - $post_array[$i]['post'] = compact('post_author', 'post_content', 'post_title', 'post_category', 'post_author', 'post_date', 'post_status'); - $post_array[$i]['comments'] = false; - } - - // Import any comments attached to this post. - if ($postparts[1]) : - for ($j = 1; $j < count($postparts); $j = $j + 1) { - $commentinfo = explode('|W|P|', $postparts[$j]); - $comment_date = explode(' ', $commentinfo[0]); - $comment_date_Ymd = explode('/', $comment_date[0]); - $commentyear = $comment_date_Ymd[2]; - $commentmonth = zeroise($comment_date_Ymd[0], 2); - $commentday = zeroise($comment_date_Ymd[1], 2); - $comment_date_His = explode(':', $comment_date[1]); - $commenthour = zeroise($comment_date_His[0], 2); - $commentminute = zeroise($comment_date_His[1], 2); - $commentsecond = '00'; - if (($comment_date[2] == 'PM') && ($commenthour != '12')) - $commenthour = $commenthour + 12; - else if (($comment_date[2] == 'AM') && ($commenthour == '12')) - $commenthour = '00'; - $comment_date = "$commentyear-$commentmonth-$commentday $commenthour:$commentminute:$commentsecond"; - $comment_author = addslashes(strip_tags(html_entity_decode($commentinfo[1]))); - if ( strpos($commentinfo[1], 'a href') ) { - $comment_author_parts = explode('"', htmlentities($commentinfo[1])); - $comment_author_url = $comment_author_parts[1]; - } else $comment_author_url = ''; - $comment_content = $commentinfo[2]; - $comment_content = str_replace(array('
','
','
','
','
','
'), "\n", $comment_content); - $comment_approved = 1; - if ( comment_exists($comment_author, $comment_date) ) { - $skippedcommentcount++; - } else { - $comment = compact('comment_author', 'comment_author_url', 'comment_date', 'comment_content', 'comment_approved'); - $post_array[$i]['comments'][$j] = wp_filter_comment($comment); - } - $commentcount++; - } - endif; - $postcount++; - } - if ( count($post_array) ) { - krsort($post_array); - foreach($post_array as $post) { - if ( ! $comment_post_ID = $post['ID'] ) - $comment_post_ID = wp_insert_post($post['post']); - if ( $post['comments'] ) { - foreach ( $post['comments'] as $comment ) { - $comment['comment_post_ID'] = $comment_post_ID; - wp_insert_comment($comment); - } - } - } - } - $status = "$postcount ".__('post(s) parsed,')." $skippedpostcount ".__('skipped...')." $commentcount ".__('comment(s) parsed,')." $skippedcommentcount ".__('skipped...').' '.__('Done').''; - $import = $this->import; - $import['blogs'][$_GET['blog']]['archives']["$url"] = $status; - update_option('import-blogger', $import); - $did_one = true; - } - $output.= "

$archivename $status

\n"; - } - if ( ! $did_one ) - $this->set_next_step(7); - die( $this->refresher(1000) . $output ); - } - - // Step 7: Restore the backed-up settings to Blogger - function restore_settings() { - $output = '

'.__('Restoring your Blogger options')."

\n"; - $did_one = false; - // Restore options in reverse order. - if ( ! $this->import['reversed'] ) { - $this->import['blogs'][$_GET['blog']]['options'] = array_reverse($this->import['blogs'][$_GET['blog']]['options'], true); - $this->import['reversed'] = true; - update_option('import-blogger', $this->import); - } - foreach ( $this->import['blogs'][$_GET['blog']]['options'] as $blog_opt => $optary ) { - if ( $did_one ) { - $output .= "

$blog_opt

\n"; - } elseif ( $optary['restored'] || ! $optary['modify'] ) { - $output .= "

$blog_opt

\n"; - } else { - $posturl = "http://www.blogger.com/{$blog_opt}.do"; - $headers = array_merge($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'], $this->import['cookies']); - if ( 'blog-publishing' == $blog_opt) { - if ( $optary['backup']['publishMode'] > 0 ) { - $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode={$optary['backup']['publishMode']}", $headers); - sleep(2); - if ( $response['code'] >= 400 ) - die('

Error restoring publishMode.

Please tell the devs.

' . addslashes(print_r($response, 1)) ); - } - } - if ( $optary['backup'] != $optary['modify'] ) { - $response = $this->post_blogger($posturl, $headers, $optary['backup']); - if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') ) { - $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['error'] = true; - update_option('import-blogger', $this->import); - $output .= "

$blog_opt ".__('failed. Trying again.').'

'; - } else { - $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['restored'] = true; - update_option('import-blogger', $this->import); - $output .= "

$blog_opt ".__('restored.').'

'; - } - } - $did_one = true; - } - } - - if ( $did_one ) { - die( $this->refresher(1000) . $output ); - } elseif ( $this->import['blogs'][$_GET['blog']]['options']['blog-publishing']['backup']['publishMode'] > 0 ) { - $this->set_next_step(9); - } else { - $this->set_next_step(8); - } - - $this->do_next_step(); - } - - // Step 8: Republish, all back to normal - function republish_blog() { - $this->publish_blogger(9, __('Publishing with original template and options')); - } - - // Step 9: Congratulate the user - function congrats() { - echo '

'.__('Congratulations!').'

'.__('Now that you have imported your Blogger blog into WordPress, what are you going to do? Here are some suggestions:').'

'; - } - - // Figures out what to do, then does it. - function start() { - if ( $_GET['restart'] == 'true' ) { - $this->restart(); - } - - if ( isset($_GET['noheader']) ) { - $this->import = get_settings('import-blogger'); - - if ( false === $this->import ) { - $step = 0; - } elseif ( isset($_GET['step']) ) { - $step = (int) $_GET['step']; - } elseif ( isset($_GET['blog']) && isset($this->import['blogs'][$_GET['blog']]['nextstep']) ) { - $step = $this->import['blogs'][$_GET['blog']]['nextstep']; - } elseif ( is_array($this->import['blogs']) ) { - $step = 1; - } else { - $step = 0; - } -//echo "Step $step."; -//die('
'.print_r($this->import,1).'do_login();
-					break;
-				case 1 :
-					$this->select_blog();
-					break;
-				case 2 :
-					$this->backup_settings();
-					break;
-				case 3 :
-					$this->wait_for_blogger();
-					break;
-				case 4 :
-					$this->publish_blog();
-					break;
-				case 5 :
-					$this->get_archive_urls();
-					break;
-				case 6 :
-					$this->get_archive();
-					break;
-				case 7 :
-					$this->restore_settings();
-					break;
-				case 8 :
-					$this->republish_blog();
-					break;
-				case 9 :
-					$this->congrats();
-					break;
-			}
-			die;
-			
-		} else {
-			$this->greet();
-		}
-	}
-
-	function Blogger_Import() {
-		// This space intentionally left blank.
-	}
-}
-
-$blogger_import = new Blogger_Import();
-
-register_importer('blogger', 'Blogger', __('Import posts and comments from a Blogger account'), array ($blogger_import, 'start'));
-
-?>
+

$title

$welcome

"; + if ( function_exists('curl_init') ) + echo "

$reset

"; + else + echo "

$incompat

"; + echo "\n"; + } + + // Deletes saved data and redirect. + function restart() { + delete_option('import-blogger'); + header("Location: admin.php?import=blogger"); + die(); + } + + // Generates a string that will make the page reload in a specified interval. + function refresher($msec) { + 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. + function parse_response($this_response) { + // Split response into header and body sections + list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2); + $response_header_lines = explode("\r\n", $response_headers); + + // First line of headers is the HTTP response code + $http_response_line = array_shift($response_header_lines); + if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; } + + // put the rest of the headers in an array + $response_header_array = array(); + foreach($response_header_lines as $header_line) { + list($header,$value) = explode(': ', $header_line, 2); + $response_header_array[$header] .= $value."\n"; + } + + $cookie_array = array(); + $cookies = explode("\n", $response_header_array["Set-Cookie"]); + foreach($cookies as $this_cookie) { array_push($cookie_array, "Cookie: ".$this_cookie); } + + return array("code" => $response_code, "header" => $response_header_array, "cookies" => $cookie_array, "body" => $response_body); + } + + // Prints a form for the user to enter Blogger creds. + function login_form($text='') { + echo '

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

\n$text\n"; + echo '
' . __('Username') . ':
' . __('Password') . ':
'; + die; + } + + // Sends creds to Blogger, returns the session cookies an array of headers. + function login_blogger($user, $pass) { + $_url = 'http://www.blogger.com/login.do'; + $params = "username=$user&password=$pass"; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_POST,1); + curl_setopt($ch, CURLOPT_POSTFIELDS,$params); + curl_setopt($ch, CURLOPT_URL,$_url); + 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); + $response = curl_exec ($ch); + + $response = $this->parse_response($response); + + sleep(1); + + return $response['cookies']; + } + + // Requests page from Blogger, returns the response array. + function get_blogger($url, $header = '', $user=false, $pass=false) { + $ch = curl_init(); + if ($user && $pass) curl_setopt($ch, CURLOPT_USERPWD,"{$user}:{$pass}"); + curl_setopt($ch, CURLOPT_URL,$url); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + 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); + + $response = $this->parse_response($response); + $response['url'] = $url; + + if (curl_errno($ch)) { + print curl_error($ch); + } else { + curl_close($ch); + } + + return $response; + } + + // Posts data to Blogger, returns response array. + function post_blogger($url, $header = false, $paramary = false, $parse=true) { + $params = ''; + if ( is_array($paramary) ) { + foreach($paramary as $key=>$value) + if($key && $value != '') + $params.=$key."=".urlencode(stripslashes($value))."&"; + } + if ($user && $pass) $params .= "username=$user&password=$pass"; + $params = trim($params,'&'); + $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, 'Blogger Exporter'); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_HEADER,$parse); + curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); + if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header); + $response = curl_exec ($ch); + + if ($parse) { + $response = $this->parse_response($response); + $response['url'] = $url; + return $response; + } + + return $response; + } + + // Prints the list of blogs for import. + function show_blogs() { + global $import; + echo '

' . __('Selecting a Blog') . "

\n\n"); + } + + // Publishes. + function publish_blogger($i, $text) { + $head = $this->refresher(2000) . "

$text

\n"; + if ( ! strstr($this->import['blogs'][$_GET['blog']]['publish'][$i], 'http') ) { + // First call. Start the publish process with a fresh set of cookies. + $this->import['cookies'] = $this->login_blogger($this->import['user'], $this->import['pass']); + update_option('import-blogger', $this->import); + $paramary = array('blogID' => $_GET['blog'], 'all' => '1', 'republishAll' => 'Republish Entire Blog', 'publish' => '1', 'redirectUrl' => "/publish.do?blogID={$_GET['blog']}&inprogress=true"); + + $response = $this->post_blogger("http://www.blogger.com/publish.do?blogID={$_GET['blog']}", $this->import['cookies'], $paramary); + if ( $response['code'] == '302' ) { + $url = str_replace('publish.g', 'publish-body.g', $response['header']['Location']); + $this->import['blogs'][$_GET['blog']]['publish'][$i] = $url; + update_option('import-blogger', $this->import); + $response = $this->get_blogger($url, $this->import['cookies']); + preg_match('#

.*

#U', $response['body'], $matches); + $progress = $matches[0]; + die($head . $progress); + } else { + $this->import['blogs'][$_GET['blog']]['publish'][$i] = false; + update_option('import-blogger', $this->import); + die($head); + } + } else { + // Subsequent call. Keep checking status until Blogger reports publish complete. + $url = $this->import['blogs'][$_GET['blog']]['publish'][$i]; + $response = $this->get_blogger($url, $this->import['cookies']); + if ( preg_match('#

.*

#U', $response['body'], $matches) ) { + $progress = $matches[0]; + if ( strstr($progress, '100%') ) { + $this->set_next_step($i); + $progress .= '

'.__('Moving on...').'

'; + } + die($head . $progress); + } else { + $this->import['blogs'][$_GET['blog']]['publish'][$i] = false; + update_option('import-blogger', $this->import); + die("$head

" . __('Trying again...') . '

'); + } + } + } + + // Sets next step, saves options + function set_next_step($step) { + $this->import['blogs'][$_GET['blog']]['nextstep'] = $step; + update_option('import-blogger', $this->import); + } + + // Redirects to next step + function do_next_step() { + header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}"); + die(); + } + + // Step 0: Do Blogger login, get blogid/title pairs. + function do_login() { + if ( ( ! $this->import['user'] && ! is_array($this->import['cookies']) ) ) { + // The user must provide a Blogger username and password. + if ( ! ( $_POST['user'] && $_POST['pass'] ) ) { + $this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:

  1. Back up your Blogger template.
  2. Back up any other Blogger settings you might need later.
  3. Log out of Blogger
  4. Log in here with your Blogger username and password.
  5. On the next screen, click one of your Blogger blogs.
  6. Do not close this window or navigate away until the process is complete.
')); + } + + // Try logging in. If we get an array of cookies back, we at least connected. + $this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']); + if ( !is_array( $this->import['cookies'] ) ) { + $this->login_form("Login failed. Please enter your credentials again."); + } + + // Save the password so we can log the browser in when it's time to publish. + $this->import['pass'] = $_POST['pass']; + $this->import['user'] = $_POST['user']; + + // Get the Blogger welcome page and scrape the blog numbers and names from it + $response = $this->get_blogger('http://www.blogger.com/home', $this->import['cookies']); + if (! stristr($response['body'], 'signed in as') ) $this->login_form("Login failed. Please re-enter your username and password."); + $blogsary = array(); + preg_match_all('#posts\.g\?blogID=(\d+)">([^<]+)#U', $response['body'], $blogsary); + if ( ! count( $blogsary[1] < 1 ) ) + die(__('No blogs found for this user.')); + $this->import['blogs'] = array(); + $template = '


'.__('Are you looking for %title%? It is temporarily out of service. Please try again in a few minutes. 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$>'; + foreach ( $blogsary[1] as $key => $id ) { + // Define the required Blogger options. + $blog_opts = array( + 'blog-options-basic' => false, + 'blog-options-archiving' => array('archiveFrequency' => 'm'), + 'blog-publishing' => array('publishMode'=>'0', 'blogID' => "$id", 'subdomain' => mt_rand().mt_rand(), 'pingWeblogs' => 'false'), + 'blog-formatting' => array('timeStampFormat' => '0', 'encoding'=>'UTF-8', 'convertLineBreaks'=>'false', 'floatAlignment'=>'false'), + 'blog-comments' => array('commentsTimeStampFormat' => '0'), + 'template-edit' => array( 'templateText' => str_replace('%title%', trim($blogsary[2][$key]), $template) ) + ); + + // Build the blog options array template + foreach ($blog_opts as $blog_opt => $modify) + $new_opts["$blog_opt"] = array('backup'=>false, 'modify' => $modify, 'error'=>false); + + $this->import['blogs']["$id"] = array( + 'id' => $id, + 'title' => trim($blogsary[2][$key]), + 'options' => $new_opts, + 'url' => false, + 'publish_cookies' => false, + 'published' => false, + 'archives' => false, + 'lump_authors' => false, + 'newusers' => array(), + 'nextstep' => 2 + ); + } + update_option('import-blogger', $this->import); + header("Location: admin.php?import=blogger&noheader=true&step=1"); + } + die(); + } + + // Step 1: Select one of the blogs belonging to the user logged in. + function select_blog() { + if ( is_array($this->import['blogs']) ) { + $this->show_blogs(); + die(); + } else { + $this->restart(); + } + } + + // Step 2: Backup the Blogger options pages, updating some of them. + function backup_settings() { + $output.= "

Backing up Blogger options

\n"; + $form = false; + foreach ($this->import['blogs'][$_GET['blog']]['options'] as $blog_opt => $optary) { + if ( $blog_opt == $_GET['form'] ) { + // Save the posted form data + $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['backup'] = $_POST; + update_option('import-blogger',$this->import); + + // Post the modified form data to Blogger + if ( $optary['modify'] ) { + $posturl = "http://www.blogger.com/{$blog_opt}.do"; + $headers = array_merge($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'], $this->import['cookies']); + if ( 'blog-publishing' == $blog_opt ) { + if ( $_POST['publishMode'] > 0 ) { + $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode=0", $headers); + if ( $response['code'] >= 400 ) + die('

'.__('Failed attempt to change publish mode from FTP to BlogSpot.').'

' . addslashes(print_r($headers, 1)) . addslashes(print_r($response, 1)) . '
'); + $this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $optary['modify']['subdomain'] . '.blogspot.com/'; + sleep(2); + } else { + $this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $_POST['subdomain'] . '.blogspot.com/'; + update_option('import-blogger', $this->import); + $output .= "

$blog_opt

\n"; + continue; + } + $paramary = $optary['modify']; + } else { + $paramary = array_merge($_POST, $optary['modify']); + } + $response = $this->post_blogger($posturl, $headers, $paramary); + if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') ) + die('

'.__('Error on form submission. Retry or reset the importer.').'

' . addslashes(print_r($response, 1))); + } + $output .= "

$blog_opt

\n"; + } elseif ( is_array($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['backup']) ) { + // This option set has already been backed up. + $output .= "

$blog_opt

\n"; + } elseif ( ! $form ) { + // This option page needs to be downloaded and given to the browser for submission back to this script. + $response = $this->get_blogger("http://www.blogger.com/{$blog_opt}.g?blogID={$_GET['blog']}", $this->import['cookies']); + $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'] = $response['cookies']; + update_option('import-blogger',$this->import); + $body = $response['body']; + $body = preg_replace("|\]*>|ms","",$body); + $body = preg_replace("|/?{$blog_opt}.do|","admin.php?import=blogger&noheader=true&step=2&blog={$_GET['blog']}&form={$blog_opt}",$body); + $body = str_replace("name='submit'","name='supermit'",$body); + $body = str_replace('name="submit"','name="supermit"',$body); + $body = str_replace('','',str_replace('','',$body)); + $form = "
"; + $form.= $body; + $form.= "
"; + $output.= "

$blog_opt in progress, please wait...

\n"; + } else { + $output.= "

$blog_opt

\n"; + } + } + if ( $form ) + die($output . $form); + + $this->set_next_step(4); + $this->do_next_step(); + } + + // Step 3: Cancelled :-) + + // Step 4: Publish with the new template and settings. + function publish_blog() { + $this->publish_blogger(5, __('Publishing with new template and options')); + } + + // Step 5: Get the archive URLs from the new blog. + function get_archive_urls() { + $bloghtml = $this->get_blogger($this->import['blogs'][$_GET['blog']]['url']); + if (! strstr($bloghtml['body'], 'import['blogs'][$_GET['blog']]['archives'][$archive] = false; + } + $this->set_next_step(6); + $this->do_next_step(); + } + + // Step 6: Get each monthly archive, import it, mark it done. + function get_archive() { + global $wpdb; + $output = '

'.__('Importing Blogger archives into WordPress').'

'; + $did_one = false; + $post_array = $posts = array(); + foreach ( $this->import['blogs'][$_GET['blog']]['archives'] as $url => $status ) { + $archivename = substr(basename($url),0,7); + if ( $status || $did_one ) { + $foo = 'bar'; + // Do nothing. + } else { + // Import the selected month + $postcount = 0; + $skippedpostcount = 0; + $commentcount = 0; + $skippedcommentcount = 0; + $status = __('in progress...'); + $this->import['blogs'][$_GET['blog']]['archives']["$url"] = $status; + update_option('import-blogger', $import); + $archive = $this->get_blogger($url); + if ( $archive['code'] > 200 ) + continue; + $posts = explode('', $archive['body']); + for ($i = 1; $i < count($posts); $i = $i + 1) { + $postparts = explode('', $posts[$i]); + $postinfo = explode('|W|P|', $postparts[0]); + $post_date = $postinfo[0]; + $post_content = $postinfo[2]; + // Don't try to re-use the original numbers + // because the new, longer numbers are too + // big to handle as ints. + //$post_number = $postinfo[3]; + $post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3]; + $post_author_name = $wpdb->escape(trim($postinfo[1])); + $post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org'; + + if ( $this->lump_authors ) { + // Ignore Blogger authors. Use the current user_ID for all posts imported. + $post_author = $GLOBALS['user_ID']; + } else { + // Add a user for each new author encountered. + if (! username_exists($post_author_name) ) { + $user_login = $wpdb->escape($post_author_name); + $user_email = $wpdb->escape($post_author_email); + $user_password = substr(md5(uniqid(microtime())), 0, 6); + $result = wp_create_user( $user_login, $user_password, $user_email ); + $status.= "Registered user $user_login. "; + $this->import['blogs'][$_GET['blog']]['newusers'][] = $user_login; + } + $userdata = get_userdatabylogin( $post_author_name ); + $post_author = $userdata->ID; + } + $post_date = explode(' ', $post_date); + $post_date_Ymd = explode('/', $post_date[0]); + $postyear = $post_date_Ymd[2]; + $postmonth = zeroise($post_date_Ymd[0], 2); + $postday = zeroise($post_date_Ymd[1], 2); + $post_date_His = explode(':', $post_date[1]); + $posthour = zeroise($post_date_His[0], 2); + $postminute = zeroise($post_date_His[1], 2); + $postsecond = zeroise($post_date_His[2], 2); + + if (($post_date[2] == 'PM') && ($posthour != '12')) + $posthour = $posthour + 12; + else if (($post_date[2] == 'AM') && ($posthour == '12')) + $posthour = '00'; + + $post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond"; + + $post_content = addslashes($post_content); + $post_content = str_replace(array('
','
','
','
','
','
'), "\n", $post_content); // the XHTML touch... ;) + + $post_title = addslashes($post_title); + + $post_status = 'publish'; + + if ( $ID = post_exists($post_title, '', $post_date) ) { + $post_array[$i]['ID'] = $ID; + $skippedpostcount++; + } else { + $post_array[$i]['post'] = compact('post_author', 'post_content', 'post_title', 'post_category', 'post_author', 'post_date', 'post_status'); + $post_array[$i]['comments'] = false; + } + + // Import any comments attached to this post. + if ($postparts[1]) : + for ($j = 1; $j < count($postparts); $j = $j + 1) { + $commentinfo = explode('|W|P|', $postparts[$j]); + $comment_date = explode(' ', $commentinfo[0]); + $comment_date_Ymd = explode('/', $comment_date[0]); + $commentyear = $comment_date_Ymd[2]; + $commentmonth = zeroise($comment_date_Ymd[0], 2); + $commentday = zeroise($comment_date_Ymd[1], 2); + $comment_date_His = explode(':', $comment_date[1]); + $commenthour = zeroise($comment_date_His[0], 2); + $commentminute = zeroise($comment_date_His[1], 2); + $commentsecond = '00'; + if (($comment_date[2] == 'PM') && ($commenthour != '12')) + $commenthour = $commenthour + 12; + else if (($comment_date[2] == 'AM') && ($commenthour == '12')) + $commenthour = '00'; + $comment_date = "$commentyear-$commentmonth-$commentday $commenthour:$commentminute:$commentsecond"; + $comment_author = addslashes(strip_tags(html_entity_decode($commentinfo[1]))); + if ( strpos($commentinfo[1], 'a href') ) { + $comment_author_parts = explode('"', htmlentities($commentinfo[1])); + $comment_author_url = $comment_author_parts[1]; + } else $comment_author_url = ''; + $comment_content = $commentinfo[2]; + $comment_content = str_replace(array('
','
','
','
','
','
'), "\n", $comment_content); + $comment_approved = 1; + if ( comment_exists($comment_author, $comment_date) ) { + $skippedcommentcount++; + } else { + $comment = compact('comment_author', 'comment_author_url', 'comment_date', 'comment_content', 'comment_approved'); + $post_array[$i]['comments'][$j] = wp_filter_comment($comment); + } + $commentcount++; + } + endif; + $postcount++; + } + if ( count($post_array) ) { + krsort($post_array); + foreach($post_array as $post) { + if ( ! $comment_post_ID = $post['ID'] ) + $comment_post_ID = wp_insert_post($post['post']); + if ( $post['comments'] ) { + foreach ( $post['comments'] as $comment ) { + $comment['comment_post_ID'] = $comment_post_ID; + wp_insert_comment($comment); + } + } + } + } + $status = "$postcount ".__('post(s) parsed,')." $skippedpostcount ".__('skipped...')." $commentcount ".__('comment(s) parsed,')." $skippedcommentcount ".__('skipped...').' '.__('Done').''; + $import = $this->import; + $import['blogs'][$_GET['blog']]['archives']["$url"] = $status; + update_option('import-blogger', $import); + $did_one = true; + } + $output.= "

$archivename $status

\n"; + } + if ( ! $did_one ) + $this->set_next_step(7); + die( $this->refresher(1000) . $output ); + } + + // Step 7: Restore the backed-up settings to Blogger + function restore_settings() { + $output = '

'.__('Restoring your Blogger options')."

\n"; + $did_one = false; + // Restore options in reverse order. + if ( ! $this->import['reversed'] ) { + $this->import['blogs'][$_GET['blog']]['options'] = array_reverse($this->import['blogs'][$_GET['blog']]['options'], true); + $this->import['reversed'] = true; + update_option('import-blogger', $this->import); + } + foreach ( $this->import['blogs'][$_GET['blog']]['options'] as $blog_opt => $optary ) { + if ( $did_one ) { + $output .= "

$blog_opt

\n"; + } elseif ( $optary['restored'] || ! $optary['modify'] ) { + $output .= "

$blog_opt

\n"; + } else { + $posturl = "http://www.blogger.com/{$blog_opt}.do"; + $headers = array_merge($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'], $this->import['cookies']); + if ( 'blog-publishing' == $blog_opt) { + if ( $optary['backup']['publishMode'] > 0 ) { + $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode={$optary['backup']['publishMode']}", $headers); + sleep(2); + if ( $response['code'] >= 400 ) + die('

Error restoring publishMode.

Please tell the devs.

' . addslashes(print_r($response, 1)) ); + } + } + if ( $optary['backup'] != $optary['modify'] ) { + $response = $this->post_blogger($posturl, $headers, $optary['backup']); + if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') ) { + $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['error'] = true; + update_option('import-blogger', $this->import); + $output .= "

$blog_opt ".__('failed. Trying again.').'

'; + } else { + $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['restored'] = true; + update_option('import-blogger', $this->import); + $output .= "

$blog_opt ".__('restored.').'

'; + } + } + $did_one = true; + } + } + + if ( $did_one ) { + die( $this->refresher(1000) . $output ); + } elseif ( $this->import['blogs'][$_GET['blog']]['options']['blog-publishing']['backup']['publishMode'] > 0 ) { + $this->set_next_step(9); + } else { + $this->set_next_step(8); + } + + $this->do_next_step(); + } + + // Step 8: Republish, all back to normal + function republish_blog() { + $this->publish_blogger(9, __('Publishing with original template and options')); + } + + // Step 9: Congratulate the user + function congrats() { + echo '

'.__('Congratulations!').'

'.__('Now that you have imported your Blogger blog into WordPress, what are you going to do? Here are some suggestions:').'

'; + } + + // Figures out what to do, then does it. + function start() { + if ( $_GET['restart'] == 'true' ) { + $this->restart(); + } + + if ( isset($_GET['noheader']) ) { + $this->import = get_settings('import-blogger'); + + if ( false === $this->import ) { + $step = 0; + } elseif ( isset($_GET['step']) ) { + $step = (int) $_GET['step']; + } elseif ( isset($_GET['blog']) && isset($this->import['blogs'][$_GET['blog']]['nextstep']) ) { + $step = $this->import['blogs'][$_GET['blog']]['nextstep']; + } elseif ( is_array($this->import['blogs']) ) { + $step = 1; + } else { + $step = 0; + } +//echo "Step $step."; +//die('
'.print_r($this->import,1).'do_login();
+					break;
+				case 1 :
+					$this->select_blog();
+					break;
+				case 2 :
+					$this->backup_settings();
+					break;
+				case 3 :
+					$this->wait_for_blogger();
+					break;
+				case 4 :
+					$this->publish_blog();
+					break;
+				case 5 :
+					$this->get_archive_urls();
+					break;
+				case 6 :
+					$this->get_archive();
+					break;
+				case 7 :
+					$this->restore_settings();
+					break;
+				case 8 :
+					$this->republish_blog();
+					break;
+				case 9 :
+					$this->congrats();
+					break;
+			}
+			die;
+			
+		} else {
+			$this->greet();
+		}
+	}
+
+	function Blogger_Import() {
+		// This space intentionally left blank.
+	}
+}
+
+$blogger_import = new Blogger_Import();
+
+register_importer('blogger', 'Blogger', __('Import posts and comments from a Blogger account'), array ($blogger_import, 'start'));
+
+?>
diff --git a/wp-includes/js/tinymce/themes/advanced/about.htm b/wp-includes/js/tinymce/themes/advanced/about.htm
index f4130fdfe4..bbd8d1389a 100644
--- a/wp-includes/js/tinymce/themes/advanced/about.htm
+++ b/wp-includes/js/tinymce/themes/advanced/about.htm
@@ -1,52 +1,52 @@
-
-
-	{$lang_about_title}
-	
-	
-	
-	
-
-
-		
-
-		
-
-

{$lang_about_title}

-

Version: {$tinymce_version} ({$tinymce_releasedate})

-

TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL - by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.

-

Copyright © 2005, Moxiecode Systems AB, All rights reserved.

-

For more information about this software visit the TinyMCE website.

- -
-
- -
-
-

{$lang_loaded_plugins}

- -
-
- -

 

-
-
- -
-
-
-
- -
-
- -
-
- - + + + {$lang_about_title} + + + + + + + + +
+
+

{$lang_about_title}

+

Version: {$tinymce_version} ({$tinymce_releasedate})

+

TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL + by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.

+

Copyright © 2005, Moxiecode Systems AB, All rights reserved.

+

For more information about this software visit the TinyMCE website.

+ +
+
+ +
+
+

{$lang_loaded_plugins}

+ +
+
+ +

 

+
+
+ +
+
+
+
+ +
+
+ +
+
+ + diff --git a/wp-includes/js/tinymce/themes/advanced/anchor.htm b/wp-includes/js/tinymce/themes/advanced/anchor.htm index 6fbe53f23a..48ba245f49 100644 --- a/wp-includes/js/tinymce/themes/advanced/anchor.htm +++ b/wp-includes/js/tinymce/themes/advanced/anchor.htm @@ -1,32 +1,32 @@ - - - {$lang_insert_anchor_title} - - - - -
- - - - - - - - - -
{$lang_insert_anchor_title}
{$lang_insert_anchor_name}:
- -
-
- -
- -
- -
-
- -
- - + + + {$lang_insert_anchor_title} + + + + +
+ + + + + + + + + +
{$lang_insert_anchor_title}
{$lang_insert_anchor_name}:
+ +
+
+ +
+ +
+ +
+
+ +
+ + diff --git a/wp-includes/js/tinymce/themes/advanced/charmap.htm b/wp-includes/js/tinymce/themes/advanced/charmap.htm index 59d893d4f2..bcebff243e 100644 --- a/wp-includes/js/tinymce/themes/advanced/charmap.htm +++ b/wp-includes/js/tinymce/themes/advanced/charmap.htm @@ -1,52 +1,52 @@ - - - {$lang_theme_charmap_title} - - - - - - - - - - - - - - - - -
{$lang_theme_charmap_title}
- - - - - - - - - -
 
 
-
- - - - - - - - - - - - - - - - -
HTML-Code
 
 
NUM-Code
 
-
- - - + + + {$lang_theme_charmap_title} + + + + + + + + + + + + + + + + +
{$lang_theme_charmap_title}
+ + + + + + + + + +
 
 
+
+ + + + + + + + + + + + + + + + +
HTML-Code
 
 
NUM-Code
 
+
+ + + diff --git a/wp-includes/js/tinymce/themes/advanced/color_picker.htm b/wp-includes/js/tinymce/themes/advanced/color_picker.htm index 374d84636d..e35d711e45 100644 --- a/wp-includes/js/tinymce/themes/advanced/color_picker.htm +++ b/wp-includes/js/tinymce/themes/advanced/color_picker.htm @@ -1,12 +1,12 @@ - - - {$lang_theme_colorpicker_title} - - - - -
- -
- - + + + {$lang_theme_colorpicker_title} + + + + +
+ +
+ + diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/about.js b/wp-includes/js/tinymce/themes/advanced/jscripts/about.js index fc33f85c44..9cb015d3a7 100644 --- a/wp-includes/js/tinymce/themes/advanced/jscripts/about.js +++ b/wp-includes/js/tinymce/themes/advanced/jscripts/about.js @@ -1,74 +1,74 @@ -function init() { - tinyMCEPopup.resizeToInnerSize(); - - // Give FF some time - window.setTimeout('insertHelpIFrame();', 10); - - var tcont = document.getElementById('plugintablecontainer'); - var plugins = tinyMCE.getParam('plugins', '', true, ','); - if (plugins.length == 0) - document.getElementById('plugins_tab').style.display = 'none'; - - var html = ""; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - - for (var i=0; i' + info.longname + ''; - else - html += ''; - - if (info.authorurl != null && info.authorurl != '') - html += ''; - else - html += ''; - - html += ''; - html += ''; - } - - html += ''; - html += '
' + tinyMCE.getLang('lang_plugin') + '' + tinyMCE.getLang('lang_author') + '' + tinyMCE.getLang('lang_version') + '
' + info.longname + '' + info.author + '' + info.author + '' + info.version + '
'; - - tcont.innerHTML = html; -} - -function getPluginInfo(name) { - var fn = eval('tinyMCEPopup.windowOpener.TinyMCE_' + name + '_getInfo'); - - if (typeof(fn) != 'undefined') - return fn(); - - return { - longname : name, - authorurl : '', - infourl : '', - author : '--', - version : '--' - }; -} - -function insertHelpIFrame() { - var html = ''; - - document.getElementById('iframecontainer').innerHTML = html; - - html = ''; - html += 'Got Moxie? '; - html += 'Hosted By Sourceforge '; - html += 'Also on freshmeat '; - - document.getElementById('buttoncontainer').innerHTML = html; -} +function init() { + tinyMCEPopup.resizeToInnerSize(); + + // Give FF some time + window.setTimeout('insertHelpIFrame();', 10); + + var tcont = document.getElementById('plugintablecontainer'); + var plugins = tinyMCE.getParam('plugins', '', true, ','); + if (plugins.length == 0) + document.getElementById('plugins_tab').style.display = 'none'; + + var html = ""; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + for (var i=0; i' + info.longname + ''; + else + html += ''; + + if (info.authorurl != null && info.authorurl != '') + html += ''; + else + html += ''; + + html += ''; + html += ''; + } + + html += ''; + html += '
' + tinyMCE.getLang('lang_plugin') + '' + tinyMCE.getLang('lang_author') + '' + tinyMCE.getLang('lang_version') + '
' + info.longname + '' + info.author + '' + info.author + '' + info.version + '
'; + + tcont.innerHTML = html; +} + +function getPluginInfo(name) { + var fn = eval('tinyMCEPopup.windowOpener.TinyMCE_' + name + '_getInfo'); + + if (typeof(fn) != 'undefined') + return fn(); + + return { + longname : name, + authorurl : '', + infourl : '', + author : '--', + version : '--' + }; +} + +function insertHelpIFrame() { + var html = ''; + + document.getElementById('iframecontainer').innerHTML = html; + + html = ''; + html += 'Got Moxie? '; + html += 'Hosted By Sourceforge '; + html += 'Also on freshmeat '; + + document.getElementById('buttoncontainer').innerHTML = html; +} diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/anchor.js b/wp-includes/js/tinymce/themes/advanced/jscripts/anchor.js index 446a3ce2be..a89f9729d4 100644 --- a/wp-includes/js/tinymce/themes/advanced/jscripts/anchor.js +++ b/wp-includes/js/tinymce/themes/advanced/jscripts/anchor.js @@ -1,59 +1,59 @@ -var action, element; - -function init() { - tinyMCEPopup.resizeToInnerSize(); - - var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id')); - var anchor = tinyMCE.getParentElement(inst.getFocusElement(), "a", "name"); - var img = inst.getFocusElement(); - action = 'insert'; - - if (anchor != null) { - element = anchor; - action = "update"; - } - - if (tinyMCE.getAttrib(img, "class") == "mceItemAnchor") { - element = img; - action = "update"; - } - - if (action == "update") - document.forms[0].anchorName.value = element.nodeName == "IMG" ? element.getAttribute("title") : element.getAttribute("name"); - - document.forms[0].insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true); -} - -function insertAnchor() { - var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id')); - var name = document.forms[0].anchorName.value; - - tinyMCEPopup.execCommand("mceBeginUndoLevel"); - - if (action == "update") { - if (element.nodeName == "IMG") - element.setAttribute("title", name); - else - element.setAttribute("name", name); - } else { - var rng = inst.getRng(); - - if (rng.collapse) - rng.collapse(false); - - name = name.replace(/&/g, '&'); - name = name.replace(/\"/g, '"'); - name = name.replace(//g, '&gr;'); - - html = ''; - - tinyMCEPopup.execCommand("mceInsertContent", false, html); - tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst); - } - - tinyMCEPopup.execCommand("mceEndUndoLevel"); - - tinyMCE.triggerNodeChange(); - tinyMCEPopup.close(); -} +var action, element; + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id')); + var anchor = tinyMCE.getParentElement(inst.getFocusElement(), "a", "name"); + var img = inst.getFocusElement(); + action = 'insert'; + + if (anchor != null) { + element = anchor; + action = "update"; + } + + if (tinyMCE.getAttrib(img, "class") == "mceItemAnchor") { + element = img; + action = "update"; + } + + if (action == "update") + document.forms[0].anchorName.value = element.nodeName == "IMG" ? element.getAttribute("title") : element.getAttribute("name"); + + document.forms[0].insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true); +} + +function insertAnchor() { + var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id')); + var name = document.forms[0].anchorName.value; + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + if (action == "update") { + if (element.nodeName == "IMG") + element.setAttribute("title", name); + else + element.setAttribute("name", name); + } else { + var rng = inst.getRng(); + + if (rng.collapse) + rng.collapse(false); + + name = name.replace(/&/g, '&'); + name = name.replace(/\"/g, '"'); + name = name.replace(//g, '&gr;'); + + html = ''; + + tinyMCEPopup.execCommand("mceInsertContent", false, html); + tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + + tinyMCE.triggerNodeChange(); + tinyMCEPopup.close(); +} diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js b/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js index bc9df27b35..2f758cfa8d 100644 --- a/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js +++ b/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js @@ -1,324 +1,324 @@ -function init() { - tinyMCEPopup.resizeToInnerSize(); -} - -var charmap = new Array(); - -// for mor details please see w3c.org -// now here is the complete list ;) - -charmap = [ - [' ', ' ', true, 'no-break space'], - ['&', '&', true, 'ampersand'], - ['"', '"', true, 'quotation mark'], -// finance - ['¢', '¢', true, 'cent sign'], - ['€', '€', true, 'euro sign'], - ['£', '£', true, 'pound sign'], - ['¥', '¥', true, 'yen sign'], -// signs - ['©', '©', true, 'copyright sign'], - ['®', '®', true, 'registered sign'], - ['™', '™', true, 'trade mark sign'], - ['‰', '‰', true, 'per mille sign'], - ['µ', 'µ', true, 'micro sign'], - ['·', '·', true, 'middle dot'], - ['•', '•', true, 'bullet'], - ['…', '…', true, 'three dot leader'], - ['′', '′', true, 'minutes / feet'], - ['″', '″', true, 'seconds / inches'], - ['§', '§', true, 'section sign'], - ['¶', '¶', true, 'paragraph sign'], - ['ß', 'ß', true, 'sharp s / ess-zed'], -// quotations - ['‹', '‹', true, 'single left-pointing angle quotation mark'], - ['›', '›', true, 'single right-pointing angle quotation mark'], - ['«', '«', true, 'left pointing guillemet'], - ['»', '»', true, 'right pointing guillemet'], - ['‘', '‘', true, 'left single quotation mark'], - ['’', '’', true, 'right single quotation mark'], - ['“', '“', true, 'left double quotation mark'], - ['”', '”', true, 'right double quotation mark'], - ['‚', '‚', true, 'single low-9 quotation mark'], - ['„', '„', true, 'double low-9 quotation mark'], - ['<', '<', true, 'less-than sign'], - ['>', '>', true, 'greater-than sign'], - ['≤', '≤', true, 'less-than or equal to'], - ['≥', '≥', true, 'greater-than or equal to'], - ['–', '–', true, 'en dash'], - ['—', '—', true, 'em dash'], - ['¯', '¯', true, 'macron'], - ['‾', '‾', true, 'overline'], - ['¤', '¤', true, 'currency sign'], - ['¦', '¦', true, 'broken bar'], - ['¨', '¨', true, 'diaeresis'], - ['¡', '¡', true, 'inverted exclamation mark'], - ['¿', '¿', true, 'turned question mark'], - ['ˆ', 'ˆ', true, 'circumflex accent'], - ['˜', '˜', true, 'small tilde'], - ['°', '°', true, 'degree sign'], - ['−', '−', true, 'minus sign'], - ['±', '±', true, 'plus-minus sign'], - ['÷', '÷', true, 'division sign'], - ['⁄', '⁄', true, 'fraction slash'], - ['×', '×', true, 'multiplication sign'], - ['¹', '¹', true, 'superscript one'], - ['²', '²', true, 'superscript two'], - ['³', '³', true, 'superscript three'], - ['¼', '¼', true, 'fraction one quarter'], - ['½', '½', true, 'fraction one half'], - ['¾', '¾', true, 'fraction three quarters'], -// math / logical - ['ƒ', 'ƒ', true, 'function / florin'], - ['∫', '∫', true, 'integral'], - ['∑', '∑', true, 'n-ary sumation'], - ['∞', '∞', true, 'infinity'], - ['√', '√', true, 'square root'], - ['∼', '∼', false,'similar to'], - ['≅', '≅', false,'approximately equal to'], - ['≈', '≈', true, 'almost equal to'], - ['≠', '≠', true, 'not equal to'], - ['≡', '≡', true, 'identical to'], - ['∈', '∈', false,'element of'], - ['∉', '∉', false,'not an element of'], - ['∋', '∋', false,'contains as member'], - ['∏', '∏', true, 'n-ary product'], - ['∧', '∧', false,'logical and'], - ['∨', '∨', false,'logical or'], - ['¬', '¬', true, 'not sign'], - ['∩', '∩', true, 'intersection'], - ['∪', '∪', false,'union'], - ['∂', '∂', true, 'partial differential'], - ['∀', '∀', false,'for all'], - ['∃', '∃', false,'there exists'], - ['∅', '∅', false,'diameter'], - ['∇', '∇', false,'backward difference'], - ['∗', '∗', false,'asterisk operator'], - ['∝', '∝', false,'proportional to'], - ['∠', '∠', false,'angle'], -// undefined - ['´', '´', true, 'acute accent'], - ['¸', '¸', true, 'cedilla'], - ['ª', 'ª', true, 'feminine ordinal indicator'], - ['º', 'º', true, 'masculine ordinal indicator'], - ['†', '†', true, 'dagger'], - ['‡', '‡', true, 'double dagger'], -// alphabetical special chars - ['À', 'À', true, 'A - grave'], - ['Á', 'Á', true, 'A - acute'], - ['Â', 'Â', true, 'A - circumflex'], - ['Ã', 'Ã', true, 'A - tilde'], - ['Ä', 'Ä', true, 'A - diaeresis'], - ['Å', 'Å', true, 'A - ring above'], - ['Æ', 'Æ', true, 'ligature AE'], - ['Ç', 'Ç', true, 'C - cedilla'], - ['È', 'È', true, 'E - grave'], - ['É', 'É', true, 'E - acute'], - ['Ê', 'Ê', true, 'E - circumflex'], - ['Ë', 'Ë', true, 'E - diaeresis'], - ['Ì', 'Ì', true, 'I - grave'], - ['Í', 'Í', true, 'I - acute'], - ['Î', 'Î', true, 'I - circumflex'], - ['Ï', 'Ï', true, 'I - diaeresis'], - ['Ð', 'Ð', true, 'ETH'], - ['Ñ', 'Ñ', true, 'N - tilde'], - ['Ò', 'Ò', true, 'O - grave'], - ['Ó', 'Ó', true, 'O - acute'], - ['Ô', 'Ô', true, 'O - circumflex'], - ['Õ', 'Õ', true, 'O - tilde'], - ['Ö', 'Ö', true, 'O - diaeresis'], - ['Ø', 'Ø', true, 'O - slash'], - ['Œ', 'Œ', true, 'ligature OE'], - ['Š', 'Š', true, 'S - caron'], - ['Ù', 'Ù', true, 'U - grave'], - ['Ú', 'Ú', true, 'U - acute'], - ['Û', 'Û', true, 'U - circumflex'], - ['Ü', 'Ü', true, 'U - diaeresis'], - ['Ý', 'Ý', true, 'Y - acute'], - ['Ÿ', 'Ÿ', true, 'Y - diaeresis'], - ['Þ', 'Þ', true, 'THORN'], - ['à', 'à', true, 'a - grave'], - ['á', 'á', true, 'a - acute'], - ['â', 'â', true, 'a - circumflex'], - ['ã', 'ã', true, 'a - tilde'], - ['ä', 'ä', true, 'a - diaeresis'], - ['å', 'å', true, 'a - ring above'], - ['æ', 'æ', true, 'ligature ae'], - ['ç', 'ç', true, 'c - cedilla'], - ['è', 'è', true, 'e - grave'], - ['é', 'é', true, 'e - acute'], - ['ê', 'ê', true, 'e - circumflex'], - ['ë', 'ë', true, 'e - diaeresis'], - ['ì', 'ì', true, 'i - grave'], - ['í', 'í', true, 'i - acute'], - ['î', 'î', true, 'i - circumflex'], - ['ï', 'ï', true, 'i - diaeresis'], - ['ð', 'ð', true, 'eth'], - ['ñ', 'ñ', true, 'n - tilde'], - ['ò', 'ò', true, 'o - grave'], - ['ó', 'ó', true, 'o - acute'], - ['ô', 'ô', true, 'o - circumflex'], - ['õ', 'õ', true, 'o - tilde'], - ['ö', 'ö', true, 'o - diaeresis'], - ['ø', 'ø', true, 'o slash'], - ['œ', 'œ', true, 'ligature oe'], - ['š', 'š', true, 's - caron'], - ['ù', 'ù', true, 'u - grave'], - ['ú', 'ú', true, 'u - acute'], - ['û', 'û', true, 'u - circumflex'], - ['ü', 'ü', true, 'u - diaeresis'], - ['ý', 'ý', true, 'y - acute'], - ['þ', 'þ', true, 'thorn'], - ['ÿ', 'ÿ', true, 'y - diaeresis'], -// ['Α', 'Α', true, 'Alpha'], - ['Β', 'Β', true, 'Beta'], - ['Γ', 'Γ', true, 'Gamma'], - ['Δ', 'Δ', true, 'Delta'], - ['Ε', 'Ε', true, 'Epsilon'], - ['Ζ', 'Ζ', true, 'Zeta'], - ['Η', 'Η', true, 'Eta'], - ['Θ', 'Θ', true, 'Theta'], - ['Ι', 'Ι', true, 'Iota'], - ['Κ', 'Κ', true, 'Kappa'], - ['Λ', 'Λ', true, 'Lambda'], - ['Μ', 'Μ', true, 'Mu'], - ['Ν', 'Ν', true, 'Nu'], - ['Ξ', 'Ξ', true, 'Xi'], - ['Ο', 'Ο', true, 'Omicron'], - ['Π', 'Π', true, 'Pi'], - ['Ρ', 'Ρ', true, 'Rho'], - ['Σ', 'Σ', true, 'Sigma'], - ['Τ', 'Τ', true, 'Tau'], - ['Υ', 'Υ', true, 'Upsilon'], - ['Φ', 'Φ', true, 'Phi'], - ['Χ', 'Χ', true, 'Chi'], - ['Ψ', 'Ψ', true, 'Psi'], - ['Ω', 'Ω', true, 'Omega'], - ['α', 'α', true, 'alpha'], - ['β', 'β', true, 'beta'], - ['γ', 'γ', true, 'gamma'], - ['δ', 'δ', true, 'delta'], - ['ε', 'ε', true, 'epsilon'], - ['ζ', 'ζ', true, 'zeta'], - ['η', 'η', true, 'eta'], - ['θ', 'θ', true, 'theta'], - ['ι', 'ι', true, 'iota'], - ['κ', 'κ', true, 'kappa'], - ['λ', 'λ', true, 'lambda'], - ['μ', 'μ', true, 'mu'], - ['ν', 'ν', true, 'nu'], - ['ξ', 'ξ', true, 'xi'], - ['ο', 'ο', true, 'omicron'], - ['π', 'π', true, 'pi'], - ['ρ', 'ρ', true, 'rho'], - ['ς', 'ς', true, 'final sigma'], - ['σ', 'σ', true, 'sigma'], - ['τ', 'τ', true, 'tau'], - ['υ', 'υ', true, 'upsilon'], - ['φ', 'φ', true, 'phi'], - ['χ', 'χ', true, 'chi'], - ['ψ', 'ψ', true, 'psi'], - ['ω', 'ω', true, 'omega'], -// symbols - ['ℵ', 'ℵ', false,'alef symbol'], - ['ϖ', 'ϖ', false,'pi symbol'], - ['ℜ', 'ℜ', false,'real part symbol'], - ['ϑ','ϑ', false,'theta symbol'], - ['ϒ', 'ϒ', false,'upsilon - hook symbol'], - ['℘', '℘', false,'Weierstrass p'], - ['ℑ', 'ℑ', false,'imaginary part'], -// arrows - ['←', '←', true, 'leftwards arrow'], - ['↑', '↑', true, 'upwards arrow'], - ['→', '→', true, 'rightwards arrow'], - ['↓', '↓', true, 'downwards arrow'], - ['↔', '↔', true, 'left right arrow'], - ['↵', '↵', false,'carriage return'], - ['⇐', '⇐', false,'leftwards double arrow'], - ['⇑', '⇑', false,'upwards double arrow'], - ['⇒', '⇒', false,'rightwards double arrow'], - ['⇓', '⇓', false,'downwards double arrow'], - ['⇔', '⇔', false,'left right double arrow'], - ['∴', '∴', false,'therefore'], - ['⊂', '⊂', false,'subset of'], - ['⊃', '⊃', false,'superset of'], - ['⊄', '⊄', false,'not a subset of'], - ['⊆', '⊆', false,'subset of or equal to'], - ['⊇', '⊇', false,'superset of or equal to'], - ['⊕', '⊕', false,'circled plus'], - ['⊗', '⊗', false,'circled times'], - ['⊥', '⊥', false,'perpendicular'], - ['⋅', '⋅', false,'dot operator'], - ['⌈', '⌈', false,'left ceiling'], - ['⌉', '⌉', false,'right ceiling'], - ['⌊', '⌊', false,'left floor'], - ['⌋', '⌋', false,'right floor'], - ['⟨', '〈', false,'left-pointing angle bracket'], - ['⟩', '〉', false,'right-pointing angle bracket'], - ['◊', '◊', true,'lozenge'], - ['♠', '♠', false,'black spade suit'], - ['♣', '♣', true, 'black club suit'], - ['♥', '♥', true, 'black heart suit'], - ['♦', '♦', true, 'black diamond suit'], - [' ', ' ', false,'en space'], - [' ', ' ', false,'em space'], - [' ', ' ', false,'thin space'], - ['‌', '‌', false,'zero width non-joiner'], - ['‍', '‍', false,'zero width joiner'], - ['‎', '‎', false,'left-to-right mark'], - ['‏', '‏', false,'right-to-left mark'], - ['­', '­', false,'soft hyphen'] -]; - -function renderCharMapHTML() { - var charsPerRow = 20, tdWidth=20, tdHeight=20; - var html = ''; - var cols=-1; - for (var i=0; i' - + charmap[i][1] - + ''; - if ((cols+1) % charsPerRow == 0) - html += ''; - } - } - if (cols % charsPerRow > 0) { - var padd = charsPerRow - (cols % charsPerRow); - for (var i=0; i '; - } - html += '
'; - document.write(html); -} - -function insertChar(chr) { - tinyMCEPopup.execCommand('mceInsertContent', false, '\&#' + chr + ';'); - - // Refocus in window - if (tinyMCEPopup.isWindow) - window.focus(); -} - -function previewChar(codeA, codeB, codeN) { - var elmA = document.getElementById('codeA'); - var elmB = document.getElementById('codeB'); - var elmV = document.getElementById('codeV'); - var elmN = document.getElementById('codeN'); - - if (codeA=='#160;') { - elmV.innerHTML = '__'; - } else { - elmV.innerHTML = '&' + codeA; - } - - elmB.innerHTML = '&' + codeA; - elmA.innerHTML = '&' + codeB; - elmN.innerHTML = codeN; -} +function init() { + tinyMCEPopup.resizeToInnerSize(); +} + +var charmap = new Array(); + +// for mor details please see w3c.org +// now here is the complete list ;) + +charmap = [ + [' ', ' ', true, 'no-break space'], + ['&', '&', true, 'ampersand'], + ['"', '"', true, 'quotation mark'], +// finance + ['¢', '¢', true, 'cent sign'], + ['€', '€', true, 'euro sign'], + ['£', '£', true, 'pound sign'], + ['¥', '¥', true, 'yen sign'], +// signs + ['©', '©', true, 'copyright sign'], + ['®', '®', true, 'registered sign'], + ['™', '™', true, 'trade mark sign'], + ['‰', '‰', true, 'per mille sign'], + ['µ', 'µ', true, 'micro sign'], + ['·', '·', true, 'middle dot'], + ['•', '•', true, 'bullet'], + ['…', '…', true, 'three dot leader'], + ['′', '′', true, 'minutes / feet'], + ['″', '″', true, 'seconds / inches'], + ['§', '§', true, 'section sign'], + ['¶', '¶', true, 'paragraph sign'], + ['ß', 'ß', true, 'sharp s / ess-zed'], +// quotations + ['‹', '‹', true, 'single left-pointing angle quotation mark'], + ['›', '›', true, 'single right-pointing angle quotation mark'], + ['«', '«', true, 'left pointing guillemet'], + ['»', '»', true, 'right pointing guillemet'], + ['‘', '‘', true, 'left single quotation mark'], + ['’', '’', true, 'right single quotation mark'], + ['“', '“', true, 'left double quotation mark'], + ['”', '”', true, 'right double quotation mark'], + ['‚', '‚', true, 'single low-9 quotation mark'], + ['„', '„', true, 'double low-9 quotation mark'], + ['<', '<', true, 'less-than sign'], + ['>', '>', true, 'greater-than sign'], + ['≤', '≤', true, 'less-than or equal to'], + ['≥', '≥', true, 'greater-than or equal to'], + ['–', '–', true, 'en dash'], + ['—', '—', true, 'em dash'], + ['¯', '¯', true, 'macron'], + ['‾', '‾', true, 'overline'], + ['¤', '¤', true, 'currency sign'], + ['¦', '¦', true, 'broken bar'], + ['¨', '¨', true, 'diaeresis'], + ['¡', '¡', true, 'inverted exclamation mark'], + ['¿', '¿', true, 'turned question mark'], + ['ˆ', 'ˆ', true, 'circumflex accent'], + ['˜', '˜', true, 'small tilde'], + ['°', '°', true, 'degree sign'], + ['−', '−', true, 'minus sign'], + ['±', '±', true, 'plus-minus sign'], + ['÷', '÷', true, 'division sign'], + ['⁄', '⁄', true, 'fraction slash'], + ['×', '×', true, 'multiplication sign'], + ['¹', '¹', true, 'superscript one'], + ['²', '²', true, 'superscript two'], + ['³', '³', true, 'superscript three'], + ['¼', '¼', true, 'fraction one quarter'], + ['½', '½', true, 'fraction one half'], + ['¾', '¾', true, 'fraction three quarters'], +// math / logical + ['ƒ', 'ƒ', true, 'function / florin'], + ['∫', '∫', true, 'integral'], + ['∑', '∑', true, 'n-ary sumation'], + ['∞', '∞', true, 'infinity'], + ['√', '√', true, 'square root'], + ['∼', '∼', false,'similar to'], + ['≅', '≅', false,'approximately equal to'], + ['≈', '≈', true, 'almost equal to'], + ['≠', '≠', true, 'not equal to'], + ['≡', '≡', true, 'identical to'], + ['∈', '∈', false,'element of'], + ['∉', '∉', false,'not an element of'], + ['∋', '∋', false,'contains as member'], + ['∏', '∏', true, 'n-ary product'], + ['∧', '∧', false,'logical and'], + ['∨', '∨', false,'logical or'], + ['¬', '¬', true, 'not sign'], + ['∩', '∩', true, 'intersection'], + ['∪', '∪', false,'union'], + ['∂', '∂', true, 'partial differential'], + ['∀', '∀', false,'for all'], + ['∃', '∃', false,'there exists'], + ['∅', '∅', false,'diameter'], + ['∇', '∇', false,'backward difference'], + ['∗', '∗', false,'asterisk operator'], + ['∝', '∝', false,'proportional to'], + ['∠', '∠', false,'angle'], +// undefined + ['´', '´', true, 'acute accent'], + ['¸', '¸', true, 'cedilla'], + ['ª', 'ª', true, 'feminine ordinal indicator'], + ['º', 'º', true, 'masculine ordinal indicator'], + ['†', '†', true, 'dagger'], + ['‡', '‡', true, 'double dagger'], +// alphabetical special chars + ['À', 'À', true, 'A - grave'], + ['Á', 'Á', true, 'A - acute'], + ['Â', 'Â', true, 'A - circumflex'], + ['Ã', 'Ã', true, 'A - tilde'], + ['Ä', 'Ä', true, 'A - diaeresis'], + ['Å', 'Å', true, 'A - ring above'], + ['Æ', 'Æ', true, 'ligature AE'], + ['Ç', 'Ç', true, 'C - cedilla'], + ['È', 'È', true, 'E - grave'], + ['É', 'É', true, 'E - acute'], + ['Ê', 'Ê', true, 'E - circumflex'], + ['Ë', 'Ë', true, 'E - diaeresis'], + ['Ì', 'Ì', true, 'I - grave'], + ['Í', 'Í', true, 'I - acute'], + ['Î', 'Î', true, 'I - circumflex'], + ['Ï', 'Ï', true, 'I - diaeresis'], + ['Ð', 'Ð', true, 'ETH'], + ['Ñ', 'Ñ', true, 'N - tilde'], + ['Ò', 'Ò', true, 'O - grave'], + ['Ó', 'Ó', true, 'O - acute'], + ['Ô', 'Ô', true, 'O - circumflex'], + ['Õ', 'Õ', true, 'O - tilde'], + ['Ö', 'Ö', true, 'O - diaeresis'], + ['Ø', 'Ø', true, 'O - slash'], + ['Œ', 'Œ', true, 'ligature OE'], + ['Š', 'Š', true, 'S - caron'], + ['Ù', 'Ù', true, 'U - grave'], + ['Ú', 'Ú', true, 'U - acute'], + ['Û', 'Û', true, 'U - circumflex'], + ['Ü', 'Ü', true, 'U - diaeresis'], + ['Ý', 'Ý', true, 'Y - acute'], + ['Ÿ', 'Ÿ', true, 'Y - diaeresis'], + ['Þ', 'Þ', true, 'THORN'], + ['à', 'à', true, 'a - grave'], + ['á', 'á', true, 'a - acute'], + ['â', 'â', true, 'a - circumflex'], + ['ã', 'ã', true, 'a - tilde'], + ['ä', 'ä', true, 'a - diaeresis'], + ['å', 'å', true, 'a - ring above'], + ['æ', 'æ', true, 'ligature ae'], + ['ç', 'ç', true, 'c - cedilla'], + ['è', 'è', true, 'e - grave'], + ['é', 'é', true, 'e - acute'], + ['ê', 'ê', true, 'e - circumflex'], + ['ë', 'ë', true, 'e - diaeresis'], + ['ì', 'ì', true, 'i - grave'], + ['í', 'í', true, 'i - acute'], + ['î', 'î', true, 'i - circumflex'], + ['ï', 'ï', true, 'i - diaeresis'], + ['ð', 'ð', true, 'eth'], + ['ñ', 'ñ', true, 'n - tilde'], + ['ò', 'ò', true, 'o - grave'], + ['ó', 'ó', true, 'o - acute'], + ['ô', 'ô', true, 'o - circumflex'], + ['õ', 'õ', true, 'o - tilde'], + ['ö', 'ö', true, 'o - diaeresis'], + ['ø', 'ø', true, 'o slash'], + ['œ', 'œ', true, 'ligature oe'], + ['š', 'š', true, 's - caron'], + ['ù', 'ù', true, 'u - grave'], + ['ú', 'ú', true, 'u - acute'], + ['û', 'û', true, 'u - circumflex'], + ['ü', 'ü', true, 'u - diaeresis'], + ['ý', 'ý', true, 'y - acute'], + ['þ', 'þ', true, 'thorn'], + ['ÿ', 'ÿ', true, 'y - diaeresis'], +// ['Α', 'Α', true, 'Alpha'], + ['Β', 'Β', true, 'Beta'], + ['Γ', 'Γ', true, 'Gamma'], + ['Δ', 'Δ', true, 'Delta'], + ['Ε', 'Ε', true, 'Epsilon'], + ['Ζ', 'Ζ', true, 'Zeta'], + ['Η', 'Η', true, 'Eta'], + ['Θ', 'Θ', true, 'Theta'], + ['Ι', 'Ι', true, 'Iota'], + ['Κ', 'Κ', true, 'Kappa'], + ['Λ', 'Λ', true, 'Lambda'], + ['Μ', 'Μ', true, 'Mu'], + ['Ν', 'Ν', true, 'Nu'], + ['Ξ', 'Ξ', true, 'Xi'], + ['Ο', 'Ο', true, 'Omicron'], + ['Π', 'Π', true, 'Pi'], + ['Ρ', 'Ρ', true, 'Rho'], + ['Σ', 'Σ', true, 'Sigma'], + ['Τ', 'Τ', true, 'Tau'], + ['Υ', 'Υ', true, 'Upsilon'], + ['Φ', 'Φ', true, 'Phi'], + ['Χ', 'Χ', true, 'Chi'], + ['Ψ', 'Ψ', true, 'Psi'], + ['Ω', 'Ω', true, 'Omega'], + ['α', 'α', true, 'alpha'], + ['β', 'β', true, 'beta'], + ['γ', 'γ', true, 'gamma'], + ['δ', 'δ', true, 'delta'], + ['ε', 'ε', true, 'epsilon'], + ['ζ', 'ζ', true, 'zeta'], + ['η', 'η', true, 'eta'], + ['θ', 'θ', true, 'theta'], + ['ι', 'ι', true, 'iota'], + ['κ', 'κ', true, 'kappa'], + ['λ', 'λ', true, 'lambda'], + ['μ', 'μ', true, 'mu'], + ['ν', 'ν', true, 'nu'], + ['ξ', 'ξ', true, 'xi'], + ['ο', 'ο', true, 'omicron'], + ['π', 'π', true, 'pi'], + ['ρ', 'ρ', true, 'rho'], + ['ς', 'ς', true, 'final sigma'], + ['σ', 'σ', true, 'sigma'], + ['τ', 'τ', true, 'tau'], + ['υ', 'υ', true, 'upsilon'], + ['φ', 'φ', true, 'phi'], + ['χ', 'χ', true, 'chi'], + ['ψ', 'ψ', true, 'psi'], + ['ω', 'ω', true, 'omega'], +// symbols + ['ℵ', 'ℵ', false,'alef symbol'], + ['ϖ', 'ϖ', false,'pi symbol'], + ['ℜ', 'ℜ', false,'real part symbol'], + ['ϑ','ϑ', false,'theta symbol'], + ['ϒ', 'ϒ', false,'upsilon - hook symbol'], + ['℘', '℘', false,'Weierstrass p'], + ['ℑ', 'ℑ', false,'imaginary part'], +// arrows + ['←', '←', true, 'leftwards arrow'], + ['↑', '↑', true, 'upwards arrow'], + ['→', '→', true, 'rightwards arrow'], + ['↓', '↓', true, 'downwards arrow'], + ['↔', '↔', true, 'left right arrow'], + ['↵', '↵', false,'carriage return'], + ['⇐', '⇐', false,'leftwards double arrow'], + ['⇑', '⇑', false,'upwards double arrow'], + ['⇒', '⇒', false,'rightwards double arrow'], + ['⇓', '⇓', false,'downwards double arrow'], + ['⇔', '⇔', false,'left right double arrow'], + ['∴', '∴', false,'therefore'], + ['⊂', '⊂', false,'subset of'], + ['⊃', '⊃', false,'superset of'], + ['⊄', '⊄', false,'not a subset of'], + ['⊆', '⊆', false,'subset of or equal to'], + ['⊇', '⊇', false,'superset of or equal to'], + ['⊕', '⊕', false,'circled plus'], + ['⊗', '⊗', false,'circled times'], + ['⊥', '⊥', false,'perpendicular'], + ['⋅', '⋅', false,'dot operator'], + ['⌈', '⌈', false,'left ceiling'], + ['⌉', '⌉', false,'right ceiling'], + ['⌊', '⌊', false,'left floor'], + ['⌋', '⌋', false,'right floor'], + ['⟨', '〈', false,'left-pointing angle bracket'], + ['⟩', '〉', false,'right-pointing angle bracket'], + ['◊', '◊', true,'lozenge'], + ['♠', '♠', false,'black spade suit'], + ['♣', '♣', true, 'black club suit'], + ['♥', '♥', true, 'black heart suit'], + ['♦', '♦', true, 'black diamond suit'], + [' ', ' ', false,'en space'], + [' ', ' ', false,'em space'], + [' ', ' ', false,'thin space'], + ['‌', '‌', false,'zero width non-joiner'], + ['‍', '‍', false,'zero width joiner'], + ['‎', '‎', false,'left-to-right mark'], + ['‏', '‏', false,'right-to-left mark'], + ['­', '­', false,'soft hyphen'] +]; + +function renderCharMapHTML() { + var charsPerRow = 20, tdWidth=20, tdHeight=20; + var html = ''; + var cols=-1; + for (var i=0; i' + + charmap[i][1] + + ''; + if ((cols+1) % charsPerRow == 0) + html += ''; + } + } + if (cols % charsPerRow > 0) { + var padd = charsPerRow - (cols % charsPerRow); + for (var i=0; i '; + } + html += '
'; + document.write(html); +} + +function insertChar(chr) { + tinyMCEPopup.execCommand('mceInsertContent', false, '\&#' + chr + ';'); + + // Refocus in window + if (tinyMCEPopup.isWindow) + window.focus(); +} + +function previewChar(codeA, codeB, codeN) { + var elmA = document.getElementById('codeA'); + var elmB = document.getElementById('codeB'); + var elmV = document.getElementById('codeV'); + var elmN = document.getElementById('codeN'); + + if (codeA=='#160;') { + elmV.innerHTML = '__'; + } else { + elmV.innerHTML = '&' + codeA; + } + + elmB.innerHTML = '&' + codeA; + elmA.innerHTML = '&' + codeB; + elmN.innerHTML = codeN; +} diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js b/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js index aab668e08b..1d585aa372 100644 --- a/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js +++ b/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js @@ -1,107 +1,107 @@ -function init() { - if (tinyMCE.isMSIE) - tinyMCEPopup.resizeToInnerSize(); -} - -function selectColor() { - var color = document.getElementById("selectedColorBox").value; - - tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color); - tinyMCEPopup.close(); -} - -function showColor(color) { - document.getElementById("selectedColor").style.backgroundColor = color; - document.getElementById("selectedColorBox").value = color; -} - -var colors = new Array( - "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", - "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", - "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", - "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033", - "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399", - "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff", - "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333", - "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399", - "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff", - "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633", - "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699", - "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff", - "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633", - "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999", - "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff", - "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933", - "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999", - "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff", - "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33", - "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99", - "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff", - "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33", - "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99", - "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff", - "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", - "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", - "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" -); - -function convertRGBToHex(col) { - var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); - - var rgb = col.replace(re, "$1,$2,$3").split(','); - if (rgb.length == 3) { - r = parseInt(rgb[0]).toString(16); - g = parseInt(rgb[1]).toString(16); - b = parseInt(rgb[2]).toString(16); - - r = r.length == 1 ? '0' + r : r; - g = g.length == 1 ? '0' + g : g; - b = b.length == 1 ? '0' + b : b; - - return "#" + r + g + b; - } - - return col; -} - -function convertHexToRGB(col) { - if (col.indexOf('#') != -1) { - col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); - - r = parseInt(col.substring(0, 2), 16); - g = parseInt(col.substring(2, 4), 16); - b = parseInt(col.substring(4, 6), 16); - - return "rgb(" + r + "," + g + "," + b + ")"; - } - - return col; -} - -function renderColorMap() { - var html = ""; - var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color')); - - html += '' - + ''; - for (var i=0; i' - + '' - + '' + colors[i] +  ''; - if ((i+1) % 18 == 0) - html += ''; - } - html += '' - + '
' - + '' - + '' - + '
' - + '' - + '' - + '' - + '
' - + '' - + '
'; - - document.write(html); +function init() { + if (tinyMCE.isMSIE) + tinyMCEPopup.resizeToInnerSize(); +} + +function selectColor() { + var color = document.getElementById("selectedColorBox").value; + + tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color); + tinyMCEPopup.close(); +} + +function showColor(color) { + document.getElementById("selectedColor").style.backgroundColor = color; + document.getElementById("selectedColorBox").value = color; +} + +var colors = new Array( + "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", + "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", + "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", + "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033", + "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399", + "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff", + "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333", + "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399", + "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff", + "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633", + "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699", + "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff", + "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633", + "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999", + "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff", + "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933", + "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999", + "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff", + "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33", + "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99", + "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff", + "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33", + "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99", + "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff", + "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", + "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", + "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" +); + +function convertRGBToHex(col) { + var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); + + var rgb = col.replace(re, "$1,$2,$3").split(','); + if (rgb.length == 3) { + r = parseInt(rgb[0]).toString(16); + g = parseInt(rgb[1]).toString(16); + b = parseInt(rgb[2]).toString(16); + + r = r.length == 1 ? '0' + r : r; + g = g.length == 1 ? '0' + g : g; + b = b.length == 1 ? '0' + b : b; + + return "#" + r + g + b; + } + + return col; +} + +function convertHexToRGB(col) { + if (col.indexOf('#') != -1) { + col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); + + r = parseInt(col.substring(0, 2), 16); + g = parseInt(col.substring(2, 4), 16); + b = parseInt(col.substring(4, 6), 16); + + return "rgb(" + r + "," + g + "," + b + ")"; + } + + return col; +} + +function renderColorMap() { + var html = ""; + var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color')); + + html += '' + + ''; + for (var i=0; i' + + '' + + '' + colors[i] +  ''; + if ((i+1) % 18 == 0) + html += ''; + } + html += '' + + '
' + + '' + + '' + + '
' + + '' + + '' + + '' + + '
' + + '' + + '
'; + + document.write(html); } \ No newline at end of file diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/image.js b/wp-includes/js/tinymce/themes/advanced/jscripts/image.js index 894a0ffe95..537d713652 100644 --- a/wp-includes/js/tinymce/themes/advanced/jscripts/image.js +++ b/wp-includes/js/tinymce/themes/advanced/jscripts/image.js @@ -1,82 +1,82 @@ -var url = tinyMCE.getParam("external_image_list_url"); -if (url != null) { - // Fix relative - if (url.charAt(0) != '/' && url.indexOf('://') == -1) - url = tinyMCE.documentBasePath + "/" + url; - - document.write(''); -} - -function insertImage() { - if (window.opener) { - var src = document.forms[0].src.value; - var alt = document.forms[0].alt.value; - var border = document.forms[0].border.value; - var vspace = document.forms[0].vspace.value; - var hspace = document.forms[0].hspace.value; - var width = document.forms[0].width.value; - var height = document.forms[0].height.value; - var align = document.forms[0].align.options[document.forms[0].align.selectedIndex].value; - - window.opener.tinyMCE.insertImage(src, alt, border, hspace, vspace, width, height, align); - top.close(); - } -} - -function init() { - tinyMCEPopup.resizeToInnerSize(); - - document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); - - var formObj = document.forms[0]; - - for (var i=0; i 0) { - for (var i=0; i'); +} + +function insertImage() { + if (window.opener) { + var src = document.forms[0].src.value; + var alt = document.forms[0].alt.value; + var border = document.forms[0].border.value; + var vspace = document.forms[0].vspace.value; + var hspace = document.forms[0].hspace.value; + var width = document.forms[0].width.value; + var height = document.forms[0].height.value; + var align = document.forms[0].align.options[document.forms[0].align.selectedIndex].value; + + window.opener.tinyMCE.insertImage(src, alt, border, hspace, vspace, width, height, align); + top.close(); + } +} + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + + var formObj = document.forms[0]; + + for (var i=0; i 0) { + for (var i=0; i'); -} - -function init() { - tinyMCEPopup.resizeToInnerSize(); - - document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link'); - - var formObj = document.forms[0]; - - for (var i=0; i 0) { - var formObj = document.forms[0]; - - for (var i=0; i'); +} + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link'); + + var formObj = document.forms[0]; + + for (var i=0; i 0) { + var formObj = document.forms[0]; + + for (var i=0; i', 'gi'),'\n'); - html = tinyMCE.regexpReplace(html, '
','
\n','gi'); - html = tinyMCE.regexpReplace(html, '\n\n','\n','gi'); - return html; -} - -function onLoadInit() { - tinyMCEPopup.resizeToInnerSize(); - - document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id'))); - resizeInputs(); - setWrap('off'); -} - -function setWrap(val) { - // hard soft off - document.forms[0].htmlSource.wrap = val; -} - -function toggleWordWrap(elm) { - if (elm.checked) - setWrap('soft'); - else - setWrap('off'); -} - -var wHeight=0, wWidth=0, owHeight=0, owWidth=0; - -function resizeInputs() { - if (!tinyMCE.isMSIE) { - wHeight = self.innerHeight-80; - wWidth = self.innerWidth-16; - } else { - wHeight = document.body.clientHeight - 80; - wWidth = document.body.clientWidth - 16; - } - - document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px'; - document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px'; -} - -function renderWordWrap() { - if (tinyMCE.isMSIE) - document.write(''); -} +function saveContent() { + tinyMCE.setContent(document.getElementById('htmlSource').value); + tinyMCE.closeWindow(window); +} + +// Fixes some charcode issues +function fixContent(html) { + html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1'); + html = html.replace(new RegExp('<\/(p|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'\n'); + html = tinyMCE.regexpReplace(html, '
','
\n','gi'); + html = tinyMCE.regexpReplace(html, '\n\n','\n','gi'); + return html; +} + +function onLoadInit() { + tinyMCEPopup.resizeToInnerSize(); + + document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id'))); + resizeInputs(); + setWrap('off'); +} + +function setWrap(val) { + // hard soft off + document.forms[0].htmlSource.wrap = val; +} + +function toggleWordWrap(elm) { + if (elm.checked) + setWrap('soft'); + else + setWrap('off'); +} + +var wHeight=0, wWidth=0, owHeight=0, owWidth=0; + +function resizeInputs() { + if (!tinyMCE.isMSIE) { + wHeight = self.innerHeight-80; + wWidth = self.innerWidth-16; + } else { + wHeight = document.body.clientHeight - 80; + wWidth = document.body.clientWidth - 16; + } + + document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px'; + document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px'; +} + +function renderWordWrap() { + if (tinyMCE.isMSIE) + document.write(''); +}