Utils/Element.php
/**
     * Configure a hyperlink
     *
     * @param $attributes
     * @param array $settings
     * @return string the linked text
     */
Configure a hyperlink
@param $attributes
@param array $settings
@return string the linked text
Configure a hyperlink @param $attributes @param array $settings @return string the linked text
protected static function aElement($attributes, $settings = array())
    {
        if (empty($attributes['href'])) {
            $attributes['href'] = strip_tags($settings['content']);
        }
        if (empty($settings['content'])) {
            $settings['content'] = $attributes['href'];
        }
        $href_content_eq = $settings['content'] === $attributes['href'];
        if (strpos($attributes['href'], '@') !== false && strpos($attributes['href'], '//') === false) {
            $address            = str_replace('mailto:', '', $attributes['href']);
            $attributes['href'] = StringUtils::encodeText('mailto:' . $address);
            if ($href_content_eq) {
                $settings['content'] = StringUtils::encodeText($address);
            }
        } else if ($href_content_eq && strpos($settings['content'], '//') !== false) {
            $settings['content'] = substr($settings['content'], strpos($settings['content'], '//') + 2);
            if (substr_count($settings['content'], '/') === 1) {
                $settings['content'] = rtrim($settings['content'], '/');
            }
        } else if (preg_match('~^(\(|\+){0,2}[\d\)\- ]{6,}+$~', $settings['content'])) {
            $protocol           = 'tel';
            $attributes['href'] = str_replace(array('tel:', ' ', ')', '(', '-'), '', $attributes['href']);
            if (strpos($attributes['href'], '00') !== false) {
                $attributes['href'] = '+' . substr($attributes['href'], 2);
            }
            $attributes['href'] = $protocol . ':' . str_replace(array('tel:', ' ', ')', '('), '', $attributes['href']);
        }
        return self::build($attributes, $settings);
    }
protected static function aElement ( $ attributes , $ settings = array ( ) ) { if ( empty ( $ attributes [ 'href' ] ) ) { $ attributes [ 'href' ] = strip_tags ( $ settings [ 'content' ] ) ; } if ( empty ( $ settings [ 'content' ] ) ) { $ settings [ 'content' ] = $ attributes [ 'href' ] ; } $ href_content_eq = $ settings [ 'content' ] === $ attributes [ 'href' ] ; if ( strpos ( $ attributes [ 'href' ] , '@' ) !== false && strpos ( $ attributes [ 'href' ] , '//' ) === false ) { $ address = str_replace ( 'mailto:' , '' , $ attributes [ 'href' ] ) ; $ attributes [ 'href' ] = StringUtils :: encodeText ( 'mailto:' . $ address ) ; if ( $ href_content_eq ) { $ settings [ 'content' ] = StringUtils :: encodeText ( $ address ) ; } } else if ( $ href_content_eq && strpos ( $ settings [ 'content' ] , '//' ) !== false ) { $ settings [ 'content' ] = substr ( $ settings [ 'content' ] , strpos ( $ settings [ 'content' ] , '//' ) + 2 ) ; if ( substr_count ( $ settings [ 'content' ] , '/' ) === 1 ) { $ settings [ 'content' ] = rtrim ( $ settings [ 'content' ] , '/' ) ; } } else if ( preg_match ( '~^(\(|\+){0,2}[\d\)\- ]{6,}+$~' , $ settings [ 'content' ] ) ) { $ protocol = 'tel' ; $ attributes [ 'href' ] = str_replace ( array ( 'tel:' , ' ' , ')' , '(' , '-' ) , '' , $ attributes [ 'href' ] ) ; if ( strpos ( $ attributes [ 'href' ] , '00' ) !== false ) { $ attributes [ 'href' ] = '+' . substr ( $ attributes [ 'href' ] , 2 ) ; } $ attributes [ 'href' ] = $ protocol . ':' . str_replace ( array ( 'tel:' , ' ' , ')' , '(' ) , '' , $ attributes [ 'href' ] ) ; } return self :: build ( $ attributes , $ settings ) ; }
Configure a hyperlink
 @param $attributes
 @param array $settings
 @return string the linked text
Configure a hyperlink @param $attributes @param array $settings @return string the linked text
// emails but not urls with password