Ejemplo n.º 1
0
/**
 * Save enabled betas
 *
 * @since       2.6.11
 * @return      void
 */
function edd_tools_enabled_betas_save()
{
    if (!wp_verify_nonce($_POST['edd_save_betas_nonce'], 'edd_save_betas_nonce')) {
        return;
    }
    if (!current_user_can('manage_shop_settings')) {
        return;
    }
    if (!empty($_POST['enabled_betas'])) {
        $enabled_betas = array_filter(array_map('edd_tools_enabled_betas_sanitize_value', $_POST['enabled_betas']));
        edd_update_option('enabled_betas', $enabled_betas);
    } else {
        edd_delete_option('enabled_betas');
    }
}
 public function gourl_init_settings()
 {
     global $edd_options;
     // Define user set variables
     $arr = array('gourl_title', 'gourl_emultiplier', 'gourl_deflang', 'gourl_defcoin', 'gourl_iconwidth');
     foreach ($arr as $v) {
         $k = str_replace('gourl_', '', $v);
         $this->{$k} = isset($edd_options[$v]) ? $edd_options[$v] : '';
     }
     $this->emultiplier = trim(str_replace(array("%", ","), array("", "."), $this->emultiplier));
     $this->iconwidth = trim(str_replace("px", "", $this->iconwidth));
     // Re-check
     if (!$this->title) {
         $this->title = __('GoUrl Bitcoin/Altcoins', GOURLEDD);
         edd_update_option('gourl_title', $this->title);
     }
     if (!isset($this->languages[$this->deflang])) {
         $this->deflang = 'en';
         edd_update_option('gourl_deflang', $this->deflang);
     }
     if (!$this->emultiplier || !is_numeric($this->emultiplier) || $this->emultiplier < 0.01) {
         $this->emultiplier = 1;
         edd_update_option('gourl_emultiplier', $this->emultiplier);
     }
     if (!is_numeric($this->iconwidth) || $this->iconwidth < 30 || $this->iconwidth > 250) {
         $this->iconwidth = 60;
         edd_update_option('gourl_iconwidth', $this->iconwidth);
     }
     if ($this->defcoin && $this->payments && !isset($this->payments[$this->defcoin])) {
         $this->defcoin = key($this->payments);
         edd_update_option('gourl_defcoin', $this->defcoin);
     } elseif (!$this->payments) {
         $this->defcoin = '';
         edd_update_option('gourl_defcoin', $this->defcoin);
     } elseif (!$this->defcoin) {
         $this->defcoin = key($this->payments);
         edd_update_option('gourl_defcoin', $this->defcoin);
     }
     return true;
 }