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

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

81 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Theme: Classic.
5 *
6 * @link https://plugins360.com
7 * @since 1.0.0
8 *
9 * @package Automatic_YouTube_Gallery
10 */
11
12 $player_ratio = ! empty( $attributes['player_ratio'] ) ? (float) $attributes['player_ratio'] : '56.25';
13
14 $params = array(
15 'uid' => sanitize_text_field( $attributes['uid'] ),
16 'autoplay' => (int) $attributes['autoplay'],
17 'loop' => (int) $attributes['loop'],
18 'muted' => (int) $attributes['muted'],
19 'controls' => (int) $attributes['controls'],
20 'modestbranding' => (int) $attributes['modestbranding'],
21 'cc_load_policy' => (int) $attributes['cc_load_policy'],
22 'iv_load_policy' => (int) $attributes['iv_load_policy'],
23 'hl' => sanitize_text_field( $attributes['hl'] ),
24 'cc_lang_pref' => sanitize_text_field( $attributes['cc_lang_pref'] )
25 );
26
27 $featured = $videos[0]; // Featured Video
28 ?>
29
30 <div id="ayg-<?php echo esc_attr( $attributes['uid'] ); ?>" class="ayg ayg-theme-single" data-params='<?php echo wp_json_encode( $params ); ?>'>
31 <!-- Player -->
32 <div class="ayg-player">
33 <div class="ayg-player-wrapper" style="padding-bottom: <?php echo (float) $player_ratio; ?>%;">
34 <?php
35 // Image
36 $image_src = 'none';
37
38 if ( isset( $video->thumbnails->default ) ) {
39 $image_src = $video->thumbnails->default->url;
40 }
41
42 if ( 75 == (int) $attributes['player_ratio'] ) { // 4:3 ( default - 120x90, high - 480x360, standard - 640x480 )
43 if ( isset( $video->thumbnails->high ) ) {
44 $image_src = $video->thumbnails->high->url;
45 }
46 }
47
48 if ( 56.25 == (float) $attributes['player_ratio'] ) { // 16:9 ( medium - 320x180, maxres - 1280x720 )
49 if ( isset( $video->thumbnails->medium ) ) {
50 $image_src = $video->thumbnails->medium->url;
51 }
52 }
53
54 // Player
55 $tag = 'div';
56 if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
57 $tag = 'iframe';
58 }
59
60 printf(
61 '<%1$s class="ayg-player-iframe" width="100%%" height="100%%" src="%2$s/embed/%3$s" data-id="%3$s" data-image="%4%s" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></%1$s>',
62 $tag,
63 ayg_get_youtube_domain(),
64 esc_attr( $featured->id ),
65 esc_attr( $image_src )
66 );
67 ?>
68 </div>
69
70 <div class="ayg-player-caption">
71 <?php if ( ! empty( $attributes['player_title'] ) ) : ?>
72 <h2 class="ayg-player-title"><?php echo esc_html( $featured->title ); ?></h2>
73 <?php endif; ?>
74
75 <?php if ( ! empty( $attributes['player_description'] ) && ! empty( $featured->description ) ) : ?>
76 <div class="ayg-player-description"><?php echo wp_kses_post( ayg_get_player_description( $featured ) ); ?></div>
77 <?php endif; ?>
78 </div>
79 </div>
80 </div>
81