当前位置: 首页>>代码示例>>PHP>>正文


PHP HTML::encode方法代码示例

本文整理汇总了PHP中HTML::encode方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::encode方法的具体用法?PHP HTML::encode怎么用?PHP HTML::encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTML的用法示例。


在下文中一共展示了HTML::encode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionAjaxentermsg

 public function actionAjaxentermsg($id = null)
 {
     if (isset($_GET['text'])) {
         if (!Yii::$app->user->isGuest) {
             $model = new Msgs();
             $model->admin_id = Yii::$app->user->id;
             $model->text = $_GET['text'];
             $model->time = time();
             $model->unit_type = 1;
             $model->unit_id = $id;
             if ($model->save()) {
                 echo '<tr>
                     <th>' . User::name(Yii::$app->user->id) . '<br/>
                         <span style="font-size: xx-small; color: #c0c0c0;">(' . date('d.m.y', time()) . ')</span>
                     </th>
                     <td>' . nl2br(HTML::encode($_GET['text'])) . '</td>
                 </tr>';
             } else {
                 echo '== данные не сохранились... ==';
             }
         } else {
             echo '<tr class="grey">
                     <th>
                         Гость<br/>
                         <span style="font-size: xx-small;">(' . date('d.m.y', time()) . ')</span>
                     </th>
                     <td>' . nl2br(HTML::encode($_GET['text'])) . '</td>
             </tr>';
         }
     } else {
         echo '== данные не получены... ==';
     }
 }
开发者ID:Nechhist,项目名称:to.ru,代码行数:33,代码来源:MsgsController.php

示例2: setFilter

 public function setFilter($post, $db)
 {
     $cid = (int) $post['cid'];
     $fid = (int) $post['fid'];
     $cfh_id = (int) $post['cfh_id'];
     $filter = HTML::encode(trim($post['filter']));
     $fil_id = $db->createCommand("SELECT filter_id FROM idc_categories_filters WHERE filter = :filter")->bindValues([':filter' => $filter])->queryScalar();
     if ($cid && $fid && $filter && $cfh_id) {
         if (!$fil_id) {
             $db->createCommand("UPDATE idc_categories_filters AS cf\n                                        SET cf.filter = :filter\n                                        WHERE cf.filter_id = :fid")->bindValues([':filter' => $filter, ':fid' => $fid])->execute();
         } else {
             $db->createCommand("UPDATE idc_categories_filters_hooks AS cfh\n                                        SET cfh.filter_id = :fil_id\n                                        WHERE cfh.category_id = :cid\n                                        AND cfh.cfh_id = :cfh_id")->bindValues([':cid' => $cid, ':fil_id' => $fil_id, ':cfh_id' => $cfh_id])->execute();
         }
     } elseif ($cid && !$fid && $filter && !$cfh_id) {
         if (!$fil_id) {
             $db->createCommand()->insert('idc_categories_filters', ['filter' => $filter])->execute();
             $fid = $db->getLastInsertID();
         } else {
             $fid = $fil_id;
         }
         $db->createCommand()->insert('idc_categories_filters_hooks', ['category_id' => $cid, 'filter_id' => $fid])->execute();
         $cfh_id = $db->getLastInsertID();
         return ['cfh' => $cid, 'fid' => $fid, 'cfh_id' => $cfh_id];
     }
     return false;
 }
开发者ID:egorlost,项目名称:mysite,代码行数:26,代码来源:FilterModel.php

示例3: actionIndex

 public function actionIndex($type)
 {
     $dataProvider = new ActiveDataProvider(['query' => Product::find()->where(['product_type' => HTML::encode($type)])]);
     /*
     if(!$dataProvider){
         throw new NotFoundHttpException(\Yii::t('backend', 'Page not found'));
     }
     */
     $name = Product::getProductTypeName2(HTML::encode($type));
     return $this->render('index', ['dataProvider' => $dataProvider, 'type' => $name]);
 }
开发者ID:sergey-exu,项目名称:diru,代码行数:11,代码来源:ProductController.php

示例4: actionResetpic

 public function actionResetpic()
 {
     $a = $_POST['data'];
     $a = HTML::encode($a);
     $user = User::findByUsername(Yii::$app->user->identity->username);
     $user->pic = $a;
     $link = mysqli_connect("localhost", "root", "tttsss17", "ts18web") or die("Could not connect database");
     if (mysqli_query($link, "UPDATE user SET pic = '{$a}'  WHERE username = '{$user->username}'")) {
         return $this->redirect(['dashboard/index', ['model' => $user]]);
     } else {
         return $this->redirect(['site/index']);
     }
     //(['dashboard/index']);
 }
