PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 2.3.2
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v2.3.2
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 | includes/functions.php +103 -49 2.2.02.3.2 View file →
@@ -100,10 +100,10 @@
100 100
101 101 // Gallery
102 102 $videos = array();
103 103
104 - $gallery_id_from_url = get_query_var( 'ayg_gallery' );
105 - $video_id_from_url = get_query_var( 'ayg_video' );
104 + $gallery_id_from_url = get_query_var( 'ayg_gallery_id' );
105 + $video_id_from_url = get_query_var( 'ayg_video_id' );
106 106
107 107 if ( $attributes['uid'] == $gallery_id_from_url ) {
108 108 $video = ayg_db_get_video( $video_id_from_url );
109 109
@@ -360,40 +360,46 @@
360 360 'api_key' => '',
361 361 'development_mode' => 1
362 362 ),
363 363 'ayg_gallery_settings' => array(
364 - 'theme' => 'classic',
365 - 'columns' => 3,
366 - 'per_page' => 12,
367 - 'thumb_ratio' => 56.25,
368 - 'thumb_title' => 1,
369 - 'thumb_title_length' => 0,
370 - 'thumb_excerpt' => 1,
371 - 'thumb_excerpt_length' => 75,
372 - 'pagination' => 1,
373 - 'pagination_type' => 'more'
364 + 'theme' => 'classic',
365 + 'columns' => 3,
366 + 'per_page' => 12,
367 + 'thumb_ratio' => 56.25,
368 + 'thumb_title' => 1,
369 + 'thumb_title_length' => 0,
370 + 'thumb_excerpt' => 1,
371 + 'thumb_excerpt_length' => 75,
372 + 'pagination' => 1,
373 + 'pagination_type' => 'more',
374 + 'more_button_label' => __( 'Load More', 'automatic-youtube-gallery' ),
375 + 'previous_button_label' => __( 'Previous', 'automatic-youtube-gallery' ),
376 + 'next_button_label' => __( 'Next', 'automatic-youtube-gallery' )
374 377 ),
375 378 'ayg_player_settings' => array(
376 - 'player_ratio' => 56.25,
377 - 'player_title' => 1,
378 - 'player_description' => 1,
379 - 'autoplay' => 0,
380 - 'autoadvance' => 1,
381 - 'loop' => 0,
382 - 'controls' => 1,
383 - 'modestbranding' => 1,
384 - 'cc_load_policy' => 0,
385 - 'iv_load_policy' => 0,
386 - 'hl' => '',
387 - 'cc_lang_pref' => ''
379 + 'player_ratio' => 56.25,
380 + 'player_title' => 1,
381 + 'player_description' => 1,
382 + 'autoplay' => 0,
383 + 'autoadvance' => 1,
384 + 'loop' => 0,
385 + 'muted' => 0,
386 + 'controls' => 1,
387 + 'modestbranding' => 1,
388 + 'cc_load_policy' => 0,
389 + 'iv_load_policy' => 0,
390 + 'hl' => '',
391 + 'cc_lang_pref' => '',
392 + 'privacy_enhanced_mode' => 0,
393 + 'origin' => 0
388 394 ),
389 395 'ayg_livestream_settings' => array(
390 396 'fallback_message' => __( 'Sorry, but the channel is not currently streaming live content. Please check back later.', 'automatic-youtube-gallery' )
391 397 ),
392 - 'ayg_privacy_settings' => array(
393 - 'cookie_consent' => 0,
394 - 'consent_message' => __( 'Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.', 'automatic-youtube-gallery' ),
395 - 'button_label' => __( 'Accept', 'automatic-youtube-gallery' )
398 + 'ayg_privacy_settings' => array(
399 + 'cookie_consent' => 0,
400 + 'consent_message' => __( 'Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.', 'automatic-youtube-gallery' ),
401 + 'button_label' => __( 'Accept', 'automatic-youtube-gallery' )
396 402 )
397 403 );
398 404
399 405 return $defaults;
@@ -506,14 +512,14 @@
506 512 'label' => __( 'Cache Duration', 'automatic-youtube-gallery' ),
507 513 'description' => __( 'Specifies how frequently we should check your YouTube source for new videos/updates.', 'automatic-youtube-gallery' ),
508 514 'type' => 'select',
509 515 'options' => array(
510 - '900' => __( '15 minutes', 'automatic-youtube-gallery' ),
511 - '1800' => __( '30 minutes', 'automatic-youtube-gallery' ),
516 + '900' => __( '15 Minutes', 'automatic-youtube-gallery' ),
517 + '1800' => __( '30 Minutes', 'automatic-youtube-gallery' ),
512 518 '3600' => __( '1 Hour', 'automatic-youtube-gallery' ),
513 519 '86400' => __( '1 Day', 'automatic-youtube-gallery' ),
514 520 '604800' => __( '1 Week', 'automatic-youtube-gallery' ),
515 - '2419200' => __( ' 1Month', 'automatic-youtube-gallery' )
521 + '2419200' => __( '1 Month', 'automatic-youtube-gallery' )
516 522 ),
517 523 'value' => 86400,
518 524 'sanitize_callback' => 'intval'
519 525 )
@@ -544,9 +550,9 @@
544 550 $fields = array(
545 551 array(
546 552 'name' => 'theme',
547 553 'label' => __( 'Select Theme (Layout)', 'automatic-youtube-gallery' ),
548 - 'description' => ( ayg_fs()->is_not_paying() ? sprintf( __( '<a href="%s">Upgrade Pro</a> for more themes (Inline, Popup, Slider, Playlist).', 'automatic-youtube-gallery' ), esc_url( ayg_fs()->get_upgrade_url() ) ) : '' ),
554 + 'description' => ( ayg_fs()->is_not_paying() ? sprintf( __( '<a href="%s">Upgrade Pro</a> for more themes (Popup, Inline, Slider, Playlist).', 'automatic-youtube-gallery' ), esc_url( ayg_fs()->get_upgrade_url() ) ) : '' ),
549 555 'type' => 'select',
550 556 'options' => array(
551 557 'classic' => __( 'Classic', 'automatic-youtube-gallery' )
552 558 ),
@@ -639,8 +645,32 @@
639 645
640 646 ),
641 647 'value' => $gallery_settings['pagination_type'],
642 648 'sanitize_callback' => 'sanitize_key'
649 + ),
650 + array(
651 + 'name' => 'more_button_label',
652 + 'label' => __( 'More Button Label', 'automatic-youtube-gallery' ),
653 + 'description' => __( 'Enter the more button label text.', 'automatic-youtube-gallery' ),
654 + 'type' => 'text',
655 + 'value' => isset( $gallery_settings['more_button_label'] ) ? $gallery_settings['more_button_label'] : __( 'Load More', 'automatic-youtube-gallery' ),
656 + 'sanitize_callback' => 'sanitize_text_field'
657 + ),
658 + array(
659 + 'name' => 'previous_button_label',
660 + 'label' => __( 'Previous Button Label', 'automatic-youtube-gallery' ),
661 + 'description' => __( 'Enter the previous button label text.', 'automatic-youtube-gallery' ),
662 + 'type' => 'text',
663 + 'value' => isset( $gallery_settings['previous_button_label'] ) ? $gallery_settings['previous_button_label'] : __( 'Previous', 'automatic-youtube-gallery' ),
664 + 'sanitize_callback' => 'sanitize_text_field'
665 + ),
666 + array(
667 + 'name' => 'next_button_label',
668 + 'label' => __( 'Next Button Label', 'automatic-youtube-gallery' ),
669 + 'description' => __( 'Enter the next button label text.', 'automatic-youtube-gallery' ),
670 + 'type' => 'text',
671 + 'value' => isset( $gallery_settings['next_button_label'] ) ? $gallery_settings['next_button_label'] : __( 'Next', 'automatic-youtube-gallery' ),
672 + 'sanitize_callback' => 'sanitize_text_field'
643 673 )
644 674 );
645 675
646 676 return apply_filters( 'ayg_gallery_settings_fields', $fields );
@@ -661,9 +691,9 @@
661 691 if ( count( $words_array ) > $words_count ) {
662 692 $words_array[ $words_count ] = '<span class="ayg-player-description-dots">...</span></span><span class="ayg-player-description-more">' . $words_array[ $words_count ];
663 693
664 694 $description = '<span class="ayg-player-description-less">' . implode( ' ', $words_array ) . '</span>';
665 - $description .= '<a href="javascript:void(0);" class="ayg-player-description-toggle-btn">[+] ' . __( 'Show More', 'automatic-youtube-gallery' ) . '</a>';
695 + $description .= '<a href="#" class="ayg-player-description-toggle-btn">[+] ' . __( 'Show More', 'automatic-youtube-gallery' ) . '</a>';
666 696 }
667 697
668 698 $description = nl2br( $description );
669 699 $description = make_clickable( $description );
@@ -731,10 +761,18 @@
731 761 'description' => __( 'In the case of a single video player, plays the initial video again and again. In the case of a gallery, plays the entire list in the gallery and then starts again at the first video.', 'automatic-youtube-gallery' ),
732 762 'type' => 'checkbox',
733 763 'value' => $player_settings['loop'],
734 764 'sanitize_callback' => 'intval'
735 - ),
765 + ),
736 766 array(
767 + 'name' => 'muted',
768 + 'label' => __( 'Muted', 'automatic-youtube-gallery' ),
769 + 'description' => __( 'Check this option to turn OFF the audio output of the video by default.', 'automatic-youtube-gallery' ),
770 + 'type' => 'checkbox',
771 + 'value' => isset( $player_settings['muted'] ) ? $player_settings['muted'] : 0,
772 + 'sanitize_callback' => 'intval'
773 + ),
774 + array(
737 775 'name' => 'controls',
738 776 'label' => __( 'Show Player Controls', 'automatic-youtube-gallery' ),
739 777 'description' => __( 'Uncheck this option to hide the video player controls.', 'automatic-youtube-gallery' ),
740 778 'type' => 'checkbox',
@@ -785,9 +823,25 @@
785 823 ),
786 824 'type' => 'text',
787 825 'value' => $player_settings['cc_lang_pref'],
788 826 'sanitize_callback' => 'sanitize_text_field'
789 - )
827 + ),
828 + array(
829 + 'name' => 'privacy_enhanced_mode',
830 + 'label' => __( 'Privacy Enhanced Mode', 'automatic-youtube-gallery' ),
831 + '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' ),
832 + 'type' => 'checkbox',
833 + 'value' => isset( $player_settings['privacy_enhanced_mode'] ) ? $player_settings['privacy_enhanced_mode'] : 0,
834 + 'sanitize_callback' => 'intval'
835 + ),
836 + array(
837 + 'name' => 'origin',
838 + 'label' => __( 'Extra Player Security', 'automatic-youtube-gallery' ),
839 + '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' ),
840 + 'type' => 'checkbox',
841 + 'value' => isset( $player_settings['origin'] ) ? $player_settings['origin'] : 0,
842 + 'sanitize_callback' => 'intval'
843 + ),
790 844 );
791 845
792 846 return $fields;
793 847 }
@@ -796,14 +850,14 @@
796 850 /**
797 851 * Get a single video page URL.
798 852 *
799 853 * @since 2.1.0
800 - * @param string $video_id YouTube Video ID.
801 - * @param array $args An array of gallery options.
802 - * @return string Single video URL.
854 + * @param stdClass $video YouTube video object.
855 + * @param array $args An array of gallery options.
856 + * @return string Single video URL.
803 857 */
804 -function ayg_get_single_video_url( $video_id, $attributes ) {
805 - return apply_filters( 'ayg_single_video_url', '', $video_id, $attributes );
858 +function ayg_get_single_video_url( $video, $attributes ) {
859 + return apply_filters( 'ayg_single_video_url', '', $video, $attributes );
806 860 }
807 861
808 862 /**
809 863 * Get filtered php template file path.
@@ -833,22 +887,22 @@
833 887 return uniqid() . ++$ayg_uniqid;
834 888 }
835 889
836 890 /**
837 - * Check if Yoast SEO plugin is active.
891 + * Get YouTube domain.
838 892 *
839 - * @since 2.1.0
840 - * @return bool $has_yoast True if the Yoast plugin is installed and active, false if not.
893 + * @since 2.3.0
894 + * @return string YouTube embed domain.
841 895 */
842 -function ayg_has_yoast() {
843 - $has_yoast = false;
896 +function ayg_get_youtube_domain() {
897 + $player_settings = get_option( 'ayg_player_settings' );
844 898
845 - $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
846 - if ( in_array( 'wordpress-seo/wp-seo.php', $active_plugins ) || in_array( 'wordpress-seo-premium/wp-seo-premium.php', $active_plugins ) ) {
847 - $has_yoast = true;
899 + $domain = 'https://www.youtube.com';
900 + if ( isset( $player_settings['privacy_enhanced_mode'] ) && ! empty( $player_settings['privacy_enhanced_mode'] ) ) {
901 + $domain = 'https://www.youtube-nocookie.com';
848 902 }
849 903
850 - return $has_yoast;
904 + return $domain;
851 905 }
852 906
853 907 /**
854 908 * Inserts a new associative array after another associative array key.