/
Service.php
57 lines (49 loc) · 1.15 KB
/
Service.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
55
56
57
<?php
namespace Concrete\Core\Sharing\SocialNetwork;
class Service
{
protected $ssHandle;
protected $ssName;
protected $ssIcon;
protected $customHTML;
public function __construct($ssHandle, $ssName, $ssIcon, $customHTML = null)
{
$this->ssHandle = $ssHandle;
$this->ssName = $ssName;
$this->ssIcon = $ssIcon;
$this->customHTML = $customHTML;
}
public function getHandle()
{
return $this->ssHandle;
}
public function getName()
{
return $this->ssName;
}
public function getDisplayName()
{
return h($this->getName());
}
public function getIcon()
{
return $this->ssIcon;
}
public function getServiceIconHTML()
{
if ($this->customHTML) {
return $this->customHTML;
} else {
return '<i class="fa fa-' . $this->getIcon() . '"></i>';
}
}
public static function getByHandle($ssHandle)
{
$services = ServiceList::get();
foreach ($services as $s) {
if ($s->getHandle() == $ssHandle) {
return $s;
}
}
}
}