]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/import/textpattern.php
Wordpress 2.9.1-scripts
[autoinstalls/wordpress.git] / wp-admin / import / textpattern.php
index bbddc08d382d5947bc9b08c38b81e9103d16c201..fb4721393565e7b522c51fd7f6ade59c8f589e74 100644 (file)
@@ -1,10 +1,22 @@
 <?php
 /**
-       Add These Functions to make our lives easier
-**/
+ * TextPattern Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
 
 if(!function_exists('get_comment_count'))
 {
+       /**
+        * Get the comment count for posts.
+        *
+        * @package WordPress
+        * @subpackage Textpattern_Import
+        *
+        * @param int $post_ID Post ID
+        * @return int
+        */
        function get_comment_count($post_ID)
        {
                global $wpdb;
@@ -14,6 +26,15 @@ if(!function_exists('get_comment_count'))
 
 if(!function_exists('link_exists'))
 {
+       /**
+        * Check whether link already exists.
+        *
+        * @package WordPress
+        * @subpackage Textpattern_Import
+        *
+        * @param string $linkname
+        * @return int
+        */
        function link_exists($linkname)
        {
                global $wpdb;
@@ -22,13 +43,16 @@ if(!function_exists('link_exists'))
 }
 
 /**
-       The Main Importer Class
-**/
+ * TextPattern Importer Class
+ *
+ * @since unknown
+ */
 class Textpattern_Import {
 
        function header()
        {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import Textpattern').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
        }
@@ -46,7 +70,7 @@ class Textpattern_Import {
                echo '<form action="admin.php?import=textpattern&amp;step=1" method="post">';
                wp_nonce_field('import-textpattern');
                $this->db_form();
-               echo '<p class="submit"><input type="submit" class="button" name="submit" value="'.attribute_escape(__('Import')).'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Import').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
@@ -177,7 +201,7 @@ class Textpattern_Import {
 
                        // Store category translation for future use
                        add_option('txpcat2wpcat',$txpcat2wpcat);
-                       echo '<p>'.sprintf(__ngettext('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
+                       echo '<p>'.sprintf(_n('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
                        return true;
                }
                echo __('No Categories to Import!');
@@ -373,33 +397,24 @@ class Textpattern_Import {
                                $web = $wpdb->escape($web);
                                $message = $wpdb->escape($message);
 
-                               if($cinfo = comment_exists($name, $posted))
-                               {
+                               $comment = array(
+                                                       'comment_post_ID'       => $comment_post_ID,
+                                                       'comment_author'        => $name,
+                                                       'comment_author_IP'     => $ip,
+                                                       'comment_author_email'  => $email,
+                                                       'comment_author_url'    => $web,
+                                                       'comment_date'          => $posted,
+                                                       'comment_content'       => $message,
+                                                       'comment_approved'      => $comment_approved);
+                               $comment = wp_filter_comment($comment);
+
+                               if ( $cinfo = comment_exists($name, $posted) ) {
                                        // Update comments
-                                       $ret_id = wp_update_comment(array(
-                                               'comment_ID'                    => $cinfo,
-                                               'comment_post_ID'               => $comment_post_ID,
-                                               'comment_author'                => $name,
-                                               'comment_author_email'  => $email,
-                                               'comment_author_url'    => $web,
-                                               'comment_date'                  => $posted,
-                                               'comment_content'               => $message,
-                                               'comment_approved'              => $comment_approved)
-                                               );
-                               }
-                               else
-                               {
+                                       $comment['comment_ID'] = $cinfo;
+                                       $ret_id = wp_update_comment($comment);
+                               } else {
                                        // Insert comments
-                                       $ret_id = wp_insert_comment(array(
-                                               'comment_post_ID'               => $comment_post_ID,
-                                               'comment_author'                => $name,
-                                               'comment_author_email'  => $email,
-                                               'comment_author_url'    => $web,
-                                               'comment_author_IP'             => $ip,
-                                               'comment_date'                  => $posted,
-                                               'comment_content'               => $message,
-                                               'comment_approved'              => $comment_approved)
-                                               );
+                                       $ret_id = wp_insert_comment($comment);
                                }
                                $txpcm2wpcm[$comment_ID] = $ret_id;
                        }
@@ -462,7 +477,7 @@ class Textpattern_Import {
                        }
                        add_option('txplinks2wplinks',$txplinks2wplinks);
                        echo '<p>';
-                       printf(__ngettext('Done! <strong>%s</strong> link imported', 'Done! <strong>%s</strong> links imported', $count), $count);
+                       printf(_n('Done! <strong>%s</strong> link imported', 'Done! <strong>%s</strong> links imported', $count), $count);
                        echo '<br /><br /></p>';
                        return true;
                }
@@ -481,7 +496,7 @@ class Textpattern_Import {
 
                echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
                wp_nonce_field('import-textpattern');
-               printf('<input type="submit" class="button" name="submit" value="%s" />', attribute_escape(__('Import Users')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Users'));
                echo '</form>';
 
        }
@@ -494,7 +509,7 @@ class Textpattern_Import {
 
                echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
                wp_nonce_field('import-textpattern');
-               printf('<input type="submit" class="button" name="submit" value="%s" />', attribute_escape(__('Import Posts')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Posts'));
                echo '</form>';
        }
 
@@ -508,7 +523,7 @@ class Textpattern_Import {
 
                echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
                wp_nonce_field('import-textpattern');
-               printf('<input type="submit" class="button" name="submit" value="%s" />', attribute_escape(__('Import Comments')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Comments'));
                echo '</form>';
        }
 
@@ -520,7 +535,7 @@ class Textpattern_Import {
 
                echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
                wp_nonce_field('import-textpattern');
-               printf('<input type="submit" class="button" name="submit" value="%s" />', attribute_escape(__('Import Links')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Links'));
                echo '</form>';
        }
 
@@ -533,7 +548,7 @@ class Textpattern_Import {
 
                echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
                wp_nonce_field('import-textpattern');
-               printf('<input type="submit" class="button" name="submit" value="%s" />', attribute_escape(__('Finish')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Finish'));
                echo '</form>';
        }
 
@@ -558,7 +573,7 @@ class Textpattern_Import {
        {
                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>';
                echo '<h3>'.__('Users').'</h3>';
-               echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn&#8217;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.'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
+               echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn&#8217;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">log in</a> and change it.'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
                echo '<h3>'.__('Preserving Authors').'</h3>';
                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>';
                echo '<h3>'.__('Textile').'</h3>';
@@ -570,7 +585,7 @@ class Textpattern_Import {
                echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
                echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
                echo '</ul>';
-               echo '<p>'.sprintf(__('That&#8217;s it! What are you waiting for? Go <a href="%1$s">login</a>!'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
+               echo '<p>'.sprintf(__('That&#8217;s it! What are you waiting for? Go <a href="%1$s">log in</a>!'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
        }
 
        function db_form()
@@ -670,5 +685,7 @@ class Textpattern_Import {
 }
 
 $txp_import = new Textpattern_Import();
+
 register_importer('textpattern', __('Textpattern'), __('Import categories, users, posts, comments, and links from a Textpattern blog.'), array ($txp_import, 'dispatch'));
+
 ?>