-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSocialShare.php
108 lines (98 loc) · 2.44 KB
/
SocialShare.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
namespace bl\socialShare;
use yii\base\Object;
use bl\socialShare\widgets\SocialShareWidget;
/**
* Component for configuration of social network classes
*
* @author Vladimir Kuprienko <vldmr.kuprienko@gmail.com>
*
* @link https://github.com/black-lamp/yii2-socialshare
* @license https://opensource.org/licenses/GPL-3.0 GNU Public License
*
* @property array $networks
* @property array $attributes
* @property boolean $defaultIcons
* @property boolean $enableSeo
* @property array $seoAttributes
*
* @see SocialShareWidget
*
* Example
* ```php
* 'components' => [
* // ...
* 'socialShare' => [
* 'class' => bl\socialShare\SocialShare::className(),
* 'attributes' => [
* 'class' => 'social-btn' // html class
* ],
* 'networks' => [
* 'facebook' => [
* 'class' => bl\socialShare\classes\Facebook::className(),
* 'label' => 'Facebook'
* ],
* 'twitter' => [
* 'class' => bl\socialShare\classes\Twitter::className(),
* 'label' => 'Twitter',
* // custom option for Twitter class
* 'account' => 'username'
* ],
* // other social networks ...
* ]
* ],
* ]
* ```
*/
class SocialShare extends Object
{
/**
* @var array Configuration social networks classes
*/
public $networks = [];
/**
* @var array HTML attributes for all links
*/
public $attributes = [];
/**
* @var boolean If set `true` for all links will be used font-icons
* instead text labels
*/
public $defaultIcons = false;
/**
* @var boolean If set `true` for all links will be appended
* SEO attributes from $seoAttributes array
*/
public $enableSeo = true;
/**
* @var array of SEO attributes for link
*/
public $seoAttributes = [
'target' => '_blank',
'rel' => 'nofollow'
];
/**
* Getter for $networks
* @return array
*/
public function getNetworks()
{
return $this->networks;
}
/**
* Getter for $attributes
* @return array
*/
public function getAttributes()
{
return $this->attributes;
}
/**
* Getter for $seoAttributes
* @return array
*/
public function getSeoAttributes()
{
return $this->seoAttributes;
}
}