API15

JApplication/initialise: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Initialise the application. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</now...
 
m preparing for archive only
 
(3 intermediate revisions by 2 users not shown)
Line 2: Line 2:
Initialise the application.
Initialise the application.


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JApplication/initialise|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JApplication/initialise}}
 
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 19: Line 17:
| $options
| $options
| array()
| array()
|  An optional associative array of configuration settings.  
|  An optional associative array of configuration settings. public
|}
|}


Line 29: Line 27:
===Source Body===
===Source Body===
<source lang="php">
<source lang="php">
public function initialise($options = array())
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   = &JFactory::getUser();
         $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);
        // Trigger the onAfterInitialise event.
        JPluginHelper::importPlugin('system');
        $this->triggerEvent('onAfterInitialise');
}
}
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JApplication/initialise|Edit See Also]]<nowiki>]</nowiki>
<! removed transcluded page call, red link never existed >
</span>
{{SeeAlso:JApplication/initialise}}


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=initialise
  category=initialise
  category=JApplication
  category=JApplication
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API15]]

Latest revision as of 00:16, 25 March 2017

Description

Initialise the application.


<! removed transcluded page call, red link never existed >

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);
}


<! removed transcluded page call, red link never existed >

Examples

Code Examples