Skip to content

Commit 5944bfb

Browse files
committed
Merge branch 'trunk' into 61623-don't-dispaly-good-if-call-to-wp.org-failed
2 parents a6f3469 + 40bb201 commit 5944bfb

File tree

17 files changed

+771
-127
lines changed

17 files changed

+771
-127
lines changed

src/wp-admin/includes/class-wp-filesystem-ftpext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
1717

1818
/**
1919
* @since 2.5.0
20-
* @var resource
20+
* @var FTP\Connection|resource|false
2121
*/
2222
public $link;
2323

src/wp-includes/block-supports/typography.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ function wp_typography_get_preset_inline_style_value( $style_value, $css_propert
306306
* @return string Filtered block content.
307307
*/
308308
function wp_render_typography_support( $block_content, $block ) {
309-
if ( ! empty( $block['attrs']['fitText'] ) ) {
309+
if ( ! empty( $block['attrs']['fitText'] ) && ! is_admin() ) {
310310
wp_enqueue_script_module( '@wordpress/block-editor/utils/fit-text-frontend' );
311311
}
312312
if ( ! isset( $block['attrs']['style']['typography']['fontSize'] ) ) {

src/wp-includes/class-wp-hook.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,21 @@ public function remove_filter( $hook_name, $callback, $priority ) {
223223
* that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
224224
*
225225
* @since 4.7.0
226+
* @since 6.9.0 Added the `$priority` parameter.
226227
*
227228
* @param string $hook_name Optional. The name of the filter hook. Default empty.
228229
* @param callable|string|array|false $callback Optional. The callback to check for.
229230
* This method can be called unconditionally to speculatively check
230231
* a callback that may or may not exist. Default false.
232+
* @param int|false $priority Optional. The specific priority at which to check for the callback.
233+
* Default false.
231234
* @return bool|int If `$callback` is omitted, returns boolean for whether the hook has
232235
* anything registered. When checking a specific function, the priority
233236
* of that hook is returned, or false if the function is not attached.
237+
* If `$callback` and `$priority` are both provided, a boolean is returned
238+
* for whether the specific function is registered at that priority.
234239
*/
235-
public function has_filter( $hook_name = '', $callback = false ) {
240+
public function has_filter( $hook_name = '', $callback = false, $priority = false ) {
236241
if ( false === $callback ) {
237242
return $this->has_filters();
238243
}
@@ -243,9 +248,13 @@ public function has_filter( $hook_name = '', $callback = false ) {
243248
return false;
244249
}
245250

246-
foreach ( $this->callbacks as $priority => $callbacks ) {
251+
if ( is_int( $priority ) ) {
252+
return isset( $this->callbacks[ $priority ][ $function_key ] );
253+
}
254+
255+
foreach ( $this->callbacks as $callback_priority => $callbacks ) {
247256
if ( isset( $callbacks[ $function_key ] ) ) {
248-
return $priority;
257+
return $callback_priority;
249258
}
250259
}
251260

src/wp-includes/class-wp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,8 @@ public function send_headers() {
588588
/**
589589
* Fires once the requested HTTP headers for caching, content type, etc. have been sent.
590590
*
591-
* The {@see 'wp_send_late_headers'} action may be used to send headers after rendering the template into an
592-
* output buffer.
591+
* The {@see 'wp_finalized_template_enhancement_output_buffer'} action may be used to send
592+
* headers after rendering the template into an output buffer.
593593
*
594594
* @since 2.1.0
595595
*

src/wp-includes/default-filters.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@
423423
add_action( 'do_all_pings', 'generic_ping', 10, 0 );
424424
add_action( 'do_robots', 'do_robots' );
425425
add_action( 'do_favicon', 'do_favicon' );
426-
add_action( 'wp_before_include_template', 'wp_start_template_enhancement_output_buffer', 1000 ); // Late priority to let `wp_template_enhancement_output_buffer` filters and `wp_send_late_headers` actions be registered.
426+
add_action( 'wp_before_include_template', 'wp_start_template_enhancement_output_buffer', 1000 ); // Late priority to let `wp_template_enhancement_output_buffer` filters and `wp_finalized_template_enhancement_output_buffer` actions be registered.
427427
add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 3 );
428428
add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' );
429429
add_action( 'init', 'smilies_init', 5 );
@@ -704,7 +704,8 @@
704704
add_action( 'rest_api_init', 'wp_oembed_register_route' );
705705
add_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 );
706706

707-
add_action( 'wp_head', 'wp_oembed_add_discovery_links' );
707+
add_action( 'wp_head', 'wp_oembed_add_discovery_links', 4 ); // Printed after feed_links() and feed_links_extra().
708+
add_action( 'wp_head', 'wp_oembed_add_discovery_links' ); // Unhooked the first time that wp_oembed_add_discovery_links() runs for back-compat.
708709
add_action( 'wp_head', 'wp_oembed_add_host_js' ); // Back-compat for sites disabling oEmbed host JS by removing action.
709710
add_filter( 'embed_oembed_html', 'wp_maybe_enqueue_oembed_host_js' );
710711

src/wp-includes/embed.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,19 @@ function wp_oembed_register_route() {
332332
*
333333
* @since 4.4.0
334334
* @since 6.8.0 Output was adjusted to only embed if the post supports it.
335+
* @since 6.9.0 Now runs first at `wp_head` priority 4, with a fallback to priority 10. This helps ensure the discovery links appear within the first 150KB.
335336
*/
336337
function wp_oembed_add_discovery_links() {
338+
if ( doing_action( 'wp_head' ) ) {
339+
// For back-compat, short-circuit if a plugin has removed the action at the original priority.
340+
if ( ! has_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 ) ) {
341+
return;
342+
}
343+
344+
// Prevent running again at the original priority.
345+
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
346+
}
347+
337348
$output = '';
338349

339350
if ( is_singular() && is_post_embeddable() ) {

src/wp-includes/plugin.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,25 +267,30 @@ function apply_filters_ref_array( $hook_name, $args ) {
267267
* that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
268268
*
269269
* @since 2.5.0
270+
* @since 6.9.0 Added the `$priority` parameter.
270271
*
271272
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
272273
*
273274
* @param string $hook_name The name of the filter hook.
274275
* @param callable|string|array|false $callback Optional. The callback to check for.
275276
* This function can be called unconditionally to speculatively check
276277
* a callback that may or may not exist. Default false.
278+
* @param int|false $priority Optional. The specific priority at which to check for the callback.
279+
* Default false.
277280
* @return bool|int If `$callback` is omitted, returns boolean for whether the hook has
278281
* anything registered. When checking a specific function, the priority
279282
* of that hook is returned, or false if the function is not attached.
283+
* If `$callback` and `$priority` are both provided, a boolean is returned
284+
* for whether the specific function is registered at that priority.
280285
*/
281-
function has_filter( $hook_name, $callback = false ) {
286+
function has_filter( $hook_name, $callback = false, $priority = false ) {
282287
global $wp_filter;
283288

284289
if ( ! isset( $wp_filter[ $hook_name ] ) ) {
285290
return false;
286291
}
287292

288-
return $wp_filter[ $hook_name ]->has_filter( $hook_name, $callback );
293+
return $wp_filter[ $hook_name ]->has_filter( $hook_name, $callback, $priority );
289294
}
290295

291296
/**
@@ -574,19 +579,24 @@ function do_action_ref_array( $hook_name, $args ) {
574579
* that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
575580
*
576581
* @since 2.5.0
582+
* @since 6.9.0 Added the `$priority` parameter.
577583
*
578584
* @see has_filter() This function is an alias of has_filter().
579585
*
580586
* @param string $hook_name The name of the action hook.
581587
* @param callable|string|array|false $callback Optional. The callback to check for.
582588
* This function can be called unconditionally to speculatively check
583589
* a callback that may or may not exist. Default false.
590+
* @param int|false $priority Optional. The specific priority at which to check for the callback.
591+
* Default false.
584592
* @return bool|int If `$callback` is omitted, returns boolean for whether the hook has
585593
* anything registered. When checking a specific function, the priority
586594
* of that hook is returned, or false if the function is not attached.
595+
* If `$callback` and `$priority` are both provided, a boolean is returned
596+
* for whether the specific function is registered at that priority.
587597
*/
588-
function has_action( $hook_name, $callback = false ) {
589-
return has_filter( $hook_name, $callback );
598+
function has_action( $hook_name, $callback = false, $priority = false ) {
599+
return has_filter( $hook_name, $callback, $priority );
590600
}
591601

592602
/**

src/wp-includes/post.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4842,7 +4842,8 @@ function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true )
48424842
if ( isset( $data[ $emoji_field ] ) ) {
48434843
$charset = $wpdb->get_col_charset( $wpdb->posts, $emoji_field );
48444844

4845-
if ( 'utf8' === $charset ) {
4845+
// The 'utf8' character set is a deprecated alias of 'utf8mb3'. See <https://dev.mysql.com/doc/refman/8.4/en/charset-unicode-utf8.html>.
4846+
if ( 'utf8' === $charset || 'utf8mb3' === $charset ) {
48464847
$data[ $emoji_field ] = wp_encode_emoji( $data[ $emoji_field ] );
48474848
}
48484849
}

src/wp-includes/rest-api/class-wp-rest-response.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public function add_link( $rel, $href, $attributes = array() ) {
7676
*
7777
* @since 4.4.0
7878
*
79-
* @param string $rel Link relation. Either an IANA registered type, or an absolute URL.
80-
* @param string $href Optional. Only remove links for the relation matching the given href.
81-
* Default null.
79+
* @param string $rel Link relation. Either an IANA registered type, or an absolute URL.
80+
* @param string|null $href Optional. Only remove links for the relation matching the given href.
81+
* Default null.
8282
*/
8383
public function remove_link( $rel, $href = null ) {
8484
if ( ! isset( $this->links[ $rel ] ) ) {

src/wp-includes/rest-api/class-wp-rest-server.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ protected function error_to_response( $error ) {
224224
*
225225
* @since 4.4.0
226226
*
227-
* @param string $code WP_Error-style code.
228-
* @param string $message Human-readable message.
229-
* @param int $status Optional. HTTP status code to send. Default null.
227+
* @param string $code WP_Error-style code.
228+
* @param string $message Human-readable message.
229+
* @param int|null $status Optional. HTTP status code to send. Default null.
230230
* @return string JSON representation of the error
231231
*/
232232
protected function json_error( $code, $message, $status = null ) {
@@ -278,8 +278,8 @@ protected function get_json_encode_options( WP_REST_Request $request ) {
278278
*
279279
* @global WP_User $current_user The currently authenticated user.
280280
*
281-
* @param string $path Optional. The request route. If not set, `$_SERVER['PATH_INFO']` will be used.
282-
* Default null.
281+
* @param string|null $path Optional. The request route. If not set, `$_SERVER['PATH_INFO']` will be used.
282+
* Default null.
283283
* @return null|false Null if not served and a HEAD request, false otherwise.
284284
*/
285285
public function serve_request( $path = null ) {
@@ -655,12 +655,11 @@ public static function get_response_links( $response ) {
655655
}
656656

657657
/**
658-
* Gets the target links for a REST API Link.
658+
* Gets the target hints for a REST API Link.
659659
*
660660
* @since 6.7.0
661661
*
662-
* @param array $link
663-
*
662+
* @param array $link The link to get target hints for.
664663
* @return array|null
665664
*/
666665
protected static function get_target_hints_for_link( $link ) {
@@ -764,6 +763,7 @@ public static function get_compact_response_links( $response ) {
764763
*
765764
* @param array $data Data from the request.
766765
* @param bool|string[] $embed Whether to embed all links or a filtered list of link relations.
766+
* Default true.
767767
* @return array {
768768
* Data with sub-requests embedded.
769769
*

0 commit comments

Comments
 (0)