开发者ID:eesast,项目名称:ts17web,代码行数:14,代码来源:DashboardController.php

示例5: name

 public static function name($id = null, $a = 0)
 {
     if ($id == 0) {
         return '<i>Гость</i>';
     }
     $user = User::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]);
     if ($user == null) {
         return '<i>==не_найден==</i>';
     }
     if ($a == 0) {
         return '<strong>' . HTML::encode($user['username']) . '</strong>';
     }
     if ($a == 1) {
         return '<a href="' . Yii::$app->request->baseUrl . '/user/view/' . $user['id'] . '">' . HTML::encode($user['username']) . '</a>';
     }
     return '<i>==нет_параметра==</i>';
 }
开发者ID:Nechhist,项目名称:to.ru,代码行数:17,代码来源:User.php

示例6: name

 /**
  * @param $id - id турнира
  * @param int $a - включить ссылку
  * @return string
  */
 public static function name($id, $a = 0)
 {
     if ($id == 0) {
         return '<i>Неизвестный</i>';
     }
     $t = T::findOne(['id' => $id]);
     if ($t == null) {
         return '<i>==не_найден==</i>';
     }
     if ($a == 0) {
         return HTML::encode($t['name']);
     }
     if ($a == 1) {
         return '<a href="' . Yii::$app->request->baseUrl . '/' . $t['id'] . '">' . HTML::encode($t['name']) . '</a>';
     }
     return '<i>==нет_параметра==</i>';
 }
开发者ID:Nechhist,项目名称:to.ru,代码行数:22,代码来源:T.php

示例7: actionAjaxenterchatmain

 public function actionAjaxenterchatmain()
 {
     if (isset($_GET['text']) && $_GET['text'] != NULL) {
         $_GET['text'] = substr($_GET['text'], 0, 254);
         if (!Yii::$app->user->isGuest) {
             // проверка на спам.
             $check = Chatmain::findOne(['admin_id' => Yii::$app->user->id]);
             if ($check && $check['time'] < time() - 10) {
                 // создание новой записи
                 $model = new Chatmain();
                 $model->admin_id = Yii::$app->user->id;
                 $model->text = $_GET['text'];
                 $model->time = time();
                 if ($model->save()) {
                     echo '<div>
                     <span>' . User::name(Yii::$app->user->id) . ': </span>
                     <span>' . nl2br(HTML::encode($_GET['text'])) . '</span>
                 </div>';
                 } else {
                     echo '== данные не сохранились... ==';
                 }
             } else {
                 '<div class="grey">
                     <span>.User::name(Yii::$app->user->id): </span>
                     <span>' . nl2br(HTML::encode($_GET['text'])) . '</span>
                     <span> (Антиспам: сообщение не будет сохранено)</span>
                 </div>';
             }
         } else {
             echo '<div class="grey">
                 <span>Гость: </span>
                 <span>' . nl2br(HTML::encode($_GET['text'])) . '</span>
             </div>';
         }
     }
     //else echo '== данные не получены... ==';
 }
开发者ID:Nechhist,项目名称:to.ru,代码行数:37,代码来源:ChatmainController.php

示例8: dump

 public static function dump($value, $name)
 {
     if (!self::isDebugUser()) {
         return;
     }
     $text = var_export($value, true);
     if (php_sapi_name() == 'cli') {
         return $text;
     }
     $text = preg_replace('/=(>?) \\n */', '=\\1 ', $text);
     $html = HTML::encode($text);
     $expandable_html = self::getExpandButtonHtml('this.nextSibling');
     $expandable_html .= '<span style="display: none">';
     $html = str_replace('{', '{' . $expandable_html, $html);
     $html = str_replace('}', '</span>}', $html);
     $html = str_replace('::__set_state(array(', ':((' . $expandable_html, $html);
     $html = str_replace('))', '</span>))', $html);
     $html = str_replace('array (', 'array (' . $expandable_html, $html);
     $html = preg_replace('/^(\\s*)\\)/m', '$1</span>)', $html);
     return HTML::tag('div', array('class' => 'debug'), HTML::tag('b', null, $name . self::getExpandButtonHtml('this.parentNode.nextSibling')) . HTML::tag('pre', array('style' => 'display: none;'), $html));
 }
开发者ID:Nozemi,项目名称:MyFramework,代码行数:21,代码来源:Debug.class.php

示例9: foreach

                    <td>Посл.изменение</td>
                    </thead>
                    <?php 
