settings = new Clientsask_Settings(); $this->seo = new Clientsask_Seo( $seo_detector ); $this->client = new Clientsask_Client( $this->settings, $this->seo ); $this->log = new Clientsask_Log(); $this->actions = new Clientsask_Actions( $this->log, $this->seo, $this->client ); $this->sync = new Clientsask_Sync( $this->settings, $this->client, $this->seo, $this->log, $this->actions ); $this->admin = new Clientsask_Admin( $this->settings, $this->sync, $this->actions, $this->log, $this->seo ); } public static function boot( $seo_detector = null ) { $plugin = new self( $seo_detector ); $plugin->admin->register(); $jsonld = new Clientsask_Jsonld(); $jsonld->register(); $head = new Clientsask_Head( $plugin->seo ); $head->register(); add_action( self::CRON_HOOK, array( $plugin, 'run_cron' ) ); add_action( 'init', array( __CLASS__, 'schedule' ) ); return $plugin; } public function run_cron() { $this->sync->run( false ); } /** An approved change should not wait a day. A site updated from 0.1.5 still has the daily event, so it is moved to hourly here. */ public static function schedule() { if ( wp_get_schedule( self::CRON_HOOK ) !== self::SCHEDULE ) { wp_clear_scheduled_hook( self::CRON_HOOK ); wp_schedule_event( time() + 60, self::SCHEDULE, self::CRON_HOOK ); } } public static function activate() { self::schedule(); } public static function deactivate() { wp_clear_scheduled_hook( self::CRON_HOOK ); } }