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 +170 -63 2.3.62.6.4 View file →
@@ -69,14 +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 - $pagination_type = $gallery_settings['pagination_type'];
78 -
79 73 require_once AYG_DIR . 'admin/templates/settings.php';
80 74 }
81 75
82 76 /**
@@ -122,33 +116,45 @@
122 116 array(
123 117 'id' => 'ayg_general_settings',
124 118 'title' => __( 'General Settings', 'automatic-youtube-gallery' ),
125 119 'description' => '',
126 - 'tab' => 'general'
120 + 'tab' => 'general',
121 + 'page' => 'ayg_general_settings'
127 122 ),
128 123 array(
124 + 'id' => 'ayg_strings_settings',
125 + 'title' => __( 'Button & Link Labels', 'automatic-youtube-gallery' ),
126 + 'description' => '',
127 + 'tab' => 'general',
128 + 'page' => 'ayg_strings_settings'
129 + ),
130 + array(
129 131 'id' => 'ayg_gallery_settings',
130 132 'title' => __( 'Gallery Settings', 'automatic-youtube-gallery' ),
131 133 'description' => '',
132 - 'tab' => 'gallery'
134 + 'tab' => 'gallery',
135 + 'page' => 'ayg_gallery_settings'
133 136 ),
134 137 array(
135 138 'id' => 'ayg_player_settings',
136 139 'title' => __( 'Player Settings', 'automatic-youtube-gallery' ),
137 140 'description' => '',
138 - 'tab' => 'player'
141 + 'tab' => 'player',
142 + 'page' => 'ayg_player_settings'
139 143 ),
140 144 array(
141 145 'id' => 'ayg_livestream_settings',
142 146 'title' => __( 'Livestream Settings', 'automatic-youtube-gallery' ),
143 147 'description' => '',
144 - 'tab' => 'livestream'
148 + 'tab' => 'livestream',
149 + 'page' => 'ayg_livestream_settings'
145 150 ),
146 151 array(
147 152 'id' => 'ayg_privacy_settings',
148 153 'title' => __( 'GDPR Compliance', 'automatic-youtube-gallery' ),
149 154 'description' => __( 'These options will help with privacy restrictions such as GDPR and the EU Cookie Law.', 'automatic-youtube-gallery' ),
150 - 'tab' => 'privacy'
155 + 'tab' => 'privacy',
156 + 'page' => 'ayg_privacy_settings'
151 157 ),
152 158 );
153 159
154 160 return apply_filters( 'ayg_settings_sections', $sections );
@@ -159,62 +165,164 @@
159 165 *
160 166 * @since 1.0.0
161 167 * @return array $fields Setting fields array.
162 168 */
163 - public function get_fields() {
164 - $fields = array(
165 - 'ayg_general_settings' => array(
166 - array(
167 - 'name' => 'api_key',
168 - 'label' => __( 'Youtube API Key', 'automatic-youtube-gallery' ),
169 - 'description' => sprintf(
170 - __( 'Follow <a href="%s" target="_blank">this guide</a> to get your own API key.', 'automatic-youtube-gallery' ),
171 - 'https://plugins360.com/automatic-youtube-gallery/how-to-get-youtube-api-key/'
172 - ),
173 - 'type' => 'text',
174 - 'sanitize_callback' => 'sanitize_text_field'
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/'
175 178 ),
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'
179 + 'type' => 'text',
180 + 'sanitize_callback' => 'sanitize_text_field'
181 + ),
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'
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'
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' )
182 260 ),
261 + 'sanitize_callback' => 'sanitize_text_field'
183 262 ),
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'
193 - )
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'
194 311 ),
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 - )
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'
217 325 )
218 326 );
219 327
220 328 return apply_filters( 'ayg_settings_fields', $fields );
@@ -227,10 +335,9 @@
227 335 */
228 336 public function initialize_settings() {
229 337 // Register settings sections & fields
230 338 foreach ( $this->sections as $section ) {
231 -
232 - $page_hook = "ayg_{$section['tab']}_settings";
339 + $page_hook = isset( $section['page'] ) ? $section['page'] : $section['id'];
233 340
234 341 // Sections
235 342 if ( false == get_option( $section['id'] ) ) {
236 343 add_option( $section['id'] );