]>
Commit | Line | Data |
---|---|---|
b7b9dbb0 | 1 | <?php |
9a364c28 A |
2 | /** |
3 | * Plugin Archive.org. | |
4 | * | |
5 | * Add an icon in the link list for archive.org. | |
6 | */ | |
b7b9dbb0 A |
7 | |
8 | /** | |
9 | * Add archive.org icon to link_plugin when rendering linklist. | |
10 | * | |
9a364c28 A |
11 | * @param mixed $data - linklist data. |
12 | * | |
b7b9dbb0 A |
13 | * @return mixed - linklist data with archive.org plugin. |
14 | */ | |
9a364c28 A |
15 | function hook_archiveorg_render_linklist($data) |
16 | { | |
b7b9dbb0 A |
17 | $archive_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/archiveorg/archiveorg.html'); |
18 | ||
19 | foreach ($data['links'] as &$value) { | |
5e148f8a T |
20 | if($value['private'] && preg_match('/^\?[a-zA-Z0-9-_@]{6}($|&|#)/', $value['real_url'])) { |
21 | continue; | |
22 | } | |
12266213 | 23 | $archive = sprintf($archive_html, $value['url'], t('View on archive.org')); |
b7b9dbb0 A |
24 | $value['link_plugin'][] = $archive; |
25 | } | |
26 | ||
27 | return $data; | |
28 | } | |
12266213 A |
29 | |
30 | /** | |
31 | * This function is never called, but contains translation calls for GNU gettext extraction. | |
32 | */ | |
33 | function archiveorg_dummy_translation() | |
34 | { | |
35 | // meta | |
36 | t('For each link, add an Archive.org icon.'); | |
37 | } |