Loading modules/Plugins/Controllers/PluginController.php +11 −4 Original line number Diff line number Diff line Loading @@ -125,8 +125,15 @@ class PluginController extends BaseController $data['episode'] = $episode; } $fields = $plugin->getSettingsFields($type); if ($fields === []) { throw PageNotFoundException::forPageNotFound(); } $data['type'] = $type; $data['context'] = $context; $data['fields'] = $fields; helper('form'); replace_breadcrumb_params($breadcrumbReplacements); Loading Loading @@ -164,8 +171,8 @@ class PluginController extends BaseController $rules = []; foreach ($plugin->getSettingsFields($type) as $field) { $typeRules = $plugins::FIELDS_VALIDATIONS[$field->type]; if (! in_array('permit_empty', $typeRules, true) && ! $field->optional) { $typeRules[] = 'required'; if (! in_array('permit_empty', $typeRules, true)) { $typeRules[] = $field->optional ? 'permit_empty' : 'required'; } $rules[$field->key] = $typeRules; Loading @@ -182,7 +189,7 @@ class PluginController extends BaseController foreach ($plugin->getSettingsFields('general') as $field) { $value = $validatedData[$field->key] ?? null; $fieldValue = match ($plugins::FIELDS_CASTS[$field->type] ?? 'text') { $fieldValue = $value === '' ? null : match ($plugins::FIELDS_CASTS[$field->type] ?? 'text') { 'bool' => $value === 'yes', 'int' => (int) $value, 'uri' => new URI($value), Loading @@ -192,7 +199,7 @@ class PluginController extends BaseController $this->request->getPost('client_timezone') )->setTimezone(app_timezone()), 'markdown' => new Markdown($value), default => $value === '' ? null : $value, default => $value, }; $plugins->setOption($plugin, $field->key, $fieldValue, $context); } Loading modules/Plugins/Core/BasePlugin.php +9 −6 Original line number Diff line number Diff line Loading @@ -108,11 +108,6 @@ abstract class BasePlugin implements PluginInterface return in_array($name, $this->manifest->hooks, true); } final public function getSettings(): ?Settings { return $this->manifest->settings; } final public function getVersion(): string { return $this->manifest->version; Loading Loading @@ -167,7 +162,7 @@ abstract class BasePlugin implements PluginInterface */ final public function getSettingsFields(string $type): array { $settings = $this->getSettings(); $settings = $this->manifest->settings; if (! $settings instanceof Settings) { return []; } Loading @@ -175,6 +170,14 @@ abstract class BasePlugin implements PluginInterface return $settings->{$type}; } /** * @return list<string> */ final public function getHooks(): array { return $this->manifest->hooks; } final public function getKey(): string { return $this->key; Loading modules/Plugins/Language/en/Plugins.php +8 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,13 @@ return [ 'authors' => 'Authors', 'author_email' => 'Email {authorName}', 'author_homepage' => '{authorName} homepage', 'declaredHooks' => 'Declared hooks', 'settings' => 'Settings', 'settingsTitle' => '{type, select, podcast {{pluginName} podcast settings} episode {{pluginName} episode settings} other {{pluginName} general settings} }', 'view' => 'View', 'activate' => 'Activate', 'deactivate' => 'Deactivate', Loading @@ -29,6 +35,8 @@ return [ 'analytics' => 'Analytics', 'accessibility' => 'Accessibility', ], 'noDescription' => 'No description', 'noReadme' => 'No README file found.', 'messages' => [ 'saveSettingsSuccess' => '{pluginName} settings were successfully saved!', ], Loading modules/Plugins/Manifest/Person.php +2 −2 Original line number Diff line number Diff line Loading @@ -46,8 +46,8 @@ class Person extends ManifestObject $data = [ 'name' => $matches['name'], 'email' => $matches['email'], 'url' => $matches['url'], 'email' => $matches['email'] ?? null, 'url' => $matches['url'] ?? null, ]; } Loading themes/cp_admin/_layout.php +2 −2 Original line number Diff line number Diff line Loading @@ -41,10 +41,10 @@ $isEpisodeArea = isset($podcast) && isset($episode); <div class="inline-flex items-center"> <?php // @icon('exchange-dollar-fill')?> <x-IconButton uri="<?= route_to('subscription-list', $podcast->id) ?>" glyph="exchange-dollar-fill" variant="secondary" size="large" class="p-0 mr-2 border-0"><?= ($isEpisodeArea && $episode->is_premium) ? lang('PremiumPodcasts.episode_is_premium') : lang('PremiumPodcasts.podcast_is_premium') ?></x-IconButton> <x-Heading tagName="h1" size="large" class="truncate"><?= $this->renderSection('pageTitle') ?></x-Heading> <x-Heading tagName="h1" size="large" class="max-w-sm truncate"><?= $this->renderSection('pageTitle') ?></x-Heading> </div> <?php else: ?> <x-Heading tagName="h1" size="large" class="truncate"><?= $this->renderSection('pageTitle') ?></x-Heading> <x-Heading tagName="h1" size="large" class="max-w-lg truncate"><?= $this->renderSection('pageTitle') ?></x-Heading> <?php endif; ?> <?= $this->renderSection('headerLeft') ?> </div> Loading Loading
modules/Plugins/Controllers/PluginController.php +11 −4 Original line number Diff line number Diff line Loading @@ -125,8 +125,15 @@ class PluginController extends BaseController $data['episode'] = $episode; } $fields = $plugin->getSettingsFields($type); if ($fields === []) { throw PageNotFoundException::forPageNotFound(); } $data['type'] = $type; $data['context'] = $context; $data['fields'] = $fields; helper('form'); replace_breadcrumb_params($breadcrumbReplacements); Loading Loading @@ -164,8 +171,8 @@ class PluginController extends BaseController $rules = []; foreach ($plugin->getSettingsFields($type) as $field) { $typeRules = $plugins::FIELDS_VALIDATIONS[$field->type]; if (! in_array('permit_empty', $typeRules, true) && ! $field->optional) { $typeRules[] = 'required'; if (! in_array('permit_empty', $typeRules, true)) { $typeRules[] = $field->optional ? 'permit_empty' : 'required'; } $rules[$field->key] = $typeRules; Loading @@ -182,7 +189,7 @@ class PluginController extends BaseController foreach ($plugin->getSettingsFields('general') as $field) { $value = $validatedData[$field->key] ?? null; $fieldValue = match ($plugins::FIELDS_CASTS[$field->type] ?? 'text') { $fieldValue = $value === '' ? null : match ($plugins::FIELDS_CASTS[$field->type] ?? 'text') { 'bool' => $value === 'yes', 'int' => (int) $value, 'uri' => new URI($value), Loading @@ -192,7 +199,7 @@ class PluginController extends BaseController $this->request->getPost('client_timezone') )->setTimezone(app_timezone()), 'markdown' => new Markdown($value), default => $value === '' ? null : $value, default => $value, }; $plugins->setOption($plugin, $field->key, $fieldValue, $context); } Loading
modules/Plugins/Core/BasePlugin.php +9 −6 Original line number Diff line number Diff line Loading @@ -108,11 +108,6 @@ abstract class BasePlugin implements PluginInterface return in_array($name, $this->manifest->hooks, true); } final public function getSettings(): ?Settings { return $this->manifest->settings; } final public function getVersion(): string { return $this->manifest->version; Loading Loading @@ -167,7 +162,7 @@ abstract class BasePlugin implements PluginInterface */ final public function getSettingsFields(string $type): array { $settings = $this->getSettings(); $settings = $this->manifest->settings; if (! $settings instanceof Settings) { return []; } Loading @@ -175,6 +170,14 @@ abstract class BasePlugin implements PluginInterface return $settings->{$type}; } /** * @return list<string> */ final public function getHooks(): array { return $this->manifest->hooks; } final public function getKey(): string { return $this->key; Loading
modules/Plugins/Language/en/Plugins.php +8 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,13 @@ return [ 'authors' => 'Authors', 'author_email' => 'Email {authorName}', 'author_homepage' => '{authorName} homepage', 'declaredHooks' => 'Declared hooks', 'settings' => 'Settings', 'settingsTitle' => '{type, select, podcast {{pluginName} podcast settings} episode {{pluginName} episode settings} other {{pluginName} general settings} }', 'view' => 'View', 'activate' => 'Activate', 'deactivate' => 'Deactivate', Loading @@ -29,6 +35,8 @@ return [ 'analytics' => 'Analytics', 'accessibility' => 'Accessibility', ], 'noDescription' => 'No description', 'noReadme' => 'No README file found.', 'messages' => [ 'saveSettingsSuccess' => '{pluginName} settings were successfully saved!', ], Loading
modules/Plugins/Manifest/Person.php +2 −2 Original line number Diff line number Diff line Loading @@ -46,8 +46,8 @@ class Person extends ManifestObject $data = [ 'name' => $matches['name'], 'email' => $matches['email'], 'url' => $matches['url'], 'email' => $matches['email'] ?? null, 'url' => $matches['url'] ?? null, ]; } Loading
themes/cp_admin/_layout.php +2 −2 Original line number Diff line number Diff line Loading @@ -41,10 +41,10 @@ $isEpisodeArea = isset($podcast) && isset($episode); <div class="inline-flex items-center"> <?php // @icon('exchange-dollar-fill')?> <x-IconButton uri="<?= route_to('subscription-list', $podcast->id) ?>" glyph="exchange-dollar-fill" variant="secondary" size="large" class="p-0 mr-2 border-0"><?= ($isEpisodeArea && $episode->is_premium) ? lang('PremiumPodcasts.episode_is_premium') : lang('PremiumPodcasts.podcast_is_premium') ?></x-IconButton> <x-Heading tagName="h1" size="large" class="truncate"><?= $this->renderSection('pageTitle') ?></x-Heading> <x-Heading tagName="h1" size="large" class="max-w-sm truncate"><?= $this->renderSection('pageTitle') ?></x-Heading> </div> <?php else: ?> <x-Heading tagName="h1" size="large" class="truncate"><?= $this->renderSection('pageTitle') ?></x-Heading> <x-Heading tagName="h1" size="large" class="max-w-lg truncate"><?= $this->renderSection('pageTitle') ?></x-Heading> <?php endif; ?> <?= $this->renderSection('headerLeft') ?> </div> Loading