JMail/getInstance: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 4: | Line 4: | ||
===Syntax=== | ===Syntax=== | ||
| Line 47: | Line 47: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=getInstance | category=getInstance | ||
category=JMail | category=JMail | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
Latest revision as of 01:53, 25 March 2017
Description
Returns the global e-mail object, only creating it if it doesn't already exist.
Syntax
static getInstance($id= 'Joomla')
| Parameter Name | Default Value | Description |
|---|---|---|
| $id | 'Joomla' | $id The id string for the instance [optional] |
Returns
object The global object
Defined in
libraries/joomla/mail/mail.php
Importing
jimport( 'joomla.mail.mail' );
Source Body
public static function getInstance($id = 'Joomla')
{
static $instances;
if (!isset ($instances)) {
$instances = array ();
}
if (empty($instances[$id])) {
$instances[$id] = new JMail();
}
return $instances[$id];
}
Examples
Code Examples