-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.driver.php
executable file
·79 lines (65 loc) · 2.11 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
class Extension_SchemaDevKit extends Extension {
/*-------------------------------------------------------------------------
Definition:
-------------------------------------------------------------------------*/
public static $active = false;
public function about() {
return array(
'name' => 'Schema DevKit',
'version' => '0.9.0',
'release-date' => '2011-08-31',
'author' => array(
'name' => 'Remie Bolte',
'website' => 'http://github.com/remie/schemadevkit',
'email' => 'r.bolte@gmail.com'
)
);
}
public function getSubscribedDelegates() {
return array(
array(
'page' => '/frontend/',
'delegate' => 'FrontendDevKitResolve',
'callback' => 'frontendDevKitResolve'
),
array(
'page' => '/frontend/',
'delegate' => 'ManipulateDevKitNavigation',
'callback' => 'manipulateDevKitNavigation'
)
);
}
public function install() {
if(Symphony::ExtensionManager()->fetchStatus("debugdevkit") != EXTENSION_ENABLED) {
Administration::instance()->Page->pageAlert("You need to have the 'debugdevkit' extension installed and enabled.");
return false;
}
}
public function frontendDevKitResolve($context) {
if (false or isset($_GET['validation'])) {
require_once(EXTENSIONS . '/schemadevkit/content/content.schema.php');
$context['devkit'] = new Content_SchemaDevKit_List();
self::$active = true;
} else if (false or isset($_GET['validate'])) {
require_once(EXTENSIONS . '/schemadevkit/content/content.validate.php');
$context['devkit'] = new Content_SchemaDevKit_Validate();
self::$active = true;
}
}
public function manipulateDevKitNavigation($context) {
$xml = $context['xml'];
$item = $xml->createElement('item');
$item->setAttribute('name', __('Validation'));
$item->setAttribute('handle', 'validation');
$item->setAttribute('active', (self::$active ? 'yes' : 'no'));
$parent = $xml->documentElement;
if ($parent->hasChildNodes()) {
$parent->appendChild($item);
}
else {
$xml->documentElement->appendChild($item);
}
}
}
?>