99 lines
3.7 KiB
PHP
99 lines
3.7 KiB
PHP
<?php
|
|
/**
|
|
* ==========================
|
|
* 🔐 IGNY8 FILE RULE HEADER
|
|
* ==========================
|
|
* @file : sync-hooks.php
|
|
* @location : /flows/sync-hooks.php
|
|
* @type : Function Library
|
|
* @scope : Global
|
|
* @allowed : Hook definitions, workflow registration, automation triggers
|
|
* @reusability : Globally Reusable
|
|
* @notes : Central hook definitions for all automation workflows
|
|
*/
|
|
|
|
// Prevent direct access
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
// ===================================================================
|
|
// AUTOMATION WORKFLOW HOOKS
|
|
// ===================================================================
|
|
|
|
/**
|
|
* Keyword lifecycle hooks - trigger cluster updates
|
|
*/
|
|
add_action('igny8_keyword_added', 'igny8_handle_keyword_cluster_update', 10, 2);
|
|
add_action('igny8_keyword_updated', 'igny8_handle_keyword_cluster_update', 10, 2);
|
|
add_action('igny8_keyword_deleted', 'igny8_handle_keyword_cluster_update', 10, 2);
|
|
|
|
/**
|
|
* Cluster management hooks
|
|
*/
|
|
add_action('igny8_cluster_added', 'igny8_auto_create_cluster_term', 10, 1);
|
|
add_action('igny8_cluster_updated', 'igny8_auto_update_cluster_term', 10, 1);
|
|
add_action('set_object_terms', 'igny8_handle_content_cluster_association', 10, 4);
|
|
|
|
/**
|
|
* WordPress post publishing hooks - update keyword status when content is published
|
|
*/
|
|
add_action('publish_post', 'igny8_update_keywords_on_post_publish', 10, 1);
|
|
add_action('publish_page', 'igny8_update_keywords_on_post_publish', 10, 1);
|
|
add_action('draft_to_publish', 'igny8_update_keywords_on_post_publish', 10, 1);
|
|
add_action('future_to_publish', 'igny8_update_keywords_on_post_publish', 10, 1);
|
|
|
|
|
|
// ===================================================================
|
|
// AJAX WORKFLOW HOOKS
|
|
// ===================================================================
|
|
|
|
/**
|
|
* Import and bulk operations
|
|
*/
|
|
add_action('wp_ajax_igny8_import_keywords', 'igny8_ajax_import_keywords');
|
|
|
|
/**
|
|
* Planner → Writer bridge operations
|
|
*/
|
|
add_action('wp_ajax_igny8_create_task_from_idea', 'igny8_create_task_from_idea_ajax');
|
|
add_action('wp_ajax_igny8_bulk_create_tasks_from_ideas', 'igny8_bulk_create_tasks_from_ideas_ajax');
|
|
|
|
/**
|
|
* Bulk keyword operations
|
|
*/
|
|
add_action('wp_ajax_igny8_bulk_delete_keywords', 'igny8_ajax_bulk_delete_keywords');
|
|
add_action('wp_ajax_igny8_bulk_map_keywords', 'igny8_ajax_bulk_map_keywords');
|
|
add_action('wp_ajax_igny8_bulk_unmap_keywords', 'igny8_ajax_bulk_unmap_keywords');
|
|
|
|
/**
|
|
* Bulk record operations
|
|
*/
|
|
add_action('wp_ajax_igny8_delete_bulk_records', 'igny8_delete_bulk_records');
|
|
|
|
// ===================================================================
|
|
// AI QUEUE PROCESSING - DEPRECATED (MOVED TO CRON MANAGER)
|
|
// ===================================================================
|
|
|
|
// Note: AI queue processing is now handled by the smart automation system
|
|
// in core/cron/igny8-cron-master-dispatcher.php and core/cron/igny8-cron-handlers.php
|
|
|
|
// ===================================================================
|
|
// AI AUTOMATION CRON JOBS - DEPRECATED (MOVED TO CRON MANAGER)
|
|
// ===================================================================
|
|
|
|
// Note: All automation cron jobs are now handled by the smart automation system
|
|
// in core/cron/igny8-cron-master-dispatcher.php and core/cron/igny8-cron-handlers.php
|
|
|
|
// All cron handlers have been moved to core/cron/igny8-cron-handlers.php
|
|
|
|
// ===================================================================
|
|
// WRITER MODULE HOOKS
|
|
// ===================================================================
|
|
|
|
/**
|
|
* Hook into draft creation and recalculate metrics
|
|
*/
|
|
add_action('igny8_task_draft_created', function($task_id, $post_id) {
|
|
igny8_update_task_metrics($task_id);
|
|
}, 10, 2); |