Skip to content

Commit 222b871

Browse files
committed
Include 4 6.8-branch commits
Commit list: 4c4fd4d1b2a5b178915ac5970f86faab12998fcc 07ede8e6a24829ee810fdd60f2ea6696ddd0c793 a9ea0e8be55f8dd8459ddf099406b44402d2a190 d57ecb8b980c5a6ad2b68369750e592f6db4bd09 See #60
1 parent c5745b1 commit 222b871

File tree

6 files changed

+114
-15
lines changed

6 files changed

+114
-15
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
/**
3+
* Aria label block support flag.
4+
*
5+
* @package Retraceur
6+
* @since WP 6.8.0
7+
* @since 2.0.0 Retraceur fork.
8+
*/
9+
10+
/**
11+
* Registers the aria-label block attribute for block types that support it.
12+
*
13+
* @since WP 6.8.0
14+
* @since 2.0.0 Retraceur fork.
15+
* @access private
16+
*
17+
* @param WP_Block_Type $block_type Block Type.
18+
*/
19+
function wp_register_aria_label_support( $block_type ) {
20+
$has_aria_label_support = block_has_support( $block_type, array( 'ariaLabel' ), false );
21+
22+
if ( ! $has_aria_label_support ) {
23+
return;
24+
}
25+
26+
if ( ! $block_type->attributes ) {
27+
$block_type->attributes = array();
28+
}
29+
30+
if ( ! array_key_exists( 'ariaLabel', $block_type->attributes ) ) {
31+
$block_type->attributes['ariaLabel'] = array(
32+
'type' => 'string',
33+
);
34+
}
35+
}
36+
37+
/**
38+
* Add the aria-label to the output.
39+
*
40+
* @since WP 6.8.0
41+
* @since 2.0.0 Retraceur fork.
42+
* @access private
43+
*
44+
* @param WP_Block_Type $block_type Block Type.
45+
* @param array $block_attributes Block attributes.
46+
*
47+
* @return array Block aria-label.
48+
*/
49+
function wp_apply_aria_label_support( $block_type, $block_attributes ) {
50+
if ( ! $block_attributes ) {
51+
return array();
52+
}
53+
54+
$has_aria_label_support = block_has_support( $block_type, array( 'ariaLabel' ), false );
55+
if ( ! $has_aria_label_support ) {
56+
return array();
57+
}
58+
59+
$has_aria_label = array_key_exists( 'ariaLabel', $block_attributes );
60+
if ( ! $has_aria_label ) {
61+
return array();
62+
}
63+
return array( 'aria-label' => $block_attributes['ariaLabel'] );
64+
}
65+
66+
// Register the block support.
67+
WP_Block_Supports::get_instance()->register(
68+
'aria-label',
69+
array(
70+
'register_attribute' => 'wp_register_aria_label_support',
71+
'apply' => 'wp_apply_aria_label_support',
72+
)
73+
);

