本文整理汇总了PHP中JApplication::initialise方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplication::initialise方法的具体用法?PHP JApplication::initialise怎么用?PHP JApplication::initialise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JApplication
的用法示例。
在下文中一共展示了JApplication::initialise方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialise
/**
* 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);
}
示例2: initialise
/**
* 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);
}
示例3: initialise
/**
* 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);
}
示例4: initialise
/**
* 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);
}
示例5: initialise
/**
* 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);
}