| Server IP : 62.72.47.131 / Your IP : 216.73.217.34 Web Server : Apache/2.4.66 (Debian) System : Linux 975cdb959a49 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64 User : ( 501) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/woocommerce/src/Internal/Abilities/ |
Upload File : |
<?php
/**
* Abilities Categories class file.
*/
declare( strict_types=1 );
namespace Automattic\WooCommerce\Internal\Abilities;
defined( 'ABSPATH' ) || exit;
/**
* Abilities Categories class for WooCommerce.
*
* Registers categories for WooCommerce abilities to improve organization
* and discoverability in the WordPress Abilities API v0.3.0+.
*/
class AbilitiesCategories {
/**
* Initialize category registration.
*
* @internal
*/
final public static function init(): void {
/*
* Register categories when Abilities API categories are ready.
* Support both old (pre-6.9) and new (6.9+) action names.
*/
add_action( 'abilities_api_categories_init', array( __CLASS__, 'register_categories' ) );
add_action( 'wp_abilities_api_categories_init', array( __CLASS__, 'register_categories' ) );
}
/**
* Register WooCommerce ability categories.
*
* @since 10.9.0
*/
public static function register_categories(): void {
// Only register if the function exists.
if ( ! function_exists( 'wp_register_ability_category' ) ) {
return;
}
if ( ! function_exists( 'wp_has_ability_category' ) || ! wp_has_ability_category( 'woocommerce' ) ) {
wp_register_ability_category(
'woocommerce',
array(
'label' => __( 'WooCommerce', 'woocommerce' ),
'description' => __( 'Abilities for WooCommerce store operations, including core commerce features and extension-provided capabilities.', 'woocommerce' ),
)
);
}
if ( ! function_exists( 'wp_has_ability_category' ) || ! wp_has_ability_category( 'woocommerce-rest' ) ) {
wp_register_ability_category(
'woocommerce-rest',
array(
'label' => __( 'WooCommerce REST API', 'woocommerce' ),
'description' => __( 'REST API operations for store resources including products, orders, and other store data.', 'woocommerce' ),
)
);
}
}
}