Returns rendered image HTML code.
@access		public
@param		string		$email			Email address to get Gravatar image for
@param		array		$attributes		Additional HTML tag attributes
@return		string		Image HTML code
505976
public function renderImage( $email, $attributes = array() ){
		$attributes['src']		= $this->getUrl( $email );
		$attributes['width']	= $this->size;
		$attributes['height']	= $this->size;
		return UI_HTML_Tag::create( 'img', NULL, $attributes );
	}
1289207
public function getAttributesHTML($attributes)
    {
        // Initialise:
        
        $markup = [];
        
        // Remove Empty Attributes:
        
        $attributes = array_filter($attributes, function ($v) {
            return ($v || $v === 0 || $v === '0');
        });
        
        // Render Remaining Attributes:
        
        foreach ($attributes as $name => $value) {
            $markup[] = sprintf('%s="%s"', $name, ($value === true) ? $name : Convert::raw2att($value));
        }
        
        // Answer Markup:
        
        return implode(' ', $markup);
    }
743311
public function mailto($email, $title = null, $attributes = [])
    {
        $email = $this->email($email);

        $title = $title ?: $email;

        $email = $this->obfuscate('mailto:') . $email;

        return '<a href="' . $email . '"' . $this->attributes($attributes) . '>' . $this->entities($title) . '</a>';
    }
400668
public static function get_attribute_html( $attributes = array() ) {
		$html = '';

		if ( ! $attributes ) {
			return $html;
		}

		foreach ( $attributes as $key => $attribute ) {
			$html .= ' ' . esc_attr( $key ) . '="' . esc_attr( $attribute ) . '"';
		}

		return $html;
	}
1287988
protected static function _renderImage($src, $className, array $attributes = array())
        {
            if (is_array($attributes['class'])) {
                $attributes['class'][] = $className;
            } else {
                $attributes['class'] .= ' ' . $className;
            }

            return sprintf('<img src="%s"%s />', Html::escape($src), Html::attributes($attributes));
        }
154991
public static function encodeEmail($email)
    {
        if (($pos = strpos($email, '@')) === false) {
            return;
        }
        if (!preg_match('~[\x80-\xFF]~', $email)) {
            return $email;
        }
        $domain = substr($email, ++$pos);
        return substr($email, 0, $pos) . idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46);
    }
100568
public static function attrsToHtml(array $attributes)
    {
        $attrs = [];

        foreach ($attributes as $key => $value) {
            $element = is_numeric($key) ?
                (string)$value :
                (is_null($value) ? (string)$key : $key . '="' . e($value) . '"');
            if (!empty($element)) {
                $attrs[] = $element;
            }
        }

        return count($attrs) ? ' ' . implode(' ', $attrs) : '';
    }
736586
private function getParams($email)
    {
        $params = $this->cachedParams;

        if (is_null($this->cachedParams)) {
            $params['s'] = $this->getSize();
            $params['r'] = $this->getRating();

            if ($this->getDefaultImage() !== false) {
                $params['d'] = $this->getDefaultImage();
            }

            $this->cachedParams = $params;
        }

        if (empty($email)) {
            $params['f'] = 'y';
        }

        return (array) $params;
    }
858707
public function img($attributes = null)
    {
        if ($image = $this->transformed) {
            if ($image && isset($image['url'])) {
                $lazyLoad = false;
                if (isset($attributes['lazyLoad'])) {
                    $lazyLoad = $attributes['lazyLoad'];
                    unset($attributes['lazyLoad']); // unset to remove it from the html output
                }
                $tagAttributes = $this->getTagAttributes($attributes);

                return Template::raw('<img ' . ($lazyLoad ? $this->lazyLoadPrefix : '') . 'src="' . $image['url'] . '" ' . $tagAttributes . ' />');
            }
        }

        return null;
    }
1013874
public function renderAttribute($attribute, array $params)
    {
        $twig = $this->getTwig(new EmailTemplateLoader([
            'attributeName' => $attribute,
        ]));

        try {
            $result = $twig->render($this->shortcut, $params);
        } catch (\Exception $e) {
            $result = 'Error compiling email ' . $attribute . ': ' . $e->getMessage();
        }

        return $result;
    }
1219197
public function send(Email $email)
    {
        $message = [
            'html' => $email->message(Email::MESSAGE_HTML),
            'text' => $email->message(Email::MESSAGE_TEXT),
            'subject' => mb_decode_mimeheader($email->getSubject()), // Decode because SendGrid is encoding
            'from' => key($email->getFrom()),
            'fromname' => current($email->getFrom()),
            'to' => [],
            'toname' => [],
            'cc' => [],
            'ccname' => [],
            'bcc' => [],
            'bccname' => [],
            'replyto' => $email->getReplyTo() ? array_values($email->getReplyTo())[0] : key($email->getFrom()),
        ];
        // Add recipients
        $recipients = [
            'to' => $email->getTo(),
            'cc' => $email->getCc(),
            'bcc' => $email->getBcc()
        ];
        foreach ($recipients as $type => $emails) {
            foreach ($emails as $mail => $name) {
                $message[$type][] = $mail;
                $message[$type . 'name'][] = $name;
            }
        }

        // Create a new scoped Http Client
        $this->http = new Client([
            'host' => 'api.sendgrid.com',
            'scheme' => 'https',
            'headers' => [
                'User-Agent' => 'CakePHP SendGrid Plugin'
            ]
        ]);

        $message = $this->_attachments($email, $message);

        return $this->_send($message);
    }
238774
protected function renderAttributes(array $attributes)
    {
        foreach ($attributes as $name => $value) {
            if (is_array($value)) {
                $value = implode(' ', (array) $value);
            }
            $attributes[$name] = $name . '="' . htmlspecialchars($value, ENT_QUOTES, 'UTF-8') . '"';
        }

        return implode(' ', $attributes);
    }
627618
public function attr(array $attributes)
    {
        $result = '';

        foreach ($attributes as $attribute => $value) {
            $result .= ' '.(is_int($attribute) ? $value : $attribute.'="'.str_replace('"', '&quot;', $value).'"');
        }

        return $result;
    }
609011
public function getAutoregisterModel($email)
    {
        if(!$this->isRegistrationEnabled()) {
            return null;
        }

        $ret = User::USER_AUTOREGISTER; // default if there is no whitelist defined at all

        // try to match against the whitelist
        if( ($xml = $this->get_sxml_structure()) !== false) {
            $wl = $xml->xpath('/record/registration/auto_register/email_whitelist');
            if($wl !== false && count($wl) === 1) {
                $ret = null;    // there IS a whitelist, the email must match

                foreach ($wl[0]->xpath('email') as $element) {
                    if (preg_match($element['pattern'], $email) === 1) {
                        return (string)$element['user_model'];
                    }
                }
            }
        }

        return $ret;
    }
69634
protected function setHref(Attributes $attributes)
    {
        if (substr($this->url, 0, 7) == 'mailto:') {
            if (version_compare(VERSION . '.' . BUILD, '3.5.5', '>=')) {
                $url = \StringUtil::encodeEmail($this->url);
            } else {
                $url = \String::encodeEmail($this->url);
            }
            $attributes->setAttribute('href', $url);
        } else {
            $attributes->setAttribute('href', ampersand($this->url));
        }
    }
605941
public static function stripEmail($email) {
		if (strpos($email, '<') && substr($email, -1) == '>') {
			return substr($email, strpos($email, '<') + 1, (strlen($email) - strpos($email, '<')) - 2);
		}
		return $email;
	}
580138
protected function renderAttributes($attributes)
    {
        if (count((array) $attributes) == 0) {
            return '';
        }

        $return = [];

        foreach ($attributes as $key => $value) {
            $return[] = $key . '="' . $value . '"';
        }

        return ' ' . implode(' ', $return);
    }