PATH:
home
/
fengshp
/
www
/
wp-content
/
plugins
/
themify-builder-pro
/
includes
/
dynamic-content
<?php /** * @package Themify Builder Pro * @link https://themify.me/ */ class Tbp_Dynamic_Item_PTBAudioPlaylist extends Tbp_Dynamic_Item { public static function is_available():bool { return class_exists( 'Themify_Builder_Plugin_Compat_ptb',false ); } public static function get_category():string { return 'ptb'; } public static function get_type():array { return array( 'wp_editor' ); } public static function get_label():string { return __( 'PTB (Audio Playlist)', 'tbp' ); } public static function get_value(array $args = array()):?string { $value = ''; if ( ! empty( $args['field'] ) ) { $field_name = explode( ':', $args['field'] ); $cf_value = get_post_meta( $args['post_id'] ?? get_the_ID(), "ptb_{$field_name[1]}", true ); if ( isset( $cf_value['url'] ) && is_array( $cf_value['url'] ) ) { $value = self::make_playlist( $cf_value ); } } return $value; } /** * Create audio playlist * * Modified version of wp_playlist_shortcode() where it also support external audio. */ private static function make_playlist(array $value ):string { if ( is_feed() ) { $output =PHP_EOL; foreach ( $value['url'] as $audio ) { $output .= $audio .PHP_EOL; } return $output; } $tracks = array(); foreach ( $value['url'] as $i => $url ) { $attachment_id = attachment_url_to_postid( $url ); $ftype = wp_check_filetype( $url, wp_get_mime_types() ); $track = array( 'src' => $url, 'type' => $ftype['type'], 'title' => $value['title'][ $i ], 'caption' => $value['description'][ $i ], ); $track['meta'] = array(); $meta = false; if ( $attachment_id ) { $meta = wp_get_attachment_metadata( $attachment_id ); } if ( ! empty( $meta ) ) { $attachment_post = get_post( $attachment_id ); foreach ( wp_get_attachment_id3_keys( $attachment_post ) as $key => $label ) { if ( ! empty( $meta[ $key ] ) ) { $track['meta'][ $key ] = $meta[ $key ]; } } } if ( $attachment_id ) { $thumb_id = get_post_thumbnail_id( $attachment_id ); if ( ! empty( $thumb_id ) ) { list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' ); $track['thumb'] = compact( 'src', 'width', 'height' ); } else { $mime_icon = wp_mime_type_icon( $attachment_id ); if ( $mime_icon ) { $track['thumb'] = [ 'src' => $mime_icon, 'width' => 48, 'height' => 64 ]; } } } $tracks[] = $track; } return Themify_Enqueue_Assets::audio_playlist( array( 'type' => 'audio', 'tracks' => $tracks, ) ); } public static function get_options():array { return array( array( 'label' => 'tbp_f', 'id' => 'field', 'type' => 'select', 'dataset' => 'ptb_fields', 'dataset_args' => [ 'type' => [ 'audio' ] ] ), ); } }
[+]
..
[-] ProductSalePrice.php
[edit]
[-] PTBGallery.php
[edit]
[-] WCCheckoutURL.php
[edit]
[-] PostDate.php
[edit]
[-] ACFURL.php
[edit]
[-] PostTermsClass.php
[edit]
[-] PostAuthorURL.php
[edit]
[-] ACFWysiwyg.php
[edit]
[-] PostAuthorEmail.php
[edit]
[-] PTBGalleryAsText.php
[edit]
[-] PTBAudioPlaylist.php
[edit]
[-] ProductTitle.php
[edit]
[-] PTBIconAsIcon.php
[edit]
[-] PTBTelephone.php
[edit]
[-] PTBSelectClass.php
[edit]
[-] ProductCartUrl.php
[edit]
[-] PostAuthorMeta.php
[edit]
[-] tbpTermCover.php
[edit]
[-] PTBEmail.php
[edit]
[-] ArchiveTitle.php
[edit]
[-] SiteURL.php
[edit]
[-] PostAuthorBio.php
[edit]
[-] ACFChoice.php
[edit]
[-] PTBDateAsText.php
[edit]
[-] ACFGallery.php
[edit]
[-] PTBRatingAsText.php
[edit]
[-] ACFEmail.php
[edit]
[-] Option.php
[edit]
[-] PostAuthorClass.php
[edit]
[-] PostCommentCount.php
[edit]
[-] ProductAttributes.php
[edit]
[-] PTBRadioButtonClass.php
[edit]
[-] ACFNumber.php
[edit]
[-] PTBAudio.php
[edit]
[-] PTBTextarea.php
[edit]
[-] PostTerms.php
[edit]
[-] ACFDate.php
[edit]
[-] PTBText.php
[edit]
[-] PostFeaturedImage.php
[edit]
[-] PTBAccordion.php
[edit]
[-] ACFoEmbed.php
[edit]
[-] ProductSKU.php
[edit]
[-] Shortcode.php
[edit]
[-] CurrentDate.php
[edit]
[-] PTBFile.php
[edit]
[-] PTBLinkButton.php
[edit]
[-] PTBMap.php
[edit]
[-] PTBRadioButton.php
[edit]
[-] CustomField.php
[edit]
[-] PTBRating.php
[edit]
[-] ACFFile.php
[edit]
[-] PTBCheckboxClass.php
[edit]
[-] FileContent.php
[edit]
[-] PTBVideoPlaylist.php
[edit]
[-] PTBRepeatableText.php
[edit]
[-] ProductDescription.php
[edit]
[-] PTBIcon.php
[edit]
[-] ArchiveDescription.php
[edit]
[-] PostImageAttachments.php
[edit]
[-] ACFMap.php
[edit]
[-] PTBRelations.php
[edit]
[-] PostAuthorName.php
[edit]
[-] PostAuthorAvatar.php
[edit]
[-] PTBVideo.php
[edit]
[-] ACFText.php
[edit]
[-] PTBDate.php
[edit]
[-] ACFImage.php
[edit]
[-] ACFTextarea.php
[edit]
[-] ProductImage.php
[edit]
[-] PTBNumber.php
[edit]
[-] ProductRating.php
[edit]
[-] ProductStock.php
[edit]
[-] PTBImage.php
[edit]
[-] ProductPrice.php
[edit]
[-] SiteDescription.php
[edit]
[-] EventPostDate.php
[edit]
[-] SiteTitle.php
[edit]
[-] ProductGallery.php
[edit]
[-] MediaLibrary.php
[edit]
[-] RandomNumber.php
[edit]
[-] PostExcerpt.php
[edit]
[-] PTBCheckbox.php
[edit]
[-] ProductCatImage.php
[edit]
[-] PostTitle.php
[edit]
[-] PostClass.php
[edit]
[-] PTBProgressBar.php
[edit]
[-] PTBIconAsText.php
[edit]
[-] ACFPageLink.php
[edit]
[-] PostPermalink.php
[edit]
[-] SiteIcon.php
[edit]
[-] PTBAcc.php
[edit]
[-] PTBSelect.php
[edit]