From ed919b2ff3b20db3703dc7f6735e994ed7b893da Mon Sep 17 00:00:00 2001 From: donncha Date: Mon, 25 Jun 2007 09:58:04 +0000 Subject: Removing code that isn't needed, prompted by #358 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1007 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/import/wordpress.php | 43 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) (limited to 'wp-admin/import/wordpress.php') diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php index 0b1aa2a..a56e30a 100644 --- a/wp-admin/import/wordpress.php +++ b/wp-admin/import/wordpress.php @@ -37,14 +37,15 @@ class WP_Import { function get_tag( $string, $tag ) { global $wpdb; preg_match("|<$tag.*?>(.*?)|is", $string, $return); - $return = $wpdb->escape( trim( $return[1] ) ); + $return = preg_replace('|^$|s', '$1', $return[1]); + $return = $wpdb->escape( trim( $return ) ); return $return; } function users_form($n) { global $wpdb, $testing; $users = get_users_of_blog($wpdb->blogid); -?> $line) { - $newname = trim(stripslashes($line)); - if ($newname == '') - $newname = 'left_blank'; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form. - array_push($formnames, "$newname"); - } // $formnames is the array with the form entered names - - foreach ($_POST['userselect'] as $user => $key) { - $selected = trim(stripslashes($key)); - array_push($selectnames, "$selected"); - } - - $count = count($formnames); - for ($i = 0; $i < $count; $i ++) { - if ($selectnames[$i] != '#NONE#') { //if no name was selected from the select menu, use the name entered in the form - array_push($this->newauthornames, "$selectnames[$i]"); - } else { - array_push($this->newauthornames, "$formnames[$i]"); - } - } - } - function wp_authors_form() { ?>

@@ -198,7 +173,7 @@ class WP_Import { $cat_names = (array) $wpdb->get_col("SELECT cat_name FROM $wpdb->categories"); while ( $c = array_shift($this->categories) ) { - $cat_name = trim(str_replace(array (''), '', $this->get_tag( $c, 'wp:cat_name' ))); + $cat_name = trim($this->get_tag( $c, 'wp:cat_name' )); // If the category exists we leave it alone if ( in_array($cat_name, $cat_names) ) @@ -234,14 +209,14 @@ class WP_Import { echo '

'.sprintf(__('All done.').' '.__('Have fun!').'', get_option('home')).'

'; } - + function process_post($post) { global $wpdb; $post_ID = (int) $this->get_tag( $post, 'wp:post_id' ); if ( $post_ID && !empty($this->posts_processed[$post_ID][1]) ) // Processed already return 0; - + // There are only ever one of these $post_title = $this->get_tag( $post, 'title' ); $post_date = $this->get_tag( $post, 'wp:post_date' ); @@ -257,7 +232,6 @@ class WP_Import { $post_author = $this->get_tag( $post, 'dc:creator' ); $post_content = $this->get_tag( $post, 'content:encoded' ); - $post_content = str_replace(array (''), '', $post_content); $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content); $post_content = str_replace('
', '
', $post_content); $post_content = str_replace('
', '
', $post_content); @@ -294,7 +268,7 @@ class WP_Import { // Memorize old and new ID. if ( $post_id && $post_ID && $this->posts_processed[$post_ID] ) $this->posts_processed[$post_ID][1] = $post_id; // New ID. - + // Add categories. if (count($categories) > 0) { $post_cats = array(); @@ -350,7 +324,6 @@ class WP_Import { $this->id = (int) $_GET['id']; $this->file = get_attached_file($this->id); - $this->get_authors_from_post(); $this->get_entries(); $this->process_categories(); $this->process_posts(); -- cgit