本文整理汇总了PHP中Conversation::noticeCount方法的典型用法代码示例。如果您正苦于以下问题:PHP Conversation::noticeCount方法的具体用法?PHP Conversation::noticeCount怎么用?PHP Conversation::noticeCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conversation
的用法示例。
在下文中一共展示了Conversation::noticeCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showMiniForm
function showMiniForm()
{
$id = $this->notice->conversation;
$url = common_local_url('conversation', array('id' => $id));
$n = Conversation::noticeCount($id) - 1;
// TRANS: Link to show replies for a notice.
// TRANS: %d is the number of replies to a notice and used for plural.
$msg = sprintf(_m('Show reply', 'Show all %d replies', $n), $n);
$this->out->element('a', array('href' => $url), $msg);
}
示例2: linkback_save
function linkback_save($source, $target, $response, $notice_or_user)
{
$dupe = linkback_is_dupe('uri', $response->getEffectiveUrl());
if (!$dupe) {
$dupe = linkback_is_dupe('url', $response->getEffectiveUrl());
}
if (!$dupe) {
$dupe = linkback_is_dupe('uri', $source);
}
if (!$dupe) {
$dupe = linkback_is_dupe('url', $source);
}
$mf2 = new Mf2\Parser($response->getBody(), $response->getEffectiveUrl());
$mf2 = $mf2->parse();
$entry = linkback_find_entry($mf2, $target);
if (!$entry) {
preg_match('/<title>([^<]+)', $response->getBody(), $match);
$entry = array('content' => array('html' => $response->getBody()), 'name' => $match[1] ? htmlspecialchars_decode($match[1]) : $source);
}
if (!$entry['url']) {
$entry['url'] = array($response->getEffectiveUrl());
}
if (!$dupe) {
$dupe = linkback_is_dupe('uri', $entry['url'][0]);
}
if (!$dupe) {
$dupe = linkback_is_dupe('url', $entry['url'][0]);
}
$entry['type'] = linkback_entry_type($entry, $mf2, $target);
list($profile, $author) = linkback_profile($entry, $mf2, $response, $target);
list($content, $options) = linkback_notice($source, $notice_or_user, $entry, $author, $mf2);
if ($dupe) {
$orig = clone $dupe;
try {
// Ignore duplicate save error
try {
$dupe->saveKnownReplies($options['replies']);
} catch (ServerException $ex) {
}
try {
$dupe->saveKnownTags($options['tags']);
} catch (ServerException $ex) {
}
try {
$dupe->saveKnownUrls($options['urls']);
} catch (ServerException $ex) {
}
if ($options['reply_to']) {
$dupe->reply_to = $options['reply_to'];
}
if ($options['repeat_of']) {
$dupe->repeat_of = $options['repeat_of'];
}
if ($dupe->reply_to != $orig->reply_to || $dupe->repeat_of != $orig->repeat_of) {
$parent = Notice::getKV('id', $dupe->repost_of ? $dupe->repost_of : $dupe->reply_to);
if ($parent instanceof Notice) {
// If we changed the reply_to or repeat_of we might live in a new conversation now
$dupe->conversation = $parent->conversation;
}
}
if ($dupe->update($orig)) {
$saved = $dupe;
}
if ($dupe->conversation != $orig->conversation && Conversation::noticeCount($orig->conversation) < 1) {
// Delete empty conversation
$emptyConversation = Conversation::getKV('id', $orig->conversation);
$emptyConversation->delete();
}
} catch (Exception $e) {
common_log(LOG_ERR, "Linkback update of remote message {$source} failed: " . $e->getMessage());
return false;
}
common_log(LOG_INFO, "Linkback updated remote message {$source} as notice id {$saved->id}");
} else {
if ($entry['type'] == 'like' || $entry['type'] == 'reply' && $entry['rsvp']) {
$act = new Activity();
$act->type = ActivityObject::ACTIVITY;
$act->time = $options['created'] ? strtotime($options['created']) : time();
$act->title = $entry["name"] ? $entry["name"][0] : _m("Favor");
$act->actor = $profile->asActivityObject();
$act->target = $notice_or_user->asActivityObject();
$act->objects = array(clone $act->target);
// TRANS: Message that is the "content" of a favorite (%1$s is the actor's nickname, %2$ is the favorited
// notice's nickname and %3$s is the content of the favorited notice.)
$act->content = sprintf(_('%1$s favorited something by %2$s: %3$s'), $profile->getNickname(), $notice_or_user->getProfile()->getNickname(), $notice_or_user->getRendered());
if ($entry['rsvp']) {
$act->content = $options['rendered'];
}
$act->verb = ActivityVerb::FAVORITE;
if (strtolower($entry['rsvp'][0]) == 'yes') {
$act->verb = 'http://activitystrea.ms/schema/1.0/rsvp-yes';
} else {
if (strtolower($entry['rsvp'][0]) == 'no') {
$act->verb = 'http://activitystrea.ms/schema/1.0/rsvp-no';
} else {
if (strtolower($entry['rsvp'][0]) == 'maybe') {
$act->verb = 'http://activitystrea.ms/schema/1.0/rsvp-maybe';
}
}
}
//.........这里部分代码省略.........