| @@ -2,13 +2,14 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: SureDonation |
| 4 | 4 | * Plugin URI: https://suredonation.com |
| 5 | 5 | * Description: A powerful donation management plugin for WordPress with campaign tracking, payment processing, and donor management. |
| 6 | - * Version: 0.0.1 | |
| 6 | + * Version: 1.1.0 | |
| 7 | 7 | * Author: SureDonation |
| 8 | 8 | * Text Domain: suredonation |
| 9 | + * Domain Path: /languages | |
| 9 | 10 | * Requires at least: 6.4 |
| 10 | - * Requires PHP: 7.4 | |
| 11 | + * Requires PHP: 8.0 | |
| 11 | 12 | * License: GPL v2 or later |
| 12 | 13 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 | 14 | * |
| 14 | 15 | * @package SureDonation |
| @@ -21,9 +22,9 @@ | ||
| 21 | 22 | |
| 22 | 23 | /** |
| 23 | 24 | * Define plugin constants. |
| 24 | 25 | */ |
| 25 | -define( 'SUREDONATION_VER', '0.0.1' ); | |
| 26 | +define( 'SUREDONATION_VER', '1.1.0' ); | |
| 26 | 27 | define( 'SUREDONATION_FILE', __FILE__ ); |
| 27 | 28 | define( 'SUREDONATION_DIR', plugin_dir_path( __FILE__ ) ); |
| 28 | 29 | define( 'SUREDONATION_URL', plugin_dir_url( __FILE__ ) ); |
| 29 | 30 | define( 'SUREDONATION_BASENAME', plugin_basename( __FILE__ ) ); |
| @@ -30,12 +31,40 @@ | ||
| 30 | 31 | define( 'SUREDONATION_POST_TYPE', 'suredonation_cmpgn' ); |
| 31 | 32 | |
| 32 | 33 | /** |
| 33 | 34 | * Middleware base URL for payment processing. |
| 34 | - * This can be overridden for local/staging environments. | |
| 35 | + * | |
| 36 | + * Pre-define this constant in `wp-config.php` or a mu-plugin to point at a | |
| 37 | + * local/staging middleware. The `defined()` guard prevents the production | |
| 38 | + * default from emitting a redefinition warning when an override is in place. | |
| 35 | 39 | */ |
| 36 | -define( 'SUREDONATION_MIDDLEWARE_BASE_URL', 'https://api.sureforms.com/' ); | |
| 40 | +if ( ! defined( 'SUREDONATION_MIDDLEWARE_BASE_URL' ) ) { | |
| 41 | + define( 'SUREDONATION_MIDDLEWARE_BASE_URL', 'https://api.sureforms.com/' ); | |
| 42 | +} | |
| 37 | 43 | |
| 38 | 44 | /** |
| 45 | + * Abilities API constants. | |
| 46 | + */ | |
| 47 | +define( 'SUREDONATION_ABILITY_API_NAMESPACE', 'suredonation/' ); | |
| 48 | + | |
| 49 | +/** | |
| 39 | 50 | * Load the plugin loader. |
| 40 | 51 | */ |
| 41 | 52 | require_once SUREDONATION_DIR . 'plugin-loader.php'; |
| 53 | + | |
| 54 | +/** | |
| 55 | + * Register Abilities API integration (WordPress 6.9+). | |
| 56 | + * Graceful degradation: if Abilities API is not available, the plugin functions normally. | |
| 57 | + */ | |
| 58 | +if ( class_exists( 'WP_Ability' ) ) { | |
| 59 | + $suredonation_ai_settings = SureDonation\Inc\Helper::get_suredonation_option( 'ai_settings', [] ); | |
| 60 | + if ( is_array( $suredonation_ai_settings ) && ! empty( $suredonation_ai_settings['enable_abilities'] ) ) { | |
| 61 | + $suredonation_ability = new SureDonation\Inc\Abilities\Runtime(); | |
| 62 | + add_action( 'wp_abilities_api_categories_init', [ $suredonation_ability, 'register_categories' ] ); | |
| 63 | + add_action( 'wp_abilities_api_init', [ $suredonation_ability, 'register' ] ); | |
| 64 | + | |
| 65 | + // Register dedicated MCP server when enabled and MCP adapter is available. | |
| 66 | + if ( ! empty( $suredonation_ai_settings['mcp_server'] ) && class_exists( 'WP\MCP\Plugin' ) ) { | |
| 67 | + add_action( 'mcp_adapter_init', [ $suredonation_ability, 'register_mcp_server' ] ); | |
| 68 | + } | |
| 69 | + } | |
| 70 | +} | |