View/Helper/Gravatar.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_View
- Subpackage
- Helper
- Version
- $Id: Doctype.php 16971 2009-07-22 18:05:45Z mikaelkael $
\Zend_View_Helper_Gravatar
Helper for retrieving avatars from gravatar.com
- Parent(s)
- \Zend_View_Helper_HtmlElement < \Zend_View_Helper_Abstract
- 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
Constants
Properties

string $_closingBracket = null
nullDetails- Type
- string
- Inherited_from
- \Zend_View_Helper_HtmlElement::$$_closingBracket

array $_options = array('img_size' => 80, 'default_img' => self::DEFAULT_MM, 'rating' => self::RATING_G, 'secure' => null)Options
array('img_size' => 80, 'default_img' => self::DEFAULT_MM, 'rating' => self::RATING_G, 'secure' => null)Details- Type
- array

\Zend_View_Interface $view = nullView object
Inherited from: \Zend_View_Helper_Abstract::$$view\Zend_View_Helper_HtmlElement::$$viewnullDetails- Type
- \Zend_View_Interface
- Inherited_from
- \Zend_View_Helper_Abstract::$$view
- Inherited_from
- \Zend_View_Helper_HtmlElement::$$view
Methods

_getAvatarUrl() : stringGet avatar url (including size, rating and default image oprions)
| Type | Description |
|---|---|
| string |

_htmlAttribs(array $attribs) : stringConverts an associative array to a string of tag attributes.
Inherited from: \Zend_View_Helper_HtmlElement::_htmlAttribs()| Name | Type | Description |
|---|---|---|
| $attribs | array | From this array, each key-value pair is converted to an attribute name and value. |
| Type | Description |
|---|---|
| string | The XHTML for the attributes. |
- Access
- public

_normalizeId(string $value) : string
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| string |

_setSrcAttribForImg() : voidSet src attrib for image.
You shouldn't set a own url value! It sets value, uses protected method _getAvatarUrl.
If already exsist overwritten.

direct() : voidStrategy pattern: currently unutilized
Inherited from: \Zend_View_Helper_Abstract::direct()\Zend_View_Helper_HtmlElement::direct()
getAttribs() : arrayGet 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!
| Type | Description |
|---|---|
| array |

getClosingBracket() : stringGet the tag closing bracket
Inherited from: \Zend_View_Helper_HtmlElement::getClosingBracket()| Type | Description |
|---|---|
| string |

gravatar(string | null $email = "", null | array $options = array(), array $attribs = array()) : \Zend_View_Helper_GravatarReturns 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
| Name | Type | Description |
|---|---|---|
| string | null | Email adress. |
|
| $options | null | array | Options |
| $attribs | array | Attributes for image tag (title, alt etc.) |
| Type | Description |
|---|---|
| \Zend_View_Helper_Gravatar |
- See
- \global\http://pl.gravatar.com/site/implement/url
- See
- \global\http://pl.gravatar.com/site/implement/url

setAttribs(array $attribs) : \Zend_View_Helper_GravatarSet 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().
| Name | Type | Description |
|---|---|---|
| $attribs | array |
| Type | Description |
|---|---|
| \Zend_View_Helper_Gravatar |

setDefaultImg(string $defaultImg) : \Zend_View_Helper_GravatarSet default img
Can be either an absolute URL to an image, or one of the DEFAULT_* constants
| Name | Type | Description |
|---|---|---|
| $defaultImg | string |
| Type | Description |
|---|---|
| \Zend_View_Helper_Gravatar |

setEmail(string $email) : \Zend_View_Helper_GravatarSet email adress
| Name | Type | Description |
|---|---|---|
| string |
| Type | Description |
|---|---|
| \Zend_View_Helper_Gravatar |

setImgSize(int $imgSize) : \Zend_View_Helper_GravatarSet img size in pixels
| Name | Type | Description |
|---|---|---|
| $imgSize | int | Size of img must be between 1 and 512 |
| Type | Description |
|---|---|
| \Zend_View_Helper_Gravatar |

setOptions(array $options) : \Zend_View_Helper_GravatarConfigure state
| Name | Type | Description |
|---|---|---|
| $options | array |
| Type | Description |
|---|---|
| \Zend_View_Helper_Gravatar |

setRating(string $rating) : voidSet rating value
Must be one of the RATING_* constants
| Name | Type | Description |
|---|---|---|
| $rating | string | Value for rating. Allowed values are: g, px, r,x |
| Exception | Description |
|---|---|
| \Zend_View_Exception |

setSecure(bool $flag) : \Zend_View_Helper_GravatarLoad from an SSL or No-SSL location?
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_View_Helper_Gravatar |

setView(\Zend_View_Interface $view) : \Zend_View_Helper_AbstractSet the View object
Inherited from: \Zend_View_Helper_Abstract::setView()\Zend_View_Helper_HtmlElement::setView()| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| \Zend_View_Helper_Abstract |