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
automatic-youtube-gallery / public / templates / thumbnail.php

thumbnail.php in Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels 2.6.4, at public/templates/thumbnail.php

77 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Thumbnail
5 *
6 * @link https://plugins360.com
7 * @since 1.0.0
8 *
9 * @package Automatic_YouTube_Gallery
10 */
11
12 $single_url = ayg_get_single_video_url( $video, $attributes );
13 ?>
14 <div class="ayg-thumbnail" data-id="<?php echo esc_attr( $video->id ); ?>" data-title="<?php echo esc_attr( $video->title ); ?>" data-url="<?php echo esc_attr( $single_url ); ?>">
15 <div class="ayg-thumbnail-media">
16 <?php
17 // Image
18 $image_url = '';
19
20 if ( isset( $video->thumbnails->default ) ) {
21 $image_url = $video->thumbnails->default->url;
22 }
23
24 if ( 75 == (int) $attributes['thumb_ratio'] ) { // 4:3 ( default - 120x90, high - 480x360, standard - 640x480 )
25 if ( isset( $video->thumbnails->high ) ) {
26 $image_url = $video->thumbnails->high->url;
27 }
28
29 if ( isset( $video->thumbnails->standard ) ) {
30 $image_url = $video->thumbnails->standard->url;
31 }
32 }
33
34 if ( 56.25 == (float) $attributes['thumb_ratio'] ) { // 16:9 ( medium - 320x180, maxres - 1280x720 )
35 if ( isset( $video->thumbnails->medium ) ) {
36 $image_url = $video->thumbnails->medium->url;
37 }
38
39 if ( isset( $video->thumbnails->maxres ) ) {
40 $image_url = $video->thumbnails->maxres->url;
41 }
42 }
43
44 $image_url = apply_filters( 'ayg_thumbnail_image_url', $image_url, $video, $attributes );
45
46 echo sprintf(
47 '<img src="%s" class="ayg-thumbnail-image" width="320" height="180" alt="%s" %s/>',
48 esc_url( $image_url ),
49 esc_attr( $video->title ),
50 ( ! empty( $attributes['lazyload'] ) ? 'loading="lazy"' : '' )
51 );
52
53 // Play Icon
54 echo sprintf(
55 '<svg xmlns="http://www.w3.org/2000/svg" fill="white" width="40" height="40" viewBox="0 0 24 24" class="ayg-icon ayg-thumbnail-icon-play" title="%1$s" aria-label="%1$s"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm14.024-.983a1.125 1.125 0 0 1 0 1.966l-5.603 3.113A1.125 1.125 0 0 1 9 15.113V8.887c0-.857.921-1.4 1.671-.983l5.603 3.113Z" clip-rule="evenodd" /></svg>',
56 esc_attr__( 'Play', 'automatic-youtube-gallery' )
57 );
58
59 // Now Playing
60 echo sprintf(
61 '<div class="ayg-thumbnail-now-playing" style="display: none;">%s</div>',
62 esc_html__( 'Now Playing', 'automatic-youtube-gallery' )
63 );
64 ?>
65 </div>
66 <div class="ayg-thumbnail-caption">
67 <?php if ( ! empty( $attributes['thumb_title'] ) ) : ?>
68 <div class="ayg-thumbnail-title"><?php echo esc_html( ayg_trim_words( $video->title, (int) $attributes['thumb_title_length'] ) ); ?></div>
69 <?php endif; ?>
70 <?php if ( ! empty( $attributes['thumb_excerpt'] ) && ! empty( $video->description ) ) : ?>
71 <div class="ayg-thumbnail-excerpt"><?php echo wp_kses_post( ayg_trim_words( $video->description, (int) $attributes['thumb_excerpt_length'] ) ); ?></div>
72 <?php endif; ?>
73 <?php if ( ! empty( $attributes['player_description'] ) && ! empty( $video->description ) ) : ?>
74 <div class="ayg-thumbnail-description" style="display: none;"><?php echo wp_kses_post( ayg_get_player_description( $video, $attributes ) ); ?></div>
75 <?php endif; ?>
76 </div>
77 </div>