00001 <?php
00002
00003
00004
00005
00015 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
00016
00020 class modules_html {
00021
00022 function module( &$module, &$params, $Itemid, $style=0 ) {
00023 global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_lang;
00024 $mosConfig_absolute_path = aliroCore::get('mosConfig_absolute_path');
00025
00026 $rssurl = $params->get( 'rssurl' );
00027 $rssitems = $params->get( 'rssitems', 5 );
00028 $rssdesc = $params->get( 'rssdesc', 1 );
00029 $rssimage = $params->get( 'rssimage', 1 );
00030 $rssitemdesc = $params->get( 'rssitemdesc', 1 );
00031 $moduleclass_sfx = $params->get( 'moduleclass_sfx' );
00032 $words = $params->def( 'word_count', 0 );
00033
00034 if ($style == -1 && !$rssurl) {
00035 echo $module->content;
00036 return;
00037 } else {
00038 ?>
00039 <table cellpadding="0" cellspacing="0" class="moduletable<?php echo $moduleclass_sfx; ?>">
00040 <?php
00041 if ( $module->showtitle != 0 ) {
00042 ?>
00043 <tr>
00044 <th valign="top">
00045 <?php echo $module->title; ?>
00046 </th>
00047 </tr>
00048 <?php
00049 }
00050
00051 if ( $module->content ) {
00052 ?>
00053 <tr>
00054 <td>
00055 <?php echo $module->content; ?>
00056 </td>
00057 </tr>
00058 <?php
00059 }
00060 }
00061
00062 if ( $rssurl ) {
00063 if (!defined('MAGPIE_CACHE_DIR')) define ('MAGPIE_CACHE_DIR', aliroCore::get('mosConfig_absolute_path').'/includes/magpie_cache');
00064 require_once (aliroCore::get('mosConfig_absolute_path').'/includes/magpierss/rss_fetch.php');
00065 $rss = fetch_rss($rssurl);
00066 if (isset($rss->image['title'])) $iTitle = $rss->image['title'];
00067 if (isset($rss->image['url'])) $iUrl = $rss->image['url'];
00068
00069 ?>
00070 <tr>
00071 <td>
00072 <strong>
00073 <a href="<?php echo $rss->channel['link']; ?>" target="_blank">
00074 <?php echo $rss->channel['title']; ?>
00075 </a>
00076 </strong>
00077 </td>
00078 </tr>
00079 <?php
00080
00081 if ( $rssdesc ) {
00082 ?>
00083 <tr>
00084 <td>
00085 <?php echo $rss->channel['description']; ?>
00086 </td>
00087 </tr>
00088 <?php
00089 }
00090
00091 if ( $rssimage AND isset($iUrl) ) {
00092 ?>
00093 <tr>
00094 <td align="center">
00095 <image src="<?php echo $iUrl; ?>" alt="<?php echo $iTitle; ?>"/>
00096 </td>
00097 </tr>
00098 <?php
00099 }
00100 $itemnumber = 1;
00101 ?>
00102 <tr>
00103 <td>
00104 <ul class="newsfeed<?php echo $moduleclass_sfx; ?>">
00105 <?php
00106 foreach ($rss->items as $item) {
00107 if ($itemnumber > $rssitems) break;
00108 $itemnumber++;
00109
00110 ?>
00111 <li class="newsfeed<?php echo $moduleclass_sfx; ?>">
00112 <strong>
00113 <a href="<?php echo $item['link']; ?>" target="_blank">
00114 <?php echo $item['title']; ?>
00115 </a>
00116 </strong>
00117 <?php
00118
00119 if ( $rssitemdesc ) {
00120
00121 $text = html_entity_decode( $item['description'] );
00122
00123 if ( $words ) {
00124 $texts = explode( ' ', $text );
00125 $count = count( $texts );
00126 if ( $count > $words ) {
00127 $text = '';
00128 for( $i=0; $i < $words; $i++ ) {
00129 $text .= ' '. $texts[$i];
00130 }
00131 $text .= '...';
00132 }
00133 }
00134 ?>
00135 <div>
00136 <?php echo $text; ?>
00137 </div>
00138 <?php
00139 }
00140 ?>
00141 </li>
00142 <?php
00143 }
00144 ?>
00145 </ul>
00146 </td>
00147 </tr>
00148 <?php
00149 }
00150 ?>
00151 </table>
00152 <?php
00153 }
00154
00155 }