/**
  * Returns all the payment email settings fields.  
  *
  * @return  array
  * @access  public
  * @since   1.0.0
  */
 public function add_email_fields()
 {
     if (!charitable_is_settings_view('emails')) {
         return array();
     }
     return array('section' => array('title' => '', 'type' => 'hidden', 'priority' => 10000, 'value' => 'emails', 'save' => false), 'section_emails' => array('title' => __('Available Emails', 'charitable'), 'type' => 'heading', 'priority' => 5), 'emails' => array('title' => false, 'callback' => array($this, 'render_emails_table'), 'priority' => 7), 'section_email_general' => array('title' => __('General Email Settings', 'charitable'), 'type' => 'heading', 'priority' => 10), 'email_from_name' => array('title' => __('"From" Name', 'charitable'), 'type' => 'text', 'help' => __('The name of the email sender.', 'charitable'), 'priority' => 12, 'default' => get_option('blogname')), 'email_from_email' => array('title' => __('"From" Email', 'charitable'), 'type' => 'email', 'help' => __('The email address of the email sender. This will be the address recipients email if they hit "Reply".', 'charitable'), 'priority' => 14, 'default' => get_option('admin_email')));
 }
 /**
  * Returns all the payment gateway settings fields.  
  *
  * @return  array[]
  * @access  public
  * @since   1.0.0
  */
 public function add_gateway_fields()
 {
     if (!charitable_is_settings_view('gateways')) {
         return array();
     }
     return array('section' => array('title' => '', 'type' => 'hidden', 'priority' => 10000, 'value' => 'gateways', 'save' => false), 'section_gateways' => array('title' => __('Available Payment Gateways', 'charitable'), 'type' => 'heading', 'priority' => 5), 'gateways' => array('title' => false, 'callback' => array($this, 'render_gateways_table'), 'priority' => 10), 'test_mode' => array('title' => __('Turn on Test Mode', 'charitable'), 'type' => 'checkbox', 'priority' => 15));
 }
 /**
  * Add the advanced tab settings fields. 
  *
  * @return  array[]
  * @access  public
  * @since   1.0.0
  */
 public function add_advanced_fields()
 {
     if (!charitable_is_settings_view('advanced')) {
         return array();
     }
     return array('section' => array('title' => '', 'type' => 'hidden', 'priority' => 10000, 'value' => 'advanced'), 'section_dangerous' => array('title' => __('Dangerous Settings', 'charitable'), 'type' => 'heading', 'priority' => 100), 'delete_data_on_uninstall' => array('label_for' => __('Reset Data', 'charitable'), 'type' => 'checkbox', 'help' => __('DELETE ALL DATA when uninstalling the plugin.', 'charitable'), 'priority' => 105));
 }
 /**
  * Register setting.
  *
  * @return  void
  * @access  public
  * @since   1.0.0
  */
 public function register_settings()
 {
     if (!charitable_is_settings_view()) {
         return;
     }
     register_setting('charitable_settings', 'charitable_settings', array($this, 'sanitize_settings'));
     $fields = $this->get_fields();
     if (empty($fields)) {
         return;
     }
     $sections = array_merge($this->get_sections(), $this->get_dynamic_groups());
     /* Register each section */
     foreach ($sections as $section_key => $section) {
         $section_id = 'charitable_settings_' . $section_key;
         add_settings_section($section_id, __return_null(), '__return_false', $section_id);
         if (!isset($fields[$section_key]) || empty($fields[$section_key])) {
             continue;
         }
         /* Sort by priority */
         $section_fields = $fields[$section_key];
         uasort($section_fields, 'charitable_priority_sort');
         /* Add the individual fields within the section */
         foreach ($section_fields as $key => $field) {
             $this->register_field($field, array($section_key, $key));
         }
     }
 }
 /**
  * Add the general tab settings fields. 
  *
  * @param   array[] $fields
  * @return  array
  * @access  public
  * @since   1.0.0
  */
 public function add_general_fields($fields = array())
 {
     if (!charitable_is_settings_view('general')) {
         return array();
     }
     $general_fields = array('section' => array('title' => '', 'type' => 'hidden', 'priority' => 10000, 'value' => 'general'), 'section_locale' => array('title' => __('Currency & Location', 'charitable'), 'type' => 'heading', 'priority' => 2), 'country' => array('title' => __('Base Country', 'charitable'), 'type' => 'select', 'priority' => 4, 'default' => 'AU', 'options' => charitable_get_location_helper()->get_countries()), 'currency' => array('title' => __('Currency', 'charitable'), 'type' => 'select', 'priority' => 10, 'default' => 'AUD', 'options' => charitable_get_currency_helper()->get_all_currencies()), 'currency_format' => array('title' => __('Currency Format', 'charitable'), 'type' => 'select', 'priority' => 12, 'default' => 'left', 'options' => array('left' => '$23.00', 'right' => '23.00$', 'left-with-space' => '$ 23.00', 'right-with-space' => '23.00 $')), 'decimal_separator' => array('title' => __('Decimal Separator', 'charitable'), 'type' => 'select', 'priority' => 14, 'default' => '.', 'options' => array('.' => 'Period (12.50)', ',' => 'Comma (12,50)')), 'thousands_separator' => array('title' => __('Thousands Separator', 'charitable'), 'type' => 'select', 'priority' => 16, 'default' => ',', 'options' => array(',' => __('Comma (10,000)', 'charitable'), '.' => __('Period (10.000)', 'charitable'), '' => __('None', 'charitable'))), 'decimal_count' => array('title' => __('Number of Decimals', 'charitable'), 'type' => 'number', 'priority' => 18, 'default' => 2, 'class' => 'short'), 'section_donation_form' => array('title' => __('Donation Form', 'charitable'), 'type' => 'heading', 'priority' => 20), 'donation_form_display' => array('title' => __('Display Options', 'charitable'), 'type' => 'select', 'priority' => 22, 'default' => 'separate_page', 'options' => array('separate_page' => __('Show on a Separate Page', 'charitable'), 'same_page' => __('Show on the Same Page', 'charitable'), 'modal' => __('Reveal in a Modal', 'charitable')), 'help' => __('Choose how you want a campaign\'s donation form to show.', 'charitable')), 'section_pages' => array('title' => __('Pages', 'charitable'), 'type' => 'heading', 'priority' => 30), 'login_page' => array('title' => __('Login Page', 'charitable'), 'type' => 'select', 'priority' => 32, 'default' => 'wp', 'options' => array('wp' => __('Use WordPress Login', 'charitable'), 'pages' => array('options' => charitable_get_admin_settings()->get_pages(), 'label' => __('Choose a Static Page', 'charitable'))), 'help' => __('Allow users to login via the normal WordPress login page or via a static page. The static page should contain the <code>[charitable_login]</code> shortcode.', 'charitable')), 'registration_page' => array('title' => __('Registration Page', 'charitable'), 'type' => 'select', 'priority' => 34, 'default' => 'wp', 'options' => array('wp' => __('Use WordPress Registration Page', 'charitable'), 'pages' => array('options' => charitable_get_admin_settings()->get_pages(), 'label' => __('Choose a Static Page', 'charitable'))), 'help' => __('Allow users to register via the default WordPress login or via a static page. The static page should contain the <code>[charitable_registration]</code> shortcode.', 'charitable')), 'profile_page' => array('title' => __('Profile Page', 'charitable'), 'type' => 'select', 'priority' => 36, 'options' => charitable_get_admin_settings()->get_pages(), 'help' => __('The static page should contain the <code>[charitable_profile]</code> shortcode.', 'charitable')), 'donation_receipt_page' => array('title' => __('Donation Receipt Page', 'charitable'), 'type' => 'select', 'priority' => 38, 'default' => 'auto', 'options' => array('auto' => __('Automatic', 'charitable'), 'pages' => array('options' => charitable_get_admin_settings()->get_pages(), 'label' => __('Choose a Static Page', 'charitable'))), 'help' => __('Choose the page that users will be redirected to after donating. Leave it set to automatic to use the built-in Charitable receipt. If you choose a static page, it should contain the <code>[donation_receipt]</code> shortcode.', 'charitable')));
     $fields = array_merge($fields, $general_fields);
     return $fields;
 }
 /**
  * Add settings to the Extensions settings tab.
  *
  * @param   array[] $fields
  * @return  array[]
  * @access  public
  * @since   1.0.0
  */
 public function add_extension_boilerplate_settings($fields = array())
 {
     if (!charitable_is_settings_view('extensions')) {
         return $fields;
     }
     $custom_fields = array('section_extension_boilerplate' => array('title' => __('Extension Boilerplate', 'charitable-extension-boilerplate'), 'type' => 'heading', 'priority' => 50), 'extension_boilerplate_setting_text' => array('title' => __('Text Field Setting', 'charitable-extension-boilerplate'), 'type' => 'text', 'priority' => 50.2, 'default' => __('', 'charitable-extension-boilerplate')), 'extension_boilerplate_setting_checkbox' => array('title' => __('Checkbox Setting', 'charitable-extension-boilerplate'), 'type' => 'checkbox', 'priority' => 50.6, 'default' => false, 'help' => __('', 'charitable-extension-boilerplate')));
     $fields = array_merge($fields, $custom_fields);
     return $fields;
 }
 /**
  * Add the licenses tab settings fields. 
  *
  * @return  array[]
  * @access  public
  * @since   1.0.0
  */
 public function add_licenses_fields()
 {
     if (!charitable_is_settings_view('licenses')) {
         return array();
     }
     $fields = array('section' => array('title' => '', 'type' => 'hidden', 'priority' => 10000, 'value' => 'licenses', 'save' => false), 'licenses' => array('title' => false, 'callback' => array($this, 'render_licenses_table'), 'priority' => 4));
     foreach (charitable_get_helper('licenses')->get_products() as $key => $product) {
         $fields[$key] = array('type' => 'text', 'render' => false, 'priority' => 6);
     }
     return $fields;
 }