From 76fe68d924d424283d0a1784c5f5e7582dda3a00 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 22 Sep 2020 12:44:08 +0200 Subject: Fix plugin base path in core plugins Also fix note check in archiveorg plugin, and regression on vintage template. Documentation regarding relative path has been added. Fixes #1548 --- plugins/archiveorg/archiveorg.php | 6 ++++-- plugins/isso/isso.php | 2 +- plugins/qrcode/qrcode.php | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/archiveorg/archiveorg.php b/plugins/archiveorg/archiveorg.php index f26e6129..922b5966 100644 --- a/plugins/archiveorg/archiveorg.php +++ b/plugins/archiveorg/archiveorg.php @@ -20,10 +20,12 @@ function hook_archiveorg_render_linklist($data) $path = ($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; foreach ($data['links'] as &$value) { - if ($value['private'] && preg_match('/^\?[a-zA-Z0-9-_@]{6}($|&|#)/', $value['real_url'])) { + $isNote = startsWith($value['real_url'], '/shaare/'); + if ($value['private'] && $isNote) { continue; } - $archive = sprintf($archive_html, $value['url'], $path, t('View on archive.org')); + $url = $isNote ? rtrim(index_url($_SERVER), '/') . $value['real_url'] : $value['real_url']; + $archive = sprintf($archive_html, $url, $path, t('View on archive.org')); $value['link_plugin'][] = $archive; } diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php index 16edd9a6..79e7380b 100644 --- a/plugins/isso/isso.php +++ b/plugins/isso/isso.php @@ -49,7 +49,7 @@ function hook_isso_render_linklist($data, $conf) $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']); $data['plugin_end_zone'][] = $isso; } else { - $button = ''; + $button = ''; // For the default theme we use a FontAwesome icon which is better than an image if ($conf->get('resource.theme') === 'default') { $button .= ''; diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php index 56ae47b3..95499e39 100644 --- a/plugins/qrcode/qrcode.php +++ b/plugins/qrcode/qrcode.php @@ -42,7 +42,7 @@ function hook_qrcode_render_linklist($data) function hook_qrcode_render_footer($data) { if ($data['_PAGE_'] == TemplatePage::LINKLIST) { - $data['js_files'][] = ($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH . '/qrcode/shaarli-qrcode.js'; + $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/qrcode/shaarli-qrcode.js'; } return $data; @@ -58,7 +58,7 @@ function hook_qrcode_render_footer($data) function hook_qrcode_render_includes($data) { if ($data['_PAGE_'] == TemplatePage::LINKLIST) { - $data['css_files'][] = ($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.css'; + $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.css'; } return $data; -- cgit v1.2.3