PHPDevShell 3.1.3-Stable
PHP OOP RAD Development Framework
PHPDS Class Reference

Public Member Functions

 __construct ($embedded=false)
 __destruct ()
 copyArray ($source, &$target, $indexes, $type=null)
 loadFunctions ()
 run ()
 _factory ($classname, $params=null, $dependancy=null)
 PHPDS_configuration ($configuration=null)
 PHPDS_errorHandler ()
 PHPDS_core ()
 PHPDS_user ()
 PHPDS_debug ()
 log ($data)
 _log ($data)
 PHPDS_navigation ()
 PHPDS_db ()
 PHPDS_security ()
 PHPDS_template ($lazy=true)
 PHPDS_tagger ()
 PHPDS_notif ()
 PHPDS_lang ()
 get ($field)
 isEmbedded ()
 basepath ($postfix= '')
 sneak_class ($classname, $filename)
 sneakClass ($classname, $filename)
 PHPDS_autoloader ($class_name)

Protected Member Functions

 includeConfigFile ($path, &$configuration)
 loadConfigFile ($filename, &$configuration)
 loadPluginsConfig (&$configuration)
 loadConfig ()
 configSession ()
 configDb ()
 copySettings ($settings, $type=null)
 configCoreSettings ()
 config ()

Protected Attributes

 $configuration
 $lang
 $db
 $core
 $user
 $security
 $navigation
 $template
 $debugInstance
 $tagger
 $notif
 $classes
 $embedded
 $basepath
 $compatMode = 1
 $stage = 1

Detailed 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

Date:
20090427
Version:
1.0

Constructor & Destructor Documentation

__construct ( embedded = false)

Constructor: initialize the instance and starts the configuration process

Parameters:
$embedded
Date:
20100618 (v1.0.2) (greg) added exception handler to display config parameters to allow inspection in a problematic installation
20091006 Improved windoz compat by using DIRECTORY_SEPARATOR
Author:
greg
Version:
1.0.2
Returns:
itself
__destruct ( )

Destruct Class.

Date:
20091030 mute possible error with @ (in case destruct is called before ob is started)
Author:
greg
Version:
1.0.1
Returns:
nothing

Member Function Documentation

_factory ( classname,
params = null,
dependancy = null 
)
_log ( data)

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

Deprecated:
Parameters:
unknown_type$data
basepath ( postfix = '')

Simply returns basepath

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

Author:
greg
Date:
2009106 fix a problem when the path is invalid
Version:
1.0.1
Returns:
string
config ( ) [protected]

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()

Version:
1.0.2
Date:
20100630 (v1.0.1) (greg) moved loading of user functions up
20100810 (v1.0.2) (greg) rearranged calls to allow switching to install.php if needed
Returns:
PHPDS the current instance
configCoreSettings ( ) [protected]

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

Date:
20090513
Version:
1.0.1
Returns:
PHPDS the current instance
configDb ( ) [protected]

Deal with database access configuration

Date:
20090427
Version:
1.0
Returns:
PHPDS the current instance
configSession ( ) [protected]

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

Date:
20090427
Version:
1.0
Returns:
PHPDS the current instance
copyArray ( source,
&$  target,
indexes,
type = null 
)

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

Date:
20100219
Author:
greg
Version:
1.0
Parameters:
$sourcearray, the array to extract values from
$targetarray, the array to add the values to
$indexesarray, the indexes of the values to copy
$typestring, the type of value to cast (currently only boolean or null for everything else)
Returns:
nothing
copySettings ( settings,
type = null 
) [protected]

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

Date:
20100219
Author:
greg
Version:
1.1
Parameters:
$sourcearray, the array to extract values from
$targetarray, the array to add the values to
$indexesarray, the indexes of the values to copy
$typestring, the type of value to cast (currently only boolean or null for everything else)
Returns:
nothing
get ( field)

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

Date:
20090427
Version:
1.0
Parameters:
$field
Returns:
mixed depends on what is asked for
includeConfigFile ( path,
&$  configuration 
) [protected]

Load one config file, if it exists

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

Parameters:
$pathabsolute file name
Returns:
boolean wether it's successfull
Date:
20090521 Added
20091006 Changed to dual list of files (used/missing)
20100630 (v1.1.1) (greg) fixed the misplaced _log() call
20110225 (v1.1.2) (greg) fixed _log() to log() ; remove pre/postfix on $path
Author:
greg <greg@phpdevshell.org>
Version:
1.1.2
isEmbedded ( )

