예제 #1
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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
0
/**
 * 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
0
 /**
  * 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
     }
 }