Class PHPDS

Description

PHPDS: the main class for the PHPDevShell engine

It can be used either standalone or embedded

NOTE: none of these methods are meant to be called by you. For standalone mode, consult PHPDevShell programmers' guide. For embedded mode, use the PHPDSlib

  • version: 1.0
  • date: 20090427

Located in /PHPDS.inc.php (line 38)


	
			
Variable Summary
string $basepath
object $core
object $db
boolean $embedded
object $lang
object $navigation
PHPDS_notif $notif
object $security
int $stage
mixed $tagger
object $template
object $user
Method Summary
itself __construct ([$embedded $embedded = false])
nothing __destruct ()
string basepath ([ $postfix = ''])
nothing copyArray ($source $source, $target &$target, $indexes $indexes, [$type $type = null])
nothing copySettings ($source $settings, [$target $type = null], $indexes 2, $type 3)
mixed get ($field $field)
boolean includeConfigFile ($path $path,  &$configuration)
mixed isEmbedded ()
nothing loadConfigFile ($filename $filename,  &$configuration)
void loadFunctions ()
void loadPluginsConfig ( &$configuration)
void log (string $data)
irrelevant, PHPDS_autoloader ($class_name $class_name)
array PHPDS_configuration ([$configuration $configuration = null])
core PHPDS_core ()
db PHPDS_db ()
debug PHPDS_debug ()
template PHPDS_lang ()
navigation PHPDS_navigation ()
PHPDS_notif PHPDS_notif ()
security PHPDS_security ()
PHPDS_tagger PHPDS_tagger ()
template PHPDS_template ([boolean $lazy = true])
user PHPDS_user ()
nothing run ()
boolean sneakClass ($classname $classname, $filename $filename)
boolean sneak_class ($classname $classname, $filename $filename)
instance _factory (string $classname, [array $params = null], [PHPDS|PHPDS_dependant $dependancy = null])
void _log (unknown_type $data)
Variables
string $basepath (line 115)

The textual path of PHPDS directory on disk (not the URL).

  • access: protected
int $compatMode = 1 (line 121)

The higher the less backward-compatible.

  • access: protected
object $configuration (line 45)

Core system configuration settings.

  • access: protected
object $core (line 63)

Core object.

  • access: protected
object $db (line 57)

Core database object.

  • access: protected
object $debugInstance (line 93)

Main instance of the debug module, which handles startup init.

  • access: protected
boolean $embedded (line 109)

PHPDS is used throught the lib (true) or standalone (false).

  • access: protected
object $lang (line 51)

Core system language values.

  • access: protected
object $navigation (line 81)

Core navigation object.

  • access: protected
PHPDS_notif $notif (line 103)

Main instance of the notification module

  • access: protected
array $PluginClasses (line 127)

Contains array of installed supportive plugin classes.

  • access: public
object $security (line 75)

Core security object.

  • access: protected
int $stage = 1 (line 133)

Execution stage (i.e. run level)

  • access: protected
mixed $tagger (line 97)

Main instance of the tagger module

  • access: protected
object $template (line 87)

Core template object.

  • access: protected
object $user (line 69)

Core user object.

  • access: protected
Methods
Constructor __construct (line 144)

Constructor: initialize the instance and starts the configuration process

  • author: greg
  • version: 1.0.2
  • date: 20091006 Improved windoz compat by using DIRECTORY_SEPARATOR
  • date: 20100618 (v1.0.2) (greg) added exception handler to display config parameters to allow inspection in a problematic installation
  • access: public
itself __construct ([$embedded $embedded = false])
  • $embedded $embedded
Destructor __destruct (line 167)

Destruct Class.

  • author: greg
  • version: 1.0.1
  • date: 20091030 mute possible error with @ (in case destruct is called before ob is started)
  • access: public
nothing __destruct ()
basepath (line 944)

Simply returns basepath

An optional postfix (i.e. folder name) can be given to retrieve the path a subfolder

  • author: greg
  • version: 1.0.1
  • date: 2009106 fix a problem when the path is invalid
  • access: public
string basepath ([ $postfix = ''])
  • $postfix
config (line 486)

Main configuration method: load settings, create menus, templates, and so on After that, everything is ready to run all config_*() methods are meant to be called only at startup time by config()

  • return: the current instance
  • version: 1.0.2
  • date: 20100630 (v1.0.1) (greg) moved loading of user functions up TODO: maybe we should hardcode the ones we're using??
  • date: 20100810 (v1.0.2) (greg) rearranged calls to allow switching to install.php if needed
  • access: protected
PHPDS config ()
configCoreSettings (line 429)

Fetch core settings from the site configuration stored in the database Also fetch some settings from the session and the locales

  • return: the current instance
  • version: 1.0.1
  • date: 20090513
  • access: protected
