Documentation

Sigma extends HTML_Template_Sigma
in package

Description of Sigma

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Michael Ritter michael.ritter@comvation.com

Thomas Däppen thomas.daeppen@comvation.com

subpackage

core_html

Table of Contents

Properties

$variablenameRegExp  : string
Override placeholder regexp to only match uppercase alphanumeric placeholders
$callbackPlaceholders  : array<string|int, mixed>
List of callbacks to register for all instances
$callbackPlaceholdersWithPreservedArgs  : array<string|int, mixed>
List of callback names that need variable substitution to happen after execution
$parseTarget  : ParseTarget
Target where this instance is parsed into
$restoreFileRoot  : mixed

Methods

__construct()  : mixed
Cx Sigma constructor
_buildBlocks()  : mixed
{@inheritDoc} Added two extensions: - Trigger events {@see static::cxLoadTemplate()} - Allow duplicate template blocks (see CLX-4854)
addBlockfile()  : mixed
addCallbackPlaceholder()  : mixed
Adds a callback function to the list of callbacks for all instances
blockExists()  : bool
getCallbackPlaceholders()  : array<string|int, mixed>
Returns a list of callbacks registered for all instances
getChildrenOfBlock()  : array<string|int, mixed>
Get list of all template blocks that are located directly within the template block `$block` or indirectly through child blocks of `$block`.
getParseTarget()  : ParseTarget
Returns this instances parse target (might be null)
getRoot()  : mixed
getUnparsedBlock()  : string
Returns an unparsed block (/as it was delivered) This is useful for "reflection". This is used by ESI parsing.
hideBlock()  : int
Check if the given block exist. If not then an error is logged.
loadTemplateFile()  : mixed
parse()  : bool
Check if the given block exist and if it exist the given block is parsed.
removeCallbackPlaceholder()  : mixed
Removes a registered callback
replaceBlock()  : mixed
replaceBlockfile()  : mixed
setCacheRoot()  : mixed
setCurrentBlock()  : int
Check if the given block exist. If not then an error is logged.
setGlobalVariable()  : mixed
Triggers an event on setGlobalVariable()
setParseTarget()  : mixed
Sets the parse target after initialization
setVariable()  : mixed
Triggers an event on setVariable()
toggleBlock()  : int
Helper to simplify showing/hiding blocks
touchBlock()  : int
Check if the given block exist. If not then an error is logged.
cxLoadTemplate()  : void
Triggers an event on setTemplate() and setTemplateFile()
internalSetVariables()  : mixed
Triggers events on setVariable() and setGlobalVariable()
mapCustomizing()  : mixed
Detects if $filename is customized.
unmapCustomizing()  : mixed
In case a customized version of a file has been loaded.

Properties

$variablenameRegExp

Override placeholder regexp to only match uppercase alphanumeric placeholders

public string $variablenameRegExp = '[0-9A-Z_]+'

$callbackPlaceholders

List of callbacks to register for all instances

protected static array<string|int, mixed> $callbackPlaceholders = array()
Tags
see
parent::setCallbackFunction()

$callbackPlaceholdersWithPreservedArgs

List of callback names that need variable substitution to happen after execution

protected static array<string|int, mixed> $callbackPlaceholdersWithPreservedArgs = array()

List of callback placeholder names

Tags
see
parent::setCallbackFunction()

$restoreFileRoot

protected mixed $restoreFileRoot = null

Methods

__construct()

Cx Sigma constructor

public __construct([string $root = '' ][, string $cacheRoot = '' ][, ParseTarget $parseTarget = null ]) : mixed
Parameters
$root : string = ''

root directory for templates

$cacheRoot : string = ''

directory to cache "prepared" templates in

$parseTarget : ParseTarget = null

(optional) Target where this instance will get parsed into

_buildBlocks()

{@inheritDoc} Added two extensions: - Trigger events {@see static::cxLoadTemplate()} - Allow duplicate template blocks (see CLX-4854)

public _buildBlocks(mixed $string) : mixed
Parameters
$string : mixed

addBlockfile()

public addBlockfile(mixed $placeholder, mixed $block, mixed $filename) : mixed
Parameters
$placeholder : mixed
$block : mixed
$filename : mixed

addCallbackPlaceholder()

Adds a callback function to the list of callbacks for all instances

public static addCallbackPlaceholder(string $name, callable $callback[, bool $preserveArgs = true ]) : mixed
Parameters
$name : string

Name of callback to register

$callback : callable

Callback to call for all occurences

$preserveArgs : bool = true

If set to false, variable substitution is done beforehand

blockExists()

public blockExists(mixed $block[, bool $withinCurrentBlockOnly = false ]) : bool
Parameters
$block : mixed
$withinCurrentBlockOnly : bool = false
Tags
inheritDoc

If $withinCurrentBlockOnly is true, considers the current block (set by static::setCurrentBlock()) only. For the global block, this has no effect.

Return values
bool

getCallbackPlaceholders()

Returns a list of callbacks registered for all instances

public static getCallbackPlaceholders() : array<string|int, mixed>
Return values
array<string|int, mixed> —

List of callbacks ($name=>$callable)

getChildrenOfBlock()

Get list of all template blocks that are located directly within the template block `$block` or indirectly through child blocks of `$block`.

public getChildrenOfBlock([string $block = '__global__' ]) : array<string|int, mixed>

