CBPHelper::__ConvertAnchorTag

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPHelper
  4. __ConvertAnchorTag
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/helper.php
  • Класс: CBPHelper
  • Вызов: CBPHelper::__ConvertAnchorTag
static function __ConvertAnchorTag($url, $text = '', $serverName = '')
{
	if (is_array($url))
	{
		$text = isset($url[2]) ? $url[2] : $url[1];
		$url = $url[1];
		$serverName = static::$serverName;
	}

	$scheme = CMain::IsHTTPS() ? 'https' : 'http';

	if (mb_substr($url, 0, 1) != "/" && !preg_match("/^(http|news|https|ftp|aim|mailto):///i".BX_UTF_PCRE_MODIFIER, $url))
		$url = $scheme.'://'.$url;
	if (!preg_match("/^(http|https|news|ftp|aim)://[-_:.a-z0-9@]+/i".BX_UTF_PCRE_MODIFIER, $url))
		$url = $serverName.$url;
	if (!preg_match("/^(http|news|https|ftp|aim|mailto):///i".BX_UTF_PCRE_MODIFIER, $url))
		$url = $scheme.'://'.$url;

	$url = str_replace(' ', '%20', $url);

	if ($text <> '' && $text !== $url)
	{
		return $text." ( ".$url." )";
	}

	return $url;
}

Добавить комментарий