Merge latest 0.12.2
This commit is contained in:
parent
984073a980
commit
23a5fc1eef
232 changed files with 27850 additions and 10113 deletions
plugins/archiveorg
|
@ -1,5 +1,5 @@
|
|||
<span>
|
||||
<a href="https://web.archive.org/web/%s">
|
||||
<img class="linklist-plugin-icon" src="plugins/archiveorg/internetarchive.png" title="%s" alt="archive.org" />
|
||||
<img class="linklist-plugin-icon" src="%s/archiveorg/internetarchive.png" title="%s" alt="archive.org" />
|
||||
</a>
|
||||
</span>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Plugin Archive.org.
|
||||
*
|
||||
|
@ -17,12 +18,15 @@ use Shaarli\Plugin\PluginManager;
|
|||
function hook_archiveorg_render_linklist($data)
|
||||
{
|
||||
$archive_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/archiveorg/archiveorg.html');
|
||||
$path = ($data['_ROOT_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'], 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue