Zend_Feed_Writer.xml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  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>setLanguage()</methodname></entry>
  321. <entry>
  322. Sets the language of the feed. This will be omitted unless set.
  323. </entry>
  324. </row>
  325. <row>
  326. <entry><methodname>setGenerator()</methodname></entry>
  327. <entry>
  328. Allows the setting of a generator. The parameter should be an
  329. array containing the keys "name", "version" and "uri". If omitted
  330. a default generator will be added referencing
  331. <classname>Zend_Feed_Writer</classname>, the current Zend Framework
  332. version and the Framework's <acronym>URI</acronym>.
  333. </entry>
  334. </row>
  335. <row>
  336. <entry><methodname>setCopyright()</methodname></entry>
  337. <entry>Sets a copyright notice associated with the feed.</entry>
  338. </row>
  339. <row>
  340. <entry><methodname>addHubs()</methodname></entry>
  341. <entry>
  342. Accepts an array of Pubsubhubbub Hub Endpoints to be rendered in
  343. the feed as Atom links so that PuSH Subscribers may subscribe to
  344. your feed. Note that you must implement a Pubsubhubbub Publisher in
  345. order for real-time updates to be enabled. A Publisher may be
  346. implemented using
  347. <classname>Zend_Feed_Pubsubhubbub_Publisher</classname>.
  348. The method <methodname>addHub()</methodname> allows adding
  349. a single hub at a time.
  350. </entry>
  351. </row>
  352. <row>
  353. <entry><methodname>addCategories()</methodname></entry>
  354. <entry>
  355. Accepts an array of categories for rendering, where each element is
  356. itself an array whose possible keys include "term", "label" and
  357. "scheme". The "term" is a typically a category name suitable for
  358. inclusion in a <acronym>URI</acronym>. The "label" may be a human
  359. readable category name supporting special characters (it is
  360. <acronym>HTML</acronym> encoded during rendering) and is a required key.
  361. The "scheme" (called the domain in <acronym>RSS</acronym>) is optional
  362. but must be a valid <acronym>URI</acronym>. The method
  363. <methodname>addCategory()</methodname> allows adding a single category
  364. at a time.
  365. </entry>
  366. </row>
  367. <row>
  368. <entry><methodname>createEntry()</methodname></entry>
  369. <entry>Returns a new instance of <classname>Zend_Feed_Writer_Entry
  370. </classname>. This is the Entry level data container. New entries
  371. are not automatically assigned to the current feed, so you
  372. must explicitly call <methodname>addEntry()</methodname>
  373. to add the entry for rendering.</entry>
  374. </row>
  375. <row>
  376. <entry><methodname>addEntry()</methodname></entry>
  377. <entry>Adds an instance of <classname>Zend_Feed_Writer_Entry
  378. </classname> to the current feed container for rendering.</entry>
  379. </row>
  380. <row>
  381. <entry><methodname>createTombstone()</methodname></entry>
  382. <entry>Returns a new instance of <classname>Zend_Feed_Writer_Deleted
  383. </classname>. This is the Atom 2.0 Tombstone level data container. New
  384. entries are not automatically assigned to the current feed, so you
  385. must explicitly call <methodname>addTombstone()</methodname>
  386. to add the deleted entry for rendering.</entry>
  387. </row>
  388. <row>
  389. <entry><methodname>addTombstone()</methodname></entry>
  390. <entry>Adds an instance of <classname>Zend_Feed_Writer_Deleted
  391. </classname> to the current feed container for rendering.</entry>
  392. </row>
  393. <row>
  394. <entry><methodname>removeEntry()</methodname></entry>
  395. <entry>Accepts a parameter indicating an array index of the
  396. entry to remove from the feed.</entry>
  397. </row>
  398. <row>
  399. <entry><methodname>export()</methodname></entry>
  400. <entry>
  401. Exports the entire data hierarchy to an <acronym>XML</acronym> feed. The
  402. method has two parameters. The first is the feed type, one of "atom"
  403. or "rss". The second is an optional boolean to set whether
  404. Exceptions are thrown. The default is <constant>TRUE</constant>.
  405. </entry>
  406. </row>
  407. </tbody>
  408. </tgroup>
  409. </table>
  410. <note>
  411. <para>
  412. In addition to these setters, there are also matching getters to retrieve data from
  413. the Entry data container.
  414. </para>
  415. </note>
  416. <!-- remaining feed stuff -->
  417. </sect2>
  418. <sect2 id="zend.feed.writer.setting.entry.data.points">
  419. <title>Setting Entry Data Points</title>
  420. <para>
  421. Here's a summary of the Core <acronym>API</acronym> for Entries and Items. You should
  422. note it comprises not only the basic <acronym>RSS</acronym> and Atom standards, but
  423. also accounts for a number of included Extensions bundled with
  424. <classname>Zend_Feed_Writer</classname>. The naming of these
  425. Extension sourced methods remain fairly generic - all Extension
  426. methods operate at the same level as the Core <acronym>API</acronym> though we do allow
  427. you to retrieve any specific Extension object separately if required.
  428. </para>
  429. <para>
  430. The Entry Level <acronym>API</acronym> for data is contained in
  431. <classname>Zend_Feed_Writer_Entry</classname>.
  432. </para>
  433. <table>
  434. <title>Entry Level API Methods</title>
  435. <tgroup cols="2">
  436. <tbody>
  437. <row>
  438. <entry><methodname>setId()</methodname></entry>
  439. <entry>
  440. Set a unique ID associated with this entry. For Atom 1.0
  441. this is an atom:id element, whereas for <acronym>RSS</acronym> 2.0 it is
  442. added as a guid element. These are optional so long as a link is
  443. added, i.e. the link is set as the ID.
  444. </entry>
  445. </row>
  446. <row>
  447. <entry><methodname>setTitle()</methodname></entry>
  448. <entry>Set the title of the entry.</entry>
  449. </row>
  450. <row>
  451. <entry><methodname>setDescription()</methodname></entry>
  452. <entry>Set the text description of the entry.</entry>
  453. </row>
  454. <row>
  455. <entry><methodname>setContent()</methodname></entry>
  456. <entry>Set the content of the entry.</entry>
  457. </row>
  458. <row>
  459. <entry><methodname>setLink()</methodname></entry>
  460. <entry>
  461. Set a <acronym>URI</acronym> to the <acronym>HTML</acronym> website
  462. containing the same or
  463. similar information as this entry (i.e. if the feed is from a blog,
  464. it should provide the blog article's <acronym>URI</acronym> where the
  465. <acronym>HTML</acronym> version of the entry can be read).
  466. </entry>
  467. </row>
  468. <row>
  469. <entry><methodname>setFeedLinks()</methodname></entry>
  470. <entry>
  471. Add a link to an <acronym>XML</acronym> feed, whether the feed being
  472. generated or an alternate <acronym>URI</acronym> pointing to the same
  473. feed but in a different format. At a minimum, it is recommended to
  474. include a link to the feed being generated so it has an identifiable
  475. final <acronym>URI</acronym> allowing a client to track its location
  476. changes without necessitating constant redirects. The parameter is an
  477. array of arrays, where each sub-array contains the keys "type" and
  478. "uri". The type should be one of "atom", "rss", or "rdf". If a type is
  479. omitted, it defaults to the type used when rendering the feed.
  480. </entry>
  481. </row>
  482. <row>
  483. <entry><methodname>addAuthors()</methodname></entry>
  484. <entry>
  485. Sets the data for authors. The parameter is an array of arrays
  486. where each sub-array may contain the keys "name", "email" and
  487. "uri". The "uri" value is only applicable for Atom feeds since
  488. <acronym>RSS</acronym> contains no facility to show it. For
  489. <acronym>RSS</acronym> 2.0, rendering will create two elements - an
  490. author element containing the email reference with the name in brackets,
  491. and a Dublin Core creator element only containing the name.
  492. </entry>
  493. </row>
  494. <row>
  495. <entry><methodname>addAuthor()</methodname></entry>
  496. <entry>
  497. Sets the data for a single author following the same
  498. format as described above for a single sub-array.
  499. </entry>
  500. </row>
  501. <row>
  502. <entry><methodname>setDateCreated()</methodname></entry>
  503. <entry>
  504. Sets the date on which this feed was created. Generally
  505. only applicable to Atom where it represents the date the resource
  506. described by an Atom 1.0 document was created. The expected parameter
  507. may be a <acronym>UNIX</acronym> timestamp or a
  508. <classname>Zend_Date</classname> object. If omitted, the date
  509. used will be the current date and time.
  510. </entry>
  511. </row>
  512. <row>
  513. <entry><methodname>setDateModified()</methodname></entry>
  514. <entry>
  515. Sets the date on which this feed was last modified. The expected
  516. parameter may be a <acronym>UNIX</acronym> timestamp or a
  517. <classname>Zend_Date</classname> object. If omitted, the date
  518. used will be the current date and time.
  519. </entry>
  520. </row>
  521. <row>
  522. <entry><methodname>setCopyright()</methodname></entry>
  523. <entry>Sets a copyright notice associated with the feed.</entry>
  524. </row>
  525. <row>
  526. <entry><methodname>setCategories()</methodname></entry>
  527. <entry>
  528. Accepts an array of categories for rendering, where each element is
  529. itself an array whose possible keys include "term", "label" and
  530. "scheme". The "term" is a typically a category name suitable for
  531. inclusion in a <acronym>URI</acronym>. The "label" may be a human
  532. readable category name supporting special characters (it is encoded
  533. during rendering) and is a required key. The "scheme" (called the domain
  534. in <acronym>RSS</acronym>) is optional but must be a valid
  535. <acronym>URI</acronym>.
  536. </entry>
  537. </row>
  538. <row>
  539. <entry><methodname>setCommentCount()</methodname></entry>
  540. <entry>
  541. Sets the number of comments associated with this entry. Rendering
  542. differs between <acronym>RSS</acronym> and Atom 2.0 depending
  543. on the element/attribute needed.
  544. </entry>
  545. </row>
  546. <row>
  547. <entry><methodname>setCommentLink()</methodname></entry>
  548. <entry>
  549. Seta a link to a <acronym>HTML</acronym> page containing comments
  550. associated with this entry.
  551. </entry>
  552. </row>
  553. <row>
  554. <entry><methodname>setCommentFeedLink()</methodname></entry>
  555. <entry>
  556. Sets a link to a <acronym>XML</acronym> feed containing comments
  557. associated with this entry. The parameter is an array containing the
  558. keys "uri" and "type", where the type is one of "rdf", "rss" or "atom".
  559. </entry>
  560. </row>
  561. <row>
  562. <entry><methodname>setCommentFeedLinks()</methodname></entry>
  563. <entry>
  564. Same as <methodname>setCommentFeedLink()</methodname> except it
  565. accepts an array of arrays, where each subarray contains the
  566. expected parameters of <methodname>setCommentFeedLink()</methodname>.
  567. </entry>
  568. </row>
  569. <row>
  570. <entry><methodname>setEncoding()</methodname></entry>
  571. <entry>
  572. Sets the encoding of entry text. This will default to UTF-8 which
  573. is the preferred encoding.
  574. </entry>
  575. </row>
  576. </tbody>
  577. </tgroup>
  578. </table>
  579. <note>
  580. <para>
  581. In addition to these setters, there are also matching getters to retrieve data from
  582. from the Entry data container.
  583. </para>
  584. </note>
  585. </sect2>
  586. </sect1>