Add sanitization of option values to add_option. Fixes #5209 props johnbillion.

git-svn-id: https://develop.svn.wordpress.org/trunk@7445 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2008-03-21 08:56:29 +00:00
parent 0c47f0d9d9
commit 9954e0e3c2
1 changed files with 2 additions and 0 deletions

View File

@ -344,6 +344,7 @@ function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
wp_protect_special_option( $name );
$safe_name = $wpdb->escape( $name );
$value = sanitize_option( $name, $value );
// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
$notoptions = wp_cache_get( 'notoptions', 'options' );
@ -371,6 +372,7 @@ function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
$wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES (%s, %s, %s)", $name, $value, $autoload ) );
do_action( "add_option_{$name}", $name, $value );
return;
}