foreach (array_reverse($season) as $one) {
    ?>
                        <tr>
                            <td><?php 
    echo $one->id;
    ?>
</td>
                            <td><?php 
    echo T::name($one->t_id, 1);
    ?>
</td>
                            <td><?php 
    echo HTML::encode($one->name);
    ?>
</td>
                            <td><?php 
    echo Season::nets(1, $one->net_type);
    ?>
</td>
                            <td><?php 
    echo User::name($one->admin_id);
    ?>
</td>
                            <td><?php 
    echo date('d.m.y в H:i', $one->time_update);
    ?>
</td>
                        </tr>
开发者ID:Nechhist,项目名称:to.ru,代码行数:31,代码来源:index.php

示例10: foreach

        <table class="table table-hover">
            <tr>
                <th>รหัส</th>   
                <th>ชื่อตำแหน่ง</th>
                <th>ลบ</th>           
            </tr>
            <?php 
foreach ($positions as $position) {
    ?>
                <tr>
                    <td><?php 
    echo HTML::encode($position['position_id']);
    ?>
</td>
                    <td><?php 
    echo HTML::encode($position['position_name']);
    ?>
</td>
                    <td><a href="<?php 
    echo Url::to(['position/delete', 'id' => Html::encode($position['position_id'])]);
    ?>
">
                            <span class="fa fa-trash text-danger">
                        </a></span></td>
                </tr>
            <?php 
}
?>
        </table>

        <!--ตัวอย่างต้นฉบับ-->
开发者ID:komsin,项目名称:yiiexpert1,代码行数:31,代码来源:index.php

示例11: foreach

    echo Yii::$app->urlManager->createUrl(['t/createseason']) . '/' . $t['id'];
    ?>
">
                                    (+) добавить новую турнирную сетку
                                </a>
                            </td>
                        <?php 
}
?>
                    </tr>
                </table>

                <?php 
foreach (array_reverse($seasons) as $one) {
    ?>
                    <a style="cursor: pointer;" onclick="show_season(<?php 
    echo $one['id'];
    ?>
)"><?php 
    echo HTML::encode($one['name']);
    ?>
</a>;
                <?php 
}
?>

            </div>
        </td>
    </tr>
</table>
开发者ID:Nechhist,项目名称:to.ru,代码行数:30,代码来源:_header.php

示例12:

<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\User;
use app\models\Season;
$color_table = '#' . $t['color_table'];
$color_text_unit = '#' . $t['color_text_unit'];
$color_text_time = '#' . $t['color_text_time'];
$color_line = '#' . $t['color_line'];
$color_cell = '#' . $t['color_cell'];
$line = '2px solid' . $color_line;
$this->title = 'Изменение ' . HTML::encode($season['name']) . '(' . HTML::encode($t['name']) . ') | ' . Yii::$app->name;
?>


