21 lines
426 B
PHP
21 lines
426 B
PHP
<?php
|
|
|
|
namespace Deblan\Bundle\BlogBundle\Model;
|
|
|
|
use Deblan\Bundle\BlogBundle\Model\om\BaseTinyPost;
|
|
|
|
class TinyPost extends BaseTinyPost
|
|
{
|
|
public function getExcerpt()
|
|
{
|
|
$content = strip_tags($this->getContent());
|
|
$size = 300;
|
|
|
|
if (mb_strlen($content, "utf-8") > $size - 3) {
|
|
return mb_substr($content, 0, $size, "utf-8") . '…';
|
|
}
|
|
|
|
return $content;
|
|
}
|
|
}
|