mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- improvement remove not needed ?><?php transitions from compiled code
This commit is contained in:
@@ -854,6 +854,24 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append code segments and remove unneeded ?> <?php transitions
|
||||||
|
*
|
||||||
|
* @param string $left
|
||||||
|
* @param string $right
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function appendCode($left, $right) {
|
||||||
|
if ( preg_match('/\s*\?>\s*$/', $left) && preg_match('/^\s*<\?php\s+/', $right)) {
|
||||||
|
$left = preg_replace('/\s*\?>\s*$/', "\n", $left);
|
||||||
|
$left .= preg_replace('/^\s*<\?php\s+/', '', $right);
|
||||||
|
} else {
|
||||||
|
$left .= $right;
|
||||||
|
}
|
||||||
|
return $left;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inject inline code for nocache template sections
|
* Inject inline code for nocache template sections
|
||||||
* This method gets the content of each template element from the parser.
|
* This method gets the content of each template element from the parser.
|
||||||
|
Reference in New Issue
Block a user