Actions

API16

JApplicationHelper/getClientInfo

From Joomla! Documentation

< API16:JApplicationHelper
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Gets information on a specific client id. This method will be useful in future versions when we start mapping applications in the database.

[<! removed edit link to red link >]

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

Syntax

static getClientInfo($id=null, $byName=false)
Parameter Name Default Value Description
$id null $id A client identifier
$byName false $byName If True, find the client by it's name

Returns

mixed Object describing the client or false if not known

Defined in

libraries/joomla/application/helper.php

Importing

jimport( 'joomla.application.helper' );

Source Body

public static function getClientInfo($id = null, $byName = false)
{
        // Only create the array if it does not exist
        if (self::$_clients === null)
        {
                $obj = new stdClass();
 
                // Site Client
                $obj->id        = 0;
                $obj->name      = 'site';
                $obj->path      = JPATH_SITE;
                self::$_clients[0] = clone $obj;
 
                // Administrator Client
                $obj->id        = 1;
                $obj->name      = 'administrator';
                $obj->path      = JPATH_ADMINISTRATOR;
                self::$_clients[1] = clone $obj;
 
                // Installation Client
                $obj->id        = 2;
                $obj->name      = 'installation';
                $obj->path      = JPATH_INSTALLATION;
                self::$_clients[2] = clone $obj;
        }
 
        // If no client id has been passed return the whole array
        if (is_null($id)) {
                return self::$_clients;
        }
 
        // Are we looking for client information by id or by name?
        if (!$byName)
        {
                if (isset(self::$_clients[$id])){
                        return self::$_clients[$id];
                }
        }
        else
        {
                foreach (self::$_clients as $client)
                {
                        if ($client->name == strtolower($id)) {
                                return $client;
                        }
                }
        }
 
        return null;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />