private function parseAndCreateView(\blaze\io\File $file, $compositionChildren = null)
 {
     $path = $file->getAbsolutePath();
     $dom = new \DOMDocument();
     $dom->load($file->getAbsolutePath()->toNative());
     $viewId = $path->substring($this->viewDir->getAbsolutePath()->length())->replace(\blaze\io\File::$directorySeparator, '/')->trim('/');
     $root = new \blaze\web\component\UIViewRoot();
     if ($compositionChildren == null) {
         $root->setViewId($viewId->toNative());
         $this->views->put($root->getViewId(), $root);
     }
     $this->handleChildren($root, $dom->documentElement->childNodes, $compositionChildren);
     if ($compositionChildren != null) {
         return $root;
     }
 }
 private function initApplication()
 {
     if ($this->netletContext != null) {
         return;
     }
     $f = new File(ClassLoader::getSystemClassLoader()->getClassPath(), $this->package . File::$directorySeparator . 'web.xml');
     $doc = new \DOMDocument();
     $doc->load($f->getAbsolutePath());
     $this->config = $doc;
     $useDefault = true;
     foreach ($doc->documentElement->childNodes as $node) {
         if ($node->nodeType == XML_ELEMENT_NODE && $node->localName == 'netletConfig') {
             $this->netletContext = new NetletContextImpl(self::getInitParams($node), $this);
             $useDefault = false;
             self::handleConfigChildren($node);
         }
     }
     if ($useDefault) {
         $this->netletContext = new NetletContextImpl($this->getInitParams(self::$defaultNetletConfig), $this);
         self::handleConfigChildren(self::$defaultNetletConfig);
     }
 }
Exemple #3
0
 /**
  * Copy a file.
  *
  * @param File $src Source path and name file to copy.
  * @param File $dest Destination path and name of new file.
  *
  * @return void
  * @throws Exception if file cannot be copied.
  */
 public function copy(File $src, File $dest)
 {
     global $php_errormsg;
     // Recursively copy a directory
     if ($src->isDirectory()) {
         return $this->copyr($src->getAbsolutePath()->toNative(), $dest->getAbsolutePath()->toNative());
     }
     $srcPath = $src->getAbsolutePath()->toNative();
     $destPath = $dest->getAbsolutePath()->toNative();
     if (false === @copy($srcPath, $destPath)) {
         // Copy FAILED. Log and return err.
         // Add error from php to end of log message. $php_errormsg.
         $msg = "FileSystem::copy() FAILED. Cannot copy {$srcPath} to {$destPath}. {$php_errormsg}";
         throw new Exception($msg);
     }
     try {
         $dest->setMode($src->getMode());
     } catch (Exception $exc) {
         // [MA] does chmod returns an error on systems that do not support it ?
         // eat it up for now.
     }
 }