<?php
/**
 * Yt_EVL_Dashboard
 * 
 * Custom plugin dashboard shows different functionality based on user status
 * 
 * @package Yt_Evolution
 * @subpackage Classes
 * @author  Chris Derenberger <https://www.ytevolution.com>
 * @copyright Copyright 2020, YTEVOLUTION®
 * @link https://www.ytevolution.com
 * @since 1.0.0
 */
 
class Yt_EVL_Dashboard {
  
  public static $instance;
  
  public static $youtube_api_key;
  
  public static $vimeo_api_key;
  
  public static $twitch_api_key;
  
  public static $sources;
  
  
  public static function init()
  {
      if ( is_null( self::$instance ) )
          self::$instance = new Yt_EVL_Dashboard();
      return self::$instance;
  }
  
  
  // Constructor  
  function __construct() {    

    if( isset($_GET['page']) ){
      $page = filter_var($_GET['page'], FILTER_SANITIZE_STRING);    
      if ( isset( $page ) && ( $page == YT_EVOLUTION_SLUG) ):    
        
        // action to set local storage of API key values
        add_action( 'init', array( $this, 'set_local_api_key_values' ) );
        
        // Add Sections
        add_action('admin_init', array( $this, 'add_dashboard_sections' ) );
        
      endif;
    }
  }
  
  
  
  
  // Store API key values here in this object for quick access
  function set_local_api_key_values(){  
    
    self::$youtube_api_key = Yt_Evolution::$tube_youtube_videos->get_youtube_api_key();
    
    self::$vimeo_api_key = Yt_Evolution::$tube_vimeo_videos->get_vimeo_api_key();
    
    self::$twitch_api_key = Yt_Evolution::$tube_twitch_videos->get_twitch_api_key();
  
  }
  
  
  // add the different settions sections for the dashboard
  function add_dashboard_sections() { 

     // Get started section
     add_settings_section(
      'tube_vc_dashboard_get_started_section', 
      NULL, 
      array( $this, 'show_dashboard_get_started_section'), 
      'tube_vc_dashboard_get_started_section'
    );
        
    // YouTube API Section
     add_settings_section(
      'tube_vc_dashboard_youtube_api_key_section', 
      __( 'How to get a YouTube API key:', 'yt-revolution' ), 
      array( $this, 'show_dashboard_youtube_api_key_section'), 
      'tube_vc_dashboard_youtube_api_key_section'
    );    
            
    // Vimeo API Section
     add_settings_section(
      'tube_vc_dashboard_vimeo_api_key_section', 
      __( 'How to get a Vimeo API key:', 'yt-revolution' ), 
      array( $this, 'show_dashboard_vimeo_api_key_section'), 
      'tube_vc_dashboard_vimeo_api_key_section'
    );    
            
    // Twitch API Section
     add_settings_section(
      'tube_vc_dashboard_twitch_api_key_section', 
      __( 'How to get a Twitch API key:', 'yt-revolution' ), 
      array( $this, 'show_dashboard_twitch_api_key_section'), 
      'tube_vc_dashboard_twitch_api_key_section'
    );    
            
    // Your Channels & Playlists Section
     add_settings_section(
      'tube_vc_dashboard_your_channels_section', 
      __( 'Manage channels and playlists:', 'yt-revolution' ), 
      array( $this, 'show_dashboard_your_channels_section'), 
      'tube_vc_dashboard_next_steps_section'
    );
            
    // Find Videos
     add_settings_section(
      'tube_vc_dashboard_find_videos_section', 
      __( 'Find and create new videos:', 'yt-revolution' ), 
      array( $this, 'show_dashboard_find_videos_section'), 
      'tube_vc_dashboard_next_steps_section'
    );

    // Settings & API Keys
    /* add_settings_section(
      'tube_vc_dashboard_update_settings_section', 
      __( 'Update your settings:', 'yt-revolution' ), 
      array( $this, 'show_dashboard_update_settings_section'), 
      'tube_vc_dashboard_next_steps_section'
    );*/
    
    // Settings & API Keys
//     add_settings_section(
//      'tube_vc_dashboard_manage_api_keys_section', 
//      __( 'Manage your API Keys:', 'yt-revolution' ), 
//      array( $this, 'show_dashboard_manage_api_keys_section'), 
//      'tube_vc_dashboard_next_steps_section'
//    );
            
            
    // Sidebar Section
     add_settings_section(
      'tube_vc_dashboard_sidebar_section', 
      NULL, 
      array( $this, 'show_dashboard_sidebar_section'), 
      'tube_vc_dashboard_sidebar_section'
    );
    
      
  }
 
 
  // render the Dashboard page
  function render_options_page_dashboard(){
         
    ?>
    <div class="wrap">
      <div class="welcome_section">
        <h1>
          <?php _e('<span>Welcome to the</span> YT Evolution', 'yt-revolution'); ?>
        </h1>
      </div>
      <?php settings_errors(); ?>
      
      
      <div class="tube-vc-settings">
        <div class="tube-vc-settings-content-col">
          <form action='options.php' method='post' class="section-divider ytvideo">
            <?php
              
              // test if no API keys
              if ( ! self::$youtube_api_key && ! self::$vimeo_api_key ):
                
                // show page to add a new key?
                if ( isset( $_GET['newkey'] ) ):
                  $newkey = filter_var($_GET['newkey'], FILTER_SANITIZE_STRING);    
                  
                  // show specific settings sections based on which type of key
                  switch ( $newkey ):
                    
                    case 'youtube':                    
                      do_settings_sections( 'tube_vc_dashboard_youtube_api_key_section' );
                      break;
                    
                    case 'vimeo':
                      do_settings_sections( 'tube_vc_dashboard_vimeo_api_key_section' );
                      break;
                    
                    case 'twitch':
                      do_settings_sections( 'tube_vc_dashboard_twitch_api_key_section' );
                      break;
                      
                  endswitch;            
                  
                else:
                 
                 // no keys, and not trying to add a key, so show "get started"
                 do_settings_sections( 'tube_vc_dashboard_get_started_section' );
                  
                endif;
                
              else: // has at least one set of API keys
             
                // show the main next sections
                do_settings_sections( 'tube_vc_dashboard_next_steps_section' );
                
              endif; 
              
              ?>
            
          </form>      
        </div>    
        <div class="tube-vc-settings-sidebar-col">
        
          <?php 
          // show the sidebar section
          do_settings_sections( 'tube_vc_dashboard_sidebar_section' );
          ?>
          
        </div>    
      </div>  
    </div>
    <?php
  
  }
  
