Generates the Gravatar URL.

@param string $type  - [avatar|profile] Get the requested user item
@param string $email - The user's email
@param array  $attr  - Extra attributes to set for the image request

@throws \Exception

@return string
963421
public function generateUrl($type, $email, array $attr = [])
    {
        if (!empty($email)) {
            $this->setEmail($email);
        }

        if (isset($attr['size'])) {
            $this->setSize($attr['size']);
        }

        if (isset($attr['imgset'])) {
            $this->setImageSet($attr['imgset']);
        }

        if (isset($attr['rating'])) {
            $this->setRating($attr['rating']);
        }

        $uri = '?';
        $ignore = ['email', 'hash', 'secure'];
        foreach ($this->_options as $k => $v) {
            if (!in_array($k, $ignore)) {
                $uri .= $k.'='.$v.'&';
            }
        }
        $uri = rtrim($uri, '&');

        $base = (($this->_options['secure']) ? self::BASE_HTTPS : self::BASE_HTTP);

        switch (strtolower($type)) {
        case 'avatar':
            $url = $base.'avatar/';
            break;
        case 'profile':
            $url = $base;
            break;
        default:
            throw new \Exception('Invalid URL type given! Must be avatar or profile!');
        }

        return $url.$this->getHash();
    }
344748
def get_gravatar(email, size=80, rating='g', default=None,
                 protocol=PROTOCOL):
    
    gravatar_protocols = {'http': 'http://www',
                          'https': 'https://secure'}
    url = '%s.gravatar.com/avatar/%s' % (
        gravatar_protocols[protocol],
        md5(email.strip().lower().encode('utf-8')).hexdigest())
    options = {'s': size, 'r': rating}
    if default:
        options['d'] = default

    url = '%s?%s' % (url, urlencode(options))
    return url.replace('&', '&amp;')
1204201
protected function buildUrl($type = 'email', $value)
    {
        $type = trim(strtolower($type));

        if (! in_array($type, ['ip', 'email', 'username'])) {
            throw new \InvalidArgumentException('Type of '.$type.' is not supported by the API');
        }

        $url = $this->apiUrl.'?'.$type.'='.urlencode($value).'&f=json';

        return $url;
    }
147772
public function Gravatar()
    {
        $gravatar = '';
        $use_gravatar = $this->getOption('use_gravatar');

        if ($use_gravatar) {
            $gravatar = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($this->Email)));
            $gravatarsize = $this->getOption('gravatar_size');
            $gravatardefault = $this->getOption('gravatar_default');
            $gravatarrating = $this->getOption('gravatar_rating');
            $gravatar .= '?' . http_build_query(array(
                's' => $gravatarsize,
                'd' => $gravatardefault,
                'r' => $gravatarrating,
            ));
        }

        return $gravatar;
    }
760026
public static function img($attr = null)
    {
        if (is_string($attr)) {
            $attr = array('src' => $attr);
        }

        return self::tag('img', $attr + array('alt' => ''), null, array_merge(self::$common_attrib,
            array('src','alt','width','height','border','usemap','onclick','onerror','onload')));
    }
357967
public function gravatar()
    {
        // Check for valid gravatar
        $gravCheck = 'http://www.gravatar.com/avatar/'. md5( strtolower( trim( $this->email ) ) ) .'.png?d=404';
        $response  = get_headers($gravCheck);

        // If a valid gravatar URL is found, use the gravatar image
        if ($response[0] != "HTTP/1.0 404 Not Found"){
            return 'http://www.gravatar.com/avatar/'. md5( strtolower( trim( $this->email ) ) ) .'.png?s=200&d=blank';
        }

        // If no other image is set, use the default
        return '/img/no_user.png';
    }
1329665
public function generate(string $type)
    {
        $this->public   = $type === 'public';
        $this->url      = $this->public ? $this->config->env['public'] : $this->config->env['local'];
        $this->url      = rtrim($this->url, '/');
        $this->root     = $this->config->root . ($this->public ? '/public' : '/local');
        $this->copyTheme($this->theme_dir, $this->root);
        // copy user files
        if (is_dir("{$this->config->paths['contents']}/file")) {
            Util::copyDirectory("{$this->config->paths['contents']}/file", $this->root);
        }

        // override articles url
        $url = $this->url;
        $this->articles = $this->articles->map(function ($article) use ($url) {
            $article->setUrl($url);
            return $article;
        });

        $env = $this->getEnvironment();
        IndexGenerator::generate($env);
        ArticleGenerator::generate($env);
        FeedGenerator::generate($env);
        TagPageGenerator::generate($env);
        UserPageGenerator::generate($env);
        ThemePageGenerator::generate($env);
    }
