Skip to content

Commit

Permalink
Enable PicoDeprecated if no plugins are loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
PhrozenByte committed Nov 4, 2015
1 parent ccac8dd commit 2a43b21
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions plugins/00-PicoDeprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,23 @@ class PicoDeprecated extends AbstractPicoPlugin
*/
public function onPluginsLoaded(&$plugins)
{
foreach ($plugins as $plugin) {
if (!is_a($plugin, 'PicoPluginInterface')) {
// the plugin doesn't implement PicoPluginInterface; it uses deprecated events
// enable PicoDeprecated if it hasn't be explicitly enabled/disabled yet
if (!$this->isStatusChanged()) {
$this->setEnabled(true, true, true);
if (!empty($plugins)) {
foreach ($plugins as $plugin) {
if (!is_a($plugin, 'PicoPluginInterface')) {
// the plugin doesn't implement PicoPluginInterface; it uses deprecated events
// enable PicoDeprecated if it hasn't be explicitly enabled/disabled yet
if (!$this->isStatusChanged()) {
$this->setEnabled(true, true, true);
}
break;
}
break;
}
} else {
// no plugins were found, so it actually isn't necessary to call deprecated events
// anyway, this plugin also ensures compatibility apart from events used by old plugins,
// so enable PicoDeprecated if it hasn't be explicitly enabled/disabled yet
if (!$this->isStatusChanged()) {
$this->setEnabled(true, true, true);
}
}

Expand Down

0 comments on commit 2a43b21

Please sign in to comment.