Ejemplo n.º 1
0
 public function test_wordLimiter()
 {
     $str = "This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test";
     $result = wordLimiter($str, 10);
     $expected = 'This is a test This is a test This is...';
     $this->assertEquals($expected, $result);
 }
Ejemplo n.º 2
0
    ?>
            <?php 
    foreach ($packs as $pack) {
        ?>
                <tr>
                    <td class="pack-img"><?php 
        echo $pack->imgIsExists() ? CHtml::image($pack->getImgUrl()) : '';
        ?>
</td>
                    <td class="desc">
                        <?php 
        echo e($pack->title);
        ?>
<br>
                        <?php 
        echo wordLimiter($pack->description, 20);
        ?>
                    </td>
                    <td><?php 
        echo $pack->countItems;
        ?>
</td>
                    <td><span class="label <?php 
        echo $pack->isStatusOn() ? 'label-success' : 'label-default';
        ?>
"><?php 
        echo $pack->getStatus();
        ?>
</span></td>
                    <td><?php 
        echo $pack->sort;
Ejemplo n.º 3
0
 /**
  * Возвращает небольшую часть сообщения
  *
  * @param int $count_word (кол-во слов которые надо вернуть)
  *
  * @return string
  */
 public function getShortMessage($count_word = 10)
 {
     return wordLimiter(e(strip_tags($this->message)), $count_word, ' ...');
 }