diff --git a/app/Helpers/rss_helper.php b/app/Helpers/rss_helper.php
index 2abafbe4..580752ab 100644
--- a/app/Helpers/rss_helper.php
+++ b/app/Helpers/rss_helper.php
@@ -47,6 +47,8 @@ if (! function_exists('get_rss_feed')) {
""
);
+ $plugins->rssBeforeChannel($podcast);
+
$channel = $rss->addChild('channel');
$atomLink = $channel->addChild('link', null, $atomNamespace);
@@ -298,13 +300,15 @@ if (! function_exists('get_rss_feed')) {
}
// run plugins hook at the end
- $plugins->channelTag($podcast, $channel);
+ $plugins->rssAfterChannel($podcast, $channel);
foreach ($episodes as $episode) {
if ($episode->is_premium && ! $subscription instanceof Subscription) {
continue;
}
+ $plugins->rssBeforeItem($episode);
+
$item = $channel->addChild('item');
$item->addChild('title', $episode->title, null, false);
$enclosure = $item->addChild('enclosure');
@@ -460,7 +464,7 @@ if (! function_exists('get_rss_feed')) {
], $item);
}
- $plugins->itemTag($episode, $item);
+ $plugins->rssAfterItem($episode, $item);
}
return $rss->asXML();
diff --git a/modules/Plugins/Controllers/PluginController.php b/modules/Plugins/Controllers/PluginController.php
index 788e5a78..25c3d009 100644
--- a/modules/Plugins/Controllers/PluginController.php
+++ b/modules/Plugins/Controllers/PluginController.php
@@ -187,7 +187,7 @@ class PluginController extends BaseController
$validatedData = $this->validator->getValidated();
- foreach ($plugin->getSettingsFields('general') as $field) {
+ foreach ($plugin->getSettingsFields($type) as $field) {
$value = $validatedData[$field->key] ?? null;
$fieldValue = $value === '' ? null : match ($plugins::FIELDS_CASTS[$field->type] ?? 'text') {
'bool' => $value === 'yes',
diff --git a/modules/Plugins/Core/BasePlugin.php b/modules/Plugins/Core/BasePlugin.php
index 70877548..09911a8c 100644
--- a/modules/Plugins/Core/BasePlugin.php
+++ b/modules/Plugins/Core/BasePlugin.php
@@ -52,7 +52,7 @@ abstract class BasePlugin implements PluginInterface
// TODO: cache manifest data
$manifestPath = $directory . '/manifest.json';
- $manifestContents = file_get_contents($manifestPath);
+ $manifestContents = @file_get_contents($manifestPath);
if (! $manifestContents) {
$manifestContents = '{}';
@@ -93,18 +93,19 @@ abstract class BasePlugin implements PluginInterface
$this->{$name} = $value;
}
- public function init(): void
- {
- // add to admin navigation
-
- // TODO: setup navigation and views?
- }
-
- public function channelTag(Podcast $podcast, SimpleRSSElement $channel): void
+ public function rssBeforeChannel(Podcast $podcast): void
{
}
- public function itemTag(Episode $episode, SimpleRSSElement $item): void
+ public function rssAfterChannel(Podcast $podcast, SimpleRSSElement $channel): void
+ {
+ }
+
+ public function rssBeforeItem(Episode $episode): void
+ {
+ }
+
+ public function rssAfterItem(Episode $episode, SimpleRSSElement $item): void
{
}
diff --git a/modules/Plugins/Core/PluginInterface.php b/modules/Plugins/Core/PluginInterface.php
index 9f9595ff..586f6d42 100644
--- a/modules/Plugins/Core/PluginInterface.php
+++ b/modules/Plugins/Core/PluginInterface.php
@@ -10,9 +10,13 @@ use App\Libraries\SimpleRSSElement;
interface PluginInterface
{
- public function channelTag(Podcast $podcast, SimpleRSSElement $channel): void;
+ public function rssBeforeChannel(Podcast $podcast): void;
- public function itemTag(Episode $episode, SimpleRSSElement $item): void;
+ public function rssAfterChannel(Podcast $podcast, SimpleRSSElement $channel): void;
+
+ public function rssBeforeItem(Episode $episode): void;
+
+ public function rssAfterItem(Episode $episode, SimpleRSSElement $item): void;
public function siteHead(): void;
}
diff --git a/modules/Plugins/Core/Plugins.php b/modules/Plugins/Core/Plugins.php
index 321e904f..90dd6295 100644
--- a/modules/Plugins/Core/Plugins.php
+++ b/modules/Plugins/Core/Plugins.php
@@ -10,9 +10,11 @@ use App\Libraries\SimpleRSSElement;
use Config\Database;
/**
- * @method void channelTag(Podcast $podcast, SimpleRSSElement $channel)
- * @method void itemTag(Episode $episode, SimpleRSSElement $item)
- * @method string siteHead()
+ * @method void rssBeforeChannel(Podcast $podcast)
+ * @method void rssAfterChannel(Podcast $podcast, SimpleRSSElement $channel)
+ * @method void rssBeforeItem(Episode $episode)
+ * @method void rssAfterItem(Episode $episode, SimpleRSSElement $item)
+ * @method void siteHead()
*/
class Plugins
{
@@ -21,7 +23,7 @@ class Plugins
/**
* @var list
*/
- public const HOOKS = ['channelTag', 'itemTag', 'siteHead'];
+ public const HOOKS = ['rssBeforeChannel', 'rssAfterChannel', 'rssBeforeItem', 'rssAfterItem', 'siteHead'];
public const FIELDS_VALIDATIONS = [
'checkbox' => ['permit_empty'],
diff --git a/modules/Plugins/Manifest/Manifest.php b/modules/Plugins/Manifest/Manifest.php
index 1d83ba0f..09dcbf98 100644
--- a/modules/Plugins/Manifest/Manifest.php
+++ b/modules/Plugins/Manifest/Manifest.php
@@ -34,7 +34,7 @@ class Manifest extends ManifestObject
'license' => 'permit_empty|string',
'private' => 'permit_empty|is_boolean',
'keywords.*' => 'permit_empty',
- 'hooks.*' => 'permit_empty|in_list[channelTag,itemTag,siteHead]',
+ 'hooks.*' => 'permit_empty|in_list[rssBeforeChannel,rssAfterChannel,rssBeforeItem,rssAfterItem,siteHead]',
'settings' => 'permit_empty|is_list',
'repository' => 'permit_empty|is_list',
];
diff --git a/modules/Plugins/Manifest/schema.json b/modules/Plugins/Manifest/schema.json
index 5d2b33e7..9d1629f0 100644
--- a/modules/Plugins/Manifest/schema.json
+++ b/modules/Plugins/Manifest/schema.json
@@ -87,7 +87,13 @@
"description": "The hooks used by the plugin.",
"type": "array",
"items": {
- "enum": ["channelTag", "itemTag", "siteHead"]
+ "enum": [
+ "rssBeforeChannel",
+ "rssAfterChannel",
+ "rssBeforeItem",
+ "rssAfterItem",
+ "siteHead"
+ ]
},
"uniqueItems": true
},
diff --git a/themes/cp_admin/contributor/create.php b/themes/cp_admin/contributor/create.php
index 42963de1..60e5805d 100644
--- a/themes/cp_admin/contributor/create.php
+++ b/themes/cp_admin/contributor/create.php
@@ -28,7 +28,7 @@
label="= esc(lang('Contributor.form.role')) ?>"
options="= esc(json_encode($roleOptions)) ?>"
placeholder="= lang('Contributor.form.role_placeholder') ?>"
- selected="= setting('AuthGroups.defaultPodcastGroup') ?>"
+ defaultValue="= setting('AuthGroups.defaultPodcastGroup') ?>"
isRequired="true" />
= lang('Contributor.form.submit_add') ?>
diff --git a/themes/cp_admin/contributor/edit.php b/themes/cp_admin/contributor/edit.php
index 9338d5bc..c6a490a0 100644
--- a/themes/cp_admin/contributor/edit.php
+++ b/themes/cp_admin/contributor/edit.php
@@ -19,7 +19,7 @@
name="role"
label="= esc(lang('Contributor.form.role')) ?>"
options="= esc(json_encode($roleOptions)) ?>"
- selected="= $contributorGroup ?>"
+ defaultValue="= $contributorGroup ?>"
placeholder="= lang('Contributor.form.role_placeholder') ?>"
isRequired="true" />
diff --git a/themes/cp_admin/episode/persons.php b/themes/cp_admin/episode/persons.php
index 814f3754..4dae9ca1 100644
--- a/themes/cp_admin/episode/persons.php
+++ b/themes/cp_admin/episode/persons.php
@@ -30,7 +30,7 @@
label="= esc(lang('Person.episode_form.persons')) ?>"
hint="= esc(lang('Person.episode_form.persons_hint')) ?>"
options="= esc(json_encode($personOptions)) ?>"
- selected="= esc(json_encode(old('persons', []))) ?>"
+ defaultValue="= esc(json_encode(old('persons', []))) ?>"
isRequired="true"
/>
@@ -41,7 +41,7 @@
label="= esc(lang('Person.episode_form.roles')) ?>"
hint="= esc(lang('Person.episode_form.roles_hint')) ?>"
options="= esc(json_encode($taxonomyOptions)) ?>"
- selected="= esc(json_encode(old('roles', []))) ?>"
+ defaultValue="= esc(json_encode(old('roles', []))) ?>"
/>
= lang('Person.episode_form.submit_add') ?>
diff --git a/themes/cp_admin/import/add_to_queue.php b/themes/cp_admin/import/add_to_queue.php
index 931ed1cb..8dab08fd 100644
--- a/themes/cp_admin/import/add_to_queue.php
+++ b/themes/cp_admin/import/add_to_queue.php
@@ -44,7 +44,7 @@
as="Select"
name="language"
label="= esc(lang('Podcast.form.language')) ?>"
- selected="= $browserLang ?>"
+ defaultValue="= $browserLang ?>"
isRequired="true"
options="= esc(json_encode($languageOptions)) ?>" />
diff --git a/themes/cp_admin/podcast/persons.php b/themes/cp_admin/podcast/persons.php
index a4c8924a..37ef3ad7 100644
--- a/themes/cp_admin/podcast/persons.php
+++ b/themes/cp_admin/podcast/persons.php
@@ -30,7 +30,7 @@
label="= esc(lang('Person.podcast_form.persons')) ?>"
hint="= esc(lang('Person.podcast_form.persons_hint')) ?>"
options="= esc(json_encode($personOptions)) ?>"
- selected="= esc(json_encode(old('persons', []))) ?>"
+ defaultValue="= esc(json_encode(old('persons', []))) ?>"
isRequired="true" />
= lang('Person.podcast_form.submit_add') ?>
diff --git a/themes/cp_admin/user/create.php b/themes/cp_admin/user/create.php
index 623bb8bb..269fbbdf 100644
--- a/themes/cp_admin/user/create.php
+++ b/themes/cp_admin/user/create.php
@@ -30,7 +30,7 @@
name="role"
label="= esc(lang('User.form.role')) ?>"
options="= esc(json_encode($roleOptions)) ?>"
- selected="= setting('AuthGroups.defaultGroup') ?>"
+ defaultValue="= setting('AuthGroups.defaultGroup') ?>"
isRequired="true" />
= lang('User.form.submit_create') ?>
diff --git a/themes/cp_admin/user/edit.php b/themes/cp_admin/user/edit.php
index 1900a7aa..3ac57967 100644
--- a/themes/cp_admin/user/edit.php
+++ b/themes/cp_admin/user/edit.php
@@ -23,7 +23,7 @@
name="role"
label="= esc(lang('User.form.role')) ?>"
options="= esc(json_encode($roleOptions)) ?>"
- selected="= esc(get_instance_group($user)) ?>"
+ defaultValue="= esc(get_instance_group($user)) ?>"
isRequired="true" />
= lang('User.form.submit_edit') ?>
diff --git a/themes/cp_install/cache_config.php b/themes/cp_install/cache_config.php
index 6b254936..a2198903 100644
--- a/themes/cp_install/cache_config.php
+++ b/themes/cp_install/cache_config.php
@@ -25,7 +25,7 @@
'redis' => lang('Install.form.cacheHandlerOptions.redis'),
'predis' => lang('Install.form.cacheHandlerOptions.predis'),
])) ?>"
- selected="file"
+ defaultValue="file"
isRequired="true" />
= lang('Install.form.next') ?>