Skip to content

Commit 010b6ea

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents 5d49607 + 2437ef5 commit 010b6ea

30 files changed

Lines changed: 572 additions & 368 deletions

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
"jquery-hoverintent": "1.10.2",
145145
"lodash": "4.17.21",
146146
"masonry-layout": "4.2.2",
147-
"moment": "2.29.3",
147+
"moment": "2.29.4",
148148
"objectFitPolyfill": "2.3.5",
149149
"polyfill-library": "4.0.0",
150150
"react": "17.0.2",

src/wp-admin/css/common.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,6 +1574,9 @@ div.error {
15741574
.wrap .notice p:before,
15751575
.import-php .updating-message:before {
15761576
margin-right: 6px;
1577+
}
1578+
1579+
.import-php .updating-message:before {
15771580
vertical-align: bottom;
15781581
}
15791582

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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,14 +1277,14 @@ function wp_ajax_replyto_comment( $action ) {
12771277

12781278
check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
12791279

1280-
$comment_post_ID = (int) $_POST['comment_post_ID'];
1281-
$post = get_post( $comment_post_ID );
1280+
$comment_post_id = (int) $_POST['comment_post_ID'];
1281+
$post = get_post( $comment_post_id );
12821282

12831283
if ( ! $post ) {
12841284
wp_die( -1 );
12851285
}
12861286

1287-
if ( ! current_user_can( 'edit_post', $comment_post_ID ) ) {
1287+
if ( ! current_user_can( 'edit_post', $comment_post_id ) ) {
12881288
wp_die( -1 );
12891289
}
12901290

@@ -1331,13 +1331,26 @@ function wp_ajax_replyto_comment( $action ) {
13311331
}
13321332

13331333
$comment_auto_approved = false;
1334-
$commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID' );
1334+
1335+
$commentdata = array(
1336+
'comment_post_ID' => $comment_post_id,
1337+
);
1338+
1339+
$commentdata += compact(
1340+
'comment_author',
1341+
'comment_author_email',
1342+
'comment_author_url',
1343+
'comment_content',
1344+
'comment_type',
1345+
'comment_parent',
1346+
'user_ID'
1347+
);
13351348

13361349
// Automatically approve parent comment.
13371350
if ( ! empty( $_POST['approve_parent'] ) ) {
13381351
$parent = get_comment( $comment_parent );
13391352

1340-
if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_ID ) {
1353+
if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_id ) {
13411354
if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) {
13421355
wp_die( -1 );
13431356
}

src/wp-admin/includes/post.php

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ function postbox_classes( $box_id, $screen_id ) {
13761376
*
13771377
* @since 2.5.0
13781378
*
1379-
* @param int|WP_Post $id Post ID or post object.
1379+
* @param int|WP_Post $post Post ID or post object.
13801380
* @param string|null $title Optional. Title to override the post's current title
13811381
* when generating the post name. Default null.
13821382
* @param string|null $name Optional. Name to override the post name. Default null.
@@ -1387,8 +1387,9 @@ function postbox_classes( $box_id, $screen_id ) {
13871387
* @type string $1 The post name.
13881388
* }
13891389
*/
1390-
function get_sample_permalink( $id, $title = null, $name = null ) {
1391-
$post = get_post( $id );
1390+
function get_sample_permalink( $post, $title = null, $name = null ) {
1391+
$post = get_post( $post );
1392+
13921393
if ( ! $post ) {
13931394
return array( '', '' );
13941395
}
@@ -1468,13 +1469,14 @@ function get_sample_permalink( $id, $title = null, $name = null ) {
14681469
*
14691470
* @since 2.5.0
14701471
*
1471-
* @param int|WP_Post $id Post ID or post object.
1472+
* @param int|WP_Post $post Post ID or post object.
14721473
* @param string|null $new_title Optional. New title. Default null.
14731474
* @param string|null $new_slug Optional. New slug. Default null.
14741475
* @return string The HTML of the sample permalink slug editor.
14751476
*/
1476-
function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
1477-
$post = get_post( $id );
1477+
function get_sample_permalink_html( $post, $new_title = null, $new_slug = null ) {
1478+
$post = get_post( $post );
1479+
14781480
if ( ! $post ) {
14791481
return '';
14801482
}
@@ -1511,7 +1513,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
15111513

15121514
// Encourage a pretty permalink setting.
15131515
if ( ! get_option( 'permalink_structure' ) && current_user_can( 'manage_options' )
1514-
&& ! ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $id )
1516+
&& ! ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID )
15151517
) {
15161518
$return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small">' . __( 'Change Permalink Structure' ) . "</a></span>\n";
15171519
}
@@ -1628,17 +1630,19 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
16281630
*
16291631
* @since 2.5.0
16301632
*
1631-
* @param int|WP_Post $post_id ID or object of the post to check for editing.
1633+
* @param int|WP_Post $post ID or object of the post to check for editing.
16321634
* @return int|false ID of the user with lock. False if the post does not exist, post is not locked,
16331635
* the user with lock does not exist, or the post is locked by current user.
16341636
*/
1635-
function wp_check_post_lock( $post_id ) {
1636-
$post = get_post( $post_id );
1637+
function wp_check_post_lock( $post ) {
1638+
$post = get_post( $post );
1639+
16371640
if ( ! $post ) {
16381641
return false;
16391642
}
16401643

16411644
$lock = get_post_meta( $post->ID, '_edit_lock', true );
1645+
16421646
if ( ! $lock ) {
16431647
return false;
16441648
}
@@ -1666,7 +1670,7 @@ function wp_check_post_lock( $post_id ) {
16661670
*
16671671
* @since 2.5.0
16681672
*
1669-
* @param int|WP_Post $post_id ID or object of the post being edited.
1673+
* @param int|WP_Post $post ID or object of the post being edited.
16701674
* @return array|false {
16711675
* Array of the lock time and user ID. False if the post does not exist, or there
16721676
* is no current user.
@@ -1675,13 +1679,15 @@ function wp_check_post_lock( $post_id ) {
16751679
* @type int $1 The ID of the current user.
16761680
* }
16771681
*/
1678-
function wp_set_post_lock( $post_id ) {
1679-
$post = get_post( $post_id );
1682+
function wp_set_post_lock( $post ) {
1683+
$post = get_post( $post );
1684+
16801685
if ( ! $post ) {
16811686
return false;
16821687
}
16831688

16841689
$user_id = get_current_user_id();
1690+
16851691
if ( 0 == $user_id ) {
16861692
return false;
16871693
}
@@ -1701,12 +1707,14 @@ function wp_set_post_lock( $post_id ) {
17011707
*/
17021708
function _admin_notice_post_locked() {
17031709
$post = get_post();
1710+
17041711
if ( ! $post ) {
17051712
return;
17061713
}
17071714

17081715
$user = null;
17091716
$user_id = wp_check_post_lock( $post->ID );
1717+
17101718
if ( $user_id ) {
17111719
$user = get_userdata( $user_id );
17121720
}
@@ -1936,6 +1944,7 @@ function post_preview() {
19361944
$_POST['ID'] = $post_ID;
19371945

19381946
$post = get_post( $post_ID );
1947+
19391948
if ( ! $post ) {
19401949
wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
19411950
}

src/wp-content/themes/twentytwentyone/inc/block-patterns.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function twenty_twenty_one_register_block_pattern() {
4747
'title' => esc_html__( 'Large text', 'twentytwentyone' ),
4848
'categories' => array( 'twentytwentyone' ),
4949
'viewportWidth' => 1440,
50+
'blockTypes' => array( 'core/heading' ),
5051
'content' => '<!-- wp:heading {"align":"wide","fontSize":"gigantic","style":{"typography":{"lineHeight":"1.1"}}} --><h2 class="alignwide has-text-align-wide has-gigantic-font-size" style="line-height:1.1">' . esc_html__( 'A new portfolio default theme for WordPress', 'twentytwentyone' ) . '</h2><!-- /wp:heading -->',
5152
)
5253
);
@@ -58,6 +59,7 @@ function twenty_twenty_one_register_block_pattern() {
5859
'title' => esc_html__( 'Links area', 'twentytwentyone' ),
5960
'categories' => array( 'twentytwentyone' ),
6061
'viewportWidth' => 1440,
62+
'blockTypes' => array( 'core/cover' ),
6163
'description' => esc_html_x( 'A huge text followed by social networks and email address links.', 'Block pattern description', 'twentytwentyone' ),
6264
'content' => '<!-- wp:cover {"overlayColor":"green","contentPosition":"center center","align":"wide","className":"is-style-twentytwentyone-border"} --><div class="wp-block-cover alignwide has-green-background-color has-background-dim is-style-twentytwentyone-border"><div class="wp-block-cover__inner-container"><!-- wp:spacer {"height":20} --><div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --><!-- wp:paragraph {"fontSize":"huge"} --><p class="has-huge-font-size">' . wp_kses_post( __( 'Let&#8217;s Connect.', 'twentytwentyone' ) ) . '</p><!-- /wp:paragraph --><!-- wp:spacer {"height":75} --><div style="height:75px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --><!-- wp:columns --><div class="wp-block-columns"><!-- wp:column --><div class="wp-block-column"><!-- wp:paragraph --><p><a href="#" data-type="URL">' . esc_html__( 'Twitter', 'twentytwentyone' ) . '</a> / <a href="#" data-type="URL">' . esc_html__( 'Instagram', 'twentytwentyone' ) . '</a> / <a href="#" data-type="URL">' . esc_html__( 'Dribbble', 'twentytwentyone' ) . '</a></p><!-- /wp:paragraph --></div><!-- /wp:column --><!-- wp:column --><div class="wp-block-column"><!-- wp:paragraph --><p><a href="#">' . esc_html__( 'example@example.com', 'twentytwentyone' ) . '</a></p><!-- /wp:paragraph --></div><!-- /wp:column --></div><!-- /wp:columns --><!-- wp:spacer {"height":20} --><div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --></div></div><!-- /wp:cover --><!-- wp:paragraph --><p></p><!-- /wp:paragraph -->',
6365
)
@@ -82,6 +84,7 @@ function twenty_twenty_one_register_block_pattern() {
8284
'title' => esc_html__( 'Overlapping images', 'twentytwentyone' ),
8385
'categories' => array( 'twentytwentyone' ),
8486
'viewportWidth' => 1024,
87+
'blockTypes' => array( 'core/columns' ),
8588
'description' => esc_html_x( 'Three images inside an overlapping columns block.', 'Block pattern description', 'twentytwentyone' ),
8689
'content' => '<!-- wp:columns {"verticalAlignment":"center","align":"wide","className":"is-style-twentytwentyone-columns-overlap"} --><div class="wp-block-columns alignwide are-vertically-aligned-center is-style-twentytwentyone-columns-overlap"><!-- wp:column {"verticalAlignment":"center"} --><div class="wp-block-column is-vertically-aligned-center"><!-- wp:image {"align":"full","sizeSlug":"full"} --><figure class="wp-block-image alignfull size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/roses-tremieres-hollyhocks-1884.jpg" alt="' . esc_attr__( '&#8220;Roses Trémières&#8221; by Berthe Morisot', 'twentytwentyone' ) . '"/></figure><!-- /wp:image --><!-- wp:spacer --><div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --><!-- wp:image {"align":"full","sizeSlug":"full"} --><figure class="wp-block-image alignfull size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/in-the-bois-de-boulogne.jpg" alt="' . esc_attr__( '&#8220;In the Bois de Boulogne&#8221; by Berthe Morisot', 'twentytwentyone' ) . '"/></figure><!-- /wp:image --></div><!-- /wp:column --><!-- wp:column {"verticalAlignment":"center"} --><div class="wp-block-column is-vertically-aligned-center"><!-- wp:spacer --><div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --><!-- wp:image {"align":"full",sizeSlug":"full"} --><figure class="wp-block-image alignfull size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/young-woman-in-mauve.jpg" alt="' . esc_attr__( '&#8220;Young Woman in Mauve&#8221; by Berthe Morisot', 'twentytwentyone' ) . '"/></figure><!-- /wp:image --></div><!-- /wp:column --></div><!-- /wp:columns -->',
8790
)
@@ -106,6 +109,7 @@ function twenty_twenty_one_register_block_pattern() {
106109
'title' => esc_html__( 'Overlapping images and text', 'twentytwentyone' ),
107110
'categories' => array( 'twentytwentyone' ),
108111
'viewportWidth' => 1440,
112+
'blockTypes' => array( 'core/columns' ),
109113
'description' => esc_html_x( 'An overlapping columns block with two images and a text description.', 'Block pattern description', 'twentytwentyone' ),
110114
'content' => '<!-- wp:columns {"verticalAlignment":null,"align":"wide","className":"is-style-twentytwentyone-columns-overlap"} --> <div class="wp-block-columns alignwide is-style-twentytwentyone-columns-overlap"><!-- wp:column --> <div class="wp-block-column"><!-- wp:image {sizeSlug":"full"} --> <figure class="wp-block-image size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/the-garden-at-bougival-1884.jpg" alt="' . esc_attr__( '&#8220;The Garden at Bougival&#8221; by Berthe Morisot', 'twentytwentyone' ) . '"/></figure> <!-- /wp:image --></div> <!-- /wp:column --> <!-- wp:column {"verticalAlignment":"bottom"} --> <div class="wp-block-column is-vertically-aligned-bottom"><!-- wp:group {"className":"is-style-twentytwentyone-border","backgroundColor":"green"} --> <div class="wp-block-group is-style-twentytwentyone-border has-green-background-color has-background"><div class="wp-block-group__inner-container"><!-- wp:paragraph {"fontSize":"extra-large","style":{"typography":{"lineHeight":"1.4"}}} --> <p class="has-extra-large-font-size" style="line-height:1.4">' . esc_html__( 'Beautiful gardens painted by Berthe Morisot in the late 1800s', 'twentytwentyone' ) . '</p> <!-- /wp:paragraph --></div></div> <!-- /wp:group --></div> <!-- /wp:column --> <!-- wp:column --> <div class="wp-block-column"><!-- wp:image {sizeSlug":"full"} --> <figure class="wp-block-image size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/villa-with-orange-trees-nice.jpg" alt="' . esc_attr__( '&#8220;Villa with Orange Trees, Nice&#8221; by Berthe Morisot', 'twentytwentyone' ) . '"/></figure> <!-- /wp:image --></div> <!-- /wp:column --></div> <!-- /wp:columns -->',
111115
)
@@ -127,6 +131,7 @@ function twenty_twenty_one_register_block_pattern() {
127131
array(
128132
'title' => esc_html__( 'Contact information', 'twentytwentyone' ),
129133
'categories' => array( 'twentytwentyone' ),
134+
'blockTypes' => array( 'core/columns' ),
130135
'description' => esc_html_x( 'A block with 3 columns that display contact information and social media links.', 'Block pattern description', 'twentytwentyone' ),
131136
'content' => '<!-- wp:columns {"align":"wide"} --><div class="wp-block-columns alignwide"><!-- wp:column --><div class="wp-block-column"><!-- wp:paragraph --><p><a href="mailto:#">' . esc_html_x( 'example@example.com', 'Block pattern sample content', 'twentytwentyone' ) . '<br></a>' . esc_html_x( '123-456-7890', 'Block pattern sample content', 'twentytwentyone' ) . '</p><!-- /wp:paragraph --></div><!-- /wp:column --><!-- wp:column --><div class="wp-block-column"><!-- wp:paragraph {"align":"center"} --><p class="has-text-align-center">' . esc_html_x( '123 Main Street', 'Block pattern sample content', 'twentytwentyone' ) . '<br>' . esc_html_x( 'Cambridge, MA, 02139', 'Block pattern sample content', 'twentytwentyone' ) . '</p><!-- /wp:paragraph --></div><!-- /wp:column --><!-- wp:column {"verticalAlignment":"center"} --><div class="wp-block-column is-vertically-aligned-center"><!-- wp:social-links {"align":"right","className":"is-style-twentytwentyone-social-icons-color"} --><ul class="wp-block-social-links alignright is-style-twentytwentyone-social-icons-color"><!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /--><!-- wp:social-link {"url":"https://www.facebook.com/WordPress/","service":"facebook"} /--><!-- wp:social-link {"url":"https://twitter.com/WordPress","service":"twitter"} /--><!-- wp:social-link {"url":"https://www.youtube.com/wordpress","service":"youtube"} /--></ul><!-- /wp:social-links --></div><!-- /wp:column --></div><!-- /wp:columns -->',
132137
)

src/wp-includes/blocks.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
286286
'title' => 'title',
287287
'category' => 'category',
288288
'parent' => 'parent',
289+
'ancestor' => 'ancestor',
289290
'icon' => 'icon',
290291
'description' => 'description',
291292
'keywords' => 'keywords',

0 commit comments

Comments
 (0)