diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/readityourself/config.php.dist | 3 | ||||
-rw-r--r-- | plugins/readityourself/readityourself.php | 21 | ||||
-rw-r--r-- | plugins/wallabag/README.md | 29 | ||||
-rw-r--r-- | plugins/wallabag/config.php.dist | 4 | ||||
-rw-r--r-- | plugins/wallabag/wallabag.php | 25 |
5 files changed, 31 insertions, 51 deletions
diff --git a/plugins/readityourself/config.php.dist b/plugins/readityourself/config.php.dist deleted file mode 100644 index d6b5cb85..00000000 --- a/plugins/readityourself/config.php.dist +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | $GLOBALS['plugins']['READITYOUSELF_URL'] = 'http://someurl.com'; \ No newline at end of file | ||
diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php index c8df4c4f..4bfcf501 100644 --- a/plugins/readityourself/readityourself.php +++ b/plugins/readityourself/readityourself.php | |||
@@ -8,34 +8,31 @@ | |||
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 | $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); |
12 | if (is_file(PluginManager::$PLUGINS_PATH . '/readityourself/config.php')) { | 12 | if (empty($riyUrl)) { |
13 | include PluginManager::$PLUGINS_PATH . '/readityourself/config.php'; | ||
14 | } | ||
15 | |||
16 | if (empty($GLOBALS['plugins']['READITYOUSELF_URL'])) { | ||
17 | $GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '. | 13 | $GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '. |
18 | 'Please define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" '. | 14 | 'Please define the "READITYOUSELF_URL" setting in the plugin administration page.'; |
19 | 'in "plugins/readityourself/config.php" or in your Shaarli config.php file.'; | ||
20 | } | 15 | } |
21 | 16 | ||
22 | /** | 17 | /** |
23 | * Add readityourself icon to link_plugin when rendering linklist. | 18 | * Add readityourself icon to link_plugin when rendering linklist. |
24 | * | 19 | * |
25 | * @param mixed $data - linklist data. | 20 | * @param mixed $data Linklist data. |
21 | * @param ConfigManager $conf Configuration Manager instance. | ||
26 | * | 22 | * |
27 | * @return mixed - linklist data with readityourself plugin. | 23 | * @return mixed - linklist data with readityourself plugin. |
28 | */ | 24 | */ |
29 | function hook_readityourself_render_linklist($data) | 25 | function hook_readityourself_render_linklist($data, $conf) |
30 | { | 26 | { |
31 | if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) { | 27 | $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); |
28 | if (empty($riyUrl)) { | ||
32 | return $data; | 29 | return $data; |
33 | } | 30 | } |
34 | 31 | ||
35 | $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html'); | 32 | $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html'); |
36 | 33 | ||
37 | foreach ($data['links'] as &$value) { | 34 | foreach ($data['links'] as &$value) { |
38 | $readityourself = sprintf($readityourself_html, $GLOBALS['plugins']['READITYOUSELF_URL'], $value['url'], PluginManager::$PLUGINS_PATH); | 35 | $readityourself = sprintf($readityourself_html, $riyUrl, $value['url'], PluginManager::$PLUGINS_PATH); |
39 | $value['link_plugin'][] = $readityourself; | 36 | $value['link_plugin'][] = $readityourself; |
40 | } | 37 | } |
41 | 38 | ||
diff --git a/plugins/wallabag/README.md b/plugins/wallabag/README.md index 5bc35be1..3f930564 100644 --- a/plugins/wallabag/README.md +++ b/plugins/wallabag/README.md | |||
@@ -12,31 +12,26 @@ The directory structure should look like: | |||
12 | └── plugins | 12 | └── plugins |
13 | └── wallabag | 13 | └── wallabag |
14 | ├── README.md | 14 | ├── README.md |
15 | ├── config.php.dist | ||
16 | ├── wallabag.html | 15 | ├── wallabag.html |
16 | ├── wallabag.meta | ||
17 | ├── wallabag.php | 17 | ├── wallabag.php |
18 | └── wallabag.png | 18 | ├── wallabag.php |
19 | └── WallabagInstance.php | ||
19 | ``` | 20 | ``` |
20 | 21 | ||
21 | To enable the plugin, add `'wallabag'` to your list of enabled plugins in `data/options.php` (`PLUGINS` array). | 22 | To enable the plugin, you can either: |
22 | This should look like: | ||
23 | 23 | ||
24 | ``` | 24 | * enable it in the plugins administration page (`?do=pluginadmin`). |
25 | $GLOBALS['config']['PLUGINS'] = array('qrcode', 'any_other_plugin', 'wallabag') | 25 | * add `wallabag` to your list of enabled plugins in `data/config.json.php` (`general.enabled_plugins` section). |
26 | ``` | ||
27 | 26 | ||
28 | ### Configuration | 27 | ### Configuration |
29 | 28 | ||
30 | Copy `config.php.dist` into `config.php` and setup your instance. | 29 | Go to the plugin administration page, and edit the following settings (with the plugin enabled). |
31 | 30 | ||
32 | *Wallabag instance URL* | 31 | **WALLABAG_URL**: *Wallabag instance URL* |
33 | ``` | 32 | Example value: `http://v2.wallabag.org` |
34 | $GLOBALS['config']['WALLABAG_URL'] = 'http://v2.wallabag.org' ; | ||
35 | ``` | ||
36 | 33 | ||
37 | *Wallabag version*: either `1` (for 1.x) or `2` (for 2.x) | 34 | **WALLABAG_VERSION**: *Wallabag version* |
38 | ``` | 35 | Value: either `1` (for 1.x) or `2` (for 2.x) |
39 | $GLOBALS['config']['WALLABAG_VERSION'] = 2; | ||
40 | ``` | ||
41 | 36 | ||
42 | > Note: these settings can also be set in `data/config.php`. \ No newline at end of file | 37 | > Note: these settings can also be set in `data/config.json.php`, in the plugins section. \ No newline at end of file |
diff --git a/plugins/wallabag/config.php.dist b/plugins/wallabag/config.php.dist deleted file mode 100644 index a602708f..00000000 --- a/plugins/wallabag/config.php.dist +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | $GLOBALS['plugins']['WALLABAG_URL'] = 'https://demo.wallabag.org'; | ||
4 | $GLOBALS['plugins']['WALLABAG_VERSION'] = 1; \ No newline at end of file | ||
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index 0d6fc66d..ec09c8a1 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php | |||
@@ -6,34 +6,29 @@ | |||
6 | 6 | ||
7 | require_once 'WallabagInstance.php'; | 7 | require_once 'WallabagInstance.php'; |
8 | 8 | ||
9 | // don't raise unnecessary warnings | 9 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); |
10 | if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) { | 10 | if (empty($wallabagUrl)) { |
11 | include PluginManager::$PLUGINS_PATH . '/wallabag/config.php'; | ||
12 | } | ||
13 | |||
14 | if (empty($GLOBALS['plugins']['WALLABAG_URL'])) { | ||
15 | $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '. | 11 | $GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '. |
16 | 'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '. | 12 | 'Please define the "WALLABAG_URL" setting in the plugin administration page.'; |
17 | 'in "plugins/wallabag/config.php" or in your Shaarli config.php file.'; | ||
18 | } | 13 | } |
19 | 14 | ||
20 | /** | 15 | /** |
21 | * Add wallabag icon to link_plugin when rendering linklist. | 16 | * Add wallabag icon to link_plugin when rendering linklist. |
22 | * | 17 | * |
23 | * @param mixed $data - linklist data. | 18 | * @param mixed $data Linklist data. |
19 | * @param ConfigManager $conf Configuration Manager instance. | ||
24 | * | 20 | * |
25 | * @return mixed - linklist data with wallabag plugin. | 21 | * @return mixed - linklist data with wallabag plugin. |
26 | */ | 22 | */ |
27 | function hook_wallabag_render_linklist($data) | 23 | function hook_wallabag_render_linklist($data, $conf) |
28 | { | 24 | { |
29 | if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) { | 25 | $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); |
26 | if (empty($wallabagUrl)) { | ||
30 | return $data; | 27 | return $data; |
31 | } | 28 | } |
32 | 29 | ||
33 | $version = isset($GLOBALS['plugins']['WALLABAG_VERSION']) | 30 | $version = $conf->get('plugins.WALLABAG_VERSION'); |
34 | ? $GLOBALS['plugins']['WALLABAG_VERSION'] | 31 | $wallabagInstance = new WallabagInstance($wallabagUrl, $version); |
35 | : ''; | ||
36 | $wallabagInstance = new WallabagInstance($GLOBALS['plugins']['WALLABAG_URL'], $version); | ||
37 | 32 | ||
38 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); | 33 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); |
39 | 34 | ||