コード例 #1
0
ファイル: StringHelperTest.php プロジェクト: sciurodont/yii2
 public function testTruncateWords()
 {
     $this->assertEquals('это тестовая multibyte строка', StringHelper::truncateWords('это тестовая multibyte строка', 5));
     $this->assertEquals('это тестовая multibyte...', StringHelper::truncateWords('это тестовая multibyte строка', 3));
     $this->assertEquals('это тестовая multibyte!!!', StringHelper::truncateWords('это тестовая multibyte строка', 3, '!!!'));
     $this->assertEquals('это строка с          неожиданными...', StringHelper::truncateWords('это строка с          неожиданными пробелами', 4));
 }
コード例 #2
0
ファイル: DefaultController.php プロジェクト: BoBRoID/new.k-z
 public function actionFeed($id, $link)
 {
     $newsFeed = NewsFeed::findOne(['id' => $id, 'published' => 1]);
     if (!$newsFeed) {
         throw new NotFoundHttpException("Лента новостей не найдена!");
     }
     if ($newsFeed->link != $link) {
         return $this->redirect(['/rss/' . $newsFeed->fullLink]);
     }
     $response = \Yii::$app->getResponse();
     $headers = $response->getHeaders();
     $headers->set('Content-Type', 'application/rss+xml; charset=utf-8');
     if (true || $newsFeed->hasUpdated()) {
         $feed = new RssView(['dataProvider' => new ActiveDataProvider(['query' => $newsFeed->getNews(), 'sort' => ['defaultOrder' => ['publishDate' => SORT_DESC]], 'pagination' => ['pageSize' => array_key_exists('feedLength', $newsFeed->params) ? $newsFeed->params['feedLength'] : 30]]), 'channel' => ['title' => function ($widget, \Zelenin\Feed $feed) use(&$newsFeed) {
             $feed->addChannelTitle($newsFeed->name);
         }, 'link' => Url::toRoute('/', true), 'description' => $newsFeed->description, 'language' => function ($widget, \Zelenin\Feed $feed) {
             return \Yii::$app->language;
         }, 'image' => function ($widget, \Zelenin\Feed $feed) use(&$newsFeed) {
             $feed->addChannelImage('//k-z.com.ua/images/' . (array_key_exists('image', $newsFeed->params) ? $newsFeed->params['image'] : 'logo1.png'), '//k-z.com.ua', 88, 31, $newsFeed->description);
         }], 'items' => ['title' => function ($model, $widget, \Zelenin\Feed $feed) {
             return $model->title;
         }, 'link' => function ($model, $widget, \Zelenin\Feed $feed) {
             return Url::toRoute([$model->fullLink], true);
         }, 'guid' => function ($model, $widget, \Zelenin\Feed $feed) {
             return Url::toRoute([$model->fullLink], true);
         }, 'description' => function ($model, $widget, \Zelenin\Feed $feed) use(&$newsFeed) {
             $text = htmlspecialchars_decode($model->textPreview);
             if (array_key_exists('hideImages', $newsFeed->params) && $newsFeed->params['hideImages'] == 1) {
                 $text = strip_tags($text, '<a></a><p></p>');
             }
             $text = StringHelper::truncateWords(preg_replace('/\\&(\\#|)(\\w+|\\D+)\\;/m', '', $text), 50);
             return $text;
         }, 'yandex:full-text' => function ($model, $widget, $feed) use(&$newsFeed) {
             $text = htmlspecialchars_decode($model->textPreview . $model->text);
             if (array_key_exists('hideImages', $newsFeed->params) && $newsFeed->params['hideImages'] == 1) {
                 $text = strip_tags($text, '<a></a><p></p>');
             }
             $text = preg_replace('/\\&(\\#|)(\\w+|\\D+)\\;/m', '', $text);
             return $text;
         }, 'author' => function ($model, $widget, \Zelenin\Feed $feed) {
             return $model->author;
         }, 'dc:creator' => function ($model, $widget, \Zelenin\Feed $feed) {
             return $model->author;
         }, 'pubDate' => function ($model, $widget, \Zelenin\Feed $feed) {
             $date = new \DateTime();
             $date->setTimestamp($model->publishDate);
             return $date->format(DATE_RSS);
         }], 'standards' => ['xmlns:dc' => 'http://purl.org/dc/elements/1.1/', 'xmlns:yandex' => 'http://news.yandex.ru', 'xmlns' => 'http://backend.userland.com/rss2']]);
         $feedContent = $feed->run()->__toString();
         \Yii::$app->cache->set('rssfeed-' . $newsFeed->id . '-content', $feedContent);
     } else {
         $feedContent = \Yii::$app->cache->get('rssfeed-' . $newsFeed->id . '-content');
     }
     echo $feedContent;
 }
コード例 #3
0
 protected function chooseQuote()
 {
     if (count($this->quotes) == 0) {
         return;
     }
     $this->currentQuote = $this->quotes[array_rand($this->quotes)];
     if (isset($_REQUEST['DEBUG'])) {
         $this->currentQuote = $this->quotes[0];
     }
     $this->currentSnippet = StringHelper::truncateWords($this->currentQuote, 6);
 }
コード例 #4
0
 public function actionRss()
 {
     $dataProvider = new ActiveDataProvider(['query' => Article::find()->with(['user'])->orderby('id DESC'), 'pagination' => ['pageSize' => 10]]);
     $response = \Yii::$app->getResponse();
     \Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
     header("Content-Type: application/xml; charset=UTF-8");
     $response->content = \Zelenin\yii\extensions\Rss\RssView::widget(['dataProvider' => $dataProvider, 'channel' => ['title' => Yii::$app->name, 'link' => Url::toRoute('/', true), 'description' => 'Articles ', 'language' => Yii::$app->language], 'items' => ['title' => function ($model, $widget) {
         return $model->title;
     }, 'description' => function ($model, $widget) {
         return StringHelper::truncateWords($model->content, 50);
     }, 'link' => function ($model, $widget) {
         return Url::toRoute(['article/view', 'id' => $model->id], true);
     }, 'author' => function ($model, $widget) {
         return $model->user->email . ' (' . $model->user->name . ')';
     }, 'pubDate' => function ($model, $widget) {
         $date = \DateTime::createFromFormat('Y-m-d H:i:s', $model->date);
         return $date->format(DATE_RSS);
     }]]);
 }
