Files
eveAI/integrations/Wordpress/eveai_sync/includes/class-eveai-sync.php
Josako 9e14824249 - Furter refinement of the API, adding functionality for refreshing documents and returning Token expiration time when retrieving token
- Implementation of a first version of a Wordpress plugin
- Adding api service to nginx.conf
2024-09-11 16:31:13 +02:00

34 lines
1.3 KiB
PHP

<?php
class EveAI_Sync {
private $api;
private $post_handler;
private $admin;
public function init() {
$this->load_dependencies();
$this->setup_actions();
}
private function load_dependencies() {
require_once EVEAI_SYNC_PLUGIN_DIR . 'includes/class-eveai-api.php';
require_once EVEAI_SYNC_PLUGIN_DIR . 'includes/class-eveai-post-handler.php';
require_once EVEAI_SYNC_PLUGIN_DIR . 'includes/class-eveai-admin.php';
require_once EVEAI_SYNC_PLUGIN_DIR . 'includes/class-eveai-bulk-sync.php';
$this->api = new EveAI_API();
$this->post_handler = new EveAI_Post_Handler($this->api);
$this->admin = new EveAI_Admin($this->api);
}
private function setup_actions() {
add_action('save_post', array($this->post_handler, 'handle_post_save'), 10, 3);
add_action('before_delete_post', array($this->post_handler, 'handle_post_delete'));
add_action('admin_init', array($this->admin, 'register_settings'));
add_action('admin_menu', array($this->admin, 'add_admin_menu'));
add_action('add_meta_boxes', array($this->admin, 'add_sync_meta_box'));
add_action('eveai_sync_post', array($this->post_handler, 'sync_post'), 10, 2);
add_action('wp_ajax_eveai_bulk_sync', array($this->admin, 'handle_bulk_sync_ajax'));
}
}