PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 2.6.4
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v2.6.4
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/settings.php +197 -55 1.6.42.6.4 View file →
@@ -69,13 +69,8 @@
69 69 *
70 70 * @since 1.0.0
71 71 */
72 72 public function display_settings_form() {
73 - $gallery_settings = get_option( 'ayg_gallery_settings' );
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'];
77 -
78 73 require_once AYG_DIR . 'admin/templates/settings.php';
79 74 }
80 75
81 76 /**
@@ -102,9 +97,10 @@
102 97 $tabs = array(
103 98 'general' => __( 'General', 'automatic-youtube-gallery' ),
104 99 'gallery' => __( 'Gallery', 'automatic-youtube-gallery' ),
105 100 'player' => __( 'Player', 'automatic-youtube-gallery' ),
106 - 'livestream' => __( 'Live Stream', 'automatic-youtube-gallery' )
101 + 'livestream' => __( 'Livestream', 'automatic-youtube-gallery' ),
102 + 'privacy' => __( 'GDPR Compliance', 'automatic-youtube-gallery' )
107 103 );
108 104
109 105 return apply_filters( 'ayg_settings_tabs', $tabs );
110 106 }
@@ -117,27 +113,49 @@
117 113 */
118 114 public function get_sections() {
119 115 $sections = array(
120 116 array(
121 - 'id' => 'ayg_general_settings',
122 - 'title' => __( 'General Settings', 'automatic-youtube-gallery' ),
123 - 'tab' => 'general'
117 + 'id' => 'ayg_general_settings',
118 + 'title' => __( 'General Settings', 'automatic-youtube-gallery' ),
119 + 'description' => '',
120 + 'tab' => 'general',
121 + 'page' => 'ayg_general_settings'
124 122 ),
125 123 array(
126 - 'id' => 'ayg_gallery_settings',
127 - 'title' => __( 'Gallery Settings', 'automatic-youtube-gallery' ),
128 - 'tab' => 'gallery'
124 + 'id' => 'ayg_strings_settings',
125 + 'title' => __( 'Button & Link Labels', 'automatic-youtube-gallery' ),
126 + 'description' => '',
127 + 'tab' => 'general',
128 + 'page' => 'ayg_strings_settings'
129 129 ),
130 130 array(
131 - 'id' => 'ayg_player_settings',
132 - 'title' => __( 'Player Settings', 'automatic-youtube-gallery' ),
133 - 'tab' => 'player'
131 + 'id' => 'ayg_gallery_settings',
132 + 'title' => __( 'Gallery Settings', 'automatic-youtube-gallery' ),
133 + 'description' => '',
134 + 'tab' => 'gallery',
135 + 'page' => 'ayg_gallery_settings'
134 136 ),
135 137 array(
136 - 'id' => 'ayg_livestream_settings',
137 - 'title' => __( 'Live Stream', 'automatic-youtube-gallery' ),
138 - 'tab' => 'livestream'
139 - )
138 + 'id' => 'ayg_player_settings',
139 + 'title' => __( 'Player Settings', 'automatic-youtube-gallery' ),
140 + 'description' => '',
141 + 'tab' => 'player',
142 + 'page' => 'ayg_player_settings'
143 + ),
144 + array(
145 + 'id' => 'ayg_livestream_settings',
146 + 'title' => __( 'Livestream Settings', 'automatic-youtube-gallery' ),
147 + 'description' => '',
148 + 'tab' => 'livestream',
149 + 'page' => 'ayg_livestream_settings'
150 + ),
151 + array(
152 + 'id' => 'ayg_privacy_settings',
153 + 'title' => __( 'GDPR Compliance', 'automatic-youtube-gallery' ),
154 + 'description' => __( 'These options will help with privacy restrictions such as GDPR and the EU Cookie Law.', 'automatic-youtube-gallery' ),
155 + 'tab' => 'privacy',
156 + 'page' => 'ayg_privacy_settings'
157 + ),
140 158 );
141 159
142 160 return apply_filters( 'ayg_settings_sections', $sections );
143 161 }
@@ -147,34 +165,166 @@
147 165 *
148 166 * @since 1.0.0
149 167 * @return array $fields Setting fields array.
150 168 */
151 - public function get_fields() {
152 - $fields = array(
153 - 'ayg_general_settings' => array(
154 - array(
155 - 'name' => 'api_key',
156 - 'label' => __( 'Youtube API Key', 'automatic-youtube-gallery' ),
157 - 'description' => sprintf(
158 - __( 'Follow <a href="%s" target="_blank">this guide</a> to get your own API key.', 'automatic-youtube-gallery' ),
159 - 'https://plugins360.com/automatic-youtube-gallery/how-to-get-youtube-api-key/'
160 - ),
161 - 'type' => 'text',
162 - 'sanitize_callback' => 'sanitize_text_field'
163 - )
169 + public function get_fields() {
170 + // General Settings
171 + $fields['ayg_general_settings'] = array(
172 + array(
173 + 'name' => 'api_key',
174 + 'label' => __( 'Youtube API Key', 'automatic-youtube-gallery' ),
175 + 'description' => sprintf(
176 + __( 'Follow <a href="%s" target="_blank" rel="noopener noreferrer">this guide</a> to get your own API key.', 'automatic-youtube-gallery' ),
177 + 'https://plugins360.com/automatic-youtube-gallery/how-to-get-youtube-api-key/'
178 + ),
179 + 'type' => 'text',
180 + 'sanitize_callback' => 'sanitize_text_field'
164 181 ),
165 - 'ayg_gallery_settings' => ayg_get_gallery_settings_fields(),
166 - 'ayg_player_settings' => ayg_get_player_settings_fields(),
167 - 'ayg_livestream_settings' => array(
168 - array(
169 - 'name' => 'fallback_message',
170 - 'label' => __( 'Fallback Message', 'automatic-youtube-gallery' ),
171 - 'description' => __( 'Enter your Custom HTML message that should be displayed when there is no video streaming live.', 'automatic-youtube-gallery' ),
172 - 'type' => 'wysiwyg',
173 - 'sanitize_callback' => 'wp_kses_post'
174 - )
182 + array(
183 + 'name' => 'lazyload',
184 + 'label' => __( 'Lazyload Images / Videos', 'automatic-youtube-gallery' ),
185 + 'description' => __( 'Enable this option to lazy load images and videos added by the plugin to enhance page load speed and performance. If you experience any issues with content display, try disabling this option.', 'automatic-youtube-gallery' ),
186 + 'type' => 'checkbox',
187 + 'sanitize_callback' => 'intval'
188 + ),
189 + array(
190 + 'name' => 'development_mode',
191 + 'label' => __( 'Development Mode', 'automatic-youtube-gallery' ),
192 + 'description' => __( 'Does not cache API results when checked. We strongly recommend disabling this option when your site is live.', 'automatic-youtube-gallery' ),
193 + 'type' => 'checkbox',
194 + 'sanitize_callback' => 'intval'
175 195 )
196 + );
197 +
198 + // Strings Settings
199 + $fields['ayg_strings_settings'] = array(
200 + array(
201 + 'name' => 'more_button_label',
202 + 'label' => __( 'More Button Label', 'automatic-youtube-gallery' ),
203 + 'description' => __( 'Text for the "Load More" button when pagination type is set to "More Button".', 'automatic-youtube-gallery' ),
204 + 'type' => 'text',
205 + 'sanitize_callback' => 'sanitize_text_field'
206 + ),
207 + array(
208 + 'name' => 'previous_button_label',
209 + 'label' => __( 'Previous Button Label', 'automatic-youtube-gallery' ),
210 + 'description' => __( 'Text for the "Previous" button when pagination type is set to "Pager".', 'automatic-youtube-gallery' ),
211 + 'type' => 'text',
212 + 'sanitize_callback' => 'sanitize_text_field'
213 + ),
214 + array(
215 + 'name' => 'next_button_label',
216 + 'label' => __( 'Next Button Label', 'automatic-youtube-gallery' ),
217 + 'description' => __( 'Text for the "Next" button when pagination type is set to "Pager".', 'automatic-youtube-gallery' ),
218 + 'type' => 'text',
219 + 'sanitize_callback' => 'sanitize_text_field'
220 + ),
221 + array(
222 + 'name' => 'show_more_label',
223 + 'label' => __( 'Show More Label', 'automatic-youtube-gallery' ),
224 + 'description' => __( 'Text for the "Show More" link that expands the video description below the player.', 'automatic-youtube-gallery' ),
225 + 'type' => 'text',
226 + 'sanitize_callback' => 'sanitize_text_field'
227 + ),
228 + array(
229 + 'name' => 'show_less_label',
230 + 'label' => __( 'Show Less Label', 'automatic-youtube-gallery' ),
231 + 'description' => __( 'Text for the "Show Less" link that collapses the video description below the player.', 'automatic-youtube-gallery' ),
232 + 'type' => 'text',
233 + 'sanitize_callback' => 'sanitize_text_field'
234 + )
235 + );
236 +
237 + // Gallery Settings
238 + $gallery_settings = ayg_get_gallery_settings_fields();
239 +
240 + $gallery_settings[] = array(
241 + 'name' => 'scroll_top_offset',
242 + 'label' => __( 'Page Scroll Top Offset', 'automatic-youtube-gallery' ),
243 + 'description' => __( 'Set the top offset in pixels for scrolling to the video player after a thumbnail is clicked. Enter <code>-1</code> to disable automatic scrolling.', 'automatic-youtube-gallery' ),
244 + 'type' => 'text',
245 + 'sanitize_callback' => 'ayg_sanitize_int'
176 246 );
247 +
248 + $fields['ayg_gallery_settings'] = $gallery_settings;
249 +
250 + // Player Settings
251 + $player_settings = array(
252 + array(
253 + 'name' => 'player_type',
254 + 'label' => __( 'Player Type', 'automatic-youtube-gallery' ),
255 + 'description' => '',
256 + 'type' => 'radio',
257 + 'options' => array(
258 + 'youtube' => __( 'Native YouTube Embed', 'automatic-youtube-gallery' ),
259 + 'custom' => __( 'Custom Video Player', 'automatic-youtube-gallery' )
260 + ),
261 + 'sanitize_callback' => 'sanitize_text_field'
262 + ),
263 + array(
264 + 'name' => 'player_color',
265 + 'label' => __( 'Player Color', 'automatic-youtube-gallery' ),
266 + 'description' => __( 'Set the theme color for your video player.', 'automatic-youtube-gallery' ),
267 + 'type' => 'color',
268 + 'sanitize_callback' => 'sanitize_text_field'
269 + )
270 + );
271 +
272 + $player_settings = array_merge( $player_settings, ayg_get_player_settings_fields() );
273 +
274 + $player_settings[] = array(
275 + 'name' => 'privacy_enhanced_mode',
276 + 'label' => __( 'Privacy Enhanced Mode', 'automatic-youtube-gallery' ),
277 + 'description' => __( "Prevent YouTube from leaving tracking cookies on your visitor's browsers unless they actually play the videos. Please uncheck this option if you see errors while testing your playlist embeds or watching your videos on mobile.", 'automatic-youtube-gallery' ),
278 + 'type' => 'checkbox',
279 + 'sanitize_callback' => 'intval'
280 + );
281 +
282 + $player_settings[] = array(
283 + 'name' => 'origin',
284 + 'label' => __( 'Extra Player Security', 'automatic-youtube-gallery' ),
285 + 'description' => __( 'Add site origin information with each embed code as an extra security measure. In YouTube\'s own words, checking this option "protects against malicious third-party JavaScript being injected into your page and hijacking control of your YouTube player."', 'automatic-youtube-gallery' ),
286 + 'type' => 'checkbox',
287 + 'sanitize_callback' => 'intval'
288 + );
289 +
290 + $fields['ayg_player_settings'] = $player_settings;
291 +
292 + // Livestream Settings
293 + $fields['ayg_livestream_settings'] = array(
294 + array(
295 + 'name' => 'fallback_message',
296 + 'label' => __( 'Fallback Message', 'automatic-youtube-gallery' ),
297 + 'description' => __( 'Enter your Custom HTML message that should be displayed when there is no video streaming live.', 'automatic-youtube-gallery' ),
298 + 'type' => 'wysiwyg',
299 + 'sanitize_callback' => 'wp_kses_post'
300 + )
301 + );
302 +
303 + // Privacy Settings
304 + $fields['ayg_privacy_settings'] = array(
305 + array(
306 + 'name' => 'cookie_consent',
307 + 'label' => __( 'Cookie Consent', 'automatic-youtube-gallery' ),
308 + 'description' => __( 'Ask for viewer consent to store YouTube cookies before showing videos.', 'automatic-youtube-gallery' ),
309 + 'type' => 'checkbox',
310 + 'sanitize_callback' => 'intval'
311 + ),
312 + array(
313 + 'name' => 'consent_message',
314 + 'label' => __( 'Consent Message', 'automatic-youtube-gallery' ),
315 + 'description' => '',
316 + 'type' => 'wysiwyg',
317 + 'sanitize_callback' => 'wp_kses_post'
318 + ),
319 + array(
320 + 'name' => 'button_label',
321 + 'label' => __( 'Button Label', 'automatic-youtube-gallery' ),
322 + 'description' => '',
323 + 'type' => 'text',
324 + 'sanitize_callback' => 'sanitize_text_field'
325 + )
326 + );
177 327
178 328 return apply_filters( 'ayg_settings_fields', $fields );
179 329 }
180 330
@@ -185,10 +335,9 @@
185 335 */
186 336 public function initialize_settings() {
187 337 // Register settings sections & fields
188 338 foreach ( $this->sections as $section ) {
189 -
190 - $page_hook = "ayg_{$section['tab']}_settings";
339 + $page_hook = isset( $section['page'] ) ? $section['page'] : $section['id'];
191 340
192 341 // Sections
193 342 if ( false == get_option( $section['id'] ) ) {
194 343 add_option( $section['id'] );
@@ -245,9 +394,9 @@
245 394 */
246 395 public function settings_section_callback( $args ) {
247 396 foreach ( $this->sections as $section ) {
248 397 if ( $section['id'] == $args['id'] ) {
249 - printf( '<div class="inside">%s</div>', sanitize_text_field( $section['description'] ) );
398 + printf( '<div class="inside">%s</div>', wp_kses_post( $section['description'] ) );
250 399 break;
251 400 }
252 401 }
253 402 }
@@ -600,21 +749,14 @@
600 749 *
601 750 * @since 1.3.0
602 751 */
603 752 public function ajax_callback_delete_cache() {
604 - check_ajax_referer( 'ayg_admin_ajax_nonce', 'security' );
753 + check_ajax_referer( 'ayg_ajax_nonce', 'security' );
605 754
606 - // Get the current list of transients
607 - $transient_keys = get_option( 'ayg_transient_keys', array() );
608 -
609 - // For each key, delete that transient
610 - foreach ( $transient_keys as $key ) {
611 - delete_transient( $key );
755 + if ( current_user_can( 'manage_options' ) ) {
756 + ayg_delete_cache();
612 757 }
613 758
614 - // Reset our DB value
615 - update_option( 'ayg_transient_keys', array() );
616 -
617 759 wp_die();
618 760 }
619 761
620 762 }