Skip to content

Commit

Permalink
Merge pull request #1870 from WordPress/release/3.9.0
Browse files Browse the repository at this point in the history
Post 3.9.0 release merge
  • Loading branch information
westonruter authored Feb 13, 2025
2 parents d21b74d + 91bc26d commit 42bd7a8
Show file tree
Hide file tree
Showing 17 changed files with 153 additions and 37 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Plugin | Slug | Experimental | Lin
[Image Placeholders][1] | `dominant-color-images` | No | [Source][9], [Issues][17], [PRs][25]
[Image Prioritizer][7] | `image-prioritizer` | No | [Source][15], [Issues][23], [PRs][31]
[Modern Image Formats][2] | `webp-uploads` | No | [Source][10], [Issues][18], [PRs][26]
[Optimization Detective][33] | `optimization-detective` | No | [Source][34], [Issues][35], [PRs][36]
[Performant Translations][3] | `performant-translations` | No | [Source][11], [Issues][19], [PRs][27]
[Speculative Loading][4] | `speculation-rules` | No | [Source][12], [Issues][20], [PRs][28]
[Enhanced Responsive Images][6] | `auto-sizes` | Yes | [Source][14], [Issues][22], [PRs][30]
Expand All @@ -28,6 +29,7 @@ Plugin | Slug | Experimental | Lin
[6]: https://wordpress.org/plugins/auto-sizes/
[7]: https://wordpress.org/plugins/image-prioritizer/
[8]: https://wordpress.org/plugins/web-worker-offloading/
[33]: https://wordpress.org/plugins/optimization-detective/

[9]: https://github.com/WordPress/performance/tree/trunk/plugins/dominant-color-images
[10]: https://github.com/WordPress/performance/tree/trunk/plugins/webp-uploads
Expand All @@ -37,6 +39,7 @@ Plugin | Slug | Experimental | Lin
[14]: https://github.com/WordPress/performance/tree/trunk/plugins/auto-sizes
[15]: https://github.com/WordPress/performance/tree/trunk/plugins/image-prioritizer
[16]: https://github.com/WordPress/performance/tree/trunk/plugins/web-worker-offloading
[34]: https://github.com/WordPress/performance/tree/trunk/plugins/optimization-detective

[17]: https://github.com/WordPress/performance/issues?q=is%3Aopen+label%3A%22%5BPlugin%5D+Image+Placeholders%22
[18]: https://github.com/WordPress/performance/issues?q=is%3Aopen+label%3A%22%5BPlugin%5D+Modern+Image+Formats%22
Expand All @@ -46,6 +49,7 @@ Plugin | Slug | Experimental | Lin
[22]: https://github.com/WordPress/performance/issues?q=is%3Aopen+label%3A%22%5BPlugin%5D+Enhanced+Responsive+Images%22
[23]: https://github.com/WordPress/performance/issues?q=is%3Aopen+label%3A%22%5BPlugin%5D+Image+Prioritizer%22
[24]: https://github.com/WordPress/performance/issues?q=is%3Aopen%20label%3A%22%5BPlugin%5D%20Web%20Worker%20Offloading%22
[35]: https://github.com/WordPress/performance/issues?q=is%3Aopen%20label%3A%22%5BPlugin%5D%20Optimization%20Detective%22

[25]: https://github.com/WordPress/performance/pulls?q=is%3Apr+is%3Aopen+label%3A%22%5BPlugin%5D+Image+Placeholders%22
[26]: https://github.com/WordPress/performance/pulls?q=is%3Apr+is%3Aopen+label%3A%22%5BPlugin%5D+Modern+Image+Formats%22
Expand All @@ -55,5 +59,6 @@ Plugin | Slug | Experimental | Lin
[30]: https://github.com/WordPress/performance/pulls?q=is%3Apr+is%3Aopen+label%3A%22%5BPlugin%5D+Enhanced+Responsive+Images%22
[31]: https://github.com/WordPress/performance/pulls?q=is%3Apr+is%3Aopen+label%3A%22%5BPlugin%5D+Image+Prioritizer%22
[32]: https://github.com/WordPress/performance/pulls?q=is%3Apr+is%3Aopen+label%3A%22%5BPlugin%5D+Web%20Worker%20Offloading%22
[36]: https://github.com/WordPress/performance/pulls?q=is%3Apr+is%3Aopen+label%3A%22%5BPlugin%5D+Optimization%20Detective%22