  // Get started section
  function show_dashboard_get_started_section(){
        
    global $tube_video_curator;
    $current_user = wp_get_current_user();
    
    ?>
      <p style="font-size:1.25em;"><?php _e( sprintf( __('Hi %1$s. To create videos, you&rsquo;ll need an API Key* from YouTube, Vimeo, or Twitch.'), $current_user->first_name ) , 'yt-revolution'); ?></p>
      <p style="font-size:1.25em;"><?php _e('Which site would you like to set up first?', 'yt-revolution'); ?></p>
      <ul style="list-style: disc; padding-left:1.75em;">
        <li>
          <h3 style="margin-bottom:0;">
            <a href="<?php echo admin_url('admin.php?page=yt-evolution-api-keys') ?>"><?php _e('YouTube', 'yt-revolution'); ?></a>
          </h3>
          <p style="margin-top:5px;">
            <?php _e('This usually takes about 3 or 4 minutes if you already have a Google account.', 'yt-revolution'); ?>
          </p>
        </li>
       
      </ul>
      <hr />
      <p><?php _e('* An API Key is a unique code that&rsquo;s required to get videos and other information from these sites.', 'yt-revolution'); ?></p>
      <?php   
  }
  
  
  // YouTube API Key Section
  function show_dashboard_youtube_api_key_section(){
    global $tube_video_curator;
    $current_user = wp_get_current_user();
    
    
    ?>
      
      <p style="font-size:1.25em;"><?php _e( 'If you already have a YouTube API Key, scroll down and enter it now.' , 'yt-revolution'); ?></p>
      <p style="font-size:1.25em;"><?php  _e('Otherwise, here&rsquo;s how to get one.' , 'yt-revolution'); ?></p>
        <?php
        Yt_Evolution::$tube_settings_api_keys -> show_youtube_api_howto();
        ?>
      <div class="card">        
        <?php
        settings_fields( 'tube_vc_youtube_api_settings' );
        do_settings_sections( 'tube_vc_youtube_api_settings' );
        submit_button(__('Save API Key', 'yt-revolution' ) );
        ?>

      </div>
      <?php
  }
  
  
  
