ZenMagick 0.9.6


org.zenmagick.rp.uip.themes.ZMTheme

Class ZMTheme

ZMObject
|
+--ZMTheme

public class ZMTheme
extends ZMObject

A theme.

Author:
DerManoMann
Version:
$Id: ZMTheme.php 2168 2009-04-17 05:13:14Z dermanomann $

Fields inherited from org.zenmagick.ZMObject
properties_
Constructor Summary

ZMTheme(mixed themeId)

Create new instance.

Method Summary
string

getBoxesDir()

Return the path of the boxes directory.

string

getContentDir()

Return the path of the content directory.

string

getExtraDir()

Return the path of the extra directory.

string

getLangDir()

Return the path of the lang directory.

string

getRootDir()

Return the full filename for the themes root directory.

array

getStaticPageList(boolean includeDefaults, int languageId)

Get a list of available static pages.

string

getThemeId()

Get this themes id.

ZMThemeInfo

getThemeInfo()

Get the ZMThemeInfo for this theme.

string

getViewsDir()

Return the path of the views directory.

boolean

hasLayout(string page)

Check if a layout is configured for the given page.

void

loadLocale(ZMLanguage language)

Load locale settings (l10n/i18n).

boolean

saveStaticPageContent(string page, string contents, int languageId)

Write the content of a static (define) page.

string

staticPageContent(string page, int languageId, boolean echo)

Get the content of a static (define) page.

string

themeFile(string name, string baseDir, boolean echo)

Resolve a theme relative filename into a full path.

string

themeFileContents(string file)

Load and eval a theme file.

boolean

themeFileExists(string name, string baseDir)

Check if the given theme relative file exists.

string

themeURL(string uri, boolean echo)

Resolve a theme relative URI.

string

zcStaticPageContent(string page, int languageId, boolean echo)

Get the content of a static (define) page using the zen-cart location.

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

Constructor Detail

ZMTheme

public ZMTheme(mixed themeId)

Create new instance.

Params:
string themeId The theme id/name.

Method Detail

getBoxesDir

public string getBoxesDir()

Return the path of the boxes directory.

Returns:
A full filename denoting the themes boxes directory.

getContentDir

public string getContentDir()

Return the path of the content directory.

Returns:
A full filename denoting the themes content directory.

getExtraDir

public string getExtraDir()

Return the path of the extra directory.

Returns:
A full filename denoting the themes extra directory.

getLangDir

public string getLangDir()

Return the path of the lang directory.

Returns:
A full filename denoting the themes lang directory.

getRootDir

public string getRootDir()

Return the full filename for the themes root directory.

Returns:
The themes root directory.

getStaticPageList

public array getStaticPageList(boolean includeDefaults, int languageId)

Get a list of available static pages.

Parameters:
includeDefaults - If set to true, default pages will be included; default is false.
languageId - Optional language id; default is null for current language.
Returns:
List of available static page names.

getThemeId

public string getThemeId()

Get this themes id.

Returns:
The theme id.

getThemeInfo

public ZMThemeInfo getThemeInfo()

Get the ZMThemeInfo for this theme.

Returns:
A ZMThemeInfo instance.

getViewsDir

public string getViewsDir()

Return the path of the views directory.

Returns:
A full filename denoting the themes views directory.

hasLayout

public boolean hasLayout(string page)

Check if a layout is configured for the given page.

Parameters:
page - The page name.
Returns:
true if a layout file is configured for the given page.

loadLocale

public void loadLocale(ZMLanguage language)

Load locale settings (l10n/i18n).

NOTE: This is only going to load mappings. However, since i18n settings need to be set using define(..), this is done in a separate function, once loading (and theme switching) is over.

Parameters:
language - The language.

saveStaticPageContent

public boolean saveStaticPageContent(string page, string contents, int languageId)

Write the content of a static (define) page.

Parameters:
page - The page name.
contents - The contents.
languageId - Optional language id; default is null for current language.
Returns:
The status.

staticPageContent

public string staticPageContent(string page, int languageId, boolean echo)

Get the content of a static (define) page.

If the file is not found and isEnableThemeDefaults is set to true, the method will try to resolve the name in the default theme.

Parameters:
page - The page name.
languageId - Optional language id; default is null for current language.
echo - If true, the URL will be echo'ed as well as returned.
Returns:
The content or null.

themeFile

public string themeFile(string name, string baseDir, boolean echo)

Resolve a theme relative filename into a full path.

If the file is not found and isEnableThemeDefaults is set to true, the method will try to resolve the name in the default theme.

Parameters:
name - A theme relative filename.
baseDir - An optional base directory; default is content/
echo - If true, the URL will be echo'ed as well as returned.
Returns:
A fully qualified filename.

themeFileContents

public string themeFileContents(string file)

Load and eval a theme file.

This allows to use PHP code in, for example, JavaScript files. One side-effect is that the evaluated content is inline'ed rather than loaded from a separate file. That means it's more usefule for small snippets rather than large files

Parameters:
file - The filename.
Returns:
The eval'ed content.

themeFileExists

public boolean themeFileExists(string name, string baseDir)

Check if the given theme relative file exists.

Parameters:
name - A theme relative filename.
baseDir - An optional base directory; default is content/
Returns:
true if the file exists, false if not.

themeURL

public string themeURL(string uri, boolean echo)

Resolve a theme relative URI.

The given uri is assumed to be relative to the themes content folder.

If the file is not found and isEnableThemeDefaults is set to true, the method will try to resolve the name in the default theme.

Parameters:
uri - The relative URI.
echo - If true, the URL will be echo'ed as well as returned.
Returns:
An absolute URL.

zcStaticPageContent

public string zcStaticPageContent(string page, int languageId, boolean echo)

Get the content of a static (define) page using the zen-cart location.

If the file is not found and isEnableThemeDefaults is set to true, the method will try to resolve the name in the default theme.

Parameters:
page - The page name.
languageId - Optional language id; default is null for current language.
echo - If true, the URL will be echo'ed as well as returned.
Returns:
The content or null.

ZenMagick 0.9.6