Note that the plugin names sometimes diverge from the plugin slugs due to scope changes. For example, a plugin's purpose may change as some of its features are merged into WordPress core.
4 changes: 2 additions & 2 deletions plugins/embed-optimizer/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Optimizes the performance of embeds through lazy-loading, preconnecting, and reserving space to reduce layout shifts.
* Requires at least: 6.6
* Requires PHP: 7.2
* Version: 0.4.1
* Version: 1.0.0-beta1
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPLv2 or later
Expand Down Expand Up @@ -71,7 +71,7 @@ static function ( string $global_var_name, string $version, Closure $load ): voi
}
)(
'embed_optimizer_pending_plugin',
'0.4.1',
'1.0.0-beta1',
static function ( string $version ): void {
if ( defined( 'EMBED_OPTIMIZER_VERSION' ) ) {
return;
Expand Down
9 changes: 8 additions & 1 deletion plugins/embed-optimizer/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributors: wordpressdotorg
Tested up to: 6.7
Stable tag: 0.4.1
Stable tag: 1.0.0-beta1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: performance, embeds
Expand Down Expand Up @@ -67,6 +67,13 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu

== Changelog ==

= 1.0.0-beta1 =

**Enhancements**

* Bump version to 1.0.0-beta1 to indicate graduation from being experimental. See [1846](https://github.com/WordPress/performance/pull/1846).
* Use CSS range syntax in media queries. ([1833](https://github.com/WordPress/performance/pull/1833))

= 0.4.1 =

**Bug Fixes**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ private function sizes_attribute_includes_valid_auto( string $sizes_attr ): bool
/**
* Computes responsive sizes for the current element based on its boundingClientRect width captured in URL Metrics.
*
* @since n.e.x.t
* @since 1.0.0
*
* @param OD_Tag_Visitor_Context $context Context.
* @return non-empty-string[] Computed sizes.
Expand Down
4 changes: 2 additions & 2 deletions plugins/image-prioritizer/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Requires at least: 6.6
* Requires PHP: 7.2
* Requires Plugins: optimization-detective
* Version: 0.3.1
* Version: 1.0.0-beta1
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPLv2 or later
Expand Down Expand Up @@ -72,7 +72,7 @@ static function ( string $global_var_name, string $version, Closure $load ): voi
}
)(
'image_prioritizer_pending_plugin',
'0.3.1',
'1.0.0-beta1',
static function ( string $version ): void {
if ( defined( 'IMAGE_PRIORITIZER_VERSION' ) ) {
return;
Expand Down
9 changes: 8 additions & 1 deletion plugins/image-prioritizer/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributors: wordpressdotorg
Tested up to: 6.7
Stable tag: 0.3.1
Stable tag: 1.0.0-beta1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: performance, optimization, image, lcp, lazy-load
Expand Down Expand Up @@ -72,6 +72,13 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu

== Changelog ==

= 1.0.0-beta1 =

**Enhancements**

* Bump version to 1.0.0-beta1 to indicate graduation from being experimental. See [1846](https://github.com/WordPress/performance/pull/1846).
* Compute responsive `sizes` attribute based on the `width` from the `boundingClientRect` in captured URL Metrics. ([1840](https://github.com/WordPress/performance/pull/1840))

= 0.3.1 =

**Bug Fixes**
Expand Down
54 changes: 43 additions & 11 deletions plugins/optimization-detective/class-od-link-collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,22 +267,32 @@ public function get_response_header(): ?string {

foreach ( $this->get_prepared_links() as $link ) {
if ( isset( $link['href'] ) ) {
$decoded_url = urldecode( $link['href'] );

// Encode characters not allowed in a URL per RFC 3986 (anything that is not among the reserved and unreserved characters).
$encoded_url = preg_replace_callback(
'/[^A-Za-z0-9\-._~:\/?#\[\]@!$&\'()*+,;=]/',
static function ( $matches ) {
return rawurlencode( $matches[0] );
},
$decoded_url
);
$link['href'] = esc_url_raw( $encoded_url ?? '' );
$link['href'] = $this->encode_url_for_response_header( $link['href'] );
} else {
// The about:blank is present since a Link without a reference-uri is invalid so any imagesrcset would otherwise not get downloaded.
$link['href'] = 'about:blank';
}

// Encode the URLs in the srcset.
if ( isset( $link['imagesrcset'] ) ) {
$link['imagesrcset'] = join(
', ',
array_map(
function ( $image_candidate ) {
// Parse out the URL to separate it from the descriptor.
$image_candidate_parts = (array) preg_split( '/\s+/', (string) $image_candidate, 2 );

// Encode the URL.
$image_candidate_parts[0] = $this->encode_url_for_response_header( (string) $image_candidate_parts[0] );

// Re-join the URL with the descriptor.
return implode( ' ', $image_candidate_parts );
},
(array) preg_split( '/\s*,\s*/', $link['imagesrcset'] )
)
);
}

$link_header = '<' . $link['href'] . '>';
unset( $link['href'] );
foreach ( $link as $name => $value ) {
Expand Down Expand Up @@ -310,6 +320,28 @@ static function ( $matches ) {
return 'Link: ' . implode( ', ', $link_headers );
}

/**
* Encodes a URL for serving in an HTTP response header.
*
* @since n.e.x.t
*
* @param string $url URL to percent encode. Any existing percent encodings will first be decoded.
* @return string Percent-encoded URL.
*/
private function encode_url_for_response_header( string $url ): string {
$decoded_url = urldecode( $url );

// Encode characters not allowed in a URL per RFC 3986 (anything that is not among the reserved and unreserved characters).
$encoded_url = (string) preg_replace_callback(
'/[^A-Za-z0-9\-._~:\/?#\[\]@!$&\'()*+,;=]/',
static function ( $matches ) {
return rawurlencode( $matches[0] );
},
$decoded_url
);
return esc_url_raw( $encoded_url );
}

/**
* Counts the links.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class OD_Tag_Visitor_Context {
*
* May be null if no post has been created yet.
*
* @since n.e.x.t
* @since 1.0.0
* @var positive-int|null
*/
private $url_metrics_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function get_current_etag(): string {
/**
* Gets the breakpoints in max widths.
*
* @since n.e.x.t
* @since 1.0.0
*
* @return positive-int[] Breakpoints in max widths.
*/
Expand All @@ -213,7 +213,7 @@ public function get_breakpoints(): array {
/**
* Gets the sample size for URL Metrics for a given breakpoint.
*
* @since n.e.x.t
* @since 1.0.0
*
* @return int<1, max> Sample size for URL Metrics for a given breakpoint.
*/
Expand All @@ -224,7 +224,7 @@ public function get_sample_size(): int {
/**
* Gets the freshness age (TTL) for a given URL Metric..
*
* @since n.e.x.t
* @since 1.0.0
*
* @return int<0, max> Freshness age (TTL) for a given URL Metric.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function get_freshness_ttl(): int {
/**
* Gets the collection that this group is a part of.
*
* @since n.e.x.t
* @since 1.0.0
*
* @todo Eliminate in favor of readonly public property.
* @return OD_URL_Metric_Group_Collection Collection.
Expand Down
4 changes: 2 additions & 2 deletions plugins/optimization-detective/class-od-url-metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function set_group( OD_URL_Metric_Group $group ): void {
*
* @since 0.1.0
* @since 0.9.0 Added the 'etag' property to the schema.
* @since n.e.x.t The 'etag' property is now required.
* @since 1.0.0 The 'etag' property is now required.
*
* @todo Cache the return value?
*
Expand Down Expand Up @@ -451,7 +451,7 @@ public function get_uuid(): string {
* Gets ETag.
*
* @since 0.9.0
* @since n.e.x.t No longer returns null as 'etag' is now required.
* @since 1.0.0 No longer returns null as 'etag' is now required.
*
* @return non-empty-string ETag.
*/
Expand Down
20 changes: 20 additions & 0 deletions plugins/optimization-detective/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu

= 1.0.0-beta2 =

**Enhancements**

* Account for 64 KiB limit for sending beacon data. ([1851](https://github.com/WordPress/performance/pull/1851))
* Add post ID for the `od_url_metrics` post to the tag visitor context. ([1847](https://github.com/WordPress/performance/pull/1847))
* Change minimum viewport width to be exclusive whereas the maximum width remains inclusive. ([1839](https://github.com/WordPress/performance/pull/1839))
* Disable URL Metric storage locking by default for administrators. ([1835](https://github.com/WordPress/performance/pull/1835))
* Include active plugins in ETag data and increase default freshness TTL from 1 day to 1 week. ([1854](https://github.com/WordPress/performance/pull/1854))
* Make ETag a required property of the URL Metric. ([1824](https://github.com/WordPress/performance/pull/1824))
* Use CSS range syntax in media queries. ([1833](https://github.com/WordPress/performance/pull/1833))
* Use `IFRAME` to display HTML responses for REST API storage request failures in Site Health test. ([1849](https://github.com/WordPress/performance/pull/1849))

**Bug Fixes**

* Prevent URL in `Link` header from including invalid characters. ([1802](https://github.com/WordPress/performance/pull/1802))
* Prevent optimizing post previews by default. ([1848](https://github.com/WordPress/performance/pull/1848))

**Documentation**

* Improve Optimization Detective documentation. ([1782](https://github.com/WordPress/performance/pull/1782))

= 1.0.0-beta1 =

**Enhancements**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ final class OD_Storage_Lock {
/**
* Capability for being able to store a URL Metric now.
*
* @since n.e.x.t
* @since 1.0.0
* @var string
*/
const STORE_URL_METRIC_NOW_CAPABILITY = 'od_store_url_metric_now';

/**
* Adds hooks.
*
* @since n.e.x.t
* @since 1.0.0
*/
public static function add_hooks(): void {
add_filter( 'user_has_cap', array( __CLASS__, 'filter_user_has_cap' ) );
Expand All @@ -40,7 +40,7 @@ public static function add_hooks(): void {
/**
* Filters `user_has_cap` to grant the `od_store_url_metric_now` capability to users who can `manage_options` by default.
*
* @since n.e.x.t
* @since 1.0.0
*
* @param array<string, bool>|mixed $allcaps Capability names mapped to boolean values for whether the user has that capability.
* @return array<string, bool> Capability names mapped to boolean values for whether the user has that capability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class OD_URL_Metric_Store_Request_Context {
*
* This was originally $post_id which was introduced in 0.7.0.
*
* @since n.e.x.t
* @since 1.0.0
* @var positive-int
*/
private $url_metrics_id;
Expand Down Expand Up @@ -92,7 +92,7 @@ public function __construct( WP_REST_Request $request, int $url_metrics_id, OD_U
/**
* Gets a property.
*
* @since n.e.x.t
* @since 1.0.0
*
* @param string $name Property name.
* @return mixed Property value.
Expand Down Expand Up @@ -121,7 +121,7 @@ public function __get( string $name ) {
__CLASS__ . '::$url_metrics_id'
)
),
'optimization-detective n.e.x.t'
'optimization-detective 1.0.0'
);
return $this->url_metrics_id;
default:
Expand Down
Loading

0 comments on commit 42bd7a8

Please sign in to comment.