本文整理汇总了PHP中Subscription::bySubscriber方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscription::bySubscriber方法的具体用法?PHP Subscription::bySubscriber怎么用?PHP Subscription::bySubscriber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscription
的用法示例。
在下文中一共展示了Subscription::bySubscriber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: atompubPrepare
protected function atompubPrepare()
{
$subscriber = $this->trimmed('subscriber');
$this->_profile = Profile::getKV('id', $subscriber);
if (!$this->_profile instanceof Profile) {
// TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID.
// TRANS: %d is the non-existing profile ID number.
throw new ClientException(sprintf(_('No such profile id: %d.'), $subscriber), 404);
}
$this->_subscriptions = Subscription::bySubscriber($this->_profile->id, $this->offset, $this->limit);
return true;
}
示例2: dumpSubscriptions
function dumpSubscriptions($user, $dir)
{
common_log(LOG_INFO, 'dumping subscriptions by ' . $user->nickname . ' to directory ' . $dir);
$page = 1;
do {
$sub = Subscription::bySubscriber($user->id, ($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
while ($sub->fetch()) {
try {
if ($sub->subscribed == $user->id) {
continue;
}
$fname = $dir . '/' . common_date_iso8601($sub->created) . '-subscription-' . $sub->subscribed . '.atom';
$act = $sub->asActivity();
$data = $act->asString(false, false, false);
common_log(LOG_INFO, 'dumping sub of ' . $sub->subscribed . ' to file ' . $fname);
file_put_contents($fname, $data);
$data = null;
} catch (Exception $e) {
common_log(LOG_ERR, "Error backing up subscription to " . $sub->subscribed . ": " . $e->getMessage());
continue;
}
}
$page++;
} while ($sub->N > PROFILES_PER_PAGE);
}
示例3: getSubscriptions
function getSubscriptions($offset = 0, $limit = null)
{
$subs = Subscription::bySubscriber($this->id, $offset, $limit);
$profiles = array();
while ($subs->fetch()) {
$profile = Profile::staticGet($subs->subscribed);
if ($profile) {
$profiles[] = $profile;
}
}
return new ArrayWrapper($profiles);
}