# Class Tpex

Tpex is a parser used by Thelia CMS (http://thelia.net)

Tpex use syntax like loop : <THELIA id="loopId" type="loopName" parameter1="value1" parameter2="value2"> #SUBTITUTION1 #SUBSTITUTION2 #SUBSTITUTION-n </THELIA>

you have to implements your own loop, all the logical is in your loop not in Tpex

filter syntax :

[...(filter_name{param1, param2, ... }) ... ]

base param syntax :

PARAM_BASE_parameName=paramValue

Namespace: Thelia\Tpex
Author: Manuel Raynaud <mraynaud@openstudio.fr>
Located at core/lib/Thelia/Tpex/Tpex.php

Methods summary
`public` | # `__construct( Symfony\Component\HttpFoundation\Request $request, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher )` Tpex constructor Tpex constructor #### Parameters $request `Symfony\Component\HttpFoundation\Request` $request $dispatcher `Symfony\Component\EventDispatcher\EventDispatcherInterface` $dispatcher
`public` | # `setContent( string $content )` set the content to parse set the content to parse #### Parameters $content `string` $content
`public` | # `setBaseDir( string $baseDir )` set the base directory. include are based from this base directory set the base directory. include are based from this base directory #### Parameters $baseDir `string` $baseDir
`public` | # `configure( array $config )` #### Parameters $config `array` $config #### Throws `RuntimeException`
`public boolean` | # `isInitialized( )` verify if Tpex is initialized #### Returns `boolean`
`public string` | # `getContent( )` return the current at the current state during parsing #### Returns `string`
`public` | # `setLoop( array $loop )`
`public` | # `setFilter( array $filter )`
`public` | # `setTestLoop( array $testLoop )`
`public` | # `setBaseParams( array $baseParams )` add multiple baseParam ine one time in Tpex Parser key is baseParam name value is the class implementing/extending base baseParam classes $baseParam = array( "secure" => "Thelia\BaseParam\Secure", "reset" => "Thelia\BaseParam\reset", "myBaseParam" => "My\Own\BaseParam" ); #### Parameters $baseParams `array` $baseParams #### Throws `InvalidArgumentException`
`public` | # `addBaseParam( type $name, type $className )` add a new baseParam to Tpex param #### Parameters $name `type` $name baseParam name. Must be unique $className `type` $className class name implementing/extending filter classes #### Throws `InvalidArgumentException`
`public` | # `execute( )`
`protected` | # `parseBaseParam( )`
`protected` | # `parseInclude( )`
`protected` | # `parseString( )`
`protected` | # `parseStringWithCache( )`
`protected` | # `cleanCache( )`

Properties summary
`protected string` | $content | `` | # $content contains string to parse
`protected string` | $basedir | `` | # the base directory for searching all files for inclusion
`protected Symfony\Component\HttpFoundation\Request` | $request | `` | #
`protected Symfony\Component\EventDispatcher\EventDispatcherInterface` | $dispatcher | `` | #
`protected Array` | $baseParam | `array()` | # associative array containing information for baseParam execution associative array containing information for baseParam execution key is baseParam name value is the class implementing/extending base baseParam classes ex : $baseParam = array( "secure" => "Thelia\BaseParam\Secure", "reset" => "Thelia\BaseParam\reset", "myBaseParam" => "My\Own\BaseParam" );
`protected boolean` | $init | `false` | #
`protected array` | $config | `array( "cacheDir" => false, "cacheTimeFile" => ".time_cache", "fileLifeTime" => 86400, "checkPeriod" => 7200 )` | # config array cacheDir where cache is created cacheTimeFile File containing last cache pass fileLifeTime : file lifetime in seconds in cache system checkPeriod : Time in seconds between each cache examination
`protected array` | $regex | `array( 'include' => '/#INCLUDE[\s]*"([^"]*)"/', 'baseParam' => '/#PARAM_BASE_([a-zA-Z0-9_]+)[\s]*=[\s]*([0-9]*)[\s]*/' )` | #
`protected `Thelia\Tpex\Tokenizer\Tokenize`` | $tokenizer | `` | #