  // Vimeo API Key Section
  function show_dashboard_vimeo_api_key_section(){
    global $tube_video_curator;
    $current_user = wp_get_current_user();
    
    
    ?>
      
      <p style="font-size:1.25em;"><?php _e( 'If you already have a Vimeo API Key, scroll down and enter it now.' , 'yt-revolution'); ?></p>
      <p style="font-size:1.25em;"><?php  _e('Otherwise, read on to learn how to get one.' , 'yt-revolution'); ?></p>
      <?php
      Yt_Evolution::$tube_settings_api_keys -> show_vimeo_api_howto();
        ?>
      <div class="card">        
        <?php
      settings_fields( 'tube_vc_vimeo_api_settings' );
      do_settings_sections( 'tube_vc_vimeo_api_settings' );
      submit_button(__('Save ID &amp; Secret', 'yt-revolution' ) );       
        ?>
      </div>
      <?php 
  }
  
  
  
  // Twitch API Key Section
  function show_dashboard_twitch_api_key_section(){
    global $tube_video_curator;
    $current_user = wp_get_current_user();
    
    
    ?>
      
      <p style="font-size:1.25em;"><?php _e( 'If you already have a Twitch API Key, scroll down and enter it now.' , 'yt-revolution'); ?></p>
      <p style="font-size:1.25em;"><?php  _e('Otherwise, read on to learn how to get one.' , 'yt-revolution'); ?></p>
      <?php
      Yt_Evolution::$tube_settings_api_keys -> show_twitch_api_howto();
        ?>
      <div class="card">        
        <?php
      settings_fields( 'tube_vc_twitch_api_settings' );
      do_settings_sections( 'tube_vc_twitch_api_settings' );
      submit_button(__('Save ID &amp; Secret', 'yt-revolution' ) );       
        ?>
      </div>
      <?php 
  }
  
  
      
  // Your Channels section
  function show_dashboard_your_channels_section() { 
    
    global $tube_video_curator;
     
    $this::$sources = $tube_video_curator::$tube_source_manager -> get_sources( array( 'posts_per_page' => 6 ) );
    $class = 'has-1-items';
        if ( count($this::$sources) > 0 ){
            $class = 'has-2-items';
        }
    ?>
    
    <div class="woocommerce-layout">
              <div class="woocommerce-section-header"><h2 class="woocommerce-section-header__title woocommerce-section-header__header-item"><b class="sub_heading">Youtube channels and playlists</b></h2></div>
            
              <div class="woocommerce-dashboard__store-performance">
                  <div role="menu" aria-orientation="horizontal" aria-label="Youtube channels and playlists" aria-describedby="woocommerce-summary-helptext-41">
                      <ul class="woocommerce-summary <?php echo esc_attr($class); ?>">
     
        <?php if ( count($this::$sources) > 0 ): ?>
          
                          <li class="woocommerce-summary__item-container channels_playlist item padding_right">
                              <a href="<?php echo esc_url( YT_EVOLUTION_VIEW_SOURCES_URL ); ?>" class="woocommerce-summary__item" role="menuitem" data-link-type="wc-admin">
                                  <img class="icon" src="<?php echo esc_url( YT_EVOLUTION_URL ); ?>/images/channels.png">
                                  <h3 style="margin-bottom:0;">            
                                    <?php _e('Your Channels &amp; Playlists 1', 'yt-revolution' ); ?>      
                                  </h3>
                                  <p style="margin-top:5px;">
                                    <?php _e('Find videos from your Channels &amp; Playlists, change auto-sync settings, and more.', 'yt-revolution'); ?>
                                  </p>                            
                              </a>
                          </li>
                          
                            <?php endif; ?>    
                          <li class="woocommerce-summary__item-container item padding_left">
                              <a href="<?php echo esc_url( YT_EVOLUTION_FIND_SOURCES_URL ); ?>" class="woocommerce-summary__item" role="menuitem" data-link-type="wc-admin">
                                <img class="icon" src="<?php echo esc_url( YT_EVOLUTION_URL ); ?>/images/channels.png">
                                <h3 style="margin-bottom:0;"><?php _e('Add Channels &amp; Playlists', 'yt-revolution'); ?></h3>
                                <p style="margin-top:5px;">             
                                    <?php _e('Channels and playlists make it&rsquo;s easy to create the latest videos from your favorite sources.', 'yt-revolution'); ?>
                                </p>                             
                              </a>
                          </li>
                      </ul>
                  </div>
              </div>
              
              </div>
              
    <?php
      
  }
  
  
      
