contenido\classes\class.cec.php
Description: Contenido Extension Chainer (CEC). See "docs/techref/plugins/Contenido Extension Chainer.pdf" for more details about CEC.
Requirements:
- Author
- Timo A. Hummel
- Author
- Murat Purc
- Con_php_req
- 5.0
- Copyright
- four for business AG
- License
- http://www.contenido.org/license/LIZENZ.txt
- Link
- http://www.4fb.de
- Link
- http://www.contenido.org
- Package
- Contenido Backend classes
- Since
- file available since contenido release <= 4.6 {@internal created unknown modified 2008-06-30, Dominik Ziegler, add security fix modified 2008-08-28, Murat Purc, add singleton pattern feature modified 2009-12-30, Murat Purc, redesign of cApiCECRegistry and pApiCECChainItem bearing in mind of downwards compatibility and documenting the code, see [#CON-291], also regards to [#CON-256] $Id: class.cec.php 1110 2010-01-01 11:11:50Z xmurrix $: }}
- Subpackage
- CEC
- Version
- 1.2.0
\cApiCECRegistry
Used to register chains and chain functions to invoke.
Following 3 types of CEC functions/callbacks are supported at the moment: - Callbacks, which should only be invoked. They don't return a value and have no break conditions, @see CEC_Hook::execute() - Callbacks, which should return a value and/or should modify a passed parameter,
- See
- - Callbacks, which should be processed untill a defined break condition achieves, @see CEC_Hook::executeWhileBreakCondition()
- Author
- Timo A. Hummel
- Author
- Murat Purc
Properties
Methods


_addChain(string $sChainName, array $aParameters = array()) : void
Adds the chain to the internal chain holder
Name | Type | Description |
---|---|---|
$sChainName | string | Chain name |
$aParameters | array | Chain parameter |


_resetIterator(string $sChainName) : void
Resets the chain iterator.
Name | Type | Description |
---|---|---|
$sChainName | string |


addChainFunction(string $sChainName, string $sFunctionName) : bool
Adds a chain function which is to invoke.
Name | Type | Description |
---|---|---|
$sChainName | string | Chain name |
$sFunctionName | string | Name of function/callback to invoke. Feasible values are: - "ClassName->methodName" to invoke a method of a ClassName instance. A instance of the clas will be created here. - "ClassName::methodName" to invoke a static method of ClassName. - "FunctionName" to invoke a function. NOTE: Necessary files must be manually included before or by defined autoloader. |
Type | Description |
---|---|
bool | True on success, otherwhise false |


chainFunctionExists(string $sChainName, string $sFunctionName) : bool
Checks if a chain function exists.
Name | Type | Description |
---|---|---|
$sChainName | string | Chain name |
$sFunctionName | string | Name of function to check |
Type | Description |
---|---|
bool |


getInstance() : \cApiCECRegistry
Returns a instance of cApiCECRegistry
Type | Description |
---|---|
\cApiCECRegistry |


getIterator(string $sChainName) : \cIterator
Returns the iterator for a desired chain.
Name | Type | Description |
---|---|---|
$sChainName | string | Chain name |
Type | Description |
---|---|
\cIterator |
- TODO
- : cIterator should be replaced by ArrayIterator (@see http://www.php.net/spl) but ArrayIterator uses rewind() instead of reset()...


isChainRegistered(string $sChainName) : bool
Checks if a chain is registered or not.
Name | Type | Description |
---|---|---|
$sChainName | string |
Type | Description |
---|---|
bool |


registerChain(string $sChainName) : void
Registers a chain (adds the chain to the internal chain holder)
Name | Type | Description |
---|---|---|
$sChainName | string |


removeChainFunction(string $sChainName, string $sFunctionName) : void
Removes a chain function.
Name | Type | Description |
---|---|---|
$sChainName | string | Chain name |
$sFunctionName | string | Name of function to remove from chain. |
\pApiCECChainItem
- Author
- Timo A. Hummel
- Author
- Murat Purc
Properties


array|string $_mCallback
Contains either the function name to invoke, or a indexed array (class/object and method) and it's method to execute.
- Type
- array | string
Methods


__construct(string $sChainName, string $sFunctionName, array $aParameters) : void
Constructor, sets the CEC chain item properties.
Name | Type | Description |
---|---|---|
$sChainName | string | |
$sFunctionName | string | |
$aParameters | array |


execute() : mixed
Invokes the CEC function/callback.
Type | Description |
---|---|
mixed | If available, the result of the CEC function/callback |


getTemporaryArguments() : void
Will be invoked by execute() method.
If temporary arguments where set before, it returns them and resets the property.


setCallback( $callback) : string | array
Sets the callback
Name | Type | Description |
---|---|---|
$callback |
Type | Description |
---|---|
string | array |


setChainName(string $sChainName) : void
Sets the chain name
Name | Type | Description |
---|---|---|
$sChainName | string |


setFunctionName(string $sFunctionName) : void
Sets the function name
Name | Type | Description |
---|---|---|
$sFunctionName | string |


setParameters(array $aParameters) : void
Sets the callback parameters
Name | Type | Description |
---|---|---|
$aParameters | array |