Skip to content

Commit 42bd7a8

Browse files
authored
Merge pull request #1870 from WordPress/release/3.9.0
Post 3.9.0 release merge
2 parents d21b74d + 91bc26d commit 42bd7a8

17 files changed

+153
-37
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Plugin | Slug | Experimental | Lin
1515
[Image Placeholders][1] | `dominant-color-images` | No | [Source][9], [Issues][17], [PRs][25]
1616
[Image Prioritizer][7] | `image-prioritizer` | No | [Source][15], [Issues][23], [PRs][31]
1717
[Modern Image Formats][2] | `webp-uploads` | No | [Source][10], [Issues][18], [PRs][26]
18+
[Optimization Detective][33] | `optimization-detective` | No | [Source][34], [Issues][35], [PRs][36]
1819
[Performant Translations][3] | `performant-translations` | No | [Source][11], [Issues][19], [PRs][27]
1920
[Speculative Loading][4] | `speculation-rules` | No | [Source][12], [Issues][20], [PRs][28]
2021
[Enhanced Responsive Images][6] | `auto-sizes` | Yes | [Source][14], [Issues][22], [PRs][30]
@@ -28,6 +29,7 @@ Plugin | Slug | Experimental | Lin
2829
[6]: https://wordpress.org/plugins/auto-sizes/
2930
[7]: https://wordpress.org/plugins/image-prioritizer/
3031
[8]: https://wordpress.org/plugins/web-worker-offloading/
32+
[33]: https://wordpress.org/plugins/optimization-detective/
3133

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

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

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

5964
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.

