/** * @param string|array $item the item to be normalized. * @return string|array normalized item. */ protected function normalizeItem($item) { if (is_array($item)) { if (isset($item['icon'])) { if (isset($item['label'])) { $label = $item['label']; $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels; if ($encodeLabel) { $label = Html::encode($label); } } else { $label = ''; } $item['encode'] = false; $label = Html::icon($item['icon']) . ' ' . $label; $item['label'] = $label; } if (isset($item['items'])) { foreach ($item['items'] as $key => $value) { $item['items'][$key] = $this->normalizeItem($value); } } } return $item; }
/** * @inheritdoc */ public function run() { if (!$this->height) { $this->height = $this->width; } if (!isset($this->linkOptions['href'])) { $this->linkOptions['href'] = $this->space->getUrl(); } if ($this->space->color != null) { $color = Html::encode($this->space->color); } else { $color = '#d7d7d7'; } if (!isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ""; } if (!isset($this->htmlOptions['style'])) { $this->htmlOptions['style'] = ""; } $acronymHtmlOptions = $this->htmlOptions; $imageHtmlOptions = $this->htmlOptions; $acronymHtmlOptions['class'] .= " space-profile-acronym-" . $this->space->id . " space-acronym"; $acronymHtmlOptions['style'] .= " background-color: " . $color . "; width: " . $this->width . "px; height: " . $this->height . "px;"; $acronymHtmlOptions['style'] .= " " . $this->getDynamicStyles($this->width); $imageHtmlOptions['class'] .= " space-profile-image-" . $this->space->id . " img-rounded profile-user-photo"; $imageHtmlOptions['style'] .= " width: " . $this->width . "px; height: " . $this->height . "px"; $imageHtmlOptions['alt'] = Html::encode($this->space->name); $defaultImage = basename($this->space->getProfileImage()->getUrl()) == 'default_space.jpg' || basename($this->space->getProfileImage()->getUrl()) == 'default_space.jpg?cacheId=0' ? true : false; if (!$defaultImage) { $acronymHtmlOptions['class'] .= " hidden"; } else { $imageHtmlOptions['class'] .= " hidden"; } return $this->render('image', ['space' => $this->space, 'acronym' => $this->getAcronym(), 'link' => $this->link, 'linkOptions' => $this->linkOptions, 'acronymHtmlOptions' => $acronymHtmlOptions, 'imageHtmlOptions' => $imageHtmlOptions]); }
public function init() { if ($this->toUser || $this->subject || $this->content) { throw new Exception('邮件属性不能为空'); } $this->subject = Html::encode($this->subject); }
/** * @inheritdoc */ public function getAsHtml() { $contentInfo = $this->getContentInfo($this->getCommentedRecord()); if ($this->groupCount > 1) { return Yii::t('CommentModule.notification', "{displayNames} commented {contentTitle}.", array('displayNames' => $this->getGroupUserDisplayNames(), 'contentTitle' => $contentInfo)); } return Yii::t('CommentModule.notification', "{displayName} commented {contentTitle}.", array('displayName' => Html::tag('strong', Html::encode($this->originator->displayName)), 'contentTitle' => $contentInfo)); }
/** * @inheritdoc * **/ protected function renderItem($item) { //Есть ли дочерние элементы if (ArrayHelper::getValue($item, 'items')) { $template = value($this->parentLinkTemplate, $this->linkTemplate); } else { $template = $this->linkTemplate; } if (isset($item['url'])) { $template = ArrayHelper::getValue($item, 'template', $template); return strtr($template, ['{url}' => Html::encode(Url::to($item['url'])), '{label}' => $item['label'], '{icon}' => ArrayHelper::getValue($item, 'icon', null), '{active}' => ($this->isItemActive($item) or ArrayHelper::getValue($item, 'active', false)) ? $this->activeCssClass : null]); } else { $template = ArrayHelper::getValue($item, 'template', $this->labelTemplate); return strtr($template, ['{label}' => $item['label']]); } }
public function actionForm() { /* @var $name string*/ /* @var $email string */ $form = new MyForm(); if ($form->load(Yii::$app->request->post()) && $form->validate()) { $name = Html::encode($form->name); $email = Html::encode($form->email); $form->file = UploadedFile::getInstance($form, 'file'); $form->file->saveAs('photo/' . $form->file->baseName . '.' . $form->file->extension); } else { $name = ''; $email = ''; } return $this->render('form', ['form' => $form, 'name' => $name, 'email' => $email]); }
/** * Renders single item. * @param array $item item configuration. * @return string rendered HTML */ protected function renderItem($item) { if (isset($item[0])) { $url = $item; $options = []; } else { $url = $item['url']; $options = $item; unset($options['url']); } // label : if (isset($options['label'])) { $label = $options['label']; unset($options['label']); } else { $label = $this->detectLabel($url); } if (isset($options['encode'])) { $encodeLabel = $options['encode']; unset($options['encode']); } else { $encodeLabel = $this->encodeLabels; } if ($encodeLabel) { $label = Html::encode($label); } // icon : if (isset($options['icon'])) { $icon = $options['icon']; unset($options['icon']); } else { $icon = $this->detectIcon($url); } if ($icon) { $label = Html::icon($icon) . ' ' . $label; } // CSS class : if (isset($options['class'])) { Html::addCssClass($options, ['widget' => 'btn']); } else { $options['class'] = ['btn', $this->detectClass($url)]; } if (!isset($options['data'])) { $options['data'] = $this->detectData($url); } return Html::a($label, $url, $options); }
/** * 验证邮箱 * @return \yii\web\Response * @throws Exception */ public function actionEmail() { $a = Html::encode(Yii::$app->request->get('a')); if (!$a) { throw new Exception('链接错误'); } $model = Yii::$app->user->identity; if ($model->validateAuthKey($a)) { $model->generateAuthKey(); $model->is_email = User::IS_EMAIL_TRUE; if ($model->save(false)) { return $this->redirect(['/user/index']); } else { throw new Exception('验证邮箱失败'); } } else { throw new Exception('身份不正确'); } }
/** * Renders menu items. * * @param array $items the menu items to be rendered * @param array $options the container HTML attributes * @return string the rendering result. * @throws InvalidConfigException if the label option is not specified in one of the items. */ protected function renderItems($items, $options = []) { $lines = []; foreach ($items as $i => $item) { if (isset($item['visible']) && !$item['visible']) { unset($items[$i]); continue; } if (is_string($item)) { $lines[] = $item; continue; } if (!array_key_exists('label', $item)) { throw new InvalidConfigException("The 'label' option is required."); } $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels; $label = $encodeLabel ? Html::encode($item['label']) : $item['label']; $itemOptions = ArrayHelper::getValue($item, 'options', []); $icon = ArrayHelper::getValue($item, 'icon', ''); $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []); $linkOptions['tabindex'] = '-1'; $url = array_key_exists('url', $item) ? $item['url'] : null; if (!empty($icon)) { $icon = Html::tag('i', '', ['class' => $icon]); } if (empty($item['items'])) { if ($url === null) { $content = $label; Html::addCssClass($itemOptions, 'dropdown-header'); } else { $content = Html::a($icon . $label, $url, $linkOptions); } } else { $submenuOptions = $options; unset($submenuOptions['id']); $content = Html::a($label, $url === null ? '#' : $url, $linkOptions) . $this->renderItems($item['items'], $submenuOptions); Html::addCssClass($itemOptions, 'dropdown-submenu'); } $lines[] = Html::tag('li', $content, $itemOptions); } return Html::tag('ul', implode("\n", $lines), $options); }
/** * @inheritdoc */ public function init() { if (!isset($this->options['id'])) { $this->options['id'] = $this->getId(); } if ($this->requiresDjax()) { ob_start(); ob_implicit_flush(false); $view = $this->getView(); $view->clear(); $view->beginPage(); $view->head(); $view->beginBody(); if ($view->title !== null) { echo Html::tag('title', Html::encode($view->title)); } } else { echo Html::beginTag('div', $this->options); } }
/** * @inheritdoc */ public function getAsHtml() { return Yii::t('SpaceModule.notification', '{displayName} declined your membership request for the space {spaceName}', array('{displayName}' => Html::tag('strong', Html::encode($this->originator->displayName)), '{spaceName}' => Html::tag('strong', Html::encode($this->source->name)))); }
Icon::map($this, Icon::FA); $this->beginPage(); ?> <!DOCTYPE html> <html lang="<?php echo Yii::$app->language; ?> "> <head> <meta charset="<?php echo Yii::$app->charset; ?> "/> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo Html::encode($this->title . ' | Administrator'); ?> </title> <?php // Css $this->registerCssFile($this->theme->baseUrl . '/css/plugins/iCheck/custom.css', ['depends' => BackendAsset::className()]); // $this->registerCssFile($this->theme->baseUrl . '/css/plugins/cropper/cropper.min.css', ['depends' => BackendAsset::className()]); // $this->registerCssFile($this->theme->baseUrl . '/css/plugins/cropper/main.css', ['depends' => BackendAsset::className()]); $this->registerCssFile($this->theme->baseUrl . '/css/animate.css', ['depends' => BackendAsset::className()]); $this->registerCssFile($this->theme->baseUrl . '/css/style.css', ['depends' => BackendAsset::className()]); $this->registerCssFile($this->theme->baseUrl . '/css/letyii.css', ['depends' => BackendAsset::className()]); // Javascript $this->registerJsFile($this->theme->baseUrl . '/js/plugins/metisMenu/jquery.metisMenu.js', ['depends' => BackendAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/js/plugins/slimscroll/jquery.slimscroll.min.js', ['depends' => BackendAsset::className()]); // iCheck $this->registerJsFile($this->theme->baseUrl . '/js/plugins/iCheck/icheck.min.js', ['depends' => BackendAsset::className()]);
/** * Renders button. * @param string $name button name. * @param mixed $model * @param string $key * @param integer $index * @return string rendered HTML * @throws InvalidConfigException on invalid button format. */ protected function renderButton($name, $model, $key, $index) { if (!isset($this->buttons[$name])) { return ''; } $button = $this->buttons[$name]; if ($button instanceof \Closure) { $url = $this->createUrl($name, $model, $key, $index); return call_user_func($button, $url, $model, $key); } if (!is_array($button)) { throw new InvalidConfigException("Button should be either a Closure or array configuration."); } // Visibility : if (isset($button['visible'])) { if ($button['visible'] instanceof \Closure) { if (!call_user_func($button['visible'], $model, $key, $index)) { return ''; } } elseif (!$button['visible']) { return ''; } } // URL : if (isset($button['url'])) { $url = call_user_func($button['url'], $name, $model, $key, $index); } else { $url = $this->createUrl($name, $model, $key, $index); } // label : if (isset($button['label'])) { $label = $button['label']; if (isset($button['encode'])) { $encodeLabel = $button['encode']; unset($button['encode']); } else { $encodeLabel = true; } if ($encodeLabel) { $label = Html::encode($label); } } else { $label = ''; } // icon : if (isset($button['icon'])) { $icon = $button['icon']; $label = Html::icon($icon) . (empty($label) ? '' : ' ' . $label); } $options = array_merge(ArrayHelper::getValue($button, 'options', []), $this->buttonOptions); return Html::a($label, $url, $options); }
protected function renderLink($item) { $lines = []; foreach ($item as $i => $item) { if (isset($item['url'])) { $template = ArrayHelper::getValue($item, 'template', $this->linkTemplate); $lines[] = strtr($template, ['{url}' => Html::encode(Url::to($item['url'])), '{label}' => $item['label']]); } else { $template = ArrayHelper::getValue($item, 'template', $this->labelTemplate); $lines[] = strtr($template, ['{label}' => $item['label']]); } } return implode("\n", $lines); }
<tr> <td><?php echo $specie->getAttributeLabel('dutch'); ?> </td> <td><?php echo Html::encode($specie->dutch); ?> </td> </tr> <?php if ($specie->url) { ?> <tr> <td><?php echo $specie->getAttributeLabel('url'); ?> </td> <td><a href="<?php echo Html::encode($specie->url); ?> "><?php echo Html::encode($specie->url); ?> </a></td> </tr> <?php } ?> </table> </div>
<?php use app\api\NewsItemObject; use yii\bootstrap\Html; use yii\helpers\Url; use yii\web\View; use yii\widgets\Breadcrumbs; /** * @var View $this * @var NewsItemObject $newsItem */ $this->title = Html::encode($newsItem->model->name); $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'News'), 'url' => ['/news/index']]; $this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => [Url::to()]]; ?> <div class="shop-page"> <div class="row"> <div class="col-md-12"> <?php echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]); ?> </div> <div class="col-md-12"> <h1> <?php echo $newsItem->model->name; ?> </h1> <div class="thumbnail no-border"> <?php
<section> <div class="panel panel-info"> <div class="panel-heading">All Glyphicons</div> <div class="panel-body"> <div class="row"> <?php foreach ($glyphicons as $icon) { ?> <div class="fa col-md-4"> <p> <?php echo GI::i($icon)->fixedWidth(); ?> <?php echo Html::encode('GI::i(\'' . $icon . '\')'); ?> <br> </p> </div> <?php } ?> </div> </div> </div> </section> </div><!-- /.body-content --> </div><!-- /#content-wrapper -->
/* @var $this \yii\web\View */ use yii\bootstrap\Html; /* @var \common\models\Blog[] $models */ echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <?php if ($models) { ?> <?php foreach ($models as $model) { ?> <url> <loc><?php echo Html::encode($model->getViewUrl(true)); ?> </loc> <lastmod><?php echo Yii::$app->formatter->asDate($model->updated_at, 'php:Y-m-d'); ?> </lastmod> </url> <?php } ?> <?php } ?> </urlset>
<div class="main-breadcrumb"> <?php echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]); ?> </div> </div> </div> </div> <!-- # BREADCRUMB --> <!--//Get all flash messages and loop through them--> <?php foreach (Yii::$app->session->getAllFlashes() as $message) { ?> <?php echo \kartik\widgets\Growl::widget(['type' => !empty($message['type']) ? $message['type'] : 'danger', 'title' => !empty($message['title']) ? Html::encode($message['title']) : 'Title Not Set!', 'icon' => !empty($message['icon']) ? $message['icon'] : 'fa fa-info', 'body' => !empty($message['message']) ? Html::encode($message['message']) : 'Message Not Set!', 'showSeparator' => true, 'delay' => 1, 'pluginOptions' => ['delay' => !empty($message['duration']) ? $message['duration'] : 3000, 'placement' => ['from' => !empty($message['positonY']) ? $message['positonY'] : 'top', 'align' => !empty($message['positonX']) ? $message['positonX'] : 'right']]]); ?> <?php } ?> <?php echo $content; ?> <!-- FOOTER --> <footer id="footer" class="footer-container"> <div class="main-footer"> <div class="container"> <div class="row"> <div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<?php echo Header::widget(); ?> <div class="content-wrapper"> <div class="container"> <section class="content-header" style="padding: 10px 0"> <h1> <?php echo Html::encode($this->title); ?> <?php if (!empty($this->params['subtitle'])) { ?> <small><?php echo Html::encode($this->params['subtitle']); ?> </small> <?php } ?> </h1> <?php echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]); ?> </section> <section class="content" style="padding: 10px 0"> <?php echo Alert::widget(); ?>
?> </td> </tr> <?php } ?> <?php if ($model->visit->embargo) { ?> <tr> <td><?php echo $visitModel->getAttributeLabel('embargo'); ?> </td> <td><?php echo Html::encode($model->visit->embargo); ?> </td> </tr> <?php } ?> <?php } ?> </table> <?php $form = ActiveForm::begin(['enableClientValidation' => false, 'options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'box_id')->dropDownList(Arrayhelper::map($boxes, 'id', 'code'));
<?php /** * @var yii\web\View $this * @var \webtoolsnz\importer\models\Import $model */ use yii\bootstrap\Html; use webtoolsnz\importer\models\Import; ?> <div class="panel panel-default"> <div class="panel-heading"> Importing <?php echo Html::encode($model->filename); ?> </div> <div class="panel-body"> <table class="table"> <tr> <th>Status:</th> <td class="status-text"><?php echo $model->getStatus(); ?> </td> </tr> <tr> <th>Time Elapsed:</th> <td class="time-elapsed"><?php echo $model->getTimeElapsed(); ?>
/* @var $this yii\web\View */ /* @var $name string */ /* @var $message string */ /* @var $exception Exception */ $this->title = $name; ?> <div class="site-error"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]); ?> <div class="alert alert-danger"> <?php echo nl2br(Html::encode($message)); ?> </div> <p> The above error occurred while the Web server was processing your request. </p> <p> Please contact us if you think this is a server error. Thank you. </p> </div>
* User: brunosalzano * Date: 25/01/16 * Time: 07:41 */ /** @var $this \yii\web\View */ use yii\bootstrap\Html; use d4rkstar\dbconfig\components\ConfigurationUtils; use yii\helpers\Inflector; use yii\bootstrap\Collapse; $params = Yii::$app->controller->module->config->params; print Html::beginForm('', 'post', ['class' => 'form-horizontal']); $this->title = Yii::t('app', 'Configuration'); $this->params['breadcrumbs'][] = $this->title; $items = []; $isFirst = true; print Html::tag('h1', Html::encode($this->title)); if (!Yii::$app->user->isGuest) { print ' ' . Html::tag('small', Html::icon('pencil', ['class' => 'xs']) . Html::a('Manage', \yii\helpers\Url::to('manage'))); } ?> <?php if (count($params) == 0) { print Html::tag('h2', Yii::t('app', 'No configuration items.')); } else { print Html::tag('p', Yii::t('app', 'Click on the titles to expand.')); foreach ($params as $group => $params) { $options = []; /*if ($isFirst) { $options['class'] = 'in';
<?php use user\models\Role as RoleForm; use yii\bootstrap\Html; use yii\web\View; /* @var $this View */ /* @var $model RoleForm */ print Html::tag('h1', Yii::t('user', 'Update role: {name}', ['name' => Html::encode($model->getName())])); print $this->render('_form', ['model' => $model]);
/** * @inheritdoc */ public function getAsHtml() { return Yii::t('FriendshipModule.notification', '{displayName} declined your friend request.', array('displayName' => Html::tag('strong', Html::encode($this->originator->displayName)))); }
<?php echo ContributorLine::widget(['contributor' => $contributorApi->getContributor($project->repo_type, $commit->contributorName, $commit->contributorEmail), 'avatarSize' => 'small', 'useLink' => false]); ?> <br /> <span class="label label-info"><?php echo Html::encode($project->title); ?> </span> <span class="commit-date"><?php echo $commit->getDate()->format('d\'M y H:i:s'); ?> </span> </div> <div class="col-md-8 commit-message"> <strong class="list-group-item-heading"><?php echo Html::encode($commit->message); ?> </strong> </div> </a> <?php } ?> </div> <?php echo LinkPager::widget(['pagination' => $pagination]); ?> <?php echo $this->render('_branches', ['project' => $project, 'branches' => $branches]);
<?php /* @var $this yii\web\View */ /* @var $model common\models\Group */ use yii\bootstrap\Html; use yii\helpers\ArrayHelper; $this->title = Html::encode($model->name); ?> <div class="site-group"> <h1><?php echo $this->title; ?> </h1> <div class="row"> <div class="col-xs-12 col-sm-4 col-md-3"> <div class="group-info"> <?php if ($model->has_logo) { ?> <div class="group-logo"> <img src="/logo/<?php echo $model->id; ?> .jpg" alt="<?php echo $model->name; ?> "> </div> <?php }
* Date: 2016/4/1 * Time: 15:01 * Desc: */ use yii\bootstrap\Html; use yii\helpers\Url; use yii\helpers\ArrayHelper; use yii\widgets\Pjax; use yii\grid\GridView; $this->title = Yii::t('app', 'Words'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="words-index"> <h2><?php echo Html::encode($this->title); ?> </h2> <p> <?php echo Html::a(Yii::t('app', 'Create'), ['create'], ['class' => 'btn btn-primary']); ?> </p> <?php Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'category_id', 'author', 'content', 'slug', 'created_at', 'updated_at', 'status', ['class' => 'yii\\grid\\ActionColumn']]]); ?>
<?php use app\api\PageObject; use yii\bootstrap\Html; use yii\helpers\Url; use yii\web\View; use yii\widgets\Breadcrumbs; /** * @var View $this * @var PageObject $page */ $this->title = Html::encode($page->model->name); $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Pages'), 'url' => ['/page/index']]; $this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => [Url::to()]]; ?> <div class="shop-page"> <div class="row"> <div class="col-md-12"> <?php echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]); ?> </div> <div class="col-md-12"> <h1> <?php echo $page->model->name; ?> </h1> <div class="thumbnail no-border"> <?php