本文整理汇总了PHP中Ostatus_profile::ensureActorProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP Ostatus_profile::ensureActorProfile方法的具体用法?PHP Ostatus_profile::ensureActorProfile怎么用?PHP Ostatus_profile::ensureActorProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ostatus_profile
的用法示例。
在下文中一共展示了Ostatus_profile::ensureActorProfile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onStartHandleFeedEntry
function onStartHandleFeedEntry($activity)
{
common_log(LOG_INFO, 'photo plugin: onEndAtomPubNewActivity');
$oprofile = Ostatus_profile::ensureActorProfile($activity);
foreach ($activity->objects as $object) {
if ($object->type == ActivityObject::PHOTO) {
$uri = $object->largerImage;
$thumb_uri = $object->thumbnail;
$profile_id = $oprofile->profile_id;
$source = 'unknown';
// TODO: put something better here.
common_log(LOG_INFO, 'uri : ' . $uri);
common_log(LOG_INFO, 'thumb_uri : ' . $thumb_uri);
// It's possible this is validated elsewhere, but I'm not sure and
// would rather be safe.
$uri = filter_var($uri, FILTER_SANITIZE_URL);
$thumb_uri = filter_var($thumb_uri, FILTER_SANITIZE_URL);
$uri = filter_var($uri, FILTER_VALIDATE_URL);
$thumb_uri = filter_var($thumb_uri, FILTER_VALIDATE_URL);
if (empty($thumb_uri)) {
// We need a thumbnail, so if we aren't given one, use the actual picture for now.
$thumb_uri = $uri;
}
if (!empty($uri) && !empty($thumb_uri)) {
GNUsocialPhoto::saveNew($profile_id, $thumb_uri, $uri, $source, false);
} else {
common_log(LOG_INFO, 'bad URI for photo');
}
return false;
}
}
return true;
}