Skip to content

Commit 856fd18

Browse files
committed
Merge branch 'trunk' into feature/expose-wp-base-styles-css-file
2 parents 7420c25 + 63b3a8f commit 856fd18

File tree

124 files changed

+1044
-479
lines changed

Some content is hidden

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

124 files changed

+1044
-479
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-filesystem-ftpext.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public function chmod( $file, $mode = false, $recursive = false ) {
299299
public function owner( $file ) {
300300
$dir = $this->dirlist( $file );
301301

302-
return $dir[ $file ]['owner'];
302+
return $dir[ $file ]['owner'] ?? '';
303303
}
304304

305305
/**
@@ -313,7 +313,7 @@ public function owner( $file ) {
313313
public function getchmod( $file ) {
314314
$dir = $this->dirlist( $file );
315315

316-
return $dir[ $file ]['permsn'];
316+
return $dir[ $file ]['permsn'] ?? '';
317317
}
318318

319319
/**
@@ -327,7 +327,7 @@ public function getchmod( $file ) {
327327
public function group( $file ) {
328328
$dir = $this->dirlist( $file );
329329

330-
return $dir[ $file ]['group'];
330+
return $dir[ $file ]['group'] ?? '';
331331
}
332332

333333
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public function chmod( $file, $mode = false, $recursive = false ) {
309309
public function owner( $file ) {
310310
$dir = $this->dirlist( $file );
311311

312-
return $dir[ $file ]['owner'];
312+
return $dir[ $file ]['owner'] ?? '';
313313
}
314314

315315
/**
@@ -323,7 +323,7 @@ public function owner( $file ) {
323323
public function getchmod( $file ) {
324324
$dir = $this->dirlist( $file );
325325

326-
return $dir[ $file ]['permsn'];
326+
return $dir[ $file ]['permsn'] ?? '';
327327
}
328328

329329
/**
@@ -337,7 +337,7 @@ public function getchmod( $file ) {
337337
public function group( $file ) {
338338
$dir = $this->dirlist( $file );
339339

340-
return $dir[ $file ]['group'];
340+
return $dir[ $file ]['group'] ?? '';
341341
}
342342

343343
/**

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(); ?>

0 commit comments

Comments
 (0)