contenido\classes\class.cec.php

Show: PublicProtectedPrivateinherited
Table of Contents
Project: Contenido Content Management System

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

Package: Contenido Backend classes\CEC
CEC registry class.

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

>VPropertyprivatearray $_aChains
List of available chains
Details
Type
array
>VPropertyprivate\cApiCECRegistry $_instance = null
static
Self instance
Default valuenullDetails
Type
\cApiCECRegistry

Methods

methodprivate__clone() : void

Prevent cloning

methodprotected__construct() : void

Constructor

methodprotected_addChain(string $sChainName, array $aParameters = array()) : void

Adds the chain to the internal chain holder

Parameters
NameTypeDescription
$sChainNamestring

Chain name

$aParametersarray

Chain parameter

methodprotected_resetIterator(string $sChainName) : void

Resets the chain iterator.

Parameters
NameTypeDescription
$sChainNamestring
methodpublicaddChainFunction(string $sChainName, string $sFunctionName) : bool

Adds a chain function which is to invoke.

Parameters
NameTypeDescription
$sChainNamestring

Chain name

$sFunctionNamestring

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.

Returns
TypeDescription
boolTrue on success, otherwhise false
methodpublicchainFunctionExists(string $sChainName, string $sFunctionName) : bool

Checks if a chain function exists.

Parameters
NameTypeDescription
$sChainNamestring

Chain name

$sFunctionNamestring

Name of function to check

Returns
TypeDescription
bool
methodpublicgetInstance() : \cApiCECRegistry
static

Returns a instance of cApiCECRegistry

Returns
TypeDescription
\cApiCECRegistry
methodpublicgetIterator(string $sChainName) : \cIterator

Returns the iterator for a desired chain.

Parameters
NameTypeDescription
$sChainNamestring

Chain name

Returns
TypeDescription
\cIterator
Details
TODO
: cIterator should be replaced by ArrayIterator (@see http://www.php.net/spl) but ArrayIterator uses rewind() instead of reset()...  
methodpublicgetRegisteredChainNames() : array

Returns list of registered chain names

Returns
TypeDescription
array
methodpublicisChainRegistered(string $sChainName) : bool

Checks if a chain is registered or not.

Parameters
NameTypeDescription
$sChainNamestring
Returns
TypeDescription
bool
methodpublicregisterChain(string $sChainName) : void

Registers a chain (adds the chain to the internal chain holder)

Parameters
NameTypeDescription
$sChainNamestring
methodpublicremoveChainFunction(string $sChainName, string $sFunctionName) : void

Removes a chain function.

Parameters
NameTypeDescription
$sChainNamestring

Chain name

$sFunctionNamestring

Name of function to remove from chain.

methodpublicunregisterChain(string $sChainName) : void

Unregisters a chain

Parameters
NameTypeDescription
$sChainNamestring

\pApiCECChainItem

Package: Contenido Backend classes\CEC
CEC chain item class.
Author
Timo A. Hummel  
Author
Murat Purc  

Properties

>VPropertyprotectedarray $_aParameters
Parameter to pass to the function
Details
Type
array
>VPropertyprotectedarray|string $_mCallback
Callback name.

Contains either the function name to invoke, or a indexed array (class/object and method) and it's method to execute.

Details
Type
array | string
>VPropertyprotectedarray|null $_mTemporaryArguments
Temporary arguments holder
Details
Type
array | null
>VPropertyprotectedstring $_sChainName
Chain name
Details
Type
string
>VPropertyprotectedstring $_sFunctionName
Name of function to invoke
Details
Type
string

Methods

methodpublic__construct(string $sChainName, string $sFunctionName, array $aParameters) : void

Constructor, sets the CEC chain item properties.

Parameters
NameTypeDescription
$sChainNamestring
$sFunctionNamestring
$aParametersarray
methodpublicexecute() : mixed

Invokes the CEC function/callback.

Returns
TypeDescription
mixedIf available, the result of the CEC function/callback
methodpublicgetCallback() : string | array

Returns the callback

Returns
TypeDescription
string | array
methodpublicgetChainName() : string

Returns the chain name

Returns
TypeDescription
string
methodpublicgetFunctionName() : string

Returns the function name

Returns
TypeDescription
string
methodpublicgetParameters() : array

Returns the function name

Returns
TypeDescription
array
methodpublicgetTemporaryArguments() : void

Will be invoked by execute() method.

If temporary arguments where set before, it returns them and resets the property.

methodpublicsetCallback( $callback) : string | array

Sets the callback

Parameters
NameTypeDescription
$callback
Returns
TypeDescription
string | array
methodpublicsetChainName(string $sChainName) : void

Sets the chain name

Parameters
NameTypeDescription
$sChainNamestring
methodpublicsetFunctionName(string $sFunctionName) : void

Sets the function name

Parameters
NameTypeDescription
$sFunctionNamestring
methodpublicsetParameters(array $aParameters) : void

Sets the callback parameters

Parameters
NameTypeDescription
$aParametersarray
methodpublicsetTemporaryArguments(array $args = array()) : void

Another way to set the arguments before invoking execute() method.

Parameters
NameTypeDescription
$argsarray
Documentation was generated by phpDocumentor 2.0.0a12.