diff --git a/src/Admin/LimitsTab.php b/src/Admin/LimitsTab.php index cdb029f..36a6e1b 100644 --- a/src/Admin/LimitsTab.php +++ b/src/Admin/LimitsTab.php @@ -40,16 +40,18 @@ final class LimitsTab implements AdminTab public function render(): void { $values = (new Limits())->all(); - $fields = [ - 'upload_mb' => [__('Maximale Upload-/Download-Größe (MB)', 'wp-lit-mcp'), 1, 100], - 'log_retention_days' => [__('Protokoll aufbewahren (Tage)', 'wp-lit-mcp'), 1, 3650], - 'snapshot_count' => [__('Anzahl Designsystem-Snapshots (ab Etappe 4)', 'wp-lit-mcp'), 1, 100], + $bounds = Limits::bounds(); + $labels = [ + 'upload_mb' => __('Maximale Upload-/Download-Größe (MB)', 'wp-lit-mcp'), + 'log_retention_days' => __('Protokoll aufbewahren (Tage)', 'wp-lit-mcp'), + 'snapshot_count' => __('Anzahl Designsystem-Snapshots (ab Etappe 4)', 'wp-lit-mcp'), ]; echo '
'; } + + /** + * PHP's own upload_max_filesize/post_max_size (via wp_max_upload_size()) can be lower than + * what is configured here – WordPress itself would then refuse a large upload/download before + * this limit ever applies. A warning only, since the two are independent knobs. + */ + private function maybeRenderUploadSizeNotice(int $uploadMb): void + { + $serverMaxMb = (int) floor(wp_max_upload_size() / (1024 * 1024)); + if ($serverMaxMb <= 0 || $uploadMb <= $serverMaxMb) { + return; + } + + $message = sprintf( + /* translators: 1: configured limit in MB, 2: server limit in MB */ + __('%1$d MB übersteigt das Server-Limit von %2$d MB (upload_max_filesize/post_max_size).', 'wp-lit-mcp'), + $uploadMb, + $serverMaxMb + ); + printf('%s
', esc_html($message)); + } } diff --git a/src/Integrations/WordPress/Content/PostPresenter.php b/src/Integrations/WordPress/Content/PostPresenter.php index df50177..f9a3cf5 100644 --- a/src/Integrations/WordPress/Content/PostPresenter.php +++ b/src/Integrations/WordPress/Content/PostPresenter.php @@ -19,7 +19,7 @@ class PostPresenter public const DIVI_HINT = 'Dieser Inhalt ist mit Divi gebaut. Die Divi-Struktur wird über lit-divi-outline ' . 'gelesen und mit den lit-divi-*-Tools bearbeitet; fehlen diese Tools, kann der Divi-Inhalt hier nicht ' . 'bearbeitet werden. content wird deshalb nicht ausgegeben; Titel, Auszug, Felder und Begriffe sind ' - . 'über lit-content-update änderbar.'; + . 'über lit/content-update (direkt: lit-content-update) änderbar.'; public function __construct(private ContentSchema $schema) { diff --git a/src/Integrations/WordPress/Schema/FieldValidator.php b/src/Integrations/WordPress/Schema/FieldValidator.php index 8bcbbcb..7bf3926 100644 --- a/src/Integrations/WordPress/Schema/FieldValidator.php +++ b/src/Integrations/WordPress/Schema/FieldValidator.php @@ -28,7 +28,8 @@ final class FieldValidator $key = (string) $key; $field = $definitions[$key] ?? null; if ($field === null) { - $errors[$key] = 'Unbekanntes Feld; verfügbare Felder über lit-content-types abrufen.'; + $errors[$key] = 'Unbekanntes Feld; verfügbare Felder über lit/content-types (direkt: ' + . 'lit-content-types) abrufen.'; continue; } diff --git a/src/Limits.php b/src/Limits.php index f16b81f..aaedb71 100644 --- a/src/Limits.php +++ b/src/Limits.php @@ -39,6 +39,17 @@ final class Limits return self::sanitize(get_option(self::OPTION, [])); } + /** + * The [min, max] each field is clamped to by sanitize() – for admin UI form attributes, + * so they can't drift from the actual bounds. + * + * @return array