| 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 |
'autoadvance' => (int) $attributes['autoadvance'], |
| 26 |
'player_title' => (int) $attributes['player_title'], |
| 27 |
'player_description' => (int) $attributes['player_description'] |
| 28 |
); |
| 29 |
|
| 30 |
$featured = $videos[0]; // Featured Video |
| 31 |
?> |
| 32 |
|
| 33 |
<div id="ayg-<?php echo esc_attr( $attributes['uid'] ); ?>" class="ayg ayg-theme-classic" data-params='<?php echo wp_json_encode( $params ); ?>'> |
| 34 |
<!-- Player --> |
| 35 |
<div class="ayg-player"> |
| 36 |
<div class="ayg-player-wrapper" style="padding-bottom: <?php echo (float) $player_ratio; ?>%;"> |
| 37 |
<?php |
| 38 |
$tag = 'div'; |
| 39 |
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { |
| 40 |
$tag = 'iframe'; |
| 41 |
} |
| 42 |
|
| 43 |
printf( |
| 44 |
'<%1$s class="ayg-player-iframe" width="100%%" height="100%%" src="%2$s/embed/%3$s" data-id="%3$s" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></%1$s>', |
| 45 |
$tag, |
| 46 |
ayg_get_youtube_domain(), |
| 47 |
esc_attr( $featured->id ) |
| 48 |
); |
| 49 |
?> |
| 50 |
</div> |
| 51 |
|
| 52 |
<div class="ayg-player-caption"> |
| 53 |
<?php if ( ! empty( $attributes['player_title'] ) ) : ?> |
| 54 |
<h2 class="ayg-player-title"><?php echo esc_html( $featured->title ); ?></h2> |
| 55 |
<?php endif; ?> |
| 56 |
|
| 57 |
<?php if ( ! empty( $attributes['player_description'] ) ) : ?> |
| 58 |
<div class="ayg-player-description"><?php if ( ! empty( $featured->description ) ) echo wp_kses_post( ayg_get_player_description( $featured ) ); ?></div> |
| 59 |
<?php endif; ?> |
| 60 |
</div> |
| 61 |
</div> |
| 62 |
|
| 63 |
<!-- Gallery --> |
| 64 |
<div class="ayg-gallery ayg-row"> |
| 65 |
<?php foreach ( $videos as $index => $video ) : |
| 66 |
$classes = array(); |
| 67 |
$classes[] = 'ayg-item'; |
| 68 |
$classes[] = 'ayg-item-' . $video->id; |
| 69 |
$classes[] = 'ayg-col'; |
| 70 |
$classes[] = 'ayg-col-' . (int) $attributes['columns']; |
| 71 |
|
| 72 |
if ( $video->id == $featured->id ) { |
| 73 |
$classes[] = 'ayg-active'; |
| 74 |
} |
| 75 |
?> |
| 76 |
<div class="<?php echo implode( ' ', $classes ); ?>"> |
| 77 |
<?php the_ayg_gallery_thumbnail( $video, $attributes ); ?> |
| 78 |
</div> |
| 79 |
<?php endforeach; ?> |
| 80 |
</div> |
| 81 |
|
| 82 |
<!-- Pagination --> |
| 83 |
<?php the_ayg_pagination( $attributes ); ?> |
| 84 |
</div> |
| 85 |
|