[Solved] How to determine if a plugin is enabled?

Post Reply
jonathanholvey
Ssr. Bludit
Posts: 23
Joined: Mon May 22, 2017 10:15 pm

Hi,

I'd like to add an RSS link in the footer of the theme I'm working on. However, this link will only make sense if the RSS plugin is enabled. How can I check to see if a given plugin is enabled? The contents of $plugins["all"]["pluginRSS"] doesn't seem to provide the enabled status of the plugin.

Thanks,
Jon
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Why not use the plugin RSS Feed that comes with Bludit?
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
jonathanholvey
Ssr. Bludit
Posts: 23
Joined: Mon May 22, 2017 10:15 pm

Edi wrote: Sun Dec 31, 2017 7:41 pm Why not use the plugin RSS Feed that comes with Bludit?
That's the one I'm talking about. How can I tell if it's enabled or not in PHP?
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

If a plugin is enabled or not is shown on the plugin page.

You can use a plugin in your theme always by adding a hook. The plugin RSS Feed uses the hook siteHead. Therefore there ha`s to be the helper Theme::plugins('siteHead') in the header section of the theme. Something like this:

Code: Select all

<head>
...
<?php
    Theme::plugins('siteHead');
?>
...
</head>
To show the RSS icon you can use something like this:

Code: Select all

if( $plugins['all']['pluginRSS']->installed() ) {
    echo '<a href="'.DOMAIN_BASE.'rss.xml'.'" class="fa-rss"><span class="label">RSS</span></a>';
}
An example for this gives the theme Log.
Last edited by Edi on Wed Jan 03, 2018 1:14 am, edited 1 time in total.
Reason: Correction of snippet to show RSS icon.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
jonathanholvey
Ssr. Bludit
Posts: 23
Joined: Mon May 22, 2017 10:15 pm

Thanks. $plugins['all']['pluginRSS']->installed() is what I'm after.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Sorry! I posted the wrong snippet. :oops:

It's corrected.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply