feat: add Central API clients, bot rate limiting, and admin API UI
- Add ITK_HP_API and ITK_Bot_API static classes with queue/flush/cron - Add WP-Cron (5 min) + shutdown flush for both API queues - Bot Blocker and Honeypot now queue events to their respective APIs - Admin: Bot Blocker tab gains Central Bot API settings panel (enable, URL, token, test connection, flush queue, historical sync) - Admin: Honeypot tab gains Central Honeypot API settings panel - Admin JS: AJAX handlers for Test Connection and Flush Now buttons - Admin CSS: API card styles (status badge, notices, footer controls) - Add .gitignore (excludes bot-api/ which lives in CloudHost/bot-api) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,8 @@ define('ITK_URL', plugin_dir_url(__FILE__));
|
||||
define('ITK_BASENAME', plugin_basename(__FILE__));
|
||||
|
||||
require_once ITK_PATH . 'includes/class-itk-database.php';
|
||||
require_once ITK_PATH . 'includes/class-itk-hp-api.php';
|
||||
require_once ITK_PATH . 'includes/class-itk-bot-api.php';
|
||||
require_once ITK_PATH . 'includes/class-itk-bot-blocker.php';
|
||||
require_once ITK_PATH . 'includes/class-itk-protection.php';
|
||||
require_once ITK_PATH . 'includes/class-itk-optimization.php';
|
||||
@@ -39,6 +41,18 @@ class InformatiQ_Toolkit {
|
||||
}
|
||||
|
||||
private function __construct() {
|
||||
// Register custom cron interval (5 minutes)
|
||||
add_filter('cron_schedules', function ($schedules) {
|
||||
if (!isset($schedules['itk_5min'])) {
|
||||
$schedules['itk_5min'] = ['interval' => 300, 'display' => 'Every 5 Minutes'];
|
||||
}
|
||||
return $schedules;
|
||||
});
|
||||
|
||||
// Boot API cron flushers
|
||||
ITK_HP_API::register_cron();
|
||||
ITK_Bot_API::register_cron();
|
||||
|
||||
new ITK_Bot_Blocker();
|
||||
new ITK_Protection();
|
||||
new ITK_Optimization();
|
||||
@@ -137,6 +151,8 @@ class InformatiQ_Toolkit {
|
||||
}
|
||||
|
||||
public static function deactivate() {
|
||||
ITK_HP_API::clear_cron();
|
||||
ITK_Bot_API::clear_cron();
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user