本文整理汇总了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];
}
示例2: testSupportsLink
public function testSupportsLink()
{
$this->assertEquals(true, ezcBaseFeatures::supportsLink());
}
示例3: testSupportsLink
public function testSupportsLink()
{
$this->assertFalse(ezcBaseFeatures::supportsLink());
}