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


PHP Profile::limit方法代码示例

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


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

示例1: prepare

 protected function prepare(array $args = array())
 {
     // If we die, show short error messages.
     GNUsocial::setApi(true);
     parent::prepare($args);
     $this->groups = array();
     $this->profiles = array();
     $term = $this->arg('term');
     $limit = $this->arg('limit');
     if ($limit > 200) {
         $limit = 200;
     }
     //prevent DOS attacks
     if (substr($term, 0, 1) == '@') {
         //profile search
         $term = substr($term, 1);
         $profile = new Profile();
         $profile->limit($limit);
         $profile->whereAdd('nickname like \'' . trim($profile->escape($term), '\'') . '%\'');
         $profile->whereAdd(sprintf('id in (SELECT id FROM user) OR ' . 'id in (SELECT subscribed from subscription' . ' where subscriber = %d)', $this->scoped->id));
         if ($profile->find()) {
             while ($profile->fetch()) {
                 $this->profiles[] = clone $profile;
             }
         }
     }
     if (substr($term, 0, 1) == '!') {
         //group search
         $term = substr($term, 1);
         $group = new User_group();
         $group->limit($limit);
         $group->whereAdd('nickname like \'' . trim($group->escape($term), '\'') . '%\'');
         //Can't post to groups we're not subscribed to...:
         $group->whereAdd(sprintf('id in (SELECT group_id FROM group_member' . ' WHERE profile_id = %d)', $this->scoped->id));
         if ($group->find()) {
             while ($group->fetch()) {
                 $this->groups[] = clone $group;
             }
         }
     }
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:42,代码来源:autocomplete.php

示例2: getProfileByUrl

 /**
  * Look up a Profile by profileurl field.  Profile::staticGet() was
  * not working consistently.
  *
  * @param string $nickname   local nickname of the Twitter user
  * @param string $profileurl the profile url
  *
  * @return mixed value the first Profile with that url, or null
  */
 function getProfileByUrl($nickname, $profileurl)
 {
     $profile = new Profile();
     $profile->nickname = $nickname;
     $profile->profileurl = $profileurl;
     $profile->limit(1);
     if ($profile->find()) {
         $profile->fetch();
         return $profile;
     }
     return null;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:21,代码来源:twitterimport.php

示例3: getTagged

 /**
  * Get profiles tagged with this people tag,
  * include modified timestamp as a "cursor" field
  * order by descending order of modified time
  *
  * @param integer $offset   offset
  * @param integer $limit    maximum no of results
  * @param integer $since_id=null    since unix timestamp
  * @param integer $upto=null  maximum unix timestamp when subscription was made
  *
  * @return Profile results
  */
 function getTagged($offset = 0, $limit = null, $since = 0, $upto = 0)
 {
     $tagged = new Profile();
     $tagged->joinAdd(array('id', 'profile_tag:tagged'));
     #@fixme: postgres
     $tagged->selectAdd('unix_timestamp(profile_tag.modified) as "cursor"');
     $tagged->whereAdd('profile_tag.tagger = ' . $this->tagger);
     $tagged->whereAdd("profile_tag.tag = '{$this->tag}'");
     if ($since != 0) {
         $tagged->whereAdd('cursor > ' . $since);
     }
     if ($upto != 0) {
         $tagged->whereAdd('cursor <= ' . $upto);
     }
     if ($limit != null) {
         $tagged->limit($offset, $limit);
     }
     $tagged->orderBy('profile_tag.modified DESC');
     $tagged->find();
     return $tagged;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:33,代码来源:Profile_list.php

示例4: getUsers

 function getUsers()
 {
     $profile = new Profile();
     // Comment this out or disable to get global profile searches
     $profile->joinAdd(array('id', 'user:id'));
     $offset = ($this->page - 1) * PROFILES_PER_PAGE;
     $limit = PROFILES_PER_PAGE + 1;
     if (!empty($this->q)) {
         // User is searching via query
         $search_engine = $profile->getSearchEngine('profile');
         $mode = 'reverse_chron';
         if ($this->sort == 'nickname') {
             if ($this->reverse) {
                 $mode = 'nickname_desc';
             } else {
                 $mode = 'nickname_asc';
             }
         } else {
             if ($this->reverse) {
                 $mode = 'chron';
             }
         }
         $search_engine->set_sort_mode($mode);
         $search_engine->limit($offset, $limit);
         $search_engine->query($this->q);
         $profile->find();
     } else {
         // User is browsing via AlphaNav
         switch ($this->filter) {
             case 'all':
                 // NOOP
                 break;
             case '0-9':
                 $profile->whereAdd(sprintf('LEFT(%1$s.%2$s, 1) BETWEEN %3$s AND %4$s', $profile->escapedTableName(), 'nickname', $profile->_quote("0"), $profile->_quote("9")));
                 break;
             default:
                 $profile->whereAdd(sprintf('LEFT(LOWER(%1$s.%2$s), 1) = %3$s', $profile->escapedTableName(), 'nickname', $profile->_quote($this->filter)));
         }
         $order = sprintf('%1$s.%2$s %3$s, %1$s.%4$s ASC', $profile->escapedTableName(), $this->getSortKey('nickname'), $this->reverse ? 'DESC' : 'ASC', 'nickname');
         $profile->orderBy($order);
         $profile->limit($offset, $limit);
         $profile->find();
     }
     return $profile;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:45,代码来源:userdirectory.php

示例5: getProfileByUrl

 /**
  * Look up a Profile by profileurl field.  Profile::getKV() was
  * not working consistently.
  *
  * @param string $nickname   local nickname of the Twitter user
  * @param string $profileurl the profile url
  *
  * @return mixed value the first Profile with that url, or null
  */
 protected function getProfileByUrl($nickname, $profileurl)
 {
     $profile = new Profile();
     $profile->nickname = $nickname;
     $profile->profileurl = $profileurl;
     $profile->limit(1);
     if (!$profile->find(true)) {
         $profile->profileurl = str_replace('https://', 'http://', $profileurl);
         if (!$profile->find(true)) {
             throw new NoResultException($profile);
         }
     }
     return $profile;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:23,代码来源:twitterimport.php

示例6: getRequests

 /**
  * Get pending subscribers, who have not yet been approved.
  *
  * @param int $offset
  * @param int $limit
  * @return Profile
  */
 function getRequests($offset = 0, $limit = null)
 {
     // FIXME: mysql only
     $subqueue = new Profile();
     $subqueue->joinAdd(array('id', 'subscription_queue:subscriber'));
     $subqueue->whereAdd(sprintf('subscription_queue.subscribed = %d', $this->getID()));
     $subqueue->limit($offset, $limit);
     $subqueue->orderBy('subscription_queue.created', 'DESC');
     if (!$subqueue->find()) {
         throw new NoResultException($subqueue);
     }
     return $subqueue;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:20,代码来源:Profile.php

示例7: getBlocked

 function getBlocked($offset = null, $limit = null)
 {
     $blocked = new Profile();
     $blocked->joinAdd(array('id', 'group_block:blocked'));
     $blocked->whereAdd(sprintf('group_block.group_id = %u', $this->id));
     $blocked->orderBy('group_block.modified DESC');
     $blocked->limit($offset, $limit);
     $blocked->find();
     return $blocked;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:10,代码来源:User_group.php


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