| @@ -7,49 +7,33 @@ | ||
| 7 | 7 | * @since 1.3.0 |
| 8 | 8 | * |
| 9 | 9 | * @package Automatic_YouTube_Gallery |
| 10 | 10 | */ |
| 11 | +?> | |
| 11 | 12 | |
| 12 | -// Exit if accessed directly | |
| 13 | -if ( ! defined( 'WPINC' ) ) { | |
| 14 | - die; | |
| 15 | -} | |
| 13 | +<div id="ayg-dashboard" class="wrap about-wrap full-width-layout ayg-dashboard"> | |
| 14 | + <h1><?php esc_html_e( 'Welcome to "Automatic YouTube Gallery"', 'automatic-youtube-gallery' ); ?></h1> | |
| 16 | 15 | |
| 17 | -$general_settings = ayg_get_option( 'ayg_general_settings' ); | |
| 16 | + <p class="about-text"> | |
| 17 | + <?php esc_html_e( 'Create responsive, modern & dynamic video galleries by simply adding a YouTube USERNAME, CHANNEL, PLAYLIST, SEARCH KEYWORDS, or a custom list of YouTube URLs.', 'automatic-youtube-gallery' ); ?> | |
| 18 | + </p> | |
| 18 | 19 | |
| 19 | -$file = 'api-key'; | |
| 20 | + <div class="wp-badge"><?php printf( esc_html__( 'Version %s', 'automatic-youtube-gallery' ), AYG_VERSION ); ?></div> | |
| 20 | 21 | |
| 21 | -if ( ! empty( $general_settings['api_key'] ) ) { | |
| 22 | - $action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ''; | |
| 22 | + <h2 class="nav-tab-wrapper wp-clearfix"> | |
| 23 | + <?php | |
| 24 | + $plugin_url = admin_url( 'admin.php?page=automatic-youtube-gallery' ); | |
| 23 | 25 | |
| 24 | - if ( 'new' === $action || 'edit' === $action ) { | |
| 25 | - $file = 'gallery-form'; | |
| 26 | - } else { | |
| 27 | - $file = 'gallery-list'; | |
| 28 | - } | |
| 29 | -} | |
| 30 | -?> | |
| 26 | + foreach ( $tabs as $tab => $title ) { | |
| 27 | + $class = ( $tab == $active_tab ) ? 'nav-tab nav-tab-active' : 'nav-tab'; | |
| 28 | + printf( '<a href="%s" class="%s">%s</a>', esc_url( add_query_arg( 'tab', $tab, $plugin_url ) ), $class, $title ); | |
| 29 | + } | |
| 30 | + ?> | |
| 31 | + </h2> | |
| 31 | 32 | |
| 32 | -<div id="ayg-dashboard" class="ayg ayg-dashboard clear"> | |
| 33 | - <?php if ( 'gallery-form' !== $file ) : ?> | |
| 34 | - <div class="wrap about-wrap"> | |
| 35 | - <h1><?php esc_html_e( 'Automatic YouTube Gallery', 'automatic-youtube-gallery' ); ?></h1> | |
| 36 | - | |
| 37 | - <p class="about-text"> | |
| 38 | - <?php esc_html_e( 'Build beautiful, responsive YouTube galleries from a Channel, Playlist, Username, Search, Livestream, Single Video, or a custom list of videos — then keep them automatically up to date with scheduled imports.', 'automatic-youtube-gallery' ); ?> | |
| 39 | - </p> | |
| 40 | - | |
| 41 | - <div class="wp-badge"><?php printf( esc_html__( 'Version %s', 'automatic-youtube-gallery' ), AYG_VERSION ); ?></div> | |
| 42 | - | |
| 43 | - <?php if ( 'gallery-list' === $file ) : ?> | |
| 44 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=automatic-youtube-gallery&action=new' ) ); ?>" class="ayg-button button button-primary button-hero"> | |
| 45 | - <svg xmlns="http://www.w3.org/2000/svg" fill="none" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> | |
| 46 | - <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z" /> | |
| 47 | - </svg> | |
| 48 | - <?php esc_html_e( 'Add New Gallery', 'automatic-youtube-gallery' ); ?> | |
| 49 | - </a> | |
| 50 | - <?php endif; ?> | |
| 51 | - </div> | |
| 52 | - <?php endif; ?> | |
| 53 | - | |
| 54 | - <?php require_once AYG_DIR . "admin/templates/{$file}.php"; ?> | |
| 33 | + <?php | |
| 34 | + if ( 'dashboard' == $active_tab ) { | |
| 35 | + $file = ! empty( $general_settings['api_key'] ) ? 'builder' : 'api-key'; | |
| 36 | + require_once AYG_DIR . "admin/templates/{$file}.php"; | |
| 37 | + } | |
| 38 | + ?> | |
| 55 | 39 | </div> |