-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplugin.php
More file actions
26 lines (22 loc) · 722 Bytes
/
plugin.php
File metadata and controls
26 lines (22 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
/**
* @package Linkify
* @copyright Copyright 2012, John Flatness
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 or any later version
*/
add_filter(array('Display', 'Item', 'Dublin Core', 'Creator'), 'linkify');
add_filter(array('Display', 'Item', 'Dublin Core', 'Subject'), 'linkify');
function linkify($text, $record, $elementText) {
if (trim($text) == '') return $text;
$elementId = $elementText->element_id;
$url = uri('items/browse', array(
'advanced' => array(
array(
'element_id' => $elementId,
'type' => 'is exactly',
'terms' => $text
)
)
));
return "<a href=\"$url\">$text</a>";
}