diff --git a/plugin.json b/plugin.json index 756428d..c839924 100644 --- a/plugin.json +++ b/plugin.json @@ -5,7 +5,7 @@ "provider": "Botble\\RssFeed\\Providers\\RssFeedServiceProvider", "author": "Botble Technologies", "url": "https://botble.com", - "version": "1.1.4", + "version": "1.1.5", "description": "RSS is a web feed that allows users and applications to access updates to websites in a standardized, computer-readable format.", "minimum_core_version": "7.3.0" } diff --git a/src/Http/Controllers/RssFeedController.php b/src/Http/Controllers/RssFeedController.php index 0ee7fc7..9d2a5a4 100644 --- a/src/Http/Controllers/RssFeedController.php +++ b/src/Http/Controllers/RssFeedController.php @@ -72,7 +72,7 @@ public function show(string $name) break; case 'jobs': - if (! is_plugin_active('job-board')) { + if (! is_plugin_active('job-board') || ! class_exists(Job::class)) { abort(404); } @@ -110,7 +110,7 @@ public function show(string $name) break; case 'properties': - if (! is_plugin_active('real-estate')) { + if (! is_plugin_active('real-estate') || ! interface_exists(PropertyInterface::class)) { abort(404); } @@ -149,7 +149,7 @@ public function show(string $name) break; case 'projects': - if (! is_plugin_active('real-estate')) { + if (! is_plugin_active('real-estate') || ! interface_exists(ProjectInterface::class)) { abort(404); } @@ -191,7 +191,7 @@ public function show(string $name) break; case 'products': - if (! is_plugin_active('ecommerce')) { + if (! is_plugin_active('ecommerce') || ! function_exists('get_products')) { abort(404); } diff --git a/src/Providers/RssFeedServiceProvider.php b/src/Providers/RssFeedServiceProvider.php index bbb3425..8f26153 100644 --- a/src/Providers/RssFeedServiceProvider.php +++ b/src/Providers/RssFeedServiceProvider.php @@ -7,7 +7,6 @@ use Botble\RssFeed\Facades\RssFeed; use Illuminate\Foundation\AliasLoader; use Illuminate\Routing\Events\RouteMatched; -use Illuminate\Support\Facades\Route; class RssFeedServiceProvider extends ServiceProvider { @@ -27,9 +26,40 @@ public function boot(): void ->loadAndPublishViews(); $this->app['events']->listen(RouteMatched::class, function () { - if (is_plugin_active('blog') && Route::has('feeds.posts')) { - RssFeed::addFeedLink(route('feeds.posts'), 'Posts feed'); + if (is_plugin_active('blog')) { + RssFeed::addFeedLink( + route('feeds.show', ['name' => 'posts']), + __(':name feed', ['name' => __('Posts')]) + ); } + + if (is_plugin_active('job-board')) { + RssFeed::addFeedLink( + route('feeds.show', ['name' => 'jobs']), + __(':name feed', ['name' => __('Jobs')]) + ); + } + + if (is_plugin_active('real-estate')) { + RssFeed::addFeedLink( + route('feeds.show', ['name' => 'properties']), + __(':name feed', ['name' => __('Properties')]) + ); + + RssFeed::addFeedLink( + route('feeds.show', ['name' => 'projects']), + __(':name feed', ['name' => __('Projects')]) + ); + } + + if (is_plugin_active('ecommerce')) { + RssFeed::addFeedLink( + route('feeds.show', ['name' => 'products']), + __(':name feed', ['name' => __('Products')]) + ); + } + + do_action('rss_feed.add_feed_link'); }); } }