| 1 |
<?php |
| 2 |
/** |
| 3 |
* mosparo Integration |
| 4 |
* |
| 5 |
* @package MosparoIntegration |
| 6 |
* @author mosparo Core Developers and contributors |
| 7 |
* @copyright 2021-2026 mosparo Core Developers and contributors |
| 8 |
* @license MIT |
| 9 |
* |
| 10 |
* @wordpress-plugin |
| 11 |
* Plugin Name: mosparo Integration |
| 12 |
* Plugin URI: https://mosparo.io/integrations/wordpress/ |
| 13 |
* Description: Adds the ability to protect forms in WordPress with mosparo. |
| 14 |
* Author: mosparo |
| 15 |
* Author URI: https://mosparo.io/ |
| 16 |
* License: MIT |
| 17 |
* Version: 1.18.2 |
| 18 |
* Text Domain: mosparo-integration |
| 19 |
* Domain Path: /languages |
| 20 |
*/ |
| 21 |
|
| 22 |
use MosparoIntegration\Helper\AdminHelper; |
| 23 |
use MosparoIntegration\Helper\ConfigHelper; |
| 24 |
use MosparoIntegration\Helper\FrontendHelper; |
| 25 |
use MosparoIntegration\Helper\ModuleHelper; |
| 26 |
|
| 27 |
require_once(__DIR__ . '/src/autoload.php'); |
| 28 |
require_once(__DIR__ . '/vendor-prefixed/autoload.php'); |
| 29 |
|
| 30 |
function mosparoIntegrationInitialize() |
| 31 |
{ |
| 32 |
$configHelper = ConfigHelper::getInstance(); |
| 33 |
|
| 34 |
$moduleHelper = ModuleHelper::getInstance(); |
| 35 |
$moduleHelper->initializeActiveModules(plugin_dir_path(__FILE__), plugin_dir_url(__FILE__)); |
| 36 |
|
| 37 |
$frontendHelper = FrontendHelper::getInstance(); |
| 38 |
$frontendHelper->initializeScheduleEvents(); |
| 39 |
|
| 40 |
$adminHelper = AdminHelper::getInstance(); |
| 41 |
$adminHelper->initializeAdmin(__DIR__, plugin_dir_url(__FILE__), plugin_basename(__FILE__)); |
| 42 |
} |
| 43 |
add_action('after_setup_theme', 'mosparoIntegrationInitialize', -1000); |
| 44 |
|
| 45 |
function mosparoIntegrationInitializeLate() |
| 46 |
{ |
| 47 |
// This second round is to initialize the modules that depend on a Theme instead of a plugin. |
| 48 |
$moduleHelper = ModuleHelper::getInstance(); |
| 49 |
$moduleHelper->initializeActiveModules(plugin_dir_path(__FILE__), plugin_dir_url(__FILE__)); |
| 50 |
} |
| 51 |
add_action('after_setup_theme', 'mosparoIntegrationInitializeLate', 1000); |
| 52 |
|
| 53 |
function mosparoIntegrationInitializeVeryEarly() |
| 54 |
{ |
| 55 |
// This initialization round is mainly for Ninja Forms, which uses the action plugins_loaded to register the Ninja Forms actions |
| 56 |
$moduleHelper = ModuleHelper::getInstance(); |
| 57 |
$moduleHelper->initializeActiveModulesVeryEarly(); |
| 58 |
} |
| 59 |
add_action('plugins_loaded', 'mosparoIntegrationInitializeVeryEarly', -1000); |
| 60 |
|
| 61 |
function mosparoIntegrationInitializeTextDomain() |
| 62 |
{ |
| 63 |
load_plugin_textdomain('mosparo-integration', false, dirname(plugin_basename(__FILE__)) . '/languages'); |
| 64 |
} |
| 65 |
add_action('init', 'mosparoIntegrationInitializeTextDomain'); |
| 66 |
|
| 67 |
function mosparoIntegrationActivatePlugin() |
| 68 |
{ |
| 69 |
if (!wp_next_scheduled('mosparo_integration_refresh_css_url_cache')) { |
| 70 |
wp_schedule_event(time(), 'daily', 'mosparo_integration_refresh_css_url_cache'); |
| 71 |
} |
| 72 |
} |
| 73 |
register_activation_hook(__FILE__, 'mosparoIntegrationActivatePlugin'); |
| 74 |
|
| 75 |
function mosparoIntegrationDeactivatePlugin() |
| 76 |
{ |
| 77 |
wp_clear_scheduled_hook('mosparo_integration_refresh_css_url_cache'); |
| 78 |
} |
| 79 |
register_deactivation_hook(__FILE__, 'mosparoIntegrationDeactivatePlugin'); |
| 80 |
|