コード例 #5
0
 public function actionRss($category_id = null)
 {
     return RssView::widget(['dataProvider' => new ActiveDataProvider(['query' => Post::find()->published()->category($category_id)->language(Yii::$app->language)->orderBy(['published_at' => SORT_DESC]), 'pagination' => ['pageSize' => $this->module->rssPageSize]]), 'channel' => ['title' => Yii::$app->siteName, 'link' => Url::toRoute(['', 'category_id' => $category_id], true), 'description' => $category_id ? $this->loadCategoryModel($category_id)->title : Yii::t('gromver.platform', 'All news'), 'language' => Yii::$app->language], 'items' => ['title' => function ($model) {
         /** @var $model \gromver\platform\news\models\Post */
         return $model->title;
     }, 'description' => function ($model) {
         /** @var $model \gromver\platform\news\models\Post */
         return $model->preview_text ? $model->preview_text : StringHelper::truncateWords(strip_tags($model->detail_text), 40);
     }, 'link' => function ($model) {
         /** @var $model \gromver\platform\news\models\Post */
         return Url::toRoute($model->getFrontendViewLink(), true);
     }, 'author' => function ($model) {
         /** @var $model \gromver\platform\news\models\Post */
         return $model->user->email . ' (' . $model->user->username . ')';
     }, 'guid' => function ($model) {
         /** @var $model \gromver\platform\news\models\Post */
         return Url::toRoute($model->getFrontendViewLink(), true) . ' ' . Yii::$app->formatter->asDatetime($model->updated_at, 'php:' . DATE_RSS);
     }, 'pubDate' => function ($model) {
         /** @var $model \gromver\platform\news\models\Post */
         return Yii::$app->formatter->asDatetime($model->published_at, 'php:' . DATE_RSS);
     }]]);
 }
コード例 #6
0
ファイル: BlogPost.php プロジェクト: HeavyDots/heavyCMS
 public function getBriefText($asHtml = true)
 {
     return StringHelper::truncateWords($this->text, 40, $suffix = '...', $asHtml);
 }
コード例 #7
0
ファイル: _item.php プロジェクト: oakcms/oakcms
 * File name: _item.php
 * @var $model \app\modules\content\models\ContentArticles;
 */
?>
<div class="container">
    <article class="main-news-article wow fadeIn" data-wow-offset="50" data-wow-duration="1.5s" data-wow-delay="0s">
        <div class="main-news-article__image col-sm-4">
            <img src="<?php 
echo $model->getUploadUrl('image');
?>
" alt="<?php 
echo $model->title;
?>
">
        </div>
        <div class="main-news-article__text col-sm-8">
            <h4><?php 
echo $model->title;
?>
</h4>
            <p><?php 
echo \yii\helpers\StringHelper::truncateWords(strip_tags($model->content), 20);
?>
</p>
            <?php 
echo \app\modules\admin\widgets\Html::a(Yii::t('text', 'Read more...'), ['/content/article/view', 'catslug' => $model->category->slug, 'slug' => $model->slug]);
?>
        </div>
    </article>
</div>
コード例 #8
0
ファイル: _four_news.php プロジェクト: BoBRoID/new.k-z
echo $firstNews->title;
?>
" src="<?php 
echo $firstNews->imagePreview;
?>
">
                                </div>
                            </a>
                            <div class="tleft fleft">
                                <a class="readon inline readMore" href="<?php 
echo $firstNews->fullLink;
?>
">Подробнее</a>
                                <p class="nspText longText" lang="ru">
                                    <?php 
echo ($textWords = $theme->textWords) ? StringHelper::truncateWords($firstNews->getTextPreview(0, '<a></a>'), $textWords) : $firstNews->getTextPreview(0, '<a></a>');
?>
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="nspLinksWrap right">
            <div class="nspLinks">
                <ul class="nspList">
                    <?php 
foreach ($topNews as $news) {
    ?>
                        <li>
コード例 #9
0
ファイル: last-comments.php プロジェクト: obuhovski/my-site
?>

<div class="popular-post widget">
    <h3>Популярные комментарии</h3>

    <ul>
        <?php 
foreach ($comments as $comment) {
    ?>
            <li>
                <a href="<?php 
    echo $comment->entity . '#' . $comment->id;
    ?>
">
                    <?php 
    echo StringHelper::truncateWords($comment->content, 20);
    ?>
                </a>
                <br>
                <time>
                    <i class="glyphicon glyphicon-time"></i> <?php 
    echo $comment->created_at;
    ?>
                </time>
            </li>
        <?php 
}
?>
    </ul>

</div>
コード例 #10
0
 /**
  * Main RSS channel.
  * @return string
  */
 public function actionRss()
 {
     $response = Yii::$app->getResponse();
     $headers = $response->getHeaders();
     $headers->set('Content-Type', 'application/rss+xml; charset=utf-8');
     $response->content = RssView::widget(['dataProvider' => (new Forum())->search(null, true), 'channel' => ['title' => Config::getInstance()->get('name'), 'link' => Url::to(['default/index'], true), 'description' => Config::getInstance()->get('meta_description'), 'language' => Yii::$app->language], 'items' => ['title' => function ($model, $widget) {
         if (!empty($model->latest)) {
             return Html::encode($model->latest->thread->name);
         } else {
             return Html::encode($model->name);
         }
     }, 'description' => function ($model, $widget) {
         if (!empty($model->latest)) {
             return StringHelper::truncateWords($model->latest->content, 50, '...', true);
         }
         return '';
     }, 'link' => function ($model, $widget) {
         if (!empty($model->latest)) {
             return Url::to(['default/show', 'id' => $model->latest->id], true);
         }
         return Url::to(['default/forum', 'cid' => $model->category_id, 'id' => $model->id, 'slug' => $model->slug], true);
     }, 'author' => function ($model, $widget) {
         if (!empty($model->latest)) {
             return $model->latest->author->username;
         }
         return 'Podium';
     }, 'guid' => function ($model, $widget) {
         if (!empty($model->latest)) {
             return Url::to(['default/show', 'id' => $model->latest->id], true) . ' ' . Yii::$app->formatter->asDatetime($model->latest->updated_at, 'php:' . DATE_RSS);
         } else {
             return Url::to(['default/forum', 'cid' => $model->category_id, 'id' => $model->id, 'slug' => $model->slug], true) . ' ' . Yii::$app->formatter->asDatetime($model->updated_at, 'php:' . DATE_RSS);
         }
     }, 'pubDate' => function ($model, $widget) {
         if (!empty($model->latest)) {
             return Yii::$app->formatter->asDatetime($model->latest->updated_at, 'php:' . DATE_RSS);
         } else {
             return Yii::$app->formatter->asDatetime($model->updated_at, 'php:' . DATE_RSS);
         }
     }]]);
 }
コード例 #11
0
ファイル: _view.php プロジェクト: Rudianasaja/yiifeed
    ?>
        <?php 
}
?>
    </div>
    <div class="col-sm-9 col-md-10 post">
        <h1>
            <?php 
