|
@@ 703-717 (lines=15) @@
|
| 700 |
|
* @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped. |
| 701 |
|
* @return bool False if option was not added and true if option was added. |
| 702 |
|
*/ |
| 703 |
|
function add_blog_option( $id, $option, $value ) { |
| 704 |
|
$id = (int) $id; |
| 705 |
|
|
| 706 |
|
if ( empty( $id ) ) |
| 707 |
|
$id = get_current_blog_id(); |
| 708 |
|
|
| 709 |
|
if ( get_current_blog_id() == $id ) |
| 710 |
|
return add_option( $option, $value ); |
| 711 |
|
|
| 712 |
|
switch_to_blog( $id ); |
| 713 |
|
$return = add_option( $option, $value ); |
| 714 |
|
restore_current_blog(); |
| 715 |
|
|
| 716 |
|
return $return; |
| 717 |
|
} |
| 718 |
|
|
| 719 |
|
/** |
| 720 |
|
* Removes option by name for a given blog id. Prevents removal of protected WordPress options. |
|
@@ 728-742 (lines=15) @@
|
| 725 |
|
* @param string $option Name of option to remove. Expected to not be SQL-escaped. |
| 726 |
|
* @return bool True, if option is successfully deleted. False on failure. |
| 727 |
|
*/ |
| 728 |
|
function delete_blog_option( $id, $option ) { |
| 729 |
|
$id = (int) $id; |
| 730 |
|
|
| 731 |
|
if ( empty( $id ) ) |
| 732 |
|
$id = get_current_blog_id(); |
| 733 |
|
|
| 734 |
|
if ( get_current_blog_id() == $id ) |
| 735 |
|
return delete_option( $option ); |
| 736 |
|
|
| 737 |
|
switch_to_blog( $id ); |
| 738 |
|
$return = delete_option( $option ); |
| 739 |
|
restore_current_blog(); |
| 740 |
|
|
| 741 |
|
return $return; |
| 742 |
|
} |
| 743 |
|
|
| 744 |
|
/** |
| 745 |
|
* Update an option for a particular blog. |