/**
  * Main Audiotheme_Settings instance.
  *
  * Provides access to the Audiotheme_Settings object and ensures only one
  * instance ever exists. Accessing the object should usually be done
  * through one of the helper functions.
  *
  * @since 1.0.0
  */
 public static function instance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
/**
 * Render a settings screen.
 *
 * Renders the tabs and fields, including javascript, for tabbed screens and
 * attaching error messages to fields and their parent tabs.
 *
 * @since 1.0.0
 */
function audiotheme_settings_display_screen()
{
    global $plugin_page;
    $settings = Audiotheme_Settings::instance();
    $screen = $settings->get_screen($plugin_page);
    $has_tabs = count($screen->tabs) < 2 ? false : true;
    ?>
	<div class="wrap audiotheme-settings-screen<?php 
    echo $has_tabs ? ' audiotheme-settings-screen-has-tabs' : '';
    ?>
">
		<form action="<?php 
    echo is_network_admin() ? 'edit.php?action=audiotheme-save-network-settings' : 'options.php';
    ?>
" method="post">
			<?php 
    screen_icon();
    // Don't add tabs if there isn't more than one registered.
    if (!$has_tabs) {
        echo '<h1>' . $screen->name . '</h2>';
    } else {
        echo '<h1 class="nav-tab-wrapper">';
        foreach ($screen->tabs as $tab_id => $tab) {
            echo '<a href="#' . $tab_id . '-panel" class="nav-tab">' . esc_html($tab['title']) . '</a>';
        }
        echo '</h1>';
    }
    // Output the nonce stuff.
    settings_fields($screen->option_group);
    // Output the tab panels.
    foreach ($screen->tabs as $tab_id => $tab) {
        echo '<div class="tab-panel" id="' . $tab_id . '-panel">';
        do_action($screen->option_group . '_' . $tab_id . '_fields_before');
        $wp_settings_section = $screen->screen_id === $tab_id ? $screen->screen_id : $screen->screen_id . '-' . $tab_id;
        do_settings_sections($wp_settings_section);
        do_action($screen->option_group . '_' . $tab_id . '_fields_after');
        echo '</div>';
    }
    ?>

			<p class="submit">
				<input type="submit" value="Save Changes" class="button-primary">
			</p>
		</form>
	</div><!--end div.wrap-->
	<?php 
}