- md5
- 0ca120f960bc43fc03add1c651c18dce
- sha1
- 7f824cbe8d8c068cc01af81f007fe11a09270a17
- sha256
- 21dd4400c006eab99dd8654a83f5027fdbf2da23d3e6b535236513f64947e21f
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
<?php
/**
* @package Joomla.Libraries
* @subpackage Language
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
/**
* Utitlity class for multilang
*
* @package Joomla.Libraries
* @subpackage Language
* @since 2.5.4
*/
class JLanguageMultilang
{
/**
* Method to determine if the language filter plugin is enabled.
* This works for both site and administrator.
*
* @return boolean True if site is supporting multiple languages; false otherwise.
*
* @since 2.5.4
*/
public static function isEnabled()
{
// Flag to avoid doing multiple database queries.
static $tested = false;
// Status of language filter plugin.
static $enabled = false;
// Get application object.
$app = JFactory::getApplication();
// If being called from the front-end, we can avoid the database query.
if ($app->isSite())
{
$enabled = $app->getLanguageFilter();
return $enabled;
}
// If already tested, don't test again.
if (!$tested)
{
// Determine status of language filter plug-in.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('enabled');
$query->from($db->quoteName('#__extensions'));
$query->where($db->quoteName('type') . ' = ' . $db->quote('plugin'));
$query->where($db->quoteName('folder') . ' = ' . $db->quote('system'));
$query->where($db->quoteName('element') . ' = ' . $db->quote('languagefilter'));
$db->setQuery($query);
$enabled = $db->loadResult();
$tested = true;
}
return $enabled;
}
}
The same content is in 8 releases, Joomla 2.5.4 to 3.0.2. See them all, or every version of this file.