本文整理汇总了PHP中Iterator::isDot方法的典型用法代码示例。如果您正苦于以下问题:PHP Iterator::isDot方法的具体用法?PHP Iterator::isDot怎么用?PHP Iterator::isDot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Iterator
的用法示例。
在下文中一共展示了Iterator::isDot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _search
/**
* Searches for matching files
*
* @param Iterator $file
* @param string $segment
* @param array $segments
* @param string $extension
* @param Atomik_Model_Builder $builder
* @return array
*/
protected function _search($file, $segment, $segments, $extension, $builder)
{
$files = array();
if (!$file->isDir() && count($segments) == 0) {
// not a directory
$filename = $file->getFilename();
$fileExt = null;
if ($extension !== null) {
// extracting the extension from the filename
$fileExt = strtolower(substr($filename, strrpos($filename, '.') + 1));
$filename = substr($filename, 0, strrpos($filename, '.'));
}
// to match, the segment can either be a variable or match the filename (without the extension)
// the file extension must matched the searched extensions
if ((substr($segment, 0, 1) == ':' || $filename == $segment) && $fileExt == $extension) {
$files[] = $this->_getDataFromFile($file->getPathname(), $builder);
}
} else if ($file->isDir()) {
// it is a directory
// the segment is not a variable and the filename does not match
if (substr($segment, 0, 1) != ':' && $file->getFilename() != $segment) {
return array();
}
// the segment is either a variable or it matches the current filename
// checking in sub files
$segment = array_shift($segments);
foreach (new DirectoryIterator($file->getPathname()) as $subFile) {
if (!$file->isDot()) {
$files = array_merge($files, $this->_search($subFile, $segment, $segments, $extension, $builder));
}
}
}
return $files;
}