| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: SureDonation |
| 4 |
* Plugin URI: https://suredonation.com |
| 5 |
* Description: A powerful donation management plugin for WordPress with campaign tracking, payment processing, and donor management. |
| 6 |
* Version: 1.5.1 |
| 7 |
* Author: SureDonation |
| 8 |
* Text Domain: suredonation |
| 9 |
* Domain Path: /languages |
| 10 |
* Requires at least: 6.4 |
| 11 |
* Requires PHP: 8.0 |
| 12 |
* License: GPL v2 or later |
| 13 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 14 |
* |
| 15 |
* @package SureDonation |
| 16 |
*/ |
| 17 |
|
| 18 |
// Exit if accessed directly. |
| 19 |
if ( ! defined( 'ABSPATH' ) ) { |
| 20 |
exit; |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Define plugin constants. |
| 25 |
*/ |
| 26 |
define( 'SUREDONATION_VER', '1.5.1' ); |
| 27 |
define( 'SUREDONATION_FILE', __FILE__ ); |
| 28 |
define( 'SUREDONATION_DIR', plugin_dir_path( __FILE__ ) ); |
| 29 |
define( 'SUREDONATION_URL', plugin_dir_url( __FILE__ ) ); |
| 30 |
define( 'SUREDONATION_BASENAME', plugin_basename( __FILE__ ) ); |
| 31 |
define( 'SUREDONATION_POST_TYPE', 'suredonation_cmpgn' ); |
| 32 |
|
| 33 |
/** |
| 34 |
* Middleware base URL for payment processing. |
| 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. |
| 39 |
*/ |
| 40 |
if ( ! defined( 'SUREDONATION_MIDDLEWARE_BASE_URL' ) ) { |
| 41 |
define( 'SUREDONATION_MIDDLEWARE_BASE_URL', 'https://api.sureforms.com/' ); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Abilities API constants. |
| 46 |
*/ |
| 47 |
define( 'SUREDONATION_ABILITY_API_NAMESPACE', 'suredonation/' ); |
| 48 |
|
| 49 |
/** |
| 50 |
* OttoKit (formerly SureTriggers) integration base URL. |
| 51 |
*/ |
| 52 |
define( 'SUREDONATION_SURETRIGGERS_INTEGRATION_BASE_URL', 'https://app.ottokit.com/' ); |
| 53 |
|
| 54 |
/** |
| 55 |
* Load the plugin loader. |
| 56 |
*/ |
| 57 |
require_once SUREDONATION_DIR . 'plugin-loader.php'; |
| 58 |
|
| 59 |
/** |
| 60 |
* Register Abilities API integration (WordPress 6.9+). |
| 61 |
* Graceful degradation: if Abilities API is not available, the plugin functions normally. |
| 62 |
*/ |
| 63 |
if ( class_exists( 'WP_Ability' ) ) { |
| 64 |
$suredonation_ai_settings = SureDonation\Inc\Helper::get_suredonation_option( 'ai_settings', [] ); |
| 65 |
if ( is_array( $suredonation_ai_settings ) && ! empty( $suredonation_ai_settings['enable_abilities'] ) ) { |
| 66 |
$suredonation_ability = new SureDonation\Inc\Abilities\Runtime(); |
| 67 |
add_action( 'wp_abilities_api_categories_init', [ $suredonation_ability, 'register_categories' ] ); |
| 68 |
add_action( 'wp_abilities_api_init', [ $suredonation_ability, 'register' ] ); |
| 69 |
|
| 70 |
// Register dedicated MCP server when enabled and MCP adapter is available. |
| 71 |
if ( ! empty( $suredonation_ai_settings['mcp_server'] ) && class_exists( 'WP\MCP\Plugin' ) ) { |
| 72 |
add_action( 'mcp_adapter_init', [ $suredonation_ability, 'register_mcp_server' ] ); |
| 73 |
} |
| 74 |
} |
| 75 |
} |
| 76 |
|