Zend_Feed_Writer.xml 33 KB

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