/** * Enter description here... * * @param IF_File $oDestFile */ public function copyTo(IF_File $file) { return copy($this->m_path, $file->getPath()); }
/** * Gets the path to the file which the caller of this method wants. * * @param string $strFilename * @param long $timestamp */ public function load($strFilename, $timestamp = NULL) { // Parameter must be given. if (!empty($strFilename)) { // Get the store folder of the file. $storeFolder = self::getStoreFolderPath(FALSE, $timestamp); // Create a file object and return the relative path. $oStoredFile = new IF_File($storeFolder . "/" . $strFilename); if ($oStoredFile->exists()) { return $oStoredFile->getPath(); } else { // Throw excpetion, because the file doesn't exist. throw new Exception("The file doesn't exist: " . $oStoredFile->getAbsolutePath()); } } }
/** * Searches all include statements and reads the contents from the include * files into the current template. * */ private function doIncludes() { // The regexpression for the include-tags. $strRegex = "/\\[\\{INCLUDE ([^ \\}]+)\\}\\]/"; // Match the regex. if (preg_match_all($strRegex, $this->m_templateContent, $matches, PREG_SET_ORDER)) { // Iterate the matches, if there are any.. foreach ($matches as $match) { //print( "Match: " . $match[0] . "<br />" ); //print( "Match-Group: " . $match[1] . "<br />" ); // Check whether the include-file exists. $oIncFile = new IF_File($match[1]); if ($oIncFile->exists()) { // Read the contents of the file. $fileContent = file_get_contents($oIncFile->getPath()); // Insert the content into the current template file. $this->m_templateContent = str_replace($match[0], $fileContent, $this->m_templateContent); } else { // The file which is to include can not be found. throw new Exception("Template error: The file \"" . $match[1] . "\" doesn't exist."); } } } }