aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/isso/isso.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-08-14 13:39:31 +0200
committerArthurHoaro <arthur@hoa.ro>2018-08-14 13:39:31 +0200
commit0e54e1059f3c3aa353a448567a9314ad694abbe1 (patch)
treedebd575b20c5abf7e26f27dabf73df5d5c9379c5 /plugins/isso/isso.php
parentf28b73b21f705102f8536cd16ea28122aa870e49 (diff)
downloadShaarli-0e54e1059f3c3aa353a448567a9314ad694abbe1.tar.gz
Shaarli-0e54e1059f3c3aa353a448567a9314ad694abbe1.tar.zst
Shaarli-0e54e1059f3c3aa353a448567a9314ad694abbe1.zip
Isso plugin: add an icon in linklist if enabled
Fixes #1075
Diffstat (limited to 'plugins/isso/isso.php')
-rw-r--r--plugins/isso/isso.php31
1 files changed, 29 insertions, 2 deletions
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php
index 5bc1cce2..378c11af 100644
--- a/plugins/isso/isso.php
+++ b/plugins/isso/isso.php
@@ -46,9 +46,36 @@ function hook_isso_render_linklist($data, $conf)
46 46
47 $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']); 47 $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']);
48 $data['plugin_end_zone'][] = $isso; 48 $data['plugin_end_zone'][] = $isso;
49 } else {
50 $button = '<span><a href="?%s#isso-thread">';
51 // For the default theme we use a FontAwesome icon which is better than an image
52 if ($conf->get('resource.theme') === 'default') {
53 $button .= '<i class="linklist-plugin-icon fa fa-comment"></i>';
54 } else {
55 $button .= '<img class="linklist-plugin-icon" src="plugins/isso/comment.png" ';
56 $button .= 'title="Comment on this shaare" alt="Comments" />';
57 }
58 $button .= '</a></span>';
59 foreach ($data['links'] as &$value) {
60 $commentLink = sprintf($button, $value['shorturl']);
61 $value['link_plugin'][] = $commentLink;
62 }
63 }
49 64
50 // Hackish way to include this CSS file only when necessary. 65 return $data;
51 $data['plugins_includes']['css_files'][] = PluginManager::$PLUGINS_PATH . '/isso/isso.css'; 66}
67
68/**
69 * When linklist is displayed, include isso CSS file.
70 *
71 * @param array $data - header data.
72 *
73 * @return mixed - header data with isso CSS file added.
74 */
75function hook_isso_render_includes($data)
76{
77 if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) {
78 $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/isso/isso.css';
52 } 79 }
53 80
54 return $data; 81 return $data;