• Модуль: fileman
  • Путь к файлу: ~/bitrix/modules/fileman/classes/general/snippets.php
  • Класс: CSnippets
  • Вызов: CSnippets::InspectDir
static function InspectDir(&$arSnGroups, $path, $template, $level = 0, $parent = '')
{
	$io = CBXVirtualIo::GetInstance();
	$basePath = self::GetBasePath($template);
	if(!$io->DirectoryExists($basePath))
		return;

	$bpPath = $basePath.($path == "" ? "" : "/").$path;
	if (!$level)
		$level = 0;

	$d = $io->GetDirectory($bpPath);
	$arChildren = $d->GetChildren();
	foreach ($arChildren as $child)
	{
		$file = $child->GetName();
		if($file == ".htaccess" || $file == ".content.php" || ($level == 0 && $file == "images") || !$child->IsDirectory())
			continue;

		$filePath = $child->GetPathWithName();
		$arSnGroups[] = Array
		(
			'path' => $path,
			'name' => $file,
			'level' => $level,
			'default_name' => CSnippets::GetDefaultFileName($filePath)
		);

		$new_path = "".$path.($path == "" ? "" : "/").$file;
		CSnippets::InspectDir($arSnGroups, $new_path, $template, $level + 1, $parent);
	}
}