本文整理汇总了PHP中HTML::entities方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::entities方法的具体用法?PHP HTML::entities怎么用?PHP HTML::entities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::entities方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html
public function html()
{
$this->render_field->set('tag', 'option')->text($this->field->alias())->attr('value', HTML::entities($this->render_field->value));
if ($this->field->parent()->val() == $this->render_field->value) {
$this->render_field->attr('selected', 'selected');
}
}
示例2: before
/**
* Construct controller
*/
public function before()
{
parent::before();
$this->page_title = __('Forum');
// Generic page actions
$this->page_actions['new-posts'] = array('link' => Route::url('forum'), 'text' => '<i class="icon-comment icon-white"></i> ' . __('New posts'));
// Forum areas dropdown
$groups = Model_Forum_Group::factory()->find_all();
$areas = array();
foreach ($groups as $group) {
$divider = false;
foreach ($group->areas() as $area) {
if (Permission::has($area, Model_Forum_Area::PERMISSION_READ, self::$user)) {
$divider = true;
$areas[] = array('link' => Route::model($area), 'text' => HTML::entities($area->name));
}
}
if ($divider) {
$areas[] = array('divider' => true);
}
}
array_pop($areas);
$this->page_actions['areas'] = array('link' => Route::url('forum_group'), 'text' => '<i class="icon-folder-open icon-white"></i> ' . __('Areas'));
$this->page_actions['area'] = array('link' => Route::url('forum_group'), 'text' => '', 'dropdown' => $areas);
if (self::$user) {
$this->page_actions['private-messages'] = array('link' => Forum::private_messages_url(), 'text' => '<i class="icon-envelope icon-white"></i> ' . __('Private messages'));
}
}
示例3: action_create
public function action_create()
{
// form post handling
if (isset($_POST) && Valid::not_empty($_POST)) {
// validate
$post = Validation::factory($_POST)->rule('email', 'not_empty')->rule('email', 'email')->rule('email', 'email_domain')->rule('username', 'not_empty')->rule('username', Kohana::$config->load('ko32example.account.create.username.format'))->rule('username', 'min_length', array(':value', Kohana::$config->load('ko32example.account.create.username.min_length')))->rule('username', 'max_length', array(':value', Kohana::$config->load('ko32example.account.create.username.max_length')))->rule('password', 'not_empty')->rule('password', 'min_length', array(':value', Kohana::$config->load('ko32example.account.create.password.min_length')))->rule('password', array($this, 'pwdneusr'), array(':validation', ':field', 'username'));
if ($post->check()) {
// save
$model = ORM::factory('user');
$model->values(array('email' => $post['email'], 'username' => HTML::entities(strip_tags($post['username'])), 'password' => $post['password']));
try {
$model->save();
$model->add('roles', ORM::factory('role')->where('name', '=', 'login')->find());
$model->add('roles', ORM::factory('role')->where('name', '=', 'participant')->find());
// success login
if (Auth::instance()->login($post['username'], $post['password'])) {
if (Auth::instance()->logged_in('participant')) {
// sucessfully loged
$this->request->redirect('dashboard');
}
} else {
//TODO error
}
} catch (ORM_Validation_Exception $e) {
$errors = $e->errors('user');
}
} else {
$errors = $post->errors('user');
}
}
// TODO i18n
$this->template->title = __('Create an account');
// display
$this->template->content = View::factory('account/create')->bind('post', $post)->bind('errors', $errors);
}
示例4: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$whereAmI = $this->ruta . $this->listOneBreadcrumb('editar localidad', '', 1);
$departamentos = Departamento::listByFullName();
$localidad = Localidad::with('departamento')->with('departamento.provincia')->with('departamento.provincia.pais')->findOrFail($id);
$donde_estoy[0] = \HTML::entities(\Html::linkRoute('cities.localidades.index', 'localidades'));
$data = ['whereAmI' => $whereAmI, 'departamentos' => $departamentos, 'donde_estoy' => $donde_estoy, 'localidad' => $localidad];
return view('admin.cities.localidades.edit', $data);
}
示例5: saveContract
public function saveContract($id)
{
$form = DeliveryForm::find($id);
if ($form->contract_type->secondary_lang) {
$rules = ['user_email' => 'required', 'company_name' => 'required', 'user_name' => 'required', 'user_surname' => 'required', 'user_patronymic' => 'required', 'requisites' => 'required', 'en_company_name' => 'required', 'en_user_name' => 'required', 'en_user_surname' => 'required', 'en_user_patronymic' => 'required', 'en_requisites' => 'required'];
} else {
$rules = ['user_email' => 'required', 'company_name' => 'required', 'user_name' => 'required', 'user_surname' => 'required', 'user_patronymic' => 'required', 'requisites' => 'required'];
}
if ($form->contract_type->id == 6) {
$rules['tax_content'] = 'required';
}
$data = Input::except('_token');
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
return Redirect::back()->withInput()->withErrors($validator->messages());
}
if (isset($form->user_id) && $this->user_id == $form->user_id) {
$form->user_email = HTML::entities(Input::get('user_email'));
$form->company_name = HTML::entities(Input::get('company_name'));
$form->user_name = HTML::entities(Input::get('user_name'));
$form->user_surname = HTML::entities(Input::get('user_surname'));
$form->user_patronymic = HTML::entities(Input::get('user_patronymic'));
$form->requisites = HTML::entities(Input::get('requisites'));
if ($form->contract_type->secondary_lang) {
$form->en_company_name = HTML::entities(Input::get('en_company_name'));
$form->en_user_name = HTML::entities(Input::get('en_user_name'));
$form->en_user_surname = HTML::entities(Input::get('en_user_surname'));
$form->en_user_patronymic = HTML::entities(Input::get('en_user_patronymic'));
$form->en_requisites = HTML::entities(Input::get('en_requisites'));
}
if ($form->contract_type->id == 6) {
if (!$form->tax) {
$tax = new Tax(['content' => HTML::entities(Input::get('tax_content'))]);
$tax = $form->tax()->save($tax);
} else {
$form->tax->content = HTML::entities(Input::get('tax_content'));
$form->tax->save();
}
}
$form->user_confirmed = 1;
$form->save();
return Redirect::to('/profile/forms/edit/' . $id);
} else {
return Redirect::to('/login');
}
}
示例6: function
<?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function (Faker\Generator $faker) {
return ['name' => $faker->name, 'username' => $faker->userName, 'email' => $faker->email, 'password' => Hash::make('password'), 'remember_token' => str_random(10)];
});
$factory->define(App\Post::class, function (Faker\Generator $faker) {
return ['post_content' => HTML::entities('<p>' . implode('</p><p>', $faker->paragraphs(random_int(3, 10))) . '</p>'), 'post_title' => HTML::entities($faker->sentence()), 'post_featured_image_url' => "http://lorempixel.com/1000/500/food/" . random_int(1, 10), 'created_at' => $faker->dateTime, 'updated_at' => $faker->dateTime];
});
$factory->define(App\Comment::class, function (Faker\Generator $faker) {
return ['comment_content' => $faker->paragraph()];
});
示例7:
<?php
/**
* @var string $bill_id
* @var string $textStatus
*/
?>
<html>
<head>
<title>Изменения в счёте</title>
</head>
<body>
<p>
Счёт № <?php
echo HTML::entities($bill_id);
?>
<?php
echo HTML::entities($textStatus);
?>
</p>
</body>
</html>
示例8: foreach
<td><?php
echo $mail->getDatetimeSent();
?>
</td>
<td>
<?php
foreach ($msg->getTo() as $email => $name) {
if ($name) {
echo '<' . $name . '> ';
}
echo $email;
}
?>
</td>
<td><?php
echo $msg->getSubject();
?>
</td>
<td>
<?php
echo $msg->getContentType() == 'text/html' ? $msg->getBody() : HTML::entities($msg->getBody());
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
示例9: foreach
?>
"</th>
</tr>
<?php
foreach ($stats as $num => $query) {
?>
<tr class="<?php
echo Text::alternate('odd', 'even');
?>
">
<td><?php
echo $num + 1;
?>
</td>
<td><?php
echo HTML::entities($query['name']);
?>
</td>
<td><?php
echo number_format($query['time'] * 1000, 3);
?>
ms</td>
<td><?php
echo number_format($query['memory'] / 1024, 3);
?>
kb</td>
</tr>
<?php
}
?>
<?php
示例10:
<?php
/**
* @var string $themeName
* @var string $baseMessage
* @var string $comment
*/
?>
<html>
<head>
<title><?php
echo HTML::entities($themeName);
?>
</title>
</head>
<body>
<p>
<?php
echo HTML::entities($baseMessage);
?>
.<br>
<br> <?php
echo HTML::entities($comment);
?>
</p>
</body>
</html>
示例11: as_html
/**
* Replace HTML entities in humanize
* @param string $currency optionally convert to another currency
* @return string
*/
public function as_html($currency = NULL)
{
return HTML::entities($this->humanize($currency));
}
示例12: _HTML_ENTITIES
protected function _HTML_ENTITIES($elem)
{
return HTML::entities($elem[\Zeyon\SIGN_CDATA]);
}
示例13: select
/**
* Returns a "<select></select>" box and selects the option matching the HTTP POST/GET data, or the value if the former is missing.
*
* @param string $name The <select> tag name.
* @param array $options An associative array of options. The keys contain
* the captions while the array elements contain the values. You can
* define an option group ("<optgroup>") by specifying an array of
* options as the value. For options with additional XHTML attributes,
* specify an array with the option value as the very first element and
* additional attributes thereafter.
* Example:
* <code>
* select('pizza', array(
* 'Regular' => array(
* 'Margherita' => array('margherita', 'title' => '50% Off Special'),
* 'Funghi' => 'funghi',
* 'Prosciutto' => 'prosciutto',
* 'Salame' => 'salame',
* ),
* 'Specials' => array(
* 'Mexican Style' => 'mexican',
* 'Spicy Curry' => 'curry',
* ),
* ));
* </code>
* @param mixed $value Optional. The value to select if no matching HTTP
* POST/GET variable exists. Default is NULL.
* @param array $attributes Optional. Additional attributes to include.
* You can use this e.g. to set a tag ID or to override the "type"
* attribute. Default is NULL.
* @param string $method Optional. Default is {@link METHOD_POST}.
* @return string
* @uses expandOptions()
*/
public static function select($name, array $options, $value = null, array $attributes = null, $method = self::METHOD_POST)
{
$selectedValue = $method == self::METHOD_POST ? HTTP::readPOST($name, $value) : HTTP::readGET($name, $value);
return '<select name="' . HTML::entities($name) . '" ' . HTML::expandAttributes($attributes) . '>' . self::expandOptions($options, $selectedValue) . '</select>';
}
示例14:
<div class="comment">
<div class="header">
<?php
echo App::gravatar_for($comment->email);
?>
<?php
echo $comment->username;
?>
</div>
<div class="content">
<?php
echo HTML::entities($comment->content);
?>
</div>
</div>
示例15: e_array
/**
* Convert HTML characters to entities.
*
* The encoding specified in the application configuration file will be used.
*
* @param string[] $array
*
* @return string[]
*/
function e_array($array)
{
foreach ($array as $key => $value) {
if (is_array($value)) {
$array[$key] = e_array($value);
} else {
$array[$key] = HTML::entities($value);
}
}
return $array;
}