function searchandreplace_doit($search_text, $replace_text, $sall = TRUE, $content = TRUE, $guid = TRUE, $id = TRUE, $title = TRUE, $excerpt = TRUE, $meta_value = TRUE, $comment_content = TRUE, $comment_author = TRUE, $comment_author_email = TRUE, $comment_author_url = TRUE, $comment_count = TRUE, $cat_description = TRUE, $tag = TRUE, $user_id = TRUE, $user_login = TRUE, $signups = TRUE)
{
    global $wpdb;
    $myecho = '';
    // slug string
    $search_slug = strtolower($search_text);
    $replace_slug = strtolower($replace_text);
    if (!$sall && !$content && !$id && !$guid && !$title && !$excerpt && !$meta_value && !$comment_content && !$comment_author && !$comment_author_email && !$comment_author_url && !$comment_count && !$cat_description && !$tag && !$user_id && !$user_login && !$signups) {
        return '<div class="error"><p><strong>' . __('Nothing (checkbox) selected to modify!', FB_SAR_TEXTDOMAIN) . '</strong></p></div><br class="clear" />';
    }
    // search at all
    if ('sall' === $sall) {
        $myecho .= "\n" . '<li>' . __('Searching all', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_sall($search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
    }
    // search/replace at all
    if ('srall' === $sall) {
        $myecho .= "\n" . '<li>' . __('Searching & replacing all', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_sall($search_text, $replace_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
    }
    // post content
    if ($content) {
        $myecho .= "\n" . '<li>' . __('Searching post content', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('post_content', 'posts', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->posts} ";
        $query .= "SET post_content = ";
        $query .= "REPLACE(post_content, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // post id
    if ($id) {
        $myecho .= "\n" . __('Searching ID', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('ID', 'posts', $search_text);
        $myecho .= searchandreplace_results('post_parent', 'posts', $search_text);
        $myecho .= searchandreplace_results('post_id', 'postmeta', $search_text);
        $myecho .= searchandreplace_results('object_id', 'term_relationships', $search_text);
        $myecho .= searchandreplace_results('comment_post_ID', 'comments', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->posts} ";
        $query .= "SET ID = ";
        $query .= "REPLACE(ID, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->posts} ";
        $query .= "SET post_parent = ";
        $query .= "REPLACE(post_parent, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->postmeta} ";
        $query .= "SET post_id = ";
        $query .= "REPLACE(post_id, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->term_relationships} ";
        $query .= "SET object_id = ";
        $query .= "REPLACE(object_id, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->comments} ";
        $query .= "SET comment_post_ID = ";
        $query .= "REPLACE(comment_post_ID, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // post guid
    if ($guid) {
        $myecho .= "\n" . '<li>' . __('Searching <abbr title=\\"Global Unique Identifier\\">GUID</abbr>', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('guid', 'posts', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->posts} ";
        $query .= "SET guid = ";
        $query .= "REPLACE(guid, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // post title
    if ($title) {
        $myecho .= "\n" . '<li>' . __('Searching Title', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('post_title', 'posts', $search_text);
        $myecho .= searchandreplace_results('post_name', 'posts', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->posts} ";
        $query .= "SET post_title = ";
        $query .= "REPLACE(post_title, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->posts} ";
        $query .= "SET post_name = ";
        $query .= "REPLACE(post_name, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // post excerpt
    if ($excerpt) {
        $myecho .= "\n" . '<li>' . __('Searching post excerpts', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('post_excerpt', 'posts', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->posts} ";
        $query .= "SET post_excerpt = ";
        $query .= "REPLACE(post_excerpt, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // meta_value
    if ($meta_value) {
        $myecho .= "\n" . '<li>' . __('Searching metadata', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('meta_value', 'postmeta', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->postmeta} ";
        $query .= "SET meta_value = ";
        $query .= "REPLACE(meta_value, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // comment content
    if ($comment_content) {
        $myecho .= "\n" . '<li>' . __('Searching comments text', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('comment_content', 'comments', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->comments} ";
        $query .= "SET comment_content = ";
        $query .= "REPLACE(comment_content, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // comment_author
    if ($comment_author) {
        $myecho .= "\n" . '<li>' . __('Searching comments authors', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('comment_author', 'comments', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->comments} ";
        $query .= "SET comment_author = ";
        $query .= "REPLACE(comment_author, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // comment_author_email
    if ($comment_author_email) {
        $myecho .= "\n" . '<li>' . __('Searching comments authors e-mails', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('comment_author_email', 'comments', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->comments} ";
        $query .= "SET comment_author_email = ";
        $query .= "REPLACE(comment_author_email, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // comment_author_url
    if ($comment_author_url) {
        $myecho .= "\n" . '<li>' . __('Searching comments authors URLs', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('comment_author_url', 'comments', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->comments} ";
        $query .= "SET comment_author_url = ";
        $query .= "REPLACE(comment_author_url, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // comment_count
    if ($comment_count) {
        $myecho .= "\n" . '<li>' . __('Searching comment counts', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('comment_count', 'posts', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->posts} ";
        $query .= "SET comment_count = ";
        $query .= "REPLACE(comment_count, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // category description
    if ($cat_description) {
        $myecho .= "\n" . '<li>' . __('Searching category descriptions', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('description', 'term_taxonomy', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->term_taxonomy} ";
        $query .= "SET description = ";
        $query .= "REPLACE(description, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    // tags and category
    if ($tag) {
        $myecho .= "\n" . '<li>' . __('Searching tags', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('name', 'terms', $search_text);
        $myecho .= searchandreplace_results('slug', 'terms', $search_slug);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->terms} ";
        $query .= "SET name = ";
        $query .= "REPLACE(name, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->terms} ";
        $query .= "SET slug = ";
        $query .= "REPLACE(slug, \"{$search_slug}\", \"{$replace_slug}\") ";
        $wpdb->get_results($query);
    }
    // user_id
    if ($user_id) {
        $myecho .= "\n" . '<li>' . __('Searching user IDs', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('ID', 'users', $search_text);
        $myecho .= searchandreplace_results('user_id', 'usermeta', $search_slug);
        $myecho .= searchandreplace_results('post_author', 'posts', $search_slug);
        $myecho .= searchandreplace_results('user_id', 'comments', $search_slug);
        $myecho .= searchandreplace_results('link_owner', 'links', $search_slug);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->users} ";
        $query .= "SET ID = ";
        $query .= "REPLACE(ID, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->usermeta} ";
        $query .= "SET user_id = ";
        $query .= "REPLACE(user_id, \"{$search_slug}\", \"{$replace_slug}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->posts} ";
        $query .= "SET post_author = ";
        $query .= "REPLACE(post_author, \"{$search_slug}\", \"{$replace_slug}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->comments} ";
        $query .= "SET user_id = ";
        $query .= "REPLACE(user_id, \"{$search_slug}\", \"{$replace_slug}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->links} ";
        $query .= "SET link_owner = ";
        $query .= "REPLACE(link_owner, \"{$search_slug}\", \"{$replace_slug}\") ";
        $wpdb->get_results($query);
    }
    // user_login
    if ($user_login) {
        $myecho .= "\n" . '<li>' . __('Searching user logins', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('user_login', 'users', $search_text);
        $myecho .= searchandreplace_results('user_nicename', 'users', $search_slug);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->users} ";
        $query .= "SET user_login = "******"REPLACE(user_login, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
        $query = "UPDATE {$wpdb->users} ";
        $query .= "SET user_nicename = ";
        $query .= "REPLACE(user_nicename, \"{$search_slug}\", \"{$replace_slug}\") ";
        $wpdb->get_results($query);
    }
    // signups on WP multisite
    if ($signups) {
        $myecho .= "\n" . '<li>' . __('Searching signups', FB_SAR_TEXTDOMAIN) . ' ...';
        $myecho .= "\n" . '<ul>' . "\n";
        $myecho .= searchandreplace_results('user_login', 'signups', $search_text);
        $myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
        $query = "UPDATE {$wpdb->signups} ";
        $query .= "SET user_login = "******"REPLACE(user_login, \"{$search_text}\", \"{$replace_text}\") ";
        $wpdb->get_results($query);
    }
    $echo = '<div class="updated fade">' . "\n" . '<ul>';
    $echo .= $myecho;
    $echo .= "\n" . '</ul>' . "\n" . '</div><br class="clear"/>' . "\n";
    return $echo;
}
Example #2
0
function searchandreplace_doit(
	$search_text,
	$replace_text,
	$all                  = TRUE,
	$content              = TRUE,
	$guid                 = TRUE,
	$id                   = TRUE,
	$title                = TRUE,
	$excerpt              = TRUE,
	$meta_value           = TRUE,
	$comment_content      = TRUE,
	$comment_author       = TRUE,
	$comment_author_email = TRUE,
	$comment_author_url   = TRUE,
	$comment_count        = TRUE,
	$cat_description      = TRUE,
	$tag                  = TRUE,
	$user_id              = TRUE,
	$user_login           = TRUE,
	$signups              = TRUE
	) {
	global $wpdb;

	$myecho = '';
	// slug string
	$search_slug  = strtolower($search_text);
	$replace_slug = strtolower($replace_text);
	
	if (!$all && !$content && !$id && !$guid && !$title && !$excerpt && !$meta_value && 
		!$comment_content && !$comment_author && !$comment_author_email && !$comment_author_url && !$comment_count && 
		!$cat_description && !$tag && !$user_id && !$user_login &&
		!$signups ) {
		return '<div class="error"><p><strong>' . __('Nothing (Checkbox) selected to modify!', FB_SAR_TEXTDOMAIN). '</strong></p></div><br class="clear" />';
	}

	// search at all
	if ($all) {
		$myecho .= "\n" . '<li>' . __('Looking @ all', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_all($search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
	}
	
	// post content
	if ($content) {
		$myecho .= "\n" . '<li>' . __('Looking @ post content', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('post_content', 'posts', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->posts ";
		$query .= "SET post_content = ";
		$query .= "REPLACE(post_content, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}

	// post id
	if ($id) {
		$myecho .= "\n" . __('Looking @ ID', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('ID', 'posts', $search_text);
		$myecho .= searchandreplace_results('post_parent', 'posts', $search_text);
		$myecho .= searchandreplace_results('post_id', 'postmeta', $search_text);
		$myecho .= searchandreplace_results('object_id', 'term_relationships', $search_text);
		$myecho .= searchandreplace_results('comment_post_ID', 'comments', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->posts ";
		$query .= "SET ID = ";
		$query .= "REPLACE(ID, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
		
		$query  = "UPDATE $wpdb->posts ";
		$query .= "SET post_parent = ";
		$query .= "REPLACE(post_parent, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);

		$query  = "UPDATE $wpdb->postmeta ";
		$query .= "SET post_id = ";
		$query .= "REPLACE(post_id, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);

		$query  = "UPDATE $wpdb->term_relationships ";
		$query .= "SET object_id = ";
		$query .= "REPLACE(object_id, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);

		$query  = "UPDATE $wpdb->comments ";
		$query .= "SET comment_post_ID = ";
		$query .= "REPLACE(comment_post_ID, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}
	
	// post guid
	if ($guid) {
		$myecho .= "\n" . '<li>' . __('Looking @ GUID', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('guid', 'posts', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->posts ";
		$query .= "SET guid = ";
		$query .= "REPLACE(guid, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}
	
	// post title
	if ($title) {
		$myecho .= "\n" . '<li>' . __('Looking @ Titeln', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('post_title', 'posts', $search_text);
		$myecho .= searchandreplace_results('post_name', 'posts', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->posts ";
		$query .= "SET post_title = ";
		$query .= "REPLACE(post_title, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
		
		$query  = "UPDATE $wpdb->posts ";
		$query .= "SET post_name = ";
		$query .= "REPLACE(post_name, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}
	
	// post excerpt
	if ($excerpt) {
		$myecho .= "\n" . '<li>' . __('Looking @ post excerpts', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('post_excerpt', 'posts', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->posts ";
		$query .= "SET post_excerpt = ";
		$query .= "REPLACE(post_excerpt, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}
	
	// meta_value
	if ($meta_value) {
		$myecho .= "\n" . '<li>' . __('Looking @ Meta Daten', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('meta_value', 'postmeta', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->postmeta ";
		$query .= "SET meta_value = ";
		$query .= "REPLACE(meta_value, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}
	
	// comment content
	if ($comment_content) {
		$myecho .= "\n" . '<li>' . __('Looking @ modifying comments text', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('comment_content', 'comments', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->comments ";
		$query .= "SET comment_content = ";
		$query .= "REPLACE(comment_content, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}
	
	// comment_author
	if ($comment_author) {
		$myecho .= "\n" . '<li>' . __('Looking @ modifying comments author', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('comment_author', 'comments', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->comments ";
		$query .= "SET comment_author = ";
		$query .= "REPLACE(comment_author, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}
	
	// comment_author_email
	if ($comment_author_email) {
		$myecho .= "\n" . '<li>' . __('Looking @ modifying comments author e-mail', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('comment_author_email', 'comments', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->comments ";
		$query .= "SET comment_author_email = ";
		$query .= "REPLACE(comment_author_email, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}
	
	// comment_author_url
	if ($comment_author_url) {
		$myecho .= "\n" . '<li>' . __('Looking @ modifying comments author URLs', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('comment_author_url', 'comments', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->comments ";
		$query .= "SET comment_author_url = ";
		$query .= "REPLACE(comment_author_url, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}

	// comment_count
	if ($comment_count) {
		$myecho .= "\n" . '<li>' . __('Looking @ Comment-Count', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('comment_count', 'posts', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->posts ";
		$query .= "SET comment_count = ";
		$query .= "REPLACE(comment_count, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}

	// category description
	if ($cat_description) {
		$myecho .= "\n" . '<li>' . __('Looking @ category description', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('description', 'term_taxonomy', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->term_taxonomy ";
		$query .= "SET description = ";
		$query .= "REPLACE(description, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}
	
	// tags and category
	if ($tag) {
		$myecho .= "\n" . '<li>' . __('Looking @ Tags', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('name', 'terms', $search_text);
		$myecho .= searchandreplace_results('slug', 'terms', $search_slug);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->terms ";
		$query .= "SET name = ";
		$query .= "REPLACE(name, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
		
		$query  = "UPDATE $wpdb->terms ";
		$query .= "SET slug = ";
		$query .= "REPLACE(slug, \"$search_slug\", \"$replace_slug\") ";
		$wpdb->get_results($query);
	}

	// user_id
	if ($user_id) {
		$myecho .= "\n" . '<li>' . __('Looking @ User-ID', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('ID', 'users', $search_text);
		$myecho .= searchandreplace_results('user_id', 'usermeta', $search_slug);
		$myecho .= searchandreplace_results('post_author', 'posts', $search_slug);
		$myecho .= searchandreplace_results('link_owner', 'links', $search_slug);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->users ";
		$query .= "SET ID = ";
		$query .= "REPLACE(ID, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
		
		$query  = "UPDATE $wpdb->usermeta ";
		$query .= "SET user_id = ";
		$query .= "REPLACE(user_id, \"$search_slug\", \"$replace_slug\") ";
		$wpdb->get_results($query);
		
		$query  = "UPDATE $wpdb->posts ";
		$query .= "SET post_author = ";
		$query .= "REPLACE(post_author, \"$search_slug\", \"$replace_slug\") ";
		$wpdb->get_results($query);
		
		$query  = "UPDATE $wpdb->links ";
		$query .= "SET link_owner = ";
		$query .= "REPLACE(link_owner, \"$search_slug\", \"$replace_slug\") ";
		$wpdb->get_results($query);
	}

	// user_login
	if ($user_login) {
		$myecho .= "\n" . '<li>' . __('Looking @ User Login', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('user_login', 'users', $search_text);
		$myecho .= searchandreplace_results('user_nicename', 'users', $search_slug);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->users ";
		$query .= "SET user_login = "******"REPLACE(user_login, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
		
		$query  = "UPDATE $wpdb->users ";
		$query .= "SET user_nicename = ";
		$query .= "REPLACE(user_nicename, \"$search_slug\", \"$replace_slug\") ";
		$wpdb->get_results($query);
	}
	
	// signups on WP multisite
	if ($signups) {
		$myecho .= "\n" . '<li>' . __('Looking @ signups', FB_SAR_TEXTDOMAIN) . ' ...';
		
		$myecho .= "\n" . '<ul>' . "\n";
		$myecho .= searchandreplace_results('user_login', 'signups', $search_text);
		$myecho .= "\n" . '</ul>' . "\n" . '</li>' . "\n";
		
		$query  = "UPDATE $wpdb->signups ";
		$query .= "SET user_login = "******"REPLACE(user_login, \"$search_text\", \"$replace_text\") ";
		$wpdb->get_results($query);
	}
	
	$echo  = '<div class="updated fade">' . "\n" . '<ul>';
	$echo .= $myecho;
	$echo .= "\n" . '</ul>' . "\n" . '</div><br class="clear"/>' . "\n";
	
	return $echo;
}