- $object = new ActivityObject();
- $object->id = $notice->uri;
- $object->type = self::POLL_OBJECT;
- $object->title = 'Poll title';
- $object->summary = 'Poll summary';
- $object->link = $notice->bestUrl();
-
- $poll = Poll::getByNotice($notice);
- /**
- * Adding the poll-specific data. There's no standard in AS for polls,
- * so we're making stuff up.
- *
- * For the moment, using a kind of icky-looking schema that happens to
- * work with out code for generating both Atom and JSON forms, though
- * I don't like it:
- *
- * <poll:data xmlns:poll="http://apinamespace.org/activitystreams/object/poll"
- * question="Who wants a poll question?"
- * option1="Option one"
- * option2="Option two"
- * option3="Option three"></poll:data>
- *
- * "poll:data": {
- * "xmlns:poll": http://apinamespace.org/activitystreams/object/poll
- * "question": "Who wants a poll question?"
- * "option1": "Option one"
- * "option2": "Option two"
- * "option3": "Option three"
- * }
- *
- */
- // @fixme there's no way to specify an XML node tree here, like <poll><option/><option/></poll>
- // @fixme there's no way to specify a JSON array or multi-level tree unless you break the XML attribs
- // @fixme XML node contents don't get shown in JSON
- $data = array('xmlns:poll' => self::POLL_OBJECT,
- 'question' => $poll->question);
- foreach ($poll->getOptions() as $i => $opt) {
- $data['option' . ($i + 1)] = $opt;
- }
- $object->extra[] = array('poll:data', $data, '');
- return $object;
- }
-
- /**
- * @fixme WARNING WARNING WARNING parent class closes the final div that we
- * open here, but we probably shouldn't open it here. Check parent class
- * and Bookmark plugin for if that's right.
- */
- function showNotice($notice, $out)
- {