diff options
Diffstat (limited to 'plugins/isso')
-rw-r--r-- | plugins/isso/comment.png | bin | 0 -> 277 bytes | |||
-rw-r--r-- | plugins/isso/isso.php | 33 | ||||
-rw-r--r-- | plugins/isso/isso_button.html | 5 |
3 files changed, 36 insertions, 2 deletions
diff --git a/plugins/isso/comment.png b/plugins/isso/comment.png new file mode 100644 index 00000000..0158c03b --- /dev/null +++ b/plugins/isso/comment.png | |||
Binary files differ | |||
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php index 5bc1cce2..dab75dd5 100644 --- a/plugins/isso/isso.php +++ b/plugins/isso/isso.php | |||
@@ -5,6 +5,8 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | use Shaarli\Config\ConfigManager; | 7 | use Shaarli\Config\ConfigManager; |
8 | use Shaarli\Plugin\PluginManager; | ||
9 | use Shaarli\Router; | ||
8 | 10 | ||
9 | /** | 11 | /** |
10 | * Display an error everywhere if the plugin is enabled without configuration. | 12 | * Display an error everywhere if the plugin is enabled without configuration. |
@@ -46,9 +48,36 @@ function hook_isso_render_linklist($data, $conf) | |||
46 | 48 | ||
47 | $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']); | 49 | $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']); |
48 | $data['plugin_end_zone'][] = $isso; | 50 | $data['plugin_end_zone'][] = $isso; |
51 | } else { | ||
52 | $button = '<span><a href="?%s#isso-thread">'; | ||
53 | // For the default theme we use a FontAwesome icon which is better than an image | ||
54 | if ($conf->get('resource.theme') === 'default') { | ||
55 | $button .= '<i class="linklist-plugin-icon fa fa-comment"></i>'; | ||
56 | } else { | ||
57 | $button .= '<img class="linklist-plugin-icon" src="plugins/isso/comment.png" '; | ||
58 | $button .= 'title="Comment on this shaare" alt="Comments" />'; | ||
59 | } | ||
60 | $button .= '</a></span>'; | ||
61 | foreach ($data['links'] as &$value) { | ||
62 | $commentLink = sprintf($button, $value['shorturl']); | ||
63 | $value['link_plugin'][] = $commentLink; | ||
64 | } | ||
65 | } | ||
49 | 66 | ||
50 | // Hackish way to include this CSS file only when necessary. | 67 | return $data; |
51 | $data['plugins_includes']['css_files'][] = PluginManager::$PLUGINS_PATH . '/isso/isso.css'; | 68 | } |
69 | |||
70 | /** | ||
71 | * When linklist is displayed, include isso CSS file. | ||
72 | * | ||
73 | * @param array $data - header data. | ||
74 | * | ||
75 | * @return mixed - header data with isso CSS file added. | ||
76 | */ | ||
77 | function hook_isso_render_includes($data) | ||
78 | { | ||
79 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { | ||
80 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/isso/isso.css'; | ||
52 | } | 81 | } |
53 | 82 | ||
54 | return $data; | 83 | return $data; |
diff --git a/plugins/isso/isso_button.html b/plugins/isso/isso_button.html new file mode 100644 index 00000000..3f828480 --- /dev/null +++ b/plugins/isso/isso_button.html | |||
@@ -0,0 +1,5 @@ | |||
1 | <span> | ||
2 | <a href="?%s#isso-thread"> | ||
3 | <img class="linklist-plugin-icon" src="plugins/archiveorg/internetarchive.png" title="%s" alt="archive.org" /> | ||
4 | </a> | ||
5 | </span> | ||