PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 2.2.0
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v2.2.0
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.2.0, at public/templates/theme-single.php

80 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 'controls' => (int) $attributes['controls'],
19 'modestbranding' => (int) $attributes['modestbranding'],
20 'cc_load_policy' => (int) $attributes['cc_load_policy'],
21 'iv_load_policy' => (int) $attributes['iv_load_policy'],
22 'hl' => sanitize_text_field( $attributes['hl'] ),
23 'cc_lang_pref' => sanitize_text_field( $attributes['cc_lang_pref'] )
24 );
25
26 $featured = $videos[0]; // Featured Video
27 ?>
28
29 <div id="ayg-<?php echo esc_attr( $attributes['uid'] ); ?>" class="ayg ayg-theme-single" data-params='<?php echo wp_json_encode( $params ); ?>'>
30 <!-- Player -->
31 <div class="ayg-player">
32 <div class="ayg-player-wrapper" style="padding-bottom: <?php echo (float) $player_ratio; ?>%;">
33 <?php
34 // Image
35 $image_src = 'none';
36
37 if ( isset( $video->thumbnails->default ) ) {
38 $image_src = $video->thumbnails->default->url;
39 }
40
41 if ( 75 == (int) $attributes['player_ratio'] ) { // 4:3 ( default - 120x90, high - 480x360, standard - 640x480 )
42 if ( isset( $video->thumbnails->high ) ) {
43 $image_src = $video->thumbnails->high->url;
44 }
45 }
46
47 if ( 56.25 == (float) $attributes['player_ratio'] ) { // 16:9 ( medium - 320x180, maxres - 1280x720 )
48 if ( isset( $video->thumbnails->medium ) ) {
49 $image_src = $video->thumbnails->medium->url;
50 }
51 }
52
53 // Player
54 $tag = 'div';
55 if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
56 $tag = 'iframe';
57 }
58
59 printf(
60 '<%1$s id="ayg-player-%2$s" class="ayg-player-iframe" width="100%%" height="100%%" src="https://www.youtube.com/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>',
61 $tag,
62 esc_attr( $attributes['uid'] ),
63 esc_attr( $featured->id ),
64 esc_attr( $image_src )
65 );
66 ?>
67 </div>
68
69 <div class="ayg-player-caption">
70 <?php if ( ! empty( $attributes['player_title'] ) ) : ?>
71 <h2 class="ayg-player-title"><?php echo esc_html( $featured->title ); ?></h2>
72 <?php endif; ?>
73
74 <?php if ( ! empty( $attributes['player_description'] ) && ! empty( $featured->description ) ) : ?>
75 <div class="ayg-player-description"><?php echo wp_kses_post( ayg_get_player_description( $featured ) ); ?></div>
76 <?php endif; ?>
77 </div>
78 </div>
79 </div>
80