22/**
33 * Abilities API
44 *
5- * Defines WP_Abilities_Category_Registry class.
5+ * Defines WP_Ability_Categories_Registry class.
66 *
77 * @package WordPress
88 * @subpackage Abilities API
1717 * @since 6.9.0
1818 * @access private
1919 */
20- final class WP_Abilities_Category_Registry {
20+ final class WP_Ability_Categories_Registry {
2121 /**
2222 * The singleton instance of the registry.
2323 *
@@ -27,40 +27,40 @@ final class WP_Abilities_Category_Registry {
2727 private static $ instance = null ;
2828
2929 /**
30- * Holds the registered categories.
30+ * Holds the registered ability categories.
3131 *
3232 * @since 6.9.0
3333 * @var WP_Ability_Category[]
3434 */
3535 private $ registered_categories = array ();
3636
3737 /**
38- * Registers a new category.
38+ * Registers a new ability category.
3939 *
4040 * Do not use this method directly. Instead, use the `wp_register_ability_category()` function.
4141 *
4242 * @since 6.9.0
4343 *
4444 * @see wp_register_ability_category()
4545 *
46- * @param string $slug The unique slug for the category. Must contain only lowercase
46+ * @param string $slug The unique slug for the ability category. Must contain only lowercase
4747 * alphanumeric characters and dashes.
4848 * @param array<string, mixed> $args {
49- * An associative array of arguments for the category.
49+ * An associative array of arguments for the ability category.
5050 *
51- * @type string $label The human-readable label for the category.
52- * @type string $description A description of the category.
53- * @type array<string, mixed> $meta Optional. Additional metadata for the category.
51+ * @type string $label The human-readable label for the ability category.
52+ * @type string $description A description of the ability category.
53+ * @type array<string, mixed> $meta Optional. Additional metadata for the ability category.
5454 * }
55- * @return WP_Ability_Category|null The registered category instance on success, null on failure.
55+ * @return WP_Ability_Category|null The registered ability category instance on success, null on failure.
5656 */
5757 public function register ( string $ slug , array $ args ): ?WP_Ability_Category {
5858 if ( ! doing_action ( 'wp_abilities_api_categories_init ' ) ) {
5959 _doing_it_wrong (
6060 __METHOD__ ,
6161 sprintf (
62- /* translators: 1: abilities_api_categories_init, 2: category slug. */
63- __ ( 'Categories must be registered during the %1$s action. The category %2$s was not registered. ' ),
62+ /* translators: 1: abilities_api_categories_init, 2: ability category slug. */
63+ __ ( 'Ability categories must be registered during the %1$s action. The category %2$s was not registered. ' ),
6464 '<code>wp_abilities_api_categories_init</code> ' ,
6565 '<code> ' . esc_html ( $ slug ) . '</code> '
6666 ),
@@ -72,8 +72,8 @@ public function register( string $slug, array $args ): ?WP_Ability_Category {
7272 if ( $ this ->is_registered ( $ slug ) ) {
7373 _doing_it_wrong (
7474 __METHOD__ ,
75- /* translators: %s: Category slug. */
76- sprintf ( __ ( 'Category "%s" is already registered. ' ), esc_html ( $ slug ) ),
75+ /* translators: %s: Ability category slug. */
76+ sprintf ( __ ( 'Ability category "%s" is already registered. ' ), esc_html ( $ slug ) ),
7777 '6.9.0 '
7878 );
7979 return null ;
@@ -82,25 +82,25 @@ public function register( string $slug, array $args ): ?WP_Ability_Category {
8282 if ( ! preg_match ( '/^[a-z0-9]+(?:-[a-z0-9]+)*$/ ' , $ slug ) ) {
8383 _doing_it_wrong (
8484 __METHOD__ ,
85- __ ( 'Category slug must contain only lowercase alphanumeric characters and dashes. ' ),
85+ __ ( 'Ability category slug must contain only lowercase alphanumeric characters and dashes. ' ),
8686 '6.9.0 '
8787 );
8888 return null ;
8989 }
9090
9191 /**
92- * Filters the category arguments before they are validated and used to instantiate the category.
92+ * Filters the ability category arguments before they are validated and used to instantiate the ability category.
9393 *
9494 * @since 6.9.0
9595 *
9696 * @param array<string, mixed> $args {
97- * The arguments used to instantiate the category.
97+ * The arguments used to instantiate the ability category.
9898 *
99- * @type string $label The human-readable label for the category.
100- * @type string $description A description of the category.
101- * @type array<string, mixed> $meta Optional. Additional metadata for the category.
99+ * @type string $label The human-readable label for the ability category.
100+ * @type string $description A description of the ability category.
101+ * @type array<string, mixed> $meta Optional. Additional metadata for the ability category.
102102 * }
103- * @param string $slug The slug of the category.
103+ * @param string $slug The slug of the ability category.
104104 */
105105 $ args = apply_filters ( 'wp_register_ability_category_args ' , $ args , $ slug );
106106
@@ -121,16 +121,16 @@ public function register( string $slug, array $args ): ?WP_Ability_Category {
121121 }
122122
123123 /**
124- * Unregisters a category.
124+ * Unregisters a ability category.
125125 *
126126 * Do not use this method directly. Instead, use the `wp_unregister_ability_category()` function.
127127 *
128128 * @since 6.9.0
129129 *
130130 * @see wp_unregister_ability_category()
131131 *
132- * @param string $slug The slug of the registered category.
133- * @return WP_Ability_Category|null The unregistered category instance on success, null on failure.
132+ * @param string $slug The slug of the registered ability category.
133+ * @return WP_Ability_Category|null The unregistered ability category instance on success, null on failure.
134134 */
135135 public function unregister ( string $ slug ): ?WP_Ability_Category {
136136 if ( ! $ this ->is_registered ( $ slug ) ) {
@@ -150,43 +150,43 @@ public function unregister( string $slug ): ?WP_Ability_Category {
150150 }
151151
152152 /**
153- * Retrieves the list of all registered categories.
153+ * Retrieves the list of all registered ability categories.
154154 *
155155 * Do not use this method directly. Instead, use the `wp_get_ability_categories()` function.
156156 *
157157 * @since 6.9.0
158158 *
159159 * @see wp_get_ability_categories()
160160 *
161- * @return array<string, WP_Ability_Category> The array of registered categories.
161+ * @return array<string, WP_Ability_Category> The array of registered ability categories.
162162 */
163163 public function get_all_registered (): array {
164164 return $ this ->registered_categories ;
165165 }
166166
167167 /**
168- * Checks if a category is registered.
168+ * Checks if a ability category is registered.
169169 *
170170 * @since 6.9.0
171171 *
172- * @param string $slug The slug of the category.
173- * @return bool True if the category is registered, false otherwise.
172+ * @param string $slug The slug of the ability category.
173+ * @return bool True if the ability category is registered, false otherwise.
174174 */
175175 public function is_registered ( string $ slug ): bool {
176176 return isset ( $ this ->registered_categories [ $ slug ] );
177177 }
178178
179179 /**
180- * Retrieves a registered category.
180+ * Retrieves a registered ability category.
181181 *
182182 * Do not use this method directly. Instead, use the `wp_get_ability_category()` function.
183183 *
184184 * @since 6.9.0
185185 *
186186 * @see wp_get_ability_category()
187187 *
188- * @param string $slug The slug of the registered category.
189- * @return WP_Ability_Category|null The registered category instance, or null if it is not registered.
188+ * @param string $slug The slug of the registered ability category.
189+ * @return WP_Ability_Category|null The registered ability category instance, or null if it is not registered.
190190 */
191191 public function get_registered ( string $ slug ): ?WP_Ability_Category {
192192 if ( ! $ this ->is_registered ( $ slug ) ) {
@@ -208,7 +208,7 @@ public function get_registered( string $slug ): ?WP_Ability_Category {
208208 *
209209 * @since 6.9.0
210210 *
211- * @return WP_Abilities_Category_Registry The main registry instance.
211+ * @return WP_Ability_Categories_Registry The main registry instance.
212212 */
213213 public static function get_instance (): self {
214214 if ( null === self ::$ instance ) {
@@ -217,11 +217,11 @@ public static function get_instance(): self {
217217 /**
218218 * Fires when preparing ability categories registry.
219219 *
220- * Categories should be registered on this action to ensure they're available when needed.
220+ * Ability categories should be registered on this action to ensure they're available when needed.
221221 *
222222 * @since 6.9.0
223223 *
224- * @param WP_Abilities_Category_Registry $instance Categories registry object.
224+ * @param WP_Ability_Categories_Registry $instance Ability categories registry object.
225225 */
226226 do_action ( 'wp_abilities_api_categories_init ' , self ::$ instance );
227227 }
0 commit comments