Revert [4735]. Not needed.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-01-16 03:00:35 +00:00
parent 7aa452938f
commit 23148c01f3
1 changed files with 30 additions and 2 deletions

View File

@ -41,7 +41,7 @@ class WP_Import {
function users_form($n) { function users_form($n) {
global $wpdb, $testing; global $wpdb, $testing;
$users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID"); $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
?><select name="userselect[<?php echo attribute_escape($n); ?>]"> ?><select name="userselect[<?php echo $n; ?>]">
<option value="#NONE#">- Select -</option> <option value="#NONE#">- Select -</option>
<?php <?php
foreach ($users as $user) { foreach ($users as $user) {
@ -100,6 +100,7 @@ class WP_Import {
array_push($temp, "$author"); //store the extracted author names in a temporary array array_push($temp, "$author"); //store the extracted author names in a temporary array
} }
} }
// We need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting. // We need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting.
$authors[0] = array_shift($temp); $authors[0] = array_shift($temp);
$y = count($temp) + 1; $y = count($temp) + 1;
@ -112,6 +113,32 @@ class WP_Import {
return $authors; return $authors;
} }
function get_authors_from_post() {
$formnames = array ();
$selectnames = array ();
foreach ($_POST['user'] as $key => $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() { function wp_authors_form() {
?> ?>
<h2><?php _e('Assign Authors'); ?></h2> <h2><?php _e('Assign Authors'); ?></h2>
@ -127,7 +154,7 @@ class WP_Import {
foreach ($authors as $author) { foreach ($authors as $author) {
++ $j; ++ $j;
echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />'); echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
$this->users_form($author); $this->users_form($j);
echo '</li>'; echo '</li>';
} }
@ -280,6 +307,7 @@ class WP_Import {
$this->id = (int) $_GET['id']; $this->id = (int) $_GET['id'];
$this->file = get_attached_file($this->id); $this->file = get_attached_file($this->id);
$this->get_authors_from_post();
$this->get_entries(); $this->get_entries();
$this->process_categories(); $this->process_categories();
$this->process_posts(); $this->process_posts();