dozent_get_video( int $post_ID, null $key = null )
Get Video info which attached with this Course|Lecture
Description
See also
Parameters
- $post_ID
-
(int) (Required)
- $key
-
(null) (Optional)
Default value: null
Return
(array|bool|mixed)
Source
File: includes/core-functions.php
function dozent_get_video( $post_ID = 0, $key = null ) { $post_ID = dozent_get_post_id( $post_ID ); $video = (array) maybe_unserialize( get_post_meta( $post_ID, '_video', true ) ); $video_source = dozent_array_get( 'source', $video ); if ( $video_source === 'html5' ) { $video_id = dozent_array_get( 'html5_video_id', $video ); $video_info = (array) maybe_unserialize( get_post_meta( $video_id, '_wp_attachment_metadata', true ) ); if ( $video_info ) { $path = get_attached_file( $video_id ); $video['filesize'] = dozent_array_get( 'length', $video_info ); $video['mime_type'] = dozent_array_get( 'mime_type', $video_info ); $video['length'] = dozent_array_get( 'length', $video_info ); $video['length_formatted'] = dozent_array_get( 'length_formatted', $video_info ); $video['path'] = $path; $video['url'] = wp_get_attachment_url( $video_id ); $video['ext'] = strtolower( pathinfo( $path, PATHINFO_EXTENSION ) ); } } if ( $key ) { return dozent_array_get( $key, $video ); } return $video; }
Changelog
Version | Description |
---|---|
DozentLMS 1.0.0 | Introduced. |