embedded.php
3 months ago
external_url.php
3 months ago
html5.php
3 months ago
shortcode.php
3 months ago
video.php
1 year ago
vimeo.php
9 hours ago
youtube.php
3 months ago
vimeo.php
65 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Display Vimeo Video |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @subpackage Single\Video |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 1.0.0 |
| 10 | */ |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; |
| 14 | } |
| 15 | |
| 16 | $disable_default_player_vimeo = tutor_utils()->get_option( 'disable_default_player_vimeo' ); |
| 17 | |
| 18 | $video_info = tutor_utils()->get_video_info(); |
| 19 | $video_info = $video_info ? (array) $video_info : array(); |
| 20 | $video_url = tutor_utils()->avalue_dot( 'source_vimeo', $video_info ); |
| 21 | $video_id = ''; |
| 22 | $video_hash = ''; |
| 23 | |
| 24 | if ( preg_match( '%^https?:\/\/(?:www\.|player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/[^\/]*\/videos\/|album\/\d+\/video\/|video\/)?(\d+)(?:\/([a-zA-Z0-9]+))?(?:$|\/|\?)(?:[?]?.*)?$%im', $video_url, $match ) ) { |
| 25 | $video_id = $match[1] ?? ''; |
| 26 | $video_hash = $match[2] ?? ''; |
| 27 | } |
| 28 | |
| 29 | $embed_url = "https://player.vimeo.com/video/{$video_id}"; |
| 30 | |
| 31 | if ( $video_hash ) { |
| 32 | $embed_url = add_query_arg( 'h', $video_hash, $embed_url ); |
| 33 | } |
| 34 | |
| 35 | $tutor_player_embed_url = add_query_arg( |
| 36 | array( |
| 37 | 'loop' => 'false', |
| 38 | 'byline' => 'false', |
| 39 | 'portrait' => 'false', |
| 40 | 'title' => 'false', |
| 41 | 'speed' => 'true', |
| 42 | 'transparent' => '0', |
| 43 | 'gesture' => 'media', |
| 44 | ), |
| 45 | $embed_url |
| 46 | ); |
| 47 | |
| 48 | do_action( 'tutor_lesson/single/before/video/vimeo' ); |
| 49 | ?> |
| 50 | |
| 51 | <?php if ( $video_id ) : ?> |
| 52 | <div class="tutor-video-player"> |
| 53 | <div class="loading-spinner" aria-hidden="true"></div> |
| 54 | <div class="<?php echo $disable_default_player_vimeo ? 'plyr__video-embed tutorPlayer' : 'tutor-ratio tutor-ratio-16x9'; ?>"> |
| 55 | <?php if ( ! $disable_default_player_vimeo ) : ?> |
| 56 | <iframe src="<?php echo esc_url( $embed_url ); ?>" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe> |
| 57 | <?php else : ?> |
| 58 | <iframe src="<?php echo esc_url( $tutor_player_embed_url ); ?>" allowfullscreen allowtransparency allow="autoplay"></iframe> |
| 59 | <?php endif; ?> |
| 60 | </div> |
| 61 | </div> |
| 62 | <?php endif; ?> |
| 63 | |
| 64 | <?php do_action( 'tutor_lesson/single/after/video/vimeo' ); ?> |
| 65 |