| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @subpackage Newsfeeds 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 /** ensure this file is being included by a parent file */ 18 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 19 20 class HTML_newsfeed { 21 22 function displaylist( &$categories, &$rows, $catid, $currentcat=NULL, &$params, $tabclass ) { 23 global $Itemid, $mosConfig_live_site, $hide_js; 24 if ( $params->get( 'page_title' ) ) { 25 ?> 26 <div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>"> 27 <?php echo $currentcat->header; ?> 28 </div> 29 <?php 30 } 31 ?> 32 <form action="index.php" method="post" name="adminForm"> 33 34 <table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>"> 35 <tr> 36 <td width="60%" valign="top" class="contentdescription<?php echo $params->get( 'pageclass_sfx' ); ?>" colspan="2"> 37 <?php 38 // show image 39 if ( $currentcat->img ) { 40 ?> 41 <img src="<?php echo $currentcat->img; ?>" align="<?php echo $currentcat->align; ?>" hspace="6" alt="<?php echo T_('Web Links'); ?>" /> 42 <?php 43 } 44 echo $currentcat->descrip; 45 ?> 46 </td> 47 </tr> 48 <tr> 49 <td> 50 <?php 51 if ( count( $rows ) ) { 52 HTML_newsfeed::showTable( $params, $rows, $catid, $tabclass ); 53 } 54 ?> 55 </td> 56 </tr> 57 <tr> 58 <td> 59 60 </td> 61 </tr> 62 <tr> 63 <td> 64 <?php 65 // Displays listing of Categories 66 if ( ( $params->get( 'type' ) == 'category' ) && $params->get( 'other_cat' ) ) { 67 HTML_newsfeed::showCategories( $params, $categories, $catid ); 68 } else if ( ( $params->get( 'type' ) == 'section' ) && $params->get( 'other_cat_section' ) ) { 69 HTML_newsfeed::showCategories( $params, $categories, $catid ); 70 } 71 ?> 72 </td> 73 </tr> 74 </table> 75 </form> 76 <?php 77 // displays back button 78 mosHTML::BackButton ( $params, $hide_js ); 79 } 80 81 /** 82 * Display Table of items 83 */ 84 function showTable( &$params, &$rows, $catid, $tabclass ) { 85 global $mosConfig_live_site, $Itemid; 86 // icon in table display 87 $mainframe =& mosMainFrame::getInstance(); 88 $img = $mainframe->ImageCheck( 'con_info.png', '/images/M_images/', $params->get( 'icon' ) ); 89 ?> 90 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"> 91 <?php 92 if ( $params->get( 'headings' ) ) { 93 ?> 94 <tr> 95 <?php 96 if ( $params->get( 'name' ) ) { 97 ?> 98 <td height="20" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>"> 99 <?php echo T_('Feed Name'); ?> 100 </td> 101 <?php 102 } 103 ?> 104 <?php 105 if ( $params->get( 'articles' ) ) { 106 ?> 107 <td height="20" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" align="center"> 108 <?php echo T_('# Articles'); ?> 109 </td> 110 <?php 111 } 112 ?> 113 <?php 114 if ( $params->get( 'link' ) ) { 115 ?> 116 <td height="20" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>"> 117 <?php echo T_('Feed Link'); ?> 118 </td> 119 <?php 120 } 121 ?> 122 <td width="100%" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>"></td> 123 </tr> 124 <?php 125 } 126 127 $k = 0; 128 foreach ($rows as $row) { 129 $link = 'index.php?option=com_newsfeeds&task=view&feedid='. $row->id .'&Itemid='. $Itemid; 130 ?> 131 <tr> 132 <?php 133 if ( $params->get( 'name' ) ) { 134 ?> 135 <td width="30%" height="20" class="<?php echo $tabclass[$k]; ?>"> 136 <a href="<?php echo sefRelToAbs( $link ); ?>" class="category<?php echo $params->get( 'pageclass_sfx' ); ?>"> 137 <?php echo $row->name; ?> 138 </a> 139 </td> 140 <?php 141 } 142 ?> 143 <?php 144 if ( $params->get( 'articles' ) ) { 145 ?> 146 <td width="20%" class="<?php echo $tabclass[$k]; ?>" align="center"> 147 <?php echo $row->numarticles; ?> 148 </td> 149 <?php 150 } 151 ?> 152 <?php 153 if ( $params->get( 'link' ) ) { 154 ?> 155 <td width="50%" class="<?php echo $tabclass[$k]; ?>"> 156 <?php echo $row->link; ?> 157 </td> 158 <?php 159 } 160 ?> 161 <td width="100%"></td> 162 </tr> 163 <?php 164 $k = 1 - $k; 165 } 166 ?> 167 </table> 168 <?php 169 } 170 171 /** 172 * Display links to categories 173 */ 174 function showCategories( &$params, &$categories, $catid ) { 175 global $mosConfig_live_site, $Itemid; 176 ?> 177 <ul> 178 <?php 179 foreach ((array) $categories as $cat ) { 180 if ( $catid == $cat->catid ) { 181 ?> 182 <li> 183 <strong> 184 <?php echo $cat->title;?> 185 </strong> 186 187 <span class="small"> 188 (<?php echo $cat->numlinks;?>) 189 </span> 190 </li> 191 <?php 192 } else { 193 $link = 'index.php?option=com_newsfeeds&catid='. $cat->catid .'&Itemid='. $Itemid; 194 ?> 195 <li> 196 <a href="<?php echo sefRelToAbs( $link ); ?>" class="category<?php echo $params->get( 'pageclass_sfx' ); ?>"> 197 <?php echo $cat->title;?> 198 </a> 199 <?php 200 if ( $params->get( 'cat_items' ) ) { 201 ?> 202 203 <span class="small"> 204 (<?php echo $cat->numlinks;?>) 205 </span> 206 <?php 207 } 208 ?> 209 <?php 210 // Writes Category Description 211 if ( $params->get( 'cat_description' ) ) { 212 echo '<br />'; 213 echo $cat->description; 214 } 215 ?> 216 </li> 217 <?php 218 } 219 } 220 ?> 221 </ul> 222 <?php 223 } 224 225 226 function showNewsfeeds( &$newsfeeds, &$params ) { 227 global $mosConfig_live_site, $mosConfig_absolute_path; 228 ?> 229 <table width="100%" class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>"> 230 <?php 231 if ( $params->get( 'header' ) ) { 232 ?> 233 <tr> 234 <td class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" colspan="2"> 235 <?php echo $params->get( 'header' ); ?> 236 </td> 237 </tr> 238 <?php 239 } 240 241 if (!defined('MAGPIE_CACHE_DIR')) define ('MAGPIE_CACHE_DIR', mamboCore::get('mosConfig_absolute_path').'/includes/magpie_cache'); 242 require_once (mamboCore::get('mosConfig_absolute_path').'/includes/magpierss/rss_fetch.php'); 243 foreach ( $newsfeeds as $newsfeed ) { 244 $rss = fetch_rss($newsfeed->link); 245 if (!is_object($rss)) { 246 echo '<tr><td><span>RSS feed failed</span></td></tr>'; 247 break; 248 } 249 if (isset($rss->image['title'])) $iTitle = $rss->image['title']; 250 if (isset($rss->image['url'])) $iUrl = $rss->image['url']; 251 ?> 252 <tr> 253 <td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>"> 254 <a href="<?php echo $rss->channel['link']; ?>" target="_child"> 255 <?php echo $rss->channel['title']; ?> 256 </a> 257 </td> 258 </tr> 259 <?php 260 // feed description 261 if ( $params->get( 'feed_descr' ) ) { 262 ?> 263 <tr> 264 <td> 265 <?php if (isset($rss->channel['description'])) echo $rss->channel['description']; ?> 266 <br /><br /> 267 </td> 268 </tr> 269 <?php 270 } 271 // feed image 272 if ( isset($iUrl) && $params->get( 'feed_image' ) ) { 273 ?> 274 <tr> 275 <td> 276 <img src="<?php echo $iUrl; ?>" alt="<?php echo $iTitle; ?>" /> 277 </td> 278 </tr> 279 <?php 280 } 281 ?> 282 <tr> 283 <td> 284 <ul> 285 <?php 286 $itemnumber = 1; 287 foreach ($rss->items as $item) { 288 if ($itemnumber > $newsfeed->numarticles) break; 289 $itemnumber++; 290 ?> 291 <li> 292 <a href="<?php echo $item['link']; ?>" target="_child"> 293 <?php echo $item['title']; ?> 294 </a> 295 <?php 296 // item description 297 if ( $params->get( 'item_descr' ) ) { 298 $text = html_entity_decode( $item['description'] ); 299 $num = $params->get( 'word_count' ); 300 301 // word limit check 302 if ( $num ) { 303 $texts = explode( ' ', $text ); 304 $count = count( $texts ); 305 if ( $count > $num ) { 306 $text = ''; 307 for( $i=0; $i < $num; $i++ ) { 308 $text .= ' '. $texts[$i]; 309 } 310 $text .= '...'; 311 } 312 } 313 ?> 314 <br /> 315 <?php echo $text; ?> 316 <br /><br /> 317 <?php 318 } 319 ?> 320 </li> 321 <?php 322 } 323 ?> 324 </ul> 325 </td> 326 </tr> 327 <tr> 328 <td> 329 <br /> 330 </td> 331 </tr> 332 <?php 333 } 334 ?> 335 </table> 336 <?php 337 // displays back button 338 mosHTML::BackButton ( $params ); 339 } 340 341 } 342 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |