Skip to:
Content

BuddyPress.org

Changeset 5724


Ignore:
Timestamp:
02/11/2012 08:45:05 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Move _option functions into bp-core-options.php

Location:
trunk/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r5723 r5724  
    5656
    5757/** Functions *****************************************************************/
    58 
    59 /**
    60  * Retrieve an option
    61  *
    62  * This is a wrapper for get_blog_option(), which in turn stores settings data (such as bp-pages)
    63  * on the appropriate blog, given your current setup.
    64  *
    65  * The 'bp_get_option' filter is primarily for backward-compatibility.
    66  *
    67  * @package BuddyPress
    68  * @since 1.5
    69  *
    70  * @uses bp_get_root_blog_id()
    71  * @param str $option_name The option to be retrieved
    72  * @param str $default Optional. Default value to be returned if the option isn't set
    73  * @return mixed The value for the option
    74  */
    75 function bp_get_option( $option_name, $default = '' ) {
    76     $value = get_blog_option( bp_get_root_blog_id(), $option_name, $default );
    77 
    78     return apply_filters( 'bp_get_option', $value );
    79 }
    80 
    81 /**
    82  * Save an option
    83  *
    84  * This is a wrapper for update_blog_option(), which in turn stores settings data (such as bp-pages)
    85  * on the appropriate blog, given your current setup.
    86  *
    87  * @package BuddyPress
    88  * @since 1.5
    89  *
    90  * @uses bp_get_root_blog_id()
    91  * @param str $option_name The option key to be set
    92  * @param str $value The value to be set
    93  */
    94 function bp_update_option( $option_name, $value ) {
    95     update_blog_option( bp_get_root_blog_id(), $option_name, $value );
    96 }
    97 
    98 /**
    99  * Delete an option
    100  *
    101  * This is a wrapper for delete_blog_option(), which in turn deletes settings data (such as
    102  * bp-pages) on the appropriate blog, given your current setup.
    103  *
    104  * @package BuddyPress
    105  * @since 1.5
    106  *
    107  * @uses bp_get_root_blog_id()
    108  * @param str $option_name The option key to be set
    109  */
    110 function bp_delete_option( $option_name ) {
    111     delete_blog_option( bp_get_root_blog_id(), $option_name );
    112 }
    11358
    11459/**
  • trunk/bp-core/bp-core-options.php

    r5721 r5724  
    191191    // Always return a value, even if false
    192192    return $value;
     193}
     194
     195/**
     196 * Retrieve an option
     197 *
     198 * This is a wrapper for get_blog_option(), which in turn stores settings data (such as bp-pages)
     199 * on the appropriate blog, given your current setup.
     200 *
     201 * The 'bp_get_option' filter is primarily for backward-compatibility.
     202 *
     203 * @package BuddyPress
     204 * @since 1.5
     205 *
     206 * @uses bp_get_root_blog_id()
     207 * @param str $option_name The option to be retrieved
     208 * @param str $default Optional. Default value to be returned if the option isn't set
     209 * @return mixed The value for the option
     210 */
     211function bp_get_option( $option_name, $default = '' ) {
     212    $value = get_blog_option( bp_get_root_blog_id(), $option_name, $default );
     213
     214    return apply_filters( 'bp_get_option', $value );
     215}
     216
     217/**
     218 * Save an option
     219 *
     220 * This is a wrapper for update_blog_option(), which in turn stores settings data (such as bp-pages)
     221 * on the appropriate blog, given your current setup.
     222 *
     223 * @package BuddyPress
     224 * @since 1.5
     225 *
     226 * @uses bp_get_root_blog_id()
     227 * @param str $option_name The option key to be set
     228 * @param str $value The value to be set
     229 */
     230function bp_update_option( $option_name, $value ) {
     231    update_blog_option( bp_get_root_blog_id(), $option_name, $value );
     232}
     233
     234/**
     235 * Delete an option
     236 *
     237 * This is a wrapper for delete_blog_option(), which in turn deletes settings data (such as
     238 * bp-pages) on the appropriate blog, given your current setup.
     239 *
     240 * @package BuddyPress
     241 * @since 1.5
     242 *
     243 * @uses bp_get_root_blog_id()
     244 * @param str $option_name The option key to be set
     245 */
     246function bp_delete_option( $option_name ) {
     247    delete_blog_option( bp_get_root_blog_id(), $option_name );
    193248}
    194249
Note: See TracChangeset for help on using the changeset viewer.