Make WordPress Themes


Ignore:
Timestamp:
09/24/2024 02:00:16 PM (14 months ago)
Author:
themedropbox
Message:

New version of Inspiro - 1.9.3

Location:
inspiro/1.9.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • inspiro/1.9.3/inc/custom-header.php

    r242144 r243118  
    497497add_filter( 'customize_validate_external_header_video', 'inspiro_filter_external_header_video_setting_validity', 11, 2 );
    498498
     499
     500function inspiro_validate_header_video( $validity, $value ) {
     501    $video = get_attached_file( absint( $value ) );
     502    if ( $video ) {
     503        $size = filesize( $video );
     504        if ( $size > 8 * MB_IN_BYTES ) {
     505            $validity->add(
     506                'size_too_large',
     507                sprintf(
     508                    __( 'This video file is too large. The free version is limited to videos of 8MB or less, while the Premium and PRO versions do not have this limitation. Try a smaller video or consider upgrading to <a href="%1$s" target="_blank">Inspiro Premium</a>.' ),
     509                    esc_url( 'https://www.wpzoom.com/themes/inspiro/?utm_source=wpadmin&utm_medium=customizer&utm_campaign=video8mb' )
     510                )
     511            );
     512        }
     513
     514        if ( ! str_ends_with( $video, '.mp4' ) && ! str_ends_with( $video, '.mov' ) ) { // Check for .mp4 or .mov format, which (assuming h.264 encoding) are the only cross-browser-supported formats.
     515            $validity->add(
     516                'invalid_file_type',
     517                sprintf(
     518                    /* translators: 1: .mp4, 2: .mov */
     519                    __( 'Only %1$s or %2$s files may be used for header video. Please convert your video file and try again, or, upload your video to YouTube and link it with the option below.' ),
     520                    '<code>.mp4</code>',
     521                    '<code>.mov</code>'
     522                )
     523            );
     524        }
     525    }
     526    return $validity;
     527}
     528
     529add_filter( 'customize_dynamic_setting_args', function ( $args, $id ) {
     530
     531    if ( 'header_video' === $id ) {
     532        $args['validate_callback'] = 'inspiro_validate_header_video';
     533    }
     534
     535    return $args;
     536}, 10, 2 );
Note: See TracChangeset for help on using the changeset viewer.