本文整理汇总了PHP中Notice::asAtomEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::asAtomEntry方法的具体用法?PHP Notice::asAtomEntry怎么用?PHP Notice::asAtomEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notice
的用法示例。
在下文中一共展示了Notice::asAtomEntry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addEntryFromNotice
/**
* Add a single Notice to the feed
*
* @param Notice $notice a Notice to add
*/
function addEntryFromNotice($notice)
{
$source = $this->showSource();
$author = $this->showAuthor();
$this->addEntryRaw($notice->asAtomEntry(false, $source, $author));
}
示例2: format_entry
/**
* extra information for XMPP messages, as defined by Twitter
*
* @param Profile $profile Profile of the sending user
* @param Notice $notice Notice being sent
*
* @return string Extra information (Atom, HTML, addresses) in string format
*/
protected function format_entry(Notice $notice)
{
$profile = $notice->getProfile();
$entry = $notice->asAtomEntry(true, true);
$xs = new XMLStringer();
$xs->elementStart('html', array('xmlns' => 'http://jabber.org/protocol/xhtml-im'));
$xs->elementStart('body', array('xmlns' => 'http://www.w3.org/1999/xhtml'));
$xs->element('a', array('href' => $profile->profileurl), $profile->nickname);
try {
$parent = $notice->getParent();
$orig_profile = $parent->getProfile();
$orig_profurl = $orig_profile->getUrl();
$xs->text(" => ");
$xs->element('a', array('href' => $orig_profurl), $orig_profile->nickname);
$xs->text(": ");
} catch (InvalidUrlException $e) {
$xs->text(sprintf(' => %s', $orig_profile->nickname));
} catch (NoParentNoticeException $e) {
$xs->text(": ");
}
if (!empty($notice->rendered)) {
$notice->rendered = str_replace("\t", "", $notice->rendered);
$xs->raw($notice->rendered);
} else {
$xs->raw(common_render_content($notice->content, $notice));
}
$xs->text(" ");
$xs->element('a', array('href' => common_local_url('conversation', array('id' => $notice->conversation)) . '#notice-' . $notice->id), sprintf(_m('[%u]'), $notice->id));
$xs->elementEnd('body');
$xs->elementEnd('html');
$html = $xs->getString();
return $html . ' ' . $entry;
}
示例3: format_entry
/**
* extra information for XMPP messages, as defined by Twitter
*
* @param Profile $profile Profile of the sending user
* @param Notice $notice Notice being sent
*
* @return string Extra information (Atom, HTML, addresses) in string format
*/
protected function format_entry(Notice $notice)
{
$profile = $notice->getProfile();
$entry = $notice->asAtomEntry(true, true);
$xs = new XMLStringer();
$xs->elementStart('html', array('xmlns' => 'http://jabber.org/protocol/xhtml-im'));
$xs->elementStart('body', array('xmlns' => 'http://www.w3.org/1999/xhtml'));
$xs->element('a', array('href' => $profile->profileurl), $profile->nickname);
try {
$parent = $notice->getParent();
$orig_profile = $parent->getProfile();
$orig_profurl = $orig_profile->getUrl();
$xs->text(" => ");
$xs->element('a', array('href' => $orig_profurl), $orig_profile->nickname);
$xs->text(": ");
} catch (InvalidUrlException $e) {
$xs->text(sprintf(' => %s', $orig_profile->nickname));
} catch (NoParentNoticeException $e) {
$xs->text(": ");
} catch (NoResultException $e) {
// Parent notice was probably deleted.
$xs->text(": ");
}
// FIXME: Why do we replace \t with ''? is it just to make it pretty? shouldn't whitespace be handled well...?
$xs->raw(str_replace("\t", "", $notice->getRendered()));
$xs->text(" ");
$xs->element('a', array('href' => common_local_url('conversation', array('id' => $notice->conversation)) . '#notice-' . $notice->id), sprintf(_m('[%u]'), $notice->id));
$xs->elementEnd('body');
$xs->elementEnd('html');
$html = $xs->getString();
return $html . ' ' . $entry;
}
示例4: addEntryFromNotice
/**
* Add a single Notice to the feed
*
* @param Notice $notice a Notice to add
*/
function addEntryFromNotice($notice)
{
try {
$source = $this->showSource();
$author = $this->showAuthor();
$this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $this->scoped));
} catch (Exception $e) {
common_log(LOG_ERR, $e->getMessage());
// we continue on exceptions
}
}
示例5: jabber_format_entry
/**
* extra information for XMPP messages, as defined by Twitter
*
* @param Profile $profile Profile of the sending user
* @param Notice $notice Notice being sent
*
* @return string Extra information (Atom, HTML, addresses) in string format
*/
function jabber_format_entry($profile, $notice)
{
$entry = $notice->asAtomEntry(true, true);
$xs = new XMLStringer();
$xs->elementStart('html', array('xmlns' => 'http://jabber.org/protocol/xhtml-im'));
$xs->elementStart('body', array('xmlns' => 'http://www.w3.org/1999/xhtml'));
$xs->element('a', array('href' => $profile->profileurl), $profile->nickname);
$xs->text(": ");
if (!empty($notice->rendered)) {
$xs->raw($notice->rendered);
} else {
$xs->raw(common_render_content($notice->content, $notice));
}
$xs->text(" ");
$xs->element('a', array('href' => common_local_url('conversation', array('id' => $notice->conversation)) . '#notice-' . $notice->id), sprintf(_('[%s]'), $notice->id));
$xs->elementEnd('body');
$xs->elementEnd('html');
$html = $xs->getString();
return $html . ' ' . $entry;
}
示例6: addEntryFromNotice
/**
* Add a single Notice to the feed
*
* @param Notice $notice a Notice to add
*/
function addEntryFromNotice($notice)
{
try {
$source = $this->showSource();
$author = $this->showAuthor();
$cur = empty($this->cur) ? common_current_user() : $this->cur;
$this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur));
} catch (Exception $e) {
common_log(LOG_ERR, $e->getMessage());
// we continue on exceptions
}
}