本文整理汇总了PHP中RecursiveDirectoryIterator::isDot方法的典型用法代码示例。如果您正苦于以下问题:PHP RecursiveDirectoryIterator::isDot方法的具体用法?PHP RecursiveDirectoryIterator::isDot怎么用?PHP RecursiveDirectoryIterator::isDot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecursiveDirectoryIterator
的用法示例。
在下文中一共展示了RecursiveDirectoryIterator::isDot方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_maps
function show_maps()
{
$maps = array();
$it = new RecursiveDirectoryIterator('../maps');
foreach (new RecursiveIteratorIterator($it) as $file) {
if (!$it->isDot()) {
array_push($maps, basename($file));
}
}
echo json_encode($maps);
}
示例2: valid
/**
* Returns true if file is valid.
* Valid Files: Directories and Files not beginning with a "." (dot).
*
* @todo make it more flexible to handle hidden dirs on demand etc,
* win/*nix compat
*
* @return boolean if current file entry is vali
*/
public function valid()
{
if (parent::valid()) {
if (parent::isDot() || parent::isDir() && strpos(parent::getFilename(), '.') === 0) {
parent::next();
// zum nächsten eintrag hüpfen
return $this->valid();
// nochmal prüfen
}
return true;
}
return false;
}
开发者ID:joshiausdemwald,项目名称:sfFilebasePlugin,代码行数:22,代码来源:sfFilebasePluginRecursiveDirectoryIterator.php
示例3: getImagePaths
/**
* A function to (optionally) recursive through a root directory,
* retrieving image paths
*
* @param $folder
* The root folder to start the scanning
* @param $enable_chidren
* Boolean value to enable scanning through child folders, default to false
*
* @return
* An array of image paths
*
* @todo
* Use more robust php recursive directory search options
*/
static function getImagePaths($folder, $enable_chidren = FALSE)
{
$image_array = array();
$iterator = new RecursiveDirectoryIterator($folder);
$image_array = array_merge($image_array, VSMGFileHelper::getDirectoryImages($folder));
if ($enable_chidren) {
foreach ($iterator as $file) {
if (is_dir($file) && !$iterator->isDot()) {
// echo "VSMGFileHelper::getImagePaths DIR: $file\n";
$image_array = array_merge($image_array, VSMGFileHelper::getDirectoryImages($file));
}
}
}
return $image_array;
}
示例4: scanFilesObj
/**
* fills the list of availible files, with DirectoryIterator object as value
*
* @return void
*/
protected function scanFilesObj()
{
if (!empty($this->filesObj)) {
return;
}
if ($this->recursive) {
$it = new RecursiveIteratorIterator($this->obj, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($it as $filename => $obj) {
if ($it->isDot()) {
continue;
}
$this->filesObj[$filename] = $obj;
}
} else {
foreach ($this->obj as $filename => $obj) {
if ($this->obj->isDot()) {
continue;
}
$this->filesObj[$obj->getFilename()] = $obj;
}
}
}
示例5: parseDir
/**
* parse this directory
*
* @return none
*/
protected function parseDir()
{
$this->clear();
$iter = new RecursiveDirectoryIterator($this->getPath());
while ($iter->valid()) {
$curr = (string) $iter->getSubPathname();
if (!$iter->isDot() && $curr[0] != '.') {
$this->addItem(Varien_Directory_Factory::getFactory($iter->current(), $this->getRecursion(), $this->getRecursionLevel()));
}
$iter->next();
}
}
示例6: emptyDirectoryRecursively
/**
* Deletes all files, directories and subdirectories from the specified
* directory. The passed directory itself won't be deleted though.
*
* @param string $path Path to the directory which shall be emptied.
* @return void
* @throws Exception
* @see removeDirectoryRecursively()
*/
public static function emptyDirectoryRecursively($path)
{
if (!is_dir($path)) {
throw new \TYPO3\Flow\Utility\Exception('"' . $path . '" is no directory.', 1169047616);
}
if (self::is_link($path)) {
if (self::unlink($path) !== TRUE) {
throw new \TYPO3\Flow\Utility\Exception('Could not unlink symbolic link "' . $path . '".', 1323697654);
}
} else {
$directoryIterator = new \RecursiveDirectoryIterator($path);
foreach ($directoryIterator as $fileInfo) {
if (!$fileInfo->isDir()) {
if (self::unlink($fileInfo->getPathname()) !== TRUE) {
throw new \TYPO3\Flow\Utility\Exception('Could not unlink file "' . $fileInfo->getPathname() . '".', 1169047619);
}
} elseif (!$directoryIterator->isDot()) {
self::removeDirectoryRecursively($fileInfo->getPathname());
}
}
}
}
示例7: remove
function remove($dirname) {
if (is_dir($dirname)) {
$dir=new RecursiveDirectoryIterator($dirname);
foreach ($dir as $k=>$v) {
if (!$dir->isDot()) {
if ($v->isDir()) {
self::remove($v->getPathname());
}
else {
unlink($v->getPathname());
}
}
}
unset($dir);
rmdir($dirname);
return true;
}
return false;
}
示例8: iterateFiles
/**
* Not using recursiveDirectoryIterator to savely ignore unreadable directories
*
* @param RecursiveDirectoryIterator $iter
*/
protected function iterateFiles(RecursiveDirectoryIterator $iter)
{
foreach ($iter as $file) {
if (!is_readable($file)) {
continue;
} else {
if (!$iter->isDot()) {
if (is_file((string) $file)) {
if (!$this->isIgnored($file) && !$this->isIgnoredDirectory($file)) {
$this->results[] = new Robo47_DirectoryHasher_Result_File($file);
}
} else {
if (is_dir($file)) {
$this->iterateFiles(new RecursiveDirectoryIterator((string) $file));
}
}
}
}
}
}
示例9: unzipAll
/**
* Recursively go through each folder and extract the archives
*
* @param $start
*/
public function unzipAll($start)
{
$iterator = new RecursiveDirectoryIterator($start);
foreach ($iterator as $file) {
if ($file->isFile()) {
$extension = pathinfo($file->getFilename(), PATHINFO_EXTENSION);
if ($extension == 'zip') {
$unzip = $file->getPath() . '/' . $file->getBasename('.' . $extension);
$result = JArchive::extract($file->getPathname(), $unzip);
// delete the archive once we extract it
if ($result) {
JFile::delete($file->getPathname());
// now check the new extracted folder for archive files
$this->unzipAll($unzip);
}
}
} else {
if (!$iterator->isDot()) {
$this->unzipAll($file->getPathname());
}
}
}
}
示例10: _recurseDirectory
/**
* Recursive directory function.
*
* @param RecursiveDirectoryIterator $iterator
*/
protected function _recurseDirectory($iterator)
{
while ($iterator->valid()) {
if ($iterator->isDir() && !$iterator->isDot()) {
if ($iterator->hasChildren()) {
$this->_recurseDirectory($iterator->getChildren());
}
} elseif ($iterator->isFile()) {
$path = $iterator->getPath() . '/' . $iterator->getFilename();
$pathinfo = pathinfo($path);
if ($this->_isPhpFile($path)) {
$this->addFile($path);
}
}
$iterator->next();
}
}
示例11: _fetch
/**
*
* Recursively iterates through a directory looking for class files.
*
* Skips CVS directories, and all files and dirs not starting with
* a capital letter (such as dot-files).
*
* @param RecursiveDirectoryIterator $iter Directory iterator.
*
* @return void
*
*/
protected function _fetch(RecursiveDirectoryIterator $iter)
{
for ($iter->rewind(); $iter->valid(); $iter->next()) {
// preliminaries
$path = $iter->current()->getPathname();
$file = basename($path);
$capital = ctype_alpha($file[0]) && $file == ucfirst($file);
$phpfile = strripos($file, '.php');
// check for valid class files
if ($iter->isDot() || !$capital) {
// skip dot-files (including dot-file directories), as
// well as files/dirs not starting with a capital letter
continue;
} elseif ($iter->isDir() && $file == 'CVS') {
// skip CVS directories
continue;
} elseif ($iter->isDir() && $iter->hasChildren()) {
// descend into child directories
$this->_fetch($iter->getChildren());
} elseif ($iter->isFile() && $phpfile) {
// map the .php file to a class name
$len = strlen($this->_base);
$class = substr($path, $len, -4);
// drops .php
$class = str_replace(DIRECTORY_SEPARATOR, '_', $class);
$this->_map[$class] = $path;
}
}
}
示例12: valid
function valid()
{
if (parent::valid()) {
if (!parent::isDir() || parent::isDot()) {
parent::next();
return $this->valid();
}
return TRUE;
}
return FALSE;
}