mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Fix broken test
This commit is contained in:
@ -75,10 +75,6 @@ class Aspect {
|
||||
* @var array Templates storage
|
||||
*/
|
||||
protected $_storage = array();
|
||||
/**
|
||||
* @var array template directory
|
||||
*/
|
||||
protected $_tpl_path = array();
|
||||
/**
|
||||
* @var string compile directory
|
||||
*/
|
||||
@ -115,7 +111,6 @@ class Aspect {
|
||||
"truncate" => 'Aspect\Modifier::truncate',
|
||||
"escape" => 'Aspect\Modifier::escape',
|
||||
"e" => 'Aspect\Modifier::escape', // alias of escape
|
||||
"url" => 'urlencode', // alias of escape:"url"
|
||||
"unescape" => 'Aspect\Modifier::unescape',
|
||||
"strip" => 'Aspect\Modifier::strip',
|
||||
"default" => 'Aspect\Modifier::defaultValue'
|
||||
@ -220,6 +215,15 @@ class Aspect {
|
||||
'type' => self::BLOCK_COMPILER,
|
||||
'open' => 'Aspect\Compiler::filterOpen',
|
||||
'close' => 'Aspect\Compiler::filterClose'
|
||||
),
|
||||
'macro' => array(
|
||||
'type' => self::BLOCK_COMPILER,
|
||||
'open' => 'Aspect\Compiler::macroOpen',
|
||||
'close' => 'Aspect\Compiler::macroClose'
|
||||
),
|
||||
'import' => array(
|
||||
'type' => self::INLINE_COMPILER,
|
||||
'parser' => 'Aspect\Compiler::tagImport'
|
||||
)
|
||||
);
|
||||
|
||||
@ -611,23 +615,18 @@ class Aspect {
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all compiled templates.
|
||||
*
|
||||
* @param string $scm
|
||||
* @return int
|
||||
*/
|
||||
public function compileAll($scm = null) {
|
||||
//return FS::rm($this->_compile_dir.'/*');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tpl
|
||||
* @param bool $cache
|
||||
* @return bool
|
||||
*/
|
||||
public function clearCompiledTemplate($tpl) {
|
||||
public function clearCompiledTemplate($tpl, $cache = true) {
|
||||
$file_name = $this->_compile_dir."/".$this->_getHash($tpl);
|
||||
if(file_exists($file_name)) {
|
||||
if($cache) {
|
||||
unset($this->_storage[$tpl]);
|
||||
}
|
||||
return unlink($file_name);
|
||||
} else {
|
||||
return true;
|
||||
@ -635,10 +634,10 @@ class Aspect {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*
|
||||
*/
|
||||
public function clearAllCompiles() {
|
||||
|
||||
\Aspect\FSProvider::clean($this->_compile_dir);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -688,9 +688,10 @@ class Compiler {
|
||||
*
|
||||
* @param Tokenizer $tokens
|
||||
* @param Scope $scope
|
||||
* @throws ImproperUseException
|
||||
* @return string
|
||||
*/
|
||||
public static function macrosOpen(Tokenizer $tokens, Scope $scope) {
|
||||
public static function macroOpen(Tokenizer $tokens, Scope $scope) {
|
||||
$tokens->get('.');
|
||||
$name = $tokens->get(Tokenizer::MACRO_STRING);
|
||||
if($tokens->is('(')) {
|
||||
@ -706,7 +707,7 @@ class Compiler {
|
||||
}
|
||||
}
|
||||
|
||||
public static function macrosClose(Tokenizer $tokens, Scope $scope) {
|
||||
public static function macroClose(Tokenizer $tokens, Scope $scope) {
|
||||
$scope->tpl->_macros[ $scope["name"] ] = $scope->getContent();
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ class FSProvider implements ProviderInterface {
|
||||
foreach($iterator as $file) {
|
||||
/* @var \splFileInfo $file*/
|
||||
if($file->isFile()) {
|
||||
if(strpos($file->getBasename(), ",") !== 0) {
|
||||
if(strpos($file->getBasename(), ".") !== 0) {
|
||||
unlink($file->getRealPath());
|
||||
}
|
||||
} elseif($file->isDir()) {
|
||||
@ -46,10 +46,6 @@ class FSProvider implements ProviderInterface {
|
||||
}
|
||||
}
|
||||
|
||||
public static function put($path, $content) {
|
||||
file_put_contents($path, $content);
|
||||
}
|
||||
|
||||
public function __construct($template_dir) {
|
||||
if($_dir = realpath($template_dir)) {
|
||||
$this->_path = $_dir;
|
||||
|
Reference in New Issue
Block a user