*
* @return array the context
*/
+
function asArray()
{
$context = array();
- $context['replyToId'] = $this->replyToID;
- $context['replyToUrl'] = $this->replyToUrl;
+ $context['inReplyTo'] = $this->getInReplyToArray();
$context['conversation'] = $this->conversation;
$context['forwardId'] = $this->forwardID;
$context['forwardUrl'] = $this->forwardUrl;
- // XXX: We might want to have the attention to stuff
- // in here like we do with Atom
-
return array_filter($context);
}
*
* @return array the array of recipients
*/
+
function getToArray()
{
$tos = array();
foreach ($this->attention as $attnUrl) {
- $to = array('id' => $attnUrl, 'url' => $attnUrl);
+ $to = array(
+ 'objectType' => 'person',
+ 'id' => $attnUrl,
+ 'url' => $attnUrl
+ );
$tos[] = $to;
}
return $tos;
}
+ /**
+ * Return an array for the notices this notice is a reply to
+ * suitable for serializing as JSON note objects.
+ *
+ * @return array the array of notes
+ */
+
+ function getInReplyToArray()
+ {
+ if (empty($this->replyToID) && empty($this->replyToUrl)) {
+ return null;
+ }
+
+ $replyToObj = array('objectType' => 'note');
+
+ // XXX: Possibly shorten this to just the numeric ID?
+ // Currently, it's the full URI of the notice.
+ if (!empty($this->replyToID)) {
+ $replyToObj['id'] = $this->replyToID;
+ }
+ if (!empty($this->replyToUrl)) {
+ $replyToObj['url'] = $this->replyToUrl;
+ }
+
+ return $replyToObj;
+ }
+
}
+