Changeset 3089755
- Timestamp:
- 05/21/2024 02:09:02 AM (21 months ago)
- Location:
- lazy-embed
- Files:
-
- 8 added
- 2 edited
-
tags/1.6.0 (added)
-
tags/1.6.0/index.php (added)
-
tags/1.6.0/lazy-embed.php (added)
-
tags/1.6.0/licence.txt (added)
-
tags/1.6.0/partials (added)
-
tags/1.6.0/partials/embed-styles.css (added)
-
tags/1.6.0/partials/play.svg (added)
-
tags/1.6.0/readme.txt (added)
-
trunk/lazy-embed.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lazy-embed/trunk/lazy-embed.php
r3066506 r3089755 7 7 * Plugin URI: https://bitbucket.org/beleaf-au/lazy-embed/ 8 8 * Description: Improves the performance and reduces the emissions of your website by only loading embeds (youtube, vimeo, etc) when they are clicked. 9 * Version: 1.6. 09 * Version: 1.6.1 10 10 * Requires PHP: 7.1 11 11 * Requires at least: 6.2.0 … … 34 34 { 35 35 if ($block['blockName'] === 'core/embed' || $block['blockName'] === 'core/video') { 36 $tag = $block['blockName'] === 'core/embed' 37 ? 'iframe' 38 : 'video'; 39 40 $processor = new \WP_HTML_Tag_Processor($html); 41 $processor->next_tag($tag); 42 36 43 if (!empty($block['attrs']['className']) && str_contains($block['attrs']['className'], self::IGNORE_STRING)) { 37 38 $tag = $block['blockName'] === 'core/embed'39 ? 'iframe'40 : 'video';41 42 $processor = new \WP_HTML_Tag_Processor($html);43 $processor->next_tag($tag);44 44 $processor->add_class(self::IGNORE_STRING); 45 45 return $processor->get_updated_html(); 46 }elseif($tag === 'iframe') { 47 $processor->set_attribute('loading', 'lazy'); 46 48 return $processor->get_updated_html(); 47 49 } … … 181 183 $srcdoc .= '<a href="' . esc_url($iframeSrc) . '">'; 182 184 $srcdoc .= "<span>$play</span>"; 183 $srcdoc .= '<img src="' . esc_url($imageSrc) . '">';185 $srcdoc .= '<img loading="lazy" src="' . esc_url($imageSrc) . '">'; 184 186 $srcdoc .= '</a>'; 185 187 … … 256 258 // https://ourcodeworld.com/articles/read/1364/how-to-obtain-the-thumbnails-of-any-youtube-video 257 259 return !empty($id) 258 ? "https://img.youtube.com/vi/$id/ hqdefault.jpg"260 ? "https://img.youtube.com/vi/$id/maxresdefault.jpg" 259 261 : ''; 260 262 } -
lazy-embed/trunk/readme.txt
r3066506 r3089755 4 4 Requires at least: 6.2.0 5 5 Tested up to: 6.4 6 Stable tag: 1.6. 06 Stable tag: 1.6.1 7 7 Requires PHP: 5.6 8 8 License: GPLv2 or later … … 27 27 == Changelog == 28 28 29 = 1.6.0 = 29 = 1.6.1 = 30 Fix: Load high resolution thumbnail from youtube 31 Fix: Lazy load iframe and img tag placeholder 32 33 = 1.6.0 - 08/04/2024 = 30 34 Feat: Replace regular expressions with WP_HTML_Tag_Processor 31 35 Fix: A missing src tag on an iframe resulted in a fatal error. This nolonger happens. Thanks Dan
Note: See TracChangeset
for help on using the changeset viewer.