Source for file Regex.php
Documentation is available at Regex.php
class HTML_Template_Flexy_Compiler_Regex {
* @var object HTML_Template_Flexy
* classicParse - the older regex based code generator.
* here all the replacing, filtering and writing of the compiled file is done
* well this is not much work, but still its in here :-)
* @author Wolfram Kriesing <wolfram@kriesing.de>
* @author Alan Knowles <alan@akbkhome.com>
* @return boolean (basically true all the time here)
function compile (&$flexy)
// read the entire file into one variable
$fileContent = $this->applyFilters ( $fileContent , "/^pre_/i" );
$fileContent = $this->applyFilters ( $fileContent , "/^(pre_|post_)/i",TRUE );
$fileContent = $this->applyFilters ( $fileContent , "/^post_/i" );
// write the compiled template into the compiledTemplate-File
if( ($cfp = fopen( $flexy->compiledTemplate , 'w' )) ) {
@chmod($flexy->compiledTemplate ,0775 );
* actually it will only be used to apply the pre and post filters
* @author Alan Knowles <alan@akbkhome.com>
* @param string $input the string to filter
* @param array $prefix the subset of methods to use.
* @return string the filtered string
function applyFilters ( $input , $prefix = "",$negate=FALSE )
$this->flexy->debug (" APPLY FILTER $prefix<BR>" );
$filters = $this->options['filters'];
$this->flexy->debug (serialize($filters). "<BR>");
foreach($filters as $filtername) {
$class = " HTML_Template_Flexy_Compiler_Regex_{$filtername}";
require_once(" HTML/Template/Flexy/Compiler/Regex/{$filtername}.php" );
return $this->raiseError (" Failed to load filter $filter" ,null ,PEAR_ERROR_DIE );
if (!@$this->filter_objects[$class]) {
$this->filter_objects[$class] = new $class;
$this->filter_objects[$class]->_set_engine ($this);
$filter = &$this->filter_objects[$class];
$this->flexy->debug ("METHODS:");
$this->flexy->debug (serialize($methods). "<BR>");
foreach($methods as $method) {
$this->flexy->debug (" TEST: $negate $prefix : $method" );
$this->flexy->debug (" APPLYING $filtername $method<BR>" );
$input = $filter->$method($input);
Documentation generated on Mon, 11 Mar 2019 10:15:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|