<?php
$code ='<!-- DEFINE $SEARCH_BOX --> <!-- ENDDEFINE -->';
$phpbb_tags = array(
/*'BEGIN',
'BEGINELSE',
'END',
'IF',
'ELSE',
'ELSEIF',
'ENDIF',
'DEFINE',
'UNDEFINE',*/
'ENDDEFINE',
'INCLUDE',
'INCLUDEPHP',
'INCLUDEJS',
'INCLUDECSS',
'PHP',
'ENDPHP',
'EVENT',
);
// Twig tag masks
$twig_tags = array(
'autoescape',
'endautoescape',
'if',
'elseif',
'else',
'endif',
'block',
'endblock',
'use',
'extends',
'embed',
'filter',
'endfilter',
'flush',
'for',
'endfor',
'macro',
'endmacro',
'import',
'from',
'sandbox',
'endsandbox',
'set',
'endset',
'spaceless',
'endspaceless',
'verbatim',
'endverbatim',
);
// Fix tokens that may have inline variables (e.g. <!-- DEFINE $TEST = '{FOO}')
$code = $this->strip_surrounding_quotes(array(
'INCLUDE',
'INCLUDEPHP',
'INCLUDEJS',
'INCLUDECSS',
), $code);
$code = $this->fix_inline_variable_tokens(array(
'DEFINE \$[a-zA-Z0-9_]+ =',
'INCLUDE',
'INCLUDEPHP',
'INCLUDEJS',
'INCLUDECSS',
), $code);
$code = $this->add_surrounding_quotes(array(
'INCLUDE',
'INCLUDEPHP',
'INCLUDEJS',
'INCLUDECSS',
), $code);
// Fix our BEGIN statements
$code = $this->fix_begin_tokens($code);
// Fix our IF tokens
$code = $this->fix_if_tokens($code);
// Fix our DEFINE tokens
$code = $this->fix_define_tokens($code);
// Replace all of our starting tokens, <!-- TOKEN --> with Twig style, {% TOKEN %}
// This also strips outer parenthesis, <!-- IF (blah) --> becomes <!-- IF blah -->
$code = preg_replace('#<!-- (' . implode('|', $phpbb_tags) . ')(?: (.*?) ?)?-->#', '{% $1 $2 %}', $code);
// Replace all of our twig masks with Twig code (e.g. <!-- BLOCK .+ --> with {% block $1 %})
$code = $this->replace_twig_tag_masks($code, $twig_tags);
// Replace all of our language variables, {L_VARNAME}, with Twig style, {{ lang('NAME') }}
// Appends any filters after lang()
$code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2 }}', $code);
// Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|escape('js') }}
// Appends any filters after lang(), but before escape('js')
$code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2|escape(\'js\') }}', $code);
// Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }}
// Appends any filters
$code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ $1$2 }}', $code);
echo $code;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/J1lNr
function name: (null)
number of ops: 74
compiled vars: !0 = $code, !1 = $phpbb_tags, !2 = $twig_tags
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > ASSIGN !0, '%3C%21--+DEFINE+%24SEARCH_BOX+--%3E%09%3C%21--+ENDDEFINE+--%3E'
5 1 ASSIGN !1, <array>
25 2 ASSIGN !2, <array>
56 3 FETCH_THIS $6
4 INIT_METHOD_CALL $6, 'strip_surrounding_quotes'
57 5 SEND_VAL_EX <array>
6 SEND_VAR_EX !0
7 DO_FCALL 0 $7
56 8 ASSIGN !0, $7
62 9 FETCH_THIS $9
10 INIT_METHOD_CALL $9, 'fix_inline_variable_tokens'
63 11 SEND_VAL_EX <array>
12 SEND_VAR_EX !0
13 DO_FCALL 0 $10
62 14 ASSIGN !0, $10
69 15 FETCH_THIS $12
16 INIT_METHOD_CALL $12, 'add_surrounding_quotes'
70 17 SEND_VAL_EX <array>
18 SEND_VAR_EX !0
19 DO_FCALL 0 $13
69 20 ASSIGN !0, $13
76 21 FETCH_THIS $15
22 INIT_METHOD_CALL $15, 'fix_begin_tokens'
23 SEND_VAR_EX !0
24 DO_FCALL 0 $16
25 ASSIGN !0, $16
78 26 FETCH_THIS $18
27 INIT_METHOD_CALL $18, 'fix_if_tokens'
28 SEND_VAR_EX !0
29 DO_FCALL 0 $19
30 ASSIGN !0, $19
80 31 FETCH_THIS $21
32 INIT_METHOD_CALL $21, 'fix_define_tokens'
33 SEND_VAR_EX !0
34 DO_FCALL 0 $22
35 ASSIGN !0, $22
83 36 INIT_FCALL 'preg_replace'
37 INIT_FCALL 'implode'
38 SEND_VAL '%7C'
39 SEND_VAR !1
40 DO_ICALL $24
41 CONCAT ~25 '%23%3C%21--+%28', $24
42 CONCAT ~26 ~25, '%29%28%3F%3A+%28.%2A%3F%29+%3F%29%3F--%3E%23'
43 SEND_VAL ~26
44 SEND_VAL '%7B%25+%241+%242+%25%7D'
45 SEND_VAR !0
46 DO_ICALL $27
47 ASSIGN !0, $27
85 48 FETCH_THIS $29
49 INIT_METHOD_CALL $29, 'replace_twig_tag_masks'
50 SEND_VAR_EX !0
51 SEND_VAR_EX !2
52 DO_FCALL 0 $30
53 ASSIGN !0, $30
88 54 INIT_FCALL 'preg_replace'
55 SEND_VAL '%23%7BL_%28%5Ba-zA-Z0-9_%5C.%5D%2B%29%28%5C%7C%5B%5E%7D%5D%2B%3F%29%3F%7D%23'
56 SEND_VAL '%7B%7B+lang%28%27%241%27%29%242+%7D%7D'
57 SEND_VAR !0
58 DO_ICALL $32
59 ASSIGN !0, $32
91 60 INIT_FCALL 'preg_replace'
61 SEND_VAL '%23%7BLA_%28%5Ba-zA-Z0-9_%5C.%5D%2B%29%28%5C%7C%5B%5E%7D%5D%2B%3F%29%3F%7D%23'
62 SEND_VAL '%7B%7B+lang%28%27%241%27%29%242%7Cescape%28%27js%27%29+%7D%7D'
63 SEND_VAR !0
64 DO_ICALL $34
65 ASSIGN !0, $34
94 66 INIT_FCALL 'preg_replace'
67 SEND_VAL '%23%7B%28%5Ba-zA-Z0-9_%5C.%5D%2B%29%28%5C%7C%5B%5E%7D%5D%2B%3F%29%3F%7D%23'
68 SEND_VAL '%7B%7B+%241%242+%7D%7D'
69 SEND_VAR !0
70 DO_ICALL $36
71 ASSIGN !0, $36
96 72 ECHO !0
73 > RETURN 1
Generated using Vulcan Logic Dumper, using php 8.0.0
preferences:
167.37 ms | 1404 KiB | 17 Q