Check if instance is embedded.

Returns:
mixed
loadConfig ( ) [protected]

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.

Date:
20090427
20090521 Make it lighter by using loadConfigFile()
20091006 Changed to dual list of files (used/missing)
20110225 (v1.1.1) (greg) added support for plugin-specific host-style config files
Version:
1.1.1
Returns:
PHPDS the current instance
loadConfigFile ( filename,
&$  configuration 
) [protected]

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

Parameters:
$filenameshort file name
Returns:
nothing
Date:
20090521 Added
20091006 Changed to dual list of files (used/missing)
Version:
1.0
loadFunctions ( )

Loads extra broad based system functions.

Returns:
void
loadPluginsConfig ( &$  configuration) [protected]

Load plugin-specific host-style config

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

log ( data)

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.

Parameters:
string$data
PHPDS_autoloader ( class_name)

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

Date:
20100215 (greg) added manual overloading by configuration file ; enable cascading in case a file is found but the doesn't define the class
Version:
1.2
Author:
jason
Parameters:
$class_name
Returns:
irrelevant, it's a callback for the new() operator (however we return true on success, false otherwise)
PHPDS_configuration ( configuration = null)

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

Date:
20090427
Version:
1.0
Parameters:
$configurationpossibly a new configuration array
Returns:
array the configuration array

Allow access to the (formerly) global core subsystem

One is created if necessary.

You can override to use you own core subsystem

Date:
20090427
Version:
1.0
Returns:
core
PHPDS_db ( )

Allow access to the (formerly) global database subsystem

One is created if necessary.

You can override to use you own database subsystem

Date:
20090427
Version:
1.0
Returns:
db

Allow access to the global debugging subsystem

One is created if necessary.

You can override to use you own core subsystem

Date:
20100412 (v1.0.1) default domain is now "skel"
20090615 (v1.0) creation
Version:
1.0.1
Returns:
debug instance

Custom Error Handler.

One is created if necessary.

You can override to use you own core subsystem

Date:
20090618
Version:
1.0
Returns:
error
PHPDS_lang ( )

Allow access to the (formerly) global templating subsystem

One is created if necessary.

You can override to use you own templating subsystem

Date:
20090427
Version:
1.0
Returns:
template

Allow access to the (formerly) global navigation subsystem

One is created if necessary.

You can override to use you own navigation subsystem

Date:
20090427
Version:
1.0
Returns:
navigation

Allow access to the aynschronous notifications subsystem

One is created if necessary.

You can override to use you own tagging subsystem

Date:
20110615
Version:
1.0
Author:
greg
Returns:
PHPDS_notif

Main instance of the notification module

Allow access to the (formerly) global security subsystem

One is created if necessary.

You can override to use you own security subsystem

Date:
20090427
Version:
1.0
Returns:
security

Allow access to the tagging subsystem

One is created if necessary.

You can override to use you own tagging subsystem

Date:
20100825
Version:
1.0
Author:
greg
Returns:
PHPDS_tagger
PHPDS_template ( lazy = true)

Allow access to the (formerly) global templating subsystem

One is created if necessary.

You can override to use you own templating subsystem

Date:
20100928 (v1.1) (greg) added $lazy param
20090427 (v1.0) (greg) created
Version:
1.1
Parameters:
boolean$lazyif true (default) the template is created if wasn't before
Returns:
template

Provides a variaty of user functions.

One is created if necessary.

You can override to use you own core subsystem

Date:
20101111
Version:
1.0
Returns:
user
run ( )

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

Date:
20090427
Version:
1.0
Returns:
nothing
sneak_class ( classname,
filename 
)

Try to load a class from a file

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

Deprecated:
Parameters:
$classnamename of the class to look for
$filenamename of the file to look into
Returns:
boolean wether we found the class or not
sneakClass ( classname,
filename 
)

Try to load a class from a file

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

Parameters:
$classnamename of the class to look for
$filenamename of the file to look into
Returns:
boolean wether we found the class or not

Field Documentation

$basepath [protected]
$classes [protected]
$compatMode = 1 [protected]
$configuration [protected]
$core [protected]
$db [protected]
$debugInstance [protected]
$embedded [protected]
$lang [protected]
$navigation [protected]
$notif [protected]
$security [protected]
$stage = 1 [protected]
$tagger [protected]

Main instance of the tagger module

$template [protected]
$user [protected]

The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations