mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
API CHANGE: Added SSViewer::set_source_file_comments() to allow disabling of comments in SSViewer output
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@67426 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d0ee6fbce2
commit
681c05d088
@ -48,6 +48,15 @@
|
|||||||
* @subpackage view
|
* @subpackage view
|
||||||
*/
|
*/
|
||||||
class SSViewer extends Object {
|
class SSViewer extends Object {
|
||||||
|
protected static $source_file_comments = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether HTML comments indicating the source .SS file used to render this page should be
|
||||||
|
* included in the output. This is enabled by default
|
||||||
|
*/
|
||||||
|
function set_source_file_comments($val) {
|
||||||
|
self::$source_file_comments = $val;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array $chosenTemplates Associative array for the different
|
* @var array $chosenTemplates Associative array for the different
|
||||||
@ -346,7 +355,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() && $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) {
|
||||||
$content = preg_replace('/(<html[^>]*>)/i', "\\1<!-- template $template -->", $content);
|
$content = preg_replace('/(<html[^>]*>)/i', "\\1<!-- template $template -->", $content);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user