X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=plugins%2Fisso%2Fisso.php;h=a54509892e999eff7517d0c0ff2cc77aee7d0ecd;hb=53054b2bf6a919fd4ff9b44b6ad1986f21f488b6;hp=ffb7cfacd5dff8cea437ec925f2b683cc452693f;hpb=bf26e7ebcb5ee69523b93a5ec7b7a65b39acb916;p=github%2Fshaarli%2FShaarli.git diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php index ffb7cfac..a5450989 100644 --- a/plugins/isso/isso.php +++ b/plugins/isso/isso.php @@ -4,10 +4,13 @@ * Plugin Isso. */ +use Shaarli\Config\ConfigManager; +use Shaarli\Plugin\PluginManager; +use Shaarli\Render\TemplatePage; + /** * Display an error everywhere if the plugin is enabled without configuration. * - * @param $data array List of links * @param $conf ConfigManager instance * * @return mixed - linklist data with Isso plugin. @@ -16,9 +19,9 @@ function isso_init($conf) { $issoUrl = $conf->get('plugins.ISSO_SERVER'); if (empty($issoUrl)) { - $error = 'Isso plugin error: '. - 'Please define the "ISSO_SERVER" setting in the plugin administration page.'; - return array($error); + $error = t('Isso plugin error: ' . + 'Please define the "ISSO_SERVER" setting in the plugin administration page.'); + return [$error]; } } @@ -41,14 +44,51 @@ function hook_isso_render_linklist($data, $conf) // Only display comments for permalinks. if (count($data['links']) == 1 && empty($data['search_tags']) && empty($data['search_term'])) { $link = reset($data['links']); - $isso_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/isso/isso.html'); + $issoHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/isso/isso.html'); - $isso = sprintf($isso_html, $issoUrl, $issoUrl, $link['linkdate'], $link['linkdate']); + $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']); $data['plugin_end_zone'][] = $isso; + } else { + $button = ''; + // For the default theme we use a FontAwesome icon which is better than an image + if ($conf->get('resource.theme') === 'default') { + $button .= ''; + } else { + $button .= '