예제 #1
0
/**
 * Weekly Events
 *
 * @since  1.3
 */
function dedo_cron_weekly()
{
    // Run folder protection
    dedo_folder_protection();
}
 /**
  * Activate plugin
  *
  * @since  1.3.2
  */
 public function activate()
 {
     global $dedo_default_options, $dedo_statistics;
     // Install database table
     $dedo_statistics->setup_table();
     // Add version to database
     update_option('delightful-downloads-version', DEDO_VERSION);
     // Add default options to database
     update_option('delightful-downloads', $dedo_default_options);
     // Add option for admin notices
     update_option('delightful-downloads-notices', array());
     // Run folder protection
     dedo_folder_protection();
 }
예제 #3
0
/**
 * Validate settings callback
 *
 * @since  1.3
 */
function dedo_validate_settings($input)
{
    global $dedo_options, $dedo_default_options;
    // Registered options
    $options = dedo_get_options();
    // Ensure text fields are not blank
    foreach ($options as $key => $value) {
        if ('text' === $options[$key]['type'] && '' === trim($input[$key])) {
            $input[$key] = $dedo_default_options[$key];
        }
    }
    // Ensure download URL does not contain illegal characters
    $input['download_url'] = strtolower(preg_replace('/[^A-Za-z0-9_-]/', '', $input['download_url']));
    // Run folder protection if option changed
    if ($input['folder_protection'] != $dedo_options['folder_protection']) {
        dedo_folder_protection($input['folder_protection']);
    }
    // Clear transients
    dedo_delete_all_transients();
    return $input;
}