Loading app/Helpers/rss_helper.php +4 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ if (! function_exists('get_rss_feed')) { Subscription $subscription = null, string $token = null ): string { $plugins = service('plugins'); $episodes = $podcast->episodes; $itunesNamespace = 'http://www.itunes.com/dtds/podcast-1.0.dtd'; Loading Loading @@ -69,6 +71,8 @@ if (! function_exists('get_rss_feed')) { $channel->addChild('generator', 'Castopod - https://castopod.org/'); $channel->addChild('docs', 'https://cyber.harvard.edu/rss/rss.html'); $plugins->runHook('setChannelTag', [$podcast, $channel]); if ($podcast->guid === '') { // FIXME: guid shouldn't be empty here as it should be filled upon Podcast creation $uuid = service('uuid'); Loading modules/Plugins/Plugins.php +41 −5 Original line number Diff line number Diff line Loading @@ -9,18 +9,54 @@ class Plugins /** * @var array<PluginInterface> */ protected array $installed = []; protected static array $plugins = []; public function registerPlugin(PluginInterface $plugin): void public function __construct() { $this->installed[] = $plugin; $this->registerPlugins(); } /** * @return array<PluginInterface> */ public function getInstalled(): array public function getPlugins(): array { return $this->installed; return $this->plugins; } /** * @param array<mixed> $parameters */ public function runHook(string $name, array $parameters): void { dd(static::$plugins); // only run active plugins' hooks foreach (static::$plugins as $plugin) { $plugin->{$name}(...$parameters); } } protected function registerPlugins(): void { $locator = service('locator'); $pluginsFiles = $locator->search('HelloWorld/Plugin.php'); // dd($pluginsFiles); foreach ($pluginsFiles as $file) { $className = $locator->findQualifiedNameFromPath($file); dd($file); if ($className === false) { continue; } $plugin = new $className(); if (! $plugin instanceof PluginInterface) { continue; } static::$plugins[] = $plugin; } } } Loading
app/Helpers/rss_helper.php +4 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ if (! function_exists('get_rss_feed')) { Subscription $subscription = null, string $token = null ): string { $plugins = service('plugins'); $episodes = $podcast->episodes; $itunesNamespace = 'http://www.itunes.com/dtds/podcast-1.0.dtd'; Loading Loading @@ -69,6 +71,8 @@ if (! function_exists('get_rss_feed')) { $channel->addChild('generator', 'Castopod - https://castopod.org/'); $channel->addChild('docs', 'https://cyber.harvard.edu/rss/rss.html'); $plugins->runHook('setChannelTag', [$podcast, $channel]); if ($podcast->guid === '') { // FIXME: guid shouldn't be empty here as it should be filled upon Podcast creation $uuid = service('uuid'); Loading
modules/Plugins/Plugins.php +41 −5 Original line number Diff line number Diff line Loading @@ -9,18 +9,54 @@ class Plugins /** * @var array<PluginInterface> */ protected array $installed = []; protected static array $plugins = []; public function registerPlugin(PluginInterface $plugin): void public function __construct() { $this->installed[] = $plugin; $this->registerPlugins(); } /** * @return array<PluginInterface> */ public function getInstalled(): array public function getPlugins(): array { return $this->installed; return $this->plugins; } /** * @param array<mixed> $parameters */ public function runHook(string $name, array $parameters): void { dd(static::$plugins); // only run active plugins' hooks foreach (static::$plugins as $plugin) { $plugin->{$name}(...$parameters); } } protected function registerPlugins(): void { $locator = service('locator'); $pluginsFiles = $locator->search('HelloWorld/Plugin.php'); // dd($pluginsFiles); foreach ($pluginsFiles as $file) { $className = $locator->findQualifiedNameFromPath($file); dd($file); if ($className === false) { continue; } $plugin = new $className(); if (! $plugin instanceof PluginInterface) { continue; } static::$plugins[] = $plugin; } } }