-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLinkResourcePlugin.php
54 lines (47 loc) · 1.45 KB
/
LinkResourcePlugin.php
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* linkResource
*
* @copyright Copyright 2018 Eric C. Weig
* @license http://opensource.org/licenses/MIT MIT
*/
/**
* The LinkResource plugin.
*
* @package Omeka\Plugins\LinkResource
*/
class LinkResourcePlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_filters = array(
'linkResource' => array('Display', 'Item', 'Links', 'Linked Resource'),
'projlinkResource' => array('Display', 'Collection', 'Links', 'Linked Resource'),
);
public function linkResource($text, $args) {
return $this->_linkField($text, $args);
}
public function projlinkResource($text, $args) {
return $this->_projlinkField($text, $args);
}
public function _linkField($text, $args) {
$find = "|";
$pos = strpos($text, $find);
if ($pos != false) {
$parts = explode("|", $text);
$spacer = " ";
return "<span class=\"reslinks\">$parts[0]: <a href=\"" . $parts[1] . "\" target=\"_blank\">$parts[1]</a></span>";
} else {
return $text;
}
}
public function _projlinkField($text, $args) {
$find = "|";
$pos = strpos($text, $find);
if ($pos != false) {
$parts = explode("|", $text);
$spacer = " ";
return "<span class=\"reslinks\">$parts[0]: <a href=\"" . $parts[1] . "\" target=\"_blank\">$parts[1]</a></span>";
}else {
return $text;
}
}
}