Class ConsumerService

Description

This class provides basic methods for reading Consumer Settings.

ATTENTION: This class handles the Domain Name always lower-case!

The Consumer Configuration File has the Format:

  1.  [www.example.com]
  2.  id 0
You can define a Default Consumer by using the DEFAULT_COMMUNITY constant as Domain:
  1.  [*]
  2.  id 0
A lookup for the default Community is done, if no mapping for the requested Domain could be found.



			
Direct descendents
Class Description
ConsumerHelper This class provides extended methods for manipulating Consumer Settings.
Method Summary
void findConsumerID ([String $domain = ''])
Consumer getConsumerByName (String $domain)
mixed getConsumerConfigEntry (String $domain, String $key)
int getConsumerIdForDomain (String $domain)
array getNamesForID (int $cid)
array loadConsumerConfiguration ([ $reload = false])
Methods
findConsumerID (line 96)

Finds the Consumer ID for the given Domain.

If no Domain Name is passed it uses

  1. $_SERVER['HTTP_HOST']
to detect the ID for.

This method includes Exception Handling, so if you just want to get the Consumer ID for a Domain use

instead! This method is ONLY meant for initialization of a Session.

void findConsumerID ([String $domain = ''])
  • String $domain: the Domain Name to fetch the Consumer ID for
getConsumerByName (line 240)

Fetches a full configured Consumer for the given Domain or null if no Consumer could be found for this URL.

  • return: the Consumer for the given Domain or null
Consumer getConsumerByName (String $domain)
  • String $domain: domain the Domain Name to fetch the Consumer for
getConsumerConfigEntry (line 171)

Returns the Consumer Config Entry for the given Domain.

If no Consumer could be found at all (none installed maybe), it returns -2. It returns -1 if the Config Entry is not existing.

  • return: the Config Value or -1 or -2
mixed getConsumerConfigEntry (String $domain, String $key)
  • String $domain: the Consumer Domain
  • String $key: the Name of the Config Entry
getConsumerIdForDomain (line 151)

Returns the Consumer ID for a Domain Name.

If no match could be found, it returns -1. If no Consumer could be found at all (none installed maybe), it returns -2. It returns -3 if the Domain Name could not be processed (empty String or invalid Host URL). ATTENTION: This function handles Domain Names lower-case.

  • return: the Consumer ID or -1 if no match could be found
int getConsumerIdForDomain (String $domain)
  • String $domain: the Domain Name to find the Consumer ID for
getNamesForID (line 206)

Gets all Domain names matching the given Consumer ID.

Returns an empty array if the given CID could not be found.

  • return: the Array with all Names matching the given CID
array getNamesForID (int $cid)
  • int $cid: the Consumer ID
loadConsumerConfiguration (line 192)

Returns the complete Consumer Configuration for this System, including ALL settings for ALL Consumer.

  • return: the Consumer Configuration
array loadConsumerConfiguration ([ $reload = false])
  • $reload

Documentation generated by phpDocumentor 1.3.1