Tempcode (compiled implementation).

package core

 Methods

Constructor of Tempcode

__construct(\?array $details = null

Parameters

$details

\?array

Pair: Code to preexecute, Initialisation seq-parts (null: start as empty)

PHP magic function to handle serialisation.

__sleep() : array

Returns

arrayWhat is to be serialised

Parses the current Tempcode object, then return the parsed string

__toString() : string

Returns

stringThe evaluated thing.

Attach the specified Tempcode to the right of the current Tempcode object.

attach(mixed $attach, boolean $avoid_child_merge = false

Parameters

$attach

mixed

The Tempcode/string to attach

$avoid_child_merge

boolean

If we've already merged the children from what we're attaching into the child tree (at bind stage)

Bind the parameter bits, or recursively bind children (doesn't change self, returns a bound Tempcode object)

bind(array $parameters, \ID_TEXT $codename) : \Tempcode

Parameters

$parameters

array

Map of parameters to bind parameter bits to

$codename

\ID_TEXT

The codename of the template this Tempcode is from

Returns

\TempcodeThe new bound Tempcode object

Remove any internal evaluation cachings within the object.

decache() 

Parses the current Tempcode object, then return the parsed string

evaluate(\?LANGUAGE_NAME $current_lang = null) : string

Parameters

$current_lang

\?LANGUAGE_NAME

The language to evaluate with (null: current user's language)

Returns

stringThe evaluated thing. Voila, it's all over!

Parse the current Tempcode object, then echo it to the browser.

evaluate_echo(\?LANGUAGE_NAME $current_lang = null, boolean $stop_if_stuck = false) : string

Parameters

$current_lang

\?LANGUAGE_NAME

The language to evaluate with (null: current users language)

$stop_if_stuck

boolean

Whether to stop if we are stuck of a seq_part with parameters yet-unbound, and to continue from last resume point

Returns

stringBlank string. Allows chaining within echo statements

The opposite of to_assembly - it decodes a Tempcode storage representation and turns it into a proper Tempcode object.

from_assembly(string $raw_data, boolean $allow_failure = false) : boolean

Parameters

$raw_data

string

The assembled Tempcode

$allow_failure

boolean

Return error code on failure, rather than exiting

Returns

booleanSuccess status (it can fail, if the compiled cache file is corrupt)

The opposite of to_assembly - it decodes a Tempcode storage representation and turns it into a proper Tempcode object. This version handles the result of evaled code.

from_assembly_executed(\PATH $file, array $forced_reload_details) : boolean

Parameters

$file

\PATH

The file to load

$forced_reload_details

array

List of parameters for a forced reload if required

Returns

booleanSuccess status (it can fail, if the compiled cache file is corrupt)

Scan this Tempcode for anything that needs to be symbol-preprocessed

handle_symbol_preprocessing() 

Find whether the Tempcode object is blank or not.

is_empty() : boolean

Returns

booleanWhether the Tempcode object is empty

Find whether the Tempcode object entirely empty (devoid of anything evaluable), not just evaluates as empty. This is also useful if you want to avoid early evaluation, which will mess up GET/SET flow.

is_empty_shell() : boolean

Does not perform an evaluation, so will not trigger any early pre-processing or out-of-order evaluation.

Returns

booleanWhether it is entirely empty

Find whether a variable within this Tempcode is parameterless.

parameterless(integer $at) : boolean

Parameters

$at

integer

Offset to the variable

Returns

booleanWhether it is parameterless

Parse a single symbol from an input stream and append it.

parse_from(string $code, integer $pos, integer $len) 

Parameters

$code

string

Code string (input stream)

$pos

integer

Start position of input string

$len

integer

End position of input string

Replace the named parameter with a specific value. Hardly used, but still important. Note that this will bind to all kinds of things that might not normally take named parameters, like symbols; this should not cause problems though.

singular_bind(string $parameter, \Tempcode $value) 

Parameters

$parameter

string

Named parameter

$value

\Tempcode

Specific value

Assemble the current Tempcode object into a single serialised (compiled) Tempcode storage representation (parameters and certain symbols and not evaluated). The output of the function is language-tied.

to_assembly() : string

Returns

stringThe assembly result

Recursively mark all parameters in this Tempcode as escaped. This is needed when loading from cache, as escape tainting data would have been lost.

_mark_all_as_escaped(boolean $top_level = true

Parameters

$top_level

boolean

Whether this is the top-level call

 Properties

 

$cached_output

$cached_output 

Default

 

$children

$children 

Default

null
 

$code_to_preexecute

$code_to_preexecute 

Default

 

$codename

$codename 

Default

':container'
 

$evaluate_echo_offset_group

$evaluate_echo_offset_group 

Default

0
 

$evaluate_echo_offset_inner

$evaluate_echo_offset_inner 

Default

0
 

$fresh

$fresh 

Default

null
 

$preprocessable_bits

$preprocessable_bits 

Default

 

$preprocessed

$preprocessed 

Default

false
 

$pure_lang

$pure_lang 

Default

 

$seq_parts

$seq_parts 

Default