Ticket #4472: mt.diff
| File mt.diff, 2.5 KB (added by shacker, 4 years ago) |
|---|
-
mt.php
23 23 ?> 24 24 <div class="narrow"> 25 25 <p><?php _e('Howdy! We’re about to begin importing all of your Movable Type or Typepad entries into WordPress. To begin, either choose a file to upload and click "Upload file and import," or use FTP to upload your MT export file as <code>mt-export.txt</code> in your <code>/wp-content/</code> directory and then click "Import mt-export.txt"'); ?></p> 26 26 27 <?php wp_import_upload_form( add_query_arg('step', 1) ); ?> 27 28 <form method="post" action="<?php echo add_query_arg('step', 1); ?>" class="import-upload-form"> 29 28 30 <?php wp_nonce_field('import-upload'); ?> 29 31 <p> 30 32 <input type="hidden" name="upload_type" value="ftp" /> … … 196 198 $this->mt_authors_form(); 197 199 } 198 200 199 function save_post(&$post, &$comments, &$pings ) {201 function save_post(&$post, &$comments, &$pings, &$keywords) { 200 202 // Reset the counter 201 203 set_time_limit(30); 202 204 $post = get_object_vars($post); … … 222 224 if ( 0 != count($post->categories) ) { 223 225 wp_create_categories($post->categories, $post_id); 224 226 } 227 228 // Add tags or keywords 229 if ( 1 < strlen($post->post_keywords) ) { 230 // Keywords exist. 231 printf(__('<br />Adding tags <i>%s</i>...'), stripslashes($post->post_keywords)); 232 wp_add_post_tags($post_id, $post->post_keywords); 233 } 234 225 235 } 226 236 227 237 $num_comments = 0; … … 274 284 $comments = array(); 275 285 $ping = new StdClass(); 276 286 $pings = array(); 287 $keyword = new StdClass(); 288 $keywords = array(); 277 289 290 278 291 echo "<div class='wrap'><ol>"; 279 292 280 293 while ( $line = fgets($handle) ) { … … 293 306 } else if ( '--------' == $line ) { 294 307 // Finishing a post. 295 308 $context = ''; 296 $result = $this->save_post($post, $comments, $pings );309 $result = $this->save_post($post, $comments, $pings, $keywords); 297 310 if ( is_wp_error( $result ) ) 298 311 return $result; 299 312 $post = new StdClass; 300 313 $comment = new StdClass(); 301 314 $ping = new StdClass(); 315 $keywords = new StdClass(); 302 316 $comments = array(); 303 317 $pings = array(); 304 318 } else if ( 'BODY:' == $line ) { … … 396 410 $post->extended .= $line; 397 411 } else if ( 'excerpt' == $context ) { 398 412 $post->post_excerpt .= $line; 413 } else if ( 'keywords' == $context ) { 414 $post->post_keywords .= $line; 399 415 } else if ( 'comment' == $context ) { 400 416 $comment->comment_content .= $line; 401 417 } else if ( 'ping' == $context ) {
