PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.11.1
WpStream – Live Streaming, Video on Demand, Pay Per View v4.11.1
4.14.1 4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 All 181 releases
wpstream / hello-wpstream / framework / dashboard-functions.php

dashboard-functions.php in WpStream – Live Streaming, Video on Demand, Pay Per View 4.11.1, at hello-wpstream/framework/dashboard-functions.php

511 lines 23.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Dashboard functions
5 *
6 * @package wpstream-plugin
7 */
8
9 if ( ! function_exists( 'wpstream_theme_return_user_channel_list' ) ) {
10 /**
11 * Return user channel list.
12 *
13 * This function generates and returns HTML markup for a select field containing user channels.
14 *
15 * @param int $already_selected The ID of the already selected channel.
16 * @param string $return_type The type of return. Default is empty.
17 * @return string|int The HTML markup for the select field or the count of found posts.
18 */
19 function wpstream_theme_return_user_channel_list( $already_selected, $return_type = '' ) {
20 $current_user = wp_get_current_user();
21 $limit = 100;
22 $return_string = '';
23
24 if ( wpstream_check_woo_active() ) {
25 $post_type = array( 'product', 'wpstream_product' );
26 $taxonomy_array = array(
27 'relation' => 'OR',
28 array(
29 'taxonomy' => 'product_type',
30 'field' => 'slug',
31 'terms' => array( 'live_stream' ),
32 ),
33 array(
34 'taxonomy' => 'product_type',
35 'operator' => 'NOT EXISTS',
36 ),
37 );
38 } else {
39 $post_type = 'wpstream_product';
40 $taxonomy_array = array();
41 }
42
43 $args = array(
44 'post_type' => $post_type,
45 'posts_per_page' => $limit,
46 'tax_query' => $taxonomy_array, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
47 'author' => $current_user->ID,
48 );
49
50 $query_list = new WP_Query( $args );
51
52 if ( 'found_posts' === $return_type ) {
53 return intval( $query_list->found_posts );
54 }
55
56 $return_string .= '<select id="wpstream-user-channel-selection" name="wpstream-user-channel-selection" '
57 . 'class="wpstream-user-channel-selection">'
58 . '<option value="">' . esc_html__( 'select the channel', 'hello-wpstream' ) . '</value>';
59
60 if ( $query_list->have_posts() ) {
61 while ( $query_list->have_posts() ) :
62 $query_list->the_post();
63 $the_id = get_the_ID();
64 $the_title = get_the_title( $the_id );
65 $post_type = get_post_type( $the_id );
66 $product_type = '';
67
68 if ( get_post_type( $the_id ) === 'product' ) {
69 $product_type = get_post_meta( $the_id, '_product_type', true );
70 }
71
72 $image_url = '';
73 $return_string .= '<option value="' . intval( $the_id ) . '"';
74 if ( intval( $already_selected ) === $the_id ) {
75 $return_string .= ' selected';
76 }
77 $return_string .= ' data-thumbnail="' . esc_url( $image_url ) . '">';
78 $return_string .= esc_html( $the_title ) . '</option>';
79
80 endwhile;
81 }
82
83 $return_string .= '</select>';
84
85 wp_reset_postdata();
86
87 return $return_string;
88 }
89 }
90
91 /**
92 * Localize the upload script for images.
93 *
94 * @param string $button_upload The ID of the upload button.
95 */
96 function wpstream_theme_localize_upload_script_images( $button_upload ) {
97 $plup_url = add_query_arg(
98 array(
99 'action' => 'wpstream_me_upload',
100 'nonce' => wp_create_nonce( 'aaiu_allow' ),
101 ),
102 esc_url( admin_url( 'admin-ajax.php' ) )
103 );
104
105 $max_file_size = 100 * 1000 * 1000;
106
107 $plupload_values = array(
108 'runtimes' => 'html5,flash,html4',
109 'max_file_size' => $max_file_size . 'b',
110 'url' => $plup_url,
111 'file_data_name' => 'aaiu_upload_file',
112 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
113 'filters' => array(
114 array(
115 'title' => esc_html__( 'Allowed Files', 'hello-wpstream' ),
116 'extensions' => 'jpeg,jpg,gif,png,pdf,webp,mp4,mov',
117 ),
118 ),
119 'multipart' => true,
120 'urlstream_upload' => true,
121 'multipart_params' => array( 'button_id' => $button_upload ),
122 );
123
124 $tmp_plupload_values = array(
125 'browse_button' => $button_upload,
126 'container' => 'aaiu-upload-container',
127 );
128
129 $plupload_values = wp_parse_args( $plupload_values, $tmp_plupload_values );
130 $plupload_values['drop_element'] = 'drag-and-drop';
131 $max_images = 20;
132
133 wp_localize_script(
134 'ajax-upload',
135 'ajax_vars',
136 array(
137 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
138 'nonce' => wp_create_nonce( 'aaiu_upload' ),
139 'remove' => wp_create_nonce( 'aaiu_remove' ),
140 'number' => 1,
141 'upload_enabled' => true,
142 'warning' => __( 'Image needs to be at least 500px height x 500px wide!', 'hello-wpstream' ),
143 'max_images' => $max_images,
144 'warning_max' => __( 'You cannot upload more than', 'hello-wpstream' ) . ' ' . $max_images . ' ' . __( 'images', 'hello-wpstream' ),
145 'path' => trailingslashit( WPSTREAM_PLUGIN_PATH ),
146 'confirmMsg' => esc_html__( 'Are you sure you want to delete this?', 'hello-wpstream' ),
147 'plupload' => $plupload_values,
148 )
149 );
150 }
151
152 if ( ! function_exists( 'wpstream_theme_return_image_upload_markup' ) ) {
153 /**
154 * Return the markup for image upload.
155 *
156 * This function generates and returns the markup for image upload based on the provided post ID.
157 *
158 * @param int $user_id The ID of the user.
159 * @param int $post_id The ID of the post.
160 * @return string The HTML markup for image upload.
161 */
162 function wpstream_theme_return_image_upload_markup( $user_id, $post_id ) {
163 $post_type = get_post_type( $post_id );
164 $gallery_images = '';
165
166 if ( 'product' === $post_type ) {
167 $gallery_images_source = get_post_meta( $post_id, '_product_image_gallery', true );
168 $gallery_images = explode( ',', $gallery_images_source );
169 } else {
170 if(function_exists('rwmb_meta')){
171 $gallery_images = rwmb_meta( 'wpstream_theme_gallery', array(), $post_id );
172
173 if ( is_array( $gallery_images ) ) {
174 $gallery_images = array_keys( $gallery_images );
175 }
176 }
177 }
178
179 $gallery_images = wpstream_theme_return_image_gallery( $post_id );
180
181 $thumbid = get_post_thumbnail_id( $post_id );
182 $images = '';
183
184 if ( is_array( $gallery_images ) ) {
185 foreach ( $gallery_images as $attachment_id ) {
186
187 $preview = wp_get_attachment_image_src( $attachment_id, 'wpstream_featured_unit_cards' );
188
189 if ( $preview && $preview[0] != '' ) {
190 $images .= '<div class="wpstream_uploaded_images" data-imageid="' . esc_attr( $attachment_id ) . '">'
191 . '<img src="' . esc_url( $preview[0] ) . '" alt="' . esc_html__( 'thumb', 'hello-wpstream' ) . '" />'
192 . '<i class="far fa-trash-alt wpstream_delete_image"></i>';
193
194 $images .= '</div>';
195 }
196 }
197 }
198
199 $gallery_images_string = '';
200 if ( is_array( $gallery_images ) ) {
201 $gallery_images_string = implode( ',', $gallery_images );
202 }
203
204 $return_string = '';
205 ob_start();
206 ?>
207
208 <div id="upload-container" class="upload-container">
209 <div id="aaiu-upload-container upload-container__body">
210 <h3><?php echo esc_html__( 'Image list', 'hello-wpstream' ); ?></h3>
211 <div id="aaiu-upload-imagelist">
212 <ul id="aaiu-ul-list" class="aaiu-upload-list"></ul>
213 </div>
214
215 <div id="wpstream_imagelist">
216 <?php
217 $ajax_nonce = wp_create_nonce( 'wpstream_image_upload' );
218 print '<input type="hidden" id="wpstream_image_upload" value="' . esc_html( $ajax_nonce ) . '" /> ';
219 if ( '' !== $images ) {
220 print trim( $images ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
221 }
222 ?>
223 </div>
224
225 <div class="upload-container__actions-wrap upload-container__actions-wrap--row">
226 <div id="drag-and-drop" class="rh_drag_and_drop_wrapper ">
227 <div id="aaiu-uploader" class="wpstream_theme_button_dashboard">
228 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
229 <path fill-rule="evenodd" clip-rule="evenodd" d="M10.7379 16.6273C9.96427 16.6273 9.31895 16.036 9.2514 15.2654C9.11015 13.6541 9.07441 12.0356 9.14427 10.4203C9.05994 10.4147 8.97563 10.4088 8.89133 10.4026L7.40178 10.2941C6.44973 10.2247 5.91752 9.16309 6.43151 8.35871C7.5277 6.6432 9.53693 4.72314 11.1904 3.53541C11.6742 3.18786 12.3258 3.18786 12.8097 3.53541C14.4631 4.72314 16.4723 6.64319 17.5685 8.35871C18.0825 9.16309 17.5503 10.2247 16.5983 10.2941L15.1087 10.4026C15.0244 10.4088 14.9401 10.4147 14.8558 10.4203C14.9256 12.0356 14.8899 13.6541 14.7486 15.2654C14.6811 16.036 14.0358 16.6273 13.2622 16.6273H10.7379ZM10.6815 9.76253C10.5678 11.5498 10.589 13.3431 10.745 15.1273H13.255C13.411 13.3431 13.4323 11.5498 13.3186 9.76253C13.3058 9.56216 13.3739 9.36505 13.5077 9.21531C13.6414 9.06556 13.8296 8.9757 14.0301 8.96582C14.3535 8.94989 14.6767 8.93015 14.9997 8.90661L16.0815 8.82775C15.1219 7.41445 13.9204 6.1802 12.5313 5.18235L12 4.80071L11.4687 5.18235C10.0796 6.1802 8.87813 7.41446 7.91858 8.82775L9.00038 8.90661C9.32337 8.93015 9.64656 8.94989 9.9699 8.96582C10.1704 8.9757 10.3586 9.06556 10.4924 9.21531C10.6261 9.36505 10.6942 9.56216 10.6815 9.76253Z" fill="#0F0F0F"/>
230 <path d="M5.75 17C5.75 16.5858 5.41421 16.25 5 16.25C4.58579 16.25 4.25 16.5858 4.25 17V19C4.25 19.9665 5.0335 20.75 6 20.75H18C18.9665 20.75 19.75 19.9665 19.75 19V17C19.75 16.5858 19.4142 16.25 19 16.25C18.5858 16.25 18.25 16.5858 18.25 17V19C18.25 19.1381 18.1381 19.25 18 19.25H6C5.86193 19.25 5.75 19.1381 5.75 19V17Z" fill="#0F0F0F"/>
231 </svg>
232
233 <?php esc_html_e( 'Upload More', 'hello-wpstream' ); ?>
234 </div>
235 </div>
236
237 <input type="hidden" name="attachid" id="attachid" value="<?php print esc_html( $gallery_images_string ); ?>">
238 <input type="hidden" name="attachthumb" id="attachthumb" value="<?php print esc_html( $thumbid ); ?>">
239 <p class="full_form full_form_image">
240 <?php
241 esc_html_e(
242 "It's recommended to use a picture that's at least 1280 x 720 pixels and 4MB or less.
243 Use a PNG or GIF (no animations) file.",
244 'hello-wpstream'
245 );
246 ?>
247 </p>
248 </div>
249 </div>
250 </div>
251 <?php
252 $return_string .= ob_get_contents();
253 ob_end_clean();
254
255 return $return_string;
256 }
257 }
258
259 if ( ! function_exists( 'wpstream_theme_return_image_upload_markup_single' ) ) {
260 /**
261 * Return the markup for single image upload.
262 *
263 * This function generates and returns the markup for single image upload based on the provided post ID.
264 *
265 * @param int $user_id The ID of the user.
266 * @param int $post_id The ID of the post.
267 * @return string The HTML markup for single image upload.
268 */
269 function wpstream_theme_return_image_upload_markup_single( $post_id ) {
270 $thumbid = get_post_thumbnail_id( $post_id );
271 $images = '';
272 $preview = wp_get_attachment_image_src( $thumbid, 'wpstream_featured_unit_cards' );
273
274 if ( isset( $preview[0] ) && '' !== $preview[0] ) {
275 $images .= '<div class="wpstream_uploaded_images" id="wpstream_uploaded_profile_image" data-imageid="' . esc_attr( $thumbid ) . '">'
276 . '<img src="' . esc_url( $preview[0] ) . '" alt="' . esc_html__( 'thumb', 'hello-wpstream' ) . '" /></div>';
277 }
278
279 $return_string = '';
280 ob_start();
281 ?>
282
283 <div id="upload-container">
284 <div id="aaiu-upload-container" class="upload-container">
285 <p class="upload-container__title"><?php echo esc_html__( 'Channel Thumbnail', 'hello-wpstream' ); ?></p>
286 <div class="upload-container__row">
287 <div class="upload-container__image-wrap">
288 <div id="aaiu-upload-imagelist_single">
289 <ul id="aaiu-ul-list" class="aaiu-upload-list"></ul>
290 </div>
291
292 <div id="wpstream_imagelist_single">
293 <?php
294 $ajax_nonce = wp_create_nonce( 'wpstream_image_upload' );
295 print '<input type="hidden" id="wpstream_image_upload" value="' . esc_html( $ajax_nonce ) . '" /> ';
296 if ( '' !== $images ) {
297 print trim( $images ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
298 }
299 ?>
300 </div>
301
302 <input type="hidden" name="attachthumb" id="attachthumb" value="<?php print esc_html( $thumbid ); ?>">
303 </div>
304
305 <div class="upload-container__actions-wrap upload-container__actions-wrap--column">
306 <p class="full_form full_form_image">
307 <?php
308 esc_html_e(
309 "It's recommended to use a picture that's at least 1280 x 720 pixels and 4MB or less.
310 Use a PNG or GIF (no animations) file.",
311 'hello-wpstream'
312 );
313 ?>
314 </p>
315
316 <div id="drag-and-drop" class="rh_drag_and_drop_wrapper">
317 <div id="aaiu-uploader-single" class="wpstream_theme_button_dashboard">
318 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
319 <path fill-rule="evenodd" clip-rule="evenodd" d="M10.7379 16.6273C9.96427 16.6273 9.31895 16.036 9.2514 15.2654C9.11015 13.6541 9.07441 12.0356 9.14427 10.4203C9.05994 10.4147 8.97563 10.4088 8.89133 10.4026L7.40178 10.2941C6.44973 10.2247 5.91752 9.16309 6.43151 8.35871C7.5277 6.6432 9.53693 4.72314 11.1904 3.53541C11.6742 3.18786 12.3258 3.18786 12.8097 3.53541C14.4631 4.72314 16.4723 6.64319 17.5685 8.35871C18.0825 9.16309 17.5503 10.2247 16.5983 10.2941L15.1087 10.4026C15.0244 10.4088 14.9401 10.4147 14.8558 10.4203C14.9256 12.0356 14.8899 13.6541 14.7486 15.2654C14.6811 16.036 14.0358 16.6273 13.2622 16.6273H10.7379ZM10.6815 9.76253C10.5678 11.5498 10.589 13.3431 10.745 15.1273H13.255C13.411 13.3431 13.4323 11.5498 13.3186 9.76253C13.3058 9.56216 13.3739 9.36505 13.5077 9.21531C13.6414 9.06556 13.8296 8.9757 14.0301 8.96582C14.3535 8.94989 14.6767 8.93015 14.9997 8.90661L16.0815 8.82775C15.1219 7.41445 13.9204 6.1802 12.5313 5.18235L12 4.80071L11.4687 5.18235C10.0796 6.1802 8.87813 7.41446 7.91858 8.82775L9.00038 8.90661C9.32337 8.93015 9.64656 8.94989 9.9699 8.96582C10.1704 8.9757 10.3586 9.06556 10.4924 9.21531C10.6261 9.36505 10.6942 9.56216 10.6815 9.76253Z" fill="#0F0F0F"/>
320 <path d="M5.75 17C5.75 16.5858 5.41421 16.25 5 16.25C4.58579 16.25 4.25 16.5858 4.25 17V19C4.25 19.9665 5.0335 20.75 6 20.75H18C18.9665 20.75 19.75 19.9665 19.75 19V17C19.75 16.5858 19.4142 16.25 19 16.25C18.5858 16.25 18.25 16.5858 18.25 17V19C18.25 19.1381 18.1381 19.25 18 19.25H6C5.86193 19.25 5.75 19.1381 5.75 19V17Z" fill="#0F0F0F"/>
321 </svg>
322
323 <?php esc_html_e( 'Change', 'hello-wpstream' ); ?>
324 </div>
325 </div>
326 </div>
327 </div>
328 </div>
329 </div>
330 <?php
331 $return_string .= ob_get_contents();
332 ob_end_clean();
333
334 return $return_string;
335 }
336 }
337
338 if ( ! function_exists( 'wpstream_theme_return_trailer_upload_markup' ) ) {
339 /**
340 * Return the markup for trailer video upload.
341 *
342 * This function generates and returns the markup for trailer video upload based on the provided post ID.
343 *
344 * @param int $post_id The ID of the post.
345 * @return string The HTML markup for trailer video upload.
346 */
347 function wpstream_theme_return_trailer_upload_markup( $post_id ) {
348 $trailer_id = get_post_meta( $post_id, 'video_trailer', true );
349 $attachment_url = wp_get_attachment_url( $trailer_id );
350 $video_html = '';
351
352 if ( $trailer_id && $attachment_url ) {
353 $video_html = '<div class="wpstream_uplod_video" id="wpstream_uploaded_trailer" data-videoid="' . esc_attr( $trailer_id ) . '">'
354 .'<video height="240" controls><source src="' . esc_url( $attachment_url ) . '" type="video/mp4"></video></div>';
355 }
356
357 $return_string = '';
358 ob_start();
359 ?>
360
361 <div id="trailer-upload-container">
362 <div id="aaiu-trailer-container" class="upload-container">
363 <p class="upload-container__title"><?php echo esc_html__( 'Video Trailer', 'hello-wpstream' ); ?></p>
364 <div class="upload-container__row">
365 <div class="upload-container__video-wrap">
366 <div id="aaiu-upload-trailer">
367 <ul id="aaiu-ul-list" class="aaiu-upload-list"></ul>
368 </div>
369
370 <div id="wpstream_trailerlist">
371 <?php
372 $ajax_nonce = wp_create_nonce( 'wpstream_trailer_upload' );
373 print '<input type="hidden" id="wpstream_trailer_upload" value="' . esc_html( $ajax_nonce ) . '" /> ';
374 if ( '' !== $video_html ) {
375 print trim( $video_html ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
376 }
377 ?>
378 </div>
379
380 <input type="hidden" id="upload_trailer" class="wpstream_upload_file" />
381 </div>
382
383 <div class="upload-container__actions-wrap upload-container__actions-wrap--column">
384 <p class="full_form full_form_trailer">
385 <?php
386 esc_html_e( "Upload a video trailer for your content. Supported formats: MP4, MOV", 'hello-wpstream' );
387 ?>
388 </p>
389
390 <div id="drag-and-drop" class="rh_drag_and_drop_wrapper">
391 <div id="aaiu-uploader-trailer" class="wpstream_theme_button_dashboard">
392 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
393 <path fill-rule="evenodd" clip-rule="evenodd" d="M10.7379 16.6273C9.96427 16.6273 9.31895 16.036 9.2514 15.2654C9.11015 13.6541 9.07441 12.0356 9.14427 10.4203C9.05994 10.4147 8.97563 10.4088 8.89133 10.4026L7.40178 10.2941C6.44973 10.2247 5.91752 9.16309 6.43151 8.35871C7.5277 6.6432 9.53693 4.72314 11.1904 3.53541C11.6742 3.18786 12.3258 3.18786 12.8097 3.53541C14.4631 4.72314 16.4723 6.64319 17.5685 8.35871C18.0825 9.16309 17.5503 10.2247 16.5983 10.2941L15.1087 10.4026C15.0244 10.4088 14.9401 10.4147 14.8558 10.4203C14.9256 12.0356 14.8899 13.6541 14.7486 15.2654C14.6811 16.036 14.0358 16.6273 13.2622 16.6273H10.7379ZM10.6815 9.76253C10.5678 11.5498 10.589 13.3431 10.745 15.1273H13.255C13.411 13.3431 13.4323 11.5498 13.3186 9.76253C13.3058 9.56216 13.3739 9.36505 13.5077 9.21531C13.6414 9.06556 13.8296 8.9757 14.0301 8.96582C14.3535 8.94989 14.6767 8.93015 14.9997 8.90661L16.0815 8.82775C15.1219 7.41445 13.9204 6.1802 12.5313 5.18235L12 4.80071L11.4687 5.18235C10.0796 6.1802 8.87813 7.41446 7.91858 8.82775L9.00038 8.90661C9.32337 8.93015 9.64656 8.94989 9.9699 8.96582C10.1704 8.9757 10.3586 9.06556 10.4924 9.21531C10.6261 9.36505 10.6942 9.56216 10.6815 9.76253Z" fill="#0F0F0F"/>
394 <path d="M5.75 17C5.75 16.5858 5.41421 16.25 5 16.25C4.58579 16.25 4.25 16.5858 4.25 17V19C4.25 19.9665 5.0335 20.75 6 20.75H18C18.9665 20.75 19.75 19.9665 19.75 19V17C19.75 16.5858 19.4142 16.25 19 16.25C18.5858 16.25 18.25 16.5858 18.25 17V19C18.25 19.1381 18.1381 19.25 18 19.25H6C5.86193 19.25 5.75 19.1381 5.75 19V17Z" fill="#0F0F0F"/>
395 </svg>
396
397 <?php esc_html_e( 'Change', 'hello-wpstream' ); ?>
398 </div>
399 </div>
400 </div>
401 </div>
402 </div>
403 </div>
404 <?php
405 $return_string .= ob_get_contents();
406 ob_end_clean();
407
408 return $return_string;
409 }
410 }
411
412 if ( ! function_exists( 'wpstream_theme_return_preview_upload_markup' ) ) {
413 /**
414 * Return the markup for preview video upload.
415 *
416 * This function generates and returns the markup for preview video upload based on the provided post ID.
417 *
418 * @param int $post_id The ID of the post.
419 * @return string The HTML markup for preview video upload.
420 */
421 function wpstream_theme_return_preview_upload_markup( $post_id ) {
422 $preview_id = get_post_meta( $post_id, 'video_preview', true );
423 $attachment_url = wp_get_attachment_url( $preview_id );
424 $video_html = '';
425
426 if ( $preview_id && $attachment_url ) {
427 $video_html = '<div class="wpstream_uplod_video" id="wpstream_uploaded_preview" data-videoid="' . esc_attr( $preview_id ) . '">'
428 .'<video height="240" controls><source src="' . esc_url( $attachment_url ) . '" type="video/mp4"></video></div>';
429 }
430
431 $return_string = '';
432 ob_start();
433 ?>
434
435 <div id="preview-upload-container">
436 <div id="aaiu-preview-container" class="upload-container">
437 <p class="upload-container__title"><?php echo esc_html__( 'Video Preview', 'hello-wpstream' ); ?></p>
438 <div class="upload-container__row">
439 <div class="upload-container__video-wrap">
440 <div id="aaiu-upload-preview">
441 <ul id="aaiu-ul-list" class="aaiu-upload-list"></ul>
442 </div>
443
444 <div id="wpstream_previewlist">
445 <?php
446 $ajax_nonce = wp_create_nonce( 'wpstream_preview_upload' );
447 print '<input type="hidden" id="wpstream_preview_upload" value="' . esc_html( $ajax_nonce ) . '" /> ';
448 if ( '' !== $video_html ) {
449 print trim( $video_html ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
450 }
451 ?>
452 </div>
453
454 <input type="hidden" id="upload_preview" class="wpstream_upload_file" />
455 </div>
456
457 <div class="upload-container__actions-wrap upload-container__actions-wrap--column">
458 <p class="full_form full_form_trailer">
459 <?php
460 esc_html_e( "Upload a video preview for your content. Supported formats: MP4, MOV", 'hello-wpstream' );
461 ?>
462 </p>
463
464 <div id="drag-and-drop" class="rh_drag_and_drop_wrapper">
465 <div id="aaiu-uploader-preview" class="wpstream_theme_button_dashboard">
466 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
467 <path fill-rule="evenodd" clip-rule="evenodd" d="M10.7379 16.6273C9.96427 16.6273 9.31895 16.036 9.2514 15.2654C9.11015 13.6541 9.07441 12.0356 9.14427 10.4203C9.05994 10.4147 8.97563 10.4088 8.89133 10.4026L7.40178 10.2941C6.44973 10.2247 5.91752 9.16309 6.43151 8.35871C7.5277 6.6432 9.53693 4.72314 11.1904 3.53541C11.6742 3.18786 12.3258 3.18786 12.8097 3.53541C14.4631 4.72314 16.4723 6.64319 17.5685 8.35871C18.0825 9.16309 17.5503 10.2247 16.5983 10.2941L15.1087 10.4026C15.0244 10.4088 14.9401 10.4147 14.8558 10.4203C14.9256 12.0356 14.8899 13.6541 14.7486 15.2654C14.6811 16.036 14.0358 16.6273 13.2622 16.6273H10.7379ZM10.6815 9.76253C10.5678 11.5498 10.589 13.3431 10.745 15.1273H13.255C13.411 13.3431 13.4323 11.5498 13.3186 9.76253C13.3058 9.56216 13.3739 9.36505 13.5077 9.21531C13.6414 9.06556 13.8296 8.9757 14.0301 8.96582C14.3535 8.94989 14.6767 8.93015 14.9997 8.90661L16.0815 8.82775C15.1219 7.41445 13.9204 6.1802 12.5313 5.18235L12 4.80071L11.4687 5.18235C10.0796 6.1802 8.87813 7.41446 7.91858 8.82775L9.00038 8.90661C9.32337 8.93015 9.64656 8.94989 9.9699 8.96582C10.1704 8.9757 10.3586 9.06556 10.4924 9.21531C10.6261 9.36505 10.6942 9.56216 10.6815 9.76253Z" fill="#0F0F0F"/>
468 <path d="M5.75 17C5.75 16.5858 5.41421 16.25 5 16.25C4.58579 16.25 4.25 16.5858 4.25 17V19C4.25 19.9665 5.0335 20.75 6 20.75H18C18.9665 20.75 19.75 19.9665 19.75 19V17C19.75 16.5858 19.4142 16.25 19 16.25C18.5858 16.25 18.25 16.5858 18.25 17V19C18.25 19.1381 18.1381 19.25 18 19.25H6C5.86193 19.25 5.75 19.1381 5.75 19V17Z" fill="#0F0F0F"/>
469 </svg>
470
471 <?php esc_html_e( 'Change', 'hello-wpstream' ); ?>
472 </div>
473 </div>
474 </div>
475 </div>
476 </div>
477 </div>
478 <?php
479 $return_string .= ob_get_contents();
480 ob_end_clean();
481
482 return $return_string;
483 }
484 }
485
486 if ( ! function_exists( 'wpstream_theme_build_html_gallery_dashboard' ) ) {
487 /**
488 * Build HTML for the gallery in the dashboard.
489 *
490 * This function builds HTML for the gallery in the dashboard based on the provided array of image IDs.
491 *
492 * @param array $gallery_images An array of image IDs.
493 * @return string The HTML string for the gallery.
494 */
495 function wpstream_theme_build_html_gallery_dashboard( $gallery_images ) {
496 $return_string = '';
497
498 if ( is_array( $gallery_images ) ) {
499 foreach ( $gallery_images as $attachment_id ) {
500 $preview = wp_get_attachment_image_src( $attachment_id, 'wpstream_featured_unit_cards' );
501
502 if ( $preview && '' !== $preview[0] ) {
503 $return_string .= '<div class="wpstream_uploaded_images" data-imageid="' . esc_attr( $attachment_id ) . '">';
504 $return_string .= '<img src="' . esc_url( $preview[0] ) . '" alt="' . esc_html__( 'thumb', 'hello-wpstream' ) . '" /></div>';
505 }
506 }
507 }
508
509 return $return_string;
510 }
511 }