Class jTplCompiler

Description

Implements interfaces:

This is the compiler of templates: it converts a template into a php file.

Located in /tpl/jTplCompiler.class.php (line 27)


	
			
Variable Summary
Method Summary
jTplCompiler __construct ()
void addMetaContent ( $content)
boolean compile (jSelectorTpl $selector)
void compileContent ( $tplcontent)
void compileString ( $templatecontent,  $cachefile,  $userModifiers,  $userFunctions,  $md5)
void doError0 ( $err)
void doError1 ( $err,  $arg)
void doError2 ( $err,  $arg1,  $arg2)
boolean isInsideBlock (string $blockName, [boolean $onlyUpper = false])
string _callback (array $matches)
string _callbackLineFeed (array $matches)
array|boolean _getPlugin (string $type, string $name)
array|string _parseFinal (string $string, [array $allowed = array()], [array $exceptchar = array(';')], [boolean $splitArgIntoArray = false], [ $sep1 = ','], [ $sep2 = ','])
string _parseFunction (string $name, string $args)
void _parseMeta ( $args, [ $fct = ''])
string _parseVariable (string $expr)
void _piCallback ( $matches)
Variables
mixed $escapePI = false (line 143)
  • access: protected
mixed $outputType = '' (line 129)

type of the output

  • access: public
mixed $removeASPtags = true (line 145)
  • access: protected
mixed $trusted = true (line 136)

true if the template doesn't come from an untrusted source.

if it comes from an untrusted source, like a template uploaded by a user, you should set to false.

  • access: public
mixed $_allowedAssign (line 79)

tokens allowed into assignements

  • access: protected
mixed $_allowedConstants = array ('TRUE','FALSE','NULL', 'M_1_PI',
'M_2_PI', 'M_2_SQRTPI', 'M_E', 'M_LN10', 'M_LN2', 'M_LOG10E',
'M_LOG2E', 'M_PI','M_PI_2','M_PI_4','M_SQRT1_2','M_SQRT2')
(line 91)
  • access: protected
mixed $_allowedInExpr (line 74)

tokens allowed into expressions

  • access: protected
mixed $_allowedInForeach (line 84)

tokens allowed in foreach statements

  • access: protected
mixed $_allowedInVar (line 69)

tokens allowed in output for variables

  • access: protected
mixed $_excludedInVar = array (';','=') (line 89)

tokens not allowed in variable

  • access: protected
mixed $_metaBody = '' (line 100)
  • access: protected
mixed $_modifier = array ('upper'=>'strtoupper', 'lower'=>'strtolower',
'escxml'=>'htmlspecialchars', 'eschtml'=>'htmlspecialchars',
'strip_tags'=>'strip_tags', 'escurl'=>'rawurlencode',
'capitalize'=>'ucwords', 'stripslashes'=>'stripslashes',
'upperfirst'=>'ucfirst')
(line 105)

native modifiers

  • access: protected
mixed $_userFunctions = array () (line 141)

list of user functions

  • access: protected
Methods
Constructor __construct (line 150)

Initialize some properties

jTplCompiler __construct ()
addMetaContent (line 663)
  • access: public
void addMetaContent ( $content)
  • $content
compile (line 168)

Launch the compilation of a template

Store the result (a php content) into a cache file given by the selector.

  • return: true if ok
  • access: public
boolean compile (jSelectorTpl $selector)

Implementation of:
jISimpleCompiler::compile()
parse the given file, and store the result in a cache file
compileContent (line 213)
  • access: protected
void compileContent ( $tplcontent)
  • $tplcontent
compileString (line 187)
  • access: public
void compileString ( $templatecontent,  $cachefile,  $userModifiers,  $userFunctions,  $md5)
  • $templatecontent
  • $cachefile
  • $userModifiers
  • $userFunctions
  • $md5
doError0 (line 698)
  • access: public
void doError0 ( $err)
  • $err
doError1 (line 702)
  • access: public
void doError1 ( $err,  $arg)
  • $err
  • $arg
doError2 (line 706)
  • access: public
void doError2 ( $err,  $arg1,  $arg2)
  • $err
  • $arg1
  • $arg2
isInsideBlock (line 517)

for plugins, it says if the plugin is inside the given block

  • return: true if it is inside the block
  • access: public
boolean isInsideBlock (string $blockName, [boolean $onlyUpper = false])
  • string $blockName: the block to search
  • boolean $onlyUpper: check only the upper block
_callback (line 268)

function called during the parsing of the template by a preg_replace_callback function

It is called on each template tag {xxxx }

  • return: the corresponding php code of the tag (with php tag).
  • access: public
string _callback (array $matches)
  • array $matches: a matched item
_callbackLineFeed (line 254)

function called during the parsing of the template by a preg_replace_callback function

It is called to add line feeds where needed

  • return: the same tag with one more line feed
  • access: public
string _callbackLineFeed (array $matches)
  • array $matches: a matched item
_getPlugin (line 674)

Try to find a plugin

  • return: an array containing the path of the plugin and the name of the plugin function, or false if not found
  • access: protected
array|boolean _getPlugin (string $type, string $name)
  • string $type: type of plugin (function, modifier...)
  • string $name: the plugin name
_parseFinal (line 535)

sub-function which analyse an expression

  • access: protected
array|string _parseFinal (string $string, [array $allowed = array()], [array $exceptchar = array(';')], [boolean $splitArgIntoArray = false], [ $sep1 = ','], [ $sep2 = ','])
  • string $string: the expression
  • array $allowed: list of allowed php token
  • array $exceptchar: list of forbidden characters
  • boolean $splitArgIntoArray: true: split the results on coma
  • $sep1
  • $sep2
_parseFunction (line 342)

analyse the tag which have a name

  • return: the corresponding php instructions
  • access: protected
string _parseFunction (string $name, string $args)
  • string $name: the name of the tag
  • string $args: the content that follow the name in the tag
_parseMeta (line 647)
  • access: protected
void _parseMeta ( $args, [ $fct = ''])
  • $args
  • $fct
_parseVariable (line 300)

analyse an "echo" tag : {$..} or {@..}

  • return: the corresponding php instruction
  • access: protected
string _parseVariable (string $expr)
  • string $expr: the content of the tag
_piCallback (line 208)
  • access: protected
void _piCallback ( $matches)
  • $matches

Documentation generated on Mon, 26 Oct 2015 21:56:39 +0100 by phpDocumentor 1.4.3