/
ServiceList.php
66 lines (59 loc) · 2.41 KB
/
ServiceList.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
58
59
60
61
62
63
64
65
66
<?php
namespace Concrete\Core\Sharing\SocialNetwork;
class ServiceList
{
protected static function getServices()
{
$services = [
['facebook', 'Facebook', 'facebook'],
['twitter', 'Twitter', 'twitter'],
['instagram', 'Instagram', 'instagram'],
['tumblr', 'Tumblr', 'tumblr-square'],
['github', 'Github', 'github-square'],
['dribbble', 'Dribbble', 'dribbble'],
['pinterest', 'Pinterest', 'pinterest'],
['youtube', 'Youtube', 'youtube'],
['linkedin', 'LinkedIn', 'linkedin-square'],
['soundcloud', 'Soundcloud', 'soundcloud'],
['foursquare', 'Foursquare', 'foursquare'],
['flickr', 'Flickr', 'flickr'],
['googleplus', 'Google Plus', 'google-plus-square'],
['reddit', 'Reddit', 'reddit'],
['steam', 'Steam', 'steam'],
['twitch', 'Twitch', 'twitch'],
['vine', 'Vine', 'vine'],
['stumbleupon', 'Stumbleupon', 'stumbleupon'],
['skype', 'Skype', 'skype'],
['vk', 'Vkontakte', 'vk'],
['personal_website', 'Personal Website', 'external-link'],
['email', 'Email', 'envelope'],
['phone', 'Phone', 'phone-square'],
];
// if additional social media services have been defined in custom config, append to built-in list or override
if ($additionalSocialNetworks = \Config::get('concrete.social.additional_services')) {
$serviceArray = [];
$additionalKeyArray = [];
// create arrays to merge using service handle as key, allows for overriding
foreach ($services as $service) {
$serviceArray[$service[0]] = $service;
}
foreach ($additionalSocialNetworks as $service) {
$additionalKeyArray[$service[0]] = $service;
}
$services = array_values(array_merge($additionalKeyArray + $serviceArray));
}
return $services;
}
public static function get()
{
$services = static::getServices();
$return = [];
foreach ($services as $serviceArray) {
$o = new Service($serviceArray[0], $serviceArray[1], $serviceArray[2], isset($serviceArray[3]) ? $serviceArray[3] : null);
if ($o) {
$return[] = $o;
}
}
return $return;
}
}