Source for file frontend.html.php

Documentation is available at frontend.html.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @author Mambo Foundation Inc see README.php
  5. @copyright Mambo Foundation Inc.
  6. *  See COPYRIGHT.php for copyright notices and details.
  7. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
  8. *  LICENSE.php
  9. *  Mambo is free software; you can redistribute it and/or
  10. *  modify it under the terms of the GNU General Public License
  11. *  as published by the Free Software Foundation; version 2 of the
  12. *  License.
  13. */ 
  14.  
  15. /** ensure this file is being included by a parent file */
  16. defined'_VALID_MOS' or die'Direct Access to this location is not allowed.' );
  17.  
  18. class modules_html {
  19.  
  20.     function module&$module&$params$Itemid$style={
  21.         global $mosConfig_live_site$mosConfig_sitename$mosConfig_lang;
  22.         $mosConfig_absolute_path mamboCore::get('mosConfig_absolute_path');
  23.         // custom module params
  24.         $rssurl             $params->get'rssurl' );
  25.         $rssitems             $params->get'rssitems');
  26.         $rssdesc             $params->get'rssdesc');
  27.         $rssimage             $params->get'rssimage');
  28.         $rssitemdesc        $params->get'rssitemdesc');
  29.         $moduleclass_sfx     $params->get'moduleclass_sfx' );
  30.         $words                 $params->def'word_count');
  31.  
  32.         if ($style == -&& !$rssurl{
  33.             echo $module->content;
  34.             return;
  35.         else {
  36.             ?>
  37.             <table cellpadding="0" cellspacing="0" class="moduletable<?php echo $moduleclass_sfx?>">
  38.             <?php
  39.             if $module->showtitle != {
  40.                 ?>
  41.                 <tr>
  42.                     <th valign="top">
  43.                     <?php echo $module->title?>
  44.                     </th>
  45.                 </tr>
  46.                 <?php
  47.             }
  48.  
  49.             if $module->content {
  50.                 ?>
  51.                 <tr>
  52.                     <td>
  53.                     <?php echo $module->content?>
  54.                     </td>
  55.                 </tr>
  56.                 <?php
  57.             }
  58.         }
  59.         // feed output
  60.         if $rssurl {
  61.             if (!defined('MAGPIE_CACHE_DIR')) define ('MAGPIE_CACHE_DIR'mamboCore::get('mosConfig_absolute_path').'/includes/magpie_cache');
  62.             require_once (mamboCore::get('mosConfig_absolute_path').'/includes/magpierss/rss_fetch.php');
  63.             $rss fetch_rss($rssurl);
  64.             if (isset($rss->image['title'])) $iTitle $rss->image['title'];
  65.             if (isset($rss->image['url'])) $iUrl $rss->image['url'];
  66.             // feed title
  67.             ?>
  68.             <tr>
  69.                 <td>
  70.                 <strong>
  71.                 <a href="<?php echo $rss->channel['link']?>" target="_blank">
  72.                 <?php echo $rss->channel['title']?>
  73.                 </a>
  74.                 </strong>
  75.                 </td>
  76.             </tr>
  77.             <?php
  78.             // feed description
  79.             if $rssdesc {
  80.                 ?>
  81.                 <tr>
  82.                     <td>
  83.                     <?php echo $rss->channel['description']?>
  84.                     </td>
  85.                 </tr>
  86.                 <?php
  87.             }
  88.             // feed image
  89.             if $rssimage AND isset($iUrl) ) {
  90.                 ?>
  91.                 <tr>
  92.                     <td align="center">
  93.                     <image src="<?php echo $iUrl?>" alt="<?php echo $iTitle?>"/>
  94.                     </td>
  95.                 </tr>
  96.                 <?php
  97.             }
  98.             $itemnumber 1;
  99.             ?>
  100.             <tr>
  101.                 <td>
  102.                 <ul class="newsfeed<?php echo $moduleclass_sfx?>">
  103.             <?php
  104.             foreach ($rss->items as $item{
  105.                 if ($itemnumber $rssitemsbreak;
  106.                 $itemnumber++;
  107.                 // item title
  108.                 ?>
  109.                 <li class="newsfeed<?php echo $moduleclass_sfx?>">
  110.                 <strong>
  111.                 <a href="<?php echo $item['link']?>" target="_blank">
  112.                 <?php echo $item['title']?>
  113.                 </a>
  114.                 </strong>
  115.                 <?php
  116.                 // item description
  117.                 if $rssitemdesc {
  118.                     // item description
  119.                     $text html_entity_decode$item['description');
  120.                         // word limit check
  121.                     if $words {
  122.                         $texts explode' '$text );
  123.                         $count count$texts );
  124.                         if $count $words {
  125.                             $text '';
  126.                             for$i=0$i $words$i++ {
  127.                                 $text .= ' '$texts[$i];
  128.                             }
  129.                             $text .= '...';
  130.                         }
  131.                     }
  132.                     ?>
  133.                     <div>
  134.                     <?php echo $text?>
  135.                     </div>
  136.                     <?php
  137.                 }
  138.                 ?>
  139.                 </li>
  140.                 <?php
  141.             }
  142.             ?>
  143.             </ul>
  144.             </td>
  145.             </tr>
  146.             <?php
  147.         }
  148.         ?>
  149.         </table>
  150.         <?php
  151.     }
  152.  
  153.     /**
  154.     * @param object 
  155.     * @param object 
  156.     * @param int The menu item ID
  157.     * @param int -1=show without wrapper and title, -2=x-mambo style
  158.     */
  159.     function module2&$module&$params$Itemid$style=0$count={
  160.         global $mosConfig_live_site$mosConfig_sitename$mosConfig_lang;
  161.         global $mainframe$database$my;
  162.         $mosConfig_absolute_path mamboCore::get('mosConfig_absolute_path');
  163.         $moduleclass_sfx         $params->get'moduleclass_sfx' );
  164.         $number '';
  165.         if ($count 0$number '<span>' $count '</span> ';
  166.         
  167.         if ($style == -3{
  168.             // allows for rounded corners
  169.             echo "\n<div class=\"module$moduleclass_sfx\"><div><div><div>";
  170.             if ($module->showtitle != 0echo "<h3>$module->title</h3>\n";
  171.             include$mosConfig_absolute_path .'/modules/'$module->module .'.php' );
  172.             if (isset$content)) echo $content;
  173.             echo "\n\n</div></div></div></div>\n";
  174.             
  175.         else if ($style == -2{
  176.             // headder and content encapsulated with div tag
  177.             ?>
  178.             <div id="moduletable<?php echo $moduleclass_sfx?>">
  179.             <?php
  180.             if ($module->showtitle != 0{
  181.                 ?>
  182.                 <h1><?php echo $module->title?></h1>
  183.                 <?php
  184.             }
  185.             include$mosConfig_absolute_path .'/modules/'$module->module .'.php' );
  186.             if (isset$content)) echo $content;
  187.             ?>
  188.             </div>
  189.             <?php
  190.             
  191.         else if ($style == -1{
  192.             // show a naked module - no wrapper and no title
  193.             include$mosConfig_absolute_path .'/modules/'$module->module .'.php' );
  194.             if (isset$content)) echo $content;
  195.             
  196.         else {
  197.             ?>
  198.             <table cellpadding="0" cellspacing="0" class="moduletable<?php echo $moduleclass_sfx?>">
  199.             <?php
  200.             if $module->showtitle != {
  201.                 ?>
  202.                 <tr>
  203.                     <th valign="top">
  204.                     <?php echo $module->title?>
  205.                     </th>
  206.                 </tr>
  207.                 <?php
  208.             }
  209.             ?>
  210.             <tr>
  211.                 <td>
  212.                 <?php
  213.                 include$mosConfig_absolute_path '/modules/' $module->module '.php' );
  214.                 if (isset$content)) echo $content;
  215.                 ?>
  216.                 </td>
  217.             </tr>
  218.             </table>
  219.             <?php
  220.         }
  221.     }
  222. }
  223. ?>

Documentation generated on Mon, 05 May 2008 16:19:45 +0400 by phpDocumentor 1.4.0