7 use Shaarli\Config\ConfigManager
;
11 * Display an error everywhere if the plugin is enabled without configuration.
13 * @param $conf ConfigManager instance
15 * @return mixed - linklist data with Isso plugin.
17 function isso_init($conf)
19 $issoUrl = $conf->get('plugins.ISSO_SERVER');
20 if (empty($issoUrl)) {
21 $error = t('Isso plugin error: '.
22 'Please define the "ISSO_SERVER" setting in the plugin administration page.');
28 * Render linklist hook.
29 * Will only display Isso comments on permalinks.
31 * @param $data array List of links
32 * @param $conf ConfigManager instance
34 * @return mixed - linklist data with Isso plugin.
36 function hook_isso_render_linklist($data, $conf)
38 $issoUrl = $conf->get('plugins.ISSO_SERVER');
39 if (empty($issoUrl)) {
43 // Only display comments for permalinks.
44 if (count($data['links']) == 1 && empty($data['search_tags']) && empty($data['search_term'])) {
45 $link = reset($data['links']);
46 $issoHtml = file_get_contents(PluginManager
::$PLUGINS_PATH . '/isso/isso.html');
48 $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']);
49 $data['plugin_end_zone'][] = $isso;
51 $button = '<span><a href="?%s#isso-thread">';
52 // For the default theme we use a FontAwesome icon which is better than an image
53 if ($conf->get('resource.theme') === 'default') {
54 $button .= '<i class="linklist-plugin-icon fa fa-comment"></i>';
56 $button .= '<img class="linklist-plugin-icon" src="plugins/isso/comment.png" ';
57 $button .= 'title="Comment on this shaare" alt="Comments" />';
59 $button .= '</a></span>';
60 foreach ($data['links'] as &$value) {
61 $commentLink = sprintf($button, $value['shorturl']);
62 $value['link_plugin'][] = $commentLink;
70 * When linklist is displayed, include isso CSS file.
72 * @param array $data - header data.
74 * @return mixed - header data with isso CSS file added.
76 function hook_isso_render_includes($data)
78 if ($data['_PAGE_'] == Router
::$PAGE_LINKLIST) {
79 $data['css_files'][] = PluginManager
::$PLUGINS_PATH . '/isso/isso.css';
86 * This function is never called, but contains translation calls for GNU gettext extraction.
88 function isso_dummy_translation()
91 t('Let visitor comment your shaares on permalinks with Isso.');
92 t('Isso server URL (without \'http://\')');