Source for file Compiler.php
Documentation is available at Compiler.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Alan Knowles <alan@akbkhome.com> |
// +----------------------------------------------------------------------+
// $Id: Compiler.php,v 1.6 2004/06/03 03:25:11 alan_k Exp $
// Base Compiler Class (Interface)
* Compiler Globals go here..
* public (to it's children)
* @access public (to it's children)
$GLOBAL['_HTML_TEMPLATE_FLEXY_COMPILER'] = array ();
class HTML_Template_Flexy_Compiler {
* @param array options only ['compiler'] is used directly
* @return object The Compiler Object
function factory ($options)
if (empty ($options['compiler'])) {
$options['compiler'] = 'Standard';
require_once 'HTML/Template/Flexy/Compiler/'. ucfirst( $options['compiler'] ) . '.php';
$class = 'HTML_Template_Flexy_Compiler_'. $options['compiler'];
$ret->options = $options;
* @param object HTML_Template_Flexy that is requesting the compile
* @return object HTML_Template_Flexy
* @return string to compile (if not using a file as the source)
function compile (&$flexy,$string = false )
echo "No compiler implemented!";
* Append HTML to compiled ouput
* These are hooks for passing data to other processes
* @param string to append to compiled
* @return string to be output
function appendHtml ($string)
* Append PHP Code to compiled ouput
* These are hooks for passing data to other processes
* @param string PHP code to append to compiled
* @return string to be output
function appendPhp ($string)
return '<?php '. $string. '?>';
* Compile All templates in the
* These are hooks for passing data to other processes
* @param string PHP code to append to compiled
* @return string to be output
function compileAll (&$flexy, $dir = '',$regex= '/.html$/')
$this->compileDir ($dir,$regex);
function compileDir ($dir = '',$regex= '/.html$/')
foreach ($this->flexy->options ['templateDir'] as $base) {
if (!file_exists($base . DIRECTORY_SEPARATOR . $dir)) {
$dh = opendir($base . DIRECTORY_SEPARATOR . $dir);
while (($name = readdir($dh)) !== false ) {
if (is_dir($base . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . $name)) {
$this->compileDir ($dir . DIRECTORY_SEPARATOR . $name,$regex);
//echo "Compiling $dir". DIRECTORY_SEPARATOR . "$name \n";
$this->flexy->compile ($dir . DIRECTORY_SEPARATOR . $name);
Documentation generated on Mon, 11 Mar 2019 13:52:01 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|