settings = new Settings(); $this->debug_history = new Debug_History(); $this->api_client = new API_Client( $this->settings ); $this->sync_service = new Sync_Service( $this->settings, $this->api_client, $this->debug_history ); $this->scheduler = new Scheduler( $this->settings, $this->sync_service ); $this->admin = null; // Admin UI is only needed in the WordPress back-end. if ( is_admin() ) { $this->admin = new Admin( $this->settings, $this->sync_service, $this->scheduler, $this->debug_history ); } } /** * Runs on plugin activation. Called statically from the main plugin file. * * @return void */ public static function activate() { $settings = new Settings(); $settings->set_defaults(); $debug_history = new Debug_History(); $api_client = new API_Client( $settings ); $sync_service = new Sync_Service( $settings, $api_client, $debug_history ); $scheduler = new Scheduler( $settings, $sync_service ); $scheduler->register_schedule(); } /** * Runs on plugin deactivation. Called statically from the main plugin file. * * @return void */ public static function deactivate() { $settings = new Settings(); $debug_history = new Debug_History(); $api_client = new API_Client( $settings ); $sync_service = new Sync_Service( $settings, $api_client, $debug_history ); $scheduler = new Scheduler( $settings, $sync_service ); $scheduler->clear_schedule(); } }