-
Notifications
You must be signed in to change notification settings - Fork 13
/
CoreExtension.php
76 lines (64 loc) · 2.79 KB
/
CoreExtension.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
<?php
namespace Goetas\Twital\Extension;
use Goetas\Twital\Attribute;
use Goetas\Twital\EventSubscriber\ContextAwareEscapingSubscriber;
use Goetas\Twital\EventSubscriber\CustomNamespaceRawSubscriber;
use Goetas\Twital\EventSubscriber\DOMMessSubscriber;
use Goetas\Twital\EventSubscriber\FixHtmlEntitiesInExpressionSubscriber;
use Goetas\Twital\EventSubscriber\IDNodeSubscriber;
use Goetas\Twital\Node;
use Goetas\Twital\Twital;
/**
*
* @author Asmir Mustafic <goetas@gmail.com>
*
*/
class CoreExtension extends AbstractExtension
{
public function getSubscribers()
{
return array(
new DOMMessSubscriber(),
new CustomNamespaceRawSubscriber(array(
't' => Twital::NS
)),
new FixHtmlEntitiesInExpressionSubscriber(),
new ContextAwareEscapingSubscriber(),
new IDNodeSubscriber()
);
}
public function getAttributes()
{
$attributes = array();
$attributes[Twital::NS]['__base__'] = new Attribute\BaseAttribute();
$attributes[Twital::NS]['__internal-id__'] = new Attribute\InternalIDAttribute();
$attributes[Twital::NS]['if'] = new Attribute\IfAttribute();
$attributes[Twital::NS]['elseif'] = new Attribute\ElseIfAttribute();
$attributes[Twital::NS]['else'] = new Attribute\ElseAttribute();
$attributes[Twital::NS]['omit'] = new Attribute\OmitAttribute();
$attributes[Twital::NS]['set'] = new Attribute\SetAttribute();
$attributes[Twital::NS]['content'] = new Attribute\ContentAttribute();
$attributes[Twital::NS]['capture'] = new Attribute\CaptureAttribute();
$attributes[Twital::NS]['replace'] = new Attribute\ReplaceAttribute();
$attributes[Twital::NS]['attr'] = new Attribute\AttrAttribute();
$attributes[Twital::NS]['attr-append'] = new Attribute\AttrAppendAttribute();
$attributes[Twital::NS]['extends'] = new Attribute\ExtendsAttribute();
$attributes[Twital::NS]['block'] = new Attribute\BlockInnerAttribute();
$attributes[Twital::NS]['block-inner'] = new Attribute\BlockInnerAttribute();
$attributes[Twital::NS]['block-outer'] = new Attribute\BlockOuterAttribute();
return $attributes;
}
public function getNodes()
{
$nodes = array();
$nodes[Twital::NS]['extends'] = new Node\ExtendsNode();
$nodes[Twital::NS]['block'] = new Node\BlockNode();
$nodes[Twital::NS]['macro'] = new Node\MacroNode();
$nodes[Twital::NS]['import'] = new Node\ImportNode();
$nodes[Twital::NS]['include'] = new Node\IncludeNode();
$nodes[Twital::NS]['omit'] = new Node\OmitNode();
$nodes[Twital::NS]['embed'] = new Node\EmbedNode();
$nodes[Twital::NS]['use'] = new Node\UseNode();
return $nodes;
}
}