<?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);
// 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 = 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/ZuVAY
function name: (null)
number of ops: 50
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
78 18 INIT_FCALL 'preg_replace'
19 INIT_FCALL 'implode'
20 SEND_VAL '%7C'
21 SEND_VAR !1
22 DO_ICALL $12
23 CONCAT ~13 '%23%3C%21--+%28', $12
24 CONCAT ~14 ~13, '%29%28%3F%3A+%28.%2A%3F%29+%3F%29%3F--%3E%23'
25 SEND_VAL ~14
26 SEND_VAL '%7B%25+%241+%242+%25%7D'
27 SEND_VAR !0
28 DO_ICALL $15
29 ASSIGN !0, $15
81 30 INIT_FCALL 'preg_replace'
31 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'
32 SEND_VAL '%7B%7B+lang%28%27%241%27%29%242+%7D%7D'
33 SEND_VAR !0
34 DO_ICALL $17
35 ASSIGN !0, $17
84 36 INIT_FCALL 'preg_replace'
37 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'
38 SEND_VAL '%7B%7B+lang%28%27%241%27%29%242%7Cescape%28%27js%27%29+%7D%7D'
39 SEND_VAR !0
40 DO_ICALL $19
41 ASSIGN !0, $19
87 42 INIT_FCALL 'preg_replace'
43 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'
44 SEND_VAL '%7B%7B+%241%242+%7D%7D'
45 SEND_VAR !0
46 DO_ICALL $21
47 ASSIGN !0, $21
89 48 ECHO !0
49 > RETURN 1
Generated using Vulcan Logic Dumper, using php 8.0.0
preferences:
169.38 ms | 1400 KiB | 17 Q