| 1 |
<?php |
| 2 |
/** |
| 3 |
* Abilities Service Provider. |
| 4 |
* |
| 5 |
* @package zip-ai |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace ZipAI\MCP\Classes\Providers; |
| 9 |
|
| 10 |
// Exit if accessed directly. |
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
use ZipAI\MCP\Classes\Abilities\Zipai_Abilities; |
| 16 |
use ZipAI\MCP\Classes\Core\Service_Provider; |
| 17 |
|
| 18 |
/** |
| 19 |
* Abilities Service Provider Class. |
| 20 |
*/ |
| 21 |
class Abilities_Service_Provider extends Service_Provider { |
| 22 |
|
| 23 |
/** |
| 24 |
* Register services. |
| 25 |
* |
| 26 |
* @return void |
| 27 |
*/ |
| 28 |
public function register() { |
| 29 |
// Register ZipWP Abilities. |
| 30 |
$this->container->singleton( |
| 31 |
Zipai_Abilities::class, |
| 32 |
function () { |
| 33 |
return new Zipai_Abilities(); |
| 34 |
} |
| 35 |
); |
| 36 |
|
| 37 |
// SureForms abilities provided natively by SureForms plugin (v2.7+). |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Boot services. |
| 42 |
* |
| 43 |
* @return void |
| 44 |
*/ |
| 45 |
public function boot() { |
| 46 |
// Register ability categories. |
| 47 |
add_action( 'wp_abilities_api_categories_init', array( $this, 'register_categories' ) ); |
| 48 |
|
| 49 |
// Instantiate abilities. |
| 50 |
$this->container->make( Zipai_Abilities::class ); |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Register ability categories. |
| 55 |
* |
| 56 |
* @return void |
| 57 |
*/ |
| 58 |
public function register_categories() { |
| 59 |
if ( ! function_exists( 'wp_register_ability_category' ) ) { |
| 60 |
return; |
| 61 |
} |
| 62 |
|
| 63 |
// ZipWP - WordPress settings, admin, site management |
| 64 |
wp_register_ability_category( |
| 65 |
'zipai', |
| 66 |
array( |
| 67 |
'label' => 'WordPress Management', |
| 68 |
'description' => 'WordPress site settings, theme, plugin, and media management tools', |
| 69 |
) |
| 70 |
); |
| 71 |
|
| 72 |
// SureForms - Form creation and management |
| 73 |
wp_register_ability_category( |
| 74 |
'sureforms', |
| 75 |
array( |
| 76 |
'label' => 'SureForms', |
| 77 |
'description' => 'Form creation and management tools', |
| 78 |
) |
| 79 |
); |
| 80 |
|
| 81 |
// SureCart - E-commerce, products, payments |
| 82 |
wp_register_ability_category( |
| 83 |
'surecart', |
| 84 |
array( |
| 85 |
'label' => 'SureCart E-commerce', |
| 86 |
'description' => 'E-commerce tools for products, cart, and payments', |
| 87 |
) |
| 88 |
); |
| 89 |
|
| 90 |
// WooCommerce - Products, orders, customers. |
| 91 |
wp_register_ability_category( |
| 92 |
'woo', |
| 93 |
array( |
| 94 |
'label' => 'WooCommerce', |
| 95 |
'description' => 'WooCommerce product, order, and customer management tools', |
| 96 |
) |
| 97 |
); |
| 98 |
|
| 99 |
// Accessibility - WCAG compliance and a11y tools. |
| 100 |
wp_register_ability_category( |
| 101 |
'a11y', |
| 102 |
array( |
| 103 |
'label' => 'Accessibility', |
| 104 |
'description' => 'Accessibility compliance and WCAG audit tools', |
| 105 |
) |
| 106 |
); |
| 107 |
} |
| 108 |
} |
| 109 |
|