summaryrefslogtreecommitdiff
path: root/inc/lib/Twig/Markup.php
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-08-05 06:03:40 -0400
committerczaks <marcin@6irc.net>2013-08-05 06:03:40 -0400
commita84c4510fccfdc0cfb6f187633daea10dc70f326 (patch)
tree6077f5211196ae40cac0184bb7cc67b81d320b0b /inc/lib/Twig/Markup.php
parent33c7abf11f3a9b5c0964a2d7a25533c2849dbc78 (diff)
parenta8327c3a37fd22d2aa5d63061c9d3eaa30ae425a (diff)
Merge branch 'master' of github.com:vichan-devel/Tinyboard
Conflicts: js/post-hider.js
Diffstat (limited to 'inc/lib/Twig/Markup.php')
-rw-r--r--inc/lib/Twig/Markup.php14
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);
+ }
}