JApplication/initialise: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Initialise the application.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</now... |
No edit summary |
||
| Line 19: | Line 19: | ||
| $options | | $options | ||
| array() | | array() | ||
| An optional associative array of configuration settings. | | An optional associative array of configuration settings. public | ||
|} | |} | ||
| Line 29: | Line 29: | ||
===Source Body=== | ===Source Body=== | ||
<source lang="php"> | <source lang="php"> | ||
function initialise($options = array()) | |||
{ | { | ||
jimport('joomla.plugin.helper'); | jimport('joomla.plugin.helper'); | ||
// Set the language in the class | //Set the language in the class | ||
$config = &JFactory::getConfig(); | $config =& JFactory::getConfig(); | ||
// Check that we were given a language in the array (since by default may be blank) | // Check that we were given a language in the array (since by default may be blank) | ||
if (isset($options['language'])) { | if(isset($options['language'])) { | ||
$config->setValue('config.language', $options['language']); | $config->setValue('config.language', $options['language']); | ||
} | } | ||
// Set user specific editor | // Set user specific editor | ||
$user | $user =& JFactory::getUser(); | ||
$editor = $user->getParam('editor', $this->getCfg('editor')); | $editor = $user->getParam('editor', $this->getCfg('editor')); | ||
$editor = JPluginHelper::isEnabled('editors', $editor) ? $editor : $this->getCfg('editor'); | $editor = JPluginHelper::isEnabled('editors', $editor) ? $editor : $this->getCfg('editor'); | ||
$config->setValue('config.editor', $editor); | $config->setValue('config.editor', $editor); | ||
} | } | ||
</source> | </source> | ||
Revision as of 22:09, 22 March 2010
Description
Initialise the application.
Template:Description:JApplication/initialise
Syntax
initialise($options=array())
| Parameter Name | Default Value | Description |
|---|---|---|
| $options | array() | An optional associative array of configuration settings. public |
Defined in
libraries/joomla/application/application.php
Importing
jimport( 'joomla.application.application' );
Source Body
function initialise($options = array())
{
jimport('joomla.plugin.helper');
//Set the language in the class
$config =& JFactory::getConfig();
// Check that we were given a language in the array (since by default may be blank)
if(isset($options['language'])) {
$config->setValue('config.language', $options['language']);
}
// Set user specific editor
$user =& JFactory::getUser();
$editor = $user->getParam('editor', $this->getCfg('editor'));
$editor = JPluginHelper::isEnabled('editors', $editor) ? $editor : $this->getCfg('editor');
$config->setValue('config.editor', $editor);
}
[Edit See Also] Template:SeeAlso:JApplication/initialise
Examples
<CodeExamplesForm />