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 19)


	
			
Variable Summary
Method Summary
jTplCompiler __construct ()
void addMetaContent ( $content)
boolean compile (jSelectorTpl $selector)
void compileContent ( $tplcontent)
void compileString ( $templatecontent,  $cachefile,  $userModifiers,  $userFunctions,  $md5, [ $header = ''], [ $footer = ''])
void doError0 ( $err)
void doError1 ( $err,  $arg)
void doError2 ( $err,  $arg1,  $arg2)
boolean isInsideBlock (string $blockName, [boolean $onlyUpper = false])
string _callback (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)
Variables
mixed $outputType = '' (line 123)

type of the output

  • access: public
mixed $removeASPtags = true (line 137)
  • access: protected
mixed $trusted = true (line 130)

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 73)

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 85)
  • access: protected
mixed $_allowedInExpr (line 68)

tokens allowed into expressions

  • access: protected
mixed $_allowedInForeach (line 78)

tokens allowed in foreach statements

  • access: protected
mixed $_allowedInVar (line 63)

tokens allowed in output for variables

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

tokens not allowed in variable

  • access: protected
mixed $_metaBody = '' (line 94)
  • 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 99)

native modifiers

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

list of user functions

  • access: protected
Methods
Constructor __construct (line 142)

Initialize some properties

jTplCompiler __construct ()
addMetaContent (line 646)
  • access: public
void addMetaContent ( $content)
  • $content
compile (line 159)

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 203)
  • access: protected
void compileContent ( $tplcontent)
  • $tplcontent
compileString (line 182)
  • access: public
void compileString ( $templatecontent,  $cachefile,  $userModifiers,  $userFunctions,  $md5, [ $header = ''], [ $footer = ''])
  • $templatecontent
  • $cachefile
  • $userModifiers
  • $userFunctions
  • $md5
  • $header
  • $footer
doError0 (line 681)
  • access: public
void doError0 ( $err)
  • $err
doError1 (line 685)
  • access: public
void doError1 ( $err,  $arg)
  • $err
  • $arg
doError2 (line 689)
  • access: public
void doError2 ( $err,  $arg1,  $arg2)
  • $err
  • $arg1
  • $arg2
isInsideBlock (line 500)

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 251)

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
_getPlugin (line 657)

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 518)

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 325)

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 630)
  • access: protected
void _parseMeta ( $args, [ $fct = ''])
  • $args
  • $fct
_parseVariable (line 283)

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

  • return: the corresponding php instruction
  • access: protected
string _parseVariable (string $expr)
  • string $expr: the content of the tag

Documentation generated on Wed, 04 Jan 2017 22:57:10 +0100 by phpDocumentor 1.4.3