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


PHP ezcBaseFeatures::supportsLink方法代码示例

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


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

示例1: getEntryFromFile

 /**
  * Returns one or an array of ezcArchiveEntry's from one or multiple files in the file system.
  *
  * One or multiple ezcArchiveEntry's are created upon the given files.
  * The prefix will directly set for the ezcArchiveEntry with $prefix.
  *
  * If $files contains a path to a file, then one ezcArchiveEntry will be created and returned.
  * If $files is an array of paths, then all those ezcArchiveEntry's will be created and returned in an array.
  *
  * When multiple files are given in an array, this method will search for hard links among other files in the array.
  *
  * @throws ezcArchiveEntryPrefixException if the prefix is invalid.
  *
  * @param string|array(string)  $files
  * @param string                $prefix
  * @return ezcArchiveEntry
  */
 public static function getEntryFromFile($files, $prefix)
 {
     $isArray = true;
     if (!is_array($files)) {
         $isArray = false;
         $files = array($files);
     }
     $inodes = array();
     $i = 0;
     foreach ($files as $file) {
         if (!file_exists($file) && !is_link($file)) {
             return false;
         }
         $struct = self::getFileStructureFromFile($file);
         // Check if it's a hardlink if the OS supports it, and handle it.
         if (ezcBaseFeatures::supportsLink()) {
             if (isset($inodes[$struct->ino])) {
                 // Yes, it's a hardlink.
                 $struct->type = ezcArchiveEntry::IS_LINK;
                 $struct->size = 0;
                 $struct->link = $inodes[$struct->ino];
             } else {
                 $inodes[$struct->ino] = $struct->path;
             }
         }
         $entry[$i] = new ezcArchiveEntry($struct);
         $entry[$i]->setPrefix($prefix);
         if (isset($prefix) && strlen($prefix) > 0) {
             if (strlen($entry[$i]->getPath()) == strlen($entry[$i]->getPath(false))) {
                 throw new ezcArchiveEntryPrefixException($prefix, $file);
             }
         }
         $i++;
     }
     return $isArray ? $entry : $entry[0];
 }
开发者ID:bmdevel,项目名称:ezc,代码行数:53,代码来源:entry.php

示例2: testSupportsLink

 public function testSupportsLink()
 {
     $this->assertEquals(true, ezcBaseFeatures::supportsLink());
 }
开发者ID:andikoller,项目名称:FHC-3.0-FHBGLD,代码行数:4,代码来源:features_test.php

示例3: testSupportsLink

 public function testSupportsLink()
 {
     $this->assertFalse(ezcBaseFeatures::supportsLink());
 }
开发者ID:naderman,项目名称:pflow,代码行数:4,代码来源:features_windows_test.php


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