  // Show the sidebar  
  function show_dashboard_sidebar_section() {
        
    $this -> show_dashboard_recent_channels_module();  
        
   // $this -> show_dashboard_tube_ad_module();    
    
  }
  
      
  // Channels List Module
  function show_dashboard_recent_channels_module() {
      
    global $tube_video_curator;
   
      // If there are sources, show a box of recently added
    if( !empty($this::$sources) ){
      if ( count($this::$sources) > 0 ): 
      ?>
       <div id="tube-vc-recent-channels-module">
        
        <h3>
          <?php _e( 'Recently added Channels &amp; Playlists', 'yt-revolution' ); ?>
        </h3>
        
        <ul style="list-style: none; padding-left:.25em;">
          
          <?php 
            
            $count = 0;
            
            foreach ( $this::$sources as $source ):
              
              $count++;
                   
              if ( $count > 5 ):
                continue;
              endif;
                    
              $tube_source_link = get_edit_post_link( $source->ID );
              
              $tube_source_site = get_post_meta( $source->ID, 'tube_source_site', true);
              
              $tube_source_site_label = $tube_video_curator->get_external_site_label($tube_source_site);
              
              $tube_feed_type = get_post_meta( $source->ID, 'tube_feed_type', true);
              
              $tube_feed_type_label = $tube_video_curator->get_feed_type_label($tube_feed_type);
              
               $tube_source_thumbnail = get_the_post_thumbnail( $source->ID,  array(50,80))  ;
              ?>
              <li style="overflow:hidden;">
                
                <div style="float:left; margin-right:1em;">
                  <?php echo filter_var($tube_source_thumbnail); ?>
                </div>
                <div style="float:left;">
                  <h3 style="margin:0;">
                    <a href="<?php echo esc_url($tube_source_link); ?>">
                      <?php echo esc_html( $source->post_title ); ?>
                    </a>
                  </h3>
                   
                  <p style="margin-top:5px;">
                    <?php echo esc_html( $tube_feed_type_label ); ?>
                  </p>
                </div>
                
              </li>
            <?php endforeach; ?>
                    
            <?php if ( count($this::$sources) > 5 ): ?>                
              <li>
                <hr />
                <a href="<?php echo esc_url( YT_EVOLUTION_VIEW_SOURCES_URL ); ?>">
                <?php _e('Manage Your Channels &amp; Playlists', 'yt-revolution' ); ?>
              </a>
              </li>
             <?php endif; ?>   
             
        </ul>
        
      </div>
    <?php endif; 
  }
  }
      
