ActivityStreamJSONDocument.php

Summary
ActivityStreamJSONDocument.php
ActivityStreamJSONDocumentClass abstraction for the JSON API document representing an activity or activity stream.
ActivityStreamJSONDocumentA class for generating JSON documents that represent an Activity Streams
setTitleSet the title of the document
setUrl
addItemsFromNoticesAdd more than one Item to the document
addItemFromNoticeAdd a single Notice to the document
addLinkAdd a link to the JSON document
asStringReturn the entire document as a big string of JSON

ActivityStreamJSONDocument

Class abstraction for the JSON API document representing an activity or activity stream.

postActiv

the micro-blogging software

Copyright

Copyright © 2016-2017, Maiyannah Bishop

Derived from code copyright various sources

  • GNU Social © 2013-2016, Free Software Foundation, Inc
  • StatusNet © 2008-2012, StatusNet, Inc

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses/.

https://www.gnu.org/licenses/agpl.html

About

Class for serializing Activity Streams in JSON

PHP version

Tested with PHP 7

File Authors

Web

Summary
ActivityStreamJSONDocumentA class for generating JSON documents that represent an Activity Streams
setTitleSet the title of the document
setUrl
addItemsFromNoticesAdd more than one Item to the document
addItemFromNoticeAdd a single Notice to the document
addLinkAdd a link to the JSON document
asStringReturn the entire document as a big string of JSON

ActivityStreamJSONDocument

class ActivityStreamJSONDocument extends JSONActivityCollection

A class for generating JSON documents that represent an Activity Streams

Defines

  • CONTENT_TYPE = ‘application/json; charset=utf-8’;

Variables

  • $doc - Top level array representing the document
  • $cur - The current authenticated user
  • $scoped - default null
  • $title - Title of the document
  • $links - Links associated with this document
  • $count - Count of items in this document.  This is cryptically referred to in the spec: “The Stream serialization MAY contain a count property.

setTitle

function setTitle($title)

Set the title of the document

Parameters

  • String $title the title

setUrl

function setUrl($url)

addItemsFromNotices

function addItemsFromNotices($notices)

Add more than one Item to the document

Parameters

  • mixed $notices an array of Notice objects or handle

addItemFromNotice

function addItemFromNotice($notice)

Add a single Notice to the document

Parameters

  • Notice $notice a Notice to add

addLink

function addLink($url =  null,
$rel =  null,
$mediaType =  null)

Add a link to the JSON document

Parameters

  • string $url the URL for the link
  • string $rel the link relationship

asString

function asString()

Return the entire document as a big string of JSON

Returns

  • string encoded JSON output
class ActivityStreamJSONDocument extends JSONActivityCollection
A class for generating JSON documents that represent an Activity Streams
function setTitle($title)
Set the title of the document
function setUrl($url)
function addItemsFromNotices($notices)
Add more than one Item to the document
function addItemFromNotice($notice)
Add a single Notice to the document
function addLink($url =  null,
$rel =  null,
$mediaType =  null)
Add a link to the JSON document
function asString()
Return the entire document as a big string of JSON