Changeset 3374716
- Timestamp:
- 10/07/2025 10:57:57 PM (4 months ago)
- Location:
- enhanced-embed-block
- Files:
-
- 14 edited
- 1 copied
-
tags/1.3.0 (copied) (copied from enhanced-embed-block/trunk)
-
tags/1.3.0/css/lite-embed-fallback.css (modified) (1 diff)
-
tags/1.3.0/enhanced-embed-block.php (modified) (2 diffs)
-
tags/1.3.0/inc/generic.php (modified) (1 diff)
-
tags/1.3.0/inc/vimeo.php (modified) (2 diffs)
-
tags/1.3.0/inc/youtube.php (modified) (2 diffs)
-
tags/1.3.0/readme.txt (modified) (4 diffs)
-
tags/1.3.0/vendor/lite-youtube/lite-youtube.js (modified) (4 diffs)
-
trunk/css/lite-embed-fallback.css (modified) (1 diff)
-
trunk/enhanced-embed-block.php (modified) (2 diffs)
-
trunk/inc/generic.php (modified) (1 diff)
-
trunk/inc/vimeo.php (modified) (2 diffs)
-
trunk/inc/youtube.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/vendor/lite-youtube/lite-youtube.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
enhanced-embed-block/tags/1.3.0/css/lite-embed-fallback.css
r3293487 r3374716 9 9 text-align: center !important; 10 10 gap: 5% !important; 11 aspect-ratio: 16/9!important;11 aspect-ratio: var(--embed-aspect-ratio, 16/9) !important; 12 12 padding: 5% !important; 13 13 background-color: var(--eeb-fallback-background) !important; -
enhanced-embed-block/tags/1.3.0/enhanced-embed-block.php
r3306564 r3374716 7 7 * Author URI: https://MRWweb.com 8 8 * Text Domain: enhanced-embed-block 9 * Version: 1. 2.19 * Version: 1.3.0 10 10 * Requires at least: 6.5 11 11 * Requires PHP: 7.4 … … 20 20 namespace EnhancedEmbedBlock; 21 21 22 define( 'EEB_VERSION', '1. 2.1' );22 define( 'EEB_VERSION', '1.3.0' ); 23 23 24 24 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_lite_youtube_component' ); -
enhanced-embed-block/tags/1.3.0/inc/generic.php
r3293487 r3374716 36 36 return isset( $match[0] ) ? $match[0] : false; 37 37 } 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 */ 45 function 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 */ 58 function 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 35 35 /* Craft the new output: the web component with HTML fallback link */ 36 36 $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"> 38 38 <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> 40 40 <a href="%5$s" class="lite-embed-fallback" target="_blank" rel="noreferrer noopenner">Watch "%2$s" on Vimeo</a> 41 41 </lite-vimeo> … … 48 48 $start_time, 49 49 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 ) 51 54 ); 52 55 -
enhanced-embed-block/tags/1.3.0/inc/youtube.php
r3293487 r3374716 48 48 /* Craft the new output: the web component with HTML fallback link */ 49 49 $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"> 51 51 <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> 53 53 <a href="%6$s" class="lite-embed-fallback" target="_blank" rel="noreferrer noopenner">Watch "%7$s" on YouTube</a> 54 54 </lite-youtube> … … 63 63 esc_url( $block['attrs']['url'] ), 64 64 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 ) 66 69 ); 67 70 -
enhanced-embed-block/tags/1.3.0/readme.txt
r3306564 r3374716 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1. 2.18 Stable tag: 1.3.0 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 62 62 = Does it automatically enhance all my YouTube and Vimeo embeds? = 63 63 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 HTMLare not enhanced. Using the core WordPress Embed block is highly recommended!64 It 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! 65 65 66 66 = Why don't Google and Vimeo load all their videos this way by default? = … … 83 83 84 84 == 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 85 92 86 93 = 1.2.1 (4 June 2025) = … … 113 120 == Upgrade Notice == 114 121 115 = 1.2.0 = 116 Add Vimeo support! Upgrade lite-youtube custom element. Even faster loading times. 122 = 1.3.0 = 123 124 Add 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 210 210 generateIframe(isIntersectionObserver = false) { 211 211 let autoplay = isIntersectionObserver ? 0 : 1; 212 let autoPause = this.autoPause ? '&enablejsapi=1' : ''; 212 213 const wantsNoCookie = this.noCookie ? '-nocookie' : ''; 213 214 let embedTarget; … … 218 219 embedTarget = `${this.videoId}?`; 219 220 } 220 if (this.autoPause) {221 this.params = `enablejsapi=1`;222 }223 221 if (this.isYouTubeShort()) { 224 222 this.params = `loop=1&mute=1&modestbranding=1&playsinline=1&rel=0&enablejsapi=1&playlist=${this.videoId}`; … … 228 226 <iframe credentialless frameborder="0" title="${this.videoTitle}" 229 227 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}" 231 229 ></iframe>`; 232 230 } … … 344 342 LiteYTEmbed.isPreconnected = false; 345 343 customElements.define('lite-youtube', LiteYTEmbed); 346 //# sourceMappingURL=lite-youtube.js.map -
enhanced-embed-block/trunk/css/lite-embed-fallback.css
r3293487 r3374716 9 9 text-align: center !important; 10 10 gap: 5% !important; 11 aspect-ratio: 16/9!important;11 aspect-ratio: var(--embed-aspect-ratio, 16/9) !important; 12 12 padding: 5% !important; 13 13 background-color: var(--eeb-fallback-background) !important; -
enhanced-embed-block/trunk/enhanced-embed-block.php
r3306564 r3374716 7 7 * Author URI: https://MRWweb.com 8 8 * Text Domain: enhanced-embed-block 9 * Version: 1. 2.19 * Version: 1.3.0 10 10 * Requires at least: 6.5 11 11 * Requires PHP: 7.4 … … 20 20 namespace EnhancedEmbedBlock; 21 21 22 define( 'EEB_VERSION', '1. 2.1' );22 define( 'EEB_VERSION', '1.3.0' ); 23 23 24 24 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_lite_youtube_component' ); -
enhanced-embed-block/trunk/inc/generic.php
r3293487 r3374716 36 36 return isset( $match[0] ) ? $match[0] : false; 37 37 } 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 */ 45 function 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 */ 58 function 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 35 35 /* Craft the new output: the web component with HTML fallback link */ 36 36 $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"> 38 38 <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> 40 40 <a href="%5$s" class="lite-embed-fallback" target="_blank" rel="noreferrer noopenner">Watch "%2$s" on Vimeo</a> 41 41 </lite-vimeo> … … 48 48 $start_time, 49 49 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 ) 51 54 ); 52 55 -
enhanced-embed-block/trunk/inc/youtube.php
r3293487 r3374716 48 48 /* Craft the new output: the web component with HTML fallback link */ 49 49 $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"> 51 51 <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> 53 53 <a href="%6$s" class="lite-embed-fallback" target="_blank" rel="noreferrer noopenner">Watch "%7$s" on YouTube</a> 54 54 </lite-youtube> … … 63 63 esc_url( $block['attrs']['url'] ), 64 64 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 ) 66 69 ); 67 70 -
enhanced-embed-block/trunk/readme.txt
r3306564 r3374716 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1. 2.18 Stable tag: 1.3.0 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 62 62 = Does it automatically enhance all my YouTube and Vimeo embeds? = 63 63 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 HTMLare not enhanced. Using the core WordPress Embed block is highly recommended!64 It 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! 65 65 66 66 = Why don't Google and Vimeo load all their videos this way by default? = … … 83 83 84 84 == 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 85 92 86 93 = 1.2.1 (4 June 2025) = … … 113 120 == Upgrade Notice == 114 121 115 = 1.2.0 = 116 Add Vimeo support! Upgrade lite-youtube custom element. Even faster loading times. 122 = 1.3.0 = 123 124 Add support for block alignment (e.g. wide) and responsive block settings -
enhanced-embed-block/trunk/vendor/lite-youtube/lite-youtube.js
r3293487 r3374716 210 210 generateIframe(isIntersectionObserver = false) { 211 211 let autoplay = isIntersectionObserver ? 0 : 1; 212 let autoPause = this.autoPause ? '&enablejsapi=1' : ''; 212 213 const wantsNoCookie = this.noCookie ? '-nocookie' : ''; 213 214 let embedTarget; … … 218 219 embedTarget = `${this.videoId}?`; 219 220 } 220 if (this.autoPause) {221 this.params = `enablejsapi=1`;222 }223 221 if (this.isYouTubeShort()) { 224 222 this.params = `loop=1&mute=1&modestbranding=1&playsinline=1&rel=0&enablejsapi=1&playlist=${this.videoId}`; … … 228 226 <iframe credentialless frameborder="0" title="${this.videoTitle}" 229 227 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}" 231 229 ></iframe>`; 232 230 } … … 344 342 LiteYTEmbed.isPreconnected = false; 345 343 customElements.define('lite-youtube', LiteYTEmbed); 346 //# sourceMappingURL=lite-youtube.js.map
Note: See TracChangeset
for help on using the changeset viewer.