Esempio n. 1
0
/**
 * Version 1.5
 *
 * Update options with new sub-options.
 *
 * @since  1.5
 */
function dedo_upgrade_1_5()
{
    global $dedo_options, $dedo_notices;
    // Convert old durations to boolean values
    foreach (array('grace_period', 'auto_delete') as $key) {
        $dedo_options[$key] = $dedo_options[$key] > 0 ? 1 : 0;
    }
    // Handle cache name change
    $dedo_options['cache'] = $dedo_options['cache_duration'] > 0 ? 1 : 0;
    // Update options
    $new_options = wp_parse_args($dedo_options, dedo_get_default_options());
    update_option('delightful-downloads', $new_options);
    // Add upgrade notice
    $dedo_notices->add('updated', __('Delightful Downloads updated to version 1.5.', 'delightful-downloads'));
}
 /**
  * Setup plugin options.
  *
  * @since  1.3.2
  */
 private function setup_options()
 {
     global $dedo_options, $dedo_default_options;
     // Include options file.
     include_once DEDO_PLUGIN_DIR . 'includes/options.php';
     // Set globals
     $dedo_default_options = dedo_get_default_options();
     $dedo_options = wp_parse_args(get_option('delightful-downloads'), $dedo_default_options);
 }