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.php12
-rw-r--r--plugins/demo_plugin/demo_plugin.php45
-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.php5
11 files changed, 68 insertions, 61 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..574a0bd4 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 }
@@ -56,7 +56,7 @@ function default_colors_init($conf)
56function hook_default_colors_render_includes($data) 56function hook_default_colors_render_includes($data)
57{ 57{
58 $file = PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css'; 58 $file = PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css';
59 if (file_exists($file )) { 59 if (file_exists($file)) {
60 $data['css_files'][] = $file ; 60 $data['css_files'][] = $file ;
61 } 61 }
62 62
@@ -75,7 +75,7 @@ function default_colors_generate_css_file($params): void
75 $content = ''; 75 $content = '';
76 foreach (DEFAULT_COLORS_PLACEHOLDERS as $rule) { 76 foreach (DEFAULT_COLORS_PLACEHOLDERS as $rule) {
77 $content .= !empty($params[$rule]) 77 $content .= !empty($params[$rule])
78 ? default_colors_format_css_rule($params, $rule) .';'. PHP_EOL 78 ? default_colors_format_css_rule($params, $rule) . ';' . PHP_EOL
79 : ''; 79 : '';
80 } 80 }
81 81
@@ -99,8 +99,8 @@ function default_colors_format_css_rule($data, $parameter)
99 } 99 }
100 100
101 $key = str_replace('DEFAULT_COLORS_', '', $parameter); 101 $key = str_replace('DEFAULT_COLORS_', '', $parameter);
102 $key = str_replace('_', '-', strtolower($key)) .'-color'; 102 $key = str_replace('_', '-', strtolower($key)) . '-color';
103 return ' --'. $key .': '. $data[$parameter]; 103 return ' --' . $key . ': ' . $data[$parameter];
104} 104}
105 105
106 106
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php
index defb01f7..22d27b68 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 *
@@ -82,14 +83,14 @@ function hook_demo_plugin_render_header($data)
82 * A link is an array of its attributes (key="value"), 83 * A link is an array of its attributes (key="value"),
83 * and a mandatory `html` key, which contains its value. 84 * and a mandatory `html` key, which contains its value.
84 */ 85 */
85 $button = array( 86 $button = [
86 'attr' => array ( 87 'attr' => [
87 'href' => '#', 88 'href' => '#',
88 'class' => 'mybutton', 89 'class' => 'mybutton',
89 'title' => 'hover me', 90 'title' => 'hover me',
90 ), 91 ],
91 'html' => 'DEMO buttons toolbar', 92 'html' => 'DEMO buttons toolbar',
92 ); 93 ];
93 $data['buttons_toolbar'][] = $button; 94 $data['buttons_toolbar'][] = $button;
94 } 95 }
95 96
@@ -115,29 +116,29 @@ function hook_demo_plugin_render_header($data)
115 * <input input-2-attribute-1="input 2 attribute 1 value"> 116 * <input input-2-attribute-1="input 2 attribute 1 value">
116 * </form> 117 * </form>
117 */ 118 */
118 $form = array( 119 $form = [
119 'attr' => array( 120 'attr' => [
120 'method' => 'GET', 121 'method' => 'GET',
121 'action' => $data['_BASE_PATH_'] . '/', 122 'action' => $data['_BASE_PATH_'] . '/',
122 'class' => 'addform', 123 'class' => 'addform',
123 ), 124 ],
124 'inputs' => array( 125 'inputs' => [
125 array( 126 [
126 'type' => 'text', 127 'type' => 'text',
127 'name' => 'demo', 128 'name' => 'demo',
128 'placeholder' => 'demo', 129 'placeholder' => 'demo',
129 ) 130 ]
130 ) 131 ]
131 ); 132 ];
132 $data['fields_toolbar'][] = $form; 133 $data['fields_toolbar'][] = $form;
133 } 134 }
134 // Another button always displayed 135 // Another button always displayed
135 $button = array( 136 $button = [
136 'attr' => array( 137 'attr' => [
137 'href' => '#', 138 'href' => '#',
138 ), 139 ],
139 'html' => 'Demo', 140 'html' => 'Demo',
140 ); 141 ];
141 $data['buttons_toolbar'][] = $button; 142 $data['buttons_toolbar'][] = $button;
142 143
143 return $data; 144 return $data;
@@ -187,7 +188,7 @@ function hook_demo_plugin_render_includes($data)
187function hook_demo_plugin_render_footer($data) 188function hook_demo_plugin_render_footer($data)
188{ 189{
189 // Footer text 190 // Footer text
190 $data['text'][] = '<br>'. demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.'); 191 $data['text'][] = '<br>' . demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.');
191 192
192 // Free elements at the end of the page. 193 // Free elements at the end of the page.
193 $data['endofpage'][] = '<marquee id="demo_marquee">' . 194 $data['endofpage'][] = '<marquee id="demo_marquee">' .
@@ -229,13 +230,13 @@ function hook_demo_plugin_render_linklist($data)
229 * and a mandatory `html` key, which contains its value. 230 * and a mandatory `html` key, which contains its value.
230 * It's also recommended to add key 'on' or 'off' for theme rendering. 231 * It's also recommended to add key 'on' or 'off' for theme rendering.
231 */ 232 */
232 $action = array( 233 $action = [
233 'attr' => array( 234 'attr' => [
234 'href' => '?up', 235 'href' => '?up',
235 'title' => 'Uppercase!', 236 'title' => 'Uppercase!',
236 ), 237 ],
237 'html' => '←', 238 'html' => '←',
238 ); 239 ];
239 240
240 if (isset($_GET['up'])) { 241 if (isset($_GET['up'])) {
241 // Manipulate link data 242 // Manipulate link data
@@ -275,7 +276,7 @@ function hook_demo_plugin_render_linklist($data)
275function hook_demo_plugin_render_editlink($data) 276function hook_demo_plugin_render_editlink($data)
276{ 277{
277 // Load HTML into a string 278 // Load HTML into a string
278 $html = file_get_contents(PluginManager::$PLUGINS_PATH .'/demo_plugin/field.html'); 279 $html = file_get_contents(PluginManager::$PLUGINS_PATH . '/demo_plugin/field.html');
279 280
280 // Replace value in HTML if it exists in $data 281 // Replace value in HTML if it exists in $data
281 if (!empty($data['link']['stuff'])) { 282 if (!empty($data['link']['stuff'])) {
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 8cd3f4ad..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,9 +19,9 @@ 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 }
25 $conf->setEmpty('plugins.WALLABAG_URL', '2'); 26 $conf->setEmpty('plugins.WALLABAG_URL', '2');
26} 27}