当前位置: 首页>>代码示例>>PHP>>正文


PHP Model_User::find_user_light方法代码示例

本文整理汇总了PHP中Model_User::find_user_light方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::find_user_light方法的具体用法?PHP Model_User::find_user_light怎么用?PHP Model_User::find_user_light使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model_User的用法示例。


在下文中一共展示了Model_User::find_user_light方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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 &#9662;' : ':count others &#9662;', 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();
 }
开发者ID:anqh,项目名称:anqh,代码行数:38,代码来源:list.php

示例2: content

    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        $friends = array();
        $suggestions = $this->user->find_friend_suggestions();
        if ($suggestions) {
            $randoms = array_rand($suggestions, min($this->limit, count($suggestions)));
            foreach ($randoms as $friend_id) {
                $friend = Model_User::find_user_light($friend_id);
                $friends[$friend['username']] = array('user' => $friend, 'score' => $suggestions[$friend_id]);
            }
            ?>

<ul class="media-list">
	<?php 
            foreach ($friends as $friend) {
                ?>

	<?php 
                echo new View_Users_Friend($friend['user'], $friend['score']);
                ?>

	<?php 
            }
            ?>
</ul>

<?php 
        } else {
            echo __('Darn, no friend suggestions available. You might want to consider adding some friends first?');
        }
        return ob_get_clean();
    }
开发者ID:anqh,项目名称:anqh,代码行数:38,代码来源:friendsuggestions.php

示例3: __construct

 /**
  * Create new view.
  *
  * @param  Model_User  $user
  * @param  boolean     $friended
  */
 public function __construct($user = null, $friended = false)
 {
     parent::__construct();
     $this->user = $user;
     $this->friended = $friended;
     foreach ($this->user->find_friends($this->friended) as $friend_id) {
         $friend = Model_User::find_user_light($friend_id);
         $this->friends[$friend['username']] = $friend;
     }
     ksort($this->friends, SORT_LOCALE_STRING);
     $this->title = $friended ? __('Friending me') : __('Friends');
     $this->title .= ' <small class="muted">(' . count($this->friends) . ')</small>';
 }
开发者ID:anqh,项目名称:anqh,代码行数:19,代码来源:friends.php

示例4: as_array

 /**
  * Get news feed as array
  *
  * @return  array
  */
 public function as_array()
 {
     $feed = array();
     foreach ($this->get_items() as $item) {
         // Ignore
         if ($this->_user && $this->_user->is_ignored($item->user_id)) {
             continue;
         }
         $class = 'Newsfeeditem_' . $item->class;
         if (method_exists($class, 'get') && ($text = call_user_func(array($class, 'get'), $item))) {
             $feed[] = array('user' => Model_User::find_user_light((int) $item->user_id), 'stamp' => $item->stamp, 'text' => $text);
         }
     }
     return $feed;
 }
开发者ID:anqh,项目名称:core,代码行数:20,代码来源:newsfeed.php

示例5: __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);
         }
     }
 }
开发者ID:anqh,项目名称:core,代码行数:20,代码来源:online.php

示例6: find_recipient_names

 /**
  * Get message recipient usernames
  *
  * @return  array
  */
 public function find_recipient_names()
 {
     static $recipients;
     if (!is_array($recipients)) {
         $recipients = array();
     }
     if ($this->loaded()) {
         if (!isset($recipients[$this->id])) {
             $recipients[$this->id] = array();
             foreach ($this->recipients() as $recipient) {
                 $recipients[$this->id][$recipient] = Arr::get(Model_User::find_user_light($recipient), 'username');
             }
             natcasesort($recipients[$this->id]);
         }
         return $recipients[$this->id];
     }
     return array();
 }
开发者ID:anqh,项目名称:anqh,代码行数:23,代码来源:topic.php

示例7: bbcode_quote

 /**
  * 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 = Model_Forum_Post::factory((int) $param['value']);
                 break;
                 // Parent post author
             // Parent post author
             case 'author':
                 $author_name = $param['value'];
                 $author = Model_User::find_user_light($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 = Model_User::find_user_light($post->author_id);
     } else {
         $quote = '<blockquote>';
     }
     $quote .= '<p>' . trim($content) . '</p>';
     // Post author
     if (isset($author) && $author) {
         $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;
 }
开发者ID:anqh,项目名称:core,代码行数:52,代码来源:bb.php

示例8: content

    /**
     * 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();
    }
开发者ID:anqh,项目名称:anqh,代码行数:46,代码来源:ignores.php

示例9: content

    /**
     * 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();
    }
开发者ID:anqh,项目名称:core,代码行数:44,代码来源:friends.php

示例10: content

    /**
     * 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();
    }
开发者ID:anqh,项目名称:core,代码行数:43,代码来源:new.php

示例11: content

    /**
     * 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();
    }
开发者ID:anqh,项目名称:core,代码行数:43,代码来源:ignores.php

示例12: user

 /**
  * Returns user link
  *
  * @param   mixed   $user
  * @param   string  $nick
  * @param   array   $attributes
  * @param   string  $url         override url
  * @return  string
  */
 public static function user($user, $nick = null, array $attributes = null, $url = null)
 {
     static $viewer = true;
     // Load current user for friend styling
     if ($viewer === true) {
         $viewer = Visitor::instance()->get_user();
     }
     $class = array('user', 'hoverable');
     if (is_array($user) || $user && ($user = Model_User::find_user_light($user))) {
         if ($user) {
             $nick = $user['username'];
             if ($viewer && $viewer->is_friend($user)) {
                 $class[] = 'friend ';
             }
             switch ($user['gender']) {
                 case 'f':
                     $class[] = 'female';
                     break;
                 case 'm':
                     $class[] = 'male';
                     break;
             }
         }
     }
     $class[] = Arr::get($attributes, 'class');
     $attributes['class'] = trim(implode(' ', $class));
     return empty($nick) ? __('Unknown') : HTML::anchor($url ? $url : URL::user($nick), $nick, $attributes);
 }
