-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcontroller.php
64 lines (53 loc) · 1.91 KB
/
controller.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
<?php
defined('C5_EXECUTE') or die('Access Denied.');
Loader::model('single_page');
Loader::model('user_attributes');
class SocialPackage extends Package
{
protected $pkgHandle = 'social';
protected $appVersionRequired = '5.4.2.2';
protected $pkgVersion = '0.9';
public function getPackageDescription()
{
return t("Adds social login and registration.");
}
public function getPackageName()
{
return t("Social");
}
public function install()
{
$pkg = parent::install();
// Add social single page
SinglePage::add('social', $pkg);
// Add dashboard pages.
$d = SinglePage::add('dashboard/social', $pkg);
$d->update(
array(
'cName' => t('Social'),
'cDescription' => t('Configure social networks.'),
)
);
SinglePage::add('dashboard/social/facebook', $pkg);
SinglePage::add('dashboard/social/linkedin', $pkg);
SinglePage::add('dashboard/social/twitter', $pkg);
SinglePage::add('dashboard/social/google', $pkg);
// Add social network attribute keys.
$this->add_user_attribute_key('facebook_id', 'Facebook ID');
$this->add_user_attribute_key('linkedin_id', 'LinkedIn ID');
$this->add_user_attribute_key('twitter_id', 'Twitter ID');
$this->add_user_attribute_key('google_id', 'Google ID');
// Basic fields for profile information.
$this->add_user_attribute_key('first_name', 'First Name');
$this->add_user_attribute_key('last_name', 'Last Name');
}
public function add_user_attribute_key($handle, $name, $type = 'text')
{
$ak = UserAttributeKey::getByHandle($handle);
if (!is_object($ak)) {
UserAttributeKey::add($type, array(
'akHandle' => $handle,
'akName' => t($name), ), $pkg);
}
}
}