• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/block.php
  • Класс: BitrixLandingBlock
  • Вызов: Block::getNamespaces
static function getNamespaces()
{
	static $namespaces = [];

	if ($namespaces)
	{
		return $namespaces;
	}

	$paths = self::getGeneralPaths();
	$disableNamespace = (array)Config::get('disable_namespace');
	$enableNamespace = Config::get('enable_namespace');
	$enableNamespace = $enableNamespace ? (array) $enableNamespace : array();

	$namespaces = [];
	foreach ($paths as $path)
	{
		if ($path !== false)
		{
			$path = Manager::getDocRoot() . $path;
			// read all subdirs ($namespaces) in block dir
			if (($handle = opendir($path)))
			{
				while ((($entry = readdir($handle)) !== false))
				{
					if (!empty($enableNamespace))
					{
						if (in_array($entry, $enableNamespace))
						{
							$namespaces[] = $entry;
						}
					}
					else if (
						$entry != '.' && $entry != '..' &&
						is_dir($path . '/' . $entry) &&
						!in_array($entry, $disableNamespace)
					)
					{
						$namespaces[] = $entry;
					}
				}
			}
		}
	}
	$namespaces = array_unique($namespaces);

	return $namespaces;
}