diff --git a/composer.json b/composer.json index 6df02ae..9e8b37f 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ }, "autoload": { "psr-4": { - "Krutush\\Template": "src/" + "Krutush\\Template\\": "src/" } } -} \ No newline at end of file +} diff --git a/src/Html.php b/src/Html.php index 7cd9ae4..dc7e39f 100644 --- a/src/Html.php +++ b/src/Html.php @@ -4,6 +4,9 @@ namespace Krutush\Template; class Html extends Text{ + /** @var string */ + const EXTENTION = '.phtml'; + public function _escape(string $data){ return htmlspecialchars($data, ENT_QUOTES, 'UTF-8'); } @@ -26,4 +29,4 @@ class Html extends Text{ return str_replace('{?}', $this->_get($key, $filters), $format); } public function _p(string $key, string $format = null, array $filters = array('type' => 'string', 'escape' => true)){ return $this->_print($key, $format, $filters); } -} \ No newline at end of file +} diff --git a/src/Template.php b/src/Template.php index 357e07e..5f202db 100644 --- a/src/Template.php +++ b/src/Template.php @@ -10,7 +10,7 @@ class Template{ /** @var array */ private $data = array(); /** @var string */ - private $extention = '.tpl'; + const EXTENTION = '.tpl'; public function __construct(string $path, string $extention = null, bool $folder = true){ $this->path = $this->path($path, $extention, $folder); @@ -77,7 +77,7 @@ class Template{ } public function path(string $path, string $extention = null, bool $folder = true): string{ - $path .= $extention ?? $this->extention; + $path .= $extention ?? self::EXTENTION; if($folder == true && class_exists(\Krutush\Path)) //Remove require krutush/krutush $path = \Krutush\Path::get('template').'/'.$path; @@ -163,4 +163,4 @@ class Template{ } } public function _(string $key, array $filters = array()){ return $this->_get($key, $filters); } -} \ No newline at end of file +}