class vB_Template_XML extends vB_Template_Data

Properties

static protected array $pre_registered Preregistered variables. from vB_Template
static protected $placeHolders from vB_Template
protected string $template Name of the template to render from vB_Template
protected array $registered Array of registered variables. from vB_Template
protected bool $registered_globals Whether the globally accessible vars have been registered. from vB_Template
static array $template_usage Debug helper to count how many times a template was used on a page. from vB_Template
static array $template_queries Debug helper to list the templates that were fetched out of the database (not cached properly). from vB_Template
static protected array $registered_templates Registered templates and their local vars. from vB_Template_Data
static protected $token_prefix Prefix for the template token. from vB_Template_Data

Methods

static vB_Template
create($template_name, $forcenoapi = false)

Factory method to create the template object.

static 
remove_common_show($show)

Unset common items in $show array for API

__construct($template_name)

vB_Template constructor.

string
get_template_name()

Returns the name of the template that will be rendered.

static 
preRegister(string $template_name, array $variables = NULL)

Preregisters variables before template instantiation.

bool
register(string $name, mixed $value, bool $overwrite = true)

Register a variable with the template.

quickRegister($values, $overwrite = true)

Registers an array of variables with the template.

register_global(string $name, bool $overwrite = true)

Registers a named global variable with the template.

bool
register_ref(string $name, mixed $value, bool $overwrite = true)

Identical to register, but registers a value as a reference.

mixed
unregister(string $name)

Unregisters a previously registered variable.

bool
is_registered(string $name)

Determines if a named variable is registered.

mixed
registered(string $name = '')

Return the value of a registered variable or all registered values If no variable name is specified then all variables are returned.

register_page_templates()

Automatically register the page-level templates footer, header, and headinclude based on their global values.

register_globals(bool $final_render = false)

Register globally accessible vars.

string
render($suppress_html_comments = false, $final = false, $nopermissioncheck = false)

Renders the template.

string
render_output($suppress_html_comments = false, $nopermissioncheck = false)

Renders the output after preperation.

string
fetch_css_path()

Returns the CSS path needed for the {vb:cssfile} template tag

static string
fetch_template_raw(string $template_name)

Returns a single template from the templatecache or the database and returns the raw contents of it. Note that text will be escaped for eval'ing.

bool
parse_token($value)

Checks if a registered value is a template token.

whitelist_filter()

No description

whitelist_filter_recur($whitelist, $arr, $registered)

No description

removeShow($arr)

No description

forceRenderPhrases($value)

No description

string
render_token()

Buffers locally registered vars and returns a token representation of the template.

static 
dump_templates()

No description

Details

in vB_Template at line 1100
static vB_Template create($template_name, $forcenoapi = false)

Factory method to create the template object.

Will choose the correct template type based on the request. Any preregistered variables are also registered and cleared from the preregister cache.

Parameters

$template_name
$forcenoapi

Return Value

vB_Template Template object

in vB_Template at line 1147
static protected remove_common_show($show)

Unset common items in $show array for API

Parameters

$show

in vB_Template at line 1169
protected __construct($template_name)

vB_Template constructor.

Protected constructor to enforce the factory pattern. Ensures the chrome templates have been processed.

Parameters

$template_name

in vB_Template at line 1179
string get_template_name()

Returns the name of the template that will be rendered.

Return Value

string

in vB_Template at line 1190
static preRegister(string $template_name, array $variables = NULL)

Preregisters variables before template instantiation.

Parameters

string $template_name The name of the template to register for
array $variables The variables to register

in vB_Template_Data at line 1561
bool register(string $name, mixed $value, bool $overwrite = true)

Register a variable with the template.

If the variable is prefixed with the template token then it is assumed as a child template and picked up from $registered_templates.

Parameters

string $name Name of the variable to be registered
mixed $value Value to be registered. This may be a scalar or an array.
bool $overwrite Whether to overwrite existing vars

Return Value

bool Whether the var was registered

in vB_Template at line 1228
quickRegister($values, $overwrite = true)

Registers an array of variables with the template.

Parameters

$values
$overwrite

in vB_Template at line 1247
register_global(string $name, bool $overwrite = true)

Registers a named global variable with the template.

Parameters

string $name The global to register
bool $overwrite Whether to overwrite on a name collision

in vB_Template_Data at line 1590
bool register_ref(string $name, mixed $value, bool $overwrite = true)

Identical to register, but registers a value as a reference.

Parameters

string $name Name of the variable to be registered
mixed $value Value to be registered. This may be a scalar or an array
bool $overwrite Whether to overwrite existing vars

Return Value

bool Whether the var was registered

in vB_Template at line 1283
mixed unregister(string $name)

Unregisters a previously registered variable.

Parameters

string $name Name of variable to be unregistered

Return Value

mixed Null if the variable wasn't registered, otherwise the value of the variable

in vB_Template at line 1303
bool is_registered(string $name)

Determines if a named variable is registered.

Parameters

string $name Name of variable to check

Return Value

bool

in vB_Template at line 1315
mixed registered(string $name = '')

Return the value of a registered variable or all registered values If no variable name is specified then all variables are returned.

Parameters

string $name The name of the variable to get the value for.

Return Value

mixed If a name is specified, the value of the variable or null if it doesn't exist.

in vB_Template at line 1331
register_page_templates()

Automatically register the page-level templates footer, header, and headinclude based on their global values.

in vB_Template at line 1350
protected register_globals(bool $final_render = false)

Register globally accessible vars.

Parameters

bool $final_render
  • Whether we are rendering the final response

in vB_Template_Data at line 1787
string render($suppress_html_comments = false, $final = false, $nopermissioncheck = false)

Renders the template.

Parameters

$suppress_html_comments
$final
$nopermissioncheck

Return Value

string Rendered version of the template

at line 1888
protected string render_output($suppress_html_comments = false, $nopermissioncheck = false)

Renders the output after preperation.

Parameters

$suppress_html_comments
$nopermissioncheck

Return Value

string

See also

vB_Template::render

in vB_Template at line 1464
string fetch_css_path()

Returns the CSS path needed for the {vb:cssfile} template tag

Return Value

string CSS path

in vB_Template at line 1518
static string fetch_template_raw(string $template_name)

Returns a single template from the templatecache or the database and returns the raw contents of it. Note that text will be escaped for eval'ing.

Parameters

string $template_name Name of template to be fetched

Return Value

string

in vB_Template_Data at line 1620
bool parse_token($value)

Checks if a registered value is a template token.

If it is, the registered vars of the child template are picked up and assigned to this template.

Parameters

$value

Return Value

bool Whether the value was picked up as a token, or the resovled value

in vB_Template_Data at line 1657
protected whitelist_filter()

in vB_Template_Data at line 1674
protected whitelist_filter_recur($whitelist, $arr, $registered)

Parameters

$whitelist
$arr
$registered

in vB_Template_Data at line 1750
protected removeShow($arr)

Parameters

$arr

in vB_Template_Data at line 1762
protected forceRenderPhrases($value)

Parameters

$value

in vB_Template_Data at line 1844
protected string render_token()

Buffers locally registered vars and returns a token representation of the template.

Return Value

string

in vB_Template_Data at line 1872
static dump_templates()