feat: tools and limits settings tabs
Adds Einstellungen → LIT MCP → Tools (direct/indirect/disabled per ability, only ExposurePolicy-allowed modes offered) and → Limits (upload size, log retention, snapshot count), wired into Plugin.php. Ruling Q11b (carried from task 6): overview.md notes that direct visibility is configurable; hints in src/ that name a tool which is direct by default but can be switched to indirect (content-get, content-query, content-types, post-publish, media-search) now use the neutral "lit/<name> (direkt: lit-<name>)" form so they stay correct after an admin override. lit/guide (always direct) and the media-preview/-download DIRECT_ONLY tools are unaffected. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Admin;
|
||||
|
||||
use LIT\MCP\Limits;
|
||||
|
||||
/**
|
||||
* Tab "Limits": upload/download size, log retention, snapshot count (spec §8.4).
|
||||
* Changes apply immediately – Limits::all() always reads the current option.
|
||||
*/
|
||||
final class LimitsTab implements AdminTab
|
||||
{
|
||||
public const GROUP = 'lit_mcp_limits';
|
||||
|
||||
public function slug(): string
|
||||
{
|
||||
return 'limits';
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return __('Limits', 'wp-lit-mcp');
|
||||
}
|
||||
|
||||
public function registerSettings(): void
|
||||
{
|
||||
register_setting(self::GROUP, Limits::OPTION, [
|
||||
'type' => 'array',
|
||||
'sanitize_callback' => [Limits::class, 'sanitize'],
|
||||
'default' => Limits::DEFAULTS,
|
||||
]);
|
||||
}
|
||||
|
||||
public function registerActions(): void
|
||||
{
|
||||
}
|
||||
|
||||
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],
|
||||
];
|
||||
|
||||
echo '<form method="post" action="options.php">';
|
||||
settings_fields(self::GROUP);
|
||||
echo '<table class="form-table"><tbody>';
|
||||
foreach ($fields as $key => [$label, $min, $max]) {
|
||||
printf(
|
||||
'<tr><th scope="row"><label for="lit-mcp-%1$s">%2$s</label></th><td>'
|
||||
. '<input id="lit-mcp-%1$s" type="number" min="%3$d" max="%4$d" name="%5$s[%1$s]" value="%6$d">'
|
||||
. '</td></tr>',
|
||||
esc_attr($key),
|
||||
esc_html($label),
|
||||
esc_attr((string) $min),
|
||||
esc_attr((string) $max),
|
||||
esc_attr(Limits::OPTION),
|
||||
esc_attr((string) $values[$key])
|
||||
);
|
||||
}
|
||||
echo '</tbody></table>';
|
||||
submit_button();
|
||||
echo '</form>';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user