| 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_video_page_url = ayg_get_single_video_url( $video, $attributes ); |
| 13 |
?> |
| 14 |
|
| 15 |
<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_video_page_url ); ?>"> |
| 16 |
<div class="ayg-thumbnail-image-wrapper"> |
| 17 |
<?php |
| 18 |
$image_src = ''; |
| 19 |
|
| 20 |
if ( isset( $video->thumbnails->default ) ) { |
| 21 |
$image_src = $video->thumbnails->default->url; |
| 22 |
} |
| 23 |
|
| 24 |
// 4:3 ( default - 120x90, high - 480x360, standard - 640x480 ) |
| 25 |
if ( 75 == (int) $attributes['thumb_ratio'] ) { |
| 26 |
if ( isset( $video->thumbnails->high ) ) { |
| 27 |
$image_src = $video->thumbnails->high->url; |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
// 16:9 ( medium - 320x180, maxres - 1280x720 ) |
| 32 |
if ( 56.25 == (float) $attributes['thumb_ratio'] ) { |
| 33 |
if ( isset( $video->thumbnails->medium ) ) { |
| 34 |
$image_src = $video->thumbnails->medium->url; |
| 35 |
} |
| 36 |
} |
| 37 |
?> |
| 38 |
<img src="<?php echo esc_url( $image_src ); ?>" class="ayg-thumbnail-image" alt="<?php echo esc_attr( $video->title );?>" /> |
| 39 |
|
| 40 |
<svg class="ayg-icon ayg-thumbnail-icon-play" width="32" height="32" viewBox="0 0 32 32" fill="#fff"> |
| 41 |
<path d="M16 0c-8.837 0-16 7.163-16 16s7.163 16 16 16 16-7.163 16-16-7.163-16-16-16zM16 29c-7.18 0-13-5.82-13-13s5.82-13 13-13 13 5.82 13 13-5.82 13-13 13zM12 9l12 7-12 7z"></path> |
| 42 |
</svg> |
| 43 |
|
| 44 |
<div class="ayg-thumbnail-active" style="display: none;"><?php esc_html_e( 'active', 'automatic-youtube-gallery' ); ?></div> |
| 45 |
</div> |
| 46 |
|
| 47 |
<div class="ayg-thumbnail-caption"> |
| 48 |
<?php if ( ! empty( $attributes['thumb_title'] ) ) : ?> |
| 49 |
<div class="ayg-thumbnail-title"><?php echo esc_html( ayg_trim_words( $video->title, (int) $attributes['thumb_title_length'] ) ); ?></div> |
| 50 |
<?php endif; ?> |
| 51 |
|
| 52 |
<?php if ( ! empty( $attributes['thumb_excerpt'] ) && ! empty( $video->description ) ) : ?> |
| 53 |
<div class="ayg-thumbnail-excerpt"><?php echo wp_kses_post( ayg_trim_words( $video->description, (int) $attributes['thumb_excerpt_length'] ) ); ?></div> |
| 54 |
<?php endif; ?> |
| 55 |
|
| 56 |
<?php if ( ! empty( $attributes['player_description'] ) && ! empty( $video->description ) ) : ?> |
| 57 |
<div class="ayg-thumbnail-description" style="display: none;"><?php echo wp_kses_post( ayg_get_player_description( $video ) ); ?></div> |
| 58 |
<?php endif; ?> |
| 59 |
</div> |
| 60 |
</div> |