aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/addlink_toolbar/addlink_toolbar.php20
-rw-r--r--plugins/archiveorg/archiveorg.php1
-rw-r--r--plugins/default_colors/default_colors.php26
-rw-r--r--plugins/demo_plugin/DemoPluginController.php24
-rw-r--r--plugins/demo_plugin/demo_plugin.php64
-rw-r--r--plugins/isso/isso.php8
-rw-r--r--plugins/piwik/piwik.php3
-rw-r--r--plugins/playvideos/playvideos.php11
-rw-r--r--plugins/pubsubhubbub/pubsubhubbub.php14
-rw-r--r--plugins/qrcode/qrcode.php1
-rw-r--r--plugins/wallabag/WallabagInstance.php9
-rw-r--r--plugins/wallabag/wallabag.php10
12 files changed, 127 insertions, 64 deletions
diff --git a/plugins/addlink_toolbar/addlink_toolbar.php b/plugins/addlink_toolbar/addlink_toolbar.php
index ab6ed6de..80b1dd95 100644
--- a/plugins/addlink_toolbar/addlink_toolbar.php
+++ b/plugins/addlink_toolbar/addlink_toolbar.php
@@ -17,26 +17,26 @@ use Shaarli\Render\TemplatePage;
17function hook_addlink_toolbar_render_header($data) 17function hook_addlink_toolbar_render_header($data)
18{ 18{
19 if ($data['_PAGE_'] == TemplatePage::LINKLIST && $data['_LOGGEDIN_'] === true) { 19 if ($data['_PAGE_'] == TemplatePage::LINKLIST && $data['_LOGGEDIN_'] === true) {
20 $form = array( 20 $form = [
21 'attr' => array( 21 'attr' => [
22 'method' => 'GET', 22 'method' => 'GET',
23 'action' => $data['_BASE_PATH_'] . '/admin/shaare', 23 'action' => $data['_BASE_PATH_'] . '/admin/shaare',
24 'name' => 'addform', 24 'name' => 'addform',
25 'class' => 'addform', 25 'class' => 'addform',
26 ), 26 ],
27 'inputs' => array( 27 'inputs' => [
28 array( 28 [
29 'type' => 'text', 29 'type' => 'text',
30 'name' => 'post', 30 'name' => 'post',
31 'placeholder' => t('URI'), 31 'placeholder' => t('URI'),
32 ), 32 ],
33 array( 33 [
34 'type' => 'submit', 34 'type' => 'submit',
35 'value' => t('Add link'), 35 'value' => t('Add link'),
36 'class' => 'bigbutton', 36 'class' => 'bigbutton',
37 ), 37 ],
38 ), 38 ],
39 ); 39 ];
40 $data['fields_toolbar'][] = $form; 40 $data['fields_toolbar'][] = $form;
41 } 41 }
42 42
diff --git a/plugins/archiveorg/archiveorg.php b/plugins/archiveorg/archiveorg.php
index ed271532..88f2b653 100644
--- a/plugins/archiveorg/archiveorg.php
+++ b/plugins/archiveorg/archiveorg.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2
2/** 3/**
3 * Plugin Archive.org. 4 * Plugin Archive.org.
4 * 5 *
diff --git a/plugins/default_colors/default_colors.php b/plugins/default_colors/default_colors.php
index e1fd5cfb..d3e1fa76 100644
--- a/plugins/default_colors/default_colors.php
+++ b/plugins/default_colors/default_colors.php
@@ -28,14 +28,14 @@ function default_colors_init($conf)
28{ 28{
29 $params = []; 29 $params = [];
30 foreach (DEFAULT_COLORS_PLACEHOLDERS as $placeholder) { 30 foreach (DEFAULT_COLORS_PLACEHOLDERS as $placeholder) {
31 $value = trim($conf->get('plugins.'. $placeholder, '')); 31 $value = trim($conf->get('plugins.' . $placeholder, ''));
32 if (strlen($value) > 0) { 32 if (strlen($value) > 0) {
33 $params[$placeholder] = $value; 33 $params[$placeholder] = $value;
34 } 34 }
35 } 35 }
36 36
37 if (empty($params)) { 37 if (empty($params)) {
38 $error = t('Default colors plugin error: '. 38 $error = t('Default colors plugin error: ' .
39 'This plugin is active and no custom color is configured.'); 39 'This plugin is active and no custom color is configured.');
40 return [$error]; 40 return [$error];
41 } 41 }
@@ -47,6 +47,20 @@ function default_colors_init($conf)
47} 47}
48 48
49/** 49/**
50 * When plugin parameters are saved, we regenerate the custom CSS file with provided settings.
51 *
52 * @param array $data $_POST array
53 *
54 * @return array Updated $_POST array
55 */
56function hook_default_colors_save_plugin_parameters($data)
57{
58 default_colors_generate_css_file($data);
59
60 return $data;
61}
62
63/**
50 * When linklist is displayed, include default_colors CSS file. 64 * When linklist is displayed, include default_colors CSS file.
51 * 65 *
52 * @param array $data - header data. 66 * @param array $data - header data.
@@ -56,7 +70,7 @@ function default_colors_init($conf)
56function hook_default_colors_render_includes($data) 70function hook_default_colors_render_includes($data)
57{ 71{
58 $file = PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css'; 72 $file = PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css';
59 if (file_exists($file )) { 73 if (file_exists($file)) {
60 $data['css_files'][] = $file ; 74 $data['css_files'][] = $file ;
61 } 75 }
62 76
@@ -75,7 +89,7 @@ function default_colors_generate_css_file($params): void
75 $content = ''; 89 $content = '';
76 foreach (DEFAULT_COLORS_PLACEHOLDERS as $rule) { 90 foreach (DEFAULT_COLORS_PLACEHOLDERS as $rule) {
77 $content .= !empty($params[$rule]) 91 $content .= !empty($params[$rule])
78 ? default_colors_format_css_rule($params, $rule) .';'. PHP_EOL 92 ? default_colors_format_css_rule($params, $rule) . ';' . PHP_EOL
79 : ''; 93 : '';
80 } 94 }
81 95
@@ -99,8 +113,8 @@ function default_colors_format_css_rule($data, $parameter)
99 } 113 }
100 114
101 $key = str_replace('DEFAULT_COLORS_', '', $parameter); 115 $key = str_replace('DEFAULT_COLORS_', '', $parameter);
102 $key = str_replace('_', '-', strtolower($key)) .'-color'; 116 $key = str_replace('_', '-', strtolower($key)) . '-color';
103 return ' --'. $key .': '. $data[$parameter]; 117 return ' --' . $key . ': ' . $data[$parameter];
104} 118}
105 119
106 120
diff --git a/plugins/demo_plugin/DemoPluginController.php b/plugins/demo_plugin/DemoPluginController.php
new file mode 100644
index 00000000..b8ace9c8
--- /dev/null
+++ b/plugins/demo_plugin/DemoPluginController.php
@@ -0,0 +1,24 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Shaarli\DemoPlugin;
6
7use Shaarli\Front\Controller\Admin\ShaarliAdminController;
8use Slim\Http\Request;
9use Slim\Http\Response;
10
11class DemoPluginController extends ShaarliAdminController
12{
13 public function index(Request $request, Response $response): Response
14 {
15 $this->assignView(
16 'content',
17 '<div class="center">' .
18 'This is a demo page. I have access to Shaarli container, so I\'m free to do whatever I want here.' .
19 '</div>'
20 );
21
22 return $response->write($this->render('pluginscontent'));
23 }
24}
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php
index defb01f7..15cfc2c5 100644
--- a/plugins/demo_plugin/demo_plugin.php
+++ b/plugins/demo_plugin/demo_plugin.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2
2/** 3/**
3 * Demo Plugin. 4 * Demo Plugin.
4 * 5 *
@@ -6,6 +7,8 @@
6 * Can be used by plugin developers to make their own plugin. 7 * Can be used by plugin developers to make their own plugin.
7 */ 8 */
8 9
10require_once __DIR__ . '/DemoPluginController.php';
11
9/* 12/*
10 * RENDER HEADER, INCLUDES, FOOTER 13 * RENDER HEADER, INCLUDES, FOOTER
11 * 14 *
@@ -59,6 +62,17 @@ function demo_plugin_init($conf)
59 return $errors; 62 return $errors;
60} 63}
61 64
65function demo_plugin_register_routes(): array
66{
67 return [
68 [
69 'method' => 'GET',
70 'route' => '/custom',
71 'callable' => 'Shaarli\DemoPlugin\DemoPluginController:index',
72 ],
73 ];
74}
75
62/** 76/**
63 * Hook render_header. 77 * Hook render_header.
64 * Executed on every page render. 78 * Executed on every page render.
@@ -82,14 +96,14 @@ function hook_demo_plugin_render_header($data)
82 * A link is an array of its attributes (key="value"), 96 * A link is an array of its attributes (key="value"),
83 * and a mandatory `html` key, which contains its value. 97 * and a mandatory `html` key, which contains its value.
84 */ 98 */
85 $button = array( 99 $button = [
86 'attr' => array ( 100 'attr' => [
87 'href' => '#', 101 'href' => '#',
88 'class' => 'mybutton', 102 'class' => 'mybutton',
89 'title' => 'hover me', 103 'title' => 'hover me',
90 ), 104 ],
91 'html' => 'DEMO buttons toolbar', 105 'html' => 'DEMO buttons toolbar',
92 ); 106 ];
93 $data['buttons_toolbar'][] = $button; 107 $data['buttons_toolbar'][] = $button;
94 } 108 }
95 109
@@ -115,29 +129,29 @@ function hook_demo_plugin_render_header($data)
115 * <input input-2-attribute-1="input 2 attribute 1 value"> 129 * <input input-2-attribute-1="input 2 attribute 1 value">
116 * </form> 130 * </form>
117 */ 131 */
118 $form = array( 132 $form = [
119 'attr' => array( 133 'attr' => [
120 'method' => 'GET', 134 'method' => 'GET',
121 'action' => $data['_BASE_PATH_'] . '/', 135 'action' => $data['_BASE_PATH_'] . '/',
122 'class' => 'addform', 136 'class' => 'addform',
123 ), 137 ],
124 'inputs' => array( 138 'inputs' => [
125 array( 139 [
126 'type' => 'text', 140 'type' => 'text',
127 'name' => 'demo', 141 'name' => 'demo',
128 'placeholder' => 'demo', 142 'placeholder' => 'demo',
129 ) 143 ]
130 ) 144 ]
131 ); 145 ];
132 $data['fields_toolbar'][] = $form; 146 $data['fields_toolbar'][] = $form;
133 } 147 }
134 // Another button always displayed 148 // Another button always displayed
135 $button = array( 149 $button = [
136 'attr' => array( 150 'attr' => [
137 'href' => '#', 151 'href' => '#',
138 ), 152 ],
139 'html' => 'Demo', 153 'html' => 'Demo',
140 ); 154 ];
141 $data['buttons_toolbar'][] = $button; 155 $data['buttons_toolbar'][] = $button;
142 156
143 return $data; 157 return $data;
@@ -187,7 +201,7 @@ function hook_demo_plugin_render_includes($data)
187function hook_demo_plugin_render_footer($data) 201function hook_demo_plugin_render_footer($data)
188{ 202{
189 // Footer text 203 // Footer text
190 $data['text'][] = '<br>'. demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.'); 204 $data['text'][] = '<br>' . demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.');
191 205
192 // Free elements at the end of the page. 206 // Free elements at the end of the page.
193 $data['endofpage'][] = '<marquee id="demo_marquee">' . 207 $data['endofpage'][] = '<marquee id="demo_marquee">' .
@@ -229,13 +243,13 @@ function hook_demo_plugin_render_linklist($data)
229 * and a mandatory `html` key, which contains its value. 243 * and a mandatory `html` key, which contains its value.
230 * It's also recommended to add key 'on' or 'off' for theme rendering. 244 * It's also recommended to add key 'on' or 'off' for theme rendering.
231 */ 245 */
232 $action = array( 246 $action = [
233 'attr' => array( 247 'attr' => [
234 'href' => '?up', 248 'href' => '?up',
235 'title' => 'Uppercase!', 249 'title' => 'Uppercase!',
236 ), 250 ],
237 'html' => '←', 251 'html' => '←',
238 ); 252 ];
239 253
240 if (isset($_GET['up'])) { 254 if (isset($_GET['up'])) {
241 // Manipulate link data 255 // Manipulate link data
@@ -275,7 +289,7 @@ function hook_demo_plugin_render_linklist($data)
275function hook_demo_plugin_render_editlink($data) 289function hook_demo_plugin_render_editlink($data)
276{ 290{
277 // Load HTML into a string 291 // Load HTML into a string
278 $html = file_get_contents(PluginManager::$PLUGINS_PATH .'/demo_plugin/field.html'); 292 $html = file_get_contents(PluginManager::$PLUGINS_PATH . '/demo_plugin/field.html');
279 293
280 // Replace value in HTML if it exists in $data 294 // Replace value in HTML if it exists in $data
281 if (!empty($data['link']['stuff'])) { 295 if (!empty($data['link']['stuff'])) {
@@ -303,7 +317,11 @@ function hook_demo_plugin_render_editlink($data)
303function hook_demo_plugin_render_tools($data) 317function hook_demo_plugin_render_tools($data)
304{ 318{
305 // field_plugin 319 // field_plugin
306 $data['tools_plugin'][] = 'tools_plugin'; 320 $data['tools_plugin'][] = '<div class="tools-item">
321 <a href="' . $data['_BASE_PATH_'] . '/plugin/demo_plugin/custom">
322 <span class="pure-button pure-u-lg-2-3 pure-u-3-4">Demo Plugin Custom Route</span>
323 </a>
324 </div>';
307 325
308 return $data; 326 return $data;
309} 327}
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php
index d4632163..a5450989 100644
--- a/plugins/isso/isso.php
+++ b/plugins/isso/isso.php
@@ -19,9 +19,9 @@ function isso_init($conf)
19{ 19{
20 $issoUrl = $conf->get('plugins.ISSO_SERVER'); 20 $issoUrl = $conf->get('plugins.ISSO_SERVER');
21 if (empty($issoUrl)) { 21 if (empty($issoUrl)) {
22 $error = t('Isso plugin error: '. 22 $error = t('Isso plugin error: ' .
23 'Please define the "ISSO_SERVER" setting in the plugin administration page.'); 23 'Please define the "ISSO_SERVER" setting in the plugin administration page.');
24 return array($error); 24 return [$error];
25 } 25 }
26} 26}
27 27
@@ -49,12 +49,12 @@ function hook_isso_render_linklist($data, $conf)
49 $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']); 49 $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']);
50 $data['plugin_end_zone'][] = $isso; 50 $data['plugin_end_zone'][] = $isso;
51 } else { 51 } else {
52 $button = '<span><a href="'. ($data['_BASE_PATH_'] ?? '') . '/shaare/%s#isso-thread">'; 52 $button = '<span><a href="' . ($data['_BASE_PATH_'] ?? '') . '/shaare/%s#isso-thread">';
53 // For the default theme we use a FontAwesome icon which is better than an image 53 // For the default theme we use a FontAwesome icon which is better than an image
54 if ($conf->get('resource.theme') === 'default') { 54 if ($conf->get('resource.theme') === 'default') {
55 $button .= '<i class="linklist-plugin-icon fa fa-comment"></i>'; 55 $button .= '<i class="linklist-plugin-icon fa fa-comment"></i>';
56 } else { 56 } else {
57 $button .= '<img class="linklist-plugin-icon" src="'. $data['_ROOT_PATH_'].'/plugins/isso/comment.png" '; 57 $button .= '<img class="linklist-plugin-icon" src="' . $data['_ROOT_PATH_'] . '/plugins/isso/comment.png" ';
58 $button .= 'title="Comment on this shaare" alt="Comments" />'; 58 $button .= 'title="Comment on this shaare" alt="Comments" />';
59 } 59 }
60 $button .= '</a></span>'; 60 $button .= '</a></span>';
diff --git a/plugins/piwik/piwik.php b/plugins/piwik/piwik.php
index 17b1aecc..efea8610 100644
--- a/plugins/piwik/piwik.php
+++ b/plugins/piwik/piwik.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2
2/** 3/**
3 * Piwik plugin. 4 * Piwik plugin.
4 * Adds tracking code on each page. 5 * Adds tracking code on each page.
@@ -22,7 +23,7 @@ function piwik_init($conf)
22 if (empty($piwikUrl) || empty($piwikSiteid)) { 23 if (empty($piwikUrl) || empty($piwikSiteid)) {
23 $error = t('Piwik plugin error: ' . 24 $error = t('Piwik plugin error: ' .
24 'Please define PIWIK_URL and PIWIK_SITEID in the plugin administration page.'); 25 'Please define PIWIK_URL and PIWIK_SITEID in the plugin administration page.');
25 return array($error); 26 return [$error];
26 } 27 }
27} 28}
28 29
diff --git a/plugins/playvideos/playvideos.php b/plugins/playvideos/playvideos.php
index 91a9c1e5..4f874f92 100644
--- a/plugins/playvideos/playvideos.php
+++ b/plugins/playvideos/playvideos.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2
2/** 3/**
3 * Plugin PlayVideos 4 * Plugin PlayVideos
4 * 5 *
@@ -19,14 +20,14 @@ use Shaarli\Render\TemplatePage;
19function hook_playvideos_render_header($data) 20function hook_playvideos_render_header($data)
20{ 21{
21 if ($data['_PAGE_'] == TemplatePage::LINKLIST) { 22 if ($data['_PAGE_'] == TemplatePage::LINKLIST) {
22 $playvideo = array( 23 $playvideo = [
23 'attr' => array( 24 'attr' => [
24 'href' => '#', 25 'href' => '#',
25 'title' => t('Video player'), 26 'title' => t('Video player'),
26 'id' => 'playvideos', 27 'id' => 'playvideos',
27 ), 28 ],
28 'html' => '► '. t('Play Videos') 29 'html' => '► ' . t('Play Videos')
29 ); 30 ];
30 $data['buttons_toolbar'][] = $playvideo; 31 $data['buttons_toolbar'][] = $playvideo;
31 } 32 }
32 33
diff --git a/plugins/pubsubhubbub/pubsubhubbub.php b/plugins/pubsubhubbub/pubsubhubbub.php
index 8fe6799c..299b84fb 100644
--- a/plugins/pubsubhubbub/pubsubhubbub.php
+++ b/plugins/pubsubhubbub/pubsubhubbub.php
@@ -42,7 +42,7 @@ function pubsubhubbub_init($conf)
42function hook_pubsubhubbub_render_feed($data, $conf) 42function hook_pubsubhubbub_render_feed($data, $conf)
43{ 43{
44 $feedType = $data['_PAGE_'] == TemplatePage::FEED_RSS ? FeedBuilder::$FEED_RSS : FeedBuilder::$FEED_ATOM; 44 $feedType = $data['_PAGE_'] == TemplatePage::FEED_RSS ? FeedBuilder::$FEED_RSS : FeedBuilder::$FEED_ATOM;
45 $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/pubsubhubbub/hub.'. $feedType .'.xml'); 45 $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/pubsubhubbub/hub.' . $feedType . '.xml');
46 $data['feed_plugins_header'][] = sprintf($template, $conf->get('plugins.PUBSUBHUB_URL')); 46 $data['feed_plugins_header'][] = sprintf($template, $conf->get('plugins.PUBSUBHUB_URL'));
47 47
48 return $data; 48 return $data;
@@ -59,10 +59,10 @@ function hook_pubsubhubbub_render_feed($data, $conf)
59 */ 59 */
60function hook_pubsubhubbub_save_link($data, $conf) 60function hook_pubsubhubbub_save_link($data, $conf)
61{ 61{
62 $feeds = array( 62 $feeds = [
63 index_url($_SERVER) .'feed/atom', 63 index_url($_SERVER) . 'feed/atom',
64 index_url($_SERVER) .'feed/rss', 64 index_url($_SERVER) . 'feed/rss',
65 ); 65 ];
66 66
67 $httpPost = function_exists('curl_version') ? false : 'nocurl_http_post'; 67 $httpPost = function_exists('curl_version') ? false : 'nocurl_http_post';
68 try { 68 try {
@@ -87,11 +87,11 @@ function hook_pubsubhubbub_save_link($data, $conf)
87 */ 87 */
88function nocurl_http_post($url, $postString) 88function nocurl_http_post($url, $postString)
89{ 89{
90 $params = array('http' => array( 90 $params = ['http' => [
91 'method' => 'POST', 91 'method' => 'POST',
92 'content' => $postString, 92 'content' => $postString,
93 'user_agent' => 'PubSubHubbub-Publisher-PHP/1.0', 93 'user_agent' => 'PubSubHubbub-Publisher-PHP/1.0',
94 )); 94 ]];
95 95
96 $context = stream_context_create($params); 96 $context = stream_context_create($params);
97 $fp = @fopen($url, 'rb', false, $context); 97 $fp = @fopen($url, 'rb', false, $context);
diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php
index 24fd18ba..2ae10476 100644
--- a/plugins/qrcode/qrcode.php
+++ b/plugins/qrcode/qrcode.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2
2/** 3/**
3 * Plugin qrcode 4 * Plugin qrcode
4 * Add QRCode containing URL for each links. 5 * Add QRCode containing URL for each links.
diff --git a/plugins/wallabag/WallabagInstance.php b/plugins/wallabag/WallabagInstance.php
index f4a0a92b..88f84ae3 100644
--- a/plugins/wallabag/WallabagInstance.php
+++ b/plugins/wallabag/WallabagInstance.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2
2namespace Shaarli\Plugin\Wallabag; 3namespace Shaarli\Plugin\Wallabag;
3 4
4/** 5/**
@@ -11,20 +12,20 @@ class WallabagInstance
11 * - key: version ID, must match plugin settings. 12 * - key: version ID, must match plugin settings.
12 * - value: version name. 13 * - value: version name.
13 */ 14 */
14 private static $wallabagVersions = array( 15 private static $wallabagVersions = [
15 1 => '1.x', 16 1 => '1.x',
16 2 => '2.x', 17 2 => '2.x',
17 ); 18 ];
18 19
19 /** 20 /**
20 * @var array Static reference to WB endpoint according to the API version. 21 * @var array Static reference to WB endpoint according to the API version.
21 * - key: version name. 22 * - key: version name.
22 * - value: endpoint. 23 * - value: endpoint.
23 */ 24 */
24 private static $wallabagEndpoints = array( 25 private static $wallabagEndpoints = [
25 '1.x' => '?plainurl=', 26 '1.x' => '?plainurl=',
26 '2.x' => 'bookmarklet?url=', 27 '2.x' => 'bookmarklet?url=',
27 ); 28 ];
28 29
29 /** 30 /**
30 * @var string Wallabag user instance URL. 31 * @var string Wallabag user instance URL.
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php
index d0df3501..f2003cb9 100644
--- a/plugins/wallabag/wallabag.php
+++ b/plugins/wallabag/wallabag.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2
2/** 3/**
3 * Wallabag plugin 4 * Wallabag plugin
4 */ 5 */
@@ -18,10 +19,11 @@ function wallabag_init($conf)
18{ 19{
19 $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); 20 $wallabagUrl = $conf->get('plugins.WALLABAG_URL');
20 if (empty($wallabagUrl)) { 21 if (empty($wallabagUrl)) {
21 $error = t('Wallabag plugin error: '. 22 $error = t('Wallabag plugin error: ' .
22 'Please define the "WALLABAG_URL" setting in the plugin administration page.'); 23 'Please define the "WALLABAG_URL" setting in the plugin administration page.');
23 return array($error); 24 return [$error];
24 } 25 }
26 $conf->setEmpty('plugins.WALLABAG_URL', '2');
25} 27}
26 28
27/** 29/**
@@ -35,7 +37,7 @@ function wallabag_init($conf)
35function hook_wallabag_render_linklist($data, $conf) 37function hook_wallabag_render_linklist($data, $conf)
36{ 38{
37 $wallabagUrl = $conf->get('plugins.WALLABAG_URL'); 39 $wallabagUrl = $conf->get('plugins.WALLABAG_URL');
38 if (empty($wallabagUrl)) { 40 if (empty($wallabagUrl) || !$data['_LOGGEDIN_']) {
39 return $data; 41 return $data;
40 } 42 }
41 43
@@ -51,7 +53,7 @@ function hook_wallabag_render_linklist($data, $conf)
51 $wallabag = sprintf( 53 $wallabag = sprintf(
52 $wallabagHtml, 54 $wallabagHtml,
53 $wallabagInstance->getWallabagUrl(), 55 $wallabagInstance->getWallabagUrl(),
54 urlencode($value['url']), 56 urlencode(unescape($value['url'])),
55 $path, 57 $path,
56 $linkTitle 58 $linkTitle
57 ); 59 );