allow for very-granular default settings so that updates can make use of default values

isekai
Jonathan Daggerhart 9 years ago
parent ada93ba4f3
commit 43a5d7110e

@ -16,11 +16,16 @@ class WP_Option_Settings {
/** /**
* @param $option_name * @param $option_name
* @param array $default_settings * @param array $default_settings
* @param bool|TRUE $granular_defaults
*/ */
function __construct( $option_name, $default_settings = array() ){ function __construct( $option_name, $default_settings = array(), $granular_defaults = true ){
$this->option_name = $option_name; $this->option_name = $option_name;
$this->default_settings = $default_settings; $this->default_settings = $default_settings;
$this->values = get_option( $this->option_name, $this->default_settings ); $this->values = get_option( $this->option_name, $this->default_settings );
if ( $granular_defaults ) {
$this->values = array_replace_recursive( $this->default_settings, $this->values );
}
} }
function __get( $key ){ function __get( $key ){

Loading…
Cancel
Save