class DOMMessSubscriber implements EventSubscriberInterface
14
{
15
487
public static function getSubscribedEvents()
16
{
17
return array(
18
487
CompilerEvents::POST_DUMP => array(
19
array(
20
'removeCdata'
21
487
),
22
array(
23
'fixAttributes'
24
487
)
25
487
)
26
487
);
27
}
28
29
484
public function removeCdata(SourceEvent $event)
30
{
31
484
$event->setTemplate(str_replace(array(
32
484
"<![CDATA[__[__",
33
"__]__]]>"
34
484
), "", $event->getTemplate()));
35
484
}
36
37
public function fixAttributes(SourceEvent $event)
38
{
39
484
$event->setTemplate(preg_replace_callback('/ __attr__="(__a[0-9a-f]+)"/', function ($mch) {
40
13
return '{% for ____ak,____av in ' . $mch[1] . ' %}{% if (____av|length > 0) and not (____av|length == 1 and ____av[0] is same as(false)) %} {{____ak|raw}}{% if ____av|length > 1 or ____av[0] is not same as(true) %}="{{ ____av|join(\'\') }}"{% endif %}{% endif %}{% endfor %}';