cloudProvider = $cloudProvider; } public static function get_instance(S3_Provider $cloudProvider) { if (self::$instance === null) { self::$instance = new self($cloudProvider); } return self::$instance; } public function initializeHooks() { $this->attach(new AttachmentUploadObserver($this->cloudProvider)); $this->attach(new ImageSrcsetObserver($this->cloudProvider)); $this->attach(new ImageSrcsetMetaObserver($this->cloudProvider)); $this->attach(new AttachmentUrlObserver($this->cloudProvider)); $this->attach(new AttachmentUrlLookup($this->cloudProvider)); $this->attach(advmo()->app()->get(AttachedFileObserver::class)); $this->attach(new OffloadStatusObserver($this->cloudProvider)); $this->attach(new AttachmentOffloadButtonObserver($this->cloudProvider)); $this->attach(new AttachmentDeleteObserver($this->cloudProvider)); $this->attach(new AttachmentDeleteLoadingObserver()); $this->attach(new PostContentImageTagObserver($this->cloudProvider)); $this->attach(new ThumbnailRegenerationObserver($this->cloudProvider)); $this->attach(new AttachmentUpdateObserver($this->cloudProvider)); $this->attach(new UniqueFilenameObserver($this->cloudProvider)); $this->attach(new MediaLibraryFilterObserver()); $this->attach(new ImagifyCompatObserver($this->cloudProvider)); $this->attach(new EWWWCompatObserver($this->cloudProvider)); foreach ($this->observers as $observer) { $observer->register(); } } public function attach(ObserverInterface $observer) { $this->observers[] = $observer; } public function detach(ObserverInterface $observer) { foreach ($this->observers as $key => $obs) { if ($obs === $observer) { unset($this->observers[$key]); } } } }