echo $isFull ? Html::encode($model->title) : Html::a(Html::encode($model->title), ['view', 'id' => $model->id]);
?>
        </h1>

        <div class="content">
            <?php 
$text = HtmlPurifier::process(Markdown::process($model->text));
echo $isFull ? $text : StringHelper::truncateWords($text, 70, '<p>' . Html::a('Read more', ['view', 'id' => $model->id]) . '</p>', true);
?>

            <?php 
if ($isFull) {
    ?>
            <div class="meta">
                <?php 
    if (!empty($model->link)) {
        ?>
                    <p><?php 
        echo Html::a(Html::encode($model->link), $model->link);
        ?>
</p>
                <?php 
    }
コード例 #12
0
ファイル: index.php プロジェクト: Avenger1/yii2-podium
                    </tr>
                </thead>
                <tbody>
<?php 
foreach ($posts as $post) {
    ?>
                    <tr>
                        <td><a href="<?php 
    echo Url::to(['default/show', 'id' => $post->id]);
    ?>
"><?php 
    echo Html::encode($post->thread->name);
    ?>
</a></td>
                        <td><span data-toggle="popover" data-container="body" data-placement="right" data-trigger="hover focus" data-html="true" data-content="<small><?php 
    echo str_replace('"', '&quote;', StringHelper::truncateWords($post->content, 20, '...', true));
    ?>
</small>" title="<?php 
    echo Yii::t('podium/view', 'Post Preview');
    ?>
"><span class="glyphicon glyphicon-leaf"></span></span></td>
                        <td><a href="<?php 
    echo Url::to(['admin/view', 'id' => $post->author->id]);
    ?>
"><?php 
    echo $post->author->podiumName;
    ?>
</a></td>
                        <td><span data-toggle="tooltip" data-placement="top" title="<?php 
    echo Yii::$app->formatter->asDateTime($post->created_at, 'long');
    ?>
コード例 #13
0
ファイル: index.php プロジェクト: ramialcheikh/quickforms
Carbon::setLocale(substr(Yii::$app->language, 0, 2));
// eg. en-US to en
?>
<div class="template-category-index">

    <?php 
echo GridView::widget(['id' => 'template-category-grid', 'dataProvider' => $dataProvider, 'resizableColumns' => false, 'pjax' => false, 'export' => false, 'responsive' => true, 'bordered' => false, 'striped' => true, 'panelTemplate' => '<div class="panel {type}">
            {panelHeading}
            {panelBefore}
            {items}
            <div style="text-align: center">{pager}</div>
        </div>', 'panel' => ['type' => GridView::TYPE_INFO, 'heading' => Yii::t('app', 'Templates') . ' <small class="panel-subtitle hidden-xs">' . Yii::t('app', 'By Categories') . '</small>', 'footer' => false, 'before' => ActionBar::widget(['grid' => 'template-category-grid', 'templates' => ['{create}' => ['class' => 'col-xs-6 col-md-8'], '{bulk-actions}' => ['class' => 'col-xs-6 col-md-2 col-md-offset-2']], 'bulkActionsItems' => [Yii::t('app', 'General') => ['general-delete' => Yii::t('app', 'Delete')]], 'bulkActionsOptions' => ['options' => ['general-delete' => ['url' => Url::toRoute('delete-multiple'), 'data-confirm' => Yii::t('app', 'Are you sure you want to delete these template categories? All data related to each item will be deleted. This action cannot be undone.')]], 'class' => 'form-control'], 'elements' => ['create' => Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Yii::t('app', 'Create Category'), ['create'], ['class' => 'btn btn-primary']) . ' ' . Html::a(Yii::t('app', 'Need to extend the app functionality?'), ['/addons'], ['data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('app', 'With our add-ons you can add great features and integrations to your forms. Try them now!'), 'class' => 'text hidden-xs hidden-sm'])], 'class' => 'form-control'])], 'toolbar' => false, 'columns' => [['class' => '\\kartik\\grid\\CheckboxColumn', 'headerOptions' => ['class' => 'kartik-sheet-style'], 'rowSelectedClass' => GridView::TYPE_WARNING], ['attribute' => 'name', 'format' => 'raw', 'value' => function ($model) {
    return Html::a(Html::encode($model->name), ['templates/category', 'id' => $model->id]);
}], ['attribute' => 'description', 'value' => function ($model) {
    if (isset($model->description)) {
        return StringHelper::truncateWords(Html::encode($model->description), 15);
    }
    return null;
}], ['attribute' => 'updated_at', 'value' => function ($model) {
    if (isset($model->updated_at)) {
        return Carbon::createFromTimestampUTC($model->updated_at)->diffForHumans();
    }
    return null;
}, 'label' => Yii::t('app', 'Last updated')], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => true, 'dropdownButton' => ['class' => 'btn btn-primary'], 'dropdownOptions' => ['class' => 'pull-right'], 'buttons' => ['view' => function ($url) {
    $options = array_merge(['title' => Yii::t('app', 'View'), 'aria-label' => Yii::t('app', 'View'), 'data-pjax' => '0'], []);
    return '<li>' . Html::a('<span class="glyphicon glyphicon-eye-open"></span> ' . Yii::t('app', 'View Record'), $url, $options) . '</li>';
}, 'update' => function ($url) {
    $options = array_merge(['title' => Yii::t('app', 'Update'), 'aria-label' => Yii::t('app', 'Update'), 'data-pjax' => '0'], []);
    return '<li>' . Html::a('<span class="glyphicon glyphicon-pencil"></span> ' . Yii::t('app', 'Update'), $url, $options) . '</li>';
}, 'delete' => function ($url) {
    $options = array_merge(['title' => Yii::t('app', 'Delete'), 'aria-label' => Yii::t('app', 'Delete'), 'data-confirm' => Yii::t('app', 'Are you sure you want to delete this template category?
コード例 #14
0
ファイル: rss.php プロジェクト: yii2mod/yii2-feed
<?php 
}
foreach ($items as $item) {
    ?>
    <li class="rss-post">
        <h2>
            <?php 
    echo Html::a($item->get_title(), $item->get_permalink(), ['target' => '_blank']);
    ?>
            <?php 
    if (isset($options['wrapperTagForDate'])) {
        ?>
                <?php 
        echo Html::tag($options['wrapperTagForDate'], $item->get_date('D, d M Y H:i:s'));
        ?>
            <?php 
    } else {
        ?>
                <?php 
        echo $item->get_date('D, d M Y H:i:s');
        ?>
            <?php 
    }
    ?>
        </h2>
        <?php 
    echo StringHelper::truncateWords(strip_tags($item->get_content()), 40);
    ?>
    </li>
<?php 
}
コード例 #15
0
ファイル: index.php プロジェクト: BoBRoID/new.k-z
                        <img class="nspImage" alt="<?php 
echo $latestNews->title;
?>
" src="<?php 
echo $latestNews->imagePreview;
?>
">
                    </div>
                    <h4 class="nspHeader">
                        <?php 
echo ($titleLen = ConfigurationHelper::getValue('i.titleWords')) ? StringHelper::truncateWords($latestNews->title, $titleLen) : $latestNews->title;
?>
                    </h4>
                </a>
                <?php 
echo Html::tag('div', ($textLen = ConfigurationHelper::getValue('i.textWords')) ? StringHelper::truncateWords($latestNews->getTextPreview(0, ''), $textLen) : $latestNews->getTextPreview(0, ''), ['class' => 'nspText textPreview', 'lang' => 'ru']);
?>
            </div>
        </div>
    </div>
    <div id="gkToptop3" class="gkCol gkColRight">
        <?php 
echo \frontend\widgets\LastNewsWidget::widget();
?>
    </div>
</div>
<div id="gkTop2" class="gkMain gkWrap">
    <div class="box nsp grey dotted">
        <div>
            <h3 class="header">
                <span>Новости дня</span>
コード例 #16
0
ファイル: _accion-especifica.php プロジェクト: minpppst/rsc
 * de Acciones Especificas
 */
use common\models\ProyectoAccionEspecificaSearch;
use yii\helpers\Html;
use yii\helpers\StringHelper;
use yii\widgets\Pjax;
use yii\helpers\Url;
use yii\bootstrap\Modal;
use kartik\grid\GridView;
use kartik\date\DatePicker;
use johnitvn\ajaxcrud\CrudAsset;
use johnitvn\ajaxcrud\BulkButtonWidget;
$searchModel = new ProyectoAccionEspecificaSearch(['id_proyecto' => $model->id]);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
//Iconos
$icons = ['nuevo' => '<span class="glyphicon glyphicon-file" aria-hidden="true"></span>', 'crear' => '<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>', 'editar' => '<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>', 'eliminar' => '<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>'];
echo GridView::widget(['id' => 'especifica', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'pjaxSettings' => ['options' => ['id' => 'especifica-pjax']], 'columns' => [['class' => 'kartik\\grid\\CheckboxColumn', 'width' => '20px'], ['class' => 'kartik\\grid\\SerialColumn', 'width' => '30px'], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'codigo_accion_especifica'], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'nombre', 'value' => function ($model) {
    //Cortar el nombre
    return StringHelper::truncateWords($model->nombre, 10);
}], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'nombreUnidadEjecutora', 'value' => function ($model) {
    //Cortar el nombre de la UE
    return StringHelper::truncateWords($model->nombreUnidadEjecutora, 6);
}], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'fecha_inicio', 'value' => function ($model) {
    return date('d/m/Y', strtotime($model->fecha_inicio));
}, 'filterType' => '\\kartik\\date\\DatePicker', 'filterWidgetOptions' => ['readonly' => true, 'pluginOptions' => ['todayHighlight' => false, 'todayBtn' => true, 'format' => 'yyyy-mm-dd', 'autoclose' => true]]], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'fecha_fin', 'value' => function ($model) {
    return date('d/m/Y', strtotime($model->fecha_fin));
}, 'filterType' => '\\kartik\\date\\DatePicker', 'filterWidgetOptions' => ['readonly' => true, 'pluginOptions' => ['todayHighlight' => false, 'todayBtn' => true, 'format' => 'yyyy-mm-dd', 'autoclose' => true]]], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => false, 'vAlign' => 'middle', 'urlCreator' => function ($action, $model, $key, $index) {
    return Url::to(['proyecto-accion-especifica/' . $action, 'id' => $key]);
}, 'viewOptions' => ['role' => 'modal-remote', 'title' => 'View', 'data-toggle' => 'tooltip'], 'updateOptions' => ['role' => 'modal-remote', 'title' => 'Update', 'data-toggle' => 'tooltip'], 'deleteOptions' => ['role' => 'modal-remote', 'title' => 'Delete', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-toggle' => 'tooltip', 'data-confirm-title' => 'Are you sure?', 'data-confirm-message' => 'Are you sure want to delete this item', 'class' => 'text-danger'], 'template' => '{view} {update} {prg} {delete}', 'buttons' => ['prg' => function ($model, $key, $index) {
    return Html::a('<span class="glyphicon glyphicon-calendar"></span>', Url::to(['proyecto-ae-meta/update', 'accionEspecifica' => $index]), ['role' => 'modal-remote', 'title' => 'Programación', 'data-toggle' => 'tooltip']);
}]]], 'toolbar' => [['content' => Html::a($icons['nuevo'] . ' Nuevo', ['proyecto-accion-especifica/create', 'proyecto' => $searchModel->id_proyecto], ['role' => 'modal-remote', 'title' => 'Crear Acción Específica', 'class' => 'btn btn-default']) . '{toggleData}' . '{export}']], 'striped' => true, 'condensed' => true, 'responsive' => true, 'panel' => ['type' => 'info', 'heading' => '<i class="glyphicon glyphicon-list"></i> Acciones Específicas', 'before' => '<em>* Gestionar Acciones Específicas de este proyecto.</em>', 'after' => BulkButtonWidget::widget(['buttons' => Html::a('<i class="glyphicon glyphicon-trash"></i>&nbsp; Eliminar', ["proyecto-accion-especifica/bulk-delete"], ["class" => "btn btn-danger btn-xs", 'role' => 'modal-remote-bulk', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-confirm-title' => 'Are you sure?', 'data-confirm-message' => 'Are you sure want to delete this item']) . ' ' . Html::a('<i class="glyphicon glyphicon-ban-circle"></i>&nbsp; Desactivar', ["proyecto-accion-especifica/bulk-desactivar", 'id_proyecto' => $searchModel->id_proyecto], ["class" => "btn btn-warning btn-xs", 'role' => 'modal-remote-bulk', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-confirm-title' => '¿Está seguro?', 'data-confirm-message' => '¿Está seguro que desea desactivar los elementos seleccionados?']) . ' ' . Html::a('<i class="glyphicon glyphicon-ok-circle"></i>&nbsp; Activar', ["proyecto-accion-especifica/bulk-activar", 'id_proyecto' => $searchModel->id_proyecto], ["class" => "btn btn-success btn-xs", 'role' => 'modal-remote-bulk', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-confirm-title' => '¿Está seguro?', 'data-confirm-message' => '¿Está seguro que desea activar los elementos seleccionados?'])]) . '<div class="clearfix"></div>']]);
コード例 #17
0
     ?>
                     <i class="video-play-inline"></i>
                 <?php 
 }
 ?>
             </a>
         </div>
         <div class="media-body fnt-smaller">
             <h4 class="media-heading" id="preview-title">
                 <?php 
 echo Html::a($pageInfo->getTitle(), $pageInfo->getUrl(), ['target' => '_blank']);
 ?>
             </h4>
             <p id="preview-description">
                 <?php 
 echo StringHelper::truncateWords($pageInfo->getDescription(), 50);
 ?>
             </p>
             <span id="preview-url">
                 <?php 
 echo $pageInfo->getRequest()->getHost();
 ?>
             </span>
             <?php 
 echo Html::activeHiddenInput($linkPreviewModel, 'image', ['value' => $pageInfo->getImage()]);
 ?>
             <?php 
 echo Html::activeHiddenInput($linkPreviewModel, 'title', ['value' => $pageInfo->getTitle()]);
 ?>
             <?php 
 echo Html::activeHiddenInput($linkPreviewModel, 'url', ['value' => $pageInfo->getUrl()]);
コード例 #18
0
ファイル: StringHelperTest.php プロジェクト: glowdan/yii2
 public function testTruncateWords()
 {
     $this->assertEquals('это тестовая multibyte строка', StringHelper::truncateWords('это тестовая multibyte строка', 5));
     $this->assertEquals('это тестовая multibyte...', StringHelper::truncateWords('это тестовая multibyte строка', 3));
     $this->assertEquals('это тестовая multibyte!!!', StringHelper::truncateWords('это тестовая multibyte строка', 3, '!!!'));
     $this->assertEquals('это строка с          неожиданными...', StringHelper::truncateWords('это строка с          неожиданными пробелами', 4));
     // With Html
     $this->assertEquals('<span>This is a test</span>...', StringHelper::truncateWords('<span>This is a test sentance</span>', 4, '...', true));
     $this->assertEquals('<span><img src="image.png" />This is a test</span>...', StringHelper::truncateWords('<span><img src="image.png" />This is a test sentance</span>', 4, '...', true));
 }
コード例 #19
0
 public function actionRssCategory($category = NULL)
 {
     if (Yii::$app->params['enableRss']) {
         if ($category) {
             $dataProvider = new ActiveDataProvider(['query' => PostsSearch::find()->where(['published' => 1, 'slugUrl' => $category])->orderBy('created_at DESC')->join('INNER JOIN', "{{%sources}}", "sources_id=sources.id")->join('INNER JOIN', "{{%categories}}", "categories_id=categories.id"), 'pagination' => ['pageSize' => Yii::$app->params['pageSizeRss']]]);
             $response = Yii::$app->getResponse();
             $headers = $response->getHeaders();
             $headers->set('Content-Type', 'application/rss+xml; charset=utf-8');
             echo \Zelenin\yii\extensions\Rss\RssView::widget(['dataProvider' => $dataProvider, 'channel' => ['title' => Yii::$app->params['SiteName'], 'link' => Url::toRoute('/', true), 'description' => Yii::t('app', 'New Records in category {0}', [Categories::getCategoryBySlug($category)->title]), 'language' => function ($widget, \Zelenin\Feed $feed) {
                 return Yii::$app->language;
             }], 'items' => ['image' => function ($model, $widget, \Zelenin\Feed $feed) {
                 return $model->activePhotos[0]->link;
             }, 'title' => function ($model, $widget, \Zelenin\Feed $feed) {
                 return empty($model->title) || is_null($model->title) || !isset($model->title) ? $model->alternativeTitle : $model->title;
             }, 'description' => function ($model, $widget, \Zelenin\Feed $feed) {
                 return '<img src="' . $model->activePhotos[0]->link . '" width="100" style="margin:10px;"/><br/>' . (!empty(StringHelper::truncateWords($model->content, 25)) ? StringHelper::truncateWords($model->content, 25) : NULL);
             }, 'link' => function ($model, $widget, \Zelenin\Feed $feed) {
                 return $model->urlFull;
             }, 'guid' => function ($model, $widget, \Zelenin\Feed $feed) {
                 return $model->recordId . $model->updated_at;
             }, 'pubDate' => function ($model, $widget, \Zelenin\Feed $feed) {
                 return Date(DATE_RSS, $model->updated_at);
             }]]);
         }
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #20
0
ファイル: view.php プロジェクト: luobenyu/blog-1
                        <span class="created_at"> · 发布于 <time
                                datetime="<?php 
    echo date('Y-m-d H:i:s', $article['created_at']);
    ?>
"><?php 
    echo Yii::$app->getFormatter()->asRelativeTime($article['created_at']);
    ?>
</time></span><span
                            class="comment-total"> · <?php 
    echo $article['comment_total'] > 0 ? '已经有' . $article['comment_total'] . '个用户发表了读后感' : '还没人鸟我哟';
    ?>
</span>
                    </section>
                    <div class="article-content">
                        <?php 
    echo \yii\helpers\StringHelper::truncateWords($parsedown->parse($article['text']), 10);
    ?>
                    </div>
                </article>
            <?php 
}
?>
            <?php 
echo \yii\widgets\LinkPager::widget(['pagination' => $articles['pagination']]);
?>
        </div>
        <div class="hidden-xs col-md-3 col-lg-4">
            <div class="panel panel-default">
                <div class="panel-heading">分类简介</div>
                <div class="panel-body"><?php 
echo $category['description'] ?: '唔,这个分类的介绍被搞丢了。。。';
コード例 #21
0
ファイル: article.php プロジェクト: BoBRoID/new.k-z
    foreach ($interest as $news) {
        ?>
        <a class="possibleArticle" href="<?php 
        echo $news->fullLink;
        ?>
">
            <div class="image"><?php 
        echo Html::img($news->imagePreview, ['alt' => $news->title]);
        ?>
</div>
            <div class="details">
                <span class="title" title="<?php 
        echo $news->title;
        ?>
"><?php 
        echo \yii\helpers\StringHelper::truncateWords($news->title, 5);
        ?>
</span>
                <span class="date"><?php 
        echo \Yii::$app->formatter->asDate($news->publishDate);
        ?>
</span>
            </div>
        </a>
    <?php 
    }
    ?>
</div>
<?php 
}
?>
コード例 #22
0
ファイル: _partblog.php プロジェクト: elgorm/yii2-blogervk
if ($model->activePhotos) {
    ?>
                    <a href="<?php 
    echo $model->url;
    ?>
"><img class="img-responsive" src="<?php 
    echo $model->activePhotos[0]->link;
    ?>
" alt="<?php 
    echo $model->activePhotos[0]->text;
    ?>
"></a>
                    <hr>
                    <?php 
}
?>
                    <p>
                        <?php 
echo \yii\helpers\StringHelper::truncateWords($model->content, 25, "...");
?>
                    </p>
                    <a class="btn btn-primary" href="<?php 
echo $model->url;
?>
"><?php 
echo Yii::t("app/posts", 'Read More');
?>
 <span class="glyphicon glyphicon-chevron-right"></span></a>

                    <hr>
コード例 #23
0
ファイル: calendarium.php プロジェクト: czechcamus/dasport
         }
         echo '</div>';
         echo '<div class="col s12 l11">';
     } else {
         echo '<div class="col s12">';
     }
     $dateTimeString = '<span class="subheader">( *&nbsp;' . Yii::$app->formatter->asDate($item->content_date, 'dd.MM.y');
     if ($item->content_end_date) {
         $dateTimeString .= ' , &dagger;&nbsp;' . Yii::$app->formatter->asDate($item->content_end_date, 'dd.MM.y');
     }
     $dateTimeString .= ' )</span>';
     echo '<h4>' . $dateTimeString . Html::a($item->title, $url) . '</h4>';
     $text = strip_tags($item->perex, 'a, strong, b, em, i');
     echo '<p>';
     if ($wordsCount) {
         echo StringHelper::truncateWords($text, $wordsCount);
     } else {
         echo $text;
     }
     echo '</div>';
     echo '</div>';
     echo '</div>';
     if ($test == $columnsCount - 1) {
         echo '</div>';
     }
     ++$i;
 }
 if ($test != $columnsCount - 1) {
     echo '</div>';
 }
 echo '</div>';
コード例 #24
0
ファイル: index.php プロジェクト: minpppst/rsc
<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use yii\helpers\StringHelper;
/* @var $this yii\web\View */
/* @var $searchModel app\models\ProyectoPedidoSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Proyecto - Requerimientos';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="proyecto-pedido-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'striped' => true, 'condensed' => true, 'responsive' => true, 'pjax' => true, 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', [''], ['data-pjax' => 1, 'class' => 'btn btn-default', 'title' => 'Reset Grid']) . '{toggleData}']], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'proyectoEspecifica.nombreProyecto', 'value' => function ($model) {
    return StringHelper::truncateWords($model->proyectoEspecifica->nombreProyecto, 15);
}], 'nombreEspecifica', ['class' => 'kartik\\grid\\ActionColumn', 'header' => 'Acciones', 'vAlign' => 'middle', 'buttons' => ['asignar' => function ($url, $model) {
    return Html::a('<i class="glyphicon glyphicon-shopping-cart"></i> Solicitar', ['pedido', 'asignado' => $model->id], ['class' => 'btn btn-primary', 'data-request-method' => 'post', 'data-pjax' => '0']);
}], 'template' => '{asignar}']], 'panel' => ['type' => 'warning', 'heading' => '<i class="glyphicon glyphicon-shopping-cart"></i> Proyecto - Requerimientos', 'before' => '<em><b>' . $usuario->username . '</b> - Seleccione la acción específica para el pedido.</em>', 'after' => '<div class="clearfix"></div>']]);
?>

</div>
コード例 #25
0
echo $model->postViewed ? ' viewed' : (Yii::$app->user->isGuest ? '' : ' new');
?>
"><?php 
echo Html::a(Html::encode($model->title), $model->getFrontendViewLink());
?>
</h4>
    <div class="issue-bar">
        <small class="issue-published"><?php 
echo Yii::$app->formatter->asDatetime($model->published_at);
?>
</small>
        <small class="issue-separator">|</small>
        <?php 
foreach ($model->tags as $tag) {
    /** @var $tag \gromver\platform\basic\modules\tag\models\Tag */
    echo Html::a($tag->title, ['/grom/news/frontend/post/tag', 'tag_id' => $tag->id, 'tag_alias' => $tag->alias, 'category_id' => $postListWidget->category ? $postListWidget->category->id : null], ['class' => 'issue-tag badge']);
}
?>
    </div>
    <?php 
