This loads and controls everything

copyright CONTREXX CMS - COMVATION AG
author Michael Ritter
package contrexx
subpackage core
link contrexx homepage
since v3.1.0
todo Remove all instances of "global" or at least move them to a single place

 Methods

Return ClassLoader instance

getClassLoader() : \Cx\Core\ClassLoader\ClassLoader

Returns the database connection handler

getDb() : \Cx\Core\Model\Db

Returns

\Cx\Core\Model\DbDB connection handler

Returns the Contrexx event manager instance

getEvents() : \Cx\Core\Event\Controller\EventManager

Returns the license for this instance

getLicense() : \Cx\Core_Modules\License\License

Returns

\Cx\Core_Modules\License\License

Returns the mode this instance of Cx is in

getMode() : string

Returns

stringOne of 'cli', 'frontend', 'backend', 'minimal'

Returns the resolved page

getPage() : \Cx\Core\ContentManager\Model\Entity\Page

Please note, that this works only if mode is self::MODE_FRONTEND by now If resolving has not taken place yet, null is returned

Returns

Returns the request URL

getRequest() : \Cx\Core\Routing\Url

Returns

Returns the main template

getTemplate() : \Cx\Core\Html\Sigma

Returns

\Cx\Core\Html\SigmaMain template

Returns the toolbox

getToolbox() : \FWSystem

Returns

\FWSystemToolbox

Returns the current user object

getUser() : \FWUser

Returns

\FWUserCurrent user

This creates instances of this class

instanciate(string $mode, boolean $forceNew) : \Cx\Core\Core\Controller\Cx
Static

Normally the first instance is returned. This method is necessary because of special cases like license update in installer, which has to initialize Cx in order to perform a user login and then including versioncheck.php, which load Cx for standalone operation.

Parameters

$mode

string

(optional) One of the modes listed in constants above

$forceNew

boolean

(optional) Wheter to force a new instance or not, default false

Returns

\Cx\Core\Core\Controller\CxInstance of this class

Initializes the Cx class This does everything related to Contrexx.

__construct(string $mode) 

Parameters

$mode

string

(optional) Use constants, one of self::MODE_[FRONTEND|BACKEND|CLI|MINIMAL]

Adjust the protocol to https if https is activated for the current area (frontend|backend)

adjustProtocol() : null | string

Returns

nullstringthe correct protocol

Check whether the user accessed the correct domain url and protocol

adjustRequest() : mixed

Returns

mixed

Check whether the requested url is correct or not there is a settings option in the general settings section of contrexx which allows to force the domain url which is provided

checkDomainUrl() : null | string

Returns

nullstringthe correct domain url

Check whether the system is running

checkSystemState() 

Exceptions

\Exception

Parses the main template in order to finish request

finalize() 
todo Remove usage of globals
global type $themesPages
global null $moduleStyleFile
global type $objCache
global array $_CONFIG
global type $subMenuTitle
global type $_CORELANG
global type $plainCmd
global type $cmd

Sets the parameters to the correct path values

fixPaths(string $documentRoot, string $rootOffset) 

Parameters

$documentRoot

string

Document root for this vHost

$rootOffset

string

Document root offset for this installation

Loads a subclass of this class from customizing if available

handleCustomizing() : null

Returns

null

Loading ClassLoader, EventManager, Env, DB, API and InitCMS (Env, API and InitCMS are deprecated)

init() 
todo Remove deprecated elements
todo Remove usage of globals
global array $_CONFIG
global type $_FTPCONFIG
global type $objDatabase
global type $objInit

This populates globals for legacy code

legacyGlobalsHook(int $no) 
todo Avoid this! All this should be part of some components hook
global type $objFWUser
global type $objTemplate
global type $cl
global \InitCMS $objInit
global type $_LANGID
global type $_CORELANG
global \Cx\Core\Routing\Url $url

Parameters

$no

int

Hook number

Loads all active components

loadComponents() 

Loads configuration files (settings.php and set_constants.php)

loadConfig() 

configuration.php is loaded in index.php in order to load this file from its correct location.

todo Find a way to store configuration by avoiding global variables
global array $_CONFIG Configuration array from /config/settings.php
global array $_PATHCONFIG Path configuration from /config/configuration.php

Exceptions

\Exception If the CMS is deactivated, an exception is thrown

This parses the content

loadContent() 

This cannot be used in mode self::MODE_CLI, since content is added to template directly

todo Write a method, that only returns the content, in order to allow usage in CLI mode
todo Remove usage of globals
global type $plainSection
global type $_ARRAYLANG

Initializes global template, executes all component hook methods and parses the template.

loadContrexx() 

Init main template object

loadTemplate() 

In backend mode, ASCMS_ADMIN_TEMPLATE_PATH/index.html is opened In all other modes, no file is loaded here

Calls hooks after content was processed

postContentLoad() 

Calls hooks after call to finalize()

postFinalize() 

Late initializations.

postInit() 

Loads components

Calls post-resolve hooks

postResolve() 
todo Remove usage of globals

Calls hooks before content is processed

preContentLoad() 
todo Remove usage of globals
global null $moduleStyleFile
global type $plainCmd
global type $plainSection

Calls hooks before finalize() is called

preFinalize() 

Early initializations.

preInit() 

Tries to enable APC and increase RAM size

Calls pre-resolve hooks

preResolve() 

Does the resolving

resolve() 

For modes other than 'frontend', no actual resolving is done, resolver is just initialized in order to return the correct result for $resolver->getUrl()

todo Implement resolver for backend
todo Is this useful in CLI mode?

Set the mode Contrexx is used in

setMode(mixed $mode) 

Parameters

$mode

mixed

Mode as string or true for front- or false for backend

Set main template placeholders required after content parsing

setPostContentLoadPlaceholders() : \Cx\Core\Core\Controller\type
todo Remove usage of globals
global array $_CONFIG
global type $themesPages
global type $objCounter
global type $objBanner
global type $_CORELANG

Returns

\Cx\Core\Core\Controller\type

Set main template placeholders required before parsing the content

setPreContentLoadPlaceholders(\Cx\Core\Core\Controller\type $objTemplate) 
todo Does this even make any sense? Couldn't simply everything be set after content parsing?
todo Remove usage of globals
global type $themesPages
global type $page_template
global array $_CONFIG

Parameters

$objTemplate

\Cx\Core\Core\Controller\type

Starts time measurement for page parsing time

startTimer() 

Stops time measurement and returns page parsing time

stopTimer() : int

Returns

intTime needed to parse page in seconds

This tries to set the memory limit if its lower than 32 megabytes

tryToSetMemoryLimit() 

 Properties

     

$customizingPath : string
     

$instances : array

The first one is the normally used one, all others are special.

 

$langId : int
 

$license : \Cx\Core_Modules\License\License
 

$mode : string
 

$request : \Cx\Core\Routing\Url
     

$startTime : array
 

$template : \Cx\Core\Html\Sigma
 

$toolbox : \FWSystem
todo Update FWSystem

 Constants

 

Backend mode

MODE_BACKEND 

In this mode, Contrexx show the administrative backend

 

Commandline interface mode

MODE_CLI 

In this mode, Contrexx is initialized for commandline usage This mode is BETA at this time

 

Frontend mode

MODE_FRONTEND 

In this mode, Contrexx shows the frontend

 

Minimal mode

MODE_MINIMAL 

In this mode, the whole environment is loaded, but the main template will not be initialized, no component hooks will be executed and the template will not be parsed This mode is BETA at this time

© Copyright 2014 by Comvation AG
Generated on 2014-07-11T08:39:19+02:00.