Skip to content
Browse files

Removing dependency on String class. Adding handling of non file temp…

…lates.
  • Loading branch information...
1 parent 9468966 commit 24fb650ba2eb99be21e11e4f403519578f6dc6b5 @davidpersson davidpersson committed
Showing with 5 additions and 6 deletions.
  1. +5 −6 extensions/View.php
View
11 extensions/View.php
@@ -10,7 +10,6 @@
use \lithium\core\Libraries;
use \lithium\core\Environment;
-use \lithium\util\String;
/**
* This extended View class adds HTML comments to all rendered templates and
@@ -32,7 +31,7 @@ protected function _element($template, $data, array $options = array()) {
$template = $this->_loader->template('template', $options);
$data = (array) $data + $this->outputFilters;
$data = $this->_renderer->render($template, $data, $options);
- return $this->_pathized($data, $template);
+ return $this->_pathized($data, 'element', $template);
}
/**
@@ -46,7 +45,7 @@ protected function _template($template, $data, array $options = array()) {
$template = $this->_loader->template('template', $options);
$data = (array) $data + $this->outputFilters;
$data = $this->_renderer->render($template, $data, $options);
- return $this->_pathized($data, $template);
+ return $this->_pathized($data, 'template', $template);
}
/**
@@ -56,12 +55,12 @@ protected function _template($template, $data, array $options = array()) {
* @param string $path The path to the template that corresponds to the data.
* @return string Data wrapped by HTML comments.
*/
- protected function _pathized($data, $path) {
+ protected function _pathized($data, $type, $path) {
if (Environment::is('production')) {
return $data;
}
- $message = "<!-- START OF {:start} -->\n{$data}\n<!-- END OF {:stop} -->";
- return String::insert($message, array('start' => $path, 'stop' => $path));
+ $identifier = is_file($path) ? "{$type} {$path}" : $type;
+ return "<!-- START OF {$identifier} -->\n{$data}\n<!-- END OF {$identifier} -->";
}
}

0 comments on commit 24fb650

Please sign in to comment.
Something went wrong with that request. Please try again.