true, 'strategy' => 'defer', ) ); } add_action( 'init', 'mulabase_register_assets', 5 ); /** * Twice-daily sync, only while the site owner has turned downloads on. */ function mulabase_cron_sync() { if ( mulabase_connected() ) { mulabase_sync(); } } add_action( 'mulabase_sync_event', 'mulabase_cron_sync' ); /** * On activation nothing is downloaded. The plugin contacts Mulabase only after * an administrator clicks "Download the data" on the Mulabase screen. * If downloads were turned on before (reactivation), the schedule comes back. */ function mulabase_activate() { if ( mulabase_connected() ) { mulabase_schedule(); } } register_activation_hook( __FILE__, 'mulabase_activate' ); /** * On deactivation: stop the sync. Settings and data stay until the plugin is deleted. */ function mulabase_deactivate() { wp_clear_scheduled_hook( 'mulabase_sync_event' ); } register_deactivation_hook( __FILE__, 'mulabase_deactivate' );