Example #1
0
function config_Read()
{
    $config = get_option('postie-settings');
    return config_ValidateSettings($config);
}
Example #2
0
function activate_postie()
{
    static $init = false;
    $options = config_Read();
    if ($init) {
        return;
    }
    if (!$options) {
        $options = array();
    }
    $default_options = config_GetDefaults();
    $old_config = array();
    $result = config_GetOld();
    if (is_array($result)) {
        foreach ($result as $key => $val) {
            $old_config[strtolower($key)] = $val;
        }
    }
    // overlay the options on top of each other:
    // the current value of $options takes priority over the $old_config, which takes priority over the $default_options
    $options = array_merge($default_options, $old_config, $options);
    $options = config_ValidateSettings($options);
    update_option('postie-settings', $options);
    $init = true;
}