PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 2.6.3
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v2.6.3
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 / player.php

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

62 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Player
5 *
6 * @link https://plugins360.com
7 * @since 2.5.0
8 *
9 * @package Automatic_YouTube_Gallery
10 */
11
12 $player_ratio = ! empty( $attributes['player_ratio'] ) ? (float) $attributes['player_ratio'] : '56.25';
13
14 $video_attributes = array(
15 'src' => esc_url( ayg_get_youtube_embed_url( $video->id, $attributes ) ),
16 'ratio' => $player_ratio
17 );
18
19 if ( isset( $video->title ) ) {
20 $video_attributes['title'] = esc_attr( $video->title );
21 }
22
23 if ( isset( $attributes['poster'] ) && ! empty( $attributes['poster'] ) ) {
24 $video_attributes['poster'] = $attributes['poster'];
25 } else {
26 if ( isset( $video->thumbnails->default ) ) {
27 $video_attributes['poster'] = $video->thumbnails->default->url;
28 }
29
30 if ( 75 == $player_ratio ) { // 4:3 ( default - 120x90, high - 480x360, standard - 640x480 )
31 if ( isset( $video->thumbnails->high ) ) {
32 $video_attributes['poster'] = $video->thumbnails->high->url;
33 }
34
35 if ( isset( $video->thumbnails->standard ) ) {
36 $video_attributes['poster'] = $video->thumbnails->standard->url;
37 }
38 }
39
40 if ( 56.25 == $player_ratio ) { // 16:9 ( medium - 320x180, maxres - 1280x720 )
41 if ( isset( $video->thumbnails->medium ) ) {
42 $video_attributes['poster'] = $video->thumbnails->medium->url;
43 }
44
45 if ( isset( $video->thumbnails->maxres ) ) {
46 $video_attributes['poster'] = $video->thumbnails->maxres->url;
47 }
48 }
49 }
50
51 if ( isset( $video_attributes['poster'] ) ) {
52 $video_attributes['poster'] = esc_url( $video_attributes['poster'] );
53 }
54
55 if ( ! empty( $attributes['lazyload'] ) ) {
56 $video_attributes['lazyload'] = '';
57 }
58
59 $player_html = sprintf( '<ayg-player %s></ayg-player>', ayg_combine_video_attributes( $video_attributes ) );
60
61 // Allow filtering before output
62 echo apply_filters( 'the_ayg_player', $player_html, $video, $attributes );