JAuthentication/getInstance: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 40: | Line 40: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=getInstance | category=getInstance | ||
category=JAuthentication | category=JAuthentication | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 00:18, 25 March 2017
Description
Returns a reference to a global authentication object, only creating it if it doesn't already exist.
<! removed transcluded page call, red link never existed >
Syntax
& getInstance()
Returns
object The global object
Defined in
libraries/joomla/user/authentication.php
Importing
jimport( 'joomla.user.authentication' );
Source Body
function & getInstance()
{
static $instances;
if (!isset ($instances)) {
$instances = array ();
}
if (empty ($instances[0])) {
$instances[0] = new JAuthentication();
}
return $instances[0];
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples