Source for file RSSAction.class.php

Documentation is available at RSSAction.class.php

  1. <?php
  2. /**
  3. * @since 8/7/06
  4. * @package polyphony.AbstractActions
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: RSSAction.class.php,v 1.4 2007/09/19 14:04:41 adamfranco Exp $
  10. */
  11. require_once(POLYPHONY."/main/library/AbstractActions/ForceAuthAction.class.php");
  12. require_once(HARMONI."/Primitives/Collections-Text/HtmlString.class.php");
  13.  
  14. /**
  15. * <##>
  16. *
  17. * @since 8/7/06
  18. * @package polyphony.AbstractActions
  19. *
  20. * @copyright Copyright &copy; 2005, Middlebury College
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22. *
  23. * @version $Id: RSSAction.class.php,v 1.4 2007/09/19 14:04:41 adamfranco Exp $
  24. */
  25. class RSSAction
  26. extends ForceAuthAction
  27. {
  28. /**
  29. * @var array $_items; Items in the feed
  30. * @access private
  31. * @since 8/7/06
  32. */
  33. var $_items = array();
  34. /**
  35. * @var string $_title;
  36. * @access private
  37. * @since 8/7/06
  38. */
  39. var $_title = 'Untitled';
  40. /**
  41. * @var string $_link;
  42. * @access private
  43. * @since 8/7/06
  44. */
  45. var $_link = 'http://www.example.net/';
  46. /**
  47. * @var string $_description;
  48. * @access private
  49. * @since 8/7/06
  50. */
  51. var $_description;
  52. /**
  53. * @var array $_categories;
  54. * @access private
  55. * @since 8/8/06
  56. */
  57. var $_categories = array();
  58. /**
  59. * @var string $_generator;
  60. * @access private
  61. * @since 8/7/06
  62. */
  63. var $_generator = 'Harmoni Application Framework';
  64. /**
  65. * @var array $_skipHours;
  66. * @access private
  67. * @since 8/8/06
  68. */
  69. var $_skipHours = array();
  70. /**
  71. * @var array $_skipDays;
  72. * @access private
  73. * @since 8/8/06
  74. */
  75. var $_skipDays = array();
  76. /**
  77. * Build the content for this action
  78. *
  79. * @return void
  80. * @access public
  81. * @since 4/26/05
  82. */
  83. function execute () {
  84. if (!$this->isAuthorizedToExecute()) {
  85. header('HTTP/1.0 401 Unauthorized');
  86. $this->setTitle(_("Unauthorized"));
  87. $this->setDescription(_("You are not authorized to view this feed."));
  88. $this->write();
  89. exit;
  90. }
  91. $this->buildFeed();
  92. $this->write();
  93. exit;
  94. }
  95. /**
  96. * Add an item to this feed
  97. *
  98. * @param object RSSItem $item
  99. * @return object RSSItem The item added.
  100. * @access public
  101. * @since 8/7/06
  102. */
  103. function addItem ($item) {
  104. $this->_items[] =$item;
  105. return $item;
  106. }
  107. /*******************************************************
  108. * Required Channel elements
  109. *********************************************************/
  110.  
  111. /**
  112. * Required: Set the title
  113. *
  114. * @param string $title
  115. * @return void
  116. * @access public
  117. * @since 8/7/06
  118. */
  119. function setTitle ($title) {
  120. ArgumentValidator::validate($title, StringValidatorRule::getRule());
  121. $tmp = HtmlString::fromString(str_replace("&nbsp;", "&#160;", $title));
  122. $this->_title = $tmp->stripTagsAndTrim(20);
  123. }
  124. /**
  125. * Required: Set the link, if it is the GUID, then the GUID will be set to the link.
  126. *
  127. * @param string $link
  128. * @param optional boolean $isGUID
  129. * @return void
  130. * @access public
  131. * @since 8/7/06
  132. */
  133. function setLink ($link, $isGUID = FALSE) {
  134. ArgumentValidator::validate($link, StringValidatorRule::getRule());
  135. ArgumentValidator::validate($isGUID, BooleanValidatorRule::getRule());
  136. $this->_link = $link;
  137. if ($isGUID)
  138. $this->setGUID($link, true);
  139. }
  140. /**
  141. * Required: Set the description
  142. *
  143. * @param string $description
  144. * @return void
  145. * @access public
  146. * @since 8/7/06
  147. */
  148. function setDescription ($description) {
  149. ArgumentValidator::validate($description, StringValidatorRule::getRule());
  150. $this->_description = HtmlString::fromString(
  151. str_replace("&nbsp;", "&#160;", $description));
  152. $this->_description->clean();
  153. }
  154. /*******************************************************
  155. * Optional Channel elements
  156. *********************************************************/
  157.  
  158. /**
  159. * Optional: Set the publish date
  160. *
  161. * @param object DateAndTime $pubDate
  162. * @return void
  163. * @access public
  164. * @since 8/7/06
  165. */
  166. function setPubDate ( $pubDate) {
  167. ArgumentValidator::validate($pubDate, HasMethodsValidatorRule::getRule("asDateAndTime"));
  168. $this->_pubDate =$pubDate->asDateAndTime();
  169. }
  170. /**
  171. * Optional: Set the lastBuildDate
  172. *
  173. * @param object DateAndTime $lastBuildDate
  174. * @return void
  175. * @access public
  176. * @since 8/7/06
  177. */
  178. function setLastBuildDate ( $lastBuildDate) {
  179. ArgumentValidator::validate($pubDate, HasMethodsValidatorRule::getRule("asDateAndTime"));
  180. $this->_lastBuildDate =$lastBuildDate->asDateAndTime();
  181. }
  182. /**
  183. * Optional: Set the managingEditor name and email
  184. *
  185. * @param string $name
  186. * @param optional string $email
  187. * @return void
  188. * @access public
  189. * @since 8/7/06
  190. */
  191. function setManagingEditor ($name, $email='nobody@example.net') {
  192. ArgumentValidator::validate($name, StringValidatorRule::getRule());
  193. ArgumentValidator::validate($email, StringValidatorRule::getRule());
  194. $this->_managingEditorName = $name;
  195. $this->_managingEditorEmail = $email;
  196. }
  197. /**
  198. * Optional: Set the copyright notice
  199. *
  200. * @param string $copyright
  201. * @return void
  202. * @access public
  203. * @since 8/7/06
  204. */
  205. function setCopyright ($copyright) {
  206. ArgumentValidator::validate($copyright, StringValidatorRule::getRule());
  207. $this->_copyright = $copyright;
  208. }
  209. /**
  210. * Optional: Set the category
  211. *
  212. * @param string category
  213. * @return void
  214. * @access public
  215. * @since 8/7/06
  216. */
  217. function addCategory ($category, $domain = null) {
  218. ArgumentValidator::validate($category, StringValidatorRule::getRule());
  219. ArgumentValidator::validate($domain, OptionalRule::getRule(StringValidatorRule::getRule()));
  220. if ($domain) {
  221. if (!isset($this->_categories[$domain]))
  222. $this->_categories[$domain] = array();
  223. $this->_categories[$domain][] = $category;
  224. } else {
  225. if (!isset($this->_categories['_no_domain_']))
  226. $this->_categories['_no_domain_'] = array();
  227. $this->_categories['_no_domain_'][] = $category;
  228. }
  229. }
  230. /**
  231. * Optional: Set the time to live, It's a number of minutes that indicates how long a
  232. * channel can be cached before refreshing from the source.
  233. *
  234. * @param integer $minutes
  235. * @return void
  236. * @access public
  237. * @since 8/7/06
  238. */
  239. function setTTL ($minutes) {
  240. ArgumentValidator::validate($minutes, IntegerValidatorRule::getRule());
  241. ArgumentValidator::validate($minutes, IntegerRangeValidatorRule::getRule(1, pow(2, 30)));
  242. $this->_ttl = $minutes;
  243. }
  244. /**
  245. * Optional: Specifies a GIF, JPEG or PNG image that can be displayed with the channel.
  246. *
  247. * @param string $imageURL
  248. * @param string $imageTitle
  249. * @return void
  250. * @access public
  251. * @since 8/7/06
  252. */
  253. function setImage ($imageURL, $imageHeight = null, $imageWidth = null,
  254. $imageTitle = null, $imageLink = null, $imageDescription = null)
  255. {
  256. ArgumentValidator::validate($imageURL, StringValidatorRule::getRule());
  257. ArgumentValidator::validate($imageHeight, OptionalRule::getRule(IntegerValidatorRule::getRule()));
  258. ArgumentValidator::validate($imageHeight,
  259. OptionalRule::getRule(IntegerRangeValidatorRule::getRule(1, 400)));
  260. ArgumentValidator::validate($imageWidth, OptionalRule::getRule(IntegerValidatorRule::getRule()));
  261. ArgumentValidator::validate($imageWidth,
  262. OptionalRule::getRule(IntegerRangeValidatorRule::getRule(1, 144)));
  263. ArgumentValidator::validate($imageLink, OptionalRule::getRule(StringValidatorRule::getRule()));
  264. ArgumentValidator::validate($imageDescription, OptionalRule::getRule(StringValidatorRule::getRule()));
  265. $this->_imageURL = $imageURL;
  266. if ($imageTitle)
  267. $this->_imageTitle = $imageTitle;
  268. if ($imageLink)
  269. $this->_imageLink = $imageLink;
  270. if ($imageDescription)
  271. $this->_imageDescription = $imageDescription;
  272. if ($imageHeight)
  273. $this->_imageHeight = $imageHeight;
  274. if ($imageWidth)
  275. $this->_imageWidth = $imageWidth;
  276. }
  277. /*******************************************************
  278. * Output
  279. *********************************************************/
  280.  
  281. /**
  282. * Send the Content headers and write the feed, then exit.
  283. *
  284. * @return void
  285. * @access public
  286. * @since 8/7/06
  287. */
  288. function write () {
  289. header("Content-Type: text/xml; charset=utf-8");
  290. print<<<END
  291. <?xml version="1.0" encoding="utf-8" ?>
  292. <rss version="2.0">
  293. <channel>
  294. END;
  295. print "\n\t\t<title>".htmlentities($this->_title)."</title>";
  296. print "\n\t\t<link>".$this->_link."</link>";
  297. if (isset($this->_description))
  298. print "\n\t\t<description>".htmlentities($this->_description->asString())."</description>";
  299. else
  300. print "\n\t\t<description></description>";
  301. if (isset($this->_language))
  302. print "\n\t\t<language>".$this->_language."</language>";
  303. if (isset($this->_copyright))
  304. print "\n\t\t<copyright>".$this->_copyright."</copyright>";
  305. if (isset($this->_managingEditor))
  306. print "\n\t\t<managingEditor>".$this->_managingEditor."</managingEditor>";
  307. if (isset($this->_webMaster))
  308. print "\n\t\t<webMaster>".$this->_webMaster."</webMaster>";
  309. if (isset($this->_pubDate) && is_object($this->_pubDate)) {
  310. print "\n\t\t<pubDate>";
  311. RSSAction::printRSSTimestamp($this->_pubDate);
  312. print "</pubDate>";
  313. }
  314. if (!isset($this->_lastBuildDate) || !is_object($this->_lastBuildDate))
  315. $this->_lastBuildDate =$this->getLatestItemDate();
  316. if (isset($this->_lastBuildDate) && is_object($this->_lastBuildDate)) {
  317. print "\n\t\t<lastBuildDate>";
  318. RSSAction::printRSSTimestamp($this->_lastBuildDate);
  319. print "</lastBuildDate>";
  320. }
  321. if (count($this->_categories)) {
  322. foreach ($this->_categories as $domain => $categories) {
  323. foreach ($categories as $category) {
  324. if ($domain == '_no_domain_')
  325. print "\n\t\t<category>";
  326. else
  327. print "\n\t\t<category domain='".$domain."'>";
  328. print $category."</category>";
  329. }
  330. }
  331. }
  332. print "\n\t\t<generator>".$this->_generator."</generator>";
  333. print "\n\t\t<docs>http://blogs.law.harvard.edu/tech/rss</docs>";
  334. if (isset($this->_ttl))
  335. print "\n\t\t<ttl>".$this->_ttl."</ttl>";
  336. if (isset($this->_imageURL)) {
  337. print "\n\t\t<image>";
  338. print "\n\t\t\t<url>".$this->_imageURL."</url>";
  339. if (isset($this->_imageTitle))
  340. print "\n\t\t\t<title>".htmlentities($this->_imageTitle)."</title>";
  341. else
  342. print "\n\t\t\t<title>".htmlentities($this->_title)."</title>";
  343. if (isset($this->_imageLink))
  344. print "\n\t\t\t<link>".$this->_imageLink."</link>";
  345. else
  346. print "\n\t\t\t<link>".$this->_link."</link>";
  347. if (isset($this->_imageDescription)) {
  348. print "\n\t\t\t<description>";
  349. print htmlentities($this->_imageDescription);
  350. print "</description>";
  351. } else if (isset($this->_description) && is_object($this->_description)) {
  352. print "\n\t\t\t<description>";
  353. print htmlentities($this->_description->stripTagsAndTrim(20));
  354. print "</description>";
  355. }
  356. if (isset($this->_imageWidth))
  357. print "\n\t\t\t<width>".$this->_imageWidth."</width>";
  358. if (isset($this->_imageHeight))
  359. print "\n\t\t\t<height>".$this->_imageWidth."</height>";
  360. print "\n\t\t</image>";
  361. }
  362. if (isset($this->_copyright))
  363. print "\n\t\t<copyright>".htmlentities($this->_copyright)."</copyright>";
  364. if (count($this->_skipHours)) {
  365. print "\n\t\t<skipHours>";
  366. foreach($this->_skipHours as $hour)
  367. print "\n\t\t\t<hour>".$hour."</hour>";
  368. print "\n\t\t</skipHours>";
  369. }
  370. if (count($this->_skipDays)) {
  371. print "\n\t\t<skipDays>";
  372. foreach($this->_skipDays as $day)
  373. print "\n\t\t\t<day>".$hour."</day>";
  374. print "\n\t\t</skipDays>";
  375. }
  376. foreach ($this->_items as $key => $copy) {
  377. $this->_items[$key]->write();
  378. }
  379. print<<<END
  380.  
  381. </channel>
  382. </rss>
  383.  
  384. END;
  385. }
  386. /**
  387. * Get the latested Item-date
  388. *
  389. * @return mixed object or null
  390. * @access public
  391. * @since 8/8/06
  392. */
  393. function getLatestItemDate () {
  394. $latestDate = null;
  395. foreach (array_keys($this->_items) as $key) {
  396. $itemDate =$this->_items[$key]->getPubDate();
  397. if (!is_object($itemDate))
  398. continue;
  399. if (is_null($latestDate)) {
  400. $latestDate =$itemDate;
  401. continue;
  402. }
  403. if ($itemDate->isGreaterThan($latestDate))
  404. $latestDate =$itemDate;
  405. }
  406. return $latestDate;
  407. }
  408. /**
  409. * Print a timestamp in RSS form
  410. *
  411. * @param object DateAndTime $timestamp
  412. * @return void
  413. * @access public
  414. * @since 8/7/06
  415. */
  416. function printRSSTimestamp ($timestamp) {
  417. print $timestamp->dayOfWeekAbbreviation().", ";
  418. print str_pad($timestamp->dayOfMonth(), 2, '0', STR_PAD_LEFT)." ";
  419. print $timestamp->monthAbbreviation()." ";
  420. print $timestamp->year()." ";
  421. print $timestamp->hmsString()." ";
  422. $tzOffset =$timestamp->offset();
  423. print (($tzOffset->isPositive())?"+":"-");
  424. print str_pad(abs($tzOffset->hours()), 2, '0', STR_PAD_LEFT)."";
  425. print str_pad(abs($tzOffset->minutes()), 2, '0', STR_PAD_LEFT);
  426. }
  427. }
  428.  
  429. /**
  430. * This class represents an item in an RSS feed
  431. *
  432. * @since 8/7/06
  433. * @package polyphony.AbstractActions
  434. *
  435. * @copyright Copyright &copy; 2005, Middlebury College
  436. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  437. *
  438. * @version $Id: RSSAction.class.php,v 1.4 2007/09/19 14:04:41 adamfranco Exp $
  439. */
  440. class RSSItem {
  441. /**
  442. * @var array $_categories;
  443. * @access private
  444. * @since 8/8/06
  445. */
  446. var $_categories = array();
  447. /**
  448. * @var array $_enclosures;
  449. * @access private
  450. * @since 8/9/06
  451. */
  452. var $_enclosures;
  453. /*******************************************************
  454. * Required Item Elements
  455. *
  456. * Title OR Description are required, but both are not required
  457. *********************************************************/
  458.  
  459. /**
  460. * Required: Set the title
  461. *
  462. * @param string $title
  463. * @return void
  464. * @access public
  465. * @since 8/7/06
  466. */
  467. function setTitle ($title) {
  468. ArgumentValidator::validate($title, StringValidatorRule::getRule());
  469. $tmp = HtmlString::fromString(str_replace("&nbsp;", "&#160;", $title));
  470. $this->_title = $tmp->stripTagsAndTrim(20);
  471. }
  472. /**
  473. * Required: Set the description
  474. *
  475. * @param string $description
  476. * @return void
  477. * @access public
  478. * @since 8/7/06
  479. */
  480. function setDescription ($description) {
  481. ArgumentValidator::validate($description, StringValidatorRule::getRule());
  482. $this->_description = HtmlString::fromString(
  483. str_replace("&nbsp;", "&#160;", $description));
  484. $this->_description->clean();
  485. }
  486. /**
  487. * Answer the description
  488. *
  489. * @return string
  490. * @access public
  491. * @since 8/9/06
  492. */
  493. function getDescription () {
  494. return $this->_description->asString();
  495. }
  496. /*******************************************************
  497. * Optional Item Elements
  498. *********************************************************/
  499.  
  500. /**
  501. * Optional: Set the link, if it is the GUID, then the GUID will be set to the link.
  502. *
  503. * @param string $link
  504. * @param optional boolean $isGUID
  505. * @return void
  506. * @access public
  507. * @since 8/7/06
  508. */
  509. function setLink ($link, $isGUID = true) {
  510. ArgumentValidator::validate($link, StringValidatorRule::getRule());
  511. ArgumentValidator::validate($isGUID, BooleanValidatorRule::getRule());
  512. $this->_link = $link;
  513. if ($isGUID)
  514. $this->setGUID($link, true);
  515. }
  516. /**
  517. * Optional: Set the publish date
  518. *
  519. * @param object DateAndTime $pubDate
  520. * @return void
  521. * @access public
  522. * @since 8/7/06
  523. */
  524. function setPubDate ( $pubDate) {
  525. ArgumentValidator::validate($pubDate, HasMethodsValidatorRule::getRule("asDateAndTime"));
  526. $this->_pubDate =$pubDate->asDateAndTime();
  527. }
  528. /**
  529. * Answer the PubDate
  530. *
  531. * @return object or null
  532. * @access public
  533. * @since 8/8/06
  534. */
  535. function getPubDate () {
  536. if (isset($this->_pubDate) && is_object($this->_pubDate))
  537. return $this->_pubDate;
  538. else {
  539. $null = null;
  540. return $null;
  541. }
  542. }
  543. /**
  544. * Optional: Set the author name and email
  545. *
  546. * @param string $name
  547. * @param optional string $email
  548. * @return void
  549. * @access public
  550. * @since 8/7/06
  551. */
  552. function setAuthor ($name, $email='nobody@example.net') {
  553. ArgumentValidator::validate($name, StringValidatorRule::getRule());
  554. ArgumentValidator::validate($email, StringValidatorRule::getRule());
  555. $this->_authorName = $name;
  556. $this->_authorEmail = $email;
  557. }
  558. /**
  559. * Optional: Set the GUID and isPermaLink
  560. *
  561. * @param string $guid
  562. * @param optional boolean $isPermaLink
  563. * @return void
  564. * @access public
  565. * @since 8/7/06
  566. */
  567. function setGUID ($guid, $isPermaLink=true) {
  568. ArgumentValidator::validate($guid, StringValidatorRule::getRule());
  569. ArgumentValidator::validate($isPermaLink, BooleanValidatorRule::getRule());
  570. $this->_guid = $guid;
  571. $this->_isPermaLink = $isPermaLink;
  572. }
  573. /**
  574. * Optional: Add a category category
  575. *
  576. * @param string category
  577. * @return void
  578. * @access public
  579. * @since 8/7/06
  580. */
  581. function addCategory ($category, $domain = '_no_domain_') {
  582. ArgumentValidator::validate($category, StringValidatorRule::getRule());
  583. ArgumentValidator::validate($domain, StringValidatorRule::getRule());
  584. $this->_categories[] = array('category' => $category, 'domain' => $domain);
  585. }
  586. /**
  587. * Optional: Add a category to the beginning of the list
  588. *
  589. * @param string category
  590. * @return void
  591. * @access public
  592. * @since 8/9/06
  593. */
  594. function prependCategory ($category, $domain = '_no_domain_') {
  595. ArgumentValidator::validate($category, StringValidatorRule::getRule());
  596. ArgumentValidator::validate($domain, StringValidatorRule::getRule());
  597. array_unshift($this->_categories, array('category' => $category, 'domain' => $domain));
  598. }
  599. /**
  600. * Optional: Set comments URL
  601. *
  602. * @param string $commentsLink
  603. * @return void
  604. * @access public
  605. * @since 8/7/06
  606. */
  607. function setCommentsLink ($commentsLink) {
  608. ArgumentValidator::validate($category, StringValidatorRule::getRule());
  609. $this->_commentsLink = $commentsLink;
  610. }
  611. /**
  612. * Optional: Set source
  613. *
  614. * @param string $sourceTitle
  615. * @param string $sourceLink
  616. * @return void
  617. * @access public
  618. * @since 8/7/06
  619. */
  620. function setSource ($sourceTitle, $sourceLink) {
  621. ArgumentValidator::validate($sourceTitle, StringValidatorRule::getRule());
  622. ArgumentValidator::validate($sourceLink, StringValidatorRule::getRule());
  623. $this->_sourceTitle = $sourceTitle;
  624. $this->_sourceLink = $sourceLink;
  625. }
  626. /**
  627. * Optional: Add an enclosure. As of this writing the RSS 2.0 spec does not
  628. * allow multiple enclosures. Some aggregators however, support them anyway
  629. * and the one's I've (Adam) tested in simply ignore the extra enclosures.
  630. * Add multiple enclosures at your own risk.
  631. *
  632. * @param string $url
  633. * @param integer $length
  634. * @param string $mimeType
  635. * @return void
  636. * @access public
  637. * @since 8/7/06
  638. */
  639. function addEnclosure ($url, $length, $mimeType) {
  640. ArgumentValidator::validate($url, StringValidatorRule::getRule());
  641. ArgumentValidator::validate($length, IntegerValidatorRule::getRule());
  642. ArgumentValidator::validate($mimeType, RegexValidatorRule::getRule(
  643. '^(text|image|audio|video|application)/.+$'));
  644. $this->_enclosures[] = array(
  645. 'url' => $url,
  646. 'length' => $length,
  647. 'mimeType' => $mimeType);
  648. }
  649. /*******************************************************
  650. * Output methods
  651. *********************************************************/
  652.  
  653. /**
  654. * print out the item XML
  655. *
  656. * @return void
  657. * @access public
  658. * @since 8/7/06
  659. */
  660. function write () {
  661. print "\n\t\t<item>";
  662. if (isset($this->_title))
  663. print "\n\t\t<title>".htmlentities($this->_title)."</title>";
  664. else if (!isset($this->_description))
  665. print "\n\t\t<title>"._("Untitled")."</title>";
  666. if (isset($this->_link))
  667. print "\n\t\t<link>".$this->_link."</link>";
  668. if (isset($this->_description) && is_object($this->_description)) {
  669. print "\n\t\t<description>";
  670. print htmlentities($this->_description->asString());
  671. print "</description>";
  672. }
  673. if (isset($this->_authorName) || isset($this->_authorEmail)) {
  674. print "\n\t\t<author>";
  675. print $this->_authorName;
  676. if ($this->_authorEmail && $this->_authorName)
  677. print ' - '.$this->_authorEmail;
  678. else if ($this->_authorEmail)
  679. print $this->_authorEmail;
  680. print "</author>";
  681. }
  682. if (count($this->_categories)) {
  683. foreach ($this->_categories as $categoryArray) {
  684. $category = $categoryArray['category'];
  685. $domain = $categoryArray['domain'];
  686. if ($domain == '_no_domain_')
  687. print "\n\t\t<category>";
  688. else
  689. print "\n\t\t<category domain='".$domain."'>";
  690. print $category."</category>";
  691. }
  692. }
  693. if (isset($this->_commentsLink))
  694. print "\n\t\t<comments>".$this->_commentsLink."</comments>";
  695. if (count($this->_enclosures)) {
  696. foreach ($this->_enclosures as $enclosure) {
  697. print "\n\t\t<enclosure ";
  698. print " url='".$enclosure['url']."'";
  699. print " length='".$enclosure['length']."'";
  700. print " type='".$enclosure['mimeType']."'";
  701. print " />";
  702. }
  703. }
  704. if (isset($this->_guid)) {
  705. print "\n\t\t<guid isPermaLink='".(($this->_isPermaLink)?"true":"false")."'>";
  706. print $this->_guid."</guid>";
  707. }
  708. if (isset($this->_pubDate) && is_object($this->_pubDate)) {
  709. print "\n\t\t<pubDate>";
  710. RSSAction::printRSSTimestamp($this->_pubDate);
  711. print "</pubDate>";
  712. }
  713. if (isset($this->_sourceLink)) {
  714. print "\n\t\t<source url='".$this->_sourceLink."'>";
  715. if (isset($this->_sourceTitle))
  716. print htmlentities($this->_sourceTitle);
  717. else
  718. print _("Untitled Source");
  719. print "</source>";
  720. }
  721. print "\n\t\t</item>";
  722. }
  723. }
  724.  
  725.  
  726. ?>

Documentation generated on Wed, 19 Sep 2007 10:26:09 -0400 by phpDocumentor 1.3.0RC3