本文整理汇总了PHP中Ostatus_profile::checkAuthorship方法的典型用法代码示例。如果您正苦于以下问题:PHP Ostatus_profile::checkAuthorship方法的具体用法?PHP Ostatus_profile::checkAuthorship怎么用?PHP Ostatus_profile::checkAuthorship使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ostatus_profile
的用法示例。
在下文中一共展示了Ostatus_profile::checkAuthorship方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onStartHandleFeedEntryWithProfile
/**
* Handle a posted object from PuSH
*
* @param Activity $activity activity to handle
* @param Ostatus_profile $oprofile Profile for the feed
*
* @return boolean hook value
*/
function onStartHandleFeedEntryWithProfile($activity, $oprofile, &$notice)
{
if ($this->isMyActivity($activity)) {
$actor = $oprofile->checkAuthorship($activity);
if (empty($actor)) {
// TRANS: Client exception thrown when no author for an activity was found.
throw new ClientException(_('Cannot get author for activity.'));
}
$object = $activity->objects[0];
$options = array('uri' => $object->id, 'url' => $object->link, 'is_local' => Notice::REMOTE, 'source' => 'ostatus');
// $actor is an ostatus_profile
$notice = $this->saveNoticeFromActivity($activity, $actor->localProfile(), $options);
return false;
}
return true;
}
示例2: onStartHandleFeedEntryWithProfile
/**
* Handle a posted bookmark from PuSH
*
* @param Activity $activity activity to handle
* @param Ostatus_profile $oprofile Profile for the feed
*
* @return boolean hook value
*/
function onStartHandleFeedEntryWithProfile($activity, $oprofile)
{
common_log(LOG_INFO, "BookmarkPlugin called for new feed entry.");
if (self::_isPostBookmark($activity)) {
common_log(LOG_INFO, "Importing activity {$activity->id} as a bookmark.");
$author = $oprofile->checkAuthorship($activity);
if (empty($author)) {
throw new ClientException(_('Can\'t get author for activity.'));
}
self::_postRemoteBookmark($author, $activity);
return false;
}
return true;
}