diff --git a/application/PluginManager.php b/application/plugin/PluginManager.php similarity index 87% rename from application/PluginManager.php rename to application/plugin/PluginManager.php index 1ed4db4..f7b24a8 100644 --- a/application/PluginManager.php +++ b/application/plugin/PluginManager.php @@ -1,4 +1,8 @@ errors; } } - -/** - * Class PluginFileNotFoundException - * - * Raise when plugin files can't be found. - */ -class PluginFileNotFoundException extends Exception -{ - /** - * Construct exception with plugin name. - * Generate message. - * - * @param string $pluginName name of the plugin not found - */ - public function __construct($pluginName) - { - $this->message = sprintf(t('Plugin "%s" files not found.'), $pluginName); - } -} diff --git a/application/plugin/exception/PluginFileNotFoundException.php b/application/plugin/exception/PluginFileNotFoundException.php new file mode 100644 index 0000000..e5386f0 --- /dev/null +++ b/application/plugin/exception/PluginFileNotFoundException.php @@ -0,0 +1,23 @@ +message = sprintf(t('Plugin "%s" files not found.'), $pluginName); + } +} diff --git a/composer.json b/composer.json index c1f4731..a2df466 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,8 @@ "Shaarli\\Feed\\": "application/feed", "Shaarli\\Http\\": "application/http", "Shaarli\\Netscape\\": "application/netscape", + "Shaarli\\Plugin\\": "application/plugin", + "Shaarli\\Plugin\\Exception\\": "application/plugin/exception", "Shaarli\\Render\\": "application/render", "Shaarli\\Security\\": "application/security", "Shaarli\\Updater\\": "application/updater", diff --git a/index.php b/index.php index bff8e8f..633ab89 100644 --- a/index.php +++ b/index.php @@ -65,7 +65,6 @@ require_once 'application/updater/UpdaterUtils.php'; require_once 'application/FileUtils.php'; require_once 'application/TimeZone.php'; require_once 'application/Utils.php'; -require_once 'application/PluginManager.php'; use \Shaarli\ApplicationUtils; use \Shaarli\Bookmark\Exception\LinkNotFoundException; @@ -76,6 +75,7 @@ use \Shaarli\Feed\FeedBuilder; use \Shaarli\History; use \Shaarli\Languages; use \Shaarli\Netscape\NetscapeBookmarkUtils; +use \Shaarli\Plugin\PluginManager; use \Shaarli\Render\PageBuilder; use \Shaarli\Render\ThemeUtils; use \Shaarli\Router; diff --git a/plugins/archiveorg/archiveorg.php b/plugins/archiveorg/archiveorg.php index 5dcea5a..0ee1c73 100644 --- a/plugins/archiveorg/archiveorg.php +++ b/plugins/archiveorg/archiveorg.php @@ -5,6 +5,8 @@ * Add an icon in the link list for archive.org. */ +use Shaarli\Plugin\PluginManager; + /** * Add archive.org icon to link_plugin when rendering linklist. * diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php index 94ce38f..95ea7fe 100644 --- a/plugins/demo_plugin/demo_plugin.php +++ b/plugins/demo_plugin/demo_plugin.php @@ -15,6 +15,7 @@ */ use Shaarli\Config\ConfigManager; +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /** diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php index 9bdd590..dab75dd 100644 --- a/plugins/isso/isso.php +++ b/plugins/isso/isso.php @@ -5,6 +5,7 @@ */ use Shaarli\Config\ConfigManager; +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /** diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 9928a48..628970d 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php @@ -7,6 +7,7 @@ */ use Shaarli\Config\ConfigManager; +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /* diff --git a/plugins/piwik/piwik.php b/plugins/piwik/piwik.php index ca00c2b..17b1aec 100644 --- a/plugins/piwik/piwik.php +++ b/plugins/piwik/piwik.php @@ -4,6 +4,8 @@ * Adds tracking code on each page. */ +use Shaarli\Plugin\PluginManager; + /** * Initialization function. * It will be called when the plugin is loaded. diff --git a/plugins/playvideos/playvideos.php b/plugins/playvideos/playvideos.php index bb5b9e9..0341ed5 100644 --- a/plugins/playvideos/playvideos.php +++ b/plugins/playvideos/playvideos.php @@ -6,6 +6,7 @@ * Note: this plugin adds jQuery. */ +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /** diff --git a/plugins/pubsubhubbub/pubsubhubbub.php b/plugins/pubsubhubbub/pubsubhubbub.php index a7bd34c..2878c05 100644 --- a/plugins/pubsubhubbub/pubsubhubbub.php +++ b/plugins/pubsubhubbub/pubsubhubbub.php @@ -12,6 +12,7 @@ use pubsubhubbub\publisher\Publisher; use Shaarli\Config\ConfigManager; use Shaarli\Feed\FeedBuilder; +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /** diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php index 21908ce..34eef8b 100644 --- a/plugins/qrcode/qrcode.php +++ b/plugins/qrcode/qrcode.php @@ -5,6 +5,7 @@ * Display a QRCode icon in link list. */ +use Shaarli\Plugin\PluginManager; use Shaarli\Router; /** diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index a6476c7..5ba1611 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php @@ -6,6 +6,7 @@ require_once 'WallabagInstance.php'; use Shaarli\Config\ConfigManager; +use Shaarli\Plugin\PluginManager; /** * Init function, return an error if the server is not set. diff --git a/tests/PluginManagerTest.php b/tests/PluginManagerTest.php index 01de959..71761ac 100644 --- a/tests/PluginManagerTest.php +++ b/tests/PluginManagerTest.php @@ -1,16 +1,12 @@