mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 03:48:53 +00:00
Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9811 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
269c2c2944
commit
b613781d3a
3 changed files with 12 additions and 2 deletions
|
@ -168,6 +168,7 @@
|
||||||
<li>[Fix] Allow changing forum from select box under certain circumstances. (Bug #37525)</li>
|
<li>[Fix] Allow changing forum from select box under certain circumstances. (Bug #37525)</li>
|
||||||
<li>[Fix] Display required fields notice on registration above the custom profile fields. (Bug #39665)</li>
|
<li>[Fix] Display required fields notice on registration above the custom profile fields. (Bug #39665)</li>
|
||||||
<li>[Fix] Copy poll options properly when copying topic. (Bug #39065)</li>
|
<li>[Fix] Copy poll options properly when copying topic. (Bug #39065)</li>
|
||||||
|
<li>[Fix] Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags)</li>
|
||||||
<li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li>
|
<li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li>
|
||||||
<li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li>
|
<li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li>
|
||||||
<li>[Change] Template engine now permits to a limited extent variable includes.</li>
|
<li>[Change] Template engine now permits to a limited extent variable includes.</li>
|
||||||
|
|
|
@ -251,15 +251,22 @@ class template_compile
|
||||||
$template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
|
$template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove unused opening/closing tags
|
||||||
|
$template_php = str_replace(' ?><?php ', ' ', $template_php);
|
||||||
|
|
||||||
|
// Now add a newline after each php closing tag which already has a newline
|
||||||
|
// PHP itself strips a newline if a closing tag is used (this is documented behaviour) and it is mostly not intended by style authors to remove newlines
|
||||||
|
$template_php = preg_replace('#\?\>([\r\n])#', '?>\1\1', $template_php);
|
||||||
|
|
||||||
// There will be a number of occasions where we switch into and out of
|
// There will be a number of occasions where we switch into and out of
|
||||||
// PHP mode instantaneously. Rather than "burden" the parser with this
|
// PHP mode instantaneously. Rather than "burden" the parser with this
|
||||||
// we'll strip out such occurences, minimising such switching
|
// we'll strip out such occurences, minimising such switching
|
||||||
if ($no_echo)
|
if ($no_echo)
|
||||||
{
|
{
|
||||||
return "\$$echo_var .= '" . str_replace(' ?><?php ', ' ', $template_php) . "'";
|
return "\$$echo_var .= '" . $template_php . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
return str_replace(' ?><?php ', ' ', $template_php);
|
return $template_php;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -82,6 +82,8 @@ class template
|
||||||
$this->root = $template_path;
|
$this->root = $template_path;
|
||||||
$this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
|
$this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
|
||||||
|
|
||||||
|
$this->_rootref = &$this->_tpldata['.'][0];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue