| Current Path : /home/digilove/public_html/plugins/system/nnframework/fields/ |
| Current File : /home/digilove/public_html/plugins/system/nnframework/fields/loadlanguage.php |
<?php
/**
* Element: Load Language
* Loads the English language file as fallback
*
* @package NoNumber Framework
* @version 14.11.6
*
* @author Peter van Westen <peter@nonumber.nl>
* @link http://www.nonumber.nl
* @copyright Copyright © 2014 NoNumber All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
class JFormFieldNN_LoadLanguage extends JFormField
{
public $type = 'LoadLanguage';
private $params = null;
protected function getLabel()
{
return '';
}
protected function getInput()
{
$this->params = $this->element->attributes();
$extension = $this->get('extension');
$admin = $this->get('admin', 1);
self::loadLanguage($extension, $admin);
return '';
}
function loadLanguage($extension, $admin = 1)
{
if ($extension)
{
JFactory::getLanguage()->load($extension, $admin ? JPATH_ADMINISTRATOR : JPATH_SITE);
}
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}