1
|
|
|
<?php |
2
|
|
|
namespace Goetas\Twital\Extension; |
3
|
|
|
|
4
|
|
|
use Goetas\Twital\Attribute; |
5
|
|
|
use Goetas\Twital\EventSubscriber\ContextAwareEscapingSubscriber; |
6
|
|
|
use Goetas\Twital\EventSubscriber\CustomNamespaceRawSubscriber; |
7
|
|
|
use Goetas\Twital\EventSubscriber\DOMMessSubscriber; |
8
|
|
|
use Goetas\Twital\EventSubscriber\FixHtmlEntitiesInExpressionSubscriber; |
9
|
|
|
use Goetas\Twital\EventSubscriber\IDNodeSubscriber; |
10
|
|
|
use Goetas\Twital\Node; |
11
|
|
|
use Goetas\Twital\Twital; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* |
15
|
|
|
* @author Asmir Mustafic <[email protected]> |
16
|
|
|
* |
17
|
|
|
*/ |
18
|
|
|
class CoreExtension extends AbstractExtension |
19
|
|
|
{ |
20
|
487 |
|
public function getSubscribers() |
21
|
|
|
{ |
22
|
|
|
return array( |
23
|
487 |
|
new DOMMessSubscriber(), |
24
|
487 |
|
new CustomNamespaceRawSubscriber(array( |
25
|
|
|
't' => Twital::NS |
26
|
487 |
|
)), |
27
|
487 |
|
new FixHtmlEntitiesInExpressionSubscriber(), |
28
|
487 |
|
new ContextAwareEscapingSubscriber(), |
29
|
487 |
|
new IDNodeSubscriber() |
30
|
487 |
|
); |
31
|
|
|
} |
32
|
|
|
|
33
|
487 |
|
public function getAttributes() |
34
|
|
|
{ |
35
|
487 |
|
$attributes = array(); |
36
|
487 |
|
$attributes[Twital::NS]['__base__'] = new Attribute\BaseAttribute(); |
37
|
487 |
|
$attributes[Twital::NS]['__internal-id__'] = new Attribute\InternalIDAttribute(); |
38
|
|
|
|
39
|
487 |
|
$attributes[Twital::NS]['if'] = new Attribute\IfAttribute(); |
40
|
487 |
|
$attributes[Twital::NS]['elseif'] = new Attribute\ElseIfAttribute(); |
41
|
487 |
|
$attributes[Twital::NS]['else'] = new Attribute\ElseAttribute(); |
42
|
|
|
|
43
|
487 |
|
$attributes[Twital::NS]['omit'] = new Attribute\OmitAttribute(); |
44
|
487 |
|
$attributes[Twital::NS]['set'] = new Attribute\SetAttribute(); |
45
|
|
|
|
46
|
487 |
|
$attributes[Twital::NS]['content'] = new Attribute\ContentAttribute(); |
47
|
487 |
|
$attributes[Twital::NS]['capture'] = new Attribute\CaptureAttribute(); |
48
|
487 |
|
$attributes[Twital::NS]['replace'] = new Attribute\ReplaceAttribute(); |
49
|
|
|
|
50
|
487 |
|
$attributes[Twital::NS]['attr'] = new Attribute\AttrAttribute(); |
51
|
487 |
|
$attributes[Twital::NS]['attr-append'] = new Attribute\AttrAppendAttribute(); |
52
|
|
|
|
53
|
487 |
|
$attributes[Twital::NS]['extends'] = new Attribute\ExtendsAttribute(); |
54
|
|
|
|
55
|
487 |
|
$attributes[Twital::NS]['block'] = new Attribute\BlockInnerAttribute(); |
56
|
487 |
|
$attributes[Twital::NS]['block-inner'] = new Attribute\BlockInnerAttribute(); |
57
|
487 |
|
$attributes[Twital::NS]['block-outer'] = new Attribute\BlockOuterAttribute(); |
58
|
|
|
|
59
|
487 |
|
return $attributes; |
60
|
|
|
} |
61
|
|
|
|
62
|
487 |
|
public function getNodes() |
63
|
|
|
{ |
64
|
487 |
|
$nodes = array(); |
65
|
487 |
|
$nodes[Twital::NS]['extends'] = new Node\ExtendsNode(); |
66
|
487 |
|
$nodes[Twital::NS]['block'] = new Node\BlockNode(); |
67
|
487 |
|
$nodes[Twital::NS]['macro'] = new Node\MacroNode(); |
68
|
487 |
|
$nodes[Twital::NS]['import'] = new Node\ImportNode(); |
69
|
487 |
|
$nodes[Twital::NS]['include'] = new Node\IncludeNode(); |
70
|
487 |
|
$nodes[Twital::NS]['omit'] = new Node\OmitNode(); |
71
|
487 |
|
$nodes[Twital::NS]['embed'] = new Node\EmbedNode(); |
72
|
487 |
|
$nodes[Twital::NS]['use'] = new Node\UseNode(); |
73
|
|
|
|
74
|
487 |
|
return $nodes; |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|