• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/paysystem/manager.php
  • Класс: BitrixSalePaySystemManager
  • Вызов: Manager::getHandlerList
static function getHandlerList()
{
	$documentRoot = Application::getDocumentRoot();
	$result = array(
		'SYSTEM' => array(),
		'USER' => array()
	);

	foreach (self::getHandlerDirectories() as $type => $dir)
	{
		if (!Directory::isDirectoryExists($documentRoot.$dir))
		{
			continue;
		}

		$directory = new Directory($documentRoot.$dir);
		foreach ($directory->getChildren() as $handler)
		{
			if (!$handler->isDirectory())
			{
				continue;
			}

			$isDescriptionExist = false;
			/** @var Directory $handler */
			foreach ($handler->getChildren() as $item)
			{
				if ($item->isFile())
				{
					$data = array();
					$psTitle = '';
					$isAvailable = null;

					if (mb_strpos($item->getName(), '.description') !== false)
					{
						$handlerName = $handler->getName();

						include $item->getPath();

						if (array_key_exists('NAME', $data))
						{
							$psTitle = $data['NAME'].' ('.$handlerName.')';
							if (isset($data['IS_AVAILABLE']))
							{
								$isAvailable = $data['IS_AVAILABLE'];
							}
						}
						else
						{
							if ($psTitle == '')
							{
								$psTitle = $handlerName;
							}
							else
							{
								$psTitle .= ' ('.$handlerName.')';
							}

							$handlerName = str_replace(Path::normalize($documentRoot), '', $handler->getPath());
						}
						$group = (mb_strpos($type, 'SYSTEM') !== false) ? 'SYSTEM' : 'USER';

						if (!isset($result[$group][$handlerName]))
						{
							if ($isAvailable !== null
								&& $isAvailable === static::HANDLER_AVAILABLE_FALSE
							)
							{
								continue(2);
							}

							$result[$group][$handlerName] = $psTitle;
						}
						$isDescriptionExist = true;
						continue;
					}
				}
			}

			if (!$isDescriptionExist)
			{
				$group = (mb_strpos($type, 'SYSTEM') !== false) ? 'SYSTEM' : 'USER';
				$handlerName = str_replace($documentRoot, '', $handler->getPath());
				$result[$group][$handlerName] = $handler->getName();
			}
		}
	}

	$result['USER'] = array_merge(static::getRestHandlers(), $result['USER']);

	return $result;
}