/**
  * Settings admin section.
  */
 public static function admin_settings()
 {
     global $wp, $wpdb, $affiliates_options, $wp_roles;
     if (!current_user_can(AFFILIATES_ADMINISTER_OPTIONS)) {
         wp_die(__('Access denied.', AFFILIATES_PLUGIN_DOMAIN));
     }
     wp_enqueue_style('affiliates-admin-settings');
     wp_enqueue_script('affiliates-field-choice');
     self::init_sections();
     $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : null;
     if (!key_exists($section, self::$sections)) {
         $section = 'general';
     }
     $section_title = self::$sections[$section];
     echo '<h1>' . __('Settings', AFFILIATES_PLUGIN_DOMAIN) . '</h1>';
     $section_links = array();
     foreach (self::$sections as $sec => $title) {
         $section_links[] = sprintf('<a class="section-link %s" href="%s">%s</a>', $section == $sec ? 'active' : '', esc_url(add_query_arg('section', $sec, admin_url('admin.php?page=affiliates-admin-settings'))), $title);
     }
     echo '<div class="section-links">';
     echo implode(' | ', $section_links);
     echo '</div>';
     echo '<h2>' . $section_title . '</h2>';
     switch ($section) {
         case 'integrations':
             require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings-integrations.php';
             Affiliates_Settings_Integrations::section();
             break;
         case 'pages':
             require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings-pages.php';
             Affiliates_Settings_Pages::section();
             break;
         case 'referrals':
             require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings-referrals.php';
             Affiliates_Settings_Referrals::section();
             break;
         case 'registration':
             require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings-registration.php';
             Affiliates_Settings_Registration::section();
             break;
         case 'general':
             require_once AFFILIATES_CORE_LIB . '/class-affiliates-settings-general.php';
             Affiliates_Settings_General::section();
             break;
         default:
             do_action('affiliates_settings_section', $section);
     }
 }