php code */ public $allow_php_code = true; /** * Modifiers path * * @access private * @var string Path to modifiers directory */ static private $template_plugins_class_path; /** * Modifiers clases * * @access private * @var array Array of modifier classes */ static private $template_plugin_classes = array(); private $_skinGroup = ''; /** * Escaped double quote replacement * Part of a hackish fix to retain manual escpaes in PHP code blocks * but not elsewhere in the code * * @access private * @var string */ private $_dqReplacement = '{{^|^escapedDQ^|^}}'; /** * Constructor * * @access public * @param string Path to template plugins directory * @return boolean Construction successful */ public function __construct( $template_plugins_class_path='' ) { self::$template_plugins_class_path = $template_plugins_class_path; $this->IPS_CACHE_PATH = $this->root_path . $this->cache_dir . '/cacheid_' . $this->cache_id; return true; } public function setWorkingGroup( $group ) { $this->_skinGroup = $group; } /** * convert_cache_to_eval * * Takes raw PHP data (from a MASTER cache class) and formats it ready * for eval'ing in the scripts. * * @access public * @param string The actual contents of the class, php tags 'an all. * @param string Full class name * @param integer ID to use * @return string Ready to eval PHP code */ public function convertCacheToEval($data='', $full_class_name='', $id=1) { //----------------------------------------- // INIT //----------------------------------------- $this->_skinGroup = preg_replace( "#^(.*)_\d+?$#", "\\1", $full_class_name ); $final_content = $this->_returnFunctionData( $data ); //----------------------------------------- // Return the stuff... //----------------------------------------- $out = "class {$full_class_name} {\n\n"; $out .= <<registry = \$registry; \$this->DB = \$this->registry->DB(); \$this->settings =& \$this->registry->fetchSettings(); \$this->request =& \$this->registry->fetchRequest(); \$this->lang = \$this->registry->getClass('class_localization'); \$this->member = \$this->registry->member(); \$this->memberData =& \$this->registry->member()->fetchMemberData(); \$this->cache = \$this->registry->cache(); \$this->caches =& \$this->registry->cache()->fetchCaches(); } EOF; $out .= $final_content; $out .= "\n\n}"; return $out; } /** * _returnFunctionData * * Extracts function data * * @access private * @param string The actual contents of the class, php tags 'an all. * @param array Functions to find * @return string Converted content */ private function _returnFunctionData( $data='', $function_find=array() ) { //----------------------------------------- // 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( "/