Skip to content

Commit 57c6e21

Browse files
committed
Merge branch 'trunk' into LAPSrj/trunk
* trunk: (44 commits) I18N: Use `wp_get_list_item_separator()` as list separator for the states of sites, posts, and media. Tests: Use `assertSame()` in some newly introduced tests. Export: Update `export_wp()` to handle `get_comment()` returning `null` due to filter. I18N: Add missing translation functions for REST API app login. Tests: Use `assertSame()` in some newly introduced tests. Networks and Sites: Ensure the Site Address field renders in correct order when RTL locale is active. Tests: Use `assertSame()` in some newly introduced tests. Add: Unit test to validate core abilities schemas only include valid properties. Docs: Improve specificity of types in `WP_Script_Modules` and `script-modules.php` functions. I18N: add border.radiusSizes key to theme-i18n.json Posts, Post Types: Only set default title for custom post types if they have title support. Site Health: Include value of `EMPTY_TRASH_DAYS` constant in debug data. Docs: Improve accuracy for types in phpdoc for `WP_Dependencies`, `_WP_Dependency`, `WP_Scripts`, and `WP_Styles`. Script Loader: Re-target release for missing dependency notices from 7.0.0 to 6.9.1. Docs: Add missing parameter descriptions in `wp-admin/install.php`. Site Health: Add common HTTP response headers for page cache detection. Docs: Update `@since x.y.z` with actual version number. Plugins: Restore line break between the filter links row and the plugin cards in the Featured view. Mail: Add missing `embeds` key for the `wp_mail_succeeded` action's `$mail_data` param. Upgrade/Install: Add missing file to the `$_old_files` array. ...
2 parents 2786262 + b6f02b8 commit 57c6e21

File tree

125 files changed

+1050
-482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+1050
-482
lines changed

src/js/_enqueues/wp/sanitize.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,25 @@
2323
* @return {string} Stripped text.
2424
*/
2525
stripTags: function( text ) {
26-
let _text = text || '';
26+
const domParser = new DOMParser();
27+
const htmlDocument = domParser.parseFromString(
28+
text,
29+
'text/html'
30+
);
2731

28-
// Do the search-replace until there is nothing to be replaced.
29-
do {
30-
// Keep pre-replace text for comparison.
31-
text = _text;
32-
33-
// Do the replacement.
34-
_text = text
35-
.replace( /<!--[\s\S]*?(-->|$)/g, '' )
36-
.replace( /<(script|style)[^>]*>[\s\S]*?(<\/\1>|$)/ig, '' )
37-
.replace( /<\/?[a-z][\s\S]*?(>|$)/ig, '' );
38-
} while ( _text !== text );
32+
/*
33+
* The following self-assignment appears to be a no-op, but it isn't.
34+
* It enforces the escaping. Reading the `innerText` property decodes
35+
* character references, returning a raw string. When written, however,
36+
* the text is re-escaped to ensure that the rendered text replicates
37+
* what it's given.
38+
*
39+
* See <https://github.com/WordPress/wordpress-develop/pull/10536#discussion_r2550615378>.
40+
*/
41+
htmlDocument.body.innerText = htmlDocument.body.innerText;
3942

4043
// Return the text with stripped tags.
41-
return _text;
44+
return htmlDocument.body.innerHTML;
4245
},
4346

