|
@@ -32,15 +32,15 @@ |
|
|
block discarded – undo |
|
32
|
32
|
* |
|
33
|
33
|
* @return string |
|
34
|
34
|
*/ |
|
35
|
|
- public function transform( $segment ) { |
|
36
|
|
- preg_match_all( '/{{[^<>!{}]+?}}|{%[^<>!%]+?%}|{#[^<>!#]+?#}/', $segment, $html, PREG_SET_ORDER ); |
|
37
|
|
- foreach ( $html as $pos => $twig_variable ) { |
|
|
35
|
+ public function transform($segment) { |
|
|
36
|
+ preg_match_all('/{{[^<>!{}]+?}}|{%[^<>!%]+?%}|{#[^<>!#]+?#}/', $segment, $html, PREG_SET_ORDER); |
|
|
37
|
+ foreach ($html as $pos => $twig_variable) { |
|
38
|
38
|
//check if inside twig variable there is a tag because in this case shouldn't replace the content with PH tag |
|
39
|
|
- if ( !strstr( $twig_variable[ 0 ], ConstantEnum::GTPLACEHOLDER ) ) { |
|
|
39
|
+ if (!strstr($twig_variable[0], ConstantEnum::GTPLACEHOLDER)) { |
|
40
|
40
|
//replace subsequent elements excluding already encoded |
|
41
|
41
|
$segment = preg_replace( |
|
42
|
|
- '/' . preg_quote( $twig_variable[ 0 ], '/' ) . '/', |
|
43
|
|
- '<ph id="' . $this->getPipeline()->getNextId() . '" ctype="' . CTypeEnum::TWIG . '" equiv-text="base64:' . base64_encode( $twig_variable[ 0 ] ) . '"/>', |
|
|
42
|
+ '/'.preg_quote($twig_variable[0], '/').'/', |
|
|
43
|
+ '<ph id="'.$this->getPipeline()->getNextId().'" ctype="'.CTypeEnum::TWIG.'" equiv-text="base64:'.base64_encode($twig_variable[0]).'"/>', |
|
44
|
44
|
$segment, |
|
45
|
45
|
1 |
|
46
|
46
|
); |
Please login to merge, or discard this patch.