Plugin Directory

Changeset 3374716


Ignore:
Timestamp:
10/07/2025 10:57:57 PM (4 months ago)
Author:
mrwweb
Message:

Update to version 1.3.0 from GitHub

Location:
enhanced-embed-block
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • enhanced-embed-block/tags/1.3.0/css/lite-embed-fallback.css

    r3293487 r3374716  
    99    text-align: center !important;
    1010    gap: 5% !important;
    11     aspect-ratio: 16/9 !important;
     11    aspect-ratio: var(--embed-aspect-ratio, 16/9) !important;
    1212    padding: 5% !important;
    1313    background-color: var(--eeb-fallback-background) !important;
  • enhanced-embed-block/tags/1.3.0/enhanced-embed-block.php

    r3306564 r3374716  
    77 * Author URI:      https://MRWweb.com
    88 * Text Domain:     enhanced-embed-block
    9  * Version:         1.2.1
     9 * Version:         1.3.0
    1010 * Requires at least: 6.5
    1111 * Requires PHP:    7.4
     
    2020namespace EnhancedEmbedBlock;
    2121
    22 define( 'EEB_VERSION', '1.2.1' );
     22define( 'EEB_VERSION', '1.3.0' );
    2323
    2424add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_lite_youtube_component' );
  • enhanced-embed-block/tags/1.3.0/inc/generic.php

    r3293487 r3374716  
    3636    return isset( $match[0] ) ? $match[0] : false;
    3737}
     38
     39/**
     40 * Generate the alignment class based on the block's alignment attribute
     41 *
     42 * @param array $block the block array
     43 * @return string aligment class or empty string
     44 */
     45function alignment_class( $block ) {
     46    if ( isset( $block['attrs']['align'] ) ) {
     47        return ' align' . esc_attr( $block['attrs']['align'] ) . ' ';
     48    }
     49    return '';
     50}
     51
     52/**
     53 * Set the correct styles to support WP aspect ratio detection
     54 *
     55 * @param array $block the block array
     56 * @return string style attribute or empty string if no aspect ratio class is present
     57 */
     58function aspect_ratio_style( $block ) {
     59    if( isset( $block['attrs']['className'] ) && str_contains( $block['attrs']['className'], 'wp-embed-aspect-' ) ) {
     60        $style = 'position:absolute;inset:0;';
     61        if( $block['attrs']['providerNameSlug'] === 'youtube' ) {
     62            //php regex to extract the aspect ratio from the class name
     63            preg_match( '/wp-embed-aspect-([0-9]+)-([0-9]+)/', $block['attrs']['className'], $matches );
     64            $style .= '--lite-youtube-aspect-ratio:' . $matches[1] . '/' . $matches[2] . ';';
     65        }
     66       
     67        return ' style="' . $style . '" ';
     68    }
     69    return '';
     70}
     71
  • enhanced-embed-block/tags/1.3.0/inc/vimeo.php

    r3293487 r3374716  
    3535    /* Craft the new output: the web component with HTML fallback link */
    3636    $content = sprintf(
    37         '<figure class="wp-block-embed-vimeo wp-block-embed is-type-video is-provider-vimeo">
     37        '<figure class="wp-block-embed-vimeo wp-block-embed is-type-video is-provider-vimeo %7$s %8$s">
    3838            <div class="wp-block-embed__wrapper">
    39                 <lite-vimeo videoid="%1$s" videotitle="%2$s" videoplay="%3$s" start="%4$ds">
     39                <lite-vimeo videoid="%1$s" videotitle="%2$s" videoplay="%3$s" start="%4$ds" %9$s>
    4040                    <a href="%5$s" class="lite-embed-fallback" target="_blank" rel="noreferrer noopenner">Watch "%2$s" on Vimeo</a>
    4141                </lite-vimeo>
     
    4848        $start_time,
    4949        esc_url( $block['attrs']['url'] ),
    50         $embed_caption
     50        $embed_caption,
     51        esc_attr( $block['attrs']['className'] ),
     52        alignment_class( $block ),
     53        aspect_ratio_style( $block )
    5154    );
    5255
  • enhanced-embed-block/tags/1.3.0/inc/youtube.php

    r3293487 r3374716  
    4848    /* Craft the new output: the web component with HTML fallback link */
    4949    $content = sprintf(
    50         '<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube">
     50        '<figure class="wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube %9$s%10$s">
    5151            <div class="wp-block-embed__wrapper">
    52                 <lite-youtube videoid="%1$s" videotitle="%7$s" videoplay="%2$s" videoStartAt="%3$d" posterquality="%4$s" posterloading="lazy"%5$s disablenoscript>
     52                <lite-youtube videoid="%1$s" videotitle="%7$s" videoplay="%2$s" videoStartAt="%3$d" posterquality="%4$s" posterloading="lazy"%5$s %11$s disablenoscript>
    5353                    <a href="%6$s" class="lite-embed-fallback" target="_blank" rel="noreferrer noopenner">Watch "%7$s" on YouTube</a>
    5454                </lite-youtube>
     
    6363        esc_url( $block['attrs']['url'] ),
    6464        esc_html( $video_title ),
    65         $embed_caption
     65        $embed_caption,
     66        esc_attr( $block['attrs']['className'] ),
     67        alignment_class( $block ),
     68        aspect_ratio_style( $block )
    6669    );
    6770
  • enhanced-embed-block/tags/1.3.0/readme.txt

    r3306564 r3374716  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.2.1
     8Stable tag: 1.3.0
    99License: GPLv3 or later
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    6262= Does it automatically enhance all my YouTube and Vimeo embeds? =
    6363
    64 It works for any embeds using the YouTube or Vimeo variations of the Embed block. Embeds using the [embed] shortcode or literal YouTube embed code in HTML are not enhanced. Using the core WordPress Embed block is highly recommended!
     64It works for any embeds using the YouTube or Vimeo variations of the Embed block. Embeds using the [embed] shortcode or a literal YouTube embed code in an HTML block are not enhanced. Using the core WordPress Embed block is highly recommended!
    6565
    6666= Why don't Google and Vimeo load all their videos this way by default? =
     
    8383
    8484== Changelog ==
     85
     86= 1.3.0 (7 October 2025) =
     87
     88- Add missing block CSS classes (including custom ones, if provided)
     89- Fixes alignment support (wide, full, etc.)
     90- Improve responsive and aspect ratio behavior of blocks. For instance, old YouTube videos now correctly display with 4/3 placeholder and video player!
     91- Update lite-youtube component to 1.8.2
    8592
    8693= 1.2.1 (4 June 2025) =
     
    113120== Upgrade Notice ==
    114121
    115 = 1.2.0 =
    116 Add Vimeo support! Upgrade lite-youtube custom element. Even faster loading times.
     122= 1.3.0 =
     123
     124Add support for block alignment (e.g. wide) and responsive block settings
  • enhanced-embed-block/tags/1.3.0/vendor/lite-youtube/lite-youtube.js

    r3293487 r3374716  
    210210    generateIframe(isIntersectionObserver = false) {
    211211        let autoplay = isIntersectionObserver ? 0 : 1;
     212        let autoPause = this.autoPause ? '&enablejsapi=1' : '';
    212213        const wantsNoCookie = this.noCookie ? '-nocookie' : '';
    213214        let embedTarget;
     
    218219            embedTarget = `${this.videoId}?`;
    219220        }
    220         if (this.autoPause) {
    221             this.params = `enablejsapi=1`;
    222         }
    223221        if (this.isYouTubeShort()) {
    224222            this.params = `loop=1&mute=1&modestbranding=1&playsinline=1&rel=0&enablejsapi=1&playlist=${this.videoId}`;
     
    228226<iframe credentialless frameborder="0" title="${this.videoTitle}"
    229227  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen
    230   src="https://www.youtube${wantsNoCookie}.com/embed/${embedTarget}autoplay=${autoplay}&${this.params}"
     228  src="https://www.youtube${wantsNoCookie}.com/embed/${embedTarget}autoplay=${autoplay}${autoPause}&${this.params}"
    231229></iframe>`;
    232230    }
     
    344342LiteYTEmbed.isPreconnected = false;
    345343customElements.define('lite-youtube', LiteYTEmbed);
    346 //# sourceMappingURL=lite-youtube.js.map
  • enhanced-embed-block/trunk/css/lite-embed-fallback.css

    r3293487 r3374716  
    99    text-align: center !important;
    1010    gap: 5% !important;
    11     aspect-ratio: 16/9 !important;
     11    aspect-ratio: var(--embed-aspect-ratio, 16/9) !important;
    1212    padding: 5% !important;
    1313    background-color: var(--eeb-fallback-background) !important;
  • enhanced-embed-block/trunk/enhanced-embed-block.php

    r3306564 r3374716  
    77 * Author URI:      https://MRWweb.com
    88 * Text Domain:     enhanced-embed-block
    9  * Version:         1.2.1
     9 * Version:         1.3.0
    1010 * Requires at least: 6.5
    1111 * Requires PHP:    7.4
     
    2020namespace EnhancedEmbedBlock;
    2121
    22 define( 'EEB_VERSION', '1.2.1' );
     22define( 'EEB_VERSION', '1.3.0' );
    2323
    2424add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_lite_youtube_component' );
  • enhanced-embed-block/trunk/inc/generic.php

    r3293487 r3374716  
    3636    return isset( $match[0] ) ? $match[0] : false;
    3737}
     38
     39/**
     40 * Generate the alignment class based on the block's alignment attribute
     41 *
     42 * @param array $block the block array
     43 * @return string aligment class or empty string
     44 */
     45function alignment_class( $block ) {
     46    if ( isset( $block['attrs']['align'] ) ) {
     47        return ' align' . esc_attr( $block['attrs']['align'] ) . ' ';
     48    }
     49    return '';
     50}
     51
     52/**
     53 * Set the correct styles to support WP aspect ratio detection
     54 *
     55 * @param array $block the block array
     56 * @return string style attribute or empty string if no aspect ratio class is present
     57 */
     58function aspect_ratio_style( $block ) {
     59    if( isset( $block['attrs']['className'] ) && str_contains( $block['attrs']['className'], 'wp-embed-aspect-' ) ) {
     60        $style = 'position:absolute;inset:0;';
     61        if( $block['attrs']['providerNameSlug'] === 'youtube' ) {
     62            //php regex to extract the aspect ratio from the class name
     63            preg_match( '/wp-embed-aspect-([0-9]+)-([0-9]+)/', $block['attrs']['className'], $matches );
     64            $style .= '--lite-youtube-aspect-ratio:' . $matches[1] . '/' . $matches[2] . ';';
     65        }
     66       
     67        return ' style="' . $style . '" ';
     68    }
     69    return '';
     70}
     71
  • enhanced-embed-block/trunk/inc/vimeo.php

    r3293487 r3374716  
    3535    /* Craft the new output: the web component with HTML fallback link */
    3636    $content = sprintf(
    37         '<figure class="wp-block-embed-vimeo wp-block-embed is-type-video is-provider-vimeo">
     37        '<figure class="wp-block-embed-vimeo wp-block-embed is-type-video is-provider-vimeo %7$s %8$s">
    3838            <div class="wp-block-embed__wrapper">
    39                 <lite-vimeo videoid="%1$s" videotitle="%2$s" videoplay="%3$s" start="%4$ds">
     39                <lite-vimeo videoid="%1$s" videotitle="%2$s" videoplay="%3$s" start="%4$ds" %9$s>
    4040                    <a href="%5$s" class="lite-embed-fallback" target="_blank" rel="noreferrer noopenner">Watch "%2$s" on Vimeo</a>
    4141                </lite-vimeo>
     
    4848        $start_time,
    4949        esc_url( $block['attrs']['url'] ),
    50         $embed_caption
     50        $embed_caption,
     51        esc_attr( $block['attrs']['className'] ),
     52        alignment_class( $block ),
     53        aspect_ratio_style( $block )
    5154    );
    5255
  • enhanced-embed-block/trunk/inc/youtube.php

    r3293487 r3374716  
    4848    /* Craft the new output: the web component with HTML fallback link */
    4949    $content = sprintf(
    50         '<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube">
     50        '<figure class="wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube %9$s%10$s">
    5151            <div class="wp-block-embed__wrapper">
    52                 <lite-youtube videoid="%1$s" videotitle="%7$s" videoplay="%2$s" videoStartAt="%3$d" posterquality="%4$s" posterloading="lazy"%5$s disablenoscript>
     52                <lite-youtube videoid="%1$s" videotitle="%7$s" videoplay="%2$s" videoStartAt="%3$d" posterquality="%4$s" posterloading="lazy"%5$s %11$s disablenoscript>
    5353                    <a href="%6$s" class="lite-embed-fallback" target="_blank" rel="noreferrer noopenner">Watch "%7$s" on YouTube</a>
    5454                </lite-youtube>
     
    6363        esc_url( $block['attrs']['url'] ),
    6464        esc_html( $video_title ),
    65         $embed_caption
     65        $embed_caption,
     66        esc_attr( $block['attrs']['className'] ),
     67        alignment_class( $block ),
     68        aspect_ratio_style( $block )
    6669    );
    6770
  • enhanced-embed-block/trunk/readme.txt

    r3306564 r3374716  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.2.1
     8Stable tag: 1.3.0
    99License: GPLv3 or later
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    6262= Does it automatically enhance all my YouTube and Vimeo embeds? =
    6363
    64 It works for any embeds using the YouTube or Vimeo variations of the Embed block. Embeds using the [embed] shortcode or literal YouTube embed code in HTML are not enhanced. Using the core WordPress Embed block is highly recommended!
     64It works for any embeds using the YouTube or Vimeo variations of the Embed block. Embeds using the [embed] shortcode or a literal YouTube embed code in an HTML block are not enhanced. Using the core WordPress Embed block is highly recommended!
    6565
    6666= Why don't Google and Vimeo load all their videos this way by default? =
     
    8383
    8484== Changelog ==
     85
     86= 1.3.0 (7 October 2025) =
     87
     88- Add missing block CSS classes (including custom ones, if provided)
     89- Fixes alignment support (wide, full, etc.)
     90- Improve responsive and aspect ratio behavior of blocks. For instance, old YouTube videos now correctly display with 4/3 placeholder and video player!
     91- Update lite-youtube component to 1.8.2
    8592
    8693= 1.2.1 (4 June 2025) =
     
    113120== Upgrade Notice ==
    114121
    115 = 1.2.0 =
    116 Add Vimeo support! Upgrade lite-youtube custom element. Even faster loading times.
     122= 1.3.0 =
     123
     124Add support for block alignment (e.g. wide) and responsive block settings
  • enhanced-embed-block/trunk/vendor/lite-youtube/lite-youtube.js

    r3293487 r3374716  
    210210    generateIframe(isIntersectionObserver = false) {
    211211        let autoplay = isIntersectionObserver ? 0 : 1;
     212        let autoPause = this.autoPause ? '&enablejsapi=1' : '';
    212213        const wantsNoCookie = this.noCookie ? '-nocookie' : '';
    213214        let embedTarget;
     
    218219            embedTarget = `${this.videoId}?`;
    219220        }
    220         if (this.autoPause) {
    221             this.params = `enablejsapi=1`;
    222         }
    223221        if (this.isYouTubeShort()) {
    224222            this.params = `loop=1&mute=1&modestbranding=1&playsinline=1&rel=0&enablejsapi=1&playlist=${this.videoId}`;
     
    228226<iframe credentialless frameborder="0" title="${this.videoTitle}"
    229227  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen
    230   src="https://www.youtube${wantsNoCookie}.com/embed/${embedTarget}autoplay=${autoplay}&${this.params}"
     228  src="https://www.youtube${wantsNoCookie}.com/embed/${embedTarget}autoplay=${autoplay}${autoPause}&${this.params}"
    231229></iframe>`;
    232230    }
     
    344342LiteYTEmbed.isPreconnected = false;
    345343customElements.define('lite-youtube', LiteYTEmbed);
    346 //# sourceMappingURL=lite-youtube.js.map
Note: See TracChangeset for help on using the changeset viewer.