aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/isso
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2016-10-18 08:14:09 +0200
committerGitHub <noreply@github.com>2016-10-18 08:14:09 +0200
commitc1c21028503f2c05206481b2b0cb7ac8d6c16a71 (patch)
treebe74b08810c6160ab0e85863febd9605201b7ad9 /plugins/isso
parent8406a4b670957b7d0450f6ea5e4f2e61c7114e8f (diff)
parentbf26e7ebcb5ee69523b93a5ec7b7a65b39acb916 (diff)
downloadShaarli-c1c21028503f2c05206481b2b0cb7ac8d6c16a71.tar.gz
Shaarli-c1c21028503f2c05206481b2b0cb7ac8d6c16a71.tar.zst
Shaarli-c1c21028503f2c05206481b2b0cb7ac8d6c16a71.zip
Merge pull request #651 from ArthurHoaro/plugin-isso2
Isso comments plugin
Diffstat (limited to 'plugins/isso')
-rw-r--r--plugins/isso/isso.css3
-rw-r--r--plugins/isso/isso.html14
-rw-r--r--plugins/isso/isso.meta3
-rw-r--r--plugins/isso/isso.php54
4 files changed, 74 insertions, 0 deletions
diff --git a/plugins/isso/isso.css b/plugins/isso/isso.css
new file mode 100644
index 00000000..b89babc3
--- /dev/null
+++ b/plugins/isso/isso.css
@@ -0,0 +1,3 @@
1#isso-thread > h4 {
2 text-align: center;
3}
diff --git a/plugins/isso/isso.html b/plugins/isso/isso.html
new file mode 100644
index 00000000..babab9b8
--- /dev/null
+++ b/plugins/isso/isso.html
@@ -0,0 +1,14 @@
1<script data-isso="//%s"
2 data-isso-css="true"
3 data-isso-lang="en"
4 data-isso-reply-to-self="true"
5 data-isso-max-comments-top="20"
6 data-isso-max-comments-nested="5"
7 data-isso-reveal-on-click="5"
8 data-isso-avatar="true"
9 data-isso-avatar-bg="#f0f0f0"
10 data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..."
11 data-isso-vote="true"
12 src="//%s/js/embed.min.js">
13</script>
14<section id="isso-thread" data-isso-id="%s" data-title="%s"></section>
diff --git a/plugins/isso/isso.meta b/plugins/isso/isso.meta
new file mode 100644
index 00000000..62473abc
--- /dev/null
+++ b/plugins/isso/isso.meta
@@ -0,0 +1,3 @@
1description="Let visitor comment your shaares on permalinks with Isso."
2parameters="ISSO_SERVER"
3parameter.ISSO_SERVER="Isso server URL (without 'http://')"
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php
new file mode 100644
index 00000000..ffb7cfac
--- /dev/null
+++ b/plugins/isso/isso.php
@@ -0,0 +1,54 @@
1<?php
2
3/**
4 * Plugin Isso.
5 */
6
7/**
8 * Display an error everywhere if the plugin is enabled without configuration.
9 *
10 * @param $data array List of links
11 * @param $conf ConfigManager instance
12 *
13 * @return mixed - linklist data with Isso plugin.
14 */
15function isso_init($conf)
16{
17 $issoUrl = $conf->get('plugins.ISSO_SERVER');
18 if (empty($issoUrl)) {
19 $error = 'Isso plugin error: '.
20 'Please define the "ISSO_SERVER" setting in the plugin administration page.';
21 return array($error);
22 }
23}
24
25/**
26 * Render linklist hook.
27 * Will only display Isso comments on permalinks.
28 *
29 * @param $data array List of links
30 * @param $conf ConfigManager instance
31 *
32 * @return mixed - linklist data with Isso plugin.
33 */
34function hook_isso_render_linklist($data, $conf)
35{
36 $issoUrl = $conf->get('plugins.ISSO_SERVER');
37 if (empty($issoUrl)) {
38 return $data;
39 }
40
41 // Only display comments for permalinks.
42 if (count($data['links']) == 1 && empty($data['search_tags']) && empty($data['search_term'])) {
43 $link = reset($data['links']);
44 $isso_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/isso/isso.html');
45
46 $isso = sprintf($isso_html, $issoUrl, $issoUrl, $link['linkdate'], $link['linkdate']);
47 $data['plugin_end_zone'][] = $isso;
48
49 // Hackish way to include this CSS file only when necessary.
50 $data['plugins_includes']['css_files'][] = PluginManager::$PLUGINS_PATH . '/isso/isso.css';
51 }
52
53 return $data;
54}