本文整理汇总了PHP中HTML::chars方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::chars方法的具体用法?PHP HTML::chars怎么用?PHP HTML::chars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::chars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_signup
public function action_signup()
{
$this->template->menu_signup = TRUE;
// Если залогинен, то перекидываем на дерево
if (Auth::instance()->logged_in()) {
$this->redirect(Route::url('user/id', array('user_id' => Auth::instance()->get_user()->id)));
}
$post = Arr::extract($this->request->post(), array('name', 'surname', 'email'));
$data['errors'] = NULL;
if ($this->request->method() == 'POST') {
// Генерирую случайный пароль из цифр
$post['password'] = Text::random('numeric', 5);
try {
$user = ORM::factory('User')->values($post)->save();
$user->add('roles', ORM::factory('Role', array('name' => 'login')));
$message = '
Для входа на сайт ' . $_SERVER['HTTP_HOST'] . ' используйте следующие данные:<br><br>
Адрес электронной почты: ' . HTML::chars($user->email) . '<br>
Пароль: ' . HTML::chars($post['password']) . '<br><br>
<a href="' . URL::base(TRUE) . '">Перейти на сайт</a>';
Useful::mail($user->email, 'Регистрация LiveTex', $message, 'LiveTex');
// Авторизовываю
Auth::instance()->login($user->email, $post['password'], TRUE);
$this->redirect(Route::url('user/id', array('user_id' => $user->id)));
} catch (ORM_Validation_Exception $e) {
$data['errors'] = $e->errors('orm');
}
}
$data += $post;
$this->template->content = View::factory('auth/signup', $data);
}
示例2: after
/**
* After action
*/
public function after()
{
$this->template->legend = HTML::chars(__($this->config_mod['b_menu']['heading'])) . SEPARATOR . HTML::chars($this->title);
$this->template->v_nav_top = View::factory('backend/v_nav_top');
$this->template->v_nav_left = View::factory('backend/v_nav_left', ['panels' => Module::get_panels(), 'current' => $this->config_mod['cms_module']]);
parent::after();
}
示例3: insBook
/**
* @param bool $id
* @return bool
* @throws Kohana_Exception
*
* insert or update book
*/
public function insBook($id = false)
{
$_POST = Arr::map('trim', $_POST);
$post = Validation::factory($_POST);
$post->rule('name', 'not_empty')->rule('name', 'alpha_numeric', array(':value', false))->rule('name', 'min_length', array(':value', 2))->rule('name', 'max_length', array(':value', 20))->rule('email', 'email')->rule('body', 'not_empty')->rule('body', 'max_length', array(':value', 1024));
if ($post->check()) {
if ($id) {
$book = ORM::factory('Guestbook', $id);
} else {
$book = ORM::factory('Guestbook');
}
$book->name = Security::encode_php_tags(HTML::chars($_POST['name']));
$book->email = Security::encode_php_tags(HTML::chars($_POST['email']));
$book->body = Security::encode_php_tags(HTML::chars($_POST['body']));
try {
if ($id) {
$book->update();
} else {
$book->create();
}
return true;
} catch (ORM_Validation_Exception $e) {
return false;
}
} else {
//$errors = $post -> errors('validation');
return false;
}
}
示例4: content
/**
* Render content.
*
* @return string
*/
public function content()
{
ob_start();
// Stamp
echo HTML::time(Date('l ', $this->event->stamp_begin) . Date::format('DDMMYYYY', $this->event->stamp_begin), $this->event->stamp_begin, true);
// Location
if ($this->event->venue) {
echo ' @ ', HTML::anchor(Route::model($this->event->venue), HTML::chars($this->event->venue->name)), ', ', HTML::chars($this->event->venue->city_name);
} elseif ($this->event->venue_name) {
echo ' @ ', $this->event->venue_url ? HTML::anchor($this->event->venue_url, $this->event->venue_name) : HTML::chars($this->event->venue_name), $this->event->city_name ? ', ' . HTML::chars($this->event->city_name) : '';
} elseif ($this->event->city_name) {
echo ' @ ', HTML::chars($this->event->city_name);
}
// Flyer
if ($this->event->flyer_front) {
echo '<figure>', HTML::image($this->event->flyer_front->get_url(Model_Image::SIZE_THUMBNAIL)), '</figure>';
} elseif ($this->event->flyer_back) {
echo '<figure>', HTML::image($this->event->flyer_back->get_url(Model_Image::SIZE_THUMBNAIL)), '</figure>';
} elseif (Valid::url($this->event->flyer_front_url)) {
echo '<br /><figure>', HTML::image($this->event->flyer_front_url, array('width' => 160)), '</figure>';
}
// Favorites
if ($this->event->favorite_count) {
echo '<span class="stats"><i class="icon-heart"></i> ' . $this->event->favorite_count . '</span>';
}
return ob_get_clean();
}
示例5: get
/**
* Get newsfeed item as HTML
*
* @static
* @param Model_NewsfeedItem $item
* @return string
*/
public static function get(Model_NewsFeedItem $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_EVENT:
$event = Model_Event::factory($item->data['event_id']);
if ($event->loaded()) {
$text = __('added new event<br />:event', array(':event' => HTML::anchor(Route::model($event), '<i class="icon-calendar icon-white"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'))));
}
break;
case self::TYPE_EVENT_EDIT:
$event = Model_Event::factory($item->data['event_id']);
if ($event->loaded()) {
$text = __('updated event<br />:event', array(':event' => HTML::anchor(Route::model($event), '<i class="icon-calendar icon-white"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'))));
}
break;
case self::TYPE_FAVORITE:
$event = Model_Event::factory($item->data['event_id']);
if ($event->loaded()) {
$text = __('added event to favorites<br />:event', array(':event' => HTML::anchor(Route::model($event), '<i class="icon-heart icon-white"></i> ' . HTML::chars($event->name), array('class' => 'hoverable'))));
}
break;
}
return $text;
}
示例6: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
foreach ($this->_group_by_city() as $city => $venues) {
?>
<header>
<h4><?php
echo HTML::chars($city);
?>
</h4>
</header>
<ul class="list-unstyled row">
<?php
foreach ($venues as $venue) {
?>
<li class="col-xs-6 col-sm-4 col-md-3"><?php
echo HTML::anchor(Route::model($venue), HTML::chars($venue->name));
?>
</li>
<?php
}
?>
</ul>
<?php
}
return ob_get_clean();
}
示例7: content
/**
* Render content.
*
* @return string
*/
public function content()
{
// Venue
if ($this->event->venue_hidden) {
$venue = __('Underground');
} elseif ($venue = $this->event->venue()) {
$venue = HTML::anchor(Route::model($venue), HTML::chars($venue->name));
} else {
$venue = HTML::chars($this->event->venue_name);
}
ob_start();
?>
<span class="details"><?php
echo $this->event->price() . ($venue ? ' @ ' : '') . $venue;
?>
</span><br />
<span class="djs"><?php
echo HTML::chars($this->event->dj);
?>
</span>
<?php
return ob_get_clean();
}
示例8: _head
/**
* Render <head>.
*
* @return string
*/
protected function _head()
{
ob_start();
?>
<head>
<meta charset="<?php
echo Kohana::$charset;
?>
" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php
echo Kohana::$charset;
?>
" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title><?php
echo ($this->title ? HTML::chars($this->title) . ' | ' : '') . Kohana::$config->load('site.site_name');
?>
</title>
<link rel="icon" type="image/png" href="<?php
echo $this->base;
?>
ui/favicon.png" />
<?php
echo $this->_styles();
?>
</head>
<?php
return ob_get_clean();
}
示例9: content
/**
* Render view.
*
* @return string
*/
public function content()
{
if (!$this->blog_entries) {
return '';
}
ob_start();
?>
<ul class="unstyled">
<?php
foreach ($this->blog_entries as $entry) {
?>
<li><?php
echo HTML::anchor(Route::model($entry), HTML::chars($entry->name));
?>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
示例10: content
/**
* Render view.
*
* @return string
*/
public function content()
{
if (!$this->blog_entries) {
return '';
}
ob_start();
?>
<ul class="list-unstyled">
<?php
foreach ($this->blog_entries as $entry) {
?>
<li><?php
echo __(':blog by :author', array(':blog' => HTML::anchor(Route::model($entry), HTML::chars($entry->name)), ':author' => HTML::user($entry->author())));
?>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
示例11: content
/**
* Render content.
*
* @return string
*/
public function content()
{
ob_start();
// Stamp
echo HTML::time(Date('l ', $this->event->stamp_begin) . Date::format('DDMMYYYY', $this->event->stamp_begin), $this->event->stamp_begin, true);
// Location
if ($this->event->venue) {
echo ' @ ', HTML::anchor(Route::model($this->event->venue), HTML::chars($this->event->venue->name)), ', ', HTML::chars($this->event->venue->city_name);
} elseif ($this->event->venue_name) {
echo ' @ ', $this->event->venue_url ? HTML::anchor($this->event->venue_url, $this->event->venue_name) : HTML::chars($this->event->venue_name), $this->event->city_name ? ', ' . HTML::chars($this->event->city_name) : '';
} elseif ($this->event->city_name) {
echo ' @ ', HTML::chars($this->event->city_name);
}
// Flyer
if ($flyer = $this->event->flyer()) {
echo '<figure>', HTML::image($flyer->image_url(Model_Image::SIZE_THUMBNAIL)), '</figure>';
} elseif ($this->event->flyer_front_url) {
echo '<figure>', HTML::image($this->event->flyer_front_url, ['class' => 'img-responsive']), '</figure>';
}
// Favorites
if ($this->event->favorite_count) {
echo '<span class="stats"><i class="fa fa-heart"></i> ' . $this->event->favorite_count . '</span>';
}
return ob_get_clean();
}
示例12: content
/**
* Render content.
*
* @return string
*/
public function content()
{
if (!$this->events) {
return '';
}
ob_start();
?>
<ul class="list-unstyled">
<?php
foreach ($this->events as $event) {
?>
<li>
<span title="<?php
echo Date::format(Date::DATETIME, $event->stamp_begin) . ($event->stamp_end ? ' - ' . Date::format(Date::TIME, $event->stamp_end) : '');
?>
"><?php
echo Date::format(Date::DM_PADDED, $event->stamp_begin);
?>
</span>
<?php
echo HTML::anchor(Route::model($event), HTML::chars($event->name), array('class' => 'hoverable', 'title' => HTML::chars($event->name)));
?>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
示例13: content
/**
* Render view.
*
* @return string
*/
public function content()
{
if (!$this->topics) {
return '';
}
ob_start();
?>
<ul class="unstyled">
<?php
foreach ($this->topics as $topic) {
?>
<li>
<small class="ago"><?php
echo HTML::time(Date::short_span($topic->last_posted, true), $topic->last_posted);
?>
</small>
<?php
echo HTML::anchor(Route::model($topic), '<i class="muted iconic-upload"></i>', array('title' => __('First post')));
?>
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), HTML::chars($topic->name), array('title' => $topic->name));
?>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
示例14: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
?>
<ul class="thumbnails">
<?php
foreach ($this->flyers as $flyer) {
$name = $flyer->event ? $flyer->event->name : $flyer->name;
?>
<li class="span2">
<?php
echo HTML::anchor(Route::get('flyer')->uri(array('id' => $flyer->id)), HTML::image($flyer->image->get_url('thumbnail')), array('class' => 'thumbnail'));
?>
<h4><?php
echo HTML::anchor(Route::get('flyer')->uri(array('id' => $flyer->id)), HTML::chars($name), array('title' => HTML::chars($name)));
?>
</h4>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
示例15: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
$uri = Route::model($this->venue, 'combine');
?>
<ul class="unstyled">
<?php
foreach ($this->venues as $venue) {
?>
<li><?php
echo floor($venue['similarity']);
?>
% <?php
echo HTML::anchor($uri . '/' . $venue['venue']->id, HTML::chars($venue['venue']->name) . ', ' . HTML::chars($venue['venue']->city_name));
?>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}