PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/mod_feed/tmpl/default.php

https://github.com/joebushi/joomla
PHP | 128 lines | 98 code | 15 blank | 15 comment | 16 complexity | f1329eaf2b6536881b5beab21c58724d MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <?php
  2. /**
  3. * @version $Id$
  4. * @package Joomla.Site
  5. * @subpackage mod_feed
  6. * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE.txt
  8. */
  9. // no direct access
  10. defined('_JEXEC') or die;
  11. ?>
  12. <?php
  13. if ($feed != false)
  14. {
  15. //image handling
  16. $iUrl = isset($feed->image->url) ? $feed->image->url : null;
  17. $iTitle = isset($feed->image->title) ? $feed->image->title : null;
  18. ?>
  19. <div style="direction: <?php echo $rssrtl ? 'rtl' :'ltr'; ?>; text-align: <?php echo $rssrtl ? 'right' :'left'; ?> ! important" class="feed<?php echo $params->get('moduleclass_sfx'); ?>">
  20. <?php
  21. // feed description
  22. if (!is_null($feed->title) && $params->get('rsstitle', 1)) {
  23. ?>
  24. <h4>
  25. <a href="<?php echo str_replace('&', '&amp', $feed->link); ?>" target="_blank">
  26. <?php echo $feed->title; ?></a>
  27. </h4>
  28. <?php
  29. }
  30. // feed description
  31. if ($params->get('rssdesc', 1)) {
  32. ?>
  33. <?php echo $feed->description; ?>
  34. <?php
  35. }
  36. // feed image
  37. if ($params->get('rssimage', 1) && $iUrl) {
  38. ?>
  39. <img src="<?php echo $iUrl; ?>" alt="<?php echo @$iTitle; ?>"/>
  40. <?php
  41. }
  42. $actualItems = count($feed->items);
  43. $setItems = $params->get('rssitems', 5);
  44. if ($setItems > $actualItems) {
  45. $totalItems = $actualItems;
  46. } else {
  47. $totalItems = $setItems;
  48. }
  49. ?>
  50. <ul class="newsfeed<?php echo $params->get('moduleclass_sfx'); ?>">
  51. <?php
  52. $words = $params->def('word_count', 0);
  53. for ($j = 0; $j < $totalItems; $j ++)
  54. {
  55. $currItem = & $feed->items[$j];
  56. // item title
  57. ?>
  58. <li class="newsfeed-item">
  59. <?php if (!is_null($currItem->get_link())) {
  60. ?>
  61. <?php if (!is_null($feed->title) && $params->get('rsstitle', 1))
  62. { echo '<h5 class="feed-link">';}
  63. else
  64. {
  65. echo '<h4 class="feed-link">';
  66. }
  67. ?>
  68. <a href="<?php echo $currItem->get_link(); ?>" target="_blank">
  69. <?php echo $currItem->get_title(); ?></a>
  70. <?php if (!is_null($feed->title) && $params->get('rsstitle', 1))
  71. { echo '</h5>';}
  72. else
  73. { echo '</h4>';}
  74. ?>
  75. <?php
  76. }
  77. // item description
  78. if ($params->get('rssitemdesc', 1))
  79. {
  80. // item description
  81. $text = $currItem->get_description();
  82. $text = str_replace('&apos;', "'", $text);
  83. $text=strip_tags($text);
  84. // word limit check
  85. if ($words)
  86. {
  87. $texts = explode(' ', $text);
  88. $count = count($texts);
  89. if ($count > $words)
  90. {
  91. $text = '';
  92. for ($i = 0; $i < $words; $i ++) {
  93. $text .= ' '.$texts[$i];
  94. }
  95. $text .= '...';
  96. }
  97. }
  98. ?>
  99. <p><?php echo $text; ?></p>
  100. <?php
  101. }
  102. ?>
  103. </li>
  104. <?php
  105. }
  106. ?>
  107. </ul>
  108. </div>
  109. <?php } ?>