Class Init

Description

Initializes the framework

This class is used inside the initialization script, and has the responsability of starting up all basic services of the framework: configuration, internationalization and session.

Located in /core/Init.class.php (line 57)


	
			
Variable Summary
Method Summary
static Init &getInstance ()
Init Init ()
void resetLocale ()
bool setLocale (string $language)
bool _applyLocale (string $language, [bool $userDefined = FALSE])
void _initConfig ()
void _initDateFormat ()
void _initLocale ()
void _initSession ()
Variables
string $charset (line 71)

Charset code

string $locale (line 64)

Locale code

Conf $_Conf (line 132)

Reference to the singleton of the Conf class

  • access: private
array $_dateFormatTable = array(
'EURO' => array(
'type' => 'EURO',
'format' => 'd/m/Y',
'xlsFormat' => 'DD/MM/YYYY',
'calendarFormat' => '%d/%m/%Y',
'regexp' => '^([0-9]{1,2})(\/|\-|\.)([0-9]{1,2})(\/|\-|\.)([0-9]{1,4})(\s([0-9]{1,2}):([0-9]{1,2}):?([0-9]{1,2})?)?$',
'matches' => array(1, 3, 5),'mask'=>'[#]{0,2}/[#]{0,2}/[#]{0,4}'),'US'=>array('type'=>'US','format'=>'m/d/Y','xlsFormat'=>'MM/DD/YYYY','calendarFormat'=>'%m/%d/%Y','regexp'=>'^([0-9]{1,2})(\/|\-|\.)([0-9]{1,2})(\/|\-|\.)([0-9]{1,4})(\s([0-9]{1,2}):([0-9]{1,2}):?([0-9]{1,2})?)?$','matches'=>array(3,1,5),'mask'=>'[#]{0,2}/[#]{0,2}/[#]{0,4}'),'SQL'=>array('type'=>'SQL','format'=>'Y-m-d','xlsFormat'=>'YYYY-MM-DD','calendarFormat'=>'%Y-%m-%d','regexp'=>'^([0-9]{1,4})(\/|\-|\.)([0-9]{1,2})(\/|\-|\.)([0-9]{1,2})(\s([0-9]{1,2}):([0-9]{1,2}):?([0-9]{1,2})?)?$','matches'=>array(5,3,1),'mask'=>'[#]{0,4}-[#]{0,2}-[#]{0,2}'))
(line 96)

Date format settings table

  • access: private
LanguageBase $_Lang (line 140)

Refernce to the singleton of the LanguageBase class

  • access: private
array $_localeTable = array(
'pt-br' => array(array('pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8', 'portuguese'),'brazilian-portuguese','pt-br'),'en-us'=>array(array('en_US','en','english'),'us-english','en'),'es'=>array(array('es_ES','es','spanish'),'spanish','es'),'cs'=>array(array('cs_CZ','cz','czech'),'czech','cz'),'it'=>array(array('it_IT','it','italian'),'italian','it'),'de-de'=>array(array('de_DE','de','ge','german'),'de-german','de'),'fr-fr'=>array(array('fr_FR','fr','french'),'french','fr'),'th'=>array(array('th_TH','th','english'),'thai','th'))
(line 79)

Available set of locales

  • access: private
LocaleNegotiator $_Negotiator (line 148)

Reference to the singleton of the LocaleNegotiator class

  • access: private
Methods
static method getInstance (line 176)

Get the singleton of the class

This method is called inside p2gConfig.php, and launches the framework's initialization.

static Init &getInstance ()
Constructor Init (line 155)

Class constructor

Init Init ()
resetLocale (line 204)

Reset the language settings

Check if there's a language code (choosen by the user) stored in the cookies or in the session scope. If it exists, it is removed and all language/locale configurations are reinitialized based on the default language settings.

This method could be useful to remove a language choice right after the user logs off the application.

void resetLocale ()
setLocale (line 189)

Change the active locale

bool setLocale (string $language)
  • string $language: Language code
_applyLocale (line 446)

Apply a given language code

bool _applyLocale (string $language, [bool $userDefined = FALSE])
  • string $language: Language code
  • bool $userDefined: Whether this is a user choice
_checkAbsoluteUri (line 419)

Check if the ABSOLUTE_URI configuration setting is present and represents a valid absolute or relative URL

  • access: private
void _checkAbsoluteUri ()
_checkPhpVersion (line 408)

Check if the running PHP version satisfies the minimum requirement of the framework

  • access: private
void _checkPhpVersion ()
_initConfig (line 218)

Initialize the configuration settings

  • access: private
void _initConfig ()
_initDateFormat (line 383)

Initializes date format settings

  • access: private
void _initDateFormat ()
_initLocale (line 320)

Initialize locale and language settings

Steps of language code detection:

  • use LANGUAGE.REQUEST_PARAM, if present and mapping to a supported language code
  • use the previously selected language code stored in the cookies, if present and supported
  • use the previously selected language stored in the session scope, if present and supported
  • use auto detected language, if auto detection is enabled and detected language is supported
  • use language code defined as default, if present in the config settings
  • use framework's default language code (en-us)

  • access: private
void _initLocale ()
_initSession (line 248)

Initializes the session

Configure all session properties based on the global settings: session name, session lifetime, session save path, ... Start PHP session if SESSION.AUTO_START is missing or set to true. Define a set of ini entries for sessions.

  • access: private
void _initSession ()

Documentation generated on Sun, 07 Oct 2007 19:26:43 -0300 by phpDocumentor 1.3.2