Index: functions.php
===================================================================
--- functions.php	(revision 4776)
+++ functions.php	(working copy)
@@ -920,22 +920,39 @@
 	return wp_specialchars(add_query_arg('_wpnonce', wp_create_nonce($action), $actionurl));
 }
 
-function wp_nonce_field($action = -1) {
-	echo '<input type="hidden" name="_wpnonce" value="' . wp_create_nonce($action) . '" />';
+function wp_nonce_field($action = -1, $return = FALSE) {
+	$nonce = '<input type="hidden" name="_wpnonce" value="' . wp_create_nonce($action) . '" />';
+    
+    if($return) {
+        return $nonce;
+    } else {
+        echo $nonce;
+    }
 	wp_referer_field();
 }
 
-function wp_referer_field() {
+function wp_referer_field($return = FALSE) {
 	$ref = attribute_escape($_SERVER['REQUEST_URI']);
-	echo '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
+	$ret_val = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
 	if ( wp_get_original_referer() ) {
 		$original_ref = attribute_escape(stripslashes(wp_get_original_referer()));
-		echo '<input type="hidden" name="_wp_original_http_referer" value="'. $original_ref . '" />';
+		$ret_val .= '<input type="hidden" name="_wp_original_http_referer" value="'. $original_ref . '" />';
 	}
+    if($return) {
+        return $ret_val;
+    } else {
+        echo $ret_val;
+    }
+    
 }
 
-function wp_original_referer_field() {
-	echo '<input type="hidden" name="_wp_original_http_referer" value="' . attribute_escape(stripslashes($_SERVER['REQUEST_URI'])) . '" />';
+function wp_original_referer_field($return = FALSE) {
+    $ret_val = '<input type="hidden" name="_wp_original_http_referer" value="' . attribute_escape(stripslashes($_SERVER['REQUEST_URI'])) . '" />';
+    if($return) {
+        return $ret_val;
+    } else {
+        echo $ret_val;
+    }
 }
 
 function wp_get_referer() {

