WordPress.org

Make WordPress Core

Changeset 11995


Ignore:
Timestamp:
10/03/2009 09:40:27 PM (12 years ago)
Author:
westi
Message:

Make the (add|get|update)_site_option functions run the same filters in WP as they do in mu. Fixes #10893.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r11978 r11995  
    31593159
    31603160function get_site_option( $key, $default = false, $use_cache = true ) {
    3161     return get_option($key, $default);
     3161    // Allow plugins to short-circuit site options.
     3162    $pre = apply_filters( 'pre_site_option_' . $key, false );
     3163    if ( false !== $pre )
     3164        return $pre;
     3165 
     3166    $value = get_option($key, $default);
     3167 
     3168    return apply_filters( 'site_option_' . $key, $value );
    31623169}
    31633170
    31643171// expects $key, $value not to be SQL escaped
    31653172function add_site_option( $key, $value ) {
    3166     return add_option($key, $value);
     3173    $value = apply_filters( 'pre_add_site_option_' . $key, $value );
     3174    $result =  add_option($key, $value);
     3175    do_action( "add_site_option_{$key}", $key, $value );
     3176    return $result;
    31673177}
    31683178
    31693179// expects $key, $value not to be SQL escaped
    31703180function update_site_option( $key, $value ) {
    3171     return update_option($key, $value);
     3181    $oldvalue = get_site_option( $key );
     3182    $value = apply_filters( 'pre_update_site_option_' . $key, $value, $oldvalue );
     3183    $result = update_option($key, $value);
     3184    do_action( "update_site_option_{$key}", $key, $value );
     3185    return $result;
    31723186}
    31733187
Note: See TracChangeset for help on using the changeset viewer.