Ejemplo n.º 1
0
 /**
  * Initialise the application.
  *
  * @param	array	$options	An optional associative array of configuration settings.
  *
  * @return	void
  * @since	1.5
  */
 public function initialise($options = array())
 {
     $config = JFactory::getConfig();
     // if a language was specified it has priority
     // otherwise use user or default language settings
     if (empty($options['language'])) {
         $user = JFactory::getUser();
         $lang = $user->getParam('admin_language');
         // Make sure that the user's language exists
         if ($lang && JLanguage::exists($lang)) {
             $options['language'] = $lang;
         } else {
             $params = JComponentHelper::getParams('com_languages');
             $client = JApplicationHelper::getClientInfo($this->getClientId());
             $options['language'] = $params->get($client->name, $config->get('language', 'es-LA'));
         }
     }
     // One last check to make sure we have something
     if (!JLanguage::exists($options['language'])) {
         $lang = $config->get('language', 'es-LA');
         if (JLanguage::exists($lang)) {
             $options['language'] = $lang;
         } else {
             $options['language'] = 'es-LA';
             // as a last ditch fail to english
         }
     }
     // Execute the parent initialise method.
     parent::initialise($options);
     // Load Library language
     $lang = JFactory::getLanguage();
     $lang->load('lib_joomla', JPATH_ADMINISTRATOR, null, false, true);
 }
Ejemplo n.º 2
0
	/**
	* Initialise the application.
	*
	* @access public
	*/
	function initialise( $options = array())
	{
		// if a language was specified it has priority
		// otherwise use user or default language settings
		if (empty($options['language']))
		{
			$user = & JFactory::getUser();
			$lang	= $user->getParam( 'language' );

			// Make sure that the user's language exists
			if ( $lang && JLanguage::exists($lang) ) {
				$options['language'] = $lang;
			} 
			else 
			{
				$params =  JComponentHelper::getParams('com_extensions');
				$client	=& JApplicationHelper::getClientInfo($this->getClientId());
				$options['language'] = $params->get('language_'.$client->name, 'en-GB');
			}

		}

		// One last check to make sure we have something
		if ( ! JLanguage::exists($options['language']) ) {
			$options['language'] = 'en-GB';
		}

		parent::initialise($options);
	}
Ejemplo n.º 3
0
 /**
  * Initialise the application.
  *
  * @param	array	An optional associative array of configuration settings.
  */
 function initialise($options = array())
 {
     $config =& JFactory::getConfig();
     // if a language was specified it has priority
     // otherwise use user or default language settings
     if (empty($options['language'])) {
         $user =& JFactory::getUser();
         $lang = $user->getParam('admin_language');
         // Make sure that the user's language exists
         if ($lang && JLanguage::exists($lang)) {
             $options['language'] = $lang;
         } else {
             $params = JComponentHelper::getParams('com_languages');
             $client =& JApplicationHelper::getClientInfo($this->getClientId());
             $options['language'] = $params->get($client->name, $config->getValue('config.language', 'en-GB'));
         }
     }
     // One last check to make sure we have something
     if (!JLanguage::exists($options['language'])) {
         $lang = $config->getValue('config.language', 'en-GB');
         if (JLanguage::exists($lang)) {
             $options['language'] = $lang;
         } else {
             $options['language'] = 'en-GB';
             // as a last ditch fail to english
         }
     }
     parent::initialise($options);
 }
