diff --git a/README.md b/README.md index a03957f..7c8f8a9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Fenom - Template Engine for PHP > Composer package: `{"fenom/fenom": "dev-master"}`. See on [Packagist.org](https://packagist.org/packages/bzick/fenom) -[![Build Status](https://travis-ci.org/bzick/fenom.png?branch=master)](https://travis-ci.org/bzick/fenom) +[![Build Status](https://travis-ci.org/bzick/fenom.png?branch=master)](https://travis-ci.org/fenom/fenom) ## [Usage](./docs/usage.md) :: [Documentation](./docs/readme.md) :: [Benchmark](./docs/benchmark.md) :: [Articles](./docs/articles.md) * Simple [syntax](./docs/syntax.md) diff --git a/src/Fenom.php b/src/Fenom.php index 92ddf44..a8649b7 100644 --- a/src/Fenom.php +++ b/src/Fenom.php @@ -107,7 +107,6 @@ class Fenom { "unescape" => 'Fenom\Modifier::unescape', "strip" => 'Fenom\Modifier::strip', "length" => 'Fenom\Modifier::length', - "default" => 'Fenom\Modifier::defaultValue', "iterable" => 'Fenom\Modifier::isIterable' ); @@ -558,12 +557,7 @@ class Fenom { } /** - * Set options. May be bitwise mask of constants DENY_METHODS, DENY_INLINE_FUNCS, DENY_SET_VARS, INCLUDE_SOURCES, - * FORCE_COMPILE, CHECK_MTIME, or associative array with boolean values: - * disable_methods - disable all calls method in template - * disable_native_funcs - disable all native PHP functions in template - * force_compile - recompile template every time (very slow!) - * compile_check - check template modifications (slow!) + * Set options * @param int|array $options */ public function setOptions($options) { @@ -605,7 +599,7 @@ class Fenom { * @return Fenom\Template */ public function getRawTemplate() { - return new \Fenom\Template($this, $this->_options); + return new Template($this, $this->_options); } /** @@ -726,7 +720,7 @@ class Fenom { */ public function compile($tpl, $store = true, $options = 0) { $options = $this->_options | $options; - $template = Template::factory($this, $options)->load($tpl); + $template = $this->getRawTemplate()->load($tpl); if($store) { $cache = $this->_getCacheName($tpl, $options); $tpl_tmp = tempnam($this->_compile_dir, $cache); @@ -766,7 +760,7 @@ class Fenom { * @return Fenom\Template */ public function compileCode($code, $name = 'Runtime compile') { - return Template::factory($this, $this->_options)->source($name, $code); + return $this->getRawTemplate()->source($name, $code); } diff --git a/src/Fenom/Template.php b/src/Fenom/Template.php index 46d2ed6..e696095 100644 --- a/src/Fenom/Template.php +++ b/src/Fenom/Template.php @@ -118,17 +118,6 @@ class Template extends Render { 'third' => '!(%s %% 3)' ); - /** - * Just factory - * - * @param \Fenom $fenom - * @param $options - * @return Template - */ - public static function factory(Fenom $fenom, $options) { - return new static($fenom, $options); - } - /** * @param Fenom $fenom Template storage * @param int $options @@ -215,7 +204,7 @@ class Template extends Render { $this->_appendText(substr($this->_src, $pos, $start - $pos)); $end = $start + 1; do { - $need_next_close_symbol = false; + $need_more = false; $end = strpos($this->_src, '}', $end + 1); // search close-symbol of the tag if($end === false) { // if unexpected end of template throw new CompileException("Unclosed tag in line {$this->_line}", 0, 1, $this->_name, $this->_line); @@ -233,7 +222,7 @@ class Template extends Render { } else { $tokens = new Tokenizer($_tag); // tokenize the tag if($tokens->isIncomplete()) { // all strings finished? - $need_next_close_symbol = true; + $need_more = true; } else { $this->_appendCode( $this->parseTag($tokens) , $tag); // start the tag lexer if($tokens->key()) { // if tokenizer have tokens - throws exceptions @@ -241,7 +230,7 @@ class Template extends Render { } } } - } while ($need_next_close_symbol); + } while ($need_more); unset($_tag, $tag); // cleanup break; }