MINOR: moved includeDebuggingComments logic into own method to allow separated tests

This commit is contained in:
Zauberfisch 2013-04-22 14:12:43 +00:00
parent 7c66e8e7a2
commit 94b37f9c85
2 changed files with 40 additions and 22 deletions

View File

@ -4593,6 +4593,17 @@ class SSTemplateParser extends Parser {
// Include top level debugging comments if desired
if($includeDebuggingComments && $templateName && stripos($code, "<?xml") === false) {
$code = $parser->includeDebuggingComments($code, $templateName);
}
return $code;
}
/**
* @param string $code
* @return string $code
*/
protected function includeDebuggingComments($code, $templateName) {
// If this template contains a doctype, put it right after it,
// if not, put it after the <html> tag to avoid IE glitches
if(stripos($code, "<!doctype") !== false) {
@ -4604,8 +4615,6 @@ class SSTemplateParser extends Parser {
' -->\';' . "\r\n", $code);
}
$code .= "\r\n" . '$val .= \'<!-- end template ' . $templateName . ' -->\';';
}
return $code;
}

View File

@ -1047,6 +1047,17 @@ class SSTemplateParser extends Parser {
// Include top level debugging comments if desired
if($includeDebuggingComments && $templateName && stripos($code, "<?xml") === false) {
$code = $parser->includeDebuggingComments($code, $templateName);
}
return $code;
}
/**
* @param string $code
* @return string $code
*/
protected function includeDebuggingComments($code, $templateName) {
// If this template contains a doctype, put it right after it,
// if not, put it after the <html> tag to avoid IE glitches
if(stripos($code, "<!doctype") !== false) {
@ -1058,8 +1069,6 @@ class SSTemplateParser extends Parser {
' -->\';' . "\r\n", $code);
}
$code .= "\r\n" . '$val .= \'<!-- end template ' . $templateName . ' -->\';';
}
return $code;
}