當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HTML::chars方法代碼示例

本文整理匯總了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);
    }
開發者ID:vetalstar,項目名稱:LiveTex,代碼行數:31,代碼來源:Auth.php

示例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();
 }
開發者ID:eok8177,項目名稱:shopCMS,代碼行數:10,代碼來源:Backend.php

示例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;
     }
 }
開發者ID:alex-bro,項目名稱:test-vezom,代碼行數:36,代碼來源:Guestbook.php

示例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();
 }
開發者ID:anqh,項目名稱:events,代碼行數:32,代碼來源:hovercard.php

示例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;
 }
開發者ID:anqh,項目名稱:events,代碼行數:32,代碼來源:events.php

示例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();
    }
開發者ID:anqh,項目名稱:anqh,代碼行數:37,代碼來源:index.php

示例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();
    }
開發者ID:anqh,項目名稱:events,代碼行數:30,代碼來源:day.php

示例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();
    }
開發者ID:anqh,項目名稱:core,代碼行數:38,代碼來源:errorpage.php

示例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();
    }
開發者ID:anqh,項目名稱:blog,代碼行數:31,代碼來源:list.php

示例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();
    }
開發者ID:anqh,項目名稱:anqh,代碼行數:31,代碼來源:list.php

示例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();
 }
開發者ID:anqh,項目名稱:anqh,代碼行數:30,代碼來源:hovercard.php

示例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();
    }
開發者ID:anqh,項目名稱:anqh,代碼行數:39,代碼來源:list.php

示例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();
    }
開發者ID:anqh,項目名稱:forum,代碼行數:39,代碼來源:list.php

示例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();
    }
開發者ID:anqh,項目名稱:galleries,代碼行數:38,代碼來源:latest.php

示例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();
    }
開發者ID:anqh,項目名稱:venues,代碼行數:34,代碼來源:similar.php


注:本文中的HTML::chars方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。