Ticket #3628: wp_nonces.2.diff
File wp_nonces.2.diff, 1.9 KB (added by , 17 years ago) |
---|
-
functions.php
920 920 return wp_specialchars(add_query_arg('_wpnonce', wp_create_nonce($action), $actionurl)); 921 921 } 922 922 923 function wp_nonce_field($action = -1) { 924 echo '<input type="hidden" name="_wpnonce" value="' . wp_create_nonce($action) . '" />'; 923 function wp_nonce_field($action = -1, $return = FALSE) { 924 $nonce = '<input type="hidden" name="_wpnonce" value="' . wp_create_nonce($action) . '" />'; 925 926 if($return) { 927 return $nonce; 928 } else { 929 echo $nonce; 930 } 925 931 wp_referer_field(); 926 932 } 927 933 928 function wp_referer_field( ) {934 function wp_referer_field($return = FALSE) { 929 935 $ref = attribute_escape($_SERVER['REQUEST_URI']); 930 echo'<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';936 $ret_val = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />'; 931 937 if ( wp_get_original_referer() ) { 932 938 $original_ref = attribute_escape(stripslashes(wp_get_original_referer())); 933 echo'<input type="hidden" name="_wp_original_http_referer" value="'. $original_ref . '" />';939 $ret_val .= '<input type="hidden" name="_wp_original_http_referer" value="'. $original_ref . '" />'; 934 940 } 941 if($return) { 942 return $ret_val; 943 } else { 944 echo $ret_val; 945 } 946 935 947 } 936 948 937 function wp_original_referer_field() { 938 echo '<input type="hidden" name="_wp_original_http_referer" value="' . attribute_escape(stripslashes($_SERVER['REQUEST_URI'])) . '" />'; 949 function wp_original_referer_field($return = FALSE) { 950 $ret_val = '<input type="hidden" name="_wp_original_http_referer" value="' . attribute_escape(stripslashes($_SERVER['REQUEST_URI'])) . '" />'; 951 if($return) { 952 return $ret_val; 953 } else { 954 echo $ret_val; 955 } 939 956 } 940 957 941 958 function wp_get_referer() {