PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 2.6.3
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v2.6.3
2.9.1 2.9.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 2.0.0 2.1.0 2.2.0 2.3.2 2.3.3 2.3.5 2.3.6 2.3.8 2.3.9 2.4.3 All 37 releases
← All changes | admin/templates/settings.php +80 -15 1.2.02.6.3 View file →
@@ -7,42 +7,107 @@
7 7 * @since 1.0.0
8 8 *
9 9 * @package Automatic_YouTube_Gallery
10 10 */
11 +
12 +$gallery_settings = get_option( 'ayg_gallery_settings' );
13 +$player_settings = get_option( 'ayg_player_settings' );
14 +
15 +$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->tabs ) ? sanitize_text_field( $_GET['tab'] ) : 'general';
16 +$active_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : '';
17 +$active_theme = $gallery_settings['theme'];
18 +$player_type = isset( $player_settings['player_type'] ) ? $player_settings['player_type'] : 'youtube';
19 +
20 +$sections = array();
21 +foreach ( $this->sections as $section ) {
22 + $tab = $section['tab'];
23 +
24 + if ( ! isset( $sections[ $tab ] ) ) {
25 + $sections[ $tab ] = array();
26 + }
27 +
28 + $sections[ $tab ][] = $section;
29 +}
11 30 ?>
12 31
13 -<div id="ayg-settings" class="wrap ayg-settings ayg-settings-theme-<?php echo esc_attr( $active_theme ); ?>">
14 - <h1><?php esc_html_e( 'Automatic YouTube Gallery', 'automatic-youtube-gallery' ); ?></h1>
32 +<div id="ayg-settings" class="ayg ayg-settings theme-<?php echo esc_attr( $active_theme ); ?> player_type-<?php echo esc_attr( $player_type ); ?> wrap">
33 + <?php settings_errors(); ?>
15 34
16 - <h2 class="nav-tab-wrapper">
35 + <h2 class="nav-tab-wrapper wp-clearfix">
17 36 <?php
18 - $settings_url = admin_url( 'admin.php?page=automatic-youtube-gallery' );
19 -
20 37 foreach ( $this->tabs as $tab => $title ) {
21 - $class = ( $tab == $active_tab ) ? 'nav-tab nav-tab-active' : 'nav-tab';
22 - printf( '<a href="%s" class="%s">%s</a>', esc_url( add_query_arg( 'tab', $tab, $settings_url ) ), $class, $title );
38 + $url = add_query_arg( 'tab', $tab, admin_url( 'admin.php?page=automatic-youtube-gallery-settings' ) );
39 +
40 + foreach ( $sections[ $tab ] as $section ) {
41 + $url = add_query_arg( 'section', $section['id'], $url );
42 +
43 + if ( $tab == $active_tab && empty( $active_section ) ) {
44 + $active_section = $section['id'];
45 + }
46 +
47 + break;
48 + }
49 +
50 + $classes = array( 'nav-tab' );
51 + if ( $tab == $active_tab ) $classes[] = 'nav-tab-active';
52 +
53 + printf(
54 + '<a href="%s" class="%s">%s</a>',
55 + esc_url( $url ),
56 + implode( ' ', $classes ),
57 + esc_html( $title )
58 + );
23 59 }
24 60 ?>
25 61 </h2>
26 62
27 - <?php settings_errors(); ?>
63 + <?php
64 + $section_links = array();
65 +
66 + foreach ( $sections[ $active_tab ] as $section ) {
67 + $page = $section['page'];
68 +
69 + $url = add_query_arg(
70 + array(
71 + 'tab' => $active_tab,
72 + 'section' => $page
73 + ),
74 + admin_url( 'admin.php?page=automatic-youtube-gallery-settings' )
75 + );
76 +
77 + if ( ! isset( $section_links[ $page ] ) ) {
78 + $section_links[ $page ] = sprintf(
79 + '<a href="%s" class="%s">%s</a>',
80 + esc_url( $url ),
81 + ( $section['id'] == $active_section ? 'current' : '' ),
82 + ( isset( $section['menu_title'] ) ? esc_html( $section['menu_title'] ) : esc_html( $section['title'] ) )
83 + );
84 + }
85 + }
86 +
87 + if ( count( $section_links ) > 1 ) : ?>
88 + <ul class="ayg-margin-bottom subsubsub"><li><?php echo implode( ' | </li><li>', $section_links ); ?></li></ul>
89 + <div class="clear"></div>
90 + <?php endif; ?>
28 91
29 92 <form method="post" action="options.php">
30 93 <?php
31 - settings_fields( "ayg_{$active_tab}_settings" );
32 - do_settings_sections( "ayg_{$active_tab}_settings" );
94 + $page_hook = $active_section;
95 +
96 + settings_fields( $page_hook );
97 + do_settings_sections( $page_hook );
33 98 ?>
34 99
35 - <?php if ( 'general' == $active_tab ) : ?>
36 - <table class="form-table" style="margin-top: 0;">
100 + <?php if ( 'general' == $active_tab && 'ayg_general_settings' == $active_section ) : ?>
101 + <table id="ayg-table-delete-cache" class="form-table">
37 102 <tbody>
38 103 <tr>
39 104 <th scope="row">
40 - <label for="ayg-delete-cache-button"><?php esc_html_e( 'Delete Cache', 'automatic-youtube-gallery' ); ?></label>
105 + <label><?php esc_html_e( 'Delete Cache', 'automatic-youtube-gallery' ); ?></label>
41 106 </th>
42 107 <td>
43 - <?php wp_nonce_field( 'ayg_delete_cache_nonce', 'ayg_delete_cache_nonce' ); ?>
44 - <input type="submit" class="button-secondary" name="ayg_delete_cache" value="<?php esc_attr_e( 'Delete Cache', 'automatic-youtube-gallery' ); ?>" />
108 + <input type="submit" id="ayg-button-delete-cache" class="button-secondary" value="<?php esc_attr_e( 'Delete Cache', 'automatic-youtube-gallery' ); ?>" />
109 + <span class="ayg-ajax-status"></span>
45 110 <p class="description"><?php esc_html_e( 'Delete all of the YouTube API data cached by the plugin.', 'automatic-youtube-gallery' ); ?></p>
46 111 </td>
47 112 </tr>
48 113 </tbody>