Exemplo n.º 1
0
 /**
  * 
  * @param string $namespace
  * @param string $path
  * @return boolean|string
  */
 protected function _getPath($namespace, $path)
 {
     // Find in session
     $namespaces = ZtFramework::getSession('extensions', array());
     if (isset($namespaces[$namespace])) {
         $paths = $namespaces[$namespace]->paths;
     } else {
         if (isset($this->_namespaces[$namespace])) {
             $paths = $this->_namespaces[$namespace];
         } else {
             $paths = array();
         }
     }
     /* Find first exists filePath */
     foreach ($paths as $_path) {
         $physicalPath = $_path . DIRECTORY_SEPARATOR . $path;
         if (JFile::exists($physicalPath)) {
             return rtrim(str_replace('/', DIRECTORY_SEPARATOR, $physicalPath), DIRECTORY_SEPARATOR);
         } elseif (JFolder::exists($physicalPath)) {
             return rtrim(str_replace('/', DIRECTORY_SEPARATOR, $physicalPath), DIRECTORY_SEPARATOR);
         }
     }
 }