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 +84 -20 1.1.02.6.3 View file →
@@ -2,49 +2,113 @@
2 2
3 3 /**
4 4 * Settings Form.
5 5 *
6 - * @link https://plugins360.com
7 - * @since 1.0.0
6 + * @link https://plugins360.com
7 + * @since 1.0.0
8 8 *
9 - * @package Automatic_YouTube_Gallery
10 - * @subpackage Automatic_YouTube_Gallery/admin/templates
9 + * @package Automatic_YouTube_Gallery
11 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 +}
12 30 ?>
13 31
14 -<div id="ayg-settings" class="wrap ayg-settings ayg-settings-theme-<?php esc_attr_e( $active_theme ); ?>">
15 - <h1><?php _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(); ?>
16 34
17 - <h2 class="nav-tab-wrapper">
35 + <h2 class="nav-tab-wrapper wp-clearfix">
18 36 <?php
19 - $settings_url = admin_url( 'admin.php?page=automatic-youtube-gallery' );
20 -
21 37 foreach ( $this->tabs as $tab => $title ) {
22 - $class = ( $tab == $active_tab ) ? 'nav-tab nav-tab-active' : 'nav-tab';
23 - 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 + );
24 59 }
25 60 ?>
26 61 </h2>
27 62
28 - <?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; ?>
29 91
30 92 <form method="post" action="options.php">
31 93 <?php
32 - settings_fields( "ayg_{$active_tab}_settings" );
33 - do_settings_sections( "ayg_{$active_tab}_settings" );
94 + $page_hook = $active_section;
95 +
96 + settings_fields( $page_hook );
97 + do_settings_sections( $page_hook );
34 98 ?>
35 99
36 - <?php if ( 'general' == $active_tab ) : ?>
37 - <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">
38 102 <tbody>
39 103 <tr>
40 104 <th scope="row">
41 - <label for="ayg-delete-cache-button"><?php _e( 'Delete Cache', 'automatic-youtube-gallery' ); ?></label>
105 + <label><?php esc_html_e( 'Delete Cache', 'automatic-youtube-gallery' ); ?></label>
42 106 </th>
43 107 <td>
44 - <?php wp_nonce_field( 'ayg_delete_cache_nonce', 'ayg_delete_cache_nonce' ); ?>
45 - <input type="submit" class="button-secondary" name="ayg_delete_cache" value="<?php _e( 'Delete Cache', 'automatic-youtube-gallery' ); ?>" />
46 - <p class="description"><?php _e( 'Delete all of the YouTube API data cached by the plugin.', 'automatic-youtube-gallery' ); ?></p>
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>
110 + <p class="description"><?php esc_html_e( 'Delete all of the YouTube API data cached by the plugin.', 'automatic-youtube-gallery' ); ?></p>
47 111 </td>
48 112 </tr>
49 113 </tbody>
50 114 </table>