public static function getRows($feeds, $params) { if (is_null($feeds) || count($feeds) == 0) { return false; } # Get Parameters $totalfeeds = (int) $params->get('rssitems', 5); $pagination = (int) $params->get('pagination', 0); $pagination_items = (int) $params->get('paginationitems', 5); $img_w = $params->get('imagew', 0); $img_h = $params->get('imageh', 0); $img_marg = $params->get('imagemargin', '0px'); $imgalign = $params->get('imgalign', 'left'); $showimage = (int) $params->get('rssimage', 1); $showtitle = (int) $params->get('showtitle', 1); $showdesc = (int) $params->get('rssitemdesc', 1); $rssnoimage = (int) $params->get('rssnoimage', 0); //$cleanhtml = (int)$params->get('clean_html', 1); $showdatetime = (int) $params->get('showdattime', 1); $txtalign = $params->get('txtalign', 'left'); $titlealign = $params->get('titlealign', 'left'); $link_target = $params->get('linktarget', 'blank'); $linksrelation = $params->get('linksrel', 'none'); $link_title = (int) $params->get('linktitle', 1); $link_image = (int) $params->get('linkimage', 1); $use_readmore = (int) $params->get('showreadmore', 1); $seperator = $params->get('seperator', ''); $shownoimage = (int) $params->get('shownoimage', 0); $noimage = $params->get('noimage', 'modules/mod_we_ufeed_display/images/no_image.jpg'); $titlelimit = (int) $params->get('titlelimit', 0); $textlimit = $params->get('textlimit', 'words'); $limit_count = (int) $params->get('limit_count', 0); $readmorestyle = $params->get('readmorestyle', 'joomla'); $dformat = $params->get('dformat', 'd-m-Y H:i'); $readlightbox = (int) $params->get('readlightbox', 0); $imagesource = (int) $params->get('imagesource', 1); $noconflictjq = (int) $params->get('noconflictjq', 1); $showfeedinfo = (int) $params->get('showfeedinfo', 1); $videolink = (int) $params->get('videoplayer', 1); $internallinks = (int) $params->get('internallinks', 0); $minwidth = (int) $params->get('minwidthskip', 30); $useLogo = (int) $params->get('uselogo', 0); $usedivcrop = (int) $params->get('usedivcrop', 0); $replacewords = array_filter(@explode(",", $params->get('rplwords', ','))); $RemoveApply = (int) $params->get('rplwordsapply', 0); $htmltags = $params->get('htmltags', ''); $textFunction = (int) $params->get('textfunction', 1); $iframeTag = $params->get('iframelightboxtag', 'ufeedpop'); $modal = $params->get('modaltype', 'colorbox'); $datePos = $params->get('datepos', 'nexttitle'); $imgcheckmime = (int) $params->get('checkmime', 1); $document = JFactory::getDocument(); if ($readlightbox && !defined('RSS_JQREADER')) { if ($params->get('loadcolorboxcss', 1)) { $document->addStyleSheet(JURI::root(true) . '/modules/mod_we_ufeed_display/colorbox/colorbox.css'); } if ($modal == 'colorbox') { if (version_compare(JVERSION, '3.0', 'lt')) { if ($params->get('loadjq', 1)) { $document->addScript(JURI::root(true) . '/modules/mod_we_ufeed_display/colorbox/jquery-1.9.1.min.js'); } } else { JHtml::_('jquery.framework'); // load jquery } $document->addScript(JURI::root(true) . '/modules/mod_we_ufeed_display/colorbox/jquery.colorbox-min.js'); if ($noconflictjq) { $document->addScript(JURI::root(true) . '/modules/mod_we_ufeed_display/colorbox/weultimatefeeddisplay.js?width=98&height=98&itag=' . $iframeTag); } else { //$box='(function($){$(document).ready(function(){$(".'.$iframeTag.'").colorbox({width:"98%", height:"98%", iframe:true});});}(jQuery));'; $box = 'jQuery(document).ready(function($){$(".' . $iframeTag . '").colorbox({width:"98%", height:"98%", iframe:true});});'; $document->addScriptDeclaration($box, 'text/javascript'); } } else { if (version_compare(JVERSION, '3.0', 'lt')) { JHTML::_('behavior.mootools'); JHTML::_('behavior.modal'); } else { JHtml::_('behavior.framework'); JHtml::_('behavior.modal'); } $box = "window.addEvent('domready',function(){\n\t\t\t\t\tSqueezeBox.initialize({});\n\t\t\t\t\tSqueezeBox.assign(\$\$('a." . $iframeTag . "'),{size: {x: " . str_replace(array('px', '%'), '', $params->get('sqwidth', 800)) . ", y: " . str_replace(array('px', '%'), '', $params->get('sqheight', 500)) . "},handler: 'iframe'});\n\t\t\t\t});"; $document->addScriptDeclaration($box, 'text/javascript'); } define('RSS_JQREADER', 1); } $image_params = ""; $divCrop = 'class="img_pos_' . $imgalign . '" style="overflow:hidden;'; # Actualy Code Starts here if ($showimage) { # Create image style $image_params = ' class="img_pos_' . $imgalign . '" style="margin:' . $img_marg . ';'; $image_dim = ''; if ($img_w != 0) { $divCrop .= ' width:' . $img_w . ';'; if (!$usedivcrop) { $image_params .= ' width:' . $img_w . ';'; $image_dim .= ' width="' . str_replace('px', '', $img_w) . '" '; } } if ($img_h != 0) { $divCrop .= ' height:' . $img_h . ';'; if (!$usedivcrop) { $image_params .= ' height:' . $img_h . ';'; $image_dim .= ' height="' . str_replace('px', '', $img_h) . '" '; } } $image_params .= '"'; $image_params .= $image_dim; unset($image_dim); } $divCrop .= '"'; $html_content = array(); $counter = 1; $limitperpage = $pagination ? $pagination_items : $totalfeeds; # Loop to each feed news foreach ($feeds as $feed) { $useTiny = (int) $params->get('tinyurl', 0); $title = $feed->ItemTitle; # Title Limit if ($titlelimit != 0) { $length = JString::strlen($title); if ($length > $titlelimit) { $title = JString::substr($title, 0, $titlelimit) . '...'; } } // item description $text = !$textFunction || empty($feed->ItemText) ? $feed->ItemFulltext : $feed->ItemText; $class = ""; #Links rel(ation) $linksrel = ""; if ($linksrelation != "none") { $linksrel = 'rel="' . $linksrelation . '" '; } if ($readlightbox == 1) { $class = 'class="' . $iframeTag . '" '; } if ($internallinks && JString::strpos($feed->ItemLink, JURI::root()) !== false) { $link_target = "self"; $class = ""; $linksrel = 'rel="follow" '; } $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8'); $text = htmlspecialchars_decode($text, ENT_QUOTES); # News Image $no_img_found = false; //for hiding news without image #Get Image if ($showimage) { $enclosures = $feed->ItemEnclosures; $image_src = false; if (@JString::strpos($feed->ItemLink, "facebook.com") !== false) { $class = ''; } #disable lightbox reader for Facebook Links - Facebook not allow iframe content load. #Get the first image with width bigger than $minwidth $feedImage = modFeedShowHelper::getImage($text, $minwidth); #Youtube: Example Link http://www.youtube.com/watch?v=TZn3yZD0GZQ&feature=youtube_gdata if (JString::strpos($feed->ItemLink, "youtube.com") !== false) { $query = explode("?", $feed->ItemLink); parse_str($query[1], $ytube); $feedImage['src'] = "http://i3.ytimg.com/vi/" . $ytube['v'] . "/default.jpg"; if ($videolink && $readlightbox == 1) { $feed->ItemLink = "http://www.youtube.com/embed/" . $ytube['v'] . "?hd=1&autoplay=1"; } $useTiny = false; unset($query, $ytube); } if ($feedImage['src'] != false) { $image_src = $feedImage['src']; } #Facebook Image Links Fixing if (JString::strpos($image_src, "fbcdn.net") !== false && JString::strpos($image_src, "url=") > 0) { list($site, $image_src) = explode("url=", $image_src, 2); } #No Image Found in Text if (empty($image_src) || $image_src === false) { $no_img_found = true; } #If no text image or default source Enclusure tag AND Enclusure is image type...then... if (is_array($enclosures) && count($enclosures) > 0 && ($imagesource == 0 || $no_img_found === true)) { $images = array(); foreach ($enclosures as $enclosure) { if (empty($enclosure->link) && is_array($enclosure->thumbnails)) { foreach ($enclosure->thumbnails as $thumb) { if ($imgcheckmime) { list($thumb, $query) = @explode("?", $thumb, 2); $tags = @getimagesize($thumb); if (!empty($tags["mime"]) && strpos($tags["mime"], 'image') === false || !@preg_match("#\\.(jpg|jpeg|png|gif|bmp)#s", strtolower($thumb), $matchesEx) || (int) $tags["width"] > 0 && $minwidth != -1 && $minwidth > $tags["width"]) { continue; } } $obj = new stdClass(); $obj->link = trim($thumb); $obj->type = $tags["mime"]; $images[(int) $tags["width"]] = $obj; } } elseif (!empty($enclosure->link)) { if ($imgcheckmime) { list($enclosure->link, $query) = @explode("?", $enclosure->link, 2); $tags = @getimagesize($enclosure->link); if (!empty($tags["mime"]) && strpos($tags["mime"], 'image') === false || !@preg_match("#\\.(jpg|jpeg|png|gif|bmp)#s", strtolower($enclosure->link), $matchesEx) || (int) $tags["width"] > 0 && $minwidth != -1 && $minwidth > $tags["width"]) { continue; } } $obj = new stdClass(); $obj->link = trim($enclosure->link); $obj->type = $tags["mime"]; $images[(int) $tags["width"]] = $obj; } } asort($images); //get the bigger image $enclosure = reset($images); if (!empty($enclosure->link)) { $image_src = $enclosure->link; $no_img_found = false; } } #NoImage or Defaul FeedLogo src if ($no_img_found || empty($image_src) || $image_src === false) { $image_src = $useLogo && !empty($feed->FeedLogo) ? $feed->FeedLogo : $noimage; } $image_src = modFeedShowHelper::downloadImage($image_src, $params); #cache image } #Hide news without images if ($rssnoimage && $no_img_found) { continue; } #Vimeo: Example Link http://vimeo.com/36600080 if (JString::strpos($feed->ItemLink, "vimeo.com") > 0 && $readlightbox == 1 && $videolink) { if (preg_match("/(\\d){8,}/", $feed->ItemLink, $match)) { $feed->ItemLink = "http://player.vimeo.com/video/" . $match[0] . "?title=0&byline=0&portrait=0&autoplay=1"; $useTiny = false; } } #Link Mode $FeedItemLink = $useTiny ? modFeedShowHelper::TinyUrl($feed->ItemLink) : $feed->ItemLink; if (empty($FeedItemLink)) { $FeedItemLink = "#"; } #Remove Image if coditions are met if ($no_img_found && $shownoimage || !$showimage) { $image = ""; } else { #Create Image Element if ($link_image) { $image = '<div ' . $divCrop . '><a title="' . $title . '" ' . $linksrel . $class . ' target="_' . @$link_target . '" href="' . $FeedItemLink . '"><img alt="' . $title . '" src="' . @$image_src . '" ' . @$image_params . ' /></a></div>'; } else { $image = '<div ' . $divCrop . '><img alt="' . $title . '" src="' . @$image_src . '" ' . @$image_params . ' /></div>'; } } //clean content $title = strip_tags(str_replace(''', "'", $title), $htmltags); $text = strip_tags(str_replace(''', "'", $text), $htmltags); //Utf-8 force if ($params->get('utf8force', 1)) { $text = modFeedShowHelper::fixEncoding($text); $title = modFeedShowHelper::fixEncoding($title); } //Words Replace if ($RemoveApply != 0 && count($replacewords) > 0) { if ($showtitle && ($RemoveApply == 1 || $RemoveApply == 2)) { $title = str_replace($replacewords, "", $title); } if ($showdesc && ($RemoveApply == 1 || $RemoveApply == 3)) { $text = str_replace($replacewords, "", $text); } if ($showdesc && ($RemoveApply == 1 || $RemoveApply == 4)) { $feed->FeedTitle = str_replace($replacewords, "", $feed->FeedTitle); $feed->FeedDescription = str_replace($replacewords, "", $feed->FeedDescription); } } #Date $date_line = ''; if ($showdatetime) { if ($datePos == 'nexttitle') { $date_line = '<span class="feed_datetime nexttitle"> ' . $feed->ItemDate . '</span>'; } elseif ($datePos == 'abovetitle') { $date_line = '<div class="feed_datetime abovetitle"> ' . $feed->ItemDate . '</div>'; } elseif ($datePos == 'undertitle') { $date_line = '<div class="feed_datetime undertitle"> ' . $feed->ItemDate . '</div>'; } elseif ($datePos == 'beforetext') { $date_line = '<div class="feed_datetime beforetext"> ' . $feed->ItemDate . '</div>'; } elseif ($datePos == 'endoftext') { $date_line = '<div class="feed_datetime endoftext"> ' . $feed->ItemDate . '</div>'; } } $news_title = ''; if ($showtitle) { if ($link_title) { $news_title = '<a title="' . $title . '" ' . $linksrel . $class . ' target="_' . $link_target . '" href="' . $FeedItemLink . '">' . $title . '</a>'; } else { $news_title = $title; } # News Title $news_title = '<div class="feed_title_' . $titlealign . '">' . $news_title; #feed channel info if ($showfeedinfo) { if (JFile::exists($feed->FeedFavicon)) { $news_title .= '<br/><span class="feed_info" style="display:block;backround:transparent url(' . $feed->FeedFavicon . ') 0 50% no-repeat;padding:2px 0 2px 20px;">'; } else { $news_title .= '<br/><span class="feed_info">'; } $news_title .= '<a rel="nofolow" target="_blank" href="' . $feed->FeedLink . '" title="' . $feed->FeedDescription . '">' . $feed->FeedTitle . '</a></span>'; } #Title with date in same line if ($datePos == 'nexttitle') { $news_title .= $date_line; } $news_title .= '</div>'; } if ($datePos == 'abovetitle') { $news_title = $date_line . $news_title; } elseif ($datePos == 'undertitle') { $news_title = $news_title . $date_line; } # News Text $newstext = ""; $readmore_link = ""; if ($showdesc) { if ($limit_count != 0) { if ($textlimit == 'words') { $texts = explode(' ', $text); $count = count($texts); if ($count > $limit_count) { $text = ''; for ($i = 0; $i < $limit_count; $i++) { $w = JString::trim($texts[$i]); if (empty($w)) { continue; } $text .= ' ' . $w; } $text .= '...'; } } else { /* chars */ $length = JString::strlen($text); if ($length > $limit_count && $length != 0) { $text = JString::substr($text, 0, $limit_count); $text .= '...'; } } } if ($datePos == 'beforetext') { $newstext .= $date_line; } $newstext .= '<div class="feed_newstext_' . $txtalign . '">' . JString::trim($text) . '</div>'; if ($datePos == 'endoftext') { $newstext .= $date_line; } # Read more if ($use_readmore) { $c = array(); if ($readlightbox == 1 && !($internallinks && JString::strpos($feed->ItemLink, JURI::root()) !== false) && !(@JString::strpos($feed->ItemLink, "facebook.com") > 0)) { $c[] = $iframeTag; } if ($readmorestyle == 'joomla') { if (WEJM16) { $c[] = 'readmore'; } else { $c[] = 'readon'; } } if ($readmorestyle == 'custom') { $c[] = 'feed_readmore'; } if ($readmorestyle == 'inline') { $c[] = 'inline_readmore'; } $class = 'class="' . implode(' ', $c) . '"'; $readmore_link = '<span class="feed_readmore_around"><a ' . $linksrel . $class . ' target="_' . $link_target . '" href="' . $FeedItemLink . '">' . JText::_('MOD_WE_UFEED_DISPLAY_READMORE') . '</a></span>'; } } $title_order = (int) $params->get('ordertitle', 1); $img_order = (int) $params->get('orderimage', 2); $ordertext = (int) $params->get('ordertext', 3); $first = $second = $third = ""; switch ($title_order) { case 1: $first = $news_title; break; case 2: $second = $news_title; break; case 3: $third = $news_title; break; } switch ($img_order) { case 1: $first = $image; break; case 2: $second = $image; break; case 3: $third = $image; break; } switch ($ordertext) { case 1: $first = $newstext; break; case 2: $second = $newstext; break; case 3: $third = $newstext; break; } ######################## HERE YOU CAN CHANGE THE ORDER IF YOU WANT ########################### # Add All to Array $html_content[] = '<div class="ufdrssitem">' . $first . $second . $third . $seperator . $readmore_link . '</div>'; if ($counter == $limitperpage) { break; } $counter++; } // end foraech unset($feed, $params); if (count($html_content) == 0) { return false; } return $html_content; }
if (isset($items[$b * $tbcolumns + $c])) { echo $items[$b * $tbcolumns + $c]; } ?> </td> <?php } ?> <?php } ?> </tr> <?php } ?> </table> <div style="clear:both;"></div> <!-- pagination starts here --> <?php if ($pagination && $pages > 1) { ?> <div class="ufeedpagination"> <ul class="pagination-ufeed"> <?php if ($current_page != 1) { $link = modFeedShowHelper::pagination($current_page - 1, $module->id, $params->get('linkhash', 1)); ?> <li class="previous-off"><a href="<?php echo $link; ?> ">«<?php
//check if feed URL is set if (!$hideerrors && ($feeddata['rsstotalitems'] == 0 || count($feeddata["items"]) == 0 || $feeddata["items"] === false)) { echo '<div>There are not feed items to display.'; echo '<ul><li>Check if RSS URL is online</li><li>Check if RSS contains items</li>'; if ($filtermode > 0) { echo '<li>Check the #Keyword Filter# parameter. Change the keywords or remove them</li>'; } echo '</ul></div>'; return; } jimport('joomla.filesystem.file'); $items = modFeedShowHelper::getRows($feeddata["items"], $params); // Get RSS News if ($pagination && $feeddata !== false) { $maxitems = $feeddata["rsstotalitems"] > $amount ? $amount : $feeddata["rsstotalitems"]; $current_page = modFeedShowHelper::getPage($module->id); $pages = (int) ceil($maxitems / $pagination_items); $amount = $pagination_items; # rows } #Auto-calculate values $tbrows = $tbcolumns == 1 ? $amount : ceil($amount / $tbcolumns); $unit = JString::strpos($tablewidth, '%') > 0 ? '%' : 'px'; if ($cwidth == 'auto' || $cwidth == 0) { $cwidth = round($tablewidth / $tbcolumns, 2) . $unit; } ?> <!-- Web-Expert.gr Ultimate Feed Display Starts here --> <?php #########Load tmpl, you can customize it, overriding to templates/template-name/html/mod_we_ufeed_display/FOLDERNAME/default.php ######### require JModuleHelper::getLayoutPath('mod_we_ufeed_display', $params->get('layout', 'default') . DS . 'default');