| @@ -150,9 +150,9 @@ | ||
| 150 | 150 | ), |
| 151 | 151 | array( |
| 152 | 152 | 'id' => 'ayg_privacy_settings', |
| 153 | 153 | 'title' => __( 'GDPR Compliance', 'automatic-youtube-gallery' ), |
| 154 | - 'description' => '', | |
| 154 | + 'description' => __( 'These options will help with privacy restrictions such as GDPR and the EU Cookie Law.', 'automatic-youtube-gallery' ), | |
| 155 | 155 | 'tab' => 'privacy', |
| 156 | 156 | 'page' => 'ayg_privacy_settings' |
| 157 | 157 | ), |
| 158 | 158 | ); |
| @@ -170,31 +170,20 @@ | ||
| 170 | 170 | // General Settings |
| 171 | 171 | $fields['ayg_general_settings'] = array( |
| 172 | 172 | array( |
| 173 | 173 | 'name' => 'api_key', |
| 174 | - 'label' => __( 'YouTube API Key', 'automatic-youtube-gallery' ), | |
| 175 | - 'description' => sprintf( | |
| 176 | - __( 'A free YouTube Data API key is required to fetch your videos. <a href="%s" target="_blank" rel="noopener noreferrer">Get your API key</a> in just a few minutes.', 'automatic-youtube-gallery' ), | |
| 177 | - 'https://plugins360.com/automatic-youtube-gallery/how-to-get-youtube-api-key/' | |
| 178 | - ), | |
| 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 | 179 | 'type' => 'text', |
| 180 | 180 | 'sanitize_callback' => 'sanitize_text_field' |
| 181 | 181 | ), |
| 182 | 182 | array( |
| 183 | - 'name' => 'force_load_assets', | |
| 184 | - 'label' => __( 'Force Load Plugin Assets', 'automatic-youtube-gallery' ), | |
| 185 | - 'description' => __( 'Force-load the plugin\'s CSS and/or JavaScript files on all front-end pages. Enable this option only if layouts do not render correctly due to page builders or theme conflicts.', 'automatic-youtube-gallery' ), | |
| 186 | - 'type' => 'multicheck', | |
| 187 | - 'options' => array( | |
| 188 | - 'css' => __( 'Force load CSS', 'automatic-youtube-gallery' ), | |
| 189 | - 'js' => __( 'Force load JavaScript', 'automatic-youtube-gallery' ), | |
| 190 | - ), | |
| 191 | - 'sanitize_callback' => 'ayg_sanitize_array' | |
| 192 | - ), | |
| 193 | - array( | |
| 194 | 183 | 'name' => 'lazyload', |
| 195 | - 'label' => __( 'Lazy Load Images / Videos', 'automatic-youtube-gallery' ), | |
| 196 | - 'description' => __( 'Check 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' ), | |
| 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' ), | |
| 197 | 186 | 'type' => 'checkbox', |
| 198 | 187 | 'sanitize_callback' => 'intval' |
| 199 | 188 | ), |
| 200 | 189 | array( |
| @@ -199,9 +188,9 @@ | ||
| 199 | 188 | ), |
| 200 | 189 | array( |
| 201 | 190 | 'name' => 'development_mode', |
| 202 | 191 | 'label' => __( 'Development Mode', 'automatic-youtube-gallery' ), |
| 203 | - 'description' => __( 'Check this option to stop caching API results. We strongly recommend disabling this option when your site is live.', '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' ), | |
| 204 | 193 | 'type' => 'checkbox', |
| 205 | 194 | 'sanitize_callback' => 'intval' |
| 206 | 195 | ) |
| 207 | 196 | ); |
| @@ -261,10 +250,10 @@ | ||
| 261 | 250 | // Player Settings |
| 262 | 251 | $player_settings = array( |
| 263 | 252 | array( |
| 264 | 253 | 'name' => 'player_type', |
| 265 | - 'label' => __( 'Player Type', 'automatic-youtube-gallery' ), | |
| 266 | - 'description' => __( 'Choose how videos are embedded. "Native YouTube Embed" uses YouTube\'s standard iframe, while "Custom Video Player" provides a lightweight, styled player with more control over its appearance.', 'automatic-youtube-gallery' ), | |
| 254 | + 'label' => __( 'Player Type', 'automatic-youtube-gallery' ), | |
| 255 | + 'description' => '', | |
| 267 | 256 | 'type' => 'radio', |
| 268 | 257 | 'options' => array( |
| 269 | 258 | 'youtube' => __( 'Native YouTube Embed', 'automatic-youtube-gallery' ), |
| 270 | 259 | 'custom' => __( 'Custom Video Player', 'automatic-youtube-gallery' ) |
| @@ -284,9 +273,9 @@ | ||
| 284 | 273 | |
| 285 | 274 | $player_settings[] = array( |
| 286 | 275 | 'name' => 'privacy_enhanced_mode', |
| 287 | 276 | 'label' => __( 'Privacy Enhanced Mode', 'automatic-youtube-gallery' ), |
| 288 | - 'description' => __( "Check this option to 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' ), | |
| 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' ), | |
| 289 | 278 | 'type' => 'checkbox', |
| 290 | 279 | 'sanitize_callback' => 'intval' |
| 291 | 280 | ); |
| 292 | 281 | |
| @@ -292,9 +281,9 @@ | ||
| 292 | 281 | |
| 293 | 282 | $player_settings[] = array( |
| 294 | 283 | 'name' => 'origin', |
| 295 | 284 | 'label' => __( 'Extra Player Security', 'automatic-youtube-gallery' ), |
| 296 | - 'description' => __( 'Check this option to 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' ), | |
| 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' ), | |
| 297 | 286 | 'type' => 'checkbox', |
| 298 | 287 | 'sanitize_callback' => 'intval' |
| 299 | 288 | ); |
| 300 | 289 | |
| @@ -315,9 +304,9 @@ | ||
| 315 | 304 | $fields['ayg_privacy_settings'] = array( |
| 316 | 305 | array( |
| 317 | 306 | 'name' => 'cookie_consent', |
| 318 | 307 | 'label' => __( 'Cookie Consent', 'automatic-youtube-gallery' ), |
| 319 | - 'description' => __( 'Check this option to ask for viewer consent to store YouTube cookies before showing videos.', 'automatic-youtube-gallery' ), | |
| 308 | + 'description' => __( 'Ask for viewer consent to store YouTube cookies before showing videos.', 'automatic-youtube-gallery' ), | |
| 320 | 309 | 'type' => 'checkbox', |
| 321 | 310 | 'sanitize_callback' => 'intval' |
| 322 | 311 | ), |
| 323 | 312 | array( |
| @@ -322,16 +311,16 @@ | ||
| 322 | 311 | ), |
| 323 | 312 | array( |
| 324 | 313 | 'name' => 'consent_message', |
| 325 | 314 | 'label' => __( 'Consent Message', 'automatic-youtube-gallery' ), |
| 326 | - 'description' => __( 'The message shown to visitors asking for their permission before YouTube videos and cookies are loaded.', 'automatic-youtube-gallery' ), | |
| 315 | + 'description' => '', | |
| 327 | 316 | 'type' => 'wysiwyg', |
| 328 | 317 | 'sanitize_callback' => 'wp_kses_post' |
| 329 | 318 | ), |
| 330 | 319 | array( |
| 331 | 320 | 'name' => 'button_label', |
| 332 | - 'label' => __( 'Consent Button Label', 'automatic-youtube-gallery' ), | |
| 333 | - 'description' => __( 'Text for the button visitors click to accept and load the video (e.g. "Accept" or "Load video").', 'automatic-youtube-gallery' ), | |
| 321 | + 'label' => __( 'Button Label', 'automatic-youtube-gallery' ), | |
| 322 | + 'description' => '', | |
| 334 | 323 | 'type' => 'text', |
| 335 | 324 | 'sanitize_callback' => 'sanitize_text_field' |
| 336 | 325 | ) |
| 337 | 326 | ); |
| @@ -419,13 +408,13 @@ | ||
| 419 | 408 | * @param array $args Settings field args. |
| 420 | 409 | */ |
| 421 | 410 | public function callback_text( $args ) { |
| 422 | 411 | $value = esc_attr( $this->get_option( $args['id'], $args['section'], '' ) ); |
| 423 | - $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular-text'; | |
| 412 | + $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; | |
| 424 | 413 | $type = isset( $args['type'] ) ? $args['type'] : 'text'; |
| 425 | 414 | $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"'; |
| 426 | 415 | |
| 427 | - $html = sprintf( '<input type="%1$s" class="%2$s" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder ); | |
| 416 | + $html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder ); | |
| 428 | 417 | $html .= $this->get_field_description( $args ); |
| 429 | 418 | |
| 430 | 419 | echo $html; |
| 431 | 420 | } |
| @@ -447,9 +436,9 @@ | ||
| 447 | 436 | * @param array $args Settings field args. |
| 448 | 437 | */ |
| 449 | 438 | public function callback_number( $args ) { |
| 450 | 439 | $value = esc_attr( $this->get_option( $args['id'], $args['section'], 0 ) ); |
| 451 | - $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular-text'; | |
| 440 | + $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; | |
| 452 | 441 | $type = isset( $args['type'] ) ? $args['type'] : 'number'; |
| 453 | 442 | $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"'; |
| 454 | 443 | $min = empty( $args['min'] ) ? '' : ' min="' . $args['min'] . '"'; |
| 455 | 444 | $max = empty( $args['max'] ) ? '' : ' max="' . $args['max'] . '"'; |
| @@ -454,9 +443,9 @@ | ||
| 454 | 443 | $min = empty( $args['min'] ) ? '' : ' min="' . $args['min'] . '"'; |
| 455 | 444 | $max = empty( $args['max'] ) ? '' : ' max="' . $args['max'] . '"'; |
| 456 | 445 | $step = empty( $args['max'] ) ? '' : ' step="' . $args['step'] . '"'; |
| 457 | 446 | |
| 458 | - $html = sprintf( '<input type="%1$s" class="%2$s" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step ); | |
| 447 | + $html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step ); | |
| 459 | 448 | $html .= $this->get_field_description( $args ); |
| 460 | 449 | |
| 461 | 450 | echo $html; |
| 462 | 451 | } |
| @@ -531,9 +520,9 @@ | ||
| 531 | 520 | * @param array $args Settings field args. |
| 532 | 521 | */ |
| 533 | 522 | public function callback_select( $args ) { |
| 534 | 523 | $value = esc_attr( $this->get_option( $args['id'], $args['section'], '' ) ); |
| 535 | - $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular-text'; | |
| 524 | + $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; | |
| 536 | 525 | |
| 537 | 526 | $html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] ); |
| 538 | 527 | foreach ( $args['options'] as $key => $label ) { |
| 539 | 528 | $html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label ); |
| @@ -551,12 +540,12 @@ | ||
| 551 | 540 | * @param array $args Settings field args. |
| 552 | 541 | */ |
| 553 | 542 | public function callback_textarea( $args ) { |
| 554 | 543 | $value = esc_textarea( $this->get_option( $args['id'], $args['section'], '' ) ); |
| 555 | - $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular-text'; | |
| 544 | + $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; | |
| 556 | 545 | $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="'.$args['placeholder'].'"'; |
| 557 | 546 | |
| 558 | - $html = sprintf( '<textarea rows="5" cols="55" class="%1$s" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value ); | |
| 547 | + $html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value ); | |
| 559 | 548 | $html .= $this->get_field_description( $args ); |
| 560 | 549 | |
| 561 | 550 | echo $html; |
| 562 | 551 | } |
| @@ -602,14 +591,14 @@ | ||
| 602 | 591 | * @param array $args Settings field args. |
| 603 | 592 | */ |
| 604 | 593 | public function callback_file( $args ) { |
| 605 | 594 | $value = esc_attr( $this->get_option( $args['id'], $args['section'], '' ) ); |
| 606 | - $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular-text'; | |
| 595 | + $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; | |
| 607 | 596 | $id = $args['section'] . '[' . $args['id'] . ']'; |
| 608 | 597 | $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File', 'automatic-youtube-gallery' ); |
| 609 | 598 | |
| 610 | - $html = sprintf( '<input type="text" class="%1$s ayg-settings-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value ); | |
| 611 | - $html .= '<input type="button" class="button ayg-button-upload-media" value="' . $label . '" />'; | |
| 599 | + $html = sprintf( '<input type="text" class="%1$s-text ayg-settings-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value ); | |
| 600 | + $html .= '<input type="button" class="button ayg-settings-browse" value="' . $label . '" />'; | |
| 612 | 601 | $html .= $this->get_field_description( $args ); |
| 613 | 602 | |
| 614 | 603 | echo $html; |
| 615 | 604 | } |
| @@ -621,11 +610,11 @@ | ||
| 621 | 610 | * @param array $args Settings field args. |
| 622 | 611 | */ |
| 623 | 612 | public function callback_password( $args ) { |
| 624 | 613 | $value = esc_attr( $this->get_option( $args['id'], $args['section'], '' ) ); |
| 625 | - $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular-text'; | |
| 614 | + $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; | |
| 626 | 615 | |
| 627 | - $html = sprintf( '<input type="password" class="%1$s" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value ); | |
| 616 | + $html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value ); | |
| 628 | 617 | $html .= $this->get_field_description( $args ); |
| 629 | 618 | |
| 630 | 619 | echo $html; |
| 631 | 620 | } |
| @@ -637,11 +626,11 @@ | ||
| 637 | 626 | * @param array $args Settings field args. |
| 638 | 627 | */ |
| 639 | 628 | public function callback_color( $args ) { |
| 640 | 629 | $value = esc_attr( $this->get_option( $args['id'], $args['section'], '#ffffff' ) ); |
| 641 | - $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular-text'; | |
| 630 | + $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular'; | |
| 642 | 631 | |
| 643 | - $html = sprintf( '<input type="text" class="%1$s ayg-color-picker" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, '#ffffff' ); | |
| 632 | + $html = sprintf( '<input type="text" class="%1$s-text ayg-color-picker" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, '#ffffff' ); | |
| 644 | 633 | $html .= $this->get_field_description( $args ); |
| 645 | 634 | |
| 646 | 635 | echo $html; |
| 647 | 636 | } |
| @@ -762,14 +751,12 @@ | ||
| 762 | 751 | */ |
| 763 | 752 | public function ajax_callback_delete_cache() { |
| 764 | 753 | check_ajax_referer( 'ayg_ajax_nonce', 'security' ); |
| 765 | 754 | |
| 766 | - if ( ! current_user_can( 'manage_options' ) ) { | |
| 767 | - wp_send_json_error( array( 'message' => __( 'Permission denied.', 'automatic-youtube-gallery' ) ) ); | |
| 768 | - } | |
| 769 | - | |
| 770 | - ayg_delete_cache(); | |
| 755 | + if ( current_user_can( 'manage_options' ) ) { | |
| 756 | + ayg_delete_cache(); | |
| 757 | + } | |
| 771 | 758 | |
| 772 | - wp_send_json_success(); | |
| 759 | + wp_die(); | |
| 773 | 760 | } |
| 774 | 761 | |
| 775 | 762 | } |