rep_install(); } public function on_uninstall() { $this->rep_clear(); } public function init_hooks() { /** @var Self_Execution_Job_It $job */ foreach ( $this->rep_generate_items() as $job ) { $job->init_hooks(); } add_action( 'action_scheduler_begin_execute', array( $this, 'set_action_id' ) ); } public function remove_hooks() { /** @var Self_Execution_Job_It $job */ foreach ( $this->rep_generate_items() as $job ) { $job->remove_hooks(); } remove_action( 'action_scheduler_begin_execute', array( $this, 'set_action_id' ) ); } public function rep_instances(): array { return array(); } public function unschedule_all() { if ( ! class_exists( '\ActionScheduler_DBStore' ) ) { return; } \ActionScheduler_DBStore::instance()->cancel_actions_by_group( Post_Type\Module::SLUG ); } public function set_action_id( $action_id ) { $this->action_id = absint( $action_id ); } /** * @return int */ public function get_action_id(): int { return $this->action_id; } public function install( Self_Execution_Job_It $job ) { $this->rep_install_item_soft( $job ); } public function uninstall( Self_Execution_Job_It $job ) { $this->rep_remove( $job ); } /** * @param string $job_hook * * @return Self_Execution_Job_It * @throws Repository_Exception */ public function get( string $job_hook ): Self_Execution_Job_It { return $this->rep_get_item( $job_hook ); } }