includeCode($include_file); } } public function setCode($code) { $this->_code = $code; } public function includeCode($path) { $fp = fopen($path, 'r'); if ( !$fp ) { return; } $contents = fread($fp, filesize($path)); $contents = str_replace('', '', $contents); fclose($fp); $this->setCode($contents); } public function redefineFunction($new_function) { preg_match('/function (.+)\(/', $new_function, $aryMatches); $func_name = trim($aryMatches[1]); if (preg_match('/(function ' . $func_name . '[\w\W\n]+?)(function)/s', $this->_code, $aryMatches)) { $search_code = $aryMatches[1]; $new_code = str_replace($search_code, $new_function . "\n\n", $this->_code); $new_code = str_replace("function cssmgr", "function __construct", $new_code); $this->setCode($new_code); return true; } else { return false; } } public function getCode() { return $this->_code; } }