abstract class Template

Class Template

Properties

static array $theme_set_config
static protected int $output_mode
string $block_id
array $data_blocks
array $marker_sets
Controller $mod
array $html_blocks
mixed $markers
protected array $file_cache
protected string $render_stage
protected bool $render_stage_key
protected bool $render_stage_block
protected int $render_stage_ttl
protected int $render_stage_force_render
protected array $_prerendered
protected bool $final_render_call
protected array[] $auto_render_sub_blocks
protected mixed $template_includes
protected string $render_mode
protected $previous_render_mode
$render_mode_block
protected $_raw_markers
protected bool $option_template_debug
protected $last_xtag_if_value
protected $last_parse_template

Methods

__construct()

Template constructor.

__toString()

No description

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

No description

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

Parse for ###Markers###

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

Parse the passed HTML source for xTags and render these xTags

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

Internal Render Function

void
add_render_block(string $block, array $data)

No description

void
add_renderer(string $auto_render_sub_block, int $priority = 50, string $block = 'content')

No description

boolean
add_template(string $name, string $path)

Add a template to the registry

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

No description

append_to_list(string $marker, string $content, string $block = 'content')

No description

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

No description

assign_js($options)

No description

assign_xss()

No description

auto_render_block(string $block)

No description

static 
cb_gettext($matches)

No description

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

No description

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

Convert String to XML Node

void
disable_render_stage()

DISABLE Pre-Rendering and resets staging params

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

ENABLE Pre-Rendering for template parsing

string
format_template_specialchars(string $text)

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

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

No description

string
getFileCacheContent(string $tpl, string $section)

No description

static mixed
get_config(string $var)

Get Config Value of Custom Theme Config

get_marker_block(string $block)

No description

get_marker_content($block, $marker, $render_objects = false, $params = false)

No description

get_output_mode()

No description

array
get_render_blocks()

No description

get_render_mode(bool $changes_only = false, bool $previous_mode = false)

No description

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

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

string
get_template_debug()

Returns the debug output for the current template

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

No description

static array
get_xtag_registry()

Returns the xtag registry

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

This function is used to fund

init_template_vars()

put your comment there.

bool
is_final_render_call()

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

load_theme_set_config()

Set the theme configuration (theme set config)

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

No description

output_html()

Output the final HTML

string
output_login_form()

No description

string
output_pw_change_form()

No description

string
output_two_factor_auth_form()

No description

parse_partial_template(string $template, string $section, array $values)

No description

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

Generic Template Loader

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

No description

string
parse_template_translate_cb(array $matches)

Callback used by template language replace

mixed|string
parse_xtag(array $xml_source)

Evaluate the passed XML Source parse xTags

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)

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

Register custom xtag parser

render()

No description

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

Render Action Function on Template if exists

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

No description

render_content_marker()

No description

render_error()

No description

string
render_html(bool $final_render_call = false)

No description

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

string
render_login()

wrapper for beeing able to use the output_login_form as renderer

string
render_meta_script_resources()

Render Meta Script Resources

string
render_meta_style_resources()

Render CSS Resources

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

Pre-Render Templates

string
render_system_flash_message()

put your comment there.

string
render_xtag(string $tag, array $params)

