• Модуль: pull
  • Путь к файлу: ~/bitrix/modules/pull/lib/loader.php
  • Класс: BitrixPullLoader
  • Вызов: Loader::autoLoad
static function autoLoad($className)
{
	$className = ltrim($className, "\"); // fix web env
	$className = str_replace("\", '/', $className);

	if (preg_match("#[^\\/a-zA-Z0-9_]#", $className))
	{
		return;
	}

	$fileParts = explode("/", $className);
	if (count($fileParts) < 2)
	{
		return;
	}

	$firstNamespace = mb_strtolower($fileParts[0]);
	$secondNamespace = mb_strtolower($fileParts[1]);

	if (
		$firstNamespace === "protobuf" ||
		$firstNamespace === "google" && $secondNamespace === "protobuf" ||
		$firstNamespace === "gpbmetadata" && $secondNamespace === "google"
	)
	{
		$documentRoot = $documentRoot = rtrim($_SERVER["DOCUMENT_ROOT"], "/\");
		$filePath = $documentRoot."/bitrix/modules/pull/vendor/".implode("/", $fileParts).".php";

		if (file_exists($filePath))
		{
			require_once($filePath);
		}
	}
}