if ($model->preview_image) {
    echo Html::img($model->getFileUrl('preview_image'), ['class' => 'pull-left', 'style' => 'max-width: 200px; margin-right: 15px;']);
}
?>

    <div class="issue-preview"><?php 
echo $model->preview_text ? $model->preview_text : \yii\helpers\StringHelper::truncateWords(strip_tags($model->detail_text), 50);
?>
</div>
    <div class="clearfix"></div>
</div>
コード例 #26
0
ファイル: SiteController.php プロジェクト: czechcamus/dasport
 public function actionRss()
 {
     $model = new SearchContent();
     $dataProvider = $model->getItems(true);
     $response = Yii::$app->getResponse();
     $headers = $response->getHeaders();
     $headers->set('Content-Type', 'application/rss+xml; charset=utf-8');
     /** @noinspection PhpUnusedParameterInspection */
     $response->content = RssView::widget(['dataProvider' => $dataProvider, 'channel' => ['title' => Yii::$app->name, 'link' => Url::toRoute('/', true), 'description' => Yii::t('front', 'Articles'), 'language' => Yii::$app->language], 'items' => ['title' => function ($model, $widget) {
         return $model['title'];
     }, 'description' => function ($model, $widget) {
         return StringHelper::truncateWords($model['perex'], 50);
     }, 'link' => function ($model, $widget) {
         return Url::toRoute(['site/content', 'id' => $model['id']], true);
     }, 'guid' => function ($model, $widget) {
         $date = \DateTime::createFromFormat('Y-m-d H:i:s', $model['updated_at']);
         return Url::toRoute(['site/content', 'id' => $model['id']], true) . ' ' . $date->format(DATE_RSS);
     }, 'pubDate' => function ($model, $widget) {
         $date = \DateTime::createFromFormat('Y-m-d H:i:s', $model['updated_at']);
         return $date->format(DATE_RSS);
     }]]);
 }
