mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX SSViewer::set_source_file_comments(false) wasn't working because of lack of checking if enabled.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@68024 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d530706093
commit
22b1b81843
@ -60,14 +60,14 @@ class SSViewer extends Object {
|
|||||||
*
|
*
|
||||||
* @param boolean $val
|
* @param boolean $val
|
||||||
*/
|
*/
|
||||||
function set_source_file_comments($val) {
|
static function set_source_file_comments($val) {
|
||||||
self::$source_file_comments = $val;
|
self::$source_file_comments = $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function get_source_file_comments() {
|
static function get_source_file_comments() {
|
||||||
return self::$source_file_comments;
|
return self::$source_file_comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,6 +368,7 @@ class SSViewer extends Object {
|
|||||||
|
|
||||||
static function parseTemplateContent($content, $template="") {
|
static function parseTemplateContent($content, $template="") {
|
||||||
// Add template filename comments on dev sites
|
// Add template filename comments on dev sites
|
||||||
|
|
||||||
if(Director::isDev() && self::$source_file_comments && $template) {
|
if(Director::isDev() && self::$source_file_comments && $template) {
|
||||||
// If this template is a full HTML page, then put the comments just inside the HTML tag to prevent any IE glitches
|
// If this template is a full HTML page, then put the comments just inside the HTML tag to prevent any IE glitches
|
||||||
if(stripos($content, "<html") !== false) {
|
if(stripos($content, "<html") !== false) {
|
||||||
@ -382,7 +383,7 @@ class SSViewer extends Object {
|
|||||||
$oldContent = $content;
|
$oldContent = $content;
|
||||||
|
|
||||||
// Add include filename comments on dev sites
|
// Add include filename comments on dev sites
|
||||||
if(Director::isDev()) $replacementCode = 'return "<!-- include " . SSViewer::getTemplateFile($matches[1]) . "-->\n"
|
if(Director::isDev() && self::$source_file_comments && SSViewer::getTemplateFile($matches[1])) $replacementCode = 'return "<!-- include " . SSViewer::getTemplateFile($matches[1]) . "-->\n"
|
||||||
. SSViewer::getTemplateContent($matches[1])
|
. SSViewer::getTemplateContent($matches[1])
|
||||||
. "\n<!-- end include " . SSViewer::getTemplateFile($matches[1]) . "-->";';
|
. "\n<!-- end include " . SSViewer::getTemplateFile($matches[1]) . "-->";';
|
||||||
else $replacementCode = 'return SSViewer::getTemplateContent($matches[1]);';
|
else $replacementCode = 'return SSViewer::getTemplateContent($matches[1]);';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user