wp-includes/class-wp-block-supports.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function get_block_wrapper_attributes( $extra_attributes = array() ) {
181181

182182
// This is hardcoded on purpose.
183183
// We only support a fixed list of attributes.
184-
$attributes_to_merge = array( 'style', 'class', 'id' );
184+
$attributes_to_merge = array( 'style', 'class', 'id', 'aria-label' );
185185
$attributes = array();
186186
foreach ( $attributes_to_merge as $attribute_name ) {
187187
if ( empty( $new_attributes[ $attribute_name ] ) && empty( $extra_attributes[ $attribute_name ] ) ) {

wp-includes/class-wp-query.php

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3491,14 +3491,28 @@ public function the_post() {
34913491
global $post;
34923492

34933493
if ( ! $this->in_the_loop ) {
3494-
// Only prime the post cache for queries limited to the ID field.
3495-
$post_ids = array_filter( $this->posts, 'is_numeric' );
3496-
// Exclude any falsey values, such as 0.
3497-
$post_ids = array_filter( $post_ids );
3494+
// Get post IDs to prime incomplete post objects.
3495+
$post_ids = array_reduce(
3496+
$this->posts,
3497+
function ( $carry, $post ) {
3498+
if ( is_numeric( $post ) && $post > 0 ) {
3499+
// Query for post ID.
3500+
$carry[] = $post;
3501+
}
3502+
3503+
if ( is_object( $post ) && isset( $post->ID ) ) {
3504+
// Query for object, either WP_Post or stdClass.
3505+
$carry[] = $post->ID;
3506+
}
3507+
3508+
return $carry;
3509+
},
3510+
array()
3511+
);
34983512
if ( $post_ids ) {
34993513
_prime_post_caches( $post_ids, $this->query_vars['update_post_term_cache'], $this->query_vars['update_post_meta_cache'] );
35003514
}
3501-
$post_objects = array_map( 'get_post', $this->posts );
3515+
$post_objects = array_map( 'get_post', $post_ids );
35023516
update_post_author_caches( $post_objects );
35033517
}
35043518

@@ -3517,6 +3531,16 @@ public function the_post() {
35173531
}
35183532

35193533
$post = $this->next_post();
3534+
3535+
// Get the post ID.
3536+
if ( is_object( $post ) ) {
3537+
$global_post_id = $post->ID;
3538+
} else {
3539+
$global_post_id = $post;
3540+
}
3541+
3542+
// Ensure the global $post is the full post object.
3543+
$post = get_post( $global_post_id );
35203544
$this->setup_postdata( $post );
35213545
}
35223546

wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function register_routes() {
5555
* @return true|WP_Error True if the request has access, or WP_Error object.
5656
*/
5757
public function permissions_check() {
58-
if ( current_user_can( 'edit_theme_options' ) ) {
58+
if ( current_user_can( 'export' ) ) {
5959
return true;
6060
}
6161

wp-includes/update.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,6 @@ function wp_update_plugins( $extra_stats = array() ) {
254254
$current = new stdClass();
255255
}
256256

257-
$updates = new stdClass();
258-
$updates->last_checked = time();
259-
$updates->response = array();
260-
$updates->translations = array();
261-
$updates->no_update = array();
262-
263257
$doing_cron = wp_doing_cron();
264258

265259
// Check for update on a different schedule, depending on the page.
@@ -288,8 +282,6 @@ function wp_update_plugins( $extra_stats = array() ) {
288282
$plugin_changed = false;
289283

290284
foreach ( $plugins as $file => $p ) {
291-
$updates->checked[ $file ] = $p['Version'];
292-
293285
if ( ! isset( $current->checked[ $file ] ) || (string) $current->checked[ $file ] !== (string) $p['Version'] ) {
294286
$plugin_changed = true;
295287
}
@@ -371,6 +363,15 @@ function wp_update_plugins( $extra_stats = array() ) {
371363
return;
372364
}
373365

366+
$updates = new stdClass();
367+
$updates->last_checked = time();
368+
$updates->response = array();
369+
$updates->translations = array();
370+
$updates->no_update = array();
371+
foreach ( $plugins as $file => $p ) {
372+
$updates->checked[ $file ] = $p['Version'];
373+
}
374+
374375
$response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
375376

376377
if ( $response && is_array( $response ) ) {

wp-settings.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@
371371
require ABSPATH . WPINC . '/block-supports/shadow.php';
372372
require ABSPATH . WPINC . '/block-supports/background.php';
373373
require ABSPATH . WPINC . '/block-supports/block-style-variations.php';
374+
require ABSPATH . WPINC . '/block-supports/aria-label.php';
374375
require ABSPATH . WPINC . '/style-engine.php';
375376
require ABSPATH . WPINC . '/style-engine/class-wp-style-engine.php';
376377
require ABSPATH . WPINC . '/style-engine/class-wp-style-engine-css-declarations.php';

0 commit comments

Comments
 (0)