| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: module.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla.Framework 5 * @subpackage Document 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant 9 * to the GNU General Public License, and as distributed it includes or 10 * is derivative of works licensed under the GNU General Public License or 11 * other free or open source software licenses. 12 * See COPYRIGHT.php for copyright notices and details. 13 */ 14 15 // Check to ensure this file is within the rest of the framework 16 defined('JPATH_BASE') or die(); 17 18 /** 19 * JDocument Module renderer 20 * 21 * @package Joomla.Framework 22 * @subpackage Document 23 * @since 1.5 24 */ 25 class JDocumentRendererModule extends JDocumentRenderer 26 { 27 /** 28 * Renders a module script and returns the results as a string 29 * 30 * @access public 31 * @param string $name The name of the module to render 32 * @param array $params Associative array of values 33 * @return string The output of the script 34 */ 35 function render( $module, $params = array(), $content = null ) 36 { 37 if (!is_object($module)) 38 { 39 $title = isset($params['title']) ? $params['title'] : null; 40 41 $module =& JModuleHelper::getModule($module, $title); 42 43 if (!is_object($module)) 44 { 45 if (is_null($content)) { 46 return ''; 47 } else { 48 /** 49 * If module isn't found in the database but data has been pushed in the buffer 50 * we want to render it 51 */ 52 $tmp = $module; 53 $module = new stdClass(); 54 $module->params = null; 55 $module->module = $tmp; 56 $module->id = 0; 57 $module->user = 0; 58 } 59 } 60 } 61 62 // get the user and configuration object 63 $user =& JFactory::getUser(); 64 $conf =& JFactory::getConfig(); 65 66 // set the module content 67 if (!is_null($content)) { 68 $module->content = $content; 69 } 70 71 //get module parameters 72 $mod_params = new JParameter( $module->params ); 73 74 $contents = ''; 75 if ($mod_params->get('cache', 0) && $conf->getValue( 'config.caching' )) 76 { 77 $cache =& JFactory::getCache( $module->module ); 78 79 $cache->setLifeTime( $mod_params->get( 'cache_time', $conf->getValue( 'config.cachetime' ) * 60 ) ); 80 $cache->setCacheValidation(true); 81 82 $contents = $cache->get( array('JModuleHelper', 'renderModule'), array( $module, $params ), $module->id. $user->get('aid', 0) ); 83 } else { 84 $contents = JModuleHelper::renderModule($module, $params); 85 } 86 87 return $contents; 88 } 89 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |