class VarsTemplate extends Template

Properties

static array $theme_set_config

Stores Theme configuration information

from  Template
static protected int $output_mode from  Template
string $block_id from  Template
array $data_blocks from  Template
$marker_sets
Controller $mod

if called via Controller::get_vars() current instance is referenced

array $html_blocks from  Template
mixed $markers from  Template
protected array $file_cache from  Template
protected string $render_stage from  Template
protected bool $render_stage_key from  Template
protected bool $render_stage_block from  Template
protected int $render_stage_ttl from  Template
protected int $render_stage_force_render from  Template
protected array $_prerendered from  Template
protected bool $final_render_call from  Template
protected array[] $auto_render_sub_blocks from  Template
protected mixed $template_includes from  Template
protected string $render_mode from  Template
protected $previous_render_mode from  Template
$render_mode_block from  Template
protected $_raw_markers from  Template
protected bool $option_template_debug from  Template
protected $last_xtag_if_value from  Template
protected $last_parse_template from  Template
int $id
string $template_file:

stored in MySQL as varchar

string $language:

stored in MySQL as char

string $culture:

stored in MySQL as char

bool $custom:

stored in MySQL as tinyint

string $instance_id:

stored in MySQL as varchar

string $module_name:

stored in MySQL as varchar

string $template:

stored in MySQL as mediumtext

string $hash:

stored in MySQL as binary

int $editor_id
int $created_at:

stored in MySQL as timestamp

int $updated_at:

stored in MySQL as timestamp

string $title

Extract from the XML template

string|bool $loaded_from

string db|file or false if could not be loaded

bool $is_custom

Methods

__construct(string $source, bool $language = false, bool $culture = false, mixed $custom_allowed = null, bool $source_is_text = false)

Vars constructor

mixed
__get(mixed $var)

No description

__toString()

No description

static string
_parse_template_content(string $template_content, bool $block = false, bool $parseLangStrings = true, Template $to = null)

No description

from  Template
static string
_parse_template_content_markers(string $template_content, Template $to)

Parse for ###Markers###

from  Template
static mixed
_parse_template_content_xtags(mixed $content, bool|Template $to = false)

Parse the passed HTML source for xTags and render these xTags

from  Template
bool|string
_render_array_block(mixed $array, mixed $key = false)

Internal Render Function

from  Template
void
add_renderer(string|array $auto_render_sub_block)

No description

from  Template
bool
add_template(string $name, string $path)

Add a template to the registry

from  Template
string
add_xml_wrapper(string $xml_source)

Add xml definition and html,head and body tags around the given xml_source

void
append(string $marker, string $content, string $block = 'content')

No description

from  Template
void
append_to_list(string $marker, string $content, string $block = 'content')

No description

from  Template
assign(mixed $marker, string $content = 'array_fill', string $block = 'content', int|bool $cache_ttl = false, string $cache_group = 'default')

No description

from  Template
assign_js($options)

No description

from  Template
assign_xss()

No description

from  Template
string|null
auto_render_block(string $block)

No description

from  Template
static 
cb_gettext($matches)

No description

from  Template
bool
clear_marker_cache(string $marker = '', string $cache_group = '', string $block = 'content')

No description

from  Template
static DOMNode
convert_to_xml(string $xml_source, array $errors = array())

Convert String to XML Node

from  Template
void
disable_render_stage()

DISABLE Pre-Rendering and resets staging params

from  Template
enable_render_stage(string $render_stage = 'pre', string $cache_key = 'auto', int $ttl = 3600, string $block_id = 'content')

ENABLE Pre-Rendering for template parsing

from  Template
string
format_template_specialchars(string $text)

