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


PHP FileUtil::unifyDirSeperator方法代码示例

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


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

示例1: getData

 /**
  * @see CacheBuilder::getData()
  */
 public function getData($cacheResource)
 {
     $data = array();
     $sql = "SELECT\t*\n\t\t\tFROM\tpb" . PB_N . "_setup_resource";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $data[$row['sourceID']][] = FileUtil::unifyDirSeperator($row['directory']);
     }
     return $data;
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:13,代码来源:CacheBuilderWcfSetupResource.class.php

示例2: checkout

 /**
  * @see	SCM::checkout()
  */
 public static function checkout($url, $directory, array $loginDetails = array(), array $options = array())
 {
     if (empty($directory)) {
         throw new SubversionException('Subversion checkout: target directory missing.');
     }
     // append directory
     $directory = FileUtil::unifyDirSeperator($directory);
     $options['directory'] = $directory;
     return self::executeCommand('checkout', $url, $loginDetails, $options);
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:13,代码来源:Subversion.class.php

示例3: create

 /**
  * Creates a new source.
  *
  * @param 	string		$name			The name of the source
  * @param	string		$sourceDirectory	Source directory used for files
  * @param	string		$buildDirectory		Build directory contains all archives
  * @param	string		$scm			Defines used SCM, may be 'git', 'none' and 'subversion'
  * @param	string		$url			URL for accessing subversion
  * @param	string		$username		Username neccessary if subversion repository is protected
  * @param	string		$password		Password neccessary if subversion repository is protected
  * @param	boolean		$trustServerCert	Automaticly trust server certificate
  * @param	boolean		$enableCheckout		Enables checkout ability
  * @param	integer		$position		Position used to order sources
  * @return 	SourceEditor
  */
 public static function create($name, $sourceDirectory, $buildDirectory, $scm, $url, $username, $password, $trustServerCert, $enableCheckout, $position)
 {
     // handle dir seperators
     $sourceDirectory = FileUtil::unifyDirSeperator($sourceDirectory);
     $buildDirectory = FileUtil::unifyDirSeperator($buildDirectory);
     // validate SCM
     $scm = self::validateSCM($scm);
     // save data
     $sourceID = self::insert($name, array('sourceDirectory' => $sourceDirectory, 'buildDirectory' => $buildDirectory, 'scm' => $scm, 'url' => $url, 'username' => $username, 'password' => $password, 'trustServerCert' => $trustServerCert, 'enableCheckout' => $enableCheckout));
     // get source
     $source = new SourceEditor($sourceID, null);
     // set position
     $source->setPosition($position);
     // create permissions
     $source->createPermissions();
     return $source;
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:32,代码来源:SourceEditor.class.php

示例4: readData

 /**
  * @see	Page::readData()
  */
 public function readData()
 {
     // read cache
     WCF::getCache()->addResource('packages-' . $this->source->sourceID, PB_DIR . 'cache/cache.packages-' . $this->source->sourceID . '.php', PB_DIR . 'lib/system/cache/CacheBuilderPackages.class.php');
     try {
         $packages = WCF::getCache()->get('packages-' . $this->source->sourceID, 'packages');
     } catch (SystemException $e) {
         // fallback if no cache available
         $packages = array();
     }
     // handle packages
     foreach ($packages as $package) {
         $this->directories[$package['packageName']] = $package['packageName'];
         $this->packages[$package['directory']] = array('packageName' => $package['packageName'], 'version' => $package['version']);
     }
     // remove duplicates and sort directories
     asort($this->directories);
     // set build directory
     $this->buildDirectory = $this->source->buildDirectory;
     if (WCF::getUser()->getPermission('admin.source.canEditSources')) {
         $this->buildDirectory = StringUtil::replace(FileUtil::unifyDirSeperator(PB_DIR), '', $this->buildDirectory);
     }
     // get source configuration
     $sourceData = WCF::getSession()->getVar('source' . $this->source->sourceID);
     if ($sourceData !== null) {
         $sourceData = unserialize($sourceData);
         $this->currentDirectory = $sourceData['directory'];
         $this->currentPackageName = $sourceData['packageName'];
     } else {
         $sql = "SELECT\tdirectory, packageName\n\t\t\t\tFROM\tpb" . PB_N . "_user_preference\n\t\t\t\tWHERE \tuserID = " . WCF::getUser()->userID . "\n\t\t\t\t\tAND sourceID = " . $this->source->sourceID;
         $row = WCF::getDB()->getFirstRow($sql);
         $this->currentDirectory = $row['directory'];
         $this->currentPackageName = $row['packageName'];
         WCF::getSession()->register('source' . $this->source->sourceID, serialize(array('directory' => $row['directory'], 'packageName' => $row['packageName'])));
     }
     // set current filename
     $currentFilename = WCF::getSession()->getVar('filename' . $this->source->sourceID);
     if ($currentFilename !== null) {
         $this->currentFilename = $currentFilename;
     }
     // read current builds
     $this->sourceFileList = new SourceFileList();
     $this->sourceFileList->sqlConditions = 'source_file.sourceID = ' . $this->source->sourceID;
     $this->sourceFileList->sqlLimit = 0;
     $this->sourceFileList->readObjects();
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:49,代码来源:SourceViewPage.class.php

示例5: getHeadRevision

 /**
  * @see	SCM::getHeadRevision()
  */
 public static function getHeadRevision($url, array $loginDetails = array(), array $options = array())
 {
     try {
         self::validateGitPath();
         // not very nice or fast method to find out, but it should work
         self::checkout($url, GIT_TEMPORARY_DIRECTORY, $loginDetails, $options);
         $dir = explode('/', $url);
         $dir = str_replace('.git', '', $dir[count($dir) - 1]);
         $headdir = explode(" ", file_get_contents(FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator(GIT_TEMPORARY_DIRECTORY)) . $dir . '/.git/HEAD'));
         $return = file_get_contents(FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator(GIT_TEMPORARY_DIRECTORY)) . $dir . '/.git/' . trim($headdir[1]));
         $dir = DirectoryUtil::getInstance(FileUtil::addTrailingSlash(GIT_TEMPORARY_DIRECTORY) . $dir);
         $dir->removeComplete();
         return $return;
     } catch (GitException $e) {
         throw $e;
     } catch (SystemException $e) {
     }
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:21,代码来源:Git.class.php

示例6: readFormParameters

 /**
  * @see Form::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     if (isset($_POST['name'])) {
         $this->name = StringUtil::trim($_POST['name']);
     }
     if (isset($_POST['sourceDirectory'])) {
         $this->sourceDirectory = StringUtil::trim($_POST['sourceDirectory']);
     }
     $this->sourceDirectory = FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator($this->sourceDirectory));
     if (isset($_POST['buildDirectory'])) {
         $this->buildDirectory = StringUtil::trim($_POST['buildDirectory']);
     }
     $this->buildDirectory = FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator($this->buildDirectory));
     if (isset($_POST['position'])) {
         $this->position = intval($_POST['position']);
     }
     if (isset($_POST['scm'])) {
         $this->scm = StringUtil::trim($_POST['scm']);
     }
     if (isset($_POST['useSubversion'])) {
         $this->useSubversion = intval($_POST['useSubversion']);
     }
     if (isset($_POST['url'])) {
         $this->url = StringUtil::trim($_POST['url']);
     }
     if (isset($_POST['username'])) {
         $this->username = StringUtil::trim($_POST['username']);
     }
     if (isset($_POST['password'])) {
         $this->password = StringUtil::trim($_POST['password']);
     }
     if (isset($_POST['trustServerCert'])) {
         $this->trustServerCert = intval($_POST['trustServerCert']);
     }
     if (isset($_POST['enableCheckout'])) {
         $this->enableCheckout = intval($_POST['enableCheckout']);
     }
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:42,代码来源:SourceAddForm.class.php

示例7: getRandomDirectory

 /**
  * Returns a random directory
  *
  * @param	string	$directory	Directory to include
  * @return	Random 	directory
  */
 public static function getRandomDirectory($directory)
 {
     $directory = PB_DIR . $directory . '/' . StringUtil::getRandomID() . '/';
     $directory = FileUtil::unifyDirSeperator($directory);
     return $directory;
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:12,代码来源:Source.class.php

示例8: uninstall

 /**
  * Uninstalls the files of this package.
  */
 public function uninstall()
 {
     // get absolute package dir
     $packageDir = FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator(realpath(WCF_DIR . $this->installation->getPackage()->getDir())));
     // create file list
     $files = array();
     // get files from log
     $sql = "SELECT\t*\n\t\t\tFROM\twcf" . WCF_N . "_package_installation_file_log\n\t\t\tWHERE \tpackageID = " . $this->installation->getPackageID();
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $files[] = $row['filename'];
     }
     if (count($files) > 0) {
         // delete files
         $this->installation->deleteFiles($packageDir, $files);
         // delete log entries
         parent::uninstall();
     }
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:22,代码来源:FilesPackageInstallationPlugin.class.php

示例9: getRequestURI

 /**
  * Returns the request uri of the active request.
  * 
  * @return	string
  */
 public static function getRequestURI()
 {
     $REQUEST_URI = '';
     /*if (!empty($_SERVER['REQUEST_URI'])) {
     			$REQUEST_URI = $_SERVER['REQUEST_URI'];
     		}
     		else {*/
     if (!empty($_SERVER['ORIG_PATH_INFO']) && strpos($_SERVER['ORIG_PATH_INFO'], '.php') !== false) {
         $REQUEST_URI = $_SERVER['ORIG_PATH_INFO'];
     } else {
         if (!empty($_SERVER['ORIG_SCRIPT_NAME'])) {
             $REQUEST_URI = $_SERVER['ORIG_SCRIPT_NAME'];
         } else {
             if (!empty($_SERVER['SCRIPT_NAME'])) {
                 $REQUEST_URI = $_SERVER['SCRIPT_NAME'];
             } else {
                 if (!empty($_SERVER['PHP_SELF'])) {
                     $REQUEST_URI = $_SERVER['PHP_SELF'];
                 } else {
                     if (!empty($_SERVER['PATH_INFO'])) {
                         $REQUEST_URI = $_SERVER['PATH_INFO'];
                     }
                 }
             }
         }
     }
     if (!empty($_SERVER['QUERY_STRING'])) {
         $REQUEST_URI .= '?' . $_SERVER['QUERY_STRING'];
     }
     //}
     //if (!strstr($REQUEST_URI, '.')) $REQUEST_URI = 'index.php';
     return substr(FileUtil::unifyDirSeperator($REQUEST_URI), 0, 255);
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:38,代码来源:UserUtil.class.php

示例10: addFile

 /**
  * Adds a file to the tar archive.
  * 
  * @param	string		$filename
  * @param	string		$addDir
  * @param	string		$removeDir
  * @return	boolean		result
  */
 protected function addFile($filename, $addDir, $removeDir)
 {
     $filename = FileUtil::unifyDirSeperator($filename);
     $storedFilename = $filename;
     if (!empty($removeDir)) {
         $storedFilename = StringUtil::replaceIgnoreCase($removeDir, '', $filename);
     }
     if (!empty($addDir)) {
         $storedFilename = $addDir . $storedFilename;
     }
     if (is_file($filename)) {
         // open file
         $file = new File($filename, 'rb');
         // write header
         if (!$this->writeFileHeader($filename, $storedFilename)) {
             return false;
         }
         // write file content
         while (($buffer = $file->read(512)) != '') {
             $this->file->write(pack('a512', $buffer));
         }
         // close file
         $file->close();
     } else {
         // only directory header
         if (!$this->writeFileHeader($filename, $storedFilename)) {
             return false;
         }
     }
     return true;
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:39,代码来源:TarWriter.class.php

示例11: redirect

 /**
  * Redirects the user agent.
  *
  * @param	string		$location
  * @param 	boolean		$prependDir
  * @param	boolean		$sendStatusCode
  */
 public static function redirect($location, $prependDir = true, $sendStatusCode = false)
 {
     if ($prependDir) {
         // @see http://www.woltlab.com/bugtracker/index.php?page=Bug&bugID=2909
         $location = self::getHost() . FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator(dirname(WCF::getSession()->requestURI))) . $location;
     }
     //if ($sendStatusCode) @header('HTTP/1.0 301 Moved Permanently');
     if ($sendStatusCode) {
         @header('HTTP/1.1 307 Temporary Redirect');
     }
     header('Location: ' . $location);
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:19,代码来源:HeaderUtil.class.php

示例12: getInstalledFiles

 /**
  * Scans the given dir for installed files.
  * 
  * @param 	string		$dir
  */
 protected function getInstalledFiles($dir)
 {
     if ($files = glob($dir . '*')) {
         foreach ($files as $file) {
             if (is_dir($file)) {
                 $this->getInstalledFiles(FileUtil::addTrailingSlash($file));
             } else {
                 self::$installedFiles[] = FileUtil::unifyDirSeperator($file);
             }
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:17,代码来源:WCFSetup.class.php

示例13: getRelativeFtpPath

 /**
  * Searches a relative path emanating from an absolute installation path.
  * 
  * @param 	FTP 		$ftp
  * @param 	string 		$installPath
  * @return 	string		$relativeFtpPath
  */
 public static function getRelativeFtpPath(FTP $ftp, $installPath)
 {
     // write a zero byte test file to the presumptive root of the ftp server.
     $installPath = FileUtil::unifyDirSeperator($installPath);
     $destFile = self::writeDummyFile($ftp);
     $pathPrefix = '';
     if (!$destFile) {
         // loop through folders to find a writable directory
         $pathSegments = explode('/', FileUtil::removeLeadingSlash(FileUtil::removeTrailingSlash($installPath)));
         foreach ($pathSegments as $path) {
             if (@$ftp->chdir($path)) {
                 $pathPrefix .= $path . '/';
                 if ($destFile = self::writeDummyFile($ftp)) {
                     for ($i = 0; $i < substr_count($pathPrefix, '/'); $i++) {
                         $ftp->cdup();
                     }
                     break;
                 }
             } else {
                 if (!empty($pathPrefix)) {
                     return null;
                 }
             }
         }
     }
     // search given installation path for that file.
     $pathSegments = explode('/', FileUtil::removeLeadingSlash(FileUtil::removeTrailingSlash($installPath)));
     while (count($pathSegments) != 0) {
         if (preg_match('/^WIN/i', PHP_OS)) {
             $currentDir = FileUtil::addTrailingSlash(implode($pathSegments, '/'));
         } else {
             $currentDir = '/' . FileUtil::addTrailingSlash(implode($pathSegments, '/'));
         }
         if (@file_exists($currentDir . $destFile)) {
             $basePath = $currentDir;
             break;
         } else {
             array_pop($pathSegments);
         }
     }
     if ($pathPrefix . $destFile) {
         $ftp->delete($pathPrefix . $destFile);
     }
     // return the rest of the path which must be the relative path.
     $relativeFtpPath = FileUtil::addTrailingSlash($pathPrefix . str_replace($currentDir, '', $installPath));
     return $relativeFtpPath;
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:54,代码来源:FTPUtil.class.php

示例14: cloneDirectory

 /**
  * Clones a directory.
  * 
  * @param	string		$buildDirectory
  * @param	string		$path
  */
 protected function cloneDirectory($buildDirectory, $path)
 {
     $path = FileUtil::addTrailingSlash($path);
     // ensure source directory exists
     if (!is_dir($this->resourceDirectory . $path)) {
         throw new SystemException("Required path '" . $path . "' within resource directory is not available.");
     }
     // create path
     if (!is_dir($buildDirectory . $path)) {
         FileUtil::makePath($buildDirectory . $path);
     }
     // copy files recursively
     $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->resourceDirectory . $path));
     while ($it->valid()) {
         if (!$it->isDot()) {
             // ignore .svn directories
             $tmp = explode('/', FileUtil::unifyDirSeperator($it->getSubPath()));
             if (in_array('.svn', $tmp)) {
                 $it->next();
                 continue;
             }
             $subPath = FileUtil::addTrailingSlash($it->getSubPath());
             if (!is_dir($buildDirectory . $path . $subPath)) {
                 FileUtil::makePath($buildDirectory . $path . $subPath);
             }
             copy($it->key(), $buildDirectory . $path . $it->getSubPathName());
         }
         $it->next();
     }
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:36,代码来源:StandalonePackageBuilder.class.php

示例15: getInstance

 /**
  * returns an instance of DirectoryUtil
  *
  * @param 	string		$directory 	directorypath
  * @param	boolean		$recursive	should the directory be walked through recursive
  * @return 	object				DirectoryUtil object
  */
 public static function getInstance($directory, $recursive = true)
 {
     $directory = realpath(FileUtil::unifyDirSeperator($directory));
     if ($directory === false) {
         throw new SystemException('Invalid directory');
     }
     if (!isset(self::$instances[$recursive][$directory])) {
         self::$instances[$recursive][$directory] = new DirectoryUtil($directory, $recursive);
     }
     return self::$instances[$recursive][$directory];
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:18,代码来源:DirectoryUtil.class.php


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