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.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / views / metabox / video-metabox.php
tutor / views / metabox Last commit date
course 4 years ago course-add-edd-product-metabox.php 4 years ago course-add-product-metabox.php 4 years ago course-additional-data.php 4 years ago course-contents.php 4 years ago course-level-metabox.php 4 years ago course-topics.php 4 years ago instructors-metabox.php 4 years ago lesson-attachments-metabox.php 4 years ago lesson-metabox.php 4 years ago product-selection.php 4 years ago settings-tabs.php 4 years ago user-profile-fields.php 4 years ago video-metabox.php 4 years ago
video-metabox.php
157 lines
1 <?php
2
3 /**
4 * Don't change it, it's supporting modal in other place
5 * if get_the_ID() empty, then it's means we are passing $post variable from another place
6 */
7 if (get_the_ID())
8 global $post;
9
10 $video = maybe_unserialize(get_post_meta($post->ID, '_video', true));
11 $videoSource = tutor_utils()->avalue_dot('source', $video, 'html5');
12 $runtimeHours = tutor_utils()->avalue_dot('runtime.hours', $video);
13 $runtimeMinutes = tutor_utils()->avalue_dot('runtime.minutes', $video);
14 $runtimeSeconds = tutor_utils()->avalue_dot('runtime.seconds', $video);
15 $sourceVideoID = tutor_utils()->avalue_dot('source_video_id', $video);
16 $poster = tutor_utils()->avalue_dot('poster', $video);
17 $videoAttachment = $sourceVideoID ? tutor_utils()->get_attachment_data($sourceVideoID) : null;
18
19 $video_sources = tutor_utils()->get_video_sources(false);
20
21 $supported_sources = tutor_utils()->get_option('supported_video_sources', array());
22 !is_array($supported_sources) ? $supported_sources = array($supported_sources) : 0;
23 $GLOBALS['supported_sources'] = $supported_sources;
24
25 if (!is_array($supported_sources) || !count($supported_sources)) {
26 $notice = __('No video source selected from settings!', 'tutor');
27 echo "<div class='tutor-alert tutor-warning'>
28 <div class='tutor-alert-text'>
29 <span class='tutor-alert-icon tutor-fs-4 tutor-icon-circle-info tutor-mr-12'></span>
30 <span>{$notice}</span>
31 </div>
32 </div>";
33 // _e('No video source selected from settings!', 'tutor');
34 return;
35 }
36
37
38 function tutor_video_input_state($videoSource, $source){
39 $value = ($videoSource == $source && in_array($source, $GLOBALS['supported_sources'])) ? 'block' : 'none';
40 echo 'display:'.$value.';';
41 }
42 ?>
43
44 <div class="tutor-mb-32">
45 <label class="tutor-form-label">
46 <?php
47 if ($post->post_type === tutor()->course_post_type) {
48 _e('Course Intro Video', 'tutor');
49 } else {
50 _e('Video Source', 'tutor');
51 }
52 ?>
53 </label>
54
55 <div class="tutor-input-group tutor-mb-16 tutor-mt-12 tutor-d-block">
56 <div class="tutor-video-upload-wrap">
57 <div class="tutor-dropdown-icon-pack tutor-mt-4" data-video_source="<?php echo empty($videoSource) ? '' : $videoSource; ?>">
58 <i class="tutor-icon-brand-html5-bold" data-for="html5"></i>
59 <i class="tutor-icon-brand-youtube-line" data-for="youtube"></i>
60 <i class="tutor-icon-brand-vimeo-line" data-for="vimeo"></i>
61 <i class="tutor-icon-shortcode" data-for="shortcode"></i>
62 <i class="tutor-icon-link" data-for="external_url"></i>
63 <i class="tutor-icon-coding" data-for="embedded"></i>
64 </div>
65 <select name="video[source]" class="tutor-form-control tutor-select-icon-primary tutor_lesson_video_source no-tutor-dropdown">
66 <option value="-1"><?php _e('Select Video Source', 'tutor'); ?></option>
67 <?php
68 foreach ($video_sources as $value => $source) {
69 if (in_array($value, $supported_sources)) {
70 echo '<option value="' . $value . '" ' . selected($value, $videoSource) . ' data-icon="' . $source['icon'] . '">
71 ' . $source['title'] . '
72 </option>';
73 }
74 }
75 ?>
76 </select>
77
78 <div class="tutor-mt-16 video-metabox-source-item video_source_wrap_html5 tutor-dashed-uploader <?php echo $sourceVideoID ? 'tutor-has-video' : ''; ?>" style="<?php tutor_video_input_state($videoSource, 'html5'); ?>">
79 <div class="video-metabox-source-html5-upload">
80 <p class="video-upload-icon"><i class="tutor-icon-upload-icon-line"></i></p>
81 <p><strong><?php _e('Drag & Drop Your Video', 'tutor'); ?></strong></p>
82 <p><?php _e('File Format: ', 'tutor'); ?> <span class="tutor-color-black">.mp4</span></p>
83 <p class="tutor-color-black"><?php _e('or', 'tutor'); ?></p>
84
85 <div class="video_source_upload_wrap_html5">
86 <button class="video_upload_btn tutor-btn tutor-btn-secondary tutor-btn-md">
87 <?php _e('Browse File', 'tutor'); ?>
88 </button>
89 <input type="hidden" class="input_source_video_id" name="video[source_video_id]" value="<?php echo $sourceVideoID; ?>">
90 </div>
91 </div>
92
93 <div class="html5-video-data">
94 <?php
95 // Load Attachment card segment
96 tutor_load_template_from_custom_path(tutor()->path . '/views/fragments/attachments.php', array(
97 'attachments' => array($videoAttachment ? $videoAttachment : (object)array('id' => 0, 'url' => '', 'title' => '', 'size' => '')),
98 'size_below' => true,
99 'no_control' => true
100 ), false);
101
102 echo '<div class="tutor-fs-6 tutor-fw-medium tutor-color-secondary tutor-mb-12" >' . __('Upload Video Poster', 'tutor') . '</div>';
103 // Load thumbnail segment
104 tutor_load_template_from_custom_path(tutor()->path . '/views/fragments/thumbnail-uploader.php', array(
105 'media_id' => tutor_utils()->avalue_dot('poster', $video),
106 'input_name' => 'video[poster]'
107 ), false);
108 ?>
109 </div>
110 </div>
111
112 <div class="tutor-mt-16 video-metabox-source-item video_source_wrap_external_url tutor-dashed-uploader" style="<?php tutor_video_input_state($videoSource, 'external_url'); ?>">
113 <input class="tutor-form-control" type="text" name="video[source_external_url]" value="<?php echo tutor_utils()->avalue_dot('source_external_url', $video); ?>" placeholder="<?php _e('Paste External Video URL', 'tutor'); ?>">
114 </div>
115
116 <div class="tutor-mt-16 video-metabox-source-item video_source_wrap_shortcode tutor-dashed-uploader" style="<?php tutor_video_input_state($videoSource, 'shortcode'); ?>">
117 <input class="tutor-form-control" type="text" name="video[source_shortcode]" value="<?php echo tutor_utils()->avalue_dot('source_shortcode', $video); ?>" placeholder="<?php _e('Paste Shortcode', 'tutor'); ?>">
118 </div>
119
120 <div class="tutor-mt-16 video-metabox-source-item video_source_wrap_youtube tutor-dashed-uploader" style="<?php tutor_video_input_state($videoSource, 'youtube'); ?>">
121 <input class="tutor-form-control" type="text" name="video[source_youtube]" value="<?php echo tutor_utils()->avalue_dot('source_youtube', $video); ?>" placeholder="<?php _e('Paste YouTube Video URL', 'tutor'); ?>" data-youtube_api_key="<?php echo tutor_utils()->get_option('lesson_video_duration_youtube_api_key', ''); ?>">
122 </div>
123
124 <div class="tutor-mt-16 video-metabox-source-item video_source_wrap_vimeo tutor-dashed-uploader" style="<?php tutor_video_input_state($videoSource, 'vimeo'); ?>">
125 <input class="tutor-form-control" type="text" name="video[source_vimeo]" value="<?php echo tutor_utils()->avalue_dot('source_vimeo', $video); ?>" placeholder="<?php _e('Paste Vimeo Video URL', 'tutor'); ?>">
126 </div>
127
128 <div class="tutor-mt-16 video-metabox-source-item video_source_wrap_embedded tutor-dashed-uploader" style="<?php tutor_video_input_state($videoSource, 'embedded'); ?>">
129 <textarea class="tutor-form-control" name="video[source_embedded]" placeholder="<?php _e('Place your embedded code here', 'tutor'); ?>"><?php echo tutor_utils()->avalue_dot('source_embedded', $video); ?></textarea>
130 </div>
131 </div>
132 </div>
133 </div>
134
135 <!-- For Lesson -->
136 <?php if ($post->post_type !== tutor()->course_post_type) : ?>
137 <div class="tutor-mb-20">
138 <label class="tutor-form-label"><?php _e('Video playback time', 'tutor'); ?></label>
139 <div class="tutor-input-group tutor-option-field-video-duration">
140 <div class="tutor-row">
141 <div class="tutor-col-4">
142 <input class="tutor-form-control" type="number" value="<?php echo $runtimeHours ? $runtimeHours : '00'; ?>" name="video[runtime][hours]" min="0">
143 <span><?php _e('Hour', 'tutor'); ?></span>
144 </div>
145 <div class="tutor-col-4">
146 <input class="tutor-form-control" type="number" class="tutor-number-validation" data-min="0" data-max="59" value="<?php echo $runtimeMinutes ? $runtimeMinutes : '00'; ?>" name="video[runtime][minutes]" min="0">
147 <span><?php _e('Minute', 'tutor'); ?></span>
148 </div>
149 <div class="tutor-col-4">
150 <input class="tutor-form-control" type="number" class="tutor-number-validation" data-min="0" data-max="59" value="<?php echo $runtimeSeconds ? $runtimeSeconds : '00'; ?>" name="video[runtime][seconds]" min="0">
151 <span><?php _e('Second', 'tutor'); ?></span>
152 </div>
153 </div>
154 </div>
155 </div>
156 <?php endif; ?>
157