• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/component_util.php
  • Класс: CComponentUtil
  • Вызов: CComponentUtil::isComponent
static function isComponent($componentPath)
{
	$bDirectoryExists = file_exists($_SERVER["DOCUMENT_ROOT"].$componentPath)
		&& is_dir($_SERVER["DOCUMENT_ROOT"].$componentPath);
	if(!$bDirectoryExists)
		return false;

	$bComponentExists = file_exists($_SERVER["DOCUMENT_ROOT"].$componentPath."/component.php")
		&& is_file($_SERVER["DOCUMENT_ROOT"].$componentPath."/component.php");
	if($bComponentExists)
		return true;

	$bClassExists = file_exists($_SERVER["DOCUMENT_ROOT"].$componentPath."/class.php")
		&& is_file($_SERVER["DOCUMENT_ROOT"].$componentPath."/class.php");
	if($bClassExists)
		return true;

	return false;
}