@@ 672-686 (lines=15) @@ | ||
669 | * @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped. |
|
670 | * @return bool False if option was not added and true if option was added. |
|
671 | */ |
|
672 | function add_blog_option( $id, $option, $value ) { |
|
673 | $id = (int) $id; |
|
674 | ||
675 | if ( empty( $id ) ) |
|
676 | $id = get_current_blog_id(); |
|
677 | ||
678 | if ( get_current_blog_id() == $id ) |
|
679 | return add_option( $option, $value ); |
|
680 | ||
681 | switch_to_blog( $id ); |
|
682 | $return = add_option( $option, $value ); |
|
683 | restore_current_blog(); |
|
684 | ||
685 | return $return; |
|
686 | } |
|
687 | ||
688 | /** |
|
689 | * Removes option by name for a given blog id. Prevents removal of protected WordPress options. |
|
@@ 697-711 (lines=15) @@ | ||
694 | * @param string $option Name of option to remove. Expected to not be SQL-escaped. |
|
695 | * @return bool True, if option is successfully deleted. False on failure. |
|
696 | */ |
|
697 | function delete_blog_option( $id, $option ) { |
|
698 | $id = (int) $id; |
|
699 | ||
700 | if ( empty( $id ) ) |
|
701 | $id = get_current_blog_id(); |
|
702 | ||
703 | if ( get_current_blog_id() == $id ) |
|
704 | return delete_option( $option ); |
|
705 | ||
706 | switch_to_blog( $id ); |
|
707 | $return = delete_option( $option ); |
|
708 | restore_current_blog(); |
|
709 | ||
710 | return $return; |
|
711 | } |
|
712 | ||
713 | /** |
|
714 | * Update an option for a particular blog. |