Edit File by line
/home/barbar84/www/wp-inclu...
File: media.php
[2500] Fix | Delete
$output .= "</{$itemtag}>";
[2501] Fix | Delete
[2502] Fix | Delete
if ( ! $html5 && $columns > 0 && 0 === ++$i % $columns ) {
[2503] Fix | Delete
$output .= '<br style="clear: both" />';
[2504] Fix | Delete
}
[2505] Fix | Delete
}
[2506] Fix | Delete
[2507] Fix | Delete
if ( ! $html5 && $columns > 0 && 0 !== $i % $columns ) {
[2508] Fix | Delete
$output .= "
[2509] Fix | Delete
<br style='clear: both' />";
[2510] Fix | Delete
}
[2511] Fix | Delete
[2512] Fix | Delete
$output .= "
[2513] Fix | Delete
</div>\n";
[2514] Fix | Delete
[2515] Fix | Delete
return $output;
[2516] Fix | Delete
}
[2517] Fix | Delete
[2518] Fix | Delete
/**
[2519] Fix | Delete
* Outputs the templates used by playlists.
[2520] Fix | Delete
*
[2521] Fix | Delete
* @since 3.9.0
[2522] Fix | Delete
*/
[2523] Fix | Delete
function wp_underscore_playlist_templates() {
[2524] Fix | Delete
?>
[2525] Fix | Delete
<script type="text/html" id="tmpl-wp-playlist-current-item">
[2526] Fix | Delete
<# if ( data.thumb && data.thumb.src ) { #>
[2527] Fix | Delete
<img src="{{ data.thumb.src }}" alt="" />
[2528] Fix | Delete
<# } #>
[2529] Fix | Delete
<div class="wp-playlist-caption">
[2530] Fix | Delete
<span class="wp-playlist-item-meta wp-playlist-item-title">
[2531] Fix | Delete
<?php
[2532] Fix | Delete
/* translators: %s: Playlist item title. */
[2533] Fix | Delete
printf( _x( '&#8220;%s&#8221;', 'playlist item title' ), '{{ data.title }}' );
[2534] Fix | Delete
?>
[2535] Fix | Delete
</span>
[2536] Fix | Delete
<# if ( data.meta.album ) { #><span class="wp-playlist-item-meta wp-playlist-item-album">{{ data.meta.album }}</span><# } #>
[2537] Fix | Delete
<# if ( data.meta.artist ) { #><span class="wp-playlist-item-meta wp-playlist-item-artist">{{ data.meta.artist }}</span><# } #>
[2538] Fix | Delete
</div>
[2539] Fix | Delete
</script>
[2540] Fix | Delete
<script type="text/html" id="tmpl-wp-playlist-item">
[2541] Fix | Delete
<div class="wp-playlist-item">
[2542] Fix | Delete
<a class="wp-playlist-caption" href="{{ data.src }}">
[2543] Fix | Delete
{{ data.index ? ( data.index + '. ' ) : '' }}
[2544] Fix | Delete
<# if ( data.caption ) { #>
[2545] Fix | Delete
{{ data.caption }}
[2546] Fix | Delete
<# } else { #>
[2547] Fix | Delete
<span class="wp-playlist-item-title">
[2548] Fix | Delete
<?php
[2549] Fix | Delete
/* translators: %s: Playlist item title. */
[2550] Fix | Delete
printf( _x( '&#8220;%s&#8221;', 'playlist item title' ), '{{{ data.title }}}' );
[2551] Fix | Delete
?>
[2552] Fix | Delete
</span>
[2553] Fix | Delete
<# if ( data.artists && data.meta.artist ) { #>
[2554] Fix | Delete
<span class="wp-playlist-item-artist"> &mdash; {{ data.meta.artist }}</span>
[2555] Fix | Delete
<# } #>
[2556] Fix | Delete
<# } #>
[2557] Fix | Delete
</a>
[2558] Fix | Delete
<# if ( data.meta.length_formatted ) { #>
[2559] Fix | Delete
<div class="wp-playlist-item-length">{{ data.meta.length_formatted }}</div>
[2560] Fix | Delete
<# } #>
[2561] Fix | Delete
</div>
[2562] Fix | Delete
</script>
[2563] Fix | Delete
<?php
[2564] Fix | Delete
}
[2565] Fix | Delete
[2566] Fix | Delete
/**
[2567] Fix | Delete
* Outputs and enqueue default scripts and styles for playlists.
[2568] Fix | Delete
*
[2569] Fix | Delete
* @since 3.9.0
[2570] Fix | Delete
*
[2571] Fix | Delete
* @param string $type Type of playlist. Accepts 'audio' or 'video'.
[2572] Fix | Delete
*/
[2573] Fix | Delete
function wp_playlist_scripts( $type ) {
[2574] Fix | Delete
wp_enqueue_style( 'wp-mediaelement' );
[2575] Fix | Delete
wp_enqueue_script( 'wp-playlist' );
[2576] Fix | Delete
?>
[2577] Fix | Delete
<!--[if lt IE 9]><script>document.createElement('<?php echo esc_js( $type ); ?>');</script><![endif]-->
[2578] Fix | Delete
<?php
[2579] Fix | Delete
add_action( 'wp_footer', 'wp_underscore_playlist_templates', 0 );
[2580] Fix | Delete
add_action( 'admin_footer', 'wp_underscore_playlist_templates', 0 );
[2581] Fix | Delete
}
[2582] Fix | Delete
[2583] Fix | Delete
/**
[2584] Fix | Delete
* Builds the Playlist shortcode output.
[2585] Fix | Delete
*
[2586] Fix | Delete
* This implements the functionality of the playlist shortcode for displaying
[2587] Fix | Delete
* a collection of WordPress audio or video files in a post.
[2588] Fix | Delete
*
[2589] Fix | Delete
* @since 3.9.0
[2590] Fix | Delete
*
[2591] Fix | Delete
* @global int $content_width
[2592] Fix | Delete
*
[2593] Fix | Delete
* @param array $attr {
[2594] Fix | Delete
* Array of default playlist attributes.
[2595] Fix | Delete
*
[2596] Fix | Delete
* @type string $type Type of playlist to display. Accepts 'audio' or 'video'. Default 'audio'.
[2597] Fix | Delete
* @type string $order Designates ascending or descending order of items in the playlist.
[2598] Fix | Delete
* Accepts 'ASC', 'DESC'. Default 'ASC'.
[2599] Fix | Delete
* @type string $orderby Any column, or columns, to sort the playlist. If $ids are
[2600] Fix | Delete
* passed, this defaults to the order of the $ids array ('post__in').
[2601] Fix | Delete
* Otherwise default is 'menu_order ID'.
[2602] Fix | Delete
* @type int $id If an explicit $ids array is not present, this parameter
[2603] Fix | Delete
* will determine which attachments are used for the playlist.
[2604] Fix | Delete
* Default is the current post ID.
[2605] Fix | Delete
* @type array $ids Create a playlist out of these explicit attachment IDs. If empty,
[2606] Fix | Delete
* a playlist will be created from all $type attachments of $id.
[2607] Fix | Delete
* Default empty.
[2608] Fix | Delete
* @type array $exclude List of specific attachment IDs to exclude from the playlist. Default empty.
[2609] Fix | Delete
* @type string $style Playlist style to use. Accepts 'light' or 'dark'. Default 'light'.
[2610] Fix | Delete
* @type bool $tracklist Whether to show or hide the playlist. Default true.
[2611] Fix | Delete
* @type bool $tracknumbers Whether to show or hide the numbers next to entries in the playlist. Default true.
[2612] Fix | Delete
* @type bool $images Show or hide the video or audio thumbnail (Featured Image/post
[2613] Fix | Delete
* thumbnail). Default true.
[2614] Fix | Delete
* @type bool $artists Whether to show or hide artist name in the playlist. Default true.
[2615] Fix | Delete
* }
[2616] Fix | Delete
*
[2617] Fix | Delete
* @return string Playlist output. Empty string if the passed type is unsupported.
[2618] Fix | Delete
*/
[2619] Fix | Delete
function wp_playlist_shortcode( $attr ) {
[2620] Fix | Delete
global $content_width;
[2621] Fix | Delete
$post = get_post();
[2622] Fix | Delete
[2623] Fix | Delete
static $instance = 0;
[2624] Fix | Delete
$instance++;
[2625] Fix | Delete
[2626] Fix | Delete
if ( ! empty( $attr['ids'] ) ) {
[2627] Fix | Delete
// 'ids' is explicitly ordered, unless you specify otherwise.
[2628] Fix | Delete
if ( empty( $attr['orderby'] ) ) {
[2629] Fix | Delete
$attr['orderby'] = 'post__in';
[2630] Fix | Delete
}
[2631] Fix | Delete
$attr['include'] = $attr['ids'];
[2632] Fix | Delete
}
[2633] Fix | Delete
[2634] Fix | Delete
/**
[2635] Fix | Delete
* Filters the playlist output.
[2636] Fix | Delete
*
[2637] Fix | Delete
* Returning a non-empty value from the filter will short-circuit generation
[2638] Fix | Delete
* of the default playlist output, returning the passed value instead.
[2639] Fix | Delete
*
[2640] Fix | Delete
* @since 3.9.0
[2641] Fix | Delete
* @since 4.2.0 The `$instance` parameter was added.
[2642] Fix | Delete
*
[2643] Fix | Delete
* @param string $output Playlist output. Default empty.
[2644] Fix | Delete
* @param array $attr An array of shortcode attributes.
[2645] Fix | Delete
* @param int $instance Unique numeric ID of this playlist shortcode instance.
[2646] Fix | Delete
*/
[2647] Fix | Delete
$output = apply_filters( 'post_playlist', '', $attr, $instance );
[2648] Fix | Delete
[2649] Fix | Delete
if ( ! empty( $output ) ) {
[2650] Fix | Delete
return $output;
[2651] Fix | Delete
}
[2652] Fix | Delete
[2653] Fix | Delete
$atts = shortcode_atts(
[2654] Fix | Delete
array(
[2655] Fix | Delete
'type' => 'audio',
[2656] Fix | Delete
'order' => 'ASC',
[2657] Fix | Delete
'orderby' => 'menu_order ID',
[2658] Fix | Delete
'id' => $post ? $post->ID : 0,
[2659] Fix | Delete
'include' => '',
[2660] Fix | Delete
'exclude' => '',
[2661] Fix | Delete
'style' => 'light',
[2662] Fix | Delete
'tracklist' => true,
[2663] Fix | Delete
'tracknumbers' => true,
[2664] Fix | Delete
'images' => true,
[2665] Fix | Delete
'artists' => true,
[2666] Fix | Delete
),
[2667] Fix | Delete
$attr,
[2668] Fix | Delete
'playlist'
[2669] Fix | Delete
);
[2670] Fix | Delete
[2671] Fix | Delete
$id = (int) $atts['id'];
[2672] Fix | Delete
[2673] Fix | Delete
if ( 'audio' !== $atts['type'] ) {
[2674] Fix | Delete
$atts['type'] = 'video';
[2675] Fix | Delete
}
[2676] Fix | Delete
[2677] Fix | Delete
$args = array(
[2678] Fix | Delete
'post_status' => 'inherit',
[2679] Fix | Delete
'post_type' => 'attachment',
[2680] Fix | Delete
'post_mime_type' => $atts['type'],
[2681] Fix | Delete
'order' => $atts['order'],
[2682] Fix | Delete
'orderby' => $atts['orderby'],
[2683] Fix | Delete
);
[2684] Fix | Delete
[2685] Fix | Delete
if ( ! empty( $atts['include'] ) ) {
[2686] Fix | Delete
$args['include'] = $atts['include'];
[2687] Fix | Delete
$_attachments = get_posts( $args );
[2688] Fix | Delete
[2689] Fix | Delete
$attachments = array();
[2690] Fix | Delete
foreach ( $_attachments as $key => $val ) {
[2691] Fix | Delete
$attachments[ $val->ID ] = $_attachments[ $key ];
[2692] Fix | Delete
}
[2693] Fix | Delete
} elseif ( ! empty( $atts['exclude'] ) ) {
[2694] Fix | Delete
$args['post_parent'] = $id;
[2695] Fix | Delete
$args['exclude'] = $atts['exclude'];
[2696] Fix | Delete
$attachments = get_children( $args );
[2697] Fix | Delete
} else {
[2698] Fix | Delete
$args['post_parent'] = $id;
[2699] Fix | Delete
$attachments = get_children( $args );
[2700] Fix | Delete
}
[2701] Fix | Delete
[2702] Fix | Delete
if ( ! empty( $args['post_parent'] ) ) {
[2703] Fix | Delete
$post_parent = get_post( $id );
[2704] Fix | Delete
[2705] Fix | Delete
// terminate the shortcode execution if user cannot read the post or password-protected
[2706] Fix | Delete
if ( ! current_user_can( 'read_post', $post_parent->ID ) || post_password_required( $post_parent ) ) {
[2707] Fix | Delete
return '';
[2708] Fix | Delete
}
[2709] Fix | Delete
}
[2710] Fix | Delete
[2711] Fix | Delete
if ( empty( $attachments ) ) {
[2712] Fix | Delete
return '';
[2713] Fix | Delete
}
[2714] Fix | Delete
[2715] Fix | Delete
if ( is_feed() ) {
[2716] Fix | Delete
$output = "\n";
[2717] Fix | Delete
foreach ( $attachments as $att_id => $attachment ) {
[2718] Fix | Delete
$output .= wp_get_attachment_link( $att_id ) . "\n";
[2719] Fix | Delete
}
[2720] Fix | Delete
return $output;
[2721] Fix | Delete
}
[2722] Fix | Delete
[2723] Fix | Delete
$outer = 22; // Default padding and border of wrapper.
[2724] Fix | Delete
[2725] Fix | Delete
$default_width = 640;
[2726] Fix | Delete
$default_height = 360;
[2727] Fix | Delete
[2728] Fix | Delete
$theme_width = empty( $content_width ) ? $default_width : ( $content_width - $outer );
[2729] Fix | Delete
$theme_height = empty( $content_width ) ? $default_height : round( ( $default_height * $theme_width ) / $default_width );
[2730] Fix | Delete
[2731] Fix | Delete
$data = array(
[2732] Fix | Delete
'type' => $atts['type'],
[2733] Fix | Delete
// Don't pass strings to JSON, will be truthy in JS.
[2734] Fix | Delete
'tracklist' => wp_validate_boolean( $atts['tracklist'] ),
[2735] Fix | Delete
'tracknumbers' => wp_validate_boolean( $atts['tracknumbers'] ),
[2736] Fix | Delete
'images' => wp_validate_boolean( $atts['images'] ),
[2737] Fix | Delete
'artists' => wp_validate_boolean( $atts['artists'] ),
[2738] Fix | Delete
);
[2739] Fix | Delete
[2740] Fix | Delete
$tracks = array();
[2741] Fix | Delete
foreach ( $attachments as $attachment ) {
[2742] Fix | Delete
$url = wp_get_attachment_url( $attachment->ID );
[2743] Fix | Delete
$ftype = wp_check_filetype( $url, wp_get_mime_types() );
[2744] Fix | Delete
$track = array(
[2745] Fix | Delete
'src' => $url,
[2746] Fix | Delete
'type' => $ftype['type'],
[2747] Fix | Delete
'title' => $attachment->post_title,
[2748] Fix | Delete
'caption' => $attachment->post_excerpt,
[2749] Fix | Delete
'description' => $attachment->post_content,
[2750] Fix | Delete
);
[2751] Fix | Delete
[2752] Fix | Delete
$track['meta'] = array();
[2753] Fix | Delete
$meta = wp_get_attachment_metadata( $attachment->ID );
[2754] Fix | Delete
if ( ! empty( $meta ) ) {
[2755] Fix | Delete
[2756] Fix | Delete
foreach ( wp_get_attachment_id3_keys( $attachment ) as $key => $label ) {
[2757] Fix | Delete
if ( ! empty( $meta[ $key ] ) ) {
[2758] Fix | Delete
$track['meta'][ $key ] = $meta[ $key ];
[2759] Fix | Delete
}
[2760] Fix | Delete
}
[2761] Fix | Delete
[2762] Fix | Delete
if ( 'video' === $atts['type'] ) {
[2763] Fix | Delete
if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
[2764] Fix | Delete
$width = $meta['width'];
[2765] Fix | Delete
$height = $meta['height'];
[2766] Fix | Delete
$theme_height = round( ( $height * $theme_width ) / $width );
[2767] Fix | Delete
} else {
[2768] Fix | Delete
$width = $default_width;
[2769] Fix | Delete
$height = $default_height;
[2770] Fix | Delete
}
[2771] Fix | Delete
[2772] Fix | Delete
$track['dimensions'] = array(
[2773] Fix | Delete
'original' => compact( 'width', 'height' ),
[2774] Fix | Delete
'resized' => array(
[2775] Fix | Delete
'width' => $theme_width,
[2776] Fix | Delete
'height' => $theme_height,
[2777] Fix | Delete
),
[2778] Fix | Delete
);
[2779] Fix | Delete
}
[2780] Fix | Delete
}
[2781] Fix | Delete
[2782] Fix | Delete
if ( $atts['images'] ) {
[2783] Fix | Delete
$thumb_id = get_post_thumbnail_id( $attachment->ID );
[2784] Fix | Delete
if ( ! empty( $thumb_id ) ) {
[2785] Fix | Delete
list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'full' );
[2786] Fix | Delete
$track['image'] = compact( 'src', 'width', 'height' );
[2787] Fix | Delete
list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' );
[2788] Fix | Delete
$track['thumb'] = compact( 'src', 'width', 'height' );
[2789] Fix | Delete
} else {
[2790] Fix | Delete
$src = wp_mime_type_icon( $attachment->ID );
[2791] Fix | Delete
$width = 48;
[2792] Fix | Delete
$height = 64;
[2793] Fix | Delete
$track['image'] = compact( 'src', 'width', 'height' );
[2794] Fix | Delete
$track['thumb'] = compact( 'src', 'width', 'height' );
[2795] Fix | Delete
}
[2796] Fix | Delete
}
[2797] Fix | Delete
[2798] Fix | Delete
$tracks[] = $track;
[2799] Fix | Delete
}
[2800] Fix | Delete
$data['tracks'] = $tracks;
[2801] Fix | Delete
[2802] Fix | Delete
$safe_type = esc_attr( $atts['type'] );
[2803] Fix | Delete
$safe_style = esc_attr( $atts['style'] );
[2804] Fix | Delete
[2805] Fix | Delete
ob_start();
[2806] Fix | Delete
[2807] Fix | Delete
if ( 1 === $instance ) {
[2808] Fix | Delete
/**
[2809] Fix | Delete
* Prints and enqueues playlist scripts, styles, and JavaScript templates.
[2810] Fix | Delete
*
[2811] Fix | Delete
* @since 3.9.0
[2812] Fix | Delete
*
[2813] Fix | Delete
* @param string $type Type of playlist. Possible values are 'audio' or 'video'.
[2814] Fix | Delete
* @param string $style The 'theme' for the playlist. Core provides 'light' and 'dark'.
[2815] Fix | Delete
*/
[2816] Fix | Delete
do_action( 'wp_playlist_scripts', $atts['type'], $atts['style'] );
[2817] Fix | Delete
}
[2818] Fix | Delete
?>
[2819] Fix | Delete
<div class="wp-playlist wp-<?php echo $safe_type; ?>-playlist wp-playlist-<?php echo $safe_style; ?>">
[2820] Fix | Delete
<?php if ( 'audio' === $atts['type'] ) : ?>
[2821] Fix | Delete
<div class="wp-playlist-current-item"></div>
[2822] Fix | Delete
<?php endif ?>
[2823] Fix | Delete
<<?php echo $safe_type; ?> controls="controls" preload="none" width="<?php echo (int) $theme_width; ?>"
[2824] Fix | Delete
<?php
[2825] Fix | Delete
if ( 'video' === $safe_type ) {
[2826] Fix | Delete
echo ' height="', (int) $theme_height, '"';
[2827] Fix | Delete
}
[2828] Fix | Delete
?>
[2829] Fix | Delete
></<?php echo $safe_type; ?>>
[2830] Fix | Delete
<div class="wp-playlist-next"></div>
[2831] Fix | Delete
<div class="wp-playlist-prev"></div>
[2832] Fix | Delete
<noscript>
[2833] Fix | Delete
<ol>
[2834] Fix | Delete
<?php
[2835] Fix | Delete
foreach ( $attachments as $att_id => $attachment ) {
[2836] Fix | Delete
printf( '<li>%s</li>', wp_get_attachment_link( $att_id ) );
[2837] Fix | Delete
}
[2838] Fix | Delete
?>
[2839] Fix | Delete
</ol>
[2840] Fix | Delete
</noscript>
[2841] Fix | Delete
<script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode( $data ); ?></script>
[2842] Fix | Delete
</div>
[2843] Fix | Delete
<?php
[2844] Fix | Delete
return ob_get_clean();
[2845] Fix | Delete
}
[2846] Fix | Delete
add_shortcode( 'playlist', 'wp_playlist_shortcode' );
[2847] Fix | Delete
[2848] Fix | Delete
/**
[2849] Fix | Delete
* Provides a No-JS Flash fallback as a last resort for audio / video.
[2850] Fix | Delete
*
[2851] Fix | Delete
* @since 3.6.0
[2852] Fix | Delete
*
[2853] Fix | Delete
* @param string $url The media element URL.
[2854] Fix | Delete
* @return string Fallback HTML.
[2855] Fix | Delete
*/
[2856] Fix | Delete
function wp_mediaelement_fallback( $url ) {
[2857] Fix | Delete
/**
[2858] Fix | Delete
* Filters the Mediaelement fallback output for no-JS.
[2859] Fix | Delete
*
[2860] Fix | Delete
* @since 3.6.0
[2861] Fix | Delete
*
[2862] Fix | Delete
* @param string $output Fallback output for no-JS.
[2863] Fix | Delete
* @param string $url Media file URL.
[2864] Fix | Delete
*/
[2865] Fix | Delete
return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url );
[2866] Fix | Delete
}
[2867] Fix | Delete
[2868] Fix | Delete
/**
[2869] Fix | Delete
* Returns a filtered list of supported audio formats.
[2870] Fix | Delete
*
[2871] Fix | Delete
* @since 3.6.0
[2872] Fix | Delete
*
[2873] Fix | Delete
* @return string[] Supported audio formats.
[2874] Fix | Delete
*/
[2875] Fix | Delete
function wp_get_audio_extensions() {
[2876] Fix | Delete
/**
[2877] Fix | Delete
* Filters the list of supported audio formats.
[2878] Fix | Delete
*
[2879] Fix | Delete
* @since 3.6.0
[2880] Fix | Delete
*
[2881] Fix | Delete
* @param string[] $extensions An array of supported audio formats. Defaults are
[2882] Fix | Delete
* 'mp3', 'ogg', 'flac', 'm4a', 'wav'.
[2883] Fix | Delete
*/
[2884] Fix | Delete
return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'flac', 'm4a', 'wav' ) );
[2885] Fix | Delete
}
[2886] Fix | Delete
[2887] Fix | Delete
/**
[2888] Fix | Delete
* Returns useful keys to use to lookup data from an attachment's stored metadata.
[2889] Fix | Delete
*
[2890] Fix | Delete
* @since 3.9.0
[2891] Fix | Delete
*
[2892] Fix | Delete
* @param WP_Post $attachment The current attachment, provided for context.
[2893] Fix | Delete
* @param string $context Optional. The context. Accepts 'edit', 'display'. Default 'display'.
[2894] Fix | Delete
* @return string[] Key/value pairs of field keys to labels.
[2895] Fix | Delete
*/
[2896] Fix | Delete
function wp_get_attachment_id3_keys( $attachment, $context = 'display' ) {
[2897] Fix | Delete
$fields = array(
[2898] Fix | Delete
'artist' => __( 'Artist' ),
[2899] Fix | Delete
'album' => __( 'Album' ),
[2900] Fix | Delete
);
[2901] Fix | Delete
[2902] Fix | Delete
if ( 'display' === $context ) {
[2903] Fix | Delete
$fields['genre'] = __( 'Genre' );
[2904] Fix | Delete
$fields['year'] = __( 'Year' );
[2905] Fix | Delete
$fields['length_formatted'] = _x( 'Length', 'video or audio' );
[2906] Fix | Delete
} elseif ( 'js' === $context ) {
[2907] Fix | Delete
$fields['bitrate'] = __( 'Bitrate' );
[2908] Fix | Delete
$fields['bitrate_mode'] = __( 'Bitrate Mode' );
[2909] Fix | Delete
}
[2910] Fix | Delete
[2911] Fix | Delete
/**
[2912] Fix | Delete
* Filters the editable list of keys to look up data from an attachment's metadata.
[2913] Fix | Delete
*
[2914] Fix | Delete
* @since 3.9.0
[2915] Fix | Delete
*
[2916] Fix | Delete
* @param array $fields Key/value pairs of field keys to labels.
[2917] Fix | Delete
* @param WP_Post $attachment Attachment object.
[2918] Fix | Delete
* @param string $context The context. Accepts 'edit', 'display'. Default 'display'.
[2919] Fix | Delete
*/
[2920] Fix | Delete
return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context );
[2921] Fix | Delete
}
[2922] Fix | Delete
/**
[2923] Fix | Delete
* Builds the Audio shortcode output.
[2924] Fix | Delete
*
[2925] Fix | Delete
* This implements the functionality of the Audio Shortcode for displaying
[2926] Fix | Delete
* WordPress mp3s in a post.
[2927] Fix | Delete
*
[2928] Fix | Delete
* @since 3.6.0
[2929] Fix | Delete
*
[2930] Fix | Delete
* @param array $attr {
[2931] Fix | Delete
* Attributes of the audio shortcode.
[2932] Fix | Delete
*
[2933] Fix | Delete
* @type string $src URL to the source of the audio file. Default empty.
[2934] Fix | Delete
* @type string $loop The 'loop' attribute for the `<audio>` element. Default empty.
[2935] Fix | Delete
* @type string $autoplay The 'autoplay' attribute for the `<audio>` element. Default empty.
[2936] Fix | Delete
* @type string $preload The 'preload' attribute for the `<audio>` element. Default 'none'.
[2937] Fix | Delete
* @type string $class The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'.
[2938] Fix | Delete
* @type string $style The 'style' attribute for the `<audio>` element. Default 'width: 100%;'.
[2939] Fix | Delete
* }
[2940] Fix | Delete
* @param string $content Shortcode content.
[2941] Fix | Delete
* @return string|void HTML content to display audio.
[2942] Fix | Delete
*/
[2943] Fix | Delete
function wp_audio_shortcode( $attr, $content = '' ) {
[2944] Fix | Delete
$post_id = get_post() ? get_the_ID() : 0;
[2945] Fix | Delete
[2946] Fix | Delete
static $instance = 0;
[2947] Fix | Delete
$instance++;
[2948] Fix | Delete
[2949] Fix | Delete
/**
[2950] Fix | Delete
* Filters the default audio shortcode output.
[2951] Fix | Delete
*
[2952] Fix | Delete
* If the filtered output isn't empty, it will be used instead of generating the default audio template.
[2953] Fix | Delete
*
[2954] Fix | Delete
* @since 3.6.0
[2955] Fix | Delete
*
[2956] Fix | Delete
* @param string $html Empty variable to be replaced with shortcode markup.
[2957] Fix | Delete
* @param array $attr Attributes of the shortcode. @see wp_audio_shortcode()
[2958] Fix | Delete
* @param string $content Shortcode content.
[2959] Fix | Delete
* @param int $instance Unique numeric ID of this audio shortcode instance.
[2960] Fix | Delete
*/
[2961] Fix | Delete
$override = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instance );
[2962] Fix | Delete
[2963] Fix | Delete
if ( '' !== $override ) {
[2964] Fix | Delete
return $override;
[2965] Fix | Delete
}
[2966] Fix | Delete
[2967] Fix | Delete
$audio = null;
[2968] Fix | Delete
[2969] Fix | Delete
$default_types = wp_get_audio_extensions();
[2970] Fix | Delete
$defaults_atts = array(
[2971] Fix | Delete
'src' => '',
[2972] Fix | Delete
'loop' => '',
[2973] Fix | Delete
'autoplay' => '',
[2974] Fix | Delete
'preload' => 'none',
[2975] Fix | Delete
'class' => 'wp-audio-shortcode',
[2976] Fix | Delete
'style' => 'width: 100%;',
[2977] Fix | Delete
);
[2978] Fix | Delete
foreach ( $default_types as $type ) {
[2979] Fix | Delete
$defaults_atts[ $type ] = '';
[2980] Fix | Delete
}
[2981] Fix | Delete
[2982] Fix | Delete
$atts = shortcode_atts( $defaults_atts, $attr, 'audio' );
[2983] Fix | Delete
[2984] Fix | Delete
$primary = false;
[2985] Fix | Delete
if ( ! empty( $atts['src'] ) ) {
[2986] Fix | Delete
$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
[2987] Fix | Delete
[2988] Fix | Delete
if ( ! in_array( strtolower( $type['ext'] ), $default_types, true ) ) {
[2989] Fix | Delete
return sprintf( '<a class="wp-embedded-audio" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
[2990] Fix | Delete
}
[2991] Fix | Delete
[2992] Fix | Delete
$primary = true;
[2993] Fix | Delete
array_unshift( $default_types, 'src' );
[2994] Fix | Delete
} else {
[2995] Fix | Delete
foreach ( $default_types as $ext ) {
[2996] Fix | Delete
if ( ! empty( $atts[ $ext ] ) ) {
[2997] Fix | Delete
$type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() );
[2998] Fix | Delete
[2999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function