File tree Expand file tree Collapse file tree 3 files changed +59
-6
lines changed
Expand file tree Collapse file tree 3 files changed +59
-6
lines changed Original file line number Diff line number Diff line change 88
99namespace WordPressVIPMinimum \Sniffs \Security ;
1010
11+ use PHP_CodeSniffer \Util \Tokens ;
1112use WordPressVIPMinimum \Sniffs \Sniff ;
1213
1314/**
@@ -28,11 +29,7 @@ class TwigSniff extends Sniff {
2829 * @return array<int|string>
2930 */
3031 public function register () {
31- return [
32- T_CONSTANT_ENCAPSED_STRING ,
33- T_INLINE_HTML ,
34- T_HEREDOC ,
35- ];
32+ return Tokens::$ textStringTokens ;
3633 }
3734
3835 /**
Original file line number Diff line number Diff line change 99{% autoescape %}
1010 {{ safe_value|raw }}
1111{% endautoescape %}
12- </script>
12+ </script>
13+
14+ <?php
15+
16+ echo '<script>
17+ {% autoescape false %}
18+ Everything will be outputted as is in this block
19+ {% endautoescape %}
20+
21+ {% autoescape %}
22+ {{ safe_value|raw }}
23+ {% endautoescape %}
24+ </script> ' ;
25+
26+ echo "<script>
27+ {% autoescape false %}
28+ Everything will be $ outputted as is in this block
29+ {% endautoescape %}
30+
31+ {% autoescape %}
32+ {{ safe_value|raw }}
33+ {% endautoescape %}
34+ </script>
35+ " ;
36+
37+ echo <<<'EOD'
38+ <script>
39+ {% autoescape false %}
40+ Everything will be outputted as is in this block
41+ {% endautoescape %}
42+
43+ {% autoescape %}
44+ {{ safe_value|raw }}
45+ {% endautoescape %}
46+ </script>
47+ EOD;
48+
49+ echo <<<EOD
50+ <script>
51+ {% autoescape false %}
52+ Everything will be $ outputted as is in this block
53+ {% endautoescape %}
54+ EOD ;
55+ echo <<<"EOD"
56+ {% autoescape %}
57+ {{ safe_value|raw }}
58+ {% endautoescape %}
59+ </script>
60+ EOD ;
Original file line number Diff line number Diff line change @@ -34,6 +34,14 @@ public function getWarningList() {
3434 return [
3535 5 => 1 ,
3636 10 => 1 ,
37+ 17 => 1 ,
38+ 22 => 1 ,
39+ 27 => 1 ,
40+ 32 => 1 ,
41+ 39 => 1 ,
42+ 44 => 1 ,
43+ 51 => 1 ,
44+ 57 => 1 ,
3745 ];
3846 }
3947}
You can’t perform that action at this time.
0 commit comments