Skip to content

Commit 5ebc808

Browse files
committed
Merge remote-tracking branch 'upstream/trunk' into 6-9/dependency-updates
2 parents 7a6e2d3 + 56ac994 commit 5ebc808

File tree

20 files changed

+225
-172
lines changed

20 files changed

+225
-172
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ module.exports = function(grunt) {
11591159
}
11601160

11611161
// Fetch a list of the files that Twemoji supplies.
1162-
query = 'query={repository(owner: "jdecked", name: "twemoji") {object(expression: "v17.0.1:assets/svg") {... on Tree {entries {name}}}}}';
1162+
query = 'query={repository(owner: "jdecked", name: "twemoji") {object(expression: "gh-pages:v/17.0.2/svg") {... on Tree {entries {name}}}}}';
11631163
files = spawn( 'gh', [ 'api', 'graphql', '-f', query] );
11641164

11651165
if ( 0 !== files.status ) {

src/js/_enqueues/vendor/twemoji.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ var twemoji = (function (
534534
how = {callback: how};
535535
}
536536

537-
// WP start
537+
// WP start
538538
// Allow passing of the doNotParse() callback in the settings.
539539
// The callback is used in `grabAllTextNodes()` (DOM mode only) as a filter
540540
// that allows bypassing of some of the text nodes. It gets the current subnode as argument.

src/wp-admin/includes/class-theme-installer-skin.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,24 @@ public function after() {
121121

122122
$install_actions = array();
123123

124-
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) && ! $theme_info->is_block_theme() ) {
125-
$customize_url = add_query_arg(
126-
array(
127-
'theme' => urlencode( $stylesheet ),
128-
'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
129-
),
130-
admin_url( 'customize.php' )
131-
);
124+
if ( current_user_can( 'edit_theme_options' ) && ( $theme_info->is_block_theme() || current_user_can( 'customize' ) ) ) {
125+
if ( $theme_info->is_block_theme() ) {
126+
$customize_url = add_query_arg(
127+
array(
128+
'wp_theme_preview' => urlencode( $stylesheet ),
129+
'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
130+
),
131+
admin_url( 'site-editor.php' )
132+
);
133+
} else {
134+
$customize_url = add_query_arg(
135+
array(
136+
'theme' => urlencode( $stylesheet ),
137+
'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
138+
),
139+
admin_url( 'customize.php' )
140+
);
141+
}
132142

133143
$install_actions['preview'] = sprintf(
134144
'<a href="%s" class="hide-if-no-customize load-customize">' .

src/wp-admin/includes/dashboard.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,7 @@ function wp_dashboard_recent_comments( $total_items = 5 ) {
10741074
$comments_query['status'] = 'approve';
10751075
}
10761076

1077+
$comments_count = 0;
10771078
do {
10781079
$possible = get_comments( $comments_query );
10791080

src/wp-admin/includes/schema.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,6 @@ function populate_options( array $options = array() ) {
563563

564564
// 6.9.0
565565
'wp_notes_notify' => 1,
566-
567566
);
568567

569568
// 3.3.0

src/wp-admin/menu.php

Lines changed: 77 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@
4040

4141
if ( ! is_multisite() ) {
4242
if ( current_user_can( 'update_core' ) ) {
43-
$cap = 'update_core';
43+
$capability = 'update_core';
4444
} elseif ( current_user_can( 'update_plugins' ) ) {
45-
$cap = 'update_plugins';
45+
$capability = 'update_plugins';
4646
} elseif ( current_user_can( 'update_themes' ) ) {
47-
$cap = 'update_themes';
47+
$capability = 'update_themes';
4848
} else {
49-
$cap = 'update_languages';
49+
$capability = 'update_languages';
5050
}
51+
5152
$submenu['index.php'][10] = array(
5253
sprintf(
5354
/* translators: %s: Number of pending updates. */
@@ -58,30 +59,35 @@
5859
number_format_i18n( $update_data['counts']['total'] )
5960
)
6061
),
61-
$cap,
62+
$capability,
6263
'update-core.php',
6364
);
64-
unset( $cap );
65+
66+
unset( $capability );
6567
}
6668

6769
$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
6870

6971
// $menu[5] = Posts.
7072

71-
$menu[10] = array( __( 'Media' ), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' );
73+
$menu[10] = array( __( 'Media' ), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' );
74+
7275
$submenu['upload.php'][5] = array( __( 'Library' ), 'upload_files', 'upload.php' );
7376
$submenu['upload.php'][10] = array( __( 'Add Media File' ), 'upload_files', 'media-new.php' );
74-
$i = 15;
75-
foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) {
76-
if ( ! $tax->show_ui || ! $tax->show_in_menu ) {
77-
continue;
77+
$submenu_index = 15;
78+
79+
foreach ( get_taxonomies_for_attachments( 'objects' ) as $taxonomy ) {
80+
if ( ! $taxonomy->show_ui || ! $taxonomy->show_in_menu ) {
81+
continue;
7882
}
7983

80-
$submenu['upload.php'][ $i++ ] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&amp;post_type=attachment' );
84+
$submenu['upload.php'][ $submenu_index++ ] = array( esc_attr( $taxonomy->labels->menu_name ), $taxonomy->cap->manage_terms, 'edit-tags.php?taxonomy=' . $taxonomy->name . '&amp;post_type=attachment' );
8185
}
82-
unset( $tax, $i );
8386

84-
$menu[15] = array( __( 'Links' ), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' );
87+
unset( $taxonomy, $submenu_index );
88+
89+
$menu[15] = array( __( 'Links' ), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' );
90+
8591
$submenu['link-manager.php'][5] = array( _x( 'All Links', 'admin menu' ), 'manage_links', 'link-manager.php' );
8692
$submenu['link-manager.php'][10] = array( __( 'Add Link' ), 'manage_links', 'link-add.php' );
8793
$submenu['link-manager.php'][15] = array( __( 'Link Categories' ), 'manage_categories', 'edit-tags.php?taxonomy=link_category' );
@@ -90,114 +96,124 @@
9096

9197
// Avoid the comment count query for users who cannot edit_posts.
9298
if ( current_user_can( 'edit_posts' ) ) {
93-
$awaiting_mod = wp_count_comments();
94-
$awaiting_mod = $awaiting_mod->moderated;
95-
$awaiting_mod_i18n = number_format_i18n( $awaiting_mod );
99+
$awaiting_moderation = wp_count_comments();
100+
$awaiting_moderation = $awaiting_moderation->moderated;
101+
$awaiting_moderation_i18n = number_format_i18n( $awaiting_moderation );
96102
/* translators: %s: Number of comments. */
97-
$awaiting_mod_text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_mod ), $awaiting_mod_i18n );
103+
$awaiting_moderation_text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_moderation ), $awaiting_moderation_i18n );
98104

99105
$menu[25] = array(
100106
/* translators: %s: Number of comments. */
101-
sprintf( __( 'Comments %s' ), '<span class="awaiting-mod count-' . absint( $awaiting_mod ) . '"><span class="pending-count" aria-hidden="true">' . $awaiting_mod_i18n . '</span><span class="comments-in-moderation-text screen-reader-text">' . $awaiting_mod_text . '</span></span>' ),
107+
sprintf( __( 'Comments %s' ), '<span class="awaiting-mod count-' . absint( $awaiting_moderation ) . '"><span class="pending-count" aria-hidden="true">' . $awaiting_moderation_i18n . '</span><span class="comments-in-moderation-text screen-reader-text">' . $awaiting_moderation_text . '</span></span>' ),
102108
'edit_posts',
103109
'edit-comments.php',
104110
'',
105111
'menu-top menu-icon-comments',
106112
'menu-comments',
107113
'dashicons-admin-comments',
108114
);
109-
unset( $awaiting_mod );
115+
116+
unset( $awaiting_moderation );
110117
}
111118

112119
$submenu['edit-comments.php'][0] = array( __( 'All Comments' ), 'edit_posts', 'edit-comments.php' );
113120

114121
$_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group.
115122

116-
$types = (array) get_post_types(
123+
$post_types = (array) get_post_types(
117124
array(
118125
'show_ui' => true,
119126
'_builtin' => false,
120127
'show_in_menu' => true,
121128
)
122129
);
123-
$builtin = array( 'post', 'page' );
124-
foreach ( array_merge( $builtin, $types ) as $ptype ) {
125-
$ptype_obj = get_post_type_object( $ptype );
130+
$builtin = array( 'post', 'page' );
131+
132+
foreach ( array_merge( $builtin, $post_types ) as $post_type ) {
133+
$post_type_obj = get_post_type_object( $post_type );
134+
126135
// Check if it should be a submenu.
127-
if ( true !== $ptype_obj->show_in_menu ) {
136+
if ( true !== $post_type_obj->show_in_menu ) {
128137
continue;
129138
}
130-
$ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
131-
$ptype_for_id = sanitize_html_class( $ptype );
139+
140+
$post_type_menu_position = is_int( $post_type_obj->menu_position )
141+
? $post_type_obj->menu_position
142+
: ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
143+
$post_type_for_id = sanitize_html_class( $post_type );
132144

133145
$menu_icon = 'dashicons-admin-post';
134-
if ( is_string( $ptype_obj->menu_icon ) ) {
146+
if ( is_string( $post_type_obj->menu_icon ) ) {
135147
// Special handling for an empty div.wp-menu-image, data:image/svg+xml, and Dashicons.
136-
if ( 'none' === $ptype_obj->menu_icon || 'div' === $ptype_obj->menu_icon
137-
|| str_starts_with( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' )
138-
|| str_starts_with( $ptype_obj->menu_icon, 'dashicons-' )
148+
if ( 'none' === $post_type_obj->menu_icon || 'div' === $post_type_obj->menu_icon
149+
|| str_starts_with( $post_type_obj->menu_icon, 'data:image/svg+xml;base64,' )
150+
|| str_starts_with( $post_type_obj->menu_icon, 'dashicons-' )
139151
) {
140-
$menu_icon = $ptype_obj->menu_icon;
152+
$menu_icon = $post_type_obj->menu_icon;
141153
} else {
142-
$menu_icon = esc_url( $ptype_obj->menu_icon );
154+
$menu_icon = esc_url( $post_type_obj->menu_icon );
143155
}
144-
} elseif ( in_array( $ptype, $builtin, true ) ) {
145-
$menu_icon = 'dashicons-admin-' . $ptype;
156+
} elseif ( in_array( $post_type, $builtin, true ) ) {
157+
$menu_icon = 'dashicons-admin-' . $post_type;
146158
}
147159

148-
$menu_class = 'menu-top menu-icon-' . $ptype_for_id;
160+
$menu_class = 'menu-top menu-icon-' . $post_type_for_id;
149161
// 'post' special case.
150-
if ( 'post' === $ptype ) {
162+
if ( 'post' === $post_type ) {
151163
$menu_class .= ' open-if-no-js';
152-
$ptype_file = 'edit.php';
164+
$post_type_file = 'edit.php';
153165
$post_new_file = 'post-new.php';
154166
$edit_tags_file = 'edit-tags.php?taxonomy=%s';
155167
} else {
156-
$ptype_file = "edit.php?post_type=$ptype";
157-
$post_new_file = "post-new.php?post_type=$ptype";
158-
$edit_tags_file = "edit-tags.php?taxonomy=%s&amp;post_type=$ptype";
168+
$post_type_file = "edit.php?post_type=$post_type";
169+
$post_new_file = "post-new.php?post_type=$post_type";
170+
$edit_tags_file = "edit-tags.php?taxonomy=%s&amp;post_type=$post_type";
159171
}
160172

161-
if ( in_array( $ptype, $builtin, true ) ) {
162-
$ptype_menu_id = 'menu-' . $ptype_for_id . 's';
173+
if ( in_array( $post_type, $builtin, true ) ) {
174+
$post_type_menu_id = 'menu-' . $post_type_for_id . 's';
163175
} else {
164-
$ptype_menu_id = 'menu-posts-' . $ptype_for_id;
176+
$post_type_menu_id = 'menu-posts-' . $post_type_for_id;
165177
}
178+
166179
/*
167-
* If $ptype_menu_position is already populated or will be populated
180+
* If $post_type_menu_position is already populated or will be populated
168181
* by a hard-coded value below, increment the position.
169182
*/
170183
$core_menu_positions = array( 59, 60, 65, 70, 75, 80, 85, 99 );
171-
while ( isset( $menu[ $ptype_menu_position ] ) || in_array( $ptype_menu_position, $core_menu_positions, true ) ) {
172-
++$ptype_menu_position;
184+
while ( isset( $menu[ $post_type_menu_position ] ) || in_array( $post_type_menu_position, $core_menu_positions, true ) ) {
185+
++$post_type_menu_position;
173186
}
174187

175-
$menu[ $ptype_menu_position ] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, $ptype_file, '', $menu_class, $ptype_menu_id, $menu_icon );
176-
$submenu[ $ptype_file ][5] = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, $ptype_file );
177-
$submenu[ $ptype_file ][10] = array( $ptype_obj->labels->add_new_item, $ptype_obj->cap->create_posts, $post_new_file );
188+
$menu[ $post_type_menu_position ] = array( esc_attr( $post_type_obj->labels->menu_name ), $post_type_obj->cap->edit_posts, $post_type_file, '', $menu_class, $post_type_menu_id, $menu_icon );
189+
$submenu[ $post_type_file ][5] = array( $post_type_obj->labels->all_items, $post_type_obj->cap->edit_posts, $post_type_file );
190+
$submenu[ $post_type_file ][10] = array( $post_type_obj->labels->add_new_item, $post_type_obj->cap->create_posts, $post_new_file );
178191

179-
$i = 15;
180-
foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
181-
if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array( $ptype, (array) $tax->object_type, true ) ) {
192+
$submenu_index = 15;
193+
194+
foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
195+
if ( ! $taxonomy->show_ui || ! $taxonomy->show_in_menu || ! in_array( $post_type, (array) $taxonomy->object_type, true ) ) {
182196
continue;
183197
}
184198

185-
$submenu[ $ptype_file ][ $i++ ] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, sprintf( $edit_tags_file, $tax->name ) );
199+
$submenu[ $post_type_file ][ $submenu_index++ ] = array( esc_attr( $taxonomy->labels->menu_name ), $taxonomy->cap->manage_terms, sprintf( $edit_tags_file, $taxonomy->name ) );
186200
}
187201
}
188-
unset( $ptype, $ptype_obj, $ptype_for_id, $ptype_menu_position, $menu_icon, $i, $tax, $post_new_file );
202+
203+
unset( $post_type, $post_type_obj, $post_type_for_id, $post_type_menu_position, $menu_icon, $submenu_index, $taxonomy, $post_new_file );
189204

190205
$menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
191206

192-
$appearance_cap = current_user_can( 'switch_themes' ) ? 'switch_themes' : 'edit_theme_options';
207+
$appearance_capability = current_user_can( 'switch_themes' ) ? 'switch_themes' : 'edit_theme_options';
193208

194-
$menu[60] = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
209+
$menu[60] = array( __( 'Appearance' ), $appearance_capability, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
195210

196211
$count = '';
197212
if ( ! is_multisite() && current_user_can( 'update_themes' ) ) {
198213
if ( ! isset( $update_data ) ) {
199214
$update_data = wp_get_update_data();
200215
}
216+
201217
$count = sprintf(
202218
'<span class="update-plugins count-%s"><span class="theme-count">%s</span></span>',
203219
$update_data['counts']['themes'],
@@ -206,7 +222,7 @@
206222
}
207223

208224
/* translators: %s: Number of available theme updates. */
209-
$submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_cap, 'themes.php' );
225+
$submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_capability, 'themes.php' );
210226

211227
if ( wp_is_block_theme() ) {
212228
$submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' );
@@ -234,17 +250,15 @@
234250

235251
if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize' ) ) {
236252
$customize_header_url = add_query_arg( array( 'autofocus' => array( 'control' => 'header_image' ) ), $customize_url );
237-
$submenu['themes.php'][15] = array( _x( 'Header', 'custom image header' ), $appearance_cap, esc_url( $customize_header_url ), '', 'hide-if-no-customize' );
253+
$submenu['themes.php'][15] = array( _x( 'Header', 'custom image header' ), $appearance_capability, esc_url( $customize_header_url ), '', 'hide-if-no-customize' );
238254
}
239255

240256
if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize' ) ) {
241257
$customize_background_url = add_query_arg( array( 'autofocus' => array( 'control' => 'background_image' ) ), $customize_url );
242-
$submenu['themes.php'][20] = array( _x( 'Background', 'custom background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' );
258+
$submenu['themes.php'][20] = array( _x( 'Background', 'custom background' ), $appearance_capability, esc_url( $customize_background_url ), '', 'hide-if-no-customize' );
243259
}
244260

245-
unset( $customize_url );
246-
247-
unset( $appearance_cap );
261+
unset( $customize_url, $appearance_capability );
248262

249263
// Add 'Theme File Editor' to the bottom of the Appearance (non-block themes) or Tools (block themes) menu.
250264
if ( ! is_multisite() ) {

src/wp-admin/options-discussion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
<?php _e( 'A comment is held for moderation' ); ?> </label>
163163
<br />
164164
<label for="wp_notes_notify">
165-
<input name="wp_notes_notify" type="checkbox" id="wp_notes_notify" value="1" <?php checked( '1', get_option( 'wp_notes_notify' ) ); ?> />
165+
<input name="wp_notes_notify" type="checkbox" id="wp_notes_notify" value="1" <?php checked( '1', get_option( 'wp_notes_notify', 1 ) ); ?> />
166166
<?php _e( 'Anyone posts a note' ); ?> </label>
167167

168168
</fieldset></td>

src/wp-admin/options-general.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -480,20 +480,11 @@ class="<?php echo esc_attr( $classes_for_button ); ?>"
480480

481481
foreach ( $date_formats as $format ) {
482482
echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'";
483-
484483
if ( get_option( 'date_format' ) === $format ) { // checked() uses "==" rather than "===".
485484
echo " checked='checked'";
486485
$custom = false;
487486
}
488-
489-
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span>' .
490-
'<code>' . esc_html( $format ) . '</code>';
491-
492-
if ( __( 'F j, Y' ) === $format ) {
493-
echo ' ' . __( '(Site language default)' );
494-
}
495-
496-
echo "</label><br />\n";
487+
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n";
497488
}
498489

499490
echo '<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
@@ -534,20 +525,11 @@ class="<?php echo esc_attr( $classes_for_button ); ?>"
534525

535526
foreach ( $time_formats as $format ) {
536527
echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'";
537-
538528
if ( get_option( 'time_format' ) === $format ) { // checked() uses "==" rather than "===".
539529
echo " checked='checked'";
540530
$custom = false;
541531
}
542-
543-
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span>' .
544-
'<code>' . esc_html( $format ) . '</code>';
545-
546-
if ( __( 'g:i a' ) === $format ) {
547-
echo ' ' . __( '(Site language default)' );
548-
}
549-
550-
echo "</label><br />\n";
532+
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n";
551533
}
552534

553535
echo '<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';

0 commit comments

Comments
 (0)