Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Zend_View_Helper_Gravatar Class Reference

Public Member Functions

 gravatar ($email="", $options=array(), $attribs=array())
 Returns an avatar from gravatar's service.
 
 setOptions (array $options)
 Configure state.
 
 getImgSize ()
 Get img size.
 
 setImgSize ($imgSize)
 Set img size in pixels.
 
 getDefaultImg ()
 Get default img.
 
 setDefaultImg ($defaultImg)
 Set default img.
 
 setRating ($rating)
 Set rating value.
 
 getRating ()
 Get rating value.
 
 setEmail ($email)
 Set email adress.
 
 getEmail ()
 Get email adress.
 
 setSecure ($flag)
 Load from an SSL or No-SSL location?
 
 getSecure ()
 Get an SSL or a No-SSL location.
 
 getAttribs ()
 Get attribs of image.
 
 setAttribs (array $attribs)
 Set attribs for image tag.
 
 getImgTag ()
 Return valid image tag.
 
 __toString ()
 Return valid image tag.
 
- Public Member Functions inherited from Zend_View_Helper_HtmlElement
 getClosingBracket ()
 Get the tag closing bracket.
 
- Public Member Functions inherited from Zend_View_Helper_Abstract
 setView (Zend_View_Interface $view)
 Set the View object.
 
 direct ()
 Strategy pattern: currently unutilized.
 

Public Attributes

const GRAVATAR_URL = 'http://www.gravatar.com/avatar'
 URL to gravatar service.
 
const GRAVATAR_URL_SECURE = 'https://secure.gravatar.com/avatar'
 Secure URL to gravatar service.
 
const RATING_G = 'g'
 Gravatar rating.
 
const RATING_PG = 'pg'
 
const RATING_R = 'r'
 
const RATING_X = 'x'
 
const DEFAULT_404 = '404'
 Default gravatar image value constants.
 
const DEFAULT_MM = 'mm'
 
const DEFAULT_IDENTICON = 'identicon'
 
const DEFAULT_MONSTERID = 'monsterid'
 
const DEFAULT_WAVATAR = 'wavatar'
 
- Public Attributes inherited from Zend_View_Helper_HtmlElement
const EOL = "\n"
 EOL character.
 
- Public Attributes inherited from Zend_View_Helper_Abstract
 $view = null
 

Protected Member Functions

 _getGravatarUrl ()
 Get URL to gravatar's service.
 
 _getAvatarUrl ()
 Get avatar url (including size, rating and default image oprions)
 
 _setSrcAttribForImg ()
 Set src attrib for image.
 
- Protected Member Functions inherited from Zend_View_Helper_HtmlElement
 _isXhtml ()
 Is doctype XHTML?
 
 _isHtml5 ()
 Is doctype HTML5?
 
 _isStrictDoctype ()
 Is doctype strict?
 
 _htmlAttribs ($attribs)
 Converts an associative array to a string of tag attributes.
 
 _normalizeId ($value)
 Normalize an ID.
 

Protected Attributes

 $_options
 
 $_email
 
 $_attribs
 
- Protected Attributes inherited from Zend_View_Helper_HtmlElement
 $_closingBracket = null
 

Member Function Documentation

__toString ( )

Return valid image tag.

Returns
string
_getAvatarUrl ( )
protected

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

Returns
string
_getGravatarUrl ( )
protected

Get URL to gravatar's service.

Returns
string URL
_setSrcAttribForImg ( )
protected

Set src attrib for image.

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

If already exsist overwritten.

getAttribs ( )

Get attribs of image.

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
getDefaultImg ( )

Get default img.

Returns
string
getEmail ( )

Get email adress.

Returns
string
getImgSize ( )

Get img size.

Returns
int The img size
getImgTag ( )

Return valid image tag.

Returns
string
getRating ( )

Get rating value.

Returns
string
getSecure ( )

Get an SSL or a No-SSL location.

Returns
bool
gravatar (   $email = "",
  $options = array(),
  $attribs = array() 
)

Returns an avatar from gravatar's service.

$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 Also
http://pl.gravatar.com/site/implement/url
http://pl.gravatar.com/site/implement/url More information about gravatar's service.
Parameters
string | null$emailEmail adress.
null | array$optionsOptions
array$attribsAttributes for image tag (title, alt etc.)
Returns
Zend_View_Helper_Gravatar
setAttribs ( array  $attribs)

Set attribs for image tag.

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
array$attribs
Returns
Zend_View_Helper_Gravatar
setDefaultImg (   $defaultImg)

Set default img.

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

Parameters
string$defaultImgMore information about default image. Zend_View_Helper_Gravatar
setEmail (   $email)

Set email adress.

Parameters
string$email
Returns
Zend_View_Helper_Gravatar
setImgSize (   $imgSize)

Set img size in pixels.

Parameters
int$imgSizeSize of img must be between 1 and 512
Returns
Zend_View_Helper_Gravatar
setOptions ( array  $options)

Configure state.

Parameters
array$options
Returns
Zend_View_Helper_Gravatar
setRating (   $rating)

Set rating value.

Must be one of the RATING_* constants

Parameters
string$ratingValue for rating. Allowed values are: g, px, r,x More information about rating. Zend_View_Exception
setSecure (   $flag)

Load from an SSL or No-SSL location?

Parameters
bool$flag
Returns
Zend_View_Helper_Gravatar

Member Data Documentation

$_attribs
protected
$_email
protected
$_options
protected
Initial value:
= array(
'img_size' => 80,
'default_img' => self::DEFAULT_MM,
'rating' => self::RATING_G,
'secure' => null,
)
const DEFAULT_404 = '404'

Default gravatar image value constants.

const DEFAULT_IDENTICON = 'identicon'
const DEFAULT_MM = 'mm'
const DEFAULT_MONSTERID = 'monsterid'
const DEFAULT_WAVATAR = 'wavatar'
const GRAVATAR_URL = 'http://www.gravatar.com/avatar'

URL to gravatar service.

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

Secure URL to gravatar service.

const RATING_G = 'g'

Gravatar rating.

const RATING_PG = 'pg'
const RATING_R = 'r'
const RATING_X = 'x'