/**
  * Generate navigation tabs HTML, based on a specific admin menu.
  * @access  public
  * @since   1.0.0
  * @return  string/WP_Error
  */
 public static function get_navigation_tabs($menu_key = 'woothemes')
 {
     $html = '';
     $screens = Woothemes_Updater_Screen::get_available_screens();
     $current_tab = self::get_current_screen();
     if (0 < count($screens)) {
         foreach ($screens as $k => $v) {
             $class = 'nav-tab';
             if ($current_tab == $k) {
                 $class .= ' nav-tab-active';
             }
             $url = add_query_arg('page', 'woothemes-helper', network_admin_url('index.php'));
             $url = add_query_arg('screen', $k, $url);
             $html .= '<a href="' . esc_url($url) . '" class="' . esc_attr($class) . '">' . esc_html($v) . '</a>';
         }
     }
     return $html;
 }
    /**
     * Load the main management screen.
     *
     * @access public
     * @since   1.0.0
     * @return   void
     */
    public function settings_screen()
    {
        ?>
		<div id="welcome-panel" class="wrap about-wrap woothemes-updater-wrap">
			<h1><?php 
        _e('Welcome to the WooThemes Helper', 'woothemes-updater');
        ?>
</h1>

			<div class="about-text woothemes-helper-about-text">
				<?php 
        _e('Looking for a hand with activating your licenses, or have questions about your WooThemes products? We\'ve got you covered.', 'woothemes-updater');
        ?>
			</div>
		</div><!--/#welcome-panel .welcome-panel-->
		<?php 
        Woothemes_Updater_Screen::get_header();
        $screen = Woothemes_Updater_Screen::get_current_screen();
        switch ($screen) {
            // Help screen.
            case 'help':
                do_action('woothemes_updater_help_screen_before');
                $this->load_help_screen_boxes();
                require_once $this->screens_path . 'screen-help.php';
                do_action('woothemes_updater_help_screen_after');
                break;
                // Licenses screen.
            // Licenses screen.
            case 'license':
            default:
                if ($this->api->ping()) {
                    $this->installed_products = $this->get_detected_products();
                    $this->pending_products = $this->get_pending_products();
                    do_action('woothemes_updater_license_screen_before');
                    require_once $this->screens_path . 'screen-manage.php';
                    do_action('woothemes_updater_license_screen_after');
                } else {
                    do_action('woothemes_updater_api_unreachable_screen_before');
                    require_once $this->screens_path . 'woothemes-api-unreachable.php';
                    do_action('woothemes_updater_api_unreachable_screen_after');
                }
                break;
        }
        Woothemes_Updater_Screen::get_footer();
    }
    /**
     * Load the main management screen.
     *
     * @access public
     * @since   1.0.0
     * @return   void
     */
    public function settings_screen()
    {
        ?>
		<div id="welcome-panel" class="wrap about-wrap woothemes-updater-wrap">
			<h1><?php 
        _e('Welcome to WooThemes Helper', 'woothemes-updater');
        ?>
</h1>

			<div class="about-text woothemes-helper-about-text">
				<?php 
        _e('This is your one-stop-spot for activating your subscriptions.', 'woothemes-updater');
        ?>
			</div>
			<div class="short-description woothemes-helper-short-description">
				<?php 
        echo wpautop(sprintf(__('To make sure your subscriptions stay active, %1$sadd a saved card%2$s and %3$senable auto-renew%2$s on the subscriptions you’re continuing to enjoy.', 'woothemes-updater'), '<a href="' . esc_url($this->my_account_url) . '">', '</a>', '<a href="' . esc_url($this->my_subscriptions_url) . '">'));
        ?>
			</div><!--/.short-description-->
		</div><!--/#welcome-panel .welcome-panel-->
		<?php 
        Woothemes_Updater_Screen::get_header();
        $screen = Woothemes_Updater_Screen::get_current_screen();
        switch ($screen) {
            // Help screen.
            case 'help':
                do_action('woothemes_updater_help_screen_before');
                $this->load_help_screen_boxes();
                require_once $this->screens_path . 'screen-help.php';
                do_action('woothemes_updater_help_screen_after');
                break;
                // Licenses screen.
            // Licenses screen.
            case 'license':
            default:
                if ($this->api->ping()) {
                    $this->installed_products = $this->get_detected_products();
                    $this->pending_products = $this->get_pending_products();
                    do_action('woothemes_updater_license_screen_before');
                    require_once $this->screens_path . 'screen-manage.php';
                    do_action('woothemes_updater_license_screen_after');
                } else {
                    do_action('woothemes_updater_api_unreachable_screen_before');
                    require_once $this->screens_path . 'woothemes-api-unreachable.php';
                    do_action('woothemes_updater_api_unreachable_screen_after');
                }
                break;
        }
        Woothemes_Updater_Screen::get_footer();
    }
    /**
     * Load the main management screen.
     *
     * @access public
     * @since   1.0.0
     * @return   void
     */
    public function settings_screen()
    {
        ?>
		<div id="welcome-panel" class="wrap about-wrap woothemes-updater-wrap">
			<h1><?php 
        _e('Welcome to WooCommerce Helper', 'woothemes-updater');
        ?>
</h1>

			<div class="about-text woothemes-helper-about-text">
				<?php 
        _e('This is your one-stop-spot for connecting your subscriptions.', 'woothemes-updater');
        ?>
			</div>
			<div class="connect-wrapper">
				<?php 
        $return = add_query_arg('page', 'woothemes-helper', network_admin_url('index.php'));
        $master_key_info = $this->api->get_master_key_info();
        if ($master_key_info) {
            $disconnect_url = admin_url('index.php?page=woothemes-helper&delete_wth_token=true');
            $refresh_url = wp_nonce_url(admin_url('index.php?page=woothemes-helper&refresh=true'), 'wth_refresh_token');
            ?>
					<div class="connected">
						<?php 
            echo get_avatar($master_key_info->user_email, 80);
            ?>
						<p>
							Connected as<br />
							<strong><?php 
            echo $master_key_info->user_email;
            ?>
</strong>
							<span class="buttons">
								<a href="<?php 
            echo $disconnect_url;
            ?>
" class="button button-secondary disconnect" title="Disconnect this WooCommerce.com account">Disconnect</a>
								<a href="<?php 
            echo $refresh_url;
            ?>
" class="button button-secondary refresh" title="Refresh the connection to this WooCommerce.com account">Refresh</a>
							</span>
						</p>
					</div>
				<?php 
        } else {
            $connect_url = wp_nonce_url($this->api->connect_url . '?site=' . urlencode(site_url()) . '&return=' . urlencode($return), 'wth_connect');
            ?>
					<a href="<?php 
            echo $connect_url;
            ?>
" class="button button-primary connect-button"><span class="dashicons dashicons-admin-plugins"></span> Connect your WooCommerce.com Account</a>
				<?php 
        }
        ?>

				<?php 
        if (!$master_key_info) {
            ?>
					<p class="short-description woothemes-helper-short-description">
						<?php 
            echo sprintf(__('When you connect your account, your subscription keys will automatically be added to your site. You can disconnect the account or an individual key at anytime. Once you\'re connected, you\'ll receive the updates and support that come with your subscription. If you prefer, you can also manually copy the key from your account and paste it below.', 'woothemes-updater'));
            ?>
					</p><!--/.short-description-->
				<?php 
        }
        ?>
			</div>
		</div><!--/#welcome-panel .welcome-panel-->
		<?php 
        Woothemes_Updater_Screen::get_header();
        $screen = Woothemes_Updater_Screen::get_current_screen();
        switch ($screen) {
            // Help screen.
            case 'help':
                do_action('woothemes_updater_help_screen_before');
                $this->load_help_screen_boxes();
                require_once $this->screens_path . 'screen-help.php';
                do_action('woothemes_updater_help_screen_after');
                break;
                // Licenses screen.
            // Licenses screen.
            case 'license':
            default:
                if ($this->api->ping()) {
                    $this->installed_products = $this->get_detected_products();
                    $this->pending_products = $this->get_pending_products();
                    do_action('woothemes_updater_license_screen_before');
                    require_once $this->screens_path . 'screen-manage.php';
                    do_action('woothemes_updater_license_screen_after');
                } else {
                    do_action('woothemes_updater_api_unreachable_screen_before');
                    require_once $this->screens_path . 'woothemes-api-unreachable.php';
                    do_action('woothemes_updater_api_unreachable_screen_after');
                }
                break;
        }
        Woothemes_Updater_Screen::get_footer();
    }