Skip to content

Commit 4669a40

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents 464e5e2 + eec6c37 commit 4669a40

68 files changed

Lines changed: 2083 additions & 453 deletions

Some content is hidden

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

.git-blame-ignore-revs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Pinking shears
2+
a4789b3cc1cb59e5cd062670f4439f264c0d34f3 # [12042]
3+
fb4e38b0e750c0cab5eb4c50532da93e2d9882b3 # [15843]
4+
4b33a0e9c45d67c5f3123577262f73727444254a # [16438]
5+
fa33255b567df6b19ccc3a61824ad243db116993 # [16439]
6+
46d96c7704b978b9d070bfec1cb1a33e4caf46b0 # [18254]
7+
feaf2597bf16b1bd6b489a0e5680501f12990bee # [18276]
8+
9e7890c3f61781200b9337186d85cd4034edac61 # [18386]
9+
fd10e500e47ca1ae3280ac6817e725965f7fc0dc # [19054]
10+
6610e321e79d9b56c6fc496b6630dd2ac664a0d3 # [19528]
11+
d26f0a4c407a5d13a095c7676b397e51a959d82c # [19577]
12+
89e9bcc1d69ebbac01c8c4501f9066e421125e66 # [20000]
13+
8c50f982ea9784fe06844ce84b1a3297b1241442 # [20715]
14+
b6e23d7269e50296270f93dda96dacb118bee8b3 # [20944]
15+
48a3ec24c5ea7615431bde431098546674a0096c # [21070]
16+
2439e4d722f5093631c4bac9a45106ab33624aaa # [21381]
17+
56c4577feae624f7a3bf55d001295e0707c972b6 # [21486]
18+
680b671330327f2568549dec9460a2e942219d55 # [21492]
19+
dd39a3b3d2d1f792b6ed8e88b1fcc13877fbd8dd # [22491]
20+
6d8bce688f5215ad20133b2cefedc72ac5136be3 # [22634]
21+
05c0f14024a2bb8ef9bdfcb84589d04205f8ce24 # [23679]
22+
ece7a7714477142d4cdb3269d2f9ad3d5dab2e5f # [23780]
23+
687d1a2ce992a0e7e24675b506b85a57e42fe78e # [24303]
24+
45d2a20783460667f85d5fdced422efd54c33b72 # [24603]
25+
c8889d984fd98381d6f0bd3228972e93348f1266 # [25085]
26+
# 21da24227f2c0087c95f44c60b1bca65cedf0611 # [25824] includes a punctuation change
27+
30f822b8ee767c0b07fe1780f2829de0cba8c314 # [25880]
28+
1cdb0ac2fa5452e58d7a002b260d594a581af02e # [26475]
29+
37a37b5fc578d945376cf3b66b4a23265d6491f3 # [26597]
30+
bda43fd1071ed45ded3def7872866f62e40af9f5 # [26627]
31+
98fe4a5aedfdaa8c769bf2aaedc58eb63d342320 # [26631]
32+
d6e06a2ee5c15b19ca80b9162f3e19c06b5af34d # [26714]
33+
cfd5c395bb3ba810edaec6cf4483212181823d2e # [26851]
34+
2ec5e68249bdacee9ac0ce59fad91b1149244af8 # [27123]
35+
305e72859a4154fc96bac7774ab7808ead6a06d4 # [29169]
36+
ca32a2d410f954b6b40d23f3392ba53e62a3d9f1 # [29707]
37+
48a504cc50a16f60a395ace8d133130e3d6962f5 # [30047]
38+
b539bd985bdf2dde162f46fcbf14e51e46ff8be7 # [30372]
39+
9a3942ffd82b28a77982e0a0d1c2bb0b8a70ce44 # [30996]
40+
469164785ff8defefbfcdf972c57d9004c273256 # [31077]
41+
c4e9c64233166957cd1cbcc54ff54b1a02edd3b5 # [31623]
42+
f4f1b4821342fd1d58708356b3ec39d6fefe31ac # [33411]
43+
0ec540b946eaebebc7e8ee39a8e4738914e7f2a3 # [33627]
44+
0c5bd752629b0960c6f43ca212a64724e4f40346 # [34534]
45+
991feb70438e981290696fa2b4fbe2ea54696a02 # [34774]
46+
6911ff11308089eace23719fc50160d403081a8e # [35627]
47+
8df8cf2df14fe26174f97af5bb17d63f2e867231 # [42843]
48+
49+
# Coding Standards
50+
8f95800d52c1736d651ae6e259f90ad4a0db2c3f # [42343]

