diff options
Diffstat (limited to 'wp-includes/functions.php')
-rw-r--r-- | wp-includes/functions.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 1882962..63416a9 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -833,6 +833,33 @@ function wp_nonce_url($actionurl, $action = -1) { function wp_nonce_field($action = -1) { echo '<input type="hidden" name="_wpnonce" value="' . wp_create_nonce($action) . '" />'; + wp_referer_field(); +} + +function wp_referer_field() { + $ref = wp_specialchars($_SERVER['REQUEST_URI']); + echo '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />'; + if ( wp_get_original_referer() ) { + $original_ref = wp_specialchars(stripslashes(wp_get_original_referer())); + echo '<input type="hidden" name="_wp_original_http_referer" value="'. $original_ref . '" />'; + } +} + +function wp_original_referer_field() { + echo '<input type="hidden" name="_wp_original_http_referer" value="' . wp_specialchars(stripslashes($_SERVER['REQUEST_URI'])) . '" />'; +} + +function wp_get_referer() { + foreach ( array($_REQUEST['_wp_http_referer'], $_SERVER['HTTP_REFERER']) as $ref ) + if ( !empty($ref) ) + return $ref; + return false; +} + +function wp_get_original_referer() { + if ( !empty($_REQUEST['_wp_original_http_referer']) ) + return $_REQUEST['_wp_original_http_referer']; + return false; } function wp_mkdir_p($target) { |