本文整理汇总了PHP中Fave::byProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP Fave::byProfile方法的具体用法?PHP Fave::byProfile怎么用?PHP Fave::byProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fave
的用法示例。
在下文中一共展示了Fave::byProfile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
/**
* For initializing members of the class.
*
* @param array $argarray misc. arguments
*
* @return boolean true
*/
function prepare($argarray)
{
parent::prepare($argarray);
$this->_profile = Profile::staticGet('id', $this->trimmed('profile'));
if (empty($this->_profile)) {
// TRANS: Client exception thrown when requesting a favorite feed for a non-existing profile.
throw new ClientException(_('No such profile.'), 404);
}
$offset = ($this->page - 1) * $this->count;
$limit = $this->count + 1;
$this->_faves = Fave::byProfile($this->_profile->id, $offset, $limit);
return true;
}
示例2: prepare
protected function prepare(array $args = array())
{
parent::prepare($args);
$this->_profile = Profile::getKV('id', $this->trimmed('profile'));
if (!$this->_profile instanceof Profile) {
// TRANS: Client exception thrown when requesting a favorite feed for a non-existing profile.
throw new ClientException(_('No such profile.'), 404);
}
$offset = ($this->page - 1) * $this->count;
$limit = $this->count + 1;
$this->_faves = Fave::byProfile($this->_profile->id, $offset, $limit);
return true;
}
示例3: dumpFaves
function dumpFaves($user, $dir)
{
common_log(LOG_INFO, 'dumping faves by ' . $user->nickname . ' to directory ' . $dir);
$page = 1;
do {
$fave = Fave::byProfile($user->id, ($page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
while ($fave->fetch()) {
try {
$fname = $dir . '/' . common_date_iso8601($fave->modified) . '-fave-' . $fave->notice_id . '.atom';
$act = $fave->asActivity();
$data = $act->asString(false, false, false);
common_log(LOG_INFO, 'dumping fave of ' . $fave->notice_id . ' to file ' . $fname);
file_put_contents($fname, $data);
$data = null;
} catch (Exception $e) {
common_log(LOG_ERR, "Error backing up fave of " . $fave->notice_id . ": " . $e->getMessage());
continue;
}
}
$page++;
} while ($fave->N > NOTICES_PER_PAGE);
}