/sources/tempcode.php

Description
Classes
Class Description
ocp_tempcode
Functions
apply_tempcode_escaping (line 308)

Apply whatever escaping is requested to the given value.

  • return: Output string (you do not need to collect this, as $value is pass-by-reference -- but this is useful for chaining)
string apply_tempcode_escaping (array $escaped, string &$value)
  • array $escaped: A list of escaping to do
  • string &$value: The string to apply the escapings to
apply_tempcode_escaping_inline (line 341)

Apply whatever escaping is requested to the given value.

  • return: Output string
string apply_tempcode_escaping_inline (array $escaped, string $value)
  • array $escaped: A list of escaping to do
  • string $value: The string to apply the escapings to
build_closure_tempcode (line 132)

Build a conventional tempcode object

  • return: Tempcode object.
tempcode build_closure_tempcode (integer $type, ID_TEXT $name, ?array $parameters, [?array $escaping = NULL])
  • integer $type: The type of symbol this is (TC_SYMBOL, TC_LANGUAGE_REFERENCE)
  • ID_TEXT $name: The name of the symbol
  • ?array $parameters: Parameters to the symbol (NULL: none). In same format as expected by evaluate_conventional_variable.
  • ?array $escaping: Escaping for the symbol (NULL: none)
closure_eval (line 206)

Evaluate some PHP code to put the result into an expression (code is allowed to have side effects).

  • return: Result
string closure_eval (string $code, array $parameters)
  • string $code: The code
  • array $parameters: Template parameters
closure_loop (line 226)

Perform a simple loop, that can be inlined in an expression.

  • return: Result
string closure_loop (array $param, array $args, array $main_function)
  • array $param: The template bound parameters
  • array $args: The loop directive parameters
  • array $main_function: The loop execution function
closure_while_loop (line 192)

Perform a simple loop, that can be inlined in an expression.

  • return: Result
string closure_while_loop (array $args, array $control_function, array $main_function)
  • array $args: The template bound parameters
  • array $control_function: The loop control function
  • array $main_function: The loop execution function
directive_tempcode (line 176)

This will create a new tempcode object that is containing a single specifed directive

  • return: A directive tempcode object
tempcode directive_tempcode (ID_TEXT $directive, tempcode $content, [?array $parameters = NULL])
  • ID_TEXT $directive: The ID of the directive to use
  • tempcode $content: The contents
  • ?array $parameters: Directive parameters (NULL: none)
do_lang_tempcode (line 376)

This will create a new tempcode object that is containing a single specifed language code

  • return: A language tempcode object
tempcode do_lang_tempcode (ID_TEXT $lang_string, [?mixed $token1 = NULL], [?mixed $token2 = NULL], [?mixed $token3 = NULL])
  • ID_TEXT $lang_string: The ID of the language string to use
  • ?mixed $token1: The first token [string or tempcode] (replaces {1}) (NULL: none)
  • ?mixed $token2: The second token [string or tempcode] (replaces {2}) (NULL: none)
  • ?mixed $token3: The third token (replaces {3}). May be an array of [of string], to allow any number of additional args (NULL: none)
do_template (line 408)

Get a tempcoded version of a normal XHTML template. It is perhaps the most common ocPortal function to load up templates using do_template, and then attach them together either as parameters to each other, or via the tempcode attach method.

  • return: The tempcode for this template
tempcode do_template (ID_TEXT $codename, [?array $parameters = NULL], [?LANGUAGE_NAME $lang = NULL], [boolean $light_error = false], [?ID_TEXT $fallback = NULL], [string $suffix = '.tpl'], [string $type = 'templates'])
  • ID_TEXT $codename: The codename of the template being loaded
  • ?array $parameters: A map of parameters for the template (key to value) (NULL: no parameters)
  • ?LANGUAGE_NAME $lang: The language to load the template in (templates can embed language references) (NULL: users own language)
  • boolean $light_error: Whether to not produce a stack dump if the template is missing
  • ?ID_TEXT $fallback: Alternate template to use if the primary one does not exist (NULL: none)
  • string $suffix: File type suffix of template file (e.g. .tpl)
  • string $type: Subdirectory type to look in
fast_uniqid (line 117)

The PHP uniqid function is slow on some PHP versions. This version is much faster.

  • return: Unique Identifier
string fast_uniqid ()
handle_symbol_preprocessing (line 569)

Certain symbols need preprocessing, before the output stream is made.

void handle_symbol_preprocessing (array $bit, array &$children)
  • array $bit: Symbol details
  • array &$children: Where we store children stuff
init__tempcode (line 24)

Standard code module initialisation function.

void init__tempcode ()
make_string_tempcode (line 294)

Convert a string to tempcode.

  • return: Tempcode
tempcode make_string_tempcode (string $string)
  • string $string: String
php_addslashes_twice (line 101)

Escape a string to fit within PHP double quotes TWICE. Needed sometimes when generating code. This function exists for performance reasons.

  • return: Resultant string
string php_addslashes_twice (string $in)
  • string $in: String in
static_evaluate_tempcode (line 90)

Simple function to evaluate some Tempcode. Very rarely to be used, only if you can't call a method (e.g. you are copying direct into an array, such as in block cacheing).

  • return: Evaluated string
string static_evaluate_tempcode (tempcode $ob)
  • tempcode $ob: Tempcode object
symbol_tempcode (line 161)

This will create a new tempcode object that is containing a single specifed symbol

  • return: A symbol tempcode object
tempcode symbol_tempcode (ID_TEXT $symbol, [?array $parameters = NULL], [?array $escape = NULL])
  • ID_TEXT $symbol: The ID of the symbol to use
  • ?array $parameters: Symbol parameters (NULL: none)
  • ?array $escape: Escaping (NULL: none)

Documentation generated on Sun, 02 Jan 2011 23:25:58 +0000 by phpDocumentor 1.4.3