diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-01 15:20:12 -0400 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-01 15:20:12 -0400 |
| commit | 0fe552857468aa12097a74e08f51f5aaa983be07 (patch) | |
| tree | 22dbca1be90d7086b20a077752552296abf23325 /inc/lib/Twig/Markup.php | |
| parent | 22f3a95e0e421de05a11633eac846df96a2a4768 (diff) | |
Upgrade Twig library
Diffstat (limited to 'inc/lib/Twig/Markup.php')
| -rw-r--r-- | inc/lib/Twig/Markup.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/inc/lib/Twig/Markup.php b/inc/lib/Twig/Markup.php index c1a1469c..69871fcb 100644 --- a/inc/lib/Twig/Markup.php +++ b/inc/lib/Twig/Markup.php @@ -12,20 +12,26 @@ /** * Marks a content as safe. * - * @package twig - * @author Fabien Potencier <fabien@symfony.com> + * @author Fabien Potencier <fabien@symfony.com> */ -class Twig_Markup +class Twig_Markup implements Countable { protected $content; + protected $charset; - public function __construct($content) + public function __construct($content, $charset) { $this->content = (string) $content; + $this->charset = $charset; } public function __toString() { return $this->content; } + + public function count() + { + return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content); + } } |
