|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class SocialSettings extends CiiSettingsModel |
|
|
|
|
|
|
4
|
|
|
{ |
|
5
|
|
|
protected $ha_twitter_enabled = false; |
|
6
|
|
|
protected $ha_twitter_key = NULL; |
|
7
|
|
|
protected $ha_twitter_secret = NULL; |
|
8
|
|
|
protected $ha_twitter_accessToken = NULL; |
|
9
|
|
|
protected $ha_twitter_accessTokenSecret = NULL; |
|
10
|
|
|
|
|
11
|
|
|
protected $ha_facebook_enabled = false; |
|
12
|
|
|
protected $ha_facebook_id = NULL; |
|
13
|
|
|
protected $ha_facebook_secret = NULL; |
|
14
|
|
|
protected $ha_facebook_scope = NULL; |
|
15
|
|
|
|
|
16
|
|
|
protected $ha_google_enabled = false; |
|
17
|
|
|
protected $ha_google_id = NULL; |
|
18
|
|
|
protected $ha_google_secret = NULL; |
|
19
|
|
|
protected $ha_google_scope = NULL; |
|
20
|
|
|
protected $google_plus_public_server_key = NULL; |
|
21
|
|
|
|
|
22
|
|
|
protected $ha_linkedin_enabled = false; |
|
23
|
|
|
protected $ha_linkedin_key = NULL; |
|
24
|
|
|
protected $ha_linkedin_secret = NULL; |
|
25
|
|
|
|
|
26
|
|
|
protected $addThisPublisherID = null; |
|
27
|
|
|
|
|
28
|
|
|
public function groups() |
|
29
|
|
|
{ |
|
30
|
|
|
return array( |
|
31
|
|
|
Yii::t('ciims.models.social', 'Twitter') => array('ha_twitter_enabled', 'ha_twitter_key', 'ha_twitter_secret', 'ha_twitter_accessToken', 'ha_twitter_accessTokenSecret'), |
|
32
|
|
|
Yii::t('ciims.models.social', 'Facebook') => array('ha_facebook_enabled', 'ha_facebook_id', 'ha_facebook_secret', 'ha_facebook_scope'), |
|
33
|
|
|
Yii::t('ciims.models.social', 'Google+') => array('ha_google_enabled', 'ha_google_id', 'ha_google_secret', 'ha_google_scope', 'google_plus_public_server_key'), |
|
34
|
|
|
Yii::t('ciims.models.social', 'LinkedIn') => array('ha_linkedin_enabled', 'ha_linkedin_key', 'ha_linkedin_secret'), |
|
35
|
|
|
Yii::t('ciims.models.social', 'AddThis') => array('addThisPublisherID') |
|
36
|
|
|
); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function rules() |
|
40
|
|
|
{ |
|
41
|
|
|
return array( |
|
42
|
|
|
array('ha_twitter_key, ha_twitter_secret, ha_twitter_accessToken, ha_twitter_accessToken, ha_twitter_accessTokenSecret', 'length', 'max' => 255), |
|
43
|
|
|
array('ha_facebook_id, ha_facebook_secret', 'length', 'max' => 255), |
|
44
|
|
|
array('ha_google_id, ha_google_secret, google_plus_public_server_key', 'length', 'max' => 255), |
|
45
|
|
|
array('ha_linkedin_key, ha_linkedin_secret', 'length', 'max' => 255), |
|
46
|
|
|
array('ha_twitter_enabled, ha_facebook_enabled, ha_google_enabled, ha_linkedin_enabled', 'boolean'), |
|
47
|
|
|
array('addThisPublisherID', 'length', 'max' => 255) |
|
48
|
|
|
); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function attributeLabels() |
|
52
|
|
|
{ |
|
53
|
|
|
return array( |
|
54
|
|
|
'ha_twitter_enabled' => Yii::t('ciims.models.social', 'Social Auth'), |
|
55
|
|
|
'ha_twitter_key' => Yii::t('ciims.models.social', 'Consumer Key'), |
|
56
|
|
|
'ha_twitter_secret' => Yii::t('ciims.models.social', 'Consumer Secret'), |
|
57
|
|
|
'ha_twitter_accessToken' => Yii::t('ciims.models.social', 'Access Token'), |
|
58
|
|
|
'ha_twitter_accessTokenSecret' => Yii::t('ciims.models.social', 'Access Token Secret'), |
|
59
|
|
|
|
|
60
|
|
|
'ha_facebook_enabled' => Yii::t('ciims.models.social', 'Social Auth'), |
|
61
|
|
|
'ha_facebook_id' => Yii::t('ciims.models.social', 'App ID'), |
|
62
|
|
|
'ha_facebook_secret' => Yii::t('ciims.models.social', 'App Secret'), |
|
63
|
|
|
'ha_facebook_scope' => Yii::t('ciims.models.social', 'Scope'), |
|
64
|
|
|
|
|
65
|
|
|
'ha_google_enabled' => Yii::t('ciims.models.social', 'Social Auth'), |
|
66
|
|
|
'ha_google_id' => Yii::t('ciims.models.social', 'Client ID'), |
|
67
|
|
|
'ha_google_secret' => Yii::t('ciims.models.social', 'Client Secret'), |
|
68
|
|
|
'ha_google_scope' => Yii::t('ciims.models.social', 'Scope'), |
|
69
|
|
|
'google_plus_public_server_key' => Yii::t('ciims.models.social', 'Public Server API Key'), |
|
70
|
|
|
|
|
71
|
|
|
'ha_linkedin_enabled' => Yii::t('ciims.models.social', 'Social Auth'), |
|
72
|
|
|
'ha_linkedin_key' => Yii::t('ciims.models.social', 'Consumer Key'), |
|
73
|
|
|
'ha_linkedin_secret' => Yii::t('ciims.models.social', 'Consumer Secret'), |
|
74
|
|
|
|
|
75
|
|
|
'addThisPublisherID' => Yii::t('ciims.models.social', 'AddThis Publisher ID') |
|
76
|
|
|
); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function afterSave() |
|
80
|
|
|
{ |
|
81
|
|
|
Yii::app()->cache->set('hybridauth_providers', false); |
|
82
|
|
|
Cii::getHybridAuthProviders(); |
|
83
|
|
|
|
|
84
|
|
|
return parent::afterSave(); |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.