コード例 #27
0
ファイル: _columns.php プロジェクト: minpppst/rsc
<?php

use yii\helpers\Url;
use yii\helpers\Html;
use yii\helpers\StringHelper;
return [['class' => 'kartik\\grid\\CheckboxColumn', 'width' => '20px'], ['class' => 'kartik\\grid\\SerialColumn', 'width' => '30px'], ['class' => '\\kartik\\grid\\DataColumn', 'header' => 'Proyecto', 'value' => function ($model) {
    return StringHelper::truncateWords($model->proyecto->nombre, 10);
}], ['class' => '\\kartik\\grid\\DataColumn', 'header' => 'Acción Específica', 'attribute' => 'proyectoEspecifica.nombre'], ['class' => '\\kartik\\grid\\DataColumn', 'header' => 'Unidad Ejecutora', 'attribute' => 'proyectoEspecifica.idUnidadEjecutora.nombre'], ['class' => '\\kartik\\grid\\DataColumn', 'width' => '50px', 'attribute' => 'estatus', 'filter' => [1 => 'Activo', 0 => 'Inactivo'], 'value' => function ($model) {
    if ($model->estatus == 1) {
        return Html::a($model->nombreEstatus, ['toggle-activo', 'id' => $model->id], ['class' => 'btn btn-xs btn-success btn-block', 'role' => 'modal-remote', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-confirm-title' => Yii::t('user', '¿Está seguro?'), 'data-confirm-message' => Yii::t('user', '¿Está seguro que desea desactivar este elemento?')]);
    } else {
        return Html::a($model->nombreEstatus, ['toggle-activo', 'id' => $model->id], ['class' => 'btn btn-xs btn-warning btn-block', 'role' => 'modal-remote', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-confirm-title' => Yii::t('user', '¿Está seguro?'), 'data-confirm-message' => Yii::t('user', '¿Está seguro que desea activar este elemento?')]);
    }
}, 'format' => 'raw'], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => false, 'header' => 'Acciones', 'vAlign' => 'middle', 'urlCreator' => function ($action, $model, $key, $index) {
    return Url::to([$action, 'id' => $key]);
}, 'viewOptions' => ['role' => 'modal-remote', 'title' => 'View', 'data-toggle' => 'tooltip'], 'updateOptions' => ['role' => 'modal-remote', 'title' => 'Update', 'data-toggle' => 'tooltip'], 'deleteOptions' => ['role' => 'modal-remote', 'title' => 'Delete', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-toggle' => 'tooltip', 'data-confirm-title' => 'Are you sure?', 'data-confirm-message' => 'Are you sure want to delete this item']]];
コード例 #28
0
ファイル: _columns.php プロジェクト: minpppst/rsc
<?php

use yii\helpers\Url;
use yii\helpers\StringHelper;
return [['class' => 'kartik\\grid\\CheckboxColumn', 'width' => '20px'], ['class' => 'kartik\\grid\\SerialColumn', 'width' => '30px'], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'objetivo_nacional', 'value' => function ($model, $key, $index) {
    return StringHelper::truncateWords($model->objetivo_nacional, 20, '...');
}], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'objetivo_historico'], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => false, 'vAlign' => 'middle', 'urlCreator' => function ($action, $model, $key, $index) {
    return Url::to([$action, 'id' => $key]);
}, 'viewOptions' => ['role' => 'modal-remote', 'title' => 'View', 'data-toggle' => 'tooltip'], 'updateOptions' => ['role' => 'modal-remote', 'title' => 'Update', 'data-toggle' => 'tooltip'], 'deleteOptions' => ['role' => 'modal-remote', 'title' => 'Delete', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-toggle' => 'tooltip', 'data-confirm-title' => 'Are you sure?', 'data-confirm-message' => 'Are you sure want to delete this item']]];
コード例 #29
0
ファイル: index.php プロジェクト: Andrewkha/sportforecast
echo Html::a('Добавить', ['create'], ['class' => 'btn btn-success']);
?>
        </p>

        <?php 
$form = ActiveForm::begin(['action' => ['news/archive'], 'id' => 'news']);
?>

        <?php 
ActiveForm::end();
?>

        <div class="row">
            <?php 
echo GridView::widget(['export' => false, 'showFooter' => true, 'responsive' => false, 'dataProvider' => $dataProvider, 'options' => ['class' => 'col-xs-12'], 'beforeFooter' => [['columns' => [['content' => Html::submitButton('Применить', ['class' => 'btn btn-success', 'form' => 'news']), 'options' => ['colspan' => 7, 'style' => 'text-align: right']]]]], 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'headerOptions' => ['style' => 'text-align:center'], 'contentOptions' => ['align' => 'center', 'style' => 'vertical-align:middle'], 'filter' => false, 'options' => ['class' => 'col-xs-1']], ['attribute' => 'subject', 'content' => function ($model) {
    return Html::a('<b>' . $model->subject . '</b>', ['news/update', 'id' => $model->id]);
}, 'format' => 'html', 'contentOptions' => ['style' => 'vertical-align:middle'], 'headerOptions' => ['style' => 'text-align:center'], 'options' => ['class' => 'col-xs-2']], ['attribute' => 'body', 'format' => 'html', 'content' => function ($model) {
    return StringHelper::truncateWords($model->body, 10) . Html::a('>>', ['news/update', 'id' => $model->id]);
}, 'headerOptions' => ['style' => 'text-align:center'], 'options' => ['class' => 'col-xs-4']], ['attribute' => 'date', 'contentOptions' => ['align' => 'center', 'style' => 'vertical-align:middle'], 'options' => ['class' => 'col-xs-1'], 'headerOptions' => ['style' => 'text-align:center'], 'content' => function ($model) {
    return date('d/m/y', $model->date);
}, 'filter' => false], ['attribute' => 'author', 'contentOptions' => ['align' => 'center', 'style' => 'vertical-align:middle'], 'options' => ['class' => 'col-xs-1'], 'headerOptions' => ['style' => 'text-align:center'], 'content' => function ($model) {
    return $model->author0->username;
}, 'filter' => $author], ['attribute' => 'id_tournament', 'contentOptions' => ['align' => 'center', 'style' => 'vertical-align:middle'], 'options' => ['class' => 'col-xs-1'], 'headerOptions' => ['style' => 'text-align:center'], 'content' => function ($model) {
    return $model->id_tournament == 0 ? 'Новости сайта' : $model->tournament->tournament_name;
}, 'filter' => $tournament], ['attribute' => 'archive', 'contentOptions' => ['align' => 'center', 'style' => 'vertical-align:middle'], 'options' => ['class' => 'col-xs-1'], 'headerOptions' => ['style' => 'text-align:center'], 'content' => function ($model) use($form) {
    return Html::hiddenInput("News[{$model->id}][archive]", 0, ['form' => 'news']) . $form->field($model, "[{$model->id}]archive")->checkbox(['uncheck' => null, 'label' => '', 'form' => 'news']);
}, 'filter' => $archive], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}', 'contentOptions' => ['align' => 'center', 'style' => 'vertical-align:middle'], 'options' => ['class' => 'col-xs-1']]]]);
?>
        </div>
    </div>
</div>
コード例 #30
0
 public function actionRss()
 {
     $path = Yii::getAlias('@vendor/zelenin/rss-generator/Feed.php');
     require_once $path;
     $dataProvider = new \yii\data\ActiveDataProvider(['query' => \sircovsw\blog\models\BlogPost::find()->where(['status' => \sircovsw\blog\models\Status::STATUS_ACTIVE])->orderBy(['created_at' => SORT_DESC]), 'pagination' => ['pageSize' => 10]]);
     $response = Yii::$app->getResponse();
     $headers = $response->getHeaders();
     $headers->set('Content-Type', 'application/rss+xml; charset=utf-8');
     echo \Zelenin\yii\extensions\Rss\RssView::widget(['dataProvider' => $dataProvider, 'channel' => ['title' => Yii::$app->name, 'link' => Url::toRoute('/', true), 'description' => 'Блог LinkOnAvt - помощь, справочные материалы, обсуждения', 'language' => function ($widget, \Zelenin\Feed $feed) {
         return Yii::$app->language;
     }, 'image' => function ($widget, \Zelenin\Feed $feed) {
         $feed->addChannelImage('http://' . Yii::$app->params["domain"] . '/img/logo.png', 'http://' . Yii::$app->params["domain"], 100, 100, 'Продвижение сайта самостоятельно');
     }], 'items' => ['title' => function ($model, $widget, \Zelenin\Feed $feed) {
         return $model->title;
     }, 'description' => function ($model, $widget, \Zelenin\Feed $feed) {
         return StringHelper::truncateWords($model->brief, 50);
     }, 'link' => function ($model, $widget, \Zelenin\Feed $feed) {
         $url = 'http://' . Yii::$app->params["domain"] . '/blog/view/' . $model->surname;
         return $url;
         //return Yii::$app->getUrlManager()->createUrl(['blog/default/view', 'surname' => $model->surname]);
         //return Url::toRoute(['blog/default/view', 'surname' => $model->surname], true);
     }, 'author' => function ($model, $widget, \Zelenin\Feed $feed) {
         return $model->user->email . ' (' . $model->user->username . ')';
     }, 'guid' => function ($model, $widget, \Zelenin\Feed $feed) {
         $date = date('d.m.Y H:i:s', $model->created_at);
         $url = 'http://' . Yii::$app->params["domain"] . '/blog/view/' . $model->surname;
         return $url;
         //.' '.\Datetime::createFromFormat('d.m.Y H:i:s', $date)->format(DATE_RSS);
         //return Url::toRoute(['blog/default/view', 'surname' => $model->surname], true).' '.\Datetime::createFromFormat('d.m.Y H:i:s', $date)->format(DATE_RSS);
     }, 'pubDate' => function ($model, $widget, \Zelenin\Feed $feed) {
         $date = date('d.m.Y H:i:s', $model->created_at);
         return \Datetime::createFromFormat('d.m.Y H:i:s', $date)->format(DATE_RSS);
     }]]);
 }