Inherited Variables
Inherited Constants
Inherited Methods
Class Details
PHP support for the Libravatar.org service.
Using this class is easy. After including or requiring PEAR/libravatar.php simply do:
This would populate $url with the string: http://cdn.libravatar.org/avatar/4db84629c121f2d443d33bdb9fd149bc
A complicated lookup using all the options is:
- $options = array();
- $options['s'] = '40';
- $options['algorithm'] = 'sha256';
- $options['https'] = true;
- $options['d'] = 'http://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png';
Tags:
- author - Melissa Draper <melissa@meldraweb.com>
- version - Release: 0.1.1
- copyright - 2011 Services_Libravatar committers.
- link - http://pear.php.net/package/Services_Libravatar
- since - Class available since Release 0.1.0
- license - MIT License
[ Top ]
Class Variables
Class Methods
comparePriority
mixed comparePriority(
mixed
$a, mixed
$b)
[line 357]
Sorting function for record priorities.
Tags:
- return - The result of the comparison
- since - Method available since Release 0.1.0
- access - protected
Parameters:
- mixed $a - A mixed value passed by usort()
- mixed $b - A mixed value passed by usort()
[ Top ]
domainGet
string domainGet(
string
$identifier, [boolean
$https = false])
[line 225]
Grab the domain from the identifier.
Extract the domain from the Email or OpenID.
Tags:
- return - A string of the domain to use
- since - Method available since Release 0.1.0
- access - protected
Parameters:
- string $identifier - A string of the email address or openid URL
- boolean $https - If this is https, true.
[ Top ]
identiferHash
string identiferHash(
string
$identifier, [boolean
$https = false], [string
$hash = 'md5'])
[line 166]
Create a hash of the identifier.
Create a hash of the email address or openid passed in. Algorithm used for email address ONLY can be varied. Either md5 or sha256 are supported by the Libravatar API. Will be ignored for openid.
Tags:
- return - A string hash of the identifier.
- since - Method available since Release 0.1.0
- access - protected
Parameters:
- string $identifier - A string of the email address or openid URL
- boolean $https - If this is https, true.
- string $hash - A string of the hash algorithm type to make Uses the php implementation of hash() MD5 preferred for Gravatar fallback
[ Top ]
srvGet
string srvGet(
string
$domain, [boolean
$https = false])
[line 282]
Get the target to use.
Get the SRV record, filtered by priority and weight. If our domain has no SRV records, fall back to Libravatar.org
Tags:
- return - The target URL.
- since - Method available since Release 0.1.0
- access - protected
Parameters:
- string $domain - A string of the domain we extracted from the provided identifer with domainGet()
- boolean $https - Whether or not to look for https records
[ Top ]
url
string url(
string
$identifier, [array
$options = array()])
[line 92]
Composes a URL for the identifier and options passed in
Compose a full URL as specified by the Libravatar API, based on the email address or openid URL passed in, and the options specified.
Tags:
- return - A string of a full URL for an avatar image
- since - Method available since Release 0.1.0
- access - public
Parameters:
- string $identifier - a string of either an email address or an openid url
- array $options - an array of (bool) https, (string) algorithm (string) s or size, (string) d or default
[ Top ]