Ejemplo n.º 1
0
 public function truncate($text, $length = 30)
 {
     if (strlen($text) > $length) {
         require_once 'Kornak/Filter/MaxLength.php';
         $filter = new Kornak_Filter_MaxLength($length - 1);
         $text = $filter->filter($text) . '…';
     }
     return $text;
 }
Ejemplo n.º 2
0
 public function testSetMaxLength()
 {
     $length = 10;
     $filter = new Kornak_Filter_MaxLength();
     $filter->setMaxLength($length);
     $this->assertSame($length, $filter->getMaxLength(), 'The maximum length should be definable');
     $object = $filter->setMaxLength(12);
     $this->assertTrue($object instanceof Zend_Filter_Interface, 'The setters should implement fluent interface');
 }