<style>

    /******** переопределение стилей BOOTSTRAP *********/

    .form-group{
        margin-bottom: 1px;
    }

    /**************************************************/

    .net table{
        width: 100%;
        margin: 0;
        padding: 0;
        background-color: <?php 
开发者ID:Nechhist,项目名称:to.ru,代码行数:31,代码来源:updateseason.php

示例13:

    }
    if (trim($season['uuuuunit2']) != null) {
        $s['uuuuunit2'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'uuuuunit2" ondblclick="update_cell_u' . $season['id'] . '(\'uuuuunit2\')">' . HTML::encode($season['uuuuunit2']) . '</td><td class="td_score" id="' . $season['id'] . 'ssssscore2" ondblclick="update_cell_s' . $season['id'] . '(\'ssssscore2\')">' . $season['ssssscore2'] . '</td></tr></table></td>';
    } else {
        $s['uuuuunit2'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'uuuuunit2" ondblclick="update_cell_u' . $season['id'] . '(\'uuuuunit2\')">' . HTML::encode($season['uuuuunit2']) . '</td><td class="td_score" id="' . $season['id'] . 'ssssscore2" ondblclick="update_cell_s' . $season['id'] . '(\'ssssscore2\')"></td></tr></table></td>';
    }
    $s['unit_winner'] = '<td class="td_unit">' . $season['unit_winner'] . '</td>';
    if (trim($season['unit3place1']) != null) {
        $s['unit3place1'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'unit3place1" ondblclick="update_cell_u' . $season['id'] . '(\'unit3place1\')">' . HTML::encode($season['unit3place1']) . '</td><td class="td_score" id="' . $season['id'] . 'score3place1" ondblclick="update_cell_s' . $season['id'] . '(\'score3place1\')">' . $season['score3place1'] . '</td></tr></table></td>';
    } else {
        $s['unit3place1'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'unit3place1" ondblclick="update_cell_u' . $season['id'] . '(\'unit3place1\')">' . HTML::encode($season['unit3place1']) . '</td><td class="td_score" id="' . $season['id'] . 'score3place1" ondblclick="update_cell_s' . $season['id'] . '(\'score3place1\')"></td></tr></table></td>';
    }
    if (trim($season['unit3place2']) != null) {
        $s['unit3place2'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'unit3place2" ondblclick="update_cell_u' . $season['id'] . '(\'unit3place2\')">' . HTML::encode($season['unit3place2']) . '</td><td class="td_score" id="' . $season['id'] . 'score3place2" ondblclick="update_cell_s' . $season['id'] . '(\'score3place2\')">' . $season['score3place2'] . '</td></tr></table></td>';
    } else {
        $s['unit3place2'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'unit3place2" ondblclick="update_cell_u' . $season['id'] . '(\'unit3place2\')">' . HTML::encode($season['unit3place2']) . '</td><td class="td_score" id="' . $season['id'] . 'score3place2" ondblclick="update_cell_s' . $season['id'] . '(\'score3place2\')"></td></tr></table></td>';
    }
    $s['unit3place3'] = '<td class="td_unit">' . $season['unit3place3'] . '</td>';
}
////////// SCORE //////////////////////////////////////////////
if (Season::nets()[$season['net_type']]['type'] == 2) {
    $s['score_a1'] = '<td class="td_score" id="' . $season['id'] . 'score_a1" ondblclick="notSendFromGroupCellScore()">' . ($season['score1'] + $season['score2'] + $season['score3']) . '</td>';
    $s['score_a2'] = '<td class="td_score" id="' . $season['id'] . 'score_a2" ondblclick="notSendFromGroupCellScore()">' . ($season['score4'] + $season['score5'] + $season['score6']) . '</td>';
    $s['score_a3'] = '<td class="td_score" id="' . $season['id'] . 'score_a3" ondblclick="notSendFromGroupCellScore()">' . ($season['score7'] + $season['score8'] + $season['score9']) . '</td>';
    $s['score_a4'] = '<td class="td_score" id="' . $season['id'] . 'score_a4" ondblclick="notSendFromGroupCellScore()">' . ($season['score10'] + $season['score11'] + $season['score12']) . '</td>';
    $s['score_b1'] = '<td class="td_score" id="' . $season['id'] . 'score_b1" ondblclick="notSendFromGroupCellScore()">' . ($season['score13'] + $season['score14'] + $season['score15']) . '</td>';
    $s['score_b2'] = '<td class="td_score" id="' . $season['id'] . 'score_b2" ondblclick="notSendFromGroupCellScore()">' . ($season['score16'] + $season['score17'] + $season['score18']) . '</td>';
    $s['score_b3'] = '<td class="td_score" id="' . $season['id'] . 'score_b3" ondblclick="notSendFromGroupCellScore()">' . ($season['score19'] + $season['score20'] + $season['score21']) . '</td>';
    $s['score_b4'] = '<td class="td_score" id="' . $season['id'] . 'score_b4" ondblclick="notSendFromGroupCellScore()">' . ($season['score22'] + $season['score23'] + $season['score24']) . '</td>';
    $s['score_c1'] = '<td class="td_score" id="' . $season['id'] . 'score_c1" ondblclick="notSendFromGroupCellScore()">' . ($season['score25'] + $season['score26'] + $season['score27']) . '</td>';
    $s['score_c2'] = '<td class="td_score" id="' . $season['id'] . 'score_c2" ondblclick="notSendFromGroupCellScore()">' . ($season['score28'] + $season['score29'] + $season['score30']) . '</td>';
开发者ID:Nechhist,项目名称:to.ru,代码行数:31,代码来源:season.php

示例14:

<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\User */
$this->title = 'Изменение пользователя: ' . $model->username;
?>

<h1>Изменение пользователя <?php 
echo HTML::encode($model->username);
?>
</h1>

<?php 
$form = ActiveForm::begin();
?>

<?php 
echo $form->field($model, 'username')->textInput();
?>

<div class="form-group">
    <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>

<?php 
ActiveForm::end();
?>
开发者ID:Nechhist,项目名称:to.ru,代码行数:31,代码来源:update.php

示例15: nl2br

<?php

/* @var $this yii\web\View */
use yii\helpers\Html;
use app\models\User;
//var_dump($news); exit;
?>
<div>
    <div>
        <span><?php 
echo User::name($msg->admin_id);
?>
: </span>
        <span><?php 
echo nl2br(HTML::encode($msg->text));
?>
</span>
    </div>
</div>
开发者ID:Nechhist,项目名称:to.ru,代码行数:19,代码来源:_message.php


注:本文中的HTML::encode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。