forked from lewiswharf/mailchimp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension.driver.php
More file actions
77 lines (61 loc) · 2.09 KB
/
extension.driver.php
File metadata and controls
77 lines (61 loc) · 2.09 KB
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
<?php
if(!defined("__IN_SYMPHONY__")) die("<h2>Error</h2><p>You cannot directly access this file</p>");
Class extension_mailchimp extends Extension{
public function uninstall() {
Symphony::Configuration()->remove('mailchimp');
Symphony::Configuration()->write();
}
public function getSubscribedDelegates() {
return array(
array(
'page' => '/system/preferences/',
'delegate' => 'AddCustomPreferenceFieldsets',
'callback' => 'addCustomPreferenceFieldsets'
)
);
}
/*-------------------------------------------------------------------------
Utilities:
-------------------------------------------------------------------------*/
public function getKey() {
return Symphony::Configuration()->get('key', 'mailchimp');
}
public function getList() {
return Symphony::Configuration()->get('list', 'mailchimp');
}
/*-------------------------------------------------------------------------
Delegates:
-------------------------------------------------------------------------*/
public function addCustomPreferenceFieldsets($context) {
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(
new XMLElement('legend', 'Mailchimp')
);
$group = new XMLElement('div');
$group->setAttribute('class', 'group');
$api = Widget::Label('API Key');
$api->appendChild(Widget::Input(
'settings[mailchimp][key]', General::Sanitize($this->getKey())
));
$api->appendChild(
new XMLElement('p', Widget::Anchor(__('Generate your API Key'), 'http://kb.mailchimp.com/article/where-can-i-find-my-api-key'), array(
'class' => 'help'
))
);
$group->appendChild($api);
$list = Widget::Label('Default List ID');
$list->appendChild(Widget::Input(
'settings[mailchimp][list]', General::Sanitize($this->getList())
));
$list->appendChild(
new XMLElement('p', __('Can be overidden from the frontend'), array(
'class' => 'help'
))
);
$group->appendChild($list);
$fieldset->appendChild($group);
$context['wrapper']->appendChild($fieldset);
}
}
?>