src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
253253

254254
editor.addCommand( 'WP_Help', function() {
255255
var access = tinymce.Env.mac ? __( 'Ctrl + Alt + letter:' ) : __( 'Shift + Alt + letter:' ),
256-
meta = tinymce.Env.mac ? __( 'Cmd + letter:' ) : __( 'Ctrl + letter:' ),
256+
meta = tinymce.Env.mac ? __( ' + letter:' ) : __( 'Ctrl + letter:' ),
257257
table1 = [],
258258
table2 = [],
259259
row1 = {},

src/js/_enqueues/wp/customize/controls.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8334,6 +8334,33 @@
83348334
history.replaceState( {}, document.title, urlParser.href );
83358335
}
83368336

8337+
/**
8338+
* Displays a Site Editor notification when a block theme is activated.
8339+
*
8340+
* @since 4.9.0
8341+
*
8342+
* @param {string} [notification] - A notification to display.
8343+
* @return {void}
8344+
*/
8345+
function addSiteEditorNotification( notification ) {
8346+
api.notifications.add( new api.Notification( 'site_editor_block_theme_notice', {
8347+
message: notification,
8348+
type: 'info',
8349+
dismissible: false,
8350+
render: function() {
8351+
var notification = api.Notification.prototype.render.call( this ),
8352+
button = notification.find( 'button.switch-to-editor' );
8353+
8354+
button.on( 'click', function( event ) {
8355+
event.preventDefault();
8356+
location.assign( button.data( 'action' ) );
8357+
} );
8358+
8359+
return notification;
8360+
}
8361+
} ) );
8362+
}
8363+
83378364
/**
83388365
* Dismiss autosave.
83398366
*
@@ -8408,6 +8435,10 @@
84088435
if ( api.settings.changeset.latestAutoDraftUuid || api.settings.changeset.hasAutosaveRevision ) {
84098436
addAutosaveRestoreNotification();
84108437
}
8438+
var shouldDisplayBlockThemeNotification = !! parseInt( $( '#customize-info' ).data( 'block-theme' ), 10 );
8439+
if (shouldDisplayBlockThemeNotification) {
8440+
addSiteEditorNotification( api.l10n.blockThemeNotification );
8441+
}
84118442
})();
84128443

84138444
// Check if preview url is valid and load the preview frame.

src/wp-admin/css/customize-controls.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,12 @@ p.customize-section-description {
17331733
font-weight: 400;
17341734
}
17351735

1736+
#customize-notifications-area .notification-message button.switch-to-editor {
1737+
display: block;
1738+
margin-top: 6px;
1739+
font-weight: 400;
1740+
}
1741+
17361742
#customize-theme-controls .control-panel-themes > .accordion-section-title:after {
17371743
display: none;
17381744
}

src/wp-admin/css/list-tables.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,12 +914,26 @@ tr.inline-edit-row td,
914914
}
915915

916916
.inline-edit-row .submit {
917+
display: flex;
918+
flex-wrap: wrap;
919+
align-items: center;
917920
clear: both;
918921
padding: 0.5em;
919922
margin: 0.5em 0 0;
920923
}
921924

925+
.inline-edit-save.submit .button {
926+
margin-right: 8px;
927+
}
928+
929+
.inline-edit-save .spinner {
930+
float: none;
931+
margin: 0;
932+
}
933+
922934
.inline-edit-row .notice-error {
935+
box-sizing: border-box;
936+
min-width: 100%;
923937
margin-top: 1em;
924938
}
925939

src/wp-admin/customize.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
<ul></ul>
223223
</div>
224224
<div class="wp-full-overlay-sidebar-content" tabindex="-1">
225-
<div id="customize-info" class="accordion-section customize-info">
225+
<div id="customize-info" class="accordion-section customize-info" data-block-theme="<?php echo (int) wp_is_block_theme(); ?>">
226226
<div class="accordion-section-title">
227227
<span class="preview-notice">
228228
<?php
@@ -235,7 +235,7 @@
235235
<div class="customize-panel-description">
236236
<p>
237237
<?php
238-
_e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements.' );
238+
_e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements. The Customizer is intended for use with non-block themes.' );
239239
?>
240240
</p>
241241
<p>

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

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3970,20 +3970,47 @@ function wp_ajax_crop_image() {
39703970
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
39713971
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
39723972

3973-
$parent_url = wp_get_attachment_url( $attachment_id );
3974-
$url = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
3973+
$parent_url = wp_get_attachment_url( $attachment_id );
3974+
$parent_basename = wp_basename( $parent_url );
3975+
$url = str_replace( $parent_basename, wp_basename( $cropped ), $parent_url );
39753976

39763977
$size = wp_getimagesize( $cropped );
39773978
$image_type = ( $size ) ? $size['mime'] : 'image/jpeg';
39783979

3980+
// Get the original image's post to pre-populate the cropped image.
3981+
$original_attachment = get_post( $attachment_id );
3982+
$sanitized_post_title = sanitize_file_name( $original_attachment->post_title );
3983+
$use_original_title = (
3984+
( '' !== trim( $original_attachment->post_title ) ) &&
3985+
/*
3986+
* Check if the original image has a title other than the "filename" default,
3987+
* meaning the image had a title when originally uploaded or its title was edited.
3988+
*/
3989+
( $parent_basename !== $sanitized_post_title ) &&
3990+
( pathinfo( $parent_basename, PATHINFO_FILENAME ) !== $sanitized_post_title )
3991+
);
3992+
$use_original_description = ( '' !== trim( $original_attachment->post_content ) );
3993+
39793994
$object = array(
3980-
'post_title' => wp_basename( $cropped ),
3981-
'post_content' => $url,
3995+
'post_title' => $use_original_title ? $original_attachment->post_title : wp_basename( $cropped ),
3996+
'post_content' => $use_original_description ? $original_attachment->post_content : $url,
39823997
'post_mime_type' => $image_type,
39833998
'guid' => $url,
39843999
'context' => $context,
39854000
);
39864001

