当前位置: 首页>>代码示例>>PHP>>正文


PHP Fox::getDirectoryPath方法代码示例

本文整理汇总了PHP中Fox::getDirectoryPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Fox::getDirectoryPath方法的具体用法?PHP Fox::getDirectoryPath怎么用?PHP Fox::getDirectoryPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fox的用法示例。


在下文中一共展示了Fox::getDirectoryPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: traverseDirFiles

 /**
  * Traverses Files and Directories inside given path Recursively
  * @param $path to traverse
  */
 public function traverseDirFiles($path)
 {
     $dir = opendir($path);
     $files = array();
     $f = array();
     $skip = array(Fox::getDirectoryPath() . DS . "var", Fox::getDirectoryPath() . DS . "library" . DS . "Zend", Fox::getExtensionDirectoryPath(), Fox::getDirectoryPath() . DS . "theme" . DS . "installer", APPLICATION_PATH . DS . "views" . DS . "installer");
     while ($ft = readdir($dir)) {
         if (in_array($ft, array(".", "..")) || in_array($path . DS . $ft, $skip)) {
             continue;
         }
         $f[] = $ft;
     }
     sort($f);
     foreach ($f as $file) {
         if (filetype($path . DS . $file) != "dir") {
             $files[] = $file;
         } else {
             $this->traverseDirFiles($path . DS . $file);
         }
     }
     foreach ($files as $f) {
         $this->processFiles($path, $f);
     }
     closedir($dir);
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:29,代码来源:DirectoryToXml.php

示例2: uninstallPackage

 /**
  * Uninstall package
  * 
  * @param string $key valid package key
  */
 public function uninstallPackage($key)
 {
     $config = $this->getConfig();
     if (!file_exists($config->getInstalledPkgPath() . DS . $key . '.xml')) {
         throw new Exception("Installation not found.");
     }
     $this->setStatus(Fox_Extensionmanager_Model_Package_Status::UNINSTALLING);
     $packageXml = $config->getInstalledPkgPath() . DS . $key . '.xml';
     $document = new Uni_Data_XDOMDocument();
     $document->load($packageXml);
     /*removing package files*/
     $xpath = new DomXpath($document);
     foreach ($xpath->query('//item[@rel="file"]') as $file) {
         $filePath = Fox::getDirectoryPath() . $file->getAttribute("path");
         if (file_exists($filePath) && !is_dir($filePath)) {
             try {
                 @unlink($filePath);
             } catch (Exception $e) {
             }
         }
     }
     /*listing directories to remove*/
     $dirs = array();
     foreach ($xpath->query('//item[@rel="dir"]') as $file) {
         $dirPath = Fox::getDirectoryPath() . $file->getAttribute("path");
         if (file_exists($dirPath) && is_dir($dirPath)) {
             try {
                 $dirs[] = $dirPath;
             } catch (Exception $e) {
             }
         }
     }
     /*removing empty directories in $dir list*/
     if ($dirs) {
         $dirs = array_reverse($dirs);
         foreach ($dirs as $dir) {
             @rmdir($dir);
         }
     }
     /*removing package from installed directory*/
     @unlink($packageXml);
     $this->clearCache();
     $this->setStatus(Fox_Extensionmanager_Model_Package_Status::UNINSTALLED);
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:49,代码来源:Package.php

示例3: getSiteXml

 /**
  * Get Xml of site directories/files
  * 
  * @param bool $cache if true gets xml from cache otherwise regenerates
  * @return string xml string
  */
 public function getSiteXml($cache = true)
 {
     $xml = '';
     $conf = $this->getConfig()->getConfiguration();
     $cachePath = Fox::getExtensionDirectoryPath() . DS . $conf->extensionmanager->dir_name . DS . $conf->extensionmanager->cache;
     if (!file_exists($cachePath)) {
         @mkdir($cachePath, 0777, true);
     }
     $fileName = $cachePath . DS . $conf->extensionmanager->cache_file;
     if ($cache && file_exists($fileName)) {
         $xml = file_get_contents($fileName);
     } else {
         $path = Fox::getDirectoryPath();
         $Obj = new Fox_Extensionmanager_Model_Generate_DirectoryToXml($path);
         $Obj->traverseDirFiles($path);
         $Obj->setArray($Obj->arr);
         if (!($xml = $Obj->saveArrayToXml())) {
             throw new Exception("Unable to load content tree data.");
         }
         $dom = $Obj->getXMLDom();
         $dom->save($fileName);
         @chmod($fileName, 0777);
     }
     return trim(preg_replace('/<\\?xml.*\\?>/', '', $xml, 1));
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:31,代码来源:Package.php


注:本文中的Fox::getDirectoryPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。