本文整理汇总了PHP中HTML::user方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::user方法的具体用法?PHP HTML::user怎么用?PHP HTML::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: get
/**
* Get newsfeed item as HTML
*
* @param Model_NewsfeedItem $item
* @return string
*/
public static function get(Model_NewsfeedItem $item)
{
$link = $item->is_aggregate() ? implode('<br>', self::get_links($item)) : self::get_link($item);
if (!$link) {
return '';
}
$text = '';
switch ($item->type) {
case self::TYPE_COMMENT:
$text = $item->is_aggregate() ? __('commented photos') : __('commented a photo');
break;
case self::TYPE_COMMENT_FLYER:
$text = $item->is_aggregate() ? __('commented flyers') : __('commented a flyer');
break;
case self::TYPE_FLYER_EDIT:
$text = $item->is_aggregate() ? __('updated flyers') : __('updated a flyer');
break;
case self::TYPE_NOTE:
$user = Model_User::find_user($item->data['user_id']);
if ($link && $user->loaded()) {
$text = __('tagged :user to a photo', array(':user' => HTML::user($user)));
}
break;
case self::TYPE_UPLOAD:
$text = __('added new photos to a gallery');
break;
}
return $text . '<br />' . $link;
}
示例3: content
/**
* Render view.
*
* @return string
*/
public function content()
{
// Build short (friends) and long (others) user list
$short = $long = array();
$total = count($this->users);
foreach ($this->users as $user) {
$user = is_array($user) ? $user : Model_User::find_user_light($user);
if ($total < 11 || Visitor::$user && Visitor::$user->is_friend($user)) {
$short[mb_strtoupper($user['username'])] = HTML::user($user);
} else {
$long[mb_strtoupper($user['username'])] = HTML::user($user);
}
}
ksort($long);
// If no friends, pick random from long
if (empty($short) && !empty($long)) {
$shorts = (array) array_rand($long, min(10, count($long)));
foreach ($shorts as $move) {
$short[$move] = $long[$move];
unset($long[$move]);
}
}
ksort($short);
ob_start();
if (count($short)) {
echo implode(', ', $short);
}
if (count($long)) {
echo ' ', __('and'), ' ', HTML::anchor('#long', __(count($long) == 1 ? ':count other ▾' : ':count others ▾', array(':count' => count($long))), array('title' => __('Show all'), 'data-toggle' => 'collapse', 'data-target' => '#long', 'onclick' => 'return false;'));
echo '<div id="long" class="collapse">', implode(', ', $long), '</div>';
}
return ob_get_clean();
}
示例4: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
echo '<figure>', HTML::image($this->image->get_url(Model_Image::SIZE_THUMBNAIL)), '</figure>';
// Tagged people
$notes = $this->image->notes();
if (count($notes)) {
$names = array();
/** @var Model_Image_Note $note */
foreach ($notes as $note) {
$user = $note->user();
$names[] = $user ? HTML::user($user['username']) : HTML::chars($note->name);
}
echo implode(', ', $names);
}
// Copyright
if ($this->image->author_id) {
echo '<br />© ', HTML::user($this->image->author_id);
}
// Comments
if ($this->image->comment_count) {
echo '<span class="stats"><i class="icon-comment"></i> ' . $this->image->comment_count . '</span>';
}
return ob_get_clean();
}
示例5: get
/**
* Get newsfeed item as HTML
*
* @param Model_NewsfeedItem $item
* @return string
*/
public static function get(Model_NewsfeedItem $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_COMMENT:
$gallery = Model_Gallery::factory($item->data['gallery_id']);
$image = Model_Image::factory($item->data['image_id']);
if ($gallery->loaded() && $image->loaded()) {
$text = __('commented to an image<br />:gallery', array(':gallery' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), '<i class="icon-camera icon-white"></i> ' . HTML::chars($gallery->name), array('class' => 'hoverable'))));
}
break;
case self::TYPE_COMMENT_FLYER:
$flyer = Model_Flyer::factory($item->data['flyer_id']);
if ($flyer->loaded()) {
$text = __('commented to a flyer<br />:flyer', array(':flyer' => HTML::anchor(Route::url('flyer', array('id' => $flyer->id)), '<i class="icon-picture icon-white"></i> ' . ($flyer->name ? HTML::chars($flyer->name) : __('flyer')), array('class' => 'hoverable'))));
}
break;
case self::TYPE_FLYER_EDIT:
$flyer = Model_Flyer::factory($item->data['flyer_id']);
if ($flyer->loaded()) {
$text = __('updated flyer<br />:flyer', array(':flyer' => HTML::anchor(Route::url('flyer', array('id' => $flyer->id)), '<i class="icon-picture icon-white"></i> ' . ($flyer->name ? HTML::chars($flyer->name) : __('flyer')), array('class' => 'hoverable'))));
}
break;
case self::TYPE_NOTE:
$gallery = Model_Gallery::factory($item->data['gallery_id']);
$image = Model_Image::factory($item->data['image_id']);
$user = Model_User::find_user($item->data['user_id']);
if ($gallery->loaded() && $image->loaded() && $user->loaded()) {
$text = __('tagged :user to an image<br />:gallery', array(':user' => HTML::user($user), ':gallery' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), '<i class="icon-tag icon-white"></i> ' . HTML::chars($gallery->name), array('class' => 'hoverable'))));
}
break;
}
return $text;
}
示例6: content
/**
* Render content.
*
* @return string
*/
public function content()
{
$shouts = array();
foreach (Model_Shout::find_latest($this->limit) as $shout) {
$shouts[] = array('created' => $shout->created, 'user_id' => $shout->author_id, 'shout' => $shout->shout);
}
if ($shouts) {
ob_start();
?>
<ul class="list-unstyled">
<?php
foreach (array_reverse($shouts) as $shout) {
?>
<li>
<?php
echo HTML::time(Date::format('HHMM', $shout['created']), array('datetime' => $shout['created'], 'class' => 'muted'));
?>
<?php
echo HTML::user($shout['user_id']);
?>
:
<?php
echo Text::smileys(Text::auto_link_urls(HTML::chars($shout['shout'])));
?>
</li>
<?php
}
?>
</ul>
<?php
if ($this->_can_shout) {
?>
<form <?php
echo $this->aside ? 'class="ajaxify"' : '';
?>
action="<?php
echo Route::url('shouts', array('action' => 'shout'));
?>
" method="post">
<input class="form-control" type="text" name="shout" maxlength="300" placeholder="<?php
echo __('Shout, and ye shall be heard..');
?>
" />
<?php
echo Form::CSRF();
?>
</form>
<?php
}
return ob_get_clean();
}
return '';
}
示例7: get_link
/**
* Get anchor to newsfeed item target.
*
* @static
* @param Model_NewsfeedItem $item
* @return string
*/
public static function get_link(Model_NewsfeedItem $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_FRIEND:
if ($friend = Model_User::find_user($item->data['friend_id'])) {
$text = HTML::user($friend);
}
break;
}
return $text;
}
示例8: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
// Title
if ($this->area->description) {
echo $this->area->description . '<hr>';
}
if ($this->area->topic_count) {
// Area has topics
$last_topic = $this->area->last_topic();
$last_poster = $last_topic->last_post()->author();
?>
<div class="media">
<div class="pull-left">
<?php
echo HTML::avatar($last_poster ? $last_poster['avatar'] : null, $last_poster ? $last_poster['username'] : null, false);
?>
</div>
<div class="media-body">
<small class="ago"><?php
echo HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted);
?>
</small>
<?php
echo $last_poster ? HTML::user($last_poster) : HTML::chars($last_topic->last_poster);
?>
<br>
<?php
echo HTML::anchor(Route::model($last_topic, '?page=last#last'), Forum::topic($last_topic), array('title' => HTML::chars($last_topic->name)));
?>
<br />
</div>
</div>
<small class="stats muted">
<i class="icon-comments"></i> <?php
echo Num::format($this->area->topic_count, 0);
?>
<i class="icon-comment"></i> <?php
echo Num::format($this->area->post_count, 0);
?>
</small>
<?php
} else {
// Empty area
echo __('No topics yet.');
}
return ob_get_clean();
}
示例9: __construct
/**
* Create new view.
*
* @param Model_Blog_Entry $blog_entry
* @param boolean $show_title
*/
public function __construct(Model_Blog_Entry $blog_entry, $show_title = false)
{
parent::__construct();
$this->blog_entry = $blog_entry;
if ($show_title) {
$author = $blog_entry->author();
// $this->avatar = HTML::avatar($author['avatar'], $author['username']);
$this->title = HTML::anchor(Route::model($blog_entry), HTML::chars($blog_entry->name));
$this->subtitle = __('By :user, :date', array(':user' => HTML::user($author), ':date' => date('l ', $blog_entry->created) . Date::format(Date::DMY_SHORT, $blog_entry->created)));
if (Permission::has($blog_entry, Model_Blog_Entry::PERMISSION_COMMENTS)) {
$this->subtitle .= ' | ' . HTML::anchor(Route::model($blog_entry), __('Comments') . ' (' . (int) $blog_entry->comment_count . ')');
}
}
}
示例10: get
/**
* Get notification as HTML.
*
* @static
* @param Model_Notification
* @return string
*/
public static function get(Model_Notification $notification)
{
$text = '';
switch ($notification->type) {
case self::TYPE_FRIEND:
$friend = Model_User::find_user($notification->user_id);
if ($friend->loaded()) {
$text = __(':friend added you as a friend', array(':friend' => HTML::user($friend)));
} else {
$notification->delete();
}
break;
}
return $text;
}
示例11: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
if ($this->gallery->links) {
$links = explode("\n", $this->gallery->links);
$count = 0;
?>
<ul class="list-unstyled">
<?php
foreach ($links as $link) {
list($user_id, $url) = explode(',', $link, 2);
?>
<li>
<?php
echo HTML::anchor($url, Text::limit_url($url, 75));
?>
© <?php
echo HTML::user($user_id);
?>
<?php
if (Visitor::$user && $user_id == Visitor::$user->id || Permission::has($this->gallery, Model_Gallery::PERMISSION_UPDATE)) {
?>
<?php
echo HTML::anchor(Route::model($this->gallery) . '?delete_link=' . $count . '&' . Security::csrf_query(), __('Remove'), array('class' => 'btn btn-danger btn-xs link-delete'));
?>
<?php
}
?>
</li>
<?php
$count++;
}
?>
</ul>
<?php
}
// Add new link
if (Permission::has($this->gallery, Model_Gallery::PERMISSION_CREATE)) {
echo HTML::anchor('#add-link', '<i class="fa fa-plus-circle"></i> ' . __('Add link'), array('data-toggle' => 'collapse', 'data-target' => '#form-link'));
echo $this->form();
}
return ob_get_clean();
}
示例12: __construct
/**
* Create new view.
*
* @param Model_Music_Track $track
*/
public function __construct($track = null)
{
parent::__construct();
$this->track = $track;
$this->id = 'music-' . $track->id;
$this->title = HTML::anchor(Route::model($track), HTML::chars($track->name));
$author = $this->track->author();
$this->subtitle = HTML::user($author, null, null, Route::url('profile_music', array('username' => urlencode($author['username']))));
// Meta
if ($tags = $track->tags()) {
$this->meta = '<small>' . implode(', ', $tags) . '</small>';
} else {
if ($track->music) {
$this->meta = '<small>' . $track->music . '</small>';
}
}
}
示例13: __construct
/**
* Create new shouts view.
*/
public function __construct()
{
parent::__construct();
$this->_guest_count = Model_User_Online::get_guest_count();
$users = Model_User_Online::find_online_users();
$this->title = __('Online');
// Build user lists
$friends = (bool) self::$_user ? self::$_user->find_friends() : array();
foreach ($users as $user_id) {
$user = Model_User::find_user_light($user_id);
if (in_array($user_id, $friends)) {
$this->_friends[mb_strtoupper($user['username'])] = HTML::user($user);
} else {
$this->_users[mb_strtoupper($user['username'])] = HTML::user($user);
}
}
}
示例14: render
/**
* Render view.
*
* @return string
*/
public function render()
{
ob_start();
?>
<li class="media">
<div class="pull-left">
<?php
echo HTML::avatar($this->user['avatar'], $this->user['username']);
?>
</div>
<div class="media-body">
<?php
if (Visitor::$user && !Visitor::$user->is_friend($this->user)) {
?>
<?php
echo HTML::anchor(URL::user($this->user, 'friend') . '?token=' . Security::csrf(), '<i class="fa fa-heart"></i> ' . __('Add to friends'), array('class' => 'ajaxify btn btn-lovely btn-sm pull-right', 'data-ajaxify-target' => 'li.media'));
?>
<?php
}
?>
<?php
echo HTML::user($this->user);
?>
<br />
<?php
if ($this->common) {
?>
<small><?php
echo __(':friends mutual friends', array(':friends' => $this->common));
?>
</small><br />
<?php
}
?>
</div>
</li>
<?php
return ob_get_clean();
}
示例15: content
/**
* Render newsfeed.
*
* @return string
*/
public function content()
{
if ($items = $this->_items()) {
ob_start();
?>
<ul class="media-list">
<?php
foreach ($items as $item) {
?>
<li class="media">
<div class="pull-left">
<?php
echo HTML::avatar($item['user']['avatar'], $item['user']['username'], $this->mini);
?>
</div>
<div class="media-body">
<?php
echo HTML::user($item['user']);
?>
<small class="pull-right"><?php
echo HTML::time(Date::short_span($item['stamp'], true, true), $item['stamp']);
?>
</small>
<?php
echo $item['text'];
?>
</div>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
return __('Whoa, we are totally out of news items for you!');
}