Skip to content

Commit d7890e8

Browse files
Merge branch 'trunk' into ticket/64145
2 parents 22d50c3 + dfd1bd1 commit d7890e8

31 files changed

+1368
-107
lines changed

src/wp-content/themes/twentynineteen/functions.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,13 @@ function twentynineteen_excerpt_more( $link ) {
242242
* @global int $content_width Content width.
243243
*/
244244
function twentynineteen_content_width() {
245-
// This variable is intended to be overruled from themes.
246-
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
247-
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
245+
/**
246+
* Filters Twenty Nineteen content width of the theme.
247+
*
248+
* @since Twenty Nineteen 1.0
249+
*
250+
* @param int $content_width Content width in pixels.
251+
*/
248252
$GLOBALS['content_width'] = apply_filters( 'twentynineteen_content_width', 640 );
249253
}
250254
add_action( 'after_setup_theme', 'twentynineteen_content_width', 0 );

src/wp-content/themes/twentynineteen/inc/helper-functions.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@
1111
* Determines if post thumbnail can be displayed.
1212
*/
1313
function twentynineteen_can_show_post_thumbnail() {
14-
return apply_filters( 'twentynineteen_can_show_post_thumbnail', ! post_password_required() && ! is_attachment() && has_post_thumbnail() );
14+
$show_post_thumbnail = ! post_password_required() && ! is_attachment() && has_post_thumbnail();
15+
16+
/**
17+
* Filters whether to show post thumbnail.
18+
*
19+
* @since Twenty Nineteen 1.0
20+
*
21+
* @param bool $show_post_thumbnail Whether to show post thumbnail.
22+
*/
23+
return apply_filters( 'twentynineteen_can_show_post_thumbnail', $show_post_thumbnail );
1524
}
1625

1726
/**

src/wp-content/themes/twentysixteen/functions.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ function twentysixteen_setup() {
246246
* @since Twenty Sixteen 1.0
247247
*/
248248
function twentysixteen_content_width() {
249+
/**
250+
* Filters Twenty Sixteen content width of the theme.
251+
*
252+
* @since Twenty Sixteen 1.0
253+
*
254+
* @param int $content_width Content width in pixels.
255+
*/
249256
$GLOBALS['content_width'] = apply_filters( 'twentysixteen_content_width', 840 );
250257
}
251258
add_action( 'after_setup_theme', 'twentysixteen_content_width', 0 );

src/wp-content/themes/twentysixteen/inc/template-tags.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
*/
2020
function twentysixteen_entry_meta() {
2121
if ( 'post' === get_post_type() ) {
22+
/**
23+
* Filters the Twenty Sixteen entry meta avatar size.
24+
*
25+
* @since Twenty Sixteen 1.0
26+
*
27+
* @param int $size The avatar height and width size in pixels.
28+
*/
2229
$author_avatar_size = apply_filters( 'twentysixteen_author_avatar_size', 49 );
2330
printf(
2431
'<span class="byline">%1$s<span class="screen-reader-text">%2$s </span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',

src/wp-content/themes/twentytwentyone/functions.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,13 @@ function twenty_twenty_one_widgets_init() {
375375
* @return void
376376
*/
377377
function twenty_twenty_one_content_width() {
378-
// This variable is intended to be overruled from themes.
379-
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
380-
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
378+
/**
379+
* Filters Twenty Twenty-One content width of the theme.
380+
*
381+
* @since Twenty Twenty-One 1.0
382+
*
383+
* @param int $content_width Content width in pixels.
384+
*/
381385
$GLOBALS['content_width'] = apply_filters( 'twenty_twenty_one_content_width', 750 );
382386
}
383387
add_action( 'after_setup_theme', 'twenty_twenty_one_content_width', 0 );

src/wp-includes/abilities-api.php

Lines changed: 394 additions & 47 deletions
Large diffs are not rendered by default.

src/wp-includes/abilities-api/class-wp-abilities-registry.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ public function register( string $name, array $args ): ?WP_Ability {
121121

122122
// Validate ability category exists if provided (will be validated as required in WP_Ability).
123123
if ( isset( $args['category'] ) ) {
124-
$category_registry = WP_Ability_Categories_Registry::get_instance();
125-
if ( ! $category_registry->is_registered( $args['category'] ) ) {
124+
if ( ! wp_has_ability_category( $args['category'] ) ) {
126125
_doing_it_wrong(
127126
__METHOD__,
128127
sprintf(
@@ -237,14 +236,14 @@ public function is_registered( string $name ): bool {
237236
* @see wp_get_ability()
238237
*
239238
* @param string $name The name of the registered ability, with its namespace.
240-
* @return ?WP_Ability The registered ability instance, or null if it is not registered.
239+
* @return WP_Ability|null The registered ability instance, or null if it is not registered.
241240
*/
242241
public function get_registered( string $name ): ?WP_Ability {
243242
if ( ! $this->is_registered( $name ) ) {
244243
_doing_it_wrong(
245244
__METHOD__,
246245
/* translators: %s: Ability name. */
247-
sprintf( esc_html__( 'Ability "%s" not found.' ), esc_attr( $name ) ),
246+
sprintf( __( 'Ability "%s" not found.' ), esc_html( $name ) ),
248247
'6.9.0'
249248
);
250249
return null;
@@ -266,7 +265,9 @@ public static function get_instance(): ?self {
266265
_doing_it_wrong(
267266
__METHOD__,
268267
sprintf(
269-
__( 'Ability API should not be initialized before the <code>init</code> action has fired' )
268+
// translators: %s: init action.
269+
__( 'Ability API should not be initialized before the %s action has fired.' ),
270+
'<code>init</code>'
270271
),
271272
'6.9.0'
272273
);
@@ -315,6 +316,6 @@ public function __wakeup(): void {
315316
* This is a security hardening measure to prevent serialization of the registry.
316317
*/
317318
public function __sleep(): array {
318-
throw new LogicException( __CLASS__ . ' should never be serialized' );
319+
throw new LogicException( __CLASS__ . ' should never be serialized.' );
319320
}
320321
}

src/wp-includes/abilities-api/class-wp-ability-categories-registry.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ public static function get_instance(): ?self {
205205
_doing_it_wrong(
206206
__METHOD__,
207207
sprintf(
208-
__( 'Ability API should not be initialized before the <code>init</code> action has fired' )
208+
// translators: %s: init action.
209+
__( 'Ability API should not be initialized before the %s action has fired.' ),
210+
'<code>init</code>'
209211
),
210212
'6.9.0'
211213
);
@@ -249,6 +251,6 @@ public function __wakeup(): void {
249251
* This is a security hardening measure to prevent serialization of the registry.
250252
*/
251253
public function __sleep(): array {
252-
throw new LogicException( __CLASS__ . ' should never be serialized' );
254+
throw new LogicException( __CLASS__ . ' should never be serialized.' );
253255
}
254256
}

src/wp-includes/abilities-api/class-wp-ability-category.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ final class WP_Ability_Category {
7575
public function __construct( string $slug, array $args ) {
7676
if ( empty( $slug ) ) {
7777
throw new InvalidArgumentException(
78-
esc_html__( 'The ability category slug cannot be empty.' )
78+
__( 'The ability category slug cannot be empty.' )
7979
);
8080
}
8181

@@ -211,6 +211,6 @@ public function __wakeup(): void {
211211
* This is a security hardening measure to prevent serialization of the ability category.
212212
*/
213213
public function __sleep(): array {
214-
throw new LogicException( __CLASS__ . ' should never be serialized' );
214+
throw new LogicException( __CLASS__ . ' should never be serialized.' );
215215
}
216216
}

src/wp-includes/abilities-api/class-wp-ability.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function __construct( string $name, array $args ) {
169169
__( 'Property "%1$s" is not a valid property for ability "%2$s". Please check the %3$s class for allowed properties.' ),
170170
'<code>' . esc_html( $property_name ) . '</code>',
171171
'<code>' . esc_html( $this->name ) . '</code>',
172-
'<code>' . self::class . '</code>'
172+
'<code>' . __CLASS__ . '</code>'
173173
),
174174
'6.9.0'
175175
);
@@ -445,7 +445,7 @@ public function validate_input( $input = null ) {
445445
sprintf(
446446
/* translators: %s ability name. */
447447
__( 'Ability "%s" does not define an input schema required to validate the provided input.' ),
448-
$this->name
448+
esc_html( $this->name )
449449
)
450450
);
451451
}
@@ -457,7 +457,7 @@ public function validate_input( $input = null ) {
457457
sprintf(
458458
/* translators: %1$s ability name, %2$s error message. */
459459
__( 'Ability "%1$s" has invalid input. Reason: %2$s' ),
460-
$this->name,
460+
esc_html( $this->name ),
461461
$valid_input->get_error_message()
462462
)
463463
);
@@ -514,7 +514,7 @@ protected function do_execute( $input = null ) {
514514
return new WP_Error(
515515
'ability_invalid_execute_callback',
516516
/* translators: %s ability name. */
517-
sprintf( __( 'Ability "%s" does not have a valid execute callback.' ), $this->name )
517+
sprintf( __( 'Ability "%s" does not have a valid execute callback.' ), esc_html( $this->name ) )
518518
);
519519
}
520520

@@ -542,7 +542,7 @@ protected function validate_output( $output ) {
542542
sprintf(
543543
/* translators: %1$s ability name, %2$s error message. */
544544
__( 'Ability "%1$s" has invalid output. Reason: %2$s' ),
545-
$this->name,
545+
esc_html( $this->name ),
546546
$valid_output->get_error_message()
547547
)
548548
);
@@ -581,7 +581,7 @@ public function execute( $input = null ) {
581581
return new WP_Error(
582582
'ability_invalid_permissions',
583583
/* translators: %s ability name. */
584-
sprintf( __( 'Ability "%s" does not have necessary permission.' ), $this->name )
584+
sprintf( __( 'Ability "%s" does not have necessary permission.' ), esc_html( $this->name ) )
585585
);
586586
}
587587

@@ -638,6 +638,6 @@ public function __wakeup(): void {
638638
* This is a security hardening measure to prevent serialization of the ability.
639639
*/
640640
public function __sleep(): array {
641-
throw new LogicException( __CLASS__ . ' should never be serialized' );
641+
throw new LogicException( __CLASS__ . ' should never be serialized.' );
642642
}
643643
}

0 commit comments

Comments
 (0)