$Date: 2005-10-10 14:03:20 +0100 (Mon, 10 Oct 2005) $ | > $Revision: 22 $ | > $Author: matt $ +--------------------------------------------------------------------------- | | > Template Engine module NEW (KERNEL) | > Module written by Matt Mecham | > Date started: Wednesday 23rd February 13:53 | | > Module Version Number: 1.0.0 +-------------------------------------------------------------------------- | New template module to build, rebuild and generate caches of templates | which include the new IPB HTML Logic system. | Example: | | | html here || | html here | | +-------------------------------------------------------------------------- */ /** * Template Engine (NOT USED CURRENTLY: FOR IPB 3.0, IP.Dynamic) * * Methods and functions for converting HTML logic into PHP code * * @package IPS_KERNEL * @author Matt Mecham * @copyright Invision Power Services, Inc. * @version 1.0 * @ignore */ /** * */ /** * Template Engine (NOT USED CURRENTLY: FOR IPB 3.0, IP.Dynamic) * * Methods and functions for converting HTML logic into PHP code * * @package IPS_KERNEL * @author Matt Mecham * @version 1.0 * @ignore */ class class_template { # The basics var $root_path = './'; var $cache_dir = 'skin_cache'; var $cache_id = '1'; var $database_id = '1'; var $cache_path = ''; /** * Foreach function blocks * Holds the foreach code * * @var array */ var $foreach_blocks = array(); /** * Allow PHP code to execute */ var $allow_php_code = 1; function class_template() { $this->cache_path = $this->root_path . $this->cache_dir . '/cacheid_' . $this->cache_id; } /*-------------------------------------------------------------------------*/ // Eval on the fly /*-------------------------------------------------------------------------*/ /** * convert_cache_to_eval * * Takes raw PHP data (from a MASTEr cache class) and formats it ready * for eval'ing in the scripts. * * @param $data string The actual contents of the class, php tags 'an all. */ function convert_cache_to_eval($data='', $full_class_name='') { //----------------------------------------- // INIT //----------------------------------------- $final_content = ''; //----------------------------------------- // Remove PHP tags //----------------------------------------- $data = preg_replace( "#<"."\?php\n?(.+?)\n?\?".">#is", "\\1", $data ); //----------------------------------------- // Pick through and get all function names //----------------------------------------- $data = str_replace( "\r" , "\n", $data ); $data = str_replace( "\n\n", "\n", $data ); //----------------------------------------- // Continue... //----------------------------------------- $farray = explode( "\n", $data ); //----------------------------------------- // Functions... //----------------------------------------- $functions = array(); $script_token = 0; $flag = 0; foreach( $farray as $f ) { //----------------------------------------- // Skip javascript functions... //----------------------------------------- if ( preg_match( "/