]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/import/textpattern.php
Wordpress 2.0.11
[autoinstalls/wordpress.git] / wp-admin / import / textpattern.php
1 <?php
2 /**
3         Add These Functions to make our lives easier
4 **/
5 if(!function_exists('get_catbynicename'))
6 {
7         function get_catbynicename($category_nicename)
8         {
9         global $wpdb;
10
11         $cat_id -= 0;   // force numeric
12         $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
13
14         return $name;
15         }
16 }
17
18 if(!function_exists('get_comment_count'))
19 {
20         function get_comment_count($post_ID)
21         {
22                 global $wpdb;
23                 return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
24         }
25 }
26
27 if(!function_exists('link_exists'))
28 {
29         function link_exists($linkname)
30         {
31                 global $wpdb;
32                 return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$wpdb->escape($linkname).'"');
33         }
34 }
35
36 /**
37         The Main Importer Class
38 **/
39 class Textpattern_Import {
40
41         function header() 
42         {
43                 echo '<div class="wrap">';
44                 echo '<h2>'.__('Import Textpattern').'</h2>';
45                 echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
46         }
47
48         function footer() 
49         {
50                 echo '</div>';
51         }
52
53         function greet() {
54                 echo '<div class="narrow">';
55                 echo '<p>'.__('Howdy! This imports categories, users, posts, comments, and links from any Textpattern 4.0.2+ into this blog.').'</p>';
56                 echo '<p>'.__('This has not been tested on previous versions of Textpattern.  Mileage may vary.').'</p>';
57                 echo '<p>'.__('Your Textpattern Configuration settings are as follows:').'</p>';
58                 echo '<form action="admin.php?import=textpattern&amp;step=1" method="post">';
59                 wp_nonce_field('import-textpattern');
60                 $this->db_form();
61                 echo '<p class="submit"><input type="submit" name="submit" value="'.attribute_escape(__('Import Categories &raquo;')).'" /></p>';
62                 echo '</form>';
63                 echo '</div>';
64         }
65
66         function get_txp_cats()
67         {
68                 global $wpdb;
69                 // General Housekeeping
70                 $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
71                 set_magic_quotes_runtime(0);
72                 $prefix = get_option('tpre');
73
74                 // Get Categories
75                 return $txpdb->get_results('SELECT
76                         id,
77                         name,
78                         title
79                         FROM '.$prefix.'txp_category
80                         WHERE type = "article"',
81                         ARRAY_A);
82         }
83
84         function get_txp_users()
85         {
86                 global $wpdb;
87                 // General Housekeeping
88                 $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
89                 set_magic_quotes_runtime(0);
90                 $prefix = get_option('tpre');
91
92                 // Get Users
93
94                 return $txpdb->get_results('SELECT
95                         user_id,
96                         name,
97                         RealName,
98                         email,
99                         privs
100                         FROM '.$prefix.'txp_users', ARRAY_A);
101         }
102
103         function get_txp_posts()
104         {
105                 // General Housekeeping
106                 $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
107                 set_magic_quotes_runtime(0);
108                 $prefix = get_option('tpre');
109
110                 // Get Posts
111                 return $txpdb->get_results('SELECT
112                         ID,
113                         Posted,
114                         AuthorID,
115                         LastMod,
116                         Title,
117                         Body,
118                         Excerpt,
119                         Category1,
120                         Category2,
121                         Status,
122                         Keywords,
123                         url_title,
124                         comments_count
125                         FROM '.$prefix.'textpattern
126                         ', ARRAY_A);
127         }
128
129         function get_txp_comments()
130         {
131                 global $wpdb;
132                 // General Housekeeping
133                 $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
134                 set_magic_quotes_runtime(0);
135                 $prefix = get_option('tpre');
136
137                 // Get Comments
138                 return $txpdb->get_results('SELECT * FROM '.$prefix.'txp_discuss', ARRAY_A);
139         }
140
141                 function get_txp_links()
142         {
143                 //General Housekeeping
144                 $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
145                 set_magic_quotes_runtime(0);
146                 $prefix = get_option('tpre');
147
148                 return $txpdb->get_results('SELECT
149                         id,
150                         date,
151                         category,
152                         url,
153                         linkname,
154                         description
155                         FROM '.$prefix.'txp_link',
156                         ARRAY_A);
157         }
158
159         function cat2wp($categories='')
160         {
161                 // General Housekeeping
162                 global $wpdb;
163                 $count = 0;
164                 $txpcat2wpcat = array();
165                 // Do the Magic
166                 if(is_array($categories))
167                 {
168                         echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
169                         foreach ($categories as $category)
170                         {
171                                 $count++;
172                                 extract($category);
173
174
175                                 // Make Nice Variables
176                                 $name = $wpdb->escape($name);
177                                 $title = $wpdb->escape($title);
178
179                                 if($cinfo = category_exists($name))
180                                 {
181                                         $ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title));
182                                 }
183                                 else
184                                 {
185                                         $ret_id = wp_insert_category(array('category_nicename' => $name, 'cat_name' => $title));
186                                 }
187                                 $txpcat2wpcat[$id] = $ret_id;
188                         }
189
190                         // Store category translation for future use
191                         add_option('txpcat2wpcat',$txpcat2wpcat);
192                         echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
193                         return true;
194                 }
195                 echo __('No Categories to Import!');
196                 return false;
197         }
198
199         function users2wp($users='')
200         {
201                 // General Housekeeping
202                 global $wpdb;
203                 $count = 0;
204                 $txpid2wpid = array();
205
206                 // Midnight Mojo
207                 if(is_array($users))
208                 {
209                         echo '<p>'.__('Importing Users...').'<br /><br /></p>';
210                         foreach($users as $user)
211                         {
212                                 $count++;
213                                 extract($user);
214
215                                 // Make Nice Variables
216                                 $name = $wpdb->escape($name);
217                                 $RealName = $wpdb->escape($RealName);
218
219                                 if($uinfo = get_userdatabylogin($name))
220                                 {
221
222                                         $ret_id = wp_insert_user(array(
223                                                                 'ID'                    => $uinfo->ID,
224                                                                 'user_login'    => $name,
225                                                                 'user_nicename' => $RealName,
226                                                                 'user_email'    => $email,
227                                                                 'user_url'              => 'http://',
228                                                                 'display_name'  => $name)
229                                                                 );
230                                 }
231                                 else
232                                 {
233                                         $ret_id = wp_insert_user(array(
234                                                                 'user_login'    => $name,
235                                                                 'user_nicename' => $RealName,
236                                                                 'user_email'    => $email,
237                                                                 'user_url'              => 'http://',
238                                                                 'display_name'  => $name)
239                                                                 );
240                                 }
241                                 $txpid2wpid[$user_id] = $ret_id;
242
243                                 // Set Textpattern-to-WordPress permissions translation
244                                 $transperms = array(1 => '10', 2 => '9', 3 => '5', 4 => '4', 5 => '3', 6 => '2', 7 => '0');
245
246                                 // Update Usermeta Data
247                                 $user = new WP_User($ret_id);
248                                 if('10' == $transperms[$privs]) { $user->set_role('administrator'); }
249                                 if('9'  == $transperms[$privs]) { $user->set_role('editor'); }
250                                 if('5'  == $transperms[$privs]) { $user->set_role('editor'); }
251                                 if('4'  == $transperms[$privs]) { $user->set_role('author'); }
252                                 if('3'  == $transperms[$privs]) { $user->set_role('contributor'); }
253                                 if('2'  == $transperms[$privs]) { $user->set_role('contributor'); }
254                                 if('0'  == $transperms[$privs]) { $user->set_role('subscriber'); }
255
256                                 update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] );
257                                 update_usermeta( $ret_id, 'rich_editing', 'false');
258                         }// End foreach($users as $user)
259
260                         // Store id translation array for future use
261                         add_option('txpid2wpid',$txpid2wpid);
262
263
264                         echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
265                         return true;
266                 }// End if(is_array($users)
267
268                 echo __('No Users to Import!');
269                 return false;
270
271         }// End function user2wp()
272
273         function posts2wp($posts='')
274         {
275                 // General Housekeeping
276                 global $wpdb;
277                 $count = 0;
278                 $txpposts2wpposts = array();
279                 $cats = array();
280
281                 // Do the Magic
282                 if(is_array($posts))
283                 {
284                         echo '<p>'.__('Importing Posts...').'<br /><br /></p>';
285                         foreach($posts as $post)
286                         {
287                                 $count++;
288                                 extract($post);
289
290                                 // Set Textpattern-to-WordPress status translation
291                                 $stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish');
292
293                                 //Can we do this more efficiently?
294                                 $uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1;
295                                 $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
296
297                                 $Title = $wpdb->escape($Title);
298                                 $Body = $wpdb->escape($Body);
299                                 $Excerpt = $wpdb->escape($Excerpt);
300                                 $post_status = $stattrans[$Status];
301
302                                 // Import Post data into WordPress
303
304                                 if($pinfo = post_exists($Title,$Body))
305                                 {
306                                         $ret_id = wp_insert_post(array(
307                                                 'ID'                            => $pinfo,
308                                                 'post_date'                     => $Posted,
309                                                 'post_date_gmt'         => $post_date_gmt,
310                                                 'post_author'           => $authorid,
311                                                 'post_modified'         => $LastMod,
312                                                 'post_modified_gmt' => $post_modified_gmt,
313                                                 'post_title'            => $Title,
314                                                 'post_content'          => $Body,
315                                                 'post_excerpt'          => $Excerpt,
316                                                 'post_status'           => $post_status,
317                                                 'post_name'                     => $url_title,
318                                                 'comment_count'         => $comments_count)
319                                                 );
320                                 }
321                                 else
322                                 {
323                                         $ret_id = wp_insert_post(array(
324                                                 'post_date'                     => $Posted,
325                                                 'post_date_gmt'         => $post_date_gmt,
326                                                 'post_author'           => $authorid,
327                                                 'post_modified'         => $LastMod,
328                                                 'post_modified_gmt' => $post_modified_gmt,
329                                                 'post_title'            => $Title,
330                                                 'post_content'          => $Body,
331                                                 'post_excerpt'          => $Excerpt,
332                                                 'post_status'           => $post_status,
333                                                 'post_name'                     => $url_title,
334                                                 'comment_count'         => $comments_count)
335                                                 );
336                                 }
337                                 $txpposts2wpposts[$ID] = $ret_id;
338
339                                 // Make Post-to-Category associations
340                                 $cats = array();
341                                 if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; }
342                                 if($cat2 = get_catbynicename($Category2)) { $cats[2] = $cat2; }
343
344                                 if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
345                         }
346                 }
347                 // Store ID translation for later use
348                 add_option('txpposts2wpposts',$txpposts2wpposts);
349
350                 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
351                 return true;
352         }
353
354         function comments2wp($comments='')
355         {
356                 // General Housekeeping
357                 global $wpdb;
358                 $count = 0;
359                 $txpcm2wpcm = array();
360                 $postarr = get_option('txpposts2wpposts');
361
362                 // Magic Mojo
363                 if(is_array($comments))
364                 {
365                         echo '<p>'.__('Importing Comments...').'<br /><br /></p>';
366                         foreach($comments as $comment)
367                         {
368                                 $count++;
369                                 extract($comment);
370
371                                 // WordPressify Data
372                                 $comment_ID = ltrim($discussid, '0');
373                                 $comment_post_ID = $postarr[$parentid];
374                                 $comment_approved = (1 == $visible) ? 1 : 0;
375                                 $name = $wpdb->escape($name);
376                                 $email = $wpdb->escape($email);
377                                 $web = $wpdb->escape($web);
378                                 $message = $wpdb->escape($message);
379
380                                 if($cinfo = comment_exists($name, $posted))
381                                 {
382                                         // Update comments
383                                         $ret_id = wp_update_comment(array(
384                                                 'comment_ID'                    => $cinfo,
385                                                 'comment_post_ID'               => $comment_post_ID,
386                                                 'comment_author'                => $name,
387                                                 'comment_author_email'  => $email,
388                                                 'comment_author_url'    => $web,
389                                                 'comment_date'                  => $posted,
390                                                 'comment_content'               => $message,
391                                                 'comment_approved'              => $comment_approved)
392                                                 );
393                                 }
394                                 else
395                                 {
396                                         // Insert comments
397                                         $ret_id = wp_insert_comment(array(
398                                                 'comment_post_ID'               => $comment_post_ID,
399                                                 'comment_author'                => $name,
400                                                 'comment_author_email'  => $email,
401                                                 'comment_author_url'    => $web,
402                                                 'comment_author_IP'             => $ip,
403                                                 'comment_date'                  => $posted,
404                                                 'comment_content'               => $message,
405                                                 'comment_approved'              => $comment_approved)
406                                                 );
407                                 }
408                                 $txpcm2wpcm[$comment_ID] = $ret_id;
409                         }
410                         // Store Comment ID translation for future use
411                         add_option('txpcm2wpcm', $txpcm2wpcm);
412
413                         // Associate newly formed categories with posts
414                         get_comment_count($ret_id);
415
416
417                         echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
418                         return true;
419                 }
420                 echo __('No Comments to Import!');
421                 return false;
422         }
423
424         function links2wp($links='')
425         {
426                 // General Housekeeping
427                 global $wpdb;
428                 $count = 0;
429
430                 // Deal with the links
431                 if(is_array($links))
432                 {
433                         echo '<p>'.__('Importing Links...').'<br /><br /></p>';
434                         foreach($links as $link)
435                         {
436                                 $count++;
437                                 extract($link);
438
439                                 // Make nice vars
440                                 $category = $wpdb->escape($category);
441                                 $linkname = $wpdb->escape($linkname);
442                                 $description = $wpdb->escape($description);
443
444                                 if($linfo = link_exists($linkname))
445                                 {
446                                         $ret_id = wp_insert_link(array(
447                                                                 'link_id'                       => $linfo,
448                                                                 'link_url'                      => $url,
449                                                                 'link_name'                     => $linkname,
450                                                                 'link_category'         => $category,
451                                                                 'link_description'      => $description,
452                                                                 'link_updated'          => $date)
453                                                                 );
454                                 }
455                                 else
456                                 {
457                                         $ret_id = wp_insert_link(array(
458                                                                 'link_url'                      => $url,
459                                                                 'link_name'                     => $linkname,
460                                                                 'link_category'         => $category,
461                                                                 'link_description'      => $description,
462                                                                 'link_updated'          => $date)
463                                                                 );
464                                 }
465                                 $txplinks2wplinks[$link_id] = $ret_id;
466                         }
467                         add_option('txplinks2wplinks',$txplinks2wplinks);
468                         echo '<p>';
469                         printf(__('Done! <strong>%s</strong> Links imported'), $count);
470                         echo '<br /><br /></p>';
471                         return true;
472                 }
473                 echo __('No Links to Import!');
474                 return false;
475         }
476
477         function import_categories()
478         {
479                 // Category Import
480                 $cats = $this->get_txp_cats();
481                 $this->cat2wp($cats);
482                 add_option('txp_cats', $cats);
483
484
485
486                 echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
487                 wp_nonce_field('import-textpattern');
488                 printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Users')));
489                 echo '</form>';
490
491         }
492
493         function import_users()
494         {
495                 // User Import
496                 $users = $this->get_txp_users();
497                 $this->users2wp($users);
498
499                 echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
500                 wp_nonce_field('import-textpattern');
501                 printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Posts')));
502                 echo '</form>';
503         }
504
505         function import_posts()
506         {
507                 // Post Import
508                 $posts = $this->get_txp_posts();
509                 $this->posts2wp($posts);
510
511                 echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
512                 wp_nonce_field('import-textpattern');
513                 printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Comments')));
514                 echo '</form>';
515         }
516
517         function import_comments()
518         {
519                 // Comment Import
520                 $comments = $this->get_txp_comments();
521                 $this->comments2wp($comments);
522
523                 echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
524                 wp_nonce_field('import-textpattern');
525                 printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Links')));
526                 echo '</form>';
527         }
528
529         function import_links()
530         {
531                 //Link Import
532                 $links = $this->get_txp_links();
533                 $this->links2wp($links);
534                 add_option('txp_links', $links);
535
536                 echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
537                 wp_nonce_field('import-textpattern');
538                 printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Finish')));
539                 echo '</form>';
540         }
541
542         function cleanup_txpimport()
543         {
544                 delete_option('tpre');
545                 delete_option('txp_cats');
546                 delete_option('txpid2wpid');
547                 delete_option('txpcat2wpcat');
548                 delete_option('txpposts2wpposts');
549                 delete_option('txpcm2wpcm');
550                 delete_option('txplinks2wplinks');
551                 delete_option('txpuser');
552                 delete_option('txppass');
553                 delete_option('txpname');
554                 delete_option('txphost');
555                 $this->tips();
556         }
557
558         function tips()
559         {
560                 echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from Textpattern, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>';
561                 echo '<h3>'.__('Users').'</h3>';
562                 echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn\'t have that login in Textpattern, why should you have it here?  Instead we have taken care to import all of your users into our system.  Unfortunately there is one downside.  Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users.  <strong>Every user has the same username, but their passwords are reset to password123.</strong>  So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>';
563                 echo '<h3>'.__('Preserving Authors').'</h3>';
564                 echo '<p>'.__('Secondly, we have attempted to preserve post authors.  If you are the only author or contributor to your blog, then you are safe.  In most cases, we are successful in this preservation endeavor.  However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
565                 echo '<h3>'.__('Textile').'</h3>';
566                 echo '<p>'.__('Also, since you\'re coming from Textpattern, you probably have been using Textile to format your comments and posts.  If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>.  Trust me... You\'ll want it.').'</p>';
567                 echo '<h3>'.__('WordPress Resources').'</h3>';
568                 echo '<p>'.__('Finally, there are numerous WordPress resources around the internet.  Some of them are:').'</p>';
569                 echo '<ul>';
570                 echo '<li>'.__('<a href="http://www.wordpress.org">The official WordPress site</a>').'</li>';
571                 echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
572                 echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
573                 echo '</ul>';
574                 echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
575         }
576
577         function db_form()
578         {
579                 echo '<table class="editform">';
580                 printf('<tr><th scope="row"><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('Textpattern Database User:'));
581                 printf('<tr><th scope="row"><label for="dbpass">%s</label></th><td><input type="password" name="dbpass" id="dbpass" /></td></tr>', __('Textpattern Database Password:'));
582                 printf('<tr><th scope="row"><label for="dbname">%s</label></th><td><input type="text" id="dbname" name="dbname" /></td></tr>', __('Textpattern Database Name:'));
583                 printf('<tr><th scope="row"><label for="dbhost">%s</label></th><td><input type="text" id="dbhost" name="dbhost" value="localhost" /></td></tr>', __('Textpattern Database Host:'));
584                 printf('<tr><th scope="row"><label for="dbprefix">%s</label></th><td><input type="text" name="dbprefix" id="dbprefix"  /></td></tr>', __('Textpattern Table prefix (if any):'));
585                 echo '</table>';
586         }
587
588         function dispatch()
589         {
590
591                 if (empty ($_GET['step']))
592                         $step = 0;
593                 else
594                         $step = (int) $_GET['step'];
595                 $this->header();
596
597                 if ( $step > 0 )
598                 {
599                         check_admin_referer('import-textpattern');
600
601                         if($_POST['dbuser'])
602                         {
603                                 if(get_option('txpuser'))
604                                         delete_option('txpuser');
605                                 add_option('txpuser', sanitize_user($_POST['dbuser'], true));
606                         }
607                         if($_POST['dbpass'])
608                         {
609                                 if(get_option('txppass'))
610                                         delete_option('txppass');
611                                 add_option('txppass',  sanitize_user($_POST['dbpass'], true));
612                         }
613
614                         if($_POST['dbname'])
615                         {
616                                 if(get_option('txpname'))
617                                         delete_option('txpname');
618                                 add_option('txpname',  sanitize_user($_POST['dbname'], true));
619                         }
620                         if($_POST['dbhost'])
621                         {
622                                 if(get_option('txphost'))
623                                         delete_option('txphost');
624                                 add_option('txphost',  sanitize_user($_POST['dbhost'], true));
625                         }
626                         if($_POST['dbprefix'])
627                         {
628                                 if(get_option('tpre'))
629                                         delete_option('tpre');
630                                 add_option('tpre',  sanitize_user($_POST['dbprefix']));
631                         }
632
633
634                 }
635
636                 switch ($step)
637                 {
638                         default:
639                         case 0 :
640                                 $this->greet();
641                                 break;
642                         case 1 :
643                                 $this->import_categories();
644                                 break;
645                         case 2 :
646                                 $this->import_users();
647                                 break;
648                         case 3 :
649                                 $this->import_posts();
650                                 break;
651                         case 4 :
652                                 $this->import_comments();
653                                 break;
654                         case 5 :
655                                 $this->import_links();
656                                 break;
657                         case 6 :
658                                 $this->cleanup_txpimport();
659                                 break;
660                 }
661
662                 $this->footer();
663         }
664
665         function Textpattern_Import()
666         {
667                 // Nothing.
668         }
669 }
670
671 $txp_import = new Textpattern_Import();
672 register_importer('textpattern', __('Textpattern'), __('Import categories, users, posts, comments, and links from a Textpattern blog'), array ($txp_import, 'dispatch'));
673 ?>