X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/baca9ce86a38dc54c4574890ee2d352fd81f78b2..61343b82c4f0da4c68e4c6373daafff4a81efdd1:/wp-includes/option.php diff --git a/wp-includes/option.php b/wp-includes/option.php index 722d1f30..3df89c2c 100644 --- a/wp-includes/option.php +++ b/wp-includes/option.php @@ -104,8 +104,7 @@ function get_option( $option, $default = false ) { * @param string $option Option name. */ function wp_protect_special_option( $option ) { - $protected = array( 'alloptions', 'notoptions' ); - if ( in_array( $option, $protected ) ) + if ( 'alloptions' === $option || 'notoptions' === $option ) wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) ); } @@ -248,10 +247,10 @@ function update_option( $option, $newvalue ) { if ( ! defined( 'WP_INSTALLING' ) ) { $alloptions = wp_load_alloptions(); if ( isset( $alloptions[$option] ) ) { - $alloptions[$option] = $_newvalue; + $alloptions[$option] = $newvalue; wp_cache_set( 'alloptions', $alloptions, 'options' ); } else { - wp_cache_set( $option, $_newvalue, 'options' ); + wp_cache_set( $option, $newvalue, 'options' ); } } @@ -360,6 +359,10 @@ function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) function delete_option( $option ) { global $wpdb; + $option = trim( $option ); + if ( empty( $option ) ) + return false; + wp_protect_special_option( $option ); // Get the ID, if no ID then return @@ -512,8 +515,8 @@ function set_transient( $transient, $value, $expiration = 0 ) { } } if ( $result ) { - do_action( 'set_transient_' . $transient ); - do_action( 'setted_transient', $transient ); + do_action( 'set_transient_' . $transient, $value, $expiration ); + do_action( 'setted_transient', $transient, $value, $expiration ); } return $result; } @@ -1049,8 +1052,8 @@ function set_site_transient( $transient, $value, $expiration = 0 ) { } } if ( $result ) { - do_action( 'set_site_transient_' . $transient ); - do_action( 'setted_site_transient', $transient ); + do_action( 'set_site_transient_' . $transient, $value, $expiration ); + do_action( 'setted_site_transient', $transient, $value, $expiration ); } return $result; }