本文整理汇总了PHP中Notice::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::getUrl方法的具体用法?PHP Notice::getUrl怎么用?PHP Notice::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notice
的用法示例。
在下文中一共展示了Notice::getUrl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addNew
public static function addNew(Notice $notice, Profile $actor = null)
{
if (is_null($actor)) {
$actor = $notice->getProfile();
}
if ($notice->getProfile()->hasRole(Profile_role::DELETED)) {
// Don't emit notices if the notice author is (being) deleted
return false;
}
$act = new Activity();
$act->verb = ActivityVerb::DELETE;
$act->time = time();
$act->id = $notice->getUri();
$act->content = sprintf(_m('<a href="%1$s">%2$s</a> deleted notice <a href="%3$s">{{%4$s}}</a>.'), htmlspecialchars($actor->getUrl()), htmlspecialchars($actor->getBestName()), htmlspecialchars($notice->getUrl()), htmlspecialchars($notice->getUri()));
$act->actor = $actor->asActivityObject();
$act->target = new ActivityObject();
// We don't save the notice object, as it's supposed to be removed!
$act->target->id = $notice->getUri();
$act->target->type = $notice->getObjectType();
$act->objects = array(clone $act->target);
$url = $notice->getUrl();
$act->selfLink = $url;
$act->editLink = $url;
// This will make ActivityModeration run saveObjectFromActivity which adds
// a new Deleted_notice entry in the database as well as deletes the notice
// if the actor has permission to do so.
$stored = Notice::saveActivity($act, $actor);
return $stored;
}
示例2: activityObjectFromNotice
public function activityObjectFromNotice(Notice $notice)
{
$object = new ActivityObject();
$object->type = $notice->object_type ?: ActivityObject::NOTE;
$object->id = $notice->getUri();
$object->title = sprintf('New %1$s by %2$s', ActivityObject::canonicalType($object->type), $notice->getProfile()->getNickname());
$object->content = $notice->getRendered();
$object->link = $notice->getUrl();
$object->extra[] = array('status_net', array('notice_id' => $notice->getID()));
return $object;
}
示例3: activityObjectFromNotice
function activityObjectFromNotice(Notice $notice)
{
$object = new ActivityObject();
$object->id = $notice->uri;
$object->type = Video::OBJECT_TYPE;
$object->title = $notice->content;
$object->summary = $notice->content;
$object->link = $notice->getUrl();
$vid = Video::getByNotice($notice);
if ($vid) {
$object->extra[] = array('link', array('rel' => 'enclosure', 'href' => $vid->url), array());
}
return $object;
}
示例4: activityObjectFromNoticePoll
function activityObjectFromNoticePoll(Notice $notice)
{
$object = new ActivityObject();
$object->id = $notice->uri;
$object->type = self::POLL_OBJECT;
$object->title = $notice->content;
$object->summary = $notice->content;
$object->link = $notice->getUrl();
$poll = Poll::getByNotice($notice);
if ($poll) {
// Stash data to be formatted later by
// $this->activityObjectOutputAtom() or
// $this->activityObjectOutputJson()...
$object->pollQuestion = $poll->question;
$object->pollOptions = $poll->getOptions();
}
return $object;
}
示例5: copyNotice
/**
* Mirror a notice by emitting a new notice with the same contents.
* Kind of dirty, but if pulling an external data feed into an account
* that may be what you want.
*
* @param Notice $notice
* @return mixed Notice on successful repeat, true if already repeated, false on failure
*/
protected function copyNotice($profile, $notice)
{
$options = array('is_local' => Notice::LOCAL_PUBLIC, 'url' => $notice->getUrl(), 'rendered' => $notice->getRendered());
$saved = Notice::saveNew($profile->id, $notice->content, 'feed', $options);
return $saved;
}
示例6: onEndDisfavorNotice
/**
* Notify remote users when their notices get de-favorited.
*
* @param Profile $profile Profile person doing the de-faving
* @param Notice $notice Notice being favored
*
* @return hook return value
*/
function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
// Only distribute local users' disfavor actions, remote users
// will have already distributed theirs.
if (!$profile->isLocal()) {
return true;
}
$oprofile = Ostatus_profile::getKV('profile_id', $notice->profile_id);
if (!$oprofile instanceof Ostatus_profile) {
return true;
}
$act = new Activity();
$act->verb = ActivityVerb::UNFAVORITE;
$act->id = TagURI::mint('disfavor:%d:%d:%s', $profile->id, $notice->id, common_date_iso8601(time()));
$act->time = time();
// TRANS: Title for unliking a remote notice.
$act->title = _m('Unlike');
// TRANS: Success message for remove a favorite notice through OStatus.
// TRANS: %1$s is the unfavoring user's name, %2$s is URI to the no longer favored notice.
$act->content = sprintf(_m('%1$s no longer likes %2$s.'), $profile->getBestName(), $notice->getUrl());
$act->actor = $profile->asActivityObject();
$act->object = $notice->asActivityObject();
$oprofile->notifyActivity($act, $profile);
return true;
}