Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-includes/abilities-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function wp_register_ability( string $name, array $args ): ?WP_Ability {
__FUNCTION__,
sprintf(
/* translators: 1: wp_abilities_api_init, 2: string value of the ability name. */
esc_html__( 'Abilities must be registered on the %1$s action. The ability %2$s was not registered.' ),
__( 'Abilities must be registered on the %1$s action. The ability %2$s was not registered.' ),
'<code>wp_abilities_api_init</code>',
'<code>' . esc_html( $name ) . '</code>'
),
Expand Down
10 changes: 6 additions & 4 deletions src/wp-includes/abilities-api/class-wp-abilities-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ public function is_registered( string $name ): bool {
* @see wp_get_ability()
*
* @param string $name The name of the registered ability, with its namespace.
* @return ?WP_Ability The registered ability instance, or null if it is not registered.
* @return WP_Ability|null The registered ability instance, or null if it is not registered.
*/
public function get_registered( string $name ): ?WP_Ability {
if ( ! $this->is_registered( $name ) ) {
_doing_it_wrong(
__METHOD__,
/* translators: %s: Ability name. */
sprintf( esc_html__( 'Ability "%s" not found.' ), esc_attr( $name ) ),
sprintf( __( 'Ability "%s" not found.' ), esc_html( $name ) ),
'6.9.0'
);
return null;
Expand All @@ -265,7 +265,9 @@ public static function get_instance(): ?self {
_doing_it_wrong(
__METHOD__,
sprintf(
__( 'Ability API should not be initialized before the <code>init</code> action has fired' )
// translators: %s: init action.
__( 'Ability API should not be initialized before the %s action has fired.' ),
'<code>init</code>'
),
'6.9.0'
);
Expand Down Expand Up @@ -314,6 +316,6 @@ public function __wakeup(): void {
* This is a security hardening measure to prevent serialization of the registry.
*/
public function __sleep(): array {
throw new LogicException( __CLASS__ . ' should never be serialized' );
throw new LogicException( __CLASS__ . ' should never be serialized.' );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ public static function get_instance(): ?self {
_doing_it_wrong(
__METHOD__,
sprintf(
__( 'Ability API should not be initialized before the <code>init</code> action has fired' )
// translators: %s: init action.
__( 'Ability API should not be initialized before the %s action has fired.' ),
'<code>init</code>'
),
'6.9.0'
);
Expand Down Expand Up @@ -249,6 +251,6 @@ public function __wakeup(): void {
* This is a security hardening measure to prevent serialization of the registry.
*/
public function __sleep(): array {
throw new LogicException( __CLASS__ . ' should never be serialized' );
throw new LogicException( __CLASS__ . ' should never be serialized.' );
}
}
4 changes: 2 additions & 2 deletions src/wp-includes/abilities-api/class-wp-ability-category.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ final class WP_Ability_Category {
public function __construct( string $slug, array $args ) {
if ( empty( $slug ) ) {
throw new InvalidArgumentException(
esc_html__( 'The ability category slug cannot be empty.' )
__( 'The ability category slug cannot be empty.' )
);
}

Expand Down Expand Up @@ -211,6 +211,6 @@ public function __wakeup(): void {
* This is a security hardening measure to prevent serialization of the ability category.
*/
public function __sleep(): array {
throw new LogicException( __CLASS__ . ' should never be serialized' );
throw new LogicException( __CLASS__ . ' should never be serialized.' );
}
}
14 changes: 7 additions & 7 deletions src/wp-includes/abilities-api/class-wp-ability.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function __construct( string $name, array $args ) {
__( 'Property "%1$s" is not a valid property for ability "%2$s". Please check the %3$s class for allowed properties.' ),
'<code>' . esc_html( $property_name ) . '</code>',
'<code>' . esc_html( $this->name ) . '</code>',
'<code>' . self::class . '</code>'
'<code>' . __CLASS__ . '</code>'
),
'6.9.0'
);
Expand Down Expand Up @@ -445,7 +445,7 @@ public function validate_input( $input = null ) {
sprintf(
/* translators: %s ability name. */
__( 'Ability "%s" does not define an input schema required to validate the provided input.' ),
$this->name
esc_html( $this->name )
)
);
}
Expand All @@ -457,7 +457,7 @@ public function validate_input( $input = null ) {
sprintf(
/* translators: %1$s ability name, %2$s error message. */
__( 'Ability "%1$s" has invalid input. Reason: %2$s' ),
$this->name,
esc_html( $this->name ),
$valid_input->get_error_message()
)
);
Expand Down Expand Up @@ -514,7 +514,7 @@ protected function do_execute( $input = null ) {
return new WP_Error(
'ability_invalid_execute_callback',
/* translators: %s ability name. */
sprintf( __( 'Ability "%s" does not have a valid execute callback.' ), $this->name )
sprintf( __( 'Ability "%s" does not have a valid execute callback.' ), esc_html( $this->name ) )
);
}

Expand Down Expand Up @@ -542,7 +542,7 @@ protected function validate_output( $output ) {
sprintf(
/* translators: %1$s ability name, %2$s error message. */
__( 'Ability "%1$s" has invalid output. Reason: %2$s' ),
$this->name,
esc_html( $this->name ),
$valid_output->get_error_message()
)
);
Expand Down Expand Up @@ -581,7 +581,7 @@ public function execute( $input = null ) {
return new WP_Error(
'ability_invalid_permissions',
/* translators: %s ability name. */
sprintf( __( 'Ability "%s" does not have necessary permission.' ), $this->name )
sprintf( __( 'Ability "%s" does not have necessary permission.' ), esc_html( $this->name ) )
);
}

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