aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/isso/isso.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-05-07 19:17:33 +0200
committerArthurHoaro <arthur@hoa.ro>2017-05-07 19:17:33 +0200
commit01e942d44c7194607649817216aeb5d65c6acad6 (patch)
tree15777aa1005251f119e6dd680291147117766b5b /plugins/isso/isso.php
parentbc22c9a0acb095970e9494cbe8954f0612e05dc0 (diff)
parent8868f3ca461011a8fb6dd9f90b60ed697ab52fc5 (diff)
downloadShaarli-01e942d44c7194607649817216aeb5d65c6acad6.tar.gz
Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.tar.zst
Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.zip
Merge tag 'v0.8.4' into stable
Release v0.8.4
Diffstat (limited to 'plugins/isso/isso.php')
-rw-r--r--plugins/isso/isso.php54
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php
new file mode 100644
index 00000000..ce16645f
--- /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 $issoHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/isso/isso.html');
45
46 $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']);
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}