Skip to content

Commit fa2ad06

Browse files
authored
Merge branch 'WordPress:trunk' into trac-22225/date-i18n-day-number-ordinals
2 parents 83479e5 + ea60bd5 commit fa2ad06

File tree

123 files changed

+1160
-516
lines changed

Some content is hidden

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

123 files changed

+1160
-516
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/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/file.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,14 +1896,14 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
18961896
$uncompressed_size = 0;
18971897

18981898
// Determine any children directories needed (From within the archive).
1899-
foreach ( $archive_files as $file ) {
1900-
if ( str_starts_with( $file['filename'], '__MACOSX/' ) ) { // Skip the OS X-created __MACOSX directory.
1899+
foreach ( $archive_files as $archive_file ) {
1900+
if ( str_starts_with( $archive_file['filename'], '__MACOSX/' ) ) { // Skip the OS X-created __MACOSX directory.
19011901
continue;
19021902
}
19031903

1904-
$uncompressed_size += $file['size'];
1904+
$uncompressed_size += $archive_file['size'];
19051905

1906-
$needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname( $file['filename'] ) );
1906+
$needed_dirs[] = $to . untrailingslashit( $archive_file['folder'] ? $archive_file['filename'] : dirname( $archive_file['filename'] ) );
19071907
}
19081908

19091909
// Enough space to unzip the file and copy its contents, with a 10% buffer.
@@ -1967,22 +1967,22 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
19671967
}
19681968

19691969
// Extract the files from the zip.
1970-
foreach ( $archive_files as $file ) {
1971-
if ( $file['folder'] ) {
1970+
foreach ( $archive_files as $archive_file ) {
1971+
if ( $archive_file['folder'] ) {
19721972
continue;
19731973
}
19741974

1975-
if ( str_starts_with( $file['filename'], '__MACOSX/' ) ) { // Don't extract the OS X-created __MACOSX directory files.
1975+
if ( str_starts_with( $archive_file['filename'], '__MACOSX/' ) ) { // Don't extract the OS X-created __MACOSX directory files.
19761976
continue;
19771977
}
19781978

19791979
// Don't extract invalid files:
1980-
if ( 0 !== validate_file( $file['filename'] ) ) {
1980+
if ( 0 !== validate_file( $archive_file['filename'] ) ) {
19811981
continue;
19821982
}
19831983

1984-
if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE ) ) {
1985-
return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] );
1984+
if ( ! $wp_filesystem->put_contents( $to . $archive_file['filename'], $archive_file['content'], FS_CHMOD_FILE ) ) {
1985+
return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $archive_file['filename'] );
19861986
}
19871987
}
19881988

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
),

src/wp-admin/includes/template.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2251,6 +2251,7 @@ function _post_states( $post, $display = true ) {
22512251

22522252
if ( ! empty( $post_states ) ) {
22532253
$state_count = count( $post_states );
2254+
$separator = wp_get_list_item_separator();
22542255

22552256
$i = 0;
22562257

@@ -2259,9 +2260,9 @@ function _post_states( $post, $display = true ) {
22592260
foreach ( $post_states as $state ) {
22602261
++$i;
22612262

2262-
$separator = ( $i < $state_count ) ? ', ' : '';
2263+
$suffix = ( $i < $state_count ) ? $separator : '';
22632264

2264-
$post_states_html .= "<span class='post-state'>{$state}{$separator}</span>";
2265+
$post_states_html .= "<span class='post-state'>{$state}{$suffix}</span>";
22652266
}
22662267
}
22672268

@@ -2379,6 +2380,7 @@ function _media_states( $post, $display = true ) {
23792380

23802381
if ( ! empty( $media_states ) ) {
23812382
$state_count = count( $media_states );
2383+
$separator = wp_get_list_item_separator();
23822384

23832385
$i = 0;
23842386

@@ -2387,9 +2389,9 @@ function _media_states( $post, $display = true ) {
23872389
foreach ( $media_states as $state ) {
23882390
++$i;
23892391

2390-
$separator = ( $i < $state_count ) ? ', ' : '';
2392+
$suffix = ( $i < $state_count ) ? $separator : '';
23912393

2392-
$media_states_string .= "<span class='post-state'>{$state}{$separator}</span>";
2394+
$media_states_string .= "<span class='post-state'>{$state}{$suffix}</span>";
23932395
}
23942396
}
23952397

0 commit comments

Comments
 (0)