4002+
// Copy the image caption attribute (post_excerpt field) from the original image.
4003+
if ( '' !== trim( $original_attachment->post_excerpt ) ) {
4004+
$object['post_excerpt'] = $original_attachment->post_excerpt;
4005+
}
4006+
4007+
// Copy the image alt text attribute from the original image.
4008+
if ( '' !== trim( $original_attachment->_wp_attachment_image_alt ) ) {
4009+
$object['meta_input'] = array(
4010+
'_wp_attachment_image_alt' => wp_slash( $original_attachment->_wp_attachment_image_alt ),
4011+
);
4012+
}
4013+
39874014
$attachment_id = wp_insert_attachment( $object, $cropped );
39884015
$metadata = wp_generate_attachment_metadata( $attachment_id, $cropped );
39894016

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

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,6 @@ public static function debug_data() {
388388
$site_count += get_blog_count( $network_id );
389389
}
390390

391-
$info['wp-core']['fields']['user_count'] = array(
392-
'label' => __( 'User count' ),
393-
'value' => get_user_count(),
394-
);
395-
396391
$info['wp-core']['fields']['site_count'] = array(
397392
'label' => __( 'Site count' ),
398393
'value' => $site_count,
@@ -402,15 +397,13 @@ public static function debug_data() {
402397
'label' => __( 'Network count' ),
403398
'value' => $network_query->found_networks,
404399
);
405-
} else {
406-
$user_count = count_users();
407-
408-
$info['wp-core']['fields']['user_count'] = array(
409-
'label' => __( 'User count' ),
410-
'value' => $user_count['total_users'],
411-
);
412400
}
413401

402+
$info['wp-core']['fields']['user_count'] = array(
403+
'label' => __( 'User count' ),
404+
'value' => get_user_count(),
405+
);
406+
414407
// WordPress features requiring processing.
415408
$wp_dotorg = wp_remote_get( 'https://wordpress.org', array( 'timeout' => 10 ) );
416409

@@ -1471,20 +1464,20 @@ public static function debug_data() {
14711464
}
14721465

