init(); } /** * Initialize plugin */ private function init() { // Load text domain add_action( 'init', array( $this, 'load_textdomain' ) ); // Initialize plugin update checker $this->setup_updater(); // Initialize components $this->core = WP_Domain_Mapping_Core::get_instance(); $this->admin = WP_Domain_Mapping_Admin::get_instance(); $this->tools = WP_Domain_Mapping_Tools::get_instance(); // Check plugin requirements on activation register_activation_hook( __FILE__, array( $this, 'plugin_activation' ) ); register_deactivation_hook( __FILE__, array( $this, 'plugin_deactivation' ) ); } /** * Load plugin textdomain */ public function load_textdomain() { load_plugin_textdomain( 'wp-domain-mapping', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); } /** * Setup plugin updater */ private function setup_updater() { // Only include the updater if the PUC library exists if ( file_exists( plugin_dir_path( __FILE__ ) . 'lib/plugin-update-checker/plugin-update-checker.php' ) ) { require_once plugin_dir_path( __FILE__ ) . 'lib/plugin-update-checker/plugin-update-checker.php'; if ( class_exists( 'YahnisElsts\PluginUpdateChecker\v5p3\PucFactory' ) ) { \YahnisElsts\PluginUpdateChecker\v5p3\PucFactory::buildUpdateChecker( 'https://updates.weixiaoduo.com/wp-domain-mapping.json', __FILE__, 'wp-domain-mapping' ); } } } /** * Actions to perform on plugin activation */ public function plugin_activation() { // Create database tables $this->core->create_tables(); // Initialize remote login hash $this->core->get_hash(); // Schedule health check $this->tools->schedule_health_check(); } /** * Actions to perform on plugin deactivation */ public function plugin_deactivation() { // Unschedule health check $this->tools->unschedule_health_check(); } } // Initialize the plugin function wp_domain_mapping_init() { return WP_Domain_Mapping::get_instance(); } wp_domain_mapping_init();