| @@ -71,10 +71,11 @@ | ||
| 71 | 71 | */ |
| 72 | 72 | public function display_settings_form() { |
| 73 | 73 | $gallery_settings = get_option( 'ayg_gallery_settings' ); |
| 74 | 74 | |
| 75 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->tabs ) ? sanitize_text_field( $_GET['tab'] ) : 'general'; | |
| 76 | - $active_theme = $gallery_settings['theme']; | |
| 75 | + $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->tabs ) ? sanitize_text_field( $_GET['tab'] ) : 'general'; | |
| 76 | + $active_theme = $gallery_settings['theme']; | |
| 77 | + $pagination_type = $gallery_settings['pagination_type']; | |
| 77 | 78 | |
| 78 | 79 | require_once AYG_DIR . 'admin/templates/settings.php'; |
| 79 | 80 | } |
| 80 | 81 | |
| @@ -99,11 +100,13 @@ | ||
| 99 | 100 | * @return array $tabs Setting tabs array. |
| 100 | 101 | */ |
| 101 | 102 | public function get_tabs() { |
| 102 | 103 | $tabs = array( |
| 103 | - 'general' => __( 'General', 'automatic-youtube-gallery' ), | |
| 104 | - 'gallery' => __( 'Gallery', 'automatic-youtube-gallery' ), | |
| 105 | - 'player' => __( 'Player', 'automatic-youtube-gallery' ) | |
| 104 | + 'general' => __( 'General', 'automatic-youtube-gallery' ), | |
| 105 | + 'gallery' => __( 'Gallery', 'automatic-youtube-gallery' ), | |
| 106 | + 'player' => __( 'Player', 'automatic-youtube-gallery' ), | |
| 107 | + 'livestream' => __( 'Livestream', 'automatic-youtube-gallery' ), | |
| 108 | + 'privacy' => __( 'GDPR Compliance', 'automatic-youtube-gallery' ) | |
| 106 | 109 | ); |
| 107 | 110 | |
| 108 | 111 | return apply_filters( 'ayg_settings_tabs', $tabs ); |
| 109 | 112 | } |
| @@ -116,22 +119,37 @@ | ||
| 116 | 119 | */ |
| 117 | 120 | public function get_sections() { |
| 118 | 121 | $sections = array( |
| 119 | 122 | array( |
| 120 | - 'id' => 'ayg_general_settings', | |
| 121 | - 'title' => __( 'General Settings', 'automatic-youtube-gallery' ), | |
| 122 | - 'tab' => 'general' | |
| 123 | + 'id' => 'ayg_general_settings', | |
| 124 | + 'title' => __( 'General Settings', 'automatic-youtube-gallery' ), | |
| 125 | + 'description' => '', | |
| 126 | + 'tab' => 'general' | |
| 123 | 127 | ), |
| 124 | 128 | array( |
| 125 | - 'id' => 'ayg_gallery_settings', | |
| 126 | - 'title' => __( 'Gallery Settings', 'automatic-youtube-gallery' ), | |
| 127 | - 'tab' => 'gallery' | |
| 129 | + 'id' => 'ayg_gallery_settings', | |
| 130 | + 'title' => __( 'Gallery Settings', 'automatic-youtube-gallery' ), | |
| 131 | + 'description' => '', | |
| 132 | + 'tab' => 'gallery' | |
| 128 | 133 | ), |
| 129 | 134 | array( |
| 130 | - 'id' => 'ayg_player_settings', | |
| 131 | - 'title' => __( 'Player Settings', 'automatic-youtube-gallery' ), | |
| 132 | - 'tab' => 'player' | |
| 133 | - ) | |
| 135 | + 'id' => 'ayg_player_settings', | |
| 136 | + 'title' => __( 'Player Settings', 'automatic-youtube-gallery' ), | |
| 137 | + 'description' => '', | |
| 138 | + 'tab' => 'player' | |
| 139 | + ), | |
| 140 | + array( | |
| 141 | + 'id' => 'ayg_livestream_settings', | |
| 142 | + 'title' => __( 'Livestream Settings', 'automatic-youtube-gallery' ), | |
| 143 | + 'description' => '', | |
| 144 | + 'tab' => 'livestream' | |
| 145 | + ), | |
| 146 | + array( | |
| 147 | + 'id' => 'ayg_privacy_settings', | |
| 148 | + 'title' => __( 'GDPR Compliance', 'automatic-youtube-gallery' ), | |
| 149 | + 'description' => __( 'These options will help with privacy restrictions such as GDPR and the EU Cookie Law.', 'automatic-youtube-gallery' ), | |
| 150 | + 'tab' => 'privacy' | |
| 151 | + ), | |
| 134 | 152 | ); |
| 135 | 153 | |
| 136 | 154 | return apply_filters( 'ayg_settings_sections', $sections ); |
| 137 | 155 | } |
| @@ -153,12 +171,51 @@ | ||
| 153 | 171 | 'https://plugins360.com/automatic-youtube-gallery/how-to-get-youtube-api-key/' |
| 154 | 172 | ), |
| 155 | 173 | 'type' => 'text', |
| 156 | 174 | 'sanitize_callback' => 'sanitize_text_field' |
| 175 | + ), | |
| 176 | + array( | |
| 177 | + 'name' => 'development_mode', | |
| 178 | + 'label' => __( 'Development Mode', 'automatic-youtube-gallery' ), | |
| 179 | + 'description' => __( 'Does not cache API results when checked. We strongly recommend disabling this option when your site is live.', 'automatic-youtube-gallery' ), | |
| 180 | + 'type' => 'checkbox', | |
| 181 | + 'sanitize_callback' => 'intval' | |
| 182 | + ), | |
| 183 | + ), | |
| 184 | + 'ayg_gallery_settings' => ayg_get_gallery_settings_fields(), | |
| 185 | + 'ayg_player_settings' => ayg_get_player_settings_fields(), | |
| 186 | + 'ayg_livestream_settings' => array( | |
| 187 | + array( | |
| 188 | + 'name' => 'fallback_message', | |
| 189 | + 'label' => __( 'Fallback Message', 'automatic-youtube-gallery' ), | |
| 190 | + 'description' => __( 'Enter your Custom HTML message that should be displayed when there is no video streaming live.', 'automatic-youtube-gallery' ), | |
| 191 | + 'type' => 'wysiwyg', | |
| 192 | + 'sanitize_callback' => 'wp_kses_post' | |
| 157 | 193 | ) |
| 158 | 194 | ), |
| 159 | - 'ayg_gallery_settings' => ayg_get_gallery_settings_fields(), | |
| 160 | - 'ayg_player_settings' => ayg_get_player_settings_fields() | |
| 195 | + 'ayg_privacy_settings' => array( | |
| 196 | + array( | |
| 197 | + 'name' => 'cookie_consent', | |
| 198 | + 'label' => __( 'Cookie Consent', 'automatic-youtube-gallery' ), | |
| 199 | + 'description' => __( 'Ask for viewer consent to store YouTube cookies before showing videos.', 'automatic-youtube-gallery' ), | |
| 200 | + 'type' => 'checkbox', | |
| 201 | + 'sanitize_callback' => 'intval' | |
| 202 | + ), | |
| 203 | + array( | |
| 204 | + 'name' => 'consent_message', | |
| 205 | + 'label' => __( 'Consent Message', 'automatic-youtube-gallery' ), | |
| 206 | + 'description' => '', | |
| 207 | + 'type' => 'wysiwyg', | |
| 208 | + 'sanitize_callback' => 'wp_kses_post' | |
| 209 | + ), | |
| 210 | + array( | |
| 211 | + 'name' => 'button_label', | |
| 212 | + 'label' => __( 'Button Label', 'automatic-youtube-gallery' ), | |
| 213 | + 'description' => '', | |
| 214 | + 'type' => 'text', | |
| 215 | + 'sanitize_callback' => 'sanitize_text_field' | |
| 216 | + ) | |
| 217 | + ) | |
| 161 | 218 | ); |
| 162 | 219 | |
| 163 | 220 | return apply_filters( 'ayg_settings_fields', $fields ); |
| 164 | 221 | } |
| @@ -230,9 +287,9 @@ | ||
| 230 | 287 | */ |
| 231 | 288 | public function settings_section_callback( $args ) { |
| 232 | 289 | foreach ( $this->sections as $section ) { |
| 233 | 290 | if ( $section['id'] == $args['id'] ) { |
| 234 | - printf( '<div class="inside">%s</div>', sanitize_text_field( $section['description'] ) ); | |
| 291 | + printf( '<div class="inside">%s</div>', wp_kses_post( $section['description'] ) ); | |
| 235 | 292 | break; |
| 236 | 293 | } |
| 237 | 294 | } |
| 238 | 295 | } |
| @@ -585,21 +642,11 @@ | ||
| 585 | 642 | * |
| 586 | 643 | * @since 1.3.0 |
| 587 | 644 | */ |
| 588 | 645 | public function ajax_callback_delete_cache() { |
| 589 | - check_ajax_referer( 'ayg_admin_ajax_nonce', 'security' ); | |
| 646 | + check_ajax_referer( 'ayg_ajax_nonce', 'security' ); | |
| 590 | 647 | |
| 591 | - // Get the current list of transients | |
| 592 | - $transient_keys = get_option( 'ayg_transient_keys', array() ); | |
| 593 | - | |
| 594 | - // For each key, delete that transient | |
| 595 | - foreach ( $transient_keys as $key ) { | |
| 596 | - delete_transient( $key ); | |
| 597 | - } | |
| 598 | - | |
| 599 | - // Reset our DB value | |
| 600 | - update_option( 'ayg_transient_keys', array() ); | |
| 601 | - | |
| 648 | + ayg_delete_cache(); | |
| 602 | 649 | wp_die(); |
| 603 | 650 | } |
| 604 | 651 | |
| 605 | 652 | } |