• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/wizard_util.php
  • Класс: ifCWizardUtil
  • Вызов: CWizardUtil::GetWizardList
static function GetWizardList($filterNamespace = false, $bLoadFromModules = false)
{
	$arWizards = array();
	$arLoadedWizards = array();

	$wizardPath = $_SERVER["DOCUMENT_ROOT"].CWizardUtil::GetRepositoryPath();

	if ($handle = @opendir($wizardPath))
	{
		while (($dirName = readdir($handle)) !== false)
		{
			if ($dirName == "." || $dirName == ".." || !is_dir($wizardPath."/".$dirName))
				continue;

			if (file_exists($wizardPath."/".$dirName."/.description.php"))
			{
				//Skip component without namespace
				if ($filterNamespace !== false && $filterNamespace <> '')
					continue;

				if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru")
				{
					if (file_exists(($fname = $wizardPath."/".$dirName."/lang/".LangSubst(LANGUAGE_ID)."/.description.php")))
						__IncludeLang($fname, false, true);
				}

				if (file_exists(($fname = $wizardPath."/".$dirName."/lang/".LANGUAGE_ID."/.description.php")))
					__IncludeLang($fname, false, true);

				$arWizardDescription = array();
				include($wizardPath."/".$dirName."/.description.php");
				$arWizards[] = array("ID" => $dirName) + $arWizardDescription;
				$arLoadedWizards[] = $dirName;
			}
			else
			{
				if ($filterNamespace !== false && ($filterNamespace == '' || $filterNamespace != $dirName))
						continue;

				if ($nspaceHandle = @opendir($wizardPath."/".$dirName))
				{
					while (($file = readdir($nspaceHandle)) !== false)
					{
						$pathToWizard = $wizardPath."/".$dirName."/".$file;

						if ($file == "." || $file == ".." || !is_dir($pathToWizard))
							continue;

						if (file_exists($pathToWizard."/.description.php"))
						{
							if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru")
							{
								if (file_exists(($fname = $pathToWizard."/lang/".LangSubst(LANGUAGE_ID)."/.description.php")))
									__IncludeLang($fname, false, true);
							}

							if (file_exists(($fname = $pathToWizard."/lang/".LANGUAGE_ID."/.description.php")))
								__IncludeLang($fname, false, true);

							$arWizardDescription = array();
							include($pathToWizard."/.description.php");
							$arWizards[] = array("ID" => $dirName.":".$file) + $arWizardDescription;
							$arLoadedWizards[] = $dirName.":".$file;
						}
					}

					@closedir($nspaceHandle);
				}
			}
		}
		@closedir($handle);
	}

	if ($bLoadFromModules)
	{
		$modulesPath = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules";

		if ($handle = @opendir($modulesPath))
		{
			while (($moduleName = readdir($handle)) !== false)
			{
				if ($moduleName == "." || $moduleName == ".." || !is_dir($modulesPath."/".$moduleName))
					continue;

				if (!file_exists($modulesPath."/".$moduleName."/install/wizards"))
					continue;

				if ($handle1 = @opendir($modulesPath."/".$moduleName."/install/wizards"))
				{
					while (($dirName = readdir($handle1)) !== false)
					{
						if ($dirName == "." || $dirName == ".." || !is_dir($modulesPath."/".$moduleName."/install/wizards/".$dirName))
							continue;

						if ($filterNamespace !== false && ($filterNamespace == '' || $filterNamespace != $dirName))
							continue;

						if ($handle2 = @opendir($modulesPath."/".$moduleName."/install/wizards/".$dirName))
						{
							while (($file = readdir($handle2)) !== false)
							{
								$pathToWizard = $modulesPath."/".$moduleName."/install/wizards/".$dirName."/".$file;

								if ($file == "." || $file == ".." || !is_dir($pathToWizard))
									continue;

								if (in_array($dirName.":".$file, $arLoadedWizards))
									continue;

								if (file_exists($pathToWizard."/.description.php"))
								{
									if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru")
									{
										if (file_exists(($fname = $pathToWizard."/lang/".LangSubst(LANGUAGE_ID)."/.description.php")))
											__IncludeLang($fname, false, true);
									}

									if (file_exists(($fname = $pathToWizard."/lang/".LANGUAGE_ID."/.description.php")))
										__IncludeLang($fname, false, true);

									$arWizardDescription = array();
									include($pathToWizard."/.description.php");
									$arWizards[] = array("ID" => $moduleName.":".$dirName.":".$file) + $arWizardDescription;
									$arLoadedWizards[] = $dirName.":".$file;
								}
							}

							@closedir($handle2);
						}
					}
					@closedir($handle1);
				}
			}
			@closedir($handle);
		}
	}

	return $arWizards;
}