Plugin Directory

Changeset 2866032


Ignore:
Timestamp:
02/15/2023 10:51:00 PM (3 years ago)
Author:
beleaf
Message:

Release 1.2.0

Location:
lazy-embed
Files:
8 added
2 edited

Legend:

Unmodified
Added
Removed
  • lazy-embed/trunk/lazy-embed.php

    r2865623 r2866032  
    77 * Plugin URI: https://wordpress.org/plugins/lazy-embed/
    88 * 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.1.1
     9 * Version: 1.2.0
    1010 * Requires PHP: 7.1
    1111 * Requires at least: 4.0
     
    232232        private static function vimeoThumbnail(string $url): string
    233233        {
     234            $id = self::extractID($url);
     235            $transientName = 'lazy_embed_vimeo_' . $id;
     236
     237            if ($url = get_transient($transientName)) {
     238                return $url;
     239            }
     240
    234241            // https://developer.vimeo.com/api/oembed/videos
    235             $response = \wp_remote_get('https://vimeo.com/api/oembed.json?width=' . self::thumbnailSize() . '&url=' . $url);
     242            $response = \wp_remote_get('https://vimeo.com/api/oembed.json?' . http_build_query([
     243                'url' => 'https://vimeo.com' . '/' . $id,
     244                'width' => self::thumbnailSize(),
     245            ]));
     246
    236247            $json = \json_decode(\wp_remote_retrieve_body($response), true);
    237248
    238             return !empty($json['thumbnail_url'])
    239                 ? $json['thumbnail_url']
    240                 : '';
     249            if (empty($json['thumbnail_url'])) {
     250                return '';
     251            }
     252
     253            set_transient($transientName, $json['thumbnail_url']);
     254
     255            return $json['thumbnail_url'];
    241256        }
    242257
  • lazy-embed/trunk/readme.txt

    r2865660 r2866032  
    44Requires at least: 4.0
    55Tested up to: 6.1
    6 Stable tag: 1.1.1
     6Stable tag: 1.2.0
    77Requires PHP: 5.6
    88License: GPLv2 or later
     
    1313== Description ==
    1414
    15 Videos are one of the heavist assets that can be loaded on a webpage, and as such are one of the largest contributors to slow performance and high carbon emissions.
     15Videos are one of the largest assets that can be loaded on a webpage, and as such are one of the largest contributors to slow performance and high carbon emissions.
    1616
    1717In fact, adding a Youtube embed to a page using the latest default WordPress theme, increased the page transfer size from 21 kb to 973 kb, and loaded an additional 27 resources. That’s an increase in transfer size of 4533%. Adding a Vimeo video increased the transfer from 21 kb to 276 kb, an increase in transfer size of 1214%, and loaded an additional 7 resources.
     
    2727== Changelog ==
    2828
    29 = 1.1.1 =
     29= 1.2.0 - 16/02/2023 =
     30Fix: Vimeo embeds werent always retrieving their thumbnail due to a malformed url being passed to the Vimeo API. This is now fixed.
     31Feat: Add caching of the response from the query to the Vimeo API to improve performance and reduce emissions.
     32
     33= 1.1.1 - 15/02/2023 =
    3034Fix: Change muted parameter to mute for youtube embeds. Thanks @procontentxyz
    3135
    32 = 1.1.0 =
     36= 1.1.0 - 02/02/2023 =
    3337Fix: Use template_redirect hook to avoid iframe replacement on gutenberg save action
    3438Feat: Add support for all embeds on a page, not just the Gutenberg and TinyMCE
     
    3943QOL: House cleaning, formatting, and documentation
    4044
    41 = 1.0.0 =
     45= 1.0.0 - 11/01/2023 =
    4246Initial release.
    4347
     
    5155
    5256= Why do I have to click a video twice somtimes for it to play? =
    53 
    5457Browsers have become more restrictive around autoplaying a video. The first click on a video never reaches the video host, so they then show the default thumbnail. After the first time a Lazy Embed is interacted with, subsequent videos from that provider will not require a second load.
    5558
     59= I have updated the thumbnail for my video in Youtube/Vimeo/Dailymotion. Why am I not seeing the updated thumbnail? =
     60The thumbnails are cached to improve the performance (uncached frontend pages) and reduce the emissions (less requests to the video platform) of the Lazy Embed plugin.
     61
     62The cache is known as transients. You can clear the transient cache using a plugin like https://wordpress.org/plugins/wp-sweep/
     63
    5664= Why does it not work for my videos? =
    57 
    5865It could be for one of a few reasons.
    5966
Note: See TracChangeset for help on using the changeset viewer.