xTag Controller, regisitered for namespace xt (xelos 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

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

No description

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

No description

set_block_id($block_id)

No description

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

Set Marker

set_output_mode(int $flags = 0)

Set Output Mode

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

No description

Details

at line 154
__construct()

Template constructor.

at line 2689
__toString()

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

Parameters

string $template_content Template Content
bool $block
bool $parseLangStrings
Template $to

Return Value

string Parsed Template Content

Exceptions

Exception

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

Parse for ###Markers###

Parameters

string $template_content
Template $to

Return Value

string HTML

at line 1600
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

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

Internal Render Function

Parameters

mixed $array
mixed $key

Return Value

bool|string

at line 659
void add_render_block(string $block, array $data)

Parameters

string $block Block ID (e.g. content)
array $data Renderer ( 50 => array(funcs))

Return Value

void

at line 637
void add_renderer(string $auto_render_sub_block, int $priority = 50, string $block = 'content')

Parameters

string $auto_render_sub_block Renderer-Name (e.g. overview for a function render_overview)
int $priority Priority gives the position of the renderer within its main block
string $block Main Block (e.g. Header, Footer, Content)

Return Value

void

at line 275
boolean add_template(string $name, string $path)

Add a template to the registry

Parameters

string $name template caller
string $path path to template

Return Value

boolean success

at line 1192
append(string $marker, string $content, string $block = 'content')

Parameters

string $marker Marker ID (e.g. title)
string $content Content
string $block Block ID (e.g. content)

at line 1213
append_to_list(string $marker, string $content, string $block = 'content')

Parameters

string $marker Marker ID (e.g. title)
string $content Content
string $block Block ID (e.g. content)

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

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

at line 3114
assign_js($options)

Parameters

$options

at line 1170
Template assign_xss()

Return Value

Template

at line 595
final protected auto_render_block(string $block)

Parameters

string $block Block to be rendered (e.g. content)

at line 1542
static cb_gettext($matches)

Parameters

$matches

at line 1086
clear_marker_cache(string $marker = '', string $cache_group = '', string $block = 'content')

Parameters

string $marker Marker ID
string $cache_group Cache Group
string $block Block

at line 2556
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

at line 455
protected void disable_render_stage()

DISABLE Pre-Rendering and resets staging params

Return Value

void

at line 443
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

at line 3109
string format_template_specialchars(string $text)

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

Parameters

string $text

Return Value

string

at line 1298
string generateTemplateCacheKey(string $template_file, string $section, string|null $render_stage = null, string|null $cache_key = null)

Parameters

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

Return Value

string

at line 3153
string getFileCacheContent(string $tpl, string $section)

Parameters

string $tpl
string $section

Return Value

string

at line 229
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

at line 1051
get_marker_block(string $block)

Parameters

string $block Block ID

at line 737
protected get_marker_content($block, $marker, $render_objects = false, $params = false)

Parameters

$block
$marker
$render_objects
$params

at line 583
get_output_mode()

at line 646
array get_render_blocks()

Return Value

array Renderers with priorities

at line 556
get_render_mode(bool $changes_only = false, bool $previous_mode = false)

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

at line 675
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

at line 337
string get_template_debug()

Returns the debug output for the current template

Return Value

string html

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

Parameters

$params
$is_indexed
$clean_params
$escape_markers

at line 176
static array get_xtag_registry()

Returns the xtag registry

Return Value

array

at line 2079
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 323
init_template_vars()

put your comment there.

..

at line 415
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

at line 192
load_theme_set_config()

Set the theme configuration (theme set config)

at line 1064
marker_is_cached(string $marker, string $cache_group = 'default', string $block = 'content')

Parameters

string $marker Marker ID
string $cache_group Cache Group
string $block Block

at line 185
output_html()

Output the final HTML

at line 2811
string output_login_form()

Return Value

string html

at line 3058
string output_pw_change_form()

Return Value

string html

Exceptions

Exception

at line 2899
string output_two_factor_auth_form()

Return Value

string html

at line 1250
protected parse_partial_template(string $template, string $section, array $values)

Parameters

string $template Template ID
string $section Section within the template
array $values 2-Dim array (e.g. SQL result set)

at line 1326
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

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

Parameters

$template_content
bool $block
bool $parseLangStrings
bool $to

Return Value

string

at line 1457
string parse_template_translate_cb(array $matches)

Callback used by template language replace

Parameters

array $matches preg_match replace array

Return Value

string html

at line 1619
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

at line 292
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

at line 164
register_xtag_parser(string $module_name, bool|array $callback = false)

Register custom xtag parser

Parameters

string $module_name
bool|array $callback

at line 2682
render()

at line 310
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

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

Parameters

mixed $array Array
string|bool $key Section/Key

Return Value

string html

at line 2673
final render_content_marker()

at line 2740
protected render_error()

at line 470
string render_html(bool $final_render_call = false)

Parameters

bool $final_render_call Is the considered the final render call?

Return Value

string Returns HTML in case of staged rendering process

at line 1276
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

at line 2802
string render_login()

wrapper for beeing able to use the output_login_form as renderer

Return Value

string html?

at line 242
string render_meta_script_resources()

Render Meta Script Resources

Return Value

string

at line 256
string render_meta_style_resources()

Render CSS Resources

Return Value

string

at line 427
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

at line 2792
string render_system_flash_message()

put your comment there.

..

Return Value

string html

at line 2123
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

at line 1715
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 1230
mixed retrieve(string $marker, string $block = 'content', bool $clean_params = false)

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]

at line 3162
void setFileCacheContent(string $tpl, string $section, string $content = null)

Parameters

string $tpl
string $section
string $content

Return Value

void

at line 1546
set_block_id($block_id)

Parameters

$block_id

at line 1108
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)

at line 579
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)

at line 526
set_render_mode(string $mode = 'full', string $block = 'content')

Parameters

string $mode Mode is 'html_only' or 'block_only' , default is 'full'
string $block Block