示例#1
0
 protected function readInclude($currentFilename, $currentLine, $path, $raw, $options = array())
 {
     if (!($path[0] == '/' || preg_match('/^\\w\\:\\.+$/', $path))) {
         $path = realpath(dirname($currentFilename) . '/' . $path);
         if ($path == '') {
             throw new Exception($currentFilename, $currentLine, self::ERR_INVALID_FILENAME, $path);
         }
     }
     if (file_exists($path) && !is_dir($path)) {
         if ($raw) {
             $tline = file_get_contents($path);
         } else {
             $preproc = new self();
             $preproc->_doSaveVariables = false;
             $preproc->setVars($this->_variables);
             $tline = $preproc->parseFile($path);
             $this->_variables = $preproc->_variables;
             $preproc = null;
         }
     } else {
         throw new Exception($currentFilename, $currentLine, self::ERR_INVALID_FILENAME, $path);
     }
     if (count($options)) {
         $tline = $this->applyIncludeOptions($tline, $options);
     }
     return $tline;
 }