Do not use. Sigma is unable to parse only blocks contained within a block. This is a work-around. Nice solution would be to make parse() aware of the structure (which would lead to a lot of refactoring). This is only used for MediaDir Inputfields. Known use-case is the "multiple rows" feature, but there might be more cases in MediaDir where this fixes problems.

Parameters
$block : string = '__global__'

The me of the template block from which to fetch its children.

Return values
array<string|int, mixed> —

List of child blocks (as strings) of block $block.

getParseTarget()

Returns this instances parse target (might be null)

public getParseTarget() : ParseTarget
Return values
ParseTarget —

Target where this instances will get parsed into (or null)

getUnparsedBlock()

Returns an unparsed block (/as it was delivered) This is useful for "reflection". This is used by ESI parsing.

public getUnparsedBlock(string $blockName) : string
Parameters
$blockName : string

Name of block to return

Tags
author

Michael Ritter michael.ritter@cloudrexx.com

throws
Exception

Thrown if the block does not exist within this template

Return values
string —

Template content

hideBlock()

Check if the given block exist. If not then an error is logged.

public hideBlock(mixed $block) : int

Otherwise it hides the block even if it is not "empty".

Is somewhat an opposite to touchBlock().

Parameters
$block : mixed
Return values
int —

SIGMA_OK on success, SIGMA_BLOCK_NOT_FOUND on failure

loadTemplateFile()

public loadTemplateFile(mixed $filename[, mixed $removeUnknownVariables = true ][, mixed $removeEmptyBlocks = true ]) : mixed
Parameters
$filename : mixed
$removeUnknownVariables : mixed = true
$removeEmptyBlocks : mixed = true

parse()

Check if the given block exist and if it exist the given block is parsed.

public parse([mixed $block = '__global__' ][, mixed $flagRecursion = false ][, mixed $fakeParse = false ]) : bool

Otherwise an error is logged.

Parameters
$block : mixed = '__global__'
$flagRecursion : mixed = false
$fakeParse : mixed = false
Return values
bool —

true if block is not empty

removeCallbackPlaceholder()

Removes a registered callback

public static removeCallbackPlaceholder(string $name) : mixed
Parameters
$name : string

Name of callback to unregister

replaceBlock()

public replaceBlock(mixed $block, mixed $template[, mixed $keepContent = false ][, mixed $outer = false ]) : mixed
Parameters
$block : mixed
$template : mixed
$keepContent : mixed = false
$outer : mixed = false

replaceBlockfile()

public replaceBlockfile(mixed $block, mixed $filename[, mixed $keepContent = false ]) : mixed
Parameters
$block : mixed
$filename : mixed
$keepContent : mixed = false

setCacheRoot()

public setCacheRoot(mixed $root) : mixed
Parameters
$root : mixed
Tags
inheritDoc

setCurrentBlock()

Check if the given block exist. If not then an error is logged.

public setCurrentBlock([mixed $block = '__global__' ]) : int

Otherwise it sets the name of the current block: the block where variables are added

Parameters
$block : mixed = '__global__'
Return values
int —

SIGMA_OK on success, SIGMA_BLOCK_NOT_FOUND on failure

setGlobalVariable()

Triggers an event on setGlobalVariable()

public setGlobalVariable(mixed $variable[, mixed $value = '' ]) : mixed
Parameters
$variable : mixed
$value : mixed = ''
Tags
inheritDoc

setParseTarget()

Sets the parse target after initialization

public setParseTarget(mixed $parseTarget) : mixed

Set parse target on initialization

Parameters
$parseTarget : mixed

setVariable()

Triggers an event on setVariable()

public setVariable(mixed $variable[, mixed $value = '' ]) : mixed
Parameters
$variable : mixed
$value : mixed = ''
Tags
inheritDoc

toggleBlock()

Helper to simplify showing/hiding blocks

public toggleBlock(string $blockName, bool $show) : int
Parameters
$blockName : string

Name of the block to toggle

$show : bool

Whether to show (true) or hide (false) the block

Return values
int —

SIGMA_OK on success, SIGMA_BLOCK_NOT_FOUND on failure

touchBlock()

Check if the given block exist. If not then an error is logged.

public touchBlock(mixed $block) : int

Otherwise it preserves the block.

Parameters
$block : mixed
Return values
int —

SIGMA_OK on success, SIGMA_BLOCK_NOT_FOUND on failure

cxLoadTemplate()

Triggers an event on setTemplate() and setTemplateFile()

protected cxLoadTemplate(string &$string) : void
Parameters
$string : string

Contants the template that will be passed as argument key 'content' to the event View.Sigma:loadContent.

internalSetVariables()

Triggers events on setVariable() and setGlobalVariable()

protected internalSetVariables(string|array<string|int, mixed> &$variable[, string|array<string|int, mixed> &$value = '' ]) : mixed
Parameters
$variable : string|array<string|int, mixed>

Variable name or key/value array

$value : string|array<string|int, mixed> = ''

Value or key/value array for sub-keys

mapCustomizing()

Detects if $filename is customized.

protected mapCustomizing(string $filename) : mixed

If so, it causes \HTML_Template_Sigma to load the customized version of the file.

Parameters
$filename : string

The filename passed by the overwritten methods of \HTML_Template_Sigma

unmapCustomizing()

In case a customized version of a file has been loaded.

protected unmapCustomizing() : mixed

This method does revert \HTML_Template_Sigma so that is will continue to load regular files without customizings.

On this page

Search results