| 1 |
<?php |
| 2 |
/* |
| 3 |
* Plugin Name: IvyForms - The innovative Contact Form Builder |
| 4 |
* Plugin URI: https://ivyforms.com |
| 5 |
* Description: Transform your WordPress site with IvyForms: a powerful, user-friendly plugin for creating and managing customizable forms effortlessly. |
| 6 |
* Version: 1.4 |
| 7 |
* Requires PHP: 7.4 |
| 8 |
* Author: Melograno Ventures |
| 9 |
* Author URI: https://melograno.io/ |
| 10 |
* License: GPLv2 or later |
| 11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 12 |
* Text Domain: ivyforms |
| 13 |
* Domain Path: /languages |
| 14 |
* |
| 15 |
* IvyForms is free software: you can redistribute it and/or modify |
| 16 |
* it under the terms of the GNU General Public License as published by |
| 17 |
* the Free Software Foundation, either version 2 of the License, or |
| 18 |
* any later version. |
| 19 |
* |
| 20 |
* IvyForms is distributed in the hope that it will be useful, |
| 21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
* GNU General Public License for more details. |
| 24 |
* |
| 25 |
* You should have received a copy of the GNU General Public License |
| 26 |
* along with IvyForms. If not, see {URI to Plugin License}. |
| 27 |
*/ |
| 28 |
namespace IvyForms; |
| 29 |
|
| 30 |
use Exception; |
| 31 |
use IvyForms\Infrastructure\WP\MCP\McpFeatureGate; |
| 32 |
use IvyForms\Plugin\Plugin; |
| 33 |
use WP\MCP\Core\McpAdapter; |
| 34 |
|
| 35 |
if ( ! defined( 'ABSPATH' ) ) |
| 36 |
{ |
| 37 |
exit; // Exit if accessed directly. |
| 38 |
} |
| 39 |
|
| 40 |
if (!defined('IVYFORMS_PATH')) |
| 41 |
{ |
| 42 |
define('IVYFORMS_PATH', __DIR__); |
| 43 |
} |
| 44 |
|
| 45 |
if (!defined('IVYFORMS_URL')) |
| 46 |
{ |
| 47 |
define('IVYFORMS_URL', plugin_dir_url(__FILE__)); |
| 48 |
} |
| 49 |
|
| 50 |
if (!defined('IVYFORMS_TEMPLATES_IMAGES_URL')) |
| 51 |
{ |
| 52 |
define('IVYFORMS_TEMPLATES_IMAGES_URL', plugin_dir_url(__FILE__) . 'frontend/src/assets/images/templates/'); |
| 53 |
} |
| 54 |
|
| 55 |
if (!defined('IVYFORMS_DEV')) |
| 56 |
{ |
| 57 |
define('IVYFORMS_DEV', false); |
| 58 |
} |
| 59 |
|
| 60 |
// Google Sheets OAuth middleware (override in wp-config.php for hosted/staging). |
| 61 |
if (!defined('IVYFORMS_GOOGLE_SHEETS_MIDDLEWARE_URL')) { |
| 62 |
define( |
| 63 |
'IVYFORMS_GOOGLE_SHEETS_MIDDLEWARE_URL', |
| 64 |
IVYFORMS_DEV ? 'http://localhost:8080' : 'https://middleware.ivyforms.com' |
| 65 |
); |
| 66 |
} |
| 67 |
|
| 68 |
// Const for plugin slug |
| 69 |
if (!defined('IVYFORMS_PLUGIN_SLUG')) |
| 70 |
{ |
| 71 |
define('IVYFORMS_PLUGIN_SLUG', plugin_basename(__FILE__)); |
| 72 |
} |
| 73 |
|
| 74 |
if (!defined('IVYFORMS_FILE')) |
| 75 |
{ |
| 76 |
define('IVYFORMS_FILE', __FILE__); |
| 77 |
} |
| 78 |
// Const for site URL |
| 79 |
if (!defined('IVYFORMS_SITE_URL')) { |
| 80 |
define('IVYFORMS_SITE_URL', get_site_url()); |
| 81 |
} |
| 82 |
|
| 83 |
if (!defined('IVYFORMS_VERSION')) { |
| 84 |
define('IVYFORMS_VERSION', '1.4'); |
| 85 |
} |
| 86 |
|
| 87 |
if (!defined('IVYFORMS_MCP_MIN_WP_VERSION')) { |
| 88 |
define('IVYFORMS_MCP_MIN_WP_VERSION', '6.9'); |
| 89 |
} |
| 90 |
|
| 91 |
if (!defined('MELOGRANO_BI_GATE_URL')) { |
| 92 |
define('MELOGRANO_BI_GATE_URL', 'https://bi.melograno.io'); |
| 93 |
} |
| 94 |
|
| 95 |
require_once IVYFORMS_PATH . '/backend/scope-vendor/autoload.php'; |
| 96 |
require_once IVYFORMS_PATH . '/backend/vendor/autoload.php'; |
| 97 |
|
| 98 |
if (class_exists(McpAdapter::class) && McpFeatureGate::isEnabled()) { |
| 99 |
McpAdapter::instance(); |
| 100 |
add_action('mcp_adapter_init', array('\IvyForms\Infrastructure\WP\MCP\IvyFormsMcpServerRegistrar', 'init')); |
| 101 |
add_action('wp_abilities_api_categories_init', array('\IvyForms\Infrastructure\WP\MCP\IvyFormsAbilitiesRegistrar', 'registerCategories')); |
| 102 |
add_action('wp_abilities_api_init', array('\IvyForms\Infrastructure\WP\MCP\IvyFormsAbilitiesRegistrar', 'registerAbilities')); |
| 103 |
} |
| 104 |
|
| 105 |
try { |
| 106 |
Plugin::getInstance(); |
| 107 |
} catch (Exception $e) { |
| 108 |
echo 'ERROR: ' . esc_html($e->getMessage()); |
| 109 |
} |