1179893
public function getClient($attr = '')
    {
        if ($attr == '') {
            return $this->client;
        }

        if (!isset($this->client[$attr])) {
            return self::UNKNOWN;
        }

        return $this->client[$attr];
    }
1339069
public function get_file($file, $type, $folder = '')
	{
		if ($file = $this->find_file($file, $type, $folder))
		{
			return $this->_asset_url.$file;
		}

		return false;
	}
301740
def avatar_url_from_email(email, size=64, default='retro', dns=False):
    

    if dns:
        # This makes an extra DNS SRV query, which can slow down our webapps.
        # It is necessary for libravatar federation, though.
        import libravatar
        return libravatar.libravatar_url(
            email=email,
            size=size,
            default=default,
        )
    else:
        params = _ordered_query_params([('s', size), ('d', default)])
        query = parse.urlencode(params)
        hash = md5(email.encode('utf-8')).hexdigest()
        return "https://seccdn.libravatar.org/avatar/%s?%s" % (hash, query)
677108
function attribute( $attr )
    {
        if ( $attr == "post" )
            return $_POST;
        if ( $attr == "get" )
            return $_GET;
        if ( $attr == "session" )
        {
            return eZSession::get();
        }
        $retValue = null;
        return $retValue;
    }
137607
public function getCoverUrl($id, $type)
    {
        switch ($type) {
            case self::ITEM_TYPE_ANIMATION:
                return $this->browser->getHost().'/'.$type.'/img/'.(ceil($id / 1000) * 1000).'/'.$id.'/1.jpg';
            case self::ITEM_TYPE_CINEMA:
                return $this->browser->getHost().'/'.$type.'/img/'.(ceil($id / 10000) * 10000).'/'.$id.'/1.jpg';
            default:
                return;
        }
    }
754881
public function getUrl( $email ){
		$hash	= md5( strtolower( trim( $email ) ) );
		$query	= array(
			's'	=> $this->size,
			'd'	=> $this->default,
			'r'	=> $this->rate,
		);
		return $this->url.$hash.'?'.http_build_query( $query, NULL, '&amp;' );
	}
1075656
public function getProfileUrl($email, $format = 'json', array $options = [])
    {
        $url = 'https://www.gravatar.com/';

        $url .= md5(strtolower(trim($email))).'.';
        $url .= in_array($format, ['json', 'xml', 'php', 'vcf', 'qr']) ? $format : 'json';

        if ($options) {
            $url .= '?'.http_build_query($options);
        }

        return $url;
    }
1107092
public function getAttributeValue($attr, &$request = null) {
        $url = "entities/{$this->_id}/attrs/$attr/value";

        if ($this->_type) {
            $url .= "?type={$this->_type}";
        }

        return $this->_orion->get($url, $request, "text/plain","text/plain");
    }
518663
function attribute( $attr )
    {
        if ( isset( $this->Attributes[$attr] ) )
        {
            return $this->$attr();
        }
        else if ( $attr == 'wwwdir' )
        {
            return $this->wwwDir();
        }
        else if ( $attr == 'sitedir' )
        {
            return $this->siteDir();
        }
        else if ( $attr == 'indexfile' )
        {
            return $this->indexFile();
        }
        else if ( $attr == 'indexdir' )
        {
            return $this->indexDir();
        }
        else if ( $attr = 'querystring' )
        {
            return $this->queryString();
        }

        eZDebug::writeError( "Attribute '$attr' does not exist", __METHOD__ );
        return null;
    }
460842
public function getUri()
    {
        if (empty($this->getConfig('email')) === true) {
            throw new \RuntimeException('No email specified.');
        }
        $uri = 'http://www.gravatar.com/avatar/' . md5(strtolower(trim($this->getConfig('email')))) . '.jpg';
        $args = http_build_query([
            's' => $this->getConfig('size'),
            'd' => $this->getConfig('defaultUri'),
        ]);
        if (empty($args) === false) {
            $uri .= '?' . $args;
        }
        return $uri;
    }