开发者ID:anqh,项目名称:anqh,代码行数:37,代码来源:html.php

示例13: user

 /**
  * Get note target user light array
  *
  * @return  array
  */
 public function user()
 {
     try {
         return $this->user_id ? Model_User::find_user_light($this->user_id) : null;
     } catch (AutoModeler_Exception $e) {
         return null;
     }
 }
开发者ID:anqh,项目名称:core,代码行数:13,代码来源:note.php

示例14: _edit_topic

 /**
  * Edit forum topic
  *
  * @param  integer  $area_id
  * @param  integer  $topic_id
  *
  * @throws  Model_Exception           invalid area, invalid topic
  * @throws  InvalidArgumentException  missing area and topic
  */
 protected function _edit_topic($area_id = null, $topic_id = null)
 {
     $this->history = false;
     $this->view = new View_Page();
     if ($area_id && !$topic_id) {
         // Start new topic
         $mode = View_Forum_PostEdit::NEW_TOPIC;
         /** @var  Model_Forum_Private_Area|Model_Forum_Area  $area */
         $area = $this->private ? Model_Forum_Private_Area::factory($area_id) : Model_Forum_Area::factory($area_id);
         if (!$area->loaded()) {
             throw new Model_Exception($area, $area_id);
         }
         Permission::required($area, Model_Forum_Area::PERMISSION_POST, self::$user);
         $this->view->title = HTML::chars($area->name);
         if ($this->private) {
             $topic = new Model_Forum_Private_Topic();
             $post = new Model_Forum_Private_Post();
             $cancel = Route::url('forum_area', array('id' => 'private', 'action' => ''));
             $recipients = array();
         } else {
             $topic = new Model_Forum_Topic();
             $post = new Model_Forum_Post();
             $cancel = Route::model($area);
         }
     } else {
         if ($topic_id) {
             // Edit old topic
             $mode = View_Forum_PostEdit::EDIT_TOPIC;
             /** @var  Model_Forum_Private_Topic|Model_Forum_Topic  $topic */
             $topic = $this->private ? Model_Forum_Private_Topic::factory($topic_id) : Model_Forum_Topic::factory($topic_id);
             if (!$topic->loaded()) {
                 throw new Model_Exception($topic, $topic_id);
             }
             Permission::required($topic, Model_Forum_Topic::PERMISSION_UPDATE, self::$user);
             // Build recipients list
             if ($this->private) {
                 $recipients = $topic->find_recipient_names();
             }
             $this->view->title_html = Forum::topic($topic);
             $cancel = Route::model($topic);
             // Set actions
             if (Permission::has($topic, Model_Forum_Topic::PERMISSION_DELETE, self::$user)) {
                 $this->view->actions[] = array('link' => Route::model($topic, 'delete') . '?' . Security::csrf_query(), 'text' => '<i class="icon-trash icon-white"></i> ' . __('Delete topic'), 'class' => 'btn btn-danger topic-delete');
             }
         } else {
             throw new InvalidArgumentException('Topic and area missing');
         }
     }
     $errors = array();
     if ($_POST && Security::csrf_valid()) {
         // Get recipients
         if ($this->private) {
             $post_recipients = array();
             foreach (explode(',', Arr::get_once($_POST, 'recipients')) as $recipient) {
                 if ($user = Model_User::find_user_light(trim($recipient))) {
                     $post_recipients[$user['id']] = $user['username'];
                 }
             }
             // Make sure author is included
             $post_recipients[self::$user->id] = self::$user->username;
         }
         if (isset($post)) {
             // New topic
             $post->post = $_POST['post'];
             $post->forum_area_id = $area->id;
             $post->author_id = self::$user->id;
             $post->author_name = self::$user->username;
             $post->author_ip = Request::$client_ip;
             $post->author_host = Request::host_name();
             $post->created = time();
             try {
                 $post->is_valid();
             } catch (Validation_Exception $e) {
                 $errors += $e->array->errors('validate');
             }
             $topic->author_id = self::$user->id;
             $topic->author_name = self::$user->username;
             $topic->name = $_POST['name'];
             $topic->forum_area_id = $area->id;
             $topic->created = time();
             try {
                 $topic->is_valid();
             } catch (Validation_Exception $e) {
                 $errors += $e->array->errors('validate');
             }
             // If no errors found, save models
             if (empty($errors)) {
                 $topic->save();
                 // Recipients
                 if ($this->private) {
                     $topic->set_recipients($post_recipients);
//.........这里部分代码省略.........
开发者ID:anqh,项目名称:forum,代码行数:101,代码来源:topic.php

示例15: action_hover

 /**
  * Action: hover card
  */
 public function action_hover()
 {
     $this->history = false;
     // Hover card works only with ajax
     if ($this->_request_type !== Controller::REQUEST_AJAX) {
         return $this->action_index();
     }
     if ($user = Model_User::find_user_light(urldecode((string) $this->request->param('username')))) {
         $this->response->body(new View_User_HoverCard($user));
     } else {
         $this->response->body(__('Member not found o_O'));
     }
 }
开发者ID:anqh,项目名称:core,代码行数:16,代码来源:user.php


注:本文中的Model_User::find_user_light方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。