aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/readityourself/readityourself.php15
-rw-r--r--plugins/wallabag/wallabag.php19
2 files changed, 15 insertions, 19 deletions
diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php
index c8df4c4f..9ca73e01 100644
--- a/plugins/readityourself/readityourself.php
+++ b/plugins/readityourself/readityourself.php
@@ -8,12 +8,9 @@
8// it seems kinda dead. 8// it seems kinda dead.
9// Not tested. 9// Not tested.
10 10
11// don't raise unnecessary warnings 11$conf = ConfigManager::getInstance();
12if (is_file(PluginManager::$PLUGINS_PATH . '/readityourself/config.php')) { 12$riyUrl = $conf->get('plugins.READITYOUSELF_URL');
13 include PluginManager::$PLUGINS_PATH . '/readityourself/config.php'; 13if (empty($riyUrl)) {
14}
15
16if (empty($GLOBALS['plugins']['READITYOUSELF_URL'])) {
17 $GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '. 14 $GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '.
18 'Please define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" '. 15 'Please define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" '.
19 'in "plugins/readityourself/config.php" or in your Shaarli config.php file.'; 16 'in "plugins/readityourself/config.php" or in your Shaarli config.php file.';
@@ -28,14 +25,16 @@ if (empty($GLOBALS['plugins']['READITYOUSELF_URL'])) {
28 */ 25 */
29function hook_readityourself_render_linklist($data) 26function hook_readityourself_render_linklist($data)
30{ 27{
31 if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) { 28 $conf = ConfigManager::getInstance();
29 $riyUrl = $conf->get('plugins.READITYOUSELF_URL');
30 if (empty($riyUrl)) {
32 return $data; 31 return $data;
33 } 32 }
34 33
35 $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html'); 34 $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html');
36 35
37 foreach ($data['links'] as &$value) { 36 foreach ($data['links'] as &$value) {
38 $readityourself = sprintf($readityourself_html, $GLOBALS['plugins']['READITYOUSELF_URL'], $value['url'], PluginManager::$PLUGINS_PATH); 37 $readityourself = sprintf($readityourself_html, $riyUrl, $value['url'], PluginManager::$PLUGINS_PATH);
39 $value['link_plugin'][] = $readityourself; 38 $value['link_plugin'][] = $readityourself;
40 } 39 }
41 40
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php
index 0d6fc66d..4726d936 100644
--- a/plugins/wallabag/wallabag.php
+++ b/plugins/wallabag/wallabag.php
@@ -6,12 +6,9 @@
6 6
7require_once 'WallabagInstance.php'; 7require_once 'WallabagInstance.php';
8 8
9// don't raise unnecessary warnings 9$conf = ConfigManager::getInstance();
10if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) { 10$wallabagUrl = $conf->get('plugins.WALLABAG_URL');
11 include PluginManager::$PLUGINS_PATH . '/wallabag/config.php'; 11if (empty($wallabagUrl)) {
12}
13
14if (empty($GLOBALS['plugins']['WALLABAG_URL'])) {
15 $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '. 12 $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '.
16 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '. 13 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '.
17 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.'; 14 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.';
@@ -26,14 +23,14 @@ if (empty($GLOBALS['plugins']['WALLABAG_URL'])) {
26 */ 23 */
27function hook_wallabag_render_linklist($data) 24function hook_wallabag_render_linklist($data)
28{ 25{
29 if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) { 26 $conf = ConfigManager::getInstance();
27 $wallabagUrl = $conf->get('plugins.WALLABAG_URL');
28 if (empty($wallabagUrl)) {
30 return $data; 29 return $data;
31 } 30 }
32 31
33 $version = isset($GLOBALS['plugins']['WALLABAG_VERSION']) 32 $version = $conf->get('plugins.WALLABAG_VERSION');
34 ? $GLOBALS['plugins']['WALLABAG_VERSION'] 33 $wallabagInstance = new WallabagInstance($wallabagUrl, $version);
35 : '';
36 $wallabagInstance = new WallabagInstance($GLOBALS['plugins']['WALLABAG_URL'], $version);
37 34
38 $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); 35 $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html');
39 36