load_dependencies(); $this->setup_components(); $this->define_admin_hooks(); $this->define_public_hooks(); } /** * Load required dependencies */ private function load_dependencies(): void { // Integration components require_once AI_BOTKIT_INCLUDES_DIR . 'integration/class-rest-api.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'integration/class-api-handler.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'integration/class-pep-detector.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'integration/class-product-content-enricher.php'; // Placement: where each agent shows on this site require_once AI_BOTKIT_INCLUDES_DIR . 'placement/class-placement-store.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'placement/class-placement-evaluator.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'placement/class-request-context.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'placement/class-legacy-placement.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'placement/class-placement-migration.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'placement/class-placement-resolver.php'; // Admin and public require_once AI_BOTKIT_INCLUDES_DIR . 'admin/class-admin.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'admin/class-ajax-handler.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'public/class-shortcode-handler.php'; require_once AI_BOTKIT_INCLUDES_DIR . 'public/class-product-button.php'; } /** * Setup plugin components */ private function setup_components(): void { // Initialize integration components $this->rest_api = new REST_API(); $this->api_handler = new \AI_BotKit\Integration\API_Handler(); // Register content enrichment filter \AI_BotKit\Integration\Product_Content_Enricher::register(); // Initialize interface components $this->admin = new Admin($this->get_plugin_name(), $this->get_version()); $this->shortcode_handler = new Shortcode_Handler(); $this->product_button = new \AI_BotKit\Frontend\Product_Button(); } /** * Register admin hooks */ private function define_admin_hooks(): void { // Placement upgrade: converts the old placement options once per blog. // This class is built during plugins_loaded at priority 10, so 20 runs // later in the same action, on the first request of any kind. add_action('plugins_loaded', [Placement_Migration::class, 'maybe_run'], 20); add_action('admin_notices', [Placement_Migration::class, 'admin_notice']); // Admin menu and pages add_action('admin_menu', [$this->admin, 'add_plugin_admin_menu']); // Admin assets add_action('admin_enqueue_scripts', [$this->admin, 'enqueue_styles']); add_action('admin_enqueue_scripts', [$this->admin, 'enqueue_scripts']); // PEP detector admin notice (removed — feature now works without PEP) } /** * Register public hooks */ private function define_public_hooks(): void { add_action('wp_footer', [$this->shortcode_handler, 'render_sitewide_chatbot']); } /** * Run the plugin */ public function run(): void { do_action('ai_botkit_init', $this); } /** * The name of the plugin used to uniquely identify it within the context of * WordPress and to define internationalization functionality. * * @return string The name of the plugin. */ public function get_plugin_name(): string { return 'ai-botkit-for-lead-generation'; } /** * Retrieve the version number of the plugin. * * @return string The version number of the plugin. */ public function get_version(): string { return defined('AI_BOTKIT_VERSION') ? AI_BOTKIT_VERSION : '1.0.0'; } }