• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/textparser.php
  • Класс: CTextParser
  • Вызов: CTextParser::convert_project
public function convert_project(array $matches): string
{
	static $projectTypeList = [];
	static $extranetProjectIdList = null;
	static $pathToProject = null;

	$projectName = $matches[2];
	$projectId = (int)$matches[1];

	$renderParams = [
		'PROJECT_ID' => $projectId,
		'PROJECT_NAME' => $projectName,
	];

	if ($projectId > 0)
	{
		if ($extranetProjectIdList === null)
		{
			$extranetSiteId = (BitrixMainLoader::includeModule('extranet') ? CExtranet::getExtranetSiteId() : '');
			if (!empty($extranetSiteId))
			{
				$res = BitrixSocialnetworkWorkgroupSiteTable::getList([
					'filter' => [
						'=SITE_ID' => $extranetSiteId,
					],
					'select' => [ 'GROUP_ID' ],
				]);

				while ($projectSiteFields = $res->fetch())
				{
					$extranetProjectIdList[] = (int)$projectSiteFields['GROUP_ID'];
				}
			}
		}

		$type = false;

		if (isset($projectTypeList[$projectId]))
		{
			$type = $projectTypeList[$projectId];
		}
		else
		{
			if (!empty($extranetProjectIdList))
			{
				$type = (in_array($projectId, $extranetProjectIdList, true) ? 'extranet' : false);
			}

			$projectTypeList[$projectId] = $type;
		}

		if ($pathToProject === null)
		{
			// then replace to BitrixSocialnetworkHelperPath::get('group_path_template')
			$pathToProject = Option::get('socialnetwork', 'group_path_template', SITE_DIR . 'workgroups/group/#group_id#/', SITE_ID);
		}

		switch ($type)
		{
			case 'extranet':
				$classAdditional = ' blog-p-user-name-extranet';
				break;
			default:
				$classAdditional = '';
		}

		$renderParams['CLASS_ADDITIONAL'] = $classAdditional;
		$renderParams['PATH_TO_PROJECT'] = $pathToProject;
	}

	$res = $this->render_project($renderParams);

	return $this->defended_tags($res);
}