Ticket #11953: 11953.2.diff
| File 11953.2.diff, 1.3 KB (added by , 15 years ago) |
|---|
-
wp-includes/functions.php
1954 1954 * offer absolute protection, but should protect against most cases. It is very 1955 1955 * important to use nonce field in forms. 1956 1956 * 1957 * If you set $echo to true and set $referer to true, then you will need to1958 * retrieve the {@link wp_referer_field() wp referer field}. If you have the1959 * $referer set to true and are echoing the nonce field, it will also echo the1960 * referer field.1961 *1962 1957 * The $action and $name are optional, but if you want to have better security, 1963 1958 * it is strongly suggested to set those two parameters. It is easier to just 1964 1959 * call the function without any parameters, because validation of the nonce … … 1982 1977 function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) { 1983 1978 $name = esc_attr( $name ); 1984 1979 $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />'; 1985 if ( $echo )1986 echo $nonce_field;1987 1980 1988 1981 if ( $referer ) 1989 wp_referer_field( $echo);1982 $nonce_field .= wp_referer_field( false ); 1990 1983 1984 if ( $echo ) 1985 echo $nonce_field; 1986 1991 1987 return $nonce_field; 1992 1988 } 1993 1989