ZenMagick 0.9.8


org.zenmagick.core.ZMRuntime
\core\ZMRuntime.php at line 33

Class ZMRuntime

ZMObject
└─ZMRuntime

public class ZMRuntime
extends ZMObject

Central place for runtime stuff.

This is kind of the application context.

Author:
DerManoMann
Version:
$Id: ZMRuntime.php 2795 2009-12-29 21:55:38Z dermanomann $

Fields inherited from org.zenmagick.core.ZMObject
properties_
Method Summary
static string

getApplicationPath()

Get the full application path (if set).

static ZMDatabase

getDatabase(mixed conf)

Get the database (provider).

static array

getDatabases()

Get a list of all used databases.

static long

getExecutionTime(string time)

Get the currently elapsed page execution time.

static string

getInstallationPath()

Get the full ZenMagick installation path.

static string

getPluginBasePath()

Return the plugin base directory.

void

yamlLoad(string yaml, array defaults, boolean override)

Load mappings from a YAML style string.

Methods inherited from org.zenmagick.core.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Method Detail

\core\ZMRuntime.php at line 110

getApplicationPath

public static string getApplicationPath()

Get the full application path (if set).

Returns:
The application base folder or null.

\core\ZMRuntime.php at line 69

getDatabase

public static ZMDatabase getDatabase(mixed conf)

Get the database (provider).

ZMDatabase instances are cached, based on the given $conf data.

Supported keys for $conf are:

driver
The database driver/type; default is mysql.
host
The database host; default is DB_SERVER.
port
The database port; optional, no default.
username
The database username; default is DB_SERVER_USERNAME.
password
The database password; default is DB_SERVER_PASSWORD.
database
The database name; default is DB_DATABASE.
provider
The requested implementation class; if omitted, this defaults to ZMSettings::get('zenmagick.core.database.provider').
initQuery
An optional init query to execute; useful to set the character encoding, etc.; default is null.

If the given parameter $conf is a string, the method will lookup database settings using a settings key build like: zenmagick.core.database.connections.[$conf].

Parameters:
conf - Optional configuration; either an array with any of the supported keys, or a string; default is default.
Returns:
A ZMDatabase implementation.

\core\ZMRuntime.php at line 92

getDatabases

public static array getDatabases()

Get a list of all used databases.

Returns:
List of ZMDatabase instances.

\core\ZMRuntime.php at line 135

getExecutionTime

public static long getExecutionTime(string time)

Get the currently elapsed page execution time.

Parameters:
time - Optional execution timestamp to be used instead of the current time.
Returns:
The execution time in milliseconds.

\core\ZMRuntime.php at line 101

getInstallationPath

public static string getInstallationPath()

Get the full ZenMagick installation path.

Returns:
The ZenMagick installation folder.

\core\ZMRuntime.php at line 122

getPluginBasePath

public static string getPluginBasePath()

Return the plugin base directory.

May be configured via the setting . Default is ../lib/plugins.

Returns:
The base directory for plugins.
Todo:
make this a list to allow general and app plugins

\core\ZMRuntime.php at line 150

yamlLoad

public void yamlLoad(string yaml, array defaults, boolean override)

Load mappings from a YAML style string.

Parameters:
yaml - The yaml style mappings.
defaults - Optional defaults for merging; default is an empty array.
override - Optional flag to control whether to override existing mappings or to merge; default is true to override.

ZenMagick 0.9.8