PHPDS configCoreSettings ()
configDb (line 361)

Deal with database access configuration

  • return: the current instance
  • version: 1.0
  • date: 20090427
  • access: protected
PHPDS configDb ()
configSession (line 311)

Deal with the "session" part of the configuration

In standalone mode, create the sessions ; in embedded mode, fetch the current session (we hijack the session, we don't create a new one)

NOTE: in embedded mode you MUST create a session before using PHPDSlib

  • return: the current instance
  • version: 1.0
  • date: 20090427
  • access: protected
PHPDS configSession ()
copyArray (line 404)

Copy an array to another and defaults to false if the value isn't set

  • author: greg
  • version: 1.0
  • date: 20100219
  • access: public
nothing copyArray ($source $source, $target &$target, $indexes $indexes, [$type $type = null])
  • $source $source: array, the array to extract values from
  • $target &$target: array, the array to add the values to
  • $indexes $indexes: array, the indexes of the values to copy
  • $type $type: string, the type of value to cast (currently only boolean or null for everything else)
copySettings (line 387)

Copy settings from the database-loaded array. Converts and defaults to false if the value isn't set

  • author: greg
  • version: 1.1
  • date: 20100219
  • access: protected
nothing copySettings ($source $settings, [$target $type = null], $indexes 2, $type 3)
  • $indexes 2: array, the indexes of the values to copy
  • $type 3: string, the type of value to cast (currently only boolean or null for everything else)
  • $source $settings: array, the array to extract values from
  • $target $type: array, the array to add the values to
get (line 915)

This is a generic accessor to allow field access through an homogeneous and controlled way.

For example:

$instance->get('core')

will return the core object as returned by the core() accessor method

  • return: depends on what is asked for
  • version: 1.0
  • date: 20090427
  • access: public
mixed get ($field $field)
  • $field $field
includeConfigFile (line 187)

Load one config file, if it exists

If it's ok, its name is added to $configuration['config_files']

  • return: wether it's successfull
  • author: greg <greg@phpdevshell.org>
  • version: 1.1.2
  • date: 20110225 (v1.1.2) (greg) fixed _log() to log() ; remove pre/postfix on $path
  • date: 20090521 Added
  • date: 20091006 Changed to dual list of files (used/missing)
  • date: 20100630 (v1.1.1) (greg) fixed the misplaced _log() call
  • access: protected
boolean includeConfigFile ($path $path,  &$configuration)
  • $path $path: absolute file name
  • &$configuration
isEmbedded (line 929)

Check if instance is embedded.

  • access: public
mixed isEmbedded ()
loadConfig (line 250)

Create a config from the config files, and store it in the instance field

The actual configuration is loaded from two files (one is generic, the other is specific) from the config/ folder.

  • return: the current instance
  • version: 1.1.1
  • date: 20090427
  • date: 20090521 Make it lighter by using loadConfigFile()
  • date: 20110225 (v1.1.1) (greg) added support for plugin-specific host-style config files
  • date: 20091006 Changed to dual list of files (used/missing)
  • access: protected
PHPDS loadConfig ()
loadConfigFile (line 210)

Load one config file, if it exists; also tried a ".local" with the same name

  • version: 1.0
  • date: 20090521 Added
  • date: 20091006 Changed to dual list of files (used/missing)
  • access: protected
nothing loadConfigFile ($filename $filename,  &$configuration)
  • $filename $filename: short file name
  • &$configuration
loadFunctions (line 462)

Loads extra broad based system functions.

  • access: public
void loadFunctions ()
loadPluginsConfig (line 225)

Load plugin-specific host-style config

This allows plugins to provide a configuration, for example when 1 plugin <=> 1 site

  • access: protected
void loadPluginsConfig ( &$configuration)
  • &$configuration
log (line 734)

Send info data to the debug subsystem (console, firebug, ...)

The goal of this function is to be called all thourough the code to be able to track bugs.

  • access: public
void log (string $data)
  • string $data
PHPDS_autoloader (line 1000)

Autoloader: when a class is instanciated, this method will load the proper php file

Note: the various folders where the files are looked for depends on the instance configuration, and on the current plugin

A model file is also loaded if present

  • return: it's a callback for the new() operator (however we return true on success, false otherwise)
  • author: jason
  • version: 1.2
  • date: 20100215 (greg) added manual overloading by configuration file ; enable cascading in case a file is found but the doesn't define the class
irrelevant, PHPDS_autoloader ($class_name $class_name)
  • $class_name $class_name
PHPDS_configuration (line 630)

Allow access to configuration, either read (no param) or write

This makes possible to start with a forced configuration, for testing for example

It returns the configuration array

CAUTION: an array is not an object so be carefull to use & if you need to modify it

  • return: the configuration array
  • version: 1.0
  • date: 20090427
  • access: public
array PHPDS_configuration ([$configuration $configuration = null])
  • $configuration $configuration: possibly a new configuration array
PHPDS_core (line 674)

Allow access to the (formerly) global core subsystem

One is created if necessary.

You can override to use you own core subsystem

  • version: 1.0
  • date: 20090427
  • access: public
core PHPDS_core ()
PHPDS_db (line 785)

Allow access to the (formerly) global database subsystem

One is created if necessary.

You can override to use you own database subsystem

  • version: 1.0
  • date: 20090427
  • access: public
db PHPDS_db ()
PHPDS_debug (line 718)

Allow access to the global debugging subsystem

One is created if necessary.

You can override to use you own core subsystem

  • return: instance
  • version: 1.0.1
  • date: 20100412 (v1.0.1) default domain is now "skel"
  • date: 20090615 (v1.0) creation
  • access: public
debug PHPDS_debug ()
PHPDS_errorHandler (line 653)

Custom Error Handler.

One is created if necessary.

You can override to use you own core subsystem

  • version: 1.0
  • date: 20090618
  • access: public
error PHPDS_errorHandler ()
PHPDS_lang (line 892)

Allow access to the (formerly) global templating subsystem

One is created if necessary.

You can override to use you own templating subsystem

  • version: 1.0
  • date: 20090427
  • access: public
template PHPDS_lang ()
PHPDS_navigation (line 764)

Allow access to the (formerly) global navigation subsystem

One is created if necessary.

You can override to use you own navigation subsystem

  • version: 1.0
  • date: 20090427
  • access: public
navigation PHPDS_navigation ()
PHPDS_notif (line 872)

Allow access to the aynschronous notifications subsystem

One is created if necessary.

You can override to use you own tagging subsystem

  • author: greg
  • version: 1.0
  • date: 20110615
  • access: public
PHPDS_notif PHPDS_notif ()
PHPDS_security (line 806)

Allow access to the (formerly) global security subsystem

One is created if necessary.

You can override to use you own security subsystem

  • version: 1.0
  • date: 20090427
  • access: public
security PHPDS_security ()
PHPDS_tagger (line 851)

Allow access to the tagging subsystem

One is created if necessary.

You can override to use you own tagging subsystem

  • author: greg
  • version: 1.0
  • date: 20100825
  • access: public
PHPDS_tagger PHPDS_tagger ()
PHPDS_template (line 829)

Allow access to the (formerly) global templating subsystem

One is created if necessary.

You can override to use you own templating subsystem

  • version: 1.1
  • date: 20100928 (v1.1) (greg) added $lazy param
  • date: 20090427 (v1.0) (greg) created
  • access: public
template PHPDS_template ([boolean $lazy = true])
  • boolean $lazy: if true (default) the template is created if wasn't before
PHPDS_user (line 695)

Provides a variaty of user functions.

One is created if necessary.

You can override to use you own core subsystem

  • version: 1.0
  • date: 20101111
  • access: public
user PHPDS_user ()
run (line 548)

Actual starting point of the (non-embedded) PHPDS engine

  • version: 1.0
  • date: 20090427
  • access: public
nothing run ()
sneakClass (line 974)

Try to load a class from a file

NOTE: for performance reason we DON'T try first to see if the class already exists

  • return: wether we found the class or not
  • access: public
boolean sneakClass ($classname $classname, $filename $filename)
  • $classname $classname: name of the class to look for
  • $filename $filename: name of the file to look into
sneak_class (line 960)

Try to load a class from a file

NOTE: for performance reason we DON'T try first to see if the class already exists

  • return: wether we found the class or not
  • deprecated:
  • access: public
boolean sneak_class ($classname $classname, $filename $filename)
  • $classname $classname: name of the class to look for
  • $filename $filename: name of the file to look into
_factory (line 582)

Create a new instance of the given class and link it as dependant (arguments as an array)

  • return: of $classname
  • author: greg
  • version: 1.1
  • date: 20100217
  • date: 20100922 (v1.1) (greg) moved from PHPDS_dependant to PHDS
  • date: 20100426 (v1.0.1) (greg) direct owner is now sent instead of the top owner
  • access: public
instance _factory (string $classname, [array $params = null], [PHPDS|PHPDS_dependant $dependancy = null])
  • PHPDS|PHPDS_dependant $dependancy
  • string $classname: name of the class to instanciate
  • array $params: parameters to feed the object's constructor
_log (line 747)

Alias for log() - don't use it doesn't follow the guidelines

  • deprecated:
  • access: public
void _log (unknown_type $data)
  • unknown_type $data

Documentation generated on Tue, 09 Aug 2011 09:05:00 +0200 by phpDocumentor 1.4.3