load_textdomain(); $this->load_dependencies(); $this->init_hooks(); $this->init_components(); } /** * Load required files */ private function load_dependencies() { require_once FIVECHAT_PLUGIN_PATH . 'includes/class-fivechat-token-validator.php'; require_once FIVECHAT_PLUGIN_PATH . 'includes/class-fivechat-settings.php'; require_once FIVECHAT_PLUGIN_PATH . 'includes/class-fivechat-admin.php'; require_once FIVECHAT_PLUGIN_PATH . 'includes/class-fivechat-frontend.php'; } /** * Load plugin text domain for translations */ private function load_textdomain() { add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) ); } /** * Load plugin text domain */ public function load_plugin_textdomain() { load_plugin_textdomain( '5chat-blazing-fast-live-chat', false, dirname( plugin_basename( FIVECHAT_PLUGIN_FILE ) ) . '/languages/' ); } /** * Initialize WordPress hooks */ private function init_hooks() { register_activation_hook( FIVECHAT_PLUGIN_FILE, array( $this, 'activate' ) ); register_deactivation_hook( FIVECHAT_PLUGIN_FILE, array( $this, 'deactivate' ) ); } /** * Initialize plugin components */ private function init_components() { $this->components['token_validator'] = new FIVECHAT_Token_Validator(); $this->components['settings'] = new FIVECHAT_Settings( $this->components['token_validator'] ); $this->components['admin'] = new FIVECHAT_Admin( $this->components['token_validator'] ); $this->components['frontend'] = new FIVECHAT_Frontend(); } /** * Plugin activation hook */ public function activate() { // Add default options if they don't exist add_option( 'fivechat_website_token', '' ); } /** * Plugin deactivation hook */ public function deactivate() { // Clean up any temporary data if needed // Note: We don't delete the settings here as user might reactivate } /** * Get a component instance * * @param string $component Component name. * @return object|null Component instance or null if not found. */ public function get_component( $component ) { return isset( $this->components[ $component ] ) ? $this->components[ $component ] : null; } } /** * Initialize the plugin */ function fivechat_init() { return FIVECHAT_Plugin::get_instance(); } // Start the plugin fivechat_init();