4447
/**

src/wp-admin/about.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@
7777
</div>
7878
<div class="column is-vertically-aligned-center">
7979
<div class="about__image">
80-
<img src="data:image/svg+xml,%3Csvg width='436' height='436' viewbox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='%23ececec' /%3E%3C/svg%3E" alt="" height="436" width="436" />
80+
<img src="https://s.w.org/images/core/6.9/01-notes.webp" alt="" height="436" width="436" />
8181
</div>
8282
</div>
8383
</div>
8484

8585
<div class="about__section has-2-columns">
8686
<div class="column is-vertically-aligned-center">
8787
<div class="about__image">
88-
<img src="data:image/svg+xml,%3Csvg width='436' height='436' viewbox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='%23ececec' /%3E%3C/svg%3E" alt="" height="436" width="436" />
88+
<img src="https://s.w.org/images/core/6.9/02-visual-drag-drop.webp" alt="" height="436" width="436" />
8989
</div>
9090
</div>
9191
<div class="column is-vertically-aligned-center">
@@ -107,15 +107,15 @@
107107
</div>
108108
<div class="column is-vertically-aligned-center">
109109
<div class="about__image">
110-
<img src="data:image/svg+xml,%3Csvg width='436' height='436' viewbox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='%23ececec' /%3E%3C/svg%3E" alt="" height="436" width="436" />
110+
<img src="https://s.w.org/images/core/6.9/03-command-palette-everywhere.webp" alt="" height="436" width="436" />
111111
</div>
112112
</div>
113113
</div>
114114

115115
<div class="about__section has-2-columns">
116116
<div class="column is-vertically-aligned-center">
117117
<div class="about__image">
118-
<img src="data:image/svg+xml,%3Csvg width='436' height='436' viewbox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='%23ececec' /%3E%3C/svg%3E" alt="" height="436" width="436" />
118+
<img src="https://s.w.org/images/core/6.9/04-fit-text.webp" alt="" height="436" width="436" />
119119
</div>
120120
</div>
121121
<div class="column is-vertically-aligned-center">

src/wp-admin/includes/ajax-actions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4804,6 +4804,8 @@ function wp_ajax_search_plugins() {
48044804
// Ensure after_plugin_row_{$plugin_file} gets hooked.
48054805
wp_plugin_update_rows();
48064806

4807+
WP_Plugin_Dependencies::initialize();
4808+
48074809
$pagenow = isset( $_POST['pagenow'] ) ? sanitize_key( $_POST['pagenow'] ) : '';
48084810
if ( 'plugins-network' === $pagenow || 'plugins' === $pagenow ) {
48094811
set_current_screen( $pagenow );

src/wp-admin/includes/class-wp-debug-data.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,11 @@ private static function get_wp_constants(): array {
15921592
'value' => $db_collate,
15931593
'debug' => $db_collate_debug,
15941594
),
1595+
'EMPTY_TRASH_DAYS' => array(
1596+
'label' => 'EMPTY_TRASH_DAYS',
1597+
'value' => EMPTY_TRASH_DAYS ? EMPTY_TRASH_DAYS : __( 'Empty value' ),
1598+
'debug' => EMPTY_TRASH_DAYS,
1599+
),
15951600
);
15961601

15971602
return array(

src/wp-admin/includes/class-wp-ms-sites-list-table.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ protected function site_states( $site ) {
674674

675675
if ( ! empty( $site_states ) ) {
676676
$state_count = count( $site_states );
677+
$separator = wp_get_list_item_separator();
677678

678679
$i = 0;
679680

@@ -682,9 +683,9 @@ protected function site_states( $site ) {
682683
foreach ( $site_states as $state ) {
683684
++$i;
684685

685-
$separator = ( $i < $state_count ) ? ', ' : '';
686+
$suffix = ( $i < $state_count ) ? $separator : '';
686687

687-
echo "<span class='post-state'>{$state}{$separator}</span>";
688+
echo "<span class='post-state'>{$state}{$suffix}</span>";
688689
}
689690
}
690691
}

src/wp-admin/includes/class-wp-site-health.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3412,6 +3412,16 @@ public function get_page_cache_headers() {
34123412
},
34133413
'x-srcache-store-status' => $cache_hit_callback,
34143414
'x-srcache-fetch-status' => $cache_hit_callback,
3415+
3416+
// Generic caching proxies (Nginx, Varnish, etc.)
3417+
'x-cache' => $cache_hit_callback,
3418+
'x-cache-status' => $cache_hit_callback,
3419+
'x-litespeed-cache' => $cache_hit_callback,
3420+
'x-proxy-cache' => $cache_hit_callback,
3421+
'via' => '',
3422+
3423+
// Cloudflare
3424+
'cf-cache-status' => $cache_hit_callback,
34153425
);
34163426

34173427
/**

src/wp-admin/includes/export.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,12 @@ function wxr_filter_postmeta( $return_me, $meta_key ) {
685685
endforeach;
686686

687687
$_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
688-
$comments = array_map( 'get_comment', $_comments );
688+
$comments = array_filter(
689+
array_map( 'get_comment', $_comments ),
690+
static function ( $comment ) {
691+
return $comment instanceof WP_Comment;
692+
}
693+
);
689694
foreach ( $comments as $c ) :
690695
?>
691696
<wp:comment>

src/wp-admin/includes/media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ function media_upload_form( $errors = null ) {
22852285
_ex( 'Upload', 'verb' );
22862286
?>
22872287
</label>
2288-
<input type="file" name="async-upload" id="async-upload" required />
2288+
<input type="file" name="async-upload" id="async-upload" />
22892289
<?php submit_button( _x( 'Upload', 'verb' ), 'primary', 'html-upload', false ); ?>
22902290
<a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e( 'Cancel' ); ?></a>
22912291
</p>

src/wp-admin/includes/plugin-install.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ function display_plugins_table() {
399399
);
400400
break;
401401
case 'install_plugins_featured':
402+
echo '<br>';
402403
break;
403404
case 'install_plugins_recommended':
404405
echo '<p>' . __( 'These suggestions are based on the plugins you and other users have installed.' ) . '</p>';
@@ -409,9 +410,6 @@ function display_plugins_table() {
409410
}
410411
break;
411412
}
412-
if ( isset( $_GET['tab'] ) && 'featured' === $_GET['tab'] ) {
413-
echo '<br />';
414-
}
415413
?>
416414
<form id="plugin-filter" method="post">
417415
<?php $wp_list_table->display(); ?>

src/wp-admin/includes/post.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
764764
if ( $create_in_db ) {
765765
$post_id = wp_insert_post(
766766
array(
767-
'post_title' => __( 'Auto Draft' ),
767+
'post_title' => post_type_supports( $post_type, 'title' ) ? __( 'Auto Draft' ) : '',
768768
'post_type' => $post_type,
769769
'post_status' => 'auto-draft',
770770
),

0 commit comments

Comments
 (0)