14731466
/**
1474-
* Returns the value of a MySQL variable.
1467+
* Returns the value of a MySQL system variable.
14751468
*
14761469
* @since 5.9.0
14771470
*
14781471
* @global wpdb $wpdb WordPress database abstraction object.
14791472
*
1480-
* @param string $var Name of the MySQL variable.
1473+
* @param string $mysql_var Name of the MySQL system variable.
14811474
* @return string|null The variable value on success. Null if the variable does not exist.
14821475
*/
1483-
public static function get_mysql_var( $var ) {
1476+
public static function get_mysql_var( $mysql_var ) {
14841477
global $wpdb;
14851478

14861479
$result = $wpdb->get_row(
1487-
$wpdb->prepare( 'SHOW VARIABLES LIKE %s', $var ),
1480+
$wpdb->prepare( 'SHOW VARIABLES LIKE %s', $mysql_var ),
14881481
ARRAY_A
14891482
);
14901483

@@ -1500,11 +1493,11 @@ public static function get_mysql_var( $var ) {
15001493
*
15011494
* @since 5.2.0
15021495
*
1503-
* @param array $info_array Information gathered from the `WP_Debug_Data::debug_data` function.
1504-
* @param string $type The data type to return, either 'info' or 'debug'.
1496+
* @param array $info_array Information gathered from the `WP_Debug_Data::debug_data()` function.
1497+
* @param string $data_type The data type to return, either 'info' or 'debug'.
15051498
* @return string The formatted data.
15061499
*/
1507-
public static function format( $info_array, $type ) {
1500+
public static function format( $info_array, $data_type ) {
15081501
$return = "`\n";
15091502

15101503
foreach ( $info_array as $section => $details ) {
@@ -1513,7 +1506,7 @@ public static function format( $info_array, $type ) {
15131506
continue;
15141507
}
15151508

1516-
$section_label = 'debug' === $type ? $section : $details['label'];
1509+
$section_label = 'debug' === $data_type ? $section : $details['label'];
15171510

15181511
$return .= sprintf(
15191512
"### %s%s ###\n\n",
@@ -1526,7 +1519,7 @@ public static function format( $info_array, $type ) {
15261519
continue;
15271520
}
15281521

1529-
if ( 'debug' === $type && isset( $field['debug'] ) ) {
1522+
if ( 'debug' === $data_type && isset( $field['debug'] ) ) {
15301523
$debug_data = $field['debug'];
15311524
} else {
15321525
$debug_data = $field['value'];
@@ -1547,7 +1540,7 @@ public static function format( $info_array, $type ) {
15471540
$value = $debug_data;
15481541
}
15491542

1550-
if ( 'debug' === $type ) {
1543+
if ( 'debug' === $data_type ) {
15511544
$label = $field_name;
15521545
} else {
15531546
$label = $field['label'];

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,13 @@ public function wp_lang_dir() {
129129
* @see WP_Filesystem_Base::wp_themes_dir()
130130
* @see WP_Filesystem_Base::wp_lang_dir()
131131
*
132-
* @param string $base The folder to start searching from.
133-
* @param bool $echo True to display debug information.
134-
* Default false.
132+
* @param string $base Optional. The folder to start searching from. Default '.'.
133+
* @param bool $verbose Optional. True to display debug information. Default false.
135134
* @return string The location of the remote path.
136135
*/
137-
public function find_base_dir( $base = '.', $echo = false ) {
136+
public function find_base_dir( $base = '.', $verbose = false ) {
138137
_deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir()' );
139-
$this->verbose = $echo;
138+
$this->verbose = $verbose;
140139
return $this->abspath();
141140
}
142141

@@ -151,13 +150,13 @@ public function find_base_dir( $base = '.', $echo = false ) {
151150
* @see WP_Filesystem_Base::wp_themes_dir()
152151
* @see WP_Filesystem_Base::wp_lang_dir()
153152
*
154-
* @param string $base The folder to start searching from.
155-
* @param bool $echo True to display debug information.
153+
* @param string $base Optional. The folder to start searching from. Default '.'.
154+
* @param bool $verbose Optional. True to display debug information. Default false.
156155
* @return string The location of the remote path.
157156
*/
158-
public function get_base_dir( $base = '.', $echo = false ) {
157+
public function get_base_dir( $base = '.', $verbose = false ) {
159158
_deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir()' );
160-
$this->verbose = $echo;
159+
$this->verbose = $verbose;
161160
return $this->abspath();
162161
}
163162

src/wp-admin/includes/class-wp-importer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,13 @@ public function is_user_over_quota() {
238238
}
239239

240240
/**
241-
* Replace newlines, tabs, and multiple spaces with a single space
241+
* Replace newlines, tabs, and multiple spaces with a single space.
242242
*
243-
* @param string $string
243+
* @param string $text
244244
* @return string
245245
*/
246-
public function min_whitespace( $string ) {
247-
return preg_replace( '|[\r\n\t ]+|', ' ', $string );
246+
public function min_whitespace( $text ) {
247+
return preg_replace( '|[\r\n\t ]+|', ' ', $text );
248248
}
249249

250250
/**

0 commit comments

Comments
 (0)