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


PHP Subscription::fetch方法代码示例

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


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

示例1: getSubscribers

 function getSubscribers()
 {
     $subs = array();
     $sub = new Subscription();
     $sub->subscribed = $this->user->id;
     if ($sub->find()) {
         while ($sub->fetch()) {
             if ($sub->subscriber != $this->user->id) {
                 $subs[] = clone $sub;
             }
         }
     }
     return $subs;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:14,代码来源:useractivitystream.php

示例2: getSubscribers

 function getSubscribers()
 {
     $subs = array();
     $sub = new Subscription();
     $sub->subscribed = $this->user->id;
     if (!empty($this->after)) {
         $sub->whereAdd("created > '" . common_sql_date($this->after) . "'");
     }
     if ($sub->find()) {
         while ($sub->fetch()) {
             if ($sub->subscriber != $this->user->id) {
                 $subs[] = clone $sub;
             }
         }
     }
     return $subs;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:17,代码来源:useractivitystream.php

示例3: showMicrobloggingAccount

 /**
  * Output FOAF <account> bit for the given profile.
  *
  * @param Profile $profile
  * @param mixed $service Root URL of this StatusNet instance for a local
  *                       user, otherwise null.
  * @param mixed $useruri URI string for the referenced profile..
  * @param boolean $fetchSubscriptions Should we load and list all their subscriptions?
  * @param boolean $isSubscriber if not fetching subs, we can still mark the user as following the current page.
  *
  * @return array if $fetchSubscribers is set, return a list of info on those
  *               subscriptions.
  */
 function showMicrobloggingAccount($profile, $service = null, $useruri = null, $fetchSubscriptions = false, $isSubscriber = false)
 {
     $attr = array();
     if ($useruri) {
         $attr['rdf:about'] = $useruri . '#acct';
     }
     // Their account
     $this->elementStart('account');
     $this->elementStart('OnlineAccount', $attr);
     if ($service) {
         $this->element('accountServiceHomepage', array('rdf:resource' => $service));
     }
     $this->element('accountName', null, $profile->nickname);
     $this->element('accountProfilePage', array('rdf:resource' => $profile->profileurl));
     if ($useruri) {
         $this->element('sioc:account_of', array('rdf:resource' => $useruri));
     }
     $person = array();
     if ($fetchSubscriptions) {
         // Get people user is subscribed to
         $sub = new Subscription();
         $sub->subscriber = $profile->id;
         $sub->whereAdd('subscriber != subscribed');
         if ($sub->find()) {
             while ($sub->fetch()) {
                 $profile = Profile::staticGet('id', $sub->subscribed);
                 if (empty($profile)) {
                     common_debug('Got a bad subscription: ' . print_r($sub, true));
                     continue;
                 }
                 $user = $profile->getUser();
                 $other_uri = $profile->getUri();
                 $this->element('sioc:follows', array('rdf:resource' => $other_uri . '#acct'));
                 $person[$other_uri] = array(LISTENEE, $profile->id, $profile->nickname, $user ? 'local' : 'remote');
                 unset($profile);
             }
         }
         unset($sub);
     } else {
         if ($isSubscriber) {
             // Just declare that they follow the user whose FOAF we're showing.
             $this->element('sioc:follows', array('rdf:resource' => $this->user->uri . '#acct'));
         }
     }
     $this->elementEnd('OnlineAccount');
     $this->elementEnd('account');
     return $person;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:61,代码来源:foaf.php

示例4: realBySubscribed

 private static function realBySubscribed($subscribedId, $offset, $limit)
 {
     $sub = new Subscription();
     $sub->subscribed = $subscribedId;
     $sub->whereAdd('subscriber != ' . $subscribedId);
     $sub->orderBy('created DESC');
     $sub->limit($offset, $limit);
     $sub->find();
     $subs = array();
     while ($sub->fetch()) {
         $subs[] = clone $sub;
     }
     return $subs;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:14,代码来源:Subscription.php

示例5: Subscription

 function _deleteSubscriptions()
 {
     $sub = new Subscription();
     $sub->subscriber = $this->id;
     $sub->find();
     while ($sub->fetch()) {
         $other = Profile::staticGet('id', $sub->subscribed);
         if (empty($other)) {
             continue;
         }
         if ($other->id == $this->id) {
             continue;
         }
         Subscription::cancel($this, $other);
     }
     $subd = new Subscription();
     $subd->subscribed = $this->id;
     $subd->find();
     while ($subd->fetch()) {
         $other = Profile::staticGet('id', $subd->subscriber);
         if (empty($other)) {
             continue;
         }
         if ($other->id == $this->id) {
             continue;
         }
         Subscription::cancel($other, $this);
     }
     $self = new Subscription();
     $self->subscriber = $this->id;
     $self->subscribed = $this->id;
     $self->delete();
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:33,代码来源:Profile.php

示例6: initSubscriptionURI

function initSubscriptionURI()
{
    printfnq("Ensuring all subscriptions have a URI...");
    $sub = new Subscription();
    $sub->whereAdd('uri IS NULL');
    if ($sub->find()) {
        while ($sub->fetch()) {
            try {
                $sub->decache();
                $sub->query(sprintf('update subscription ' . 'set uri = "%s" ' . 'where subscriber = %d ' . 'and subscribed = %d', Subscription::newURI($sub->subscriber, $sub->subscribed, $sub->created), $sub->subscriber, $sub->subscribed));
            } catch (Exception $e) {
                common_log(LOG_ERR, "Error updated subscription URI: " . $e->getMessage());
            }
        }
    }
    printfnq("DONE.\n");
}
开发者ID:Grasia,项目名称:bolotweet,代码行数:17,代码来源:upgrade.php

示例7: Subscription

 function _deleteSubscriptions()
 {
     $sub = new Subscription();
     $sub->subscriber = $this->getID();
     $sub->find();
     while ($sub->fetch()) {
         try {
             $other = $sub->getSubscribed();
             if (!$other->sameAs($this)) {
                 Subscription::cancel($this, $other);
             }
         } catch (NoResultException $e) {
             // Profile not found
             common_log(LOG_INFO, 'Subscribed profile id==' . $sub->subscribed . ' not found when deleting profile id==' . $this->getID() . ', ignoring...');
         } catch (ServerException $e) {
             // Subscription cancel failed
             common_log(LOG_INFO, 'Subscribed profile id==' . $other->getID() . ' could not be reached for unsubscription notice when deleting profile id==' . $this->getID() . ', ignoring...');
         }
     }
     $sub = new Subscription();
     $sub->subscribed = $this->getID();
     $sub->find();
     while ($sub->fetch()) {
         try {
             $other = $sub->getSubscriber();
             common_log(LOG_INFO, 'Subscriber profile id==' . $sub->subscribed . ' not found when deleting profile id==' . $this->getID() . ', ignoring...');
             if (!$other->sameAs($this)) {
                 Subscription::cancel($other, $this);
             }
         } catch (NoResultException $e) {
             // Profile not found
             common_log(LOG_INFO, 'Subscribed profile id==' . $sub->subscribed . ' not found when deleting profile id==' . $this->getID() . ', ignoring...');
         } catch (ServerException $e) {
             // Subscription cancel failed
             common_log(LOG_INFO, 'Subscriber profile id==' . $other->getID() . ' could not be reached for unsubscription notice when deleting profile id==' . $this->getID() . ', ignoring...');
         }
     }
     // Finally delete self-subscription
     $self = new Subscription();
     $self->subscriber = $this->getID();
     $self->subscribed = $this->getID();
     $self->delete();
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:43,代码来源:Profile.php

示例8: omb_broadcast_profile

function omb_broadcast_profile($profile)
{
    # First, get remote users subscribed to this profile
    # XXX: use a join here rather than looping through results
    $sub = new Subscription();
    $sub->subscribed = $profile->id;
    if ($sub->find()) {
        $updated = array();
        while ($sub->fetch()) {
            $rp = Remote_profile::staticGet('id', $sub->subscriber);
            if ($rp) {
                if (!array_key_exists($rp->updateprofileurl, $updated)) {
                    if (omb_update_profile($profile, $rp, $sub)) {
                        $updated[$rp->updateprofileurl] = true;
                    }
                }
            }
        }
    }
}
开发者ID:Br3nda,项目名称:laconica,代码行数:20,代码来源:omb.php

示例9: subscriptions

 function subscriptions($apidata, $other_attr, $user_attr, $onlyIDs = false)
 {
     $this->auth_user = $apidata['user'];
     $user = $this->get_user($apidata['api_arg'], $apidata);
     if (!$user) {
         $this->clientError('Not Found', 404, $apidata['content-type']);
         return;
     }
     $page = $this->trimmed('page');
     if (!$page || !is_numeric($page)) {
         $page = 1;
     }
     $profile = $user->getProfile();
     if (!$profile) {
         $this->serverError(_('User has no profile.'));
         return;
     }
     $sub = new Subscription();
     $sub->{$user_attr} = $profile->id;
     $since = strtotime($this->trimmed('since'));
     if ($since) {
         $d = date('Y-m-d H:i:s', $since);
         $sub->whereAdd("created > '{$d}'");
     }
     $sub->orderBy('created DESC');
     if (!$onlyIDs) {
         $sub->limit(($page - 1) * 100, 100);
     }
     $others = array();
     if ($sub->find()) {
         while ($sub->fetch()) {
             $others[] = Profile::staticGet($sub->{$other_attr});
         }
     } else {
         // user has no followers
     }
     $type = $apidata['content-type'];
     $this->init_document($type);
     if ($onlyIDs) {
         $this->showIDs($others, $type);
     } else {
         $this->show_profiles($others, $type);
     }
     $this->end_document($type);
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:45,代码来源:twitapistatuses.php

示例10: handle

 function handle($args)
 {
     parent::handle($args);
     header('Content-Type: application/rdf+xml');
     $this->startXML();
     $this->elementStart('rdf:RDF', array('xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'xmlns:rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'xmlns:geo' => 'http://www.w3.org/2003/01/geo/wgs84_pos#', 'xmlns' => 'http://xmlns.com/foaf/0.1/'));
     // This is the document about the user
     $this->showPpd('', $this->user->uri);
     // XXX: might not be a person
     $this->elementStart('Person', array('rdf:about' => $this->user->uri));
     $this->element('mbox_sha1sum', null, sha1('mailto:' . $this->user->email));
     if ($this->profile->fullname) {
         $this->element('name', null, $this->profile->fullname);
     }
     if ($this->profile->homepage) {
         $this->element('homepage', array('rdf:resource' => $this->profile->homepage));
     }
     if ($this->profile->bio) {
         $this->element('rdfs:comment', null, $this->profile->bio);
     }
     // XXX: more structured location data
     if ($this->profile->location) {
         $this->elementStart('based_near');
         $this->elementStart('geo:SpatialThing');
         $this->element('name', null, $this->profile->location);
         $this->elementEnd('geo:SpatialThing');
         $this->elementEnd('based_near');
     }
     $this->showMicrobloggingAccount($this->profile, common_root_url());
     $avatar = $this->profile->getOriginalAvatar();
     if ($avatar) {
         $this->elementStart('img');
         $this->elementStart('Image', array('rdf:about' => $avatar->url));
         foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
             $scaled = $this->profile->getAvatar($size);
             if (!$scaled->original) {
                 // sometimes the original has one of our scaled sizes
                 $this->elementStart('thumbnail');
                 $this->element('Image', array('rdf:about' => $scaled->url));
                 $this->elementEnd('thumbnail');
             }
         }
         $this->elementEnd('Image');
         $this->elementEnd('img');
     }
     // Get people user is subscribed to
     $person = array();
     $sub = new Subscription();
     $sub->subscriber = $this->profile->id;
     $sub->whereAdd('subscriber != subscribed');
     if ($sub->find()) {
         while ($sub->fetch()) {
             if ($sub->token) {
                 $other = Remote_profile::staticGet('id', $sub->subscribed);
             } else {
                 $other = User::staticGet('id', $sub->subscribed);
             }
             if (!$other) {
                 common_debug('Got a bad subscription: ' . print_r($sub, true));
                 continue;
             }
             $this->element('knows', array('rdf:resource' => $other->uri));
             $person[$other->uri] = array(LISTENEE, $other);
         }
     }
     // Get people who subscribe to user
     $sub = new Subscription();
     $sub->subscribed = $this->profile->id;
     $sub->whereAdd('subscriber != subscribed');
     if ($sub->find()) {
         while ($sub->fetch()) {
             if ($sub->token) {
                 $other = Remote_profile::staticGet('id', $sub->subscriber);
             } else {
                 $other = User::staticGet('id', $sub->subscriber);
             }
             if (!$other) {
                 common_debug('Got a bad subscription: ' . print_r($sub, true));
                 continue;
             }
             if (array_key_exists($other->uri, $person)) {
                 $person[$other->uri][0] = BOTH;
             } else {
                 $person[$other->uri] = array(LISTENER, $other);
             }
         }
     }
     $this->elementEnd('Person');
     foreach ($person as $uri => $p) {
         $foaf_url = null;
         if ($p[1] instanceof User) {
             $foaf_url = common_local_url('foaf', array('nickname' => $p[1]->nickname));
         }
         $this->profile = Profile::staticGet($p[1]->id);
         $this->elementStart('Person', array('rdf:about' => $uri));
         if ($p[0] == LISTENER || $p[0] == BOTH) {
             $this->element('knows', array('rdf:resource' => $this->user->uri));
         }
         $this->showMicrobloggingAccount($this->profile, $p[1] instanceof User ? common_root_url() : null);
         if ($foaf_url) {
//.........这里部分代码省略.........
开发者ID:Br3nda,项目名称:laconica,代码行数:101,代码来源:foaf.php


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