本文整理匯總了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;
}