modules = new DiviModules(); $this->design = new DesignSystemReader(); $roles = new DiviRoles(); $this->access = new LibraryAccess(new DiviLibraryStore(), $roles, $libraryWritable, $libraryVisible); $this->themeBuilderAccess = new ThemeBuilderAccess( new DiviThemeBuilder(), $roles, $themeBuilderWritable, $themeBuilderVisible ); } public function id(): string { return 'divi'; } /** Ruling P13: whether this connection may see library IDs (library group visible, library right). */ public function libraryIdsVisible(): bool { return $this->access->revealsIds(); } public function label(): string { return __('Divi', 'wp-lit-mcp'); } public function isAvailable(): bool { return DiviModules::isAvailable(); } /** * Divi short form for lit/content-create; available() reports whether Divi 5 is loaded, * writable() asks $writable (the Tools-tab gate, security M2). * * @param (Closure(): bool)|null $writable */ public function contentComposer(?Closure $writable = null): ContentComposer { return new DiviContentComposer( $this->schema, new DiviComposition($this->modules, $this->design), new DiviSaver(), $this->design, $writable ); } public function abilities(): array { $loader = $this->loader(); $writer = $this->writer($loader); return [ new DiviOutlineAbility($loader, $this->design), new DiviNodeGetAbility($loader, $this->design), new DiviCatalogAbility($this->modules), new DiviDesignSystemAbility($this->design), new DiviInsertAbility($writer), new DiviUpdateAbility($writer), new DiviMoveAbility($writer), new DiviDeleteAbility($writer), new DiviDuplicateNodeAbility($writer), new DiviReplaceTextAbility($this->schema, $loader, $writer), new DiviNodeCopyAbility($writer, $loader, $this->diviWritable, $this->libraryInsertable), new DiviDynamicSourcesAbility($this->schema, new DynamicContentMap(), $this->access->roles()), ]; } /** * The group "Divi-Bibliothek" (lit/library-*), sharing this integration's library access and its * $diviWritable gate (lit-library-insert follows lit/divi-insert, audit M2). */ public function library(): LibraryIntegration { $loader = $this->loader(); return new LibraryIntegration( $this->access, $loader, $this->design, $this->writer($loader), new DiviSaver(), $this->log, $this->modules, $this->diviWritable ); } /** The group "Divi Theme Builder" (lit/tb-*), sharing this integration's Theme Builder access (Etappe 3b). */ public function themeBuilder(): ThemeBuilderIntegration { return new ThemeBuilderIntegration( $this->themeBuilderAccess, new DiviComposition($this->modules, $this->design), new DiviSaver(), $this->log ); } private function writer(DiviPageLoader $loader): DiviWriter { return new DiviWriter( $loader, new DiviSaver(), $this->log, $this->design, new DiviComposition($this->modules, $this->design), new GlobalEdits($this->access, new GlobalUsages(null, $this->access->roles())), new ThemeBuilderEdits($this->themeBuilderAccess) ); } private function loader(): DiviPageLoader { return new DiviPageLoader($this->schema, new Parser(), $this->access, $this->themeBuilderAccess); } }