/** * 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(); }
/** * 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; }
/** * 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(); }
/** * 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(); }
/** * 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; }
/** * 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 ''; }
/** * 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; }
/** * 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(); }
/** * 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 . ')'); } } }
/** * 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; }
/** * 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(); }
/** * 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>'; } } }
/** * 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); } } }
/** * 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(); }
/** * 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!'); }
/** * Render view. * * @return string */ public function content() { ob_start(); $ignores = array(); foreach ($this->user->find_ignores() as $ignore_id) { $ignore = Model_User::find_user_light($ignore_id); $ignores[$ignores['username']] = $ignore; } ksort($ignores, SORT_LOCALE_STRING); ?> <ul class="media-list"> <?php foreach ($ignores as $ignore) { ?> <li class="media"> <div class="pull-left"> <?php echo HTML::avatar($ignore['avatar'], $ignore['username']); ?> </div> <div class="media-body"> <?php echo HTML::user($ignore); ?> <br /> <?php echo HTML::anchor(URL::user($ignore, 'unignore') . '?token=' . Security::csrf(), '<i class="fa fa-ban"></i> ' . __('Unignore'), array('class' => 'btn btn-default btn-sm ignore-delete')); ?> </div> </li> <?php } ?> </ul> <?php return ob_get_clean(); }
/** * 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_DEFAULT_IMAGE: $image = Model_Image::factory($item->data['image_id']); if ($image->loaded()) { $text = __('changed their default image'); } break; case self::TYPE_FRIEND: $friend = Model_User::find_user($item->data['friend_id']); if ($friend->loaded()) { $text = __('added :friend as a friend', array(':friend' => HTML::user($friend))); } break; case self::TYPE_LOGIN: $text = __('logged in'); break; } return $text; }
/** * Render view. * * @return string */ public function content() { ob_start(); echo '<figure>', HTML::image($this->image->get_url(Model_Image::SIZE_THUMBNAIL)), '</figure>'; // Tagged people if ($this->image->description) { $names = array(); foreach (explode(',', $this->image->description) as $name) { $names[] = HTML::user(trim($name)); } echo __('In picture: :users', array(':users' => 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(); }
/** * Render view. * * @return string */ public function content() { ob_start(); $friends = array(); foreach ($this->user->find_friends() as $friend_id) { $friend = Model_User::find_user_light($friend_id); $friends[$friend['username']] = $friend; } ksort($friends, SORT_LOCALE_STRING); ?> <ul class="unstyled"> <?php foreach ($friends as $friend) { ?> <li class="row-fluid"> <?php echo HTML::avatar($friend['avatar'], $friend['username']); ?> <?php echo HTML::user($friend); ?> <?php if ($friend['last_login']) { echo '<small class="ago">' . HTML::time(Date::short_span($friend['last_login'], true, true), $friend['last_login']) . '</small>'; } ?> </li> <?php } ?> </ul> <?php return ob_get_clean(); }
/** * Render content. * * @return string */ public function content() { $dates = array(); foreach (Model_User::find_new_users($this->limit) as $user_id => $stamp) { $user = Model_User::find_user_light($user_id); $dates[Date::format(Date::DMY_SHORT, $stamp)][] = array('user' => $user, 'stamp' => $stamp); } ob_start(); foreach ($dates as $date => $users) { ?> <h4><?php echo $date; ?> </h4> <ul class="block-grid three-up"> <?php foreach ($users as $user) { ?> <li> <?php echo HTML::avatar($user['user']['avatar'], $user['user']['username']), ' ', HTML::user($user['user']); ?> <br /> <time class="muted"><?php echo Date::format(Date::TIME, $user['stamp']); ?> </time> </li> <?php } ?> </ul> <?php } return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); $ignores = array(); foreach ($this->user->find_ignores() as $ignore_id) { $ignore = Model_User::find_user_light($ignore_id); $ignores[$ignores['username']] = $ignore; } ksort($ignores, SORT_LOCALE_STRING); ?> <ul class="unstyled"> <?php foreach ($ignores as $ignore) { ?> <li class="row-fluid"> <?php echo HTML::avatar($ignore['avatar'], $ignore['username']); ?> <?php echo HTML::user($ignore); ?> <br /> <?php echo HTML::anchor(URL::user($ignore, 'unignore') . '?token=' . Security::csrf(), '<i class="icon-ban-circle icon-white"></i> ' . __('Unignore'), array('class' => 'btn btn-inverse btn-small ignore-delete')); ?> </li> <?php } ?> </ul> <?php return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); if ($this->blog_entries && count($this->blog_entries)) { // List blog entries foreach ($this->blog_entries as $blog_entry) { /** @var Model_Blog_Entry $blog_entry */ $author = $blog_entry->author(); ?> <article class="row blog-entry"> <div class="span1"><?php echo HTML::avatar($author['avatar'], $author['username']); ?> </div> <div class="span7"> <header> <h4><?php echo HTML::anchor(Route::model($blog_entry), HTML::chars($blog_entry->name)); ?> </h4> <p><?php echo __('By :user :ago', array(':user' => HTML::user($author), ':ago' => HTML::time(Date::fuzzy_span($blog_entry->created), $blog_entry->created))); ?> </p> </header> </div> </article> <?php } } else { // No blog entries available echo new View_Alert(__('Alas, the quill seems to be dry, no blog entries found.'), View_Alert::INFO); } return ob_get_clean(); }
/** * Render newsfeed. * * @return string */ public function content() { if ($items = $this->_items()) { ob_start(); ?> <ul class="unstyled"> <?php foreach ($items as $item) { ?> <li class="row-fluid"> <?php echo HTML::avatar($item['user']['avatar'], $item['user']['username'], $this->mini); ?> <?php echo HTML::user($item['user']); ?> <small class="ago"><?php echo HTML::time(Date::short_span($item['stamp'], true, true), $item['stamp']); ?> </small> <?php echo $item['text']; ?> </li> <?php } ?> </ul> <?php return ob_get_clean(); } return __('Whoa, we are totally out of news items for you!'); }
/** * Get notification as HTML. * * @static * @param Model_Notification * @return string */ public static function get(Model_Notification $notification) { $text = ''; switch ($notification->type) { case self::TYPE_IMAGE_COMMENT: $user = Model_User::find_user($notification->user_id); $image = Model_Image::factory($notification->data_id); if ($user->loaded() && $image->loaded()) { $gallery = $image->gallery(); $text = __(':user commented your :photo: <em>:comment</em>', array(':user' => HTML::user($user), ':photo' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), __('photo'), array('class' => 'hoverable')), ':comment' => Text::smileys(Text::auto_link_urls(HTML::chars($notification->text))))); } else { $notification->delete(); } break; case self::TYPE_IMAGE_NOTE: $user = Model_User::find_user($notification->user_id); $image = Model_Image::factory($notification->data_id); if ($user->loaded() && $image->loaded()) { $gallery = $image->gallery(); $text = __(':user tagged you to a :photo', array(':user' => HTML::user($user), ':photo' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), __('photo'), array('class' => 'hoverable')))); } else { $notification->delete(); } break; case self::TYPE_IMAGE_REPORT: $user = Model_User::find_user($notification->user_id); $image = Model_Image::factory($notification->data_id); if ($user->loaded() && $image->loaded()) { $gallery = $image->gallery(); $text = __(':user reported a :photo: <em>:reason</em>', array(':user' => HTML::user($user), ':photo' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), __('photo'), array('class' => 'hoverable')), ':reason' => $notification->text ? HTML::chars($notification->text) : __('No reason'))); } else { $notification->delete(); } break; } return $text; }
* * @package Anqh * @author Antti Qvickström * @copyright (c) 2011 Antti Qvickström * @license http://www.opensource.org/licenses/mit-license.php MIT license */ ?> <ul> <?php foreach ($friends as $friend) { ?> <li class="group"> <?php echo HTML::avatar($friend['avatar'], $friend['username']); ?> <?php echo HTML::user($friend); ?> <?php if (isset($friend['last_login'])) { echo '<small class="ago">', HTML::time(Date::short_span($friend['last_login'], true, true), $friend['last_login']), '</small>'; } ?> </li> <?php } ?> </ul>
/** * Render view. * * @return string */ public function content() { ob_start(); if (count($this->topics)) { ?> <table class="table table-condensed table-striped"> <tbody> <?php foreach ($this->topics as $topic) { $last_poster = $topic->last_post()->author(); $area = $this->area ? false : $topic->area(); ?> <tr> <td> <h4 class="media-heading"> <?php if ($this->area || $topic->recipient_count) { ?> <?php echo HTML::anchor(Route::model($topic), Forum::topic($topic)); ?> <small class="transparent"><?php echo HTML::anchor(Route::model($topic, '?page=last#last'), '<i class="text-muted fa fa-level-down"></i>', array('title' => __('Last post'))); ?> </small> <?php } else { ?> <?php echo HTML::anchor(Route::model($topic, '?page=last#last'), Forum::topic($topic)); ?> <small class="transparent"><?php echo HTML::anchor(Route::model($topic), '<i class="text-muted fa fa-level-up"></i>', array('title' => __('First post'))); ?> </small> <?php } ?> </h4> <?php if ($area) { ?> <small class="muted"> <?php echo HTML::anchor(Route::model($area), HTML::chars($area->name), array('class' => 'hoverable')); ?> </small> <?php } ?> </td> <td class="text-right muted nowrap"> <small title="<?php echo __('Replies'); ?> "><?php echo Num::format($topic->post_count - 1, 0); ?> <i class="fa fa-comment"></i></small> </td> <td> <?php echo HTML::avatar($last_poster ? $last_poster['avatar'] : null, $last_poster ? $last_poster['username'] : null, 'small'); ?> <?php echo $last_poster ? HTML::user($last_poster) : HTML::chars($topic->last_poster); ?> </td> <td> <small class="muted pull-right nowrap"><?php echo HTML::time(Date::short_span($topic->last_posted, true, true), $topic->last_posted); ?> </small> </td> </tr> <?php } ?> </tbody> </table> <?php } else { // Empty area echo new View_Alert(__('Here be nothing yet.'), null, View_Alert::INFO); } return ob_get_clean(); }
/** * Blog entries * * @package Blog * @author Antti Qvickström * @copyright (c) 2010-2011 Antti Qvickström * @license http://www.opensource.org/licenses/mit-license.php MIT license */ foreach ($entries as $entry) { $author = $entry->author(); ?> <article> <header> <?php echo HTML::avatar($author['avatar'], $author['username']); ?> <h4><?php echo HTML::anchor(Route::model($entry), HTML::chars($entry->name), array('title' => $entry->name)); ?> </h4> <span class="details"> <?php echo __('By :user :ago', array(':user' => HTML::user($author), ':ago' => HTML::time(Date::fuzzy_span($entry->created), $entry->created))); ?> </span> </header> </article> <?php }
/** * Handle forum quotations * * @param BBCode $bbcode * @param string $action * @param string $name * @param string $default * @param array $params * @param string $content * @return string */ public function bbcode_quote($bbcode, $action, $name, $default, $params, $content) { // Pass all to 2nd phase if ($action == BBCODE_CHECK) { return true; } // Parse parameters foreach ($params['_params'] as $param) { switch ($param['key']) { // Parent post id case 'post': $post = Jelly::select('forum_post', (int) $param['value']); break; // Parent post author // Parent post author case 'author': $author_name = $param['value']; $author = Model_User::find_user($author_name); break; } } // Add parent post if (isset($post) && $post->loaded()) { $quote = '<blockquote cite="' . URL::site(Route::model($post->topic)) . '?post=' . $post->id . '#post-' . $post->id . '">'; // Override author $author = $post->author; } else { $quote = '<blockquote>'; } $quote .= '<p>' . trim($content) . '</p>'; // Post author if (isset($author) && $author->loaded()) { $quote .= '<cite>' . __('-- :author', array(':author' => HTML::user($author))) . '</cite>'; } else { if (isset($author_name)) { $quote .= '<cite>' . __('-- :author', array(':author' => HTML::chars($author_name))) . '</cite>'; } } $quote .= '</blockquote>'; return $quote; }
* @license http://www.opensource.org/licenses/mit-license.php MIT license */ ?> <div class="users"> <?php // Build short (friends) and long (others) user list $short = $long = array(); $total = count($users); foreach ($users as $user) { $user = is_array($user) ? $user : Model_User::find_user_light($user); if ($total < 11 || $viewer && $viewer->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); ?> <?php
<ul> <?php $i = 0; if ($notes) { foreach ($notes as $noted) { $i++; $noted_user = $noted->user(); $name = $noted_user ? $noted_user['username'] : $noted->name; ?> <li> <?php if ($noted_user) { ?> <?php echo HTML::user($noted_user, null, array('data-note-id' => $noted->id)); ?> <?php } else { ?> <span data-note-id="<?php echo $noted->id; ?> "><?php echo HTML::chars($name); ?> </span> <?php } ?>