wp_get_audio_extensions example

'enum'        => array( 'none', 'auto', 'metadata' ),
                'default'     => 'none',
                'description' => __( 'Preload' ),
            ),
            'loop'    => array(
                'type'        => 'boolean',
                'default'     => false,
                'description' => __( 'Loop' ),
            ),
        );

        foreach ( wp_get_audio_extensions() as $audio_extension ) {
            $schema[ $audio_extension ] = array(
                'type'        => 'string',
                'default'     => '',
                'format'      => 'uri',
                /* translators: %s: Audio extension. */
                'description' => sprintf( __( 'URL to the %s audio source file' )$audio_extension ),
            );
        }

        return array_merge( $schema, parent::get_instance_schema() );
    }

    
'doc',
        'ppt',
        'odt',
        'pptx',
        'docx',
        'pps',
        'ppsx',
        'xls',
        'xlsx',
        'key',
    );
    $audio_exts       = wp_get_audio_extensions();
    $video_exts       = wp_get_video_extensions();
    $upload_filetypes = array_unique( array_merge( $misc_exts$audio_exts$video_exts ) );

    $sitemeta = array(
        'site_name'                   => __( 'My Network' ),
        'admin_email'                 => $email,
        'admin_user_id'               => $site_user->ID,
        'registration'                => 'none',
        'upload_filetypes'            => implode( ' ', $upload_filetypes ),
        'blog_upload_space'           => 100,
        'fileupload_maxk'             => 1500,
        
if ( 'import' !== $post->post_mime_type ) {
        return $type === $ext;
    }

    switch ( $type ) {
        case 'image':
            $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' );
            return in_array( $ext$image_exts, true );

        case 'audio':
            return in_array( $extwp_get_audio_extensions(), true );

        case 'video':
            return in_array( $extwp_get_video_extensions(), true );

        default:
            return $type === $ext;
    }
}

/** * Determines whether an attachment is an image. * * For more information on this and similar theme functions, check out * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ * Conditional Tags} article in the Theme Developer Handbook. * * @since 2.1.0 * @since 4.2.0 Modified into wrapper for wp_attachment_is() and * allowed WP_Post object to be passed. * * @param int|WP_Post $post Optional. Attachment ID or object. Default is global $post. * @return bool Whether the attachment is an image. */


    wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' );

    /** * Filters the audio embed handler callback. * * @since 3.6.0 * * @param callable $handler Audio embed handler callback function. */
    wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . implode( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 );

    /** * Filters the video embed handler callback. * * @since 3.6.0 * * @param callable $handler Video embed handler callback function. */
    wp_embed_register_handler( 'video', '#^https?://.+?\.(' . implode( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 );
}



/** * Outputs the markup for an audio tag to be used in an Underscore template * when data.model is passed. * * @since 3.9.0 */
function wp_underscore_audio_template() {
    $audio_types = wp_get_audio_extensions();
    ?> <audio style="visibility: hidden" controls class="wp-audio-shortcode" width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}" preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}" <# <?php     foreach ( array( 'autoplay', 'loop' ) as $attr ) :
        ?> if ( ! _.isUndefined( data.model.<?php echo $attr; ?> ) && data.model.<?php echo $attr; ?> ) { #>

    $override = apply_filters( 'wp_audio_shortcode_override', '', $attr$content$instance );

    if ( '' !== $override ) {
        return $override;
    }

    $audio = null;

    $default_types = wp_get_audio_extensions();
    $defaults_atts = array(
        'src'      => '',
        'loop'     => '',
        'autoplay' => '',
        'preload'  => 'none',
        'class'    => 'wp-audio-shortcode',
        'style'    => 'width: 100%;',
    );
    foreach ( $default_types as $type ) {
        $defaults_atts[ $type ] = '';
    }

    
Home | Imprint | This part of the site doesn't use cookies.