ZenMagick 0.9.6


org.zenmagick.ZMRuntime

Class ZMRuntime

ZMObject
|
+--ZMRuntime

public class ZMRuntime
extends ZMObject

A central place for all runtime stuff.

This is kind of the application context.

Author:
DerManoMann
Version:
$Id: ZMRuntime.php 2096 2009-03-23 01:49:18Z dermanomann $

Fields inherited from org.zenmagick.ZMObject
properties_
Method Summary
static void

finish()

Finish execution.

static string

getBaseURL(boolean secure)

Get the store base URL.

static string

getContext()

The application context.

static ZMCurrency

getCurrency()

Get the current currency.

static queryFactory

getDB()

Get the database dao.

static ZMDatabase

getDatabase(array conf)

Get the database (provider).

static ZMLanguage

getDefaultLanguage()

Get the default language.

static long

getExecutionTime(string time)

Get the currently elapsed page execution time.

static ZMLanguage

getLanguage()

Get the language.

static string

getPluginPathPrefix()

Return the base path for plugin URIs.

static string

getPluginsDir()

Return the directory containing all plugins.

static string

getScope()

Get the application scope.

static ZMTheme

getTheme()

Get the current theme.

static string

getThemeId()

Get the effective theme id.

static string

getThemesDir()

Return the directory containing all themes.

static string

getThemesPathPrefix()

Return the base path for theme URIs.

static string

getZMRootPath()

Get the full ZenMagick installation path.

static void

setTheme(ZMTheme theme)

Set the current theme.

static void

setThemeId(string themeId)

Set the theme id.

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

Method Detail

finish

public static void finish()

Finish execution.

Calling this function will end all request handling in an ordered manner.

/


getBaseURL

public static string getBaseURL(boolean secure)

Get the store base URL.

Parameters:
secure - If set, return a secure URL (if configured); default is false.
Returns:
The store base url.

getContext

public static string getContext()

The application context.

Returns:
The application context.

getCurrency

public static ZMCurrency getCurrency()

Get the current currency.

Returns:
The current currency.

getDB

public static queryFactory getDB()

Get the database dao.

Returns:
*The* zen-cart queryFactory instance.

getDatabase

public static ZMDatabase getDatabase(array 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; default is ZMSettings::get('dbProvider').

Parameters:
conf - Optional configuration; default is null to use zen-cart settings.
Returns:
A ZMDatabase implementation.

getDefaultLanguage

public static ZMLanguage getDefaultLanguage()

Get the default language.

Returns:
The default language.

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.

getLanguage

public static ZMLanguage getLanguage()

Get the language.

Returns:
The current language.

getPluginPathPrefix

public static string getPluginPathPrefix()

Return the base path for plugin URIs.

Returns:
The URL path prefix for all plugins.

getPluginsDir

public static string getPluginsDir()

Return the directory containing all plugins.

Returns:
The base directory for plugins.

getScope

public static string getScope()

Get the application scope.

Returns:
Either ZMPlugin::SCOPE_STORE or ZMPlugin::SCOPE_ADMIN.

getTheme

public static ZMTheme getTheme()

Get the current theme.

Returns:
The current theme.

getThemeId

public static string getThemeId()

Get the effective theme id.

Returns:
The currently effective theme id.

getThemesDir

public static string getThemesDir()

Return the directory containing all themes.

Returns:
The base directory for themes.

getThemesPathPrefix

public static string getThemesPathPrefix()

Return the base path for theme URIs.

Returns:
The URL path prefix for all themes.

getZMRootPath

public static string getZMRootPath()

Get the full ZenMagick installation path.

Returns:
The ZenMagick installation folder.

setTheme

public static void setTheme(ZMTheme theme)

Set the current theme.

Parameters:
theme - The theme.

setThemeId

public static void setThemeId(string themeId)

Set the theme id.

This will overwrite the configured theme id.

Calling this method is quite expensive, as all theme specific stuff needs to be updated - this is not completely implemented yet.

Parameters:
themeId - The new theme id.

ZenMagick 0.9.6