• Модуль: fileman
  • Путь к файлу: ~/bitrix/modules/fileman/classes/general/html_editor.php
  • Класс: CHTMLEditor
  • Вызов: CHTMLEditor::GetComponents
static function GetComponents($Params, $bClearCache = false, $arFilter = array())
{
	global $CACHE_MANAGER;

	$allowed = trim(COption::GetOptionString('fileman', "~allowed_components", ''));
	$mask = $allowed === ''? 0 : mb_substr(md5($allowed), 0, 10);

	$lang = isset($Params['lang']) ? $Params['lang'] : LANGUAGE_ID;
	$component_type = '';
	if(isset($arFilter['TYPE']))
		$component_type = '_'.$arFilter['TYPE'];

	$cache_name = 'component_tree_array_'.$lang.'_'.$mask.$component_type;
	$table_id = "fileman_component_tree";

	if ($bClearCache)
	{
		$CACHE_MANAGER->CleanDir($table_id);
	}

	if($CACHE_MANAGER->Read(self::CACHE_TIME, $cache_name, $table_id))
	{
		self::$arComponents = $CACHE_MANAGER->Get($cache_name);
	}

	if (empty(self::$arComponents))
	{
		// Name filter exists
		if ($allowed !== '')
		{
			$arAC = explode("n", $allowed);
			$arAC = array_unique($arAC);
			$arAllowed = Array();
			foreach ($arAC as $f)
			{
				$f = preg_replace("/s/is", "", $f);
				$f = preg_replace("/./is", "\.", $f);
				$f = preg_replace("/*/is", ".*", $f);
				$arAllowed[] = '/^'.$f.'$/';
			}
			$namespace = 'bitrix';
		}
		else
		{
			$arAllowed = false;
			$namespace = false;
		}

		$arTree = CComponentUtil::GetComponentsTree($namespace, $arAllowed, $arFilter);
		self::$arComponents = array(
			'items' => array(),
			'groups' => array()
		);
		self::$thirdLevelId = 0;

		if (isset($arTree['#']))
		{
			self::_HandleComponentElement($arTree['#'], '');
		}

		$CACHE_MANAGER->Set($cache_name, self::$arComponents);
	}

	return self::$arComponents;
}