diff --git a/composer.json b/composer.json index 38192f4..2ec4593 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "autoload": { "files": [ "lib/Pico.php", - "lib/IPicoPlugin.php", + "lib/PicoPluginInterface.php", "lib/AbstractPicoPlugin.php" ] } diff --git a/lib/AbstractPicoPlugin.php b/lib/AbstractPicoPlugin.php index 790a656..07905d1 100644 --- a/lib/AbstractPicoPlugin.php +++ b/lib/AbstractPicoPlugin.php @@ -3,21 +3,21 @@ /** * Abstract class to extend from when implementing a Pico plugin * - * @see IPicoPlugin + * @see PicoPluginInterface * * @author Daniel Rudolf * @link http://picocms.org * @license http://opensource.org/licenses/MIT * @version 1.0 */ -abstract class AbstractPicoPlugin implements IPicoPlugin +abstract class AbstractPicoPlugin implements PicoPluginInterface { /** * Current instance of Pico * * @var Pico - * @see IPicoPlugin::__construct() - * @see IPicoPlugin::getPico() + * @see PicoPluginInterface::__construct() + * @see PicoPluginInterface::getPico() */ private $pico; @@ -25,8 +25,8 @@ abstract class AbstractPicoPlugin implements IPicoPlugin * Boolean indicating if this plugin is enabled (true) or disabled (false) * * @var boolean - * @see IPicoPlugin::isEnabled() - * @see IPicoPlugin::setEnabled() + * @see PicoPluginInterface::isEnabled() + * @see PicoPluginInterface::setEnabled() */ protected $enabled = true; @@ -34,7 +34,7 @@ abstract class AbstractPicoPlugin implements IPicoPlugin * Boolean indicating if this plugin was ever enabled/disabled manually * * @var boolean - * @see IPicoPlugin::isStatusChanged() + * @see PicoPluginInterface::isStatusChanged() */ protected $statusChanged = false; @@ -42,7 +42,7 @@ abstract class AbstractPicoPlugin implements IPicoPlugin * List of plugins this plugin depends on * * @var array - * @see IPicoPlugin::getDependencies() + * @see PicoPluginInterface::getDependencies() * @see AbstractPicoPlugin::checkDependencies() */ protected $dependsOn = array(); @@ -51,13 +51,13 @@ abstract class AbstractPicoPlugin implements IPicoPlugin * List of plugin which depend on this plugin * * @var array - * @see IPicoPlugin::getDependants() + * @see PicoPluginInterface::getDependants() * @see AbstractPicoPlugin::checkDependants() */ private $dependants; /** - * @see IPicoPlugin::__construct() + * @see PicoPluginInterface::__construct() */ public function __construct(Pico $pico) { @@ -65,7 +65,7 @@ abstract class AbstractPicoPlugin implements IPicoPlugin } /** - * @see IPicoPlugin::handleEvent() + * @see PicoPluginInterface::handleEvent() */ public function handleEvent($eventName, array $params) { @@ -85,7 +85,7 @@ abstract class AbstractPicoPlugin implements IPicoPlugin } /** - * @see IPicoPlugin::setEnabled() + * @see PicoPluginInterface::setEnabled() */ public function setEnabled($enabled, $recursive = true, $auto = false) { @@ -100,7 +100,7 @@ abstract class AbstractPicoPlugin implements IPicoPlugin } /** - * @see IPicoPlugin::isEnabled() + * @see PicoPluginInterface::isEnabled() */ public function isEnabled() { @@ -108,7 +108,7 @@ abstract class AbstractPicoPlugin implements IPicoPlugin } /** - * @see IPicoPlugin::isStatusChanged() + * @see PicoPluginInterface::isStatusChanged() */ public function isStatusChanged() { @@ -116,7 +116,7 @@ abstract class AbstractPicoPlugin implements IPicoPlugin } /** - * @see IPicoPlugin::getPico() + * @see PicoPluginInterface::getPico() */ public function getPico() { @@ -161,8 +161,8 @@ abstract class AbstractPicoPlugin implements IPicoPlugin ); } - // plugins which don't implement IPicoPlugin are always enabled - if (is_a($plugin, 'IPicoPlugin') && !$plugin->isEnabled()) { + // plugins which don't implement PicoPluginInterface are always enabled + if (is_a($plugin, 'PicoPluginInterface') && !$plugin->isEnabled()) { if ($recursive) { if (!$plugin->isStatusChanged()) { $plugin->setEnabled(true, true, true); @@ -183,7 +183,7 @@ abstract class AbstractPicoPlugin implements IPicoPlugin } /** - * @see IPicoPlugin::getDependencies() + * @see PicoPluginInterface::getDependencies() */ public function getDependencies() { @@ -226,15 +226,15 @@ abstract class AbstractPicoPlugin implements IPicoPlugin } /** - * @see IPicoPlugin::getDependants() + * @see PicoPluginInterface::getDependants() */ public function getDependants() { if ($this->dependants === null) { $this->dependants = array(); foreach ($this->getPlugins() as $pluginName => $plugin) { - // only plugins which implement IPicoPlugin support dependencies - if (is_a($plugin, 'IPicoPlugin')) { + // only plugins which implement PicoPluginInterface support dependencies + if (is_a($plugin, 'PicoPluginInterface')) { $dependencies = $plugin->getDependencies(); if (in_array(get_called_class(), $dependencies)) { $this->dependants[$pluginName] = $plugin; diff --git a/lib/IPicoPlugin.php b/lib/IPicoPlugin.php deleted file mode 100644 index 2a9e284..0000000 --- a/lib/IPicoPlugin.php +++ /dev/null @@ -1,97 +0,0 @@ - required plugins - */ - public function getDependencies(); - - /** - * Returns a list of plugins which depend on this plugin - * - * @return array dependant plugins - */ - public function getDependants(); - - /** - * Returns the plugins instance of Pico - * - * @return Pico the plugins instance of Pico - */ - public function getPico(); -} diff --git a/lib/Pico.php b/lib/Pico.php index a134343..35d66cd 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -258,8 +258,8 @@ class Pico /** * Returns the instance of a named plugin * - * Plugins SHOULD implement {@link IPicoPlugin}, but you MUST NOT rely on - * it. For more information see {@link IPicoPlugin}. + * Plugins SHOULD implement {@link PicoPluginInterface}, but you MUST NOT + * rely on it. For more information see {@link PicoPluginInterface}. * * @see Pico::loadPlugins() * @param string $pluginName name of the plugin @@ -922,7 +922,7 @@ class Pico } /** - * Triggers events on plugins which implement {@link IPicoPlugin} + * Triggers events on plugins which implement {@link PicoPluginInterface} * * Deprecated events (as used by plugins not implementing * {@link IPocPlugin}) are triggered by {@link PicoDeprecated}. @@ -934,10 +934,10 @@ class Pico protected function triggerEvent($eventName, array $params = array()) { foreach ($this->plugins as $plugin) { - // only trigger events for plugins that implement IPicoPlugin + // only trigger events for plugins that implement PicoPluginInterface // deprecated events (plugins for Pico 0.9 and older) will be // triggered by the `PicoPluginDeprecated` plugin - if (is_a($plugin, 'IPicoPlugin')) { + if (is_a($plugin, 'PicoPluginInterface')) { $plugin->handleEvent($eventName, $params); } } diff --git a/plugins/00-PicoDeprecated.php b/plugins/00-PicoDeprecated.php index 92fb73b..98a8859 100644 --- a/plugins/00-PicoDeprecated.php +++ b/plugins/00-PicoDeprecated.php @@ -5,8 +5,8 @@ * * This plugin exists for backward compatibility and is disabled by default. * It gets automatically enabled when a plugin which doesn't implement - * {@link IPicoPlugin} is loaded. This plugin mainly triggers deprecated - * events, but also automatically enables {@link PicoParsePagesContent} and + * {@link PicoPluginInterface} is loaded. This plugin triggers deprecated + * events and automatically enables {@link PicoParsePagesContent} and * {@link PicoExcerpt}. These plugins heavily impact Picos performance! You * can disable this plugin by calling {@link PicoDeprecated::setEnabled()}. * @@ -68,8 +68,8 @@ class PicoDeprecated extends AbstractPicoPlugin public function onPluginsLoaded(&$plugins) { foreach ($plugins as $plugin) { - if (!is_a($plugin, 'IPicoPlugin')) { - // the plugin doesn't implement IPicoPlugin; it uses deprecated events + 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);