Zend_Feed_Writer.xml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.feed.writer">
  4. <title>Zend_Feed_Writer</title>
  5. <sect2 id="zend.feed.writer.introduction">
  6. <title>Introduction</title>
  7. <para>
  8. <classname>Zend_Feed_Writer</classname> is the sibling component to
  9. <classname>Zend_Feed_Reader</classname> responsible for generating feeds for output. It
  10. supports the Atom 1.0 specification (RFC 4287) and <acronym>RSS</acronym> 2.0 as
  11. specified by the <acronym>RSS</acronym> Advisory Board (<acronym>RSS</acronym> 2.0.11).
  12. It does not deviate from these standards. It does, however, offer a simple Extension
  13. system which allows for any extension and module for either of these two specifications
  14. to be implemented if they are not provided out of the box.
  15. </para>
  16. <para>
  17. In many ways, <classname>Zend_Feed_Writer</classname> is the inverse of
  18. <classname>Zend_Feed_Reader</classname>. Where <classname>Zend_Feed_Reader</classname>
  19. focuses on providing an easy to use architecture fronted by getter methods,
  20. <classname>Zend_Feed_Writer</classname> is fronted by similarly named setters or
  21. mutators. This ensures the <acronym>API</acronym> won't pose a learning curve to anyone
  22. familiar with <classname>Zend_Feed_Reader</classname>.
  23. </para>
  24. <para>
  25. As a result of this design, the rest may even be obvious. Behind the scenes, data set on
  26. any <classname>Zend_Feed_Writer</classname> Data Container object is translated at
  27. render time onto a DOMDocument object using the necessary feed elements. For each
  28. supported feed type there is both an Atom 1.0 and <acronym>RSS</acronym> 2.0 renderer.
  29. Using a DOMDocument class rather than a templating solution has numerous advantages,
  30. the most obvious being the ability to export the DOMDocument for
  31. additional processing and relying on <acronym>PHP</acronym> <acronym>DOM</acronym> for
  32. correct and valid rendering.
  33. </para>
  34. <para>
  35. As with <classname>Zend_Feed_Reader</classname>, <classname>Zend_Feed_Writer</classname>
  36. is a standalone replacement for <classname>Zend_Feed</classname>'s Builder architecture
  37. and is not compatible with those classes.
  38. </para>
  39. </sect2>
  40. <sect2 id="zend.feed.writer.architecture">
  41. <title>Architecture</title>
  42. <para>
  43. The architecture of <classname>Zend_Feed_Writer</classname> is very simple. It has two
  44. core sets of classes: data containers and renderers.
  45. </para>
  46. <para>
  47. The containers include the <classname>Zend_Feed_Writer_Feed</classname> and
  48. <classname>Zend_Feed_Writer_Entry</classname> classes. The Entry classes can be attached
  49. to any Feed class. The sole purpose of these containers is to collect data about the
  50. feed to generate using a simple interface of setter methods. These methods perform some
  51. data validity testing. For example, it will validate any passed <acronym>URI</acronym>s,
  52. dates, etc. These checks are not tied to any of the feed standards definitions. The
  53. container objects also contain methods to allow for fast rendering and export of the
  54. final feed, and these can be reused at will.
  55. </para>
  56. <para>
  57. In addition to the main data container classes, there are two additional Atom 2.0
  58. specific classes. <classname>Zend_Feed_Writer_Source</classname> and
  59. <classname>Zend_Feed_Writer_Deleted</classname>. The former implements Atom 2.0 source
  60. elements which carry source feed metadata for a specific entry within an aggregate feed
  61. (i.e. the current feed is not the entry's original source). The latter implements the
  62. Atom Tombstones RFC allowing feeds to carry references to entries which have been
  63. deleted.
  64. </para>
  65. <para>
  66. While there are two main data container types, there are four renderers - two matching
  67. container renderers per supported feed type. Each renderer accepts a container, and
  68. based on its content attempts to generate valid feed markup. If the renderer is unable
  69. to generate valid feed markup, perhaps due to the container missing an obligatory data
  70. point, it will report this by throwing an <classname>Exception</classname>. While it is
  71. possible to ignore <classname>Exception</classname>s, this removes the default safeguard
  72. of ensuring you have sufficient data set to render a wholly valid feed.
  73. </para>
  74. <para>
  75. To explain this more clearly, you may construct a set of data containers for a feed
  76. where there is a Feed container, into which has been added some Entry containers and a
  77. Deleted container. This forms a data hierarchy resembling a normal feed. When rendering
  78. is performed, this hierarchy has its pieces passed to relevant renderers and the partial
  79. feeds (all DOMDocuments) are then pieced together to create a complete feed. In the case
  80. of Source or Deleted (Tomestone) containers, these are rendered only for Atom 2.0 and
  81. ignored for RSS.
  82. </para>
  83. <para>
  84. Due to the system being divided between data containers and renderers, it can make
  85. Extensions somewhat interesting. A typical Extension offering namespaced feed and entry
  86. level elements, must itself reflect the exact same architecture, i.e. offer feed and
  87. entry level data containers, and matching renderers. There is, fortunately, no complex
  88. integration work required since all Extension classes are simply registered and
  89. automatically used by the core classes. We'll meet Extensions in more detail at the end
  90. of this section.
  91. </para>
  92. </sect2>
  93. <sect2 id="zend.feed.writer.getting.started">
  94. <title>Getting Started</title>
  95. <para>
  96. Using <classname>Zend_Feed_Writer</classname> is as simple as setting data and
  97. triggering the renderer. Here is an example to generate a minimal Atom 1.0 feed.
  98. As this demonstrates, each feed/entry uses a separate data container.
  99. </para>
  100. <programlisting language="php"><![CDATA[
  101. /**
  102. * Create the parent feed
  103. */
  104. $feed = new Zend_Feed_Writer_Feed;
  105. $feed->setTitle('Paddy\'s Blog');
  106. $feed->setLink('http://www.example.com');
  107. $feed->setFeedLink('http://www.example.com/atom', 'atom');
  108. $feed->addAuthor(array(
  109. 'name' => 'Paddy',
  110. 'email' => 'paddy@example.com',
  111. 'uri' => 'http://www.example.com',
  112. ));
  113. $feed->setDateModified(time());
  114. $feed->addHub('http://pubsubhubbub.appspot.com/');
  115. /**
  116. * Add one or more entries. Note that entries must
  117. * be manually added once created.
  118. */
  119. $entry = $feed->createEntry();
  120. $entry->setTitle('All Your Base Are Belong To Us');
  121. $entry->setLink('http://www.example.com/all-your-base-are-belong-to-us');
  122. $entry->addAuthor(array(
  123. 'name' => 'Paddy',
  124. 'email' => 'paddy@example.com',
  125. 'uri' => 'http://www.example.com',
  126. ));
  127. $entry->setDateModified(time());
  128. $entry->setDateCreated(time());
  129. $entry->setDescription('Exposing the difficultly of porting games to English.');
  130. $entry->setContent(
  131. 'I am not writing the article. The example is long enough as is ;).'
  132. );
  133. $feed->addEntry($entry);
  134. /**
  135. * Render the resulting feed to Atom 1.0 and assign to $out.
  136. * You can substitute "atom" with "rss" to generate an RSS 2.0 feed.
  137. */
  138. $out = $feed->export('atom');
  139. ]]></programlisting>
  140. <para>
  141. The output rendered should be as follows:
  142. </para>
  143. <programlisting language="xml"><![CDATA[
  144. <?xml version="1.0" encoding="utf-8"?>
  145. <feed xmlns="http://www.w3.org/2005/Atom">
  146. <title type="text">Paddy's Blog</title>
  147. <subtitle type="text">Writing about PC Games since 176 BC.</subtitle>
  148. <updated>2009-12-14T20:28:18+00:00</updated>
  149. <generator uri="http://framework.zend.com" version="1.10.0alpha">
  150. Zend_Feed_Writer
  151. </generator>
  152. <link rel="alternate" type="text/html" href="http://www.example.com"/>
  153. <link rel="self" type="application/atom+xml"
  154. href="http://www.example.com/atom"/>
  155. <id>http://www.example.com</id>
  156. <author>
  157. <name>Paddy</name>
  158. <email>paddy@example.com</email>
  159. <uri>http://www.example.com</uri>
  160. </author>
  161. <link rel="hub" href="http://pubsubhubbub.appspot.com/"/>
  162. <entry>
  163. <title type="html"><![CDATA[All Your Base Are Belong To
  164. Us]]]]><![CDATA[></title>
  165. <summary type="html">
  166. <![CDATA[Exposing the difficultly of porting games to
  167. English.]]]]><![CDATA[>
  168. </summary>
  169. <published>2009-12-14T20:28:18+00:00</published>
  170. <updated>2009-12-14T20:28:18+00:00</updated>
  171. <link rel="alternate" type="text/html"
  172. href="http://www.example.com/all-your-base-are-belong-to-us"/>
  173. <id>http://www.example.com/all-your-base-are-belong-to-us</id>
  174. <author>
  175. <name>Paddy</name>
  176. <email>paddy@example.com</email>
  177. <uri>http://www.example.com</uri>
  178. </author>
  179. <content type="html">
  180. <![CDATA[I am not writing the article.
  181. The example is long enough as is ;).]]]]><![CDATA[>
  182. </content>
  183. </entry>
  184. </feed>
  185. ]]></programlisting>
  186. <para>
  187. This is a perfectly valid Atom 1.0 example. It should be noted that omitting an
  188. obligatory point of data, such as a title, will trigger an
  189. <classname>Exception</classname> when rendering as Atom 1.0. This will differ for
  190. <acronym>RSS</acronym> 2.0 since a title may be omitted so long as a description is
  191. present. This gives rise to Exceptions that differ between the two standards depending
  192. on the renderer in use. By design, <classname>Zend_Feed_Writer</classname> will not
  193. render an invalid feed for either standard unless the end-user deliberately elects to
  194. ignore all Exceptions. This built in safeguard was added to ensure users without
  195. in-depth knowledge of the relevant specifications have a bit less to worry about.
  196. </para>
  197. </sect2>
  198. <sect2 id="zend.feed.writer.setting.feed.data.points">
  199. <title>Setting Feed Data Points</title>
  200. <para>
  201. Before you can render a feed, you must first setup the data necessary for
  202. the feed being rendered. This utilises a simple setter style <acronym>API</acronym>
  203. which doubles as an initial method for validating the data being set. By design, the
  204. <acronym>API</acronym> closely matches that for <classname>Zend_Feed_Reader</classname>
  205. to avoid undue confusion and uncertainty.
  206. </para>
  207. <note>
  208. <para>Users have commented that the lack of a simple array based notation for input data
  209. gives rise to lengthy tracts of code. This will be addressed in a future release.</para>
  210. </note>
  211. <para>
  212. <classname>Zend_Feed_Writer</classname> offers this <acronym>API</acronym> via its data
  213. container classes <classname>Zend_Feed_Writer_Feed</classname> and
  214. <classname>Zend_Feed_Writer_Entry</classname> (not to mention the Atom 2.0 specific
  215. and Extension classes). These classes merely store
  216. all feed data in a type-agnostic manner, meaning you may reuse any data
  217. container with any renderer without requiring additional work. Both classes
  218. are also amenable to Extensions, meaning that an Extension may define its own
  219. container classes which are registered to the base container classes as extensions, and
  220. are checked when any method call triggers the base container's
  221. <methodname>__call()</methodname> method.
  222. </para>
  223. <para>
  224. Here's a summary of the Core <acronym>API</acronym> for Feeds. You should note it
  225. comprises not only the basic <acronym>RSS</acronym> and Atom standards, but also
  226. accounts for a number of included Extensions bundled with
  227. <classname>Zend_Feed_Writer</classname>. The naming of these
  228. Extension sourced methods remain fairly generic - all Extension
  229. methods operate at the same level as the Core <acronym>API</acronym> though we do allow
  230. you to retrieve any specific Extension object separately if required.
  231. </para>
  232. <para>
  233. The Feed Level <acronym>API</acronym> for data is contained in
  234. <classname>Zend_Feed_Writer_Feed</classname>. In addition to the <acronym>API</acronym>
  235. detailed below, the class also implements the <classname>Countable</classname> and
  236. <classname>Iterator</classname> interfaces.
  237. </para>
  238. <table>
  239. <title>Feed Level API Methods</title>
  240. <tgroup cols="2">
  241. <tbody>
  242. <row>
  243. <entry><methodname>setId()</methodname></entry>
  244. <entry>
  245. Set a unique ID associated with this feed. For Atom 1.0
  246. this is an atom:id element, whereas for <acronym>RSS</acronym> 2.0 it
  247. is added as a guid element. These are optional so long as a link is
  248. added, i.e. the link is set as the ID.
  249. </entry>
  250. </row>
  251. <row>
  252. <entry><methodname>setTitle()</methodname></entry>
  253. <entry>Set the title of the feed.</entry>
  254. </row>
  255. <row>
  256. <entry><methodname>setDescription()</methodname></entry>
  257. <entry>Set the text description of the feed.</entry>
  258. </row>
  259. <row>
  260. <entry><methodname>setLink()</methodname></entry>
  261. <entry>
  262. Set a <acronym>URI</acronym> to the <acronym>HTML</acronym> website
  263. containing the same or
  264. similar information as this feed (i.e. if the feed is from a blog,
  265. it should provide the blog's <acronym>URI</acronym> where the
  266. <acronym>HTML</acronym> version of the entries can be read).
  267. </entry>
  268. </row>
  269. <row>
  270. <entry><methodname>setFeedLinks()</methodname></entry>
  271. <entry>
  272. Add a link to an <acronym>XML</acronym> feed, whether the feed being
  273. generated or an alternate <acronym>URI</acronym> pointing to the same
  274. feed but in a different format. At a minimum, it is recommended to
  275. include a link to the feed being generated so it has an identifiable
  276. final <acronym>URI</acronym> allowing a client to track its location
  277. changes without necessitating constant redirects. The parameter is an
  278. array of arrays, where each sub-array contains the keys "type" and
  279. "uri". The type should be one of "atom", "rss", or "rdf".
  280. </entry>
  281. </row>
  282. <row>
  283. <entry><methodname>addAuthors()</methodname></entry>
  284. <entry>
  285. Sets the data for authors. The parameter is an array of arrays
  286. where each sub-array may contain the keys "name", "email" and
  287. "uri". The "uri" value is only applicable for Atom feeds since
  288. <acronym>RSS</acronym> contains no facility to show it. For
  289. <acronym>RSS</acronym> 2.0, rendering will create two elements - an
  290. author element containing the email reference with the name in brackets,
  291. and a Dublin Core creator element only containing the name.
  292. </entry>
  293. </row>
  294. <row>
  295. <entry><methodname>addAuthor()</methodname></entry>
  296. <entry>
  297. Sets the data for a single author following the same
  298. array format as described above for a single sub-array.
  299. </entry>
  300. </row>
  301. <row>
  302. <entry><methodname>setDateCreated()</methodname></entry>
  303. <entry>
  304. Sets the date on which this feed was created. Generally
  305. only applicable to Atom where it represents the date the resource
  306. described by an Atom 1.0 document was created. The expected parameter
  307. may be a <acronym>UNIX</acronym> timestamp or a
  308. <classname>Zend_Date</classname> object.
  309. </entry>
  310. </row>
  311. <row>
  312. <entry><methodname>setDateModified()</methodname></entry>
  313. <entry>
  314. Sets the date on which this feed was last modified. The expected
  315. parameter may be a <acronym>UNIX</acronym> timestamp or a
  316. <classname>Zend_Date</classname> object.
  317. </entry>
  318. </row>
  319. <row>
  320. <entry><methodname>setLastBuildDate()</methodname></entry>
  321. <entry>
  322. Sets the date on which this feed was last build. The expected
  323. parameter may be a <acronym>UNIX</acronym> timestamp or a
  324. <classname>Zend_Date</classname> object. This will only be
  325. rendered for RSS 2.0 feeds and is automatically rendered as
  326. the current date by default when not explicity set.
  327. </entry>
  328. </row>
  329. <row>
  330. <entry><methodname>setLanguage()</methodname></entry>
  331. <entry>
  332. Sets the language of the feed. This will be omitted unless set.
  333. </entry>
  334. </row>
  335. <row>
  336. <entry><methodname>setGenerator()</methodname></entry>
  337. <entry>
  338. Allows the setting of a generator. The parameter should be an
  339. array containing the keys "name", "version" and "uri". If omitted
  340. a default generator will be added referencing
  341. <classname>Zend_Feed_Writer</classname>, the current Zend Framework
  342. version and the Framework's <acronym>URI</acronym>.
  343. </entry>
  344. </row>
  345. <row>
  346. <entry><methodname>setCopyright()</methodname></entry>
  347. <entry>Sets a copyright notice associated with the feed.</entry>
  348. </row>
  349. <row>
  350. <entry><methodname>addHubs()</methodname></entry>
  351. <entry>
  352. Accepts an array of Pubsubhubbub Hub Endpoints to be rendered in
  353. the feed as Atom links so that PuSH Subscribers may subscribe to
  354. your feed. Note that you must implement a Pubsubhubbub Publisher in
  355. order for real-time updates to be enabled. A Publisher may be
  356. implemented using
  357. <classname>Zend_Feed_Pubsubhubbub_Publisher</classname>.
  358. The method <methodname>addHub()</methodname> allows adding
  359. a single hub at a time.
  360. </entry>
  361. </row>
  362. <row>
  363. <entry><methodname>addCategories()</methodname></entry>
  364. <entry>
  365. Accepts an array of categories for rendering, where each element is
  366. itself an array whose possible keys include "term", "label" and
  367. "scheme". The "term" is a typically a category name suitable for
  368. inclusion in a <acronym>URI</acronym>. The "label" may be a human
  369. readable category name supporting special characters (it is
  370. <acronym>HTML</acronym> encoded during rendering) and is a required key.
  371. The "scheme" (called the domain in <acronym>RSS</acronym>) is optional
  372. but must be a valid <acronym>URI</acronym>. The method
  373. <methodname>addCategory()</methodname> allows adding a single category
  374. at a time.
  375. </entry>
  376. </row>
  377. <row>
  378. <entry><methodname>setImage()</methodname></entry>
  379. <entry>
  380. Accepts an array of image metadata for an RSS image or Atom logo. Atom 1.0
  381. only requires a URI. RSS 2.0 requires a URI, HTML link, and an image title.
  382. RSS 2.0 optionally may send a width, height and image description. The array
  383. parameter may contain these using the keys: uri, link, title, description,
  384. height and width. The RSS 2.0 HTML link should point to the feed source's
  385. HTML page.
  386. </entry>
  387. </row>
  388. <row>
  389. <entry><methodname>createEntry()</methodname></entry>
  390. <entry>Returns a new instance of <classname>Zend_Feed_Writer_Entry
  391. </classname>. This is the Entry level data container. New entries
  392. are not automatically assigned to the current feed, so you
  393. must explicitly call <methodname>addEntry()</methodname>
  394. to add the entry for rendering.</entry>
  395. </row>
  396. <row>
  397. <entry><methodname>addEntry()</methodname></entry>
  398. <entry>Adds an instance of <classname>Zend_Feed_Writer_Entry
  399. </classname> to the current feed container for rendering.</entry>
  400. </row>
  401. <row>
  402. <entry><methodname>createTombstone()</methodname></entry>
  403. <entry>Returns a new instance of <classname>Zend_Feed_Writer_Deleted
  404. </classname>. This is the Atom 2.0 Tombstone level data container. New
  405. entries are not automatically assigned to the current feed, so you
  406. must explicitly call <methodname>addTombstone()</methodname>
  407. to add the deleted entry for rendering.</entry>
  408. </row>
  409. <row>
  410. <entry><methodname>addTombstone()</methodname></entry>
  411. <entry>Adds an instance of <classname>Zend_Feed_Writer_Deleted
  412. </classname> to the current feed container for rendering.</entry>
  413. </row>
  414. <row>
  415. <entry><methodname>removeEntry()</methodname></entry>
  416. <entry>Accepts a parameter indicating an array index of the
  417. entry to remove from the feed.</entry>
  418. </row>
  419. <row>
  420. <entry><methodname>export()</methodname></entry>
  421. <entry>
  422. Exports the entire data hierarchy to an <acronym>XML</acronym> feed. The
  423. method has two parameters. The first is the feed type, one of "atom"
  424. or "rss". The second is an optional boolean to set whether
  425. Exceptions are thrown. The default is <constant>TRUE</constant>.
  426. </entry>
  427. </row>
  428. </tbody>
  429. </tgroup>
  430. </table>
  431. <note>
  432. <para>
  433. In addition to these setters, there are also matching getters to retrieve data from
  434. the Entry data container. For example, <methodname>setImage()</methodname> is matched
  435. with a <methodname>getImage()</methodname> method.
  436. </para>
  437. </note>
  438. <!-- remaining feed stuff -->
  439. </sect2>
  440. <sect2 id="zend.feed.writer.setting.entry.data.points">
  441. <title>Setting Entry Data Points</title>
  442. <para>
  443. Here's a summary of the Core <acronym>API</acronym> for Entries and Items. You should
  444. note it comprises not only the basic <acronym>RSS</acronym> and Atom standards, but
  445. also accounts for a number of included Extensions bundled with
  446. <classname>Zend_Feed_Writer</classname>. The naming of these
  447. Extension sourced methods remain fairly generic - all Extension
  448. methods operate at the same level as the Core <acronym>API</acronym> though we do allow
  449. you to retrieve any specific Extension object separately if required.
  450. </para>
  451. <para>
  452. The Entry Level <acronym>API</acronym> for data is contained in
  453. <classname>Zend_Feed_Writer_Entry</classname>.
  454. </para>
  455. <table>
  456. <title>Entry Level API Methods</title>
  457. <tgroup cols="2">
  458. <tbody>
  459. <row>
  460. <entry><methodname>setId()</methodname></entry>
  461. <entry>
  462. Set a unique ID associated with this entry. For Atom 1.0
  463. this is an atom:id element, whereas for <acronym>RSS</acronym> 2.0 it is
  464. added as a guid element. These are optional so long as a link is
  465. added, i.e. the link is set as the ID.
  466. </entry>
  467. </row>
  468. <row>
  469. <entry><methodname>setTitle()</methodname></entry>
  470. <entry>Set the title of the entry.</entry>
  471. </row>
  472. <row>
  473. <entry><methodname>setDescription()</methodname></entry>
  474. <entry>Set the text description of the entry.</entry>
  475. </row>
  476. <row>
  477. <entry><methodname>setContent()</methodname></entry>
  478. <entry>Set the content of the entry.</entry>
  479. </row>
  480. <row>
  481. <entry><methodname>setLink()</methodname></entry>
  482. <entry>
  483. Set a <acronym>URI</acronym> to the <acronym>HTML</acronym> website
  484. containing the same or
  485. similar information as this entry (i.e. if the feed is from a blog,
  486. it should provide the blog article's <acronym>URI</acronym> where the
  487. <acronym>HTML</acronym> version of the entry can be read).
  488. </entry>
  489. </row>
  490. <row>
  491. <entry><methodname>setFeedLinks()</methodname></entry>
  492. <entry>
  493. Add a link to an <acronym>XML</acronym> feed, whether the feed being
  494. generated or an alternate <acronym>URI</acronym> pointing to the same
  495. feed but in a different format. At a minimum, it is recommended to
  496. include a link to the feed being generated so it has an identifiable
  497. final <acronym>URI</acronym> allowing a client to track its location
  498. changes without necessitating constant redirects. The parameter is an
  499. array of arrays, where each sub-array contains the keys "type" and
  500. "uri". The type should be one of "atom", "rss", or "rdf". If a type is
  501. omitted, it defaults to the type used when rendering the feed.
  502. </entry>
  503. </row>
  504. <row>
  505. <entry><methodname>addAuthors()</methodname></entry>
  506. <entry>
  507. Sets the data for authors. The parameter is an array of arrays
  508. where each sub-array may contain the keys "name", "email" and
  509. "uri". The "uri" value is only applicable for Atom feeds since
  510. <acronym>RSS</acronym> contains no facility to show it. For
  511. <acronym>RSS</acronym> 2.0, rendering will create two elements - an
  512. author element containing the email reference with the name in brackets,
  513. and a Dublin Core creator element only containing the name.
  514. </entry>
  515. </row>
  516. <row>
  517. <entry><methodname>addAuthor()</methodname></entry>
  518. <entry>
  519. Sets the data for a single author following the same
  520. format as described above for a single sub-array.
  521. </entry>
  522. </row>
  523. <row>
  524. <entry><methodname>setDateCreated()</methodname></entry>
  525. <entry>
  526. Sets the date on which this feed was created. Generally
  527. only applicable to Atom where it represents the date the resource
  528. described by an Atom 1.0 document was created. The expected parameter
  529. may be a <acronym>UNIX</acronym> timestamp or a
  530. <classname>Zend_Date</classname> object. If omitted, the date
  531. used will be the current date and time.
  532. </entry>
  533. </row>
  534. <row>
  535. <entry><methodname>setDateModified()</methodname></entry>
  536. <entry>
  537. Sets the date on which this feed was last modified. The expected
  538. parameter may be a <acronym>UNIX</acronym> timestamp or a
  539. <classname>Zend_Date</classname> object. If omitted, the date
  540. used will be the current date and time.
  541. </entry>
  542. </row>
  543. <row>
  544. <entry><methodname>setCopyright()</methodname></entry>
  545. <entry>Sets a copyright notice associated with the feed.</entry>
  546. </row>
  547. <row>
  548. <entry><methodname>setCategories()</methodname></entry>
  549. <entry>
  550. Accepts an array of categories for rendering, where each element is
  551. itself an array whose possible keys include "term", "label" and
  552. "scheme". The "term" is a typically a category name suitable for
  553. inclusion in a <acronym>URI</acronym>. The "label" may be a human
  554. readable category name supporting special characters (it is encoded
  555. during rendering) and is a required key. The "scheme" (called the domain
  556. in <acronym>RSS</acronym>) is optional but must be a valid
  557. <acronym>URI</acronym>.
  558. </entry>
  559. </row>
  560. <row>
  561. <entry><methodname>setCommentCount()</methodname></entry>
  562. <entry>
  563. Sets the number of comments associated with this entry. Rendering
  564. differs between <acronym>RSS</acronym> and Atom 2.0 depending
  565. on the element/attribute needed.
  566. </entry>
  567. </row>
  568. <row>
  569. <entry><methodname>setCommentLink()</methodname></entry>
  570. <entry>
  571. Seta a link to a <acronym>HTML</acronym> page containing comments
  572. associated with this entry.
  573. </entry>
  574. </row>
  575. <row>
  576. <entry><methodname>setCommentFeedLink()</methodname></entry>
  577. <entry>
  578. Sets a link to a <acronym>XML</acronym> feed containing comments
  579. associated with this entry. The parameter is an array containing the
  580. keys "uri" and "type", where the type is one of "rdf", "rss" or "atom".
  581. </entry>
  582. </row>
  583. <row>
  584. <entry><methodname>setCommentFeedLinks()</methodname></entry>
  585. <entry>
  586. Same as <methodname>setCommentFeedLink()</methodname> except it
  587. accepts an array of arrays, where each subarray contains the
  588. expected parameters of <methodname>setCommentFeedLink()</methodname>.
  589. </entry>
  590. </row>
  591. <row>
  592. <entry><methodname>setEncoding()</methodname></entry>
  593. <entry>
  594. Sets the encoding of entry text. This will default to UTF-8 which
  595. is the preferred encoding.
  596. </entry>
  597. </row>
  598. </tbody>
  599. </tgroup>
  600. </table>
  601. <note>
  602. <para>
  603. In addition to these setters, there are also matching getters to retrieve data from
  604. from the Entry data container.
  605. </para>
  606. </note>
  607. </sect2>
  608. </sect1>