renamed vars to be inline with activity streams

pull/1/merge
Ray Slakinski 2010-11-08 10:13:39 -05:00
parent 8934c442e3
commit 490da91788
2 changed files with 102 additions and 101 deletions

View File

@ -6,7 +6,7 @@ Sure we have [RSS](http://cyber.law.harvard.edu/rss/rss.html), [RDF](http://www.
and [Atom](http://www.atomenabled.org/developers/syndication/atom-format-spec.php) which I have been working with
for many years. There are two big issues with these formats... They all use
[XML](http://en.wikipedia.org/wiki/XML) which tends to be wordy and more importantly XML is not overly easy to parse
especially in languages like Javascript, PHP, Ruby and Python. However [JSON](http://en.wikipedia.org/wiki/JSON) thankfully is!
especially in langs like Javascript, PHP, Ruby and Python. However [JSON](http://en.wikipedia.org/wiki/JSON) thankfully is!
While developing this format I set out with the following goals:
@ -26,114 +26,109 @@ come and comment in the [oSync Development Google Group](http://groups.google.co
### Example ###
{
"updated_date": "2009-08-05T12:17Z",
"subtitle": "Content Syndcation via JSONP",
"uuid": "c4dfcb75-8cd5-47e1-8a09-b19141ec2df8",
"language": "en",
"title": "News about OSync",
"image": "http://www.osync.org/media/osync-600x600.jpg",
"generator": "TextMate http://macromates.com/",
"uri": "http://www.osync.org",
"summary": "All the news you can use about your favorite new web syndication format OSync",
"copywrite": "Creative Commons Attribution-Noncommercial-No Derivative Works 3.0",
"copywrite_image": "http://creativecommons.org/images/public/somerights20.png",
"pub_date": "2009-08-05T11:17Z",
"image_thumbnail": "http://www.osync.org/media/osync-32x32.jpg",
"tags":
[
"web",
"formats",
"specifications"
],
"location":
{
"name": "Funky Thai",
"address": "2383 Dundas Street West",
"city": "Oakville",
"state": "Ontario",
"zip": "L6M3X2"
"geolat": 43.439957,
"geolong", -79.772072
},
"items":
[
{
"updated_date": "2009-08-05T11:17Z",
"body": "We lauched OSync today! we had a big party and it was all kinds of fun. I hope you like it!",
"uuid": "fd8e3a0e-5786-4583-9baa-bb65537eed70",
"title": "OSync Launched!",
"author":
{
"email": "ray.slakinski@gmail.com",
"name": "Ray Slakinski",
"uri": "http://www.slakinski.com"
"updatedDate": "2009-08-05T12:17Z",
"subtitle": "Content Syndcation via JSONP",
"id": "c4dfcb75-8cd5-47e1-8a09-b19141ec2df8",
"lang": "en",
"title": "News about oSync",
"image": "http://www.osync.org/media/osync-600x600.jpg",
"generator": "TextMate http://macromates.com/",
"permalinkUrl": "http://www.osync.org",
"summary": "All the news you can use about your favorite new web syndication format oSync",
"copywrite": "Creative Commons Attribution-Noncommercial-No Derivative Works 3.0",
"copywriteImage": "http://creativecommons.org/images/public/somerights20.png",
"postedTime": "2009-08-05T11:17Z",
"imageThumbnail": "http://www.osync.org/media/osync-32x32.jpg",
"categories": [
"web",
"formats",
"specifications"
],
"location": {
"name": "Funky Thai",
"address": "2383 Dundas Street West",
"city": "Oakville",
"state": "Ontario",
"zip": "L6M3X2",
"geolat": 43.439957,
"geolong": -79.772072
},
"items": [
{
"updatedDate": "2009-08-05T11:17Z",
"body": "We lauched oSync today! we had a big party and it was all kinds of fun. I hope you like it!",
"id": "fd8e3a0e-5786-4583-9baa-bb65537eed70",
"title": "oSync Launched!",
"author": {
"email": "ray.slakinski@gmail.com",
"name": "Ray Slakinski",
"permalinkUrl": "http://www.slakinski.com"
},
"sources":
[
"http://www.ospec.org"
"sources": [
"http://www.osync.org"
],
"uri": "http://www.osync.org/posts/osync-launched",
"location":
{
"name": "Funky Thai",
"address": "2383 Dundas Street West",
"city": "Oakville",
"state": "Ontario",
"zip": "L6M3X2"
"geolat": 43.439957,
"geolong", -79.772072
},
"exeprt": "We lauched OSync today!",
"pub_date": "2009-08-05T11:17Z",
"tags":
[
"web",
"formats",
"specifications"
"permalinkUrl": "http://www.osync.org/posts/osync-launched",
"location": {
"name": "Funky Thai",
"address": "2383 Dundas Street West",
"city": "Oakville",
"state": "Ontario",
"zip": "L6M3X2",
"geolat": 43.439957,
"geolong": -79.772072
},
"exeprt": "We lauched oSync today!",
"postedTime": "2009-08-05T11:17Z",
"categories": [
"web",
"formats",
"specifications"
],
"attachments":
[
"attachments": [
{
"hash": "6c6d81147f00bd6adb710d22bfe69f05",
"uuid": "25746ef0-b362-4d38-b4e6-a0443c634d7e",
"pub_date": "2009-08-05T11:17Z",
"explicit": false,
"uri": "http://www.osync.org/pcasts/osync-podcast-01.mp3",
"hash_type": "md5",
"filename": "osync-podcast-01.mp3",
"duration": 923282,
"type": "audio/mpeg",
"block": false,
"bytes": 228223
"hash": "6c6d81147f00bd6adb710d22bfe69f05",
"id": "25746ef0-b362-4d38-b4e6-a0443c634d7e",
"postedTime": "2009-08-05T11:17Z",
"explicit": false,
"permalinkUrl": "http://www.osync.org/pcasts/osync-podcast-01.mp3",
"hash_type": "md5",
"filename": "osync-podcast-01.mp3",
"duration": 923282,
"type": "audio/mpeg",
"blockConsumer": false,
"bytes": 228223
}
]
}
],
]
}
## Specification ##
### Main Elements ###
* uuid: Unique ID for the feed itself, great for using in conjunction with [SUP](http://code.google.com/p/simpleupdateprotocol/), [PubSubHubbub](http://code.google.com/p/pubsubhubbub/) or [rssCloud](http://rsscloud.org/)
* id: Unique ID for the feed itself, great for using in conjunction with [SUP](http://code.google.com/p/simpleupdateprotocol/), [PubSubHubbub](http://code.google.com/p/pubsubhubbub/) or [rssCloud](http://rsscloud.org/)
* hub: A central place to see which oSync feeds have been updated. Usually a location for a servers [SUP](http://code.google.com/p/simpleupdateprotocol/), [PubSubHubbub](http://code.google.com/p/pubsubhubbub/) or [rssCloud](http://rsscloud.org/) location _(Optional)_
* title: Title of the feed
* subtitle: Subtitle for this feed _(Optional)_
* summary: A short description of this feed _(Optional)_
* uri: URI to where on this content came from
* language: Based on the [W3C standard language codes](http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes)
* permalinkUrl: permalinkUrl to where on this content came from
* lang: Based on the [W3C standard language codes](http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes)
* copywrite: A string describing the copywrite for this feed
* copywrite_image: Image representation of copywrite, such as a [Creative Commons](http://creativecommons.org/) logo _(Optional)_
* copywriteImage: Image representation of copywrite, such as a [Creative Commons](http://creativecommons.org/) logo _(Optional)_
* location: [Location](#) _(Optional)_
* pub_date: Date the feed was first published in [ISO 8601](http://en.wikipedia.org/wiki/ISO-8601) format example: 2009-08-05T11:17Z
* updated_date: Last time the feed was updated
* postedTime: Date the feed was first published in [ISO 8601](http://en.wikipedia.org/wiki/ISO-8601) format example: 2009-08-05T11:17Z
* updatedDate: Last time the feed was updated _(Optional)_
* generator: What application/script created this output. Helpful for debugging. _(Optional)_
* tags: A list of tags/keywords/categories that you wish to associate with this feed _(Optional)_
* categories: See [Categoies](#) _(Optional)_
* image: Should be a square .jpg image that is at least 600 x 600 pixels
* image_thumbnail: A thumbnail version (32x32) of the image in the 'image' key
* imageThumbnail: A thumbnail version (32x32) of the image in the 'image' key
* items: A list of items (see below for item description)
### Location ###
### Globals ###
#### Location ####
* name: The name for the location _(Optional)_
* address: Street Address _(Optional)_
* city: City, Town, or Village for the location _(Optional)_
@ -142,43 +137,47 @@ come and comment in the [oSync Development Google Group](http://groups.google.co
* geolat: Latitude _(Optional if geolong not specified)_
* geolong: Longitude _(Optional if geolat not specified)_
#### Categories ####
* categories: A list of categories/keywords/tags that you wish to associate with this item
### Items ###
* uuid: Unique ID for this item
* id: Unique ID for this item
* title: title for this item
* uri: URI location of where to find this item
* permalinkUrl: Permanent URL of where to find this item
* sources: A list of sources for this item. Sites like digg.com might want to specify the original article here. _(Optional)_
* location: see [Location](#) _(Optional)_
* pub_date: Date item was first published in [ISO 8601](http://en.wikipedia.org/wiki/ISO-8601) format example: 2009-08-05T11:17Z
* updated_date: Last time the feed was updated
* postedTime: Date item was first published in [ISO 8601](http://en.wikipedia.org/wiki/ISO-8601) format example: 2009-08-05T11:17Z
* updatedDate: Last time the item was updated _(Optional)_
* summary: A short description of this item _(Optional)_
* body: The full text for this item
* author: Defines the author for this item (see below for description)
* contributors: a list of authors that also contributed to this item (see author description below) _(Optional)_
* tags: A list of tags/keywords/categories that you wish to associate with this item _(Optional)_
* categories: See [Categoies](#) _(Optional)_
* attachments: A list of attached resources for this item (see below for description) _(Optional)_
#### Author ####
* name: Full name of the author
* uri: URI location of where you can find the author online
* permalinkUrl: Permanent URL of where you can find the author online
* email: E-Mail address of where you can contact the author _(Optional)_
#### Attachments ####
* uuid: Unique ID for this attachment
* id: Unique ID for this attachment
* filename: Allows you to specify a specific name for this file _(Optional)_
* uri: URI location of where to find this attachment
* pub_date: Date item was first published in [ISO 8601](http://en.wikipedia.org/wiki/ISO-8601) format example: 2009-08-05T11:17Z
* mime_type: [Mime-type](http://www.webmaster-toolkit.com/mime-types.shtml) that defines what type of attachment this is
* permalinkUrl: Permanent URL of where to find this attachment
* postedTime: Date item was first published in [ISO 8601](http://en.wikipedia.org/wiki/ISO-8601) format example: 2009-08-05T11:17Z
* mimeType: [Mime-type](http://www.webmaster-toolkit.com/mime-types.shtml) that defines what type of attachment this is
* bytes: Attachment size in bytes
* duration: Duration in seconds, should be specified if type is audio or video _(Optional)_
* location: [Location](#) _(Optional)_
* tags: A list of tags/keywords/categories that you wish to associate with this item _(Optional)_
* categories: See [Categoies](#)
* hash: [Hash for the file](http://www.electrictoolbox.com/article/linux-unix-bsd/howto-check-md5-file/). Hashes are useful to help the consumer that they downloaded the file correctly _(Optional)_
* hash_type: To be specified if hash is set and is not MD5 (MD5 is assumed) _(Optional)_
* Note: Use lowercase (md5, sha256)
* explicit: Does the content contain explicit material? False if not specified _(Optional)_
* block: This should stop a consumer from showing this file in their UI. False if not specified _(Optional)_
* blockConsumer: This should stop a consumer from showing this file in their UI. False if not specified _(Optional)_
<a rel="license" href="http://creativecommons.org/licenses/by-nd/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://creativecommons.org/images/public/somerights20.png" /></a>

View File

@ -1,4 +1,6 @@
<?PHP
$jsonData = '{"updated_date": "2009-08-05T12:17Z", "subtitle": "Content Syndcation via JSONP", "tags": ["web", "formats", "specifications"], "image": "http://www.osync.org/media/osync-600x600.jpg", "copywrite": "Creative Commons Attribution-Noncommercial-No Derivative Works 3.0", "pub_date": "2009-08-05T11:17Z", "uuid": "c4dfcb75-8cd5-47e1-8a09-b19141ec2df8", "language": "en", "title": "News about OSync", "items": [{"updated_date": "2009-08-05T11:17Z", "body": "We lauched OSync today! we had a big party and it was all kinds of fun. I hope you like it!", "attachments": [{"hash": "6c6d81147f00bd6adb710d22bfe69f05", "hash_type": "md5", "duration": 923282, "pub_date": "2009-08-05T11:17Z", "size": 228223, "uuid": "25746ef0-b362-4d38-b4e6-a0443c634d7e", "explicit": false, "uri": "http://www.osync.org/pcasts/osync-podcast-01.mp3", "filename": "osync-podcast-01.mp3", "location": "43.459679,-79.666414", "type": "audio/mpeg", "block": false}, {"tags": ["osync", "party"], "hash": "dfb421284dbdbaba7723bb9d32f63f0d", "uuid": "9cf41fbe-aac0-4f25-8014-3135cd2260f6", "location": "43.459679,-79.666414", "type": "image/jpeg", "size": 34000, "pub_date": "2009-08-05T11:17Z", "uri": "http://www.osync.org/images/party1.jpg", "hash_type": "md5", "filename": "party1.jpg"}, {"tags": ["osync", "party"], "hash": "288f7766e5653b8dd5b5faa17d08a0fe", "uuid": "db3376d7-76df-4ea7-852f-a6fa2e47af16", "location": "43.459679,-79.666414", "type": "image/jpeg", "size": 73000, "pub_date": "2009-08-05T11:17Z", "uri": "http://www.osync.org/images/party2.jpg", "hash_type": "md5", "filename": "party2.jpg"}], "tags": ["web", "formats", "specifications"], "sources": ["http://www.ospec.org"], "link": "http://www.osync.org/posts/osync-launched", "pub_date": "2009-08-05T11:17Z", "uuid": "fd8e3a0e-5786-4583-9baa-bb65537eed70", "title": "OSync Launched!", "author": {"email": "ray.slakinski@gmail.com", "name": "Ray Slakinski", "uri": "http://www.slakinski.com"}, "exeprt": "We lauched OSync today!", "location": "43.459679,-79.666414"}], "generator": "TextMate http://macromates.com/", "uri": "http://www.osync.org", "summary": "All the news you can use about your favorite new web syndication format OSync", "location": "Oakville, Ontario, Canada", "thumbnail": "http://www.osync.org/media/osync-32x32.jpg"}';
echo $_GET['callback'] . '(' . $jsonData . ');';
$json_file = file_get_contents("osync.json");
print_r($json_file);
$json = json_decode($json_file, true);
var_dump($json);
// echo $_GET['callback'] . '(' . $json_file . ');';