本文整理汇总了PHP中yii\helpers\Html::decode方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::decode方法的具体用法?PHP Html::decode怎么用?PHP Html::decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::decode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
if ($this->encode) {
$this->text = Html::encode($this->text);
}
if (!$this->minimal) {
$maxOembedCount = 3;
// Maximum OEmbeds
$oembedCount = 0;
// OEmbeds used
$this->text = preg_replace_callback('/(https?:\\/\\/.*?)(\\s|$)/i', function ($match) use(&$oembedCount, &$maxOembedCount) {
// Try use oembed
if ($maxOembedCount > $oembedCount) {
$oembed = UrlOembed::GetOembed($match[0]);
if ($oembed) {
$oembedCount++;
return $oembed;
}
}
return Html::a($match[1], Html::decode($match[1]), array('target' => '_blank')) . $match[2];
}, $this->text);
}
// get user and space details from guids
$this->text = self::translateMentioning($this->text, $this->minimal ? false : true);
// create image tag for emojis
$this->text = self::translateEmojis($this->text, $this->minimal ? false : true);
if ($this->maxLength != 0) {
$this->text = \humhub\libs\Helpers::truncateText($this->text, $this->maxLength);
}
return nl2br($this->text);
}
示例2: getUserRole
public function getUserRole()
{
$roles = \Yii::$app->authManager->getRolesByUser($this->user_id);
$role = ' -';
foreach ($roles as $key => $value) {
$role = $key;
}
return Html::decode($role);
}
示例3: save_signature
public function save_signature()
{
$user = User::findIdentity(Yii::$app->user->id);
$user->signature = Functions::clear_text($this->signature);
if ($user->save()) {
return Html::decode($user->signature);
}
return false;
}
示例4: behaviors
/**
* @inheritdoc
*
* [
* 'class' => TimestampBehavior::className(),
* 'createdAtAttribute' => 'created_at',
* 'updatedAtAttribute' => 'updated_at',
* 'value' => function() {
* return date('U'); // unix timestamp
* },
* ]
*/
public function behaviors()
{
return ['timestamp' => ['class' => TimestampBehavior::className()], 'search' => ['class' => SearchBehavior::className(), 'searchScope' => function ($model) {
/** @var \yii\db\ActiveQuery $model */
$model->select(['id', 'title', 'anons', 'content']);
$model->andWhere(['publish_status' => [self::STATUS_PUBLISH, self::STATUS_ARCHIVE]]);
}, 'searchFields' => function ($model) {
/** @var self $model */
return [['name' => 'title', 'value' => $model->title, 'type' => SearchBehavior::FIELD_TEXT], ['name' => 'body', 'value' => strip_tags(Html::decode(Markdown::convert($model->anons))), 'type' => SearchBehavior::FIELD_TEXT], ['name' => 'url', 'value' => '/blog/default/' . $model->id, 'type' => SearchBehavior::FIELD_KEYWORD], ['name' => 'content', 'value' => Markdown::convert($model->content), 'type' => SearchBehavior::FIELD_UNSTORED]];
}]];
}
示例5: renderLink
protected function renderLink($block)
{
if (isset($block['refkey'])) {
if (($ref = $this->lookupReference($block['refkey'])) !== false) {
$block = array_merge($block, $ref);
} else {
return $block['orig'];
}
}
$block['url'] = $this->handleInternalUrls($block['url']);
$internalLink = false;
$baseUrl = Url::base(true);
if (substr($block['url'], 0, 1) == '/' || substr($block['url'], 0, strlen($baseUrl)) == $baseUrl) {
$internalLink = true;
}
return Html::a($this->renderAbsy($block['text']), Html::decode($block['url']), ['target' => $internalLink ? '_self' : '_blank']);
}
示例6: run
public function run()
{
if ($this->encode) {
$this->text = Html::encode($this->text);
}
if (!$this->minimal) {
$maxOembedCount = 3;
// Maximum OEmbeds
$oembedCount = 0;
// OEmbeds used
$that = $this;
$this->text = preg_replace_callback('/(https?:\\/\\/.*?)(\\s|$)/i', function ($match) use(&$oembedCount, &$maxOembedCount, &$that) {
if ($that->edit) {
return Html::a($match[0], Html::decode($match[0]), array('target' => '_blank'));
}
// Try use oembed
if ($maxOembedCount > $oembedCount) {
$oembed = UrlOembed::GetOembed($match[0]);
if ($oembed) {
$oembedCount++;
return $oembed;
}
}
return Html::a($match[1], Html::decode($match[1]), array('target' => '_blank')) . $match[2];
}, $this->text);
// mark emails
$this->text = preg_replace_callback('/[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{2,3})/', function ($match) {
return Html::mailto($match[0]);
}, $this->text);
}
// get user and space details from guids
$this->text = self::translateMentioning($this->text, $this->minimal ? false : true);
// create image tag for emojis
$this->text = self::translateEmojis($this->text, $this->minimal ? false : true);
if ($this->maxLength != 0) {
$this->text = \humhub\libs\Helpers::truncateText($this->text, $this->maxLength);
}
$output = nl2br($this->text);
$this->trigger(self::EVENT_BEFORE_OUTPUT, new ParameterEvent(['output' => &$output]));
return $output;
}
示例7: isset
<td class="label" valign="top"><?php
echo yii::t('friendlink', 'link_logo');
?>
:</td>
<td>
<input type="text" name="link_img" class="easyui-filebox" width="100px" buttonText="选择图片"/>
</td>
</tr>
<tr>
<td class="label" valign="top"><?php
echo yii::t('friendlink', 'url_logo');
?>
:</td>
<td>
<input type="text" name="url_logo" class="easyui-textbox" value="<?php
echo isset($link_logo) ? Html::decode($link_logo) : '';
?>
">
</td>
</tr>
<tr>
<td class="label"> </td>
<td style="height:60px">
<?php
echo Html::input("submit", "submit", Yii::t('app', 'button_submit'), ['class' => 'button']);
?>
<?php
echo Html::input("reset", "reset", Yii::t("app", 'button_reset'), ['class' => 'button']);
?>
<input name="id" type="hidden" value="<?php
echo isset($arrLink['id']) ? $arrLink['id'] : 0;
示例8:
">
<div class="col-sm-6" style="padding-left:0px;">
<?php
echo $form->field($model, 'shop', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('店铺', ['class' => 'control-label col-sm-4'])->textInput(['readonly' => 'readonly']);
?>
<?php
echo $form->field($model, 'platform', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('平台', ['class' => 'control-label col-sm-4'])->textInput(['readonly' => 'readonly']);
?>
<?php
echo $form->field($model, 'commodity_id', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('ID', ['class' => 'control-label col-sm-4'])->textInput(['readonly' => 'readonly']);
?>
<?php
echo $form->field($model, 'sku', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('SKU', ['class' => 'control-label col-sm-4'])->textInput();
?>
<?php
echo $form->field($model, 'handle_time', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('执行时间', ['class' => 'control-label col-sm-4'])->textInput(['onfocus' => Html::decode('WdatePicker({dateFmt:"yyyy-MM-dd HH:mm:ss",minDate:"%y-%M-%d %H:%m:%s"})')]);
?>
<?php
echo $form->field($model, 'rule', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('要求', ['class' => 'control-label col-sm-4'])->textarea();
?>
<?php
echo $form->field($model, 'credit', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->dropDownList(ArrayHelper::map($this->context->credits, 'value', 'text'))->label('买手信用', ['class' => 'control-label col-sm-4']);
?>
<?php
echo $form->field($model, 'trade_num', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('最近30天交易不超', ['class' => 'control-label col-sm-4']);
?>
<?php
echo $form->field($model, 'remark', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('备注', ['class' => 'control-label col-sm-4'])->textarea();
?>
</div>
<div class="col-sm-6" style="padding-left:0px;">
示例9: function
}
$res .= Html::a(Html::encode($dn->name), 'http://192.168.9.26:10001/?db=LIVE_2014#id=' . $dn->id . '&view_type=form&model=delivery.note&menu_id=527&action=502') . ' (' . $dn->state . ')';
}
return $res;
}, 'format' => 'html', 'options' => ['width' => '300']], ['label' => 'Invoices', 'format' => '', 'value' => function ($model, $key, $index, $column) {
$res = '<ul class="list-group">';
foreach ($model->invoices as $inv) {
// if($res) $res.='<br/>';
$val = $inv->currency->name . ' ' . Yii::$app->formatter->asDecimal($inv->amount_total);
$validCurrency = $model->pricelist->currency_id == $inv->currency_id ? true : false;
switch ($validCurrency) {
case false:
$res .= '<li class="list-group-item">' . Html::a(Html::decode('<span class="bg-danger">' . $inv->name . ' - ' . $val . ' (' . $inv->state . ')</span>'), 'http://192.168.9.26:10001/?db=LIVE_2014#id=' . $inv->id . '&view_type=form&model=account.invoice&menu_id=220&action=241') . '</li>';
break;
default:
$res .= '<li class="list-group-item">' . Html::a(Html::decode($inv->name . ' - ' . $val . ' (' . $inv->state . ')'), 'http://192.168.9.26:10001/?db=LIVE_2014#id=' . $inv->id . '&view_type=form&model=account.invoice&menu_id=220&action=241') . '</li>';
break;
}
}
$res .= '<ul>';
return $res;
}, 'format' => 'html', 'options' => ['width' => '400px']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}{done}', 'buttons' => ['view' => function ($url, $model, $key) {
if ($model->state == 'draft' || $model->state == 'cancel') {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', 'http://192.168.9.26:10001/?db=LIVE_2014&debug=#id=' . $model->id . '&view_type=form&model=sale.order&menu_id=255&action=305');
} else {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', 'http://192.168.9.26:10001/?db=LIVE_2014&debug=#id=' . $model->id . '&view_type=form&model=sale.order&menu_id=254&action=302');
}
}, 'done' => function ($url, $model, $key) {
if (!Yii::$app->user->isGuest) {
if ($model->state != 'done' && $model->state != 'cancel' && $model->state != 'draft') {
return Html::a('<span class="glyphicon glyphicon-check"></span>', ['sale-order/to-done', 'id' => $model->id], ['onclick' => new JsExpression('
示例10: jQuery
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $message string */
?>
<div class="app-message">
<?php
echo Html::decode($message);
?>
</div>
<?php
// Utilities required for javascript
$this->registerJsFile('@web/static_files/js/form.utils.min.js', ['depends' => \yii\web\JqueryAsset::className()]);
$js = <<<JS
jQuery(document).ready(function(){
// Send the new height to the parent window
Utils.postMessage({
height: \$("html").height()
});
});
JS;
$this->registerJs($js, $this::POS_END, 'message');
示例11: actionUpdate
public function actionUpdate()
{
$id = (int) \yii::$app->request->post('id', 0);
$show_order = (int) \Yii::$app->request->post('show_order', 0);
$link_name = Html::decode(trim(\yii::$app->request->post('link_name', '')));
$url_logo = \Yii::$app->request->post('url_logo', '');
$link_url = \Yii::$app->request->post('link_url', '');
if (isset($_FILES['link_img']['error']) && $_FILES['link_img']['error'] == 0 || !isset($_FILES['link_img']['error']) && isset($_FILES['link_img']['tmp_name']) && $_FILES['link_img']['tmp_name'] != 'none') {
$image = new ImageD();
$img_up_info = @basename($image->UploadImage($_FILES['link_img'], 'afficheimg'));
$link_logo = "/images/afficheimg/" . $img_up_info;
} elseif (!empty($url_logo)) {
$link_logo = $url_logo;
} else {
$link_logo = "";
}
//如果有新上传的图片,删除原来的图片
if (!empty($img_up_info)) {
$old_logo = FriendLink::find()->select(['link_logo'])->where('id=' . $id)->column();
if (strpos($old_logo, 'http://') === false && strpos($old_logo, 'https://') === false) {
$image_name = basename($old_logo);
@unlink(\Yii::getAlias('static') . '/images/afficheimg/' . $image_name);
}
}
/* 如果没有http:// 补上 */
if (strpos($link_url, 'http://') === false && strpos($link_url, 'https://') === false) {
$link_url = 'http://' . trim($link_url);
} else {
$link_url = trim($link_url);
}
$status = FriendLink::modRowFriendLink($id, ['link_name' => $link_name, 'link_url' => $link_url, 'link_logo' => $link_logo, 'show_order' => $show_order]);
if ($status) {
AdminLog::admin_log($link_name, 'edit', 'friendlink');
}
$link[] = ['text' => \Yii::t('common', 'back_list'), 'href' => Url::to('/friend-link/list')];
$this->system_msg(\yii::t('common', 'edit') . " " . Html::encode($link_name) . " " . \Yii::t('common', 'attradd_succed'), 0, $link);
}
示例12:
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\goods\Type */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
$form = ActiveForm::begin(['id' => 'type-form', 'options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['labelOptions' => ['class' => 'col-sm-2 control-label'], 'template' => '{label} <div class="col-sm-8">{input}{error}{hint}</div>']]);
?>
<div class="panel panel-default">
<div class="panel-heading">
<?php
echo Html::decode(Yii::t('Goods', 'type_form_title'));
?>
</div>
<div class="panel-body">
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => true])->hint(Yii::t('Goods', 'type_form_name_hint'));
?>
</div>
</div>
<div class="form-group col-sm-12">
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('Goods', 'create') : Yii::t('Goods', 'update'), ['class' => $model->isNewRecord ? 'btn btn-success col-sm-1' : 'btn btn-primary col-sm-1']);
?>
</div>
示例13:
}
?>
<div class="comment-author-name">
<span><?php
echo $comment->getAuthorName();
?>
</span>
<span class="comment-date">
<?php
echo $comment->getPostedDate();
?>
</span>
</div>
<div class="comment-body">
<?php
echo Html::decode($comment->getContent());
?>
</div>
</div>
</div>
<?php
if ($comment->hasChildren()) {
?>
<ul class="children">
<?php
echo $this->render('_list', ['comments' => $comment->children, 'maxLevel' => $maxLevel]);
?>
</ul>
<?php
}
?>
示例14:
use yii\helpers\Html;
use yii\widgets\ActiveForm;
?>
<div class="category-form shop-form">
<?php
$form = ActiveForm::begin(['options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-xs-5\">{input}</div>\n{hint}\n{error}"]]);
?>
<?php
echo $form->field($model, 'cat_name')->textInput(['maxlength' => true])->label(null, ['class' => 'col-sm-2 control-label']);
?>
<?php
echo Html::decode($form->field($model, 'parent_id')->dropDownList(\yii\helpers\ArrayHelper::map($catList, 'cat_id', 'cat_name'))->label(null, ['class' => 'col-sm-2 control-label']));
?>
<?php
echo $form->field($model, 'sort_order')->textInput()->label(null, ['class' => 'col-sm-2 control-label']);
?>
<?php
if ($model->is_show === null) {
$model->is_show = 1;
}
?>
<?php
echo $form->field($model, 'is_show')->radioList(['1' => '是', '0' => '否'], ['style' => 'margin-top:7px'])->label(null, ['class' => 'col-sm-2 control-label']);
?>
示例15: actionEditPost
public function actionEditPost()
{
$id = (int) \Yii::$app->request->post('id');
$item_name = Html::decode(\Yii::$app->request->post('item_name'));
$item_url = Html::decode(\Yii::$app->request->post('item_url'));
$item_ifshow = \Yii::$app->request->post('item_ifshow');
$item_opennew = \Yii::$app->request->post('item_opennew');
$item_type = \Yii::$app->request->post('item_type');
$item_vieworder = (int) \Yii::$app->request->post('item_vieworder', 0);
$row = Nav::find()->select(['ctype', 'cid', 'is_show', 'type'])->where($id)->one();
$arr = Nav::analyse_uri($item_url);
if ($arr) {
if ($row['ctype'] == $arr['type'] && $row['cid'] == $arr['id']) {
//如果没有修改分类
if ($item_type != 'middle') {
//位置不在中部
Nav::setShowInNav($arr['type'], $arr['id'], 0);
}
} else {
//修改了分类
if ($row['is_show'] == 1 && $row['type'] == 'middle') {
Nav::setShowInNav($row['ctype'], $row['cid'], 0);
//设置成不显示
}
}
//分类判断
if ($item_ifshow != Nav::isShowInNav($arr['type'], $arr['id']) && $item_type == 'middle') {
Nav::setShowInNav($arr['type'], $arr['id'], $item_ifshow);
}
Nav::updateAll(['name' => $item_name, 'ctype' => $arr['type'], 'cid' => $arr['id'], 'is_show' => $item_ifshow, 'view_order' => $item_vieworder, 'open_new' => $item_opennew, 'url' => $item_url, 'type' => $item_type], 'id=:id', [':id' => $id]);
} else {
if ($row['ctype'] && $row['cid']) {
Nav::setShowInNav($row['ctype'], $row['cid'], 0);
}
Nav::updateAll(['name' => $item_name, 'ctype' => '', 'cid' => '', 'is_show' => $item_ifshow, 'view_order' => $item_vieworder, 'open_new' => $item_opennew, 'url' => $item_url, 'type' => $item_type], 'id=:id', [':id' => $id]);
}
exit(UtilD::handleResult(true, \Yii::t('common', 'edit_ok')));
}