Ejemplo n.º 4
0
 /**
  * Initialise the application.
  *
  * @param   array
  */
 public function initialise($options = array())
 {
     $config = JFactory::getConfig();
     $user = JFactory::getUser();
     // If the user is a guest we populate it with the guest user group.
     if ($user->guest) {
         $guestUsergroup = JComponentHelper::getParams('com_users')->get('guest_usergroup', 1);
         $user->groups = array($guestUsergroup);
     }
     // if a language was specified it has priority
     // otherwise use user or default language settings
     JPluginHelper::importPlugin('system', 'languagefilter');
     if (empty($options['language'])) {
         $lang = $this->input->getString('language', null);
         if ($lang && JLanguage::exists($lang)) {
             $options['language'] = $lang;
         }
     }
     if ($this->_language_filter && empty($options['language'])) {
         // Detect cookie language
         $lang = $this->input->getString(self::getHash('language'), null, 'cookie');
         // Make sure that the user's language exists
         if ($lang && JLanguage::exists($lang)) {
             $options['language'] = $lang;
         }
     }
     if (empty($options['language'])) {
         // Detect user language
         $lang = $user->getParam('language');
         // Make sure that the user's language exists
         if ($lang && JLanguage::exists($lang)) {
             $options['language'] = $lang;
         }
     }
     if ($this->_detect_browser && empty($options['language'])) {
         // Detect browser language
         $lang = JLanguageHelper::detectLanguage();
         // Make sure that the user's language exists
         if ($lang && JLanguage::exists($lang)) {
             $options['language'] = $lang;
         }
     }
     if (empty($options['language'])) {
         // Detect default language
         $params = JComponentHelper::getParams('com_languages');
         $client = JApplicationHelper::getClientInfo($this->getClientId());
         $options['language'] = $params->get($client->name, $config->get('language', 'en-GB'));
     }
     // One last check to make sure we have something
     if (!JLanguage::exists($options['language'])) {
         $lang = $config->get('language', 'en-GB');
         if (JLanguage::exists($lang)) {
             $options['language'] = $lang;
         } else {
             $options['language'] = 'en-GB';
             // as a last ditch fail to english
         }
     }
     // Execute the parent initialise method.
     parent::initialise($options);
     // Load Library language
     $lang = JFactory::getLanguage();
     // Try the lib_joomla file in the current language (without allowing the loading of the file in the default language)
     $lang->load('lib_joomla', JPATH_SITE, null, false, false) || $lang->load('lib_joomla', JPATH_ADMINISTRATOR, null, false, false) || $lang->load('lib_joomla', JPATH_SITE, null, true) || $lang->load('lib_joomla', JPATH_ADMINISTRATOR, null, true);
 }
Ejemplo n.º 5
0
	/**
	 * Initialise the application.
	 *
	 * @param	array
	 */
	public function initialise($options = array())
	{
		$config = JFactory::getConfig();

		jimport('joomla.language.helper');

		if (empty($options['language'])) {
			$lang = JRequest::getString('language', null);
			if ($lang && JLanguage::exists($lang)) {
				$options['language'] = $lang;
			}
		}

		if ($this->_language_filter && empty($options['language'])) {
			// Detect cookie language
			jimport('joomla.utilities.utility');
			$lang = JRequest::getString(JUtility::getHash('language'), null ,'cookie');
			// Make sure that the user's language exists
			if ($lang && JLanguage::exists($lang)) {
				$options['language'] = $lang;
			}
		}

		if (empty($options['language'])) {
			// Detect user language
			$lang = JFactory::getUser()->getParam('language');
			// Make sure that the user's language exists
			if ($lang && JLanguage::exists($lang)) {
				$options['language'] = $lang;
			}
		}

		if ($this->_detect_browser && empty($options['language'])) {
			// Detect browser language
			$lang = JLanguageHelper::detectLanguage();
			// Make sure that the user's language exists
			if ($lang && JLanguage::exists($lang)) {
				$options['language'] = $lang;
			}
		}

		if (empty($options['language'])) {
			// Detect default language
			$params =  JComponentHelper::getParams('com_languages');
			$client	= JApplicationHelper::getClientInfo($this->getClientId());
			$options['language'] = $params->get($client->name, $config->get('language', 'en-GB'));
		}

		// One last check to make sure we have something
		if (!JLanguage::exists($options['language'])) {
			$lang = $config->get('language','en-GB');
			if (JLanguage::exists($lang)) {
				$options['language'] = $lang;
			}
			else {
				$options['language'] = 'en-GB'; // as a last ditch fail to english
			}
		}

		// Execute the parent initialise method.
		parent::initialise($options);

		// Load Library language
		$lang = JFactory::getLanguage();
		$lang->load('lib_joomla', JPATH_SITE)
		|| $lang->load('lib_joomla', JPATH_ADMINISTRATOR);

	}