CBPHelper :: __ConvertAnchorTag: Bitrix method

      
<?php 
//  CBPHelper :: __ConvertAnchorTag()
//  /dist/bitrix/modules/bizproc/classes/general/helper.php:1770

    
public 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 (
substr($url01) != "/" && !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):\/\/[-_:[email protected]]+/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 (
strlen($text) > && $text !== $url)
        {
            return 
$text." ( ".$url." )";
        }

        return 
$url;
    }