Escape / Convert Template specific characters (###;{{{;}}})

from  Template
string
generateTemplateCacheKey(string $template_file, string $section, string|null $render_stage = null, string|null $cache_key = null)

No description

from  Template
string
getFileCacheContent(string $tpl, string $section)

No description

from  Template
array|string
get_block_attribute(string $block_name, string|bool $attribute_name = false)

Get Block Attribute

get_block_xml($block_name)

No description

get_blocks()

get an array with all existing blocks

static mixed
get_config(string $var)

Get Config Value of Custom Theme Config

from  Template
array
get_marker_block(string $block)

No description

from  Template
get_marker_content(string $block, string $marker, bool $render_objects = false, $params = false)

No description

from  Template
get_output_mode()

No description

from  Template
get_property($name)

No description

array
get_render_blocks()

No description

from  Template
mixed
get_render_mode(bool $changes_only = false, bool $previous_mode = false)

No description

from  Template
object|string
get_rendered_object(object $object, array $params = null)

Calls the render() function recursively of the passed object and returns the content

from  Template
string
get_template_debug()

Returns the debug output for the current template

from  Template
string
get_xml()

Get XML Document as string

get_xtag_marker_value($params, $is_indexed = false, $clean_params = false, $escape_markers = true)

No description

from  Template
static array
get_xtag_registry()

Returns the xtag registry

from  Template
array
handle_custom_namespace(mixed $ns, int $k, mixed $name)

This function is used to fund

from  Template
init()

No description

init_template_vars()

put your comment there.

from  Template
bool
is_final_render_call()

Is the current render cycle the last cycle? (i.e. initiated from view)

from  Template
load_theme_set_config()

Set the theme configuration (theme set config)

from  Template
bool
marker_is_cached(string $marker, string $cache_group = 'default', string $block = 'content')

No description

from  Template
string
output_html()

Output the final HTML

from  Template
string
output_login_form()

No description

from  Template
string
output_pw_change_form()

No description

from  Template
string
output_two_factor_auth_form()

No description

from  Template
string
parse_partial_template(string $template, string $section, $values)

No description

from  Template
mixed
parse_template(string $template, string|bool $section = false, string|bool $block_id = false, string|bool $recursive = false)

Generic Template Loader

from  Template
string
parse_template_content($template_content, bool $block = false, bool $parseLangStrings = true, bool $to = false)

No description

from  Template
string
parse_template_translate_cb(array $matches)

Callback used by template language replace

from  Template
mixed|string
parse_xtag(array $xml_source)

Evaluate the passed XML Source parse xTags

from  Template
mixed
pre_render_action(string $page, array $args = array())

Enables a template to execute certain tasks before page is fully rendered (e.g. AJAX navigation)

from  Template
register_xtag_parser(string $module_name, bool|array $callback = false)

Register custom xtag parser

from  Template
removeRenderer($block)

Remove a block which in turn will not be rendered

from  Template
string
render()

Render Vars Template

mixed
render_action(mixed $page, array $args = array())

Render Action Function on Template if exists

from  Template
string
render_array_block(mixed $array, string|bool $key = false)

No description

from  Template
string
render_content_marker()

No description

from  Template
string
render_error()

No description

from  Template
string
render_html(bool $final_render_call = false)

No description

from  Template
bool
render_is_prepared(mixed $template, mixed $section = 'false', mixed $render_stage = 'pre', mixed $cache_key = null)

Check wether a render stage is already cached or not This allows controllers to save on processing time if certain fields are calculated for the template only You need to call this function AFTER getting a view

from  Template
string
render_login()

wrapper for beeing able to use the output_login_form as renderer

from  Template
string
render_meta_script_resources()

Render Meta Script Resources

from  Template
string
render_meta_style_resources()

Render CSS Resources

from  Template
render_prepare(string $render_stage = 'pre', string $cache_key = 'global', int $ttl = 3600, string $block_id = 'content')

Pre-Render Templates

from  Template
string
render_system_flash_message()

put your comment there.

from  Template
string
render_xtag(string $tag, array $params)

xTag Controller, regisitered for namespace xt (xelos template)

from  Template
string
render_xtag_element(DOMNode $dom_node, bool $render_only_childs = false, bool $special_child_handling_overwrite = false)

Renders the passed XML Element to String and uses registered xTag Controllers if possible

from  Template
replace_namespace($xml_source)

No description

replace_namespace_reverse($xml_source)

No description

mixed
retrieve(string $marker, string $block = 'content', bool $clean_params = false)

No description

from  Template
void
setFileCacheContent(string $tpl, string $section, string $content = null)

No description

from  Template
set_block_id($block_id)

No description

from  Template
bool
set_block_xml(string $block_name, string $xml_source)

Will set the content of an in the vars template. Creates a new block with type text when it doesn't exist.

void
set_marker_content(string $block, mixed $marker, string $content = 'array_fill', int|bool $cache_ttl = false, string $cache_group = 'default')

Set Marker

from  Template
set_mod(Core $instance)

Set Instance Reference

set_output_mode(int $flags = 0)

Set Output Mode

from  Template
void
set_render_mode(string $mode = 'full', string $block = 'content')

No description

from  Template

Details

at line 74
__construct(string $source, bool $language = false, bool $culture = false, mixed $custom_allowed = null, bool $source_is_text = false)

Vars constructor

Parameters

string $source

Either path to var file or text with template code

bool $language
bool $culture
mixed $custom_allowed
bool $source_is_text

false if $source is a filepath, true if $source is a text with template code

at line 223
mixed __get(mixed $var)

No description

Parameters

mixed $var

Return Value

mixed

at line 229
__toString()

No description

in Template at line 1512
static string _parse_template_content(string $template_content, bool $block = false, bool $parseLangStrings = true, Template $to = null)

internal  param parse $bool Language Token?
 

No description

Parameters

string $template_content

Template Content

bool $block
bool $parseLangStrings
Template $to

Return Value

string

Parsed Template Content

Exceptions

Exception

in Template at line 1559
static string _parse_template_content_markers(string $template_content, Template $to)

Parse for ###Markers###

Parameters

string $template_content
Template $to

Return Value

string

HTML

in Template at line 1601
static mixed _parse_template_content_xtags(mixed $content, bool|Template $to = false)

Parse the passed HTML source for xTags and render these xTags

Parameters

mixed $content
bool|Template $to

Return Value

mixed

in Template at line 958
protected bool|string _render_array_block(mixed $array, mixed $key = false)

Internal Render Function

Parameters

mixed $array
mixed $key

Return Value

bool|string

in Template at line 638
void add_renderer(string|array $auto_render_sub_block)

No description

Parameters

string|array $auto_render_sub_block

Renderer-Name (e.g. overview for a function render_overview)

Return Value

void

in Template at line 278
bool add_template(string $name, string $path)

Add a template to the registry

Parameters

string $name

template caller

string $path

path to template

Return Value

bool

success

at line 302
string add_xml_wrapper(string $xml_source)

Add xml definition and html,head and body tags around the given xml_source

Parameters

string $xml_source

Return Value

string

in Template at line 1193
void append(string $marker, string $content, string $block = 'content')

No description

Parameters

string $marker

Marker ID (e.g. title)

string $content

Content

string $block

Block ID (e.g. content)

Return Value

void

in Template at line 1214
void append_to_list(string $marker, string $content, string $block = 'content')

No description

Parameters

string $marker

Marker ID (e.g. title)

string $content

Content

string $block

Block ID (e.g. content)

Return Value

void

in Template at line 1147
Template assign(mixed $marker, string $content = 'array_fill', string $block = 'content', int|bool $cache_ttl = false, string $cache_group = 'default')

No description

Parameters

mixed $marker

Marker ID or Model Object

string $content

Content (Default assumes $marker to be an array)

string $block

Block ID (e.g. content)

int|bool $cache_ttl

Cache TTL (in seconds)

string $cache_group

Cache Group (e.g. userID, Group)

Return Value

Template

in Template at line 3145
assign_js($options)

No description

Parameters

$options

in Template at line 1171
Template assign_xss()

internal  param mixed $marker Marker ID or Model Object
internal  param string $content Content (Default assumes $marker to be an array)
internal  param string $block Block ID (e.g. content)
internal  param int $cache_ttl Cache TTL (in seconds)
internal  param string $cache_group Cache Group (e.g. userID, Group)
 

No description

Return Value

Template

in Template at line 598
final protected string|null auto_render_block(string $block)

No description

Parameters

string $block

Block to be rendered (e.g. content)

Return Value

string|null

Returns HTML if staged rendering is active

in Template at line 1543
static cb_gettext($matches)

No description

Parameters

$matches

in Template at line 1087
bool clear_marker_cache(string $marker = '', string $cache_group = '', string $block = 'content')

No description

Parameters

string $marker

Marker ID

string $cache_group

Cache Group

string $block

Block

Return Value

bool

success

in Template at line 2580
static DOMNode convert_to_xml(string $xml_source, array $errors = array())

Convert String to XML Node

Parameters

string $xml_source
array $errors

Return Value

DOMNode

in Template at line 458
protected void disable_render_stage()

DISABLE Pre-Rendering and resets staging params

Return Value

void

in Template at line 446
protected enable_render_stage(string $render_stage = 'pre', string $cache_key = 'auto', int $ttl = 3600, string $block_id = 'content')

ENABLE Pre-Rendering for template parsing

Parameters

string $render_stage
  • This string will identify items which should be cached during the pre-render phase
string $cache_key
  • Set the cache key to be used
int $ttl
  • Time to live for the cache
string $block_id
  • rendering applies to this block

in Template at line 3141
string format_template_specialchars(string $text)

Escape / Convert Template specific characters (###;{{{;}}})

Parameters

string $text

Return Value

string

in Template at line 1299
string generateTemplateCacheKey(string $template_file, string $section, string|null $render_stage = null, string|null $cache_key = null)

No description

Parameters

string $template_file
string $section
string|null $render_stage
string|null $cache_key

Return Value

string

in Template at line 3184
string getFileCacheContent(string $tpl, string $section)

No description

Parameters

string $tpl
string $section

Return Value

string

at line 148
array|string get_block_attribute(string $block_name, string|bool $attribute_name = false)

Get Block Attribute

Parameters

string $block_name
string|bool $attribute_name

(false for all attributes)

Return Value

array|string

Attribute Value

at line 323
get_block_xml($block_name)

No description

Parameters

$block_name

at line 156
get_blocks()

get an array with all existing blocks

in Template at line 232
static mixed get_config(string $var)

Get Config Value of Custom Theme Config

Parameters

string $var

Return Value

mixed

Value of Config, FALSE if not set

in Template at line 1052
array get_marker_block(string $block)

No description

Parameters

string $block

Block ID

Return Value

array

Markers

in Template at line 738
protected get_marker_content(string $block, string $marker, bool $render_objects = false, $params = false)

No description

Parameters

string $block

Block ID (e.g. content)

string $marker

Marker ID (e.g. title)

bool $render_objects

Auto-Render Objects?

$params

in Template at line 586
get_output_mode()

No description

at line 203
get_property($name)

No description

Parameters

$name

in Template at line 663
array get_render_blocks()

No description

Return Value

array

Renderers with priorities

in Template at line 559
mixed get_render_mode(bool $changes_only = false, bool $previous_mode = false)

No description

Parameters

bool $changes_only

Changes only? (Returns False if Render Mode is default)

bool $previous_mode

If true, the previous render mode will be returned

Return Value

mixed

in Template at line 676
protected object|string get_rendered_object(object $object, array $params = null)

Calls the render() function recursively of the passed object and returns the content

Parameters

object $object

Object with render() method

array $params

If object hase set_render_params() method these argument will be passed

Return Value

object|string

If Object cannot be rendered the function will return the object unmodified

in Template at line 340
string get_template_debug()

Returns the debug output for the current template

Return Value

string

html

at line 164
string get_xml()

Get XML Document as string

Return Value

string

in Template at line 2605
get_xtag_marker_value($params, $is_indexed = false, $clean_params = false, $escape_markers = true)

No description

Parameters

$params
$is_indexed
$clean_params
$escape_markers

in Template at line 179
static array get_xtag_registry()

Returns the xtag registry

Return Value

array

in Template at line 2085
array handle_custom_namespace(mixed $ns, int $k, mixed $name)

This function is used to fund

Parameters

mixed $ns

namespace of registry (usually 'xm')

int $k

key in name-space-array

mixed $name

Return Value

array

Exceptions

Exception

at line 106
init()

No description

in Template at line 326
init_template_vars()

put your comment there.

..

in Template at line 418
bool is_final_render_call()

Is the current render cycle the last cycle? (i.e. initiated from view)

Return Value

bool

TRUE if final render call

in Template at line 195
load_theme_set_config()

Set the theme configuration (theme set config)

in Template at line 1065
bool marker_is_cached(string $marker, string $cache_group = 'default', string $block = 'content')

No description

Parameters

string $marker

Marker ID

string $cache_group

Cache Group

string $block

Block

Return Value

bool

success

in Template at line 188
string output_html()

Output the final HTML

Return Value

string

HTML

in Template at line 2835
string output_login_form()

No description

Return Value

string

html

in Template at line 3090
string output_pw_change_form()

No description

Return Value

string

html

Exceptions

Exception

in Template at line 2931
string output_two_factor_auth_form()

No description

Return Value

string

html

in Template at line 1251
protected string parse_partial_template(string $template, string $section, $values)

No description

Parameters

string $template

Template ID

string $section

Section within the template

$values

Return Value

string

html or false if no array supplied

in Template at line 1327
mixed parse_template(string $template, string|bool $section = false, string|bool $block_id = false, string|bool $recursive = false)

Generic Template Loader

Parameters

string $template
  • a given template (maps to a certain file in the template directory)
string|bool $section

A section can be used to separate multiple template parts in one template file. Use

and
string|bool $block_id

The block id of the marker block to be used. CONTENT is the default is no block is passed

string|bool $recursive

Return Value

mixed

Exceptions

Exception

in Template at line 1491
string parse_template_content($template_content, bool $block = false, bool $parseLangStrings = true, bool $to = false)

No description

Parameters

$template_content
bool $block
bool $parseLangStrings
bool $to

Return Value

string

in Template at line 1458
string parse_template_translate_cb(array $matches)

Callback used by template language replace

Parameters

array $matches

preg_match replace array

Return Value

string

html

in Template at line 1620
mixed|string parse_xtag(array $xml_source)

Evaluate the passed XML Source parse xTags

Parameters

array $xml_source

Preg Replace Matching Array

Return Value

mixed|string

Exceptions

ContentException

in Template at line 295
mixed pre_render_action(string $page, array $args = array())

Enables a template to execute certain tasks before page is fully rendered (e.g. AJAX navigation)

Parameters

string $page
array $args

Return Value

mixed

See call_user_func_array

in Template at line 167
register_xtag_parser(string $module_name, bool|array $callback = false)

Register custom xtag parser

Parameters

string $module_name
bool|array $callback

in Template at line 651
removeRenderer($block)

Remove a block which in turn will not be rendered

Parameters

$block

at line 191
string render()

Render Vars Template

Return Value

string

HTML

in Template at line 313
mixed render_action(mixed $page, array $args = array())

Render Action Function on Template if exists

Parameters

mixed $page
array $args

Return Value

mixed

See call_user_func_array

in Template at line 931
protected string render_array_block(mixed $array, string|bool $key = false)

No description

Parameters

mixed $array

Array

string|bool $key

Section/Key

Return Value

string

html

in Template at line 2697
final string render_content_marker()

No description

Return Value

string

HTML

in Template at line 2764
protected string render_error()

No description

Return Value

string

HTML Error

in Template at line 473
string render_html(bool $final_render_call = false)

No description

Parameters

bool $final_render_call

Is the considered the final render call?

Return Value

string

Returns HTML in case of staged rendering process

in Template at line 1277
bool render_is_prepared(mixed $template, mixed $section = 'false', mixed $render_stage = 'pre', mixed $cache_key = null)

Check wether a render stage is already cached or not This allows controllers to save on processing time if certain fields are calculated for the template only You need to call this function AFTER getting a view

Parameters

mixed $template
mixed $section
mixed $render_stage
mixed $cache_key

Return Value

bool

true if cached

in Template at line 2826
string render_login()

wrapper for beeing able to use the output_login_form as renderer

Return Value

string

html?

in Template at line 245
string render_meta_script_resources()

Render Meta Script Resources

Return Value

string

in Template at line 259
string render_meta_style_resources()

Render CSS Resources

Return Value

string

in Template at line 430
render_prepare(string $render_stage = 'pre', string $cache_key = 'global', int $ttl = 3600, string $block_id = 'content')

Pre-Render Templates

Parameters

string $render_stage
  • This string will identify items which should be cached during the pre-render phase
string $cache_key
  • Set the cache key to be used
int $ttl
  • Time to live for the cache
string $block_id
  • rendering applies to this block

in Template at line 2816
string render_system_flash_message()

put your comment there.

..

Return Value

string

html

in Template at line 2129
string render_xtag(string $tag, array $params)

xTag Controller, regisitered for namespace xt (xelos template)

Parameters

string $tag
array $params

Return Value

string

Exceptions

Exception

in Template at line 1716
string render_xtag_element(DOMNode $dom_node, bool $render_only_childs = false, bool $special_child_handling_overwrite = false)

Renders the passed XML Element to String and uses registered xTag Controllers if possible

Parameters

DOMNode $dom_node

XML DOM Element

bool $render_only_childs

only render childs

bool $special_child_handling_overwrite

overwrite the skip condition in common child handling - used in special child render function of e.g. foreach

Return Value

string

html

Exceptions

Exception

at line 311
replace_namespace($xml_source)

No description

Parameters

$xml_source

at line 317
replace_namespace_reverse($xml_source)

No description

Parameters

$xml_source

in Template at line 1231
mixed retrieve(string $marker, string $block = 'content', bool $clean_params = false)

No description

Parameters

string $marker

Marker ID (e.g. title)

string $block

Block ID (e.g. content)

bool $clean_params

Return Value

mixed

HTML/Array/Object [Contents of Marker]

in Template at line 3193
void setFileCacheContent(string $tpl, string $section, string $content = null)

No description

Parameters

string $tpl
string $section
string $content

Return Value

void

in Template at line 1547
set_block_id($block_id)

No description

Parameters

$block_id

at line 362
bool set_block_xml(string $block_name, string $xml_source)

Will set the content of an in the vars template. Creates a new block with type text when it doesn't exist.

Parameters

string $block_name

Name of the block

string $xml_source

New content for the block

Return Value

bool

Returns false if an error occurred. Exceptions are written to the error log

in Template at line 1109
void set_marker_content(string $block, mixed $marker, string $content = 'array_fill', int|bool $cache_ttl = false, string $cache_group = 'default')

Set Marker

Parameters

string $block

markers are split into groups, you give the appropiate group here (e.g. meta,header,content)

mixed $marker

A marker corresponds to a specific placeholder within a tpl template, you can submit an array here and leave the third param empty

string $content

your content/html/link

int|bool $cache_ttl

Cache TTL (in seconds)

string $cache_group

Cache Group (e.g. context, userID, Group)

Return Value

void

at line 184
set_mod(Core $instance)

Set Instance Reference

Parameters

Core $instance

in Template at line 582
set_output_mode(int $flags = 0)

Set Output Mode

Parameters

int $flags

Mode: XELOS_OUTPUT_NOJS - assumes that you don't have regular JS frameworks and will reduce JS output for UI Helpers XELOS_OUTPUT_NOTEMPLATE - No default Template wrapping (No Header/Footer, No JS, No CSS Files)

in Template at line 529
void set_render_mode(string $mode = 'full', string $block = 'content')

No description

Parameters

string $mode

Mode is 'html_only' or 'block_only' , default is 'full'

string $block

Block

Return Value

void