This repository has been archived by the owner on Aug 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.driver.php
62 lines (45 loc) · 1.74 KB
/
extension.driver.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
<?php
if(!defined("__IN_SYMPHONY__")) die("<h2>Error</h2><p>You cannot directly access this file</p>");
Class extension_ab_split_test extends Extension{
private $_Path;
public function getSubscribedDelegates() {
return array(
array(
'page' => '/system/preferences/',
'delegate' => 'AddCustomPreferenceFieldsets',
'callback' => 'appendPreferences'
)
);
}
function install() {
Symphony::Configuration()->set('testid',substr(md5(time()), 0, 5),'ab');
Administration::instance()->saveConfig();
return true;
}
public function uninstall(){
Symphony::Configuration()->remove('ab');
Administration::instance()->saveConfig();
}
public function appendPreferences($context){
if(isset($_POST['action']['ab-reset'])){
$this->__SavePreferences($context);
}
$group = new XMLElement('fieldset');
$group->setAttribute('class', 'settings');
$group->appendChild(new XMLElement('legend', __('A/B Split Test')));
$div = new XMLElement('div', NULL, array('id' => 'file-actions', 'class' => 'label'));
$para = new XMLElement('p');
$span = new XMLElement('span');
$span->appendChild(new XMLElement('button', __('Reset assigns'), array('name' => 'action[ab-reset]', 'type' => 'submit')));
$para->appendChild($span);
$div->appendChild($para);
$div->appendChild(new XMLElement('p', __('Resets A/B group assigns for a new test.'), array('class' => 'help')));
$group->appendChild($div);
$context['wrapper']->appendChild($group);
unset($context);
}
public function __SavePreferences($context){
Symphony::Configuration()->set('testid',substr(md5(time()), 0, 5),'ab');
Administration::instance()->saveConfig();
}
}