'object', 'properties' => ['post_id' => ['type' => 'integer', 'minimum' => 1]], 'required' => ['post_id'], 'additionalProperties' => false, ]; } public function outputSchema(): ?array { return [ 'type' => 'object', 'properties' => [ 'post_id' => ['type' => 'integer'], 'url' => ['type' => 'string'], 'headings' => ['type' => 'array', 'items' => ['type' => 'object']], 'texts' => ['type' => 'array', 'items' => ['type' => 'string']], 'links' => ['type' => 'array', 'items' => ['type' => 'object']], 'images' => ['type' => 'array', 'items' => ['type' => 'object']], 'warnings' => ['type' => 'array', 'items' => ['type' => 'string']], 'notes' => ['type' => 'array', 'items' => ['type' => 'string']], ], 'required' => ['post_id', 'headings', 'texts', 'links', 'images', 'warnings', 'notes'], ]; } public function annotations(): array { return Annotations::read(); } public function isDirect(): bool { return true; } public function permission(array $input): bool|WP_Error { $post = PostGuard::editable($input['post_id'] ?? null, $this->schema, 'post_id', true); return $post instanceof WP_Error ? $post : true; } public function execute(array $input): mixed { $post = PostGuard::editable($input['post_id'] ?? null, $this->schema, 'post_id', true); if ($post instanceof WP_Error) { return $post; } $notes = [ 'Nur der Inhaltsbereich; Header, Footer und Theme-Builder-Vorlagen fehlen.', 'Das Rendern führt Plugin-/Theme-Filter aus (Shortcodes, oEmbed u. Ä.) und kann dabei ' . 'Netzwerkanfragen auslösen, die von WordPress oder anderen Plugins zwischengespeichert werden.', ]; if ((string) $post->post_password !== '') { $notes[] = 'Der Eintrag ist passwortgeschützt; Besucher sehen zuerst das Passwortformular.'; } return array_merge( ['post_id' => (int) $post->ID, 'url' => (string) get_permalink($post)], RenderSummary::fromHtml($this->renderer->render($post)), ['notes' => $notes] ); } }