diff --git a/src/wp-includes/abilities-api.php b/src/wp-includes/abilities-api.php index 4de55873c9556..05e4bb38d5a13 100644 --- a/src/wp-includes/abilities-api.php +++ b/src/wp-includes/abilities-api.php @@ -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.' ), 'wp_abilities_api_init', '' . esc_html( $name ) . '' ), diff --git a/src/wp-includes/abilities-api/class-wp-abilities-registry.php b/src/wp-includes/abilities-api/class-wp-abilities-registry.php index 770e553aa44b1..398d28c73dccc 100644 --- a/src/wp-includes/abilities-api/class-wp-abilities-registry.php +++ b/src/wp-includes/abilities-api/class-wp-abilities-registry.php @@ -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; @@ -265,7 +265,9 @@ public static function get_instance(): ?self { _doing_it_wrong( __METHOD__, sprintf( - __( 'Ability API should not be initialized before the init action has fired' ) + // translators: %s: init action. + __( 'Ability API should not be initialized before the %s action has fired.' ), + 'init' ), '6.9.0' ); @@ -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.' ); } } diff --git a/src/wp-includes/abilities-api/class-wp-ability-categories-registry.php b/src/wp-includes/abilities-api/class-wp-ability-categories-registry.php index 6a372c6d8cc82..58bc4323ced69 100644 --- a/src/wp-includes/abilities-api/class-wp-ability-categories-registry.php +++ b/src/wp-includes/abilities-api/class-wp-ability-categories-registry.php @@ -205,7 +205,9 @@ public static function get_instance(): ?self { _doing_it_wrong( __METHOD__, sprintf( - __( 'Ability API should not be initialized before the init action has fired' ) + // translators: %s: init action. + __( 'Ability API should not be initialized before the %s action has fired.' ), + 'init' ), '6.9.0' ); @@ -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.' ); } } diff --git a/src/wp-includes/abilities-api/class-wp-ability-category.php b/src/wp-includes/abilities-api/class-wp-ability-category.php index df6c89701885a..957ce5efa55ea 100644 --- a/src/wp-includes/abilities-api/class-wp-ability-category.php +++ b/src/wp-includes/abilities-api/class-wp-ability-category.php @@ -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.' ) ); } @@ -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.' ); } } diff --git a/src/wp-includes/abilities-api/class-wp-ability.php b/src/wp-includes/abilities-api/class-wp-ability.php index 71b2ea25f1885..4aa9f4c670f28 100644 --- a/src/wp-includes/abilities-api/class-wp-ability.php +++ b/src/wp-includes/abilities-api/class-wp-ability.php @@ -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.' ), '' . esc_html( $property_name ) . '', '' . esc_html( $this->name ) . '', - '' . self::class . '' + '' . __CLASS__ . '' ), '6.9.0' ); @@ -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 ) ) ); } @@ -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() ) ); @@ -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 ) ) ); } @@ -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() ) ); @@ -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 ) ) ); } @@ -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.' ); } }