From 0fe552857468aa12097a74e08f51f5aaa983be07 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 1 Aug 2013 15:20:12 -0400 Subject: Upgrade Twig library --- inc/lib/Twig/Markup.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'inc/lib/Twig/Markup.php') 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 + * @author Fabien Potencier */ -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); + } } -- cgit v1.3