Update to smarty 3.1.24.

(cherry picked from commit e33bbc8)
This commit is contained in:
Darko
2015-06-05 09:41:55 +02:00
parent e3943ca906
commit c9cd53ea49
40 changed files with 3113 additions and 4036 deletions
@@ -11,7 +11,6 @@
/**
* Class Smarty_Internal_Extension_CodeFrame
* Create code frame for compiled and cached templates
*/
class Smarty_Internal_Extension_CodeFrame
{
@@ -78,11 +77,19 @@ class Smarty_Internal_Extension_CodeFrame
$output .= "?>/*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%*/';\n";
}
}
$output .= "?>\n" . $content;
$output .= "<?php }\n}\n?>";
return $output;
$output .= "?>\n";
$output = self::appendCode($output, $content);
return self::appendCode($output, "<?php }\n}\n?>");
}
/**
* Create code frame of compiled template function
*
* @param \Smarty_Internal_Template $_template
* @param string $content
*
* @return string
*/
public static function createFunctionFrame(Smarty_Internal_Template $_template, $content = '')
{
if (!isset($_template->properties['unifunc'])) {
@@ -98,4 +105,23 @@ class Smarty_Internal_Extension_CodeFrame
$output .= "}\n}\n?>";
return $output;
}
/**
* Append code segments and remove unneeded ?> <?php transitions
*
* @param string $left
* @param string $right
*
* @return string
*/
public static function appendCode($left, $right)
{
if (preg_match('/\s*\?>$/', $left) && preg_match('/^<\?php\s+/', $right)) {
$left = preg_replace('/\s*\?>$/', "\n", $left);
$left .= preg_replace('/^<\?php\s+/', '', $right);
} else {
$left .= $right;
}
return $left;
}
}