Source code for file /joomla/application/component/helper.php
Documentation is available at helper.php
* @version $Id: helper.php 9918 2008-01-10 01:41:37Z pasamio $
* @package Joomla.Framework
* @subpackage Application
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
// Check to ensure this file is within the rest of the framework
* @author Johan Janssens <johan.janssens@joomla.org>
* @package Joomla.Framework
* @subpackage Application
* @param string $name The component name
* @param boolean $string If set and a component does not exist, the enabled attribue will be set to false
* @return object A JComponent object
if (isset
( $components[$name] ))
$result =
&$components[$name];
$result =
new stdClass();
$result->enabled =
$strict ?
false :
true;
* Checks if the component is enabled
* @param string $component The component name
* @param boolean $string If set and a component does not exist, false will be returned
function isEnabled( $component, $strict =
false )
return ($result->enabled |
$mainframe->isAdmin());
* Gets the parameter object for the component
* @param string $name The component name
* @return object A JParameter object
if (!isset
( $instances[$name] ))
$instances[$name] =
new JParameter($component->params);
return $instances[$name];
global $mainframe, $option;
// Throw 404 if no component
$scope =
$mainframe->scope; //record the scope
$mainframe->scope =
$name; //set scope to component name
// Build the component path
define( 'JPATH_COMPONENT', JPATH_BASE.
DS.
'components'.
DS.
$name);
define( 'JPATH_COMPONENT_SITE', JPATH_SITE.
DS.
'components'.
DS.
$name);
define( 'JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR.
DS.
'components'.
DS.
$name);
if ( $mainframe->isAdmin() &&
file_exists(JPATH_COMPONENT.
DS.
'admin.'.
$file.
'.php') ) {
$path =
JPATH_COMPONENT.
DS.
'admin.'.
$file.
'.php';
$path =
JPATH_COMPONENT.
DS.
$file.
'.php';
// If component disabled throw error
// Handle legacy globals if enabled
if ($mainframe->getCfg('legacy'))
// Include legacy globals
global $my, $database, $id, $acl, $task;
// For backwards compatibility extract the config vars as globals
$varname =
'mosConfig_'.
$k;
$varname =
'mosConfig_'.
$k;
$varname =
'mosConfig_'.
$k;
// Load common language files
// Handle template preview outlining
// Build the component toolbar
jimport( 'joomla.application.helper' );
// Get the task again, in case it has changed
$mainframe->scope =
$scope; //revert the scope
if (isset
($components)) {
if (!($components =
$db->loadObjectList( 'option' ))) {
JError::raiseWarning( 'SOME_ERROR_CODE', "Error loading Components: " .
$db->getErrorMsg());