Page 1 of 1

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

Posted: Sun Dec 31, 2017 3:54 am
by jonathanholvey
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

Re: How to determine if a plugin is enabled?

Posted: Sun Dec 31, 2017 7:41 pm
by Edi
Why not use the plugin RSS Feed that comes with Bludit?

Re: How to determine if a plugin is enabled?

Posted: Mon Jan 01, 2018 3:59 am
by jonathanholvey
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?

Re: How to determine if a plugin is enabled?

Posted: Mon Jan 01, 2018 6:19 pm
by diego

Re: How to determine if a plugin is enabled?

Posted: Mon Jan 01, 2018 8:29 pm
by Edi
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.

Re: How to determine if a plugin is enabled?

Posted: Tue Jan 02, 2018 6:37 am
by jonathanholvey
Thanks. $plugins['all']['pluginRSS']->installed() is what I'm after.

Re: How to determine if a plugin is enabled?

Posted: Wed Jan 03, 2018 1:12 am
by Edi
Sorry! I posted the wrong snippet. :oops:

It's corrected.