Hi Pádraic, list,
Thanks for the reply.
I've began working on the ActivityStreams extension. I was missing a
few parts of the puzzle when I tried to build one last week. Taking
example from the iTunes classes was very helpful.
I could successfully build a feed with the required additional
namespaces and I am now trying to add a few elements to the feed but,
it looks like I am missing something. I register my extension with
Zend_Feed_Writer, and I can validate that my extension is registered
with getExtensions(). My four classes appear in the list.
// Register the ActivityStreams extension.
Zend_Feed_Writer::registerExtension('ActivityStreams');
// Create the parent feed.
$feed = new Zend_Feed_Writer_Feed();
[...]
$feed->setActivityStreamsIcon('http://example.com/images/layout/logo.jpg');
// Render and output the stream.
$out = $feed->export('atom');
Then, I set my feed's properties with $feed's setters. So far, so
good. The problem I have is that when Zend_Feed_Writer_Feed is
exporting the feed, getters from the iTunes classes get called. My
script is supposed to set the only attribute my classes handle for
now, 'ActivityStreamsIcon'. Logging calls made to
ActivityStreams_Feed's __call(), I can see that there are calls to
getActivityStreamsIcon(), getItunesAuthors() and other getters from
the iTunes classes. The interesting part in the stack trace is that
Zend_Feed_Writer_Renderer_Feed_Atom's render() calls
Zend_Feed_Writer_Extension_ITunes_Renderer_Feed's render().
This confuses me as the iTunes classes do not appear in
getExtensions()'s output... and my classes and methods are executed
properly! I've reviewed my code twice and grep'ed through my project's
code and found nothing with "itunes" in it - just in case it would
have been a copy/paste error... Any ideas?
And, of course, I'd be glad to give back the classes I end up with :-)
Thank you very much for the help,
Jean-Michel
On Thu, May 6, 2010 at 7:33 PM, Pádraic Brady <[email protected]> wrote:
> Hi Jean-Michel,
>
> You should find me on IRC some day ;).
>
> The Writer component also has Extensions much like Readers. In the case of
> the Writer each Extension is sub-divided into Data Containers (holding the
> relevant feed agnostic data) and Renderers (which push the data into one of
> Atom 1.0 or RSS 2.0 formats). You can find examples of these such as the
> Writer's iTunes extension.
>
> For an extension comprising both feed and entry level items, you can expect
> to end up with several classes including (for example):
>
> Zend_Feed_Writer_Extension_ActivityStreams_Feed
> Zend_Feed_Writer_Extension_ActivityStreams_Entry
> Zend_Feed_Writer_Extension_ActivityStreams_Renderer_Feed
> Zend_Feed_Writer_Extension_ActivityStreams_Renderer_Entry
>
> Taking a look at the form of the iTunes extension should give you more
> insight into how each works. As with Reader, there are methods allowing you
> to dynamically register extensions quite easily at runtime (see
> Zend_Feed_Writer).
>
> Just a note on Activity Streams, I'm not sure if you have any interest in
> contributing source code you come up with (client work and such can make it
> difficult) but we are looking into Activity Streams for a near future
> proposal. We also have existing proposals to support some of the optional
> dependencies like MediaRSS (see the proposals wiki - might save you a bit of
> effort) and Atom Media. These proposals will all end up (in time) with
> relevant Reader extensions to complement them. They probably won't see a
> release any day soon with all the ZF 2.0 work ongoing, but we still intend
> writing all the code even if it's unofficially supported on Github and co.
>
> In any case, feel free to hit me up with any questions you may have on the
> extension setup.
>
> Paddy
>
> Pádraic Brady
>
> http://blog.astrumfutura.com
> http://www.survivethedeepend.com
> OpenID Europe Foundation Irish Representative
>
>
> ________________________________
> From: Jean-Michel Philippon-Nadeau <[email protected]>
> To: [email protected]
> Sent: Thu, May 6, 2010 4:24:38 AM
> Subject: [fw-general] Zend_Feed_Writer and activitystrea.ms
>
> Hi list,
>
> I am looking at extending Zend_Feed_Writer so it can easily export
> data to the Activitystrea.ms format which is basically an extension to
> Atom (http://activitystrea.ms/).
>
> Reading the manual, I've discovered the extensions. Reader extensions
> are pretty well documented but, unfortunately, I've been unable to
> find enough documentation on the Writer component to be able to write
> something working.
>
> Has anyone any ideas on how I could create such an extension?
>
> Thanks,
>
>
> Jean-Michel
>