Source for file helper.php
Documentation is available at helper.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* The component list cache
protected static $libraries =
array();
* Get the library information.
* @param string $element Element of the library in the extensions table.
* @param boolean $strict If set and the library does not exist, the enabled attribute will be set to false.
* @return object An object with the library's information.
public static function getLibrary($element, $strict =
false)
if (isset
(static::$libraries[$element]))
return static::$libraries[$element];
if (static::_load($element))
$result =
static::$libraries[$element];
$result->enabled =
$strict ?
false :
true;
* Checks if a library is enabled
* @param string $element Element of the library in the extensions table.
$result =
static::getLibrary($element, true);
* Gets the parameter object for the library
* @param string $element Element of the library in the extensions table.
* @param boolean $strict If set and the library does not exist, false will be returned
* @return JRegistry A JRegistry object.
public static function getParams($element, $strict =
false)
$library =
static::getLibrary($element, $strict);
* Save the parameters object for the library
* @param string $element Element of the library in the extensions table.
* @param JRegistry $params Params to save
* @return JRegistry A JRegistry object.
public static function saveParams($element, $params)
if (static::isEnabled($element))
$db =
JFactory::getDbo();
$query =
$db->getQuery(true)
->update($db->quoteName('#__extensions'))
->set($db->quoteName('params') .
' = ' .
$db->quote($params->toString()))
->where($db->quoteName('type') .
' = ' .
$db->quote('library'))
->where($db->quoteName('element') .
' = ' .
$db->quote($element));
// Update params in libraries cache
if ($result && isset
(static::$libraries[$element]))
static::$libraries[$element]->params =
$params;
* Load the installed libraryes into the libraries property.
* @param string $element The element value for the extension
* @return boolean True on success
protected static function _load($element)
$query =
$db->getQuery(true)
->select('extension_id AS id, element AS "option", params, enabled')
->where($db->quoteName('type') .
' = ' .
$db->quote('library'))
->where($db->quoteName('element') .
' = ' .
$db->quote($element));
static::$libraries[$element] =
$cache->get(array($db, 'loadObject'), null, $element, false);
catch
(RuntimeException $e)
JLog::add(JText::sprintf('JLIB_APPLICATION_ERROR_LIBRARY_NOT_LOADING', $element, $e->getMessage()), JLog::WARNING, 'jerror');
if (empty(static::$libraries[$element]))
$error =
JText::_('JLIB_APPLICATION_ERROR_LIBRARY_NOT_FOUND');
JLog::add(JText::sprintf('JLIB_APPLICATION_ERROR_LIBRARY_NOT_LOADING', $element, $error), JLog::WARNING, 'jerror');
// Convert the params to an object.
if (is_string(static::$libraries[$element]->params))
$temp->loadString(static::$libraries[$element]->params);
static::$libraries[$element]->params =
$temp;
Documentation generated on Tue, 19 Nov 2013 15:04:38 +0100 by phpDocumentor 1.4.3