Arta

Creates a frame for an Artaengine based application. Starts the application, loads basic stuff and holds configs. Dispatches URL to factory and sets error handlers. Most of the properties of this class hold the configs which are used by other Artaengine classes, thought they are left public to be reachable and tweak-able when it's needed.
Source
Arta.php
Implements
IArta
Depends on
Request , UrlFactoryMapNotExists , ResourceNotFound , Session , Localization , RaiseHandler , Log , Buildout , ErrorException , Inspect

Constants

VERSION = '2.0'

Artaengine version

Static Properties

HtmlDebug = true

Arta::$HtmlDebug = true

I(); and inspect(); output format. True = HTML, False = text.

autoload = array

Arta::$autoload = array()

List of autoload paths which will be used by the autoload handler.

cacheConfigs

Arta::$cacheConfigs

Cache configurations.

configs

Arta::$configs

App configs, from app configs ini files or array.

customAutoload

Arta::$customAutoload

Path to a PHP file containing a custom autoload function.

dateFormat = 'Y/m/d'

Arta::$dateFormat = 'Y/m/d'

The default date format. Set in app cofigs under [arta] to key 'date-format'.

dbConfigs

Arta::$dbConfigs

Database configurations.

exceptionHandler

Arta::$exceptionHandler

Exception handler function(method).

factory

Arta::$factory

Reference to current factory object.

globals = array

Arta::$globals = array()

To be used for storing global values instead of $_GLOBALS.

illegalHandler

Arta::$illegalHandler

Special event handler access.

logConfigs

Arta::$logConfigs

Log configurations.

nofactoryHandler

Arta::$nofactoryHandler

Special event handler access.

notajaxHandler

Arta::$notajaxHandler

Special event handler access.

notfoundHandler

Arta::$notfoundHandler

Special event handler access.

permissionsClass

Arta::$permissionsClass

Class permissions. Used by the permission Principal.

permissionsFactory

Arta::$permissionsFactory

Factory permissions. Used by the permission Principal.

principal

Arta::$principal

Name of the application princName of application principal class (class which checks permissions).

tplConfigs

Arta::$tplConfigs

Factory and template configurations.

unauthorizedHandler

Arta::$unauthorizedHandler

Special event handler access.

Static Methods

build

void Arta::build(string | array configs=null)

Builds the application. /build

Arguments

    configs=null (string | array)
    App configs ini file-path or array

Returns

void

errorHandler

void Arta::errorHandler(int code, string description, string file, int line)

Default error handler - converts error to exception and calls the exception handler.

See also
http://artaengine.com/tutorials/url-mapping#handle

Arguments

    code (int)
    Error code
    description (string)
    Error description
    file (string)
    File which raised the error
    line (int)
    Line where the error happened

Returns

void

Throws

  • ErrorException Throws the error as exception

exceptionHandler

void Arta::exceptionHandler(ErrorException exception)

Default exception handler. If an exception handler factory is not defined this method will catch all exceptions, if debug mode or PHP error reporting is off then swallows the exception otherwise shows a message.

See also
http://artaengine.com/tutorials/url-mapping#handle

Arguments

    exception (ErrorException)
    ErrorException Object to be handled

Returns

void

g

mixed Arta::g(string key, mixed default=null)

Get value of a global variable defined in Arta::$globals

Arguments

    key (string)
    Variable name
    default=null (mixed)
    If key did not exist return this value

Returns

mixed
Value of the global key or default

makePath

string Arta::makePath(array | string | [string] paths)

Fixes/sticks a path(s) and replaces "ARTA_DIR", "APP_DIR", "ARTA_TEMP_DIR" and "TEMP_DIR" inside the path with their real directory values.

Since
Artaengine 1.1.0

Arguments

    paths (array | string | [string])
    An array of paths, one paths or parts of a path to be sticked together, be fixed and constants be replaced with real paths.

Returns

string
Fixed path

now

string Arta::now(string format=null, string zone=null)

Get current time. The timezone and format are defined in app config under section 'arta' with keys 'timezone' and 'date_format', if not set the default values will be 'UTC' and 'Y/m/d H:i:s'.

See also
To get dates based on user's selected locale
Since
Artaengine 1.1.0

Arguments

    format=null (string)
    Date/time format, null='date_format H:i:s' or 'Y/m/d H:i:s'
    zone=null (string)
    Time zone, null=default application time zone or 'UTC'

Returns

string
Current date-time

start

void Arta::start(string | array configs=null)

Start an Artaengine application.

Arguments

    configs=null (string | array)
    App configs ini file-path or array

Returns

void

Throws

Methods

__construct

Arta $obj = new Arta(string | array configs=null)

Start an Artaengine application. An application can also be started by calling the static method "Arta::Start(configs)" without the need to create an Arta object.

Arguments

    configs=null (string | array)
    App configs ini file-path or array

Returns

void