<?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 = strip_surrounding_quotes(array(
'INCLUDE',
'INCLUDEPHP',
'INCLUDEJS',
'INCLUDECSS',
), $code);
$code = fix_inline_variable_tokens(array(
'DEFINE \$[a-zA-Z0-9_]+ =',
'INCLUDE',
'INCLUDEPHP',
'INCLUDEJS',
'INCLUDECSS',
), $code);
$code = add_surrounding_quotes(array(
'INCLUDE',
'INCLUDEPHP',
'INCLUDEJS',
'INCLUDECSS',
), $code);
// Fix our BEGIN statements
$code = fix_begin_tokens($code);
// Fix our IF tokens
$code = fix_if_tokens($code);
// Fix our DEFINE tokens
$code = 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 = 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/r6rVc
function name: (null)
number of ops: 67
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 INIT_FCALL_BY_NAME 'strip_surrounding_quotes'
57 4 SEND_VAL_EX <array>
5 SEND_VAR_EX !0
6 DO_FCALL 0 $6
56 7 ASSIGN !0, $6
62 8 INIT_FCALL_BY_NAME 'fix_inline_variable_tokens'
63 9 SEND_VAL_EX <array>
10 SEND_VAR_EX !0
11 DO_FCALL 0 $8
62 12 ASSIGN !0, $8
69 13 INIT_FCALL_BY_NAME 'add_surrounding_quotes'
70 14 SEND_VAL_EX <array>
15 SEND_VAR_EX !0
16 DO_FCALL 0 $10
69 17 ASSIGN !0, $10
76 18 INIT_FCALL_BY_NAME 'fix_begin_tokens'
19 SEND_VAR_EX !0
20 DO_FCALL 0 $12
21 ASSIGN !0, $12
78 22 INIT_FCALL_BY_NAME 'fix_if_tokens'
23 SEND_VAR_EX !0
24 DO_FCALL 0 $14
25 ASSIGN !0, $14
80 26 INIT_FCALL_BY_NAME 'fix_define_tokens'
27 SEND_VAR_EX !0
28 DO_FCALL 0 $16
29 ASSIGN !0, $16
83 30 INIT_FCALL 'preg_replace'
31 INIT_FCALL 'implode'
32 SEND_VAL '%7C'
33 SEND_VAR !1
34 DO_ICALL $18
35 CONCAT ~19 '%23%3C%21--+%28', $18
36 CONCAT ~20 ~19, '%29%28%3F%3A+%28.%2A%3F%29+%3F%29%3F--%3E%23'
37 SEND_VAL ~20
38 SEND_VAL '%7B%25+%241+%242+%25%7D'
39 SEND_VAR !0
40 DO_ICALL $21
41 ASSIGN !0, $21
85 42 INIT_FCALL_BY_NAME 'replace_twig_tag_masks'
43 SEND_VAR_EX !0
44 SEND_VAR_EX !2
45 DO_FCALL 0 $23
46 ASSIGN !0, $23
88 47 INIT_FCALL 'preg_replace'
48 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'
49 SEND_VAL '%7B%7B+lang%28%27%241%27%29%242+%7D%7D'
50 SEND_VAR !0
51 DO_ICALL $25
52 ASSIGN !0, $25
91 53 INIT_FCALL 'preg_replace'
54 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'
55 SEND_VAL '%7B%7B+lang%28%27%241%27%29%242%7Cescape%28%27js%27%29+%7D%7D'
56 SEND_VAR !0
57 DO_ICALL $27
58 ASSIGN !0, $27
94 59 INIT_FCALL 'preg_replace'
60 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'
61 SEND_VAL '%7B%7B+%241%242+%7D%7D'
62 SEND_VAR !0
63 DO_ICALL $29
64 ASSIGN !0, $29
96 65 ECHO !0
66 > RETURN 1
Generated using Vulcan Logic Dumper, using php 8.0.0
preferences:
170.17 ms | 1400 KiB | 17 Q