plugins/embed-optimizer/load.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Optimizes the performance of embeds through lazy-loading, preconnecting, and reserving space to reduce layout shifts.
66
* Requires at least: 6.6
77
* Requires PHP: 7.2
8-
* Version: 0.4.1
8+
* Version: 1.0.0-beta1
99
* Author: WordPress Performance Team
1010
* Author URI: https://make.wordpress.org/performance/
1111
* License: GPLv2 or later
@@ -71,7 +71,7 @@ static function ( string $global_var_name, string $version, Closure $load ): voi
7171
}
7272
)(
7373
'embed_optimizer_pending_plugin',
74-
'0.4.1',
74+
'1.0.0-beta1',
7575
static function ( string $version ): void {
7676
if ( defined( 'EMBED_OPTIMIZER_VERSION' ) ) {
7777
return;

plugins/embed-optimizer/readme.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

6868
== Changelog ==
6969

70+
= 1.0.0-beta1 =
71+
72+
**Enhancements**
73+
74+
* Bump version to 1.0.0-beta1 to indicate graduation from being experimental. See [1846](https://github.com/WordPress/performance/pull/1846).
75+
* Use CSS range syntax in media queries. ([1833](https://github.com/WordPress/performance/pull/1833))
76+
7077
= 0.4.1 =
7178

7279
**Bug Fixes**

plugins/image-prioritizer/class-image-prioritizer-img-tag-visitor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ private function sizes_attribute_includes_valid_auto( string $sizes_attr ): bool
412412
/**
413413
* Computes responsive sizes for the current element based on its boundingClientRect width captured in URL Metrics.
414414
*
415-
* @since n.e.x.t
415+
* @since 1.0.0
416416
*
417417
* @param OD_Tag_Visitor_Context $context Context.
418418
* @return non-empty-string[] Computed sizes.

plugins/image-prioritizer/load.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Requires at least: 6.6
77
* Requires PHP: 7.2
88
* Requires Plugins: optimization-detective
9-
* Version: 0.3.1
9+
* Version: 1.0.0-beta1
1010
* Author: WordPress Performance Team
1111
* Author URI: https://make.wordpress.org/performance/
1212
* License: GPLv2 or later
@@ -72,7 +72,7 @@ static function ( string $global_var_name, string $version, Closure $load ): voi
7272
}
7373
)(
7474
'image_prioritizer_pending_plugin',
75-
'0.3.1',
75+
'1.0.0-beta1',
7676
static function ( string $version ): void {
7777
if ( defined( 'IMAGE_PRIORITIZER_VERSION' ) ) {
7878
return;

plugins/image-prioritizer/readme.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

7373
== Changelog ==
7474

75+
= 1.0.0-beta1 =
76+
77+
**Enhancements**
78+
79+
* Bump version to 1.0.0-beta1 to indicate graduation from being experimental. See [1846](https://github.com/WordPress/performance/pull/1846).
80+
* Compute responsive `sizes` attribute based on the `width` from the `boundingClientRect` in captured URL Metrics. ([1840](https://github.com/WordPress/performance/pull/1840))
81+
7582
= 0.3.1 =
7683

7784
**Bug Fixes**

plugins/optimization-detective/class-od-link-collection.php

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,22 +267,32 @@ public function get_response_header(): ?string {
267267

268268
foreach ( $this->get_prepared_links() as $link ) {
269269
if ( isset( $link['href'] ) ) {
270-
$decoded_url = urldecode( $link['href'] );
271-
272-
// Encode characters not allowed in a URL per RFC 3986 (anything that is not among the reserved and unreserved characters).
273-
$encoded_url = preg_replace_callback(
274-
'/[^A-Za-z0-9\-._~:\/?#\[\]@!$&\'()*+,;=]/',
275-
static function ( $matches ) {
276-
return rawurlencode( $matches[0] );
277-
},
278-
$decoded_url
279-
);
280-
$link['href'] = esc_url_raw( $encoded_url ?? '' );
270+
$link['href'] = $this->encode_url_for_response_header( $link['href'] );
281271
} else {
282272
// The about:blank is present since a Link without a reference-uri is invalid so any imagesrcset would otherwise not get downloaded.
283273
$link['href'] = 'about:blank';
284274
}
285275

276+
// Encode the URLs in the srcset.
277+
if ( isset( $link['imagesrcset'] ) ) {
278+
$link['imagesrcset'] = join(
279+
', ',
280+
array_map(
281+
function ( $image_candidate ) {
282+
// Parse out the URL to separate it from the descriptor.
283+
$image_candidate_parts = (array) preg_split( '/\s+/', (string) $image_candidate, 2 );
284+
285+
// Encode the URL.
286+
$image_candidate_parts[0] = $this->encode_url_for_response_header( (string) $image_candidate_parts[0] );
287+
288+
// Re-join the URL with the descriptor.
289+
return implode( ' ', $image_candidate_parts );
290+
},
291+
(array) preg_split( '/\s*,\s*/', $link['imagesrcset'] )
292+
)
293+
);
294+
}
295+
286296
$link_header = '<' . $link['href'] . '>';
287297
unset( $link['href'] );
288298
foreach ( $link as $name => $value ) {
@@ -310,6 +320,28 @@ static function ( $matches ) {
310320
return 'Link: ' . implode( ', ', $link_headers );
311321
}
312322

323+
/**
324+
* Encodes a URL for serving in an HTTP response header.
325+
*
326+
* @since n.e.x.t
327+
*
328+
* @param string $url URL to percent encode. Any existing percent encodings will first be decoded.
329+
* @return string Percent-encoded URL.
330+
*/
331+
private function encode_url_for_response_header( string $url ): string {
332+
$decoded_url = urldecode( $url );
333+
334+
// Encode characters not allowed in a URL per RFC 3986 (anything that is not among the reserved and unreserved characters).
335+
$encoded_url = (string) preg_replace_callback(
336+
'/[^A-Za-z0-9\-._~:\/?#\[\]@!$&\'()*+,;=]/',
337+
static function ( $matches ) {
338+
return rawurlencode( $matches[0] );
339+
},
340+
$decoded_url
341+
);
342+
return esc_url_raw( $encoded_url );
343+
}
344+
313345
/**
314346
* Counts the links.
315347
*

plugins/optimization-detective/class-od-tag-visitor-context.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class OD_Tag_Visitor_Context {
5454
*
5555
* May be null if no post has been created yet.
5656
*
57-
* @since n.e.x.t
57+
* @since 1.0.0
5858
* @var positive-int|null
5959
*/
6060
private $url_metrics_id;

plugins/optimization-detective/class-od-url-metric-group-collection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function get_current_etag(): string {
202202
/**
203203
* Gets the breakpoints in max widths.
204204
*
205-
* @since n.e.x.t
205+
* @since 1.0.0
206206
*
207207
* @return positive-int[] Breakpoints in max widths.
208208
*/
@@ -213,7 +213,7 @@ public function get_breakpoints(): array {
213213
/**
214214
* Gets the sample size for URL Metrics for a given breakpoint.
215215
*
216-
* @since n.e.x.t
216+
* @since 1.0.0
217217
*
218218
* @return int<1, max> Sample size for URL Metrics for a given breakpoint.
219219
*/
@@ -224,7 +224,7 @@ public function get_sample_size(): int {
224224
/**
225225
* Gets the freshness age (TTL) for a given URL Metric..
226226
*
227-
* @since n.e.x.t
227+
* @since 1.0.0
228228
*
229229
* @return int<0, max> Freshness age (TTL) for a given URL Metric.
230230
*/

plugins/optimization-detective/class-od-url-metric-group.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public function get_freshness_ttl(): int {
212212
/**
213213
* Gets the collection that this group is a part of.
214214
*
215-
* @since n.e.x.t
215+
* @since 1.0.0
216216
*
217217
* @todo Eliminate in favor of readonly public property.
218218
* @return OD_URL_Metric_Group_Collection Collection.

0 commit comments

Comments
 (0)