Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ivan Shalganov 2014-04-09 20:01:59 +04:00
commit 0fcc5463e8
3 changed files with 12 additions and 11 deletions

View File

@ -1,7 +1,7 @@
Tag {raw} [RU] Tag {raw} [RU]
================== ==================
Тег `{raw <expression>}` позволяет выводить результат выражения или функций без экранирования, игнорируя глобальную настройку `auto_secape`. Тег `{raw <expression>}` позволяет выводить результат выражения или функций без экранирования, игнорируя глобальную настройку `auto_escape`.
```smarty ```smarty
{autoescape true} {autoescape true}
@ -26,4 +26,4 @@ Tag {raw} [RU]
{/autoescate} {/autoescate}
``` ```
На компиляторы свойство raw не распространяется. На компиляторы свойство raw не распространяется.

View File

@ -3,31 +3,31 @@ Basic usage
### Initialize Fenom ### Initialize Fenom
Use factory method Creating an object via factory method
```php ```php
$fenom = Fenom::factory('/path/to/templates', '/path/to/compiled/template', $options); $fenom = Fenom::factory('/path/to/templates', '/path/to/compiled/template', $options);
``` ```
Use `new` operator Creating an object via `new` operator
```php ```php
$fenom = new Fenom(new Provider('/path/to/templates')); $fenom = new Fenom(new Provider('/path/to/templates'));
$fenom->setCompileDir('/path/to/template/cache'); $fenom->setCompileDir('/path/to/template/cache');
$fenom->setOptions($options); $fenom->setOptions($options);
``` ```
### Render template ### Rendering template
Output template Output template
```php ```php
$fenom->display("template/name.tpl", $vars); $fenom->display("template/name.tpl", $vars);
``` ```
Get template into the variable Get the result of rendering the template
```php ```php
$result = $fenom->fetch("template/name.tpl", $vars); $result = $fenom->fetch("template/name.tpl", $vars);
``` ```
Create pipe-line into callback Create the pipeline of rendering into callback
```php ```php
$fenom->pipe( $fenom->pipe(
"template/sitemap.tpl", "template/sitemap.tpl",

View File

@ -492,11 +492,11 @@ class Template extends Render
return $this->out($this->parseExpr($tokens), $tokens); return $this->out($this->parseExpr($tokens), $tokens);
} }
} catch (InvalidUsageException $e) { } catch (InvalidUsageException $e) {
throw new CompileException($e->getMessage() . " in {$this} line {$this->_line}", 0, E_ERROR, $this->_name, $this->_line, $e); throw new CompileException($e->getMessage() . " in {$this->_name} line {$this->_line}", 0, E_ERROR, $this->_name, $this->_line, $e);
} catch (\LogicException $e) { } catch (\LogicException $e) {
throw new SecurityException($e->getMessage() . " in {$this} line {$this->_line}, near '{" . $tokens->getSnippetAsString(0, 0) . "' <- there", 0, E_ERROR, $this->_name, $this->_line, $e); throw new SecurityException($e->getMessage() . " in {$this->_name} line {$this->_line}, near '{" . $tokens->getSnippetAsString(0, 0) . "' <- there", 0, E_ERROR, $this->_name, $this->_line, $e);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new CompileException($e->getMessage() . " in {$this} line {$this->_line}, near '{" . $tokens->getSnippetAsString(0, 0) . "' <- there", 0, E_ERROR, $this->_name, $this->_line, $e); throw new CompileException($e->getMessage() . " in {$this->_name} line {$this->_line}, near '{" . $tokens->getSnippetAsString(0, 0) . "' <- there", 0, E_ERROR, $this->_name, $this->_line, $e);
} }
} }
@ -1173,6 +1173,7 @@ class Template extends Render
if (!$mods) { if (!$mods) {
throw new \Exception("Modifier " . $tokens->current() . " not found"); throw new \Exception("Modifier " . $tokens->current() . " not found");
} }
$modifier = $tokens->current();
$tokens->next(); $tokens->next();
$args = array(); $args = array();
@ -1183,7 +1184,7 @@ class Template extends Render
} }
if (!is_string($mods)) { // dynamic modifier if (!is_string($mods)) { // dynamic modifier
$mods = 'call_user_func($tpl->getStorage()->getModifier("' . $mods . '"), '; $mods = 'call_user_func($tpl->getStorage()->getModifier("' . $modifier . '"), ';
} else { } else {
$mods .= "("; $mods .= "(";
} }