moved strip from smarty core to plugin, made textformat block function return output instead of echo it

This commit is contained in:
mohrt
2003-04-20 18:33:31 +00:00
parent fffa454585
commit 815ac01d84
4 changed files with 3 additions and 27 deletions

1
NEWS
View File

@@ -1,3 +1,4 @@
- moved strip from smarty core to plugin (Monte)
- moved config_load from smarty core to plugin (Monte)
- added &$repeat-paramter to block-functions (messju)
- enabled hex-constants in function.math.php (messju)

View File

@@ -1281,7 +1281,7 @@ class Smarty
* @param string $scope
*/
function config_load($file, $section = null, $scope = 'global')
{
{
require_once($this->_get_plugin_filepath('function', 'config_load'));
smarty_function_config_load(array('file' => $file, 'section' => $section, 'scope' => $scope), $this);
}

View File

@@ -307,26 +307,6 @@ class Smarty_Compiler extends Smarty {
}
$template_compiled .= $text_blocks[$i];
/* Reformat data between 'strip' and '/strip' tags, removing spaces, tabs and newlines. */
if (preg_match_all("!{$ldq}strip{$rdq}.*?{$ldq}/strip{$rdq}!s", $template_compiled, $_match)) {
$strip_tags = $_match[0];
$_strip_search = array(
'%([^\\\\]\?>)\n%', // remove newlines after PHP close tags
"!{$ldq}/?strip{$rdq}|[\t ]+$|^[\t ]+!m", // remove leading/trailing space chars
'%[\r\n]+%m', // remove CRs and newlines
'%([^\\\\]\?>)%'); // replace newlines after PHP close tags
$_strip_replace = array(
'\\1',
'',
'',
'\\1' . "\n");
$strip_tags_modified = preg_replace($_strip_search, $_strip_replace, $strip_tags);
for ($i = 0, $for_max = count($strip_tags); $i < $for_max; $i++)
$template_compiled = preg_replace("!{$ldq}strip{$rdq}.*?{$ldq}/strip{$rdq}!s",
$this->quote_replace($strip_tags_modified[$i]),
$template_compiled, 1);
}
// remove \n from the end of the file, if any
if ($template_compiled{strlen($template_compiled) - 1} == "\n" ) {
$template_compiled = substr($template_compiled, 0, -1);
@@ -474,10 +454,6 @@ class Smarty_Compiler extends Smarty {
else
return "<?php endforeach; endif; ?>";
case 'strip':
case '/strip':
return $this->left_delimiter.$tag_command.$this->right_delimiter;
case 'literal':
list (,$literal_block) = each($this->_literal_blocks);
$this->_current_line_no += substr_count($literal_block, "\n");

View File

@@ -70,9 +70,8 @@ function smarty_block_textformat($params, $content, &$this)
if($assign != null) {
$this->assign($assign,$output);
} else {
echo $output;
return $output;
}
//echo $content;
}
/* vim: set expandtab: */