/**
 * Register Settings
 *
 * Registers the required settings.
 *
 * @access      private
 * @since       1.0 
 * @return      void
*/
function edd_register_settings()
{
    // setup some default option sets
    $pages = get_pages();
    $pages_options = array(0 => '');
    // blank option
    if ($pages) {
        foreach ($pages as $page) {
            $pages_options[$page->ID] = $page->post_title;
        }
    }
    /* white list our settings, each in their respective section
       filters can be used to add more options to each section */
    $edd_settings = array('general' => apply_filters('edd_settings_general', array(array('id' => 'test_mode', 'name' => __('Test Mode', 'edd'), 'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'edd'), 'type' => 'checkbox'), array('id' => 'purchase_page', 'name' => __('Checkout Page', 'edd'), 'desc' => __('This is the checkout page where buyers will complete their purchases', 'edd'), 'type' => 'select', 'options' => $pages_options), array('id' => 'success_page', 'name' => __('Success Page', 'edd'), 'desc' => __('This is the page buyers are sent to after completing their purchases', 'edd'), 'type' => 'select', 'options' => $pages_options), array('id' => 'show_links_on_success', 'name' => __('Download Links on Success Page', 'edd'), 'desc' => __('Show a list of all download links on the success page after completing a purchase?', 'edd'), 'type' => 'checkbox'), array('id' => 'currency_settings', 'name' => '<strong>' . __('Currency Settings', 'edd') . '</strong>', 'desc' => __('Configure the currency options', 'edd'), 'type' => 'header'), array('id' => 'currency', 'name' => __('Currency', 'edd'), 'desc' => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'edd'), 'type' => 'select', 'options' => edd_get_currencies()), array('id' => 'currency_position', 'name' => __('Currency Position', 'edd'), 'desc' => __('Choose the location of the currency sign.', 'edd'), 'type' => 'select', 'options' => array('before' => __('Before - $10', 'edd'), 'after' => __('After - 10$', 'edd'))), array('id' => 'thousands_separator', 'name' => __('Thousands Separator', 'edd'), 'desc' => __('The symbol (usually , or .) to separate thousands', 'edd'), 'type' => 'text', 'size' => 'small', 'std' => ','), array('id' => 'decimal_separator', 'name' => __('Decimal Separator', 'edd'), 'desc' => __('The symbol (usually , or .) to separate decimal points', 'edd'), 'type' => 'text', 'size' => 'small', 'std' => '.'))), 'gateways' => apply_filters('edd_settings_gateways', array(array('id' => 'gateways', 'name' => __('Payment Gateways', 'edd'), 'desc' => __('Choose the payment gateways you want to enable.', 'edd'), 'type' => 'gateways', 'options' => edd_get_payment_gateways()), array('id' => 'accepted_cards', 'name' => __('Accepted Payment Method Icons', 'edd'), 'desc' => __('Display icons for the selected payment methods', 'edd') . '<br/>' . __('You will also need to configure your gateway settings if you are accepting credit cards', 'edd'), 'type' => 'multicheck', 'options' => apply_filters('edd_accepted_payment_icons', array('mastercard' => 'Mastercard', 'visa' => 'Visa', 'americanexpress' => 'American Express', 'discover' => 'Discover', 'paypal' => 'PayPal'))), array('id' => 'paypal', 'name' => '<strong>' . __('PayPal Settings', 'edd') . '</strong>', 'desc' => __('Configure the PayPal settings', 'edd'), 'type' => 'header'), array('id' => 'paypal_email', 'name' => __('PayPal Email', 'edd'), 'desc' => __('Enter your PayPal account\'s email', 'edd'), 'type' => 'text', 'size' => 'regular'), array('id' => 'paypal_alternate_verification', 'name' => __('Alternate PayPal Purchase Verification', 'edd'), 'desc' => __('If payments are not getting marked as complete, then check this box. Note, this requires that buyers return to your site from PayPal.', 'edd'), 'type' => 'checkbox'), array('id' => 'disable_paypal_verification', 'name' => __('Disable PayPal IPN Verification', 'edd'), 'desc' => __('If payments are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying purchases.', 'edd'), 'type' => 'checkbox'))), 'emails' => apply_filters('edd_settings_emails', array(array('id' => 'email_template', 'name' => __('Email Template', 'edd'), 'desc' => __('Choose a template. Click "Save Changes" then "Preview Purchase Receipt" to see the new template.', 'edd'), 'type' => 'select', 'options' => edd_get_email_templates()), array('id' => 'email_settings', 'name' => '', 'desc' => '', 'type' => 'hook'), array('id' => 'from_name', 'name' => __('From Name', 'edd'), 'desc' => __('The name purchase receipts are said to come from. This should probably be your site or shop name.', 'edd'), 'type' => 'text'), array('id' => 'from_email', 'name' => __('From Email', 'edd'), 'desc' => __('Email to send purchase receipts from. This will act as the "from" and "reply-to" address.', 'edd'), 'type' => 'text'), array('id' => 'purchase_subject', 'name' => __('Purchase Email Subject', 'edd'), 'desc' => __('Enter the subject line for the purchase receipt email', 'edd'), 'type' => 'text'), array('id' => 'purchase_receipt', 'name' => __('Purchase Receipt', 'edd'), 'desc' => __('Enter the email that is sent to users after completing a successful purchase. HTML is accepted. Available template tags:', 'edd') . '<br/>' . '{download_list} - ' . __('A list of download URLs for each download purchased', 'edd') . '<br/>' . '{name} - ' . __('The buyer\'s name', 'edd') . '<br/>' . '{date} - ' . __('The date of the purchase', 'edd') . '<br/>' . '{price} - ' . __('The total price of the purchase', 'edd') . '<br/>' . '{receipt_id} - ' . __('The unique ID number for this purchase receipt', 'edd') . '<br/>' . '{payment_method} - ' . __('The method of payment used for this purchase', 'edd') . '<br/>' . '{sitename} - ' . __('Your site name', 'edd'), 'type' => 'rich_editor'))), 'styles' => apply_filters('edd_settings_styles', array(array('id' => 'disable_styles', 'name' => __('Disable Styles', 'edd'), 'desc' => __('Check this to disable all included styling', 'edd'), 'type' => 'checkbox'), array('id' => 'checkout_color', 'name' => __('Checkout Button Color', 'edd'), 'desc' => __('Choose the button color you want to use for the checkout buttons.', 'edd'), 'type' => 'select', 'options' => edd_get_button_colors()))), 'misc' => apply_filters('edd_settings_misc', array(array('id' => 'disable_ajax_cart', 'name' => __('Disable Ajax', 'edd'), 'desc' => __('Check this to disable AJAX for the shopping cart.', 'edd'), 'type' => 'checkbox'), array('id' => 'jquery_validation', 'name' => __('Enable jQuery Validation', 'edd'), 'desc' => __('Check this to enable jQuery validation on the checkout form.', 'edd'), 'type' => 'checkbox'), array('id' => 'logged_in_only', 'name' => __('Disable Guest Checkout', 'edd'), 'desc' => __('Require that users be logged-in to purchase files.', 'edd'), 'type' => 'checkbox'), array('id' => 'show_register_form', 'name' => __('Show Register / Login Form?', 'edd'), 'desc' => __('Display the registration and login forms on the checkout page for non-logged-in users.', 'edd'), 'type' => 'checkbox'), array('id' => 'download_link_expiration', 'name' => __('Download Link Expiration', 'edd'), 'desc' => __('How long should download links be valid for? Default is 24 hours from the time they are generated. Enter a time in hours.', 'edd'), 'type' => 'text', 'size' => 'small'), array('id' => 'disable_redownload', 'name' => __('Disable Redownload?', 'edd'), 'desc' => __('Check this if you do not want to allow users to redownload items from their purchase history.', 'edd'), 'type' => 'checkbox'), array('id' => 'terms', 'name' => '<strong>' . __('Terms of Agreement', 'edd') . '</strong>', 'desc' => '', 'type' => 'header'), array('id' => 'show_agree_to_terms', 'name' => __('Agree to Terms', 'edd'), 'desc' => __('Check this to show an agree to terms on the checkout that users must agree to before purchasing.', 'edd'), 'type' => 'checkbox'), array('id' => 'agree_label', 'name' => __('Agree to Terms Label', 'edd'), 'desc' => __('Label shown next to the agree to terms check box.', 'edd'), 'type' => 'text', 'size' => 'regular'), array('id' => 'agree_text', 'name' => __('Agreement Text', 'edd'), 'desc' => __('If Agree to Terms is checked, enter the agreement terms here.', 'edd'), 'type' => 'rich_editor'), array('id' => 'checkout_label', 'name' => __('Complete Purchase Text', 'edd'), 'desc' => __('The button label for completing a purchase.', 'edd'), 'type' => 'text'))));
    if (false == get_option('edd_settings_general')) {
        add_option('edd_settings_general');
    }
    if (false == get_option('edd_settings_gateways')) {
        add_option('edd_settings_gateways');
    }
    if (false == get_option('edd_settings_emails')) {
        add_option('edd_settings_emails');
    }
    if (false == get_option('edd_settings_styles')) {
        add_option('edd_settings_styles');
    }
    if (false == get_option('edd_settings_misc')) {
        add_option('edd_settings_misc');
    }
    add_settings_section('edd_settings_general', __('General Settings', 'edd'), 'edd_settings_general_description_callback', 'edd_settings_general');
    foreach ($edd_settings['general'] as $option) {
        add_settings_field('edd_settings_general[' . $option['id'] . ']', $option['name'], 'edd_' . $option['type'] . '_callback', 'edd_settings_general', 'edd_settings_general', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'general', 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    add_settings_section('edd_settings_gateways', __('Payment Gateway Settings', 'edd'), 'edd_settings_gateways_description_callback', 'edd_settings_gateways');
    foreach ($edd_settings['gateways'] as $option) {
        add_settings_field('edd_settings_gateways[' . $option['id'] . ']', $option['name'], 'edd_' . $option['type'] . '_callback', 'edd_settings_gateways', 'edd_settings_gateways', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'gateways', 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    add_settings_section('edd_settings_emails', __('Email Settings', 'edd'), 'edd_settings_emails_description_callback', 'edd_settings_emails');
    foreach ($edd_settings['emails'] as $option) {
        add_settings_field('edd_settings_emails[' . $option['id'] . ']', $option['name'], 'edd_' . $option['type'] . '_callback', 'edd_settings_emails', 'edd_settings_emails', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'emails', 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    add_settings_section('edd_settings_styles', __('Style Settings', 'edd'), 'edd_settings_styles_description_callback', 'edd_settings_styles');
    foreach ($edd_settings['styles'] as $option) {
        add_settings_field('edd_settings_styles[' . $option['id'] . ']', $option['name'], 'edd_' . $option['type'] . '_callback', 'edd_settings_styles', 'edd_settings_styles', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'styles', 'size' => isset($option['size']) ? $option['size'] : '', 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    add_settings_section('edd_settings_misc', __('Misc Settings', 'edd'), 'edd_settings_misc_description_callback', 'edd_settings_misc');
    foreach ($edd_settings['misc'] as $option) {
        add_settings_field('edd_settings_misc[' . $option['id'] . ']', $option['name'], 'edd_' . $option['type'] . '_callback', 'edd_settings_misc', 'edd_settings_misc', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'misc', 'size' => isset($option['size']) ? $option['size'] : '', 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    // creates our settings in the options table
    register_setting('edd_settings_general', 'edd_settings_general', 'edd_settings_sanitize');
    register_setting('edd_settings_gateways', 'edd_settings_gateways', 'edd_settings_sanitize');
    register_setting('edd_settings_emails', 'edd_settings_emails', 'edd_settings_sanitize');
    register_setting('edd_settings_styles', 'edd_settings_styles', 'edd_settings_sanitize');
    register_setting('edd_settings_misc', 'edd_settings_misc', 'edd_settings_sanitize');
}
Ejemplo n.º 2
0
/**
 * Retrieve the array of plugin settings
 *
 * @since 1.8
 * @return array
*/
function edd_get_registered_settings()
{
    /**
     * 'Whitelisted' EDD settings, filters are provided for each settings
     * section to allow extensions and other plugins to add their own settings
     */
    $edd_settings = array('general' => apply_filters('edd_settings_general', array('purchase_page' => array('id' => 'purchase_page', 'name' => __('Checkout Page', 'easy-digital-downloads'), 'desc' => __('This is the checkout page where buyers will complete their purchases. The [download_checkout] short code must be on this page.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_pages(), 'chosen' => true, 'placeholder' => __('Select a page', 'easy-digital-downloads')), 'success_page' => array('id' => 'success_page', 'name' => __('Success Page', 'easy-digital-downloads'), 'desc' => __('This is the page buyers are sent to after completing their purchases. The [edd_receipt] short code should be on this page.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_pages(), 'chosen' => true, 'placeholder' => __('Select a page', 'easy-digital-downloads')), 'failure_page' => array('id' => 'failure_page', 'name' => __('Failed Transaction Page', 'easy-digital-downloads'), 'desc' => __('This is the page buyers are sent to if their transaction is cancelled or fails', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_pages(), 'chosen' => true, 'placeholder' => __('Select a page', 'easy-digital-downloads')), 'purchase_history_page' => array('id' => 'purchase_history_page', 'name' => __('Purchase History Page', 'easy-digital-downloads'), 'desc' => __('This page shows a complete purchase history for the current user, including download links', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_pages(), 'chosen' => true, 'placeholder' => __('Select a page', 'easy-digital-downloads')), 'base_country' => array('id' => 'base_country', 'name' => __('Base Country', 'easy-digital-downloads'), 'desc' => __('Where does your store operate from?', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_country_list(), 'chosen' => true, 'placeholder' => __('Select a country', 'easy-digital-downloads')), 'base_state' => array('id' => 'base_state', 'name' => __('Base State / Province', 'easy-digital-downloads'), 'desc' => __('What state / province does your store operate from?', 'easy-digital-downloads'), 'type' => 'shop_states', 'chosen' => true, 'placeholder' => __('Select a state', 'easy-digital-downloads')), 'currency_settings' => array('id' => 'currency_settings', 'name' => '<strong>' . __('Currency Settings', 'easy-digital-downloads') . '</strong>', 'desc' => __('Configure the currency options', 'easy-digital-downloads'), 'type' => 'header'), 'currency' => array('id' => 'currency', 'name' => __('Currency', 'easy-digital-downloads'), 'desc' => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_currencies(), 'chosen' => true), 'currency_position' => array('id' => 'currency_position', 'name' => __('Currency Position', 'easy-digital-downloads'), 'desc' => __('Choose the location of the currency sign.', 'easy-digital-downloads'), 'type' => 'select', 'options' => array('before' => __('Before - $10', 'easy-digital-downloads'), 'after' => __('After - 10$', 'easy-digital-downloads'))), 'thousands_separator' => array('id' => 'thousands_separator', 'name' => __('Thousands Separator', 'easy-digital-downloads'), 'desc' => __('The symbol (usually , or .) to separate thousands', 'easy-digital-downloads'), 'type' => 'text', 'size' => 'small', 'std' => ','), 'decimal_separator' => array('id' => 'decimal_separator', 'name' => __('Decimal Separator', 'easy-digital-downloads'), 'desc' => __('The symbol (usually , or .) to separate decimal points', 'easy-digital-downloads'), 'type' => 'text', 'size' => 'small', 'std' => '.'), 'api_settings' => array('id' => 'api_settings', 'name' => '<strong>' . __('API Settings', 'easy-digital-downloads') . '</strong>', 'desc' => '', 'type' => 'header'), 'api_allow_user_keys' => array('id' => 'api_allow_user_keys', 'name' => __('Allow User Keys', 'easy-digital-downloads'), 'desc' => __('Check this box to allow all users to generate API keys. Users with the \'manage_shop_settings\' capability are always allowed to generate keys.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'tracking_settings' => array('id' => 'tracking_settings', 'name' => '<strong>' . __('Tracking Settings', 'easy-digital-downloads') . '</strong>', 'desc' => '', 'type' => 'header'), 'allow_tracking' => array('id' => 'allow_tracking', 'name' => __('Allow Usage Tracking?', 'easy-digital-downloads'), 'desc' => sprintf(__('Allow Easy Digital Downloads to anonymously track how this plugin is used and help us make the plugin better. Opt-in to tracking and our newsletter and immediately be emailed a 20&#37; discount to the EDD shop, valid towards the <a href="%s" target="_blank">purchase of extensions</a>. No sensitive data is tracked.', 'easy-digital-downloads'), 'https://easydigitaldownloads.com/extensions?utm_source=' . substr(md5(get_bloginfo('name')), 0, 10) . '&utm_medium=admin&utm_term=settings&utm_campaign=EDDUsageTracking'), 'type' => 'checkbox'), 'uninstall_on_delete' => array('id' => 'uninstall_on_delete', 'name' => __('Remove Data on Uninstall?', 'easy-digital-downloads'), 'desc' => __('Check this box if you would like EDD to completely remove all of its data when the plugin is deleted.', 'easy-digital-downloads'), 'type' => 'checkbox'))), 'gateways' => apply_filters('edd_settings_gateways', array('test_mode' => array('id' => 'test_mode', 'name' => __('Test Mode', 'easy-digital-downloads'), 'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'gateways' => array('id' => 'gateways', 'name' => __('Payment Gateways', 'easy-digital-downloads'), 'desc' => __('Choose the payment gateways you want to enable.', 'easy-digital-downloads'), 'type' => 'gateways', 'options' => edd_get_payment_gateways()), 'default_gateway' => array('id' => 'default_gateway', 'name' => __('Default Gateway', 'easy-digital-downloads'), 'desc' => __('This gateway will be loaded automatically with the checkout page.', 'easy-digital-downloads'), 'type' => 'gateway_select', 'options' => edd_get_payment_gateways()), 'accepted_cards' => array('id' => 'accepted_cards', 'name' => __('Accepted Payment Method Icons', 'easy-digital-downloads'), 'desc' => __('Display icons for the selected payment methods', 'easy-digital-downloads') . '<br/>' . __('You will also need to configure your gateway settings if you are accepting credit cards', 'easy-digital-downloads'), 'type' => 'payment_icons', 'options' => apply_filters('edd_accepted_payment_icons', array('mastercard' => 'Mastercard', 'visa' => 'Visa', 'americanexpress' => 'American Express', 'discover' => 'Discover', 'paypal' => 'PayPal'))), 'paypal' => array('id' => 'paypal', 'name' => '<strong>' . __('PayPal Settings', 'easy-digital-downloads') . '</strong>', 'desc' => __('Configure the PayPal settings', 'easy-digital-downloads'), 'type' => 'header'), 'paypal_email' => array('id' => 'paypal_email', 'name' => __('PayPal Email', 'easy-digital-downloads'), 'desc' => __('Enter your PayPal account\'s email', 'easy-digital-downloads'), 'type' => 'text', 'size' => 'regular'), 'paypal_page_style' => array('id' => 'paypal_page_style', 'name' => __('PayPal Page Style', 'easy-digital-downloads'), 'desc' => __('Enter the name of the page style to use, or leave blank for default', 'easy-digital-downloads'), 'type' => 'text', 'size' => 'regular'), 'disable_paypal_verification' => array('id' => 'disable_paypal_verification', 'name' => __('Disable PayPal IPN Verification', 'easy-digital-downloads'), 'desc' => __('If payments are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying purchases.', 'easy-digital-downloads'), 'type' => 'checkbox'))), 'emails' => apply_filters('edd_settings_emails', array('email_template' => array('id' => 'email_template', 'name' => __('Email Template', 'easy-digital-downloads'), 'desc' => __('Choose a template. Click "Save Changes" then "Preview Purchase Receipt" to see the new template.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_email_templates()), 'email_logo' => array('id' => 'email_logo', 'name' => __('Logo', 'easy-digital-downloads'), 'desc' => __('Upload or choose a logo to be displayed at the top of the purchase receipt emails. Displayed on HTML emails only.', 'easy-digital-downloads'), 'type' => 'upload'), 'email_settings' => array('id' => 'email_settings', 'name' => '', 'desc' => '', 'type' => 'hook'), 'from_name' => array('id' => 'from_name', 'name' => __('From Name', 'easy-digital-downloads'), 'desc' => __('The name purchase receipts are said to come from. This should probably be your site or shop name.', 'easy-digital-downloads'), 'type' => 'text', 'std' => get_bloginfo('name')), 'from_email' => array('id' => 'from_email', 'name' => __('From Email', 'easy-digital-downloads'), 'desc' => __('Email to send purchase receipts from. This will act as the "from" and "reply-to" address.', 'easy-digital-downloads'), 'type' => 'text', 'std' => get_bloginfo('admin_email')), 'purchase_subject' => array('id' => 'purchase_subject', 'name' => __('Purchase Email Subject', 'easy-digital-downloads'), 'desc' => __('Enter the subject line for the purchase receipt email', 'easy-digital-downloads'), 'type' => 'text', 'std' => __('Purchase Receipt', 'easy-digital-downloads')), 'purchase_heading' => array('id' => 'purchase_heading', 'name' => __('Purchase Email Heading', 'easy-digital-downloads'), 'desc' => __('Enter the heading for the purchase receipt email', 'easy-digital-downloads'), 'type' => 'text', 'std' => __('Purchase Receipt', 'easy-digital-downloads')), 'purchase_receipt' => array('id' => 'purchase_receipt', 'name' => __('Purchase Receipt', 'easy-digital-downloads'), 'desc' => __('Enter the text that is sent as purchase receipt email to users after completion of a successful purchase. HTML is accepted. Available template tags:', 'easy-digital-downloads') . '<br/>' . edd_get_emails_tags_list(), 'type' => 'rich_editor', 'std' => __("Dear", "easy-digital-downloads") . " {name},\n\n" . __("Thank you for your purchase. Please click on the link(s) below to download your files.", "easy-digital-downloads") . "\n\n{download_list}\n\n{sitename}"), 'sale_notification_header' => array('id' => 'sale_notification_header', 'name' => '<strong>' . __('New Sale Notifications', 'easy-digital-downloads') . '</strong>', 'desc' => __('Configure new sale notification emails', 'easy-digital-downloads'), 'type' => 'header'), 'sale_notification_subject' => array('id' => 'sale_notification_subject', 'name' => __('Sale Notification Subject', 'easy-digital-downloads'), 'desc' => __('Enter the subject line for the sale notification email', 'easy-digital-downloads'), 'type' => 'text', 'std' => 'New download purchase - Order #{payment_id}'), 'sale_notification' => array('id' => 'sale_notification', 'name' => __('Sale Notification', 'easy-digital-downloads'), 'desc' => __('Enter the text that is sent as sale notification email after completion of a purchase. HTML is accepted. Available template tags:', 'easy-digital-downloads') . '<br/>' . edd_get_emails_tags_list(), 'type' => 'rich_editor', 'std' => edd_get_default_sale_notification_email()), 'admin_notice_emails' => array('id' => 'admin_notice_emails', 'name' => __('Sale Notification Emails', 'easy-digital-downloads'), 'desc' => __('Enter the email address(es) that should receive a notification anytime a sale is made, one per line', 'easy-digital-downloads'), 'type' => 'textarea', 'std' => get_bloginfo('admin_email')), 'disable_admin_notices' => array('id' => 'disable_admin_notices', 'name' => __('Disable Admin Notifications', 'easy-digital-downloads'), 'desc' => __('Check this box if you do not want to receive emails when new sales are made.', 'easy-digital-downloads'), 'type' => 'checkbox'))), 'styles' => apply_filters('edd_settings_styles', array('disable_styles' => array('id' => 'disable_styles', 'name' => __('Disable Styles', 'easy-digital-downloads'), 'desc' => __('Check this to disable all included styling of buttons, checkout fields, and all other elements.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'button_header' => array('id' => 'button_header', 'name' => '<strong>' . __('Buttons', 'easy-digital-downloads') . '</strong>', 'desc' => __('Options for add to cart and purchase buttons', 'easy-digital-downloads'), 'type' => 'header'), 'button_style' => array('id' => 'button_style', 'name' => __('Default Button Style', 'easy-digital-downloads'), 'desc' => __('Choose the style you want to use for the buttons.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_button_styles()), 'checkout_color' => array('id' => 'checkout_color', 'name' => __('Default Button Color', 'easy-digital-downloads'), 'desc' => __('Choose the color you want to use for the buttons.', 'easy-digital-downloads'), 'type' => 'color_select', 'options' => edd_get_button_colors()))), 'taxes' => apply_filters('edd_settings_taxes', array('enable_taxes' => array('id' => 'enable_taxes', 'name' => __('Enable Taxes', 'easy-digital-downloads'), 'desc' => __('Check this to enable taxes on purchases.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'tax_rates' => array('id' => 'tax_rates', 'name' => '<strong>' . __('Tax Rates', 'easy-digital-downloads') . '</strong>', 'desc' => __('Enter tax rates for specific regions.', 'easy-digital-downloads'), 'type' => 'tax_rates'), 'tax_rate' => array('id' => 'tax_rate', 'name' => __('Fallback Tax Rate', 'easy-digital-downloads'), 'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'easy-digital-downloads'), 'type' => 'text', 'size' => 'small'), 'prices_include_tax' => array('id' => 'prices_include_tax', 'name' => __('Prices entered with tax', 'easy-digital-downloads'), 'desc' => __('This option affects how you enter prices.', 'easy-digital-downloads'), 'type' => 'radio', 'std' => 'no', 'options' => array('yes' => __('Yes, I will enter prices inclusive of tax', 'easy-digital-downloads'), 'no' => __('No, I will enter prices exclusive of tax', 'easy-digital-downloads'))), 'display_tax_rate' => array('id' => 'display_tax_rate', 'name' => __('Display Tax Rate on Prices', 'easy-digital-downloads'), 'desc' => __('Some countries require a notice when product prices include tax.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'checkout_include_tax' => array('id' => 'checkout_include_tax', 'name' => __('Display during checkout', 'easy-digital-downloads'), 'desc' => __('Should prices on the checkout page be shown with or without tax?', 'easy-digital-downloads'), 'type' => 'select', 'std' => 'no', 'options' => array('yes' => __('Including tax', 'easy-digital-downloads'), 'no' => __('Excluding tax', 'easy-digital-downloads'))))), 'extensions' => apply_filters('edd_settings_extensions', array()), 'licenses' => apply_filters('edd_settings_licenses', array()), 'misc' => apply_filters('edd_settings_misc', array('enable_ajax_cart' => array('id' => 'enable_ajax_cart', 'name' => __('Enable Ajax', 'easy-digital-downloads'), 'desc' => __('Check this to enable AJAX for the shopping cart.', 'easy-digital-downloads'), 'type' => 'checkbox', 'std' => '1'), 'redirect_on_add' => array('id' => 'redirect_on_add', 'name' => __('Redirect to Checkout', 'easy-digital-downloads'), 'desc' => __('Immediately redirect to checkout after adding an item to the cart?', 'easy-digital-downloads'), 'type' => 'checkbox'), 'enforce_ssl' => array('id' => 'enforce_ssl', 'name' => __('Enforce SSL on Checkout', 'easy-digital-downloads'), 'desc' => __('Check this to force users to be redirected to the secure checkout page. You must have an SSL certificate installed to use this option.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'logged_in_only' => array('id' => 'logged_in_only', 'name' => __('Disable Guest Checkout', 'easy-digital-downloads'), 'desc' => __('Require that users be logged-in to purchase files.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'show_register_form' => array('id' => 'show_register_form', 'name' => __('Show Register / Login Form?', 'easy-digital-downloads'), 'desc' => __('Display the registration and login forms on the checkout page for non-logged-in users.', 'easy-digital-downloads'), 'type' => 'select', 'std' => 'none', 'options' => array('both' => __('Registration and Login Forms', 'easy-digital-downloads'), 'registration' => __('Registration Form Only', 'easy-digital-downloads'), 'login' => __('Login Form Only', 'easy-digital-downloads'), 'none' => __('None', 'easy-digital-downloads'))), 'item_quantities' => array('id' => 'item_quantities', 'name' => __('Item Quantities', 'easy-digital-downloads'), 'desc' => __('Allow item quantities to be changed.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'allow_multiple_discounts' => array('id' => 'allow_multiple_discounts', 'name' => __('Multiple Discounts', 'easy-digital-downloads'), 'desc' => __('Allow customers to use multiple discounts on the same purchase?', 'easy-digital-downloads'), 'type' => 'checkbox'), 'enable_cart_saving' => array('id' => 'enable_cart_saving', 'name' => __('Enable Cart Saving', 'easy-digital-downloads'), 'desc' => __('Check this to enable cart saving on the checkout.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'field_downloads' => array('id' => 'field_downloads', 'name' => '<strong>' . __('File Downloads', 'easy-digital-downloads') . '</strong>', 'desc' => '', 'type' => 'header'), 'download_method' => array('id' => 'download_method', 'name' => __('Download Method', 'easy-digital-downloads'), 'desc' => sprintf(__('Select the file download method. Note, not all methods work on all servers.', 'easy-digital-downloads'), edd_get_label_singular()), 'type' => 'select', 'options' => array('direct' => __('Forced', 'easy-digital-downloads'), 'redirect' => __('Redirect', 'easy-digital-downloads'))), 'symlink_file_downloads' => array('id' => 'symlink_file_downloads', 'name' => __('Symlink File Downloads?', 'easy-digital-downloads'), 'desc' => __('Check this if you are delivering really large files or having problems with file downloads completing.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'file_download_limit' => array('id' => 'file_download_limit', 'name' => __('File Download Limit', 'easy-digital-downloads'), 'desc' => sprintf(__('The maximum number of times files can be downloaded for purchases. Can be overwritten for each %s.', 'easy-digital-downloads'), edd_get_label_singular()), 'type' => 'number', 'size' => 'small'), 'download_link_expiration' => array('id' => 'download_link_expiration', 'name' => __('Download Link Expiration', 'easy-digital-downloads'), 'desc' => __('How long should download links be valid for? Default is 24 hours from the time they are generated. Enter a time in hours.', 'easy-digital-downloads'), 'type' => 'number', 'size' => 'small', 'std' => '24', 'min' => '0'), 'disable_redownload' => array('id' => 'disable_redownload', 'name' => __('Disable Redownload?', 'easy-digital-downloads'), 'desc' => __('Check this if you do not want to allow users to redownload items from their purchase history.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'accounting_settings' => array('id' => 'accounting_settings', 'name' => '<strong>' . __('Accounting Settings', 'easy-digital-downloads') . '</strong>', 'desc' => '', 'type' => 'header'), 'enable_skus' => array('id' => 'enable_skus', 'name' => __('Enable SKU Entry', 'easy-digital-downloads'), 'desc' => __('Check this box to allow entry of product SKUs. SKUs will be shown on purchase receipt and exported purchase histories.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'enable_sequential' => array('id' => 'enable_sequential', 'name' => __('Sequential Order Numbers', 'easy-digital-downloads'), 'desc' => __('Check this box to enable sequential order numbers.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'sequential_start' => array('id' => 'sequential_start', 'name' => __('Sequential Starting Number', 'easy-digital-downloads'), 'desc' => __('The number that sequential order numbers should start at.', 'easy-digital-downloads'), 'type' => 'number', 'size' => 'small', 'std' => '1'), 'sequential_prefix' => array('id' => 'sequential_prefix', 'name' => __('Sequential Number Prefix', 'easy-digital-downloads'), 'desc' => __('A prefix to prepend to all sequential order numbers.', 'easy-digital-downloads'), 'type' => 'text'), 'sequential_postfix' => array('id' => 'sequential_postfix', 'name' => __('Sequential Number Postfix', 'easy-digital-downloads'), 'desc' => __('A postfix to append to all sequential order numbers.', 'easy-digital-downloads'), 'type' => 'text'), 'terms' => array('id' => 'terms', 'name' => '<strong>' . __('Terms of Agreement', 'easy-digital-downloads') . '</strong>', 'desc' => '', 'type' => 'header'), 'show_agree_to_terms' => array('id' => 'show_agree_to_terms', 'name' => __('Agree to Terms', 'easy-digital-downloads'), 'desc' => __('Check this to show an agree to terms on the checkout that users must agree to before purchasing.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'agree_label' => array('id' => 'agree_label', 'name' => __('Agree to Terms Label', 'easy-digital-downloads'), 'desc' => __('Label shown next to the agree to terms check box.', 'easy-digital-downloads'), 'type' => 'text', 'size' => 'regular'), 'agree_text' => array('id' => 'agree_text', 'name' => __('Agreement Text', 'easy-digital-downloads'), 'desc' => __('If Agree to Terms is checked, enter the agreement terms here.', 'easy-digital-downloads'), 'type' => 'rich_editor'), 'checkout_label' => array('id' => 'checkout_label', 'name' => __('Complete Purchase Text', 'easy-digital-downloads'), 'desc' => __('The button label for completing a purchase.', 'easy-digital-downloads'), 'type' => 'text', 'std' => __('Purchase', 'easy-digital-downloads')), 'add_to_cart_text' => array('id' => 'add_to_cart_text', 'name' => __('Add to Cart Text', 'easy-digital-downloads'), 'desc' => __('Text shown on the Add to Cart Buttons.', 'easy-digital-downloads'), 'type' => 'text', 'std' => __('Add to Cart', 'easy-digital-downloads')), 'buy_now_text' => array('id' => 'buy_now_text', 'name' => __('Buy Now Text', 'easy-digital-downloads'), 'desc' => __('Text shown on the Buy Now Buttons.', 'easy-digital-downloads'), 'type' => 'text', 'std' => __('Buy Now', 'easy-digital-downloads')))));
    return apply_filters('edd_registered_settings', $edd_settings);
}
/**
 * Registers all off the required EDD settings and provides hooks for extensions
 * to add their own settings to either the General, Gateways, Emails, Styles
 * or Misc Settings Pages
 *
 * @since 1.0
 * @return void
*/
function edd_register_settings()
{
    // Setup some default option sets
    $pages = get_pages();
    $pages_options = array(0 => '');
    // Blank option
    if ($pages) {
        foreach ($pages as $page) {
            $pages_options[$page->ID] = $page->post_title;
        }
    }
    /**
     * 'Whitelisted' EDD settings, filters are provided for each settings
     * section to allow extensions and other plugins to add their own settings
     */
    $edd_settings = array('general' => apply_filters('edd_settings_general', array('test_mode' => array('id' => 'test_mode', 'name' => __('Test Mode', 'edd'), 'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'edd'), 'type' => 'checkbox'), 'purchase_page' => array('id' => 'purchase_page', 'name' => __('Checkout Page', 'edd'), 'desc' => __('This is the checkout page where buyers will complete their purchases. The [download_checkout] short code must be on this page.', 'edd'), 'type' => 'select', 'options' => $pages_options), 'success_page' => array('id' => 'success_page', 'name' => __('Success Page', 'edd'), 'desc' => __('This is the page buyers are sent to after completing their purchases. The [edd_receipt] short code should be on this page.', 'edd'), 'type' => 'select', 'options' => $pages_options), 'failure_page' => array('id' => 'failure_page', 'name' => __('Failed Transaction Page', 'edd'), 'desc' => __('This is the page buyers are sent to if their transaction is cancelled or fails', 'edd'), 'type' => 'select', 'options' => $pages_options), 'currency_settings' => array('id' => 'currency_settings', 'name' => '<strong>' . __('Currency Settings', 'edd') . '</strong>', 'desc' => __('Configure the currency options', 'edd'), 'type' => 'header'), 'currency' => array('id' => 'currency', 'name' => __('Currency', 'edd'), 'desc' => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'edd'), 'type' => 'select', 'options' => edd_get_currencies()), 'currency_position' => array('id' => 'currency_position', 'name' => __('Currency Position', 'edd'), 'desc' => __('Choose the location of the currency sign.', 'edd'), 'type' => 'select', 'options' => array('before' => __('Before - $10', 'edd'), 'after' => __('After - 10$', 'edd'))), 'thousands_separator' => array('id' => 'thousands_separator', 'name' => __('Thousands Separator', 'edd'), 'desc' => __('The symbol (usually , or .) to separate thousands', 'edd'), 'type' => 'text', 'size' => 'small', 'std' => ','), 'decimal_separator' => array('id' => 'decimal_separator', 'name' => __('Decimal Separator', 'edd'), 'desc' => __('The symbol (usually , or .) to separate decimal points', 'edd'), 'type' => 'text', 'size' => 'small', 'std' => '.'), 'api_settings' => array('id' => 'api_settings', 'name' => '<strong>' . __('API Settings', 'edd') . '</strong>', 'desc' => '', 'type' => 'header'), 'api_allow_user_keys' => array('id' => 'api_allow_user_keys', 'name' => __('Allow User Keys', 'edd'), 'desc' => __('Check this box to allow all users to generate API keys. Users with the \'manage_shop_settings\' capability are always allowed to generate keys.', 'edd'), 'type' => 'checkbox'))), 'gateways' => apply_filters('edd_settings_gateways', array('gateways' => array('id' => 'gateways', 'name' => __('Payment Gateways', 'edd'), 'desc' => __('Choose the payment gateways you want to enable.', 'edd'), 'type' => 'gateways', 'options' => edd_get_payment_gateways()), 'default_gateway' => array('id' => 'default_gateway', 'name' => __('Default Gateway', 'edd'), 'desc' => __('This gateway will be loaded automatically with the checkout page.', 'edd'), 'type' => 'gateway_select', 'options' => edd_get_payment_gateways()), 'accepted_cards' => array('id' => 'accepted_cards', 'name' => __('Accepted Payment Method Icons', 'edd'), 'desc' => __('Display icons for the selected payment methods', 'edd') . '<br/>' . __('You will also need to configure your gateway settings if you are accepting credit cards', 'edd'), 'type' => 'multicheck', 'options' => apply_filters('edd_accepted_payment_icons', array('mastercard' => 'Mastercard', 'visa' => 'Visa', 'americanexpress' => 'American Express', 'discover' => 'Discover', 'paypal' => 'PayPal'))), 'paypal' => array('id' => 'paypal', 'name' => '<strong>' . __('PayPal Settings', 'edd') . '</strong>', 'desc' => __('Configure the PayPal settings', 'edd'), 'type' => 'header'), 'paypal_email' => array('id' => 'paypal_email', 'name' => __('PayPal Email', 'edd'), 'desc' => __('Enter your PayPal account\'s email', 'edd'), 'type' => 'text', 'size' => 'regular'), 'paypal_page_style' => array('id' => 'paypal_page_style', 'name' => __('PayPal Page Style', 'edd'), 'desc' => __('Enter the name of the page style to use, or leave blank for default', 'edd'), 'type' => 'text', 'size' => 'regular'), 'disable_paypal_verification' => array('id' => 'disable_paypal_verification', 'name' => __('Disable PayPal IPN Verification', 'edd'), 'desc' => __('If payments are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying purchases.', 'edd'), 'type' => 'checkbox'))), 'emails' => apply_filters('edd_settings_emails', array('email_template' => array('id' => 'email_template', 'name' => __('Email Template', 'edd'), 'desc' => __('Choose a template. Click "Save Changes" then "Preview Purchase Receipt" to see the new template.', 'edd'), 'type' => 'select', 'options' => edd_get_email_templates()), 'email_settings' => array('id' => 'email_settings', 'name' => '', 'desc' => '', 'type' => 'hook'), 'from_name' => array('id' => 'from_name', 'name' => __('From Name', 'edd'), 'desc' => __('The name purchase receipts are said to come from. This should probably be your site or shop name.', 'edd'), 'type' => 'text'), 'from_email' => array('id' => 'from_email', 'name' => __('From Email', 'edd'), 'desc' => __('Email to send purchase receipts from. This will act as the "from" and "reply-to" address.', 'edd'), 'type' => 'text'), 'purchase_subject' => array('id' => 'purchase_subject', 'name' => __('Purchase Email Subject', 'edd'), 'desc' => __('Enter the subject line for the purchase receipt email', 'edd'), 'type' => 'text'), 'purchase_receipt' => array('id' => 'purchase_receipt', 'name' => __('Purchase Receipt', 'edd'), 'desc' => __('Enter the email that is sent to users after completing a successful purchase. HTML is accepted. Available template tags:', 'edd') . '<br/>' . '{download_list} - ' . __('A list of download links for each download purchased', 'edd') . '<br/>' . '{file_urls} - ' . __('A plain-text list of download URLs for each download purchased', 'edd') . '<br/>' . '{name} - ' . __('The buyer\'s first name', 'edd') . '<br/>' . '{fullname} - ' . __('The buyer\'s full name, first and last', 'edd') . '<br/>' . '{username} - ' . __('The buyer\'s user name on the site, if they registered an account', 'edd') . '<br/>' . '{date} - ' . __('The date of the purchase', 'edd') . '<br/>' . '{subtotal} - ' . __('The price of the purchase before taxes', 'edd') . '<br/>' . '{tax} - ' . __('The taxed amount of the purchase', 'edd') . '<br/>' . '{price} - ' . __('The total price of the purchase', 'edd') . '<br/>' . '{payment_id} - ' . __('The unique ID number for this purchase', 'edd') . '<br/>' . '{receipt_id} - ' . __('The unique ID number for this purchase receipt', 'edd') . '<br/>' . '{payment_method} - ' . __('The method of payment used for this purchase', 'edd') . '<br/>' . '{sitename} - ' . __('Your site name', 'edd') . '<br/>' . '{receipt_link} - ' . __('Adds a link so users can view their receipt directly on your website if they are unable to view it in the browser correctly.', 'edd'), 'type' => 'rich_editor'), 'admin_notice_emails' => array('id' => 'admin_notice_emails', 'name' => __('Sale Notification Emails', 'edd'), 'desc' => __('Enter the email address(es) that should receive a notification anytime a sale is made, one per line', 'edd'), 'type' => 'textarea', 'std' => get_bloginfo('admin_email')), 'disable_admin_notices' => array('id' => 'disable_admin_notices', 'name' => __('Disable Admin Notifications', 'edd'), 'desc' => __('Check this box if you do not want to receive emails when no sales are made.', 'edd'), 'type' => 'checkbox'))), 'styles' => apply_filters('edd_settings_styles', array('disable_styles' => array('id' => 'disable_styles', 'name' => __('Disable Styles', 'edd'), 'desc' => __('Check this to disable all included styling of buttons, checkout fields, and all other elements.', 'edd'), 'type' => 'checkbox'), 'buton_header' => array('id' => 'buton_header', 'name' => '<strong>' . __('Buttons', 'edd') . '</strong>', 'desc' => __('Options for add to cart and purchase buttons', 'edd'), 'type' => 'header'), 'button_style' => array('id' => 'button_style', 'name' => __('Default Button Style', 'edd'), 'desc' => __('Choose the style you want to use for the buttons.', 'edd'), 'type' => 'select', 'options' => edd_get_button_styles()), 'checkout_color' => array('id' => 'checkout_color', 'name' => __('Default Button Color', 'edd'), 'desc' => __('Choose the color you want to use for the buttons.', 'edd'), 'type' => 'select', 'options' => edd_get_button_colors()))), 'taxes' => apply_filters('edd_settings_taxes', array('enable_taxes' => array('id' => 'enable_taxes', 'name' => __('Enable Taxes', 'edd'), 'desc' => __('Check this to enable taxes on purchases.', 'edd'), 'type' => 'checkbox', 'std' => 'no'), 'tax_rate' => array('id' => 'tax_rate', 'name' => __('Tax Rate', 'edd'), 'desc' => __('Enter a percentage, such as 6.5.', 'edd'), 'type' => 'text', 'size' => 'small'), 'prices_include_tax' => array('id' => 'prices_include_tax', 'name' => __('Prices entered with tax', 'edd'), 'desc' => __('This option affects how you enter prices.', 'edd'), 'type' => 'radio', 'std' => 'no', 'options' => array('yes' => __('Yes, I will enter prices inclusive of tax', 'edd'), 'no' => __('No, I will enter prices exclusive of tax', 'edd'))), 'tax_condition' => array('id' => 'tax_condition', 'name' => __('Apply Taxes to:', 'edd'), 'desc' => __('Who should have tax added to their purchases?', 'edd'), 'type' => 'radio', 'std' => 'all', 'options' => array('all' => __('Everyone', 'edd'), 'local' => __('Local residents only', 'edd'))), 'tax_location' => array('id' => 'tax_location', 'name' => __('Tax Opt-In', 'edd'), 'desc' => __('Customers will be given a checkbox to click if they reside in your local area. Please enter directions for them here. Customers <strong>must</strong> opt into this.', 'edd'), 'type' => 'text', 'size' => 'large'), 'checkout_include_tax' => array('id' => 'checkout_include_tax', 'name' => __('Display during checkout', 'edd'), 'desc' => __('Should prices on the checkout page be shown with or without tax?', 'edd'), 'type' => 'select', 'std' => 'no', 'options' => array('yes' => __('Including tax', 'edd'), 'no' => __('Excluding tax', 'edd'))), 'taxes_after_discounts' => array('id' => 'taxes_after_discounts', 'name' => __('Calculate Tax After Discounts?', 'edd'), 'desc' => __('Check this if you would like taxes calculated after discounts. By default taxes are calculated before discounts are applied.', 'edd'), 'std' => 'no', 'type' => 'checkbox'))), 'extensions' => apply_filters('edd_settings_extensions', array()), 'misc' => apply_filters('edd_settings_misc', array('disable_ajax_cart' => array('id' => 'disable_ajax_cart', 'name' => __('Disable Ajax', 'edd'), 'desc' => __('Check this to disable AJAX for the shopping cart.', 'edd'), 'type' => 'checkbox'), 'redirect_on_add' => array('id' => 'redirect_on_add', 'name' => __('Redirect to Checkout', 'edd'), 'desc' => __('Immediately redirect to checkout after adding an item to the cart?', 'edd'), 'type' => 'checkbox'), 'live_cc_validation' => array('id' => 'live_cc_validation', 'name' => __('Disable Live Credit Card Validation', 'edd'), 'desc' => __('Live credit card validation means that that card type and number will be validated as the customer enters the number.', 'edd'), 'type' => 'checkbox'), 'logged_in_only' => array('id' => 'logged_in_only', 'name' => __('Disable Guest Checkout', 'edd'), 'desc' => __('Require that users be logged-in to purchase files.', 'edd'), 'type' => 'checkbox'), 'show_register_form' => array('id' => 'show_register_form', 'name' => __('Show Register / Login Form?', 'edd'), 'desc' => __('Display the registration and login forms on the checkout page for non-logged-in users.', 'edd'), 'type' => 'checkbox'), 'field_downloads' => array('id' => 'field_downloads', 'name' => '<strong>' . __('File Downloads', 'edd') . '</strong>', 'desc' => '', 'type' => 'header'), 'download_method' => array('id' => 'download_method', 'name' => __('Download Method', 'edd'), 'desc' => sprintf(__('Select the file download method. Note, not all methods work on all servers.', 'edd'), edd_get_label_singular()), 'type' => 'select', 'options' => array('direct' => __('Direct', 'edd'), 'redirect' => __('Redirect', 'edd'))), 'symlink_file_downloads' => array('id' => 'symlink_file_downloads', 'name' => __('Symlink File Downloads?', 'edd'), 'desc' => __('Check this if you are delivering really large files or having problems with file downloads completing.', 'edd'), 'type' => 'checkbox'), 'file_download_limit' => array('id' => 'file_download_limit', 'name' => __('File Download Limit', 'edd'), 'desc' => sprintf(__('The maximum number of times files can be downloaded for purchases. Can be overwritten for each %s.', 'edd'), edd_get_label_singular()), 'type' => 'text', 'size' => 'small'), 'download_link_expiration' => array('id' => 'download_link_expiration', 'name' => __('Download Link Expiration', 'edd'), 'desc' => __('How long should download links be valid for? Default is 24 hours from the time they are generated. Enter a time in hours.', 'edd'), 'type' => 'text', 'size' => 'small'), 'disable_redownload' => array('id' => 'disable_redownload', 'name' => __('Disable Redownload?', 'edd'), 'desc' => __('Check this if you do not want to allow users to redownload items from their purchase history.', 'edd'), 'type' => 'checkbox'), 'accounting_settings' => array('id' => 'accounting_settings', 'name' => '<strong>' . __('Accounting Settings', 'edd') . '</strong>', 'desc' => '', 'type' => 'header'), 'enable_skus' => array('id' => 'enable_skus', 'name' => __('Enable SKU Entry', 'edd'), 'desc' => __('Check this box to allow entry of product SKUs. SKUs will be shown on purchase receipt and exported purchase histories.', 'edd'), 'type' => 'checkbox'), 'terms' => array('id' => 'terms', 'name' => '<strong>' . __('Terms of Agreement', 'edd') . '</strong>', 'desc' => '', 'type' => 'header'), 'show_agree_to_terms' => array('id' => 'show_agree_to_terms', 'name' => __('Agree to Terms', 'edd'), 'desc' => __('Check this to show an agree to terms on the checkout that users must agree to before purchasing.', 'edd'), 'type' => 'checkbox'), 'agree_label' => array('id' => 'agree_label', 'name' => __('Agree to Terms Label', 'edd'), 'desc' => __('Label shown next to the agree to terms check box.', 'edd'), 'type' => 'text', 'size' => 'regular'), 'agree_text' => array('id' => 'agree_text', 'name' => __('Agreement Text', 'edd'), 'desc' => __('If Agree to Terms is checked, enter the agreement terms here.', 'edd'), 'type' => 'rich_editor'), 'checkout_label' => array('id' => 'checkout_label', 'name' => __('Complete Purchase Text', 'edd'), 'desc' => __('The button label for completing a purchase.', 'edd'), 'type' => 'text'), 'add_to_cart_text' => array('id' => 'add_to_cart_text', 'name' => __('Add to Cart Text', 'edd'), 'desc' => __('Text shown on the Add to Cart Buttons', 'edd'), 'type' => 'text'))));
    if (false == get_option('edd_settings_general')) {
        add_option('edd_settings_general');
    }
    if (false == get_option('edd_settings_gateways')) {
        add_option('edd_settings_gateways');
    }
    if (false == get_option('edd_settings_emails')) {
        add_option('edd_settings_emails');
    }
    if (false == get_option('edd_settings_styles')) {
        add_option('edd_settings_styles');
    }
    if (false == get_option('edd_settings_taxes')) {
        add_option('edd_settings_taxes');
    }
    if (false == get_option('edd_settings_extensions')) {
        add_option('edd_settings_extensions');
    }
    if (false == get_option('edd_settings_misc')) {
        add_option('edd_settings_misc');
    }
    add_settings_section('edd_settings_general', __('General Settings', 'edd'), '__return_false', 'edd_settings_general');
    foreach ($edd_settings['general'] as $option) {
        add_settings_field('edd_settings_general[' . $option['id'] . ']', $option['name'], function_exists('edd_' . $option['type'] . '_callback') ? 'edd_' . $option['type'] . '_callback' : 'edd_missing_callback', 'edd_settings_general', 'edd_settings_general', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'general', 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    add_settings_section('edd_settings_gateways', __('Payment Gateway Settings', 'edd'), '__return_false', 'edd_settings_gateways');
    foreach ($edd_settings['gateways'] as $option) {
        add_settings_field('edd_settings_gateways[' . $option['id'] . ']', $option['name'], function_exists('edd_' . $option['type'] . '_callback') ? 'edd_' . $option['type'] . '_callback' : 'edd_missing_callback', 'edd_settings_gateways', 'edd_settings_gateways', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'gateways', 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    add_settings_section('edd_settings_emails', __('Email Settings', 'edd'), '__return_false', 'edd_settings_emails');
    foreach ($edd_settings['emails'] as $option) {
        add_settings_field('edd_settings_emails[' . $option['id'] . ']', $option['name'], function_exists('edd_' . $option['type'] . '_callback') ? 'edd_' . $option['type'] . '_callback' : 'edd_missing_callback', 'edd_settings_emails', 'edd_settings_emails', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'emails', 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    add_settings_section('edd_settings_styles', __('Style Settings', 'edd'), '__return_false', 'edd_settings_styles');
    foreach ($edd_settings['styles'] as $option) {
        add_settings_field('edd_settings_styles[' . $option['id'] . ']', $option['name'], function_exists('edd_' . $option['type'] . '_callback') ? 'edd_' . $option['type'] . '_callback' : 'edd_missing_callback', 'edd_settings_styles', 'edd_settings_styles', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'styles', 'size' => isset($option['size']) ? $option['size'] : '', 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    add_settings_section('edd_settings_taxes', __('Tax Settings', 'edd'), 'edd_settings_taxes_description_callback', 'edd_settings_taxes');
    foreach ($edd_settings['taxes'] as $option) {
        add_settings_field('edd_settings_taxes[' . $option['id'] . ']', $option['name'], 'edd_' . $option['type'] . '_callback', 'edd_settings_taxes', 'edd_settings_taxes', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'taxes', 'size' => isset($option['size']) ? $option['size'] : '', 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    add_settings_section('edd_settings_extensions', __('Extension Settings', 'edd'), '__return_false', 'edd_settings_extensions');
    foreach ($edd_settings['extensions'] as $option) {
        add_settings_field('edd_settings_extensions[' . $option['id'] . ']', $option['name'], function_exists('edd_' . $option['type'] . '_callback') ? 'edd_' . $option['type'] . '_callback' : 'edd_missing_callback', 'edd_settings_extensions', 'edd_settings_extensions', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'extensions', 'size' => isset($option['size']) ? $option['size'] : '', 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    add_settings_section('edd_settings_misc', __('Misc Settings', 'edd'), '__return_false', 'edd_settings_misc');
    foreach ($edd_settings['misc'] as $option) {
        add_settings_field('edd_settings_misc[' . $option['id'] . ']', $option['name'], function_exists('edd_' . $option['type'] . '_callback') ? 'edd_' . $option['type'] . '_callback' : 'edd_missing_callback', 'edd_settings_misc', 'edd_settings_misc', array('id' => $option['id'], 'desc' => $option['desc'], 'name' => $option['name'], 'section' => 'misc', 'size' => isset($option['size']) ? $option['size'] : '', 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
    }
    // Creates our settings in the options table
    register_setting('edd_settings_general', 'edd_settings_general', 'edd_settings_sanitize');
    register_setting('edd_settings_gateways', 'edd_settings_gateways', 'edd_settings_sanitize');
    register_setting('edd_settings_emails', 'edd_settings_emails', 'edd_settings_sanitize');
    register_setting('edd_settings_styles', 'edd_settings_styles', 'edd_settings_sanitize');
    register_setting('edd_settings_taxes', 'edd_settings_taxes', 'edd_settings_sanitize');
    register_setting('edd_settings_extensions', 'edd_settings_extensions', 'edd_settings_sanitize');
    register_setting('edd_settings_misc', 'edd_settings_misc', 'edd_settings_sanitize');
}
/**
 * Retrieve the array of plugin settings
 *
 * @since 1.8
 * @return array
*/
function edd_get_registered_settings()
{
    /**
     * 'Whitelisted' EDD settings, filters are provided for each settings
     * section to allow extensions and other plugins to add their own settings
     */
    $edd_settings = array('general' => apply_filters('edd_settings_general', array('main' => array('page_settings' => array('id' => 'page_settings', 'name' => '<h3>' . __('Page Settings', 'easy-digital-downloads') . '</h3>', 'desc' => '', 'type' => 'header', 'tooltip_title' => __('Page Settings', 'easy-digital-downloads'), 'tooltip_desc' => __('Easy Digital Downloads uses the pages below for handling the display of checkout, purchase confirmation, purchase history, and purchase failures. If pages are deleted or removed in some way, they can be recreated manually from the Pages menu. When re-creating the pages, enter the shortcode shown in the page content area.', 'easy-digital-downloads')), 'purchase_page' => array('id' => 'purchase_page', 'name' => __('Checkout Page', 'easy-digital-downloads'), 'desc' => __('This is the checkout page where buyers will complete their purchases. The [download_checkout] shortcode must be on this page.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_pages(), 'chosen' => true, 'placeholder' => __('Select a page', 'easy-digital-downloads')), 'success_page' => array('id' => 'success_page', 'name' => __('Success Page', 'easy-digital-downloads'), 'desc' => __('This is the page buyers are sent to after completing their purchases. The [edd_receipt] shortcode should be on this page.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_pages(), 'chosen' => true, 'placeholder' => __('Select a page', 'easy-digital-downloads')), 'failure_page' => array('id' => 'failure_page', 'name' => __('Failed Transaction Page', 'easy-digital-downloads'), 'desc' => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_pages(), 'chosen' => true, 'placeholder' => __('Select a page', 'easy-digital-downloads')), 'purchase_history_page' => array('id' => 'purchase_history_page', 'name' => __('Purchase History Page', 'easy-digital-downloads'), 'desc' => __('This page shows a complete purchase history for the current user, including download links. The [purchase_history] shortcode should be on this page.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_pages(), 'chosen' => true, 'placeholder' => __('Select a page', 'easy-digital-downloads')), 'login_redirect_page' => array('id' => 'login_redirect_page', 'name' => __('Login Redirect Page', 'easy-digital-downloads'), 'desc' => sprintf(__('This is the page where buyers will be redirected by default once they log in. The [edd_login redirect="%s"] shortcode with the redirect attribute can override this setting.', 'easy-digital-downloads'), trailingslashit(home_url())), 'type' => 'select', 'options' => edd_get_pages(), 'chosen' => true, 'placeholder' => __('Select a page', 'easy-digital-downloads')), 'locale_settings' => array('id' => 'locale_settings', 'name' => '<h3>' . __('Store Location', 'easy-digital-downloads') . '</h3>', 'desc' => '', 'type' => 'header', 'tooltip_title' => __('Store Location Settings', 'easy-digital-downloads'), 'tooltip_desc' => __('Easy Digital Downloads will use the following Country and State to pre-fill fields at checkout. This will also pre-calculate any taxes defined if the location below has taxes enabled.', 'easy-digital-downloads')), 'base_country' => array('id' => 'base_country', 'name' => __('Base Country', 'easy-digital-downloads'), 'desc' => __('Where does your store operate from?', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_country_list(), 'chosen' => true, 'placeholder' => __('Select a country', 'easy-digital-downloads')), 'base_state' => array('id' => 'base_state', 'name' => __('Base State / Province', 'easy-digital-downloads'), 'desc' => __('What state / province does your store operate from?', 'easy-digital-downloads'), 'type' => 'shop_states', 'chosen' => true, 'placeholder' => __('Select a state', 'easy-digital-downloads')), 'tracking_settings' => array('id' => 'tracking_settings', 'name' => '<h3>' . __('Tracking Settings', 'easy-digital-downloads') . '</h3>', 'desc' => '', 'type' => 'header'), 'allow_tracking' => array('id' => 'allow_tracking', 'name' => __('Allow Usage Tracking?', 'easy-digital-downloads'), 'desc' => sprintf(__('Allow Easy Digital Downloads to anonymously track how this plugin is used and help us make the plugin better. Opt-in to tracking and our newsletter and immediately be emailed a 20&#37; discount to the EDD shop, valid towards the <a href="%s" target="_blank">purchase of extensions</a>. No sensitive data is tracked.', 'easy-digital-downloads'), 'https://easydigitaldownloads.com/downloads/?utm_source=' . substr(md5(get_bloginfo('name')), 0, 10) . '&utm_medium=admin&utm_term=settings&utm_campaign=EDDUsageTracking'), 'type' => 'checkbox')), 'currency' => array('currency_settings' => array('id' => 'currency_settings', 'name' => '<h3>' . __('Currency Settings', 'easy-digital-downloads') . '</h3>', 'desc' => '', 'type' => 'header'), 'currency' => array('id' => 'currency', 'name' => __('Currency', 'easy-digital-downloads'), 'desc' => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_currencies(), 'chosen' => true), 'currency_position' => array('id' => 'currency_position', 'name' => __('Currency Position', 'easy-digital-downloads'), 'desc' => __('Choose the location of the currency sign.', 'easy-digital-downloads'), 'type' => 'select', 'options' => array('before' => __('Before - $10', 'easy-digital-downloads'), 'after' => __('After - 10$', 'easy-digital-downloads'))), 'thousands_separator' => array('id' => 'thousands_separator', 'name' => __('Thousands Separator', 'easy-digital-downloads'), 'desc' => __('The symbol (usually , or .) to separate thousands', 'easy-digital-downloads'), 'type' => 'text', 'size' => 'small', 'std' => ','), 'decimal_separator' => array('id' => 'decimal_separator', 'name' => __('Decimal Separator', 'easy-digital-downloads'), 'desc' => __('The symbol (usually , or .) to separate decimal points', 'easy-digital-downloads'), 'type' => 'text', 'size' => 'small', 'std' => '.')), 'api' => array('api_settings' => array('id' => 'api_settings', 'name' => '<h3>' . __('API Settings', 'easy-digital-downloads') . '</h3>', 'desc' => '', 'type' => 'header', 'tooltip_title' => __('API Settings', 'easy-digital-downloads'), 'tooltip_desc' => __('The Easy Digital Downloads REST API provides access to store data through our API endpoints. Enable this setting if you would like all user accounts to be able to generate their own API keys.', 'easy-digital-downloads')), 'api_allow_user_keys' => array('id' => 'api_allow_user_keys', 'name' => __('Allow User Keys', 'easy-digital-downloads'), 'desc' => __('Check this box to allow all users to generate API keys. Users with the \'manage_shop_settings\' capability are always allowed to generate keys.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'api_help' => array('id' => 'api_help', 'desc' => sprintf(__('Visit the <a href="%s" target="_blank">REST API documentation</a> for further information.', 'easy-digital-downloads'), 'http://docs.easydigitaldownloads.com/article/1131-edd-rest-api-introduction'), 'type' => 'descriptive_text')))), 'gateways' => apply_filters('edd_settings_gateways', array('main' => array('gateway_settings' => array('id' => 'api_header', 'name' => '<h3>' . __('Gateway Settings', 'easy-digital-downloads') . '</h3>', 'desc' => '', 'type' => 'header'), 'test_mode' => array('id' => 'test_mode', 'name' => __('Test Mode', 'easy-digital-downloads'), 'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'gateways' => array('id' => 'gateways', 'name' => __('Payment Gateways', 'easy-digital-downloads'), 'desc' => __('Choose the payment gateways you want to enable.', 'easy-digital-downloads'), 'type' => 'gateways', 'options' => edd_get_payment_gateways()), 'default_gateway' => array('id' => 'default_gateway', 'name' => __('Default Gateway', 'easy-digital-downloads'), 'desc' => __('This gateway will be loaded automatically with the checkout page.', 'easy-digital-downloads'), 'type' => 'gateway_select', 'options' => edd_get_payment_gateways()), 'accepted_cards' => array('id' => 'accepted_cards', 'name' => __('Accepted Payment Method Icons', 'easy-digital-downloads'), 'desc' => __('Display icons for the selected payment methods', 'easy-digital-downloads') . '<br/>' . __('You will also need to configure your gateway settings if you are accepting credit cards', 'easy-digital-downloads'), 'type' => 'payment_icons', 'options' => apply_filters('edd_accepted_payment_icons', array('mastercard' => 'Mastercard', 'visa' => 'Visa', 'americanexpress' => 'American Express', 'discover' => 'Discover', 'paypal' => 'PayPal')))))), 'emails' => apply_filters('edd_settings_emails', array('main' => array('email_settings_header' => array('id' => 'email_settings_header', 'name' => '<h3>' . __('Email Settings', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'email_template' => array('id' => 'email_template', 'name' => __('Email Template', 'easy-digital-downloads'), 'desc' => __('Choose a template. Click "Save Changes" then "Preview Purchase Receipt" to see the new template.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_email_templates()), 'email_logo' => array('id' => 'email_logo', 'name' => __('Logo', 'easy-digital-downloads'), 'desc' => __('Upload or choose a logo to be displayed at the top of the purchase receipt emails. Displayed on HTML emails only.', 'easy-digital-downloads'), 'type' => 'upload'), 'email_settings' => array('id' => 'email_settings', 'name' => '', 'desc' => '', 'type' => 'hook')), 'purchase_receipts' => array('purchase_receipt_settings' => array('id' => 'purchase_receipt_settings', 'name' => '<h3>' . __('Purchase Receipts', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'from_name' => array('id' => 'from_name', 'name' => __('From Name', 'easy-digital-downloads'), 'desc' => __('The name purchase receipts are said to come from. This should probably be your site or shop name.', 'easy-digital-downloads'), 'type' => 'text', 'std' => get_bloginfo('name')), 'from_email' => array('id' => 'from_email', 'name' => __('From Email', 'easy-digital-downloads'), 'desc' => __('Email to send purchase receipts from. This will act as the "from" and "reply-to" address.', 'easy-digital-downloads'), 'type' => 'text', 'std' => get_bloginfo('admin_email')), 'purchase_subject' => array('id' => 'purchase_subject', 'name' => __('Purchase Email Subject', 'easy-digital-downloads'), 'desc' => __('Enter the subject line for the purchase receipt email', 'easy-digital-downloads'), 'type' => 'text', 'std' => __('Purchase Receipt', 'easy-digital-downloads')), 'purchase_heading' => array('id' => 'purchase_heading', 'name' => __('Purchase Email Heading', 'easy-digital-downloads'), 'desc' => __('Enter the heading for the purchase receipt email', 'easy-digital-downloads'), 'type' => 'text', 'std' => __('Purchase Receipt', 'easy-digital-downloads')), 'purchase_receipt' => array('id' => 'purchase_receipt', 'name' => __('Purchase Receipt', 'easy-digital-downloads'), 'desc' => __('Enter the text that is sent as purchase receipt email to users after completion of a successful purchase. HTML is accepted. Available template tags:', 'easy-digital-downloads') . '<br/>' . edd_get_emails_tags_list(), 'type' => 'rich_editor', 'std' => __("Dear", "easy-digital-downloads") . " {name},\n\n" . __("Thank you for your purchase. Please click on the link(s) below to download your files.", "easy-digital-downloads") . "\n\n{download_list}\n\n{sitename}")), 'sale_notifications' => array('sale_notification_settings' => array('id' => 'sale_notification_settings', 'name' => '<h3>' . __('Sale Notifications', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'sale_notification_subject' => array('id' => 'sale_notification_subject', 'name' => __('Sale Notification Subject', 'easy-digital-downloads'), 'desc' => __('Enter the subject line for the sale notification email', 'easy-digital-downloads'), 'type' => 'text', 'std' => 'New download purchase - Order #{payment_id}'), 'sale_notification' => array('id' => 'sale_notification', 'name' => __('Sale Notification', 'easy-digital-downloads'), 'desc' => __('Enter the text that is sent as sale notification email after completion of a purchase. HTML is accepted. Available template tags:', 'easy-digital-downloads') . '<br/>' . edd_get_emails_tags_list(), 'type' => 'rich_editor', 'std' => edd_get_default_sale_notification_email()), 'admin_notice_emails' => array('id' => 'admin_notice_emails', 'name' => __('Sale Notification Emails', 'easy-digital-downloads'), 'desc' => __('Enter the email address(es) that should receive a notification anytime a sale is made, one per line', 'easy-digital-downloads'), 'type' => 'textarea', 'std' => get_bloginfo('admin_email')), 'disable_admin_notices' => array('id' => 'disable_admin_notices', 'name' => __('Disable Admin Notifications', 'easy-digital-downloads'), 'desc' => __('Check this box if you do not want to receive sales notification emails.', 'easy-digital-downloads'), 'type' => 'checkbox')))), 'styles' => apply_filters('edd_settings_styles', array('main' => array('style_settings' => array('id' => 'style_settings', 'name' => '<h3>' . __('Style Settings', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'disable_styles' => array('id' => 'disable_styles', 'name' => __('Disable Styles', 'easy-digital-downloads'), 'desc' => __('Check this to disable all included styling of buttons, checkout fields, and all other elements.', 'easy-digital-downloads'), 'type' => 'checkbox', 'tooltip_title' => __('Disabling Styles', 'easy-digital-downloads'), 'tooltip_desc' => __('If your theme has a complete custom CSS file for Easy Digital Downloads, you may wish to disable our default styles. This is not recommended unless your sure your theme has a complete custom CSS.', 'easy-digital-downloads')), 'button_header' => array('id' => 'button_header', 'name' => '<strong>' . __('Buttons', 'easy-digital-downloads') . '</strong>', 'desc' => __('Options for add to cart and purchase buttons', 'easy-digital-downloads'), 'type' => 'header'), 'button_style' => array('id' => 'button_style', 'name' => __('Default Button Style', 'easy-digital-downloads'), 'desc' => __('Choose the style you want to use for the buttons.', 'easy-digital-downloads'), 'type' => 'select', 'options' => edd_get_button_styles()), 'checkout_color' => array('id' => 'checkout_color', 'name' => __('Default Button Color', 'easy-digital-downloads'), 'desc' => __('Choose the color you want to use for the buttons.', 'easy-digital-downloads'), 'type' => 'color_select', 'options' => edd_get_button_colors())))), 'taxes' => apply_filters('edd_settings_taxes', array('main' => array('tax_settings' => array('id' => 'tax_settings', 'name' => '<h3>' . __('Tax Settings', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'tax_help' => array('id' => 'tax_help', 'name' => __('Need help?', 'easy-digital-downloads'), 'desc' => sprintf(__('Visit the <a href="%s" target="_blank">Tax setup documentation</a> for further information. If you need VAT support, there are options listed on the documentation page.', 'easy-digital-downloads'), 'http://docs.easydigitaldownloads.com/article/238-tax-settings'), 'type' => 'descriptive_text'), 'enable_taxes' => array('id' => 'enable_taxes', 'name' => __('Enable Taxes', 'easy-digital-downloads'), 'desc' => __('Check this to enable taxes on purchases.', 'easy-digital-downloads'), 'type' => 'checkbox', 'tooltip_title' => __('Enabling Taxes', 'easy-digital-downloads'), 'tooltip_desc' => __('With taxes enabled, Easy Digital Downloads will use the rules below to charge tax to customers. With taxes enabled, customers are required to input their address on checkout so that taxes can be properly calculated.', 'easy-digital-downloads')), 'tax_rates' => array('id' => 'tax_rates', 'name' => '<strong>' . __('Tax Rates', 'easy-digital-downloads') . '</strong>', 'desc' => __('Enter tax rates for specific regions.', 'easy-digital-downloads'), 'type' => 'tax_rates'), 'tax_rate' => array('id' => 'tax_rate', 'name' => __('Fallback Tax Rate', 'easy-digital-downloads'), 'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'easy-digital-downloads'), 'type' => 'text', 'size' => 'small', 'tooltip_title' => __('Fallback Tax Rate', 'easy-digital-downloads'), 'tooltip_desc' => __('If the customer\'s address fails to meet the above tax rules, you can define a `default` tax rate to be applied to all other customers.', 'easy-digital-downloads')), 'prices_include_tax' => array('id' => 'prices_include_tax', 'name' => __('Prices entered with tax', 'easy-digital-downloads'), 'desc' => __('This option affects how you enter prices.', 'easy-digital-downloads'), 'type' => 'radio', 'std' => 'no', 'options' => array('yes' => __('Yes, I will enter prices inclusive of tax', 'easy-digital-downloads'), 'no' => __('No, I will enter prices exclusive of tax', 'easy-digital-downloads')), 'tooltip_title' => __('Prices Inclusive of Tax', 'easy-digital-downloads'), 'tooltip_desc' => __('When using prices inclusive of tax, you will be entering your prices as the total amount you want a customer to pay for the download, including tax. Easy Digital Downloads will calculate the proper amount to tax the customer for the defined total price.', 'easy-digital-downloads')), 'display_tax_rate' => array('id' => 'display_tax_rate', 'name' => __('Display Tax Rate on Prices', 'easy-digital-downloads'), 'desc' => __('Some countries require a notice when product prices include tax.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'checkout_include_tax' => array('id' => 'checkout_include_tax', 'name' => __('Display during checkout', 'easy-digital-downloads'), 'desc' => __('Should prices on the checkout page be shown with or without tax?', 'easy-digital-downloads'), 'type' => 'select', 'std' => 'no', 'options' => array('yes' => __('Including tax', 'easy-digital-downloads'), 'no' => __('Excluding tax', 'easy-digital-downloads')), 'tooltip_title' => __('Taxes Displayed for Products on Checkout', 'easy-digital-downloads'), 'tooltip_desc' => __('This option will determine whether the product price displays with or without tax on checkout.', 'easy-digital-downloads'))))), 'extensions' => apply_filters('edd_settings_extensions', array()), 'licenses' => apply_filters('edd_settings_licenses', array()), 'misc' => apply_filters('edd_settings_misc', array('main' => array('misc_settings' => array('id' => 'misc_settings', 'name' => '<h3>' . __('Misc Settings', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'enable_ajax_cart' => array('id' => 'enable_ajax_cart', 'name' => __('Enable AJAX', 'easy-digital-downloads'), 'desc' => __('Check this to enable AJAX for the shopping cart.', 'easy-digital-downloads'), 'type' => 'checkbox', 'std' => '1', 'tooltip_title' => __('Enabling AJAX', 'easy-digital-downloads'), 'tooltip_desc' => __('With AJAX enabled, customers can perform cart actions like adding and removing items from their shopping cart without pages having to be reloaded. This also creates fewer steps during the checkout process.', 'easy-digital-downloads')), 'redirect_on_add' => array('id' => 'redirect_on_add', 'name' => __('Redirect to Checkout', 'easy-digital-downloads'), 'desc' => __('Immediately redirect to checkout after adding an item to the cart?', 'easy-digital-downloads'), 'type' => 'checkbox', 'tooltip_title' => __('Redirect to Checkout', 'easy-digital-downloads'), 'tooltip_desc' => __('When enabled, once an item has been added to the cart, the customer will be redirected directly to your checkout page. This is useful for stores that sell single items.', 'easy-digital-downloads')), 'item_quantities' => array('id' => 'item_quantities', 'name' => __('Item Quantities', 'easy-digital-downloads'), 'desc' => __('Allow item quantities to be changed.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'uninstall_on_delete' => array('id' => 'uninstall_on_delete', 'name' => __('Remove Data on Uninstall?', 'easy-digital-downloads'), 'desc' => __('Check this box if you would like EDD to completely remove all of its data when the plugin is deleted.', 'easy-digital-downloads'), 'type' => 'checkbox')), 'checkout' => array('checkout_settings' => array('id' => 'checkout_settings', 'name' => '<h3>' . __('Checkout Settings', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'enforce_ssl' => array('id' => 'enforce_ssl', 'name' => __('Enforce SSL on Checkout', 'easy-digital-downloads'), 'desc' => __('Check this to force users to be redirected to the secure checkout page. You must have an SSL certificate installed to use this option.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'logged_in_only' => array('id' => 'logged_in_only', 'name' => __('Require Login', 'easy-digital-downloads'), 'desc' => __('Require that users be logged-in to purchase files.', 'easy-digital-downloads'), 'type' => 'checkbox', 'tooltip_title' => __('Require Login', 'easy-digital-downloads'), 'tooltip_desc' => __('You can require that customers create and login to user accounts prior to purchasing from your store by enabling this option. When unchecked, users can purchase without being logged in by using their name and email address.', 'easy-digital-downloads')), 'show_register_form' => array('id' => 'show_register_form', 'name' => __('Show Register / Login Form?', 'easy-digital-downloads'), 'desc' => __('Display the registration and login forms on the checkout page for non-logged-in users.', 'easy-digital-downloads'), 'type' => 'select', 'std' => 'none', 'options' => array('both' => __('Registration and Login Forms', 'easy-digital-downloads'), 'registration' => __('Registration Form Only', 'easy-digital-downloads'), 'login' => __('Login Form Only', 'easy-digital-downloads'), 'none' => __('None', 'easy-digital-downloads'))), 'allow_multiple_discounts' => array('id' => 'allow_multiple_discounts', 'name' => __('Multiple Discounts', 'easy-digital-downloads'), 'desc' => __('Allow customers to use multiple discounts on the same purchase?', 'easy-digital-downloads'), 'type' => 'checkbox'), 'enable_cart_saving' => array('id' => 'enable_cart_saving', 'name' => __('Enable Cart Saving', 'easy-digital-downloads'), 'desc' => __('Check this to enable cart saving on the checkout.', 'easy-digital-downloads'), 'type' => 'checkbox', 'tooltip_title' => __('Cart Saving', 'easy-digital-downloads'), 'tooltip_desc' => __('Cart saving allows shoppers to create a temporary link to their current shopping cart so they can come back to it later, or share it with someone.', 'easy-digital-downloads'))), 'button_text' => array('button_settings' => array('id' => 'button_settings', 'name' => '<h3>' . __('Button Text', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'checkout_label' => array('id' => 'checkout_label', 'name' => __('Complete Purchase Text', 'easy-digital-downloads'), 'desc' => __('The button label for completing a purchase.', 'easy-digital-downloads'), 'type' => 'text', 'std' => __('Purchase', 'easy-digital-downloads')), 'add_to_cart_text' => array('id' => 'add_to_cart_text', 'name' => __('Add to Cart Text', 'easy-digital-downloads'), 'desc' => __('Text shown on the Add to Cart Buttons.', 'easy-digital-downloads'), 'type' => 'text', 'std' => __('Add to Cart', 'easy-digital-downloads')), 'buy_now_text' => array('id' => 'buy_now_text', 'name' => __('Buy Now Text', 'easy-digital-downloads'), 'desc' => __('Text shown on the Buy Now Buttons.', 'easy-digital-downloads'), 'type' => 'text', 'std' => __('Buy Now', 'easy-digital-downloads'))), 'file_downloads' => array('file_settings' => array('id' => 'file_settings', 'name' => '<h3>' . __('File Download Settings', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'download_method' => array('id' => 'download_method', 'name' => __('Download Method', 'easy-digital-downloads'), 'desc' => sprintf(__('Select the file download method. Note, not all methods work on all servers.', 'easy-digital-downloads'), edd_get_label_singular()), 'type' => 'select', 'tooltip_title' => __('Download Method', 'easy-digital-downloads'), 'tooltip_desc' => __('Due to its consistency in multiple platforms and better file protection, \'forced\' is the default method. Because Easy Digital Downloads uses PHP to process the file with the \'forced\' method, larger files can cause problems with delivery, resulting in hitting the \'max execution time\' of the server. If users are getting 404 or 403 errors when trying to access their purchased files when using the \'forced\' method, changing to the \'redirect\' method can help resolve this.', 'easy-digital-downloads'), 'options' => array('direct' => __('Forced', 'easy-digital-downloads'), 'redirect' => __('Redirect', 'easy-digital-downloads'))), 'symlink_file_downloads' => array('id' => 'symlink_file_downloads', 'name' => __('Symlink File Downloads?', 'easy-digital-downloads'), 'desc' => __('Check this if you are delivering really large files or having problems with file downloads completing.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'file_download_limit' => array('id' => 'file_download_limit', 'name' => __('File Download Limit', 'easy-digital-downloads'), 'desc' => sprintf(__('The maximum number of times files can be downloaded for purchases. Can be overwritten for each %s.', 'easy-digital-downloads'), edd_get_label_singular()), 'type' => 'number', 'size' => 'small', 'tooltip_title' => __('File Download Limits', 'easy-digital-downloads'), 'tooltip_desc' => sprintf(__('Set the global default for the number of times a customer can download items they purchase. Using a value of 0 is unlimited. This can be defined on a %s-specific level as well. Download limits can also be reset for an individual purchase.', 'easy-digital-downloads'), edd_get_label_singular(true))), 'download_link_expiration' => array('id' => 'download_link_expiration', 'name' => __('Download Link Expiration', 'easy-digital-downloads'), 'desc' => __('How long should download links be valid for? Default is 24 hours from the time they are generated. Enter a time in hours.', 'easy-digital-downloads'), 'tooltip_title' => __('Download Link Expiration', 'easy-digital-downloads'), 'tooltip_desc' => __('When a customer receives a link to their downloads via email, in their receipt, or in their purchase history, the link will only be valid for the timeframe (in hours) defined in this setting. Sending a new purchase receipt or visiting the account page will re-generate a valid link for the customer.', 'easy-digital-downloads'), 'type' => 'number', 'size' => 'small', 'std' => '24', 'min' => '0'), 'disable_redownload' => array('id' => 'disable_redownload', 'name' => __('Disable Redownload?', 'easy-digital-downloads'), 'desc' => __('Check this if you do not want to allow users to redownload items from their purchase history.', 'easy-digital-downloads'), 'type' => 'checkbox')), 'accounting' => array('accounting_settings' => array('id' => 'accounting_settings', 'name' => '<h3>' . __('Accounting Settings', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'enable_skus' => array('id' => 'enable_skus', 'name' => __('Enable SKU Entry', 'easy-digital-downloads'), 'desc' => __('Check this box to allow entry of product SKUs. SKUs will be shown on purchase receipt and exported purchase histories.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'enable_sequential' => array('id' => 'enable_sequential', 'name' => __('Sequential Order Numbers', 'easy-digital-downloads'), 'desc' => __('Check this box to enable sequential order numbers.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'sequential_start' => array('id' => 'sequential_start', 'name' => __('Sequential Starting Number', 'easy-digital-downloads'), 'desc' => __('The number at which the sequence should begin.', 'easy-digital-downloads'), 'type' => 'number', 'size' => 'small', 'std' => '1'), 'sequential_prefix' => array('id' => 'sequential_prefix', 'name' => __('Sequential Number Prefix', 'easy-digital-downloads'), 'desc' => __('A prefix to prepend to all sequential order numbers.', 'easy-digital-downloads'), 'type' => 'text'), 'sequential_postfix' => array('id' => 'sequential_postfix', 'name' => __('Sequential Number Postfix', 'easy-digital-downloads'), 'desc' => __('A postfix to append to all sequential order numbers.', 'easy-digital-downloads'), 'type' => 'text')), 'site_terms' => array('terms_settings' => array('id' => 'terms_settings', 'name' => '<h3>' . __('Agreement Settings', 'easy-digital-downloads') . '</h3>', 'type' => 'header'), 'show_agree_to_terms' => array('id' => 'show_agree_to_terms', 'name' => __('Agree to Terms', 'easy-digital-downloads'), 'desc' => __('Check this to show an agree to terms on the checkout that users must agree to before purchasing.', 'easy-digital-downloads'), 'type' => 'checkbox'), 'agree_label' => array('id' => 'agree_label', 'name' => __('Agree to Terms Label', 'easy-digital-downloads'), 'desc' => __('Label shown next to the agree to terms check box.', 'easy-digital-downloads'), 'type' => 'text', 'size' => 'regular'), 'agree_text' => array('id' => 'agree_text', 'name' => __('Agreement Text', 'easy-digital-downloads'), 'desc' => __('If Agree to Terms is checked, enter the agreement terms here.', 'easy-digital-downloads'), 'type' => 'rich_editor')))));
    return apply_filters('edd_registered_settings', $edd_settings);
}
/**
 * Removes incompatible email templates from the list of template options in the settings
 * 
 * @access public
 * @since 0.9.5
 * @return void
 */
function edd_pup_get_email_templates()
{
    $templates = edd_get_email_templates();
    $eddpdfi_email_templates = array('invoice_default', 'blue_stripe', 'lines', 'minimal', 'traditional', 'invoice_blue', 'invoice_green', 'invoice_orange', 'invoice_pink', 'invoice_purple', 'invoice_red', 'invoice_yellow');
    foreach ($eddpdfi_email_templates as $pdftemplate) {
        if (array_key_exists($pdftemplate, $templates)) {
            unset($templates[$pdftemplate]);
        }
    }
    return $templates;
}