Helper for retrieving avatars from gravatar.com

package Zend_View
subpackage Helper
copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
link http://pl.gravatar.com/site/implement/url
inherited_from \Zend_View_Helper_HtmlElement

 Methods

Return valid image tag

__toString() : string

Returns

string

Strategy pattern: currently unutilized

direct() : void
Inherited
inherited_from \Zend_View_Helper_Interface::direct()

Get attribs of image

getAttribs() : array

Warning! If you set src attrib, you get it, but this value will be overwritten in protected method _setSrcAttribForImg(). And finally your get other src value!

Returns

array

Get the tag closing bracket

getClosingBracket() : string
Inherited

Returns

string

Get default img

getDefaultImg() : string

Returns

string

Get email adress

getEmail() : string

Returns

string

Get img size

getImgSize() : integer

Returns

integerThe img size

Return valid image tag

getImgTag() : string

Returns

string

Get rating value

getRating() : string

Returns

string

Get an SSL or a No-SSL location

getSecure() : boolean

Returns

boolean

Returns an avatar from gravatar's service.

gravatar(string|null $email = "", null|array $options = array(), array $attribs = array()) : \Zend_View_Helper_Gravatar

$options may include the following:

  • 'img_size' int height of img to return
  • 'default_img' string img to return if email adress has not found
  • 'rating' string rating parameter for avatar
  • 'secure' bool load from the SSL or Non-SSL location
see
see More information about gravatar's service.

Parameters

$email

stringnull

Email adress.

$options

nullarray

Options

$attribs

array

Attributes for image tag (title, alt etc.)

Returns

\Zend_View_Helper_Gravatar

Set attribs for image tag

setAttribs(array $attribs) : \Zend_View_Helper_Gravatar

Warning! You shouldn't set src attrib for image tag. This attrib is overwritten in protected method _setSrcAttribForImg(). This method(_setSrcAttribForImg) is called in public method getImgTag().

Parameters

$attribs

array

Returns

\Zend_View_Helper_Gravatar

Set default img

setDefaultImg(string $defaultImg) : \Zend_View_Helper_Gravatar

Can be either an absolute URL to an image, or one of the DEFAULT_* constants

link More information about default image.

Parameters

$defaultImg

string

Returns

\Zend_View_Helper_Gravatar

Set email adress

setEmail(string $email) : \Zend_View_Helper_Gravatar

Parameters

$email

string

Returns

\Zend_View_Helper_Gravatar

Set img size in pixels

setImgSize(integer $imgSize) : \Zend_View_Helper_Gravatar

Parameters

$imgSize

integer

Size of img must be between 1 and 512

Returns

\Zend_View_Helper_Gravatar

Configure state

setOptions(array $options) : \Zend_View_Helper_Gravatar

Parameters

$options

array

Returns

\Zend_View_Helper_Gravatar

Set rating value

setRating(string $rating) 

Must be one of the RATING_* constants

link More information about rating.

Parameters

$rating

string

Value for rating. Allowed values are: g, px, r,x

Exceptions

\Zend_View_Exception

Load from an SSL or No-SSL location?

setSecure(boolean $flag) : \Zend_View_Helper_Gravatar

Parameters

$flag

boolean

Returns

\Zend_View_Helper_Gravatar

Set the View object

setView(\Zend_View_Interface $view) : \Zend_View_Helper_Abstract
Inherited
inherited_from \Zend_View_Helper_Interface::setView()

Parameters

$view

\Zend_View_Interface

Returns

\Zend_View_Helper_Abstract

Get avatar url (including size, rating and default image oprions)

_getAvatarUrl() : string

Returns

string

Get URL to gravatar's service.

_getGravatarUrl() : string

Returns

stringURL

Converts an associative array to a string of tag attributes.

_htmlAttribs(array $attribs) : string
Inherited
access public

Parameters

$attribs

array

From this array, each key-value pair is converted to an attribute name and value.

Returns

stringThe XHTML for the attributes.

Is doctype HTML5?

_isHtml5() : boolean
Inherited

Returns

boolean

Is doctype strict?

_isStrictDoctype() : boolean
Inherited

Returns

boolean

Is doctype XHTML?

_isXhtml() : boolean
Inherited

Returns

boolean

Normalize an ID

_normalizeId(string $value) : string
Inherited

Parameters

$value

string

Returns

string

Set src attrib for image.

_setSrcAttribForImg() 

You shouldn't set a own url value! It sets value, uses protected method _getAvatarUrl.

If already exsist overwritten.

 Properties

 

View object

$view : \Zend_View_Interface

Default

null
 

Attributes for HTML image tag

$_attribs : array

Default

 

The tag closing bracket

$_closingBracket : string

Default

null
   

Options

$_options : array

Default

array('img_size' => 80, 'default_img' => self::DEFAULT_MM, 'rating' => self::RATING_G, 'secure' => null)

 Constants

 

Default gravatar image value constants

DEFAULT_404 = '404' 
 

DEFAULT_IDENTICON

DEFAULT_IDENTICON = 'identicon' 
 

DEFAULT_MM

DEFAULT_MM = 'mm' 
 

DEFAULT_MONSTERID

DEFAULT_MONSTERID = 'monsterid' 
 

DEFAULT_WAVATAR

DEFAULT_WAVATAR = 'wavatar' 
 

EOL character

EOL = "\n" 
 

URL to gravatar service

GRAVATAR_URL = 'http://www.gravatar.com/avatar' 
 

Secure URL to gravatar service

GRAVATAR_URL_SECURE = 'https://secure.gravatar.com/avatar' 
 

Gravatar rating

RATING_G = 'g' 
 

RATING_PG

RATING_PG = 'pg' 
 

RATING_R

RATING_R = 'r' 
 

RATING_X

RATING_X = 'x'