Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 12294)
+++ wp-includes/functions.php	(working copy)
@@ -289,7 +289,7 @@
 }
 
 /**
- * Retrieve option value based on setting name.
+ * Retrieve option value based on option name.
  *
  * If the option does not exist or does not have a value, then the return value
  * will be false. This is useful to check whether you need to install an option
@@ -311,46 +311,48 @@
  * @since 1.5.0
  * @package WordPress
  * @subpackage Option
- * @uses apply_filters() Calls 'pre_option_$optionname' false to allow
- *		overwriting the option value in a plugin.
- * @uses apply_filters() Calls 'option_$optionname' with the option name value.
+ * @uses apply_filters() Calls 'pre_option_$option' null to allow overwriting
+ *		the option value in a plugin.
+ * @uses apply_filters() Calls 'option_$option' with the option name value.
  *
- * @param string $setting Name of option to retrieve. Should already be SQL-escaped
+ * @param string $option Name of option to retrieve. Should already be SQL-escaped
+ * @param mixed $default Optional value to return if option doesn't exist
  * @return mixed Value set for the option.
  */
-function get_option( $setting, $default = false ) {
+function get_option( $option, $default = false ) {
 	global $wpdb;
 
 	// Allow plugins to short-circuit options.
-	$pre = apply_filters( 'pre_option_' . $setting, false );
-	if ( false !== $pre )
+	$pre = apply_filters( 'pre_option_' . $option, null );
+	if ( null !== $pre )
 		return $pre;
 
 	// prevent non-existent options from triggering multiple queries
 	$notoptions = wp_cache_get( 'notoptions', 'options' );
-	if ( isset( $notoptions[$setting] ) )
+	if ( isset( $notoptions[$option] ) )
 		return $default;
 
 	$alloptions = wp_load_alloptions();
 
-	if ( isset( $alloptions[$setting] ) ) {
-		$value = $alloptions[$setting];
+	if ( isset( $alloptions[$option] ) ) {
+		$value = $alloptions[$option];
 	} else {
-		$value = wp_cache_get( $setting, 'options' );
+		$value = wp_cache_get( $option, 'options' );
 
 		if ( false === $value ) {
 			if ( defined( 'WP_INSTALLING' ) )
 				$suppress = $wpdb->suppress_errors();
-			// expected_slashed ($setting)
-			$row = $wpdb->get_row( "SELECT option_value FROM $wpdb->options WHERE option_name = '$setting' LIMIT 1" );
+			// expected_slashed ($option)
+			$row = $wpdb->get_row( "SELECT option_value FROM $wpdb->options WHERE option_name = '$option' LIMIT 1" );
 			if ( defined( 'WP_INSTALLING' ) )
 				$wpdb->suppress_errors($suppress);
 
-			if ( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
+			// Has to be get_row instead of get_var because of funkiness with 0, false, null values
+			if ( is_object( $row ) ) {
 				$value = $row->option_value;
-				wp_cache_add( $setting, $value, 'options' );
+				wp_cache_add( $option, $value, 'options' );
 			} else { // option does not exist, so we must cache its non-existence
-				$notoptions[$setting] = true;
+				$notoptions[$option] = true;
 				wp_cache_set( 'notoptions', $notoptions, 'options' );
 				return $default;
 			}
@@ -358,13 +360,13 @@
 	}
 
 	// If home is not set use siteurl.
-	if ( 'home' == $setting && '' == $value )
+	if ( 'home' == $option && '' == $value )
 		return get_option( 'siteurl' );
 
-	if ( in_array( $setting, array('siteurl', 'home', 'category_base', 'tag_base') ) )
+	if ( in_array( $option, array( 'siteurl', 'home', 'category_base', 'tag_base' ) ) )
 		$value = untrailingslashit( $value );
 
-	return apply_filters( 'option_' . $setting, maybe_unserialize( $value ) );
+	return apply_filters( 'option_' . $option, maybe_unserialize( $value ) );
 }
 
 /**
@@ -475,67 +477,65 @@
  * to set whether an option autoloaded, then you need to use the add_option().
  *
  * Before the option is updated, then the filter named
- * 'pre_update_option_$option_name', with the $option_name as the $option_name
- * parameter value, will be called. The hook should accept two parameters, the
- * first is the new value and the second is the old value.  Whatever is
- * returned will be used as the new value.
+ * 'pre_update_option_$option', with the $option as the $option parameter value,
+ * will be called. The hook should accept two parameters, the first is the new
+ * and the second is the old value.  Whatever is returned will be used as the new
+ * value.
  *
- * After the value has been updated the action named 'update_option_$option_name'
+ * After the value has been updated the action named 'update_option_$option'
  * will be called.  This action receives two parameters the first being the old
  * value and the second the new value.
  *
  * @since 1.0.0
  * @package WordPress
  * @subpackage Option
+ * @uses apply_filters() calls 'pre_update_option_$option' to allow overwriting
+ *   the option value in a plugin.
  *
- * @param string $option_name Option name. Expected to not be SQL-escaped
- * @param mixed $newvalue Option value.
+ * @param string $option Option name. Expected to not be SQL-escaped
+ * @param mixed $value Option value.
  * @return bool False if value was not updated and true if value was updated.
  */
-function update_option( $option_name, $newvalue ) {
+function update_option( $option, $value ) {
 	global $wpdb;
 
-	wp_protect_special_option( $option_name );
+	wp_protect_special_option( $option );
 
-	$safe_option_name = esc_sql( $option_name );
-	$newvalue = sanitize_option( $option_name, $newvalue );
+	$safe_option = esc_sql( $option );
+	$new_value   = sanitize_option( $option, $value );
+	$old_value   = get_option( $safe_option );
+	$new_value   = apply_filters( 'pre_update_option_' . $option, $new_value, $old_value );
 
-	$oldvalue = get_option( $safe_option_name );
-
-	$newvalue = apply_filters( 'pre_update_option_' . $option_name, $newvalue, $oldvalue );
-
 	// If the new and old values are the same, no need to update.
-	if ( $newvalue === $oldvalue )
+	if ( $new_value === $old_value )
 		return false;
 
-	if ( false === $oldvalue ) {
-		add_option( $option_name, $newvalue );
-		return true;
-	}
+	if ( false === $old_value )
+		return add_option( $option, $new_value );
 
 	$notoptions = wp_cache_get( 'notoptions', 'options' );
-	if ( is_array( $notoptions ) && isset( $notoptions[$option_name] ) ) {
-		unset( $notoptions[$option_name] );
+	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
+		unset( $notoptions[$option] );
 		wp_cache_set( 'notoptions', $notoptions, 'options' );
 	}
 
-	$_newvalue = $newvalue;
-	$newvalue = maybe_serialize( $newvalue );
+	$_new_value = $new_value;
+	$new_value  = maybe_serialize( $new_value );
 
-	do_action( 'update_option', $option_name, $oldvalue, $newvalue );
+	do_action( 'update_option', $option, $old_value, $new_value );
 	$alloptions = wp_load_alloptions();
-	if ( isset( $alloptions[$option_name] ) ) {
-		$alloptions[$option_name] = $newvalue;
+	if ( isset( $alloptions[$option] ) ) {
+		$alloptions[$option] = $new_value;
 		wp_cache_set( 'alloptions', $alloptions, 'options' );
 	} else {
-		wp_cache_set( $option_name, $newvalue, 'options' );
+		wp_cache_set( $option, $new_value, 'options' );
 	}
 
-	$wpdb->update($wpdb->options, array('option_value' => $newvalue), array('option_name' => $option_name) );
+	$wpdb->update($wpdb->options, array('option_value' => $new_value), array('option_name' => $option) );
 
 	if ( $wpdb->rows_affected == 1 ) {
-		do_action( "update_option_{$option_name}", $oldvalue, $_newvalue );
-		do_action( 'updated_option', $option_name, $oldvalue, $_newvalue );
+		do_action( "update_option_{$option}", $old_value, $_new_value );
+		do_action( 'updated_option', $option, $old_value, $_new_value );
 		return true;
 	}
 	return false;
@@ -544,7 +544,7 @@
 /**
  * Add a new option.
  *
- * You do not need to serialize values, if the value needs to be serialize, then
+ * You do not need to serialize values. If the value needs to be serialized, then
  * it will be serialized before it is inserted into the database. Remember,
  * resources can not be serialized or added as an option.
  *
@@ -554,7 +554,7 @@
  * options, the same as the ones which are protected and to not add options
  * that were already added.
  *
- * The filter named 'add_option_$optionname', with the $optionname being
+ * The filter named 'add_option_$option', with the $option being
  * replaced with the option's name, will be called. The hook should accept two
  * parameters, the first is the option name, and the second is the value.
  *
@@ -562,85 +562,90 @@
  * @subpackage Option
  * @since 1.0.0
  * @link http://alex.vort-x.net/blog/ Thanks Alex Stapleton
+ * @uses apply_filters() Calls 'pre_add_option_$option' to allow overwriting
+ *   the option value in a plugin.
  *
- * @param string $name Option name to add. Expects to NOT be SQL escaped.
+ * @param string $option Name of option to add. Expects to not be SQL escaped.
  * @param mixed $value Optional. Option value, can be anything.
  * @param mixed $deprecated Optional. Description. Not used anymore.
- * @param bool $autoload Optional. Default is enabled. Whether to load the option when WordPress starts up.
- * @return null returns when finished.
+ * @param bool $autoload Optional. Whether to load the option when WordPress starts up. Default is enabled.
+ * @return bool False if option was not added and true if option was added.
  */
-function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
+function add_option( $option, $value = '', $deprecated = '', $autoload = true ) {
 	global $wpdb;
 
-	wp_protect_special_option( $name );
-	$safe_name = esc_sql( $name );
-	$value = sanitize_option( $name, $value );
+	wp_protect_special_option( $option );
+	$safe_name = esc_sql( $option );
 
+	$value = sanitize_option( $option, $value );
+	$value = apply_filters( 'pre_add_option_' . $option, $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' );
-	if ( !is_array( $notoptions ) || !isset( $notoptions[$name] ) )
+	if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )
 		if ( false !== get_option( $safe_name ) )
-			return;
+			return false;
 
 	$value = maybe_serialize( $value );
-	$autoload = ( 'no' === $autoload ) ? 'no' : 'yes';
-	do_action( 'add_option', $name, $value );
-	if ( 'yes' == $autoload ) {
+	$autoload = ( $autoload && 'no' != $autoload ) ? true : false;
+	do_action( 'add_option', $option, $value );
+	if ( $autoload ) {
 		$alloptions = wp_load_alloptions();
-		$alloptions[$name] = $value;
+		$alloptions[$option] = $value;
 		wp_cache_set( 'alloptions', $alloptions, 'options' );
 	} else {
-		wp_cache_set( $name, $value, 'options' );
+		wp_cache_set( $option, $value, 'options' );
 	}
 
 	// This option exists now
 	$notoptions = wp_cache_get( 'notoptions', 'options' ); // yes, again... we need it to be fresh
-	if ( is_array( $notoptions ) && isset( $notoptions[$name] ) ) {
-		unset( $notoptions[$name] );
+	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
+		unset( $notoptions[$option] );
 		wp_cache_set( 'notoptions', $notoptions, 'options' );
 	}
 
-	$wpdb->insert($wpdb->options, array('option_name' => $name, 'option_value' => $value, 'autoload' => $autoload) );
+	$wpdb->insert($wpdb->options, array('option_name' => $option, 'option_value' => $value, 'autoload' => ( $autoload ) ? 'yes' : 'no' ) );
 
-	do_action( "add_option_{$name}", $name, $value );
-	do_action( 'added_option', $name, $value );
+	do_action( "add_option_{$option}", $option, $value );
+	do_action( 'added_option', $option, $value );
 	
-	return;
+	return true;
 }
 
 /**
- * Removes option by name and prevents removal of protected WordPress options.
+ * Removes option by name. Prevents removal of protected WordPress options.
  *
  * @package WordPress
  * @subpackage Option
  * @since 1.2.0
  *
- * @param string $name Option name to remove.
+ * @param string $option Name of option to remove. Expected to be SQL-escaped.
  * @return bool True, if succeed. False, if failure.
  */
-function delete_option( $name ) {
+function delete_option( $option ) {
 	global $wpdb;
 
-	wp_protect_special_option( $name );
+	wp_protect_special_option( $option );
 
 	// Get the ID, if no ID then return
 	// expected_slashed ($name)
-	$option = $wpdb->get_row( "SELECT autoload FROM $wpdb->options WHERE option_name = '$name'" );
+	$option = $wpdb->get_row( "SELECT autoload FROM $wpdb->options WHERE option_name = '$option'" );
 	if ( is_null($option) )
 		return false;
-	do_action( 'delete_option', $name );
+	do_action( 'delete_option', $option );
 	// expected_slashed ($name)
-	$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name = '$name'" );
+	$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name = '$option'" );
 	if ( 'yes' == $option->autoload ) {
 		$alloptions = wp_load_alloptions();
-		if ( isset( $alloptions[$name] ) ) {
-			unset( $alloptions[$name] );
+		if ( isset( $alloptions[$option] ) ) {
+			unset( $alloptions[$option] );
 			wp_cache_set( 'alloptions', $alloptions, 'options' );
 		}
 	} else {
-		wp_cache_delete( $name, 'options' );
+		wp_cache_delete( $option, 'options' );
 	}
-	do_action( 'deleted_option', $name );
+	do_action( "delete_option_{$option}", $option );
+	do_action( 'deleted_option', $option );
 	return true;
 }
 
@@ -655,14 +660,21 @@
  * @return bool true if successful, false otherwise
  */
 function delete_transient($transient) {
-	global $_wp_using_ext_object_cache, $wpdb;
+	global $_wp_using_ext_object_cache;
 
+	$_transient = $transient;
+	do_action( 'delete_transient', $transient );
 	if ( $_wp_using_ext_object_cache ) {
-		return wp_cache_delete($transient, 'transient');
+		$result = wp_cache_delete( $transient, 'transient' );
 	} else {
-		$transient = '_transient_' . esc_sql($transient);
-		return delete_option($transient);
+		$result = delete_option( '_transient_' . esc_sql( $transient ) );
 	}
+
+	if ( $result ) {
+		do_action( "delete_transient_{$transient}", $transient );
+		do_action( 'deleted_transient', $transient );
+	}
+	return $result;
 }
 
 /**
@@ -679,28 +691,29 @@
  * @return mixed Value of transient
  */
 function get_transient($transient) {
-	global $_wp_using_ext_object_cache, $wpdb;
+	global $_wp_using_ext_object_cache;
 
-	$pre = apply_filters( 'pre_transient_' . $transient, false );
-	if ( false !== $pre )
+	$pre = apply_filters( 'pre_transient_' . $transient, null );
+	if ( null !== $pre )
 		return $pre;
 
 	if ( $_wp_using_ext_object_cache ) {
 		$value = wp_cache_get($transient, 'transient');
 	} else {
-		$transient_option = '_transient_' . esc_sql($transient);
+		$safe_transient = esc_sql( $transient );
+		$transient_option = '_transient_' . $safe_transient;
 		// If option is not in alloptions, it is not autoloaded and thus has a timeout
 		$alloptions = wp_load_alloptions();
 		if ( !isset( $alloptions[$transient_option] ) ) {
-			$transient_timeout = '_transient_timeout_' . esc_sql($transient);
-			if ( get_option($transient_timeout) < time() ) {
-				delete_option($transient_option);
-				delete_option($transient_timeout);
+			$transient_timeout = '_transient_timeout_' . $safe_transient;
+			if ( get_option( $transient_timeout ) < time() ) {
+				delete_option( $transient_option  );
+				delete_option( $transient_timeout );
 				return false;
 			}
 		}
 
-		$value = get_option($transient_option);
+		$value = get_option( $transient_option );
 	}
 
 	return apply_filters('transient_' . $transient, $value);
@@ -715,6 +728,10 @@
  * @since 2.8.0
  * @package WordPress
  * @subpackage Transient
+ * @uses apply_filters() Calls 'pre_set_transient_$transient' null to allow overwriting
+ *		the transient value in a plugin.
+ * @uses apply_filters() Calls 'pre_set_transient_expiration_$transient' null to allow overwriting
+ *		the transient expiration in a plugin.
  *
  * @param string $transient Transient name. Expected to not be SQL-escaped
  * @param mixed $value Transient value.
@@ -722,10 +739,14 @@
  * @return bool False if value was not set and true if value was set.
  */
 function set_transient($transient, $value, $expiration = 0) {
-	global $_wp_using_ext_object_cache, $wpdb;
+	global $_wp_using_ext_object_cache;
 
+	$value = apply_filters( 'pre_set_transient_' . $transient, $value, $expiration );
+	$expiration = apply_filters( 'pre_set_transient_expiration_' . $transient, $expiration, $value );
+
+	do_action( 'set_transient', $transient, $value, $expiration );
 	if ( $_wp_using_ext_object_cache ) {
-		return wp_cache_set($transient, $value, 'transient', $expiration);
+		$result = wp_cache_set($transient, $value, 'transient', $expiration);
 	} else {
 		$transient_timeout = '_transient_timeout_' . $transient;
 		$transient = '_transient_' . $transient;
@@ -734,15 +755,20 @@
 			$autoload = 'yes';
 			if ( 0 != $expiration ) {
 				$autoload = 'no';
-				add_option($transient_timeout, time() + $expiration, '', 'no');
+				add_option( $transient_timeout, time() + $expiration, '', 'no' );
 			}
-			return add_option($transient, $value, '', $autoload);
+			$result = add_option( $transient, $value, '', $autoload );
 		} else {
 			if ( 0 != $expiration )
-				update_option($transient_timeout, time() + $expiration);
-			return update_option($transient, $value);
+				update_option( $transient_timeout, time() + $expiration );
+			$result = update_option( $transient, $value );
 		}
 	}
+	if ( $result ) {
+		do_action( "set_transient_{$transient}", $transient, $value, $expiration );
+		do_action( 'setted_transient', $transient, $value, $expiration );
+	}
+	return $result;
 }
 
 /**
@@ -3176,44 +3202,118 @@
 	return $current_suspend;
 }
 
-function get_site_option( $key, $default = false, $use_cache = true ) {
+/**
+ * Retrieve site option value based on option name.
+ *
+ * @see get_option()
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.8.0
+ * @uses apply_filters() Calls 'pre_site_option_$option' null to allow overwriting
+ *		the option value in a plugin.
+ * @uses apply_filters() Calls 'site_option_$option' with the option name value.
+ *
+ * @param string $option Name of option to retrieve. Should already be SQL-escaped
+ * @param mixed $default Optional value to return if option doesn't exist
+ * @param use_cache Used only in WordPress MU.
+ * @return mixed Value set for the option.
+ */
+function get_site_option( $option, $default = false, $use_cache = true ) {
 	// Allow plugins to short-circuit site options.
- 	$pre = apply_filters( 'pre_site_option_' . $key, false );
- 	if ( false !== $pre )
+ 	$pre = apply_filters( 'pre_site_option_' . $option, null );
+ 	if ( null !== $pre )
  		return $pre;
 
- 	$value = get_option($key, $default);
+ 	$value = get_option( $option, $default ) ;
 
- 	return apply_filters( 'site_option_' . $key, $value );
+ 	return apply_filters( 'site_option_' . $option, $value );
 }
 
-// expects $key, $value not to be SQL escaped
-function add_site_option( $key, $value ) {
-	$value = apply_filters( 'pre_add_site_option_' . $key, $value );
-	$result =  add_option($key, $value);
-	do_action( "add_site_option_{$key}", $key, $value );
+/**
+ * Add a new site option.
+ *
+ * @see add_option()
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.8.0
+ * @link http://alex.vort-x.net/blog/ Thanks Alex Stapleton
+ * @uses apply_filters() Calls 'pre_add_option_$option' to allow overwriting
+ *   the option value in a plugin.
+ *
+ * @param string $option Name of option to add. Expects to not be SQL escaped.
+ * @param mixed $value Optional. Option value, can be anything.
+ * @return bool False if option was not added and true if option was added.
+ */
+function add_site_option( $option, $value ) {
+	$value = apply_filters( 'pre_add_site_option_' . $option, $value );
+	do_action( 'add_site_option', $option, $value );
+	$result = add_option( $option, $value );
+	if ( $result ) {
+		do_action( "add_site_option_{$option}", $option, $value );
+		do_action( 'added_site_option', $option, $value );
+	}
 	return $result;
 }
 
-function delete_site_option( $key ) {
-	$result = delete_option($key);
-	do_action( "delete_site_option_{$key}", $key );
+/**
+ * Removes site option by name.
+ *
+ * @see delete_option()
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.8.0
+ *
+ * @param string $option Name of option to remove. Expected to be SQL-escaped.
+ * @return bool True, if succeed. False, if failure.
+ */
+function delete_site_option( $option ) {
+	do_action( 'delete_site_option', $option );
+	$result = delete_option( $option );
+	if ( $result ) {
+		do_action( "delete_site_option_{$option}", $option );
+		do_action( 'deleted_site_option', $option );
+	}
 	return $result;
 }
 
-// expects $key, $value not to be SQL escaped
-function update_site_option( $key, $value ) {
-	$oldvalue = get_site_option( $key );
-	$value = apply_filters( 'pre_update_site_option_' . $key, $value, $oldvalue );
-	$result = update_option($key, $value);
-	do_action( "update_site_option_{$key}", $key, $value );
+/**
+ * Update the value of a site option that was already added.
+ *
+ * @see update_option()
+ * @since 2.8.0
+ * @package WordPress
+ * @subpackage Option
+ * @uses apply_filters() calls 'pre_update_site_option_$option' to allow overwriting
+ *   the option value in a plugin.
+ *
+ * @param string $option Option name. Expected to not be SQL-escaped
+ * @param mixed $value Option value.
+ * @return bool False if value was not updated and true if value was updated.
+ */
+function update_site_option( $option, $value ) {
+	$old_value = get_site_option( $option );
+	$new_value = apply_filters( 'pre_update_site_option_' . $option, $value, $old_value );
+
+	if ( $new_value === $old_value )
+		return false;
+
+	if ( false === $old_value )
+		return add_site_option( $option, $new_value );
+
+	do_action( 'update_site_option', $option, $old_value, $new_value );
+	$result = update_option( $option, $new_value );
+	if ( $result ) {
+		do_action( "update_site_option_{$option}", $option, $old_value, $new_value );
+		do_action( 'updated_site_option', $option, $old_value, $new_value );
+	}
 	return $result;
 }
 
 /**
  * Delete a site transient
  *
- * @since 2.890
+ * @see delete_transient()
+ * @since 2.9.0
  * @package WordPress
  * @subpackage Transient
  *
@@ -3221,14 +3321,20 @@
  * @return bool true if successful, false otherwise
  */
 function delete_site_transient($transient) {
-	global $_wp_using_ext_object_cache, $wpdb;
+	global $_wp_using_ext_object_cache;
 
+	do_action( 'delete_site_transient', $transient );
 	if ( $_wp_using_ext_object_cache ) {
-		return wp_cache_delete($transient, 'site-transient');
+		$result = wp_cache_delete( $transient, 'site-transient' );
 	} else {
-		$transient = '_site_transient_' . esc_sql($transient);
-		return delete_site_option($transient);
+		$result = delete_site_option( '_site_transient_' . esc_sql( $transient ) );
 	}
+
+	if ( $result ) {
+		do_action( "delete_site_transient_{$transient}", $transient );
+		do_action( 'deleted_site_transient', $transient );
+	}
+	return $result;
 }
 
 /**
@@ -3237,35 +3343,39 @@
  * If the transient does not exist or does not have a value, then the return value
  * will be false.
  * 
+ * @see get_transient()
  * @since 2.9.0
  * @package WordPress
  * @subpackage Transient
+ * @uses apply_filters() calls 'pre_site_transient_$transient' and 'site_transient_$transient'
+     to allow overwriting the transient value in a plugin.
  *
  * @param string $transient Transient name. Expected to not be SQL-escaped
  * @return mixed Value of transient
  */
 function get_site_transient($transient) {
-	global $_wp_using_ext_object_cache, $wpdb;
+	global $_wp_using_ext_object_cache;
 
-	$pre = apply_filters( 'pre_site_transient_' . $transient, false );
-	if ( false !== $pre )
+	$pre = apply_filters( 'pre_site_transient_' . $transient, null );
+	if ( null !== $pre )
 		return $pre;
 
 	if ( $_wp_using_ext_object_cache ) {
-		$value = wp_cache_get($transient, 'site-transient');
+		$value = wp_cache_get( $transient, 'site-transient' );
 	} else {
-		$transient_option = '_site_transient_' . esc_sql($transient);
-		$transient_timeout = '_site_transient_timeout_' . esc_sql($transient);
-		if ( get_site_option($transient_timeout) < time() ) {
-			delete_site_option($transient_option);
-			delete_site_option($transient_timeout);
+		$safe_transient = esc_sql( $transient );
+		$transient_option = '_site_transient_' . $safe_transient;
+		$transient_timeout = '_site_transient_timeout_' . $safe_transient;
+		if ( get_site_option( $transient_timeout ) < time() ) {
+			delete_site_option( $transient_option  );
+			delete_site_option( $transient_timeout );
 			return false;
 		}
 
-		$value = get_site_option($transient_option);
+		$value = get_site_option( $transient_option );
 	}
 
-	return apply_filters('site_transient_' . $transient, $value);
+	return apply_filters( 'site_transient_' . $transient, $value );
 }
 
 /**
@@ -3274,9 +3384,14 @@
  * You do not need to serialize values, if the value needs to be serialize, then
  * it will be serialized before it is set.
  *
+ * @see set_transient()
  * @since 2.9.0
  * @package WordPress
  * @subpackage Transient
+ * @uses apply_filters() Calls 'pre_set_site_transient_$transient' null to allow overwriting
+ *		the transient value in a plugin.
+ * @uses apply_filters() Calls 'pre_set_site_transient_expiration_$transient' null to allow overwriting
+ *		the transient expiration in a plugin.
  *
  * @param string $transient Transient name. Expected to not be SQL-escaped
  * @param mixed $value Transient value.
@@ -3284,24 +3399,33 @@
  * @return bool False if value was not set and true if value was set.
  */
 function set_site_transient($transient, $value, $expiration = 0) {
-	global $_wp_using_ext_object_cache, $wpdb;
+	global $_wp_using_ext_object_cache;
 
+	$value = apply_filters( 'pre_set_site_transient_' . $transient, $value, $expiration );
+	$expiration = apply_filters( 'pre_set_site_transient_expiration_' . $transient, $expiration, $value );
+
+	do_action( 'set_site_transient', $transient, $value, $expiration );
 	if ( $_wp_using_ext_object_cache ) {
-		return wp_cache_set($transient, $value, 'site-transient', $expiration);
+		$result = wp_cache_set($transient, $value, 'site-transient', $expiration);
 	} else {
 		$transient_timeout = '_site_transient_timeout_' . $transient;
 		$transient = '_site_transient_' . $transient;
 		$safe_transient = esc_sql($transient);
 		if ( false === get_site_option( $safe_transient ) ) {
 			if ( 0 != $expiration )
-				add_site_option($transient_timeout, time() + $expiration);
-			return add_site_option($transient, $value);
+				add_site_option( $transient_timeout, time() + $expiration );
+			$result = add_site_option($transient, $value);
 		} else {
 			if ( 0 != $expiration )
-				update_site_option($transient_timeout, time() + $expiration);
-			return update_site_option($transient, $value);
+				update_site_option( $transient_timeout, time() + $expiration );
+			$result = update_site_option( $transient, $value );
 		}
 	}
+	if ( $result ) {
+		do_action( "set_site_transient_{$transient}", $transient, $value, $expiration );
+		do_action( 'setted_site_transient', $transient, $value, $expiration );
+	}
+	return $result;
 }
 
 /**
@@ -3593,4 +3717,4 @@
 function _search_terms_tidy($t) {
 	return trim($t, "\"\'\n\r ");
 }
-?>
+?>
\ No newline at end of file