  // Tube Ad Module
  function show_dashboard_tube_ad_module() {
    
    ?>
    <div class="tube-vc-find-your-tube-module">
      <a href="https://www.live.tube">
        <img src="<?php echo YT_EVOLUTION_URL; ?>images/find-your-tube-domain-300x250.png" alt="Find Your YT Domain" />
      </a>
    </div>

    <?php
  }
  
  
  // Find Videos section
  function show_dashboard_find_videos_section() {
    
    global $tube_video_curator;
     
    $pending_videos = $tube_video_curator -> get_videos_pending_review();
     
     
    $pending_videos_count = 0;
     $class = 'has-3-items';
      
          
  
     
    if ( $pending_videos ):
      $class = 'has-4-items';
      $pending_videos_count = $pending_videos->found_posts;
       
      $post_type = get_option( 'tube_vc_default_import_post_type' );
       
      $pending_videos_url = admin_url( 'edit.php?post_status=pending&post_type=' . $post_type );

      $pending_videos_label = _n(' Pending Video', ' Pending Videos', $pending_videos_count, 'yt-revolution');
        
    endif;
 
    ?>
         
                        
                      
         <div class="woocommerce-layout">
              <div class="woocommerce-section-header"><h2 class="woocommerce-section-header__title woocommerce-section-header__header-item sub_heading">Search and create new videos:</h2></div>
            
              <div class="woocommerce-dashboard__store-performance">
                  <div role="menu" aria-orientation="horizontal" aria-label="Youtube channels and playlists" aria-describedby="woocommerce-summary-helptext-41">
                      <ul class="woocommerce-summary <?php echo esc_attr($class); ?>">
              
              
             <?php if ( $pending_videos_count ): ?>
              <li class="woocommerce-summary__item-container">
                              <a href="<?php echo esc_url($pending_videos_url); ?>" class="woocommerce-summary__item" role="menuitem" data-link-type="wc-admin">
                                   
                <h3 style="margin-bottom:0;">
                 
                    <?php printf(__('Review %1$s %2$s', 'yt-revolution'), $pending_videos_count, $pending_videos_label); ?>
                
                </h3>
                <p style="margin-top:5px;">
                  <?php _e('Review and approve videos that are set to &#8220Pending Review.&#8221', 'yt-revolution'); ?>
                </p>
                              </a>
              </li>
             <?php endif; ?>
          
            <li class="woocommerce-summary__item-container item padding_right">
                              <a href="<?php echo esc_url( YT_EVOLUTION_ADD_VIA_URL_URL ); ?>" class="woocommerce-summary__item" role="menuitem" data-link-type="wc-admin">
                              <img class="icon" src="<?php echo esc_url( YT_EVOLUTION_URL ); ?>/images/add.png">

              <h3 style="margin-bottom:0;">
              
                  <?php _e('Add Video via URL', 'yt-revolution'); ?>  
                
              </h3>
              <p style="margin-top:5px;">
                <?php _e('Have a specific video you want to turn into a post? This is the tool for you.', 'yt-revolution'); ?>                  
              </p>
                              </a>
            </li>

             <li class="woocommerce-summary__item-container item padding_right">
                              <a href="<?php echo esc_url( YT_EVOLUTION_FIND_VIDEOS_URL ); ?>" class="woocommerce-summary__item" role="menuitem" data-link-type="wc-admin">
                              <img class="icon" src="<?php echo esc_url( YT_EVOLUTION_URL ); ?>/images/search.png">

              <h3 style="margin-bottom:0;">
              
                  <?php _e('Search for Videos', 'yt-revolution'); ?>  
               
              </h3>
              <p style="margin-top:5px;">
                <?php _e('Search for the latest videos for any query you can think of, then create just the videos you like.', 'yt-revolution'); ?>                  
              </p>
                              </a>
            </li>

           <li class="woocommerce-summary__item-container item padding_right">
                              <a href="<?php echo esc_url( YT_EVOLUTION_SKIPPED_VIDEOS_URL ); ?>" class="woocommerce-summary__item" role="menuitem" data-link-type="wc-admin">
                              <img class="icon" src="<?php echo esc_url( YT_EVOLUTION_URL ); ?>/images/forward.png">

              <h3 style="margin-bottom:0;">
                
                  <?php _e('Skipped Videos', 'yt-revolution'); ?>  
               
              </h3>
              <p style="margin-top:5px;">
                <?php _e('See all the videos you&rsquo;ve passed up, in case you want to &#8220;un-skip / delete&#8221; them.', 'yt-revolution'); ?>                  
              </p>
                              </a>
            </li>

            <li class="woocommerce-summary__item-container item padding_right">
                              <a href="<?php echo esc_url( YT_EVOLUTION_SETTINGS_URL ); ?>" class="woocommerce-summary__item" role="menuitem" data-link-type="wc-admin">
                              <img class="icon" src="<?php echo esc_url( YT_EVOLUTION_URL ); ?>/images/display.png">

        <h3 style="margin-bottom:0;">
                           
            <?php _e('Change Display Settings', 'yt-revolution'); ?>
         
        </h3>
        <p style="margin-top:5px;">
          <?php _e('Customize how videos get displayed on your site.', 'yt-revolution'); ?>
        </p>
                              </a>
      </li>
    
       <li class="woocommerce-summary__item-container item">
                              <a href="<?php echo esc_url( YT_EVOLUTION_API_KEYS_URL ); ?>" class="woocommerce-summary__item" role="menuitem" data-link-type="wc-admin">
                              <img class="icon" src="<?php echo esc_url( YT_EVOLUTION_URL ); ?>/images/setting.png">

        <h3 style="margin-bottom:0;">
         
            <?php
              if ( self::$youtube_api_key ):
                
                  _e('Manage YouTube API Key', 'yt-revolution');
                
              else:
                
                  _e('Add a YouTube API Key', 'yt-revolution');
                
              endif;
              ?>
          
         </h3>
        <p style="margin-top:5px;">
          <?php _e('With a YouTube API Key you can search for channels, playlists and more.', 'yt-revolution'); ?>
        </p>
                              </a>
      </li>

        </ul>
                  </div>
              </div>
              
              </div> 

        <?php
  } 
  
  
   
      
  // Update settings section
  function show_dashboard_update_settings_section() {
    ?>
    <div class="woocommerce-layout">
              <div class="woocommerce-section-header"><h2 class="woocommerce-section-header__title woocommerce-section-header__header-item">YT Settings</h2><hr role="presentation"></div>
            
              <div class="woocommerce-dashboard__store-performance">
                  <div role="menu" aria-orientation="horizontal" aria-label="YT Settings and  API Key" aria-describedby="woocommerce-summary-helptext-41">
                      <ul class="woocommerce-summary has-2-items">
      
        <li class="woocommerce-summary__item-container">
                              <a href="<?php echo esc_url( YT_EVOLUTION_SETTINGS_URL ); ?>" class="woocommerce-summary__item" role="menuitem" data-link-type="wc-admin">
                             
        <h3 style="margin-bottom:0;">
                           
            <?php _e('Change Display Settings', 'yt-revolution'); ?>
         
        </h3>
        <p style="margin-top:5px;">
          <?php _e('Customize how videos get displayed on your site.', 'yt-revolution'); ?>
        </p>
                              </a>
      </li>
    
       <li class="woocommerce-summary__item-container">
                              <a href="<?php echo esc_url( YT_EVOLUTION_API_KEYS_URL ); ?>" class="woocommerce-summary__item" role="menuitem" data-link-type="wc-admin">
                             
        <h3 style="margin-bottom:0;">
         
            <?php
              if ( self::$youtube_api_key ):
                
                  _e('Manage YouTube API Key', 'yt-revolution');
                
              else:
                
                  _e('Add a YouTube API Key', 'yt-revolution');
                
              endif;
              ?>
          
         </h3>
        <p style="margin-top:5px;">
          <?php _e('With a YouTube API Key you can search for channels, playlists and more.', 'yt-revolution'); ?>
        </p>
                              </a>
      </li>
        
   </ul>
                  </div>
              </div>
              
              </div> 

    <hr />
  <?php
  } 
  
      
  // Update settings section
  function show_dashboard_manage_api_keys_section() {
    ?>
    <ul style="list-style: disc; padding-left:1.75em;">
      
     
      <li>
        <h3 style="margin-bottom:0;">
          <a href="<?php echo esc_url( YT_EVOLUTION_API_KEYS_URL ); ?>">
            <?php
              if ( self::$youtube_api_key ):
                
                  _e('Manage YouTube API Key', 'yt-revolution');
                
              else:
                
                  _e('Add a YouTube API Key', 'yt-revolution');
                
              endif;
              ?>
          </a>
         </h3>
        <p style="margin-top:5px;">
          <?php _e('With a YouTube API Key you can search for channels, playlists and more.', 'yt-revolution'); ?>
        </p>
      </li>
     
      <li>
        <h3 style="margin-bottom:0;">
          <a href="<?php echo esc_url( YT_EVOLUTION_VIMEO_API_KEYS_URL ); ?>">                  
            <?php 
            if ( self::$vimeo_api_key ):
              
                _e('Manage Vimeo API Key', 'yt-revolution');
              
            else:
              
                _e('Add a Vimeo API Key', 'yt-revolution');
              
            endif;
            ?>
          </a>
        </h3>
        <p style="margin-top:5px;">
          <?php _e('A Vimeo API Key allows you to search for users, channels, and more.', 'yt-revolution'); ?>
        </p>
      </li>
     
      <li>
        <h3 style="margin-bottom:0;">
          <a href="<?php echo esc_url( YT_EVOLUTION_TWITCH_API_KEYS_URL ); ?>">                  
            <?php 
            if ( self::$twitch_api_key ):
              
                _e('Manage Twitch API Key', 'yt-revolution');
              
            else:
              
                _e('Add a Twitch API Key', 'yt-revolution');
              
            endif;
            ?>
          </a>
        </h3>
        <p style="margin-top:5px;">
          <?php _e('Your Twitch API Key allows you to search for channels, videos, and more.', 'yt-revolution'); ?>
        </p>
      </li>
        
    </ul>
  <?php
  } 
  
    
}